@anyswarm/core 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/AGENTS.md +20 -5
  2. package/README.md +69 -55
  3. package/dist/examples/README.md +138 -77
  4. package/dist/examples/authoring/README.md +4 -4
  5. package/dist/examples/autoresearch/README.md +108 -16
  6. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  7. package/dist/examples/autoresearch/config.d.ts +48 -5
  8. package/dist/examples/autoresearch/config.js +57 -23
  9. package/dist/examples/autoresearch/demo.d.ts +12 -4
  10. package/dist/examples/autoresearch/demo.js +65 -22
  11. package/dist/examples/autoresearch/eject.json +2 -0
  12. package/dist/examples/autoresearch/frontiercs2-config.d.ts +2 -0
  13. package/dist/examples/autoresearch/frontiercs2-config.js +14 -0
  14. package/dist/examples/autoresearch/frontiercs2.d.ts +18 -1
  15. package/dist/examples/autoresearch/frontiercs2.js +71 -14
  16. package/dist/examples/autoresearch/prepare-demo.d.ts +1 -0
  17. package/dist/examples/autoresearch/prepare-demo.js +46 -0
  18. package/dist/examples/autoresearch/prepare.d.ts +105 -53
  19. package/dist/examples/autoresearch/prepare.js +126 -57
  20. package/dist/examples/autoresearch/project.d.ts +6 -95
  21. package/dist/examples/autoresearch/project.js +131 -45
  22. package/dist/examples/autoresearch/research-service.d.ts +16 -1
  23. package/dist/examples/autoresearch/research-service.js +84 -44
  24. package/dist/examples/code/README.md +25 -17
  25. package/dist/examples/code/REQUIREMENTS.zh.md +3 -3
  26. package/dist/examples/code/config.d.ts +1 -0
  27. package/dist/examples/first-harness/AGENTS.md +25 -0
  28. package/dist/examples/first-harness/README.md +136 -0
  29. package/dist/examples/first-harness/config.d.ts +9 -8
  30. package/dist/examples/first-harness/config.js +33 -26
  31. package/dist/examples/first-harness/eject.json +14 -0
  32. package/dist/examples/first-harness/handoff.js +3 -3
  33. package/dist/examples/first-harness/harness.d.ts +14 -18
  34. package/dist/examples/first-harness/harness.js +102 -77
  35. package/dist/examples/first-harness/input/README.md +7 -0
  36. package/dist/examples/first-harness/session.js +2 -1
  37. package/dist/examples/first-harness/tsconfig.json +2 -1
  38. package/dist/examples/harness-session/README.md +4 -4
  39. package/dist/examples/lead-worker/README.md +1 -1
  40. package/dist/examples/lead-worker/project-config.d.ts +1 -0
  41. package/dist/examples/messages/README.md +2 -2
  42. package/dist/examples/notes/README.md +5 -5
  43. package/dist/examples/notes/config.d.ts +1 -0
  44. package/dist/examples/parallel-swarm/AGENTS.md +32 -0
  45. package/dist/examples/parallel-swarm/README.md +136 -0
  46. package/dist/examples/parallel-swarm/board-service.js +25 -8
  47. package/dist/examples/parallel-swarm/board.d.ts +31 -1
  48. package/dist/examples/parallel-swarm/board.js +98 -13
  49. package/dist/examples/parallel-swarm/config.d.ts +11 -0
  50. package/dist/examples/parallel-swarm/config.js +39 -0
  51. package/dist/examples/parallel-swarm/eject.json +5 -0
  52. package/dist/examples/parallel-swarm/harness.d.ts +26 -20
  53. package/dist/examples/parallel-swarm/harness.js +77 -76
  54. package/dist/examples/parallel-swarm/report.d.ts +12 -0
  55. package/dist/examples/parallel-swarm/report.js +30 -0
  56. package/dist/examples/peermesh/README.md +1 -1
  57. package/dist/examples/peermesh/project-config.d.ts +1 -0
  58. package/dist/examples/services/agent-control/README.md +1 -1
  59. package/dist/examples/services/mathlib-search/README.md +1 -1
  60. package/dist/examples/services/mcp-managed/README.md +1 -1
  61. package/dist/examples/services/persistent-board/README.md +6 -3
  62. package/dist/examples/subagents/AGENTS.md +35 -0
  63. package/dist/examples/subagents/README.md +129 -93
  64. package/dist/examples/subagents/config.d.ts +2 -10
  65. package/dist/examples/subagents/config.js +9 -16
  66. package/dist/examples/subagents/eject.json +17 -0
  67. package/dist/examples/subagents/handoff-config.d.ts +41 -0
  68. package/dist/examples/subagents/handoff-config.js +13 -0
  69. package/dist/examples/subagents/model.d.ts +3 -0
  70. package/dist/examples/subagents/model.js +19 -0
  71. package/dist/examples/substrate/README.md +12 -6
  72. package/dist/examples/substrate/config.d.ts +1 -0
  73. package/dist/examples/substrate/project-config.d.ts +1 -0
  74. package/dist/examples/super/README.md +34 -22
  75. package/dist/examples/super/actions.d.ts +1 -1
  76. package/dist/examples/super/actions.js +11 -11
  77. package/dist/examples/super/config.js +3 -3
  78. package/dist/examples/super/eject.json +1 -1
  79. package/dist/examples/super/location.js +1 -1
  80. package/dist/examples/super/operator.d.ts +1 -0
  81. package/dist/examples/super/operator.js +31 -0
  82. package/dist/examples/super/project.d.ts +0 -107
  83. package/dist/examples/super/project.js +1 -3
  84. package/dist/examples/taskpool/README.md +1 -1
  85. package/dist/examples/taskpool/config.d.ts +1 -0
  86. package/dist/examples/taskpool/deploy/service-hosts/service-authority-snapshot.d.ts +4 -4
  87. package/dist/scripts/anyswarm-arguments.d.ts +7 -25
  88. package/dist/scripts/anyswarm-arguments.js +69 -97
  89. package/dist/scripts/anyswarm-eject.js +1 -1
  90. package/dist/scripts/anyswarm-harnesses.d.ts +0 -1
  91. package/dist/scripts/anyswarm-harnesses.js +1 -22
  92. package/dist/scripts/anyswarm-installation.d.ts +7 -40
  93. package/dist/scripts/anyswarm-installation.js +17 -291
  94. package/dist/scripts/anyswarm-launch.d.ts +6 -36
  95. package/dist/scripts/anyswarm-launch.js +32 -81
  96. package/dist/scripts/anyswarm-progress.d.ts +6 -0
  97. package/dist/scripts/anyswarm-progress.js +133 -0
  98. package/dist/scripts/anyswarm-project.d.ts +1 -9
  99. package/dist/scripts/anyswarm-project.js +40 -127
  100. package/dist/scripts/anyswarm-source-runner.js +9 -41
  101. package/dist/scripts/anyswarm.js +6 -26
  102. package/dist/scripts/build-provenance.json +1 -1
  103. package/dist/scripts/generate-architecture-coverage.js +1 -1
  104. package/dist/scripts/generate-architecture-prompts.js +18 -10
  105. package/dist/scripts/local-environment.d.ts +13 -7
  106. package/dist/scripts/local-environment.js +73 -21
  107. package/dist/scripts/local-setup.d.ts +3 -0
  108. package/dist/scripts/local-setup.js +153 -118
  109. package/dist/scripts/pack-release.js +31 -4
  110. package/dist/src/core/index.js +1 -1
  111. package/dist/src/core/sandbox/opensandbox-backend.js +10 -4
  112. package/dist/src/core/sandbox/sandbox-connection.d.ts +9 -2
  113. package/dist/src/core/sandbox/sandbox-connection.js +22 -7
  114. package/dist/src/core/worker-image.js +1 -1
  115. package/dist/src/harness/project-harness.d.ts +1 -0
  116. package/dist/src/harness/project-harness.js +5 -4
  117. package/dist/src/harness/project-rpc-client.js +19 -0
  118. package/dist/src/harness/project-runtime.js +3 -1
  119. package/dist/src/harness/typescript-loader.d.ts +2 -0
  120. package/dist/src/harness/typescript-loader.js +26 -8
  121. package/dist/src/trace-viewer/command.mjs +6 -3
  122. package/dist/src/trace-viewer/public/app.js +239 -59
  123. package/dist/src/trace-viewer/public/index.html +5 -0
  124. package/dist/src/trace-viewer/public/style.css +22 -0
  125. package/dist/src/trace-viewer/reader.mjs +242 -26
  126. package/dist/src/trace-viewer/run-root.d.mts +1 -0
  127. package/dist/src/trace-viewer/run-root.mjs +7 -0
  128. package/dist/src/trace-viewer/server.mjs +3 -1
  129. package/docs/INDEX.md +11 -9
  130. package/docs/architecture/04-services.md +1 -1
  131. package/docs/architecture/06-observability-experiments.md +21 -7
  132. package/docs/architecture/07-run-configuration.md +118 -19
  133. package/docs/architecture/08-prompts.md +21 -2
  134. package/docs/architecture/10-service-api-reference.md +12 -5
  135. package/docs/architecture/12-code-coverage.md +157 -115
  136. package/docs/architecture/15-core-runtime.md +1 -1
  137. package/docs/architecture/16-pi-opensandbox-backend.md +2 -0
  138. package/docs/architecture/17-harness-reporting.md +79 -1
  139. package/docs/architecture/22-website.md +52 -20
  140. package/docs/architecture/23-project-harness.md +109 -37
  141. package/docs/architecture/26-code.md +20 -5
  142. package/docs/architecture/27-personal.md +23 -8
  143. package/docs/architecture/28-autoresearch.md +18 -12
  144. package/docs/architecture/INDEX.md +1 -2
  145. package/docs/architecture/prompts/11-first-sdk-harness.md +9 -9
  146. package/docs/architecture/prompts/16-parallel-swarm.md +46 -13
  147. package/docs/architecture/prompts/22-autoresearch.md +9 -2
  148. package/docs/architecture/prompts/source-manifest.json +76 -52
  149. package/docs/architecture/source-map.json +445 -105
  150. package/docs/designs/core-harness/01-core.md +2 -2
  151. package/docs/designs/core-harness/06-project-harness.md +3 -3
  152. package/docs/designs/core-harness/README.md +2 -2
  153. package/docs/en/agents.md +1 -1
  154. package/docs/en/autoresearch.md +41 -0
  155. package/docs/en/blog/100b-tokens.md +157 -0
  156. package/docs/en/build-your-harness.md +47 -22
  157. package/docs/en/changelog.md +29 -1
  158. package/docs/en/first-harness.md +40 -32
  159. package/docs/en/harnesses/index.md +23 -23
  160. package/docs/en/harnesses/lead-worker.md +1 -1
  161. package/docs/en/harnesses/peermesh.md +2 -2
  162. package/docs/en/harnesses/subagents.md +10 -31
  163. package/docs/en/harnesses/substrate.md +4 -4
  164. package/docs/en/harnesses/taskpool.md +2 -2
  165. package/docs/en/latest.md +30 -5
  166. package/docs/en/overview.md +22 -22
  167. package/docs/en/quickstart.md +69 -56
  168. package/docs/en/reference/api.md +1 -1
  169. package/docs/en/reference/cli.md +47 -85
  170. package/docs/en/sandbox.md +3 -3
  171. package/docs/en/trace-viewer.md +32 -12
  172. package/docs/operations/trace-viewer.md +26 -11
  173. package/docs/third-party-notices.md +0 -1
  174. package/docs/workflows/development.md +160 -118
  175. package/docs/workflows/release-and-docs-versioning.md +207 -54
  176. package/docs/workflows/release-cli-acceptance.md +162 -0
  177. package/docs/zh/agents.md +1 -1
  178. package/docs/zh/autoresearch.md +41 -0
  179. package/docs/zh/blog/100b-tokens.md +102 -0
  180. package/docs/zh/build-your-harness.md +48 -23
  181. package/docs/zh/changelog.md +29 -1
  182. package/docs/zh/first-harness.md +43 -35
  183. package/docs/zh/harnesses/index.md +23 -23
  184. package/docs/zh/harnesses/lead-worker.md +1 -1
  185. package/docs/zh/harnesses/peermesh.md +2 -2
  186. package/docs/zh/harnesses/subagents.md +10 -31
  187. package/docs/zh/harnesses/substrate.md +4 -4
  188. package/docs/zh/harnesses/taskpool.md +2 -2
  189. package/docs/zh/latest.md +30 -5
  190. package/docs/zh/overview.md +23 -23
  191. package/docs/zh/quickstart.md +66 -57
  192. package/docs/zh/reference/api.md +1 -1
  193. package/docs/zh/reference/cli.md +19 -79
  194. package/docs/zh/sandbox.md +3 -3
  195. package/docs/zh/trace-viewer.md +32 -12
  196. package/examples/README.md +138 -77
  197. package/examples/authoring/README.md +4 -4
  198. package/examples/autoresearch/README.md +108 -16
  199. package/examples/autoresearch/REQUIREMENTS.zh.md +13 -12
  200. package/examples/autoresearch/config.ts +64 -25
  201. package/examples/autoresearch/demo.ts +75 -22
  202. package/examples/autoresearch/eject.json +2 -0
  203. package/examples/autoresearch/frontiercs2-config.ts +15 -0
  204. package/examples/autoresearch/frontiercs2.ts +64 -11
  205. package/examples/autoresearch/prepare-demo.ts +44 -0
  206. package/examples/autoresearch/prepare.ts +134 -60
  207. package/examples/autoresearch/project.ts +120 -44
  208. package/examples/autoresearch/research-service.ts +91 -41
  209. package/examples/code/README.md +25 -17
  210. package/examples/code/REQUIREMENTS.zh.md +3 -3
  211. package/examples/first-harness/AGENTS.md +25 -0
  212. package/examples/first-harness/README.md +136 -0
  213. package/examples/first-harness/config.ts +41 -27
  214. package/examples/first-harness/eject.json +14 -0
  215. package/examples/first-harness/handoff.ts +3 -3
  216. package/examples/first-harness/harness.ts +104 -72
  217. package/examples/first-harness/input/README.md +7 -0
  218. package/examples/first-harness/session.ts +2 -1
  219. package/examples/first-harness/tsconfig.json +2 -1
  220. package/examples/harness-session/README.md +4 -4
  221. package/examples/lead-worker/README.md +1 -1
  222. package/examples/messages/README.md +2 -2
  223. package/examples/notes/README.md +5 -5
  224. package/examples/parallel-swarm/AGENTS.md +32 -0
  225. package/examples/parallel-swarm/README.md +136 -0
  226. package/examples/parallel-swarm/board-service.ts +28 -9
  227. package/examples/parallel-swarm/board.ts +107 -13
  228. package/examples/parallel-swarm/config.ts +47 -0
  229. package/examples/parallel-swarm/eject.json +5 -0
  230. package/examples/parallel-swarm/harness.ts +83 -71
  231. package/examples/parallel-swarm/report.ts +33 -0
  232. package/examples/peermesh/README.md +1 -1
  233. package/examples/services/agent-control/README.md +1 -1
  234. package/examples/services/mathlib-search/README.md +1 -1
  235. package/examples/services/mcp-managed/README.md +1 -1
  236. package/examples/services/persistent-board/README.md +6 -3
  237. package/examples/subagents/AGENTS.md +35 -0
  238. package/examples/subagents/README.md +129 -93
  239. package/examples/subagents/config.ts +9 -15
  240. package/examples/subagents/eject.json +17 -0
  241. package/examples/subagents/handoff-config.ts +14 -0
  242. package/examples/subagents/model.ts +20 -0
  243. package/examples/substrate/README.md +12 -6
  244. package/examples/super/README.md +34 -22
  245. package/examples/super/actions.ts +11 -11
  246. package/examples/super/config.ts +3 -3
  247. package/examples/super/eject.json +1 -1
  248. package/examples/super/location.ts +1 -1
  249. package/examples/super/operator.ts +28 -0
  250. package/examples/super/project.ts +1 -3
  251. package/examples/taskpool/README.md +1 -1
  252. package/npm-shrinkwrap.development.json +46 -1538
  253. package/npm-shrinkwrap.json +10 -43
  254. package/package.development.json +3 -6
  255. package/package.json +3 -5
  256. package/scripts/anyswarm-arguments.ts +67 -96
  257. package/scripts/anyswarm-eject.ts +1 -1
  258. package/scripts/anyswarm-harnesses.ts +1 -18
  259. package/scripts/anyswarm-installation.ts +18 -294
  260. package/scripts/anyswarm-launch.ts +30 -102
  261. package/scripts/anyswarm-progress.ts +125 -0
  262. package/scripts/anyswarm-project.ts +31 -123
  263. package/scripts/anyswarm-source-runner.ts +9 -36
  264. package/scripts/anyswarm.ts +4 -24
  265. package/scripts/generate-architecture-coverage.ts +1 -1
  266. package/scripts/generate-architecture-prompts.ts +21 -10
  267. package/scripts/local-environment.ts +79 -21
  268. package/scripts/local-setup.ts +150 -105
  269. package/scripts/pack-release.ts +28 -4
  270. package/src/core/index.ts +1 -1
  271. package/src/core/sandbox/opensandbox-backend.ts +10 -4
  272. package/src/core/sandbox/sandbox-connection.ts +22 -7
  273. package/src/core/worker-image.ts +1 -1
  274. package/src/harness/project-harness.ts +5 -4
  275. package/src/harness/project-rpc-client.ts +23 -0
  276. package/src/harness/project-runtime.ts +2 -1
  277. package/src/harness/typescript-loader.ts +28 -8
  278. package/src/trace-viewer/command.mjs +6 -3
  279. package/src/trace-viewer/public/app.js +239 -59
  280. package/src/trace-viewer/public/index.html +5 -0
  281. package/src/trace-viewer/public/style.css +22 -0
  282. package/src/trace-viewer/reader.mjs +242 -26
  283. package/src/trace-viewer/run-root.d.mts +1 -0
  284. package/src/trace-viewer/run-root.mjs +7 -0
  285. package/src/trace-viewer/server.mjs +3 -1
  286. package/dist/scripts/anyswarm-applications.d.ts +0 -19
  287. package/dist/scripts/anyswarm-applications.js +0 -19
  288. package/dist/scripts/anyswarm-tui-config.d.ts +0 -36
  289. package/dist/scripts/anyswarm-tui-config.js +0 -189
  290. package/dist/scripts/anyswarm-tui-session.d.ts +0 -66
  291. package/dist/scripts/anyswarm-tui-session.js +0 -304
  292. package/dist/scripts/anyswarm-tui-terminal.d.ts +0 -41
  293. package/dist/scripts/anyswarm-tui-terminal.js +0 -154
  294. package/dist/scripts/anyswarm-tui.d.ts +0 -2
  295. package/dist/scripts/anyswarm-tui.js +0 -1012
  296. package/docs/architecture/25-foreground-tui.md +0 -51
  297. package/scripts/anyswarm-applications.ts +0 -39
  298. package/scripts/anyswarm-tui-config.ts +0 -174
  299. package/scripts/anyswarm-tui-session.ts +0 -295
  300. package/scripts/anyswarm-tui-terminal.ts +0 -147
  301. package/scripts/anyswarm-tui.ts +0 -912
