@anyswarm/core 0.5.0 → 0.5.1

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 (398) hide show
  1. package/README.md +11 -10
  2. package/deploy/worker/Dockerfile +12 -4
  3. package/dist/deploy/worker/Dockerfile +12 -4
  4. package/dist/examples/README.md +24 -12
  5. package/dist/examples/authoring/README.md +24 -0
  6. package/dist/examples/authoring/business.d.ts +2 -0
  7. package/dist/examples/authoring/business.js +4 -0
  8. package/dist/examples/authoring/config.d.ts +5 -0
  9. package/dist/examples/authoring/config.js +2 -0
  10. package/dist/examples/authoring/eject.json +5 -0
  11. package/dist/examples/authoring/harness.d.ts +4 -0
  12. package/dist/examples/authoring/harness.js +19 -0
  13. package/dist/examples/autoresearch/README.md +33 -0
  14. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
  15. package/dist/examples/autoresearch/config.d.ts +51 -0
  16. package/dist/examples/autoresearch/config.js +57 -0
  17. package/dist/examples/autoresearch/demo.d.ts +11 -0
  18. package/dist/examples/autoresearch/demo.js +52 -0
  19. package/dist/examples/autoresearch/eject.json +15 -0
  20. package/dist/examples/autoresearch/frontiercs2.d.ts +87 -0
  21. package/dist/examples/autoresearch/frontiercs2.js +211 -0
  22. package/dist/examples/autoresearch/prepare.d.ts +95 -0
  23. package/dist/examples/autoresearch/prepare.js +257 -0
  24. package/dist/examples/autoresearch/process.d.ts +13 -0
  25. package/dist/examples/autoresearch/process.js +48 -0
  26. package/dist/examples/autoresearch/project.d.ts +115 -0
  27. package/dist/examples/autoresearch/project.js +410 -0
  28. package/dist/examples/autoresearch/research-service.d.ts +106 -0
  29. package/dist/examples/autoresearch/research-service.js +255 -0
  30. package/dist/examples/code/README.md +25 -0
  31. package/dist/examples/code/REQUIREMENTS.zh.md +11 -0
  32. package/dist/examples/code/candidate.d.ts +19 -0
  33. package/dist/examples/code/candidate.js +80 -0
  34. package/dist/examples/code/config.d.ts +32 -0
  35. package/dist/examples/code/config.js +18 -0
  36. package/dist/examples/code/eject.json +5 -0
  37. package/dist/examples/code/project.d.ts +3 -0
  38. package/dist/examples/code/project.js +605 -0
  39. package/dist/examples/code/prompts.d.ts +5 -0
  40. package/dist/examples/code/prompts.js +12 -0
  41. package/dist/examples/code/verification.d.ts +19 -0
  42. package/dist/examples/code/verification.js +268 -0
  43. package/dist/examples/code/worktree.d.ts +17 -0
  44. package/dist/examples/code/worktree.js +233 -0
  45. package/dist/examples/harness-session/README.md +3 -6
  46. package/dist/examples/lead-worker/harness/dynamic-scheduler.d.ts +2 -1
  47. package/dist/examples/lead-worker/harness/dynamic-scheduler.js +5 -2
  48. package/dist/examples/lead-worker/harness/index.d.ts +60 -0
  49. package/dist/examples/lead-worker/harness/index.js +77 -6
  50. package/dist/examples/lead-worker/project.js +2 -2
  51. package/dist/examples/lead-worker/services/board.d.ts +5 -0
  52. package/dist/examples/lead-worker/services/board.js +19 -1
  53. package/dist/examples/messages/README.md +5 -5
  54. package/dist/examples/messages/handoff.d.ts +2 -0
  55. package/dist/examples/messages/handoff.js +5 -1
  56. package/dist/examples/messages/project.js +52 -2
  57. package/dist/examples/notes/README.md +13 -18
  58. package/dist/examples/notes/project.js +67 -6
  59. package/dist/examples/peermesh/harness/router.js +3 -1
  60. package/dist/examples/peermesh/harness/team.d.ts +8 -0
  61. package/dist/examples/peermesh/harness/team.js +13 -0
  62. package/dist/examples/peermesh/project.js +22 -4
  63. package/dist/examples/services/agent-control/README.md +3 -3
  64. package/dist/examples/services/mathlib-search/Dockerfile +4 -2
  65. package/dist/examples/services/mathlib-search/README.md +1 -1
  66. package/dist/examples/services/mcp-managed/README.md +2 -2
  67. package/dist/examples/services/persistent-board/README.md +13 -3
  68. package/dist/examples/services/persistent-board/business.d.ts +7 -0
  69. package/dist/examples/services/persistent-board/business.js +7 -0
  70. package/dist/examples/services/persistent-board/index.js +10 -0
  71. package/dist/examples/services/persistent-board/live.d.ts +3 -0
  72. package/dist/examples/services/persistent-board/live.js +58 -0
  73. package/dist/examples/subagents/README.md +5 -5
  74. package/dist/examples/subagents/business.js +3 -1
  75. package/dist/examples/subagents/harness/controller.d.ts +15 -0
  76. package/dist/examples/subagents/harness/controller.js +181 -32
  77. package/dist/examples/subagents/project.d.ts +2 -0
  78. package/dist/examples/subagents/project.js +43 -34
  79. package/dist/examples/subagents/prompts/prompts.d.ts +1 -0
  80. package/dist/examples/subagents/prompts/prompts.js +3 -0
  81. package/dist/examples/subagents/services/collaboration-service.d.ts +3 -2
  82. package/dist/examples/subagents/services/collaboration-service.js +14 -2
  83. package/dist/examples/substrate/README.md +2 -2
  84. package/dist/examples/substrate/harness/index.d.ts +1 -1
  85. package/dist/examples/substrate/harness/index.js +77 -12
  86. package/dist/examples/substrate/project.js +4 -1
  87. package/dist/examples/super/README.md +40 -0
  88. package/dist/examples/super/actions.d.ts +95 -0
  89. package/dist/examples/super/actions.js +230 -0
  90. package/dist/examples/super/artifact.d.ts +4 -0
  91. package/dist/examples/super/artifact.js +51 -0
  92. package/dist/examples/super/config.d.ts +80 -0
  93. package/dist/examples/super/config.js +83 -0
  94. package/dist/examples/super/coordinator.d.ts +33 -0
  95. package/dist/examples/super/coordinator.js +151 -0
  96. package/dist/examples/super/daemon.d.ts +11 -0
  97. package/dist/examples/super/daemon.js +109 -0
  98. package/dist/examples/super/decisions.d.ts +8 -0
  99. package/dist/examples/super/decisions.js +52 -0
  100. package/dist/examples/super/eject.json +5 -0
  101. package/dist/examples/super/execution.d.ts +11 -0
  102. package/dist/examples/super/execution.js +136 -0
  103. package/dist/examples/super/github.d.ts +62 -0
  104. package/dist/examples/super/github.js +269 -0
  105. package/dist/examples/super/inbox.d.ts +162 -0
  106. package/dist/examples/super/inbox.js +284 -0
  107. package/dist/examples/super/location.d.ts +5 -0
  108. package/dist/examples/super/location.js +64 -0
  109. package/dist/examples/super/outbox.d.ts +5 -0
  110. package/dist/examples/super/outbox.js +103 -0
  111. package/dist/examples/super/project.d.ts +111 -0
  112. package/dist/examples/super/project.js +253 -0
  113. package/dist/examples/super/prompts.d.ts +3 -0
  114. package/dist/examples/super/prompts.js +25 -0
  115. package/dist/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  116. package/dist/examples/taskpool/harness/controller.d.ts +35 -6
  117. package/dist/examples/taskpool/harness/controller.js +73 -7
  118. package/dist/examples/taskpool/project.js +18 -2
  119. package/dist/scripts/anyswarm-applications.d.ts +19 -0
  120. package/dist/scripts/anyswarm-applications.js +19 -0
  121. package/dist/scripts/anyswarm-arguments.d.ts +35 -5
  122. package/dist/scripts/anyswarm-arguments.js +87 -23
  123. package/dist/scripts/anyswarm-author.d.ts +5 -0
  124. package/dist/scripts/anyswarm-author.js +24 -0
  125. package/dist/scripts/anyswarm-eject.d.ts +11 -0
  126. package/dist/scripts/anyswarm-eject.js +164 -0
  127. package/dist/scripts/anyswarm-harnesses.d.ts +2 -0
  128. package/dist/scripts/anyswarm-harnesses.js +31 -0
  129. package/dist/scripts/anyswarm-installation.js +19 -13
  130. package/dist/scripts/anyswarm-launch.d.ts +37 -0
  131. package/dist/scripts/anyswarm-launch.js +86 -0
  132. package/dist/scripts/anyswarm-project.d.ts +12 -2
  133. package/dist/scripts/anyswarm-project.js +121 -20
  134. package/dist/scripts/anyswarm-source-runner.d.ts +1 -0
  135. package/dist/scripts/anyswarm-source-runner.js +232 -0
  136. package/dist/scripts/anyswarm-tui-config.d.ts +36 -0
  137. package/dist/scripts/anyswarm-tui-config.js +189 -0
  138. package/dist/scripts/anyswarm-tui-session.d.ts +66 -0
  139. package/dist/scripts/anyswarm-tui-session.js +304 -0
  140. package/dist/scripts/anyswarm-tui-terminal.d.ts +41 -0
  141. package/dist/scripts/anyswarm-tui-terminal.js +154 -0
  142. package/dist/scripts/anyswarm-tui.d.ts +2 -0
  143. package/dist/scripts/anyswarm-tui.js +1012 -0
  144. package/dist/scripts/anyswarm.js +47 -2
  145. package/dist/scripts/build-provenance.json +1 -0
  146. package/dist/scripts/build.js +7 -1
  147. package/dist/scripts/generate-architecture-api.js +2 -0
  148. package/dist/scripts/generate-architecture-prompts.js +24 -2
  149. package/dist/scripts/local-environment.d.ts +6 -1
  150. package/dist/scripts/local-environment.js +52 -16
  151. package/dist/scripts/local-setup-smoke.js +3 -2
  152. package/dist/scripts/local-setup-worker.d.ts +1 -1
  153. package/dist/scripts/local-setup-worker.js +15 -6
  154. package/dist/scripts/local-setup.d.ts +2 -2
  155. package/dist/scripts/local-setup.js +72 -12
  156. package/dist/scripts/opensandbox-agent-worker.js +2 -2
  157. package/dist/scripts/pack-release.d.ts +1 -0
  158. package/dist/scripts/pack-release.js +63 -0
  159. package/dist/scripts/pi-session-bridge.js +11 -3
  160. package/dist/scripts/run-harness.js +3 -1
  161. package/dist/scripts/setup-bootstrap.js +43 -6
  162. package/dist/src/core/allocation-ledger.js +4 -3
  163. package/dist/src/core/host-identity.d.ts +2 -0
  164. package/dist/src/core/host-identity.js +11 -0
  165. package/dist/src/core/index.d.ts +4 -2
  166. package/dist/src/core/index.js +12 -4
  167. package/dist/src/core/mcp-service.js +2 -2
  168. package/dist/src/core/runtime-management.d.ts +6 -0
  169. package/dist/src/core/runtime-management.js +24 -0
  170. package/dist/src/core/sandbox/executor-driver.d.ts +4 -2
  171. package/dist/src/core/sandbox/executor-driver.js +12 -14
  172. package/dist/src/core/sandbox/local-executor.d.ts +13 -1
  173. package/dist/src/core/sandbox/local-executor.js +69 -19
  174. package/dist/src/core/sandbox/local-worker.js +32 -21
  175. package/dist/src/core/sandbox/opensandbox-backend.d.ts +2 -0
  176. package/dist/src/core/sandbox/opensandbox-backend.js +36 -11
  177. package/dist/src/core/sandbox/sandbox-connection.d.ts +2 -0
  178. package/dist/src/core/sandbox/sandbox-connection.js +14 -6
  179. package/dist/src/core/service-live-state.d.ts +14 -0
  180. package/dist/src/core/service-live-state.js +161 -0
  181. package/dist/src/core/service-observation-types.d.ts +21 -1
  182. package/dist/src/core/service-process.d.ts +1 -1
  183. package/dist/src/core/service-process.js +45 -4
  184. package/dist/src/core/service-types.d.ts +5 -1
  185. package/dist/src/core/services.d.ts +1 -1
  186. package/dist/src/core/services.js +8 -3
  187. package/dist/src/core/types.d.ts +3 -0
  188. package/dist/src/core/worker-image.js +3 -3
  189. package/dist/src/harness/harness-session-types.d.ts +10 -0
  190. package/dist/src/harness/harness-session.js +42 -5
  191. package/dist/src/harness/project-harness.d.ts +13 -1
  192. package/dist/src/harness/project-harness.js +36 -10
  193. package/dist/src/harness/project-input.js +81 -15
  194. package/dist/src/harness/project-rpc-client.d.ts +1 -0
  195. package/dist/src/harness/project-rpc-client.js +5 -0
  196. package/dist/src/harness/project-rpc.d.ts +8 -2
  197. package/dist/src/harness/project-rpc.js +31 -7
  198. package/dist/src/harness/project-runtime.js +3 -1
  199. package/dist/src/harness/typescript-loader.d.ts +2 -0
  200. package/dist/src/harness/typescript-loader.js +41 -0
  201. package/dist/src/trace-viewer/public/app.js +6 -5
  202. package/dist/src/trace-viewer/reader.mjs +42 -2
  203. package/docs/INDEX.md +3 -1
  204. package/docs/architecture/00-overview.md +1 -1
  205. package/docs/architecture/01-agent-core.md +1 -1
  206. package/docs/architecture/06-observability-experiments.md +1 -1
  207. package/docs/architecture/07-run-configuration.md +18 -12
  208. package/docs/architecture/08-prompts.md +22 -0
  209. package/docs/architecture/10-service-api-reference.md +53 -18
  210. package/docs/architecture/11-storage-reference.md +18 -1
  211. package/docs/architecture/12-code-coverage.md +148 -84
  212. package/docs/architecture/15-core-runtime.md +8 -0
  213. package/docs/architecture/16-pi-opensandbox-backend.md +5 -5
  214. package/docs/architecture/17-harness-reporting.md +1 -1
  215. package/docs/architecture/19-substrate-harness.md +28 -1
  216. package/docs/architecture/20-lead-worker-harness.md +34 -1
  217. package/docs/architecture/22-website.md +5 -3
  218. package/docs/architecture/23-project-harness.md +124 -5
  219. package/docs/architecture/24-runtime-recovery.md +10 -3
  220. package/docs/architecture/25-foreground-tui.md +51 -0
  221. package/docs/architecture/26-code.md +39 -0
  222. package/docs/architecture/27-personal.md +43 -0
  223. package/docs/architecture/28-autoresearch.md +31 -0
  224. package/docs/architecture/INDEX.md +4 -0
  225. package/docs/architecture/prompts/08-lead-worker-harness.md +4 -2
  226. package/docs/architecture/prompts/08-subagents-harness.md +21 -0
  227. package/docs/architecture/prompts/21-personal.md +44 -0
  228. package/docs/architecture/prompts/22-autoresearch.md +63 -0
  229. package/docs/architecture/prompts/26-code.md +55 -0
  230. package/docs/architecture/prompts/source-manifest.json +152 -33
  231. package/docs/architecture/source-map.json +489 -21
  232. package/docs/designs/core-harness/06-project-harness.md +13 -2
  233. package/docs/designs/core-harness/README.md +5 -0
  234. package/docs/en/agents.md +1 -1
  235. package/docs/en/build-your-harness.md +3 -5
  236. package/docs/en/changelog.md +13 -4
  237. package/docs/en/first-harness.md +8 -11
  238. package/docs/en/harnesses/lead-worker.md +1 -1
  239. package/docs/en/harnesses/peermesh.md +2 -2
  240. package/docs/en/harnesses/subagents.md +2 -2
  241. package/docs/en/harnesses/substrate.md +4 -4
  242. package/docs/en/harnesses/taskpool.md +2 -2
  243. package/docs/en/latest.md +12 -123
  244. package/docs/en/overview.md +1 -1
  245. package/docs/en/quickstart.md +40 -16
  246. package/docs/en/reference/api.md +14 -4
  247. package/docs/en/reference/cli.md +58 -14
  248. package/docs/en/runtime.md +2 -2
  249. package/docs/en/services.md +4 -0
  250. package/docs/third-party-notices.md +1 -0
  251. package/docs/workflows/development.md +17 -12
  252. package/docs/workflows/release-and-docs-versioning.md +76 -0
  253. package/docs/zh/agents.md +1 -1
  254. package/docs/zh/build-your-harness.md +3 -5
  255. package/docs/zh/changelog.md +13 -4
  256. package/docs/zh/first-harness.md +8 -11
  257. package/docs/zh/harnesses/lead-worker.md +1 -1
  258. package/docs/zh/harnesses/peermesh.md +2 -2
  259. package/docs/zh/harnesses/subagents.md +2 -2
  260. package/docs/zh/harnesses/substrate.md +4 -4
  261. package/docs/zh/harnesses/taskpool.md +2 -2
  262. package/docs/zh/latest.md +13 -124
  263. package/docs/zh/overview.md +1 -1
  264. package/docs/zh/quickstart.md +40 -16
  265. package/docs/zh/reference/api.md +14 -4
  266. package/docs/zh/reference/cli.md +58 -14
  267. package/docs/zh/runtime.md +2 -2
  268. package/docs/zh/services.md +4 -0
  269. package/examples/README.md +24 -12
  270. package/examples/authoring/README.md +24 -0
  271. package/examples/authoring/business.ts +4 -0
  272. package/examples/authoring/config.ts +2 -0
  273. package/examples/authoring/eject.json +5 -0
  274. package/examples/authoring/harness.ts +21 -0
  275. package/examples/autoresearch/README.md +33 -0
  276. package/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
  277. package/examples/autoresearch/config.ts +90 -0
  278. package/examples/autoresearch/demo.ts +55 -0
  279. package/examples/autoresearch/eject.json +15 -0
  280. package/examples/autoresearch/frontiercs2.ts +237 -0
  281. package/examples/autoresearch/prepare.ts +267 -0
  282. package/examples/autoresearch/process.ts +50 -0
  283. package/examples/autoresearch/project.ts +397 -0
  284. package/examples/autoresearch/research-service.ts +302 -0
  285. package/examples/code/README.md +25 -0
  286. package/examples/code/REQUIREMENTS.zh.md +11 -0
  287. package/examples/code/candidate.ts +89 -0
  288. package/examples/code/config.ts +19 -0
  289. package/examples/code/eject.json +5 -0
  290. package/examples/code/project.ts +581 -0
  291. package/examples/code/prompts.ts +16 -0
  292. package/examples/code/verification.ts +239 -0
  293. package/examples/code/worktree.ts +188 -0
  294. package/examples/harness-session/README.md +3 -6
  295. package/examples/lead-worker/harness/dynamic-scheduler.ts +6 -3
  296. package/examples/lead-worker/harness/index.ts +61 -6
  297. package/examples/lead-worker/project.ts +2 -2
  298. package/examples/lead-worker/services/board.ts +14 -1
  299. package/examples/messages/README.md +5 -5
  300. package/examples/messages/handoff.ts +6 -2
  301. package/examples/messages/project.ts +47 -2
  302. package/examples/notes/README.md +13 -18
  303. package/examples/notes/project.ts +57 -9
  304. package/examples/peermesh/harness/router.ts +2 -2
  305. package/examples/peermesh/harness/team.ts +11 -0
  306. package/examples/peermesh/project.ts +19 -4
  307. package/examples/services/agent-control/README.md +3 -3
  308. package/examples/services/mathlib-search/Dockerfile +4 -2
  309. package/examples/services/mathlib-search/README.md +1 -1
  310. package/examples/services/mcp-managed/README.md +2 -2
  311. package/examples/services/persistent-board/README.md +13 -3
  312. package/examples/services/persistent-board/business.ts +10 -0
  313. package/examples/services/persistent-board/index.ts +10 -0
  314. package/examples/services/persistent-board/live.ts +54 -0
  315. package/examples/subagents/README.md +5 -5
  316. package/examples/subagents/business.ts +3 -1
  317. package/examples/subagents/harness/controller.ts +161 -29
  318. package/examples/subagents/project.ts +47 -33
  319. package/examples/subagents/prompts/prompts.ts +4 -0
  320. package/examples/subagents/services/collaboration-service.ts +14 -2
  321. package/examples/substrate/README.md +2 -2
  322. package/examples/substrate/harness/index.ts +67 -11
  323. package/examples/substrate/project.ts +5 -1
  324. package/examples/super/README.md +40 -0
  325. package/examples/super/actions.ts +196 -0
  326. package/examples/super/artifact.ts +56 -0
  327. package/examples/super/config.ts +95 -0
  328. package/examples/super/coordinator.ts +158 -0
  329. package/examples/super/daemon.ts +84 -0
  330. package/examples/super/decisions.ts +46 -0
  331. package/examples/super/eject.json +5 -0
  332. package/examples/super/execution.ts +131 -0
  333. package/examples/super/github.ts +242 -0
  334. package/examples/super/inbox.ts +306 -0
  335. package/examples/super/location.ts +54 -0
  336. package/examples/super/outbox.ts +97 -0
  337. package/examples/super/project.ts +227 -0
  338. package/examples/super/prompts.ts +27 -0
  339. package/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  340. package/examples/taskpool/harness/controller.ts +59 -7
  341. package/examples/taskpool/project.ts +18 -2
  342. package/npm-shrinkwrap.development.json +2199 -0
  343. package/npm-shrinkwrap.json +86 -1920
  344. package/package.development.json +92 -0
  345. package/package.json +13 -7
  346. package/scripts/anyswarm-applications.ts +39 -0
  347. package/scripts/anyswarm-arguments.ts +94 -28
  348. package/scripts/anyswarm-author.ts +25 -0
  349. package/scripts/anyswarm-eject.ts +145 -0
  350. package/scripts/anyswarm-harnesses.ts +27 -0
  351. package/scripts/anyswarm-installation.ts +19 -13
  352. package/scripts/anyswarm-launch.ts +108 -0
  353. package/scripts/anyswarm-project.ts +114 -21
  354. package/scripts/anyswarm-source-runner.ts +203 -0
  355. package/scripts/anyswarm-tui-config.ts +174 -0
  356. package/scripts/anyswarm-tui-session.ts +295 -0
  357. package/scripts/anyswarm-tui-terminal.ts +147 -0
  358. package/scripts/anyswarm-tui.ts +912 -0
  359. package/scripts/anyswarm.ts +43 -2
  360. package/scripts/build.ts +8 -1
  361. package/scripts/generate-architecture-api.ts +2 -0
  362. package/scripts/generate-architecture-prompts.ts +35 -2
  363. package/scripts/local-environment.ts +55 -17
  364. package/scripts/local-setup-smoke.ts +3 -2
  365. package/scripts/local-setup-worker.ts +17 -7
  366. package/scripts/local-setup.ts +66 -13
  367. package/scripts/opensandbox-agent-worker.ts +2 -2
  368. package/scripts/pack-release.ts +67 -0
  369. package/scripts/pi-session-bridge.ts +10 -2
  370. package/scripts/run-harness.ts +3 -1
  371. package/scripts/setup-bootstrap.ts +41 -6
  372. package/src/core/allocation-ledger.ts +5 -3
  373. package/src/core/host-identity.ts +11 -0
  374. package/src/core/index.ts +12 -6
  375. package/src/core/mcp-service.ts +2 -2
  376. package/src/core/runtime-management.ts +22 -0
  377. package/src/core/sandbox/executor-driver.ts +15 -18
  378. package/src/core/sandbox/local-executor.ts +65 -19
  379. package/src/core/sandbox/local-worker.ts +29 -21
  380. package/src/core/sandbox/opensandbox-backend.ts +36 -11
  381. package/src/core/sandbox/sandbox-connection.ts +14 -5
  382. package/src/core/service-live-state.ts +156 -0
  383. package/src/core/service-observation-types.ts +23 -1
  384. package/src/core/service-process.ts +36 -3
  385. package/src/core/service-types.ts +3 -1
  386. package/src/core/services.ts +8 -3
  387. package/src/core/types.ts +3 -0
  388. package/src/core/worker-image.ts +3 -3
  389. package/src/harness/harness-session-types.ts +13 -1
  390. package/src/harness/harness-session.ts +40 -7
  391. package/src/harness/project-harness.ts +36 -10
  392. package/src/harness/project-input.ts +73 -15
  393. package/src/harness/project-rpc-client.ts +5 -0
  394. package/src/harness/project-rpc.ts +29 -8
  395. package/src/harness/project-runtime.ts +2 -1
  396. package/src/harness/typescript-loader.ts +37 -0
  397. package/src/trace-viewer/public/app.js +6 -5
  398. package/src/trace-viewer/reader.mjs +42 -2
