@anyswarm/core 0.5.1 → 0.6.0
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 +20 -5
- package/README.md +69 -55
- package/dist/examples/README.md +138 -77
- package/dist/examples/authoring/README.md +4 -4
- package/dist/examples/autoresearch/README.md +108 -16
- package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- package/dist/examples/autoresearch/config.d.ts +48 -5
- package/dist/examples/autoresearch/config.js +57 -23
- package/dist/examples/autoresearch/demo.d.ts +12 -4
- package/dist/examples/autoresearch/demo.js +65 -22
- 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 +14 -0
- package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
- package/dist/examples/autoresearch/frontiercs2.js +71 -14
- package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
- package/dist/examples/autoresearch/prepare-demo.js +46 -0
- package/dist/examples/autoresearch/prepare.d.ts +105 -53
- package/dist/examples/autoresearch/prepare.js +126 -57
- package/dist/examples/autoresearch/project.d.ts +6 -95
- package/dist/examples/autoresearch/project.js +131 -45
- package/dist/examples/autoresearch/research-service.d.ts +16 -1
- package/dist/examples/autoresearch/research-service.js +84 -44
- package/dist/examples/code/README.md +25 -17
- package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
- package/dist/examples/code/config.d.ts +1 -0
- package/dist/examples/first-harness/AGENTS.md +25 -0
- package/dist/examples/first-harness/README.md +136 -0
- package/dist/examples/first-harness/config.d.ts +9 -8
- package/dist/examples/first-harness/config.js +33 -26
- package/dist/examples/first-harness/eject.json +14 -0
- package/dist/examples/first-harness/handoff.js +3 -3
- package/dist/examples/first-harness/harness.d.ts +14 -18
- package/dist/examples/first-harness/harness.js +102 -77
- package/dist/examples/first-harness/input/README.md +7 -0
- package/dist/examples/first-harness/session.js +2 -1
- package/dist/examples/first-harness/tsconfig.json +2 -1
- package/dist/examples/harness-session/README.md +4 -4
- package/dist/examples/lead-worker/README.md +1 -1
- package/dist/examples/lead-worker/project-config.d.ts +1 -0
- package/dist/examples/messages/README.md +2 -2
- package/dist/examples/notes/README.md +5 -5
- package/dist/examples/notes/config.d.ts +1 -0
- package/dist/examples/parallel-swarm/AGENTS.md +32 -0
- package/dist/examples/parallel-swarm/README.md +136 -0
- package/dist/examples/parallel-swarm/board-service.js +25 -8
- package/dist/examples/parallel-swarm/board.d.ts +31 -1
- package/dist/examples/parallel-swarm/board.js +98 -13
- package/dist/examples/parallel-swarm/config.d.ts +11 -0
- package/dist/examples/parallel-swarm/config.js +39 -0
- package/dist/examples/parallel-swarm/eject.json +5 -0
- package/dist/examples/parallel-swarm/harness.d.ts +26 -20
- package/dist/examples/parallel-swarm/harness.js +77 -76
- package/dist/examples/parallel-swarm/report.d.ts +12 -0
- package/dist/examples/parallel-swarm/report.js +30 -0
- package/dist/examples/peermesh/README.md +1 -1
- package/dist/examples/peermesh/project-config.d.ts +1 -0
- package/dist/examples/services/agent-control/README.md +1 -1
- package/dist/examples/services/mathlib-search/README.md +1 -1
- package/dist/examples/services/mcp-managed/README.md +1 -1
- package/dist/examples/services/persistent-board/README.md +6 -3
- package/dist/examples/subagents/AGENTS.md +35 -0
- package/dist/examples/subagents/README.md +129 -93
- package/dist/examples/subagents/config.d.ts +2 -10
- package/dist/examples/subagents/config.js +9 -16
- package/dist/examples/subagents/eject.json +17 -0
- package/dist/examples/subagents/handoff-config.d.ts +41 -0
- package/dist/examples/subagents/handoff-config.js +13 -0
- package/dist/examples/subagents/model.d.ts +3 -0
- package/dist/examples/subagents/model.js +19 -0
- package/dist/examples/substrate/README.md +12 -6
- package/dist/examples/substrate/config.d.ts +1 -0
- package/dist/examples/substrate/project-config.d.ts +1 -0
- 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/examples/taskpool/README.md +1 -1
- package/dist/examples/taskpool/config.d.ts +1 -0
- package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
- 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 +133 -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/generate-architecture-coverage.js +1 -1
- package/dist/scripts/generate-architecture-prompts.js +18 -10
- package/dist/scripts/local-environment.d.ts +13 -7
- package/dist/scripts/local-environment.js +73 -21
- package/dist/scripts/local-setup.d.ts +3 -0
- package/dist/scripts/local-setup.js +153 -118
- package/dist/scripts/pack-release.js +31 -4
- package/dist/src/core/index.js +1 -1
- package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
- package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
- package/dist/src/core/sandbox/sandbox-connection.js +22 -7
- 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 +5 -4
- package/dist/src/harness/project-rpc-client.js +19 -0
- 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 +26 -8
- package/dist/src/trace-viewer/command.mjs +6 -3
- package/dist/src/trace-viewer/public/app.js +239 -59
- package/dist/src/trace-viewer/public/index.html +5 -0
- package/dist/src/trace-viewer/public/style.css +22 -0
- package/dist/src/trace-viewer/reader.mjs +242 -26
- package/dist/src/trace-viewer/run-root.d.mts +1 -0
- package/dist/src/trace-viewer/run-root.mjs +7 -0
- package/dist/src/trace-viewer/server.mjs +3 -1
- package/docs/INDEX.md +11 -9
- package/docs/architecture/04-services.md +1 -1
- package/docs/architecture/06-observability-experiments.md +21 -7
- package/docs/architecture/07-run-configuration.md +118 -19
- package/docs/architecture/08-prompts.md +21 -2
- package/docs/architecture/10-service-api-reference.md +12 -5
- package/docs/architecture/12-code-coverage.md +157 -115
- package/docs/architecture/15-core-runtime.md +1 -1
- package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
- package/docs/architecture/17-harness-reporting.md +79 -1
- package/docs/architecture/22-website.md +52 -20
- package/docs/architecture/23-project-harness.md +109 -37
- package/docs/architecture/26-code.md +20 -5
- package/docs/architecture/27-personal.md +23 -8
- package/docs/architecture/28-autoresearch.md +18 -12
- package/docs/architecture/INDEX.md +1 -2
- package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
- package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
- package/docs/architecture/prompts/22-autoresearch.md +9 -2
- package/docs/architecture/prompts/source-manifest.json +76 -52
- package/docs/architecture/source-map.json +445 -105
- 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/autoresearch.md +41 -0
- package/docs/en/blog/100b-tokens.md +157 -0
- package/docs/en/build-your-harness.md +47 -22
- package/docs/en/changelog.md +29 -1
- package/docs/en/first-harness.md +40 -32
- package/docs/en/harnesses/index.md +23 -23
- package/docs/en/harnesses/lead-worker.md +1 -1
- package/docs/en/harnesses/peermesh.md +2 -2
- package/docs/en/harnesses/subagents.md +10 -31
- package/docs/en/harnesses/substrate.md +4 -4
- package/docs/en/harnesses/taskpool.md +2 -2
- package/docs/en/latest.md +30 -5
- package/docs/en/overview.md +22 -22
- package/docs/en/quickstart.md +69 -56
- 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/en/trace-viewer.md +32 -12
- package/docs/operations/trace-viewer.md +26 -11
- package/docs/third-party-notices.md +0 -1
- package/docs/workflows/development.md +160 -118
- package/docs/workflows/release-and-docs-versioning.md +207 -54
- package/docs/workflows/release-cli-acceptance.md +162 -0
- package/docs/zh/agents.md +1 -1
- package/docs/zh/autoresearch.md +41 -0
- package/docs/zh/blog/100b-tokens.md +102 -0
- package/docs/zh/build-your-harness.md +48 -23
- package/docs/zh/changelog.md +29 -1
- package/docs/zh/first-harness.md +43 -35
- package/docs/zh/harnesses/index.md +23 -23
- package/docs/zh/harnesses/lead-worker.md +1 -1
- package/docs/zh/harnesses/peermesh.md +2 -2
- package/docs/zh/harnesses/subagents.md +10 -31
- package/docs/zh/harnesses/substrate.md +4 -4
- package/docs/zh/harnesses/taskpool.md +2 -2
- package/docs/zh/latest.md +30 -5
- package/docs/zh/overview.md +23 -23
- package/docs/zh/quickstart.md +66 -57
- package/docs/zh/reference/api.md +1 -1
- package/docs/zh/reference/cli.md +19 -79
- package/docs/zh/sandbox.md +3 -3
- package/docs/zh/trace-viewer.md +32 -12
- package/examples/README.md +138 -77
- package/examples/authoring/README.md +4 -4
- package/examples/autoresearch/README.md +108 -16
- package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
- package/examples/autoresearch/config.ts +64 -25
- package/examples/autoresearch/demo.ts +75 -22
- package/examples/autoresearch/eject.json +2 -0
- package/examples/autoresearch/frontiercs2-config.ts +15 -0
- package/examples/autoresearch/frontiercs2.ts +64 -11
- package/examples/autoresearch/prepare-demo.ts +44 -0
- package/examples/autoresearch/prepare.ts +134 -60
- package/examples/autoresearch/project.ts +120 -44
- package/examples/autoresearch/research-service.ts +91 -41
- package/examples/code/README.md +25 -17
- package/examples/code/REQUIREMENTS.zh.md +3 -3
- package/examples/first-harness/AGENTS.md +25 -0
- package/examples/first-harness/README.md +136 -0
- package/examples/first-harness/config.ts +41 -27
- package/examples/first-harness/eject.json +14 -0
- package/examples/first-harness/handoff.ts +3 -3
- package/examples/first-harness/harness.ts +104 -72
- package/examples/first-harness/input/README.md +7 -0
- package/examples/first-harness/session.ts +2 -1
- package/examples/first-harness/tsconfig.json +2 -1
- package/examples/harness-session/README.md +4 -4
- package/examples/lead-worker/README.md +1 -1
- package/examples/messages/README.md +2 -2
- package/examples/notes/README.md +5 -5
- package/examples/parallel-swarm/AGENTS.md +32 -0
- package/examples/parallel-swarm/README.md +136 -0
- package/examples/parallel-swarm/board-service.ts +28 -9
- package/examples/parallel-swarm/board.ts +107 -13
- package/examples/parallel-swarm/config.ts +47 -0
- package/examples/parallel-swarm/eject.json +5 -0
- package/examples/parallel-swarm/harness.ts +83 -71
- package/examples/parallel-swarm/report.ts +33 -0
- package/examples/peermesh/README.md +1 -1
- package/examples/services/agent-control/README.md +1 -1
- package/examples/services/mathlib-search/README.md +1 -1
- package/examples/services/mcp-managed/README.md +1 -1
- package/examples/services/persistent-board/README.md +6 -3
- package/examples/subagents/AGENTS.md +35 -0
- package/examples/subagents/README.md +129 -93
- package/examples/subagents/config.ts +9 -15
- package/examples/subagents/eject.json +17 -0
- package/examples/subagents/handoff-config.ts +14 -0
- package/examples/subagents/model.ts +20 -0
- package/examples/substrate/README.md +12 -6
- 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/examples/taskpool/README.md +1 -1
- package/npm-shrinkwrap.development.json +46 -1538
- package/npm-shrinkwrap.json +10 -43
- package/package.development.json +3 -6
- package/package.json +3 -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 +125 -0
- package/scripts/anyswarm-project.ts +31 -123
- package/scripts/anyswarm-source-runner.ts +9 -36
- package/scripts/anyswarm.ts +4 -24
- package/scripts/generate-architecture-coverage.ts +1 -1
- package/scripts/generate-architecture-prompts.ts +21 -10
- package/scripts/local-environment.ts +79 -21
- package/scripts/local-setup.ts +150 -105
- package/scripts/pack-release.ts +28 -4
- package/src/core/index.ts +1 -1
- package/src/core/sandbox/opensandbox-backend.ts +10 -4
- package/src/core/sandbox/sandbox-connection.ts +22 -7
- package/src/core/worker-image.ts +1 -1
- package/src/harness/project-harness.ts +5 -4
- package/src/harness/project-rpc-client.ts +23 -0
- package/src/harness/project-runtime.ts +2 -1
- package/src/harness/typescript-loader.ts +28 -8
- package/src/trace-viewer/command.mjs +6 -3
- package/src/trace-viewer/public/app.js +239 -59
- package/src/trace-viewer/public/index.html +5 -0
- package/src/trace-viewer/public/style.css +22 -0
- package/src/trace-viewer/reader.mjs +242 -26
- package/src/trace-viewer/run-root.d.mts +1 -0
- package/src/trace-viewer/run-root.mjs +7 -0
- package/src/trace-viewer/server.mjs +3 -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/quickstart.md
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 快速上手
|
|
3
|
-
description:
|
|
3
|
+
description: 准备共同运行环境,再用 Subagents 检查真实仓库,导出带文件依据的工程交接报告。
|
|
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
|
+
GitHub 的 `main` 分支与网站 **Next** 频道中的本指南跟随当前开发。
|
|
13
|
+
使用正式发行包时,请阅读[稳定版快速上手](https://anyswarm.github.io/anyswarm/zh/docs/quickstart/)。
|
|
14
|
+
稳定版网站的版本标签对应已发布的包;Next 文档可能领先于最后一次发布的 npm 预览包。
|
|
13
15
|
|
|
14
16
|
## 前置要求
|
|
15
17
|
|
|
16
18
|
| 依赖 | 要求与说明 | 检查命令 |
|
|
17
19
|
| --- | --- | --- |
|
|
18
|
-
| **Linux** | 控制器宿主机(如 Ubuntu
|
|
19
|
-
| **Node.js** | `>= 22.19
|
|
20
|
+
| **Linux 或 macOS** | 控制器宿主机(如 Ubuntu、Debian 或运行 Docker Desktop 的 macOS) | `uname -s` |
|
|
21
|
+
| **Node.js** | `>= 22.19`,推荐 Node.js 24(Ubuntu 24.04、Debian 13 等软件源默认版本偏旧,请从 [nodejs.org](https://nodejs.org/en/download) 安装 LTS) | `node --version` |
|
|
20
22
|
| **npm** | 随 Node.js 安装 | `npm --version` |
|
|
21
23
|
| **Git** | 用于检出源码与捕获项目 | `git --version` |
|
|
22
|
-
| **
|
|
23
|
-
| **Docker Engine** | 仅本机启动 OpenSandbox 时需要;接入已有服务可跳过([安装指南](https://docs.docker.com/engine/install/)) | `docker info` |
|
|
24
|
+
| **Docker Engine** | 本机运行的 Linux 容器引擎([安装指南](https://docs.docker.com/engine/install/)) | `docker info` |
|
|
24
25
|
|
|
25
26
|
在 Ubuntu 或 Debian 本机使用 Docker 时,安装系统依赖并启动 Docker:
|
|
26
27
|
|
|
27
28
|
```bash
|
|
28
|
-
sudo apt-get update && sudo apt-get install -y docker.io git
|
|
29
|
+
sudo apt-get update && sudo apt-get install -y docker.io git ca-certificates
|
|
29
30
|
sudo systemctl enable --now docker.service
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
连接已有 OpenSandbox 时,只需安装 `git curl ca-certificates`,可跳过 Docker 服务和用户组操作。
|
|
33
|
-
|
|
34
33
|
若访问 Docker socket 被拒绝,管理员可执行 `sudo usermod -aG docker alice`,将 `alice` 换为运行 AnySwarm 的账号。使用该账号重新登录,执行 `id` 和 `docker info`。[`docker` 用户组具有等同于 root 的权限](https://docs.docker.com/engine/install/linux-postinstall/)。
|
|
35
34
|
|
|
36
35
|
### macOS 上的 Docker
|
|
@@ -45,15 +44,15 @@ docker context show
|
|
|
45
44
|
docker info --format '{{.OSType}}/{{.Architecture}}'
|
|
46
45
|
```
|
|
47
46
|
|
|
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
|
|
47
|
+
若 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。
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
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
50
|
|
|
52
51
|
## 1. 安装 AnySwarm
|
|
53
52
|
|
|
54
53
|
### 安装公开发行版
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
使用 Node.js 22.19 或更高版本和 npm 安装 CLI。macOS 和 Linux 使用同一条命令。Docker 在运行 setup 时才需要。
|
|
57
56
|
|
|
58
57
|
```bash
|
|
59
58
|
npm install -g @anyswarm/core
|
|
@@ -62,71 +61,70 @@ anyswarm --version
|
|
|
62
61
|
|
|
63
62
|
`-g` 将命令装到 npm 的全局目录。若终端找不到命令,请确认 `$(npm prefix -g)/bin` 在 PATH 中,并且当前终端使用的是安装 CLI 时的 Node.js。
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
如果你要用 TypeScript 编写 Harness,请按[安装 SDK](reference/api.md#安装-sdk)把它加到项目依赖里。
|
|
65
|
+
|
|
66
|
+
### 显式试用预览包(`next`)
|
|
67
|
+
|
|
68
|
+
需要测试尚未正式发布的改动时,选择这个频道:
|
|
66
69
|
|
|
67
70
|
```bash
|
|
68
|
-
|
|
71
|
+
npm install -g @anyswarm/core@next
|
|
72
|
+
anyswarm --version
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
反馈问题时记录实际安装的预发布版本。项目 SDK 使用
|
|
76
|
+
`npm install --save-exact @anyswarm/core@next`,并保留 lockfile。
|
|
77
|
+
Next 网站跟随 `main`;若它领先于安装包,请以该包自带的示例和文档复现。
|
|
78
|
+
使用同一 npm prefix 执行 `npm install -g @anyswarm/core@latest` 可回到稳定版。
|
|
79
|
+
预览包由维护者显式发布,合入 `main` 的改动不一定已经出现在 `next` 中。
|
|
74
80
|
|
|
75
81
|
### 从源码构建并安装(`main`)
|
|
76
82
|
|
|
77
|
-
在仓库根目录执行以下命令。`npm run pack:release`
|
|
83
|
+
在仓库根目录执行以下命令。`npm run pack:release` 构建发行包,最后一条安装命令将归档装入指定的 npm prefix。
|
|
78
84
|
|
|
79
85
|
```bash
|
|
80
86
|
git clone https://github.com/AnySwarm/anyswarm.git && cd anyswarm
|
|
81
87
|
npm ci --no-audit --no-fund
|
|
82
88
|
pack_dir=$(mktemp -d)
|
|
83
89
|
npm run pack:release -- "$pack_dir"
|
|
84
|
-
|
|
90
|
+
npm install -g --prefix "$HOME/.local" "$pack_dir"/*.tgz
|
|
85
91
|
export PATH="$HOME/.local/bin:$PATH"
|
|
86
92
|
anyswarm --version
|
|
87
93
|
```
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
源码专用教程或尚未合并的改动,需要在打包前检出对应已审阅分支或提交;默认检出的 `main` 只包含已合并工作。候选包可能和发行版显示同一个版本号。请记录提交号和 tarball 的 SHA-256。如果要在[独立示例项目](../../examples/README.md)中使用同一份 SDK,请保留生成的候选版 tarball。
|
|
90
96
|
|
|
91
97
|
### 更新 CLI
|
|
92
98
|
|
|
93
|
-
|
|
94
|
-
- 安装脚本。运行 `anyswarm update`,校验 GitHub Release 归档并验证新 CLI 可用后再切换。更新失败时,原 CLI 仍可用。
|
|
99
|
+
两个通道都沿用安装时的 npm prefix。`anyswarm update` 显示稳定版的更新命令。要继续使用预览版,请再次显式安装 `@anyswarm/core@next`。
|
|
95
100
|
|
|
96
|
-
|
|
101
|
+
用同一套 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。
|
|
102
|
+
|
|
103
|
+
如果曾用旧版脚本安装 v0.5.0 或 v0.5.1,请检查 `$(npm prefix -g)/bin` 下的 `anyswarm`、`anys` 和 `swarm`。只清理指向旧安装 `lib/anyswarm/current` 的链接,再用 npm 安装。AnySwarm 配置存放在 CLI 安装目录之外。
|
|
97
104
|
|
|
98
105
|
更新项目 SDK 时,在项目目录内使用该项目的包管理器。
|
|
99
106
|
|
|
100
107
|
## 2. 准备 OpenSandbox 与 Worker
|
|
101
108
|
|
|
102
|
-
|
|
109
|
+
在准备运行 OpenSandbox 和 Worker 的本机执行:
|
|
103
110
|
|
|
104
111
|
```bash
|
|
105
|
-
|
|
106
|
-
anyswarm setup --backend pi
|
|
107
|
-
anyswarm doctor --smoke
|
|
112
|
+
anyswarm setup
|
|
108
113
|
```
|
|
109
114
|
|
|
115
|
+
setup 自动识别操作系统和 Node 版本,检查本机 Docker,并寻找已保存的配置或已安装的 Pi、Codex。缺依赖时,按提示处理后重试。用 `anyswarm doctor` 可以只读检查本机依赖与 Lifecycle 连接。
|
|
116
|
+
|
|
117
|
+
如果缺执行器,可用 `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`。
|
|
118
|
+
|
|
110
119
|
裸 `setup` 会复用上次保存的可执行文件路径。换一份安装时,用 `--backend pi --backend-path /absolute/path/to/bin/pi` 或相应的 Codex 选项。要固定已安装版本,加 `--backend-version 1.7.0` 并替换为你要使用的版本号。固定版本保存后,如果可执行文件报告其他版本,检查会明确失败。重新显式选择 backend 并省略版本参数,可恢复跟随该安装的升级。
|
|
111
120
|
|
|
112
121
|
macOS 在原生架构的 Docker 容器内准备同一发行版的 Linux 包。配置保存前会核对 Worker 版本、执行器启动和受控协议 smoke。没有保存的选择时,如果发现两种 backend,交互终端会提示选择。自动化调用可用 `--backend` 明确指定。
|
|
113
122
|
|
|
114
123
|
首次本地 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
124
|
|
|
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
|
-
```
|
|
125
|
+
AnySwarm Worker 在本机构建,内容匹配时复用已有镜像。构建的基础镜像、apt 和 npm 依赖仍可能需要联网。继续用 AnySwarm 环境变量或项目配置提供模型端点和凭据。setup 的受控模型自检不会验证真实模型凭据。可以用 `anyswarm doctor --smoke` 再跑一次受控自检。
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
`connection.publicUrl` 是 Bridge 与模型请求共用的一个回调地址。反向代理应将此前缀转发至 Runtime 的 `bindHost` 与固定 `bindPort`。本地 setup 自动发现可达宿主地址与可用端口。详细说明见 [Sandbox](sandbox.md) 和 [宿主网关](gateway.md)。
|
|
127
|
+
本地服务与 CLI 运行在同一台机器。需要接入自己管理的服务时,请参考 [Sandbox](sandbox.md)。
|
|
130
128
|
|
|
131
129
|
### 诊断镜像可用性
|
|
132
130
|
|
|
@@ -134,38 +132,49 @@ setup 显示正在准备的镜像及当前阶段的等待时间。显式 Worker
|
|
|
134
132
|
|
|
135
133
|
本地构建失败时可根据报告定位阶段并修复对应依赖。setup 会报告 SDK 的版本与内容、所选执行器及其身份、Worker 镜像 ID 和构建或复用结果。
|
|
136
134
|
|
|
137
|
-
## 3.
|
|
135
|
+
## 3. 为真实仓库生成工程交接报告
|
|
138
136
|
|
|
139
|
-
|
|
137
|
+
使用 AnySwarm 0.6.0 或[匹配的源码构建包](#从源码构建并安装main)导出交接示例。下面固定了 [p-limit 真实验收](https://github.com/AnySwarm/anyswarm/issues/358#issuecomment-7385075753)的仓库版本。体验后可把输入路径换成自己仓库中一个聚焦目录。
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
先配置支持流式响应和工具调用的模型及凭据。命令以 OpenAI Responses 为例。独立 VM 验收通过配置的 Responses 服务使用 GPT-6.1 Sol。其他协议和执行器可查阅 [CLI 参考](reference/cli.md)。
|
|
142
140
|
|
|
143
141
|
```bash
|
|
144
142
|
export ANYSWARM_MODEL_URL='https://api.openai.com/v1/responses'
|
|
145
143
|
export ANYSWARM_MODEL_ID='gpt-5-mini'
|
|
146
144
|
export ANYSWARM_MODEL_TOKEN='<your-api-key>'
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
anyswarm
|
|
146
|
+
git clone https://github.com/sindresorhus/p-limit.git ./handoff-input
|
|
147
|
+
git -C ./handoff-input checkout --detach a8a6fbec4e0e866d6d779b10889bb4f5567e70eb
|
|
148
|
+
anyswarm eject subagents --dir ./handoff
|
|
149
|
+
(
|
|
150
|
+
cd ./handoff
|
|
151
|
+
npm install
|
|
152
|
+
npm start -- --config ./handoff-config.ts --cwd ../handoff-input \
|
|
153
|
+
--prompt 'Prepare an engineering handoff for this repository. Assign two different children: ask one to find its public entry points, exported types and how to run the repository checks, and ask the other to identify scheduling flow, core state and test coverage. Have both return independent concrete findings to Root with file paths and line numbers. Wait for both; cross-check their citations. Write a useful report.md with the architecture, verified commands, risks and open questions. Only create report.md; do not modify source, install dependencies or claim to have run checks you only read about.' \
|
|
154
|
+
--output-dir ../runs
|
|
155
|
+
)
|
|
151
156
|
```
|
|
152
157
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
预期退出码为 0,`outcome: "completed"`,业务输出包含标题 `# Hello from AnySwarm`,并记录 `cleanup.status: "complete"`。Trace Viewer 可查看 `read` 工具的结果。
|
|
158
|
+
该配置允许 360 秒工作、70 秒单次模型请求和 60 秒清理,最多运行 Root 与两名直属子成员,要求导出不超过 1 MiB 的 `report.md`。实际耗时取决于输入、模型及运行环境。通用内置 Subagents 有自己的较短默认值。宿主捕获输入快照,Agent 在各自的副本工作,结果导出到 `./runs`。按终端给出的产物路径查看报告。
|
|
156
159
|
|
|
157
|
-
## 4.
|
|
160
|
+
## 4. 检查报告和背后的协作
|
|
158
161
|
|
|
159
162
|
```bash
|
|
160
|
-
anyswarm trace --root ./runs --port 8787
|
|
163
|
+
anyswarm trace --root ./runs --port 8787
|
|
161
164
|
```
|
|
162
165
|
|
|
163
|
-
|
|
166
|
+
打开终端打印的本地地址。远程宿主可使用 SSH 转发,例如 `ssh -N -L 8787:127.0.0.1:8787 user@host`,然后在本地打开 `http://127.0.0.1:8787`。
|
|
167
|
+
|
|
168
|
+
针对同一次 Run,分别核对:
|
|
169
|
+
|
|
170
|
+
- **工作过程:** Root 是否创建了要求的子 Agent,各自是否读取了不同部分,Root 是否收到他们的发现。时间线可以确认工作是否真正重叠。
|
|
171
|
+
- **报告:** 从最终产物路径或 **Files & results** 找到 `report.md`,对照捕获文件检查路径与行号范围。只从文档找到的命令应与实际执行过的命令区分。
|
|
172
|
+
- **状态:** 分别查看业务结果、导出和清理。Agent 完成回合不等于报告质量经过独立验收。通用 Subagents 的 `acceptance.status` 为 `"not-run"`,内容结论仍需判断;有最终答复也不能忽略缺文件、导出不完整或 cleanup pending。
|
|
164
173
|
|
|
165
|
-
|
|
174
|
+
无需安装或凭据即可打开 [p-limit 真实交接回放](./trace-viewer.md),查看 Root 和两个子成员如何协作,以及他们导出的 `report.md`。
|
|
166
175
|
|
|
167
176
|
## 下一步
|
|
168
177
|
|
|
169
|
-
- [
|
|
170
|
-
- [
|
|
171
|
-
- [
|
|
178
|
+
- [选择示例](harnesses/index.md)——按三层定位了解应用、协作参考与进阶集成。
|
|
179
|
+
- [第一个 SDK Harness](first-harness.md) → [并行 Swarm](build-your-harness.md)——学习 Service 交接、字节检查、并行互评与汇总。
|
|
180
|
+
- [AutoResearch](autoresearch.md)——了解当前研究应用与 Evaluator 要求。
|
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#v052)提供固定版本的安装命令。
|
|
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/docs/zh/trace-viewer.md
CHANGED
|
@@ -5,27 +5,41 @@ section: 核心构件
|
|
|
5
5
|
order: 8
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
标准 Harness Session 会保存 Run 报告,每个实际创建的 Runtime 则写入自己的结构化轨迹。内置的 **Trace Viewer**(`anyswarm trace`)让你直接在浏览器里检查已记录的 Runtime 活动,**无需安装任何额外前端依赖**。Harness 也可能在创建 Runtime 前完成或失败;这种报告的查看方式见下文版本说明。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
上方回放的是在独立 VM 上针对 [p-limit `a8a6fbec`](https://github.com/sindresorhus/p-limit/tree/a8a6fbec4e0e866d6d779b10889bb4f5567e70eb) 完成的一次 Subagents 仓库交接。Root 和两个子成员通过 Pi 与 OpenSandbox 发出了 28 次 GPT-6.1 Sol 请求。公开回放选取同一次运行的输入、模型和 Service 元数据,省略消息正文、提示词、工具事件及私有 Runtime 文件。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
打开 **产物与文件** 可查看原始 `report.md`(12,093 字节)和 SHA-256。独立 VM 核验了导出字节与资源清理。通用 Harness 记录的验收状态是 `not-run`,报告结论仍需对照源码判断。[VM 验收记录](https://github.com/AnySwarm/anyswarm/issues/358#issuecomment-7385075753)
|
|
13
|
+
|
|
14
|
+
无需安装即可操作。
|
|
15
|
+
|
|
16
|
+
- **切换展示视图**:通过外侧顶栏按钮在 **泳道时间线**、**运行事件** 与 **产物与文件** 之间切换,或点击 **打开完整版 ↗** 使用 Run 列表与搜索。
|
|
13
17
|
- **泳道缩放与平移**:在泳道上滚动滚轮即可围绕光标精确缩放,拖拽泳道或缩略小地图平移,也可使用 `W`/`S`(缩放)、`A`/`D`(平移)和 `0`(重置)。
|
|
14
|
-
-
|
|
18
|
+
- **悬浮与点击检视**:鼠标悬浮任意色块可查看记录中的耗时与摘要;点击任意色块会在右侧滑出 **Evidence Inspector**,支持 **Structured** 与 **Raw JSON** 两种查看方式。
|
|
15
19
|
|
|
16
20
|
## 1. 本地启动 `anyswarm trace`
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
标准 CLI 和 `createHarnessSession()` 的默认根目录是 `${XDG_STATE_HOME:-$HOME/.local/state}/anyswarm/runs`。在已安装 SDK 的项目中,用项目内 CLI 打开该目录:
|
|
19
23
|
|
|
20
24
|
```bash
|
|
21
|
-
#
|
|
22
|
-
anyswarm trace --root
|
|
25
|
+
# 查看标准 Harness 的默认输出目录
|
|
26
|
+
./node_modules/.bin/anyswarm trace --root "${XDG_STATE_HOME:-$HOME/.local/state}/anyswarm/runs" --port 8787 --open
|
|
23
27
|
|
|
24
|
-
#
|
|
25
|
-
anyswarm trace ./runs --port 8787
|
|
28
|
+
# 仅在 Run 显式使用 --output-dir ./runs 或 outputRoot: './runs' 时
|
|
29
|
+
./node_modules/.bin/anyswarm trace ./runs --port 8787
|
|
26
30
|
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
全局安装时,可把 `./node_modules/.bin/anyswarm` 换成 `anyswarm`。CLI 的 `--output-dir` 和 Harness Session 的 `outputRoot` 会覆盖默认值。默认目录不可用或位于被采集的工作区内时,Harness 可能改用私有临时目录;此时使用实际打印的回放命令,或把保存结果中 `reportPath` 所在的目录传给 `--root`。
|
|
33
|
+
|
|
34
|
+
在浏览器打开 `http://127.0.0.1:8787`。Trace Viewer 读取存盘文件,**不需要 Docker、OpenSandbox 或模型密钥**。`--port 0` 会选择可用端口,以启动时打印的 URL 为准。公开 npm **0.5.2** 要求根目录已经存在;新增 Run 后需要手动刷新列表,发现运行依赖 `runtime.json`。选中的 Runtime 可以通过 SSE 实时更新。若该次 Run 只有 `project-run.json`,在 0.5.2 中请直接读取报告文件。
|
|
35
|
+
|
|
36
|
+
### 0.6.0 的 Run 发现功能
|
|
37
|
+
|
|
38
|
+
0.6.0 纳入了 [#360](https://github.com/AnySwarm/anyswarm/issues/360) 的 Run 发现和报告查看改进。
|
|
39
|
+
|
|
40
|
+
- 不传根目录的 `anyswarm trace` 使用标准 Harness 状态目录。目录尚不存在时进入等待状态,页面显示正在读取的实际路径。
|
|
41
|
+
- 页面可见时约每两秒检查新增 Run。列表更新保留当前 Run、筛选、时间窗口和键盘焦点;读取失败时保留上次成功的列表,并显示错误。
|
|
42
|
+
- 尚未确认匹配的 Runtime 关联时,也可打开有效的 `project-run.json`。**Files & results** 展示报告中已有的业务结果、原因、失败、返回值、验收、导出和清理事实。缺口说明会区分身份缺失、记录不可用和关联无法确认等情况,不代表其他位置一定没有 Runtime。页面不会补出 Agent 数量、时间线、费用或耗时;一致且唯一的 Runtime 关联会提供跳转入口。
|
|
29
43
|
|
|
30
44
|
## 2. 远程 Linux 服务器查看(SSH 端口转发)
|
|
31
45
|
|
|
@@ -41,7 +55,11 @@ ssh -N -L 8787:127.0.0.1:8787 user@your-linux-host
|
|
|
41
55
|
|
|
42
56
|
随后在本机访问 `http://127.0.0.1:8787`。运行记录包含私有提示词与源码,请始终通过 SSH 转发查看,不要直接暴露公网端口。
|
|
43
57
|
|
|
44
|
-
## 3.
|
|
58
|
+
## 3. 报告与 Runtime 文件保存在哪里?
|
|
59
|
+
|
|
60
|
+
标准 Harness 将 `project-run.json` 保存在 `<root>/<runId>/`。Harness 使用该目录作为 Runtime 输出根时,Runtime 文件位于 `<root>/<runId>/<runtimeId>/`。
|
|
61
|
+
|
|
62
|
+
直接调用 SDK 的 `createRuntime()` 仍须显式设置 `outputDir`,轨迹写入 `<outputDir>/<runtimeId>/`。用 `./node_modules/.bin/anyswarm trace --root <outputDir>` 打开该目录;Harness 的状态目录默认值不会替直接 SDK 程序选择输出目录。下表路径均相对于 Runtime 目录:
|
|
45
63
|
|
|
46
64
|
| 路径 | 内容 |
|
|
47
65
|
| --- | --- |
|
|
@@ -52,10 +70,12 @@ ssh -N -L 8787:127.0.0.1:8787 user@your-linux-host
|
|
|
52
70
|
| `service-state.<id>.<uuid>.json` | close/retire 时导出的公开状态,以及 Service 提供的采集信息和展示配置 |
|
|
53
71
|
| `model-trace/` | 经 Model Gateway 转发的原始 Responses / Chat Completions 请求与流式响应 |
|
|
54
72
|
| `<agentId>/session/` 与 `artifacts/` | 归档的 Pi / Codex 原生会话与 `Profile.collect` 导出的工作区文件 |
|
|
55
|
-
| `harness-report.json` |
|
|
73
|
+
| `harness-report.json` | Harness 写入的业务结果与验收报告(如有) |
|
|
56
74
|
|
|
57
75
|
在 Run 顶部打开 **Service states**,或选择一条 Service 调用,即可检查已导出的状态。详情显示导出状态、实例身份和框架导出时间窗。Service 主动提供采集时间和业务版本后才显示对应值。未提供状态、采集失败、内容截断和文件缺失分别保留状态。close/retire 快照展示自己的观测时间窗,查看较早调用时也会保留该说明。Service 可以提供数据形式的摘要和表格,原始 JSON 同时可读。持久 Board 示例提供条目数与 Entries 表格。[运行 Board 示例](../../examples/services/persistent-board/README.md)。
|
|
58
76
|
|
|
77
|
+
在**文件与结果**中,打开带 SHA-256 的归档文件会核对原记录版本。**加载后续 64 KB**从上一页字节边界续读,**复制**包含已加载的全部文本。网站回放可以只保留部分文件预览,剩余内容可在已安装的 Viewer 中打开原 Run 查看。
|
|
78
|
+
|
|
59
79
|
## 4. 在长任务中检索
|
|
60
80
|
|
|
61
81
|
顶部的 **Model / Service / Tool** 统计覆盖整次 Run,不受当前时间窗口影响。一次模型请求、Service 调用尝试或工具执行各计一次,开始与结束事件不会重复计数。缺少原生工具边界的旧格式 Run 使用归档 Session 中的工具结果计数,结果缺少时间戳也会计入。
|