@@ -1,25 +1,23 @@
1
1
  {
2
2
  "name": "@anyswarm/core",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@anyswarm/core",
9
- "version": "0.5.1",
9
+ "version": "0.6.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@alibaba-group/opensandbox": "1.2.1",
13
- "@earendil-works/pi-tui": "1.3.0",
14
13
  "@modelcontextprotocol/client": "2.4.0",
14
+ "@swc/wasm": "1.16.22",
15
15
  "ajv": "8.20.0",
16
16
  "es-module-lexer": "3.0.5",
17
17
  "js-tiktoken": "1.0.21"
18
18
  },
19
19
  "bin": {
20
- "anys": "dist/scripts/anyswarm.js",
21
- "anyswarm": "dist/scripts/anyswarm.js",
22
- "swarm": "dist/scripts/swarm.js"
20
+ "anyswarm": "dist/scripts/anyswarm.js"
23
21
  },
24
22
  "engines": {
25
23
  "node": ">=22.19.0"
@@ -48,19 +46,6 @@
48
46
  "node": ">=20.18.1"
49
47
  }
50
48
  },
51
- "node_modules/@earendil-works/pi-tui": {
52
- "version": "1.3.0",
53
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-1.3.0.tgz",
54
- "integrity": "sha512-AlKvEwEWyVtnuw7SVb4N/mUhlfIohyFslUNWarZVdLHHSdt3ca5EhMLwTzblBpDpaofSz+f+tAHie6CfxVrWKA==",
55
- "license": "MIT",
56
- "dependencies": {
57
- "get-east-asian-width": "1.6.0",
58
- "marked": "18.0.11"
59
- },
60
- "engines": {
61
- "node": ">=22.19.0"
62
- }
63
- },
64
49
  "node_modules/@modelcontextprotocol/client": {
65
50
  "version": "2.4.0",
66
51
  "resolved": "https://registry.npmjs.org/@modelcontextprotocol/client/-/client-2.4.0.tgz",
@@ -114,6 +99,12 @@
114
99
  "node": ">=8.0.0"
115
100
  }
