Skip to content

Commit 8e8276f

Browse files
authored
Feat/local versions (#103)
* feat: add agents.yaml project debugger * feat: add Git CI and Workbench resource editing * Apply project revision 8e88368b5b94 * Apply project revision 9ff30a1f81b6 * Apply project revision 0d6bdbe7b55b * Apply project revision b8f89d8ab580 * feat: add Workbench resource and Git version management * feat: replace Git versioning with local project snapshots Migrate CLI and Workbench version management to the shared @openagentpack/project-versions package, backed by lock-protected, content-addressed YAML snapshots. - remove Git-specific init/apply options and the local-git package - share enable, list, preview, restore, and post-Apply versioning - preserve validation, redaction, atomic restore, and mutation coordination - update APIs, Workbench UI, documentation, tests, and release tooling * feat: add directory projects and local snapshot versions * feat(project): support agent-owned file mounts Add directory-project File declarations, validate Agent mount paths, upload Files during publish, mount them in new Sessions, and expose File management in Workbench. * fix(project): stop writing credentials during init Remove project-local credential environment generation from directory initialization while preserving user-managed .env files and excluding them from snapshots. * feat(project): add resource scaffolds and safe build preparation Auto-associate Agent-local File and Skill content during Build, and scaffold inactive resource examples with bilingual guides. Externalize Vault literals into project-local dotenv references and resolve them safely without mutating process environment. Preserve source filenames for declarative uploads and cover the workflows with SDK, workspace, and Workbench regression tests. * feat(vault): support credential networking and injection policies * chore: release packages 0.6.0 * fix(ci): build all libraries before SDK compatibility smoke * fix(playground): externalize project libraries and YAML in ESM bundle * fix(ci): retry transient dependency audit failures * fix(webui): upgrade Tiptap to address attribute prototype vulnerability
1 parent 941bc00 commit 8e8276f

177 files changed

Lines changed: 27732 additions & 4136 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/config.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
33
"changelog": "@changesets/cli/changelog",
44
"commit": false,
5-
"fixed": [["@openagentpack/sdk", "@openagentpack/playground", "@openagentpack/cli"]],
5+
"fixed": [
6+
[
7+
"@openagentpack/sdk",
8+
"@openagentpack/project-versions",
9+
"@openagentpack/project-workspace",
10+
"@openagentpack/playground",
11+
"@openagentpack/cli"
12+
]
13+
],
614
"linked": [],
715
"access": "public",
816
"baseBranch": "main",

.dependency-cruiser.cjs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ module.exports = {
44
{
55
name: "no-cli-to-server",
66
severity: "error",
7-
comment: "The CLI host must consume shared behavior through @openagentpack/sdk, not by importing the API server.",
7+
comment: "The CLI host must consume shared behavior through published engine packages, not the API server.",
88
from: { path: "^packages/cli/" },
99
to: { path: "^apps/server/" },
1010
},
1111
{
1212
name: "no-server-to-cli",
1313
severity: "error",
14-
comment: "The API server must consume shared behavior through @openagentpack/sdk, not by importing CLI code.",
14+
comment: "The API server must consume shared behavior through published engine packages, not CLI code.",
1515
from: { path: "^apps/server/" },
1616
to: { path: "^packages/cli/" },
1717
},
@@ -22,6 +22,21 @@ module.exports = {
2222
from: { path: "^packages/sdk/" },
2323
to: { path: "^(packages/cli|apps/server|apps/webui)/" },
2424
},
25+
{
26+
name: "no-project-versions-to-hosts-or-apps",
27+
severity: "error",
28+
comment:
29+
"@openagentpack/project-versions is a shared Node engine and must not depend on host packages or applications.",
30+
from: { path: "^packages/project-versions/" },
31+
to: { path: "^(packages/cli|packages/playground|apps/server|apps/webui)/" },
32+
},
33+
{
34+
name: "no-project-workspace-to-hosts-or-apps",
35+
severity: "error",
36+
comment: "@openagentpack/project-workspace is a shared Node engine and must not depend on hosts or applications.",
37+
from: { path: "^packages/project-workspace/" },
38+
to: { path: "^(packages/cli|packages/playground|apps/server|apps/webui)/" },
39+
},
2540
{
2641
name: "no-sdk-deep-imports",
2742
severity: "error",
@@ -42,6 +57,20 @@ module.exports = {
4257
from: { path: "^apps/webui/src/" },
4358
to: { path: "^packages/sdk/" },
4459
},
60+
{
61+
name: "no-webui-project-versions-runtime-import",
62+
severity: "error",
63+
comment: "Browser-facing code must use Workbench APIs instead of importing the Node-only version engine.",
64+
from: { path: "^apps/webui/src/" },
65+
to: { path: "^packages/project-versions/" },
66+
},
67+
{
68+
name: "no-webui-project-workspace-runtime-import",
69+
severity: "error",
70+
comment: "Browser-facing code must use Workbench APIs instead of importing the Node-only workspace engine.",
71+
from: { path: "^apps/webui/src/" },
72+
to: { path: "^packages/project-workspace/" },
73+
},
4574
],
4675
options: {
4776
doNotFollow: {

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ jobs:
5858
fail-fast: false
5959
matrix:
6060
include:
61-
# Full consumer smoke (sdk + playground + cli) on the repo baseline.
61+
# Full consumer smoke (library packages + playground + cli) on the repo baseline.
6262
- node: 22
6363
scope: all
6464
- node: 24
6565
scope: all
66-
# SDK-only smoke on the sdk engines floor (>=18.17.0): cli/playground
67-
# require Node >=22, so only the sdk tarball is installed and imported.
66+
# Library smoke on the SDK engines floor (>=18.17.0): build and install
67+
# sdk, project-versions, and project-workspace; cli/playground require Node >=22.
6868
- node: 18.17.0
6969
scope: sdk
7070
- node: 20
@@ -86,6 +86,8 @@ jobs:
8686
- if: matrix.scope == 'sdk'
8787
run: |
8888
bun run build:sdk
89+
bun run build:project-versions
90+
bun run build:project-workspace
8991
bun scripts/release/smoke-packed.ts --sdk-only
9092
9193
gate:

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,21 @@ The mechanics are a single `agents.yaml`, a `validate → plan → apply` workfl
7777
## Quick start
7878

7979
```bash
80-
agents init # interactive wizard writes a starter agents.yaml
81-
agents validate # offline YAML check, no API calls
82-
agents plan # preview create / update / delete
83-
agents apply -y # apply changes
84-
agents destroy # tear down managed resources
80+
agents project init # create a directory project (or convert agents.yaml)
81+
agents project validate # validate JSON, Markdown, skills, and local files
82+
agents project build --dry-run # preview organization and generated YAML
83+
agents project build -y # freeze the current source into a Build
84+
agents project publish -y # publish exactly that Build and record a version
85+
agents project workbench # edit and debug the same directory project
8586
```
8687

87-
Run `agents playground` to launch the local WebUI, and use `--provider` to target `bailian`, `qoder`, `ark`, or `claude`. You can switch providers on the same declaration, run real sessions, and observe tool calls and artifacts.
88+
Directory projects keep global settings in `project.json`, each Agent under `agents/<id>/`, Agent instructions in `instructions.md`, and local Skill source either beside its Agent or under the shared `skills/` directory. Build promotes a Skill to the shared directory when multiple Agents reference it and deterministically writes `.openagentpack/build/agents.yaml`. Publish never runs Build implicitly.
89+
90+
Fresh Init includes Skill, File, Vault, and Environment examples under each resource directory's `_examples/`, with bilingual configuration instructions. They are not linked in `agent.json`, do not enter generated YAML, and are not published remotely. Copy an example outside `_examples/` and configure its Agent reference to enable it.
91+
92+
Workbench and CLI share `agents project version status|enable|disable|list|preview|restore`. Versions are Git-independent full source-tree snapshots: immutable manifests point to content-addressed text and binary blobs, while `.openagentpack/state.json` is always excluded. Restore writes a historical tree forward into the working directory without moving version history or remote State. Deployment and Channel declarations remain read-only in Workbench but participate in full project Publish.
93+
94+
The original YAML workflow remains available through `agents init`, `validate`, `plan`, `apply`, and `destroy`. `agents playground -f agents.yaml` continues to open a YAML Agent Session Preview, but YAML Apply no longer creates project versions and cannot be used inside a directory-project root.
8895

8996
[Watch the full Playground demo](https://github.com/user-attachments/assets/bf51b8d8-f2ed-464b-bca9-0709fefcc44d)
9097

@@ -172,28 +179,31 @@ The [`examples/`](./examples) directory has runnable configs for every provider,
172179

173180
## Using the SDK
174181

175-
Everything the CLI does is available programmatically from `@openagentpack/sdk`:
182+
Cloud runtime capabilities are available from `@openagentpack/sdk`. Directory compilation, Build/Publish, and full-tree versions are exposed by `@openagentpack/project-workspace`, backed by the storage primitives in `@openagentpack/project-versions`:
176183

177184
```ts
178-
import { resolveProjectConfig, planProjectContext } from "@openagentpack/sdk";
179-
180-
const config = await resolveProjectConfig({ configPath: "agents.yaml" });
181-
const plan = await planProjectContext(config);
182-
console.log(plan);
185+
import { previewProjectBuild, commitProjectBuild } from "@openagentpack/project-workspace";
186+
187+
const preview = await previewProjectBuild("./my-agent");
188+
const build = await commitProjectBuild({
189+
projectRoot: preview.project_root,
190+
baseRevision: preview.project_revision,
191+
});
192+
console.log(build.manifest);
183193
```
184194

185195
See the [SDK reference](./docs/reference/sdk.md) for the public API surface.
186196

187197
## WebUI
188198

189-
`apps/webui` is a Vite single-page app for browsing playbooks and driving agent sessions; `apps/server` exposes the SDK over an OpenAPI surface. Run both from the repo root:
199+
`apps/webui` is a Vite directory-project Workbench; `apps/server` exposes directory editing, Build/Publish, versions, and Session debugging over an OpenAPI surface. Run both from the repo root with `AGENTS_PROJECT_ROOT` pointing at a project:
190200

191201
```bash
192202
bun install
193203
bun run dev # server + webui together
194204
```
195205

196-
Or launch a packaged local UI with `agents playground --provider <bailian|qoder|ark|claude>`.
206+
Launch the packaged project console with `agents project workbench --project <directory>`. Use `agents playground -f <path/to/agents.yaml>` only for the legacy YAML Session Preview. Workbench edits directory source, requires an explicit Build, and publishes the reviewed Build; it never edits Provider ownership or pushes Git state.
197207

198208
## Contributing
199209

README.zh-CN.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ agents init # 交互式向导生成 agents.yaml
8181
agents validate # 离线校验,不发起 API 调用
8282
agents plan # 预览 create / update / delete
8383
agents apply -y # 执行变更
84+
agents version enable # 可选:成功 Apply 后版本化 YAML
8485
agents destroy # 销毁托管资源
8586
```
8687

87-
运行 `agents playground` 可启动本地 WebUI,并通过 `--provider` 指定 `bailian``qoder``ark``claude`。你可以在同一份声明上切换 Provider、运行真实 Session,并观察工具调用和 Artifact。
88+
运行 `agents playground -f agents.yaml` 会直接打开 Agent Preview:单 Agent 项目自动选择,多 Agent 项目可传 `--agent <id>`,未指定时进入 Workbench 选择。使用 `agents workbench -f agents.yaml` 可直接打开项目控制台且不创建 Session。Playground 从 YAML 读取全部 Agent 和 Provider,并监听本地依赖文件。Workbench 的 Resources 页面可以通过服务端生成的 YAML Diff 编辑或移除已有声明;保存更新 `agents.yaml` 并自动刷新项目 Plan。本地版本默认不存在,只有用户在 Versions 页面或通过 `agents version enable` 显式启用后才会创建基线;开关启用时,成功 Apply 后自动版本化有变化的 YAML。Versions 页面与 CLI 共用开关,并浏览和恢复历史。
89+
90+
CLI 也提供 `agents version status|enable|disable|list|preview|restore`。Workbench 与 CLI 按当前 `agents.yaml` 共用一个本地开关:`agents version enable` 会在需要时创建基线并开启两边的成功 Apply 自动版本,`version disable` 会同时关闭两边。`store.json` 只保存开关和 head,`entries/` 保存不可变链式元数据,完整 YAML 保存在内容寻址的 `blobs/` 中,因此不依赖 Git。Restore 只把历史 YAML 写回工作区,不移动版本历史;`agents.state.json` 和外部引用文件始终不进入版本。Deployment 和 Channel 声明继续只读,且不进入 Workbench 项目 Apply。配置缺失或非法时进入诊断 Workbench。
8891

8992
[观看 Playground 完整演示](https://github.com/user-attachments/assets/bf51b8d8-f2ed-464b-bca9-0709fefcc44d)
9093

@@ -172,10 +175,11 @@ Beta 用户可以安装 `@openagentpack/cli@beta`;固定版本及切回稳定
172175

173176
## 使用 SDK
174177

175-
CLI 的全部能力都可通过 `@openagentpack/sdk` 以编程方式调用:
178+
云端项目运行能力可通过 `@openagentpack/sdk` 以编程方式调用;仅限 Node.js 的本地项目版本能力由独立包 `@openagentpack/project-versions` 提供
176179

177180
```ts
178181
import { resolveProjectConfig, planProjectContext } from "@openagentpack/sdk";
182+
import { createProjectVersionService } from "@openagentpack/project-versions";
179183
180184
const config = await resolveProjectConfig({ configPath: "agents.yaml" });
181185
const plan = await planProjectContext(config);
@@ -186,14 +190,14 @@ console.log(plan);
186190

187191
## WebUI
188192

189-
`apps/webui` 是一个 Vite 单页应用,用于浏览 playbook 和驱动 Agent Session;`apps/server` 通过 OpenAPI 暴露 SDK。从仓库根目录同时启动两者:
193+
`apps/webui` 是一个 Vite 单页项目工作台,用于检查和调试 `agents.yaml` 中声明的 Agent;`apps/server` 通过 OpenAPI 暴露 SDK。从仓库根目录同时启动两者:
190194

191195
```bash
192196
bun install
193197
bun run dev # 同时启动 server + webui
194198
```
195199

196-
或用 `agents playground --provider <bailian|qoder|ark|claude>` 启动打包的本地 UI
200+
也可以用 `agents playground -f <path/to/agents.yaml>` 打开打包后的 Preview,或用 `agents workbench -f <path/to/agents.yaml>` 打开项目控制台。Provider、模型、工具、memory、skills 和资源全部来自 YAML,UI 不提供覆盖;Deployment 声明仅只读展示
197201

198202
## 参与贡献
199203

apps/server/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @openagentpack/server
22

3+
## 0.0.11
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [8c6a767]
8+
- Updated dependencies [f956bad]
9+
- @openagentpack/sdk@0.6.0
10+
- @openagentpack/project-versions@0.6.0
11+
- @openagentpack/project-workspace@0.6.0
12+
313
## 0.0.10
414

515
### Patch Changes

0 commit comments

Comments
 (0)