@anyswarm/core 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/README.md +11 -10
  2. package/deploy/worker/Dockerfile +12 -4
  3. package/dist/deploy/worker/Dockerfile +12 -4
  4. package/dist/examples/README.md +24 -12
  5. package/dist/examples/authoring/README.md +24 -0
  6. package/dist/examples/authoring/business.d.ts +2 -0
  7. package/dist/examples/authoring/business.js +4 -0
  8. package/dist/examples/authoring/config.d.ts +5 -0
  9. package/dist/examples/authoring/config.js +2 -0
  10. package/dist/examples/authoring/eject.json +5 -0
  11. package/dist/examples/authoring/harness.d.ts +4 -0
  12. package/dist/examples/authoring/harness.js +19 -0
  13. package/dist/examples/autoresearch/README.md +33 -0
  14. package/dist/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
  15. package/dist/examples/autoresearch/config.d.ts +51 -0
  16. package/dist/examples/autoresearch/config.js +57 -0
  17. package/dist/examples/autoresearch/demo.d.ts +11 -0
  18. package/dist/examples/autoresearch/demo.js +52 -0
  19. package/dist/examples/autoresearch/eject.json +15 -0
  20. package/dist/examples/autoresearch/frontiercs2.d.ts +87 -0
  21. package/dist/examples/autoresearch/frontiercs2.js +211 -0
  22. package/dist/examples/autoresearch/prepare.d.ts +95 -0
  23. package/dist/examples/autoresearch/prepare.js +257 -0
  24. package/dist/examples/autoresearch/process.d.ts +13 -0
  25. package/dist/examples/autoresearch/process.js +48 -0
  26. package/dist/examples/autoresearch/project.d.ts +115 -0
  27. package/dist/examples/autoresearch/project.js +410 -0
  28. package/dist/examples/autoresearch/research-service.d.ts +106 -0
  29. package/dist/examples/autoresearch/research-service.js +255 -0
  30. package/dist/examples/code/README.md +25 -0
  31. package/dist/examples/code/REQUIREMENTS.zh.md +11 -0
  32. package/dist/examples/code/candidate.d.ts +19 -0
  33. package/dist/examples/code/candidate.js +80 -0
  34. package/dist/examples/code/config.d.ts +32 -0
  35. package/dist/examples/code/config.js +18 -0
  36. package/dist/examples/code/eject.json +5 -0
  37. package/dist/examples/code/project.d.ts +3 -0
  38. package/dist/examples/code/project.js +605 -0
  39. package/dist/examples/code/prompts.d.ts +5 -0
  40. package/dist/examples/code/prompts.js +12 -0
  41. package/dist/examples/code/verification.d.ts +19 -0
  42. package/dist/examples/code/verification.js +268 -0
  43. package/dist/examples/code/worktree.d.ts +17 -0
  44. package/dist/examples/code/worktree.js +233 -0
  45. package/dist/examples/harness-session/README.md +3 -6
  46. package/dist/examples/lead-worker/harness/dynamic-scheduler.d.ts +2 -1
  47. package/dist/examples/lead-worker/harness/dynamic-scheduler.js +5 -2
  48. package/dist/examples/lead-worker/harness/index.d.ts +60 -0
  49. package/dist/examples/lead-worker/harness/index.js +77 -6
  50. package/dist/examples/lead-worker/project.js +2 -2
  51. package/dist/examples/lead-worker/services/board.d.ts +5 -0
  52. package/dist/examples/lead-worker/services/board.js +19 -1
  53. package/dist/examples/messages/README.md +5 -5
  54. package/dist/examples/messages/handoff.d.ts +2 -0
  55. package/dist/examples/messages/handoff.js +5 -1
  56. package/dist/examples/messages/project.js +52 -2
  57. package/dist/examples/notes/README.md +13 -18
  58. package/dist/examples/notes/project.js +67 -6
  59. package/dist/examples/peermesh/harness/router.js +3 -1
  60. package/dist/examples/peermesh/harness/team.d.ts +8 -0
  61. package/dist/examples/peermesh/harness/team.js +13 -0
  62. package/dist/examples/peermesh/project.js +22 -4
  63. package/dist/examples/services/agent-control/README.md +3 -3
  64. package/dist/examples/services/mathlib-search/Dockerfile +4 -2
  65. package/dist/examples/services/mathlib-search/README.md +1 -1
  66. package/dist/examples/services/mcp-managed/README.md +2 -2
  67. package/dist/examples/services/persistent-board/README.md +13 -3
  68. package/dist/examples/services/persistent-board/business.d.ts +7 -0
  69. package/dist/examples/services/persistent-board/business.js +7 -0
  70. package/dist/examples/services/persistent-board/index.js +10 -0
  71. package/dist/examples/services/persistent-board/live.d.ts +3 -0
  72. package/dist/examples/services/persistent-board/live.js +58 -0
  73. package/dist/examples/subagents/README.md +5 -5
  74. package/dist/examples/subagents/business.js +3 -1
  75. package/dist/examples/subagents/harness/controller.d.ts +15 -0
  76. package/dist/examples/subagents/harness/controller.js +181 -32
  77. package/dist/examples/subagents/project.d.ts +2 -0
  78. package/dist/examples/subagents/project.js +43 -34
  79. package/dist/examples/subagents/prompts/prompts.d.ts +1 -0
  80. package/dist/examples/subagents/prompts/prompts.js +3 -0
  81. package/dist/examples/subagents/services/collaboration-service.d.ts +3 -2
  82. package/dist/examples/subagents/services/collaboration-service.js +14 -2
  83. package/dist/examples/substrate/README.md +2 -2
  84. package/dist/examples/substrate/harness/index.d.ts +1 -1
  85. package/dist/examples/substrate/harness/index.js +77 -12
  86. package/dist/examples/substrate/project.js +4 -1
  87. package/dist/examples/super/README.md +40 -0
  88. package/dist/examples/super/actions.d.ts +95 -0
  89. package/dist/examples/super/actions.js +230 -0
  90. package/dist/examples/super/artifact.d.ts +4 -0
  91. package/dist/examples/super/artifact.js +51 -0
  92. package/dist/examples/super/config.d.ts +80 -0
  93. package/dist/examples/super/config.js +83 -0
  94. package/dist/examples/super/coordinator.d.ts +33 -0
  95. package/dist/examples/super/coordinator.js +151 -0
  96. package/dist/examples/super/daemon.d.ts +11 -0
  97. package/dist/examples/super/daemon.js +109 -0
  98. package/dist/examples/super/decisions.d.ts +8 -0
  99. package/dist/examples/super/decisions.js +52 -0
  100. package/dist/examples/super/eject.json +5 -0
  101. package/dist/examples/super/execution.d.ts +11 -0
  102. package/dist/examples/super/execution.js +136 -0
  103. package/dist/examples/super/github.d.ts +62 -0
  104. package/dist/examples/super/github.js +269 -0
  105. package/dist/examples/super/inbox.d.ts +162 -0
  106. package/dist/examples/super/inbox.js +284 -0
  107. package/dist/examples/super/location.d.ts +5 -0
  108. package/dist/examples/super/location.js +64 -0
  109. package/dist/examples/super/outbox.d.ts +5 -0
  110. package/dist/examples/super/outbox.js +103 -0
  111. package/dist/examples/super/project.d.ts +111 -0
  112. package/dist/examples/super/project.js +253 -0
  113. package/dist/examples/super/prompts.d.ts +3 -0
  114. package/dist/examples/super/prompts.js +25 -0
  115. package/dist/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  116. package/dist/examples/taskpool/harness/controller.d.ts +35 -6
  117. package/dist/examples/taskpool/harness/controller.js +73 -7
  118. package/dist/examples/taskpool/project.js +18 -2
  119. package/dist/scripts/anyswarm-applications.d.ts +19 -0
  120. package/dist/scripts/anyswarm-applications.js +19 -0
  121. package/dist/scripts/anyswarm-arguments.d.ts +35 -5
  122. package/dist/scripts/anyswarm-arguments.js +87 -23
  123. package/dist/scripts/anyswarm-author.d.ts +5 -0
  124. package/dist/scripts/anyswarm-author.js +24 -0
  125. package/dist/scripts/anyswarm-eject.d.ts +11 -0
  126. package/dist/scripts/anyswarm-eject.js +164 -0
  127. package/dist/scripts/anyswarm-harnesses.d.ts +2 -0
  128. package/dist/scripts/anyswarm-harnesses.js +31 -0
  129. package/dist/scripts/anyswarm-installation.js +19 -13
  130. package/dist/scripts/anyswarm-launch.d.ts +37 -0
  131. package/dist/scripts/anyswarm-launch.js +86 -0
  132. package/dist/scripts/anyswarm-project.d.ts +12 -2
  133. package/dist/scripts/anyswarm-project.js +121 -20
  134. package/dist/scripts/anyswarm-source-runner.d.ts +1 -0
  135. package/dist/scripts/anyswarm-source-runner.js +232 -0
  136. package/dist/scripts/anyswarm-tui-config.d.ts +36 -0
  137. package/dist/scripts/anyswarm-tui-config.js +189 -0
  138. package/dist/scripts/anyswarm-tui-session.d.ts +66 -0
  139. package/dist/scripts/anyswarm-tui-session.js +304 -0
  140. package/dist/scripts/anyswarm-tui-terminal.d.ts +41 -0
  141. package/dist/scripts/anyswarm-tui-terminal.js +154 -0
  142. package/dist/scripts/anyswarm-tui.d.ts +2 -0
  143. package/dist/scripts/anyswarm-tui.js +1012 -0
  144. package/dist/scripts/anyswarm.js +47 -2
  145. package/dist/scripts/build-provenance.json +1 -0
  146. package/dist/scripts/build.js +7 -1
  147. package/dist/scripts/generate-architecture-api.js +2 -0
  148. package/dist/scripts/generate-architecture-prompts.js +24 -2
  149. package/dist/scripts/local-environment.d.ts +6 -1
  150. package/dist/scripts/local-environment.js +52 -16
  151. package/dist/scripts/local-setup-smoke.js +3 -2
  152. package/dist/scripts/local-setup-worker.d.ts +1 -1
  153. package/dist/scripts/local-setup-worker.js +15 -6
  154. package/dist/scripts/local-setup.d.ts +2 -2
  155. package/dist/scripts/local-setup.js +72 -12
  156. package/dist/scripts/opensandbox-agent-worker.js +2 -2
  157. package/dist/scripts/pack-release.d.ts +1 -0
  158. package/dist/scripts/pack-release.js +63 -0
  159. package/dist/scripts/pi-session-bridge.js +11 -3
  160. package/dist/scripts/run-harness.js +3 -1
  161. package/dist/scripts/setup-bootstrap.js +43 -6
  162. package/dist/src/core/allocation-ledger.js +4 -3
  163. package/dist/src/core/host-identity.d.ts +2 -0
  164. package/dist/src/core/host-identity.js +11 -0
  165. package/dist/src/core/index.d.ts +4 -2
  166. package/dist/src/core/index.js +12 -4
  167. package/dist/src/core/mcp-service.js +2 -2
  168. package/dist/src/core/runtime-management.d.ts +6 -0
  169. package/dist/src/core/runtime-management.js +24 -0
  170. package/dist/src/core/sandbox/executor-driver.d.ts +4 -2
  171. package/dist/src/core/sandbox/executor-driver.js +12 -14
  172. package/dist/src/core/sandbox/local-executor.d.ts +13 -1
  173. package/dist/src/core/sandbox/local-executor.js +69 -19
  174. package/dist/src/core/sandbox/local-worker.js +32 -21
  175. package/dist/src/core/sandbox/opensandbox-backend.d.ts +2 -0
  176. package/dist/src/core/sandbox/opensandbox-backend.js +36 -11
  177. package/dist/src/core/sandbox/sandbox-connection.d.ts +2 -0
  178. package/dist/src/core/sandbox/sandbox-connection.js +14 -6
  179. package/dist/src/core/service-live-state.d.ts +14 -0
  180. package/dist/src/core/service-live-state.js +161 -0
  181. package/dist/src/core/service-observation-types.d.ts +21 -1
  182. package/dist/src/core/service-process.d.ts +1 -1
  183. package/dist/src/core/service-process.js +45 -4
  184. package/dist/src/core/service-types.d.ts +5 -1
  185. package/dist/src/core/services.d.ts +1 -1
  186. package/dist/src/core/services.js +8 -3
  187. package/dist/src/core/types.d.ts +3 -0
  188. package/dist/src/core/worker-image.js +3 -3
  189. package/dist/src/harness/harness-session-types.d.ts +10 -0
  190. package/dist/src/harness/harness-session.js +42 -5
  191. package/dist/src/harness/project-harness.d.ts +13 -1
  192. package/dist/src/harness/project-harness.js +36 -10
  193. package/dist/src/harness/project-input.js +81 -15
  194. package/dist/src/harness/project-rpc-client.d.ts +1 -0
  195. package/dist/src/harness/project-rpc-client.js +5 -0
  196. package/dist/src/harness/project-rpc.d.ts +8 -2
  197. package/dist/src/harness/project-rpc.js +31 -7
  198. package/dist/src/harness/project-runtime.js +3 -1
  199. package/dist/src/harness/typescript-loader.d.ts +2 -0
  200. package/dist/src/harness/typescript-loader.js +41 -0
  201. package/dist/src/trace-viewer/public/app.js +6 -5
  202. package/dist/src/trace-viewer/reader.mjs +42 -2
  203. package/docs/INDEX.md +3 -1
  204. package/docs/architecture/00-overview.md +1 -1
  205. package/docs/architecture/01-agent-core.md +1 -1
  206. package/docs/architecture/06-observability-experiments.md +1 -1
  207. package/docs/architecture/07-run-configuration.md +18 -12
  208. package/docs/architecture/08-prompts.md +22 -0
  209. package/docs/architecture/10-service-api-reference.md +53 -18
  210. package/docs/architecture/11-storage-reference.md +18 -1
  211. package/docs/architecture/12-code-coverage.md +148 -84
  212. package/docs/architecture/15-core-runtime.md +8 -0
  213. package/docs/architecture/16-pi-opensandbox-backend.md +5 -5
  214. package/docs/architecture/17-harness-reporting.md +1 -1
  215. package/docs/architecture/19-substrate-harness.md +28 -1
  216. package/docs/architecture/20-lead-worker-harness.md +34 -1
  217. package/docs/architecture/22-website.md +5 -3
  218. package/docs/architecture/23-project-harness.md +124 -5
  219. package/docs/architecture/24-runtime-recovery.md +10 -3
  220. package/docs/architecture/25-foreground-tui.md +51 -0
  221. package/docs/architecture/26-code.md +39 -0
  222. package/docs/architecture/27-personal.md +43 -0
  223. package/docs/architecture/28-autoresearch.md +31 -0
  224. package/docs/architecture/INDEX.md +4 -0
  225. package/docs/architecture/prompts/08-lead-worker-harness.md +4 -2
  226. package/docs/architecture/prompts/08-subagents-harness.md +21 -0
  227. package/docs/architecture/prompts/21-personal.md +44 -0
  228. package/docs/architecture/prompts/22-autoresearch.md +63 -0
  229. package/docs/architecture/prompts/26-code.md +55 -0
  230. package/docs/architecture/prompts/source-manifest.json +152 -33
  231. package/docs/architecture/source-map.json +489 -21
  232. package/docs/designs/core-harness/06-project-harness.md +13 -2
  233. package/docs/designs/core-harness/README.md +5 -0
  234. package/docs/en/agents.md +1 -1
  235. package/docs/en/build-your-harness.md +3 -5
  236. package/docs/en/changelog.md +13 -4
  237. package/docs/en/first-harness.md +8 -11
  238. package/docs/en/harnesses/lead-worker.md +1 -1
  239. package/docs/en/harnesses/peermesh.md +2 -2
  240. package/docs/en/harnesses/subagents.md +2 -2
  241. package/docs/en/harnesses/substrate.md +4 -4
  242. package/docs/en/harnesses/taskpool.md +2 -2
  243. package/docs/en/latest.md +12 -123
  244. package/docs/en/overview.md +1 -1
  245. package/docs/en/quickstart.md +40 -16
  246. package/docs/en/reference/api.md +14 -4
  247. package/docs/en/reference/cli.md +58 -14
  248. package/docs/en/runtime.md +2 -2
  249. package/docs/en/services.md +4 -0
  250. package/docs/third-party-notices.md +1 -0
  251. package/docs/workflows/development.md +17 -12
  252. package/docs/workflows/release-and-docs-versioning.md +76 -0
  253. package/docs/zh/agents.md +1 -1
  254. package/docs/zh/build-your-harness.md +3 -5
  255. package/docs/zh/changelog.md +13 -4
  256. package/docs/zh/first-harness.md +8 -11
  257. package/docs/zh/harnesses/lead-worker.md +1 -1
  258. package/docs/zh/harnesses/peermesh.md +2 -2
  259. package/docs/zh/harnesses/subagents.md +2 -2
  260. package/docs/zh/harnesses/substrate.md +4 -4
  261. package/docs/zh/harnesses/taskpool.md +2 -2
  262. package/docs/zh/latest.md +13 -124
  263. package/docs/zh/overview.md +1 -1
  264. package/docs/zh/quickstart.md +40 -16
  265. package/docs/zh/reference/api.md +14 -4
  266. package/docs/zh/reference/cli.md +58 -14
  267. package/docs/zh/runtime.md +2 -2
  268. package/docs/zh/services.md +4 -0
  269. package/examples/README.md +24 -12
  270. package/examples/authoring/README.md +24 -0
  271. package/examples/authoring/business.ts +4 -0
  272. package/examples/authoring/config.ts +2 -0
  273. package/examples/authoring/eject.json +5 -0
  274. package/examples/authoring/harness.ts +21 -0
  275. package/examples/autoresearch/README.md +33 -0
  276. package/examples/autoresearch/REQUIREMENTS.zh.md +18 -0
  277. package/examples/autoresearch/config.ts +90 -0
  278. package/examples/autoresearch/demo.ts +55 -0
  279. package/examples/autoresearch/eject.json +15 -0
  280. package/examples/autoresearch/frontiercs2.ts +237 -0
  281. package/examples/autoresearch/prepare.ts +267 -0
  282. package/examples/autoresearch/process.ts +50 -0
  283. package/examples/autoresearch/project.ts +397 -0
  284. package/examples/autoresearch/research-service.ts +302 -0
  285. package/examples/code/README.md +25 -0
  286. package/examples/code/REQUIREMENTS.zh.md +11 -0
  287. package/examples/code/candidate.ts +89 -0
  288. package/examples/code/config.ts +19 -0
  289. package/examples/code/eject.json +5 -0
  290. package/examples/code/project.ts +581 -0
  291. package/examples/code/prompts.ts +16 -0
  292. package/examples/code/verification.ts +239 -0
  293. package/examples/code/worktree.ts +188 -0
  294. package/examples/harness-session/README.md +3 -6
  295. package/examples/lead-worker/harness/dynamic-scheduler.ts +6 -3
  296. package/examples/lead-worker/harness/index.ts +61 -6
  297. package/examples/lead-worker/project.ts +2 -2
  298. package/examples/lead-worker/services/board.ts +14 -1
  299. package/examples/messages/README.md +5 -5
  300. package/examples/messages/handoff.ts +6 -2
  301. package/examples/messages/project.ts +47 -2
  302. package/examples/notes/README.md +13 -18
  303. package/examples/notes/project.ts +57 -9
  304. package/examples/peermesh/harness/router.ts +2 -2
  305. package/examples/peermesh/harness/team.ts +11 -0
  306. package/examples/peermesh/project.ts +19 -4
  307. package/examples/services/agent-control/README.md +3 -3
  308. package/examples/services/mathlib-search/Dockerfile +4 -2
  309. package/examples/services/mathlib-search/README.md +1 -1
  310. package/examples/services/mcp-managed/README.md +2 -2
  311. package/examples/services/persistent-board/README.md +13 -3
  312. package/examples/services/persistent-board/business.ts +10 -0
  313. package/examples/services/persistent-board/index.ts +10 -0
  314. package/examples/services/persistent-board/live.ts +54 -0
  315. package/examples/subagents/README.md +5 -5
  316. package/examples/subagents/business.ts +3 -1
  317. package/examples/subagents/harness/controller.ts +161 -29
  318. package/examples/subagents/project.ts +47 -33
  319. package/examples/subagents/prompts/prompts.ts +4 -0
  320. package/examples/subagents/services/collaboration-service.ts +14 -2
  321. package/examples/substrate/README.md +2 -2
  322. package/examples/substrate/harness/index.ts +67 -11
  323. package/examples/substrate/project.ts +5 -1
  324. package/examples/super/README.md +40 -0
  325. package/examples/super/actions.ts +196 -0
  326. package/examples/super/artifact.ts +56 -0
  327. package/examples/super/config.ts +95 -0
  328. package/examples/super/coordinator.ts +158 -0
  329. package/examples/super/daemon.ts +84 -0
  330. package/examples/super/decisions.ts +46 -0
  331. package/examples/super/eject.json +5 -0
  332. package/examples/super/execution.ts +131 -0
  333. package/examples/super/github.ts +242 -0
  334. package/examples/super/inbox.ts +306 -0
  335. package/examples/super/location.ts +54 -0
  336. package/examples/super/outbox.ts +97 -0
  337. package/examples/super/project.ts +227 -0
  338. package/examples/super/prompts.ts +27 -0
  339. package/examples/taskpool/deploy/service-hosts/Dockerfile +4 -2
  340. package/examples/taskpool/harness/controller.ts +59 -7
  341. package/examples/taskpool/project.ts +18 -2
  342. package/npm-shrinkwrap.development.json +2199 -0
  343. package/npm-shrinkwrap.json +86 -1920
  344. package/package.development.json +92 -0
  345. package/package.json +13 -7
  346. package/scripts/anyswarm-applications.ts +39 -0
  347. package/scripts/anyswarm-arguments.ts +94 -28
  348. package/scripts/anyswarm-author.ts +25 -0
  349. package/scripts/anyswarm-eject.ts +145 -0
  350. package/scripts/anyswarm-harnesses.ts +27 -0
  351. package/scripts/anyswarm-installation.ts +19 -13
  352. package/scripts/anyswarm-launch.ts +108 -0
  353. package/scripts/anyswarm-project.ts +114 -21
  354. package/scripts/anyswarm-source-runner.ts +203 -0
  355. package/scripts/anyswarm-tui-config.ts +174 -0
  356. package/scripts/anyswarm-tui-session.ts +295 -0
  357. package/scripts/anyswarm-tui-terminal.ts +147 -0
  358. package/scripts/anyswarm-tui.ts +912 -0
  359. package/scripts/anyswarm.ts +43 -2
  360. package/scripts/build.ts +8 -1
  361. package/scripts/generate-architecture-api.ts +2 -0
  362. package/scripts/generate-architecture-prompts.ts +35 -2
  363. package/scripts/local-environment.ts +55 -17
  364. package/scripts/local-setup-smoke.ts +3 -2
  365. package/scripts/local-setup-worker.ts +17 -7
  366. package/scripts/local-setup.ts +66 -13
  367. package/scripts/opensandbox-agent-worker.ts +2 -2
  368. package/scripts/pack-release.ts +67 -0
  369. package/scripts/pi-session-bridge.ts +10 -2
  370. package/scripts/run-harness.ts +3 -1
  371. package/scripts/setup-bootstrap.ts +41 -6
  372. package/src/core/allocation-ledger.ts +5 -3
  373. package/src/core/host-identity.ts +11 -0
  374. package/src/core/index.ts +12 -6
  375. package/src/core/mcp-service.ts +2 -2
  376. package/src/core/runtime-management.ts +22 -0
  377. package/src/core/sandbox/executor-driver.ts +15 -18
  378. package/src/core/sandbox/local-executor.ts +65 -19
  379. package/src/core/sandbox/local-worker.ts +29 -21
  380. package/src/core/sandbox/opensandbox-backend.ts +36 -11
  381. package/src/core/sandbox/sandbox-connection.ts +14 -5
  382. package/src/core/service-live-state.ts +156 -0
  383. package/src/core/service-observation-types.ts +23 -1
  384. package/src/core/service-process.ts +36 -3
  385. package/src/core/service-types.ts +3 -1
  386. package/src/core/services.ts +8 -3
  387. package/src/core/types.ts +3 -0
  388. package/src/core/worker-image.ts +3 -3
  389. package/src/harness/harness-session-types.ts +13 -1
  390. package/src/harness/harness-session.ts +40 -7
  391. package/src/harness/project-harness.ts +36 -10
  392. package/src/harness/project-input.ts +73 -15
  393. package/src/harness/project-rpc-client.ts +5 -0
  394. package/src/harness/project-rpc.ts +29 -8
  395. package/src/harness/project-runtime.ts +2 -1
  396. package/src/harness/typescript-loader.ts +37 -0
  397. package/src/trace-viewer/public/app.js +6 -5
  398. package/src/trace-viewer/reader.mjs +42 -2
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  <p>
23
23
  <a href="https://anyswarm.github.io/anyswarm/">Website</a> ·
