@anyswarm/core 0.5.0 → 0.5.1
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/README.md +11 -10
- package/deploy/worker/Dockerfile +12 -4
- package/dist/deploy/worker/Dockerfile +12 -4
- package/dist/examples/README.md +24 -12
- package/dist/examples/authoring/README.md +24 -0
- package/dist/examples/authoring/business.d.ts +2 -0
- package/dist/examples/authoring/business.js +4 -0
- package/dist/examples/authoring/config.d.ts +5 -0
- package/dist/examples/authoring/config.js +2 -0
- package/dist/examples/authoring/eject.json +5 -0
- package/dist/examples/authoring/harness.d.ts +4 -0
- package/dist/examples/authoring/harness.js +19 -0
- package/dist/examples/autoresearch/README.md +33 -0
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
- package/dist/examples/autoresearch/config.d.ts +51 -0
- package/dist/examples/autoresearch/config.js +57 -0
- package/dist/examples/autoresearch/demo.d.ts +11 -0
- package/dist/examples/autoresearch/demo.js +52 -0
- package/dist/examples/autoresearch/eject.json +15 -0
- package/dist/examples/autoresearch/frontiercs2.d.ts +87 -0
- package/dist/examples/autoresearch/frontiercs2.js +211 -0
- package/dist/examples/autoresearch/prepare.d.ts +95 -0
- package/dist/examples/autoresearch/prepare.js +257 -0
- package/dist/examples/autoresearch/process.d.ts +13 -0
- package/dist/examples/autoresearch/process.js +48 -0
- package/dist/examples/autoresearch/project.d.ts +115 -0
- package/dist/examples/autoresearch/project.js +410 -0
- package/dist/examples/autoresearch/research-service.d.ts +106 -0
- package/dist/examples/autoresearch/research-service.js +255 -0
- package/dist/examples/code/README.md +25 -0
- package/dist/examples/code/REQUIREMENTS.zh.md +11 -0
- package/dist/examples/code/candidate.d.ts +19 -0
- package/dist/examples/code/candidate.js +80 -0
- package/dist/examples/code/config.d.ts +32 -0
- package/dist/examples/code/config.js +18 -0
- package/dist/examples/code/eject.json +5 -0
- package/dist/examples/code/project.d.ts +3 -0
- package/dist/examples/code/project.js +605 -0
- package/dist/examples/code/prompts.d.ts +5 -0
- package/dist/examples/code/prompts.js +12 -0
- package/dist/examples/code/verification.d.ts +19 -0
- package/dist/examples/code/verification.js +268 -0
- package/dist/examples/code/worktree.d.ts +17 -0
- package/dist/examples/code/worktree.js +233 -0
- package/dist/examples/harness-session/README.md +3 -6
- package/dist/examples/lead-worker/harness/dynamic-scheduler.d.ts +2 -1
- package/dist/examples/lead-worker/harness/dynamic-scheduler.js +5 -2
- package/dist/examples/lead-worker/harness/index.d.ts +60 -0
- package/dist/examples/lead-worker/harness/index.js +77 -6
- package/dist/examples/lead-worker/project.js +2 -2
- package/dist/examples/lead-worker/services/board.d.ts +5 -0
- package/dist/examples/lead-worker/services/board.js +19 -1
- package/dist/examples/messages/README.md +5 -5
- package/dist/examples/messages/handoff.d.ts +2 -0
- package/dist/examples/messages/handoff.js +5 -1
- package/dist/examples/messages/project.js +52 -2
- package/dist/examples/notes/README.md +13 -18
- package/dist/examples/notes/project.js +67 -6
- package/dist/examples/peermesh/harness/router.js +3 -1
- package/dist/examples/peermesh/harness/team.d.ts +8 -0
- package/dist/examples/peermesh/harness/team.js +13 -0
- package/dist/examples/peermesh/project.js +22 -4
- package/dist/examples/services/agent-control/README.md +3 -3
- package/dist/examples/services/mathlib-search/Dockerfile +4 -2
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/mcp-managed/README.md +2 -2
- package/dist/examples/services/persistent-board/README.md +13 -3
- package/dist/examples/services/persistent-board/business.d.ts +7 -0
- package/dist/examples/services/persistent-board/business.js +7 -0
- package/dist/examples/services/persistent-board/index.js +10 -0
- package/dist/examples/services/persistent-board/live.d.ts +3 -0
- package/dist/examples/services/persistent-board/live.js +58 -0
- package/dist/examples/subagents/README.md +5 -5
- package/dist/examples/subagents/business.js +3 -1
- package/dist/examples/subagents/harness/controller.d.ts +15 -0
- package/dist/examples/subagents/harness/controller.js +181 -32
- package/dist/examples/subagents/project.d.ts +2 -0
- package/dist/examples/subagents/project.js +43 -34
- package/dist/examples/subagents/prompts/prompts.d.ts +1 -0
- package/dist/examples/subagents/prompts/prompts.js +3 -0
- package/dist/examples/subagents/services/collaboration-service.d.ts +3 -2
- package/dist/examples/subagents/services/collaboration-service.js +14 -2
- package/dist/examples/substrate/README.md +2 -2
- package/dist/examples/substrate/harness/index.d.ts +1 -1
- package/dist/examples/substrate/harness/index.js +77 -12
- package/dist/examples/substrate/project.js +4 -1
- package/dist/examples/super/README.md +40 -0
- package/dist/examples/super/actions.d.ts +95 -0
- package/dist/examples/super/actions.js +230 -0
- package/dist/examples/super/artifact.d.ts +4 -0
- package/dist/examples/super/artifact.js +51 -0
- package/dist/examples/super/config.d.ts +80 -0
- package/dist/examples/super/config.js +83 -0
- package/dist/examples/super/coordinator.d.ts +33 -0
- package/dist/examples/super/coordinator.js +151 -0
- package/dist/examples/super/daemon.d.ts +11 -0
- package/dist/examples/super/daemon.js +109 -0
- package/dist/examples/super/decisions.d.ts +8 -0
- package/dist/examples/super/decisions.js +52 -0
- package/dist/examples/super/eject.json +5 -0
- package/dist/examples/super/execution.d.ts +11 -0
- package/dist/examples/super/execution.js +136 -0
- package/dist/examples/super/github.d.ts +62 -0
- package/dist/examples/super/github.js +269 -0
- package/dist/examples/super/inbox.d.ts +162 -0
- package/dist/examples/super/inbox.js +284 -0
- package/dist/examples/super/location.d.ts +5 -0
- package/dist/examples/super/location.js +64 -0
- package/dist/examples/super/outbox.d.ts +5 -0
- package/dist/examples/super/outbox.js +103 -0
- package/dist/examples/super/project.d.ts +111 -0
- package/dist/examples/super/project.js +253 -0
- package/dist/examples/super/prompts.d.ts +3 -0
- package/dist/examples/super/prompts.js +25 -0
- package/dist/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
- package/dist/examples/taskpool/harness/controller.d.ts +35 -6
- package/dist/examples/taskpool/harness/controller.js +73 -7
- package/dist/examples/taskpool/project.js +18 -2
- package/dist/scripts/anyswarm-applications.d.ts +19 -0
- package/dist/scripts/anyswarm-applications.js +19 -0
- package/dist/scripts/anyswarm-arguments.d.ts +35 -5
- package/dist/scripts/anyswarm-arguments.js +87 -23
- package/dist/scripts/anyswarm-author.d.ts +5 -0
- package/dist/scripts/anyswarm-author.js +24 -0
- package/dist/scripts/anyswarm-eject.d.ts +11 -0
- package/dist/scripts/anyswarm-eject.js +164 -0
- package/dist/scripts/anyswarm-harnesses.d.ts +2 -0
- package/dist/scripts/anyswarm-harnesses.js +31 -0
- package/dist/scripts/anyswarm-installation.js +19 -13
- package/dist/scripts/anyswarm-launch.d.ts +37 -0
- package/dist/scripts/anyswarm-launch.js +86 -0
- package/dist/scripts/anyswarm-project.d.ts +12 -2
- package/dist/scripts/anyswarm-project.js +121 -20
- package/dist/scripts/anyswarm-source-runner.d.ts +1 -0
- package/dist/scripts/anyswarm-source-runner.js +232 -0
- package/dist/scripts/anyswarm-tui-config.d.ts +36 -0
- package/dist/scripts/anyswarm-tui-config.js +189 -0
- package/dist/scripts/anyswarm-tui-session.d.ts +66 -0
- package/dist/scripts/anyswarm-tui-session.js +304 -0
- package/dist/scripts/anyswarm-tui-terminal.d.ts +41 -0
- package/dist/scripts/anyswarm-tui-terminal.js +154 -0
- package/dist/scripts/anyswarm-tui.d.ts +2 -0
- package/dist/scripts/anyswarm-tui.js +1012 -0
- package/dist/scripts/anyswarm.js +47 -2
- package/dist/scripts/build-provenance.json +1 -0
- package/dist/scripts/build.js +7 -1
- package/dist/scripts/generate-architecture-api.js +2 -0
- package/dist/scripts/generate-architecture-prompts.js +24 -2
- package/dist/scripts/local-environment.d.ts +6 -1
- package/dist/scripts/local-environment.js +52 -16
- package/dist/scripts/local-setup-smoke.js +3 -2
- package/dist/scripts/local-setup-worker.d.ts +1 -1
- package/dist/scripts/local-setup-worker.js +15 -6
- package/dist/scripts/local-setup.d.ts +2 -2
- package/dist/scripts/local-setup.js +72 -12
- package/dist/scripts/opensandbox-agent-worker.js +2 -2
- package/dist/scripts/pack-release.d.ts +1 -0
- package/dist/scripts/pack-release.js +63 -0
- package/dist/scripts/pi-session-bridge.js +11 -3
- package/dist/scripts/run-harness.js +3 -1
- package/dist/scripts/setup-bootstrap.js +43 -6
- package/dist/src/core/allocation-ledger.js +4 -3
- package/dist/src/core/host-identity.d.ts +2 -0
- package/dist/src/core/host-identity.js +11 -0
- package/dist/src/core/index.d.ts +4 -2
- package/dist/src/core/index.js +12 -4
- package/dist/src/core/mcp-service.js +2 -2
- package/dist/src/core/runtime-management.d.ts +6 -0
- package/dist/src/core/runtime-management.js +24 -0
- package/dist/src/core/sandbox/executor-driver.d.ts +4 -2
- package/dist/src/core/sandbox/executor-driver.js +12 -14
- package/dist/src/core/sandbox/local-executor.d.ts +13 -1
- package/dist/src/core/sandbox/local-executor.js +69 -19
- package/dist/src/core/sandbox/local-worker.js +32 -21
- package/dist/src/core/sandbox/opensandbox-backend.d.ts +2 -0
- package/dist/src/core/sandbox/opensandbox-backend.js +36 -11
- package/dist/src/core/sandbox/sandbox-connection.d.ts +2 -0
- package/dist/src/core/sandbox/sandbox-connection.js +14 -6
- package/dist/src/core/service-live-state.d.ts +14 -0
- package/dist/src/core/service-live-state.js +161 -0
- package/dist/src/core/service-observation-types.d.ts +21 -1
- package/dist/src/core/service-process.d.ts +1 -1
- package/dist/src/core/service-process.js +45 -4
- package/dist/src/core/service-types.d.ts +5 -1
- package/dist/src/core/services.d.ts +1 -1
- package/dist/src/core/services.js +8 -3
- package/dist/src/core/types.d.ts +3 -0
- package/dist/src/core/worker-image.js +3 -3
- package/dist/src/harness/harness-session-types.d.ts +10 -0
- package/dist/src/harness/harness-session.js +42 -5
- package/dist/src/harness/project-harness.d.ts +13 -1
- package/dist/src/harness/project-harness.js +36 -10
- package/dist/src/harness/project-input.js +81 -15
- package/dist/src/harness/project-rpc-client.d.ts +1 -0
- package/dist/src/harness/project-rpc-client.js +5 -0
- package/dist/src/harness/project-rpc.d.ts +8 -2
- package/dist/src/harness/project-rpc.js +31 -7
- package/dist/src/harness/project-runtime.js +3 -1
- package/dist/src/harness/typescript-loader.d.ts +2 -0
- package/dist/src/harness/typescript-loader.js +41 -0
- package/dist/src/trace-viewer/public/app.js +6 -5
- package/dist/src/trace-viewer/reader.mjs +42 -2
- package/docs/INDEX.md +3 -1
- package/docs/architecture/00-overview.md +1 -1
- package/docs/architecture/01-agent-core.md +1 -1
- package/docs/architecture/06-observability-experiments.md +1 -1
- package/docs/architecture/07-run-configuration.md +18 -12
- package/docs/architecture/08-prompts.md +22 -0
- package/docs/architecture/10-service-api-reference.md +53 -18
- package/docs/architecture/11-storage-reference.md +18 -1
- package/docs/architecture/12-code-coverage.md +148 -84
- package/docs/architecture/15-core-runtime.md +8 -0
- package/docs/architecture/16-pi-opensandbox-backend.md +5 -5
- package/docs/architecture/17-harness-reporting.md +1 -1
- package/docs/architecture/19-substrate-harness.md +28 -1
- package/docs/architecture/20-lead-worker-harness.md +34 -1
- package/docs/architecture/22-website.md +5 -3
- package/docs/architecture/23-project-harness.md +124 -5
- package/docs/architecture/24-runtime-recovery.md +10 -3
- package/docs/architecture/25-foreground-tui.md +51 -0
- package/docs/architecture/26-code.md +39 -0
- package/docs/architecture/27-personal.md +43 -0
- package/docs/architecture/28-autoresearch.md +31 -0
- package/docs/architecture/INDEX.md +4 -0
- package/docs/architecture/prompts/08-lead-worker-harness.md +4 -2
- package/docs/architecture/prompts/08-subagents-harness.md +21 -0
- package/docs/architecture/prompts/21-personal.md +44 -0
- package/docs/architecture/prompts/22-autoresearch.md +63 -0
- package/docs/architecture/prompts/26-code.md +55 -0
- package/docs/architecture/prompts/source-manifest.json +152 -33
- package/docs/architecture/source-map.json +489 -21
- package/docs/designs/core-harness/06-project-harness.md +13 -2
- package/docs/designs/core-harness/README.md +5 -0
- package/docs/en/agents.md +1 -1
- package/docs/en/build-your-harness.md +3 -5
- package/docs/en/changelog.md +13 -4
- package/docs/en/first-harness.md +8 -11
- 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 +12 -123
- package/docs/en/overview.md +1 -1
- package/docs/en/quickstart.md +40 -16
- package/docs/en/reference/api.md +14 -4
- package/docs/en/reference/cli.md +58 -14
- package/docs/en/runtime.md +2 -2
- package/docs/en/services.md +4 -0
- package/docs/third-party-notices.md +1 -0
- package/docs/workflows/development.md +17 -12
- package/docs/workflows/release-and-docs-versioning.md +76 -0
- package/docs/zh/agents.md +1 -1
- package/docs/zh/build-your-harness.md +3 -5
- package/docs/zh/changelog.md +13 -4
- package/docs/zh/first-harness.md +8 -11
- 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 +13 -124
- package/docs/zh/overview.md +1 -1
- package/docs/zh/quickstart.md +40 -16
- package/docs/zh/reference/api.md +14 -4
- package/docs/zh/reference/cli.md +58 -14
- package/docs/zh/runtime.md +2 -2
- package/docs/zh/services.md +4 -0
- package/examples/README.md +24 -12
- package/examples/authoring/README.md +24 -0
- package/examples/authoring/business.ts +4 -0
- package/examples/authoring/config.ts +2 -0
- package/examples/authoring/eject.json +5 -0
- package/examples/authoring/harness.ts +21 -0
- package/examples/autoresearch/README.md +33 -0
- package/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
- package/examples/autoresearch/config.ts +90 -0
- package/examples/autoresearch/demo.ts +55 -0
- package/examples/autoresearch/eject.json +15 -0
- package/examples/autoresearch/frontiercs2.ts +237 -0
- package/examples/autoresearch/prepare.ts +267 -0
- package/examples/autoresearch/process.ts +50 -0
- package/examples/autoresearch/project.ts +397 -0
- package/examples/autoresearch/research-service.ts +302 -0
- package/examples/code/README.md +25 -0
- package/examples/code/REQUIREMENTS.zh.md +11 -0
- package/examples/code/candidate.ts +89 -0
- package/examples/code/config.ts +19 -0
- package/examples/code/eject.json +5 -0
- package/examples/code/project.ts +581 -0
- package/examples/code/prompts.ts +16 -0
- package/examples/code/verification.ts +239 -0
- package/examples/code/worktree.ts +188 -0
- package/examples/harness-session/README.md +3 -6
- package/examples/lead-worker/harness/dynamic-scheduler.ts +6 -3
- package/examples/lead-worker/harness/index.ts +61 -6
- package/examples/lead-worker/project.ts +2 -2
- package/examples/lead-worker/services/board.ts +14 -1
- package/examples/messages/README.md +5 -5
- package/examples/messages/handoff.ts +6 -2
- package/examples/messages/project.ts +47 -2
- package/examples/notes/README.md +13 -18
- package/examples/notes/project.ts +57 -9
- package/examples/peermesh/harness/router.ts +2 -2
- package/examples/peermesh/harness/team.ts +11 -0
- package/examples/peermesh/project.ts +19 -4
- package/examples/services/agent-control/README.md +3 -3
- package/examples/services/mathlib-search/Dockerfile +4 -2
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/mcp-managed/README.md +2 -2
- package/examples/services/persistent-board/README.md +13 -3
- package/examples/services/persistent-board/business.ts +10 -0
- package/examples/services/persistent-board/index.ts +10 -0
- package/examples/services/persistent-board/live.ts +54 -0
- package/examples/subagents/README.md +5 -5
- package/examples/subagents/business.ts +3 -1
- package/examples/subagents/harness/controller.ts +161 -29
- package/examples/subagents/project.ts +47 -33
- package/examples/subagents/prompts/prompts.ts +4 -0
- package/examples/subagents/services/collaboration-service.ts +14 -2
- package/examples/substrate/README.md +2 -2
- package/examples/substrate/harness/index.ts +67 -11
- package/examples/substrate/project.ts +5 -1
- package/examples/super/README.md +40 -0
- package/examples/super/actions.ts +196 -0
- package/examples/super/artifact.ts +56 -0
- package/examples/super/config.ts +95 -0
- package/examples/super/coordinator.ts +158 -0
- package/examples/super/daemon.ts +84 -0
- package/examples/super/decisions.ts +46 -0
- package/examples/super/eject.json +5 -0
- package/examples/super/execution.ts +131 -0
- package/examples/super/github.ts +242 -0
- package/examples/super/inbox.ts +306 -0
- package/examples/super/location.ts +54 -0
- package/examples/super/outbox.ts +97 -0
- package/examples/super/project.ts +227 -0
- package/examples/super/prompts.ts +27 -0
- package/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
- package/examples/taskpool/harness/controller.ts +59 -7
- package/examples/taskpool/project.ts +18 -2
- package/npm-shrinkwrap.development.json +2199 -0
- package/npm-shrinkwrap.json +86 -1920
- package/package.development.json +92 -0
- package/package.json +13 -7
- package/scripts/anyswarm-applications.ts +39 -0
- package/scripts/anyswarm-arguments.ts +94 -28
- package/scripts/anyswarm-author.ts +25 -0
- package/scripts/anyswarm-eject.ts +145 -0
- package/scripts/anyswarm-harnesses.ts +27 -0
- package/scripts/anyswarm-installation.ts +19 -13
- package/scripts/anyswarm-launch.ts +108 -0
- package/scripts/anyswarm-project.ts +114 -21
- package/scripts/anyswarm-source-runner.ts +203 -0
- package/scripts/anyswarm-tui-config.ts +174 -0
- package/scripts/anyswarm-tui-session.ts +295 -0
- package/scripts/anyswarm-tui-terminal.ts +147 -0
- package/scripts/anyswarm-tui.ts +912 -0
- package/scripts/anyswarm.ts +43 -2
- package/scripts/build.ts +8 -1
- package/scripts/generate-architecture-api.ts +2 -0
- package/scripts/generate-architecture-prompts.ts +35 -2
- package/scripts/local-environment.ts +55 -17
- package/scripts/local-setup-smoke.ts +3 -2
- package/scripts/local-setup-worker.ts +17 -7
- package/scripts/local-setup.ts +66 -13
- package/scripts/opensandbox-agent-worker.ts +2 -2
- package/scripts/pack-release.ts +67 -0
- package/scripts/pi-session-bridge.ts +10 -2
- package/scripts/run-harness.ts +3 -1
- package/scripts/setup-bootstrap.ts +41 -6
- package/src/core/allocation-ledger.ts +5 -3
- package/src/core/host-identity.ts +11 -0
- package/src/core/index.ts +12 -6
- package/src/core/mcp-service.ts +2 -2
- package/src/core/runtime-management.ts +22 -0
- package/src/core/sandbox/executor-driver.ts +15 -18
- package/src/core/sandbox/local-executor.ts +65 -19
- package/src/core/sandbox/local-worker.ts +29 -21
- package/src/core/sandbox/opensandbox-backend.ts +36 -11
- package/src/core/sandbox/sandbox-connection.ts +14 -5
- package/src/core/service-live-state.ts +156 -0
- package/src/core/service-observation-types.ts +23 -1
- package/src/core/service-process.ts +36 -3
- package/src/core/service-types.ts +3 -1
- package/src/core/services.ts +8 -3
- package/src/core/types.ts +3 -0
- package/src/core/worker-image.ts +3 -3
- package/src/harness/harness-session-types.ts +13 -1
- package/src/harness/harness-session.ts +40 -7
- package/src/harness/project-harness.ts +36 -10
- package/src/harness/project-input.ts +73 -15
- package/src/harness/project-rpc-client.ts +5 -0
- package/src/harness/project-rpc.ts +29 -8
- package/src/harness/project-runtime.ts +2 -1
- package/src/harness/typescript-loader.ts +37 -0
- package/src/trace-viewer/public/app.js +6 -5
- package/src/trace-viewer/reader.mjs +42 -2
|
@@ -84,7 +84,7 @@ TaskPool 控制器在可信 TaskService 提交后检查 Mission、归属与截
|
|
|
84
84
|
构建仓库并完成宿主模块后运行:
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
|
|
87
|
+
anys 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 @@ node dist/scripts/run-harness.js --config ./my-taskpool-config.mjs
|
|
|
92
92
|
离线检查报告无需加载模型配置:
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
|
|
95
|
+
anys 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
|
@@ -1,140 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description: 安装当前
|
|
4
|
-
section:
|
|
2
|
+
title: 发行版本
|
|
3
|
+
description: 安装当前 AnySwarm SDK 和 CLI,查看发行说明。
|
|
4
|
+
section: RELEASES
|
|
5
5
|
order: 15
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## v0.5.0
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
v0.5.0 是 `@anyswarm/core` 的首个正式版本,提供现行的 Service 注册和 Profile API。具体改动见 [v0.5.0 更新日志](changelog.md#v050)。
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## v0.4.1
|
|
15
|
-
|
|
16
|
-
AnySwarm v0.4.1 已在 GitHub 和 npm 发布。本版支持托管 CLI 更新,使用本机受支持的 Pi 或 Codex 构建 Worker,并补充了 Run 诊断信息。
|
|
17
|
-
|
|
18
|
-
| 分发 | 入口 |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| CLI | [GitHub Release](https://github.com/AnySwarm/anyswarm/releases/tag/v0.4.1) · [SHA256SUMS](https://github.com/AnySwarm/anyswarm/releases/download/v0.4.1/SHA256SUMS) · [快速上手](quickstart.md) |
|
|
21
|
-
| TypeScript SDK | [npm 上的 @anyswarm/anyswarm](https://www.npmjs.com/package/@anyswarm/anyswarm/v/0.4.1) · [第一个 SDK Harness](first-harness.md) |
|
|
22
|
-
| 版本变更 | [更新日志](changelog.md#v041) |
|
|
23
|
-
|
|
24
|
-
在项目中安装此版本的 SDK:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install @anyswarm/anyswarm@0.4.1
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
已有 v0.4.0 项目升级时,将导入路径从 `@luna-shi/anyswarm` 改为 `@anyswarm/anyswarm`,在项目内运行 `npm uninstall @luna-shi/anyswarm`,并提交更新后的锁文件。全局 CLI 独立升级。
|
|
31
|
-
|
|
32
|
-
## 从 v0.4.0 升级到托管安装
|
|
33
|
-
|
|
34
|
-
从 v0.4.0 迁移 CLI 时,运行一次[官方安装器](quickstart.md#1-安装-anyswarm)。如果当前 CLI 通过 npm 安装在自定义的可写前缀,可为安装器设置 `npm_config_prefix`。安装器会输出生效的 CLI 路径,后续用 `anyswarm update` 升级。
|
|
35
|
-
|
|
36
|
-
新版会忽略 v0.4.0 保存的 OpenSandbox 连接文件。用过自定义地址时,请在新版 setup 中显式传入原地址。以下以原端口为 `18080`、选择 Pi 为例:
|
|
12
|
+
用 npm 全局安装 CLI,随后检查版本。
|
|
37
13
|
|
|
38
14
|
```sh
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
将示例地址换成你的实际地址。如果旧容器仍占用端口且新版无法确认它的归属,请先用旧版本结束其运行,再停用旧容器,之后才在原地址创建托管服务。若要继续使用已运行的服务,可按[接入已有服务](quickstart.md#连接已有-opensandbox)传入原地址和凭据。如曾设置自定义回调地址,也可通过 `--public-url` 传入原地址。
|
|
43
|
-
|
|
44
|
-
## v0.4.0 提供的功能
|
|
45
|
-
|
|
46
|
-
### 1. OpenSandbox SDK 1.2.1、统一回调入口与 Kubernetes 部署
|
|
47
|
-
|
|
48
|
-
- **官方 SDK 统一接入**:本机与远程 OpenSandbox 统一通过 OpenSandbox SDK 1.2.1 通信,`anyswarm setup` 会将连接配置与凭据自动写入仅当前用户可读写的本地配置,并由 `setup`、`doctor` 与内置 Harness 共享解析。
|
|
49
|
-
- **单一回调地址(`connection.publicUrl`)**:每个 Runtime 现通过一个统一回调地址同时提供 Service Bridge(`/bridge`)与 Model Gateway(`/model/<alias>`),原生保留反向代理路径前缀,告别过去两套回调 URL 与 `{port}` 模板。
|
|
50
|
-
- **自定义沙箱与 Kubernetes 模板**:支持通过 `createSandbox({ provider })` 接入自定义 `SandboxProvider`,并新增版本锁定的 [OpenSandbox Kubernetes 部署指南](../../deploy/opensandbox-kubernetes/README.md) 以及 `egressMode: 'dns+nft'` 包级出站白名单支持。
|
|
51
|
-
|
|
52
|
-
### 2. 统一的 `Harness` 作者接口与 `HarnessSession`
|
|
53
|
-
|
|
54
|
-
- **一套定义,三种运行方式**:从 `@luna-shi/anyswarm` 根入口导出标准 `Harness` 与 `HarnessContext` 接口,同一份自定义 Harness 模块可同时用于进程内 SDK(`createHarnessSession`)、前台 CLI(`anyswarm --harness`)与跨进程 JSONL RPC(`HarnessRpcClient`)。
|
|
55
|
-
- **交互式问答与运行时控制**:支持通过 `--lifetime interactive` 维持多轮交互、通过 `--interaction questions` 与 `context.askUser()` 向终端或客户端发起提问,并支持在运行中按成员查询或控制底层会话。
|
|
56
|
-
- **独立示例与配套教程**:五个协作示例均可在仓库外安装匹配的 SDK 归档,独立构建与启动;新增[搭建第一个 SDK Harness](first-harness.md) 实战指南,完整演示双 Agent 交接、终端交互与产物校验。
|
|
57
|
-
|
|
58
|
-
### 3. 按 Agent 粒度的会话控制与自动压缩策略
|
|
59
|
-
|
|
60
|
-
- **`runtime.session` 控制面**:原生 Pi Worker 开放 `configure`、`compact`、`abortRetry`、`clearQueue`、`getState`、`getStats` 与 `getMessages` 接口,支持精细查询与管理单个 Agent 的会话状态。
|
|
61
|
-
- **结构化上下文注入**:通过 `runtime.send()` 显式指定 `append`、`nextTurn`、`steer` 或 `followUp` 投递策略,按需补充上下文而不打乱既有对话节奏。
|
|
62
|
-
- **自动压缩拦截钩子(`hooks.beforeCompact`)**:可在 `createRuntime()` 中注册策略钩子,在触发指定次数的自动上下文压缩前主动叫停 Agent 并执行正常归档收尾(详见 [Agent 与 Profile](agents.md#6-会话控制与结构化上下文))。
|
|
63
|
-
|
|
64
|
-
### 4. 可选持久化恢复与 `anyswarm recover`
|
|
65
|
-
|
|
66
|
-
- **中断后接管运行**:在 `createRuntime()` 中显式开启 `persistence` 后,控制进程意外退出时可在同一台未重启的 Linux 宿主机上通过 `recoverRuntime()` 接管未完成的运行,并经 `restoreService` 重建运行中动态注册的 Service。
|
|
67
|
-
- **纯清理恢复命令**:新增 `anyswarm recover --run-dir <dir> --config <module>`,只接管清理权限并执行 `close()`,确认归档与沙箱清理完成后返回退出码 `0`。
|
|
68
|
-
- **可观测事件链路**:Worker 采用带游标的长轮询事件推送,并新增 `runtime.probeWorkerEvent()` 用于端到端测量鉴权事件链路耗时,不消耗模型额度(详见 [Runtime 持久化恢复](runtime.md#6-持久化恢复与-kubernetes))。
|
|
69
|
-
|
|
70
|
-
### 5. 更灵活的执行器、模型协议与大目录传输
|
|
71
|
-
|
|
72
|
-
- **扩展执行器与模型协议**:Runtime 现支持镜像内自定义执行器适配器与多版本 Pi 选择;Pi 新增流式 **Chat Completions** 协议支持,宿主机也支持接入自定义可信模型传输层。
|
|
73
|
-
- **本地 Worker 准备**。本地 `anyswarm setup` 复用兼容 Worker,内置 Worker 缺失或不兼容时从安装包构建。[快速上手](quickstart.md)提供经验证的 README 示例及 Trace Viewer 步骤。
|
|
74
|
-
- **更稳健的大目录与安装体验**:项目文件导入、同步与导出支持分阶段预算配置与磁盘分块传输;CLI 安装器在全局 npm 目录不可写时自动回退至 `$HOME/.local`,新增 `anyswarm --version` 与基于 Schema 的 `swarm service invoke ... --help` 参数示例提示。
|
|
75
|
-
|
|
76
|
-
## 安装或升级到 v0.4.0
|
|
77
|
-
|
|
78
|
-
如需固定使用历史版本 v0.4.0,在空目录下载并校验归档,再安装到当前用户目录。
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
mkdir -p anyswarm-v0.4.0 && cd anyswarm-v0.4.0
|
|
82
|
-
curl -fLO https://github.com/AnySwarm/anyswarm/releases/download/v0.4.0/luna-shi-anyswarm-0.4.0.tgz
|
|
83
|
-
curl -fLO https://github.com/AnySwarm/anyswarm/releases/download/v0.4.0/SHA256SUMS
|
|
84
|
-
sha256sum -c --ignore-missing SHA256SUMS
|
|
85
|
-
npm install -g --prefix "$HOME/.local" --ignore-scripts "./luna-shi-anyswarm-0.4.0.tgz"
|
|
86
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
15
|
+
npm install -g @anyswarm/core@0.5.0
|
|
87
16
|
anyswarm --version
|
|
88
17
|
```
|
|
89
18
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
## 从 v0.3.0 迁移
|
|
93
|
-
|
|
94
|
-
1. 用原版本的控制端与 Worker 完成或恢复正在运行的 Run。更换任一组件前,确认 Sandbox 已删除,或记录仍保留的资源归属。已保存的 Run 报告可用 `anyswarm trace --root <旧运行目录>` 查看。
|
|
95
|
-
2. 在同一 npm 前缀安装 AnySwarm 前,先从原前缀卸载旧的全局包。若旧包仍占用共用的 `swarm` 命令,npm 会拒绝安装。例如,使用用户前缀时执行:
|
|
96
|
-
|
|
97
|
-
```sh
|
|
98
|
-
npm uninstall --global --prefix "$HOME/.local" @luna-shi/murm
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
安装 `@luna-shi/anyswarm`,替换各项目的旧依赖与 SDK 导入,更新 npm 锁文件,宿主脚本使用 `anyswarm`。Worker 内的命令仍为 `swarm`。
|
|
102
|
-
3. 将 `MURM_` 环境变量前缀改为 `ANYSWARM_`。重新运行 `anyswarm setup`,在 `~/.config/anyswarm/` 下生成私有配置。如果旧服务仍占用 8080 端口,确认其 Sandbox 全部删除后停用该服务,或通过 `ANYSWARM_LIFECYCLE_URL` 选择其他端口。
|
|
103
|
-
4. v0.4.0 使用 `ghcr.io/luna-shi/anyswarm-worker:0.4.0` 或匹配的执行器变体。按匹配的 AnySwarm 协议重建自定义 Worker 和执行器适配器。将自定义传输和代理请求头白名单改为对应的 `x-anyswarm-*` 请求头。独立部署的 TaskPool Service 宿主须与控制端一起升级。Catalog 的描述更名后 manifest 哈希随之变化,混用版本时会无法通过就绪检查。见 [Worker 协议](../architecture/16-pi-opensandbox-backend.md)与 [Bridge](../architecture/04-services.md)。
|
|
19
|
+
[快速上手](quickstart.md#1-安装-anyswarm)也说明了如何从 [v0.5.0 GitHub Release](https://github.com/AnySwarm/anyswarm/releases/tag/v0.5.0) 安装托管版 CLI。
|
|
104
20
|
|
|
105
|
-
|
|
21
|
+
要把 SDK 加到项目依赖中,请在项目目录执行以下命令。
|
|
106
22
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
> 如果你仍需维护旧的 `v0.2.0` 环境,请参阅 [v0.2.0 发行页](https://github.com/AnySwarm/anyswarm/releases/tag/v0.2.0) 与 [v0.2.0 宿主机指南](https://github.com/AnySwarm/anyswarm/blob/v0.2.0/docs/zh/quickstart.md)。
|
|
110
|
-
|
|
111
|
-
- **移除内置 `local-docker` 与共享挂载**:不再内置依赖宿主机 Landlock ABI 5+ / rootful `sudo` 的 `local-docker` 模式、精确字节/inode 磁盘配额以及宿主机实时共享目录挂载。跨 Agent 文件交换请使用 `runtime.files` 或共享 Service,精确 IP/端口出站白名单请使用 OpenSandbox `dns+nft`。
|
|
112
|
-
- **Worker 协议升级至 `murm-core-v2`**:升级控制端时请同步更新 Worker 镜像(或运行 `murm setup` 重新拉取/构建),旧版 Worker 镜像会在握手阶段直接报错提示版本不匹配。
|
|
113
|
-
- **配置项迁移**:`createSandbox()` 推荐使用 `endpoint` 替代旧别名 `lifecycleBaseUrl`;`createRuntime()` 推荐使用单一 `connection.publicUrl` 替代旧版双回调 URL 与 `{port}` 模板(详见 [Sandbox 迁移说明](sandbox.md#4-资源与旧配置迁移))。
|
|
114
|
-
- **Service 调用前缀与评测入口**:启动提示统一使用 `swarm service invoke <service> <operation>`(TaskPool 保留快捷命令);固定编制 Lead-Worker 评测与 FATE 基准入口迁移至源码构建目录 `dist/benchmarks/`。
|
|
115
|
-
|
|
116
|
-
完整历次版本记录请查看 **[更新日志](changelog.md)**,功能回放演示请查看 **[Trace Viewer 观测与调试](trace-viewer.md)**。
|
|
117
|
-
|
|
118
|
-
## 安装或升级到 v0.2.0
|
|
119
|
-
|
|
120
|
-
使用 npm 安装固定的 v0.2.0 归档。该发行版早于 `murm --version`,请通过 npm 确认版本。
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
prefix="$HOME/.local"
|
|
124
|
-
npm install -g --prefix "$prefix" --ignore-scripts --allow-remote=root \
|
|
125
|
-
https://github.com/AnySwarm/anyswarm/releases/download/v0.2.0/luna-shi-murm-0.2.0.tgz
|
|
126
|
-
export PATH="$prefix/bin:$PATH"
|
|
127
|
-
MURM_ROOT="$(npm root -g --prefix "$prefix")/@luna-shi/murm"
|
|
128
|
-
printf '%s\n' "$MURM_ROOT"
|
|
129
|
-
npm ls -g --prefix "$prefix" @luna-shi/murm --depth=0
|
|
23
|
+
```sh
|
|
24
|
+
npm install @anyswarm/core@0.5.0
|
|
130
25
|
```
|
|
131
26
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
在干净的 Debian 13.8 上,v0.2.0 指南的两项 sudo 检查通过后,Agent 仍启动失败。该发行版仍依赖管理员维护的严格本机隔离配置。首次运行请参阅[快速上手](quickstart.md),该路径通过 OpenSandbox API 启动和清理 Agent。
|
|
135
|
-
|
|
136
|
-
在项目中安装 SDK 依赖时,使用同一个固定归档 URL,去掉 `-g` 和 `--prefix`。如果 lockfile 包含 GitHub Release tarball URL,npm 12+ 重装时需要 `--allow-remote=root`。
|
|
137
|
-
|
|
138
|
-
## 宿主机要求
|
|
27
|
+
SDK 的导入方式和项目内 CLI 用法见[安装 SDK](reference/api.md#安装-sdk)。
|
|
139
28
|
|
|
140
|
-
|
|
29
|
+
此前的发行版使用不同的 npm 包名。源码和发行归档可在 [GitHub Release 历史](https://github.com/AnySwarm/anyswarm/releases) 查阅。
|
package/docs/zh/overview.md
CHANGED
|
@@ -30,6 +30,6 @@ TypeScript SDK、宿主机 `anyswarm` CLI、容器内 `swarm` CLI 与 `anyswarm
|
|
|
30
30
|
- [搭建第一个 SDK Harness](first-harness.md)——用标准 `Harness` 接口跑通双 Agent 终端交互交接与产物校验。
|
|
31
31
|
- [实战:构建 Swarm Harness](build-your-harness.md)——从零搭建并行调研 + 综合的多智能体 Swarm。
|
|
32
32
|
4. **内置 Harness**:[选择 Harness](harnesses/index.md)——直接运行或参考 `Subagents`、`TaskPool`、`PeerMesh`、`Substrate` 与 `Lead-Worker`。
|
|
33
|
-
5. **参考手册与版本**:[SDK 与 API 参考](reference/api.md) · [CLI 参考](reference/cli.md) · [类型定义与源码映射](reference/types.md) · [
|
|
33
|
+
5. **参考手册与版本**:[SDK 与 API 参考](reference/api.md) · [CLI 参考](reference/cli.md) · [类型定义与源码映射](reference/types.md) · [发行版本](latest.md) · [更新日志](changelog.md)。
|
|
34
34
|
|
|
35
35
|
> 需要查阅底层协议或仓库维护说明?请参阅仓库中的[架构实现手册](https://github.com/AnySwarm/anyswarm/blob/main/docs/architecture/INDEX.md)。
|
package/docs/zh/quickstart.md
CHANGED
|
@@ -9,7 +9,7 @@ order: 1
|
|
|
9
9
|
|
|
10
10
|
`anyswarm` 将 CLI 与 TypeScript SDK 打包在同一个安装包中,并在 [OpenSandbox](sandbox.md) 隔离沙箱中运行 Agent。你可以在 Linux 本机通过 Docker 一键启动 OpenSandbox,也可以接入团队已有的服务。
|
|
11
11
|
|
|
12
|
-
本指南适用于
|
|
12
|
+
本指南适用于 `@anyswarm/core` 的首个正式版本 [v0.5.0](latest.md#v050)。
|
|
13
13
|
|
|
14
14
|
## 前置要求
|
|
15
15
|
|
|
@@ -33,37 +33,54 @@ sudo systemctl enable --now docker.service
|
|
|
33
33
|
|
|
34
34
|
若访问 Docker socket 被拒绝,管理员可执行 `sudo usermod -aG docker alice`,将 `alice` 换为运行 AnySwarm 的账号。使用该账号重新登录,执行 `id` 和 `docker info`。[`docker` 用户组具有等同于 root 的权限](https://docs.docker.com/engine/install/linux-postinstall/)。
|
|
35
35
|
|
|
36
|
+
### macOS 上的 Docker
|
|
37
|
+
|
|
38
|
+
**运行本地 setup 之前:** 安装 [Docker Desktop for Mac](https://docs.docker.com/desktop/setup/install/mac-install/),打开 Docker,等待引擎启动。如果你已有 [OrbStack](https://orbstack.dev/download) 等本地 Linux 容器引擎,启动现有引擎即可。只装 `docker` 客户端(例如 `brew install docker`)不够。npm 会安装 AnySwarm 的 npm 依赖,但 npm 命令和 `anyswarm setup` 都不会替你安装或启动 Docker Desktop。
|
|
39
|
+
|
|
40
|
+
在准备运行 AnySwarm 的终端里确认当前 context 能访问已启动的引擎:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
docker context ls
|
|
44
|
+
docker context show
|
|
45
|
+
docker info --format '{{.OSType}}/{{.Architecture}}'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
若 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
|
+
|
|
50
|
+
已发布的 v0.5.0 本机 setup 仍要求 Linux Controller。若要尝试 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
|
+
|
|
36
52
|
## 1. 安装 AnySwarm
|
|
37
53
|
|
|
38
54
|
### 安装公开发行版
|
|
39
55
|
|
|
56
|
+
任选一种方式安装 AnySwarm CLI。两种方式都需要 Node.js 22.19 或更高版本以及 npm。macOS 和 Linux 使用同一条 npm 安装命令。npm 会安装包的依赖,这一步不需要启动 Docker。
|
|
57
|
+
|
|
40
58
|
```bash
|
|
41
|
-
|
|
59
|
+
npm install -g @anyswarm/core
|
|
60
|
+
anyswarm --version
|
|
42
61
|
```
|
|
43
62
|
|
|
44
|
-
|
|
63
|
+
`-g` 将命令装到 npm 的全局目录。若终端找不到命令,请确认 `$(npm prefix -g)/bin` 在 PATH 中,并且当前终端使用的是安装 CLI 时的 Node.js。
|
|
45
64
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
在你的 Node.js 项目目录运行以下命令。
|
|
65
|
+
也可以使用安装脚本,从 GitHub Release 安装托管版 CLI。
|
|
49
66
|
|
|
50
67
|
```bash
|
|
51
|
-
|
|
68
|
+
curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
|
|
52
69
|
```
|
|
53
70
|
|
|
54
|
-
|
|
71
|
+
脚本输出版本、CLI 路径和已校验的归档来源。若脚本打印了 PATH 命令,请在当前终端执行。随后运行 `anyswarm --version` 确认可用。
|
|
55
72
|
|
|
56
|
-
|
|
73
|
+
如果你要用 TypeScript 编写 Harness,请按[安装 SDK](reference/api.md#安装-sdk)把它加到项目依赖里。
|
|
57
74
|
|
|
58
75
|
### 从源码构建并安装(`main`)
|
|
59
76
|
|
|
60
|
-
|
|
77
|
+
在仓库根目录执行以下命令。`npm run pack:release` 构建发行包,安装脚本将 CLI 装到 `$HOME/.local`。
|
|
61
78
|
|
|
62
79
|
```bash
|
|
63
80
|
git clone https://github.com/AnySwarm/anyswarm.git && cd anyswarm
|
|
64
81
|
npm ci --no-audit --no-fund
|
|
65
82
|
pack_dir=$(mktemp -d)
|
|
66
|
-
npm pack --
|
|
83
|
+
npm run pack:release -- "$pack_dir"
|
|
67
84
|
npm_config_prefix="$HOME/.local" sh website/public/install.sh --archive "$pack_dir"/*.tgz
|
|
68
85
|
export PATH="$HOME/.local/bin:$PATH"
|
|
69
86
|
anyswarm --version
|
|
@@ -71,21 +88,28 @@ anyswarm --version
|
|
|
71
88
|
|
|
72
89
|
候选包可能和发行版显示同一个版本号。请记录提交号和 tarball 的 SHA-256。如果要在[独立示例项目](../../examples/README.md)中使用同一份 SDK,请保留生成的候选版 tarball。
|
|
73
90
|
|
|
74
|
-
###
|
|
91
|
+
### 更新 CLI
|
|
75
92
|
|
|
76
|
-
|
|
93
|
+
- 全局 npm 安装。用同一套 Node.js 和 npm prefix 运行 `npm install -g @anyswarm/core@latest`。
|
|
94
|
+
- 安装脚本。运行 `anyswarm update`,校验 GitHub Release 归档并验证新 CLI 可用后再切换。更新失败时,原 CLI 仍可用。
|
|
95
|
+
|
|
96
|
+
由脚本管理的 v0.5.0 首次升级时,请用原安装前缀重新运行当前官网安装脚本。脚本会添加 `anys` 别名,并在 macOS 上使用当前的激活锁。
|
|
97
|
+
|
|
98
|
+
更新项目 SDK 时,在项目目录内使用该项目的包管理器。
|
|
77
99
|
|
|
78
100
|
## 2. 准备 OpenSandbox 与 Worker
|
|
79
101
|
|
|
80
|
-
|
|
102
|
+
使用已经安装的 Pi 或 Codex。Linux 使用 npm 安装的发行包。macOS 也支持 Codex 独立可执行文件,前提是同一发行版提供 Linux npm 包。如果还没有 Pi,可运行 `npm install --global @earendil-works/pi-coding-agent`,然后选择已安装的 backend。
|
|
81
103
|
|
|
82
104
|
```bash
|
|
83
|
-
npm install --global @earendil-works/pi-coding-agent@1.3.0
|
|
84
105
|
pi --version
|
|
85
106
|
anyswarm setup --backend pi
|
|
107
|
+
anyswarm doctor --smoke
|
|
86
108
|
```
|
|
87
109
|
|
|
88
|
-
|
|
110
|
+
裸 `setup` 会复用上次保存的可执行文件路径。换一份安装时,用 `--backend pi --backend-path /absolute/path/to/bin/pi` 或相应的 Codex 选项。要固定已安装版本,加 `--backend-version 1.7.0` 并替换为你要使用的版本号。固定版本保存后,如果可执行文件报告其他版本,检查会明确失败。重新显式选择 backend 并省略版本参数,可恢复跟随该安装的升级。
|
|
111
|
+
|
|
112
|
+
macOS 在原生架构的 Docker 容器内准备同一发行版的 Linux 包。配置保存前会核对 Worker 版本、执行器启动和受控协议 smoke。没有保存的选择时,如果发现两种 backend,交互终端会提示选择。自动化调用可用 `--backend` 明确指定。
|
|
89
113
|
|
|
90
114
|
首次本地 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` 和单独的空闲端口。
|
|
91
115
|
|
package/docs/zh/reference/api.md
CHANGED
|
@@ -5,11 +5,19 @@ section: 参考手册
|
|
|
5
5
|
order: 15
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
本页汇总 **`@anyswarm/core
|
|
8
|
+
本页汇总 **`@anyswarm/core`** 的公开运行时导出、方法契约与错误恢复规则。概念与实践请先阅读 [Runtime 与 Agent](../runtime.md) 和 [Service 与权限](../services.md);完整 TypeScript 声明见 [类型定义与源码映射](./types.md);宿主机与容器命令行参数见 [CLI 参考](./cli.md)。
|
|
9
9
|
|
|
10
10
|
## 安装 SDK
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
项目需要 Node.js 22.19 或更新版本。
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @anyswarm/core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
在代码中从 `@anyswarm/core` 导入 SDK。在项目目录运行 `npm exec -- anyswarm` 可调用随依赖安装的 CLI。要在任意目录直接运行 `anyswarm`,请按[全局 CLI 安装](../quickstart.md#1-安装-anyswarm)操作。
|
|
19
|
+
|
|
20
|
+
要安装经校验的[源码构建归档](../quickstart.md#从源码构建并安装main),使用下面的命令。[发行版本页](../latest.md#v050)提供固定版本的安装命令。
|
|
13
21
|
|
|
14
22
|
```bash
|
|
15
23
|
npm install --ignore-scripts /path/to/verified-anyswarm.tgz
|
|
@@ -26,9 +34,11 @@ npm install --ignore-scripts /path/to/verified-anyswarm.tgz
|
|
|
26
34
|
| `createSandbox(config)` | 函数 | 创建不可变、可复用的 OpenSandbox 连接配置句柄,或接入自定义 `{ provider }` `SandboxProvider`。 |
|
|
27
35
|
| `resolveSandboxConnection(overrides?)` | 函数 | 按与 CLI 一致的优先级解析 Lifecycle 地址、本地密钥与默认镜像(仅在可信宿主配置中使用)。 |
|
|
28
36
|
| `createRuntime(options)` | 异步函数 | 启动单次 Run 的控制面(`outputDir/<runtimeId>/`、Service Bridge、Model Gateway),支持 `executor`、`filePolicy` 与持久化恢复选项。 |
|
|
37
|
+
| `resolveFilePolicy(policy?)` | 函数 | 校验文件预算并补齐 Runtime 和项目宿主使用的默认值。Harness 作者可用解析后的上限检查本地候选。 |
|
|
29
38
|
| `recoverRuntime(options)` | 异步函数 | 在验证同主机、同次启动归属后恢复持久化 Run,支持仅清理模式与动态 Service 重建。 |
|
|
30
39
|
| `createHarnessSession(harness, options)` / `HarnessRpcClient` | 函数 / 类 | 在进程内或通过 JSONL 子进程管道驱动标准 `Harness` 会话,统一支持实时事件、问答与成员控制。 |
|
|
31
|
-
| `
|
|
40
|
+
| `runProjectRpc(session, input, write, launchDirectory, initialInput?, options?)` | 函数 | 在应用管理的流上提供 HarnessSession JSONL 协议。启用 `detachOnDisconnect` 后,观察连接断开时 Session 继续运行。 |
|
|
41
|
+
| `createPiExecutor({ version })` / `createCodexExecutor({ version })` | 函数 | 传入版本号时固定内置执行器的实际版本;也可继续使用 `'pi'` / `'codex'` 简写。 |
|
|
32
42
|
| `createExecutorAdapter(declaration)` / `EXECUTOR_ADAPTER_PROTOCOL` | 函数 / 常量 | 声明并校验镜像内安装的外部执行器适配器(协议 `anyswarm-executor-v1`)。 |
|
|
33
43
|
| `DEFAULT_WORKER_IMAGE` / `workerImageFor(selection)` | 常量 / 函数 | 按 Runtime 选中的执行器准备本地 Worker,也可以指定执行器并校验指定版本。 |
|
|
34
44
|
| `getExecutorCapabilities(selection)` | 函数 | 静态查询所选执行器的能力矩阵(无网络副作用)。 |
|
|
@@ -88,7 +98,7 @@ const runtime = await createRuntime({
|
|
|
88
98
|
|
|
89
99
|
- **`models`**:默认使用流式 Responses 协议;Pi 也支持 `protocol: 'chat-completions'` 与 `capabilities: { contextWindow, maxOutputTokens, tools, reasoning }`;可信宿主还可通过 `ModelTransport` 自定义流式传输。上游凭据始终留在可信宿主机。
|
|
90
100
|
- **`filePolicy`**:可选分别调整 `initial`、`snapshot`、`replace`、`export` 与 `session` 阶段的 `maxBytes`、`maxFileBytes`、`maxFiles`、`maxEntries`、`timeoutMs` 以及 `controllerSpoolBytes` / `workerSpoolBytes` 暂存上限。
|
|
91
|
-
- **`getExecutorCapabilities(selection)`**:Pi
|
|
101
|
+
- **`getExecutorCapabilities(selection)`**:Pi支持 `contextFork`、`activeSteer`、`followUp`、`one-at-a-time` 等完整能力;Codex支持 `activeSteer`、`followUp`、`all` 模式且不支持上下文分叉。
|
|
92
102
|
|
|
93
103
|
## Agent 生命周期
|
|
94
104
|
|
package/docs/zh/reference/cli.md
CHANGED
|
@@ -5,7 +5,9 @@ section: 参考手册
|
|
|
5
5
|
order: 16
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
`@anyswarm/core`
|
|
8
|
+
`@anyswarm/core` 提供同义宿主入口 **`anyswarm`** 和 **`anys`**,安装、更新、帮助与版本行为一致。Worker 容器中的 **`swarm`** 用于通过 Bridge 调用 Service。
|
|
9
|
+
|
|
10
|
+
下文的 流式终端、通用加载器、`run` 和 `eject` 需要[当前源码构建的版本](../quickstart.md#从源码构建并安装main)。使用公开包时请参阅 [v0.5.0 CLI 参考](https://github.com/AnySwarm/anyswarm/blob/v0.5.0/docs/zh/reference/cli.md)。
|
|
9
11
|
|
|
10
12
|
## 宿主机 CLI(`anyswarm`)
|
|
11
13
|
|
|
@@ -13,17 +15,48 @@ order: 16
|
|
|
13
15
|
|
|
14
16
|
| 命令 | 用途 |
|
|
15
17
|
| --- | --- |
|
|
16
|
-
| `anyswarm` |
|
|
18
|
+
| `anyswarm` / `anys` | 在交互终端打开流式输入框 |
|
|
19
|
+
| `anys -u <harness> [prompt]` | 选择内置 Harness、已安装的包或本地模块 |
|
|
20
|
+
| `anys -u <harness> --headless [prompt]` | 以 JSONL 输出 Session 动态与最终结果 |
|
|
21
|
+
| `anys -u <harness> --rpc` | 打开标准输入输出上的 HarnessSession RPC 协议 |
|
|
22
|
+
| `anys -u <harness> --cmd "/action [args]"` | 执行模块声明的独立 Slash Action |
|
|
23
|
+
| `anys run ./harness.ts [arguments]` | 直接运行多文件 TypeScript 与公开 SDK 依赖 |
|
|
24
|
+
| `anys eject <code\|autoresearch\|super\|example> --dir <target>` | 导出完整 TypeScript 作者源码并绑定 SDK 来源 |
|
|
17
25
|
| `anyswarm --version` | 输出当前安装的 `@anyswarm/core` 版本 |
|
|
18
|
-
| `anyswarm setup [--mode existing\|local] [--endpoint <url>] [--public-url <url>] [--backend pi\|codex] [--backend-path <executable>] [--config <module>]` | 本地启动托管 OpenSandbox 并自动生成密钥(`--mode local`),或验证并保存已有 OpenSandbox 连接(`--mode existing`);`local` 模式同时准备并探测所选 Worker 镜像 |
|
|
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 镜像 |
|
|
19
27
|
| `anyswarm doctor [--config <module>] [--smoke]` | 只读诊断配置与 Lifecycle 鉴权;加 `--smoke` 拉起真实 Pi/Codex Worker 运行端到端冒烟验证 |
|
|
20
|
-
| `anyswarm update` | 校验、暂存并启用托管安装的最新稳定 CLI。全局 npm
|
|
21
|
-
| `anyswarm --harness <module> --prompt <text> [options]` | 在前台对项目目录运行内置、本地 ESM 或 npm 包 Harness |
|
|
28
|
+
| `anyswarm update` | 校验、暂存并启用托管安装的最新稳定 CLI。全局 npm 安装会显示适用于当前 prefix 的更新命令 |
|
|
29
|
+
| `anyswarm --harness <module> --prompt <text> [options]` | 在前台对项目目录运行内置、本地 TypeScript/ESM 或 npm 包 Harness |
|
|
22
30
|
| `anyswarm --harness <module> --mode rpc [options]` | 通过 JSONL `stdin`/`stdout` 以 RPC 模式运行 Harness,支持 `ready`、`run`、`status`、`stop` 与成员控制 |
|
|
23
31
|
| `anyswarm recover --run-dir <dir> --config <module>` | 在同主机、同次启动归属下对持久化 Run 执行仅清理恢复并输出最终回执 |
|
|
24
32
|
| `anyswarm trace [--root] <runs-dir> [--port 8787] [--open]` | 在 `127.0.0.1` 启动内置浏览器 [Trace Viewer](../trace-viewer.md) |
|
|
25
33
|
|
|
26
|
-
|
|
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`。 |
|
|
52
|
+
|
|
53
|
+
标准输入或输出重定向时,`-u` 自动走无头 JSONL。裸命令在非 TTY 时提示用法。显式 `--harness H --mode foreground` 和 `--mode rpc` 保留原有传输格式。`anys run <harness> [prompt]` 在交互终端中打开同一个界面。普通 TypeScript 脚本可继续接收自己的 argv。在管道中,无参数或使用旧式 `--prompt` 启动的本地任务 Harness 输出一条前台 JSON 结果。导出项目通过 `npm install` 和 `npm run start` 使用匹配的项目本地 CLI。
|
|
54
|
+
|
|
55
|
+
Harness 可以在 `inputDescriptor.commands` 里声明补全提示。活跃 Session 中未匹配的 Slash 命令会作为文本传给 Harness 的输入处理器。需要在 Session 创建前提供命令时,可导出 `slashActions`,例如 `export const slashActions = { prepare: ({ args }) => ({ prepared: args }) }`。可在输入框或用 `anys -u H --cmd '/prepare example'` 调用。[应用模块契约](../../architecture/25-foreground-tui.md)
|
|
56
|
+
|
|
57
|
+
### Personal GitHub Inbox
|
|
58
|
+
|
|
59
|
+
在输入框选择 `/super`,再执行 `/setup --repo owner/project`、`/start` 和 `/jobs`。用 `/ask #123 <内容>` 或 `@router #123 <内容>` 向 Router 提交工作。界面显示 Router 的问题以及补丁和 Reviewer 意见。用 `/answer #123 <答案>`、`/approve #123` 或 `/reject #123 [原因]` 处理,也可以用无歧义的工作 ID 前缀。非交互调用使用 `anys -u super --cmd '/jobs #123'`。凭据、权限、停止和源码导出见 [Personal 快速上手](../../../examples/super/README.md)。
|
|
27
60
|
|
|
28
61
|
### 运行 Harness(`anyswarm --harness`)
|
|
29
62
|
|
|
@@ -34,28 +67,39 @@ anyswarm --harness subagents --prompt "修复解析器并补充测试"
|
|
|
34
67
|
# 显式指定目标目录、配置模块与输出根目录
|
|
35
68
|
anyswarm --harness taskpool \
|
|
36
69
|
--cwd ./my-project \
|
|
37
|
-
--config ./taskpool.config.
|
|
70
|
+
--config ./taskpool.config.ts \
|
|
38
71
|
--output-dir ./runs \
|
|
39
72
|
--prompt "修复所有失败的单元测试"
|
|
40
73
|
|
|
41
|
-
# 运行你自定义打包的本地 ESM Harness 模块
|
|
42
|
-
anyswarm --harness ./review-harness.
|
|
74
|
+
# 运行你自定义打包的本地 TypeScript/ESM Harness 模块
|
|
75
|
+
anyswarm --harness ./review-harness.ts --prompt "审计错误处理分支"
|
|
43
76
|
|
|
44
77
|
# JSONL RPC 模式(收到 ready 后发送 {"id":"1","operation":"run","input":{"cwd":"...","prompt":"..."}})
|
|
45
78
|
anyswarm --harness subagents --mode rpc --output-dir ./runs
|
|
46
79
|
```
|
|
47
80
|
|
|
48
81
|
- **内置 Harness 名称**:`subagents`、`taskpool`、`peermesh`、`substrate`、`lead-worker`、`notes`、`messages`。
|
|
49
|
-
- **模块解析规则**:可传内置名称、显式 `.
|
|
50
|
-
- **RPC 协议(`--mode rpc`)**:`stdout` 输出 JSONL 协议帧,`stderr` 输出诊断信息。收到 `ready` 后发送包含 `cwd` 与 `prompt` 的 `run` 请求启动任务。
|
|
82
|
+
- **模块解析规则**:可传内置名称、显式 `.ts`/`.mts` 或 ESM 路径,或当前启动目录已安装的 npm 包名。
|
|
83
|
+
- **RPC 协议(`--rpc` 或 `--mode rpc`)**:`stdout` 输出 JSONL 协议帧,`stderr` 输出诊断信息。收到 `ready` 后发送包含 `cwd` 与 `prompt` 的 `run` 请求启动任务。
|
|
51
84
|
|
|
52
85
|
### 会话选项与控制命令
|
|
53
86
|
|
|
54
87
|
- **生命周期(`--lifetime task|interactive`)**:默认为单次任务模式 `task`;Subagents 等支持持续对话的 Harness 可选 `interactive`,保留会话直到截止时间或收到 `stop`。
|
|
55
88
|
- **人机问答(`--interaction none|questions`)**:默认 `none`;设为 `questions` 表示客户端支持在运行中途响应 Agent 发起的授权提问。
|
|
56
|
-
- **消息通道**:带 `--prompt` 的前台命令会立即发起工作;在 `interactive` 或 `questions` 模式下,后续控制命令通过 JSONL 通道交互。`--mode rpc` 则等待 `run` 命令后再启动。
|
|
89
|
+
- **消息通道**:带 `--prompt` 的前台命令会立即发起工作;在 `interactive` 或 `questions` 模式下,后续控制命令通过 JSONL 通道交互。`--rpc` 或 `--mode rpc` 则等待 `run` 命令后再启动。
|
|
57
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 与执行器决定)。最终结果会分别记录报告保存状态与清理事实。
|
|
58
91
|
|
|
92
|
+
### AutoResearch
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
anys -u autoresearch --cmd /prepare
|
|
96
|
+
anys -u autoresearch
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
在终端输入 `/demo frontiercs2`。四名平级 Kimi K3 成员并行研究,终端显示关键活动和实时 Trace 链接。运行时可用 `@peer-2 <建议>`、`/interrupt peer-2` 或 `/stop peer-2` 控制一个成员。无界面运行使用 `anys -u autoresearch --cmd '/demo frontiercs2'`。
|
|
100
|
+
|
|
101
|
+
用 `anys -u autoresearch --config ./research.ts "研究目标"` 配置自定义可信评测器,或用 `anys eject autoresearch` 导出源码。[快速上手](../../../examples/autoresearch/README.md)
|
|
102
|
+
|
|
59
103
|
## 统一环境变量清单
|
|
60
104
|
|
|
61
105
|
内置 CLI Harness(`subagents`、`taskpool`、`notes`、`messages`)共享同一套宿主机环境变量。OpenSandbox 连接由统一解析器处理,标准变量优先于旧的 Harness 专属别名:
|
|
@@ -112,7 +156,7 @@ swarm agent stop <agent-id> --request-id stop-1
|
|
|
112
156
|
在已构建的 `anyswarm` 源码仓库中开发或运行 `taskpool`/`peermesh` 评测夹具时,还可以使用以下两个开发者脚本(通过 `stdin` JSON 行支持 `status`、`kickoff`、`input`、`wait`、`stop`):
|
|
113
157
|
|
|
114
158
|
```bash
|
|
115
|
-
node dist/scripts/run-harness.js --config <host-config.
|
|
159
|
+
node dist/scripts/run-harness.js --config <host-config.ts>
|
|
116
160
|
node dist/scripts/read-harness-result.js --run-directory <dir> --runtime-id <id>
|
|
117
161
|
```
|
|
118
162
|
|
|
@@ -121,7 +165,7 @@ node dist/scripts/read-harness-result.js --run-directory <dir> --runtime-id <id>
|
|
|
121
165
|
## `anyswarm recover`(持久化恢复清理)
|
|
122
166
|
|
|
123
167
|
```bash
|
|
124
|
-
anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.
|
|
168
|
+
anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.ts
|
|
125
169
|
```
|
|
126
170
|
|
|
127
171
|
配置模块应默认导出原始 Runtime options 对象,或返回该对象的零参数异步工厂。该命令仅以清理模式恢复控制权、调用 `close()` 并打印清理回执;只有确认清理完成时才会以退出码 `0` 结束。执行恢复要求满足同主机、同次启动(same-host, same-boot)的独占写入归属且持久化配置匹配;账本会继续跟踪未完成清理的资源,直至对账确认执行已停止且资源已删除。必需导出失败时,在回执中的 `expiresAt` 前重试。详见 [Runtime 持久化恢复](../runtime.md#6-持久化恢复与-kubernetes)。
|
package/docs/zh/runtime.md
CHANGED
|
@@ -64,7 +64,7 @@ const runtime = await createRuntime({
|
|
|
64
64
|
|
|
65
65
|
调用成功后,`anyswarm` 会在宿主机自动初始化本次运行的目录、Model Gateway 和 Service Bridge,但**尚未启动任何沙箱**——具体何时启动 Agent 由你的 Harness 调用 `runtime.spawn()` 决定(见下一章 [Agent 与 Profile](agents.md))。
|
|
66
66
|
|
|
67
|
-
> **灵活的执行器与模型选项**:除了 `'pi'
|
|
67
|
+
> **灵活的执行器与模型选项**:除了 跟随实际安装版本的 `'pi'` 和 `'codex'` 简写外,还可以用 `createPiExecutor({ version: '1.4.0' })`、`createCodexExecutor(...)` 或 `createExecutorAdapter(...)` 指定执行器版本或镜像内自定义执行器;Pi 同时支持 **Responses** 与 **Chat Completions** 协议(详见 [SDK 与 API 参考](reference/api.md))。
|
|
68
68
|
|
|
69
69
|
### 自定义推理模型
|
|
70
70
|
|
|
@@ -208,7 +208,7 @@ const runtime = await recoverRuntime({
|
|
|
208
208
|
- **纯清理恢复(CLI)**:如果只需要把中断遗留的沙箱归档并清理干净,可传入 `cleanupOnly: true` 或直接运行:
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
|
-
anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.
|
|
211
|
+
anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.ts
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
配置模块的默认导出可以是原始 `options` 对象或返回该对象的无参异步函数。`anyswarm recover` 只接管清理权限、调用 `close()` 并打印回执(全部清理完成退出码为 `0`,仍有未清理项则为 `1`,未清理资源继续留在待处理清单中)。如果必选产物导出失败,沙箱会暂留至 `expiresAt`,请在到期前排查重试;若输出标记 `retain-at-risk`,说明底层服务未能确认预期的保留时长。
|
package/docs/zh/services.md
CHANGED
|
@@ -88,6 +88,10 @@ MCP 的 `structuredContent` 成为业务结果。声明输出 Schema 的成功
|
|
|
88
88
|
|
|
89
89
|
关闭或退役时封闭业务入口并收束在途工作。可选的 `exportState` 提供 [Trace Viewer](trace-viewer.md) 可查看的公开 JSON。接入包可以附加真实采集时点、业务版本、字段说明、摘要和表格配置。状态导出用于观测,业务持久化由 Service 自己提交。[Runtime 恢复](runtime.md) 说明原 Run 和存储身份要求。
|
|
90
90
|
|
|
91
|
+
要在 Run 进行中展示业务状态,实现 `ServiceAdapter.readState({ signal })`,返回 `{ state, capturedAt, revision?, presentation? }`。明确选择可公开字段,为 I/O 传入 signal,并提供 ISO 格式的采集时点。摘要项和表格列使用 JSON Pointer 指定取值位置。展示提示可供读取实时状态的 SDK 或 RPC 客户端使用。
|
|
92
|
+
|
|
93
|
+
Runtime 的拥有者调用 `runtime.services.listState()` 和 `runtime.services.readState(name)`。HarnessSession 客户端调用 `session.services.list()` 和 `session.services.read(runtimeId, name)`。单次读取限时一秒,上限 64 KiB。失败回执区分不支持、不可用、超时和错误,并在可用时附上上一次采集时间。这个读取入口只向宿主开放。[Persistent Board 示例](../../examples/services/persistent-board/README.md#watch-a-live-board) 展示了通过公开 SDK 开发的 Service 和 Harness。
|
|
94
|
+
|
|
91
95
|
## 更新现有 SDK 调用
|
|
92
96
|
|
|
93
97
|
把 `registerService({ manifest, adapter })` 改成 `register(name, definition)`。仍需对接已有 Manifest 协议的应用可以用 `services.register(...serviceFromManifest({ manifest, adapter }))`。将 `Profile.session.tools` 移到 `Profile.tools`,将 `Profile.prompt` 改成 `Profile.addedSystemPrompt`。通用 CLI 成功响应的业务数据在 `.result`,本地命令用法错误仍写入 stderr。旧 Trace 文件仍可读取。
|
package/examples/README.md
CHANGED
|
@@ -39,18 +39,15 @@ number.
|
|
|
39
39
|
```sh
|
|
40
40
|
npm init -y
|
|
41
41
|
npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
|
|
42
|
-
npm install --save-dev typescript @types/node
|
|
43
42
|
sdk=node_modules/@anyswarm/core
|
|
44
43
|
cp -R "$sdk"/examples/subagents demo
|
|
45
44
|
cd demo
|
|
46
|
-
|
|
47
|
-
npm run build
|
|
48
|
-
npm run start -- --cwd /absolute/path/to/project --prompt 'Implement and verify the requested change'
|
|
45
|
+
../node_modules/.bin/anys run ./project.ts --cwd /absolute/path/to/project --prompt 'Implement and verify the requested change'
|
|
49
46
|
```
|
|
50
47
|
|
|
51
48
|
For another collaboration mechanism, replace `subagents` in the copy command
|
|
52
49
|
with `taskpool`, `peermesh`, `lead-worker` or `substrate`. The copied project
|
|
53
|
-
resolves the SDK
|
|
50
|
+
resolves the SDK from its parent installation. The CLI loads TS directly, including multi-file imports and TS configuration.
|
|
54
51
|
|
|
55
52
|
For current repository sources, build the matching SDK archive from that
|
|
56
53
|
checkout's root first. Record its commit and SHA-256, and set the absolute
|
|
@@ -59,27 +56,42 @@ archive path before running the commands above.
|
|
|
59
56
|
```sh
|
|
60
57
|
npm ci --ignore-scripts
|
|
61
58
|
pack_dir=$(mktemp -d)
|
|
62
|
-
archive=$(npm
|
|
63
|
-
sha256sum "$
|
|
64
|
-
export ANYSWARM_SDK_ARCHIVE="$
|
|
59
|
+
archive=$(npm run --silent pack:release -- "$pack_dir")
|
|
60
|
+
sha256sum "$archive"
|
|
61
|
+
export ANYSWARM_SDK_ARCHIVE="$archive"
|
|
65
62
|
```
|
|
66
63
|
|
|
67
64
|
When editing an existing example directly in this checkout, install this
|
|
68
65
|
archive with `npm install --no-save "$ANYSWARM_SDK_ARCHIVE"` in that example's
|
|
69
|
-
directory before its
|
|
66
|
+
directory before running its TypeScript entry.
|
|
70
67
|
|
|
71
68
|
Use the example's README for its configuration and external facilities.
|
|
72
|
-
Run `
|
|
69
|
+
Run `anys run /absolute/path/to/example/project.ts --prompt '…'` from
|
|
73
70
|
the input project to use the same editable example from elsewhere. The
|
|
74
71
|
CLI also includes each example's built-in name as a convenience. The host
|
|
75
72
|
captures the initial directory and writes outputs outside it by default.
|
|
76
|
-
Use `--config` for trusted
|
|
73
|
+
Use `--config ./config.ts` for trusted TypeScript run configuration.
|
|
77
74
|
|
|
78
75
|
The model, executor and Sandbox environment variables are documented in
|
|
79
76
|
[Quickstart](../docs/en/quickstart.md). Existing scoped variables remain
|
|
80
77
|
fallbacks. Separate benchmarks take explicit configuration and fixtures.
|
|
81
78
|
See [FATE](../benchmarks/fate/README.md) and [Lead–Worker Orders](../benchmarks/lead-worker-orders/README.md).
|
|
82
79
|
|
|
80
|
+
## Export an editable Harness
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
anys eject example --dir ./my-harness
|
|
84
|
+
cd my-harness
|
|
85
|
+
anys run ./harness.ts
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Edit `business.ts` and run it again to see your own result. Export includes the
|
|
89
|
+
complete source and an SDK archive dependency bound to that package's contents.
|
|
90
|
+
Run `npm install` to install that local archive when moving the export to another
|
|
91
|
+
machine. `anyswarm-source.json` records source revision, SDK source, content and
|
|
92
|
+
archive digests. Application teams register the same source manifest for
|
|
93
|
+
`anys eject code`, `anys eject autoresearch` and `anys eject super`.
|
|
94
|
+
|
|
83
95
|
## Smaller SDK tutorials
|
|
84
96
|
|
|
85
97
|
| Example | Host entry | What to verify |
|
|
@@ -98,7 +110,7 @@ The [Service examples index](services/README.md) also links the optional
|
|
|
98
110
|
|
|
99
111
|
Read the Host entry for Worker settings, the named registrations and each
|
|
100
112
|
Profile’s grants. Follow the runner for Agent input, business checks and the
|
|
101
|
-
close receipt. Each example's README gives its
|
|
113
|
+
close receipt. Each example's README gives its launch and evidence paths.
|
|
102
114
|
|
|
103
115
|
## Repository boundaries
|
|
104
116
|
|