@anyswarm/core 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/AGENTS.md +20 -5
  2. package/README.md +69 -55
  3. package/dist/examples/README.md +138 -77
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +108 -16
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  7. package/dist/examples/autoresearch/config.d.ts +48 -5
  8. package/dist/examples/autoresearch/config.js +57 -23
  9. package/dist/examples/autoresearch/demo.d.ts +12 -4
  10. package/dist/examples/autoresearch/demo.js +65 -22
  11. package/dist/examples/autoresearch/eject.json +2 -0
  12. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  13. package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
  14. package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
  15. package/dist/examples/autoresearch/frontiercs2.js +71 -14
  16. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  17. package/dist/examples/autoresearch/prepare-demo.js +46 -0
  18. package/dist/examples/autoresearch/prepare.d.ts +105 -53
  19. package/dist/examples/autoresearch/prepare.js +126 -57
  20. package/dist/examples/autoresearch/project.d.ts +6 -95
  21. package/dist/examples/autoresearch/project.js +131 -45
  22. package/dist/examples/autoresearch/research-service.d.ts +16 -1
  23. package/dist/examples/autoresearch/research-service.js +84 -44
  24. package/dist/examples/code/README.md +25 -17
  25. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  26. package/dist/examples/code/config.d.ts +1 -0
  27. package/dist/examples/first-harness/AGENTS.md +25 -0
  28. package/dist/examples/first-harness/README.md +136 -0
  29. package/dist/examples/first-harness/config.d.ts +9 -8
  30. package/dist/examples/first-harness/config.js +33 -26
  31. package/dist/examples/first-harness/eject.json +14 -0
  32. package/dist/examples/first-harness/handoff.js +3 -3
  33. package/dist/examples/first-harness/harness.d.ts +14 -18
  34. package/dist/examples/first-harness/harness.js +102 -77
  35. package/dist/examples/first-harness/input/README.md +7 -0
  36. package/dist/examples/first-harness/session.js +2 -1
  37. package/dist/examples/first-harness/tsconfig.json +2 -1
  38. package/dist/examples/harness-session/README.md +4 -4
  39. package/dist/examples/lead-worker/README.md +1 -1
  40. package/dist/examples/lead-worker/project-config.d.ts +1 -0
  41. package/dist/examples/messages/README.md +2 -2
  42. package/dist/examples/notes/README.md +5 -5
  43. package/dist/examples/notes/config.d.ts +1 -0
  44. package/dist/examples/parallel-swarm/AGENTS.md +32 -0
  45. package/dist/examples/parallel-swarm/README.md +136 -0
  46. package/dist/examples/parallel-swarm/board-service.js +25 -8
  47. package/dist/examples/parallel-swarm/board.d.ts +31 -1
  48. package/dist/examples/parallel-swarm/board.js +98 -13
  49. package/dist/examples/parallel-swarm/config.d.ts +11 -0
  50. package/dist/examples/parallel-swarm/config.js +39 -0
  51. package/dist/examples/parallel-swarm/eject.json +5 -0
  52. package/dist/examples/parallel-swarm/harness.d.ts +26 -20
  53. package/dist/examples/parallel-swarm/harness.js +77 -76
  54. package/dist/examples/parallel-swarm/report.d.ts +12 -0
  55. package/dist/examples/parallel-swarm/report.js +30 -0
  56. package/dist/examples/peermesh/README.md +1 -1
  57. package/dist/examples/peermesh/project-config.d.ts +1 -0
  58. package/dist/examples/services/agent-control/README.md +1 -1
  59. package/dist/examples/services/mathlib-search/README.md +1 -1
  60. package/dist/examples/services/mcp-managed/README.md +1 -1
  61. package/dist/examples/services/persistent-board/README.md +6 -3
  62. package/dist/examples/subagents/AGENTS.md +35 -0
  63. package/dist/examples/subagents/README.md +129 -93
  64. package/dist/examples/subagents/config.d.ts +2 -10
  65. package/dist/examples/subagents/config.js +9 -16
  66. package/dist/examples/subagents/eject.json +17 -0
  67. package/dist/examples/subagents/handoff-config.d.ts +41 -0
  68. package/dist/examples/subagents/handoff-config.js +13 -0
  69. package/dist/examples/subagents/model.d.ts +3 -0
  70. package/dist/examples/subagents/model.js +19 -0
  71. package/dist/examples/substrate/README.md +12 -6
  72. package/dist/examples/substrate/config.d.ts +1 -0
  73. package/dist/examples/substrate/project-config.d.ts +1 -0
  74. package/dist/examples/super/README.md +34 -22
  75. package/dist/examples/super/actions.d.ts +1 -1
  76. package/dist/examples/super/actions.js +11 -11
  77. package/dist/examples/super/config.js +3 -3
  78. package/dist/examples/super/eject.json +1 -1
  79. package/dist/examples/super/location.js +1 -1
  80. package/dist/examples/super/operator.d.ts +1 -0
  81. package/dist/examples/super/operator.js +31 -0
  82. package/dist/examples/super/project.d.ts +0 -107
  83. package/dist/examples/super/project.js +1 -3
  84. package/dist/examples/taskpool/README.md +1 -1
  85. package/dist/examples/taskpool/config.d.ts +1 -0
  86. package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
  87. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  88. package/dist/scripts/anyswarm-arguments.js +69 -97
  89. package/dist/scripts/anyswarm-eject.js +1 -1
  90. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  91. package/dist/scripts/anyswarm-harnesses.js +1 -22
  92. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  93. package/dist/scripts/anyswarm-installation.js +17 -291
  94. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  95. package/dist/scripts/anyswarm-launch.js +32 -81
  96. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  97. package/dist/scripts/anyswarm-progress.js +133 -0
  98. package/dist/scripts/anyswarm-project.d.ts +1 -9
  99. package/dist/scripts/anyswarm-project.js +40 -127
  100. package/dist/scripts/anyswarm-source-runner.js +9 -41
  101. package/dist/scripts/anyswarm.js +6 -26
  102. package/dist/scripts/build-provenance.json +1 -1
  103. package/dist/scripts/generate-architecture-coverage.js +1 -1
  104. package/dist/scripts/generate-architecture-prompts.js +18 -10
  105. package/dist/scripts/local-environment.d.ts +13 -7
  106. package/dist/scripts/local-environment.js +73 -21
  107. package/dist/scripts/local-setup.d.ts +3 -0
  108. package/dist/scripts/local-setup.js +153 -118
  109. package/dist/scripts/pack-release.js +31 -4
  110. package/dist/src/core/index.js +1 -1
  111. package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
  112. package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
  113. package/dist/src/core/sandbox/sandbox-connection.js +22 -7
  114. package/dist/src/core/worker-image.js +1 -1
  115. package/dist/src/harness/project-harness.d.ts +1 -0
  116. package/dist/src/harness/project-harness.js +5 -4
  117. package/dist/src/harness/project-rpc-client.js +19 -0
  118. package/dist/src/harness/project-runtime.js +3 -1
  119. package/dist/src/harness/typescript-loader.d.ts +2 -0
  120. package/dist/src/harness/typescript-loader.js +26 -8
  121. package/dist/src/trace-viewer/command.mjs +6 -3
  122. package/dist/src/trace-viewer/public/app.js +239 -59
  123. package/dist/src/trace-viewer/public/index.html +5 -0
  124. package/dist/src/trace-viewer/public/style.css +22 -0
  125. package/dist/src/trace-viewer/reader.mjs +242 -26
  126. package/dist/src/trace-viewer/run-root.d.mts +1 -0
  127. package/dist/src/trace-viewer/run-root.mjs +7 -0
  128. package/dist/src/trace-viewer/server.mjs +3 -1
  129. package/docs/INDEX.md +11 -9
  130. package/docs/architecture/04-services.md +1 -1
  131. package/docs/architecture/06-observability-experiments.md +21 -7
  132. package/docs/architecture/07-run-configuration.md +118 -19
  133. package/docs/architecture/08-prompts.md +21 -2
  134. package/docs/architecture/10-service-api-reference.md +12 -5
  135. package/docs/architecture/12-code-coverage.md +157 -115
  136. package/docs/architecture/15-core-runtime.md +1 -1
  137. package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
  138. package/docs/architecture/17-harness-reporting.md +79 -1
  139. package/docs/architecture/22-website.md +52 -20
  140. package/docs/architecture/23-project-harness.md +109 -37
  141. package/docs/architecture/26-code.md +20 -5
  142. package/docs/architecture/27-personal.md +23 -8
  143. package/docs/architecture/28-autoresearch.md +18 -12
  144. package/docs/architecture/INDEX.md +1 -2
  145. package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
  146. package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
  147. package/docs/architecture/prompts/22-autoresearch.md +9 -2
  148. package/docs/architecture/prompts/source-manifest.json +76 -52
  149. package/docs/architecture/source-map.json +445 -105
  150. package/docs/designs/core-harness/01-core.md +2 -2
  151. package/docs/designs/core-harness/06-project-harness.md +3 -3
  152. package/docs/designs/core-harness/README.md +2 -2
  153. package/docs/en/agents.md +1 -1
  154. package/docs/en/autoresearch.md +41 -0
  155. package/docs/en/blog/100b-tokens.md +157 -0
  156. package/docs/en/build-your-harness.md +47 -22
  157. package/docs/en/changelog.md +29 -1
  158. package/docs/en/first-harness.md +40 -32
  159. package/docs/en/harnesses/index.md +23 -23
  160. package/docs/en/harnesses/lead-worker.md +1 -1
  161. package/docs/en/harnesses/peermesh.md +2 -2
  162. package/docs/en/harnesses/subagents.md +10 -31
  163. package/docs/en/harnesses/substrate.md +4 -4
  164. package/docs/en/harnesses/taskpool.md +2 -2
  165. package/docs/en/latest.md +30 -5
  166. package/docs/en/overview.md +22 -22
  167. package/docs/en/quickstart.md +69 -56
  168. package/docs/en/reference/api.md +1 -1
  169. package/docs/en/reference/cli.md +47 -85
  170. package/docs/en/sandbox.md +3 -3
  171. package/docs/en/trace-viewer.md +32 -12
  172. package/docs/operations/trace-viewer.md +26 -11
  173. package/docs/third-party-notices.md +0 -1
  174. package/docs/workflows/development.md +160 -118
  175. package/docs/workflows/release-and-docs-versioning.md +207 -54
  176. package/docs/workflows/release-cli-acceptance.md +162 -0
  177. package/docs/zh/agents.md +1 -1
  178. package/docs/zh/autoresearch.md +41 -0
  179. package/docs/zh/blog/100b-tokens.md +102 -0
  180. package/docs/zh/build-your-harness.md +48 -23
  181. package/docs/zh/changelog.md +29 -1
  182. package/docs/zh/first-harness.md +43 -35
  183. package/docs/zh/harnesses/index.md +23 -23
  184. package/docs/zh/harnesses/lead-worker.md +1 -1
  185. package/docs/zh/harnesses/peermesh.md +2 -2
  186. package/docs/zh/harnesses/subagents.md +10 -31
  187. package/docs/zh/harnesses/substrate.md +4 -4
  188. package/docs/zh/harnesses/taskpool.md +2 -2
  189. package/docs/zh/latest.md +30 -5
  190. package/docs/zh/overview.md +23 -23
  191. package/docs/zh/quickstart.md +66 -57
  192. package/docs/zh/reference/api.md +1 -1
  193. package/docs/zh/reference/cli.md +19 -79
  194. package/docs/zh/sandbox.md +3 -3
  195. package/docs/zh/trace-viewer.md +32 -12
  196. package/examples/README.md +138 -77
  197. package/examples/authoring/README.md +4 -4
  198. package/examples/autoresearch/README.md +108 -16
  199. package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  200. package/examples/autoresearch/config.ts +64 -25
  201. package/examples/autoresearch/demo.ts +75 -22
  202. package/examples/autoresearch/eject.json +2 -0
  203. package/examples/autoresearch/frontiercs2-config.ts +15 -0
  204. package/examples/autoresearch/frontiercs2.ts +64 -11
  205. package/examples/autoresearch/prepare-demo.ts +44 -0
  206. package/examples/autoresearch/prepare.ts +134 -60
  207. package/examples/autoresearch/project.ts +120 -44
  208. package/examples/autoresearch/research-service.ts +91 -41
  209. package/examples/code/README.md +25 -17
  210. package/examples/code/REQUIREMENTS.zh.md +3 -3
  211. package/examples/first-harness/AGENTS.md +25 -0
  212. package/examples/first-harness/README.md +136 -0
  213. package/examples/first-harness/config.ts +41 -27
  214. package/examples/first-harness/eject.json +14 -0
  215. package/examples/first-harness/handoff.ts +3 -3
  216. package/examples/first-harness/harness.ts +104 -72
  217. package/examples/first-harness/input/README.md +7 -0
  218. package/examples/first-harness/session.ts +2 -1
  219. package/examples/first-harness/tsconfig.json +2 -1
  220. package/examples/harness-session/README.md +4 -4
  221. package/examples/lead-worker/README.md +1 -1
  222. package/examples/messages/README.md +2 -2
  223. package/examples/notes/README.md +5 -5
  224. package/examples/parallel-swarm/AGENTS.md +32 -0
  225. package/examples/parallel-swarm/README.md +136 -0
  226. package/examples/parallel-swarm/board-service.ts +28 -9
  227. package/examples/parallel-swarm/board.ts +107 -13
  228. package/examples/parallel-swarm/config.ts +47 -0
  229. package/examples/parallel-swarm/eject.json +5 -0
  230. package/examples/parallel-swarm/harness.ts +83 -71
  231. package/examples/parallel-swarm/report.ts +33 -0
  232. package/examples/peermesh/README.md +1 -1
  233. package/examples/services/agent-control/README.md +1 -1
  234. package/examples/services/mathlib-search/README.md +1 -1
  235. package/examples/services/mcp-managed/README.md +1 -1
  236. package/examples/services/persistent-board/README.md +6 -3
  237. package/examples/subagents/AGENTS.md +35 -0
  238. package/examples/subagents/README.md +129 -93
  239. package/examples/subagents/config.ts +9 -15
  240. package/examples/subagents/eject.json +17 -0
  241. package/examples/subagents/handoff-config.ts +14 -0
  242. package/examples/subagents/model.ts +20 -0
  243. package/examples/substrate/README.md +12 -6
  244. package/examples/super/README.md +34 -22
  245. package/examples/super/actions.ts +11 -11
  246. package/examples/super/config.ts +3 -3
  247. package/examples/super/eject.json +1 -1
  248. package/examples/super/location.ts +1 -1
  249. package/examples/super/operator.ts +28 -0
  250. package/examples/super/project.ts +1 -3
  251. package/examples/taskpool/README.md +1 -1
  252. package/npm-shrinkwrap.development.json +46 -1538
  253. package/npm-shrinkwrap.json +10 -43
  254. package/package.development.json +3 -6
  255. package/package.json +3 -5
  256. package/scripts/anyswarm-arguments.ts +67 -96
  257. package/scripts/anyswarm-eject.ts +1 -1
  258. package/scripts/anyswarm-harnesses.ts +1 -18
  259. package/scripts/anyswarm-installation.ts +18 -294
  260. package/scripts/anyswarm-launch.ts +30 -102
  261. package/scripts/anyswarm-progress.ts +125 -0
  262. package/scripts/anyswarm-project.ts +31 -123
  263. package/scripts/anyswarm-source-runner.ts +9 -36
  264. package/scripts/anyswarm.ts +4 -24
  265. package/scripts/generate-architecture-coverage.ts +1 -1
  266. package/scripts/generate-architecture-prompts.ts +21 -10
  267. package/scripts/local-environment.ts +79 -21
  268. package/scripts/local-setup.ts +150 -105
  269. package/scripts/pack-release.ts +28 -4
  270. package/src/core/index.ts +1 -1
  271. package/src/core/sandbox/opensandbox-backend.ts +10 -4
  272. package/src/core/sandbox/sandbox-connection.ts +22 -7
  273. package/src/core/worker-image.ts +1 -1
  274. package/src/harness/project-harness.ts +5 -4
  275. package/src/harness/project-rpc-client.ts +23 -0
  276. package/src/harness/project-runtime.ts +2 -1
  277. package/src/harness/typescript-loader.ts +28 -8
  278. package/src/trace-viewer/command.mjs +6 -3
  279. package/src/trace-viewer/public/app.js +239 -59
  280. package/src/trace-viewer/public/index.html +5 -0
  281. package/src/trace-viewer/public/style.css +22 -0
  282. package/src/trace-viewer/reader.mjs +242 -26
  283. package/src/trace-viewer/run-root.d.mts +1 -0
  284. package/src/trace-viewer/run-root.mjs +7 -0
  285. package/src/trace-viewer/server.mjs +3 -1
  286. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  287. package/dist/scripts/anyswarm-applications.js +0 -19
  288. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  289. package/dist/scripts/anyswarm-tui-config.js +0 -189
  290. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  291. package/dist/scripts/anyswarm-tui-session.js +0 -304
  292. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  293. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  294. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  295. package/dist/scripts/anyswarm-tui.js +0 -1012
  296. package/docs/architecture/25-foreground-tui.md +0 -51
  297. package/scripts/anyswarm-applications.ts +0 -39
  298. package/scripts/anyswarm-tui-config.ts +0 -174
  299. package/scripts/anyswarm-tui-session.ts +0 -295
  300. package/scripts/anyswarm-tui-terminal.ts +0 -147
  301. package/scripts/anyswarm-tui.ts +0 -912