116
101
  },
102
+ "node_modules/@swc/wasm": {
103
+ "version": "1.16.22",
104
+ "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.16.22.tgz",
105
+ "integrity": "sha512-7wFC6rBgXXiNElVvrBokCD7xgNF6QOMyiEDeQyhcvPgIBc+jWW99FU/E4KScd+NPZBAxwEkj3/a7N9xnu1RI+A==",
106
+ "license": "Apache-2.0"
107
+ },
117
108
  "node_modules/ajv": {
118
109
  "version": "8.20.0",
119
110
  "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
@@ -199,18 +190,6 @@
199
190
  ],
200
191
  "license": "BSD-3-Clause"
201
192
  },
202
- "node_modules/get-east-asian-width": {
203
- "version": "1.6.0",
204
- "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
205
- "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
206
- "license": "MIT",
207
- "engines": {
208
- "node": ">=18"
209
- },
210
- "funding": {
211
- "url": "https://github.com/sponsors/sindresorhus"
212
- }
213
- },
214
193
  "node_modules/isexe": {
215
194
  "version": "2.0.0",
216
195
  "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -241,18 +220,6 @@
241
220
  "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
242
221
  "license": "MIT"
243
222
  },
244
- "node_modules/marked": {
245
- "version": "18.0.11",
246
- "resolved": "https://registry.npmjs.org/marked/-/marked-18.0.11.tgz",
247
- "integrity": "sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw==",
248
- "license": "MIT",
249
- "bin": {
250
- "marked": "bin/marked.js"
251
- },
252
- "engines": {
253
- "node": ">= 20"
254
- }
255
- },
256
223
  "node_modules/openapi-fetch": {
257
224
  "version": "0.14.1",
258
225
  "resolved": "https://registry.npmjs.org/openapi-fetch/-/openapi-fetch-0.14.1.tgz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyswarm/core",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "private": true,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -68,8 +68,8 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@alibaba-group/opensandbox": "1.2.1",
71
- "@earendil-works/pi-tui": "1.3.0",
72
71
  "@modelcontextprotocol/client": "2.4.0",
72
+ "@swc/wasm": "1.16.22",
73
73
  "ajv": "8.20.0",
74
74
  "es-module-lexer": "3.0.5",
75
75
  "js-tiktoken": "1.0.21"
@@ -80,12 +80,9 @@
80
80
  }
