@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
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Service observations
4
4
 
5
+ Recorded files with manifest SHA-256 include that identity on the Files & results link. File pages verify the descriptor identity and compute the next byte offset from complete UTF-8 characters, with up to three lookahead bytes. Copy reads the text currently shown, including appended pages. Static replays distinguish the end of the cached preview from the end of the original file.
6
+
5
7
  The Reader indexes `service-calls.jsonl` and every `service-calls-recovery-<epoch>.jsonl` in the same Run. Each call keeps its recorded caller, operation and attempt identity. Its inspector includes a Service state section and links the original state file. The Run header also lists indexed Service exports. These links use the existing record/file routes and retain the Reader's path, symlink and hard-link checks.
6
8
 
7
9
  Runtime close and Service retirement export optional public state after the Service's admission gate has closed and its calls have drained, before lifecycle shutdown. `exportServiceStates` appends one record per Service to `service-states.jsonl`, including Services without an export hook. Each record identifies the Service and available instance identity, the framework export start/end window, and one of `not-provided`, `exported`, `failed` or `truncated`. Successful files use unique `service-state.<serviceId>.<uuid>.json` names so a later restart, retirement or recovered controller can add evidence without overwriting the earlier export. Every record and state file is private to the Host filesystem and passes through the Runtime redactor.
@@ -16,13 +18,21 @@ The persistent Board example in `examples/services/persistent-board/` owns its S
16
18
 
17
19
  ## Process and read boundary
18
20
 
19
- The built-in Trace Viewer under `src/trace-viewer/` is served directly by `anyswarm trace` inside `@anyswarm/core` with zero additional runtime dependencies. Selecting `trace` lazily loads `src/trace-viewer/command.mjs`, the reader, and the loopback HTTP server. A Run root is required via `--root <dir>` or as the first positional argument, and `--port` defaults to 8787. Port 0 asks the OS to select an available port. `--open` opens the local URL in the host browser when not running inside an SSH session. The server binds IPv4 loopback (`127.0.0.1`) and prints its URL; when an SSH session is detected (`SSH_CONNECTION` or `SSH_CLIENT`), it also prints an `ssh -N -L` example using the bound port and a placeholder alias. Supply the SSH destination, port and jump options used to log in from the browser machine. The SSH server-side address can be private to a VM or proxy. Run the Viewer on the machine with the Run files and forward the port with the browser machine's SSH client. `runTraceCommand(args)` accepts the arguments after `trace`, prints the listening URL and returns a close handle that `scripts/anyswarm.ts` binds to process signals.
21
+ The built-in Trace Viewer under `src/trace-viewer/` is served directly by `anyswarm trace` inside `@anyswarm/core` with zero additional runtime dependencies. Selecting `trace` lazily loads `src/trace-viewer/command.mjs`, the reader, and the loopback HTTP server. The root precedence is explicit `--root <dir>`, first positional argument, then `${XDG_STATE_HOME:-$HOME/.local/state}/anyswarm/runs`. `run-root.mjs` supplies that default to the Viewer, standard Harness output preparation and the terminal replay command; its declaration file supplies the TypeScript contract. An explicitly empty root is rejected. A Harness using a custom output root or a private temporary fallback needs the actual root printed at completion. Direct `createRuntime()` callers still supply `outputDir` and select it with `--root`.
22
+
23
+ The server can start before its root exists. Its list API returns an empty list with `rootStatus: "missing"` until a later scan sees the directory; a readable empty directory has `rootStatus: "ready"`. The page shows the actual configured root in either state. A file in place of the root is an error, and a root permission failure returns 403 rather than an empty successful list. Each discovery canonicalizes the root again, so a newly created root is picked up without restarting. `--port` defaults to 8787; port 0 asks the OS to select an available port. `--open` opens the local URL in the host browser when not running inside an SSH session. The server binds IPv4 loopback (`127.0.0.1`) and prints its URL and resolved root. When an SSH session is detected (`SSH_CONNECTION` or `SSH_CLIENT`), it also prints an `ssh -N -L` example using the bound port and a placeholder alias. Supply the SSH destination, port and jump options used to log in from the browser machine. Run the Viewer on the machine with the Run files and forward the port with the browser machine's SSH client. `runTraceCommand(args)` returns a close handle that `scripts/anyswarm.ts` binds to process signals.
20
24
 
21
25
  Each browser request must use a loopback Host header. Browser cross-site requests and differing Origins are rejected. The viewer serves GET, with no cross-origin sharing or runtime mutation surface. Records are inserted into the DOM as text. The browser's content security policy restricts loaded assets and connections to the viewer origin. SIGINT and SIGTERM close the listener and active connections. The viewer can start after the Harness has exited, model access has ended, and its Sandboxes have been deleted.
22
26
 
23
27
  ## Reader and API
24
28
 
25
- The reader discovers `runtime.json` in the configured directory and its nested Run output directories. It caches a rebuildable in-memory metadata index per opened Run and retains the Runtime identity plus each indexed record's relative file and byte or line reference. The reader decodes schema 1, including the historical `bots`, `botId` and `environment-report.json` fields and current `agents`, `agentId` and `harness-report.json` fields. Legacy records without native timing or archive data expose those gaps. Unknown Service operations keep their generic identities and raw evidence. A model result with a different Runtime ID records a `runtime-mismatch` gap without closing the local request or advancing the result file's cursor. A corrected result is indexed on a later refresh and delivered once when resuming a cursor issued during rejection, whether the corrected file is shorter, longer or the same size.
29
+ The reader discovers `runtime.json` and `project-run.json` in the configured directory and nested output directories, to depth five and at most 10,000 combined discoveries. It skips hidden directories, dependency and artifact subtrees, and does not follow symlink directory entries. A Harness report must have a Run ID equal to its directory basename, `harness.apiVersion: 1`, a nonempty Harness ID and a completed, failed or cancelled outcome. This includes a failure before Runtime creation and a successful Harness which never creates a Runtime. Malformed, oversized or inaccessible optional reports do not hide valid Runtime evidence.
30
+
31
+ Runtime rows keep their existing relative-path IDs. Harness report IDs occupy the distinct `/harness/<relative-directory>` namespace, with `/harness` reserved for a report at the configured root. These are opaque URL-encoded route segments, not file paths; a nested directory with the root's basename cannot replace the root report. The reader hides a report row only when its explicitly recorded `result.runtimeId` or `cleanup.receipt.runtimeId` consistently identifies exactly one Runtime across the scan, and that Runtime is a direct child of the Harness directory. Conflicting identities, duplicate Runtime IDs or an unrelated directory leave both records visible with an association explanation. The report ID continues to resolve after deduplication, preserving old deep links and exposing an explicit link to the matching Runtime. A Runtime can inherit the parent business outcome only through that same unique association.
32
+
33
+ The reader caches a rebuildable in-memory metadata index per opened Runtime and retains the Runtime identity plus each indexed record's relative file and byte or line reference. It decodes schema 1, including the historical `bots`, `botId` and `environment-report.json` fields and current `agents`, `agentId` and `harness-report.json` fields. Legacy records without native timing or archive data expose those gaps. Unknown Service operations keep their generic identities and raw evidence. A model result with a different Runtime ID records a `runtime-mismatch` gap without closing the local request or advancing the result file's cursor. A corrected result is indexed on a later refresh and delivered once when resuming a cursor issued during rejection, whether the corrected file is shorter, longer or the same size.
34
+
35
+ A report-only summary projects the saved outcome, full JSON result, reason, failure, artifact references, export, verification and cleanup evidence. An absent fact remains not recorded or unknown. The page opens Files & results and hides Runtime-only tabs, times, Agent counts and activity metrics. It does not turn absence of a Runtime into zero duration, zero cost or successful cleanup. Only `project-run.json` enters this report's file allowlist; artifact paths mentioned inside the report do not grant file access. The same regular-file, single-link, symlink, descriptor-path and 8 MiB metadata limits apply to discovery and rereads. Empty event/timeline responses contain no invented records; an evidence detail or focus request for a nonexistent record returns 404.
26
36
 
27
37
  The reader allows file access to discovered evidence. Raw detail rejects an invalidated source identity after truncation, replacement or changed record bytes. It rejects path escapes, symlinks, hard links and non-regular files. On Linux the Viewer checks the opened descriptor's path via `/proc/self/fd`. On macOS opening uses Darwin's `O_NOFOLLOW_ANY` and verifies the opened descriptor's path using `fcntl(F_GETPATH)` through the system Perl helper, without passing the original path or its bytes to the helper. An unverified path (including a helper failure or two-second timeout) is refused, and the descriptor is closed. The returned absolute path must stay under the canonical Run root on both platforms. Browsers connect over HTTP from any OS. See [Runtime evidence and Harness reports](17-harness-reporting.md) for producer details.
28
38
 
@@ -30,8 +40,8 @@ All routes are relative to the viewer origin. Run and record IDs are URL-encoded
30
40
 
31
41
  | GET route | Data |
32
42
  | --- | --- |