@@ -0,0 +1,33 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import type { CloseReceipt, FileTree } from '@anyswarm/core';
5
+
6
+ export type ReportCheck =
7
+ | { status: 'not-run' | 'pending' | 'unverified'; reason: string }
8
+ | { status: 'verified'; path: string; sha256: string; bytes: number };
9
+
10
+ /** A readable, newly written report is an export check, not a semantic review. */
11
+ export async function checkReportExport(receipt: CloseReceipt, agentId: string | undefined, initial: FileTree): Promise<ReportCheck> {
12
+ if (!agentId) return { status: 'not-run', reason: 'SYNTHESIZER_NOT_STARTED' };
13
+ const agent = receipt.agents.find(agent => agent.agentId === agentId);
14
+ const directory = agent?.artifacts.find(path => path.endsWith(join('artifacts', 'files')));
15
+ if (!directory) {
16
+ const pending = !agent || agent.execution !== 'stopped' || agent.cleanup === 'pending' ||
17
+ receipt.pending.some(entry => entry.kind === 'agent' && entry.id === agentId);
18
+ return { status: pending ? 'pending' : 'unverified', reason: pending ? 'REPORT_EXPORT_PENDING' : 'REPORT_MISSING' };
19
+ }
20
+ const path = join(directory, 'report.md');
21
+ try {
22
+ const bytes = await readFile(path);
23
+ const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
24
+ if (!text.trim()) return { status: 'unverified', reason: 'REPORT_EMPTY' };
25
+ const before = initial['report.md'];
26
+ if (before && bytes.equals(Buffer.from(before.data, before.encoding === 'base64' ? 'base64' : 'utf8'))) {
27
+ return { status: 'unverified', reason: 'REPORT_UNCHANGED' };
28
+ }
29
+ return { status: 'verified', path, sha256: createHash('sha256').update(bytes).digest('hex'), bytes: bytes.length };
30
+ } catch {
31
+ return { status: 'unverified', reason: 'REPORT_UNREADABLE' };
32
+ }
33
+ }
@@ -70,7 +70,7 @@ repository sources.
70
70
 