81
81
  },
82
82
  "bin": {
83
- "anyswarm": "dist/scripts/anyswarm.js",
84
- "swarm": "dist/scripts/swarm.js",
85
- "anys": "dist/scripts/anyswarm.js"
83
+ "anyswarm": "dist/scripts/anyswarm.js"
86
84
  },
87
85
  "devDependencies": {
88
- "@earendil-works/pi-coding-agent": "1.3.0",
89
86
  "@types/node": "26.6.5",
90
87
  "typescript": "^7.0.2"
91
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyswarm/core",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@alibaba-group/opensandbox": "1.2.1",
70
- "@earendil-works/pi-tui": "1.3.0",
71
70
  "@modelcontextprotocol/client": "2.4.0",
71
+ "@swc/wasm": "1.16.22",
72
72
  "ajv": "8.20.0",
73
73
  "es-module-lexer": "3.0.5",
74
74
  "js-tiktoken": "1.0.21"
@@ -79,8 +79,6 @@
79
79
  }
80
80
  },
81
81
  "bin": {
82
- "anyswarm": "dist/scripts/anyswarm.js",
83
- "swarm": "dist/scripts/swarm.js",
84
- "anys": "dist/scripts/anyswarm.js"
82
+ "anyswarm": "dist/scripts/anyswarm.js"
85
83
  }
