@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.
Files changed (301) hide show
  1. package/AGENTS.md +20 -5
  2. package/README.md +69 -55
  3. package/dist/examples/README.md +138 -77
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +108 -16
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  7. package/dist/examples/autoresearch/config.d.ts +48 -5
  8. package/dist/examples/autoresearch/config.js +57 -23
  9. package/dist/examples/autoresearch/demo.d.ts +12 -4
  10. package/dist/examples/autoresearch/demo.js +65 -22
  11. package/dist/examples/autoresearch/eject.json +2 -0
  12. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  13. package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
  14. package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
  15. package/dist/examples/autoresearch/frontiercs2.js +71 -14
  16. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  17. package/dist/examples/autoresearch/prepare-demo.js +46 -0
  18. package/dist/examples/autoresearch/prepare.d.ts +105 -53
  19. package/dist/examples/autoresearch/prepare.js +126 -57
  20. package/dist/examples/autoresearch/project.d.ts +6 -95
  21. package/dist/examples/autoresearch/project.js +131 -45
  22. package/dist/examples/autoresearch/research-service.d.ts +16 -1
  23. package/dist/examples/autoresearch/research-service.js +84 -44
  24. package/dist/examples/code/README.md +25 -17
  25. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  26. package/dist/examples/code/config.d.ts +1 -0
  27. package/dist/examples/first-harness/AGENTS.md +25 -0
  28. package/dist/examples/first-harness/README.md +136 -0
  29. package/dist/examples/first-harness/config.d.ts +9 -8
  30. package/dist/examples/first-harness/config.js +33 -26
  31. package/dist/examples/first-harness/eject.json +14 -0
  32. package/dist/examples/first-harness/handoff.js +3 -3
  33. package/dist/examples/first-harness/harness.d.ts +14 -18
  34. package/dist/examples/first-harness/harness.js +102 -77
  35. package/dist/examples/first-harness/input/README.md +7 -0
  36. package/dist/examples/first-harness/session.js +2 -1
  37. package/dist/examples/first-harness/tsconfig.json +2 -1
  38. package/dist/examples/harness-session/README.md +4 -4
  39. package/dist/examples/lead-worker/README.md +1 -1
  40. package/dist/examples/lead-worker/project-config.d.ts +1 -0
  41. package/dist/examples/messages/README.md +2 -2
  42. package/dist/examples/notes/README.md +5 -5
  43. package/dist/examples/notes/config.d.ts +1 -0
  44. package/dist/examples/parallel-swarm/AGENTS.md +32 -0
  45. package/dist/examples/parallel-swarm/README.md +136 -0
  46. package/dist/examples/parallel-swarm/board-service.js +25 -8
  47. package/dist/examples/parallel-swarm/board.d.ts +31 -1
  48. package/dist/examples/parallel-swarm/board.js +98 -13
  49. package/dist/examples/parallel-swarm/config.d.ts +11 -0
  50. package/dist/examples/parallel-swarm/config.js +39 -0
  51. package/dist/examples/parallel-swarm/eject.json +5 -0
  52. package/dist/examples/parallel-swarm/harness.d.ts +26 -20
  53. package/dist/examples/parallel-swarm/harness.js +77 -76
  54. package/dist/examples/parallel-swarm/report.d.ts +12 -0
  55. package/dist/examples/parallel-swarm/report.js +30 -0
  56. package/dist/examples/peermesh/README.md +1 -1
  57. package/dist/examples/peermesh/project-config.d.ts +1 -0
  58. package/dist/examples/services/agent-control/README.md +1 -1
  59. package/dist/examples/services/mathlib-search/README.md +1 -1
  60. package/dist/examples/services/mcp-managed/README.md +1 -1
  61. package/dist/examples/services/persistent-board/README.md +6 -3
  62. package/dist/examples/subagents/AGENTS.md +35 -0
  63. package/dist/examples/subagents/README.md +129 -93
  64. package/dist/examples/subagents/config.d.ts +2 -10
  65. package/dist/examples/subagents/config.js +9 -16
  66. package/dist/examples/subagents/eject.json +17 -0
  67. package/dist/examples/subagents/handoff-config.d.ts +41 -0
  68. package/dist/examples/subagents/handoff-config.js +13 -0
  69. package/dist/examples/subagents/model.d.ts +3 -0
  70. package/dist/examples/subagents/model.js +19 -0
  71. package/dist/examples/substrate/README.md +12 -6
  72. package/dist/examples/substrate/config.d.ts +1 -0
  73. package/dist/examples/substrate/project-config.d.ts +1 -0
  74. package/dist/examples/super/README.md +34 -22
  75. package/dist/examples/super/actions.d.ts +1 -1
  76. package/dist/examples/super/actions.js +11 -11
  77. package/dist/examples/super/config.js +3 -3
  78. package/dist/examples/super/eject.json +1 -1
  79. package/dist/examples/super/location.js +1 -1
  80. package/dist/examples/super/operator.d.ts +1 -0
  81. package/dist/examples/super/operator.js +31 -0
  82. package/dist/examples/super/project.d.ts +0 -107
  83. package/dist/examples/super/project.js +1 -3
  84. package/dist/examples/taskpool/README.md +1 -1
  85. package/dist/examples/taskpool/config.d.ts +1 -0
  86. package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
  87. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  88. package/dist/scripts/anyswarm-arguments.js +69 -97
  89. package/dist/scripts/anyswarm-eject.js +1 -1
  90. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  91. package/dist/scripts/anyswarm-harnesses.js +1 -22
  92. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  93. package/dist/scripts/anyswarm-installation.js +17 -291
  94. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  95. package/dist/scripts/anyswarm-launch.js +32 -81
  96. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  97. package/dist/scripts/anyswarm-progress.js +133 -0
  98. package/dist/scripts/anyswarm-project.d.ts +1 -9
  99. package/dist/scripts/anyswarm-project.js +40 -127
  100. package/dist/scripts/anyswarm-source-runner.js +9 -41
  101. package/dist/scripts/anyswarm.js +6 -26
  102. package/dist/scripts/build-provenance.json +1 -1
  103. package/dist/scripts/generate-architecture-coverage.js +1 -1
  104. package/dist/scripts/generate-architecture-prompts.js +18 -10
  105. package/dist/scripts/local-environment.d.ts +13 -7
  106. package/dist/scripts/local-environment.js +73 -21
  107. package/dist/scripts/local-setup.d.ts +3 -0
  108. package/dist/scripts/local-setup.js +153 -118
  109. package/dist/scripts/pack-release.js +31 -4
  110. package/dist/src/core/index.js +1 -1
  111. package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
  112. package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
  113. package/dist/src/core/sandbox/sandbox-connection.js +22 -7
  114. package/dist/src/core/worker-image.js +1 -1
  115. package/dist/src/harness/project-harness.d.ts +1 -0
  116. package/dist/src/harness/project-harness.js +5 -4
  117. package/dist/src/harness/project-rpc-client.js +19 -0
  118. package/dist/src/harness/project-runtime.js +3 -1
  119. package/dist/src/harness/typescript-loader.d.ts +2 -0
  120. package/dist/src/harness/typescript-loader.js +26 -8
  121. package/dist/src/trace-viewer/command.mjs +6 -3
  122. package/dist/src/trace-viewer/public/app.js +239 -59
  123. package/dist/src/trace-viewer/public/index.html +5 -0
  124. package/dist/src/trace-viewer/public/style.css +22 -0
  125. package/dist/src/trace-viewer/reader.mjs +242 -26
  126. package/dist/src/trace-viewer/run-root.d.mts +1 -0
  127. package/dist/src/trace-viewer/run-root.mjs +7 -0
  128. package/dist/src/trace-viewer/server.mjs +3 -1
  129. package/docs/INDEX.md +11 -9
  130. package/docs/architecture/04-services.md +1 -1
  131. package/docs/architecture/06-observability-experiments.md +21 -7
  132. package/docs/architecture/07-run-configuration.md +118 -19
  133. package/docs/architecture/08-prompts.md +21 -2
  134. package/docs/architecture/10-service-api-reference.md +12 -5
  135. package/docs/architecture/12-code-coverage.md +157 -115
  136. package/docs/architecture/15-core-runtime.md +1 -1
  137. package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
  138. package/docs/architecture/17-harness-reporting.md +79 -1
  139. package/docs/architecture/22-website.md +52 -20
  140. package/docs/architecture/23-project-harness.md +109 -37
  141. package/docs/architecture/26-code.md +20 -5
  142. package/docs/architecture/27-personal.md +23 -8
  143. package/docs/architecture/28-autoresearch.md +18 -12
  144. package/docs/architecture/INDEX.md +1 -2
  145. package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
  146. package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
  147. package/docs/architecture/prompts/22-autoresearch.md +9 -2
  148. package/docs/architecture/prompts/source-manifest.json +76 -52
  149. package/docs/architecture/source-map.json +445 -105
  150. package/docs/designs/core-harness/01-core.md +2 -2
  151. package/docs/designs/core-harness/06-project-harness.md +3 -3
  152. package/docs/designs/core-harness/README.md +2 -2
  153. package/docs/en/agents.md +1 -1
  154. package/docs/en/autoresearch.md +41 -0
  155. package/docs/en/blog/100b-tokens.md +157 -0
  156. package/docs/en/build-your-harness.md +47 -22
  157. package/docs/en/changelog.md +29 -1
  158. package/docs/en/first-harness.md +40 -32
  159. package/docs/en/harnesses/index.md +23 -23
  160. package/docs/en/harnesses/lead-worker.md +1 -1
  161. package/docs/en/harnesses/peermesh.md +2 -2
  162. package/docs/en/harnesses/subagents.md +10 -31
  163. package/docs/en/harnesses/substrate.md +4 -4
  164. package/docs/en/harnesses/taskpool.md +2 -2
  165. package/docs/en/latest.md +30 -5
  166. package/docs/en/overview.md +22 -22
  167. package/docs/en/quickstart.md +69 -56
  168. package/docs/en/reference/api.md +1 -1
  169. package/docs/en/reference/cli.md +47 -85
  170. package/docs/en/sandbox.md +3 -3
  171. package/docs/en/trace-viewer.md +32 -12
  172. package/docs/operations/trace-viewer.md +26 -11
  173. package/docs/third-party-notices.md +0 -1
  174. package/docs/workflows/development.md +160 -118
  175. package/docs/workflows/release-and-docs-versioning.md +207 -54
  176. package/docs/workflows/release-cli-acceptance.md +162 -0
  177. package/docs/zh/agents.md +1 -1
  178. package/docs/zh/autoresearch.md +41 -0
  179. package/docs/zh/blog/100b-tokens.md +102 -0
  180. package/docs/zh/build-your-harness.md +48 -23
  181. package/docs/zh/changelog.md +29 -1
  182. package/docs/zh/first-harness.md +43 -35
  183. package/docs/zh/harnesses/index.md +23 -23
  184. package/docs/zh/harnesses/lead-worker.md +1 -1
  185. package/docs/zh/harnesses/peermesh.md +2 -2
  186. package/docs/zh/harnesses/subagents.md +10 -31
  187. package/docs/zh/harnesses/substrate.md +4 -4
  188. package/docs/zh/harnesses/taskpool.md +2 -2
  189. package/docs/zh/latest.md +30 -5
  190. package/docs/zh/overview.md +23 -23
  191. package/docs/zh/quickstart.md +66 -57
  192. package/docs/zh/reference/api.md +1 -1
  193. package/docs/zh/reference/cli.md +19 -79
  194. package/docs/zh/sandbox.md +3 -3
  195. package/docs/zh/trace-viewer.md +32 -12
  196. package/examples/README.md +138 -77
  197. package/examples/authoring/README.md +4 -4
  198. package/examples/autoresearch/README.md +108 -16
  199. package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  200. package/examples/autoresearch/config.ts +64 -25
  201. package/examples/autoresearch/demo.ts +75 -22
  202. package/examples/autoresearch/eject.json +2 -0
  203. package/examples/autoresearch/frontiercs2-config.ts +15 -0
  204. package/examples/autoresearch/frontiercs2.ts +64 -11
  205. package/examples/autoresearch/prepare-demo.ts +44 -0
  206. package/examples/autoresearch/prepare.ts +134 -60
  207. package/examples/autoresearch/project.ts +120 -44
  208. package/examples/autoresearch/research-service.ts +91 -41
  209. package/examples/code/README.md +25 -17
  210. package/examples/code/REQUIREMENTS.zh.md +3 -3
  211. package/examples/first-harness/AGENTS.md +25 -0
  212. package/examples/first-harness/README.md +136 -0
  213. package/examples/first-harness/config.ts +41 -27
  214. package/examples/first-harness/eject.json +14 -0
  215. package/examples/first-harness/handoff.ts +3 -3
  216. package/examples/first-harness/harness.ts +104 -72
  217. package/examples/first-harness/input/README.md +7 -0
  218. package/examples/first-harness/session.ts +2 -1
  219. package/examples/first-harness/tsconfig.json +2 -1
  220. package/examples/harness-session/README.md +4 -4
  221. package/examples/lead-worker/README.md +1 -1
  222. package/examples/messages/README.md +2 -2
  223. package/examples/notes/README.md +5 -5
  224. package/examples/parallel-swarm/AGENTS.md +32 -0
  225. package/examples/parallel-swarm/README.md +136 -0
  226. package/examples/parallel-swarm/board-service.ts +28 -9
  227. package/examples/parallel-swarm/board.ts +107 -13
  228. package/examples/parallel-swarm/config.ts +47 -0
  229. package/examples/parallel-swarm/eject.json +5 -0
  230. package/examples/parallel-swarm/harness.ts +83 -71
  231. package/examples/parallel-swarm/report.ts +33 -0
  232. package/examples/peermesh/README.md +1 -1
  233. package/examples/services/agent-control/README.md +1 -1
  234. package/examples/services/mathlib-search/README.md +1 -1
  235. package/examples/services/mcp-managed/README.md +1 -1
  236. package/examples/services/persistent-board/README.md +6 -3
  237. package/examples/subagents/AGENTS.md +35 -0
  238. package/examples/subagents/README.md +129 -93
  239. package/examples/subagents/config.ts +9 -15
  240. package/examples/subagents/eject.json +17 -0
  241. package/examples/subagents/handoff-config.ts +14 -0
  242. package/examples/subagents/model.ts +20 -0
  243. package/examples/substrate/README.md +12 -6
  244. package/examples/super/README.md +34 -22
  245. package/examples/super/actions.ts +11 -11
  246. package/examples/super/config.ts +3 -3
  247. package/examples/super/eject.json +1 -1
  248. package/examples/super/location.ts +1 -1
  249. package/examples/super/operator.ts +28 -0
  250. package/examples/super/project.ts +1 -3
  251. package/examples/taskpool/README.md +1 -1
  252. package/npm-shrinkwrap.development.json +46 -1538
  253. package/npm-shrinkwrap.json +10 -43
  254. package/package.development.json +3 -6
  255. package/package.json +3 -5
  256. package/scripts/anyswarm-arguments.ts +67 -96
  257. package/scripts/anyswarm-eject.ts +1 -1
  258. package/scripts/anyswarm-harnesses.ts +1 -18
  259. package/scripts/anyswarm-installation.ts +18 -294
  260. package/scripts/anyswarm-launch.ts +30 -102
  261. package/scripts/anyswarm-progress.ts +125 -0
  262. package/scripts/anyswarm-project.ts +31 -123
  263. package/scripts/anyswarm-source-runner.ts +9 -36
  264. package/scripts/anyswarm.ts +4 -24
  265. package/scripts/generate-architecture-coverage.ts +1 -1
  266. package/scripts/generate-architecture-prompts.ts +21 -10
  267. package/scripts/local-environment.ts +79 -21
  268. package/scripts/local-setup.ts +150 -105
  269. package/scripts/pack-release.ts +28 -4
  270. package/src/core/index.ts +1 -1
  271. package/src/core/sandbox/opensandbox-backend.ts +10 -4
  272. package/src/core/sandbox/sandbox-connection.ts +22 -7
  273. package/src/core/worker-image.ts +1 -1
  274. package/src/harness/project-harness.ts +5 -4
  275. package/src/harness/project-rpc-client.ts +23 -0
  276. package/src/harness/project-runtime.ts +2 -1
  277. package/src/harness/typescript-loader.ts +28 -8
  278. package/src/trace-viewer/command.mjs +6 -3
  279. package/src/trace-viewer/public/app.js +239 -59
  280. package/src/trace-viewer/public/index.html +5 -0
  281. package/src/trace-viewer/public/style.css +22 -0
  282. package/src/trace-viewer/reader.mjs +242 -26
  283. package/src/trace-viewer/run-root.d.mts +1 -0
  284. package/src/trace-viewer/run-root.mjs +7 -0
  285. package/src/trace-viewer/server.mjs +3 -1
  286. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  287. package/dist/scripts/anyswarm-applications.js +0 -19
  288. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  289. package/dist/scripts/anyswarm-tui-config.js +0 -189
  290. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  291. package/dist/scripts/anyswarm-tui-session.js +0 -304
  292. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  293. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  294. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  295. package/dist/scripts/anyswarm-tui.js +0 -1012
  296. package/docs/architecture/25-foreground-tui.md +0 -51
  297. package/scripts/anyswarm-applications.ts +0 -39
  298. package/scripts/anyswarm-tui-config.ts +0 -174
  299. package/scripts/anyswarm-tui-session.ts +0 -295
  300. package/scripts/anyswarm-tui-terminal.ts +0 -147
  301. package/scripts/anyswarm-tui.ts +0 -912