71
71
  ```sh
72
72
  npm init -y
73
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
73
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
74
74
  npm install --save-dev typescript @types/node
75
75
  sdk=node_modules/@anyswarm/core
76
76
  cp -R "$sdk"/examples/peermesh demo
@@ -10,7 +10,7 @@ Run these commands in an empty directory. To use a source build, set `ANYSWARM_S
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
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
@@ -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_modules/.bin/anys run ./main.ts` from this directory.
42
+ `node ../../../dist/scripts/anyswarm.js 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.
@@ -10,7 +10,7 @@ Use Linux with Node 24 or later. Run these commands in an empty directory. To us
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
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
@@ -10,7 +10,7 @@ Use Node 24 or later. The HTTP variant also needs Python 3. Run these commands i
10
10
 
11
11
  ```sh
12
12
  npm init -y
13
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
13
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
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
@@ -56,10 +56,13 @@ Open the completed Run, expand **Service states**, and inspect the Board export.
56
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
57
 
58
58
  ```sh
59
- anys -u ./live.ts 'Watch the persistent Board'
59
+ anyswarm --harness ./live.ts --mode rpc --lifetime interactive
60
60
  ```
61
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.
62
+ Use a [Harness RPC client](../../harness-session/README.md) to start the Run
63
+ and submit two short findings with its input operation. Each commit emits the
64
+ row ID and updates the committed count. Stop the Session, then inspect its saved
65
+ records with `anyswarm trace`.
63
66
 
64
67
  ## Author a different Service
65
68
 
@@ -0,0 +1,35 @@
1
+ # Customize this Subagents Harness
2
+
3
+ This file is for a Coding Agent editing an exported application. Start by reading
4
+ `README.md`, `project.ts`, `business.ts`, and `config.ts`. Read the installed
5
+ `@anyswarm/core` package-root TypeScript declarations for exact SDK signatures.
6
+
7
+ - Keep the application in ordinary TypeScript. `project.ts` exports the public
8
+ `Harness`; one Runtime owns Root and its children. Do not create a Runtime for
9
+ every Agent or add a second session/workflow abstraction.
10
+ - `config.ts` owns model, executor, Sandbox, capacity and deadlines. Respect the
11
+ user's saved setup and explicit configuration. Keep tokens in the host
12
+ environment; never put credentials in prompts, seed files or reports.
13
+ - `business.ts` assembles Profiles and Services. The controller in
14
+ `harness/controller.ts` owns named children, messages, follow-up and closure.
15
+ The Service adapter gets the caller from the authenticated Bridge; never trust
16
+ an author or parent supplied in Agent text.
17
+ - Initial project files are captured once and passed to separate private
18
+ Sandboxes. A child message does not synchronize files. Root must integrate
19
+ contributions and write the requested deliverable in its own directory.
20
+ - Preserve accepted/unknown input receipts, cancellation, bounded close and raw
21
+ export/cleanup receipts. An unknown write is reconciled with its original
22
+ request ID. Do not silently retry it with a new identity.
23
+ - Define the application's actual output and business checks before editing.
24
+ Agent settlement and file presence do not establish correctness. Generic
25
+ Subagents returns `acceptance: not-run`; add a domain check only when its
26
+ contract is explicit. Keep business failure separate from cleanup failure.
27
+ - Read `anyswarm-source.json` for the SDK identity. Install with `npm install`
28
+ and run with the local `npm start` so source and SDK stay matched. Change the
29
+ visible source here, rather than wrapping an inaccessible bundled Harness.
30
+
31
+ Use a real input directory and question for manual acceptance. Verify the
32
+ requested members contributed, inspect citations against the captured input,
33
+ read the exported result, and check cleanup. Deterministic test fixtures verify
34
+ protocol and failure handling; they are not evidence of model quality. Report
35
+ which checks ran and any remaining real-model acceptance separately.
@@ -1,109 +1,145 @@
1
- # Subagents Harness
1
+ # Subagents: a repository handoff with delegated investigation
2
2
 
3
- ## Run the project example
3
+ Give Root a real local repository and an engineering question. It can delegate
4
+ independent reading to named children in private Sandboxes, receive their
5
+ findings through the host collaboration Service, and integrate the result.
6
+ The same general Harness supports other tasks; it does not hardcode a team size
7
+ or a report format.
4
8
 
5
- Use Node.js 22.19 or newer on Linux. Follow [SDK preparation](../README.md#run-an-example-from-its-directory)
6
- for Sandbox and model configuration. In an empty directory outside the checkout,
7
- install the SDK and copy its matching example sources. Set `ANYSWARM_SDK_ARCHIVE`
8
- to a verified archive's absolute path to use a candidate built from current
9
- repository sources.
9
+ ## Run on your repository
10
10
 
11
- ```sh
12
- npm init -y
13
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
14
- npm install --save-dev typescript @types/node
15
- sdk=node_modules/@anyswarm/core
16
- cp -R "$sdk"/examples/subagents demo
17
- cd demo
18
- npm run check
19
- npm run build
20
- npm run start -- --cwd /absolute/path/to/project \
21
- --prompt 'Inspect the project, delegate an independent check and integrate the result'
22
- ```
23
-
24
- Root receives the prompt and can delegate to children with separate Sandbox
25
- directories. Each child starts with the captured project tree. The example
26
- starts its own in-process collaboration Service. Read `project-run.json` for
27
- the result and its report paths. The captured input project stays writable outside the run and the host does not write to it. The host exports files and releases its Sandbox resources on
28
- close. See the [mechanism guide](../../docs/en/harnesses/subagents.md).
29
-
30
- ## Fixed and interactive host demonstration
31
-
32
- Use Node.js 22.19 or newer and npm on the Linux Controller. If you have a compatible Worker image and an OpenSandbox provider, build from the checkout root.
11
+ Install the CLI and complete `anyswarm setup` first. Set the host model route
12
+ (`ANYSWARM_MODEL_URL`, `ANYSWARM_MODEL_ID` and, when needed,
13
+ `ANYSWARM_MODEL_TOKEN`). The model must support tool calls and the selected
14
+ executor's protocol. Setup supplies the saved Sandbox connection and executor;
15
+ an explicit environment setting takes precedence. No separate collaboration
16
+ server, Git forge, database or chat service is required.
33
17
 
34
18
  ```sh