86
84
  }
@@ -2,38 +2,45 @@ import { parseArgs } from 'node:util';
2
2
 
3
3
  export const setupUsage = [
4
4
  'Usage: anyswarm setup [--mode existing|local] [--endpoint <url>] [--public-url <url>] [--backend pi|codex] [--backend-path <executable>] [--backend-version <version>] [--config <module>]',
5
- 'Without --mode, reuse a saved managed local service or a configured connection. With no connection, prepare local OpenSandbox.',
6
- 'Existing mode saves the authenticated connection. Run anyswarm doctor --smoke to verify Worker and Runtime callbacks.',
5
+ 'By default, prepare local OpenSandbox and reuse compatible local settings. Select --mode existing explicitly for a remote service.',
6
+ 'Existing mode saves the authenticated connection. Use anyswarm doctor --mode existing --smoke to verify that service.',
7
7
  ].join('\n');
8
8
  const updateUsage = [
9
- 'Usage: anyswarm update [--archive <package.tgz> --sha256 <digest>]',
10
- 'Update this CLI to the latest stable release in its verified installation scope. Project SDK and Worker preparation are independent.',
9
+ 'Usage: anyswarm update',
10
+ 'Print the update command for this installation. npm manages the installed version.',
11
11
  ].join('\n');
12
12
  const recoverUsage = 'Usage: anyswarm recover --run-dir <directory> --config <module>';
13
- export const doctorUsage = 'Usage: anyswarm doctor [--config <module>] [--smoke]';
13
+ export const doctorUsage = 'Usage: anyswarm doctor [--mode local|existing] [--config <module>] [--smoke]';
14
+ const runUsage = 'Usage: anyswarm run <entry.ts> [--cwd <dir>] [--config <module>] [--prompt <text>] [--output-dir <dir>]';
15
+ const ejectUsage = 'Usage: anyswarm eject <name> --dir <dir>';
14
16
  const projectUsage = [
15
- 'Usage: anyswarm --harness <module> --prompt <text> [--cwd <directory>] [--config <module>] [--output-dir <directory>] [--lifetime task|interactive] [--interaction none|questions]',
16
- ' anyswarm --harness <module> --mode rpc [--config <module>] [--output-dir <directory>] [--lifetime task|interactive] [--interaction none|questions]',
17
- 'Built-in Harnesses: subagents, taskpool, peermesh, substrate, lead-worker, notes, messages',
18
- 'Use a built-in name, an explicit TypeScript or ESM file, or a package installed from the invocation directory.',
19
- 'An explicit interactive lifetime or questions in foreground mode uses JSONL for subsequent commands.',
20
- 'The project directory defaults to the invocation directory. In RPC mode send cwd and prompt in the run request.',
17
+ 'Usage: anyswarm --harness <name|module> --prompt <text> [--cwd <dir>] [--config <module>] [--output-dir <dir>]',
18
+ ' anyswarm --harness <name|module> --mode rpc [--config <module>] [--output-dir <dir>] [--lifetime task|interactive] [--interaction none|questions]',
19
+ 'Built-in Harnesses: subagents, autoresearch, taskpool, peermesh, substrate, lead-worker, notes, messages',
21
20
  ].join('\n');