33
- | `/api/runs` | Run summaries discovered below the root |
34
- | `/api/runs/:id` | Runtime identity, Agent lanes, whole-Run activity counts, bounded intervals, collaboration, status, gaps and file references |
43
+ | `/api/runs` | `{runs, root, rootStatus}` with Runtime rows and unassociated Harness reports |
44
+ | `/api/runs/:id` | Runtime evidence summary or a `kind: "harness"` summary of the saved report |
35
45
  | `/api/runs/:id/events` | Paged record metadata, filtered by `agentId`, `type` and `query` before pagination, limited to 1,000 per page |
36
46
  | `/api/runs/:id/timeline` | Up to 1,000 entries intersecting optional epoch-millisecond `from`/`to` bounds and `agentId`; `focus` locates an original record |
37
47
  | `/api/runs/:id/records/:recordId` | A selected source record or explicit relation, with current file and cross-record evidence |
@@ -40,7 +50,9 @@ All routes are relative to the viewer origin. Run and record IDs are URL-encoded
40
50
 
41
51
  The event API cursor is opaque. Start with no cursor and pass the returned cursor to request the next page; restart pagination when a filter changes. `total` counts all records matching the current filters, while `runTotal` counts all indexed Run records. Scanning advances past nonmatching records and sets `hasMore` only when another matching record exists. The browser uses pages of 250 in Events and 25 for Timeline search. `query` is a case-insensitive substring of indexed names and identities, limited to 256 characters. Search covers event/tool names, Service and operation names, Agent ID/label/Profile, model name, and request/input/operation IDs. The reader retains at most 256 characters of the additional Service, operation, tool and model names. For generic Service dispatch, `input.tool` is indexed at the start and carried to the matching settled record. Arbitrary arguments, prompt text and response/SSE bodies are not searched or downloaded for a query; their original contents remain available in the selected record inspector.
42
52
 
43
- For live subscriptions the server pulls up to 250 new records per batch, then waits 500 ms once it reaches the indexed tail. SSE includes an event ID suitable for `Last-Event-ID`. On reconnect that header takes precedence over the query cursor. Quiet streams get a `refresh` event every ten seconds so the browser can pick up report and archive changes. The listener waits for a slow client to drain its response before sending another batch. New complete JSONL lines are indexed incrementally and incomplete trailing lines wait for their newline. With Follow live enabled, active searches refresh their current page and full matching count, including newly appended names; unfiltered Events can follow the bounded tail. A live summary first updates the timeline's time domain, extending a full-range window while preserving a zoomed range, then requests that window so its new tail arrives in the same update. Run changes and new searches invalidate older browser responses. The index has no file writes in the source Run.
53
+ The visible browser page refreshes the Run list about two seconds after the preceding request completes. Manual refresh joins an in-flight request instead of overlapping it. Visibility and page lifecycle events pause and resume polling. An unchanged list keeps its DOM; a changed list preserves selection, keyboard focus and list scroll without reopening the current Runtime or resetting its view, search, filter or time window. A list error remains visible beside the last successful data. An open report-only view refreshes its summary through the same cycle, retaining file/action focus and its original URL after association. A generation check prevents a stale report response from replacing a newly selected Runtime.
54
+
55
+ For a selected Runtime, live subscriptions continue to use the existing SSE path independently of list discovery. The server pulls up to 250 new records per batch, then waits 500 ms once it reaches the indexed tail. SSE includes an event ID suitable for `Last-Event-ID`. On reconnect that header takes precedence over the query cursor. Quiet streams get a `refresh` event every ten seconds so the browser can pick up report and archive changes. The listener waits for a slow client to drain its response before sending another batch. New complete JSONL lines are indexed incrementally and incomplete trailing lines wait for their newline. With Follow live enabled, active searches refresh their current page and full matching count, including newly appended names; unfiltered Events can follow the bounded tail. A live summary first updates the timeline's time domain, extending a full-range window while preserving a zoomed range, then requests that window so its new tail arrives in the same update. Run changes and new searches invalidate older browser responses. The index has no file writes in the source Run.
44
56
 
45
57
  ## Timeline and evidence inspection
46
58
 
@@ -52,12 +64,14 @@ The default summary selects up to 1,000 entries across intervals and points **af
52
64
 
53
65
  Panning or zooming debounces a `/timeline` query for the displayed range, and Agent filtering applies before the 1,000-entry bound. Responses report the matching `total`, `truncated` flag and limit. The UI explains when a range contains more entries than it draws and suggests zoom or full-Run search; the minimap and Sequence view represent the currently loaded bounded entries. Timeline search uses the same full-Run metadata query as Events, rather than filtering only those entries. Selecting a match requests `/timeline?focus=<recordId>`, finds its original interval through the evidence IDs, and loads a surrounding time range before opening the exact source record. Both model request and result records link to their shared interval. A raw observation with a timestamp but no paired interval stays a point. If a focused range itself has over 1,000 entries, the selected entry is retained inside that bound. Records without a timestamp open in the inspector without inventing a time. Invalid bounds or queries return 400; an unknown focus ID returns 404. No body scan is needed to locate a result.
54
66
 
55
- Clicking an interval, point or event opens its associated source records in a Structured / Raw JSON evidence inspector. Clicking a collaboration link opens its evidence and model-context matches. Files and report contents are retrieved only when selected. The Run status, business outcome and cleanup receipts are distinct views. For a project CLI Run, the reader also checks for `project-run.json` in the Runtime directory’s parent, provided that parent is inside the configured Viewer root. The report must match the parent directory’s Run ID and the discovered Runtime ID. Files & results displays the Harness outcome, bounded textual business output or failure and the Harness cleanup status. The Runtime cleanup remains in the Runtime header. The parent report is read through the existing file boundary and is excluded from the file download list. Missing, unreadable or mismatched reports fall back to the per-Runtime Harness or legacy environment report. If those are absent, the business result remains unknown.
67
+ Clicking an interval, point or event opens its associated source records in a Structured / Raw JSON evidence inspector. The inspector wraps its header controls when the pane is narrow so the close button remains clickable. Clicking a collaboration link opens its evidence and model-context matches. Files and report contents are retrieved only when selected. The Run status, business outcome and cleanup receipts are distinct views. For a uniquely associated project CLI Run, Files & results retains the parent report's full JSON result, reason, failure and artifact references alongside the existing bounded textual business preview, export, verification and Harness cleanup status. The Runtime cleanup remains in the Runtime header. The parent report is read through the existing file boundary and stays excluded from the Runtime file download list. Its own report deep link permits only its report file. Missing, unreadable or mismatched reports fall back to the per-Runtime Harness or legacy environment report. If those are absent, the business result remains unknown.
56
68
 
57
69
  The execution layer uses native `agent_start` and `agent_settled` observations for intervals. Each boundary retains its timestamp source. Agent input admission, readiness and settlement observations remain separately visible. A Run with no native start evidence can still show actual recorded model and Service activity. An accepted input does not establish execution or consumption. Unknown records, missing edges and ledger or Worker trace gaps remain explicit.
58
70
 
59
71
  Subagents links use authenticated caller and parent or destination identities, and matching request, input, operation or message IDs where the records supply them. For a returned child result, the reader matches the archived destination Session envelope to the original accepted Core input and the child's original event sequence. This relationship becomes available when the destination Session archive is readable. A message receipt is independent of evidence that its payload entered the recipient's model context. Selecting the handoff checks structured message identities in the recipient's saved model inputs and links the original requests. This lookup reads at most 8 MiB per candidate request and skips unavailable or larger bodies. Inspect the model request and final artifact or checker result separately to assess adoption. All other Service operations remain inspectable as generic calls.
60
72
 