35
- npm ci
36
- npm run build
37
- cd examples/subagents
38
- ```
39
-
40
- If you need to prepare the host, run `./scripts/setup` from the checkout root in place of the install and build commands. It builds the checkout, prepares the Worker and OpenSandbox, and verifies them with a local Responses endpoint. The setup JSON reports the image ID as `worker.id`. [Host requirements and diagnostics](../../docs/architecture/07-run-configuration.md#local-setup-and-doctor)
41
-
42
- Create `examples/subagents/.env` with your Worker image ID and a streaming `/v1/responses` endpoint that accepts `k3` and supports tool calls. Fill in the token if the endpoint requires bearer authentication.
19
+ anyswarm --harness subagents \
20
+ --cwd /absolute/path/to/repository \
21
+ --prompt 'Prepare an engineering handoff for this repository. Delegate entry points, running and configuration to one child, and modules, data flow and tests to another. Review their findings against the source and integrate report.md. Cite relative file paths and line ranges for important claims. Separate observed facts, inferences and checks not performed. Only produce the report; do not modify project source.' \
22
+ --output-dir /absolute/path/to/runs
43
23
 
44
- ```sh
45
- ANYSWARM_SUBAGENTS_IMAGE="sha256:<your-worker-image-id>"
46
- ANYSWARM_SUBAGENTS_MODEL_URL="https://your-gateway.example/v1/responses"
47
- ANYSWARM_SUBAGENTS_MODEL_TOKEN=""
24
+ anyswarm trace --root /absolute/path/to/runs --open
48
25
  ```
49
26
 
50
- The example defaults to a local OpenSandbox lifecycle URL of `http://127.0.0.1:8080/v1`. Set `ANYSWARM_SUBAGENTS_LIFECYCLE_URL` for another port and `ANYSWARM_SUBAGENTS_LIFECYCLE_TOKEN` if your provider requires authentication.
51
-
52
- From `examples/subagents/`, run one task.
53
-
54
- ```sh
55
- ../../node_modules/.bin/anys run ./main.ts \
56
- ./config.ts \
57
- 'Suggest two checks to make before merging a pull request.'
58
- ```
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 run the TS entry again to try changes.
61
-
62
- ## Fixed or interactive host entry
63
-
64
- The `main.ts` command above is the direct host demonstration. For a captured
65
- project, use `anyswarm --harness subagents --cwd /path/to/project --prompt '...'`.
66
- The collaboration Service is in-process and needs no separate deployment.
67
-
68
- ## Interactive mode
69
-
70
- Pass `--interactive` in place of the task to keep the example open.
71
-
72
- In interactive mode, enter a task or a follow-up as a line, use `/status` to inspect the team, and use `/exit` to close the whole run. A Root reply leaves the team available for further input. End of input and host cancellation also close the team. A host can instead supply `config.goal` or use the exported input, reply, status and close methods.
73
-
74
- The example config defaults to four live Agents including Root, with a maximum depth of three child edges from Root. Set `ANYSWARM_SUBAGENTS_MAX_AGENTS` and `ANYSWARM_SUBAGENTS_MAX_DEPTH` to adjust the limits. Models can be configured as `rootModel` and `childModel` on the host. The default work limit is 120 seconds and cleanup has its own 30-second limit. Set `files` to seed Root, and use a required `collect` specification for files that must be exported. Work directories are private by default. Set `workspace.root` and `workspace.child` to supported Core workspace mounts to enable sharing. Private children can send patches as text to Root.
75
-
76
- ## Use the packaged example with Codex
77
-
78
- Install the published SDK or a matching source archive as described above. The example defaults to Pi. To use Codex from that consumer project, set `ANYSWARM_EXECUTOR=codex` (or `ANYSWARM_SUBAGENTS_EXECUTOR=codex`), `ANYSWARM_MODEL_ID`, and `ANYSWARM_MODEL_URL` in the host shell. The installed SDK builds or reuses a local Worker for the selected executor. To use a prepared image, set `ANYSWARM_WORKER_IMAGE` or `ANYSWARM_SUBAGENTS_IMAGE`. Supply any required model or lifecycle token through the host environment.
27
+ This asks for two child contributions because the question has two useful
28
+ investigation areas. Root chooses how to delegate through its normal tools.
29
+ For a change investigation, replace the prompt with the actual planned change,
30
+ the behavior that must remain compatible, and the questions you need answered.
31
+ A Git diff or a specially prepared repository is not required.
32
+
33
+ ### Input, output and checks
34
+
35
+ - The host captures a fixed input tree and records its paths, modes and SHA-256
36
+ values in `initial-files.json`. Root and children receive private copies of
37
+ that tree. Subsequent local edits are not synchronized into this Run.
38
+ - Child work is communicated through messages. A child-written file is not
39
+ automatically present in Root's directory. Root must write `report.md` in its
40
+ own directory for this task.
41
+ - The default project entry requires collection of Root's tree, excluding Git,
42
+ with a 16 MiB limit. Read the actual artifact paths in `project-run.json` or
43
+ the Trace Viewer; `report.md` is inside Root's exported `artifacts/files/`
44
+ directory. Export does not overwrite the user's local repository.
45
+ - Agent completion, required file export, business acceptance and cleanup are
46
+ separate. The generic Harness returns **`acceptance: not-run`**. It does not
47
+ automatically prove source citations, architectural explanations or test
48
+ claims. Compare the report with the captured source and the child records.
49
+ - A required export that cannot be confirmed or a Sandbox that cannot be
50
+ released stays pending in its original receipt. A final Root reply is not
51
+ proof that cleanup completed.
52
+
53
+ The default limits are four live Agents including Root, depth three, 120 seconds
54
+ of work and a separate 30-second close allowance. These are limits, not a promise
55
+ that every repository can be investigated in that time. Use a focused directory
56
+ or increase the explicit configuration budget for a larger investigation.
57
+
58
+ ## Export and customize the full source
59
+
60
+ The `subagents` source export is introduced by the examples update in #335; use
61
+ a candidate containing this directory's `eject.json`. The released 0.5.2 CLI
62
+ already supports the built-in run above, but does not contain this new manifest.
79
63
 