@@ -1,4 +1,4 @@
1
- import { ServiceRegistry, createRuntime, createSandbox, AnySwarmError, ProjectPreflightError, observeProjectRuntime, projectConfiguration, runInput } from '@anyswarm/core';
1
+ import { ServiceRegistry, createRuntime, getExecutorCapabilities, createSandbox, AnySwarmError, ProjectPreflightError, observeProjectRuntime, projectConfiguration, runInput } from '@anyswarm/core';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { createNotes } from './notes.js';
@@ -28,7 +28,14 @@ const notesHarness = {
28
28
  services.register('notes', notes.service, { toolMode: 'cli' });
29
29
  const common = { image, model, writable: true };
30
30
  let observation;
31
- const state = { stage: 'writer' };
31
+ const interventions = [];
32
+ const blocked = new Set();
33
+ const waits = new Map();
34
+ const assertMember = (agentId) => {
35
+ if (blocked.has(agentId))
36
+ throw new AnySwarmError('MEMBER_WORK_CANCELLED', 'The owner intervened in this member’s work');
37
+ };
38
+ const state = { stage: 'writer', interventions };
32
39
  try {
33
40
  const result = await context.runWithRuntime({ closeTimeoutMs,
34
41
  async createRuntime() {
@@ -39,17 +46,71 @@ const notesHarness = {
39
46
  reader: { ...common, addedSystemPrompt: projectNotesReaderPrompt, services: { notes: ['get'] },
40
47
  collect: { paths: [artifact, followup], includeGit: false, maxBytes: 64 * 1024, required: true } },
41
48
  } });
42
- observation = observeProjectRuntime(runtime, context, () => state);
49
+ const native = getExecutorCapabilities(config.executor ?? 'pi');
50
+ const controlEffects = (core) => ({ core, harnessEffects: { memberWork: 'cancelled', status: 'complete' } });
51
+ const intervene = async (operation, agentId, requestId) => {
52
+ blocked.add(agentId);
53
+ interventions.push({ agentId, operation, requestId });
54
+ context.emit({ kind: 'user-intervention', agentId, operation, requestId });
55
+ void observation?.refresh();
56
+ try {
57
+ const core = operation === 'interrupt' ? await runtime.interrupt(agentId, { requestId })
58
+ : await runtime.stop(agentId, { timeoutMs: closeTimeoutMs });
59
+ return controlEffects(core);
60
+ }
61
+ finally {
62
+ waits.get(agentId)?.abort();
63
+ }
64
+ };
65
+ observation = observeProjectRuntime(runtime, context, () => state, {
66
+ capabilities: {
67
+ send: { supported: native.activeSteer, text: true, modes: ['steer'] },
68
+ interrupt: { supported: native.queuedInputCancellation }, stop: { supported: true },
69
+ },
70
+ handlers: {
71
+ send(agentId, payload, request) {
72
+ assertMember(agentId);
73
+ const { input, options } = payload;
74
+ return runtime.send(agentId, input, { ...options, mode: 'steer', wakeIfIdle: false, requestId: request.operationId });
75
+ },
76
+ interrupt: (agentId, _payload, request) => intervene('interrupt', agentId, request.operationId),
77
+ stop: (agentId, _payload, request) => intervene('stop', agentId, request.operationId),
78
+ },
79
+ async reconcile(operation, agentId, request) {
80
+ if (operation === 'stop')
81
+ return controlEffects(await runtime.stop(agentId, { timeoutMs: closeTimeoutMs }));
82
+ const core = await observation.reconcile(agentId, operation, request.operationId);
83
+ return operation === 'interrupt' ? controlEffects(core) : core;
84
+ },
85
+ });
43
86
  return runtime;
44
87
  },
45
88
  async run(runtime) {
46
89
  const { signal, initial, input } = context;
90
+ const runMember = async (agentId, text, requestId) => {
91
+ assertMember(agentId);
92
+ const wait = new AbortController();
93
+ waits.set(agentId, wait);
94
+ try {
95
+ const result = await runInput(runtime, agentId, text, { requestId, timeoutMs: turnTimeoutMs,
96
+ signal: AbortSignal.any([signal, wait.signal]), beforeSend: () => assertMember(agentId) });
97
+ assertMember(agentId);
98
+ return result;
99
+ }
100
+ catch (error) {
101
+ assertMember(agentId);
102
+ throw error;
103
+ }
104
+ finally {
105
+ waits.delete(agentId);
106
+ }
107
+ };
47
108
  signal.throwIfAborted();
48
109
  const writer = await runtime.spawn({ requestId: 'notes-writer', profile: 'writer', files: initial.files });
49
110
  signal.throwIfAborted();
50
111
  state.writerId = writer.id;
51
112
  context.markRunning();
52
- await runInput(runtime, writer.id, input.prompt, { requestId: 'notes-write', timeoutMs: turnTimeoutMs, signal });
113
+ await runMember(writer.id, input.prompt, 'notes-write');
53
114
  const published = notes.records.get(key);
54
115
  if (published?.author !== writer.id)
55
116
  throw new AnySwarmError('NOTES_PUBLICATION_UNCONFIRMED', 'The writer did not publish its project observation');
@@ -60,14 +121,14 @@ const notesHarness = {
60
121
  const reader = await runtime.spawn({ requestId: 'notes-reader', profile: 'reader', files: initial.files });
61
122
  signal.throwIfAborted();
62
123
  state.readerId = reader.id;
63
- await runInput(runtime, reader.id, JSON.stringify({ task: input.prompt, artifact }), { requestId: 'notes-read', timeoutMs: turnTimeoutMs, signal });
124
+ await runMember(reader.id, JSON.stringify({ task: input.prompt, artifact }), 'notes-read');
64
125
  if (!notes.reads.some((read) => read.agentId === reader.id && read.key === key && read.found)) {
65
126
  throw new AnySwarmError('NOTES_HANDOFF_UNCONFIRMED', 'The reader did not retrieve the writer’s note');
66
127
  }
67
128
  signal.throwIfAborted();
68
129
  state.stage = 'followup';
69
130
  void observation?.refresh();
70
- await runInput(runtime, reader.id, JSON.stringify({ task: input.prompt, instruction: projectNotesFollowupPrompt, artifact, followup }), { requestId: 'notes-followup', timeoutMs: turnTimeoutMs, signal });
131
+ await runMember(reader.id, JSON.stringify({ task: input.prompt, instruction: projectNotesFollowupPrompt, artifact, followup }), 'notes-followup');
71
132
  signal.throwIfAborted();
72
133
  state.stage = 'verification';
73
134
  void observation?.refresh();
@@ -40,6 +40,7 @@ export function createPeerMeshRouter({ mapping, runInput, readContext, steerInpu
40
40
  accepting = false;
41
41
  steerOpen = false;
42
42
  clearTimeout(nudgeTimer);
43
+ clearTimeout(timer);
43
44
  for (const row of queue.splice(0))
44
45
  cancelUnsubmitted(row, reason);
45
46
  if (active?.state === 'context')
@@ -180,7 +181,8 @@ export function createPeerMeshRouter({ mapping, runInput, readContext, steerInpu
180
181
  const uncertain = row.state === 'submitted' && !['input_failed', 'input_aborted', 'input_handled_without_model_run', 'wait_requires_idle_agent'].includes(error.code);
181
182
  Object.assign(row, { state: uncertain ? 'uncertain' : 'failed', code: error.code ?? 'ROUTER_BATCH_FAILED',
182
183
  ...(error.inputId ? { inputId: error.inputId } : {}), ...(error.receipt ? { receipt: clone(error.receipt) } : {}), ...(error.event ? { event: clone(error.event), ...(error.event.type === 'settled' ? { settled: clone(error.event) } : {}) } : {}) });
183
- fence(row.code);
184
+ if (accepting)
185
+ fence(row.code);
184
186
  }
185
187
  finally {
186
188
  steerOpen = false;
@@ -21,6 +21,14 @@ export declare function createPeerMeshTeam(options: any): Promise<Readonly<{
21
21
  }[];
22
22
  };
23
23
  hasPeer: (key: string) => any;
24
+ interruptPeer(key: string, requestId: string): Promise<{
25
+ core: any;
26
+ harnessEffects: {
27
+ status: string;
28
+ routerStopped: boolean;
29
+ };
30
+ }>;
31
+ sendOwnerInput(key: string, input: string, requestId: string): any;
24
32
  stopPeer(key: any, { timeoutMs }?: any): Promise<any>;
25
33
  kickoff(key: any, text: any): any;
26
34
  ingest(key: any, event: any): any;
@@ -222,6 +222,19 @@ export async function createPeerMeshTeam(options) {
222
222
  halt: () => stop(fail('HARNESS_STOP_REQUESTED')),
223
223
  currentPeers: () => ({ closing, peers: peerStates() }),
224
224
  hasPeer: (key) => peers.has(key),
225
+ async interruptPeer(key, requestId) {
226
+ if (closing || !peers.has(key) || stoppedPeers.has(key))
227
+ throw fail('UNKNOWN_RECIPIENT');
228
+ routers.get(key).stop('USER_INTERRUPT');
229
+ const core = await runtime.interrupt(peers.get(key).id, { requestId });
230
+ return { core, harnessEffects: { status: core.status === 'interrupted' ? 'complete' : 'unknown', routerStopped: true } };
231
+ },
232
+ sendOwnerInput(key, input, requestId) {
233
+ if (closing || !peers.has(key) || stoppedPeers.has(key))
234
+ throw fail('UNKNOWN_RECIPIENT');
235
+ return runtime.send(peers.get(key).id, input, { requestId, mode: 'steer', source: 'user',
236
+ wakeIfIdle: !routers.get(key).snapshot().accepting });
237
+ },
225
238
  async stopPeer(key, { timeoutMs = 60_000 } = {}) {
226
239
  if (closing || !peers.has(key))
227
240
  throw fail('UNKNOWN_RECIPIENT');
@@ -1,4 +1,4 @@
1
- import { createSandbox, ProjectPreflightError, checkGitProject, observeProjectRuntime, projectConfiguration, } from '@anyswarm/core';
1
+ import { createSandbox, ProjectPreflightError, checkGitProject, observeProjectRuntime, projectConfiguration, getExecutorCapabilities, } from '@anyswarm/core';
2
2
  import { addAbortListener } from 'node:events';
3
3
  import { peerBatchReceipt, runPeerMeshTeam } from './harness/team.js';
4
4
  import { peerMeshConfig } from './project-config.js';
@@ -49,10 +49,12 @@ const peerMesh = {
49
49
  onRuntime: (runtime, snapshot) => {
50
50
  observation = observeProjectRuntime(runtime, context, snapshot, {
51
51
  fence: () => team?.halt(),
52
- async reconcile(operation, agentId) {
52
+ async reconcile(operation, agentId, request) {
53
53
  const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
54
- if (operation !== 'stop' || !peer)
54
+ if (!peer)
55
55
  return { status: 'unknown' };
56
+ if (operation !== 'stop')
57
+ return observation.reconcile(agentId, operation, request.operationId);
56
58
  try {
57
59
  const core = await team.stopPeer(peer.key);
58
60
  return { core, harnessEffects: { status: core.cleanup === 'complete' ? 'complete' : 'pending',
@@ -69,9 +71,25 @@ const peerMesh = {
69
71
  },
70
72
  capabilities: agentId => {
71
73
  const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
72
- return { stop: { supported: true, available: !!peer && !peer.stopped, reason: peer?.stopped ? 'peer-closed' : undefined } };
74
+ const native = getExecutorCapabilities(config.executor ?? 'pi');
75
+ const available = !!peer && !peer.stopped;
76
+ return { stop: { supported: true, available, reason: peer?.stopped ? 'peer-closed' : undefined },
77
+ send: { supported: native.activeSteer, available, text: true, modes: ['steer'] },
78
+ interrupt: { supported: native.queuedInputCancellation, available } };
73
79
  },
74
80
  handlers: {
81
+ async send(agentId, payload, request) {
82
+ const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
83
+ if (!peer)
84
+ throw Object.assign(new Error('Unknown peer Agent'), { code: 'UNKNOWN_RECIPIENT' });
85
+ return team.sendOwnerInput(peer.key, payload.input, request.operationId);
86
+ },
87
+ async interrupt(agentId, _payload, request) {
88
+ const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
89
+ if (!peer)
90
+ throw Object.assign(new Error('Unknown peer Agent'), { code: 'UNKNOWN_RECIPIENT' });
91
+ return team.interruptPeer(peer.key, request.operationId);
92
+ },
75
93
  async stop(agentId, _payload, { signal }) {
76
94
  signal.throwIfAborted();
77
95
  const peer = team?.currentPeers().peers.find((entry) => entry.agentId === agentId);
@@ -4,13 +4,13 @@
4
4
 
5
5
  [The script](flow.sh) reads the real child ID from the spawn receipt, gets that child, sends a follow-up input and stops the child. The send receipt confirms that the input was accepted. A caller that needs to wait for the child's work should observe its settled event before stopping it.
6
6
 
7
- ## Run from an installed candidate
7
+ ## Run from the installed SDK
8
8
 
9
- Set `ANYSWARM_SDK_ARCHIVE` to the absolute path of the candidate archive. In an empty directory outside the checkout, run the following. The build puts `flow.sh` beside the compiled runner so the lead can receive it as an initial file.
9
+ Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive. The build puts `flow.sh` beside the compiled runner so the lead can receive it as an initial file.
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
14
14
  npm install --save-dev typescript @types/node
15
15
  cp -R node_modules/@anyswarm/core/examples/services/agent-control demo
16
16
  cd demo
@@ -1,7 +1,9 @@
1
1
  FROM node:22.19.0-bookworm-slim AS typescript-build
2
2
  WORKDIR /build
3
- COPY package.json npm-shrinkwrap.json tsconfig.json ./
4
- RUN npm ci --include=dev --ignore-scripts --no-audit --no-fund
3
+ COPY package*.json npm-shrinkwrap*.json tsconfig.json ./
4
+ RUN if [ -f package.development.json ]; then \
5
+ cp package.development.json package.json && cp npm-shrinkwrap.development.json npm-shrinkwrap.json; \
6
+ fi && npm ci --include=dev --ignore-scripts --no-audit --no-fund
5
7
  COPY src ./src
6
8
  COPY scripts ./scripts
7
9
  COPY examples/taskpool ./examples/taskpool
@@ -39,7 +39,7 @@ process. See the maintained [Mathlib service implementation](../../../docs/archi
39
39
 
40
40
  To run the host without a container after building the checkout, use
41
41
  `npm run service:mathlib-search` from the root, or
42
- `node ../../../dist/examples/services/mathlib-search/main.js` from this directory.
42
+ `../../../node_modules/.bin/anys run ./main.ts` from this directory.
43
43
  The caller supplies the host token with `MATHLIB_SEARCH_TOKEN`, and configures
44
44
  the endpoint in its own service adapter. The application/operator owns the
45
45
  external provider's lifecycle and persistent data; Runtime close does not remove it.
@@ -6,11 +6,11 @@ This example registers an MCP stdio provider with `mcpService()` and an ordinary
6
6
 
7
7
  ## Install and build outside the checkout
8
8
 
9
- Use Linux with Node 24 or later. Set `ANYSWARM_SDK_ARCHIVE` to the absolute path of a verified candidate SDK archive. Run these commands in an empty directory.
9
+ Use Linux with Node 24 or later. Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive.
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
14
14
  npm install --save-dev typescript @types/node
15
15
  cp -R node_modules/@anyswarm/core/examples/services/mcp-managed demo
16
16
  cd demo
@@ -4,13 +4,13 @@ Two Agents share a SQLite Board. A replacement Agent reads the committed finding
4
4
 
5
5
  `business.ts` is an independent SQLite library with publish/list operations. `interface.ts` describes the public operations. `index.ts` binds authenticated callers and supplies lifecycle and observation hooks. `python/board.py` implements the same business operations in Python. `python/server.py` exposes ordinary GET/POST `/entries` REST routes using Python's standard library.
6
6
 
7
- ## Run from an installed candidate
7
+ ## Run from the installed SDK
8
8
 
9
- Use Node 24 or later. The HTTP variant also needs Python 3. In an empty directory outside the checkout, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of the SDK archive produced by `npm pack`.
9
+ Use Node 24 or later. The HTTP variant also needs Python 3. Run these commands in an empty directory. To use a source build, set `ANYSWARM_SDK_ARCHIVE` to the absolute path of its verified archive.
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "$ANYSWARM_SDK_ARCHIVE"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
14
14
  npm install --save-dev typescript @types/node
15
15
  cp -R node_modules/@anyswarm/core/examples/services/persistent-board demo
16
16
  cd demo
@@ -51,6 +51,16 @@ npx anyswarm trace --root ./runs
51
51
 
52
52
  Open the completed Run, expand **Service states**, and inspect the Board export. A publish call also links the Board state and original JSON. Export start/end times describe the framework's export work. The Board supplies its capture time and last committed entry ID as a business revision. These close/retirement observations have their own timestamps. The Viewer retains the individual publish call evidence alongside them.
53
53
 
54
+ ## Watch a live Board
55
+
56
+ Copy this example from the installed SDK as shown above. Configure OpenSandbox and select an installed Worker with setup or `ANYSWARM_WORKER_IMAGE`. Open the example in a regular terminal and run:
57
+
58
+ ```sh
59
+ anys -u ./live.ts 'Watch the persistent Board'
60
+ ```
61
+
62
+ Enter two short findings in the composer. Each commit appears in the stream with its row ID, and the status header updates the committed count. Use `/stop` to finish and `/trace` to inspect the saved Run. The example uses SQLite and does not spawn an Agent or call a model. SDK and RPC clients can read the live count, recent IDs and commit times through the Service observation hook. The final export remains available to Trace Viewer after the Harness closes.
63
+
54
64
  ## Author a different Service
55
65
 
56
66
  Register the adapter and grant its operations explicitly.
@@ -12,5 +12,12 @@ export declare class Board {
12
12
  });
13
13
  publish(authorId: string, text: string): BoardEntry;
14
14
  list(): BoardEntry[];
15
+ observation(): {
16
+ count: number;
17
+ entries: {
18
+ id: number;
19
+ createdAt: string;
20
+ }[];
21
+ };
15
22
  close(): void;
16
23
  }
@@ -47,6 +47,13 @@ export class Board {
47
47
  .all();
48
48
  return rows.map(row => ({ id: Number(row.id), authorId: String(row.authorId), text: String(row.text), createdAt: String(row.createdAt) }));
49
49
  }
50
+ observation() {
51
+ const recent = this.database.prepare('SELECT id, created_at AS createdAt, (SELECT COUNT(*) FROM entries) AS count FROM entries ORDER BY id DESC LIMIT 20').all();
52
+ return {
53
+ count: Number(recent[0]?.count ?? 0),
54
+ entries: recent.map(row => ({ id: Number(row.id), createdAt: String(row.createdAt) })),
55
+ };
56
+ }
50
57
  close() {
51
58
  this.database.close();
52
59
  }
@@ -35,6 +35,16 @@ export function boardService({ storagePath } = {}) {
35
35
  }
36
36
  return current().list();
37
37
  },
38
+ readState() {
39
+ const state = current().observation();
40
+ return { state, capturedAt: new Date().toISOString(), revision: String(state.entries[0]?.id ?? 0),
41
+ presentation: {
42
+ summary: [{ label: 'Committed entries', path: '/count' }],
43
+ tables: [{ title: 'Recent entries', path: '/entries', columns: [
44
+ { label: 'ID', path: '/id' }, { label: 'Committed at', path: '/createdAt' },
45
+ ] }],
46
+ } };
47
+ },
38
48
  exportState() {
39
49
  const entries = current().list();
40
50
  return { entries: entries, count: entries.length, capturedAt: new Date().toISOString(),
@@ -0,0 +1,3 @@
1
+ import { type Harness } from '@anyswarm/core';
2
+ declare const harness: Harness;
3
+ export default harness;
@@ -0,0 +1,58 @@
1
+ import { join } from 'node:path';
2
+ import { createRuntime, createSandbox, resolveSandboxConnection, ServiceRegistry, workerImageFor, } from '@anyswarm/core';
3
+ import { Board } from './business.js';
4
+ import { boardService } from './index.js';
5
+ const harness = {
6
+ apiVersion: 1,
7
+ id: 'live-board',
8
+ lifetimes: ['interactive'],
9
+ input: true,
10
+ inputDescriptor: { description: 'Commit a finding to the Board', schema: { type: 'string', minLength: 1, maxLength: 10000 } },
11
+ async run(context) {
12
+ const connection = resolveSandboxConnection();
13
+ const storagePath = join(context.outputDir, 'board.sqlite');
14
+ const services = new ServiceRegistry();
15
+ services.register('board', boardService({ storagePath }));
16
+ return context.runWithRuntime({
17
+ createRuntime: () => createRuntime({
18
+ sandbox: createSandbox({ lifecycleBaseUrl: connection.lifecycleBaseUrl, apiKey: connection.apiKey }),
19
+ connection: { advertiseHost: connection.advertiseHost, publicUrl: connection.publicUrl },
20
+ // This Harness publishes Host input and never spawns a model-backed Agent.
21
+ models: { default: { provider: 'openai', model: 'unused', upstream: { url: 'http://127.0.0.1:1/v1/responses', headers: {} } } },
22
+ profiles: { observer: { model: 'default', image: connection.image ?? workerImageFor('pi'), writable: false } },
23
+ services, maxAgents: 1, outputDir: join(context.outputDir, 'runtime'),
24
+ }),
25
+ async run(runtime) {
26
+ const unregister = context.registerAgentControls({ runtime });
27
+ let writer;
28
+ try {
29
+ const board = new Board(storagePath, { create: false });
30
+ writer = board;
31
+ context.registerInput(input => {
32
+ if (typeof input !== 'string')
33
+ throw new TypeError('Enter a text finding');
34
+ const { id } = board.publish('run-owner', input);
35
+ const summary = 'Committed entries ' + board.observation().count;
36
+ context.updateStatus({ business: { summary } });
37
+ context.emit({ kind: 'board.commit', summary: summary + ' · entry ' + id });
38
+ return { id };
39
+ });
40
+ context.markRunning();
41
+ context.updateStatus({ business: { summary: 'Committed entries ' + board.observation().count } });
42
+ await new Promise(resolve => {
43
+ if (context.signal.aborted)
44
+ resolve();
45
+ else
46
+ context.signal.addEventListener('abort', () => resolve(), { once: true });
47
+ });
48
+ return { committed: board.observation().count };
49
+ }
50
+ finally {
51
+ writer?.close();
52
+ unregister();
53
+ }
54
+ },
55
+ });
56
+ },
57
+ };
58
+ export default harness;
@@ -52,12 +52,12 @@ The example defaults to a local OpenSandbox lifecycle URL of `http://127.0.0.1:8
52
52
  From `examples/subagents/`, run one task.
53
53
 
54
54
  ```sh
55
- node --env-file=.env ../../dist/examples/subagents/main.js \
56
- ../../dist/examples/subagents/config.js \
55
+ ../../node_modules/.bin/anys run ./main.ts \
56
+ ./config.ts \
57
57
  'Suggest two checks to make before merging a pull request.'
58
58
  ```
59
59
 
60
- The entry waits for Root's reply, closes the team, and writes the task result and cleanup receipts to `subagents-runs/<runtimeId>/harness-report.json`. Edit `config.ts` or `main.ts` here and rebuild from the checkout root to try changes.
60
+ The entry waits for Root's reply, closes the team, and writes the task result and cleanup receipts to `subagents-runs/<runtimeId>/harness-report.json`. Edit `config.ts` or `main.ts` here and run the TS entry again to try changes.
61
61
 
62
62
  ## Fixed or interactive host entry
63
63
 
@@ -79,8 +79,8 @@ Install the published SDK or a matching source archive as described above. The e
79
79
 
80
80
  ```sh
81
81
  sdk=node_modules/@anyswarm/core
82
- example="$sdk"/dist/examples/subagents
83
- node "$example/main.js" "$example/config.js" --interactive
82
+ example="$sdk"/examples/subagents
83
+ node_modules/.bin/anys run "$example/main.ts" "$example/config.ts" --interactive
84
84
  ```
85
85
 
86
86
  The configured `doctor --smoke` path covers Pi projects. The installed Codex example runs through the same local OpenSandbox provider and its own executor. [Codex startup and capabilities](../../docs/architecture/16-pi-opensandbox-backend.md#codex-app-server)
@@ -20,7 +20,9 @@ export async function createSubagentsHarness(config, controls = {}) {
20
20
  const services = new ServiceRegistry();
21
21
  let team;
22
22
  const { contextFork: allowContextFork } = getExecutorCapabilities(config.executor ?? 'pi');
23
- services.register('collaboration', createCollaborationService(request => team.invoke(request), () => team.exportState(), { allowContextFork }));
23
+ services.register('collaboration', createCollaborationService(request => team.invoke(request), () => team.exportState(), {
24
+ allowContextFork, readState: () => team.readLiveState(),
25
+ }));
24
26
  if (controls.userQuestions)
25
27
  services.register('user-interaction', controls.userQuestions);
26
28
  const common = { image, writable: true, serviceToolMode: 'cli', services: { collaboration: collaborationOperations,
@@ -16,6 +16,21 @@ export declare function createSubagentsController(runtime: Runtime, { maxDepth,
16
16
  onChange?: () => void;
17
17
  }): {
18
18
  attachRoot: (id: string) => void;
19
+ ownerControl: (operation: 'interrupt' | 'stop', agentId: string, requestId: string, reason?: string) => Promise<unknown>;
20
+ sendMember(agentId: string, input: string, requestId: string, options: Omit<SendOptions, 'requestId'>, signal: AbortSignal): Promise<JsonValue>;
21
+ reconcileMemberInput(agentId: string, requestId: string, query: () => Promise<any>): Promise<any>;
22
+ reconcileOwnerControl(operation: 'interrupt' | 'stop', agentId: string, requestId: string, query: () => Promise<any>): Promise<any>;
23
+ readLiveState(): {
24
+ memberCount: number;
25
+ operationCount: number;
26
+ members: {
27
+ path: string;
28
+ agentId: string | null;
29
+ parent: string | null;
30
+ lastOutcome: "completed" | "failed" | "interrupted" | null;
31
+ waiting: boolean;
32
+ }[];
33
+ };
19
34
  rootId: () => string | undefined;
20
35
  rootEpoch: () => number;
21
36
  rootBusy: () => boolean;