@anyswarm/core 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +13 -6
  3. package/dist/examples/README.md +16 -5
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +15 -8
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  7. package/dist/examples/autoresearch/demo.js +1 -1
  8. package/dist/examples/autoresearch/eject.json +2 -0
  9. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  10. package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
  11. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  12. package/dist/examples/autoresearch/prepare-demo.js +15 -0
  13. package/dist/examples/autoresearch/prepare.js +3 -3
  14. package/dist/examples/autoresearch/project.d.ts +0 -94
  15. package/dist/examples/autoresearch/project.js +2 -20
  16. package/dist/examples/code/README.md +25 -17
  17. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  18. package/dist/examples/harness-session/README.md +3 -3
  19. package/dist/examples/messages/README.md +1 -1
  20. package/dist/examples/notes/README.md +3 -3
  21. package/dist/examples/services/mathlib-search/README.md +1 -1
  22. package/dist/examples/services/persistent-board/README.md +5 -2
  23. package/dist/examples/subagents/README.md +2 -2
  24. package/dist/examples/subagents/config.js +3 -3
  25. package/dist/examples/substrate/README.md +2 -2
  26. package/dist/examples/super/README.md +34 -22
  27. package/dist/examples/super/actions.d.ts +1 -1
  28. package/dist/examples/super/actions.js +11 -11
  29. package/dist/examples/super/config.js +3 -3
  30. package/dist/examples/super/eject.json +1 -1
  31. package/dist/examples/super/location.js +1 -1
  32. package/dist/examples/super/operator.d.ts +1 -0
  33. package/dist/examples/super/operator.js +31 -0
  34. package/dist/examples/super/project.d.ts +0 -107
  35. package/dist/examples/super/project.js +1 -3
  36. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  37. package/dist/scripts/anyswarm-arguments.js +69 -97
  38. package/dist/scripts/anyswarm-eject.js +1 -1
  39. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  40. package/dist/scripts/anyswarm-harnesses.js +1 -22
  41. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  42. package/dist/scripts/anyswarm-installation.js +17 -291
  43. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  44. package/dist/scripts/anyswarm-launch.js +32 -81
  45. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  46. package/dist/scripts/anyswarm-progress.js +102 -0
  47. package/dist/scripts/anyswarm-project.d.ts +1 -9
  48. package/dist/scripts/anyswarm-project.js +40 -127
  49. package/dist/scripts/anyswarm-source-runner.js +9 -41
  50. package/dist/scripts/anyswarm.js +6 -26
  51. package/dist/scripts/build-provenance.json +1 -1
  52. package/dist/scripts/local-environment.d.ts +10 -4
  53. package/dist/scripts/local-environment.js +67 -20
  54. package/dist/scripts/local-setup.d.ts +3 -0
  55. package/dist/scripts/local-setup.js +135 -107
  56. package/dist/scripts/pack-release.js +4 -1
  57. package/dist/src/core/worker-image.js +1 -1
  58. package/dist/src/harness/project-harness.d.ts +1 -0
  59. package/dist/src/harness/project-harness.js +2 -2
  60. package/dist/src/harness/project-runtime.js +3 -1
  61. package/docs/INDEX.md +2 -1
  62. package/docs/architecture/04-services.md +1 -1
  63. package/docs/architecture/07-run-configuration.md +28 -14
  64. package/docs/architecture/12-code-coverage.md +56 -57
  65. package/docs/architecture/17-harness-reporting.md +1 -1
  66. package/docs/architecture/22-website.md +4 -7
  67. package/docs/architecture/23-project-harness.md +48 -23
  68. package/docs/architecture/26-code.md +20 -5
  69. package/docs/architecture/27-personal.md +23 -8
  70. package/docs/architecture/28-autoresearch.md +18 -6
  71. package/docs/architecture/INDEX.md +1 -2
  72. package/docs/architecture/prompts/source-manifest.json +5 -5
  73. package/docs/architecture/source-map.json +51 -71
  74. package/docs/designs/core-harness/01-core.md +2 -2
  75. package/docs/designs/core-harness/06-project-harness.md +3 -3
  76. package/docs/designs/core-harness/README.md +2 -2
  77. package/docs/en/agents.md +1 -1
  78. package/docs/en/build-your-harness.md +1 -1
  79. package/docs/en/changelog.md +7 -0
  80. package/docs/en/first-harness.md +6 -6
  81. package/docs/en/harnesses/lead-worker.md +1 -1
  82. package/docs/en/harnesses/peermesh.md +2 -2
  83. package/docs/en/harnesses/subagents.md +2 -2
  84. package/docs/en/harnesses/substrate.md +4 -4
  85. package/docs/en/harnesses/taskpool.md +2 -2
  86. package/docs/en/latest.md +9 -5
  87. package/docs/en/quickstart.md +20 -41
  88. package/docs/en/reference/api.md +1 -1
  89. package/docs/en/reference/cli.md +47 -85
  90. package/docs/en/sandbox.md +3 -3
  91. package/docs/operations/trace-viewer.md +1 -1
  92. package/docs/third-party-notices.md +0 -1
  93. package/docs/workflows/development.md +14 -12
  94. package/docs/workflows/release-and-docs-versioning.md +13 -12
  95. package/docs/workflows/release-cli-acceptance.md +85 -0
  96. package/docs/zh/agents.md +1 -1
  97. package/docs/zh/build-your-harness.md +1 -1
  98. package/docs/zh/changelog.md +8 -1
  99. package/docs/zh/first-harness.md +7 -7
  100. package/docs/zh/harnesses/lead-worker.md +1 -1
  101. package/docs/zh/harnesses/peermesh.md +2 -2
  102. package/docs/zh/harnesses/subagents.md +2 -2
  103. package/docs/zh/harnesses/substrate.md +4 -4
  104. package/docs/zh/harnesses/taskpool.md +2 -2
  105. package/docs/zh/latest.md +9 -5
  106. package/docs/zh/quickstart.md +20 -41
  107. package/docs/zh/reference/api.md +1 -1
  108. package/docs/zh/reference/cli.md +19 -79
  109. package/docs/zh/sandbox.md +3 -3
  110. package/examples/README.md +16 -5
  111. package/examples/authoring/README.md +4 -4
  112. package/examples/autoresearch/README.md +15 -8
  113. package/examples/autoresearch/REQUIREMENTS.zh.md +3 -10
  114. package/examples/autoresearch/demo.ts +1 -1
  115. package/examples/autoresearch/eject.json +2 -0
  116. package/examples/autoresearch/frontiercs2-config.ts +4 -0
  117. package/examples/autoresearch/prepare-demo.ts +15 -0
  118. package/examples/autoresearch/prepare.ts +3 -3
  119. package/examples/autoresearch/project.ts +2 -19
  120. package/examples/code/README.md +25 -17
  121. package/examples/code/REQUIREMENTS.zh.md +3 -3
  122. package/examples/harness-session/README.md +3 -3
  123. package/examples/messages/README.md +1 -1
  124. package/examples/notes/README.md +3 -3
  125. package/examples/services/mathlib-search/README.md +1 -1
  126. package/examples/services/persistent-board/README.md +5 -2
  127. package/examples/subagents/README.md +2 -2
  128. package/examples/subagents/config.ts +4 -3
  129. package/examples/substrate/README.md +2 -2
  130. package/examples/super/README.md +34 -22
  131. package/examples/super/actions.ts +11 -11
  132. package/examples/super/config.ts +3 -3
  133. package/examples/super/eject.json +1 -1
  134. package/examples/super/location.ts +1 -1
  135. package/examples/super/operator.ts +28 -0
  136. package/examples/super/project.ts +1 -3
  137. package/npm-shrinkwrap.development.json +42 -1541
  138. package/npm-shrinkwrap.json +3 -43
  139. package/package.development.json +2 -6
  140. package/package.json +2 -5
  141. package/scripts/anyswarm-arguments.ts +67 -96
  142. package/scripts/anyswarm-eject.ts +1 -1
  143. package/scripts/anyswarm-harnesses.ts +1 -18
  144. package/scripts/anyswarm-installation.ts +18 -294
  145. package/scripts/anyswarm-launch.ts +30 -102
  146. package/scripts/anyswarm-progress.ts +95 -0
  147. package/scripts/anyswarm-project.ts +31 -123
  148. package/scripts/anyswarm-source-runner.ts +9 -36
  149. package/scripts/anyswarm.ts +4 -24
  150. package/scripts/local-environment.ts +71 -20
  151. package/scripts/local-setup.ts +134 -94
  152. package/scripts/pack-release.ts +4 -1
  153. package/src/core/worker-image.ts +1 -1
  154. package/src/harness/project-harness.ts +2 -2
  155. package/src/harness/project-runtime.ts +2 -1
  156. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  157. package/dist/scripts/anyswarm-applications.js +0 -19
  158. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  159. package/dist/scripts/anyswarm-tui-config.js +0 -189
  160. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  161. package/dist/scripts/anyswarm-tui-session.js +0 -304
  162. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  163. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  164. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  165. package/dist/scripts/anyswarm-tui.js +0 -1012
  166. package/docs/architecture/25-foreground-tui.md +0 -51
  167. package/scripts/anyswarm-applications.ts +0 -39
  168. package/scripts/anyswarm-tui-config.ts +0 -174
  169. package/scripts/anyswarm-tui-session.ts +0 -295
  170. package/scripts/anyswarm-tui-terminal.ts +0 -147
  171. package/scripts/anyswarm-tui.ts +0 -912