@@ -1,76 +1,229 @@
1
- # Release updates and documentation versions
2
-
3
- Research as of 2026-12-01 against repository revision `40132bd47c0609b4149a106f1b97d83f277dd6d4`.
1
+ # Releases and documentation versions
2
+
3
+ `main`, an installable candidate, npm `next`, and npm `latest` have separate
4
+ purposes. Development can continue without publishing every merged change.
5
+ The [Release workflow](../../.github/workflows/release.yml) owns verification and
6
+ publication; this guide explains when to use each path and how to recover.
7
+
8
+ ## Channels and version policy
9
+
10
+ | Surface | Meaning | How it changes |
11
+ | --- | --- | --- |
12
+ | `main` | Current development source | Reviewed PRs merge after required CI |
13
+ | CI candidate archive | Installable bytes from one recorded source revision | Relevant CI or a manual verification run; no public npm publication |
14
+ | npm `next` | Opt-in prerelease for external testing | Authorized manual `publish_next=true` from `main` |
15
+ | npm `latest` | Current supported stable release | Approved release PR, matching stable tag, verification and publication |
16
+ | Stable website guides | Instructions compatible with the published stable package | Reviewed stable manifest inputs; deployment verifies the package exists |
17
+ | Next website guides | Current `main` instructions, possibly ahead of npm `next` | Main documentation changes |
18
+
19
+ A candidate may share its package version with the stable release; identify it
20
+ by source commit and archive SHA-256. A next package has its own prerelease
21
+ version, and its source may lag the moving Next documentation. Pin the exact
22
+ prerelease to reproduce a report, and consult its bundled docs when needed.
23
+
24
+ For the current pre-1.0 project, use a patch release for compatible fixes and a
25
+ new minor line for new capabilities or incompatible public API/CLI behavior. Explain incompatible
26
+ changes and migration steps. Do not use the `0.x` label as a reason to silently
27
+ break users in a patch. Move to 1.0 when ready to commit to the stable API contract
28
+ specified by [SemVer](https://semver.org/spec/v2.0.0.html).
29
+
30
+ Ordinary PRs do not bump formal package versions. Add user-visible changes under
31
+ `Unreleased` in the root `CHANGELOG.md`, the canonical pending-change record.
32
+ The release PR consolidates these entries into the English and Chinese changelogs
33
+ and release notes. Ordinary PRs update affected bilingual usage guides, without
34
+ having to maintain three copies of every pending note. Documentation corrections
35
+ and internal changes alone do not require a package release.
36
+
37
+ ## 1. Verify a candidate without publishing
38
+
39
+ Use Node.js 24 and the locked dependencies. Pack with `npm run pack:release`,
40
+ then verify that exact archive outside the checkout. The pack script stages the
41
+ public manifest and production lockfile while preserving development build
42
+ materials; it does not publish anything.
43
+
44
+ ```sh
45
+ npm ci --ignore-scripts
46
+ candidate_dir=$(mktemp -d)
47
+ npm run pack:release -- "$candidate_dir"
48
+ sha256sum "$candidate_dir"/*.tgz
49
+ ```
4
50
 
5
- `@anyswarm/core@0.5.0` is the first formally supported release. The previous package's release artifacts stay in GitHub history.
51
+ The [development workflow](development.md#repository-ci-checks)
52
+ describes the full cache preparation and frozen package tests. CI preserves the
53
+ archive, `SHA256SUMS` and `source.json`. The full test shards consume that same
54
+ archive. Record the CI result separately from artifact availability.
6
55
 
7
- ## Observed release and website behavior
56
+ For the full release verifier, dispatch the workflow with both publication flags
57
+ off. Select the reviewed branch or use `main`:
8
58
 
9
- - [Release workflow at the baseline](https://github.com/AnySwarm/anyswarm/blob/40132bd47c0609b4149a106f1b97d83f277dd6d4/.github/workflows/release.yml) accepts stable `vX.Y.Z` tags matching `package.json`. It packs once, tests that archive outside the checkout, verifies an installed First Harness, and uploads checksums and two byte-identical archive names. A tag push publishes those assets as a GitHub Release. A manual workflow dispatch verifies a candidate without publishing it. The npm command is **dry-run only**; the publishing job has no `id-token: write`. Publishing to npm is a separate step.
10
- - [Website deployment at the baseline](https://github.com/AnySwarm/anyswarm/blob/40132bd47c0609b4149a106f1b97d83f277dd6d4/.github/workflows/deploy-website.yml) runs for relevant main changes and successful tag Release workflows. It checks that a public latest GitHub Release contains the installer archive, then builds the current main checkout. A main-only API change can reach the documentation before the corresponding SDK release.
11
- - [Top navigation](https://github.com/AnySwarm/anyswarm/blob/40132bd47c0609b4149a106f1b97d83f277dd6d4/website/src/components/TopNav.astro) displays a generic Releases link. [Documentation URL helpers](https://github.com/AnySwarm/anyswarm/blob/40132bd47c0609b4149a106f1b97d83f277dd6d4/website/src/lib/i18n.ts) encode language and page slug.
59
+ ```sh
60
+ gh workflow run release.yml --ref main
61
+ ```
12
62
 
13
- ## Version policy
63
+ This performs candidate-only verification. Native setup, controlled-model
64
+ Quickstart and installed SDK checks require the workflow's Docker environment.
65
+ See [CLI acceptance](release-cli-acceptance.md) for manual host and upgrade checks.
14
66
 
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)
67
+ ## 2. Publish an opt-in next version
16
68
 
17
- ## Next release with the existing workflow
69
+ After the owner authorizes preview publication, dispatch from `main`:
18
70
 
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
- 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
- 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.
71
+ ```sh
72
+ gh workflow run release.yml --ref main -f publish_next=true
73
+ ```
25
74
 
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/)
75
+ `publish_next` and `publish_npm` cannot both be true. The workflow rejects next
76
+ publication from another ref. A normal main push does not publish either channel.
77
+
78
+ The workflow derives a version from the source's next minor line, run ID and
79
+ source SHA. For example, source version `0.5.2` can produce
80
+ `0.6.0-next.47107907008.g070b025305af`. The `g` prefix makes the SHA component a
81
+ valid nonnumeric SemVer identifier. A rerun of the same workflow run retains the
82
+ same version identity. Prefer rerunning the failed publication job so it downloads
83
+ the already verified artifact. Rerunning all jobs can rebuild the candidate; if
84
+ that produces different bytes for an existing version, publication must stop.
85
+ The formal source manifest and lockfile stay unchanged;
86
+ the override is applied only in the packed staging directory. Preview numbering
87
+ does not decide the eventual stable release version.
88
+
89
+ The next candidate is verified before it is published with `--tag next` through
90
+ the existing trusted publishing workflow. It has no stable Git tag or GitHub
91
+ Latest release. The publication path verifies that npm `latest` is unchanged,
92
+ then downloads the public registry tarball, checks its identity and installs the
93
+ exact version in fresh consumers. Stable and next publication share the
94
+ publication concurrency boundary.
95
+
96
+ Testers explicitly select this channel:
97
+
98
+ ```sh
99
+ npm install -g @anyswarm/core@next
100
+ anyswarm --version
101
+ ```
27
102
 
28
- ## Trusted Publishing configuration and validation
103
+ For a project SDK, use `npm install --save-exact @anyswarm/core@next` and commit
104
+ the lockfile. Report the resolved version rather than just the moving `next`
105
+ tag. Return the CLI to the supported release with
106
+ `npm install -g @anyswarm/core@latest`, using the same npm prefix.
107
+
108
+ ## 3. Prepare and publish a stable release
109
+
110
+ 1. Prepare one release PR from `main`. Update the package and lockfile versions,
111
+ release notes, affected examples, Worker/backend compatibility information,
112
+ and migration instructions. Both language guides must describe the resulting
113
+ behavior. Keep the stable website manifest on the currently published version
114
+ until the new distribution is verified.
115
+ 2. Review the merge candidate with required Core and Website CI. Run the manual
116
+ Release verifier against the reviewed revision. Preserve its source identity
117
+ and record any manual host acceptance required for the changed paths.
118
+ 3. After approval and merge, the release owner creates a matching `vX.Y.Z` tag at
119
+ the approved revision under the [tag ruleset](https://github.com/AnySwarm/anyswarm/rules/28373821).
120
+ The workflow requires a stable tag matching the source package version.
121
+ 4. The tag workflow packs and verifies its final candidate. It uploads the
122
+ versioned tarball, the byte-identical `luna-shi-anyswarm.tgz` alias, and
123
+ `SHA256SUMS` to the tagged GitHub Release. npm publication uses those public
124
+ verified bytes; it must not manufacture another tarball with `npm pack`.
125
+ 5. The npm job publishes the current GitHub Latest release, then verifies public
126
+ registry metadata, downloads the actual `dist.tarball`, checks its digest,
127
+ and installs the exact package by name in an empty project and an isolated
128
+ global npm prefix. It verifies the root SDK import and CLI version. A registry
129
+ metadata response alone does not complete this step.
130
+ 6. Once both distributions pass, review the stable documentation manifest and
131
+ deploy the compatible guides. Record the source commit, tag, archive SHA-256,
132
+ npm version/channel, workflow run and website revision in the release record.
133
+
134
+ A next prerelease cannot become a stable version just by relabeling its bytes:
135
+ the stable package has a different manifest version and must pass verification
136
+ as its own candidate. Preserve byte identity across the distribution channels
137
+ for each individual version.
138
+
139
+ An older stable tag can remain a pinned GitHub Release. The current npm workflow
140
+ publishes GitHub Latest and does not automatically backport or promote an older
141
+ API line over it. Any future maintained older npm line needs its own explicit
142
+ channel policy.
143
+
144
+ ## Publication credentials and public verification
145
+
146
+ The existing npm Trusted Publisher is bound to `AnySwarm/anyswarm` and
147
+ `release.yml`. Both stable and next publication use that workflow and its
148
+ `id-token: write` job; the configured publisher must permit direct `npm publish`.
149
+ Do not copy a long-lived token into the repository or run publication from a PR
150
+ check. Follow [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
151
+ when changing publisher settings.
152
+
153
+ The post-publication verifier can also check an already public exact package:
154
+
155
+ ```sh
156
+ ARCHIVE=/absolute/path/to/verified.tgz VERSION=0.6.0-next.47107907008.g070b025305af DIST_TAG=next node .github/verify-npm-release.mjs
157
+ ```
29
158
 
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/)
159
+ Use the recorded version, dist-tag and archive for the actual run. This command
160
+ checks a publication; it does not publish a package. Registry availability can
161
+ lag acceptance. Resume verification against the same version and bytes rather
162
+ than creating a new release solely because propagation exceeded a timeout.
31
163
 
32
164
  ## Failure and retry rules
33
165
 
34
- These are operating steps for the maintainer. The proposed release job can enforce them automatically.
35
-
36
166
  | Failure point | Recovery |
37
167
  | --- | --- |
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. |
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
- | 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
- | npm succeeded, GitHub or Pages failed | Retry finalization/deployment with the same verified package and pinned documentation inputs. Do not republish npm. |
43
- | 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
- | 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
- The proposed OIDC job would follow this sequence.
47
-
48
- ```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
168
+ | Candidate checks fail before publication | Fix the change and verify another candidate; do not describe it as released |
169
+ | GitHub Latest exists, npm missing | Rerun the npm job or dispatch `publish_npm=true` from `main`; reuse the public GitHub archive |
170
+ | npm accepted the version but it is not public yet | Resume bounded polling and public verification with the same version and bytes |
171
+ | The npm version already exists | Download it and compare bytes; equal bytes can resume verification, different bytes must stop the workflow |
172
+ | A next publication job needs a retry | Rerun that failed job to reuse the verified artifact and version identity; a rerun that rebuilds different bytes must stop for an existing version |
173
+ | Next is published and `latest` changed unexpectedly | Stop and inspect the registry/publishing race; do not report channel isolation as successful |
174
+ | Verified package has the wrong dist-tag | An authorized maintainer restores the intended tag after checking version and bytes; publishing permission does not imply arbitrary tag-management permission |
175
+ | npm succeeds but documentation deployment fails | Retry the tracked documentation deployment; do not republish npm |
176
+ | Published code is wrong | Publish a corrected new version after verification; preserve old tags and package bytes |
177
+ | A stable release finishes after a newer stable release | Preserve GitHub Latest and npm `latest` on the newest intended supported line |
178
+
179
+ To retry publication or verification for the current GitHub Latest release:
180
+
181
+ ```sh
182
+ gh workflow run release.yml --ref main -f publish_npm=true
52
183
  ```
53
184
 
54
- Use the stored artifact and checksum on retry. Report which public steps completed if a later step fails.
185
+ Published name/version pairs cannot be overwritten. The
186
+ [npm publish reference](https://docs.npmjs.com/cli/v11/commands/npm-publish/)
187
+ explains immutable versions and dist-tags. Keep the GitHub assets intact for
188
+ recovery; a successful npm step does not justify replacing them.
55
189
 
56
- ## Website recommendation
190
+ ## Stable and development documentation
57
191
 
58
- For the current single supported API line, display **v0.5.0**. Before publishing a second API line that needs different guides, add a version selector and freeze each released set of docs. Docusaurus documents the snapshot pattern and its maintenance cost. The existing Astro site can use the same pattern. [Docusaurus versioning](https://docusaurus.io/docs/versioning)
192
+ `website/docs-release.json` is the reviewed link between released software and
193
+ its instructions. It records:
59
194
 
60
- Proposed routes under the site base.
195
+ - `schemaVersion`: manifest format.
196
+ - `version`: exact publicly available stable npm version.
197
+ - `packageRevision`: immutable source revision for that package.
198
+ - `docsRevision`: immutable compatible documentation revision.
199
+ - `corrections`: ordered tracked `website/docs-corrections/*.patch` files applied
200
+ to that documentation snapshot; the preparation output records their hashes.
61
201
 
62
- | Route before the configured site base | Meaning |
63
- | --- | --- |
64
- | `/docs/<slug>/`, `/zh/docs/<slug>/` | Latest supported released documentation aliases. |
65
- | `/docs/v0.5.0/<slug>/`, `/zh/docs/v0.5.0/<slug>/` | Frozen exact release snapshot. |
66
- | `/docs/next/<slug>/`, `/zh/docs/next/<slug>/` | Main documentation, explicitly marked unreleased. |
67
-
68
- Maintain an explicit release manifest containing package version, immutable package tag/SHA, documentation source SHA and support status. Build each historical route from its pinned documentation revision. The `v0.5.0` tag predates corrections to the npm instructions. Use a reviewed documentation revision compatible with the released package and record both revisions. Publish any correction to a historical snapshot as a tracked documentation revision.
69
-
70
- Preserve the chosen version in sidebar links, previous/next links, article links, search results and example downloads. Language switching preserves **version and slug**. Version switching preserves **language and slug** when the page exists and goes to the selected version’s overview otherwise. Search uses the selected version by default. The label names the version of the documents being displayed.
202
+ Package and documentation revisions may differ when instructions were corrected
203
+ after the package release. Both pinned revisions must identify the manifest's
204
+ package name and version. Use a tracked correction when a compatible fix comes
205
+ from a later source line. Each correction remains reviewable and its identity
206
+ is checked by the website preparation process. Updating these inputs does not
207
+ require a package bump.
71
208
 
72
- Group the menu by API line. A compatible patch can share its line’s guides. Keep the exact tag and docs source in the manifest for each release. If a patch needs materially different instructions, publish a snapshot for it. Keep exact version URLs pinned once published.
73
-
74
- Every Pages deployment must include all retained version routes in its uploaded site artifact. Deploying only the newest snapshot would remove older routes from the deployed site. Preserve sources through Git tags/pinned revisions and build inputs; no repository `archive/` directory is needed. The deployment must gate the stable alias on verified release inputs rather than fetching moving main as its source of released API documentation. [GitHub Pages custom workflow and artifact deployment](https://docs.github.com/en/pages/getting-started-with-github-pages/using-custom-workflows-with-github-pages)
75
-
76
- To verify the selector, build both languages for two pinned versions. Open old URLs directly, switch languages and versions on shared and removed pages, and check search and example downloads. Deploy a newer version and confirm old routes and content hashes remain available.
209
+ | Route under the site base | Content |
210
+ | --- | --- |
211
+ | `/docs/<slug>/`, `/zh/docs/<slug>/` | Stable manifest's compatible guides |
212
+ | `/docs/next/<slug>/`, `/zh/docs/next/<slug>/` | Current main guides, explicitly marked Next |
213
+
214
+ The website build prepares ignored snapshots from the pinned revisions. Every
215
+ build contains both channels. Navigation, language switching, search and example
216
+ source links preserve the selected channel; the Next label does not claim that
217
+ every main change is already on npm `next`.
218
+
219
+ For a stable documentation correction, keep the package version and revision,
220
+ select a reviewed compatible docs revision or add a tracked correction, then
221
+ review the stable and Next outputs. For a new stable release, change the manifest
222
+ only after the exact public npm package passes verification. Pages deployment
223
+ checks the manifest's package rather than using the mere existence of GitHub
224
+ Latest as proof. A main-only CLI/API change therefore updates Next without
225
+ silently changing stable instructions.
226
+
227
+ The current site maintains one supported stable channel and one development
228
+ channel. Historical release source and documents remain in immutable Git refs;
229
+ this workflow does not promise a website route for every old patch release.
@@ -0,0 +1,162 @@
1
+ # Release CLI acceptance
2
+
3
+ Verify the exact package that users will receive. Record source commit, package
4
+ version/channel, archive SHA-256, Node/npm versions, OS/architecture, backend and
5
+ observed results. The [Release workflow](../../.github/workflows/release.yml)
6
+ provides automated candidate checks; this guide adds reproducible local and
7
+ manual acceptance for affected user paths.
8
+
9
+ A small documentation PR does not need every check here. Run the relevant
10
+ focused checks during development and use required CI for the merge gate.
11
+ A release candidate needs the package and native checks selected by the release
12
+ workflow, plus manual host checks when the change affects those hosts. Keep
13
+ unverified platforms and skipped checks explicit.
14
+
15
+ ## 1. Build and freeze a candidate
16
+
17
+ Use a clean checkout and Node.js 24, matching CI. Pack once, then keep that archive
18
+ for installation and acceptance. The commands below use Linux checksum tools.
19
+
20
+ ```sh
21
+ npm ci --ignore-scripts
22
+ npm run typecheck
23
+ npm run docs:check
24
+ candidate_dir=$(mktemp -d)
25
+ candidate_archive=$(npm run --silent pack:release -- "$candidate_dir")
26
+ candidate_sha=$(sha256sum "$candidate_archive" | cut -d ' ' -f 1)
27
+ ```
28
+
29
+ Inspect the archive manifest, production lockfile, included examples and CLI
30
+ entry points relevant to the change. Use the
31
+ [full cold-cache sequence](development.md#repository-ci-checks)
32
+ when reproducing CI package tests. The frozen install/eject checks can then run
33
+ against this exact archive:
34
+
35
+ ```sh
36
+ ANYSWARM_TEST_PACKAGE_ARCHIVE="$candidate_archive" \
37
+ ANYSWARM_TEST_PACKAGE_SHA256="$candidate_sha" \
38
+ npm run test:focus -- test/anyswarm-candidate-install.test.ts
39
+ ```
40
+
41
+ The checks must execute rather than skip. They install the CLI outside the
42
+ checkout, run an exported TypeScript Harness, modify its source, and check that
43
+ its local SDK stays bound to the archive. Record the source commit as well as
44
+ the displayed version: an ordinary candidate can share a stable version number.
45
+ CI artifacts include the same identity information and their run result.
46
+
47
+ ## 2. Native setup and one-shot Run
48
+
49
+ Use a clean Linux VM outside the repository with Docker and a supported Pi or
50
+ Codex installation. macOS support requires its own real-host acceptance; a Linux
51
+ CI pass does not establish it. Follow [Quickstart](../en/quickstart.md) for host
52
+ configuration. Use a fresh user-owned prefix and AnySwarm configuration directory.
53
+
54
+ ```sh
55
+ export PATH="$HOME/anyswarm-test/bin:$PATH"
56
+ export ANYSWARM_CONFIG_DIR="$HOME/anyswarm-test-config"
57
+ npm install -g --prefix "$HOME/anyswarm-test" /path/to/candidate.tgz
58
+ anyswarm --version
59
+ anyswarm
60
+ anyswarm setup
61
+ anyswarm doctor --smoke
62
+ ```
63
+
64
+ For the current CLI candidate, bare invocation must print the Quickstart and
65
+ exit 0 without creating project state. Setup and the controlled smoke must
66
+ verify Sandbox lifecycle, Worker, Bridge, file export and deletion. The automated
67
+ Release workflow also runs the installed Quickstart and first SDK Harness with
68
+ a local controlled model; it does not need a paid model account.
69
+
70
+ For a manual model-backed Run, use an already authorized provider configuration
71
+ and budget, then create a fresh project:
72
+
73
+ ```sh
74
+ mkdir "$HOME/sample-project"
75
+ cd "$HOME/sample-project"
76
+ printf '# AnySwarm release smoke\n' > README.md
77
+ anyswarm --harness subagents --prompt 'Read README.md and report its heading.' --output-dir ./runs
78
+ anyswarm trace --root ./runs --port 8787 --open
79
+ ```
80
+
81
+ The saved result must contain the expected heading and a successful cleanup
82
+ receipt. Check terminal milestones, the final heading exactly once, artifact/report paths and the Trace command.
83
+ Inspect the same Run, Agent and exported artifacts in the Viewer, and verify
84
+ that its Sandbox is gone. Use a loopback SSH port forward when the VM has no
85
+ browser. Keep raw prompts and Run output private.
86
+
87
+ ## 3. Eject, edit and rerun
88
+
89
+ Export into an empty directory outside the input project, install its local SDK,
90
+ and run the emitted TypeScript source.
91
+
92
+ ```sh
93
+ anyswarm eject example --dir "$HOME/editable-harness"
94
+ cd "$HOME/editable-harness"
95
+ npm install
96
+ npm exec -- anyswarm run ./harness.ts --prompt 'Verify the exported Harness' --output-dir ./runs
97
+ ```
98
+
99
+ Verify the SDK archive digest against `anyswarm-source.json`. Check the report
100
+ for completed work and cleanup. Change the greeting in `business.ts` and rerun;
101
+ the report must contain the edited greeting. Upgrade the global CLI separately
102
+ and verify that this exported project's local start command still uses its
103
+ original archive dependency.
104
+
105
+ The authoring example completes without creating a Runtime. Open its actual
106
+ report directory with the project's installed `anyswarm trace` and verify its
107
+ greeting, outcome and cleanup in Files & results. The Viewer must not invent a
108
+ Runtime timeline or Agent metrics for this report. Start the Viewer against a
109
+ fresh default state root before a Run exists; after a Run is saved, its row must
110
+ appear automatically while the page is visible. Check a report deep link again
111
+ after a matching Runtime arrives, and retain the original URL until the user
112
+ chooses the Runtime link.
113
+
114
+ The installed first-Harness gate in `test/first-harness-installed.test.ts` also
115
+ copies the candidate's four original TypeScript files into a directory without
116
+ compiled neighbours. Its `source-rpc` route must reach the real Pi Worker,
117
+ answer the channel question and verify the exported bytes through CLI RPC. The
118
+ release workflow enables this route using
119
+ `ANYSWARM_FIRST_HARNESS_CANDIDATE_DIRECTORY`; an ordinary Core test run without
120
+ that installed environment skips it and does not establish real-Worker acceptance.
121
+
122
+ ## 4. Upgrade an existing installation
123
+
124
+ Use a separate disposable npm prefix and configuration directory. Install the
125
+ previous stable version and run setup with it. Record the version and preserve
126
+ a byte-for-byte copy of its `opensandbox.json` connection settings.
127
+
128
+ Install the candidate archive with npm into that same prefix. Verify the new
129
+ version and compare the connection settings before running setup again. With
130
+ the candidate CLI, run `anyswarm update`: it should print the npm update command
131
+ for the installation scope without silently changing the installed package or
132
+ configuration. Do not assume an older release implements this newer behavior.
133
+
134
+ Run `anyswarm doctor --smoke` against the existing connection and verify Worker
135
+ export and deletion. If the package requires a Worker rebuild, record the first
136
+ result and follow the reported remedy. For a public stable upgrade, use the
137
+ printed npm command targeting `@anyswarm/core@latest`; for an opted-in preview,
138
+ select `@anyswarm/core@next` explicitly. Preserve the chosen prefix.
139
+
140
+ Stop the Viewer and remove disposable resources after recording acceptance.
141
+ A failed install or upgrade must leave enough evidence to distinguish package,
142
+ configuration, Worker and network failures.
143
+
144
+ ## 5. Check the actual public npm distribution
145
+
146
+ The workflow's post-publication verification downloads the exact registry tarball,
147
+ compares it with the accepted archive, and installs the exact version by name
148
+ in a clean consumer and isolated global prefix. It checks the SDK root import
149
+ and CLI version. Metadata availability is not an installed-user result.
150
+
151
+ For an already published candidate, repeat only verification with the actual
152
+ recorded values:
153
+
154
+ ```sh
155
+ ARCHIVE=/absolute/path/to/verified.tgz VERSION=0.6.0-next.47107907008.g070b025305af DIST_TAG=next node .github/verify-npm-release.mjs
156
+ ```
157
+
158
+ Next publication must leave `latest` unchanged. Stable publication must match
159
+ the intended supported release. Resume a delayed public-registry check with the
160
+ same version and archive; do not overwrite published bytes or increment the
161
+ version solely for propagation delay. See
162
+ [release recovery](release-and-docs-versioning.md#failure-and-retry-rules).
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
 
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: AutoResearch
3
+ description: 独立 Peer 协作研究、共享补丁互评,并使用可配置的模型与预算完成 FrontierCS-2 官方评测。
4
+ section: APPLICATIONS
5
+ order: 9
6
+ ---
7
+
8
+ AutoResearch 是基于同一套 SDK 构建的有限研究应用。平级 Peer 在独立 Sandbox 中选择方向、提出 Patch,并查看和 Review 其他成员的候选。宿主负责共享 research Service、预算和 Evaluator。见[应用 README](../../examples/autoresearch/README.md)与[实现手册](../architecture/28-autoresearch.md)。
9
+
10
+ ## 应用交付什么
11
+
12
+ 输入包括目标工程、研究目标、评分方向、预算与可信评测代码。Peer 获得工作副本,通过研究 Service 共享候选发现。宿主在评测前冻结候选,评测结果绑定到具体候选身份,而不是接受 Agent 自报的分数。
13
+
14
+ 结果保留候选作者与哈希、Review、已受理的训练评测、候选选择、最终评测与清理状态。用 `anyswarm trace --root ./runs` 关联检查这些记录。有效但低分的候选、无效候选和没有候选的 Run 是不同结果;Review 意见也不等于 Evaluator 结果。
15
+
16
+ ## 运行 FrontierCS-2 官方任务
17
+
18
+ 随附案例使用固定版本的 `binary_fuse_filter`。需要包含 [#359](https://github.com/AnySwarm/anyswarm/pull/359) 的 AnySwarm 构建、Linux x86-64 宿主、Git LFS、Python 3、启用 containerd 镜像存储的 Docker Engine 和 Buildx,以及启用 `dns+nft` 出站约束且完成鉴权的 OpenSandbox。先为选定的执行器准备 Worker,再配置支持的模型。[安装与后端要求](../../examples/autoresearch/README.md#1-install-and-choose-your-backend)
19
+
20
+ ```bash
21
+ anyswarm eject autoresearch --dir ./research-demo
22
+ cd ./research-demo
23
+ npm install
24
+ # 配置自己的模型凭证,按需编辑 frontiercs2-config.ts。
25
+ npm exec -- anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts --check
26
+ npm exec -- anyswarm run ./prepare-demo.ts --config ./frontiercs2-config.ts
27
+ npm run start -- --config ./frontiercs2-config.ts \
28
+ --prompt 'Run the FrontierCS-2 task.' --output-dir ./runs
29
+ ```
30
+
31
+ 模板提供两名 Peer、12 分钟共享工作窗口、4 次 train 受理和全队最多 128 次新模型请求。`--check` 检查依赖、路由和资源容量,模型推理由实际运行触发。准备阶段构建官方评测镜像并运行独立的无模型 reference。[资源与参考评测要求](../../examples/autoresearch/README.md#3-check-and-prepare)
32
+
33
+ 其他项目可提供 `ResearchConfiguration` 和可信的 `train`、`final` 回调。候选代码在 Evaluator 自有的隔离环境中运行,基线材料和评分规则由宿主独立确定。[自定义工程与评测器](../../examples/autoresearch/README.md#use-your-own-project-and-evaluator)
34
+
35
+ ## 已记录的验收证据
36
+
37
+ - 本机四 Peer 使用 GPT-6.1 Sol,独立 final **53.071242 / strict PASS**。记录绑定了候选字节、官方 train 和 final 载荷,并确认资源清理。[四 Peer 证据](https://github.com/AnySwarm/anyswarm/pull/359#issuecomment-7383137655)
38
+ - 本机两 Peer 使用 GPT-6.1 Sol,得到合法的独立 final,分数 **51.564952**,官方参考比较为 **strict FAIL**。记录包含跨 Peer 互评、派生候选,以及 Runtime 和 Evaluator 各自的清理。[两 Peer 证据](https://github.com/AnySwarm/anyswarm/pull/359#issuecomment-7384158140)
39
+ - 全新 Debian VM 完成安装和官方镜像构建,并进入官方 reference 评测。QEMU-TCG 环境中的 train 和 final 均触及限时。[VM 证据](https://github.com/AnySwarm/anyswarm/pull/359#issuecomment-7384227687)
40
+
41
+ 官网的 `release-notes` 测试素材用于展示 Trace 操作。研究成绩来自上面单独链接的真实运行。如需先用较少依赖了解 SDK,可阅读[第一个 Harness](first-harness.md)或[并行 Swarm](build-your-harness.md)。
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: 烧掉 1000 亿 Token 后,我们在多智能体集群上踩过的坑与解法
3
+ description: 为什么大规模多智能体系统总在运行 1 小时后崩盘?以及为什么 AnySwarm 选择将最小沙箱 Runtime 与用户空间 Harness、宿主管控 Service 及面向 Coding Agent 的可观测性彻底解耦。
4
+ section: 深度文章
5
+ order: 1
6
+ ---
7
+
8
+ > **核心观点:** 让你的 Coding Agent 去写协作 **Harness**;永远不要让它从零手搓底层 **Runtime**。
9
+
10
+ ## 1. 烧掉 1000 亿 Token 换来的教训
11
+
12
+ 在费马大定理形式化验证完成后不久,我们团队尝试用大规模多智能体集群(Agent Swarms)去冲击更难的形式化数学与工程问题。当时的直觉很自然:单个编码和推理 Agent 已经足够强了,只要把几十个 Agent 并行堆上去,理应能突破单会话的能力上限。
13
+
14
+ 结果我们一路撞墙。叫停时,已经烧掉了 **1000 亿(100B)Token**——依然失败。
15
+
16
+ 击垮我们的并不是单个模型写不出证明策略或改不好模块,而是当一次运行拉长到 1 小时以上时,**发生在 Agent 之间的所有系统级失控**:三只 Agent 读着同一份共享状态,却各自独立花二十分钟提交了字节级一模一样的错误方案;一只 Agent 证伪了某个诱人假设,一小时后下游 Agent 仍在沿着过时上下文继续构建;容器在清理阶段超时,直接抹掉了几小时尚未落盘的成果。
17
+
18
+ 更痛苦的是迭代成本。每当我们发现协作策略不对——比如想从平级抢单改成“拆解 + 集成”分工——就不得不把底层的容器胶水、会话生命周期、工具权限和状态同步整套推倒重写。而当多小时运行陷入停滞,面对几百 MB 混杂在一起的日志,不管是人还是 Coding Agent 都答不出最基本的问题:*集群卡死是因为任务拆分太粗,还是队列锁死了?海量跨 Agent 对话到底产出了有效进展,还是只是在原地空转烧 Token?*
19
+
20
+ 回看过去一年的开源生态:单智能体架构已经高度收敛——像 **Pi**(极简 `read / write / edit / bash` 内核)与 **DeepSeek Harness** 证明了跑好一个 Agent 不需要臃肿框架。但只要迈入**多智能体集群**,整个生态瞬间碎裂,每个人都在为测试一个协作想法而从零重造一套脆弱的分布式运行时。
21
+
22
+ **AnySwarm** 正是从这些伤疤里长出来的。它不是又一个“大一统编排框架”,而是沿最清晰的边界切开两层:**怎么隔离与运行一群 Agent(Runtime)**,以及**怎么组织它们协作(Harness)**。
23
+
24
+ ![图 1:Harness 定义协作策略,Runtime 统一管理隔离 Agent 会话与宿主管控 Services](../../../website/public/blog/anyswarm-system-architecture.png)
25
+
26
+ *图 1:Harness 定义协作策略,同一套 Runtime 管理隔离的 Agent 会话并管控共享 Services 访问。Agent 档案与 Service 状态各自独立可查,沙箱销毁严格发生在导出确认之后。*
27
+
28
+ ---
29
+
30
+ ## 2. 拆解开源多智能体系统:Runtime 与 Harness 的天然分界线
31
+
32
+ 过去一年最受关注的三个多智能体系统——**SwarmChat**、**ScaleMAS** 与 **DeepSeek Super-agent**——表面上南辕北辙:
33
+
34
+ - **SwarmChat** 把协作建模成给 Agent 用的 Slack 频道、线程与角色策略;
35
+ - **ScaleMAS**(FAIR & Harvard)彻底抛弃群聊和中心协调者,让 128 个异步 Agent 只通过共享引文库(`Publish` / top-*k* `Search` / `Visit`)交互;
36
+ - **Super-agent** 面向持续的人机与 GitHub 协作,用常驻 Router 会话按需派发静默的后台 Worker。
37
+
38
+ 但剥开表层抽象,它们底层依赖的是**完全相同的执行原语**:每个参与者本质上都是一个**拥有本地基础工具、运行在独立环境中的有状态单 Agent 会话**,需要按需拉起(`spawn`)、空闲时不烧 Token 的长会话保持、执行中途纠偏或中断(`send` / `interrupt` / `stop`)、不泄露凭据的模型与工具网关,以及防丢产物的可靠导出清理。
39
+
40
+ 真正让它们形态迥异的魔法,全部位于上层——即**共享状态如何建模**与**外层循环如何调度回合**。AnySwarm 正是沿着这条缝把系统切开:把同质化的基础设施沉入 **Runtime**,把富有表达力的协作契约留在用户空间的百行 **Harness** 里。从群聊协作切换到引文图谱,不再意味着重写一套分布式系统,而是替换几百行 TypeScript 宿主代码。
41
+
42
+ ---
43
+
44
+ ## 3. 用宿主 Service 取代裸 A2A:未来的软件是写给 Agent 用的 App
45
+
46
+ 很多人的第一直觉是给沙箱里的 Agent 一个 `send_message(peer_id)` 工具,让它们用自然语言自由协商(裸 A2A)。但在长程运行中,无结构 A2A 恰恰是集群失控的温床:并发一高,聊天记录迅速撑爆上下文,更致命的是**自然语言无法强制执行确定性不变量**。Agent A 说“我修好了并且测试通过”,靠自然语言既锁不住共享资源,也校验不了 Schema,更无法保证测试真的跑过。
47
+
48
+ 这促使我们形成了一个核心判断:**未来我们编写的大多数软件,本质上都是写给 Agent 使用的微应用(Agent-Native Apps)。** 当几百个并发 Agent 成为软件的 24/7 主用户时,事务、独占租约、乐观并发、分页限流、权限隔离与客观验证门禁比人类时代更加重要。
49
+
50
+ 因此,AnySwarm 的 Runtime 内核刻意不包含裸 A2A 消息。所有共享状态与外部能力,都抽象为运行在宿主侧的强类型 **Service**(任务池、排行榜、引文库、验证器,甚至聊天室本身)。沙箱内所有调用经过 **Service Bridge**,先验证容器 Token、校验输入输出 JSON Schema、按 Profile 执行 ACL 权限检查,并注入**不可伪造的 `caller` 身份(`agentId`、`profile`、`runtimeId`)**。Agent 无法冒充队友、无法越权写入,也无法靠口头宣言绕过宿主机的真实编译与测试门禁。
51
+
52
+ ---
53
+
54
+ ## 4. 面向规模演进:为什么选择 OpenSandbox 与增量工作区
55
+
56
+ AnySwarm 的默认执行层使用 **OpenSandbox**。生命周期 API 管理沙箱,容器内的 **`execd`** 执行命令和文件操作。本地 setup 使用 Docker,也可连接已有的 OpenSandbox 部署。隔离与出口网络策略由所用部署决定。
57
+
58
+ 在工作区与产物安全上,AnySwarm 在每个沙箱内配对特权轻量监管者(**Worker**)与非特权 **Agent** 进程:
59
+
60
+ - Profile 可使用只读工作区(`writable: false`)。宿主 Service 分配任务后,Harness 可通过 `runtime.files.replace` 授予可写工作区。
61
+ - 清理阶段严格执行 **Stop → Export → Delete**:先停 Agent、导出完整会话与指定产物并落盘核验,确认无误才删沙箱;若导出失败则保留在 `cleanup: pending` 状态等待 `anyswarm recover` 恢复,绝不静默销毁数小时算力。
62
+
63
+ ---
64
+
65
+ ## 5. 为 Coding Agent 而生的双层可观测性
66
+
67
+ 当今绝大多数可观测工具都默认“读日志的是人类”。但在高频迭代 Swarm 的真实日常里,排查失败、定位瓶颈、修改 Harness 的主力工程师其实是你手里的 **Coding Agent**。
68
+
69
+ 把几十个 Agent 跑几小时产生的几百 MB 数据塞进一个扁平 `events.jsonl`,瞬间就会撑爆 Coding Agent 的上下文。因此 AnySwarm 把每次运行的产物目录(`outputDir/<runId>/`)天然拆成**两层交叉索引的结构**:
70
+
71
+ 1. **按 Agent 分区的执行档案**(`<runtimeId>/<agentId>/` + 脱敏模型轨迹 `model-trace/`):Coding Agent 先看全局摘要,精准锁定异常成员后再按需钻取单只 Agent 的轨迹;
72
+ 2. **独立的 Service 记录**(`service-calls.jsonl` 与可选状态导出):Coding Agent 可核对调用、队列和租约。业务状态能否恢复取决于 Service 及其存储。
73
+
74
+ 当人类需要直观复盘时,同一份目录用零依赖内置浏览器 **[Trace Viewer](../trace-viewer.md)**(`anyswarm trace`)即可秒开并行泳道、Service 交接与导出 Diff。
75
+
76
+ ![图 2:按 Agent 分区的执行档案与独立 Service 记录提供互补的双层运行视角](../../../website/public/blog/anyswarm-run-observability.png)
77
+
78
+ *图 2:按 Agent 分区的执行档案与独立 Service 记录提供互补的双层视角,支持从运行总览精准钻取到单只 Agent 及其关联证据。*
79
+
80
+ ---
81
+
82
+ ## 6. 同一套未改动 Runtime 上的参考 Harness
83
+
84
+ 为了验证 Runtime 与 Harness 解耦的表达力,我们在同一套未改动的 `@anyswarm/core` Runtime 上构建了多组正交参考 Harness(通过确定性 CLI、TypeScript SDK 或 JSONL RPC 驱动,不绑定重型终端 UI):
85
+
86
+ | 参考 Harness | 输入 | 协作拓扑 | 宿主职责 |
87
+ | --- | --- | --- | --- |
88
+ | **`autoresearch`**(头牌无交互 Showcase) | 目标代码 + 评分器 | 无中心 Peer 集群围绕客观指标并行演化 | 候选归属、成员互评与评测 |
89
+ | **`code`** | 代码仓库 + 任务 Spec | 隔离委派 + 宿主机确定性测试门禁 | 工作区捕获、按配置执行检查和应用补丁 |
90
+ | **`super`** | GitHub / 外部事件流 | 宿主机常驻 Router + 最小权限短生命周期沙箱 | 限定 GitHub 访问范围和批准 Draft PR |
91
+
92
+ 此外仓库还内置了 5 种精简参考拓扑——[Subagents](../harnesses/subagents.md)、[TaskPool](../harnesses/taskpool.md)、[PeerMesh](../harnesses/peermesh.md)、[Substrate](../harnesses/substrate.md) 与 [Lead-Worker](../harnesses/lead-worker.md)——全部共用同一底座。
93
+
94
+ ---
95
+
96
+ ## 7. 开始上手
97
+
98
+ 随着模型越来越强,让你的 Coding Agent 读取 `@anyswarm/core` 与内置 `AGENTS.md` 去编写和迭代上层 Harness 已经足够便宜;真正不该每次从零重写的,是底层的隔离运行与可观测底座。
99
+
100
+ - **快速上手:** [安装与首次运行指南](../quickstart.md)
101
+ - **免安装体验:** [在线交互式 Trace Viewer 演示](https://anyswarm.github.io/anyswarm/trace-demo/)
102
+ - **GitHub 仓库:** [https://github.com/AnySwarm/anyswarm](https://github.com/AnySwarm/anyswarm)