@anyswarm/core 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +21 -13
  3. package/deploy/worker/Dockerfile +12 -4
  4. package/dist/deploy/worker/Dockerfile +12 -4
  5. package/dist/examples/README.md +35 -12
  6. package/dist/examples/authoring/README.md +24 -0
  7. package/dist/examples/authoring/business.d.ts +2 -0
  8. package/dist/examples/authoring/business.js +4 -0
  9. package/dist/examples/authoring/config.d.ts +5 -0
  10. package/dist/examples/authoring/config.js +2 -0
  11. package/dist/examples/authoring/eject.json +5 -0
  12. package/dist/examples/authoring/harness.d.ts +4 -0
  13. package/dist/examples/authoring/harness.js +19 -0
  14. package/dist/examples/autoresearch/README.md +40 -0
  15. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +11 -0
  16. package/dist/examples/autoresearch/config.d.ts +51 -0
  17. package/dist/examples/autoresearch/config.js +57 -0
  18. package/dist/examples/autoresearch/demo.d.ts +11 -0
  19. package/dist/examples/autoresearch/demo.js +52 -0
  20. package/dist/examples/autoresearch/eject.json +17 -0
  21. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  22. package/dist/examples/autoresearch/frontiercs2-config.js +3 -0
  23. package/dist/examples/autoresearch/frontiercs2.d.ts +87 -0
  24. package/dist/examples/autoresearch/frontiercs2.js +211 -0
  25. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  26. package/dist/examples/autoresearch/prepare-demo.js +15 -0
  27. package/dist/examples/autoresearch/prepare.d.ts +95 -0
  28. package/dist/examples/autoresearch/prepare.js +257 -0
  29. package/dist/examples/autoresearch/process.d.ts +13 -0
  30. package/dist/examples/autoresearch/process.js +48 -0
  31. package/dist/examples/autoresearch/project.d.ts +21 -0
  32. package/dist/examples/autoresearch/project.js +392 -0
  33. package/dist/examples/autoresearch/research-service.d.ts +106 -0
  34. package/dist/examples/autoresearch/research-service.js +255 -0
  35. package/dist/examples/code/README.md +33 -0
  36. package/dist/examples/code/REQUIREMENTS.zh.md +11 -0
  37. package/dist/examples/code/candidate.d.ts +19 -0
  38. package/dist/examples/code/candidate.js +80 -0
  39. package/dist/examples/code/config.d.ts +32 -0
  40. package/dist/examples/code/config.js +18 -0
  41. package/dist/examples/code/eject.json +5 -0
  42. package/dist/examples/code/project.d.ts +3 -0
  43. package/dist/examples/code/project.js +605 -0
  44. package/dist/examples/code/prompts.d.ts +5 -0
  45. package/dist/examples/code/prompts.js +12 -0
  46. package/dist/examples/code/verification.d.ts +19 -0
  47. package/dist/examples/code/verification.js +268 -0
  48. package/dist/examples/code/worktree.d.ts +17 -0
  49. package/dist/examples/code/worktree.js +233 -0
  50. package/dist/examples/harness-session/README.md +3 -6
  51. package/dist/examples/lead-worker/harness/dynamic-scheduler.d.ts +2 -1
  52. package/dist/examples/lead-worker/harness/dynamic-scheduler.js +5 -2
  53. package/dist/examples/lead-worker/harness/index.d.ts +60 -0
  54. package/dist/examples/lead-worker/harness/index.js +77 -6
  55. package/dist/examples/lead-worker/project.js +2 -2
  56. package/dist/examples/lead-worker/services/board.d.ts +5 -0
  57. package/dist/examples/lead-worker/services/board.js +19 -1
  58. package/dist/examples/messages/README.md +5 -5
  59. package/dist/examples/messages/handoff.d.ts +2 -0
  60. package/dist/examples/messages/handoff.js +5 -1
  61. package/dist/examples/messages/project.js +52 -2
  62. package/dist/examples/notes/README.md +13 -18
  63. package/dist/examples/notes/project.js +67 -6
  64. package/dist/examples/peermesh/harness/router.js +3 -1
  65. package/dist/examples/peermesh/harness/team.d.ts +8 -0
  66. package/dist/examples/peermesh/harness/team.js +13 -0
  67. package/dist/examples/peermesh/project.js +22 -4
  68. package/dist/examples/services/agent-control/README.md +3 -3
  69. package/dist/examples/services/mathlib-search/Dockerfile +4 -2
  70. package/dist/examples/services/mathlib-search/README.md +1 -1
  71. package/dist/examples/services/mcp-managed/README.md +2 -2
  72. package/dist/examples/services/persistent-board/README.md +16 -3
  73. package/dist/examples/services/persistent-board/business.d.ts +7 -0
  74. package/dist/examples/services/persistent-board/business.js +7 -0
  75. package/dist/examples/services/persistent-board/index.js +10 -0
  76. package/dist/examples/services/persistent-board/live.d.ts +3 -0
  77. package/dist/examples/services/persistent-board/live.js +58 -0
  78. package/dist/examples/subagents/README.md +5 -5
  79. package/dist/examples/subagents/business.js +3 -1
  80. package/dist/examples/subagents/config.js +3 -3
  81. package/dist/examples/subagents/harness/controller.d.ts +15 -0
  82. package/dist/examples/subagents/harness/controller.js +181 -32
  83. package/dist/examples/subagents/project.d.ts +2 -0
  84. package/dist/examples/subagents/project.js +43 -34
  85. package/dist/examples/subagents/prompts/prompts.d.ts +1 -0
  86. package/dist/examples/subagents/prompts/prompts.js +3 -0
  87. package/dist/examples/subagents/services/collaboration-service.d.ts +3 -2
  88. package/dist/examples/subagents/services/collaboration-service.js +14 -2
  89. package/dist/examples/substrate/README.md +2 -2
  90. package/dist/examples/substrate/harness/index.d.ts +1 -1
  91. package/dist/examples/substrate/harness/index.js +77 -12
  92. package/dist/examples/substrate/project.js +4 -1
  93. package/dist/examples/super/README.md +52 -0
  94. package/dist/examples/super/actions.d.ts +95 -0
  95. package/dist/examples/super/actions.js +230 -0
  96. package/dist/examples/super/artifact.d.ts +4 -0
  97. package/dist/examples/super/artifact.js +51 -0
  98. package/dist/examples/super/config.d.ts +80 -0
  99. package/dist/examples/super/config.js +83 -0
  100. package/dist/examples/super/coordinator.d.ts +33 -0
  101. package/dist/examples/super/coordinator.js +151 -0
  102. package/dist/examples/super/daemon.d.ts +11 -0
  103. package/dist/examples/super/daemon.js +109 -0
  104. package/dist/examples/super/decisions.d.ts +8 -0
  105. package/dist/examples/super/decisions.js +52 -0
  106. package/dist/examples/super/eject.json +5 -0
  107. package/dist/examples/super/execution.d.ts +11 -0
  108. package/dist/examples/super/execution.js +136 -0
  109. package/dist/examples/super/github.d.ts +62 -0
  110. package/dist/examples/super/github.js +269 -0
  111. package/dist/examples/super/inbox.d.ts +162 -0
  112. package/dist/examples/super/inbox.js +284 -0
  113. package/dist/examples/super/location.d.ts +5 -0
  114. package/dist/examples/super/location.js +64 -0
  115. package/dist/examples/super/operator.d.ts +1 -0
  116. package/dist/examples/super/operator.js +31 -0
  117. package/dist/examples/super/outbox.d.ts +5 -0
  118. package/dist/examples/super/outbox.js +103 -0
  119. package/dist/examples/super/project.d.ts +4 -0
  120. package/dist/examples/super/project.js +251 -0
  121. package/dist/examples/super/prompts.d.ts +3 -0
  122. package/dist/examples/super/prompts.js +25 -0
  123. package/dist/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  124. package/dist/examples/taskpool/harness/controller.d.ts +35 -6
  125. package/dist/examples/taskpool/harness/controller.js +73 -7
  126. package/dist/examples/taskpool/project.js +18 -2
  127. package/dist/scripts/anyswarm-arguments.d.ts +18 -6
  128. package/dist/scripts/anyswarm-arguments.js +88 -52
  129. package/dist/scripts/anyswarm-author.d.ts +5 -0
  130. package/dist/scripts/anyswarm-author.js +24 -0
  131. package/dist/scripts/anyswarm-eject.d.ts +11 -0
  132. package/dist/scripts/anyswarm-eject.js +164 -0
  133. package/dist/scripts/anyswarm-harnesses.d.ts +1 -0
  134. package/dist/scripts/anyswarm-harnesses.js +10 -0
  135. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  136. package/dist/scripts/anyswarm-installation.js +17 -285
  137. package/dist/scripts/anyswarm-launch.d.ts +7 -0
  138. package/dist/scripts/anyswarm-launch.js +37 -0
  139. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  140. package/dist/scripts/anyswarm-progress.js +102 -0
  141. package/dist/scripts/anyswarm-project.d.ts +3 -1
  142. package/dist/scripts/anyswarm-project.js +49 -35
  143. package/dist/scripts/anyswarm-source-runner.d.ts +1 -0
  144. package/dist/scripts/anyswarm-source-runner.js +200 -0
  145. package/dist/scripts/anyswarm.js +28 -3
  146. package/dist/scripts/build-provenance.json +1 -0
  147. package/dist/scripts/build.js +7 -1
  148. package/dist/scripts/generate-architecture-api.js +2 -0
  149. package/dist/scripts/generate-architecture-prompts.js +24 -2
  150. package/dist/scripts/local-environment.d.ts +13 -2
  151. package/dist/scripts/local-environment.js +111 -28
  152. package/dist/scripts/local-setup-smoke.js +3 -2
  153. package/dist/scripts/local-setup-worker.d.ts +1 -1
  154. package/dist/scripts/local-setup-worker.js +15 -6
  155. package/dist/scripts/local-setup.d.ts +5 -2
  156. package/dist/scripts/local-setup.js +167 -79
  157. package/dist/scripts/opensandbox-agent-worker.js +2 -2
  158. package/dist/scripts/pack-release.d.ts +1 -0
  159. package/dist/scripts/pack-release.js +66 -0
  160. package/dist/scripts/pi-session-bridge.js +11 -3
  161. package/dist/scripts/run-harness.js +3 -1
  162. package/dist/scripts/setup-bootstrap.js +43 -6
  163. package/dist/src/core/allocation-ledger.js +4 -3
  164. package/dist/src/core/host-identity.d.ts +2 -0
  165. package/dist/src/core/host-identity.js +11 -0
  166. package/dist/src/core/index.d.ts +4 -2
  167. package/dist/src/core/index.js +12 -4
  168. package/dist/src/core/mcp-service.js +2 -2
  169. package/dist/src/core/runtime-management.d.ts +6 -0
  170. package/dist/src/core/runtime-management.js +24 -0
  171. package/dist/src/core/sandbox/executor-driver.d.ts +4 -2
  172. package/dist/src/core/sandbox/executor-driver.js +12 -14
  173. package/dist/src/core/sandbox/local-executor.d.ts +13 -1
  174. package/dist/src/core/sandbox/local-executor.js +69 -19
  175. package/dist/src/core/sandbox/local-worker.js +32 -21
  176. package/dist/src/core/sandbox/opensandbox-backend.d.ts +2 -0
  177. package/dist/src/core/sandbox/opensandbox-backend.js +36 -11
  178. package/dist/src/core/sandbox/sandbox-connection.d.ts +2 -0
  179. package/dist/src/core/sandbox/sandbox-connection.js +14 -6
  180. package/dist/src/core/service-live-state.d.ts +14 -0
  181. package/dist/src/core/service-live-state.js +161 -0
  182. package/dist/src/core/service-observation-types.d.ts +21 -1
  183. package/dist/src/core/service-process.d.ts +1 -1
  184. package/dist/src/core/service-process.js +45 -4
  185. package/dist/src/core/service-types.d.ts +5 -1
  186. package/dist/src/core/services.d.ts +1 -1
  187. package/dist/src/core/services.js +8 -3
  188. package/dist/src/core/types.d.ts +3 -0
  189. package/dist/src/core/worker-image.js +3 -3
  190. package/dist/src/harness/harness-session-types.d.ts +10 -0
  191. package/dist/src/harness/harness-session.js +42 -5
  192. package/dist/src/harness/project-harness.d.ts +14 -1
  193. package/dist/src/harness/project-harness.js +38 -12
  194. package/dist/src/harness/project-input.js +81 -15
  195. package/dist/src/harness/project-rpc-client.d.ts +1 -0
  196. package/dist/src/harness/project-rpc-client.js +5 -0
  197. package/dist/src/harness/project-rpc.d.ts +8 -2
  198. package/dist/src/harness/project-rpc.js +31 -7
  199. package/dist/src/harness/project-runtime.js +6 -2
  200. package/dist/src/harness/typescript-loader.d.ts +2 -0
  201. package/dist/src/harness/typescript-loader.js +41 -0
  202. package/dist/src/trace-viewer/public/app.js +6 -5
  203. package/dist/src/trace-viewer/reader.mjs +42 -2
  204. package/docs/INDEX.md +5 -2
  205. package/docs/architecture/00-overview.md +1 -1
  206. package/docs/architecture/01-agent-core.md +1 -1
  207. package/docs/architecture/04-services.md +1 -1
  208. package/docs/architecture/06-observability-experiments.md +1 -1
  209. package/docs/architecture/07-run-configuration.md +38 -18
  210. package/docs/architecture/08-prompts.md +22 -0
  211. package/docs/architecture/10-service-api-reference.md +53 -18
  212. package/docs/architecture/11-storage-reference.md +18 -1
  213. package/docs/architecture/12-code-coverage.md +152 -89
  214. package/docs/architecture/15-core-runtime.md +8 -0
  215. package/docs/architecture/16-pi-opensandbox-backend.md +5 -5
  216. package/docs/architecture/17-harness-reporting.md +1 -1
  217. package/docs/architecture/19-substrate-harness.md +28 -1
  218. package/docs/architecture/20-lead-worker-harness.md +34 -1
  219. package/docs/architecture/22-website.md +5 -6
  220. package/docs/architecture/23-project-harness.md +152 -8
  221. package/docs/architecture/24-runtime-recovery.md +10 -3
  222. package/docs/architecture/26-code.md +54 -0
  223. package/docs/architecture/27-personal.md +58 -0
  224. package/docs/architecture/28-autoresearch.md +43 -0
  225. package/docs/architecture/INDEX.md +3 -0
  226. package/docs/architecture/prompts/08-lead-worker-harness.md +4 -2
  227. package/docs/architecture/prompts/08-subagents-harness.md +21 -0
  228. package/docs/architecture/prompts/21-personal.md +44 -0
  229. package/docs/architecture/prompts/22-autoresearch.md +63 -0
  230. package/docs/architecture/prompts/26-code.md +55 -0
  231. package/docs/architecture/prompts/source-manifest.json +152 -33
  232. package/docs/architecture/source-map.json +473 -25
  233. package/docs/designs/core-harness/01-core.md +2 -2
  234. package/docs/designs/core-harness/06-project-harness.md +13 -2
  235. package/docs/designs/core-harness/README.md +7 -2
  236. package/docs/en/agents.md +1 -1
  237. package/docs/en/build-your-harness.md +3 -5
  238. package/docs/en/changelog.md +20 -4
  239. package/docs/en/first-harness.md +9 -12
  240. package/docs/en/harnesses/lead-worker.md +1 -1
  241. package/docs/en/harnesses/peermesh.md +2 -2
  242. package/docs/en/harnesses/subagents.md +2 -2
  243. package/docs/en/harnesses/substrate.md +4 -4
  244. package/docs/en/harnesses/taskpool.md +2 -2
  245. package/docs/en/latest.md +14 -121
  246. package/docs/en/overview.md +1 -1
  247. package/docs/en/quickstart.md +42 -39
  248. package/docs/en/reference/api.md +14 -4
  249. package/docs/en/reference/cli.md +53 -47
  250. package/docs/en/runtime.md +2 -2
  251. package/docs/en/sandbox.md +3 -3
  252. package/docs/en/services.md +4 -0
  253. package/docs/operations/trace-viewer.md +1 -1
  254. package/docs/workflows/development.md +28 -21
  255. package/docs/workflows/release-and-docs-versioning.md +77 -0
  256. package/docs/workflows/release-cli-acceptance.md +85 -0
  257. package/docs/zh/agents.md +1 -1
  258. package/docs/zh/build-your-harness.md +3 -5
  259. package/docs/zh/changelog.md +20 -4
  260. package/docs/zh/first-harness.md +9 -12
  261. package/docs/zh/harnesses/lead-worker.md +1 -1
  262. package/docs/zh/harnesses/peermesh.md +2 -2
  263. package/docs/zh/harnesses/subagents.md +2 -2
  264. package/docs/zh/harnesses/substrate.md +4 -4
  265. package/docs/zh/harnesses/taskpool.md +2 -2
  266. package/docs/zh/latest.md +15 -122
  267. package/docs/zh/overview.md +1 -1
  268. package/docs/zh/quickstart.md +42 -39
  269. package/docs/zh/reference/api.md +14 -4
  270. package/docs/zh/reference/cli.md +24 -40
  271. package/docs/zh/runtime.md +2 -2
  272. package/docs/zh/sandbox.md +3 -3
  273. package/docs/zh/services.md +4 -0
  274. package/examples/README.md +35 -12
  275. package/examples/authoring/README.md +24 -0
  276. package/examples/authoring/business.ts +4 -0
  277. package/examples/authoring/config.ts +2 -0
  278. package/examples/authoring/eject.json +5 -0
  279. package/examples/authoring/harness.ts +21 -0
  280. package/examples/autoresearch/README.md +40 -0
  281. package/examples/autoresearch/REQUIREMENTS.zh.md +11 -0
  282. package/examples/autoresearch/config.ts +90 -0
  283. package/examples/autoresearch/demo.ts +55 -0
  284. package/examples/autoresearch/eject.json +17 -0
  285. package/examples/autoresearch/frontiercs2-config.ts +4 -0
  286. package/examples/autoresearch/frontiercs2.ts +237 -0
  287. package/examples/autoresearch/prepare-demo.ts +15 -0
  288. package/examples/autoresearch/prepare.ts +267 -0
  289. package/examples/autoresearch/process.ts +50 -0
  290. package/examples/autoresearch/project.ts +380 -0
  291. package/examples/autoresearch/research-service.ts +302 -0
  292. package/examples/code/README.md +33 -0
  293. package/examples/code/REQUIREMENTS.zh.md +11 -0
  294. package/examples/code/candidate.ts +89 -0
  295. package/examples/code/config.ts +19 -0
  296. package/examples/code/eject.json +5 -0
  297. package/examples/code/project.ts +581 -0
  298. package/examples/code/prompts.ts +16 -0
  299. package/examples/code/verification.ts +239 -0
  300. package/examples/code/worktree.ts +188 -0
  301. package/examples/harness-session/README.md +3 -6
  302. package/examples/lead-worker/harness/dynamic-scheduler.ts +6 -3
  303. package/examples/lead-worker/harness/index.ts +61 -6
  304. package/examples/lead-worker/project.ts +2 -2
  305. package/examples/lead-worker/services/board.ts +14 -1
  306. package/examples/messages/README.md +5 -5
  307. package/examples/messages/handoff.ts +6 -2
  308. package/examples/messages/project.ts +47 -2
  309. package/examples/notes/README.md +13 -18
  310. package/examples/notes/project.ts +57 -9
  311. package/examples/peermesh/harness/router.ts +2 -2
  312. package/examples/peermesh/harness/team.ts +11 -0
  313. package/examples/peermesh/project.ts +19 -4
  314. package/examples/services/agent-control/README.md +3 -3
  315. package/examples/services/mathlib-search/Dockerfile +4 -2
  316. package/examples/services/mathlib-search/README.md +1 -1
  317. package/examples/services/mcp-managed/README.md +2 -2
  318. package/examples/services/persistent-board/README.md +16 -3
  319. package/examples/services/persistent-board/business.ts +10 -0
  320. package/examples/services/persistent-board/index.ts +10 -0
  321. package/examples/services/persistent-board/live.ts +54 -0
  322. package/examples/subagents/README.md +5 -5
  323. package/examples/subagents/business.ts +3 -1
  324. package/examples/subagents/config.ts +4 -3
  325. package/examples/subagents/harness/controller.ts +161 -29
  326. package/examples/subagents/project.ts +47 -33
  327. package/examples/subagents/prompts/prompts.ts +4 -0
  328. package/examples/subagents/services/collaboration-service.ts +14 -2
  329. package/examples/substrate/README.md +2 -2
  330. package/examples/substrate/harness/index.ts +67 -11
  331. package/examples/substrate/project.ts +5 -1
  332. package/examples/super/README.md +52 -0
  333. package/examples/super/actions.ts +196 -0
  334. package/examples/super/artifact.ts +56 -0
  335. package/examples/super/config.ts +95 -0
  336. package/examples/super/coordinator.ts +158 -0
  337. package/examples/super/daemon.ts +84 -0
  338. package/examples/super/decisions.ts +46 -0
  339. package/examples/super/eject.json +5 -0
  340. package/examples/super/execution.ts +131 -0
  341. package/examples/super/github.ts +242 -0
  342. package/examples/super/inbox.ts +306 -0
  343. package/examples/super/location.ts +54 -0
  344. package/examples/super/operator.ts +28 -0
  345. package/examples/super/outbox.ts +97 -0
  346. package/examples/super/project.ts +225 -0
  347. package/examples/super/prompts.ts +27 -0
  348. package/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  349. package/examples/taskpool/harness/controller.ts +59 -7
  350. package/examples/taskpool/project.ts +18 -2
  351. package/npm-shrinkwrap.development.json +700 -0
  352. package/npm-shrinkwrap.json +95 -1969
  353. package/package.development.json +88 -0
  354. package/package.json +11 -8
  355. package/scripts/anyswarm-arguments.ts +91 -54
  356. package/scripts/anyswarm-author.ts +25 -0
  357. package/scripts/anyswarm-eject.ts +145 -0
  358. package/scripts/anyswarm-harnesses.ts +10 -0
  359. package/scripts/anyswarm-installation.ts +18 -288
  360. package/scripts/anyswarm-launch.ts +36 -0
  361. package/scripts/anyswarm-progress.ts +95 -0
  362. package/scripts/anyswarm-project.ts +35 -34
  363. package/scripts/anyswarm-source-runner.ts +176 -0
  364. package/scripts/anyswarm.ts +24 -3
  365. package/scripts/build.ts +8 -1
  366. package/scripts/generate-architecture-api.ts +2 -0
  367. package/scripts/generate-architecture-prompts.ts +35 -2
  368. package/scripts/local-environment.ts +117 -28
  369. package/scripts/local-setup-smoke.ts +3 -2
  370. package/scripts/local-setup-worker.ts +17 -7
  371. package/scripts/local-setup.ts +166 -73
  372. package/scripts/opensandbox-agent-worker.ts +2 -2
  373. package/scripts/pack-release.ts +70 -0
  374. package/scripts/pi-session-bridge.ts +10 -2
  375. package/scripts/run-harness.ts +3 -1
  376. package/scripts/setup-bootstrap.ts +41 -6
  377. package/src/core/allocation-ledger.ts +5 -3
  378. package/src/core/host-identity.ts +11 -0
  379. package/src/core/index.ts +12 -6
  380. package/src/core/mcp-service.ts +2 -2
  381. package/src/core/runtime-management.ts +22 -0
  382. package/src/core/sandbox/executor-driver.ts +15 -18
  383. package/src/core/sandbox/local-executor.ts +65 -19
  384. package/src/core/sandbox/local-worker.ts +29 -21
  385. package/src/core/sandbox/opensandbox-backend.ts +36 -11
  386. package/src/core/sandbox/sandbox-connection.ts +14 -5
  387. package/src/core/service-live-state.ts +156 -0
  388. package/src/core/service-observation-types.ts +23 -1
  389. package/src/core/service-process.ts +36 -3
  390. package/src/core/service-types.ts +3 -1
  391. package/src/core/services.ts +8 -3
  392. package/src/core/types.ts +3 -0
  393. package/src/core/worker-image.ts +3 -3
  394. package/src/harness/harness-session-types.ts +13 -1
  395. package/src/harness/harness-session.ts +40 -7
  396. package/src/harness/project-harness.ts +38 -12
  397. package/src/harness/project-input.ts +73 -15
  398. package/src/harness/project-rpc-client.ts +5 -0
  399. package/src/harness/project-rpc.ts +29 -8
  400. package/src/harness/project-runtime.ts +4 -2
  401. package/src/harness/typescript-loader.ts +37 -0
  402. package/src/trace-viewer/public/app.js +6 -5
  403. package/src/trace-viewer/reader.mjs +42 -2