24
24
  <a href="docs/en/quickstart.md">Quickstart</a> ·
25
- <a href="docs/en/latest.md">Releases and main updates</a> ·
25
+ <a href="docs/en/latest.md">Releases</a> ·
26
26
  <a href="docs/en/changelog.md">Changelog</a> ·
27
27
  <a href="docs/en/build-your-harness.md">Build a Swarm Harness</a> ·
28
28
  <a href="docs/zh/overview.md">中文文档</a>
@@ -38,17 +38,16 @@ AnySwarm separates **how Agents collaborate** from **how Agents are isolated and
38
38
 
39
39
  - **One Runtime, any topology** — Swap between recursive Subagents, leased TaskPool, PeerMesh, Substrate, or Lead-Worker without modifying the Runtime.
40
40
  - **Sandbox Provider interface** — Run `anyswarm setup --mode local`, or save an existing OpenSandbox endpoint and one Runtime callback with `anyswarm setup --mode existing`. Supply a custom Provider through the root SDK when you need a different Sandbox integration. Model API keys and external Service tokens stay on the trusted Controller.
41
- - **Configurable executors, models and file budgets** — Select Pi 1.3.0 or 1.4.0, Codex 0.172.0, or an image-installed adapter. Use Responses with Pi or Codex, Chat Completions with Pi, or a trusted Host transport. Configure import, live file operations and export separately.
41
+ - **Configurable executors, models and file budgets** — Use an installed Pi or Codex, optionally pin its exact version, or select an image-installed adapter. Use Responses with Pi or Codex, Chat Completions with Pi, or a trusted Host transport. Configure import, live file operations and export separately.
42
42
  - **Single unified package** — `@anyswarm/core` bundles the TypeScript SDK, `anyswarm` CLI, `swarm` container CLI, built-in Harnesses, and the zero-dependency browser Trace Viewer (`anyswarm trace`).