80
64
  ```sh
81
- sdk=node_modules/@anyswarm/core
82
- example="$sdk"/examples/subagents
83
- node_modules/.bin/anys run "$example/main.ts" "$example/config.ts" --interactive
65
+ anyswarm eject subagents --dir ./my-subagents
66
+ cd my-subagents
67
+ npm install
68
+ npm start -- --cwd /absolute/path/to/repository \
69
+ --prompt 'Investigate the impact of changing our configuration loading order. Delegate independent checks, cite the source and write report.md.' \
70
+ --output-dir /absolute/path/to/runs
84
71
  ```
85
72
 
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)
87
-
88
- Use `--fork-turns none` when delegating with Codex. Use `swarm service view collaboration` to see the authenticated operations and arguments. A typical pair of calls looks like this.
73
+ Read the exported `AGENTS.md` with your Coding Agent. All collaboration source is
74
+ local and editable; the export does not call a hidden bundled application.
75
+ `anyswarm-source.json` and `.anyswarm-sdk/core.tgz` bind the source to the SDK
76
+ candidate that exported it. Run the local `npm start` after installing that
77
+ archive, including when moving the project to another machine.
78
+
79
+ For a report-only investigation, append `--config ./handoff-config.ts` to the
80
+ exported project's command. The included configuration matches the deadlines in
81
+ the real p-limit acceptance: 360 seconds of work, 70 seconds per model request
82
+ and 60 seconds for close. It limits the team to Root and two direct children and
83
+ requires a `report.md` of up to 1 MiB. The report's source claims remain subject
84
+ to review. To change the budgets, edit that file. `--config` loads a complete
85
+ configuration rather than merging arbitrary partial objects.
86
+
87
+ [Recorded VM run](https://github.com/AnySwarm/anyswarm/issues/358#issuecomment-7385075753)
88
+
89
+ | File | Responsibility |
90
+ | --- | --- |
91
+ | `project.ts` | Public Harness, captured input, user input controls, lifecycle and result projection. |
92
+ | `business.ts` | One Runtime, Root/child Profiles, Service registration and final collection. |
93
+ | `config.ts`, `model.ts` | Sandbox connection, model route, executor, image, capacity and deadlines. |
94
+ | `handoff-config.ts` | Reproducible repository handoff budgets and required report collection. |
95
+ | `harness/controller.ts` | Named members, parent relationships, messaging, follow-up, waits and bounded close. |
96
+ | `services/collaboration-service.ts` | Authenticated operations, authorization and observable collaboration state. |
97
+ | `prompts/prompts.ts` | Root and child instructions; no prewritten answer to the user's task. |
98
+ | `main.ts` | Direct host demonstration for embedding and explicit interactive clients. |
99
+
100
+ Common `ANYSWARM_MODEL_*`, `ANYSWARM_EXECUTOR` and connection settings take
101
+ precedence over the corresponding `ANYSWARM_SUBAGENTS_*` fallbacks. Without an
102
+ explicit image, `workerImageFor(executor)` selects the matching Worker. Codex
103
+ requires Responses and an explicit model ID and uses `fork_turns: none`; Pi also supports
104
+ copying parent context and a streaming Chat Completions endpoint via
105
+ `ANYSWARM_MODEL_PROTOCOL=chat-completions`. Files remain private in either case.
106
+
107
+ ## Advanced host and session example
108
+
109
+ `main.ts` demonstrates direct hosting. From the exported project after
110
+ `npm install`, run:
89
111
 
90
112
  ```sh
91
- swarm collaboration spawn_agent --task-name reviewer --message 'Check the implementation plan' --fork-turns none --request-id reviewer-start
92
- swarm collaboration wait_agent --request-id reviewer-result
113
+ npm exec -- anyswarm run ./main.ts ./config.ts 'Investigate the supplied question'
93
114
  ```
94
115
 
95
- Pi supports copying parent context with `fork_turns: all`; Codex currently advertises only fresh conversations with `fork_turns: none`. Files remain private unless the host explicitly supplies supported shared-workspace mounts.
96
-
97
- A plain notice or child result can reach active work or be taken through a wait. Idle members keep the notice for later. Explicit follow-up can start work on the same Agent. Closing exports the configured files and time-stamped Sessions, model requests and Service calls to the private run directory. `harness-report.json` records task and cleanup outcomes.
98
-
99
- ## Embed the example
100
-
101
- Import `createSubagentsHarness` from the local example module after building. The returned handle provides `input`, `status`, `onReply`, `lastReply`, `waitForReply` and `close`. Check the input receipt, then check the reply outcome. For repeated inputs, pass the preceding reply sequence as `waitForReply({ after, signal })`. Supply a bounded host signal and call `close` in a `finally` block; inspect its execution and cleanup receipts. The [mechanism guide](../../docs/en/harnesses/subagents.md) shows a complete host call.
102
-
103
- ## Verification
104
-
105
- The [Subagents verification guide](../../test/README.md#subagents-verification) describes the regression and native OpenSandbox checks. The [ProgramBench fd experiment](https://github.com/AnySwarm/anyswarm/blob/207be6356c16e5fb60c4b3c5b236d7a98383f991/docs/experiments/EXP-20261125-10-issue199-fd.md) records a real three-Agent run, including the file handoff, follow-up and independent score.
106
-
107
- ## Host assembly
108
-
109
- Open [`business.ts`](business.ts) for Service registration, role permissions and the main scheduling and cleanup flow. [`config.ts`](config.ts) resolves the Worker image once for the selected executor and shares it across Profiles. [`services/collaboration-service.ts`](services/collaboration-service.ts) owns the Service adapter. The Host explicitly registers `collaboration` and the optional `user-interaction` definition before creating the Runtime. Root and child Profiles declare their collaboration grants in CLI mode.
116
+ This direct script seeds `config.files`; it does not automatically capture a
117
+ repository from `--cwd`. Use the project entry (`npm start`) or the built-in
118
+ `--harness subagents` command for the captured repository task above.
119
+
120
+ Its optional `--interactive` mode keeps the same Root available after a reply.
121
+ The host accepts a follow-up line, `/status` and `/exit`; EOF and cancellation
122
+ close the team. This direct host demonstration is separate from the foreground
123
+ task CLI. Use the SDK or JSONL RPC for a client that needs questions or ongoing
124
+ Run controls.
125
+
126
+ The exported `createSubagentsHarness` handle provides `input`, `status`,
127
+ `onReply`, `lastReply`, `waitForReply` and `close`. Check admission and execution
128
+ separately; for repeated inputs pass the preceding reply sequence in
129
+ `waitForReply({ after, signal })`. Bound work with a signal and close in
130
+ `finally`, preserving the full receipt. Service member paths such as
131
+ `/root/reviewer` are human-readable addresses, separate from the Runtime IDs.
132
+
133
+ ## Verification and remaining acceptance
134
+
135
+ Package tests verify public imports, complete source export, editable local
136
+ entry points and configuration failure before allocation. The collaboration
137
+ tests verify caller identities, named members, message/follow-up semantics,
138
+ cancellation, collection and pending cleanup using controlled backends.
139
+
140
+ The new repository-handoff recipe still requires real-model acceptance: run it
141
+ on a real repository, inspect at least two actual child contributions and Root's
142
+ report, check its citations, then change the question or input directory and
143
+ repeat. Record model/executor, input identity, output paths and cleanup. These
144
+ runs are not replaced by fixtures or by the older
145
+ [ProgramBench experiment](https://github.com/AnySwarm/anyswarm/blob/207be6356c16e5fb60c4b3c5b236d7a98383f991/docs/experiments/EXP-20261125-10-issue199-fd.md).
@@ -1,19 +1,15 @@
1
- import { workerImageFor, resolveSandboxConnection } from '@anyswarm/core';
1
+ import { workerImageFor, resolveSandboxConnection, ProjectPreflightError } from '@anyswarm/core';
2
2
 
3
- function required(...names: string[]) {
4
- for (const name of names) {
5
- const value = process.env[name];
6
- if (value) return value;
7
- }
8
- throw new Error(`Set ${names.join(' or ')} before running the Subagents Harness`);
9
- }
3
+ import { readSubagentsModel } from './model.js';
10
4
 
11
5
  const { image, advertiseHost, publicUrl, endpointSource: _endpointSource, executor: setupExecutor, ...sandbox } = resolveSandboxConnection({}, 'SUBAGENTS');
12
- const upstream = required('ANYSWARM_MODEL_URL', 'ANYSWARM_SUBAGENTS_MODEL_URL');
13
- const token = process.env.ANYSWARM_MODEL_TOKEN ?? process.env.ANYSWARM_SUBAGENTS_MODEL_TOKEN;
14
6
  const executor = process.env.ANYSWARM_EXECUTOR ?? process.env.ANYSWARM_SUBAGENTS_EXECUTOR ?? setupExecutor ?? 'pi';
15
- const provider = process.env.ANYSWARM_MODEL_PROVIDER ?? process.env.ANYSWARM_SUBAGENTS_MODEL_PROVIDER ?? 'openai';
16
- const model = process.env.ANYSWARM_MODEL_ID ?? process.env.ANYSWARM_SUBAGENTS_MODEL_ID ?? (executor === 'codex' ? required('ANYSWARM_SUBAGENTS_MODEL_ID', 'ANYSWARM_MODEL_ID') : 'gpt-5.4');
7
+ const route = readSubagentsModel(executor);
8
+ if (!route) {
9
+ throw new ProjectPreflightError('INVALID_RUN_CONFIGURATION', executor === 'codex'
10
+ ? 'Set ANYSWARM_MODEL_URL and ANYSWARM_MODEL_ID (or their ANYSWARM_SUBAGENTS_ equivalents) before running the Subagents Harness with Codex.'
11
+ : 'Set ANYSWARM_MODEL_URL or ANYSWARM_SUBAGENTS_MODEL_URL before running the Subagents Harness.');
12
+ }
17
13
 
18
14
  export default {
19
15
  model: 'default',
@@ -32,7 +28,5 @@ export default {
32
28
  connection: { publicUrl, advertiseHost,
33
29
  modelGateway: { requestTimeoutMs: 25_000, maxOutputTokens: executor === 'codex' ? null : 2048 },
34
30
  },
35
- models: { default: { provider, model, upstream: {
36
- url: upstream, headers: token ? { authorization: `Bearer ${token}` } : {},
37
- } } },
31
+ models: { default: route },
38
32
  };
@@ -0,0 +1,17 @@
1
+ {
2
+ "apiVersion": 1,
3
+ "entry": "project.ts",
4
+ "files": [
5
+ "project.ts",
6
+ "business.ts",
7
+ "config.ts",
8
+ "model.ts",
9
+ "handoff-config.ts",
10
+ "main.ts",
11
+ "harness/controller.ts",
12
+ "services/collaboration-service.ts",
13
+ "prompts/prompts.ts",
14
+ "README.md",
15
+ "AGENTS.md"
16
+ ]
17
+ }
@@ -0,0 +1,14 @@
1
+ import defaults from './config.js';
2
+
3
+ export default {
4
+ ...defaults,
5
+ maxAgents: 3,
6
+ maxDepth: 1,
7
+ workTimeoutMs: 360_000,
8
+ closeTimeoutMs: 60_000,
9
+ connection: {
10
+ ...defaults.connection,
11
+ modelGateway: { ...defaults.connection.modelGateway, requestTimeoutMs: 70_000 },
12
+ },
13
+ collect: { paths: ['report.md'], includeGit: false, maxBytes: 1024 * 1024, required: true },
14
+ };
@@ -0,0 +1,20 @@
1
+ import { ProjectPreflightError, type ModelConfig } from '@anyswarm/core';
2
+
3
+ /** Read the built-in Subagents route without reading Sandbox state or contacting a provider. */
4
+ export function readSubagentsModel(executor: string): ModelConfig | undefined {
5
+ const env = process.env;
6
+ const setting = (name: string) => env[`ANYSWARM_${name}`] ?? env[`ANYSWARM_SUBAGENTS_${name}`];
7
+ const url = env.ANYSWARM_MODEL_URL || env.ANYSWARM_SUBAGENTS_MODEL_URL;
8
+ const model = env.ANYSWARM_MODEL_ID || env.ANYSWARM_SUBAGENTS_MODEL_ID || (executor === 'codex' ? undefined : 'gpt-5.4');
9
+ if (!url || !model) return undefined;
10
+ const protocol = setting('MODEL_PROTOCOL') ?? 'responses';
11
+ if (protocol !== 'responses' && protocol !== 'chat-completions') {
12
+ throw new ProjectPreflightError('INVALID_RUN_CONFIGURATION',
13
+ 'Set ANYSWARM_MODEL_PROTOCOL or ANYSWARM_SUBAGENTS_MODEL_PROTOCOL to responses or chat-completions.');
14
+ }
15
+ const token = setting('MODEL_TOKEN');
16
+ return {
17
+ provider: setting('MODEL_PROVIDER') ?? 'openai', model, protocol,
18
+ upstream: { url, headers: token ? { authorization: `Bearer ${token}` } : {} },
19
+ };
20
+ }
@@ -21,7 +21,7 @@ repository sources.
21
21
 
22
22
  ```sh
23
23
  npm init -y
24
- npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
24
+ npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.2}"
25
25
  npm install --save-dev typescript @types/node
26
26
  sdk=node_modules/@anyswarm/core
27
27
  cp -R "$sdk"/examples/substrate demo
@@ -62,15 +62,21 @@ substrate Service owns publication permissions, ranking and persistence. See the
62
62
  `main.ts` remains the entry for fixed-question fixtures, saved-result inspection
63
63
  for ordinary Substrate. `config.ts` is its fixed-question configuration and
64
64
  requires `ANYSWARM_SUBSTRATE_RUN`; it is not the input to the normal project command.
65
- From this directory after building:
65
+ From `examples/substrate` in the source checkout after building the root:
66
66
 
67
67
  ```sh
68
- ../../node_modules/.bin/anys run ./main.ts --help
69
- ../../node_modules/.bin/anys run ./main.ts ./config.ts
68
+ node ../../dist/scripts/anyswarm.js run ./main.ts --help
69
+ node ../../dist/scripts/anyswarm.js run ./main.ts ./config.ts
70
+ ```
71
+
72
+ For an installed package, run its CLI from the consumer project and use the
73
+ matching source files in that package:
74
+
75
+ ```sh
76
+ node_modules/.bin/anyswarm run node_modules/@anyswarm/core/examples/substrate/main.ts \
77
+ node_modules/@anyswarm/core/examples/substrate/config.ts
70
78
  ```
71
79
 
72
- For an installed package, replace `../../dist/examples/substrate` with
73
- the `dist/examples/substrate` directory inside the SDK you installed.
74
80
  Keep the shipped modules in their installed location because their relative
75
81
  imports are part of the package. `--result <run-directory> --runtime-id <id>`
76
82
  reads saved reports without loading model credentials.
@@ -4,37 +4,49 @@ Personal receives GitHub Issue and linked PR requests in the background. The use
4
4
 
5
5
  ## Connect and start
6
6
 
7
- Use Node.js 22.19 or later, Git and an existing Pi/OpenSandbox connection. Run `anys setup --backend pi` for host setup. This candidate's end-to-end acceptance uses Linux. Set `ANYSWARM_MODEL_URL` to the full Responses endpoint and `ANYSWARM_MODEL_ID` to the model ID. Optional `ANYSWARM_MODEL_PROVIDER`, `ANYSWARM_MODEL_TOKEN` and `ANYSWARM_MODEL_HEADERS_JSON` follow the model provider. For a reasoning model outside the built-in model catalog, set `ANYSWARM_MODEL_REASONING=true`. Keep credentials in the host environment or credential manager.
7
+ Use Node.js 22.19 or later, Git and an existing Pi/OpenSandbox connection. Run `anyswarm setup --backend pi` for host setup. This candidate's end-to-end acceptance uses Linux. Set `ANYSWARM_MODEL_URL` to the full Responses endpoint and `ANYSWARM_MODEL_ID` to the model ID. Optional `ANYSWARM_MODEL_PROVIDER`, `ANYSWARM_MODEL_TOKEN` and `ANYSWARM_MODEL_HEADERS_JSON` follow the model provider. For a reasoning model outside the built-in model catalog, set `ANYSWARM_MODEL_REASONING=true`. Keep credentials in the host environment or credential manager.
8
8
 
9
- Open `anys`, enter `/super`, then use the composer:
9
+ Export the SDK example and install its pinned dependencies. Run the operator
10
+ from the same launch directory for each command.
10
11
 
11
- ```text
12
- /setup --repo owner/project --path README.md
13
- /start
14
- /jobs
12
+ ```sh
13
+ anyswarm eject super --dir ./personal-src
14
+ cd ./personal-src
15
+ npm install
16
+ npm exec -- anyswarm run ./operator.ts setup --repo owner/project --path README.md
17
+ npm exec -- anyswarm run ./operator.ts start
18
+ npm exec -- anyswarm run ./operator.ts jobs
15
19
  ```
16
20
 
17
- For scripts, use the same actions through `anys -u super --cmd`, for example `anys -u super --cmd '/jobs #123'`. `/setup` infers the repository from a GitHub `origin` when available and defaults to the authenticated GitHub login and `README.md`. Use repeated `--user` or `--path` to allow other logins or up to eight existing UTF-8 files. Set `ANYSWARM_SUPER_GITHUB_TOKEN` or use an existing GitHub CLI login. Allow Issues and Pull requests read/write for conversations and Contents read for files. Creating or updating a Draft PR also needs Contents and Pull requests write.
18
-
19
- `/setup` reports the verified GitHub identity, repository, comments and requested files. It validates the local Pi and model configuration and gives the fix for an invalid setting. GitHub reply and PR writes stay unverified until the corresponding operations succeed. `/start` initializes the Runtime. A real work item verifies Worker and model connectivity. `/jobs` and `/logs` show the most recent background failure stage and its repair hint.
21
+ Setup can infer the repository from a GitHub `origin`. It defaults to the
22
+ authenticated GitHub login and `README.md`. Use repeated `--user` or `--path` to
23
+ allow other logins or up to eight existing UTF-8 files. Set
24
+ `ANYSWARM_SUPER_GITHUB_TOKEN` or use an existing GitHub CLI login. Allow Issues
25
+ and Pull requests read/write and Contents read. Draft PR publication also
26
+ needs Contents and Pull requests write. Setup verifies identity, reads, Pi and
27
+ local model configuration. The first real work item verifies Worker and model
28
+ connectivity. `jobs` and `logs` show the last background failure and its repair hint.
20
29
 
21
30
  ## Work with the Router
22
31
 
23
- Post `/super Update the installation instructions` on an Issue in scope or enter `/ask #123 Update the installation instructions` in the composer. GitHub follows the original Issue or its bound Draft PR. In the terminal, `@router #123 Add a Linux example` sends a follow-up through the same inbox. Use `#<issue>` or an unambiguous work ID prefix in place of `#123` for an existing work item.
24
-
25
- When the Router asks a question, use `/answer #123 <text>` or answer its decision card. Personal sends the verified patch and Reviewer findings to the local approval card. Use `/approve #123` to let the host publish this patch and post a follow-up receipt. `/reject #123 [reason]` records the rejection locally. Use `--publish` at setup if you want automatic publication for the configured repository. `/jobs [work]` shows the artifact, decisions and reply receipts. `/stop-work <work>` stops a single work item.
32
+ Post `/super Update the installation instructions` on an Issue in scope, or run
33
+ `npm exec -- anyswarm run ./operator.ts ask '#123' Update the installation instructions`.
34
+ GitHub follows the original Issue or its bound Draft PR. Use the same operator
35
+ with `jobs '#123'` to view status, artifacts and decisions, `answer '#123' <text>`
36
+ to respond, `approve '#123'` to publish, or `reject '#123' [reason]` to decline.
37
+ An unambiguous work ID prefix also works. Setup's `--publish` opts into automatic
38
+ publication.
26
39
 
27
- Type `q` or `/quit` to detach. Use `/stop` to stop the daemon and `/logs` for its log path. `/trace` opens the Trace Viewer at the attached Personal instance's Runtime records. Every Runtime has a bounded model request budget.
40
+ Use `stop-work <work>` to stop one item, `logs` for the daemon log path, and
41
+ `npm exec -- anyswarm run ./operator.ts stop` to stop the daemon and wait for
42
+ its cleanup receipt. Use `anyswarm trace --root <state-directory>/runs` to
43
+ inspect Runtime records. The daemon keeps running between operator commands.
28
44
 
29
45
  State is keyed by the launch directory and lives under `$XDG_STATE_HOME/anyswarm/personal` or `~/.local/state/anyswarm/personal`. To reuse state across launch directories, set `ANYSWARM_SUPER_STATE_DIR` to the same absolute, private path. Stop an older candidate before starting a new version against its state. A restart retains tasks, verified artifacts, decisions and pending replies. Unknown GitHub mutations are reconciled by identity. Personal reads a newly linked PR's comments even if it has already advanced the repository cursor during recovery. The original Sandbox can require cleanup after a crash. Same-host recovery uses the original Worker-reachable address and `ANYSWARM_SUPER_CALLBACK_PORT` when set.
30
46
 
31
- ## Edit your copy
32
-
33
- ```sh
34
- anys eject super --dir ./personal-src
35
- cd ./personal-src
36
- npm install
37
- npm run start
38
- ```
47
+ ## SDK clients
39
48
 
40
- The SDK-bound export includes the TypeScript Harness, Slash Actions and GitHub adapter. `npm run start` opens the shared terminal with the exported module. The same module can run in a foreground process with `anys run ./project.ts --prompt 'Run Personal GitHub inbox'`. The exported and installed daemons use the same state lock. The export contains the application sources and SDK provenance.
49
+ Import the exported `project.ts` into an application or use `observe` from
50
+ `daemon.ts` to connect to a running Personal daemon via `HarnessRpcClient`.
51
+ The SDK client can receive live questions and send answers by ID. The
52
+ operator commands and SDK use the same persisted Inbox and ownership lock.