22
21
  export const anyswarmUsage = [
23
- 'Usage: anyswarm | anys Open the streaming TUI',
24
- 'Usage: anys -u <harness> [prompt] [--headless | --rpc]',
25
- ' anys -u <harness> --cmd "/action [arguments]"',
26
- 'Harness options: --config <module>, --cwd <directory>, --output-dir <directory>, --lifetime task|interactive',
27
- ' anys run <harness> [prompt] Local source files can also accept script arguments',
28
- 'Usage: anys eject <application> --dir <directory>',
29
- 'Usage: anyswarm --version',
30
- projectUsage, setupUsage, updateUsage, doctorUsage, recoverUsage,
31
- 'Usage: anyswarm trace --root <runs-dir> [--port 8787] [--open]',
22
+ 'Usage: anyswarm <command> [options]',
23
+ '',
24
+ 'Quickstart',
25
+ ' anyswarm setup',
26
+ ' anyswarm --harness subagents --prompt "Read README.md and report its heading." --output-dir ./runs',
27
+ ' anyswarm trace --root ./runs',
28
+ '',
29
+ 'Configure your model endpoint before running a model-backed Harness.',
30
+ '',
31
+ ' setup / doctor [--smoke] Prepare and verify local execution',
32
+ ' update Show the npm upgrade command',
33
+ ' run <entry.ts> Run an editable Harness',
34
+ ' --harness <name|module> Run a Harness or use --mode rpc for JSONL',
35
+ ' eject <name> --dir <dir> Export editable source and its pinned SDK',
36
+ ' trace / recover Inspect Run records or recover pending cleanup',
37
+ '',
38
+ 'Run a command with --help for options. Use --version for the installed version.',
32
39
  ].join('\n');
33
40
 
34
41
  export type LocalCommand =
35
42
  | { command: 'setup'; mode?: 'existing' | 'local'; endpoint?: string; publicUrl?: string; configPath?: string; backend?: 'pi' | 'codex'; backendPath?: string; backendVersion?: string }
36
- | { command: 'doctor'; configPath?: string; smoke: boolean };
43
+ | { command: 'doctor'; mode?: 'existing' | 'local'; configPath?: string; smoke: boolean };
37
44
 
