@anyswarm/core 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/README.md +13 -6
- package/dist/examples/README.md +16 -5
- package/dist/examples/authoring/README.md +4 -4
- package/dist/examples/autoresearch/README.md +15 -8
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
- package/dist/examples/autoresearch/demo.js +1 -1
- package/dist/examples/autoresearch/eject.json +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
- package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
- package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
- package/dist/examples/autoresearch/prepare-demo.js +15 -0
- package/dist/examples/autoresearch/prepare.js +3 -3
- package/dist/examples/autoresearch/project.d.ts +0 -94
- package/dist/examples/autoresearch/project.js +2 -20
- package/dist/examples/code/README.md +25 -17
- package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
- package/dist/examples/harness-session/README.md +3 -3
- package/dist/examples/messages/README.md +1 -1
- package/dist/examples/notes/README.md +3 -3
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/persistent-board/README.md +5 -2
- package/dist/examples/subagents/README.md +2 -2
- package/dist/examples/subagents/config.js +3 -3
- package/dist/examples/substrate/README.md +2 -2
- package/dist/examples/super/README.md +34 -22
- package/dist/examples/super/actions.d.ts +1 -1
- package/dist/examples/super/actions.js +11 -11
- package/dist/examples/super/config.js +3 -3
- package/dist/examples/super/eject.json +1 -1
- package/dist/examples/super/location.js +1 -1
- package/dist/examples/super/operator.d.ts +1 -0
- package/dist/examples/super/operator.js +31 -0
- package/dist/examples/super/project.d.ts +0 -107
- package/dist/examples/super/project.js +1 -3
- package/dist/scripts/anyswarm-arguments.d.ts +7 -25
- package/dist/scripts/anyswarm-arguments.js +69 -97
- package/dist/scripts/anyswarm-eject.js +1 -1
- package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
- package/dist/scripts/anyswarm-harnesses.js +1 -22
- package/dist/scripts/anyswarm-installation.d.ts +7 -40
- package/dist/scripts/anyswarm-installation.js +17 -291
- package/dist/scripts/anyswarm-launch.d.ts +6 -36
- package/dist/scripts/anyswarm-launch.js +32 -81
- package/dist/scripts/anyswarm-progress.d.ts +6 -0
- package/dist/scripts/anyswarm-progress.js +102 -0
- package/dist/scripts/anyswarm-project.d.ts +1 -9
- package/dist/scripts/anyswarm-project.js +40 -127
- package/dist/scripts/anyswarm-source-runner.js +9 -41
- package/dist/scripts/anyswarm.js +6 -26
- package/dist/scripts/build-provenance.json +1 -1
- package/dist/scripts/local-environment.d.ts +10 -4
- package/dist/scripts/local-environment.js +67 -20
- package/dist/scripts/local-setup.d.ts +3 -0
- package/dist/scripts/local-setup.js +135 -107
- package/dist/scripts/pack-release.js +4 -1
- package/dist/src/core/worker-image.js +1 -1
- package/dist/src/harness/project-harness.d.ts +1 -0
- package/dist/src/harness/project-harness.js +2 -2
- package/dist/src/harness/project-runtime.js +3 -1
- package/docs/INDEX.md +2 -1
- package/docs/architecture/04-services.md +1 -1
- package/docs/architecture/07-run-configuration.md +28 -14
- package/docs/architecture/12-code-coverage.md +56 -57
- package/docs/architecture/17-harness-reporting.md +1 -1
- package/docs/architecture/22-website.md +4 -7
- package/docs/architecture/23-project-harness.md +48 -23
- package/docs/architecture/26-code.md +20 -5
- package/docs/architecture/27-personal.md +23 -8
- package/docs/architecture/28-autoresearch.md +18 -6
- package/docs/architecture/INDEX.md +1 -2
- package/docs/architecture/prompts/source-manifest.json +5 -5
- package/docs/architecture/source-map.json +51 -71
- package/docs/designs/core-harness/01-core.md +2 -2
- package/docs/designs/core-harness/06-project-harness.md +3 -3
- package/docs/designs/core-harness/README.md +2 -2
- package/docs/en/agents.md +1 -1
- package/docs/en/build-your-harness.md +1 -1
- package/docs/en/changelog.md +7 -0
- package/docs/en/first-harness.md +6 -6
- package/docs/en/harnesses/lead-worker.md +1 -1
- package/docs/en/harnesses/peermesh.md +2 -2
- package/docs/en/harnesses/subagents.md +2 -2
- package/docs/en/harnesses/substrate.md +4 -4
- package/docs/en/harnesses/taskpool.md +2 -2
- package/docs/en/latest.md +9 -5
- package/docs/en/quickstart.md +20 -41
- package/docs/en/reference/api.md +1 -1
- package/docs/en/reference/cli.md +47 -85
- package/docs/en/sandbox.md +3 -3
- package/docs/operations/trace-viewer.md +1 -1
- package/docs/third-party-notices.md +0 -1
- package/docs/workflows/development.md +14 -12
- package/docs/workflows/release-and-docs-versioning.md +13 -12
- package/docs/workflows/release-cli-acceptance.md +85 -0
- package/docs/zh/agents.md +1 -1
- package/docs/zh/build-your-harness.md +1 -1
- package/docs/zh/changelog.md +8 -1
- package/docs/zh/first-harness.md +7 -7
- package/docs/zh/harnesses/lead-worker.md +1 -1
- package/docs/zh/harnesses/peermesh.md +2 -2
- package/docs/zh/harnesses/subagents.md +2 -2
- package/docs/zh/harnesses/substrate.md +4 -4
- package/docs/zh/harnesses/taskpool.md +2 -2
- package/docs/zh/latest.md +9 -5
- package/docs/zh/quickstart.md +20 -41
- package/docs/zh/reference/api.md +1 -1
- package/docs/zh/reference/cli.md +19 -79
- package/docs/zh/sandbox.md +3 -3
- package/examples/README.md +16 -5
- package/examples/authoring/README.md +4 -4
- package/examples/autoresearch/README.md +15 -8
- package/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
- package/examples/autoresearch/demo.ts +1 -1
- package/examples/autoresearch/eject.json +2 -0
- package/examples/autoresearch/frontiercs2-config.ts +4 -0
- package/examples/autoresearch/prepare-demo.ts +15 -0
- package/examples/autoresearch/prepare.ts +3 -3
- package/examples/autoresearch/project.ts +2 -19
- package/examples/code/README.md +25 -17
- package/examples/code/REQUIREMENTS.zh.md +3 -3
- package/examples/harness-session/README.md +3 -3
- package/examples/messages/README.md +1 -1
- package/examples/notes/README.md +3 -3
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/persistent-board/README.md +5 -2
- package/examples/subagents/README.md +2 -2
- package/examples/subagents/config.ts +4 -3
- package/examples/substrate/README.md +2 -2
- package/examples/super/README.md +34 -22
- package/examples/super/actions.ts +11 -11
- package/examples/super/config.ts +3 -3
- package/examples/super/eject.json +1 -1
- package/examples/super/location.ts +1 -1
- package/examples/super/operator.ts +28 -0
- package/examples/super/project.ts +1 -3
- package/npm-shrinkwrap.development.json +42 -1541
- package/npm-shrinkwrap.json +3 -43
- package/package.development.json +2 -6
- package/package.json +2 -5
- package/scripts/anyswarm-arguments.ts +67 -96
- package/scripts/anyswarm-eject.ts +1 -1
- package/scripts/anyswarm-harnesses.ts +1 -18
- package/scripts/anyswarm-installation.ts +18 -294
- package/scripts/anyswarm-launch.ts +30 -102
- package/scripts/anyswarm-progress.ts +95 -0
- package/scripts/anyswarm-project.ts +31 -123
- package/scripts/anyswarm-source-runner.ts +9 -36
- package/scripts/anyswarm.ts +4 -24
- package/scripts/local-environment.ts +71 -20
- package/scripts/local-setup.ts +134 -94
- package/scripts/pack-release.ts +4 -1
- package/src/core/worker-image.ts +1 -1
- package/src/harness/project-harness.ts +2 -2
- package/src/harness/project-runtime.ts +2 -1
- package/dist/scripts/anyswarm-applications.d.ts +0 -19
- package/dist/scripts/anyswarm-applications.js +0 -19
- package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
- package/dist/scripts/anyswarm-tui-config.js +0 -189
- package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
- package/dist/scripts/anyswarm-tui-session.js +0 -304
- package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
- package/dist/scripts/anyswarm-tui-terminal.js +0 -154
- package/dist/scripts/anyswarm-tui.d.ts +0 -2
- package/dist/scripts/anyswarm-tui.js +0 -1012
- package/docs/architecture/25-foreground-tui.md +0 -51
- package/scripts/anyswarm-applications.ts +0 -39
- package/scripts/anyswarm-tui-config.ts +0 -174
- package/scripts/anyswarm-tui-session.ts +0 -295
- package/scripts/anyswarm-tui-terminal.ts +0 -147
- package/scripts/anyswarm-tui.ts +0 -912
package/docs/zh/changelog.md
CHANGED
|
@@ -7,9 +7,16 @@ order: 16
|
|
|
7
7
|
|
|
8
8
|
本页同步记录 **AnySwarm**(`@anyswarm/core`)的历次重要变更,与仓库根目录的 [`CHANGELOG.md`](../../CHANGELOG.md) 保持一致。当前安装命令见[发行版本](latest.md)。
|
|
9
9
|
|
|
10
|
+
## v0.5.2
|
|
11
|
+
|
|
12
|
+
- 裸命令显示 Quickstart。原终端入口改用 `anyswarm --harness <name> --prompt <text>` 单次执行,或用 `--mode rpc` 做多轮交互。单次运行在终端显示阶段和 Trace 命令。Code 和 Personal 可导出为 SDK 示例。[CLI 参考](reference/cli.md)
|
|
13
|
+
- CLI 统一使用 npm 安装、更新和卸载。官网和快速上手只提供一条 npm 安装命令,`anyswarm update` 会显示当前 prefix 的更新命令。
|
|
14
|
+
- setup 和 doctor 默认走本机 OpenSandbox,自动检测 Docker 与执行器并复用已保存的本机配置。检查远端服务时需显式选择 existing 模式。
|
|
15
|
+
- 宿主机统一使用 `anyswarm`。已有命令和脚本中的 `anys` 改用 `anyswarm`。Worker 镜像继续提供内部命令 `swarm`。旧脚本版可以在清理所属链接后重新用 npm 安装。[升级说明](quickstart.md#更新-cli)
|
|
16
|
+
|
|
10
17
|
## v0.5.1
|
|
11
18
|
|
|
12
|
-
- AutoResearch 使用四名平级 Kimi K3 成员运行 FrontierCS-2
|
|
19
|
+
- AutoResearch 使用四名平级 Kimi K3 成员运行 FrontierCS-2 正式任务,在流式终端和实时 Trace 中展示研究活动。支持配置自定义可信评测器和导出 Harness 源码。[CLI 参考](reference/cli.md#autoresearch)。默认 Kimi K3 路线的端到端验收见 [#337](https://github.com/AnySwarm/anyswarm/issues/337)。
|
|
13
20
|
- Personal 可后台接收 GitHub 请求,由 Router 带领 Agent 处理,在流式终端按工作批准 Draft PR。
|
|
14
21
|
- 支持 macOS 原生 setup 和 Docker Desktop,可接入用户选定的 Pi 或 Codex 安装并固定确切版本。
|
|
15
22
|
- 在 Linux 项目目录运行 `anys -u code` 由主 Agent 直接编辑,按需在聊天中委派,并在共享终端查看补丁。用 `anys eject code` 导出应用源码。[CLI 参考](reference/cli.md)。
|
package/docs/zh/first-harness.md
CHANGED
|
@@ -9,7 +9,7 @@ order: 9
|
|
|
9
9
|
|
|
10
10
|
## 1. 选择 SDK 版本
|
|
11
11
|
|
|
12
|
-
本教程使用[
|
|
12
|
+
本教程使用 [AnySwarm v0.5.1](latest.md#v051) 提供的 `anyswarm run`。请从下文安装的同一个 SDK 包复制示例。
|
|
13
13
|
|
|
14
14
|
## 2. 安装并连接
|
|
15
15
|
|
|
@@ -17,10 +17,10 @@ order: 9
|
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
npm init -y
|
|
20
|
-
npm install
|
|
20
|
+
npm install @anyswarm/core@0.5.1
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
新建本地 OpenSandbox 时,先按[快速上手](quickstart.md#2-准备-opensandbox-与-worker)安装支持的 Pi,再运行 `./node_modules/.bin/anyswarm setup --mode local --backend pi`。使用已有部署时,[配置其 endpoint、鉴权、回调和 Worker 镜像](
|
|
23
|
+
新建本地 OpenSandbox 时,先按[快速上手](quickstart.md#2-准备-opensandbox-与-worker)安装支持的 Pi,再运行 `./node_modules/.bin/anyswarm setup --mode local --backend pi`。使用已有部署时,[配置其 endpoint、鉴权、回调和 Worker 镜像](sandbox.md),再运行 `./node_modules/.bin/anyswarm setup --mode existing` 和 `./node_modules/.bin/anyswarm doctor --mode existing --smoke`。
|
|
24
24
|
|
|
25
25
|
等待 `"infrastructure": "ready"` 和 `"ok": true`。受控自检会验证 Worker 启动、Service、Gateway、文件、导出和删除。示例在同一环境中用 `resolveSandboxConnection()` 读取连接。需要构建镜像时,项目实际导入的 SDK 使用自身包内材料。
|
|
26
26
|
|
|
@@ -48,13 +48,13 @@ cp "$example"/{harness.ts,session.ts,handoff.ts,config.ts} .
|
|
|
48
48
|
|
|
49
49
|
Harness 负责两个 Profile 和 Handoff Service。发布者在 Sandbox 里读取唯一编号,将编号和问题发布到 Service。公共 `runInput` 等待发布者的排他回合。Harness 核对 Service 认证过的发布者,再将 Agent 身份和 Run 的取消信号交给 `context.askUser`。写作者用自己的权限读取同一个编号,按你的回答生成 `delivery.txt`。Harness 在 Sandbox 里核对文件,要求导出,再核对 Host 导出的字节。Session 管理提问身份、回答准入、观察和最终 Run 报告。
|
|
50
50
|
|
|
51
|
-
`session.ts` 读取终端答案,调用 `respond`。用 `
|
|
51
|
+
`session.ts` 读取终端答案,调用 `respond`。用 `anyswarm run` 直接通过 SDK、RPC 和显式前台运行同一份 TypeScript 定义。
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
mkdir -p input
|
|
55
|
-
./node_modules/.bin/
|
|
56
|
-
PATH="$PWD/node_modules/.bin:$PATH" ./node_modules/.bin/
|
|
57
|
-
ANYSWARM_FIRST_CHANNEL=beta-east ./node_modules/.bin/
|
|
55
|
+
./node_modules/.bin/anyswarm run ./session.ts ./input 'Prepare a release handoff.'
|
|
56
|
+
PATH="$PWD/node_modules/.bin:$PATH" ./node_modules/.bin/anyswarm run ./session.ts --rpc ./input 'Prepare a release handoff.'
|
|
57
|
+
ANYSWARM_FIRST_CHANNEL=beta-east ./node_modules/.bin/anyswarm run ./harness.ts --cwd ./input --prompt 'Prepare a release handoff.'
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
使用独立的输入目录,避免采集示例依赖和 Run 输出。前两条命令会提示输入频道,例如 `beta-east`。单次前台命令从 `ANYSWARM_FIRST_CHANNEL` 读取频道并输出最终 JSON。JSONL 客户端也可以用 `--interaction questions` 启动显式前台并按 `questionId` 作答。成功时会看到 `outcome: "completed"`、`acceptance.status: "verified"`、`export.status: "complete"` 和 `cleanup.status: "complete"`。按验收回执找到文件,比较 `channel=` 行及 SHA‑256。完整 Host 报告位于同次 Run 的 `reportPath`。
|
|
@@ -113,7 +113,7 @@ await Promise.all(
|
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
115
|
# 配置 run ID、不可变 Worker 镜像、OpenSandbox 地址、Gitea 管理员凭证与模型端点
|
|
116
|
-
|
|
116
|
+
anyswarm run ./benchmarks/lead-worker-orders/main.ts ./benchmarks/lead-worker-orders/config.ts
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
关闭时,宿主先停止接纳 Board 写入,再调用 `runtime.close()`。只有 Core 确认执行已停止且清理完成后,才关闭 Board 连接并撤销自己创建的 Gitea 凭证。若执行状态未知、必需导出失败或 Board 证据写入失败,相关依赖会保持 `pending` 状态,等待后续人工核对与恢复清理。共享仓库、Board 数据库、提交与 PR 保留供检查。`harness-report.json` 分别记录业务失败、已交付和未完成工作、不确定输入、清理和报告保存结果。
|
|
@@ -113,7 +113,7 @@ export ANYSWARM_PEERMESH_MODEL_URL='https://your-model-endpoint/v1/responses'
|
|
|
113
113
|
export ANYSWARM_PEERMESH_PEERS=4
|
|
114
114
|
# 以及 Gitea、Mattermost 与 Board MySQL DSN 等宿主环境变量
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
anyswarm run ./scripts/run-harness.ts --config ./examples/peermesh/config.ts
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
输出 `ready` 后,可通过 `stdin` 逐行发送 JSON 命令查看状态、向指定成员追加输入或提前停止:
|
|
@@ -128,7 +128,7 @@ anys run ./scripts/run-harness.ts --config ./examples/peermesh/config.ts
|
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
130
|
runtime_id=RUNTIME_ID_FROM_RESULT
|
|
131
|
-
|
|
131
|
+
anyswarm run ./scripts/read-harness-result.ts \
|
|
132
132
|
--run-directory "./peermesh-runs/$runtime_id" \
|
|
133
133
|
--runtime-id "$runtime_id"
|
|
134
134
|
```
|
|
@@ -162,10 +162,10 @@ export ANYSWARM_MODEL_TOKEN='your-bearer-token'
|
|
|
162
162
|
# 可选:覆盖默认本地 Worker 镜像
|
|
163
163
|
# export ANYSWARM_WORKER_IMAGE='your-registry.example/compatible-worker:tag'
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
anyswarm run ./examples/subagents/main.ts ./examples/subagents/config.ts \
|
|
166
166
|
'Split this task into two independent checks and summarize the results.'
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
anyswarm run ./examples/subagents/main.ts ./examples/subagents/config.ts --interactive
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
或在 Node.js 中直接嵌入 `createSubagentsHarness`:
|
|
@@ -96,11 +96,11 @@ export ANYSWARM_SUBSTRATE_RUN=research-01
|
|
|
96
96
|
export ANYSWARM_SUBSTRATE_MODEL_URL='https://your-model-endpoint/v1/responses'
|
|
97
97
|
export ANYSWARM_SUBSTRATE_MODEL_TOKEN='your-bearer-token'
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
anyswarm run ./examples/substrate/main.ts ./examples/substrate/config.ts > substrate-result.json
|
|
100
100
|
|
|
101
101
|
# 无需模型配置,离线检查保存的回执:
|
|
102
102
|
runtime_id=RUNTIME_ID_FROM_RESULT
|
|
103
|
-
|
|
103
|
+
anyswarm run ./examples/substrate/main.ts --result "./substrate-runs/$runtime_id" --runtime-id "$runtime_id"
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
[collaboration-evidence.ts](https://github.com/AnySwarm/anyswarm/blob/main/examples/substrate/harness/collaboration-evidence.ts) 会联合审计 `substrate_contents`、`substrate_references` 和 `substrate_reads` 三张表,检查跨成员复用链:
|
|
@@ -127,8 +127,8 @@ export ANYSWARM_FATE_BENCHMARK=FATE-X
|
|
|
127
127
|
export ANYSWARM_FATE_PROJECT=/path/to/fate-x
|
|
128
128
|
export ANYSWARM_FATE_LEAN=/path/to/lean-4.28.0
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
anyswarm run ./benchmarks/fate/main.ts --fate-prepare "$ANYSWARM_FATE_PROJECT" "$ANYSWARM_FATE_LEAN" FATE-X
|
|
131
|
+
anyswarm run ./benchmarks/fate/main.ts --fate-run ./benchmarks/fate/fate-config.ts
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
## 源码索引
|
|
@@ -84,7 +84,7 @@ TaskPool 控制器在可信 TaskService 提交后检查 Mission、归属与截
|
|
|
84
84
|
构建仓库并完成宿主模块后运行:
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
|
|
87
|
+
anyswarm run ./scripts/run-harness.ts --config ./my-taskpool-config.ts
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
宿主通过 JSON 行接受 `status`、面向 Task 的 `input` 和 `stop`。定向输入会解析到当前 Execution 所有者,不是任意向某个 Agent 发送私信。最终记录包含 Runtime ID 和报告路径;[前台协议](../../architecture/17-harness-reporting.md#foreground-harness-control) 说明全部命令与结果码。
|
|
@@ -92,7 +92,7 @@ anys run ./scripts/run-harness.ts --config ./my-taskpool-config.ts
|
|
|
92
92
|
离线检查报告无需加载模型配置:
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
|
|
95
|
+
anyswarm run ./scripts/read-harness-result.ts \
|
|
96
96
|
--run-directory ./runs/RUNTIME_ID_FROM_RESULT \
|
|
97
97
|
--runtime-id RUNTIME_ID_FROM_RESULT
|
|
98
98
|
```
|
package/docs/zh/latest.md
CHANGED
|
@@ -5,25 +5,29 @@ section: RELEASES
|
|
|
5
5
|
order: 15
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
## v0.5.
|
|
8
|
+
## v0.5.1
|
|
9
9
|
|
|
10
|
-
v0.5.
|
|
10
|
+
v0.5.1 加入流式终端、Code、Personal、AutoResearch 和 macOS 原生 setup。平台要求与验证进度见 [v0.5.1 更新日志](changelog.md#v051)。
|
|
11
11
|
|
|
12
12
|
用 npm 全局安装 CLI,随后检查版本。
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
npm install -g @anyswarm/core@0.5.
|
|
15
|
+
npm install -g @anyswarm/core@0.5.1
|
|
16
16
|
anyswarm --version
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
[
|
|
19
|
+
[v0.5.1 GitHub Release](https://github.com/AnySwarm/anyswarm/releases/tag/v0.5.1) 也提供 npm 归档。
|
|
20
20
|
|
|
21
21
|
要把 SDK 加到项目依赖中,请在项目目录执行以下命令。
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
npm install @anyswarm/core@0.5.
|
|
24
|
+
npm install @anyswarm/core@0.5.1
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
SDK 的导入方式和项目内 CLI 用法见[安装 SDK](reference/api.md#安装-sdk)。
|
|
28
28
|
|
|
29
|
+
## v0.5.0
|
|
30
|
+
|
|
31
|
+
v0.5.0 是 `@anyswarm/core` 的首个正式版本。该版本的变更见 [v0.5.0 更新日志](changelog.md#v050)。
|
|
32
|
+
|
|
29
33
|
此前的发行版使用不同的 npm 包名。源码和发行归档可在 [GitHub Release 历史](https://github.com/AnySwarm/anyswarm/releases) 查阅。
|
package/docs/zh/quickstart.md
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 快速上手
|
|
3
|
-
description: 在 Linux 上准备环境、安装 AnySwarm、初始化 OpenSandbox 与 Worker,并完成首次 Sandbox 与文件读取检查。
|
|
3
|
+
description: 在 Linux 或 macOS 上准备环境、安装 AnySwarm、初始化 OpenSandbox 与 Worker,并完成首次 Sandbox 与文件读取检查。
|
|
4
4
|
section: GET STARTED
|
|
5
5
|
order: 1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
要使用已安装的 SDK 归档编写自己的应用,请从[搭建第一个 SDK Harness](first-harness.md)开始。
|
|
9
9
|
|
|
10
|
-
`anyswarm` 将 CLI 与 TypeScript SDK 打包在同一个安装包中,并在 [OpenSandbox](sandbox.md) 隔离沙箱中运行 Agent
|
|
10
|
+
`anyswarm` 将 CLI 与 TypeScript SDK 打包在同一个安装包中,并在 [OpenSandbox](sandbox.md) 隔离沙箱中运行 Agent。本指南使用 Docker 在本机运行 OpenSandbox 和 Worker。
|
|
11
11
|
|
|
12
|
-
本指南适用于
|
|
12
|
+
本指南适用于 [AnySwarm v0.5.1](latest.md#v051)。
|
|
13
13
|
|
|
14
14
|
## 前置要求
|
|
15
15
|
|
|
16
16
|
| 依赖 | 要求与说明 | 检查命令 |
|
|
17
17
|
| --- | --- | --- |
|
|
18
|
-
| **Linux** | 控制器宿主机(如 Ubuntu
|
|
18
|
+
| **Linux 或 macOS** | 控制器宿主机(如 Ubuntu、Debian 或运行 Docker Desktop 的 macOS) | `uname -s` |
|
|
19
19
|
| **Node.js** | `>= 22.19`(Ubuntu 24.04、Debian 13 等软件源默认版本偏旧,请从 [nodejs.org](https://nodejs.org/en/download) 安装 LTS) | `node --version` |
|
|
20
20
|
| **npm** | 随 Node.js 安装 | `npm --version` |
|
|
21
21
|
| **Git** | 用于检出源码与捕获项目 | `git --version` |
|
|
22
|
-
| **
|
|
23
|
-
| **Docker Engine** | 仅本机启动 OpenSandbox 时需要;接入已有服务可跳过([安装指南](https://docs.docker.com/engine/install/)) | `docker info` |
|
|
22
|
+
| **Docker Engine** | 本机运行的 Linux 容器引擎([安装指南](https://docs.docker.com/engine/install/)) | `docker info` |
|
|
24
23
|
|
|
25
24
|
在 Ubuntu 或 Debian 本机使用 Docker 时,安装系统依赖并启动 Docker:
|
|
26
25
|
|
|
27
26
|
```bash
|
|
28
|
-
sudo apt-get update && sudo apt-get install -y docker.io git
|
|
27
|
+
sudo apt-get update && sudo apt-get install -y docker.io git ca-certificates
|
|
29
28
|
sudo systemctl enable --now docker.service
|
|
30
29
|
```
|
|
31
30
|
|
|
32
|
-
连接已有 OpenSandbox 时,只需安装 `git curl ca-certificates`,可跳过 Docker 服务和用户组操作。
|
|
33
|
-
|
|
34
31
|
若访问 Docker socket 被拒绝,管理员可执行 `sudo usermod -aG docker alice`,将 `alice` 换为运行 AnySwarm 的账号。使用该账号重新登录,执行 `id` 和 `docker info`。[`docker` 用户组具有等同于 root 的权限](https://docs.docker.com/engine/install/linux-postinstall/)。
|
|
35
32
|
|
|
36
33
|
### macOS 上的 Docker
|
|
@@ -47,13 +44,13 @@ docker info --format '{{.OSType}}/{{.Architecture}}'
|
|
|
47
44
|
|
|
48
45
|
若 context 不正确,执行 `docker context use <本地-context>`,并检查 `DOCKER_CONTEXT` 或 `DOCKER_HOST` 是否覆盖了该选择。Apple Silicon 对应 Linux ARM64,Intel 对应 Linux x86-64;setup 不会切换到模拟执行。若单独安装的 Docker 客户端提示找不到 `docker-credential-desktop`,在 Docker Desktop 设置中把 CLI 工具加入 PATH,或将 `/Applications/Docker.app/Contents/Resources/bin` 加入 PATH。运行 TypeScript 作者命令请用 Node.js 24 LTS;Node.js 26 已移除这些命令使用的 transform 模式。
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
v0.5.1 支持 macOS 原生 setup。请选择兼容的 backend。[#339](https://github.com/AnySwarm/anyswarm/issues/339) 的 macOS 受控模型验证在 Apple Silicon 和 Docker Desktop 上进行,覆盖 npm Pi 1.3.0、1.7.0 及独立 Codex 0.173.0;Intel、其他引擎和其他 backend 版本还没有在 macOS 上验收。
|
|
51
48
|
|
|
52
49
|
## 1. 安装 AnySwarm
|
|
53
50
|
|
|
54
51
|
### 安装公开发行版
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
使用 Node.js 22.19 或更高版本和 npm 安装 CLI。macOS 和 Linux 使用同一条命令。Docker 在运行 setup 时才需要。
|
|
57
54
|
|
|
58
55
|
```bash
|
|
59
56
|
npm install -g @anyswarm/core
|
|
@@ -62,26 +59,18 @@ anyswarm --version
|
|
|
62
59
|
|
|
63
60
|
`-g` 将命令装到 npm 的全局目录。若终端找不到命令,请确认 `$(npm prefix -g)/bin` 在 PATH 中,并且当前终端使用的是安装 CLI 时的 Node.js。
|
|
64
61
|
|
|
65
|
-
也可以使用安装脚本,从 GitHub Release 安装托管版 CLI。
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
脚本输出版本、CLI 路径和已校验的归档来源。若脚本打印了 PATH 命令,请在当前终端执行。随后运行 `anyswarm --version` 确认可用。
|
|
72
|
-
|
|
73
62
|
如果你要用 TypeScript 编写 Harness,请按[安装 SDK](reference/api.md#安装-sdk)把它加到项目依赖里。
|
|
74
63
|
|
|
75
64
|
### 从源码构建并安装(`main`)
|
|
76
65
|
|
|
77
|
-
在仓库根目录执行以下命令。`npm run pack:release`
|
|
66
|
+
在仓库根目录执行以下命令。`npm run pack:release` 构建发行包,最后一条安装命令将归档装入指定的 npm prefix。
|
|
78
67
|
|
|
79
68
|
```bash
|
|
80
69
|
git clone https://github.com/AnySwarm/anyswarm.git && cd anyswarm
|
|
81
70
|
npm ci --no-audit --no-fund
|
|
82
71
|
pack_dir=$(mktemp -d)
|
|
83
72
|
npm run pack:release -- "$pack_dir"
|
|
84
|
-
|
|
73
|
+
npm install -g --prefix "$HOME/.local" "$pack_dir"/*.tgz
|
|
85
74
|
export PATH="$HOME/.local/bin:$PATH"
|
|
86
75
|
anyswarm --version
|
|
87
76
|
```
|
|
@@ -90,43 +79,33 @@ anyswarm --version
|
|
|
90
79
|
|
|
91
80
|
### 更新 CLI
|
|
92
81
|
|
|
93
|
-
|
|
94
|
-
- 安装脚本。运行 `anyswarm update`,校验 GitHub Release 归档并验证新 CLI 可用后再切换。更新失败时,原 CLI 仍可用。
|
|
82
|
+
用同一套 Node.js 和 npm prefix 执行 `npm install -g @anyswarm/core@latest` 更新,或执行 `npm uninstall -g @anyswarm/core` 卸载。如果 npm 报 `EACCES`,请改用用户目录下的 Node,或用 `npm install -g --prefix "$HOME/.local" @anyswarm/core` 安装到有写权限的目录。将 `$HOME/.local/bin` 加入 PATH,后续更新和卸载继续使用该 prefix。
|
|
95
83
|
|
|
96
|
-
|
|
84
|
+
如果曾用旧版脚本安装 v0.5.0 或 v0.5.1,请检查 `$(npm prefix -g)/bin` 下的 `anyswarm`、`anys` 和 `swarm`。只清理指向旧安装 `lib/anyswarm/current` 的链接,再用 npm 安装。AnySwarm 配置存放在 CLI 安装目录之外。
|
|
97
85
|
|
|
98
86
|
更新项目 SDK 时,在项目目录内使用该项目的包管理器。
|
|
99
87
|
|
|
100
88
|
## 2. 准备 OpenSandbox 与 Worker
|
|
101
89
|
|
|
102
|
-
|
|
90
|
+
在准备运行 OpenSandbox 和 Worker 的本机执行:
|
|
103
91
|
|
|
104
92
|
```bash
|
|
105
|
-
|
|
106
|
-
anyswarm setup --backend pi
|
|
107
|
-
anyswarm doctor --smoke
|
|
93
|
+
anyswarm setup
|
|
108
94
|
```
|
|
109
95
|
|
|
96
|
+
setup 自动识别操作系统和 Node 版本,检查本机 Docker,并寻找已保存的配置或已安装的 Pi、Codex。缺依赖时,按提示处理后重试。用 `anyswarm doctor` 可以只读检查本机依赖与 Lifecycle 连接。
|
|
97
|
+
|
|
98
|
+
如果缺执行器,可用 `npm install -g @earendil-works/pi-coding-agent` 安装 Pi,或用 `npm install -g @openai/codex` 安装 Codex。macOS 也支持独立可执行的 Codex,前提是同版本有 Linux npm 包。只找到一种兼容执行器时,setup 会自动选用。两种都兼容时,交互式 setup 会提示选择。自动化里可运行 `anyswarm setup --backend pi` 或 `anyswarm setup --backend codex`。
|
|
99
|
+
|
|
110
100
|
裸 `setup` 会复用上次保存的可执行文件路径。换一份安装时,用 `--backend pi --backend-path /absolute/path/to/bin/pi` 或相应的 Codex 选项。要固定已安装版本,加 `--backend-version 1.7.0` 并替换为你要使用的版本号。固定版本保存后,如果可执行文件报告其他版本,检查会明确失败。重新显式选择 backend 并省略版本参数,可恢复跟随该安装的升级。
|
|
111
101
|
|
|
112
102
|
macOS 在原生架构的 Docker 容器内准备同一发行版的 Linux 包。配置保存前会核对 Worker 版本、执行器启动和受控协议 smoke。没有保存的选择时,如果发现两种 backend,交互终端会提示选择。自动化调用可用 `--backend` 明确指定。
|
|
113
103
|
|
|
114
104
|
首次本地 setup 默认使用 `127.0.0.1:8080`,用选择的本机程序和实际 SDK 包构建 Worker,并拉取固定版本的 OpenSandbox 1.2.1 上游组件。自检经受控模型验证 Worker、Bridge、Gateway、文件、导出和 Sandbox 删除,之后保存托管连接。成功结果为 `"ok": true` 和 `"infrastructure": "ready"`。重复 setup 会恢复已经停止的托管服务并重新自检。测试时可用 `ANYSWARM_CONFIG_DIR=/path/to/private-directory` 和单独的空闲端口。
|
|
115
105
|
|
|
116
|
-
AnySwarm Worker 在本机构建,内容匹配时复用已有镜像。构建的基础镜像、apt 和 npm 依赖仍可能需要联网。继续用 AnySwarm 环境变量或项目配置提供模型端点和凭据。setup
|
|
117
|
-
|
|
118
|
-
### 连接已有 OpenSandbox
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
export OPEN_SANDBOX_API_KEY='<管理员提供的密钥>'
|
|
122
|
-
anyswarm setup --mode existing --endpoint https://sandbox.example.net \
|
|
123
|
-
--public-url https://runtime.example.net/anyswarm
|
|
124
|
-
anyswarm doctor --smoke
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
existing setup 验证鉴权,将 endpoint、密钥和回调地址保存在仅当前用户可读写的配置中。远端 Controller 需要 Node 与网络访问,服务管理员准备匹配的 Worker 镜像。运行探测和项目之前,用 `ANYSWARM_WORKER_IMAGE` 指定该镜像。`doctor` 只读检查配置与 Lifecycle;`doctor --smoke` 创建临时 Sandbox,验证控制端访问 Worker 和 Sandbox 回连 Runtime,最后确认导出与删除。已保存远端连接不可达时,会报告该连接的具体错误。
|
|
106
|
+
AnySwarm Worker 在本机构建,内容匹配时复用已有镜像。构建的基础镜像、apt 和 npm 依赖仍可能需要联网。继续用 AnySwarm 环境变量或项目配置提供模型端点和凭据。setup 的受控模型自检不会验证真实模型凭据。可以用 `anyswarm doctor --smoke` 再跑一次受控自检。
|
|
128
107
|
|
|
129
|
-
|
|
108
|
+
本地服务与 CLI 运行在同一台机器。需要接入自己管理的服务时,请参考 [Sandbox](sandbox.md)。
|
|
130
109
|
|
|
131
110
|
### 诊断镜像可用性
|
|
132
111
|
|
package/docs/zh/reference/api.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install @anyswarm/core
|
|
|
17
17
|
|
|
18
18
|
在代码中从 `@anyswarm/core` 导入 SDK。在项目目录运行 `npm exec -- anyswarm` 可调用随依赖安装的 CLI。要在任意目录直接运行 `anyswarm`,请按[全局 CLI 安装](../quickstart.md#1-安装-anyswarm)操作。
|
|
19
19
|
|
|
20
|
-
要安装经校验的[源码构建归档](../quickstart.md#从源码构建并安装main),使用下面的命令。[发行版本页](../latest.md#
|
|
20
|
+
要安装经校验的[源码构建归档](../quickstart.md#从源码构建并安装main),使用下面的命令。[发行版本页](../latest.md#v051)提供固定版本的安装命令。
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
npm install --ignore-scripts /path/to/verified-anyswarm.tgz
|
package/docs/zh/reference/cli.md
CHANGED
|
@@ -5,100 +5,40 @@ section: 参考手册
|
|
|
5
5
|
order: 16
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
宿主命令为 `anyswarm`。无参数时显示 Quickstart,命令加上 `--help` 可查看选项。Worker 内的 Agent 通过 `swarm` 调用 Bridge 上的 Service。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 宿主命令
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### 子命令一览
|
|
15
|
-
|
|
16
|
-
| 命令 | 用途 |
|
|
12
|
+
| 用途 | 命令 |
|
|
17
13
|
| --- | --- |
|
|
18
|
-
| `anyswarm
|
|
19
|
-
|
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
|
|
|
23
|
-
| `
|
|
24
|
-
| `anys eject <code\|autoresearch\|super\|example> --dir <target>` | 导出完整 TypeScript 作者源码并绑定 SDK 来源 |
|
|
25
|
-
| `anyswarm --version` | 输出当前安装的 `@anyswarm/core` 版本 |
|
|
26
|
-
| `anyswarm setup [--mode existing\|local] [--endpoint <url>] [--public-url <url>] [--backend pi\|codex] [--backend-path <executable>] [--backend-version <version>] [--config <module>]` | 本地启动托管 OpenSandbox 并自动生成密钥(`--mode local`),或验证并保存已有 OpenSandbox 连接(`--mode existing`);`local` 模式同时准备并探测所选 Worker 镜像 |
|
|
27
|
-
| `anyswarm doctor [--config <module>] [--smoke]` | 只读诊断配置与 Lifecycle 鉴权;加 `--smoke` 拉起真实 Pi/Codex Worker 运行端到端冒烟验证 |
|
|
28
|
-
| `anyswarm update` | 校验、暂存并启用托管安装的最新稳定 CLI。全局 npm 安装会显示适用于当前 prefix 的更新命令 |
|
|
29
|
-
| `anyswarm --harness <module> --prompt <text> [options]` | 在前台对项目目录运行内置、本地 TypeScript/ESM 或 npm 包 Harness |
|
|
30
|
-
| `anyswarm --harness <module> --mode rpc [options]` | 通过 JSONL `stdin`/`stdout` 以 RPC 模式运行 Harness,支持 `ready`、`run`、`status`、`stop` 与成员控制 |
|
|
31
|
-
| `anyswarm recover --run-dir <dir> --config <module>` | 在同主机、同次启动归属下对持久化 Run 执行仅清理恢复并输出最终回执 |
|
|
32
|
-
| `anyswarm trace [--root] <runs-dir> [--port 8787] [--open]` | 在 `127.0.0.1` 启动内置浏览器 [Trace Viewer](../trace-viewer.md) |
|
|
33
|
-
|
|
34
|
-
### 流式终端
|
|
35
|
-
|
|
36
|
-
在终端运行 `anys` 后输入 `/use <harness> [prompt]`。安装包含相应应用时,可用 `/code`、`/super` 或 `/autoresearch` 快捷进入。也可以选可信的本地文件(如 `/use ./harness.ts`)或当前目录下安装的包。`anys -u ./harness.ts "任务"` 会直接选择 Harness 并提交首轮输入。用 `--config ./config.ts` 指定可信配置,或在界面里通过 `/config`、`/doctor` 排查启动问题。
|
|
37
|
-
|
|
38
|
-
在 Linux 主机的项目目录运行 `anys -u code [任务]`,主 Agent 会直接编辑。需要并行时,可以在对话里要求它派子 Agent。Code 会话运行时,`/diff` 显示最近一轮的文件、补丁预览和保存位置。`/agents` 可查看成员,`@<编辑器> <消息>` 可引导运行中的成员,`/stop <编辑器>` 可停止该成员。用 `/y` 或 `/n` 回应内联确认,用 `/reply <ID> <答复>` 回答问题。[Code 快速上手](../../../examples/code/README.md)
|
|
39
|
-
|
|
40
|
-
顶栏显示 Run 阶段、Agent 计数和工作目录或业务摘要,中间滚动显示消息和活动。输入框固定在底部,边框标出当前 Harness 和已选定的 Agent。改变终端尺寸时,文本重新换行,未提交的内容会保留。Enter 提交,Alt+Enter 换行,Tab 补全命令。
|
|
41
|
-
|
|
42
|
-
| 输入 | 行为 |
|
|
43
|
-
| --- | --- |
|
|
44
|
-
| `/use <harness> [prompt]` | 切换模式。前台 Run 正在执行时,输入 `/y` 确认停止并等待清理后切换。 |
|
|
45
|
-
| `/agents`、`/target <agent\|main>` | 查看成员与控制能力。上下键选中后按 Enter 锁定目标,也可以直接指定。 |
|
|
46
|
-
| `@agent 消息`、`/to agent 消息` | 给指定成员发送 steer。用 `/to agent --follow-up 消息` 排入后续轮次。 |
|
|
47
|
-
| `/stop [agent]`、Ctrl+C | 停止指定成员或整个 Run。Ctrl+C 中断目标 Agent 的轮次或取消当前选择。 |
|
|
48
|
-
| `/y`、`/n`、`/reply [id] <answer>` | 回答内联决策。有多个确认项时可用 `/approve <id>` 或 `/reject <id>`。 |
|
|
49
|
-
| `/status` | 查看 Run 和产物路径。 |
|
|
50
|
-
| `/trace [记录目录]` | 启动本地 Trace Viewer 并打印 URL。指定目录可切换记录来源。前台模式默认可查看同一输出根目录下的连续 Run。 |
|
|
51
|
-
| `/quit` | 等待前台 Run 清理后退出。观察后台 Session 时只断开终端,后台仍继续运行,也可提交 `q`。 |
|
|
14
|
+
| 准备和验证本地环境 | `anyswarm setup`、`anyswarm doctor --smoke` |
|
|
15
|
+
| 升级 CLI | `anyswarm update` 打印当前全局安装对应的 npm 升级命令。在同一 Node/npm 环境下执行该命令。 |
|
|
16
|
+
| 运行可编辑 Harness | `anyswarm run ./project.ts --cwd ./input --config ./config.ts --prompt "检查项目"` |
|
|
17
|
+
| 运行内置 Harness 或连接客户端 | `anyswarm --harness subagents --prompt "读取 README.md" --output-dir ./runs`,或 `anyswarm --harness subagents --mode rpc` |
|
|
18
|
+
| 导出源码与精确绑定的 SDK | `anyswarm eject example --dir ./my-harness` |
|
|
19
|
+
| 查看记录或恢复待清理资源 | `anyswarm trace --root ./runs --port 8787 --open`、`anyswarm recover --run-dir <dir> --config <module>` |
|
|
52
20
|
|
|
53
|
-
|
|
21
|
+
`anyswarm --version` 显示已安装版本。安装方式、本地准备和连接已有 OpenSandbox 的步骤见[快速上手](../quickstart.md)。
|
|
54
22
|
|
|
55
|
-
|
|
23
|
+
## 运行 Harness
|
|
56
24
|
|
|
57
|
-
|
|
25
|
+
参数可为内置名称、显式 TypeScript 或 ESM 路径,也可为从启动目录解析的 npm 包。内置名称有 `subagents`、`autoresearch`、`taskpool`、`peermesh`、`substrate`、`lead-worker`、`notes` 和 `messages`。项目默认为启动目录,`--cwd` 可指定其他目录,`--config` 可指定可信模块,`--output-dir` 可指定 Run 记录根目录。
|
|
58
26
|
|
|
59
|
-
|
|
27
|
+
单次运行由 prompt 开始。直接用 `run` 启动源码 Harness 时,可以省略 prompt 并使用默认值。标准输出连接终端时,显示 Run、Agent 和可见的 Service 阶段,产物路径、清理状态,以及查看 Trace 的命令。重定向标准输出时,只输出一条 JSON 结果或启动错误。源码和 Harness 诊断写到标准错误。`run` 也可执行普通的可信源码脚本,并传递原始参数。
|
|
60
28
|
|
|
61
|
-
|
|
29
|
+
多轮客户端使用 `--mode rpc`。收到 JSONL 的 `ready` 后,发送带 `cwd` 和 `prompt` 的 `run` 请求。Harness 支持交互生命周期时可传 `--lifetime interactive`,客户端能回答问题时可传 `--interaction questions`。回应、事件和最终结果写到标准输出。用 `describe` 查询控制能力,用 `stop` 开始清理。[HarnessSession 示例](../../../examples/harness-session/README.md)
|
|
62
30
|
|
|
63
|
-
|
|
64
|
-
# 对当前目录前台运行内置 Subagents
|
|
65
|
-
anyswarm --harness subagents --prompt "修复解析器并补充测试"
|
|
66
|
-
|
|
67
|
-
# 显式指定目标目录、配置模块与输出根目录
|
|
68
|
-
anyswarm --harness taskpool \
|
|
69
|
-
--cwd ./my-project \
|
|
70
|
-
--config ./taskpool.config.ts \
|
|
71
|
-
--output-dir ./runs \
|
|
72
|
-
--prompt "修复所有失败的单元测试"
|
|
73
|
-
|
|
74
|
-
# 运行你自定义打包的本地 TypeScript/ESM Harness 模块
|
|
75
|
-
anyswarm --harness ./review-harness.ts --prompt "审计错误处理分支"
|
|
76
|
-
|
|
77
|
-
# JSONL RPC 模式(收到 ready 后发送 {"id":"1","operation":"run","input":{"cwd":"...","prompt":"..."}})
|
|
78
|
-
anyswarm --harness subagents --mode rpc --output-dir ./runs
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
- **内置 Harness 名称**:`subagents`、`taskpool`、`peermesh`、`substrate`、`lead-worker`、`notes`、`messages`。
|
|
82
|
-
- **模块解析规则**:可传内置名称、显式 `.ts`/`.mts` 或 ESM 路径,或当前启动目录已安装的 npm 包名。
|
|
83
|
-
- **RPC 协议(`--rpc` 或 `--mode rpc`)**:`stdout` 输出 JSONL 协议帧,`stderr` 输出诊断信息。收到 `ready` 后发送包含 `cwd` 与 `prompt` 的 `run` 请求启动任务。
|
|
84
|
-
|
|
85
|
-
### 会话选项与控制命令
|
|
86
|
-
|
|
87
|
-
- **生命周期(`--lifetime task|interactive`)**:默认为单次任务模式 `task`;Subagents 等支持持续对话的 Harness 可选 `interactive`,保留会话直到截止时间或收到 `stop`。
|
|
88
|
-
- **人机问答(`--interaction none|questions`)**:默认 `none`;设为 `questions` 表示客户端支持在运行中途响应 Agent 发起的授权提问。
|
|
89
|
-
- **消息通道**:带 `--prompt` 的前台命令会立即发起工作;在 `interactive` 或 `questions` 模式下,后续控制命令通过 JSONL 通道交互。`--rpc` 或 `--mode rpc` 则等待 `run` 命令后再启动。
|
|
90
|
-
- **支持的操作**:`describe`(查询能力)、`status`(读取快照)、`answer`(按 `questionId` 回答提问)、`stop`(收尾整次 Run);成员查询与控制包括 `agent.getState`、`agent.getStats`、`agent.getMessages` 以及 `agent.configure`、`agent.compact`、`agent.abortRetry`、`agent.clearQueue`、`agent.send`、`agent.interrupt`、`agent.stop`(实际开放范围由具体 Harness 与执行器决定)。最终结果会分别记录报告保存状态与清理事实。
|
|
31
|
+
导出后,在导出目录执行 `npm install`,再用项目本地 CLI 启动可编辑入口,例如 `npm run start -- --prompt "检查项目"`。[Code](../../../examples/code/README.md) 和 [Personal](../../../examples/super/README.md) 展示进阶 SDK 用法。
|
|
91
32
|
|
|
92
33
|
### AutoResearch
|
|
93
34
|
|
|
35
|
+
AutoResearch 是非交互研究示例。在独立 Sandbox 中启动平级成员,通过研究 Service 协作,并将候选、train 和 final 记录保留在 [Trace Viewer](../trace-viewer.md)。
|
|
36
|
+
|
|
94
37
|
```sh
|
|
95
|
-
|
|
96
|
-
anys -u autoresearch
|
|
38
|
+
anyswarm --harness autoresearch --config ./research.ts --prompt "研究目标" --output-dir ./runs
|
|
97
39
|
```
|
|
98
40
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
用 `anys -u autoresearch --config ./research.ts "研究目标"` 配置自定义可信评测器,或用 `anys eject autoresearch` 导出源码。[快速上手](../../../examples/autoresearch/README.md)
|
|
41
|
+
[AutoResearch 指南](../../../examples/autoresearch/README.md)包含固定版本的 FrontierCS-2 demo 准备步骤及源码导出方式。
|
|
102
42
|
|
|
103
43
|
## 统一环境变量清单
|
|
104
44
|
|
package/docs/zh/sandbox.md
CHANGED
|
@@ -23,10 +23,10 @@ export OPEN_SANDBOX_API_KEY='<管理员提供的密钥>'
|
|
|
23
23
|
anyswarm setup --mode existing \
|
|
24
24
|
--endpoint https://sandbox.example.net \
|
|
25
25
|
--public-url https://runtime.example.net/anyswarm
|
|
26
|
-
anyswarm doctor --smoke
|
|
26
|
+
anyswarm doctor --mode existing --smoke
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
`--mode existing` 会先校验管理端 API 密钥,再保存远程连接配置(写入仅当前用户可读写的本地配置文件),不会提前启动容器。随后运行 `anyswarm doctor --smoke`,会创建一个临时沙箱并走完完整清理流程,依次验证「宿主机访问 Worker → 沙箱回连 Runtime → 文件导出 → 沙箱销毁」整条链路。
|
|
29
|
+
`--mode existing` 会先校验管理端 API 密钥,再保存远程连接配置(写入仅当前用户可读写的本地配置文件),不会提前启动容器。随后运行 `anyswarm doctor --mode existing --smoke`,会创建一个临时沙箱并走完完整清理流程,依次验证「宿主机访问 Worker → 沙箱回连 Runtime → 文件导出 → 沙箱销毁」整条链路。
|
|
30
30
|
|
|
31
31
|
在远程模式下,Worker 镜像由服务端管理员预置,使用 `ANYSWARM_WORKER_IMAGE` 选择。运行 `anyswarm` 的控制端只需具备 Node.js 环境和网络连通性。跨不可信网络传输凭据时,请务必启用 TLS(HTTPS)或走可信私网。
|
|
32
32
|
|
|
@@ -49,7 +49,7 @@ const remote = createSandbox({
|
|
|
49
49
|
|
|
50
50
|
连接配置的生效优先级从高到低为:**SDK/CLI 显式传参 > 环境变量 > `anyswarm setup` 保存的本地配置 > 本地默认值**。`createSandbox()` 只负责校验并冻结配置,不会立即创建容器;直到调用 `runtime.spawn()` 时才会实际分配沙箱。
|
|
51
51
|
|
|
52
|
-
如果沙箱运行在远程主机或反向代理之后,可在 `createRuntime()` 中通过 `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` 声明一个沙箱可访问的统一回调地址(反向代理的路径前缀会自动保留;高级场景可配合 `bindHost` 和 `bindPort` 固定监听端口)。运行 `anyswarm doctor` 可查看当前生效的回调地址;若沙箱无法回连 Runtime,`--smoke` 探测会明确提示排查回调地址、监听端口和代理路由。同时,OpenSandbox 服务端也需向外发布控制端可达的 endpoint 及所需请求头。
|
|
52
|
+
如果沙箱运行在远程主机或反向代理之后,可在 `createRuntime()` 中通过 `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` 声明一个沙箱可访问的统一回调地址(反向代理的路径前缀会自动保留;高级场景可配合 `bindHost` 和 `bindPort` 固定监听端口)。运行 `anyswarm doctor --mode existing` 可查看当前生效的回调地址;若沙箱无法回连 Runtime,`--smoke` 探测会明确提示排查回调地址、监听端口和代理路由。同时,OpenSandbox 服务端也需向外发布控制端可达的 endpoint 及所需请求头。
|
|
53
53
|
|
|
54
54
|
## 4. 资源与旧配置迁移
|
|
55
55
|
|
package/examples/README.md
CHANGED
|
@@ -12,6 +12,16 @@ artifact export. Its same default definition is used by SDK, foreground and
|
|
|
12
12
|
RPC. [HarnessSession clients](harness-session/README.md) exercise the public
|
|
13
13
|
protocol with a zero-Runtime fixture.
|
|
14
14
|
|
|
15
|
+
## AutoResearch showcase
|
|
16
|
+
|
|
17
|
+
[AutoResearch](autoresearch/README.md) runs equal peers through a finite
|
|
18
|
+
research task with shared budgets, a trusted evaluator and browser Trace
|
|
19
|
+
records. The guide includes the pinned FrontierCS-2 demo and a configurable
|
|
20
|
+
evaluator path.
|
|
21
|
+
|
|
22
|
+
[Code](code/README.md), [Personal](super/README.md), and
|
|
23
|
+
[HarnessSession](harness-session/README.md) are advanced SDK examples.
|
|
24
|
+
|
|
15
25
|
## Choose a collaboration example
|
|
16
26
|
|
|
17
27
|
| Directory | Coordination | Services created by the example | Facilities you supply |
|
|
@@ -42,7 +52,7 @@ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
|
|
|
42
52
|
sdk=node_modules/@anyswarm/core
|
|
43
53
|
cp -R "$sdk"/examples/subagents demo
|
|
44
54
|
cd demo
|
|
45
|
-
../node_modules/.bin/
|
|
55
|
+
../node_modules/.bin/anyswarm run ./project.ts --cwd /absolute/path/to/project --prompt 'Implement and verify the requested change'
|
|
46
56
|
```
|
|
47
57
|
|
|
48
58
|
For another collaboration mechanism, replace `subagents` in the copy command
|
|
@@ -66,7 +76,7 @@ archive with `npm install --no-save "$ANYSWARM_SDK_ARCHIVE"` in that example's
|
|
|
66
76
|
directory before running its TypeScript entry.
|
|
67
77
|
|
|
68
78
|
Use the example's README for its configuration and external facilities.
|
|
69
|
-
Run `
|
|
79
|
+
Run `anyswarm run /absolute/path/to/example/project.ts --prompt '…'` from
|
|
70
80
|
the input project to use the same editable example from elsewhere. The
|
|
71
81
|
CLI also includes each example's built-in name as a convenience. The host
|
|
72
82
|
captures the initial directory and writes outputs outside it by default.
|
|
@@ -80,9 +90,10 @@ See [FATE](../benchmarks/fate/README.md) and [Lead–Worker Orders](../benchmark
|
|
|
80
90
|
## Export an editable Harness
|
|
81
91
|
|
|
82
92
|
```sh
|
|
83
|
-
|
|
93
|
+
anyswarm eject example --dir ./my-harness
|
|
84
94
|
cd my-harness
|
|
85
|
-
|
|
95
|
+
npm install
|
|
96
|
+
npm run start
|
|
86
97
|
```
|
|
87
98
|
|
|
88
99
|
Edit `business.ts` and run it again to see your own result. Export includes the
|
|
@@ -90,7 +101,7 @@ complete source and an SDK archive dependency bound to that package's contents.
|
|
|
90
101
|
Run `npm install` to install that local archive when moving the export to another
|
|
91
102
|
machine. `anyswarm-source.json` records source revision, SDK source, content and
|
|
92
103
|
archive digests. Application teams register the same source manifest for
|
|
93
|
-
`
|
|
104
|
+
`anyswarm eject code`, `anyswarm eject autoresearch` and `anyswarm eject super`.
|
|
94
105
|
|
|
95
106
|
## Smaller SDK tutorials
|
|
96
107
|
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
Run this complete example with the installed AnySwarm CLI.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
anyswarm run ./harness.ts
|
|
7
|
+
anyswarm run ./harness.ts --config ./config.ts --prompt 'Create a greeting'
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
Edit `business.ts` and run the command again to change the result. `harness.ts`
|
|
11
11
|
defines the Harness lifecycle, `business.ts` contains its rule, and `config.ts`
|
|
12
12
|
provides its default public configuration. This example uses no model or Sandbox.
|
|
13
13
|
|
|
14
|
-
`
|
|
14
|
+
`anyswarm eject example --dir ./my-harness` exports these sources and a local SDK
|
|
15
15
|
archive. The generated package depends on that archive, so `npm install` retains
|
|
16
|
-
the exact candidate SDK. Direct `
|
|
16
|
+
the exact candidate SDK. Direct `anyswarm run` can also resolve the invoking CLI's SDK.
|
|
17
17
|
Use the same candidate CLI recorded in `anyswarm-source.json`.
|
|
18
18
|
|
|
19
19
|
Application authors use the same export mechanism by providing `eject.json` in
|