@@ -1,108 +1,111 @@
1
1
  ---
2
2
  title: Quickstart
3
- description: Prepare Linux prerequisites, install AnySwarm, initialize OpenSandbox and the Worker image, and run a first Sandbox and file-reading check.
3
+ description: Prepare Linux or macOS prerequisites, install AnySwarm, initialize OpenSandbox and the Worker image, and run a first Sandbox and file-reading check.
4
4
  section: GET STARTED
5
5
  order: 1
6
6
  ---
7
7
 
8
8
  To build an application with the TypeScript SDK, follow [Build your first SDK Harness](first-harness.md).
9
9
 
10
- AnySwarm ships its CLI and TypeScript SDK in one package and runs Agents inside [OpenSandbox](sandbox.md) containers. You can run OpenSandbox locally with Docker Engine or connect to an existing OpenSandbox service.
10
+ AnySwarm ships its CLI and TypeScript SDK in one package and runs Agents inside [OpenSandbox](sandbox.md) containers. This guide runs OpenSandbox and Workers on your machine using Docker.
11
11
 
12
- This guide covers the stable release, starting with v0.4.1. If you already use v0.4.0, see [how to upgrade](latest.md#upgrade-from-v040-to-the-managed-installer).
12
+ This guide covers [AnySwarm v0.5.1](latest.md#v051).
13
13
 
14
14
  ## Prerequisites
15
15
 
16
16
  | Dependency | Requirement | Verify |
17
17
  | --- | --- | --- |
18
- | **Linux** | Controller host (e.g., Ubuntu / Debian) | `uname -s` |
18
+ | **Linux or macOS** | Controller host (e.g., Ubuntu, Debian, or macOS with Docker Desktop) | `uname -s` |
19
19
  | **Node.js** | `>= 22.19` (install LTS from [nodejs.org](https://nodejs.org/en/download); Ubuntu 24.04 and Debian 13 repos ship older versions) | `node --version` |
20
20
  | **npm** | Install with Node.js | `npm --version` |
21
21
  | **Git** | Required for the source checkout and project capture | `git --version` |
22
- | **curl** | Required to download the installer | `curl --version` |
23
- | **Docker Engine** | Required for local OpenSandbox only; skip when using an existing service ([install guide](https://docs.docker.com/engine/install/)) | `docker info` |
22
+ | **Docker Engine** | A running local Linux container engine ([install guide](https://docs.docker.com/engine/install/)) | `docker info` |
24
23
 
25
24
  On Ubuntu or Debian with local Docker, install the system dependencies and start Docker:
26
25
 
27
26
  ```bash
28
- sudo apt-get update && sudo apt-get install -y docker.io git curl ca-certificates
27
+ sudo apt-get update && sudo apt-get install -y docker.io git ca-certificates
29
28
  sudo systemctl enable --now docker.service
30
29
  ```
31
30
 
32
- For an existing OpenSandbox service, install only `git curl ca-certificates` and skip the Docker service and group steps.
33
-
34
31
  If the Docker socket denies access, an administrator can run `sudo usermod -aG docker alice`, replacing `alice` with the account that runs AnySwarm. Sign in again as that account and run `id` and `docker info`. The [`docker` group grants root-equivalent access](https://docs.docker.com/engine/install/linux-postinstall/).
35
32
 
36
- ## 1. Install AnySwarm
33
+ ### Docker on macOS
37
34
 
38
- ### Install a published release
35
+ **Before running local setup:** install [Docker Desktop for Mac](https://docs.docker.com/desktop/setup/install/mac-install/), open Docker, and wait for the engine to start. If you already use another local Linux container engine such as [OrbStack](https://orbstack.dev/download), start it instead. The `docker` CLI alone (for example, `brew install docker`) is not enough. AnySwarm installs its npm dependencies, but neither the npm command nor `anyswarm setup` installs or starts Docker Desktop for you.
36
+
37
+ Check that the running engine is selected in the terminal where you will run AnySwarm:
39
38
 
40
39
  ```bash
41
- curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
40
+ docker context ls
41
+ docker context show
42
+ docker info --format '{{.OSType}}/{{.Architecture}}'
42
43
  ```
43
44
 
44
- This command installs the latest GitHub Release and reports the version, CLI path, package root, and archive source. Apply the printed PATH command if needed, then run `anyswarm --version`. For the pinned v0.4.0 download and checksum, see the [release guide](latest.md#install-or-upgrade).
45
+ If the wrong context is selected, run `docker context use <local-context>` and check whether `DOCKER_CONTEXT` or `DOCKER_HOST` overrides it. The expected daemon is Linux ARM64 on Apple Silicon, or Linux x86-64 on Intel; setup does not use emulation. If a separately installed Docker client reports `docker-credential-desktop` not found, put Docker Desktop's CLI tools on PATH in its settings, or add `/Applications/Docker.app/Contents/Resources/bin` to PATH. Use Node.js 24 LTS for TypeScript author commands; Node.js 26 removed the transform mode they currently use.
45
46
 
46
- ### Install the TypeScript SDK in a project
47
+ The v0.5.1 release supports native macOS setup with a supported backend. The controlled-model macOS checks for [#339](https://github.com/AnySwarm/anyswarm/issues/339) use Apple Silicon and Docker Desktop, with npm Pi 1.3.0 and 1.7.0 and standalone Codex 0.173.0. Intel and other container engines need separate verification.
48
+
49
+ ## 1. Install AnySwarm
50
+
51
+ ### Install a published release
47
52
 
48
- Run this command in your Node.js project directory.
53
+ Install the CLI with Node.js 22.19 or newer and npm. The command is the same on Linux and macOS. Docker is needed when you run setup.
49
54
 
50
55
  ```bash
51
- npm install @anyswarm/anyswarm@0.4.1
56
+ npm install -g @anyswarm/core
57
+ anyswarm --version
52
58
  ```
53
59
 
54
- This installs the published SDK and uses the import path `@anyswarm/anyswarm`. Build the repository archive below for the current `@anyswarm/core` API.
60
+ The `-g` flag installs the command into npm's global bin directory. If your shell cannot find it, check that `$(npm prefix -g)/bin` is on your PATH and that your shell is using the Node.js installation you used to install the CLI.
55
61
 
56
- For project-local setup and a runnable example, follow the [first SDK Harness tutorial](first-harness.md).
62
+ If you are writing a Harness in TypeScript, follow [Install the SDK](reference/api.md#install-the-sdk) to add it as a project dependency.
57
63
 
58
64
  ### Build and install from source (`main`)
59
65
 
60
- Run these commands from the repository root. `npm ci` installs dependencies, `npm pack` compiles and packages the tarball, and the official installer stages the CLI under `$HOME/.local`:
66
+ Run these commands from the repository root. `npm run pack:release` builds the distribution archive. The last command installs the archive into the selected npm prefix.
61
67
 
62
68
  ```bash
63
69
  git clone https://github.com/AnySwarm/anyswarm.git && cd anyswarm
64
70
  npm ci --no-audit --no-fund
65
71
  pack_dir=$(mktemp -d)
66
- npm pack --pack-destination "$pack_dir"
67
- npm_config_prefix="$HOME/.local" sh website/public/install.sh --archive "$pack_dir"/*.tgz
72
+ npm run pack:release -- "$pack_dir"
73
+ npm install -g --prefix "$HOME/.local" "$pack_dir"/*.tgz
68
74
  export PATH="$HOME/.local/bin:$PATH"
69
75
  anyswarm --version
70
76
  ```
71
77
 
72
78
  The candidate can share its package version with the release. Record the source commit and the tarball SHA-256 to identify it. Keep the candidate tarball if you want to install the same SDK in an [independent example project](../../examples/README.md).
73
79
 
74
- ### Update a managed CLI
80
+ ### Update the CLI
81
+
82
+ Run `npm install -g @anyswarm/core@latest` to update or `npm uninstall -g @anyswarm/core` to uninstall. Use the same Node.js installation and npm prefix. If npm reports `EACCES`, switch to a user-owned Node installation or install to a writable prefix, for example `npm install -g --prefix "$HOME/.local" @anyswarm/core`. Add `$HOME/.local/bin` to PATH and reuse that prefix for updates and removal.
75
83
 
76
- `anyswarm update` resolves the latest stable release, checks its archive checksum and runs the staged CLI to verify its version before switching the active entry. A failed update leaves the prior CLI available. Global npm installs and releases that predate `update` can switch to managed installation with the official installer. See [upgrading from v0.4.0](latest.md#upgrade-from-v040-to-the-managed-installer) for the CLI and custom OpenSandbox endpoint steps. For other install scopes, the CLI reports the original package path and the applicable command. The command updates CLI software only. Projects keep their own SDK and lockfile, and setup or the consuming SDK prepares new execution materials as needed.
84
+ If you used the old shell installer for v0.5.0 or v0.5.1, check the `anyswarm`, `anys`, and `swarm` links in `$(npm prefix -g)/bin`. Clear only links that point into the old AnySwarm installation under `lib/anyswarm/current`, then install with npm. AnySwarm configuration lives outside the CLI installation.
85
+
86
+ To update a project's SDK, use its package manager in the project directory.
77
87
 
78
88
  ## 2. Prepare OpenSandbox and the Worker
79
89
 
80
- Choose a supported Linux npm installation of Pi or Codex. For example:
90
+ Run setup on the machine where you want OpenSandbox and the Worker to run.
81
91
 
82
92
  ```bash
83
- npm install --global @earendil-works/pi-coding-agent@1.3.0
84
- pi --version
85
- anyswarm setup --backend pi
93
+ anyswarm setup
86
94
  ```
87
95
 
88
- Setup accepts Pi 1.3.0 or 1.4.0 and Codex 0.172.0 from the `@openai/codex` npm distribution. Use `--backend codex` to select Codex, or `--backend-path /absolute/path/to/bin/pi` to select a specific npm executable. Without a saved selection, an interactive terminal can choose between two detected installs. Use `--backend` for automation when both are installed.
96
+ Setup detects the OS and Node version, checks the local Docker engine, and looks for your saved settings or an installed Pi or Codex backend. If a prerequisite is missing, follow the reported commands and rerun setup. Use `anyswarm doctor` for a read-only check of the same local prerequisites and Lifecycle connection.
89
97
 
90
- For a new local configuration, setup defaults to `127.0.0.1:8080`, builds a Worker from the selected installation and SDK package, and pulls the pinned upstream OpenSandbox 1.2.1 components. It saves the managed connection after a controlled smoke verifies Worker, Bridge, Gateway, files, export and deletion. Expect `"ok": true` and `"infrastructure": "ready"`. Repeating setup restores a stopped managed service and reruns the smoke. Test with `ANYSWARM_CONFIG_DIR=/path/to/private-directory` and a free loopback port if needed.
98
+ If you need a backend, install Pi with `npm install -g @earendil-works/pi-coding-agent` or Codex with `npm install -g @openai/codex`. On macOS, setup also accepts standalone Codex when the same release is available for Linux from npm. Setup selects the only compatible backend when it finds one. When both are compatible, terminal setup can ask you to choose. In automation, use `anyswarm setup --backend pi` or `anyswarm setup --backend codex`.
91
99
 
92
- Setup builds AnySwarm Workers locally. A matching Docker image is reused by content identity. Base image, apt and npm dependencies can require Internet access. Model routes and credentials still come from your explicit AnySwarm environment or project configuration. The controlled setup smoke does not verify those model credentials.
100
+ Bare setup reuses the saved executable path. To choose a different installation, supply `--backend pi --backend-path /absolute/path/to/bin/pi` or the corresponding Codex options. To require an installed version, add `--backend-version 1.7.0` (substitute the version you intend to use). A saved version pin rejects an executable that later reports a different version. Repeat explicit backend selection without a pin to follow upgrades to that installation.
93
101
 
94
- ### Connect to an existing OpenSandbox
102
+ On macOS, setup prepares the same release's Linux package inside a native Docker container. It verifies the Worker version and runs the executor startup and controlled protocol smoke before saving the connection. Without a saved selection, an interactive terminal prompts when both backends are installed. Use `--backend` in automation when both are present.
95
103
 
96
- ```bash
97
- export OPEN_SANDBOX_API_KEY='<operator-provided-key>'
98
- anyswarm setup --mode existing --endpoint https://sandbox.example.net \
99
- --public-url https://runtime.example.net/anyswarm
100
- anyswarm doctor --smoke
101
- ```
104
+ For a new local configuration, setup defaults to `127.0.0.1:8080`, builds a Worker from the selected installation and SDK package, and pulls the pinned upstream OpenSandbox 1.2.1 components. It saves the managed connection after a controlled smoke verifies Worker, Bridge, Gateway, files, export and deletion. Expect `"ok": true` and `"infrastructure": "ready"`. Repeating setup restores a stopped managed service and reruns the smoke. Test with `ANYSWARM_CONFIG_DIR=/path/to/private-directory` and a free loopback port if needed.
102
105
 
103
- Existing setup verifies authentication and saves the endpoint, key and callback in owner-only user configuration. The remote Controller needs Node and network access. Its operator prepares a matching Worker image on the service. Set `ANYSWARM_WORKER_IMAGE` to that image before the probe and your project run. `doctor` performs a read-only configuration and Lifecycle check. `doctor --smoke` allocates a temporary Sandbox and verifies Controller-to-Worker and Sandbox-to-Runtime traffic before confirming export and deletion. An unavailable saved remote connection produces an error for that connection.
106
+ Setup builds AnySwarm Workers locally. A matching Docker image is reused by content identity. Base image, apt and npm dependencies can require Internet access. Model routes and credentials still come from your explicit AnySwarm environment or project configuration. The controlled setup smoke does not verify those model credentials. Use `anyswarm doctor --smoke` to repeat the controlled probe.
104
107
 
105
- `connection.publicUrl` is one callback address for Bridge and model requests. A reverse proxy should forward that path prefix to the Runtime's `bindHost` and fixed `bindPort`. Local setup discovers its reachable host and available port. See [Sandboxes](sandbox.md) and [Host Gateway](gateway.md).
108
+ The local service runs on the same machine as the CLI. To use a service you operate, see [Connect an existing OpenSandbox service](sandbox.md).
106
109
 
107
110
  ### Diagnose image availability
108
111
 
@@ -5,11 +5,19 @@ section: REFERENCE
5
5
  order: 15
6
6
  ---
7
7
 
8
- This reference covers the public runtime exports, method contracts, and error recovery rules for **`@anyswarm/core` (current source)**. For conceptual guides, start with [Runtime & Agents](../runtime.md) and [Services & Permissions](../services.md); for exact TypeScript declarations, see [Types & Source Map](./types.md); for host and container CLIs, see [CLI Reference](./cli.md).
8
+ This reference covers the public runtime exports, method contracts, and error recovery rules for **`@anyswarm/core`**. For conceptual guides, start with [Runtime & Agents](../runtime.md) and [Services & Permissions](../services.md); for exact TypeScript declarations, see [Types & Source Map](./types.md); for host and container CLIs, see [CLI Reference](./cli.md).
9
9
 
10
10
  ## Install the SDK
11
11
 
12
- In a Node.js 22.19+ project, install the verified SDK tarball from a [source build](../quickstart.md#build-and-install-from-source-main) to use the current `@anyswarm/core` API. For the published `@anyswarm/anyswarm@0.4.1` SDK and the package-name migration, see [Releases and main updates](../latest.md).
12
+ Run this command in your Node.js project to add the TypeScript SDK as a dependency. Use Node.js 22.19 or later.
13
+
14
+ ```bash
15
+ npm install @anyswarm/core
16
+ ```
17
+
18
+ Import the SDK from `@anyswarm/core`. The same install exposes the project-local CLI through `npm exec -- anyswarm`. To run `anyswarm` directly from any directory, use a [global CLI install](../quickstart.md#1-install-anyswarm).
19
+
20
+ For a verified [source build](../quickstart.md#build-and-install-from-source-main), install its archive with the command below. The [release page](../latest.md#v051) shows how to pin the released SDK.
13
21
 
14
22
  ```bash
15
23
  npm install --ignore-scripts /path/to/verified-anyswarm.tgz
@@ -26,9 +34,11 @@ All public values and TypeScript types are imported from the single root entry `
26
34
  | `createSandbox(config)` | Function | Creates a reusable OpenSandbox connection handle or plugs in a custom `{ provider }` `SandboxProvider`. |
27
35
  | `resolveSandboxConnection(overrides?)` | Function | Resolves Lifecycle URL, local token, and image defaults matching the CLI (use only in trusted host config). |
28
36
  | `createRuntime(options)` | Async function | Opens a Run control plane (`outputDir/<runtimeId>/`, Service Bridge, Model Gateway) with configurable `executor`, `filePolicy`, and durable persistence options. |
37
+ | `resolveFilePolicy(policy?)` | Function | Validates and fills file budgets with the defaults used by Runtime and the project host. Harness authors can use the resolved limits for local candidate checks. |
29
38
  | `recoverRuntime(options)` | Async function | Reopens a durable Run under verified same-host, same-boot ownership; supports cleanup-only mode and dynamic Service restoration. |
30
39
  | `createHarnessSession(harness, options)` / `HarnessRpcClient` | Function / Class | Drives a standard `Harness` in-process or over a JSONL child-process pipe with live events, questions, and member controls. |
31
- | `createPiExecutor({ version })` / `createCodexExecutor({ version })` | Function | Selects a verified built-in executor version (Pi `1.3.0` / `1.4.0`, Codex `0.172.0`); `'pi'` / `'codex'` shorthands remain supported. |
40
+ | `runProjectRpc(session, input, write, launchDirectory, initialInput?, options?)` | Function | Serves HarnessSession JSONL over a host-owned stream. `detachOnDisconnect` keeps the Session running when that observer disconnects. |
41
+ | `createPiExecutor({ version })` / `createCodexExecutor({ version })` | Function | Pins an exact built-in executor version when supplied; `'pi'` / `'codex'` shorthands remain supported. |
32
42
  | `createExecutorAdapter(declaration)` / `EXECUTOR_ADAPTER_PROTOCOL` | Function / Constant | Declares an image-installed external executor adapter (`anyswarm-executor-v1`). |
33
43
  | `DEFAULT_WORKER_IMAGE` / `workerImageFor(selection)` | Constant / Function | Select local Worker preparation for the Runtime’s executor, or select a particular executor and optionally pin its version. |
34
44
  | `getExecutorCapabilities(selection)` | Function | Static capability lookup for a configured executor (no network side effects). |
@@ -88,7 +98,7 @@ const runtime = await createRuntime({
88
98
 
89
99
  - **`models`**: defaults to streaming Responses; Pi also supports `protocol: 'chat-completions'` and `capabilities: { contextWindow, maxOutputTokens, tools, reasoning }`; trusted host modules can supply a custom `ModelTransport`. Upstream credentials stay strictly on the host.
90
100
  - **`filePolicy`**: independently configure `initial`, `snapshot`, `replace`, `export`, and `session` limits (`maxBytes`, `maxFileBytes`, `maxFiles`, `maxEntries`, `timeoutMs`) plus `controllerSpoolBytes` and `workerSpoolBytes`.
91
- - **`getExecutorCapabilities(selection)`**: Pi (`1.3.0` / `1.4.0`) supports `contextFork`, `activeSteer`, `followUp`, and `one-at-a-time`; Codex (`0.172.0`) supports `activeSteer`, `followUp`, and `all` without context forking.
101
+ - **`getExecutorCapabilities(selection)`**: Pi supports `contextFork`, `activeSteer`, `followUp`, and `one-at-a-time`; Codex supports `activeSteer`, `followUp`, and `all` without context forking.
92
102
 
93
103
  ## Agent lifecycle
94
104
 
@@ -5,56 +5,62 @@ section: REFERENCE
5
5
  order: 16
6
6
  ---
7
7
 
8
- `@anyswarm/core` ships two binaries: **`anyswarm`** (run on the trusted Linux host) and **`swarm`** (preinstalled inside Worker containers so Agents can call Services over the Bridge).
8
+ The host command is `anyswarm`. Run it without arguments for Quickstart, or add
9
+ `--help` to a command for its options. The Worker image separately supplies
10
+ `swarm` for Agent calls to Services over the Bridge.
9
11
 
10
- ## Host CLI (`anyswarm`)
12
+ ## Host commands
11
13
 
12
- ### Commands overview
13
-
14
- | Command | Purpose |
14
+ | Workflow | Commands |
15
15
  | --- | --- |
16
- | `anyswarm` | Prints help and exits successfully in a terminal or pipeline |
17
- | `anyswarm --version` | Prints the installed `@anyswarm/core` version |
18
- | `anyswarm setup [--mode existing\|local] [--endpoint <url>] [--public-url <url>] [--backend pi\|codex] [--backend-path <executable>] [--config <module>]` | Starts a managed local OpenSandbox with auto-generated credentials (`--mode local`), or validates and saves an existing service (`--mode existing`); local mode also prepares and probes the selected Worker image |
19
- | `anyswarm doctor [--config <module>] [--smoke]` | Read-only configuration and Lifecycle auth diagnostics; pass `--smoke` for a live Pi/Codex Worker end-to-end probe |
20
- | `anyswarm update` | Verifies, stages and activates the latest stable CLI in a managed installation. Global npm users can switch once with the official installer |
21
- | `anyswarm --harness <module> --prompt <text> [options]` | Runs a built-in, local ESM, or package Harness in foreground against a project directory |
22
- | `anyswarm --harness <module> --mode rpc [options]` | Runs a Harness over JSONL `stdin`/`stdout` with `ready`, `run`, `status`, `stop`, and member controls |
23
- | `anyswarm recover --run-dir <dir> --config <module>` | Performs cleanup-only recovery on a durable Run under same-host, same-boot ownership and prints the receipt |
24
- | `anyswarm trace [--root] <runs-dir> [--port 8787] [--open]` | Starts the built-in browser [Trace Viewer](../trace-viewer.md) on `127.0.0.1` |
25
-
26
- The former scaffold command has been removed. A customized host can still be run directly with `node main.js config.js 'Your task'`. Use `node main.js config.js --interactive` for its existing terminal mode, or `anyswarm --harness ./project.js --config ./config.js --cwd ./input --prompt 'Your task'` for a project that exports a Harness. The full TUI is tracked in [#280](https://github.com/AnySwarm/anyswarm/issues/280).
27
-
28
- ### Running Harnesses (`anyswarm --harness`)
29
-
30
- ```bash
31
- # Foreground run against the current directory
32
- anyswarm --harness subagents --prompt "Fix the parser and add regression tests"
33
-
34
- # Explicit target directory, custom config module, and output root
35
- anyswarm --harness taskpool \
36
- --cwd ./my-project \
37
- --config ./taskpool.config.mjs \
38
- --output-dir ./runs \
39
- --prompt "Resolve all failing unit tests"
40
-
41
- # Local custom ESM Harness module
42
- anyswarm --harness ./review-harness.mjs --prompt "Audit error handling"
43
-
44
- # JSONL RPC mode (send {"id":"1","operation":"run","input":{"cwd":"...","prompt":"..."}} after ready)
45
- anyswarm --harness subagents --mode rpc --output-dir ./runs
16
+ | Prepare and verify local execution | `anyswarm setup`, `anyswarm doctor --smoke` |
17
+ | Upgrade the installed CLI | `anyswarm update` prints the npm command for the current global installation. Run the printed command from the same Node/npm environment. |
18
+ | Run an editable Harness | `anyswarm run ./project.ts --cwd ./input --config ./config.ts --prompt "Inspect the project"` |
19
+ | Run a built-in Harness or connect a client | `anyswarm --harness subagents --prompt "Read README.md" --output-dir ./runs`, or `anyswarm --harness subagents --mode rpc` |
20
+ | Export source and the exact SDK | `anyswarm eject example --dir ./my-harness` |
21
+ | Inspect records or recover pending cleanup | `anyswarm trace --root ./runs --port 8787 --open`, `anyswarm recover --run-dir <dir> --config <module>` |
22
+
23
+ `anyswarm --version` prints the installed package version. See [Quickstart](../quickstart.md) for local setup, explicit existing OpenSandbox connections and npm installation.
24
+
25
+ ## Run a Harness
26
+
27
+ Pick a built-in name, an explicit TypeScript or ESM module, or an installed npm
28
+ package resolved from the invocation directory. Built-ins are `subagents`,
29
+ `autoresearch`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes` and
30
+ `messages`. The project defaults to the invocation directory. `--config`
31
+ selects a trusted module and `--output-dir` selects the Run records root.
32
+ Set `--cwd` to capture a different project.
33
+
34
+ A one-shot Run starts from the supplied prompt. `run` supplies a default prompt
35
+ when a source Harness is launched without one. On a terminal, stdout shows Run
36
+ and Agent milestones, visible Service changes, exported artifact paths, cleanup,
37
+ and the command to view Trace. Redirect stdout for a single JSON result or
38
+ launch error. Source and Harness diagnostics go to stderr. `run` also executes
39
+ ordinary trusted source scripts with their original arguments.
40
+
41
+ For multiple turns, start `--mode rpc`, wait for the JSONL `ready` frame, and
42
+ send a `run` request with `cwd` and `prompt`. Use `--lifetime interactive` if
43
+ the Harness supports it and `--interaction questions` if the client can answer.
44
+ The stream carries replies, events and the final result on stdout. Use
45
+ `describe` for available controls and `stop` to initiate cleanup. [HarnessSession example](../../../examples/harness-session/README.md)
46
+
47
+ After ejecting, run `npm install` inside the export and start the editable
48
+ entry with its local CLI, for example `npm run start -- --prompt "Inspect the project"`.
49
+ See [Code](../../../examples/code/README.md) and [Personal](../../../examples/super/README.md)
50
+ for advanced SDK examples.
51
+
52
+ ### AutoResearch
53
+
54
+ AutoResearch is the non-interactive research showcase. It starts equal
55
+ peers in private Sandboxes, coordinates them through the research Service,
56
+ and records train, candidate and final evidence for [Trace Viewer](../trace-viewer.md).
57
+
58
+ ```sh
59
+ anyswarm --harness autoresearch --config ./research.ts --prompt "Your objective" --output-dir ./runs
46
60
  ```
47
61
 
48
- - **Built-in Harness names**: `subagents`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes`, `messages`.
49
- - **Module resolution**: pass a built-in name, an explicit `.mjs` / ESM `.js` path, or an installed npm package name (resolved from the invocation directory).
50
- - **RPC protocol (`--mode rpc`)**: emits JSONL frames on `stdout` and diagnostics on `stderr`. Wait for `ready`, then send a `run` request containing `cwd` and `prompt`.
51
-
52
- ### Session options and controls
53
-
54
- - **Lifetime (`--lifetime task|interactive`)**: defaults to single-task `task` mode. Harnesses that support ongoing sessions (such as Subagents) accept `interactive`, keeping the session alive until a configured deadline or explicit `stop`.
55
- - **User questions (`--interaction none|questions`)**: defaults to `none`. Set `questions` when the client can answer authorized mid-Run questions from Agents.
56
- - **Control channel**: foreground invocations with `--prompt` start immediately; when `interactive` or `questions` is enabled, subsequent commands flow over JSONL. `--mode rpc` waits for a `run` command before starting.
57
- - **Supported operations**: `describe` (discover capabilities), `status` (read snapshot), `answer` (respond by `questionId`), and `stop` (close the Run); native member queries and controls include `agent.getState`, `agent.getStats`, `agent.getMessages`, plus `agent.configure`, `agent.compact`, `agent.abortRetry`, `agent.clearQueue`, `agent.send`, `agent.interrupt`, and `agent.stop` (each Harness and executor decides which operations are permitted). The final result records report-save status and cleanup facts separately.
62
+ Use [the AutoResearch guide](../../../examples/autoresearch/README.md) to prepare the
63
+ pinned FrontierCS-2 demo or export and edit the Harness.
58
64
 
59
65
  ## Unified environment variables
60
66
 
@@ -112,7 +118,7 @@ swarm agent stop <agent-id> --request-id stop-1
112
118
  When working directly inside a built `anyswarm` source checkout, two additional developer scripts drive configured `taskpool` or `peermesh` fixtures over JSON-line `stdin` (`status`, `kickoff`, `input`, `wait`, `stop`) and inspect saved reports offline:
113
119
 
114
120
  ```bash
115
- node dist/scripts/run-harness.js --config <host-config.mjs>
121
+ node dist/scripts/run-harness.js --config <host-config.ts>
116
122
  node dist/scripts/read-harness-result.js --run-directory <dir> --runtime-id <id>
117
123
  ```
118
124
 
@@ -121,7 +127,7 @@ node dist/scripts/read-harness-result.js --run-directory <dir> --runtime-id <id>
121
127
  ## `anyswarm recover` (durable cleanup recovery)
122
128
 
123
129
  ```bash
124
- anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.mjs
130
+ anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.ts
125
131
  ```
126
132
 
127
133
  The config module default-exports either the original Runtime options object or a zero-argument async factory returning it. This command performs cleanup-only recovery, calls `close()`, prints the receipt, and exits `0` only when cleanup completes. Recovery requires same-host, same-boot exclusive writer ownership and matching durable persistence settings; unresolved resources remain tracked in the ledger until reconciliation confirms stop and deletion. Retry failed required exports before the reported `expiresAt`. See [Runtime durable recovery](../runtime.md#6-durable-recovery-and-kubernetes).
@@ -64,7 +64,7 @@ const runtime = await createRuntime({
64
64
 
65
65
  `createRuntime()` sets up the run directory, Model Gateway, and Service Bridge, but starts **zero sandboxes** until your Harness explicitly calls `runtime.spawn()` (covered next in [Agents & Profiles](agents.md)).
66
66
 
67
- > **Flexible executors & model protocols**: beyond the `'pi'` (`1.3.0` default) and `'codex'` (`0.172.0`) shorthands, use `createPiExecutor({ version: '1.4.0' })`, `createCodexExecutor(...)`, or `createExecutorAdapter(...)` for image-installed executors. Pi supports both **Responses** and **Chat Completions** (see [SDK & API Reference](reference/api.md)).
67
+ > **Flexible executors & model protocols**: beyond the `'pi'` and `'codex'` shorthands, which use the installed version, use `createPiExecutor({ version: '1.4.0' })`, `createCodexExecutor(...)`, or `createExecutorAdapter(...)` for image-installed executors. Pi supports both **Responses** and **Chat Completions** (see [SDK & API Reference](reference/api.md)).
68
68
 
69
69
  ### Custom reasoning models
70
70
 
@@ -208,7 +208,7 @@ const runtime = await recoverRuntime({
208
208
  - **Cleanup-only recovery (CLI)**: To reclaim cleanup authority and finish archiving/deleting sandboxes without resuming work, set `cleanupOnly: true` or run:
209
209
 
210
210
  ```bash
211
- anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.mjs
211
+ anyswarm recover --run-dir /private/runs/original-runtime-id --config /private/recovery.ts
212
212
  ```
213
213
 
214
214
  The config module's default export can be the original `options` object or a zero-argument async factory returning it. `anyswarm recover` runs cleanup-only recovery, calls `close()`, prints the receipt, and exits `0` only when cleanup is complete (otherwise `1`, keeping pending items recorded). When a required export fails, the sandbox is retained until `expiresAt` — fix the issue and retry before expiry (check for `retain-at-risk` if the backend could not confirm the requested retention window).
@@ -23,10 +23,10 @@ export OPEN_SANDBOX_API_KEY='<operator-provided-key>'
23
23
  anyswarm setup --mode existing \
24
24
  --endpoint https://sandbox.example.net \
25
25
  --public-url https://runtime.example.net/anyswarm
26
- anyswarm doctor --smoke
26
+ anyswarm doctor --mode existing --smoke
27
27
  ```
28
28
 
29
- Existing mode verifies your management API key and saves the connection in owner-only user config without launching a container. Running `anyswarm doctor --smoke` then creates and deletes a temporary sandbox to verify host-to-worker access, Runtime callbacks, file export, and cleanup.
29
+ Existing mode verifies your management API key and saves the connection in owner-only user config without launching a container. Running `anyswarm doctor --mode existing --smoke` then creates and deletes a temporary sandbox to verify host-to-worker access, Runtime callbacks, file export, and cleanup.
30
30
 
31
31
  In remote mode, the OpenSandbox operator supplies the Worker image, which you select with `ANYSWARM_WORKER_IMAGE`; your host machine running `anyswarm` only needs Node.js and network access. Protect credentials with TLS (HTTPS) or a trusted private network.
32
32
 
@@ -49,7 +49,7 @@ const remote = createSandbox({
49
49
 
50
50
  Configuration precedence is: **explicit SDK/CLI options → environment variables → saved user config (owner-only permissions) → local defaults**. `createSandbox()` validates and snapshots settings without launching containers; allocation starts only when you call `runtime.spawn()`.
51
51
 
52
- When sandboxes run on a remote host or behind a reverse proxy, pass `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` to `createRuntime()` to advertise a single reachable callback URL (reverse-proxy path prefixes are preserved; use `bindHost` and `bindPort` only when you need custom listener binding). `anyswarm doctor` reports the active callback origin, and `anyswarm doctor --smoke` points to the callback address, port, and proxy routes if sandboxes cannot call back. Configure OpenSandbox to publish reachable container endpoints and required headers.
52
+ When sandboxes run on a remote host or behind a reverse proxy, pass `connection: { publicUrl: 'https://runtime.example.net/anyswarm' }` to `createRuntime()` to advertise a single reachable callback URL (reverse-proxy path prefixes are preserved; use `bindHost` and `bindPort` only when you need custom listener binding). `anyswarm doctor --mode existing` reports the active callback origin, and `anyswarm doctor --mode existing --smoke` points to the callback address, port, and proxy routes if sandboxes cannot call back. Configure OpenSandbox to publish reachable container endpoints and required headers.
53
53
 
54
54
  ## 4. Resources and migration from v0.2.0
55
55
 
@@ -88,6 +88,10 @@ Use `runtime.services.get/list` to inspect readiness, ownership and available ma
88
88
 
89
89
  Close and retire fence new calls and drain in-flight work. The optional `exportState` hook supplies public observation JSON for [Trace Viewer](trace-viewer.md). Optional metadata can give a capture timestamp, business revision, field descriptions, summary values and table columns. The state export is separate from business durability. The Service owns its original database and successful commit. [Runtime recovery](runtime.md) explains the retained Run and storage requirements.
90
90
 
91
+ To display business state during a Run, implement `ServiceAdapter.readState({ signal })`. Its return value is `{ state, capturedAt, revision?, presentation? }`. Select public fields explicitly and use the signal for any I/O. Supply an ISO capture timestamp and use JSON Pointer paths for summary fields and table columns. SDK and RPC clients can use optional presentation hints to render the returned state.
92
+
93
+ The Runtime owner can call `runtime.services.listState()` and `runtime.services.readState(name)`. A HarnessSession client uses `session.services.list()` and `session.services.read(runtimeId, name)`. Reads are limited to one second and 64 KiB each. A read can return `unsupported`, `unavailable`, `timeout`, or `error`, with the previous capture time when available. The adapter hook is host-only. See the [Persistent Board example](../../examples/services/persistent-board/README.md#watch-a-live-board) for a package-root Service adapter and Harness.
94
+
91
95
  ## Migrate existing SDK code
92
96
 
93
97
  Replace `registerService({ manifest, adapter })` with `register(name, definition)`. Integrations that still use a legacy hosted manifest can adapt it with `services.register(...serviceFromManifest({ manifest, adapter }))`. Move `Profile.session.tools` to `Profile.tools` and `Profile.prompt` to `Profile.addedSystemPrompt`. Read `.result` from a successful generic CLI reply and use stderr for local usage errors. Existing Trace files remain readable.
@@ -16,7 +16,7 @@ Open [the demo Run](http://127.0.0.1:8787/#run=release-notes). The synthetic Sub
16
16
  The Trace Viewer is bundled directly inside `@anyswarm/core` (`src/trace-viewer/`) with zero extra dependencies:
17
17
 
18
18
  ```bash
19
- curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
19
+ npm install -g @anyswarm/core
20
20
  anyswarm trace /path/to/private/runs --port 8787 --open
21
21
  ```
22
22
 
@@ -61,7 +61,7 @@ coverage.
61
61
  | --- | --- |
62
62
  | README, internal Markdown or architecture inventory | Generated references and repository links |
63
63
  | Website, bilingual guides or documentation images | Generated references, repository links and website build |
64
- | Website installer, install command or either Quickstart | Website build, focused installer tests and documentation checks |
64
+ | Homepage npm install command or either Quickstart | Website build, focused npm command checks and documentation checks |
65
65
  | Core, tests, workflow or other inputs | Typecheck, full tests, generated references, repository links and website build |
66
66
 
67
67
  The full suite runs on three parallel Core runners, including the Viewer reader
@@ -80,7 +80,7 @@ cache and install the packed Core in a temporary consumer before running tests.
80
80
  export npm_config_cache="$package_dir/npm-cache"
81
81
  npm ci --no-audit --no-fund
82
82
  npm run typecheck
83
- npm pack --loglevel=error --pack-destination "$package_dir"
83
+ npm run pack:release -- "$package_dir"
84
84
  npm install --prefix "$package_dir/consumer" --prefer-offline --omit=dev --ignore-scripts --no-audit --no-fund "$package_dir"/*.tgz
85
85
  tar -xzf "$package_dir"/*.tgz -C "$package_dir" package/examples/harness-session/package.json
86
86
  npm install --prefix "$package_dir/package/examples/harness-session" --prefer-offline --no-save --ignore-scripts --no-audit --no-fund "$package_dir"/*.tgz
@@ -90,8 +90,9 @@ cache and install the packed Core in a temporary consumer before running tests.
90
90
 
91
91
  `npm ci` can fetch the locked tarballs without caching the registry metadata that
92
92
  an offline installation of the packed Core needs. The temporary consumer seeds
93
- that metadata in the same cache used by the tests. The package tests still
94
- install offline.
93
+ that metadata in the same cache used by the tests. Archive-based tests then
94
+ install offline. The by-name install test serves the candidate through a local
95
+ registry and can fetch public dependency metadata from npm.
95
96
 
96
97
  For **Website CI**,
97
98
  run `npm ci` inside `website/`, then
@@ -101,9 +102,15 @@ deploys the merged site separately.
101
102
 
102
103
  ## Release verification
103
104
 
104
- Run the [Release workflow](../../.github/workflows/release.yml) manually to verify a
105
+ For a local candidate, record the clean source commit, Node and npm versions, the
106
+ `npm ci` and `npm run pack:release` commands, and the archive SHA-256. Use those
107
+ same tool versions when reproducing a candidate. The release pack script builds
108
+ and stages with `umask 022` and normalizes staged regular-file modes to `0755` for
109
+ executables and `0644` for other files, including files from restrictive checkouts.
110
+
111
+ Run the [Release workflow](../../.github/workflows/release.yml) manually with `publish_npm` off to verify a
105
112
  candidate and download the two tarball filenames and their SHA-256 checksums from
106
- the workflow artifact. The verifier installs the exact tarball through the website installer outside the checkout. It runs local setup, the README Quickstart with a controlled model, and the first SDK Harness through the SDK, JSONL RPC and foreground CLI. The README test checks actual file-tool bytes, CLI and installed Viewer agreement, and Sandbox deletion. Manual runs only verify. After the source repository is
113
+ the workflow artifact. The verifier installs the exact tarball globally with npm and installs it by package name through a local registry outside the checkout. It runs local setup, the README Quickstart with a controlled model, and the first SDK Harness through the SDK, the RPC client, the one-shot CLI, and direct JSONL RPC with a question and answer. The README test checks actual file-tool bytes, CLI and installed Viewer agreement, and Sandbox deletion. Manual runs can verify a candidate with the same version as an existing release. After the source repository is
107
114
  public and the release owner approves the tested revision, `LuNa-shi` pushes a
108
115
  `v<version>` tag for the matching stable package version under the
109
116
  [version-tag ruleset](https://github.com/AnySwarm/anyswarm/rules/28373821).
@@ -113,27 +120,27 @@ The workflow verifies that the candidate builds its Worker locally using the pac
113
120
  The tag job uploads the verified versioned tarball, the byte-identical
114
121
  `luna-shi-anyswarm.tgz` alias and `SHA256SUMS` to the tagged Release before
115
122
  publishing it. An older stable tag can still be published as a pinned Release.
116
- The CLI resolves the latest stable tag once and checks the corresponding versioned archive against its checksum.
123
+ npm resolves CLI installs and updates using its configured registry. Verify that the candidate installs and upgrades in the same isolated global npm prefix, exposes only `anyswarm` on the host, and can be removed with npm.
117
124
 
118
- For the first release built as `@anyswarm/core`, deploy the updated website
119
- installer before publishing the tag. Compare the public installer bytes with
120
- the reviewed source and verify that the installer still accepts the published
121
- v0.4.1 archive. A managed v0.4.1 CLI needs to rerun the installer once with
122
- its existing prefix to cross the package-name change.
125
+ After GitHub publication, the npm job downloads and verifies the same public
126
+ archive. It uses [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
127
+ registered to `AnySwarm/anyswarm` and `release.yml`. Direct `npm publish`
128
+ must be enabled for that publisher. The job publishes the current GitHub
129
+ Latest version and checks its public npm integrity and `latest` tag.
123
130
 
124
- Download the approved tag's versioned archive and `SHA256SUMS`. Verify the
125
- digest and the package name and version in the archive. An npm member of the
126
- `anyswarm` organization publishes those verified bytes from the release directory:
131
+ If the GitHub Release is available and npm publication needs a retry, use the
132
+ Release workflow dispatch from `main`:
127
133
 
128
134
  ```sh
129
- npm publish "./luna-shi-anyswarm-$VERSION.tgz" --access public --registry=https://registry.npmjs.org
135
+ gh workflow run release.yml --ref main -f publish_npm=true
130
136
  ```
131
137
 
132
- Set `VERSION` to the approved stable tag version without the leading `v`.
133
- Confirm the registry resolves `@anyswarm/core@$VERSION` and install it
134
- in a fresh project. Update the website and guides' npm install command when
135
- the new package resolves publicly. The existing v0.4.1 archive was published
136
- as `@anyswarm/anyswarm@0.4.1`.
138
+ Verify the installed SDK and CLI from npm by package name in an empty
139
+ directory. Download the npm tarball and compare its SHA-256 with the GitHub asset.
140
+ After both distributions are public, update the bilingual release page and
141
+ the documented version in `website/src/components/TopNav.astro`.
142
+ See [Release updates and documentation versions](release-and-docs-versioning.md)
143
+ for retry handling, Trusted Publishing and the proposed website version selector.
137
144
 
138
145
  ## Documentation changes
139
146