38
45
  type HarnessOptions = {
39
46
  harness: string;
@@ -43,94 +50,61 @@ type HarnessOptions = {
43
50
  interaction?: 'none' | 'questions';
44
51
  };
45
52
 
46
- export type ProjectCommand = HarnessOptions & { command: 'harness'; defaults?: boolean } &
47
- ({ mode: 'foreground' | 'headless'; cwd?: string; prompt: string } | { mode: 'rpc' });
48
- export type TuiCommand = Partial<HarnessOptions> & { command: 'tui'; cwd?: string; prompt?: string };
49
- export type HarnessCommand = HarnessOptions & { command: 'use'; cwd?: string; prompt?: string } &
50
- ({ mode: 'auto' | 'tui' | 'headless' | 'foreground' | 'rpc' } | { mode: 'action'; slash: string });
53
+ export type ProjectCommand = HarnessOptions & { command: 'harness' } &
54
+ ({ mode: 'foreground'; cwd?: string; prompt: string } | { mode: 'rpc' });
51
55
 
52
- type AnySwarmCommand = TuiCommand | HarnessCommand | { command: 'run'; entryPath: string; args: string[] } |
56
+ type AnySwarmCommand = { command: 'run'; entryPath: string; args: string[] } |
53
57
  { command: 'eject'; application: string; directory: string } | LocalCommand |
54
- { command: 'update'; archive?: string; sha256?: string } | ProjectCommand | { command: 'recover'; directory: string; configPath: string };
58
+ { command: 'update' } | ProjectCommand | { command: 'recover'; directory: string; configPath: string };
55
59
 
56
- export function isLocalHarness(specifier: string) {
57
- return specifier.startsWith('./') || specifier.startsWith('../') || specifier.startsWith('/');
58
- }
59
-
60
- export function isHarnessName(specifier: string) {
61
- return /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]*$/i.test(specifier);
62
- }
63
-
64
- function parseHarnessOptions(args: string[], allowPositionals: boolean) {
65
- const { values, positionals } = parseArgs({ args, allowPositionals, options: {
66
- use: { type: 'string', short: 'u' }, harness: { type: 'string' }, prompt: { type: 'string' },
67
- cwd: { type: 'string' }, mode: { type: 'string' }, config: { type: 'string' }, 'output-dir': { type: 'string' },
60
+ export function parseProjectCommand(args: string[], source?: string): ProjectCommand {
61
+ const { values } = parseArgs({ args, options: {
62
+ harness: { type: 'string' },
63
+ prompt: { type: 'string' }, cwd: { type: 'string' }, mode: { type: 'string' },
64
+ config: { type: 'string' }, 'output-dir': { type: 'string' },
68
65
  lifetime: { type: 'string' }, interaction: { type: 'string' },
69
- headless: { type: 'boolean' }, rpc: { type: 'boolean' }, cmd: { type: 'string' },
70
66
  } });
71
- const { lifetime, interaction } = values;
72
- if ([values.use, values.harness, values.cwd, values.config, values['output-dir']].includes('') ||
67
+ const { lifetime, interaction, mode, cwd } = values;
68
+ const harness = source ?? values.harness;
69
+ if ((source && values.harness !== undefined) || !harness?.trim() || [cwd, values.config, values['output-dir']].includes('') ||
73
70
  (lifetime !== undefined && lifetime !== 'task' && lifetime !== 'interactive') ||
74
71
  (interaction !== undefined && interaction !== 'none' && interaction !== 'questions')) throw new Error();
75
- return { values, positionals, options: { configPath: values.config, outputRoot: values['output-dir'], lifetime, interaction } as Omit<HarnessOptions, 'harness'> };
72
+ const project: HarnessOptions & { command: 'harness' } = { command: 'harness', harness, configPath: values.config, outputRoot: values['output-dir'], lifetime, interaction };
73
+ if (mode === 'rpc' && values.prompt === undefined && cwd === undefined) return { ...project, mode };
74
+ const prompt = values.prompt ?? (source ? 'Run this Harness.' : undefined);
75
+ if ((mode === undefined || mode === 'foreground') && prompt?.trim() && lifetime !== 'interactive' && interaction !== 'questions') {
76
+ return { ...project, mode: 'foreground', cwd, prompt };
77
+ }
78
+ throw new Error();
76
79
  }
77
80
 
78
- export function parseHarnessSelection(args: string[], selected?: string): HarnessCommand {
79
- const { values, positionals, options } = parseHarnessOptions(args, true);
80
- const harness = selected ?? values.use;
81
- if (!harness || values.harness !== undefined || (selected && values.use !== undefined) ||
82
- (positionals.length && values.prompt !== undefined)) throw new Error(anyswarmUsage);
83
- const prompt = values.prompt ?? (positionals.length ? positionals.join(' ') : undefined);
84
- if (prompt !== undefined && !prompt.trim()) throw new Error(anyswarmUsage);
85
- const project = { command: 'use' as const, harness, ...options, prompt, cwd: values.cwd };
86
- if ([values.mode, values.headless, values.rpc, values.cmd].filter(value => value !== undefined).length > 1) throw new Error(anyswarmUsage);
87
- const mode = values.mode ?? (values.headless ? 'headless' : values.rpc ? 'rpc' : 'auto');
88
- if (values.cmd !== undefined) {
89
- if (prompt !== undefined || !/^\/[a-z][\w-]*(?:\s|$)/i.test(values.cmd.trim())) throw new Error(anyswarmUsage);
90
- return { ...project, mode: 'action', slash: values.cmd.trim() };
91
- }
92
- if (mode === 'rpc' && (prompt !== undefined || values.cwd !== undefined)) throw new Error(anyswarmUsage);
93
- if (mode === 'auto' || mode === 'tui' || mode === 'headless' || mode === 'foreground' || mode === 'rpc') return { ...project, mode };
94
- throw new Error(anyswarmUsage);
81
+ export function parseSourceHarnessCommand(args: string[], entry: string) {
82
+ try { return parseProjectCommand(args, entry); }
83
+ catch { throw new Error(runUsage); }
95
84
  }
96
85
 
97
- export function parseAnySwarmCommand(args: string[], registered: Readonly<Record<string, string>> = {}): AnySwarmCommand | { help: string } {
86
+ export function parseAnySwarmCommand(args: string[]): AnySwarmCommand | { help: string } {
98
87
  const [command, ...options] = args;
99
- if (command === undefined) return { command: 'tui' };
100
- if (command === '--help' && options.length === 0) return { help: anyswarmUsage };
101
- const usages = { run: 'Usage: anys run <harness> [prompt or source arguments]', eject: 'Usage: anys eject <application> --dir <directory>', setup: setupUsage, update: updateUsage, doctor: doctorUsage, recover: recoverUsage };
102
- const usage = Object.hasOwn(usages, command) ? usages[command as keyof typeof usages] : anyswarmUsage;
88
+ if (command === undefined || (command === '--help' && options.length === 0)) return { help: anyswarmUsage };
89
+ if ((command === '--harness' || command.startsWith('--harness=')) && options.at(-1) === '--help' &&
90
+ (options.length === 1 || (command === '--harness' && options.length === 2))) return { help: projectUsage };
91
+ const usages = { run: runUsage, eject: ejectUsage, setup: setupUsage, update: updateUsage, doctor: doctorUsage, recover: recoverUsage };
92
+ const usage = Object.hasOwn(usages, command) ? usages[command as keyof typeof usages]
93
+ : args.some(arg => /^--harness(?:=|$)/.test(arg)) ? projectUsage : anyswarmUsage;
103
94
  if (options.length === 1 && options[0] === '--help' && Object.hasOwn(usages, command)) return { help: usage };
104
95
  try {
105
96
  if (command === 'run') {
106
- if (!options[0] || options[0].startsWith('-')) throw new Error();
107
- return isLocalHarness(options[0]) || /^[^@]+\.(?:[cm]?[jt]s)$/.test(options[0])
108
- ? { command, entryPath: options[0], args: options.slice(1) }
109
- : parseHarnessSelection(options.slice(1), options[0]);
97
+ if (!options[0] || options[0].startsWith('-') || !/\.[cm]?[jt]s$/.test(options[0])) throw new Error();
98
+ return { command, entryPath: options[0], args: options.slice(1) };
110
99
  }
111
100
  if (command === 'eject') {
112
101
  const { values, positionals } = parseArgs({ args: options, allowPositionals: true, options: { dir: { type: 'string' } } });
113
- if (positionals.length === 1 && isHarnessName(positionals[0]) && !positionals[0].includes('/') && values.dir) {
102
+ if (positionals.length === 1 && /^[a-z0-9][a-z0-9_.-]*$/i.test(positionals[0]) && values.dir) {
114
103
  return { command, application: positionals[0], directory: values.dir };
115
104
  }
116
105
  throw new Error();
117
106
  }
118
- if (command === '-u' || command.startsWith('-u=') || command === '--use' || command.startsWith('--use=')) {
119
- return parseHarnessSelection(args);
120
- }
121
- if (command.startsWith('--')) {
122
- const { values, options: selection } = parseHarnessOptions(args, false);
123
- if (values.cmd !== undefined || values.headless !== undefined || values.rpc !== undefined || values.use !== undefined) throw new Error();
124
- const project = { command: 'harness' as const, harness: values.harness!, ...selection };
125
- if (values.mode === 'tui' || (values.mode === undefined && values.prompt === undefined)) {
126
- return { ...project, command: 'tui', harness: values.harness, cwd: values.cwd, prompt: values.prompt };
127
- }
128
- if (!project.harness) throw new Error();
129
- if (values.mode === 'rpc' && values.prompt === undefined && values.cwd === undefined) return { ...project, mode: 'rpc' };
130
- if ((values.mode === undefined || values.mode === 'foreground') && values.prompt?.trim()) {
131
- return { ...project, mode: 'foreground', cwd: values.cwd, prompt: values.prompt };
132
- }
133
- }
107
+ if (command.startsWith('--')) return parseProjectCommand(args);
134
108
  if (command === 'setup') {
135
109
  const { values } = parseArgs({ args: options, options: {
136
110
  mode: { type: 'string' }, endpoint: { type: 'string' }, 'public-url': { type: 'string' }, config: { type: 'string' },
@@ -146,23 +120,20 @@ export function parseAnySwarmCommand(args: string[], registered: Readonly<Record
146
120
  backend, backendPath: values['backend-path'], backendVersion: values['backend-version'] };
147
121
  }
148
122
  }
149
- if (command === 'update') {
150
- const { values } = parseArgs({ args: options, options: { archive: { type: 'string' }, sha256: { type: 'string' } } });
151
- if (options.length === 0 || (values.archive && /^[a-f0-9]{64}$/i.test(values.sha256 ?? ''))) {
152
- return { command, archive: values.archive, sha256: values.sha256?.toLowerCase() };
153
- }
154
- }
123
+ if (command === 'update' && options.length === 0) return { command };
155
124
  if (command === 'recover') {
156
125
  const { values } = parseArgs({ args: options, options: { 'run-dir': { type: 'string' }, config: { type: 'string' } } });
157
126
  if (values['run-dir'] && values.config) return { command, directory: values['run-dir'], configPath: values.config };
158
127
  }
159
128
  if (command === 'doctor') {
160
129
  const { values } = parseArgs({
161
- args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' } },
130
+ args: options, options: { config: { type: 'string' }, smoke: { type: 'boolean' }, mode: { type: 'string' } },
162
131
  });
163
- if (values.config !== '') return { command, configPath: values.config, smoke: values.smoke === true };
132
+ const { mode } = values;
133
+ if (values.config !== '' && (mode === undefined || mode === 'existing' || mode === 'local')) {
134
+ return { command, mode, configPath: values.config, smoke: values.smoke === true };
135
+ }
164
136
  }
165
- if (Object.hasOwn(registered, command)) return parseHarnessSelection(options, command);
166
137
  } catch {
167
138
  // Argument errors can contain untrusted input. Print only the command usage.
168
139
  }
@@ -92,7 +92,7 @@ export async function ejectSourceCommand(command: { application: string; directo
92
92
  archiveSha256, content: { sha256: digestFiles(packageRoot, files), files } } };
93
93
  await writeFile(join(staging, 'anyswarm-source.json'), JSON.stringify(provenance, null, 2) + '\n');
94
94
  await writeFile(join(staging, 'package.json'), JSON.stringify({ name: `anyswarm-${command.application}-source`, private: true,
95
- scripts: { start: `anys run ./${manifest.entry}` }, dependencies: { ...dependencies, '@anyswarm/core': 'file:./.anyswarm-sdk/core.tgz' },
95
+ scripts: { start: `anyswarm run ./${manifest.entry}` }, dependencies: { ...dependencies, '@anyswarm/core': 'file:./.anyswarm-sdk/core.tgz' },
96
96
  }, null, 2) + '\n');
97
97
  if (targetInfo) await rmdir(target);
98
98
  await rename(staging, target);
@@ -1,7 +1,5 @@
1
- import { existsSync } from 'node:fs';
2
- import { applicationDescriptors, findApplication } from './anyswarm-applications.js';
3
1
  export const builtins: Record<string, string> = {
4
- ...Object.fromEntries(applicationDescriptors().map(app => [app.id, app.harness])),
2
+ autoresearch: new URL('../examples/autoresearch/project.js', import.meta.url).href,
5
3
  'lead-worker': new URL('../examples/lead-worker/project.js', import.meta.url).href,
6
4
  peermesh: new URL('../examples/peermesh/project.js', import.meta.url).href,
7
5
  notes: new URL('../examples/notes/project.js', import.meta.url).href,
@@ -10,18 +8,3 @@ export const builtins: Record<string, string> = {
10
8
  substrate: new URL('../examples/substrate/project.js', import.meta.url).href,
11
9
  subagents: new URL('../examples/subagents/project.js', import.meta.url).href,
12
10
  };
13
-
14
- export async function builtinConfiguration(name: string) {
15
- if (name === 'messages') return (await import('../examples/messages/handoff-config.js')).handoffConfig();
16
- if (name === 'peermesh') return (await import('../examples/peermesh/project-config.js')).peerMeshConfig();
17
- if (name === 'substrate') return (await import('../examples/substrate/project-config.js')).substrateConfiguration();
18
- if (name === 'lead-worker') return {
19
- ...(await import('../examples/lead-worker/project-config.js')).leadWorkerConfig(),
20
- team: process.env.ANYSWARM_LEAD_WORKER_TEAM,
21
- checkingImage: process.env.ANYSWARM_LEAD_WORKER_CHECKING_IMAGE,
22
- };
23
- const path = new URL('../examples/' + name + '/config.js', import.meta.url);
24
- if (findApplication(name) && !existsSync(path)) return undefined;
25
- path.search = 'launcher=' + Date.now();
26
- return (await import(path.href)).default;
27
- }