43
43
 
44
44
  ## Quick start
45
45
 
46
- Use Node.js 22.19+ and Git on Linux, with Docker Engine and a supported npm-installed Pi or Codex for local OpenSandbox. The [Quickstart](docs/en/quickstart.md) covers prerequisites and connecting to an existing service. The steps below install the current stable CLI. For v0.4.0, see the [upgrade guide](docs/en/latest.md#upgrade-from-v040-to-the-managed-installer).
46
+ Install the current stable CLI with Node.js 22.19+ and npm on Linux or macOS. Local OpenSandbox is separate: the current release requires a Linux Controller, Docker Engine and a supported npm-installed Pi or Codex. For native macOS local setup ([#339](https://github.com/AnySwarm/anyswarm/issues/339)), [install and start Docker Desktop for Mac](docs/en/quickstart.md#docker-on-macos) or start your existing local Linux container engine. The npm command does not install the engine.
47
47
 
48
48
  ```sh
49
49
  # 1. Install the released CLI
50
- curl -fsSL https://anyswarm.github.io/anyswarm/install.sh | sh
51
- # Apply the installer’s PATH command if needed.
50
+ npm install -g @anyswarm/core
52
51
  anyswarm --version
53
52
 
54
53
  # 2. Prepare OpenSandbox and save its connection
@@ -69,17 +68,19 @@ anyswarm --harness subagents --prompt 'Read README.md and report its heading.' -
69
68
  anyswarm trace --root ./runs --port 8787
70
69
  ```
71
70
 
72
- The installed SDK builds the local Worker using its bundled materials and the selected host executor. `anyswarm update` updates the managed global CLI independently of project SDK dependencies. Set `ANYSWARM_WORKER_IMAGE` when using a custom Worker image. Use `--harness` to select any built-in (`subagents`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes`, `messages`), a local ESM module, or an installed package. In `--mode rpc`, tasks arrive over JSONL with live `status` and `stop` control.
71
+ The [shell installer](docs/en/quickstart.md#1-install-anyswarm) also installs the CLI and enables `anyswarm update`. For an npm global install, update with `npm install -g @anyswarm/core@latest`.
72
+
73
+ The installed SDK builds the local Worker using its bundled materials and the selected host executor. Set `ANYSWARM_WORKER_IMAGE` when using a custom Worker image. Use `--harness` to select any built-in (`subagents`, `taskpool`, `peermesh`, `substrate`, `lead-worker`, `notes`, `messages`), a local ESM module, or an installed package. In `--mode rpc`, tasks arrive over JSONL with live `status` and `stop` control.
73
74
 
74
75
  ## Build with the TypeScript SDK
75
76
 
76
- Use `@anyswarm/core` for the v0.5.0 SDK:
77
+ Install the TypeScript SDK in your Node.js project.
77
78
 
78
79
  ```sh
79
- npm install @anyswarm/core@0.5.0
80
+ npm install @anyswarm/core
80
81
  ```
81
82
 
82
- Import Runtime, Service and Sandbox Provider APIs from `@anyswarm/core`. The [SDK reference](docs/en/reference/api.md#install-the-sdk) also covers verified source archives. The [First Harness tutorial](docs/en/first-harness.md) copies examples from the installed SDK. Projects staying on v0.4.1 use [`@anyswarm/anyswarm@0.4.1`](https://www.npmjs.com/package/@anyswarm/anyswarm/v/0.4.1).
83
+ [v0.5.0](docs/en/latest.md#v050) is the first supported release of `@anyswarm/core`. Import Runtime, Service and Sandbox Provider APIs from this package. The [SDK reference](docs/en/reference/api.md#install-the-sdk) also covers verified source archives. The [First Harness tutorial](docs/en/first-harness.md) copies examples from the installed SDK.
83
84
 
84
85
  - Core building blocks & Swarm tutorial: [Sandboxes](docs/en/sandbox.md) · [Runtime](docs/en/runtime.md) · [Agents](docs/en/agents.md) · [Host Gateway](docs/en/gateway.md) · [Services](docs/en/services.md) · [Build a Swarm Harness](docs/en/build-your-harness.md)
85
86
  - Minimal runnable two-Agent script: [`examples/messages/handoff.ts`](examples/messages/handoff.ts)
@@ -117,7 +118,7 @@ When started inside an SSH session, `anyswarm trace` prints the matching `ssh -N
117
118
 
118
119
  ## Releases & documentation
119
120
 
120
- - **Releases and main updates**: [What's New](docs/en/latest.md) · [版本与主线更新 (中文)](docs/zh/latest.md) · [GitHub Releases](https://github.com/AnySwarm/anyswarm/releases)
121
+ - **Releases**: [Current release](docs/en/latest.md) · [发行版本 (中文)](docs/zh/latest.md) · [GitHub Releases](https://github.com/AnySwarm/anyswarm/releases)
121
122
  - **Changelog**: [CHANGELOG.md](CHANGELOG.md) · [Website Changelog](docs/en/changelog.md) · [更新日志 (中文)](docs/zh/changelog.md)
122
123
  - **Architecture & research**: [Architecture Manual](docs/architecture/INDEX.md) · [Research Context](docs/PROJECT.md) · [ProgramBench Pastel](benchmarks/programbench-pastel/README.md) · [PutnamBench TaskPool](benchmarks/putnambench-taskpool/README.md)
123
124
 
@@ -15,9 +15,13 @@ ARG WORKER_EXECUTOR
15
15
  LABEL org.opencontainers.image.source="https://github.com/AnySwarm/anyswarm" \
16
16
  org.opencontainers.image.description="AnySwarm OpenSandbox Worker with the selected local executor"
17
17
 
18
- RUN apt-get update \
19
- && apt-get install --no-install-recommends --yes bash ca-certificates curl git jq python3 python-is-python3 ripgrep util-linux \
20
- && rm -rf /var/lib/apt/lists/*
18
+ # The slim base has Node's bundled CA roots but not the OS CA bundle yet.
19
+ RUN node -e 'console.log(require("node:tls").rootCertificates.join("\n"))' > /tmp/apt-bootstrap-ca.pem \
20
+ && sed -i 's@http://deb.debian.org/@https://deb.debian.org/@g' /etc/apt/sources.list.d/debian.sources \
21
+ && apt-get -o Acquire::https::CaInfo=/tmp/apt-bootstrap-ca.pem -o Acquire::https::Timeout=30 update \
22
+ && apt-get -o Acquire::https::CaInfo=/tmp/apt-bootstrap-ca.pem -o Acquire::https::Timeout=30 \
23
+ install --no-install-recommends --yes bash ca-certificates curl git jq python3 python-is-python3 ripgrep util-linux \
24
+ && rm -rf /var/lib/apt/lists/* /tmp/apt-bootstrap-ca.pem
21
25
 
22
26
  WORKDIR /opt/anyswarm
23
27
  COPY --chown=0:0 package.json npm-shrinkwrap.json ./
@@ -57,7 +61,11 @@ RUN chmod 0755 /opt/anyswarm \
57
61
  && ln -s /opt/anyswarm/dist/scripts/swarm.js /usr/local/bin/swarm \
58
62
  && ln -s /opt/anyswarm/dist/scripts/opensandbox-agent-worker.js /opt/anyswarm/agent-worker.mjs \
59
63
  && ln -s /opt/anyswarm/dist/scripts/sandbox-project.js /opt/anyswarm/sandbox-project.mjs \
60
- && mkdir -p /workspace /opt/anyswarm/pi-agent
64
+ && mkdir -p /workspace /opt/anyswarm/pi-agent \
65
+ && case "$WORKER_EXECUTOR" in \
66
+ pi) node /opt/anyswarm/dist/scripts/pi-session-bridge.js --check-sdk ;; \
67
+ codex) /opt/anyswarm/executor/node_modules/.bin/codex app-server --help >/dev/null ;; \
68
+ esac
61
69
 
62
70
  ENV PATH="/opt/anyswarm/executor/node_modules/.bin:/opt/anyswarm/node_modules/.bin:${PATH}" \
63
71
  PI_CODING_AGENT_DIR="/opt/anyswarm/pi-agent" \
@@ -15,9 +15,13 @@ ARG WORKER_EXECUTOR
15
15
  LABEL org.opencontainers.image.source="https://github.com/AnySwarm/anyswarm" \
16
16
  org.opencontainers.image.description="AnySwarm OpenSandbox Worker with the selected local executor"
17
17
 
18
- RUN apt-get update \
19
- && apt-get install --no-install-recommends --yes bash ca-certificates curl git jq python3 python-is-python3 ripgrep util-linux \
20
- && rm -rf /var/lib/apt/lists/*
18
+ # The slim base has Node's bundled CA roots but not the OS CA bundle yet.
19
+ RUN node -e 'console.log(require("node:tls").rootCertificates.join("\n"))' > /tmp/apt-bootstrap-ca.pem \
20
+ && sed -i 's@http://deb.debian.org/@https://deb.debian.org/@g' /etc/apt/sources.list.d/debian.sources \
21
+ && apt-get -o Acquire::https::CaInfo=/tmp/apt-bootstrap-ca.pem -o Acquire::https::Timeout=30 update \
22
+ && apt-get -o Acquire::https::CaInfo=/tmp/apt-bootstrap-ca.pem -o Acquire::https::Timeout=30 \
23
+ install --no-install-recommends --yes bash ca-certificates curl git jq python3 python-is-python3 ripgrep util-linux \
24
+ && rm -rf /var/lib/apt/lists/* /tmp/apt-bootstrap-ca.pem
21
25
 
22
26
  WORKDIR /opt/anyswarm
23
27
  COPY --chown=0:0 package.json npm-shrinkwrap.json ./
@@ -57,7 +61,11 @@ RUN chmod 0755 /opt/anyswarm \
57
61
  && ln -s /opt/anyswarm/dist/scripts/swarm.js /usr/local/bin/swarm \
58
62
  && ln -s /opt/anyswarm/dist/scripts/opensandbox-agent-worker.js /opt/anyswarm/agent-worker.mjs \
59
63
  && ln -s /opt/anyswarm/dist/scripts/sandbox-project.js /opt/anyswarm/sandbox-project.mjs \
60
- && mkdir -p /workspace /opt/anyswarm/pi-agent
64
+ && mkdir -p /workspace /opt/anyswarm/pi-agent \
65
+ && case "$WORKER_EXECUTOR" in \
66
+ pi) node /opt/anyswarm/dist/scripts/pi-session-bridge.js --check-sdk ;; \
67
+ codex) /opt/anyswarm/executor/node_modules/.bin/codex app-server --help >/dev/null ;; \
68
+ esac
61
69
 
62
70
  ENV PATH="/opt/anyswarm/executor/node_modules/.bin:/opt/anyswarm/node_modules/.bin:${PATH}" \
63
71
  PI_CODING_AGENT_DIR="/opt/anyswarm/pi-agent" \
@@ -39,18 +39,15 @@ number.
39
39
  ```sh
40
40
  npm init -y
41
41
  npm install --ignore-scripts "${ANYSWARM_SDK_ARCHIVE:-@anyswarm/core@0.5.0}"
42
- npm install --save-dev typescript @types/node
43
42
  sdk=node_modules/@anyswarm/core
44
43
  cp -R "$sdk"/examples/subagents demo
45
44
  cd demo
46
- npm run check
47
- npm run build
48
- npm run start -- --cwd /absolute/path/to/project --prompt 'Implement and verify the requested change'
45
+ ../node_modules/.bin/anys run ./project.ts --cwd /absolute/path/to/project --prompt 'Implement and verify the requested change'
49
46
  ```
50
47
 
51
48
  For another collaboration mechanism, replace `subagents` in the copy command
52
49
  with `taskpool`, `peermesh`, `lead-worker` or `substrate`. The copied project
53
- resolves the SDK and compiler from its parent installation.
50
+ resolves the SDK from its parent installation. The CLI loads TS directly, including multi-file imports and TS configuration.
54
51
 
55
52
  For current repository sources, build the matching SDK archive from that
56
53
  checkout's root first. Record its commit and SHA-256, and set the absolute
@@ -59,27 +56,42 @@ archive path before running the commands above.
59
56
  ```sh
60
57
  npm ci --ignore-scripts
61
58
  pack_dir=$(mktemp -d)
62
- archive=$(npm pack --pack-destination "$pack_dir" --silent)
63
- sha256sum "$pack_dir/$archive"
64
- export ANYSWARM_SDK_ARCHIVE="$pack_dir/$archive"
59
+ archive=$(npm run --silent pack:release -- "$pack_dir")
60
+ sha256sum "$archive"
61
+ export ANYSWARM_SDK_ARCHIVE="$archive"
65
62
  ```
66
63
 
67
64
  When editing an existing example directly in this checkout, install this
68
65
  archive with `npm install --no-save "$ANYSWARM_SDK_ARCHIVE"` in that example's
69
- directory before its check and build commands.
66
+ directory before running its TypeScript entry.
70
67
 
71
68
  Use the example's README for its configuration and external facilities.
72
- Run `anyswarm --harness /absolute/path/to/example/dist/project.js --prompt '…'` from
69
+ Run `anys run /absolute/path/to/example/project.ts --prompt '…'` from
73
70
  the input project to use the same editable example from elsewhere. The
74
71
  CLI also includes each example's built-in name as a convenience. The host
75
72
  captures the initial directory and writes outputs outside it by default.
76
- Use `--config` for trusted JavaScript run configuration.
73
+ Use `--config ./config.ts` for trusted TypeScript run configuration.
77
74
 
78
75
  The model, executor and Sandbox environment variables are documented in
79
76
  [Quickstart](../docs/en/quickstart.md). Existing scoped variables remain
80
77
  fallbacks. Separate benchmarks take explicit configuration and fixtures.
81
78
  See [FATE](../benchmarks/fate/README.md) and [Lead–Worker Orders](../benchmarks/lead-worker-orders/README.md).
82
79
 
80
+ ## Export an editable Harness
81
+
82
+ ```sh
83
+ anys eject example --dir ./my-harness
84
+ cd my-harness
85
+ anys run ./harness.ts
86
+ ```
87
+
88
+ Edit `business.ts` and run it again to see your own result. Export includes the
89
+ complete source and an SDK archive dependency bound to that package's contents.
90
+ Run `npm install` to install that local archive when moving the export to another
91
+ machine. `anyswarm-source.json` records source revision, SDK source, content and
92
+ archive digests. Application teams register the same source manifest for
93
+ `anys eject code`, `anys eject autoresearch` and `anys eject super`.
94
+
83
95
  ## Smaller SDK tutorials
84
96
 
85
97
  | Example | Host entry | What to verify |
@@ -98,7 +110,7 @@ The [Service examples index](services/README.md) also links the optional
98
110
 
99
111
  Read the Host entry for Worker settings, the named registrations and each
100
112
  Profile’s grants. Follow the runner for Agent input, business checks and the
101
- close receipt. Each example's README gives its build, launch and evidence paths.
113
+ close receipt. Each example's README gives its launch and evidence paths.
102
114
 
103
115
  ## Repository boundaries
104
116
 
@@ -0,0 +1,24 @@
1
+ # Editable TypeScript Harness
2
+
3
+ Run this complete example with the installed AnySwarm CLI.
4
+
5
+ ```sh
6
+ anys run ./harness.ts
7
+ anys run ./harness.ts --config ./config.ts --prompt 'Create a greeting'
8
+ ```
9
+
10
+ Edit `business.ts` and run the command again to change the result. `harness.ts`
11
+ defines the Harness lifecycle, `business.ts` contains its rule, and `config.ts`
12
+ provides its default public configuration. This example uses no model or Sandbox.
13
+
14
+ `anys eject example --dir ./my-harness` exports these sources and a local SDK
15
+ archive. The generated package depends on that archive, so `npm install` retains
16
+ the exact candidate SDK. Direct `anys run` can also resolve the invoking CLI's SDK.
17
+ Use the same candidate CLI recorded in `anyswarm-source.json`.
18
+
19
+ Application authors use the same export mechanism by providing `eject.json` in
20
+ `examples/code`, `examples/autoresearch`, or `examples/super`. Its `apiVersion`
21
+ is `1`, `entry` names the runnable TS entry, and `files` explicitly lists every
22
+ relative source, prompt, Service, public config and README needed by that app.
23
+ Credentials, `.env`, runtime records, dependencies and build directories are
24
+ excluded by the engine. Exporting into a nonempty directory fails.
@@ -0,0 +1,2 @@
1
+ /** Edit this business rule and run harness.ts again. */
2
+ export declare function greeting(name: string): string;
@@ -0,0 +1,4 @@
1
+ /** Edit this business rule and run harness.ts again. */
2
+ export function greeting(name) {
3
+ return name ? `Hello, ${name}` : 'Hello from your TypeScript Harness';
4
+ }
@@ -0,0 +1,5 @@
1
+ /** Optional public author configuration. Keep credentials outside exported files. */
2
+ declare const _default: {
3
+ name: string;
4
+ };
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ /** Optional public author configuration. Keep credentials outside exported files. */
2
+ export default { name: '' };
@@ -0,0 +1,5 @@
1
+ {
2
+ "apiVersion": 1,
3
+ "entry": "harness.ts",
4
+ "files": ["harness.ts", "business.ts", "config.ts", "README.md"]
5
+ }
@@ -0,0 +1,4 @@
1
+ import type { Harness } from '@anyswarm/core';
2
+ /** A complete finite Harness with editable business logic and no external resources. */
3
+ declare const harness: Harness;
4
+ export default harness;
@@ -0,0 +1,19 @@
1
+ import { greeting } from './business.js';
2
+ import defaults from './config.js';
3
+ /** A complete finite Harness with editable business logic and no external resources. */
4
+ const harness = {
5
+ apiVersion: 1,
6
+ id: 'editable-typescript-example',
7
+ lifetimes: ['task'],
8
+ async run(context) {
9
+ context.markRunning();
10
+ const config = (context.configuration ?? defaults);
11
+ const message = greeting(config.name);
12
+ context.updateStatus({ business: { message } });
13
+ return {
14
+ outcome: 'completed', reason: 'greeting-created', result: { message }, artifacts: [],
15
+ export: { status: 'complete' }, cleanup: { status: 'complete' },
16
+ };
17
+ },
18
+ };
19
+ export default harness;
@@ -0,0 +1,33 @@
1
+ # AutoResearch
2
+
3
+ An AutoResearch Run starts equal peers in separate AnySwarm Sandboxes. Each peer chooses a direction, writes a patch, and can read, review and build on another peer's patch. The Harness provides the shared research Service and enforces the team's budget. A trusted evaluator decides whether a candidate is valid and returns the score used for selection.
4
+
5
+ ## FrontierCS-2 quickstart
6
+
7
+ Use a Linux x86-64 machine with Git LFS, Python 3, a local Docker daemon and an existing authenticated OpenSandbox deployment with `dns+nft` egress. Prepare a supported Pi Worker using the normal AnySwarm setup flow. Configure the existing Kimi K3 Responses route using `ANYSWARM_MODEL_URL`, `ANYSWARM_MODEL_TOKEN`, `ANYSWARM_MODEL_PROVIDER=kimi_proxy` and `ANYSWARM_MODEL_ID=k3`. Keep the token in trusted host configuration if your proxy requires one.
8
+
9
+ ```sh
10
+ anys -u autoresearch --cmd /prepare
11
+ anys -u autoresearch
12
+ ```
13
+
14
+ Preparation prints prerequisite checks and the resource plan. It reports K3 configuration and HTTP route reachability separately, and reports inference as not attempted. It fetches only the pinned task and shared dependencies, checks the Pumpkin release hash, builds images, completes an independent no-model reference run and checks the authorized submission role. Initial image builds can take several minutes. Rerunning preparation reuses verified materials and images. Reference records are environment evidence. The model receives a clean starter and only public train feedback.
15
+
16
+ Type `/demo frontiercs2` in the composer. The stream shows peer claims, submitted candidates, patch reads, reviews and train scores. When a candidate becomes available, eligible peers receive a prompt to read and review its exact version. The live Trace shows detailed research, peer messages and reviews. Use `@peer-2 <suggestion>`, `/interrupt peer-2` or `/stop peer-2` to control one peer. The Trace link serves the current Run on loopback. For a remote controller, forward its port over SSH. After the CLI exits, use the printed replay command.
17
+
18
+ For a script or pipe, use `anys -u autoresearch --cmd '/demo frontiercs2'`. The live Trace URL goes to stderr. Session events and the final result go to stdout as JSONL.
19
+
20
+ The default smoke budget is four Kimi K3 peers, a shared twelve-minute work window and eight train admissions. The demo records actual model usage without capping the request count. The application reserves additional time for final and cleanup. The result includes every frozen candidate, its hash and author, best candidate, Pumpkin record, final result and cleanup receipt. A valid candidate with a low score is a completed evaluation. A run without a valid candidate returns failure, even when it records an official zero for a selected invalid candidate.
21
+
22
+ ## Run your own project
23
+
24
+ ```sh
25
+ anys -u autoresearch --config ./research.ts "Your objective"
26
+ anys eject autoresearch --dir ./my-research
27
+ ```
28
+
29
+ The trusted TypeScript configuration exports a `ResearchConfiguration` object. Set `targetPath` relative to the invocation directory, `goal`, `direction` (`max` or `min`), optional `targetScore`, shared `budget` with an optional `maxModelRequests`, `model`, `executor`, `image`, `sandbox` and `connection`. The evaluator receives an immutable copy of the patch. Its `train(patch, signal, admitted)` returns `{valid, score, feedback}`. Call `admitted` with the trusted job identifier when one exists. `final(patch, signal)` returns the result of the independent final evaluation. The optional `start` and `close` own evaluator resources. All callbacks run as trusted host code. Run candidate code only inside an evaluator-owned isolated environment. Apply the patch to a fresh copy of the baseline, keep evaluator rules inaccessible to it and honor each supplied abort signal.
30
+
31
+ The exported `project.ts` is the editable Harness. Install its pinned SDK archive with `npm install` in the export directory, then run `anys -u ./project.ts --cwd /path/to/project --config ./research.ts "Your objective"`. The export includes the FrontierCS-2 adapter and preparation source. The installed CLI hosts the terminal and live Trace.
32
+
33
+ See [the requirements](REQUIREMENTS.zh.md).
@@ -0,0 +1,18 @@
1
+ # AutoResearch 需求
2
+
3
+ 用户配置目标、可信评测和总预算后,团队自动研究、评测、选择候选并收尾。流式终端显示认领方向、提交候选和 train 反馈,支持向单个成员发送建议、中断当前轮次和停止成员。实时 Trace 提供消息、复核、候选沿用和回执,结束后可回放。
4
+
5
+ FrontierCS-2 demo 固定 `7e48965c7cef2a567c2669c8e2f10b06386289c9` 的 `binary_fuse_filter` 和该版本的 Pumpkin。团队至少四名平级 AnySwarm Worker,同一次 Run 使用真实 `kimi_proxy/k3`,没有统一 Lead。成员自行认领研究方向、交流和选择沿用的成果。Harness 管理资源、共享预算与可信评测。demo 的研究窗口为 12 分钟,官方 train 额度为 8 次,记录模型请求数但不限制次数。官方 train 公开反馈进入看板,final 结果只写入用户记录。
6
+
7
+ ```sh
8
+ anys -u autoresearch --cmd /prepare
9
+ anys -u autoresearch --cmd "/demo frontiercs2"
10
+ anys -u autoresearch --config ./research.ts "研究目标"
11
+ anys eject autoresearch --dir ./my-research
12
+ ```
13
+
14
+ 验收从候选包开始。独立 reference 完成无模型 train/final。实际 demo 从干净 starter 开始,保存四路真实 K3 活动重叠的证据、至少一次可关联到具体候选的同行复核或采用,以及 Worker 候选、官方 train、最终保存、final 和资源回收的关联记录。记录全队的资源、模型用量与费用。未知回执和待清理资源保留可核对的标识。官方零分作为求解结果记录。
15
+
16
+ 在交互入口 `anys -u autoresearch` 也可输入 `/prepare` 和 `/demo frontiercs2`。
17
+
18
+ 范围以 [#337](https://github.com/AnySwarm/anyswarm/issues/337) 和随后确认的四成员、Agensh 式扁平协作、实时 Trace 为准。终端交互遵循 [#344](https://github.com/AnySwarm/anyswarm/issues/344)。
@@ -0,0 +1,51 @@
1
+ import { type ExecutorSelection, type ModelConfig, type RuntimeConnectionOptions, type SandboxConfig } from '@anyswarm/core';
2
+ import type { Evaluator } from './research-service.js';
3
+ export interface ResearchBudget {
4
+ workers: number;
5
+ workMs: number;
6
+ maxModelRequests?: number;
7
+ maxEvaluations: number;
8
+ }
9
+ export interface ResearchConfiguration {
10
+ targetPath?: string;
11
+ requiredFiles?: readonly string[];
12
+ goal: string;
13
+ direction: 'max' | 'min';
14
+ targetScore?: number;
15
+ budget: ResearchBudget;
16
+ evaluator: Evaluator;
17
+ executor: ExecutorSelection;
18
+ image: string;
19
+ model: ModelConfig;
20
+ sandbox: SandboxConfig;
21
+ connection: RuntimeConnectionOptions;
22
+ evaluationTimeoutMs?: number;
23
+ closeTimeoutMs?: number;
24
+ restrictNetwork?: boolean;
25
+ }
26
+ export declare const demoBudget: Readonly<ResearchBudget>;
27
+ export declare function frontierBudget(saved?: ResearchBudget): ResearchBudget;
28
+ export declare const demoGoal = "Solve the official FrontierCS-2 binary_fuse_filter task described in README.md. The 8-bit and 16-bit population routines in include/binaryfusefilter.h are stubs. Implement both routines and send a complete first patch to public train promptly. If a local C compiler is unavailable, use train for compile and correctness feedback. Then explore memory, construction or lookup performance. Change only include/, coordinate directly and review peers\u2019 patches against the official public train feedback.";
29
+ export declare const demoCloseTimeoutMs = 365000;
30
+ export declare function frontierHome(): string;
31
+ export declare function defaultResearchConnection(): {
32
+ executor: import("@anyswarm/core").ExecutorKind;
33
+ image: string;
34
+ sandbox: {
35
+ lifecycleBaseUrl: string;
36
+ apiKey: string | undefined;
37
+ useServerProxy: boolean | undefined;
38
+ egressMode: "dns+nft" | undefined;
39
+ resourceLimits: {
40
+ cpu: string;
41
+ memory: string;
42
+ };
43
+ };
44
+ connection: {
45
+ publicUrl: string | undefined;
46
+ advertiseHost: string | undefined;
47
+ };
48
+ };
49
+ export declare function kimiModel(): ModelConfig;
50
+ export declare function checkBudget(budget: ResearchBudget, minimum?: number): ResearchBudget;
51
+ export default undefined;
@@ -0,0 +1,57 @@
1
+ import { ProjectPreflightError, resolveSandboxConnection, workerImageFor } from '@anyswarm/core';
2
+ import { homedir } from 'node:os';
3
+ import { join, resolve } from 'node:path';
4
+ export const demoBudget = Object.freeze({
5
+ workers: 4, workMs: 720_000, maxEvaluations: 8,
6
+ });
7
+ export function frontierBudget(saved = demoBudget) {
8
+ const { workers, workMs, maxEvaluations } = saved;
9
+ return checkBudget({ workers, workMs, maxEvaluations }, 4);
10
+ }
11
+ export const demoGoal = 'Solve the official FrontierCS-2 binary_fuse_filter task described in README.md. The 8-bit and 16-bit population routines in include/binaryfusefilter.h are stubs. Implement both routines and send a complete first patch to public train promptly. If a local C compiler is unavailable, use train for compile and correctness feedback. Then explore memory, construction or lookup performance. Change only include/, coordinate directly and review peers’ patches against the official public train feedback.';
12
+ export const demoCloseTimeoutMs = 365_000;
13
+ export function frontierHome() {
14
+ return resolve(process.env.ANYSWARM_AUTORESEARCH_STATE_DIR ??
15
+ join(process.env.XDG_STATE_HOME ?? join(homedir(), '.local', 'state'), 'anyswarm', 'autoresearch', 'frontiercs2'));
16
+ }
17
+ export function defaultResearchConnection() {
18
+ const saved = resolveSandboxConnection({}, 'AUTORESEARCH');
19
+ return {
20
+ executor: saved.executor ?? 'pi',
21
+ image: saved.image ?? workerImageFor(saved.executor ?? 'pi'),
22
+ sandbox: {
23
+ lifecycleBaseUrl: saved.lifecycleBaseUrl, apiKey: saved.apiKey,
24
+ useServerProxy: saved.useServerProxy, egressMode: saved.egressMode,
25
+ resourceLimits: { cpu: '2', memory: '4Gi' },
26
+ },
27
+ connection: { publicUrl: saved.publicUrl, advertiseHost: saved.advertiseHost },
28
+ };
29
+ }
30
+ export function kimiModel() {
31
+ const url = process.env.ANYSWARM_MODEL_URL;
32
+ if (!url)
33
+ throw new ProjectPreflightError('AUTORESEARCH_MODEL_REQUIRED', 'Set ANYSWARM_MODEL_URL for the Kimi K3 route and ANYSWARM_MODEL_TOKEN if required by your proxy.');
34
+ const provider = process.env.ANYSWARM_MODEL_PROVIDER ?? 'kimi_proxy';
35
+ const model = process.env.ANYSWARM_MODEL_ID ?? 'k3';
36
+ if (provider !== 'kimi_proxy' || model !== 'k3') {
37
+ throw new ProjectPreflightError('AUTORESEARCH_K3_REQUIRED', 'Select the kimi_proxy/k3 model for the FrontierCS-2 demo.');
38
+ }
39
+ const endpoint = URL.canParse(url) ? new URL(url) : undefined;
40
+ if (!endpoint || !['http:', 'https:'].includes(endpoint.protocol) || endpoint.username || endpoint.password ||
41
+ endpoint.search || endpoint.hash || !endpoint.pathname.endsWith('/v1/responses')) {
42
+ throw new ProjectPreflightError('AUTORESEARCH_MODEL_URL_INVALID', 'Set ANYSWARM_MODEL_URL to a fixed HTTP(S) /v1/responses endpoint without credentials, query or fragment.');
43
+ }
44
+ const token = process.env.ANYSWARM_MODEL_TOKEN;
45
+ return { provider, model, upstream: { url: endpoint.href, headers: token ? { authorization: `Bearer ${token}` } : {} } };
46
+ }
47
+ export function checkBudget(budget, minimum = 1) {
48
+ const bounded = (value, min, max) => Number.isSafeInteger(value) && value >= min && value <= max;
49
+ if (!budget || !bounded(budget.workers, minimum, 8) || !bounded(budget.workMs, 10_000, 18_000_000) ||
50
+ !bounded(budget.maxEvaluations, 1, 100) ||
51
+ (budget.maxModelRequests !== undefined && !bounded(budget.maxModelRequests, budget.workers, 10_000))) {
52
+ throw new ProjectPreflightError('AUTORESEARCH_BUDGET_INVALID', 'Set a valid shared worker, time and evaluation budget, and a valid model-request cap if supplied.');
53
+ }
54
+ const { workers, workMs, maxEvaluations, maxModelRequests } = budget;
55
+ return { workers, workMs, maxEvaluations, ...(maxModelRequests === undefined ? {} : { maxModelRequests }) };
56
+ }
57
+ export default undefined;
@@ -0,0 +1,11 @@
1
+ import type { JsonValue } from '@anyswarm/core';
2
+ import { type ResearchConfiguration } from './config.js';
3
+ export declare function frontierTrainEvaluation(returned: Record<string, unknown>): {
4
+ valid: boolean;
5
+ score: number | null;
6
+ feedback: JsonValue;
7
+ };
8
+ export declare function frontierDemo(): Promise<{
9
+ configuration: ResearchConfiguration;
10
+ starter: string;
11
+ }>;
@@ -0,0 +1,52 @@
1
+ import { join } from 'node:path';
2
+ import { defaultResearchConnection, demoCloseTimeoutMs, demoGoal, kimiModel } from './config.js';
3
+ import { FrontierRun, frontierFinalTimeMs, frontierSubmission, judgeTimeMs } from './frontiercs2.js';
4
+ import { loadPrepared, resourcePlan } from './prepare.js';
5
+ export function frontierTrainEvaluation(returned) {
6
+ const observed = returned.raw_score;
7
+ const score = typeof observed === 'number' && Number.isFinite(observed) ? observed : null;
8
+ return {
9
+ // This task's valid benchmark score is strictly positive. Some construction
10
+ // failures return only a zero score and omit both failure and rejected.
11
+ valid: score !== null && score > 0 && !returned.rejected && !returned.failure,
12
+ score,
13
+ feedback: returned,
14
+ };
15
+ }
16
+ export async function frontierDemo() {
17
+ const ready = await loadPrepared().catch(() => { throw new Error('Prepare the pinned demo first with anys -u autoresearch --cmd /prepare.'); });
18
+ const { budget, paths, saved, starter } = ready;
19
+ const defaults = defaultResearchConnection();
20
+ const model = kimiModel();
21
+ let frontier;
22
+ const configuration = {
23
+ ...defaults, model, restrictNetwork: true, goal: demoGoal, direction: 'max', budget,
24
+ sandbox: { ...defaults.sandbox, timeoutSeconds: Math.ceil((budget.workMs + demoCloseTimeoutMs) / 1000) + 60 },
25
+ targetPath: starter,
26
+ requiredFiles: ['README.md', 'include/binaryfusefilter.h'],
27
+ evaluationTimeoutMs: judgeTimeMs + 25_000,
28
+ closeTimeoutMs: demoCloseTimeoutMs,
29
+ evaluator: {
30
+ async start(directory, signal) {
31
+ frontier = new FrontierRun(paths, join(directory, 'pumpkin'));
32
+ await frontier.start(Math.ceil((budget.workMs + frontierFinalTimeMs) / 1000), signal);
33
+ if (frontier.imageId !== saved.bridgeImage || JSON.stringify(frontier.judges) !== JSON.stringify(saved.judges)) {
34
+ throw new Error('Pumpkin image identity changed after preparation');
35
+ }
36
+ },
37
+ async train(patch, signal, admitted) {
38
+ const receipt = await frontier.train(frontierSubmission(patch), signal, admitted);
39
+ return frontierTrainEvaluation(receipt.returned);
40
+ },
41
+ async final(patch, signal) {
42
+ return await frontier.finish(frontierSubmission(patch), signal);
43
+ },
44
+ async close() { return frontier ? await frontier.close() : 'complete'; },
45
+ evidence() {
46
+ return { reference: saved.referenceRecord, record: frontier?.record ?? null, bridgeImage: frontier?.imageId ?? null, judges: frontier?.judges ?? null,
47
+ benchmark: saved.revision, pumpkin: saved.pumpkin, resources: resourcePlan(budget) };
48
+ },
49
+ },
50
+ };
51
+ return { configuration, starter };
52
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "apiVersion": 1,
3
+ "entry": "project.ts",
4
+ "files": [
5
+ "README.md",
6
+ "REQUIREMENTS.zh.md",
7
+ "project.ts",
8
+ "config.ts",
9
+ "research-service.ts",
10
+ "demo.ts",
11
+ "prepare.ts",
12
+ "frontiercs2.ts",
13
+ "process.ts"
14
+ ]
15
+ }
@@ -0,0 +1,87 @@
1
+ export declare const frontierRevision = "7e48965c7cef2a567c2669c8e2f10b06386289c9";
2
+ export declare const pumpkinPin = "2026-11-30 ca3ce7ae0da5616464b00ee7962aecac0fc0b38d a1bb9c633f1f700ea42bceb9cd9512f684e9063d3a8ae6c9485526a1dd68016f";
3
+ export declare const frontierTask = "tasks/binary_fuse_filter/task.star";
4
+ export declare const submissionLimit: number;
5
+ export declare const judgeTimeMs = 190000;
6
+ export declare const frontierFinalTimeMs = 250000;
7
+ export declare function digest(bytes: Uint8Array | string): string;
8
+ export declare function frontierSubmission(patch: Uint8Array): Buffer;
9
+ export declare const bridgeDockerfile = "FROM ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852\n";
10
+ export declare function bridgeWorkflow(source: string): string;
11
+ interface Submission {
12
+ payload: {
13
+ digest: string;
14
+ size: number;
15
+ };
16
+ finalized: boolean;
17
+ }
18
+ interface Outcome {
19
+ state?: string;
20
+ agents?: {
21
+ role: string;
22
+ submission: Submission | null;
23
+ }[];
24
+ verdict?: {
25
+ kind: string;
26
+ result?: {
27
+ values: {
28
+ name: string;
29
+ value: unknown;
30
+ }[];
31
+ };
32
+ };
33
+ usage?: unknown;
34
+ driver?: unknown;
35
+ }
36
+ export type JudgeImages = {
37
+ train_judge: string;
38
+ final_judge: string;
39
+ };
40
+ export declare function judgeImages(record: string): Promise<JudgeImages>;
41
+ export interface FrontierPaths {
42
+ source: string;
43
+ config: string;
44
+ dockerContext: string;
45
+ cache: string;
46
+ }
47
+ export declare class FrontierRun {
48
+ readonly paths: FrontierPaths;
49
+ readonly runs: string;
50
+ id?: string;
51
+ container?: string;
52
+ imageId?: string;
53
+ judges?: JudgeImages;
54
+ private closed;
55
+ constructor(paths: FrontierPaths, runs: string);
56
+ private pumpkin;
57
+ private docker;
58
+ get record(): string | undefined;
59
+ start(seconds: number, signal: AbortSignal, timeoutMs?: number): Promise<void>;
60
+ private call;
61
+ train(bytes: Uint8Array, signal: AbortSignal, onAdmission: (job: number) => void): Promise<{
62
+ job: number;
63
+ returned: Record<string, unknown>;
64
+ }>;
65
+ finish(bytes: Uint8Array, signal: AbortSignal): Promise<{
66
+ record: string;
67
+ submission: Submission;
68
+ verdict: {
69
+ kind: string;
70
+ result?: {
71
+ values: {
72
+ name: string;
73
+ value: unknown;
74
+ }[];
75
+ };
76
+ };
77
+ usage: {} | null;
78
+ driver: {} | null;
79
+ }>;
80
+ outcome(signal: AbortSignal): Promise<{
81
+ outcome: Outcome;
82
+ record: string;
83
+ }>;
84
+ close(): Promise<'complete' | 'pending'>;
85
+ }
86
+ export declare function installBridge(source: string): Promise<void>;
87
+ export {};