@@ -1,36 +1,33 @@
1
1
  ---
2
2
  title: Quickstart
3
- description: Prepare Linux prerequisites, install AnySwarm, initialize OpenSandbox and the Worker image, and run a first Sandbox and file-reading check.
3
+ description: Prepare Linux or macOS prerequisites, install AnySwarm, initialize OpenSandbox and the Worker image, and run a first Sandbox and file-reading check.
4
4
  section: GET STARTED
5
5
  order: 1
6
6
  ---
7
7
 
8
8
  To build an application with the TypeScript SDK, follow [Build your first SDK Harness](first-harness.md).
9
9
 
10
- AnySwarm ships its CLI and TypeScript SDK in one package and runs Agents inside [OpenSandbox](sandbox.md) containers. You can run OpenSandbox locally with Docker Engine or connect to an existing OpenSandbox service.
10
+ AnySwarm ships its CLI and TypeScript SDK in one package and runs Agents inside [OpenSandbox](sandbox.md) containers. This guide runs OpenSandbox and Workers on your machine using Docker.
11
11
 
12
- This guide covers [v0.5.0](latest.md#v050), the first supported release of `@anyswarm/core`.
12
+ This guide covers [AnySwarm v0.5.1](latest.md#v051).
13
13
 
14
14
  ## Prerequisites
15
15
 
16
16
  | Dependency | Requirement | Verify |
17
17
  | --- | --- | --- |
18
- | **Linux** | Controller host (e.g., Ubuntu / Debian) | `uname -s` |
18
+ | **Linux or macOS** | Controller host (e.g., Ubuntu, Debian, or macOS with Docker Desktop) | `uname -s` |
19
19
  | **Node.js** | `>= 22.19` (install LTS from [nodejs.org](https://nodejs.org/en/download); Ubuntu 24.04 and Debian 13 repos ship older versions) | `node --version` |
20
20
  | **npm** | Install with Node.js | `npm --version` |
21
21
  | **Git** | Required for the source checkout and project capture | `git --version` |
22
- | **curl** | Required to download the installer | `curl --version` |
23
- | **Docker Engine** | Required for local OpenSandbox only; skip when using an existing service ([install guide](https://docs.docker.com/engine/install/)) | `docker info` |
22
+ | **Docker Engine** | A running local Linux container engine ([install guide](https://docs.docker.com/engine/install/)) | `docker info` |
24
23
 
25
24
  On Ubuntu or Debian with local Docker, install the system dependencies and start Docker:
26
25
 
27
26
  ```bash
28
- sudo apt-get update && sudo apt-get install -y docker.io git curl ca-certificates
27
+ sudo apt-get update && sudo apt-get install -y docker.io git ca-certificates
29
28
  sudo systemctl enable --now docker.service
30
29
  ```
31
30
 
32
- For an existing OpenSandbox service, install only `git curl ca-certificates` and skip the Docker service and group steps.
33
-
34
31
  If the Docker socket denies access, an administrator can run `sudo usermod -aG docker alice`, replacing `alice` with the account that runs AnySwarm. Sign in again as that account and run `id` and `docker info`. The [`docker` group grants root-equivalent access](https://docs.docker.com/engine/install/linux-postinstall/).
35
32
 
36
33
  ### Docker on macOS
@@ -47,13 +44,13 @@ docker info --format '{{.OSType}}/{{.Architecture}}'
47
44
 
48
45
  If the wrong context is selected, run `docker context use <local-context>` and check whether `DOCKER_CONTEXT` or `DOCKER_HOST` overrides it. The expected daemon is Linux ARM64 on Apple Silicon, or Linux x86-64 on Intel; setup does not use emulation. If a separately installed Docker client reports `docker-credential-desktop` not found, put Docker Desktop's CLI tools on PATH in its settings, or add `/Applications/Docker.app/Contents/Resources/bin` to PATH. Use Node.js 24 LTS for TypeScript author commands; Node.js 26 removed the transform mode they currently use.
49
46
 
50
- The published v0.5.0 local setup still requires a Linux Controller. To try native macOS setup, build and install the current source candidate below and select a supported backend. The controlled-model macOS checks for [#339](https://github.com/AnySwarm/anyswarm/issues/339) use Apple Silicon and Docker Desktop, with npm Pi 1.3.0 and 1.7.0 and standalone Codex 0.173.0. Intel and other container engines need separate verification.
47
+ The v0.5.1 release supports native macOS setup with a supported backend. The controlled-model macOS checks for [#339](https://github.com/AnySwarm/anyswarm/issues/339) use Apple Silicon and Docker Desktop, with npm Pi 1.3.0 and 1.7.0 and standalone Codex 0.173.0. Intel and other container engines need separate verification.
51
48
 
52
49
  ## 1. Install AnySwarm
53
50
 
54
51
  ### Install a published release
55
52
 
56
- Choose one way to install the AnySwarm CLI. Both require Node.js 22.19+ and npm. The npm command is the same on macOS and Linux; npm installs the package dependencies, and a running Docker engine is not required for this step.
53
+ Install the CLI with Node.js 22.19 or newer and npm. The command is the same on Linux and macOS. Docker is needed when you run setup.
57
54
 
58
55
  ```bash
59
56
  npm install -g @anyswarm/core
@@ -62,26 +59,18 @@ anyswarm --version
62
59
 
63
60
  The `-g` flag installs the command into npm's global bin directory. If your shell cannot find it, check that `$(npm prefix -g)/bin` is on your PATH and that your shell is using the Node.js installation you used to install the CLI.
64
61
 
65
- You can also install a managed copy of the CLI from GitHub Releases.
66
-
67
- ```bash
68
- curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
69
- ```
70
-
71
- The script reports the version, CLI path, and verified archive source. Apply the printed PATH command if needed, then run `anyswarm --version`.
72
-
73
62
  If you are writing a Harness in TypeScript, follow [Install the SDK](reference/api.md#install-the-sdk) to add it as a project dependency.
74
63
 
75
64
  ### Build and install from source (`main`)
76
65
 
77
- Run these commands from the repository root. `npm run pack:release` builds the distribution archive. The installer stages the CLI under `$HOME/.local`.
66
+ Run these commands from the repository root. `npm run pack:release` builds the distribution archive. The last command installs the archive into the selected npm prefix.
78
67
 
79
68
  ```bash
80
69
  git clone https://github.com/AnySwarm/anyswarm.git && cd anyswarm
81
70
  npm ci --no-audit --no-fund
82
71
  pack_dir=$(mktemp -d)
83
72
  npm run pack:release -- "$pack_dir"
84
- npm_config_prefix="$HOME/.local" sh website/public/install.sh --archive "$pack_dir"/*.tgz
73
+ npm install -g --prefix "$HOME/.local" "$pack_dir"/*.tgz
85
74
  export PATH="$HOME/.local/bin:$PATH"
86
75
  anyswarm --version
87
76
  ```
@@ -90,43 +79,33 @@ The candidate can share its package version with the release. Record the source
90
79
 
91
80
  ### Update the CLI
92
81
 
93
- - Global npm install. Run `npm install -g @anyswarm/core@latest` with the same Node.js installation and npm prefix.
94
- - Shell installer. Run `anyswarm update` to check the GitHub Release checksum and validate the new CLI before switching. A failed update leaves the prior CLI available.
82
+ Run `npm install -g @anyswarm/core@latest` to update or `npm uninstall -g @anyswarm/core` to uninstall. Use the same Node.js installation and npm prefix. If npm reports `EACCES`, switch to a user-owned Node installation or install to a writable prefix, for example `npm install -g --prefix "$HOME/.local" @anyswarm/core`. Add `$HOME/.local/bin` to PATH and reuse that prefix for updates and removal.
95
83
 
96
- For the first upgrade from a managed v0.5.0 installation, rerun the current shell installer in the same prefix. This adds the `anys` alias. On macOS, it also uses the current activation lock.
84
+ If you used the old shell installer for v0.5.0 or v0.5.1, check the `anyswarm`, `anys`, and `swarm` links in `$(npm prefix -g)/bin`. Clear only links that point into the old AnySwarm installation under `lib/anyswarm/current`, then install with npm. AnySwarm configuration lives outside the CLI installation.
97
85
 
98
86
  To update a project's SDK, use its package manager in the project directory.
99
87
 
100
88
  ## 2. Prepare OpenSandbox and the Worker
101
89
 
102
- Use the Pi or Codex installation you already have. On Linux, use a supported npm package layout. On macOS, setup also accepts the standalone Codex executable when the same release is available for Linux from npm. If you need Pi, install it with `npm install --global @earendil-works/pi-coding-agent`. Then select an installed backend.
90
+ Run setup on the machine where you want OpenSandbox and the Worker to run.
103
91
 
104
92
  ```bash
105
- pi --version
106
- anyswarm setup --backend pi
107
- anyswarm doctor --smoke
93
+ anyswarm setup
108
94
  ```
109
95
 
96
+ Setup detects the OS and Node version, checks the local Docker engine, and looks for your saved settings or an installed Pi or Codex backend. If a prerequisite is missing, follow the reported commands and rerun setup. Use `anyswarm doctor` for a read-only check of the same local prerequisites and Lifecycle connection.
97
+
98
+ If you need a backend, install Pi with `npm install -g @earendil-works/pi-coding-agent` or Codex with `npm install -g @openai/codex`. On macOS, setup also accepts standalone Codex when the same release is available for Linux from npm. Setup selects the only compatible backend when it finds one. When both are compatible, terminal setup can ask you to choose. In automation, use `anyswarm setup --backend pi` or `anyswarm setup --backend codex`.
99
+
110
100
  Bare setup reuses the saved executable path. To choose a different installation, supply `--backend pi --backend-path /absolute/path/to/bin/pi` or the corresponding Codex options. To require an installed version, add `--backend-version 1.7.0` (substitute the version you intend to use). A saved version pin rejects an executable that later reports a different version. Repeat explicit backend selection without a pin to follow upgrades to that installation.
111
101
 
112
102
  On macOS, setup prepares the same release's Linux package inside a native Docker container. It verifies the Worker version and runs the executor startup and controlled protocol smoke before saving the connection. Without a saved selection, an interactive terminal prompts when both backends are installed. Use `--backend` in automation when both are present.
113
103
 
114
104
  For a new local configuration, setup defaults to `127.0.0.1:8080`, builds a Worker from the selected installation and SDK package, and pulls the pinned upstream OpenSandbox 1.2.1 components. It saves the managed connection after a controlled smoke verifies Worker, Bridge, Gateway, files, export and deletion. Expect `"ok": true` and `"infrastructure": "ready"`. Repeating setup restores a stopped managed service and reruns the smoke. Test with `ANYSWARM_CONFIG_DIR=/path/to/private-directory` and a free loopback port if needed.
115
105
 
116
- Setup builds AnySwarm Workers locally. A matching Docker image is reused by content identity. Base image, apt and npm dependencies can require Internet access. Model routes and credentials still come from your explicit AnySwarm environment or project configuration. The controlled setup smoke does not verify those model credentials.
117
-
118
- ### Connect to an existing OpenSandbox
119
-
120
- ```bash
121
- export OPEN_SANDBOX_API_KEY='<operator-provided-key>'
122
- anyswarm setup --mode existing --endpoint https://sandbox.example.net \
123
- --public-url https://runtime.example.net/anyswarm
124
- anyswarm doctor --smoke
125
- ```
126
-
127
- Existing setup verifies authentication and saves the endpoint, key and callback in owner-only user configuration. The remote Controller needs Node and network access. Its operator prepares a matching Worker image on the service. Set `ANYSWARM_WORKER_IMAGE` to that image before the probe and your project run. `doctor` performs a read-only configuration and Lifecycle check. `doctor --smoke` allocates a temporary Sandbox and verifies Controller-to-Worker and Sandbox-to-Runtime traffic before confirming export and deletion. An unavailable saved remote connection produces an error for that connection.
106
+ Setup builds AnySwarm Workers locally. A matching Docker image is reused by content identity. Base image, apt and npm dependencies can require Internet access. Model routes and credentials still come from your explicit AnySwarm environment or project configuration. The controlled setup smoke does not verify those model credentials. Use `anyswarm doctor --smoke` to repeat the controlled probe.
128
107
 
129
- `connection.publicUrl` is one callback address for Bridge and model requests. A reverse proxy should forward that path prefix to the Runtime's `bindHost` and fixed `bindPort`. Local setup discovers its reachable host and available port. See [Sandboxes](sandbox.md) and [Host Gateway](gateway.md).
108
+ The local service runs on the same machine as the CLI. To use a service you operate, see [Connect an existing OpenSandbox service](sandbox.md).
130
109
 
131
110
  ### Diagnose image availability
132
111
 
@@ -17,7 +17,7 @@ npm install @anyswarm/core
17
17
 
18
18
  Import the SDK from `@anyswarm/core`. The same install exposes the project-local CLI through `npm exec -- anyswarm`. To run `anyswarm` directly from any directory, use a [global CLI install](../quickstart.md#1-install-anyswarm).
19
19
 
20
- For a verified [source build](../quickstart.md#build-and-install-from-source-main), install its archive with the command below. The [release page](../latest.md#v050) shows how to pin the released SDK.
20
+ For a verified [source build](../quickstart.md#build-and-install-from-source-main), install its archive with the command below. The [release page](../latest.md#v051) shows how to pin the released SDK.
21
21
 
22
22
  ```bash
23
23
  npm install --ignore-scripts /path/to/verified-anyswarm.tgz
@@ -5,100 +5,62 @@ section: REFERENCE
5
5
  order: 16
6
6
  ---
7
7
 
8
- `@anyswarm/core` ships the synonymous host commands **`anyswarm`** and **`anys`**, plus **`swarm`** inside Worker containers for Service calls over the Bridge. Host aliases share installation, update, help and version behavior.
8
+ The host command is `anyswarm`. Run it without arguments for Quickstart, or add
9
+ `--help` to a command for its options. The Worker image separately supplies
10
+ `swarm` for Agent calls to Services over the Bridge.
9
11
 
10
- The streaming terminal, generic loader, `run` and `eject` below are available in the [current source build](../quickstart.md#build-and-install-from-source-main). See the [v0.5.0 CLI reference](https://github.com/AnySwarm/anyswarm/blob/v0.5.0/docs/en/reference/cli.md) for the published package.
12
+ ## Host commands
11
13
 
12
- ## Host CLI (`anyswarm`)
13
-
14
- ### Commands overview
15
-
16
- | Command | Purpose |
17
- | --- | --- |
18
- | `anyswarm` / `anys` | Opens the streaming composer in an interactive terminal |
19
- | `anys -u <harness> [prompt]` | Selects a built-in, installed package, or local Harness |
20
- | `anys -u <harness> --headless [prompt]` | Streams Session activity and the final result as JSONL |
21
- | `anys -u <harness> --rpc` | Opens the stdio HarnessSession RPC protocol |
22
- | `anys -u <harness> --cmd "/action [args]"` | Runs a module's standalone Slash Action |
23
- | `anys run ./harness.ts [arguments]` | Runs trusted TypeScript source with multi-file imports and SDK dependencies |
24
- | `anys eject <code\|autoresearch\|super\|example> --dir <target>` | Exports editable TypeScript sources and binds their SDK provenance |
25
- | `anyswarm --version` | Prints the installed `@anyswarm/core` version |
26
- | `anyswarm setup [--mode existing\|local] [--endpoint <url>] [--public-url <url>] [--backend pi\|codex] [--backend-path <executable>] [--backend-version <version>] [--config <module>]` | Starts a managed local OpenSandbox with auto-generated credentials (`--mode local`), or validates and saves an existing service (`--mode existing`); local mode also prepares and probes the selected Worker image |
27
- | `anyswarm doctor [--config <module>] [--smoke]` | Read-only configuration and Lifecycle auth diagnostics; pass `--smoke` for a live Pi/Codex Worker end-to-end probe |
28
- | `anyswarm update` | Verifies, stages and activates the latest stable CLI in a managed installation. Global npm users receive an npm command for their install prefix |
29
- | `anyswarm --harness <module> --prompt <text> [options]` | Runs a built-in, local TypeScript/ESM, or package Harness in foreground against a project directory |
30
- | `anyswarm --harness <module> --mode rpc [options]` | Runs a Harness over JSONL `stdin`/`stdout` with `ready`, `run`, `status`, `stop`, and member controls |
31
- | `anyswarm recover --run-dir <dir> --config <module>` | Performs cleanup-only recovery on a durable Run under same-host, same-boot ownership and prints the receipt |
32
- | `anyswarm trace [--root] <runs-dir> [--port 8787] [--open]` | Starts the built-in browser [Trace Viewer](../trace-viewer.md) on `127.0.0.1` |
33
-
34
- ### Streaming terminal
35
-
36
- Run `anys` and type `/use <harness> [prompt]`. Use `/code`, `/super` or `/autoresearch` when the corresponding application is bundled. You can also select a trusted local file such as `/use ./harness.ts`, or a package installed in your invocation directory. `anys -u ./harness.ts "task"` selects and submits the first prompt together. `--config ./config.ts` selects trusted configuration, and `/config` and `/doctor` help diagnose startup.
37
-
38
- On a Linux host, run `anys -u code [prompt]` in a project to edit it with one coding Agent. Ask it in chat to delegate a task when you want a child Agent to work in parallel. In an active Code session, `/diff` streams the latest paths, patch preview and retained patch location. Use `/agents` for the roster, `@<editor> <message>` to steer an active editor, and `/stop <editor>` to stop an editor. Use `/y` or `/n` for inline confirmations and `/reply <id> <answer>` for questions. [Code quickstart](../../../examples/code/README.md)
39
-
40
- The status rows show the Run's phase, Agent counts and workspace or Harness summary above the scrolling messages. The input area stays at the bottom, with the current Harness and selected Agent in its border. Resizing the terminal rewraps the text and keeps your draft. Press Enter to submit, Alt+Enter for a newline, and Tab for command completion.
41
-
42
- | In the composer | What it does |
14
+ | Workflow | Commands |
43
15
  | --- | --- |
44
- | `/use <harness> [prompt]` | Switches modes. Confirm with `/y` to stop and clean up active foreground work before switching. |
45
- | `/agents`, `/target <agent\|main>` | Lists members and their controls. Use the arrow keys and Enter to choose a target or target one directly. |
46
- | `@agent message`, `/to agent message` | Steers that member. Use `/to agent --follow-up message` to queue a follow-up. |
47
- | `/stop [agent]`, Ctrl+C | Stops one member or the whole Run. Ctrl+C interrupts the selected Agent turn or dismisses a pending selection. |
48
- | `/y`, `/n`, `/reply [id] <answer>` | Answers inline decisions. Use `/approve <id>` or `/reject <id>` when multiple confirms are pending. |
49
- | `/status` | Shows the Run and artifact paths. |
50
- | `/trace [records-directory]` | Opens the local Trace Viewer and prints its URL. Use a directory to switch the Viewer to those records. The default foreground output root includes successive Runs. |
51
- | `/quit` | Exits after foreground cleanup. In background observation, this disconnects the terminal and the background Session continues. You can also submit `q`. |
52
-
53
- When stdin or stdout is redirected, `-u` automatically selects headless JSONL output. Bare non-TTY invocation prints usage guidance. Explicit `--harness H --mode foreground` and `--mode rpc` retain their transport formats. `anys run <harness> [prompt]` selects the same terminal when interactive. Plain TypeScript scripts can still receive ordinary argv. In a pipe, a local task Harness launched without arguments or with the legacy `--prompt` flag prints a single foreground JSON result. In an ejected project, `npm install` and `npm run start` use the matching project-local CLI.
54
-
55
- A Harness can suggest slash names through `inputDescriptor.commands`. Unmatched slash input in an active terminal Session goes to its input handler as text. To provide a command before any Session exists, export `slashActions`, for example `export const slashActions = { prepare: ({ args }) => ({ prepared: args }) }`. Invoke it in the composer or with `anys -u H --cmd '/prepare example'`. See the [application module contract](../../architecture/25-foreground-tui.md).
56
-
57
- ### Personal GitHub inbox
58
-
59
- Select `/super` in the composer, then run `/setup --repo owner/project`, `/start` and `/jobs`. Use `/ask #123 <text>` or `@router #123 <text>` for a task. The terminal displays Router questions and verified patches with Reviewer summaries. Use `/answer #123 <text>`, `/approve #123` or `/reject #123 [reason]`, or an unambiguous work ID prefix. The same actions run noninteractively through `anys -u super --cmd '/jobs #123'`. See the [Personal quickstart](../../../examples/super/README.md) for credentials, permissions, stop and export.
60
-
61
- ### Running Harnesses (`anyswarm --harness`)
62
-
63
- ```bash
64
- # Foreground run against the current directory
65
- anyswarm --harness subagents --prompt "Fix the parser and add regression tests"
66
-
67
- # Explicit target directory, custom config module, and output root
68
- anyswarm --harness taskpool \
69
- --cwd ./my-project \
70
- --config ./taskpool.config.ts \
71
- --output-dir ./runs \
72
- --prompt "Resolve all failing unit tests"
73
-
74
- # Local custom TypeScript Harness module
75
- anyswarm --harness ./review-harness.ts --prompt "Audit error handling"
76
-
77
- # JSONL RPC mode (send {"id":"1","operation":"run","input":{"cwd":"...","prompt":"..."}} after ready)
78
- anyswarm --harness subagents --mode rpc --output-dir ./runs
79
- ```
80
-
81
- - **Built-in Harness names**: `subagents`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes`, `messages`.
82
- - **Module resolution**: pass a built-in name, an explicit `.ts` / `.mts` or ESM path, or an installed npm package name (resolved from the invocation directory).
83
- - **RPC protocol (`--rpc` or `--mode rpc`)**: emits JSONL frames on `stdout` and diagnostics on `stderr`. Wait for `ready`, then send a `run` request containing `cwd` and `prompt`.
84
-
85
- ### Session options and controls
86
-
87
- - **Lifetime (`--lifetime task|interactive`)**: defaults to single-task `task` mode. Harnesses that support ongoing sessions (such as Subagents) accept `interactive`, keeping the session alive until a configured deadline or explicit `stop`.
88
- - **User questions (`--interaction none|questions`)**: defaults to `none`. Set `questions` when the client can answer authorized mid-Run questions from Agents.
89
- - **Control channel**: foreground invocations with `--prompt` start immediately; when `interactive` or `questions` is enabled, subsequent commands flow over JSONL. `--rpc` or `--mode rpc` waits for a `run` command before starting.
90
- - **Supported operations**: `describe` (discover capabilities), `status` (read snapshot), `answer` (respond by `questionId`), and `stop` (close the Run); native member queries and controls include `agent.getState`, `agent.getStats`, `agent.getMessages`, plus `agent.configure`, `agent.compact`, `agent.abortRetry`, `agent.clearQueue`, `agent.send`, `agent.interrupt`, and `agent.stop` (each Harness and executor decides which operations are permitted). The final result records report-save status and cleanup facts separately.
16
+ | Prepare and verify local execution | `anyswarm setup`, `anyswarm doctor --smoke` |
17
+ | Upgrade the installed CLI | `anyswarm update` prints the npm command for the current global installation. Run the printed command from the same Node/npm environment. |
18
+ | Run an editable Harness | `anyswarm run ./project.ts --cwd ./input --config ./config.ts --prompt "Inspect the project"` |
19
+ | Run a built-in Harness or connect a client | `anyswarm --harness subagents --prompt "Read README.md" --output-dir ./runs`, or `anyswarm --harness subagents --mode rpc` |
20
+ | Export source and the exact SDK | `anyswarm eject example --dir ./my-harness` |
21
+ | Inspect records or recover pending cleanup | `anyswarm trace --root ./runs --port 8787 --open`, `anyswarm recover --run-dir <dir> --config <module>` |
22
+
23
+ `anyswarm --version` prints the installed package version. See [Quickstart](../quickstart.md) for local setup, explicit existing OpenSandbox connections and npm installation.
24
+
25
+ ## Run a Harness
26
+
27
+ Pick a built-in name, an explicit TypeScript or ESM module, or an installed npm
28
+ package resolved from the invocation directory. Built-ins are `subagents`,
29
+ `autoresearch`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes` and
30
+ `messages`. The project defaults to the invocation directory. `--config`
31
+ selects a trusted module and `--output-dir` selects the Run records root.
32
+ Set `--cwd` to capture a different project.
33
+
34
+ A one-shot Run starts from the supplied prompt. `run` supplies a default prompt
35
+ when a source Harness is launched without one. On a terminal, stdout shows Run
36
+ and Agent milestones, visible Service changes, exported artifact paths, cleanup,
37
+ and the command to view Trace. Redirect stdout for a single JSON result or
38
+ launch error. Source and Harness diagnostics go to stderr. `run` also executes
39
+ ordinary trusted source scripts with their original arguments.
40
+
41
+ For multiple turns, start `--mode rpc`, wait for the JSONL `ready` frame, and
42
+ send a `run` request with `cwd` and `prompt`. Use `--lifetime interactive` if
43
+ the Harness supports it and `--interaction questions` if the client can answer.
44
+ The stream carries replies, events and the final result on stdout. Use
45
+ `describe` for available controls and `stop` to initiate cleanup. [HarnessSession example](../../../examples/harness-session/README.md)
46
+
47
+ After ejecting, run `npm install` inside the export and start the editable
48
+ entry with its local CLI, for example `npm run start -- --prompt "Inspect the project"`.
49
+ See [Code](../../../examples/code/README.md) and [Personal](../../../examples/super/README.md)
50
+ for advanced SDK examples.
91
51
 
92
52
  ### AutoResearch
93
53
 
54
+ AutoResearch is the non-interactive research showcase. It starts equal
55
+ peers in private Sandboxes, coordinates them through the research Service,
56
+ and records train, candidate and final evidence for [Trace Viewer](../trace-viewer.md).
57
+
94
58
  ```sh
95
- anys -u autoresearch --cmd /prepare
96
- anys -u autoresearch
59
+ anyswarm --harness autoresearch --config ./research.ts --prompt "Your objective" --output-dir ./runs
97
60
  ```
98
61
 
99
- Enter `/demo frontiercs2` in the terminal. The demo runs four equal Kimi K3 peers and shows activity and the live Trace URL in the composer. Use `@peer-2 <suggestion>`, `/interrupt peer-2` or `/stop peer-2` during the Run. To run headlessly, use `anys -u autoresearch --cmd '/demo frontiercs2'`.
100
-
101
- Use `anys -u autoresearch --config ./research.ts "Your objective"` for a custom trusted evaluator, and `anys eject autoresearch` to export the source. [Quickstart](../../../examples/autoresearch/README.md)
62
+ Use [the AutoResearch guide](../../../examples/autoresearch/README.md) to prepare the
63
+ pinned FrontierCS-2 demo or export and edit the Harness.
102
64
 
103
65
  ## Unified environment variables
104
66
 
@@ -23,10 +23,10 @@ export OPEN_SANDBOX_API_KEY='<operator-provided-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
- Existing mode verifies your management API key and saves the connection in owner-only user config without launching a container. Running `anyswarm doctor --smoke` then creates and deletes a temporary sandbox to verify host-to-worker access, Runtime callbacks, file export, and cleanup.
29
+ Existing mode verifies your management API key and saves the connection in owner-only user config without launching a container. Running `anyswarm doctor --mode existing --smoke` then creates and deletes a temporary sandbox to verify host-to-worker access, Runtime callbacks, file export, and cleanup.
30
30
 
31
31
  In remote mode, the OpenSandbox operator supplies the Worker image, which you select with `ANYSWARM_WORKER_IMAGE`; your host machine running `anyswarm` only needs Node.js and network access. Protect credentials with TLS (HTTPS) or a trusted private network.
32
32
 
@@ -49,7 +49,7 @@ const remote = createSandbox({
49
49
 
50
50
  Configuration precedence is: **explicit SDK/CLI options → environment variables → saved user config (owner-only permissions) → local defaults**. `createSandbox()` validates and snapshots settings without launching containers; allocation starts only when you call `runtime.spawn()`.
51
51
 
52
- When sandboxes run on a remote host or behind a reverse proxy, pass `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` to `createRuntime()` to advertise a single reachable callback URL (reverse-proxy path prefixes are preserved; use `bindHost` and `bindPort` only when you need custom listener binding). `anyswarm doctor` reports the active callback origin, and `anyswarm doctor --smoke` points to the callback address, port, and proxy routes if sandboxes cannot call back. Configure OpenSandbox to publish reachable container endpoints and required headers.
52
+ When sandboxes run on a remote host or behind a reverse proxy, pass `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` to `createRuntime()` to advertise a single reachable callback URL (reverse-proxy path prefixes are preserved; use `bindHost` and `bindPort` only when you need custom listener binding). `anyswarm doctor --mode existing` reports the active callback origin, and `anyswarm doctor --mode existing --smoke` points to the callback address, port, and proxy routes if sandboxes cannot call back. Configure OpenSandbox to publish reachable container endpoints and required headers.
53
53
 
54
54
  ## 4. Resources and migration from v0.2.0
55
55
 
@@ -16,7 +16,7 @@ Open [the demo Run](http://127.0.0.1:8787/#run=release-notes). The synthetic Sub
16
16
  The Trace Viewer is bundled directly inside `@anyswarm/core` (`src/trace-viewer/`) with zero extra dependencies:
17
17
 
18
18
  ```bash
19
- curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
19
+ npm install -g @anyswarm/core
20
20
  anyswarm trace /path/to/private/runs --port 8787 --open
21
21
  ```
22
22
 
@@ -6,7 +6,6 @@ The terms in [LICENSE](../LICENSE) cover AnySwarm's original code and documentat
6
6
  | --- | --- |
7
7
  | Codex CLI in the Worker image | Apache-2.0. The image installs `@openai/codex` 0.172.0 from OpenAI. [Upstream license](https://github.com/openai/codex/blob/3d86e43b075adeba2193ec5c22ac92f55afd82e6/LICENSE) at the `rust-v0.172.0` revision. |
8
8
  | OpenSandbox JavaScript SDK | Apache-2.0. The Controller installs `@alibaba-group/opensandbox` 1.2.1. [Upstream license](https://github.com/opensandbox-group/OpenSandbox/blob/db708c218771a8d311356f0e96552c15df6e097a/LICENSE) |
9
- | Pi terminal primitives | MIT. The host CLI installs `@earendil-works/pi-tui` 1.3.0. [Package and license metadata](https://www.npmjs.com/package/@earendil-works/pi-tui/v/1.3.0) |
10
9
  | Lean module replay driver | Apache-2.0. The [driver notice](../examples/taskpool/services/judge/lean-module-verify.NOTICE.md) identifies the upstream source, copyright and local modifications. [Upstream license copy](../examples/taskpool/services/judge/lean-module-verify.LICENSE.txt) |
11
10
  | Agensh Board schema fixture (source-checkout tests) | MIT. [Source attribution and license copy](../test/fixtures/agensh-board-schema.LICENSE.txt) |
12
11
  | Agensh reference implementation | Separate Git submodule. See the [upstream license](https://github.com/microsoft/Agensh/blob/2dae4e14a653da48549fd9aa093f834841475d6c/LICENSE) at the recorded revision. |
@@ -61,7 +61,7 @@ coverage.
61
61
  | --- | --- |
62
62
  | README, internal Markdown or architecture inventory | Generated references and repository links |
63
63
  | Website, bilingual guides or documentation images | Generated references, repository links and website build |
64
- | Website installer, install command or either Quickstart | Website build, focused installer tests and documentation checks |
64
+ | Homepage npm install command or either Quickstart | Website build, focused npm command checks and documentation checks |
65
65
  | Core, tests, workflow or other inputs | Typecheck, full tests, generated references, repository links and website build |
66
66
 
67
67
  The full suite runs on three parallel Core runners, including the Viewer reader
@@ -108,9 +108,9 @@ same tool versions when reproducing a candidate. The release pack script builds
108
108
  and stages with `umask 022` and normalizes staged regular-file modes to `0755` for
109
109
  executables and `0644` for other files, including files from restrictive checkouts.
110
110
 
111
- Run the [Release workflow](../../.github/workflows/release.yml) manually to verify a
111
+ Run the [Release workflow](../../.github/workflows/release.yml) manually with `publish_npm` off to verify a
112
112
  candidate and download the two tarball filenames and their SHA-256 checksums from
113
- the workflow artifact. The verifier installs the exact tarball through the website installer and installs it by package name through a local registry outside the checkout. It runs local setup, the README Quickstart with a controlled model, and the first SDK Harness through the SDK, JSONL RPC and foreground CLI. The README test checks actual file-tool bytes, CLI and installed Viewer agreement, and Sandbox deletion. Manual runs can verify a candidate with the same version as an existing release. Tag runs also perform the public npm publication dry-run, which requires an unused version. After the source repository is
113
+ the workflow artifact. The verifier installs the exact tarball globally with npm and installs it by package name through a local registry outside the checkout. It runs local setup, the README Quickstart with a controlled model, and the first SDK Harness through the SDK, the RPC client, the one-shot CLI, and direct JSONL RPC with a question and answer. The README test checks actual file-tool bytes, CLI and installed Viewer agreement, and Sandbox deletion. Manual runs can verify a candidate with the same version as an existing release. After the source repository is
114
114
  public and the release owner approves the tested revision, `LuNa-shi` pushes a
115
115
  `v<version>` tag for the matching stable package version under the
116
116
  [version-tag ruleset](https://github.com/AnySwarm/anyswarm/rules/28373821).
@@ -120,21 +120,23 @@ The workflow verifies that the candidate builds its Worker locally using the pac
120
120
  The tag job uploads the verified versioned tarball, the byte-identical
121
121
  `luna-shi-anyswarm.tgz` alias and `SHA256SUMS` to the tagged Release before
122
122
  publishing it. An older stable tag can still be published as a pinned Release.
123
- The CLI resolves the latest stable tag once and checks the corresponding versioned archive against its checksum.
123
+ npm resolves CLI installs and updates using its configured registry. Verify that the candidate installs and upgrades in the same isolated global npm prefix, exposes only `anyswarm` on the host, and can be removed with npm.
124
124
 
125
- v0.5.0 is the first supported release of `@anyswarm/core`. Check installation and managed CLI updates from supported releases.
125
+ After GitHub publication, the npm job downloads and verifies the same public
126
+ archive. It uses [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
127
+ registered to `AnySwarm/anyswarm` and `release.yml`. Direct `npm publish`
128
+ must be enabled for that publisher. The job publishes the current GitHub
129
+ Latest version and checks its public npm integrity and `latest` tag.
126
130
 
127
- Download the approved tag's versioned archive and `SHA256SUMS`. Verify the
128
- digest and the package name and version in the archive. An npm member of the
129
- `anyswarm` organization publishes those verified bytes from the release directory:
131
+ If the GitHub Release is available and npm publication needs a retry, use the
132
+ Release workflow dispatch from `main`:
130
133
 
131
134
  ```sh
132
- npm publish "./luna-shi-anyswarm-$VERSION.tgz" --access public --registry=https://registry.npmjs.org
135
+ gh workflow run release.yml --ref main -f publish_npm=true
133
136
  ```
134
137
 
135
- Set `VERSION` to the approved stable tag version without the leading `v`.
136
- Confirm the registry resolves `@anyswarm/core@$VERSION` and install it
137
- in a fresh project. Compare the npm archive SHA-256 with the GitHub asset.
138
+ Verify the installed SDK and CLI from npm by package name in an empty
139
+ directory. Download the npm tarball and compare its SHA-256 with the GitHub asset.
138
140
  After both distributions are public, update the bilingual release page and
139
141
  the documented version in `website/src/components/TopNav.astro`.
140
142
  See [Release updates and documentation versions](release-and-docs-versioning.md)
@@ -14,44 +14,45 @@ Research as of 2026-12-01 against repository revision `40132bd47c0609b4149a106f1
14
14
 
15
15
  “First formal release” is a project support decision. SemVer still treats `0.y.z` as initial development, and reserves the stable public API commitment for `1.0.0`. Published versions must not change. For AnySwarm before 1.0, use `0.5.1` for compatible fixes and `0.6.0` for a new API line. Include migration instructions for incompatible changes. Use `1.0.0` when committing to a stable API contract. [SemVer specification](https://semver.org/spec/v2.0.0.html)
16
16
 
17
- ## Next release with the existing workflow
17
+ ## Release procedure
18
18
 
19
19
  1. Prepare one release PR from current main. Update package and lockfile versions, affected examples, Worker compatibility information, README, both languages, and migration notes. Confirm installed examples come from the exact candidate archive. Keep unshipped APIs out of the supported-release guides.
20
20
  2. Verify the reviewed head with required Core and website CI. Run the manual Release workflow to verify its package candidate. After approval and merge, the release owner creates the matching stable tag at the approved merged revision under the repository's tag rules.
21
21
  3. Wait for the tag Release workflow. Download the **published** GitHub Release archive and `SHA256SUMS`, check the checksum and package name/version, and preserve those bytes as the canonical release candidate. Do not run `npm pack` again to manufacture the npm input.
22
- 4. Publish that exact `.tgz` using the command in [Release verification](development.md#release-verification). The npm and GitHub Release steps currently require separate actions.
23
- 5. Poll the public registry for the exact version with a bounded timeout, download its `dist.tarball`, and compare its SHA-256 with the GitHub asset. Verify `dist.integrity`, then install that version by package name in a fresh project and in an isolated global npm prefix. Verify the SDK import, both CLI aliases, install warnings and the production audit. npm scans packages before public availability. If the version is still pending after the verification timeout, resume verification later using the same archive. [npm publish-time scanning](https://github.blog/changelog/2026-07-28-npm-publish-time-malware-scanning-and-dual-use-metadata/)
24
- 6. After the new package is publicly installable, update the bilingual stable guides and version label and verify the Pages deployment. Check npm `latest` and the public CLI installer, and compile the affected examples from the installed SDK. Record the source commit, tag, archive SHA-256, npm version, CI run and deployed Pages revision separately. A GitHub Release, a public npm package and a deployed website are distinct milestones.
22
+ 4. The tag workflow publishes that exact archive to npm after GitHub publication. To retry the current GitHub Latest release, dispatch the Release workflow from `main` with `publish_npm` enabled. [Release verification](development.md#release-verification)
23
+ 5. Poll the public registry for the exact version with a bounded timeout, download its `dist.tarball`, and compare its SHA-256 with the GitHub asset. Verify `dist.integrity`, then install that version by package name in a fresh project and in an isolated global npm prefix. Verify the SDK import, the `anyswarm` executable, install warnings and the production audit. npm scans packages before public availability. If the version is still pending after the verification timeout, resume verification later using the same archive. [npm publish-time scanning](https://github.blog/changelog/2026-07-28-npm-publish-time-malware-scanning-and-dual-use-metadata/)
24
+ 6. After the new package is publicly installable, update the bilingual stable guides and version label and verify the Pages deployment. Check npm `latest` and the homepage npm command, and compile the affected examples from the installed SDK. Record the source commit, tag, archive SHA-256, npm version, CI run and deployed Pages revision separately. A GitHub Release, a public npm package and a deployed website are distinct milestones.
25
25
 
26
26
  `npm publish` accepts an existing tarball. The name/version pair cannot be reused, even after unpublishing. Its default distribution tag is `latest`. For maintenance patches on an older line, select a separate dist-tag to preserve the current `latest`. [npm publish reference](https://docs.npmjs.com/cli/v11/commands/npm-publish/)
27
27
 
28
28
  ## Trusted Publishing configuration and validation
29
29
 
30
- Use GitHub-hosted runners, Node ≥22.14 and npm ≥11.5.1. Bind npm's trusted publisher to `AnySwarm` / `anyswarm` / `release.yml`; the optional environment must match the publishing job. Grant that job `id-token: write`, configure the npm registry, and explicitly allow direct `npm publish` in npm's UI. Verify the setup with the next approved release. New configurations need their first successful OIDC publish within **two days** of creation. Recreate an expired configuration before publishing. Independent `npm dist-tag` changes need their own permission and a supported CLI. The current workflow has yet to publish through OIDC. [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
30
+ Use GitHub-hosted runners, Node ≥22.14 and npm ≥11.5.1. Bind npm's trusted publisher to `AnySwarm` / `anyswarm` / `release.yml`; the optional environment must match the publishing job. Grant that job `id-token: write`, configure the npm registry, and explicitly allow direct `npm publish` in npm's UI. Verify the setup with the next approved release. New configurations need their first successful OIDC publish within **two days** of creation. Recreate an expired configuration before publishing. Independent `npm dist-tag` changes need their own permission and a supported CLI. [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
31
31
 
32
32
  ## Failure and retry rules
33
33
 
34
- These are operating steps for the maintainer. The proposed release job can enforce them automatically.
34
+ Use these recovery steps when GitHub publication, npm publication, or verification fails.
35
35
 
36
36
  | Failure point | Recovery |
37
37
  | --- | --- |
38
38
  | Verification fails before publication | Fix and review the candidate. Do not claim a release exists. |
39
- | GitHub Release exists, npm missing | Reuse the published archive and checksum. Do not substitute a newly packed archive. |
39
+ | GitHub Latest exists, npm missing | Rerun the failed npm job or dispatch from `main` with `publish_npm` enabled. The job reuses the public archive and checksum. |
40
40
  | npm accepted publication, public registry still pending | Poll within a fixed limit, then report pending. Resume verification later; do not overwrite or increment versions solely for propagation delay. |
41
41
  | npm version exists on retry | Download it and compare bytes. If equal, skip publication and resume remaining steps. If different, stop and investigate; never treat matching name/version alone as proof. |
42
+ | Matching npm bytes exist under a different dist-tag | Verify the registry and have an authorized npm maintainer promote the correct version. The release job only grants direct publishing. |
42
43
  | npm succeeded, GitHub or Pages failed | Retry finalization/deployment with the same verified package and pinned documentation inputs. Do not republish npm. |
43
44
  | Published code is incorrect | Release a new patch or API line with a correction. Do not move the old tag or replace published package bytes. |
44
45
  | Older maintenance release finishes later | Keep `latest` on the newest supported line. Serialize promotions and compare semantic versions before changing the dist-tag. |
45
46
 
46
- The proposed OIDC job would follow this sequence.
47
+ The workflow preserves the original archive across both channels.
47
48
 
48
49
  ```text
49
- protected tag → pack once → verify archive → stage GitHub draft assets
50
- → publish those bytes to npm → verify a public npm install
51
- → publish GitHub Release → deploy matching docs
50
+ protected tag → verify archive → publish GitHub Release → publish same archive to npm
51
+ main dispatch with publish_npm → reuse GitHub Latest archive
52
52
  ```
53
53
 
54
- Use the stored artifact and checksum on retry. Report which public steps completed if a later step fails.
54
+ Keep the GitHub release intact if npm needs a retry. Check the npm registry for
55
+ the published digest and tag before updating the stable version documentation.
55
56
 
56
57
  ## Website recommendation
57
58
 
@@ -0,0 +1,85 @@
1
+ # Release CLI acceptance
2
+
3
+ Use the exact release archive in a clean Linux VM outside the repository. Record
4
+ the implementation commit, archive SHA-256, OS, Node/npm versions, backend and
5
+ observed outcomes. Keep machine-specific output and credentials out of Git.
6
+
7
+ ## Build and check the archive
8
+
9
+ ```sh
10
+ npm ci
11
+ npm run build
12
+ npm run typecheck
13
+ npm run docs:check
14
+ npm test
15
+ npm run pack:release -- /tmp/anyswarm-release
16
+ sha256sum /tmp/anyswarm-release/*.tgz
17
+ ```
18
+
19
+ Check the archive member listing for removed terminal scripts and fixtures. Check
20
+ the package manifest and both shipped lockfiles for the removed terminal renderer.
21
+ After installing, verify that the package's installed dependency tree also omits it.
22
+
23
+ ## Fresh VM and one-shot Run
24
+
25
+ Provision Node.js 22.19 or later, npm, Git, Docker and a supported Pi or Codex
26
+ installation. Follow [Quickstart](../en/quickstart.md) for host and model
27
+ configuration. Use a new user-owned prefix and an empty AnySwarm config directory.
28
+
29
+ ```sh
30
+ export PATH="$HOME/anyswarm-test/bin:$PATH"
31
+ export ANYSWARM_CONFIG_DIR="$HOME/anyswarm-test-config"
32
+ npm install -g --prefix "$HOME/anyswarm-test" /path/to/candidate.tgz
33
+ anyswarm --version
34
+ anyswarm
35
+ anyswarm setup
36
+ anyswarm doctor --smoke
37
+
38
+ mkdir "$HOME/sample-project"
39
+ cd "$HOME/sample-project"
40
+ printf '# AnySwarm release smoke\n' > README.md
41
+ anyswarm --harness subagents --prompt 'Read README.md and report its heading.' --output-dir ./runs
42
+ anyswarm trace --root ./runs --port 8787 --open
43
+ ```
44
+
45
+ Check that bare invocation prints three Quickstart commands and exits 0 without
46
+ project side effects. Setup and smoke must confirm actual Sandbox lifecycle,
47
+ Worker, Bridge, file export and deletion. The built-in Run must use a configured
48
+ model, report the expected heading in its saved result, and confirm cleanup. Check
49
+ the terminal for readable milestones, artifact and report paths, and the Trace
50
+ command. Open the Viewer and inspect the actual Run, Agent and exported artifacts.
51
+ Verify that the Run's Sandbox is gone after completion. Replay separately if the
52
+ VM has no browser, using a loopback SSH port forward to the Viewer.
53
+
54
+ ## Eject, edit and rerun
55
+
56
+ In an empty directory outside the input project, export the example, install its
57
+ local SDK and run the emitted TypeScript source.
58
+
59
+ ```sh
60
+ anyswarm eject example --dir "$HOME/editable-harness"
61
+ cd "$HOME/editable-harness"
62
+ npm install
63
+ npm exec -- anyswarm run ./harness.ts --prompt 'Verify the exported Harness' --output-dir ./runs
64
+ ```
65
+
66
+ Verify the SDK archive SHA-256 against `anyswarm-source.json` and check the final
67
+ report for completed work and cleanup. Change the greeting in `business.ts` and
68
+ rerun. The final report must contain the edited greeting. The local start command
69
+ and archive pin must work after the global CLI is upgraded.
70
+
71
+ ## Upgrade in place
72
+
73
+ Use a separate prefix and configuration directory. Install the previous release,
74
+ run setup, and save a byte-for-byte copy of the connection settings. Record the
75
+ version and the digest of `opensandbox.json`. Run `anyswarm update` and verify it
76
+ prints the npm command for that prefix and leaves both the version and settings
77
+ intact. Reinstall the newer archive into the same prefix. For a published upgrade,
78
+ run the printed command to install `@anyswarm/core@latest`.
79
+
80
+ Verify the new package version and compare the OpenSandbox configuration
81
+ byte-for-byte before running setup again. Run `anyswarm doctor --smoke` against the
82
+ existing connection and verify Worker export and deletion. A package version may
83
+ require the Worker to be rebuilt. If it does, record the first smoke result and
84
+ follow the CLI's remedy after verifying configuration preservation. Shut down the
85
+ Viewer and remove the disposable VM when verification is complete.
package/docs/zh/agents.md CHANGED
@@ -179,7 +179,7 @@ const messages = await runtime.session.getMessages(agent.id, { limit: 50, maxByt
179
179
  ### 订阅会话事件与完整示例
180
180
 
181
181
  - **会话事件流**:在发任务前订阅 `runtime.onEvent()`,会话级事件以 `{ type: 'session', agentId, event }` 推送。流式回复中的 `messageStart`、`textDelta` 和 `messageEnd` 共享同一个 `messageId`(可按消息与内容块增量拼接,收到 `messageEnd` 后用完整消息替换);`toolActivity` 列出当前正在执行的工具调用。会话总用量与当前上下文用量分开统计(分叉继承的历史可能计入会话总量),未配置单价时费用为 `null`。
182
- - **可运行示例**:仓库自带的 `examples/agent-session.ts` 完整演示了 3 次自动压缩上限策略、`append`/`nextTurn` 上下文注入以及状态与消息查询。可通过 `anys run ./examples/agent-session.ts /absolute/config.ts worker '你的任务'` 运行(配置模块默认导出完整的 `CreateRuntimeOptions`,工作时限 120 秒、清理时限 30 秒)。
182
+ - **可运行示例**:仓库自带的 `examples/agent-session.ts` 完整演示了 3 次自动压缩上限策略、`append`/`nextTurn` 上下文注入以及状态与消息查询。可通过 `anyswarm run ./examples/agent-session.ts /absolute/config.ts worker '你的任务'` 运行(配置模块默认导出完整的 `CreateRuntimeOptions`,工作时限 120 秒、清理时限 30 秒)。
183
183
 
184
184
  ---
185
185
 
@@ -34,7 +34,7 @@ cp "$example"/parallel-swarm/{board.ts,board-service.ts,harness.ts} .
34
34
  ```bash
35
35
  mkdir -p input
36
36
  printf 'export const cache = new Map<string, string>();\n' > input/cache.ts
37
- ./node_modules/.bin/anys run ./harness.ts --cwd ./input \
37
+ ./node_modules/.bin/anyswarm run ./harness.ts --cwd ./input \
38
38
  --prompt '检查 cache.ts 的资源风险并发布具体发现。' --output-dir ./runs
39
39
  ./node_modules/.bin/anyswarm trace --root ./runs
40
40
  ```