73
+ The Research track uses the AutoResearch journal to link matching recorded candidate IDs and SHA-256 values, including the parent version for a derivative. The inspector shows up to 100 related records in chronological order. It reserves places for publication, train and final evidence on the inspected versions before filling the list with descendant and peer activity. When it omits records, the inspector displays the total and points to full-Run search by patch hash. Patch downloads still verify the file against the recorded identity. [AutoResearch Trace evidence](28-autoresearch.md#trace-evidence)
74
+
61
75
  The [offline demo](../operations/trace-viewer.md#replay-the-included-demo) exercises this path with a synthetic Subagents Run. The same reader opens the fixture's Core ledger, Service calls, raw model exchanges, Session archives and final file directly from disk.
62
76
 
63
77
  The reader regressions include a synthetic Run with 2,005 model intervals and tools/Services at both ends, mixed query/Agent/type pagination across 250-record pages, appended matching records, historical Session tools, and bounded focus lookup. HTTP tests exercise query forwarding, invalid bounds and a record beyond the initial page. These fixtures verify retrieval behavior without executing a model or reproducing a private research Run.
@@ -122,7 +136,7 @@ An optional `collaboration` object in a matching Harness report or project resul
122
136
 
123
137
  The timeline initially aggregates mapped instances into member lanes. Clicking a member header selects that member and expands its instance lanes. The identity-view selector switches between member groups and instances. Both counters stay visible. Original activities retain their original Agent IDs, selection IDs and raw links. Collaboration lists expand members into their instance UUIDs, timestamps, known reasons and spawn evidence references. Unrecorded reasons display unknown.
124
138
 
125
- A relation has an application identity, a fact kind (`published`, `read`, `handoff`, `adopted` or `business-accepted`), source and destination member IDs, an object `{id, version}`, optional time/check text and evidence references. A Service reference supplies Service ID, operation, operation ID and caller Agent ID. The Reader indexes successful Service outputs by these identities, checks the participants, and checks the recorded output object/version. The Messages object is its key and SHA-256 of its exact text. Other versioned outputs may supply explicit `id`/`version` fields. A file reference supplies a manifest path and matching SHA-256. Opening a relation refreshes its detail through the record endpoint. The Reader rebuilds archive references from the current manifests on refresh. It checks each referenced regular file against the manifest size and SHA-256 under the read boundary. For summaries it reuses a digest result only while the file device, inode, size, link count and nanosecond modification and change times remain the same. Replaced, missing and unreadable evidence receives a distinct status and no link. The historical business claim and its recorded check remain visible. A file link carries its SHA-256 identity. Each requested range hashes the whole open descriptor in fixed-size chunks and retains only the requested bytes from that pass. A version mismatch returns 409, and a missing file returns 404. A sanitized static preview whose bytes changed cannot be used as exact file evidence. An unreferenced source instance remains unspecified. An exact instance reference retains its original Agent identity.
139
+ A relation has an application identity, a fact kind (`published`, `read`, `handoff`, `adopted` or `business-accepted`), source and destination member IDs, an object `{id, version}`, optional time/check text and evidence references. A Service reference supplies Service ID, operation, operation ID and caller Agent ID. The Reader indexes successful Service outputs by these identities, checks the participants, and checks the recorded output object/version. The Messages object is its key and SHA-256 of its exact text. Other versioned outputs may supply explicit `id`/`version` fields. A file reference supplies a manifest path and matching SHA-256. Opening a relation refreshes its detail through the record endpoint. The Reader rebuilds archive references from the current manifests on refresh. It checks each referenced regular file against the manifest size and SHA-256 under the read boundary. For summaries it reuses a digest result only while the file device, inode, size, link count and nanosecond modification and change times remain the same. Replaced, missing and unreadable evidence receives a distinct status and no link. The historical business claim and its recorded check remain visible. A file link carries its SHA-256 identity. Each requested range hashes the whole open descriptor in fixed-size chunks and retains only the requested bytes from that pass. A version mismatch returns 409, and a missing file returns 404. A sanitized static preview whose bytes changed cannot be used as exact file evidence. Sanitized demos omit incomplete structured file previews and omit incomplete or unparsed record bodies while retaining their event and truncation metadata. An unreferenced source instance remains unspecified. An exact instance reference retains its original Agent identity.
126
140
 
127
141
  Publication, a returned Service read, inclusion of a message in a saved model request, application-declared adoption and application business acceptance remain distinct observations. Existing Subagents spawn/message/result matching remains active. Generic adjacent calls keep their original activities.
128
142
 
@@ -35,29 +35,45 @@ For the pinned source and retained-format inventory, see
35
35
 
36
36
  ## GitHub Release distribution
37
37
 
38
- The [release workflow](../../.github/workflows/release.yml) runs verification on manual dispatch or a pushed version tag. It requires a stable package version, checks that any selected tag matches it, and requires the public `AnySwarm/anyswarm` repository for a tag publication. Verification packs the compiled `@anyswarm/core` package and renames the tarball to the existing GitHub versioned asset name `luna-shi-anyswarm-<version>.tgz`. It performs an npm publication dry run, installs that same archive in a temporary consumer, runs the Core suite, and uploads the archive plus a byte-identical `luna-shi-anyswarm.tgz` alias and checksums as a workflow artifact. The installed Quickstart uses the default local-setup path. On a fresh runner, it builds the bundled Worker before testing the candidate with controlled local model responses, so verification can run before any registry publication.
38
+ The [release workflow](../../.github/workflows/release.yml) separates candidate verification, stable publication and opt-in preview publication. Its planning job runs [.github/release-plan.mjs](../../.github/release-plan.mjs) before any publish-capable job. A manual dispatch with both `publish_npm` and `publish_next` off only verifies a candidate. `publish_next=true` requests a preview; `publish_npm=true` retries npm distribution of GitHub Latest. The inputs are mutually exclusive. Either manual publication requires `main` in the public `AnySwarm/anyswarm` repository. A tag publication also requires that repository and an exact `v<source-package-version>` tag. Ordinary CI and main pushes do not publish a package.
39
39
 
40
- The SDK reads its version from the enclosing `@anyswarm/core` package manifest in both the checkout and the compiled install. If neither manifest path can be read, the build's version constant supplies the fallback. Version 0.5.1 continues to use Worker protocol `anyswarm-core-v2`. Local setup prepares a Worker from the installed package's build inputs.
40
+ Verification packs the compiled `@anyswarm/core` package and renames the tarball to the existing GitHub versioned asset name `luna-shi-anyswarm-<version>.tgz`. It records a byte-identical `luna-shi-anyswarm.tgz` alias, `SHA256SUMS` and source commit/run metadata. The temporary consumer install and Core suite use this same archive; `ANYSWARM_TEST_PACKAGE_ARCHIVE` and `ANYSWARM_TEST_PACKAGE_SHA256` keep installed-package tests bound to it instead of rebuilding or skipping them. The installed Quickstart uses the default local-setup path. On a fresh runner, it builds the bundled Worker before testing the candidate with controlled local model responses, so verification can run before any registry publication. Only successful verification enables the publication jobs.
41
41
 
42
- The publication job verifies both archive names and the checksum file. A new tag is staged as a draft and made public after asset verification. Only the highest stable published version becomes GitHub Latest. A retry checks assets for an already published tag. Installed verification prepares the candidate’s Worker from an explicit Pi installation on the runner. A maintainer publishes to npm separately using the same release tarball. [Release procedure](../workflows/development.md#release-verification)
42
+ Preview versions use the next minor version followed by `-next.<workflow-run-id>.g<source-sha-prefix>`, for example `0.6.0-next.123.g0123456789ab` from source version `0.5.2`. The run ID and first twelve source SHA characters identify the candidate; rerunning the same workflow run preserves this version. `npm run pack:release -- <directory> --version <preview-version>` changes only the temporary staging tree. Its production and development manifests and both shrinkwrap files receive the same version, including the lockfile root package entries. The checkout's package version and lockfile remain unchanged. A later stable release may select a patch or minor version independently; a preview does not reserve or publish that stable version. A fresh workflow dispatch produces a distinct preview version.
43
43
 
44
- ### Managed CLI installation and update
44
+ The SDK reads its version from the enclosing `@anyswarm/core` package manifest in both the checkout and the compiled install. If neither manifest path can be read, the build's version constant supplies the fallback. Version 0.5.2 continues to use Worker protocol `anyswarm-core-v2`. Local setup prepares a Worker from the installed package's build inputs.
45
45
 
46
- The official installer selects npm’s global prefix when writable, or the user’s `~/.local`. It uses the GitHub Latest API to resolve a stable tag, downloads the versioned archive and `SHA256SUMS`, then streams the staged file through Node's SHA-256 implementation. A missing or malformed release digest, or a mismatch with the staged bytes, fails before npm runs. An explicit local archive is copied to a private temporary directory and hashed there; the digest records the staged bytes rather than authenticating the local source. Neither path needs a system checksum command. The temporary download is removed when the installer exits. npm installs production dependencies with lifecycle scripts disabled under a unique `<prefix>/lib/anyswarm/versions/release-*` directory. The staged CLI must execute and report the expected package identity and version. A private `install.json` records the package source, digest, prefix and version.
46
+ For a stable tag, the GitHub publication job verifies both archive names and the checksum file. A new tag is staged as a draft and made public after asset verification. Only the highest stable published version becomes GitHub Latest. A retry checks assets for an already published tag. The preview path consumes the verified workflow artifact and does not create a GitHub Release or stable tag. Installed verification prepares the candidate's Worker from an explicit Pi installation on the runner. [Release procedure](../workflows/development.md#release-verification)
47
47
 
48
- The executable symlinks under `<prefix>/bin` resolve through a shared `current` link. The two host aliases both point to `current/node_modules/.bin/anyswarm`. The Worker command `swarm` uses its separate executable. Activation verifies the staged targets and executable permissions before running `anyswarm --version`. A managed archive can omit the npm `anys` entry, as the published v0.5.0 archive did. On Darwin, for that exact verified release archive, the website installer gives its legacy activator a temporary compatibility wrapper that translates its fixed GNU flock call to the equivalent persistent lockf invocation. Activation checks for competing entries and serializes mutations with a Unix file lock: Linux uses `flock`, and macOS uses the system `/usr/bin/lockf -k` so waiters and future activations keep using the same lock file. Both wait up to 15 seconds for the lock before reporting failure. The lock helper signals readiness to the activator and holds the lock until the activator closes the helper's input. It converts the previous managed short link into the common host link when `current` points into the managed versions directory. It can replace existing npm symlinks only when each points to the exact executable under `@anyswarm/core`, the v0.4.1 name `@anyswarm/anyswarm`, or the v0.4.0 name `@luna-shi/anyswarm` in the selected prefix. Activation publishes the fully validated generation with atomic rename of `current`. It restores replaced entries if activation fails and leaves the old package available. The installer reports its actual entry and package root, and prints a PATH command when its bin directory is absent. If GitHub Latest still points to v0.4.0 and no managed generation exists, the installer recognizes that archived scope and uses the original global npm install path.
48
+ ### npm publication
49
49
 
50
- `anyswarm update` verifies that its own package and invoked executable belong to the active managed generation. It resolves the stable version before downloading, returns immediately if the current version is already at least as new, and otherwise stages the checked archive in the same prefix. The candidate-only override accepts `--archive <file> --sha256 <digest>`, including two different archives using the same version. A staged CLI version mismatch, download or npm failure leaves the active generation available. Concurrent managed updates compare the active generation under a Unix file lock. The operating system releases the lock if activation exits. Previous managed generations are retained for active applications and recovery. For a verified global npm installation, update returns `preserved` with the existing version and an `npm install -g --prefix <prefix> @anyswarm/core@latest` command. It exits before resolving a release, staging a package or writing to that prefix. Running the installer explicitly can switch matching npm entry links to the managed generation while retaining the previous package files. For a project or other installation, update reports the installed path and a command for the user to run in its original scope. Project manifests, SDK locks, model configuration and backend programs are outside this update operation. The published v0.5.0 updater on Linux activates only the long alias when it upgrades to v0.5.1. Rerunning the current website installer in the same prefix activates both aliases. On macOS the same installation path uses the new package's platform-specific lock.
50
+ A successful GitHub Release job enables the npm job for a tagged push. A manual dispatch from `main` with `publish_npm` enabled skips the candidate build and goes directly to the same npm job. It reads GitHub Latest, requires a stable tag, and skips a tagged push for an older Release. It downloads the versioned archive, alias and checksum file from the public Release. Both hashes, byte equality and the archive's package name and version must match before the publish step can start.
51
+
52
+ The stable and preview npm jobs use [.github/publish-npm-release.sh](../../.github/publish-npm-release.sh) with an explicit `DIST_TAG` of `latest` or `next`. Stable versions are accepted only on `latest`; the generated prerelease format is accepted only on `next`. The publisher checks the public registry before uploading, refuses to move the selected tag backward, requires a preview to be newer than stable, and preserves the other channel's tag. A version already registered with the candidate's SHA-512 skips the upload; a different digest fails. New versions use GitHub Actions OIDC with GitHub contents read access and token issuance. npm must authorize `AnySwarm/anyswarm` and `release.yml` as a trusted publisher with direct publishing enabled.
53
+
54
+ GitHub stable publication and both npm publication paths share one queued concurrency group, so they cannot race each other's version or tag decisions. The release workflow also queues runs for the same ref. Publication polls for the expected version, selected tag and integrity for up to 15 minutes. A failed `npm publish` command still triggers those checks because the registry may have accepted the archive before its response was lost. Recovery never overwrites an existing version or silently accepts conflicting bytes. An npm failure leaves the GitHub Release available; the stable retry input downloads its existing assets. Rerun a failed preview publication job to reuse its verified artifact. Rebuilding a workflow run can only reuse its version if the bytes still agree with the registry.
55
+
56
+ After either channel is published, [.github/verify-npm-release.mjs](../../.github/verify-npm-release.mjs) fetches the exact version's registry metadata, verifies the selected dist-tag and SHA-512, and downloads a tarball that must equal the verified candidate byte for byte. It then installs `@anyswarm/core@<exact-version>` by registry package name in a temporary project and an independent global prefix, each with a fresh cache and empty npm configuration. Auth and Node loader environment variables are removed from these consumer commands. Verification imports `createSandbox` and `createHarnessSession` from the project SDK and compares both installed CLI versions to the requested version. A public artifact or consumer failure fails the job even if upload succeeded; temporary consumers and caches are removed in `finally`. No model call is needed for these public-package checks.
57
+
58
+ ### npm CLI installation and update
59
+
60
+ The package declares one npm executable, `anyswarm`, which points to the compiled host entry. A global npm install owns both `<prefix>/lib/node_modules/@anyswarm/core` and `<prefix>/bin/anyswarm` on Linux and macOS. A project install makes the same command available at `node_modules/.bin/anyswarm`. The Worker Dockerfile copies the bundled `dist/scripts/swarm.js` and creates its own `/usr/local/bin/swarm` in the image. Agent Service calls use that image-owned link and the existing Bridge authorization.
61
+
62
+ The homepage and stable Quickstart pin the version selected by `website/docs-release.json`; development guides explain `@latest`, opt-in `@next` and source-checkout use separately. Node.js 24 is the recommended development and verification version; the Core engine minimum remains 22.19. npm resolves the registry package, checks its engine declaration, selects its global prefix, and owns installation and link failures. The local tarball path uses `npm install -g --prefix <prefix> <archive>`. Release verification does this outside the checkout, with lifecycle scripts disabled, and compares the installed executable's version to the candidate. The worktree, installed package, and user configuration remain independent.
63
+
64
+ Use `npm install -g @anyswarm/core@latest` for updates and `npm uninstall -g @anyswarm/core` for removal. Run `npm prefix -g` to identify the selected prefix and ensure its `bin` is on PATH. Use a writable prefix for permission errors. The old script-managed releases left links into `lib/anyswarm/current`. Clear only confirmed AnySwarm links when switching those installations to npm.
65
+
66
+ `anyswarm update` prints guidance for the active installation. It reads its package version, verifies that the invoked entry resolves to the global npm package and checks the corresponding `npm root -g` with a ten-second deadline. For a verified global install it reports the existing version, executable and an npm command pinned to that prefix, with result `preserved` and exit status 0. A terminal prints the guidance as text. Piped stdout contains the structured report. For a project or other installation it shows the package location and tells the caller how to use its original installation scope and exits 1. The command does not fetch releases, change packages or change local OpenSandbox configuration.
51
67
 
52
68
  ## Distribution file boundary
53
69
 
54
70
  `package.json` admits the compiled runtime, CLI, examples and explicit installed verification fixtures, their required source and assets, `docs`, the compiler configuration and Docker context exclusions, and the tracked root glossary, Agent instructions, dependency shrinkwrap, environment example and submodule declaration. npm also includes its mandatory package metadata and README. Runtime code, Worker/image preparation inputs, model catalog, prompts/skills, foreground/result scripts and editable example resources remain in the tarball. The archive excludes `test/` and `dist/test/`. Installed parity tests stage controlled test backends themselves. FATE, Orders and the historical TaskPool Runtime are built from a source checkout. They are excluded from the SDK archive. The opt-in installed integration tests stage their own benchmark assets when they run. The optional TaskPool and Mathlib Search images compile their standalone host entrypoints and transitive dependencies using dedicated configurations. The Worker build stages compiled Runtime and Worker files from the same installed package. It uses the compiled TaskPool CLI table to preserve its shorthand commands. The selected executor files are supplied by the host after package installation.
55
71
 
56
- `npm ci` in the checkout uses the tracked v3 shrinkwrap, which includes development dependencies. The checkout manifest is private. [Release packaging](../../scripts/pack-release.ts) builds by default and accepts `--skip-build` for checks that already compiled the tree. It uses npm's packlist to stage the distribution in a temporary directory, then writes a public manifest and removes development metadata and dev-only entries from the staged root shrinkwrap. It keeps production resolutions and integrity values from the checkout lock. The MCP client resolves `cross-spawn` 7.1.2 independently of the Pi development tool's 7.0.6 pin. The command writes the final archive to the supplied output directory, prints its absolute path and removes staging on success or failure. The registry and GitHub Release use the same final archive. Release verification serves it through a local registry and installs it by package name into an empty project and a separate global prefix. It checks both CLI aliases, the SDK import and the production audit. Manual verification accepts a candidate that shares a version with the current release. Tag runs additionally ask public npm to validate publication with a dry-run, so version reuse fails before publication.
72
+ `npm ci` in the checkout uses the tracked v3 shrinkwrap, which includes development dependencies. The checkout manifest is private. [Release packaging](../../scripts/pack-release.ts) builds by default and accepts `--skip-build` for checks that already compiled the tree. It uses npm's packlist to stage the distribution in a temporary directory, then writes a public manifest and removes development metadata and dev-only entries from the staged root shrinkwrap. It keeps production resolutions and integrity values from the checkout lock. The MCP client resolves `cross-spawn` 7.1.2 independently of the Pi development tool's 7.0.6 pin. The command writes the final archive to the supplied output directory, prints its absolute path and removes staging on success or failure. The registry and GitHub Release use the same final archive. Release verification serves it through a local registry and installs it by package name into an empty project and a separate global prefix. It checks the single public CLI, the Worker executable separately, the SDK import and the production audit. Manual verification accepts a candidate that shares a version with the current release. Tag runs additionally ask public npm to validate publication with a dry-run, so version reuse fails before publication.
57
73
 
58
74
  The packaging command sets a `022` umask before building, staging and packing. npm records existing member permissions, which can depend on the umask used to create the checkout. Before the final pack, the command sets staged regular files to `0755` if they have an execute bit and `0644` otherwise. Staging uses a private temporary directory and the checkout keeps its original permissions. Record the clean commit, Node and npm versions, and final SHA-256 with installed acceptance evidence.
59
75
 
60
- The Worker, TaskPool service-host and Mathlib Search image runtime stages copy the root manifest and shrinkwrap alongside each other, then use `npm ci --omit=dev --ignore-scripts`. The two Service build stages use the checkout's original pair, included in the archive as `package.development.json` and `npm-shrinkwrap.development.json`. Those names keep npm from reading the development lock during a public CLI or SDK install. Each build stage restores that pair to the standard names before `npm ci --include=dev` and TypeScript compilation. The image-input test verifies the shipped COPY inputs, offline installation from both lock variants and the pinned development Pi version. Physical image build and startup are separate checks.
76
+ The Worker, TaskPool service-host and Mathlib Search image runtime stages copy the root manifest and shrinkwrap alongside each other, then use `npm ci --omit=dev --ignore-scripts`. The two Service build stages restore the archive's `package.development.json` and `npm-shrinkwrap.development.json` to their standard names and run `npm ci --include=dev` before TypeScript compilation. Packaging builds this pair from the checked-in lock offline with the executor-only Pi development dependency removed. The published runtime manifest and lock also omit the compiler and Node types. The image-input test verifies the shipped COPY inputs, offline installation from both lock variants and the pinned compiler. Pi is selected from the separately installed executor. Physical image build and startup are separate checks.
61
77
 
62
78
  The archive license and image-context audits use the same package selection as external installation. When `ANYSWARM_TEST_PACKAGE_ARCHIVE` and `ANYSWARM_TEST_PACKAGE_SHA256` are supplied, the fixture validates the pair, reads and hashes the selected bytes, and writes a private snapshot before any tar or npm consumption. These audits inspect that snapshot and report missing required files from it. Without an explicit selection they pack the current checkout. An incorrect or incomplete frozen selection fails before packing a substitute. Regression checks provide a validly hashed archive missing the required license and Dockerfile and require each corresponding audit to fail on the missing file.
63
79
 
@@ -67,17 +83,27 @@ The archive includes the exact upstream Apache 2.0 license text beside the adapt
67
83
 
68
84
  ## Local setup and doctor
69
85
 
70
- The installed CLI parses flags before importing local setup. From a checkout, `./scripts/setup` builds the project as necessary and calls the same entry point. `--config` imports an explicit trusted ESM module and reads its adjacent `.env` without overriding previously set environment variables. The Runtime configuration preflight validates the resolved Sandbox, Runtime, model routes and file policy before smoke. Missing model configuration is reported separately from infrastructure readiness. Setup’s built-in model probe keeps user credentials on the host and uses a local controlled model.
86
+ The installed CLI parses flags before importing local setup. From a checkout, `./scripts/setup` builds the project as necessary and calls the same entry point. `--config` imports an explicit trusted ESM module and reads its adjacent `.env` without overriding previously set environment variables. The Runtime configuration preflight validates the resolved Sandbox, Runtime, model routes and file policy before smoke. An invalid active route blocks the probe. Missing model settings have their own state and remedy and do not block the controlled infrastructure smoke. Setup never contacts the configured model upstream. The first default Subagents Run reports the exact missing setting when its built-in configuration has no model URL or when Codex needs an explicit model ID. That preflight failure uses the normal configuration failure code and records cleanup complete before allocation.
71
87
 
72
88
  ### Connection resolution and checkout preparation
73
89
 
74
- Explicit configuration and command flags take precedence over supported environment values, the saved connection and the loopback default. Address sources and management are separate: setup with no explicit mode uses saved local ownership for the same endpoint, existing mode for an external address, or local mode for the unconfigured default. Explicit existing mode authenticates against the requested endpoint and saves it without Docker or local fallback. Its smoke check requires an explicit prepared image supplied by the operator. Direct read-only `doctor` does not allocate or start a provider.
90
+ The CLI resolves explicit configuration and flags, supported environment settings, the owner-only saved connection and then the default Lifecycle URL `http://127.0.0.1:8080/v1`. Setup defaults to the managed local profile and reuses credentials and backend/image settings for a matching endpoint. It can reuse a loopback connection saved in existing mode. Plain doctor also recognizes an explicitly configured loopback service even when it has no local ownership record. Managed local setup accepts HTTP Lifecycle on `localhost` or `127.0.0.1` with the standard `/v1` path. A configured nonloopback address in the default path is reported with its configuration source before any Lifecycle request. That check leaves the saved file in place. Use an explicit managed endpoint to replace a conflicting saved configuration after a successful probe.
91
+
92
+ `setup --mode existing` authenticates against the explicitly configured endpoint and saves it. `doctor --mode existing` reads that same connection and verifies it without Docker. Existing-mode smoke requires an explicit prepared Worker image from the operator. Without a project configuration, doctor uses the same model environment reader as built-in Subagents. Global model settings take precedence over the corresponding `ANYSWARM_SUBAGENTS_MODEL_*` values, and an omitted protocol defaults to Responses. Core checks the resulting protocol, endpoint and executor compatibility. Doctor reports configuration readiness without making a provider request. Plain doctor makes a bounded read-only Lifecycle and authentication check and allocates no Sandbox. The SDK connection resolver still accepts explicitly configured remote services.
75
93
 
76
94
  Setup writes schema 1 to `opensandbox.json` under `~/.config/anyswarm`, or `ANYSWARM_CONFIG_DIR` when selected. The directory must be owner-controlled. Reads and atomic 0600 writes protect the endpoint credentials, optional explicit Worker override, callback, management mode, managed container ID, backend kind and executable entry, and actual prepared image ID. The prepared ID is diagnostic evidence; the SDK checks current build inputs before choosing an image. Previous schema-less saved connections are ignored. The operator can rerun setup with this release’s desired mode and endpoint.
77
95
 
96
+ Callback selection uses an explicit `advertiseHost`, the common environment value, the scoped environment value, and then a saved value for the matching Lifecycle endpoint. A configured Runtime `publicUrl` is validated before automatic discovery. Setup and doctor resolve the supported `connection.publicUrl`, `connection.bridge.publicUrl` and `connection.modelGateway.publicUrl` forms in that order before discovery; setup's `--public-url` takes priority. They carry the resolved URL and callback through the later Core configuration check as Runtime connection options, where conflicting explicit URL forms are still rejected. Only a local loopback Lifecycle without a selected callback or `publicUrl` reads the host's `docker0` IPv4 address. Explicit and saved settings therefore remain usable on systems that deny network-interface enumeration. An enumeration exception produces the fixed `HOST_NETWORK_DISCOVERY_FAILED` explanation and asks for `ANYSWARM_ADVERTISE_HOST` or `ANYSWARM_RUNTIME_PUBLIC_URL`; it does not expose the original system error. Setup and doctor identify that failure as `host.network-discovery`. Their connection-resolution phase is separate from importing the trusted configuration module, so a module import failure still reports the configuration-file remedy and a malformed connection reports its connection remedy.
97
+
98
+ `createSandbox()` snapshots the endpoint, credentials and configured/environment/saved callback settings without enumerating interfaces, because the Runtime connection options are not available at handle creation. Runtime claim checks explicit top-level and supported nested public URLs, explicit Runtime callback hosts, and the handle's saved snapshot before discovery. It does not reload mutable environment or saved configuration at claim. The local Worker planner's separate saved-executor lookup and managed provider's key-only lookup disable callback discovery; neither lookup chooses a Runtime callback. When discovery is required, the same guarded `docker0` lookup runs; a successful enumeration with no `docker0` IPv4 address retains the local `172.17.0.1` fallback. A Provider handle retains its existing callback behavior without host enumeration. The public Sandbox schema continues to reject Runtime connection fields. The [connection regressions](../../test/sandbox-default-connection.test.ts) verify precedence, supported public URL forms, public SDK construction/open/close, immutable connection snapshots, `workerImageFor()` preparation diagnostics, owner-only provider key loading, failed discovery, safe diagnostics and unchanged aggregation of missing backend/Docker checks when an explicit callback is available.
99
+
78
100
  ### Existing or locally managed OpenSandbox
79
101
 
80
- Local setup checks the host platform, Node version and access to a local Unix Docker context. macOS requires a Linux daemon matching the native Mac architecture; it does not fall back to emulation. Setup and local doctor resolve the client Unix socket and read daemon information without changing the context. A failed check points users to install and start Docker Desktop for Mac, or start their existing local Linux engine, then check context and environment overrides. Neither npm nor setup installs or launches an engine. Explicit existing mode does not check Docker. Successful setup uses the existing owner-only connection write, and plain doctor remains read-only. The checkout bootstrap waits up to 180 seconds for its directory lock (`flock` on Linux, `/usr/bin/lockf` on macOS), checks or rebuilds the checkout, and forwards the selected endpoint, backend, configuration and callback options to the same CLI entry. The backend selection uses an explicit `--backend` with optional `--backend-path`, a matching saved selection, or a detected npm executable on PATH. With two detected backends and no selection, terminal setup prompts for one. A noninteractive invocation must choose in that case. An unavailable backend reports the installation path and the failed version or startup check. An explicit `--backend-version` selects a matching saved executable or searches PATH and persists the pin with the path. A caller can combine it with `--backend-path` to verify a particular installation. A project executor pin takes precedence for that project. Both CLI installation flags require a locally built Worker; repeating explicit backend selection without a pin restores automatic version tracking. Plain doctor probes the saved executable without preparing a Worker. Setup uses the same material discovery and Worker preparation as the local SDK path described below.
102
+ Setup and doctor report the OS, architecture, and Node version and path. A separate advisory report records Git and npm versions and paths, or how to resolve a missing command. These advisory checks also work when running directly from a checkout or installed executable without npm on PATH. In managed local mode with no selected image or adapter, they look for a compatible Pi or Codex installation. Setup gives explicit backend flags priority, then uses a matching saved executable or checks PATH. For each backend the PATH search continues past unsupported wrappers and installations until a compatible executable is verified. If only one backend is compatible, setup selects it. An interactive setup can ask which backend to use when both are compatible. Automation selects one with `--backend` when the choice is ambiguous. The preflight reports the selected executable and actual version. An explicit `--backend-version` prefers a matching saved executable and searches PATH for the requested version. Combine it with `--backend-path` to verify a particular installation. Both flags require a locally built Worker. The optional pin is saved with the executable. Repeating explicit backend selection without a pin restores automatic version tracking. A project executor pin takes precedence for that project.
103
+
104
+ The local Docker check runs even when the backend is missing or fails verification so setup and doctor can report both failures before preparing anything. It resolves the current Unix socket and reads daemon information under bounded subprocess waits. The diagnostics distinguish a missing Docker CLI, a nonlocal context, unavailable daemon or socket, denied socket access, and an incompatible daemon. Linux install guidance uses the host's distribution family. A reachable engine reports its version, CLI version and active context when Docker supplies them. On Linux, a known rootless Engine version below 29.5 fails preflight before image preparation. Managed OpenSandbox uses host networking and these daemons cannot expose its port to the actual host. Existing-service mode bypasses this Docker check. On macOS the missing-engine remedy checks standard system and user Applications directories for Docker Desktop and offers launch guidance when present. macOS requires a Linux daemon matching the native architecture and suggests Docker Desktop or the user's existing local engine. Diagnostics do not install dependencies or change contexts. Plain doctor verifies the saved executable and the local engine without building a Worker. Missing local Lifecycle prompts the user to run setup. Phase progress goes to stderr, with elapsed timings and a heartbeat during long operations. The final report goes to stdout as JSON.
105
+
106
+ The checkout bootstrap waits up to 180 seconds for its directory lock (`flock` on Linux or `/usr/bin/lockf` on macOS), builds as needed, and forwards endpoint, backend, configuration and callback options to the same CLI entry. Setup uses the same material discovery and Worker preparation as the local SDK path described below.
81
107
 
82
108
  The deployment uses the pinned OpenSandbox server, Execd and Egress images. On macOS it selects native Linux images and runs the server on a Docker bridge with the Lifecycle port published on Mac loopback only. The server listens on the container interface and uses the daemon VM's `/var/run/docker.sock`, not the Mac client's Unix socket. The Runtime reaches Execd, Worker and egress endpoints through the authenticated server proxy; the Linux host-network path is unchanged. Provider mutations use a per-port local lock (`flock` on Linux or persistent-file `lockf -k` on macOS). A different platform profile is not adopted. The inspected container name selects a candidate; its setup labels, owner token, state paths, Docker mount and network configuration, and recorded container ID establish ownership. The macOS profile requires the exact loopback port publication and VM socket bind. A matching stopped service is started by ID. A different same-name container, a port occupied by another process and failed Lifecycle authentication have distinct diagnoses. Local provider preparation creates a key and state directory only when needed. Failure cleanup only deletes infrastructure attributable to that attempt, and leaves resources in place when deletion cannot be confirmed or a Sandbox still uses them.
83
109
 
@@ -87,12 +113,16 @@ Before the macOS local smoke, a disposable container from the prepared Worker im
87
113
 
88
114
  ### CLI entry and authored projects
89
115
 
90
- The two installed host names `anyswarm` and `anys` share an entry. With no arguments they open the streaming composer on a suitable interactive terminal. Help and version exit without inspecting project files. A noninteractive launch reports supported explicit foreground or RPC options and exits promptly. A project that exports a Harness can use `anys run ./harness.ts --config ./config.ts --cwd ./input --prompt '<task>'`. Previously generated project hosts can still execute their own JavaScript entry explicitly. See the [streaming terminal chapter](25-foreground-tui.md) for configuration repair and terminal restoration.
116
+ The installed host command is `anyswarm`. With no arguments or with `--help`, it prints Quickstart and exits 0 without loading project configuration, creating Run records, or allocating a Sandbox. `--version` reads the installed package manifest. Invalid commands exit 2 with usage. Setup and doctor are explicit commands. See [Harness entry and lifecycle](23-project-harness.md) for source, one-shot and RPC admission, and [release CLI acceptance](../workflows/release-cli-acceptance.md) for installed verification.
117
+
118
+ One-shot foreground output selects the human progress renderer only when stdout is a TTY. At completion it prints one final `Result` block: a string `result.business` or `result.business.output` is shown directly, and other `result` values use their string or indented JSON representation. The block preserves line breaks and tabs, normalizes CRLF, and escapes other control/format characters so returned content cannot issue terminal commands. Its rendered UTF-8 body is limited to 64 KiB without splitting a code point; truncation has an explicit notice pointing to the complete saved report, or stating that no saved report is available if persistence failed. This display limit does not change the result, pipe/RPC JSONL, or persisted bytes. Outcome/failure, exported artifacts, export status, cleanup status and report/Trace paths retain separate lines. The [foreground progress regressions](../../test/foreground-progress.test.ts) compare a real kernel PTY, pipe JSON and the saved report for the same multiline answer, and verify generic JSON, controls, truncation and pending cleanup with controlled no-Runtime Harnesses.
91
119
 
92
120
  ## Entry points
93
121
 
94
122
  `src/harness/` contains common project input, host/RPC, reporting and cleanup support. Concrete mechanisms live in their owning example directories. `scripts/anyswarm-harnesses.ts` maps installed CLI names to Harness and application entrypoints. The legacy TaskPool/PeerMesh foreground switch is CLI-specific code in `src/cli/foreground-harnesses.ts`. The [repository implementation plan](../designs/repository-layout.md) records the remaining private-helper and TaskPool domain extraction.
95
123
 
124
+ For the saved Lifecycle endpoint, `resolveSandboxConnection` can include `preparedImage` when a managed local setup recorded an immutable Worker image. Host preflight calls opt in with `{ includePreparedImage: true }` as the third argument. Existing callers can continue projecting the default fields into their sandbox configuration. The configured image override remains in `image`, and the Runtime still resolves and validates any local Worker selector when it starts.
125
+
96
126
  The shipped `.env.example` lists common connection variables, model settings for the Notes example and standalone Service hosting. Built-in project entry points and configured doctor use the shared ESM and adjacent environment loader. SDK code can call `resolveSandboxConnection` explicitly. For Notes, the model URL is the full `/v1/responses` endpoint. Pi is the default executor. Codex uses an explicitly chosen model ID. The model token stays behind the host Model Gateway. Other Harnesses can supply trusted options through their own configuration modules. [Notes configuration](../../examples/notes/config.ts) · [Environment example](../../.env.example)
97
127
 
98
128
  | Entry | Configuration and behavior |
@@ -139,11 +169,11 @@ The built-in Trace Viewer (`src/trace-viewer/`) opens an output root containing
139
169
 
140
170
  The [CI workflow](../../.github/workflows/ci.yml) runs on PRs targeting `main` and pushes to `main`. Each PR run checks out GitHub's test merge commit and compares it with its first parent, including a whitespace check. A push compares with the previous tip and fetches that commit if needed. The [change selector](../../.github/ci-scope.sh) reads added and deleted paths separately, including both sides of moves. It selects full Core and website checks if the comparison is unavailable or a changed path is outside the known documentation and website inputs. An update cancels the older run for the same PR. The token has read access to repository contents, and checkout leaves no Git credentials in the working tree.
141
171
 
142
- Documentation, website, README image and architecture inventory edits get the offline generated-reference and repository-link checks. Changes to the installer script, homepage install command or either Quickstart also get the focused installer tests. Website and guide changes build both locales. The website build also runs on full Core changes because the guides link to files in the repository and the site serves SDK examples. [Website CI](22-website.md#build-and-render)
172
+ Documentation, website, README image and architecture inventory edits get the offline generated-reference and repository-link checks. Changes to the homepage npm command or either Quickstart also check their installation contracts. Website and guide changes build both stable and next in both locales. The website build also runs on full Core changes because the guides link to files in the repository and the site serves SDK examples. Website checkout includes Git history so it can materialize the pinned documentation revisions. [Website CI](22-website.md#build-and-render)
143
173
 
144
- Full coverage runs the Core test files in three parallel Linux runners. Each runner uses a fresh npm cache, builds and packs Core, and installs the tarball and Harness Session example in temporary directories. Those installs seed registry metadata so the package tests can run offline. The runner removes its temporary files and uses Node's test sharding over a sorted list of compiled test files. Tests run serially within each runner. The shards include the compiled Trace Viewer reader and server tests, including the installed-package check for `anyswarm trace`. Local `npm test` still runs the whole suite. Opt-in native and model tests stay disabled.
174
+ Full coverage first builds one candidate archive in a dedicated job. The `anyswarm-candidate` Actions artifact holds that archive, `SHA256SUMS` and source commit/run metadata for fourteen days. Three parallel Linux test runners download and verify the same artifact, build their test programs and install the archive plus the Harness Session example into temporary consumers. Each runner uses a fresh npm cache; these initial installs seed metadata for offline package tests. The runners set `ANYSWARM_TEST_PACKAGE_ARCHIVE` and `ANYSWARM_TEST_PACKAGE_SHA256` for the entire shard and retain the archive until the job ends. Frozen-archive tests therefore execute against identical bytes rather than skipping or independently packing each shard. Node shards the sorted test files; tests run serially within each runner. The suite includes the compiled Trace Viewer reader and server checks and the installed `anyswarm trace` entry. Local `npm test` still runs the whole suite. Opt-in native and model tests stay disabled.
145
175
 
146
- The required Core CI job checks that routing succeeded and the expected Core shards succeeded or were skipped. It typechecks full changes and verifies generated references and links on every run. GitHub requires Core CI and Website CI. A failed router or shard blocks Core CI. Website CI can be skipped when the change does not affect its inputs. The Core test runners have a 30-minute limit, while the Website CI and Core CI jobs have a 10-minute limit. [Local CI commands](../workflows/development.md#repository-ci-checks)
176
+ Separate Node 22.19, 24 and 26 runners verify and install the same candidate archive, import the SDK, eject a source Harness, install its dependency and run it with an enum from a separate TypeScript module. They check the business result and cleanup in the machine-readable output. The required Core CI job checks that routing succeeded and that the candidate, shards and installed-source matrix succeeded, or were all skipped for a non-Core change. It typechecks full changes and verifies generated references and links on every run. GitHub requires Core CI and Website CI. A failed router, candidate or shard blocks Core CI. Website CI can be skipped when the change does not affect its inputs. The Core test runners have a 30-minute limit; candidate, Website CI and Core CI jobs have a 10-minute limit. [Local CI commands](../workflows/development.md#repository-ci-checks)
147
177
 
148
178
  ## Final-tree acceptance configuration
149
179
 
@@ -268,9 +298,78 @@ Worker start passes each Agent's resolved session config and the before-compact
268
298
 
269
299
  ## Installed first SDK Harness
270
300
 
271
- The [first SDK Harness](../en/first-harness.md) ships its TypeScript sources both in the package and as website downloads. The release workflow copies the same sources from the installed candidate into its isolated consumer and compiles them against the package root. It prepares local infrastructure using that binary, then runs the compiled application against the controlled local Responses fixture. The fixture exercises Service rejection and recovery, waits for the terminal question, checks the collected bytes, and checks complete cleanup. The current example resolves credentials and network addresses through the shared resolver and accepts a Pi Chat Completions model when selected. The strict-local v0.2.0 walkthrough is available at its release tag. The example assumes an already prepared local or existing Sandbox environment.
272
-
273
- The publisher runs in a read-only workspace with a generated reference and permission to publish once. The authorized writer can read the handoff and write its own workspace. After validating the handoff's actual author and reference, the host opens a bounded terminal question. The reply is restricted to a short channel identifier. The writer's result must come through an authenticated read by that Agent. The host snapshots the delivery and verifies exact bytes before close, then checks the separately collected file and its hash. A failed turn, rejected question or export failure produces an application failure summary. Cleanup is recorded independently using the actual close receipt; when close does not confirm an outcome it is reported as unknown. The SDK and both explicit CLI transports record the Run outcome, the artifact receipt and the cleanup receipt separately. The parallel Swarm tutorial uses the same public input helper in two rounds, checks shared findings, and verifies its report after the synthesizer exports it.
301
+ The [first SDK Harness source](../../examples/first-harness/README.md) is a normal
302
+ public `Harness`. `projectConfiguration` uses the complete explicit
303
+ `context.configuration` or imports its local `config.ts`; it does not merge a
304
+ partial config with hidden defaults. `firstHarnessConfig()` inherits the saved
305
+ Sandbox connection and executor for the selected endpoint. Common environment
306
+ settings override that selection. An explicit/saved image is preserved; otherwise
307
+ `workerImageFor(executor)` selects the Worker. Pi defaults to `openai/gpt-5-mini`;
308
+ Codex requires an explicit model ID. Pi supports Responses and Chat Completions,
309
+ while Codex rejects Chat Completions before allocation. Host credentials, public
310
+ callback, server-proxy and egress settings keep the resolver's semantics.
311
+
312
+ Ordinary foreground runs use `channel` or `ANYSWARM_FIRST_CHANNEL`, defaulting to
313
+ `preview`, without a question event. Only a client declaring
314
+ `clientCapabilities.questions` asks for a channel. The channel is validated as a
315
+ lowercase identifier of at most 24 characters before entering the Writer's shell
316
+ command. `session.ts` explicitly opts into questions through a direct Session or
317
+ JSONL RPC; source execution selects the adjacent `.ts` Harness and compiled
318
+ execution selects `.js`. The example's ESNext/Bundler compiler configuration also
319
+ typechecks a source export whose generated package has no module-type field.
320
+
321
+ The host gives only Publisher a fresh random reference and a `publish` grant.
322
+ After its successful input, it verifies the Service's actual author and exact
323
+ reference. Writer receives a `take` grant and the preset or answered channel; it
324
+ retrieves the reference through the authenticated Service and writes
325
+ `delivery.txt`. The host checks the reader identity and exact sandbox snapshot
326
+ bytes, then checks the independently exported bytes and SHA-256 after close.
327
+ `context.runWithRuntime` owns factory failure, work, cancellation and bounded
328
+ close; `runInput` owns each exclusive turn. The 120-second turn waits, 60-second
329
+ close allowance and 32-request gateway limit are explicit bounds, not a runtime
330
+ promise. Export verification is a business check after the helper returns, so
331
+ wrong bytes cannot be misclassified as cleanup failure. Required collection and
332
+ factory cleanup pending retain their original resource receipts. See
333
+ [report semantics](17-harness-reporting.md#sdk-tutorial-business-checks).
334
+
335
+ The installed native test retains explicit SDK/RPC questions and checks both a
336
+ configured foreground channel and the question-free default. Its Responses
337
+ fixture is controlled verification, not real model reasoning. New deterministic
338
+ tests exercise the actual Runtime/Bridge with a simulated Worker, including
339
+ wrong bytes, denied grants, cancellation and pending collection. A new live-model
340
+ run is a separately recorded acceptance item.
341
+
342
+ ## Parallel repository investigation configuration
343
+
344
+ `examples/parallel-swarm/harness.ts` also consumes the complete explicit config
345
+ or imports its own `config.ts`; it has no dependency on First Harness sources.
346
+ `parallelSwarmConfig()` resolves the Sandbox with scope `PARALLEL_SWARM`, then
347
+ selects common model/executor environment values before scoped fallbacks, saved
348
+ executor and Pi. Model URL is required; Pi defaults to `openai/gpt-5-mini` and
349
+ Codex requires an explicit model ID. Protocol and image rules match First
350
+ Harness. Optional context-window limits describe the configured model, not a
351
+ measured capacity. Credentials remain in the host gateway.
352
+
353
+ The visible config selects model alias `default`, 120 seconds per input and a
354
+ 60-second close allowance. The Harness validates finite positive waits and an
355
+ image before Runtime allocation, then passes executor, model aliases, connection
356
+ and file policy unchanged to one Runtime. Three researchers work in two rounds;
357
+ one synthesizer follows. Maximum live capacity is four. Researchers have
358
+ read-only captured files and Board `publish/search`; the synthesizer can write
359
+ its private copy, can only search the Board, and must export `report.md` within
360
+ 1 MiB. The Board validates snapshot references and per-member reviews as
361
+ described in [reporting](17-harness-reporting.md#sdk-tutorial-business-checks).
362
+ These checks do not run the investigated project's tests or establish report
363
+ correctness.
364
+
365
+ The `first-harness`, `parallel-swarm` and `subagents` source manifests export the
366
+ actual implementation and author guide with a bound SDK archive. They are added
367
+ after 0.5.2, so a 0.5.2 installation cannot supply the new manifests; development
368
+ instructions require a candidate containing them. The existing generic eject
369
+ engine handles them without a new registry or wrapper. Installed package tests
370
+ check every relative source dependency, copy bytes, SDK provenance and edited
371
+ entry execution outside repository ancestry. The new real repository/model runs
372
+ remain a separate acceptance item rather than a fixture success claim.
274
373
 
275
374
  ## Durable Runs and Kubernetes
276
375
 
@@ -52,8 +52,27 @@ The input gives the workflow for saving and checking work, publishing structured
52
52
 
53
53
  ## Installed first SDK Harness
54
54
 
55
- The [first SDK Harness prompt reference](prompts/11-first-sdk-harness.md) contains both Profile prompts and both user inputs. The publisher can discover the `handoff.publish` description, then reads a host-generated random reference from `release-data.txt` using an ordinary file tool. The registered Service records a question produced by that Agent and the host shows it to the operator. The terminal reply is normalized and validated by the host before insertion in the writer input. The operator question prompt itself is terminal UI text. The writer sees the authorized `handoff.take` operation and can retrieve the reference as a tool response. Both inputs are sent through the example turn runner with `mode: 'followUp'` after the corresponding Agent is idle. Settlement observation is independent of actual Service invocation and output bytes.
56
- - [Parallel Swarm](prompts/16-parallel-swarm.md) documents board discovery and the research, peer review and synthesis inputs.
55
+ The [first SDK Harness prompt reference](prompts/11-first-sdk-harness.md) contains
56
+ both Profile prompts and both user inputs. Publisher reads a host-generated
57
+ random reference from `release-data.txt` and publishes it through the authorized
58
+ handoff Service, together with a short channel question. Normal foreground
59
+ execution uses the host preset (default `preview`) and does not display that
60
+ question. An explicitly enabled SDK/RPC question client receives it through
61
+ `askUser`. The host validates the preset or answer before interpolating it into
62
+ Writer's input. Writer discovers `handoff.take` and receives the reference as
63
+ an authenticated Service response. Public `runInput` sends each input as
64
+ `followUp` after checking the Agent is idle. Settlement is independent of actual
65
+ Service invocation and exact sandbox/exported bytes.
66
+
67
+ [Parallel Swarm](prompts/16-parallel-swarm.md) records the full Profile strings,
68
+ three distinct research focuses, review input, synthesis input and Board
69
+ discovery text. Each first-round input combines the user's actual repository
70
+ question, one host-defined focus and an instruction to publish source evidence.
71
+ The second round asks every researcher for a new review of another author's
72
+ first-round finding. Synthesis combines the fixed integration instructions with
73
+ the same user question. The examples contain no prewritten report or planted
74
+ defect. Board references and report export have objective checks; the prompts
75
+ and result explicitly leave semantic correctness unassessed.
57
76
 
58
77
  ## Complete text and reproducible source inventory
59
78
 
@@ -40,7 +40,7 @@ This section is generated from executable exports and checked against the source
40
40
  | [test-support/taskpool-legacy/services-bridge.ts](../../test-support/taskpool-legacy/services-bridge.ts) | `7bb38b8ef1d8930a89accbf2cdd72695c4c27f5754ab3b85ee43d3f44ada5ebd` |
41
41
  | [examples/services/mathlib-search/service.json](../../examples/services/mathlib-search/service.json) | `caecf2c6344e0f2777b7135a3c6a7fccb3f93d618d11430480b800551038bfae` |
42
42
  | [src/errors.ts](../../src/errors.ts) | `c2b15623faa55162f9e0474b9810d1c5f1eea6255520cd423b0dad155511dc65` |
43
- | [src/core/index.ts](../../src/core/index.ts) | `a78f159604cb21264b987079532cf295832420374297d976e1f838e536a103d0` |
43
+ | [src/core/index.ts](../../src/core/index.ts) | `29736fc683275f3df70b1766af60185d36a453a0e69a3eefbbd20578963d1495` |
44
44
  | [src/core/types.ts](../../src/core/types.ts) | `9245229cd72d6408cb0fe801b8e0181603d5afcb27c50fb689a2e8e404d446d5` |
45
45
  | [src/core/services.ts](../../src/core/services.ts) | `5accc123c4c681a3c4d7aadad616e44e83725b52aead10250b172b127f784b1e` |
46
46
  | [src/core/service-types.ts](../../src/core/service-types.ts) | `f30edaca5a6fe5d40b3ba90f49210af32aca3b773f74ff005fa0823556d21e93` |
@@ -48,11 +48,11 @@ This section is generated from executable exports and checked against the source
48
48
  | [src/core/service-observation-types.ts](../../src/core/service-observation-types.ts) | `150ea4a963166f7de86d0158f19e032f9518109fc2ad97cdfd6131ad1c429dc5` |
49
49
  | [src/core/service-process.ts](../../src/core/service-process.ts) | `80ce634ac724c9bcff9ecd9b719266f70d8daeece3e3db92f557c67c94b91684` |
50
50
  | [src/core/mcp-service.ts](../../src/core/mcp-service.ts) | `ea2cd9865f6252413ea52ee787d357c485470eb2328aaaee029986ed9d01a485` |
51
- | [src/core/sandbox/opensandbox-backend.ts](../../src/core/sandbox/opensandbox-backend.ts) | `a7aa96e86f1d193929123872432d23454882a014839cd95f23d2a19a3c5cf634` |
51
+ | [src/core/sandbox/opensandbox-backend.ts](../../src/core/sandbox/opensandbox-backend.ts) | `14eb1d758acbc59ecad2aba7d12c288b5ff33d224710973e59543bd678d9cc10` |
52
52
  | [src/core/sandbox/executor-driver.ts](../../src/core/sandbox/executor-driver.ts) | `6b3a8a1d93c5bbca00f2df00d75d593344cd02d642e563391e58910a70dbe828` |
53
53
  | [src/core/backend-config.ts](../../src/core/backend-config.ts) | `be1c5c7db4876f5632f6f855af3e16e8f59c46a5a76b3f27a934508e15cbdf47` |
54
54
  | [src/core/sandbox/opensandbox-provider.ts](../../src/core/sandbox/opensandbox-provider.ts) | `eb98901a846c1ce294621d7a173cec46787ba4bf18b4edc65afc5c867e968c37` |
55
- | [src/core/sandbox/sandbox-connection.ts](../../src/core/sandbox/sandbox-connection.ts) | `cb7f8d271b986b6dff9cdc29718f0bf03dbd4fe86cc11f12eaf5437edbc7f782` |
55
+ | [src/core/sandbox/sandbox-connection.ts](../../src/core/sandbox/sandbox-connection.ts) | `60cb72202cf1dde246b7c12b0ed8243f08f27839cd57720cede3754c3fd8e2f8` |
56
56
 
57
57
  ### TaskPool command operation surface
58
58
 
@@ -4644,7 +4644,9 @@ interface ConnectionInput {
4644
4644
  preparedImage?: string;
4645
4645
  }
4646
4646
  export declare function normalizeRuntimePublicUrl(value: string): string;
4647
- export declare function resolveSandboxConnectionWithSources(input?: ConnectionInput, scope?: string, { useSaved }?: {
4647
+ export declare function discoverDockerCallbackHost(): string | undefined;
4648
+ export declare function resolveSandboxConnectionWithSources(input?: ConnectionInput, scope?: string, { useSaved, discoverHost }?: {
4649
+ discoverHost?: boolean | undefined;
4648
4650
  useSaved?: boolean | undefined;
4649
4651
  }): {
4650
4652
  lifecycleBaseUrl: string;
@@ -4667,7 +4669,11 @@ export declare function resolveSandboxConnectionWithSources(input?: ConnectionIn
4667
4669
  image: string | undefined;
4668
4670
  };
4669
4671
  };
4670
- export declare function resolveSandboxConnection(...settings: Parameters<typeof resolveSandboxConnectionWithSources>): {
4672
+ export declare function resolveSandboxConnection(input?: ConnectionInput, scope?: string, { useSaved, discoverHost, includePreparedImage }?: {
4673
+ discoverHost?: boolean | undefined;
4674
+ includePreparedImage?: boolean | undefined;
4675
+ useSaved?: boolean | undefined;
4676
+ }): {
4671
4677
  lifecycleBaseUrl: string;
4672
4678
  apiKey: string | undefined;
4673
4679
  advertiseHost: string | undefined;
@@ -4678,6 +4684,7 @@ export declare function resolveSandboxConnection(...settings: Parameters<typeof
4678
4684
  endpointHost: undefined;
4679
4685
  endpointSource: string;
4680
4686
  executor: import("../backend-config.js").ExecutorKind | undefined;
4687
+ preparedImage?: string | undefined;
4681
4688
  };
4682
4689
  export declare function saveSandboxConnection(input: ConnectionInput & {
4683
4690
  lifecycleBaseUrl: string;