@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
@@ -0,0 +1,189 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { constants } from 'node:fs';
3
+ import { lstat, mkdir, open, rename, rm, writeFile } from 'node:fs/promises';
4
+ import { homedir } from 'node:os';
5
+ import { dirname, extname, isAbsolute, join, resolve } from 'node:path';
6
+ import { loadAnySwarmConfig } from '../src/core/sandbox/sandbox-connection.js';
7
+ import { selectExecutorDriver } from '../src/core/sandbox/executor-driver.js';
8
+ import { builtinConfiguration, builtins } from './anyswarm-harnesses.js';
9
+ import { runLocalCommand } from './local-setup.js';
10
+ const timerMax = 2_147_483_647;
11
+ const runtimeBudgets = [
12
+ { key: 'workTimeoutMs', max: timerMax },
13
+ { key: 'closeTimeoutMs', max: timerMax },
14
+ ];
15
+ const budgets = {
16
+ subagents: [...runtimeBudgets, { key: 'questionTimeoutMs', max: 120_000 }],
17
+ taskpool: runtimeBudgets,
18
+ peermesh: [{ key: 'durationMs', max: 86_400_000 }],
19
+ substrate: [...runtimeBudgets, { key: 'turnTimeoutMs', max: timerMax }],
20
+ 'lead-worker': [runtimeBudgets[0], { key: 'closeTimeoutMs', max: 60_000 },
21
+ { key: 'turnTimeoutMs', max: timerMax }],
22
+ notes: [{ key: 'turnTimeoutMs', max: timerMax }, runtimeBudgets[1]],
23
+ messages: [{ key: 'workTimeoutMs', max: timerMax },
24
+ { key: 'cleanupTimeoutMs', max: timerMax }],
25
+ };
26
+ function builtin(name) {
27
+ return Object.hasOwn(builtins, name);
28
+ }
29
+ export function terminalObject(value) {
30
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
31
+ }
32
+ const preferencesPath = () => resolve(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'anyswarm', 'launcher.json');
33
+ async function readPreference(path) {
34
+ let handle;
35
+ try {
36
+ handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
37
+ }
38
+ catch (error) {
39
+ if (error.code === 'ENOENT')
40
+ return;
41
+ throw error;
42
+ }
43
+ try {
44
+ const file = await handle.stat();
45
+ if (!file.isFile() || file.size > 8192 || (file.mode & 0o077) !== 0 ||
46
+ (process.getuid && file.uid !== process.getuid()))
47
+ throw new Error('Launcher preferences must be an owner-only file');
48
+ const data = Buffer.alloc(8193);
49
+ const { bytesRead } = await handle.read(data, 0, data.length, 0);
50
+ if (bytesRead > 8192)
51
+ throw new Error('Launcher preferences exceed 8 KiB');
52
+ const pref = terminalObject(JSON.parse(data.subarray(0, bytesRead).toString('utf8')));
53
+ if (pref.version !== 1 || typeof pref.harness !== 'string' || typeof pref.configPath !== 'string' ||
54
+ !isAbsolute(pref.configPath) || Object.keys(pref).length !== 3) {
55
+ throw new Error('Invalid launcher preferences. Select a trusted configuration or forget the saved preference.');
56
+ }
57
+ return pref;
58
+ }
59
+ finally {
60
+ await handle.close();
61
+ }
62
+ }
63
+ export class LauncherConfiguration {
64
+ harness;
65
+ specifier;
66
+ launchDirectory;
67
+ workspace;
68
+ preferencePath = preferencesPath();
69
+ isBuiltin;
70
+ source = 'environment';
71
+ path;
72
+ preference;
73
+ preferenceError;
74
+ error;
75
+ configuration;
76
+ diagnostics;
77
+ choice;
78
+ constructor(harness, specifier, launchDirectory, cwd, path, choice) {
79
+ this.harness = harness;
80
+ this.specifier = specifier;
81
+ this.launchDirectory = launchDirectory;
82
+ this.workspace = resolve(launchDirectory, cwd ?? '.');
83
+ this.isBuiltin = builtin(specifier);
84
+ this.choice = choice ?? (path ? { path: resolve(launchDirectory, path), source: '--config' } : undefined);
85
+ }
86
+ selectedChoice() { return this.choice; }
87
+ async refresh() {
88
+ this.diagnostics = undefined;
89
+ this.preference = undefined;
90
+ this.preferenceError = undefined;
91
+ this.configuration = undefined;
92
+ this.error = undefined;
93
+ try {
94
+ this.preference = await readPreference(this.preferencePath);
95
+ }
96
+ catch {
97
+ this.preferenceError = 'Cannot use launcher preferences. Select a trusted configuration or forget the preference.';
98
+ }
99
+ const remembered = this.preference?.harness === this.harness ? this.preference : undefined;
100
+ this.path = this.choice ? this.choice.path : remembered?.configPath;
101
+ this.source = this.choice?.source ?? (remembered ? 'remembered' : this.isBuiltin ? 'environment' : 'Harness defaults');
102
+ if (!this.choice && this.preferenceError) {
103
+ this.error = this.preferenceError;
104
+ return;
105
+ }
106
+ try {
107
+ if (this.path && !['.ts', '.mts', '.cts', '.mjs', '.js'].includes(extname(this.path))) {
108
+ this.error = 'Choose an explicit trusted TypeScript or ESM module.';
109
+ return;
110
+ }
111
+ const value = this.path ? await loadAnySwarmConfig(this.path)
112
+ : builtin(this.specifier) ? await builtinConfiguration(this.specifier) : undefined;
113
+ if (value === undefined && !this.path)
114
+ return;
115
+ if (value === null || Array.isArray(value) || typeof value !== 'object' ||
116
+ ['cwd', 'prompt', 'input', 'workload'].some(field => Object.hasOwn(value, field))) {
117
+ this.error = 'The configuration must export an object without cwd, prompt, input or workload fields.';
118
+ return;
119
+ }
120
+ this.configuration = { ...value };
121
+ if (Object.hasOwn(budgets, this.specifier))
122
+ this.validateRuntime();
123
+ }
124
+ catch (error) {
125
+ const requirements = /^Set ([A-Z0-9_]+(?: or [A-Z0-9_]+)*) /.exec(error instanceof Error ? error.message : '');
126
+ this.error = !this.path && requirements ? 'Set ' + requirements[1] : this.path
127
+ ? 'Could not load the trusted module. Check its path, exported configuration and adjacent .env.'
128
+ : 'Set the model endpoint and Sandbox connection environment, or select a trusted configuration.';
129
+ }
130
+ }
131
+ validateRuntime() {
132
+ const config = this.configuration;
133
+ if (!config.sandbox || !config.models || typeof config.image !== 'string' || !config.image) {
134
+ this.error = 'This Harness requires sandbox, models and a Worker image. Use /config to select a trusted configuration or run setup.';
135
+ return;
136
+ }
137
+ try {
138
+ selectExecutorDriver(config.executor);
139
+ }
140
+ catch {
141
+ this.error = 'The selected executor is not configured. Run anys setup --backend pi or --backend codex.';
142
+ }
143
+ const invalid = budgets[this.specifier].find(({ key, max }) => {
144
+ const value = config[key];
145
+ return value !== undefined && (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1 || value > max);
146
+ });
147
+ if (invalid && !this.error)
148
+ this.error = invalid.key + ' must be between 1 and ' + invalid.max + ' ms.';
149
+ }
150
+ select(path) {
151
+ this.choice = path.trim() ? { path: resolve(this.launchDirectory, path.trim()), source: 'selected for this launch' } :
152
+ { source: this.isBuiltin ? 'environment (selected)' : 'Harness defaults (selected)' };
153
+ return this.refresh();
154
+ }
155
+ async remember() {
156
+ if (!this.path || !this.configuration || this.error)
157
+ throw new Error('Select a valid trusted configuration first.');
158
+ await mkdir(dirname(this.preferencePath), { recursive: true, mode: 0o700 });
159
+ const preference = { version: 1, harness: this.harness, configPath: this.path };
160
+ const temporary = this.preferencePath + '.' + randomUUID();
161
+ try {
162
+ await writeFile(temporary, JSON.stringify(preference) + '\n', { mode: 0o600, flag: 'wx' });
163
+ await rename(temporary, this.preferencePath);
164
+ this.preference = preference;
165
+ this.preferenceError = undefined;
166
+ }
167
+ finally {
168
+ await rm(temporary, { force: true });
169
+ }
170
+ }
171
+ async forget() {
172
+ if (await lstat(this.preferencePath).then(() => true, error => {
173
+ if (error.code !== 'ENOENT')
174
+ throw error;
175
+ return false;
176
+ }))
177
+ await rm(this.preferencePath);
178
+ await this.refresh();
179
+ }
180
+ async diagnose(prepare, signal, progress, backend) {
181
+ if (this.path && !this.configuration)
182
+ throw new Error('Fix the selected configuration before using setup or doctor.');
183
+ const command = prepare ? { command: 'setup', configPath: this.path, backend } : { command: 'doctor', smoke: false, configPath: this.path };
184
+ const report = await runLocalCommand(command, signal, progress);
185
+ if (prepare && report.ok && !this.path)
186
+ await this.refresh();
187
+ this.diagnostics = report;
188
+ }
189
+ }
@@ -0,0 +1,66 @@
1
+ import type { HarnessEvent, HarnessQuestion, HarnessRequest, HarnessResult, HarnessSession, HarnessState } from '../src/harness/project-harness.js';
2
+ type Message = {
3
+ order: number;
4
+ agentId: string;
5
+ id: string;
6
+ role: string;
7
+ blocks: Map<number, string>;
8
+ hidden: boolean;
9
+ complete: boolean;
10
+ truncated: boolean;
11
+ };
12
+ type Activity = {
13
+ order: number;
14
+ agentId: string;
15
+ event: string;
16
+ summary?: string;
17
+ };
18
+ type Mutation = {
19
+ payload: unknown;
20
+ request: HarnessRequest;
21
+ send: (request: HarnessRequest) => Promise<unknown>;
22
+ status: 'pending' | 'unknown' | 'confirmed' | 'failed';
23
+ receipt?: unknown;
24
+ };
25
+ export declare function formatSessionError(error: unknown): string;
26
+ export declare class TerminalSession {
27
+ readonly session: HarnessSession;
28
+ private readonly update;
29
+ state?: HarnessState;
30
+ revision: number;
31
+ result?: HarnessResult;
32
+ readonly questions: Map<string, HarnessQuestion>;
33
+ readonly messages: Map<string, Message>;
34
+ readonly activity: Map<string, Activity>;
35
+ readonly operations: Map<string, Mutation>;
36
+ readonly observations: Map<string, {
37
+ pending: boolean;
38
+ result?: unknown;
39
+ error?: string;
40
+ }>;
41
+ subscribing: boolean;
42
+ observationLost: boolean;
43
+ workerHistoryLost: boolean;
44
+ runtimeObservationLost: boolean;
45
+ truncated: boolean;
46
+ lastError?: string;
47
+ private unsubscribe?;
48
+ private resubscribe?;
49
+ private closed;
50
+ private anonymousActivity;
51
+ private reading;
52
+ constructor(session: HarnessSession, update: () => void);
53
+ close(): void;
54
+ private subscribe;
55
+ private subscriptionFailed;
56
+ consume(event: HarnessEvent): void;
57
+ private restoreMessage;
58
+ private message;
59
+ private finishMessage;
60
+ private observe;
61
+ private rememberActivity;
62
+ mutate(key: string, payload: unknown, send: (request: HarnessRequest) => Promise<unknown>): Promise<unknown>;
63
+ retry(key: string): Promise<unknown> | undefined;
64
+ read(key: string, query: () => Promise<unknown>): Promise<void>;
65
+ }
66
+ export {};
@@ -0,0 +1,304 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { isDeepStrictEqual } from 'node:util';
3
+ import { terminalObject } from './anyswarm-tui-config.js';
4
+ function unresolvedHarnessReceipt(value) {
5
+ const receipt = terminalObject(value);
6
+ const core = terminalObject(receipt.core ?? receipt.result);
7
+ return receipt.status === 'unknown' || core.status === 'unknown' || receipt.disposition === 'unknown' || core.disposition === 'unknown' || core.cleanup === 'pending' || terminalObject(receipt.harnessEffects).status === 'pending';
8
+ }
9
+ const messageLimit = 96;
10
+ const activityLimit = 100;
11
+ const contentLimit = 16_384;
12
+ const maxPending = 64;
13
+ const readTimeoutMs = 8_000;
14
+ export function formatSessionError(error) {
15
+ const { code, message } = terminalObject(error);
16
+ const detail = typeof message === 'string' ? message.slice(0, 1024) : 'The request failed.';
17
+ return typeof code === 'string' ? code + ' ' + detail : detail;
18
+ }
19
+ function boundedMap(map, key, value, max) {
20
+ map.set(key, value);
21
+ if (map.size > max)
22
+ map.delete(map.keys().next().value);
23
+ }
24
+ function messageText(message) {
25
+ if (typeof message.content === 'string')
26
+ return message.content.slice(0, contentLimit);
27
+ if (!Array.isArray(message.content))
28
+ return '';
29
+ let text = '';
30
+ for (const part of message.content.slice(0, 64)) {
31
+ const { type, text: block, name } = terminalObject(part);
32
+ if (type === 'text' && typeof block === 'string')
33
+ text += block;
34
+ if (type === 'toolCall' && typeof name === 'string')
35
+ text += '\nTool ' + name;
36
+ if (text.length >= contentLimit)
37
+ break;
38
+ }
39
+ return text.slice(0, contentLimit);
40
+ }
41
+ export class TerminalSession {
42
+ session;
43
+ update;
44
+ state;
45
+ revision = 0;
46
+ result;
47
+ questions = new Map();
48
+ messages = new Map();
49
+ activity = new Map();
50
+ operations = new Map();
51
+ observations = new Map();
52
+ subscribing = true;
53
+ observationLost = false;
54
+ workerHistoryLost = false;
55
+ runtimeObservationLost = false;
56
+ truncated = false;
57
+ lastError;
58
+ unsubscribe;
59
+ resubscribe;
60
+ closed = false;
61
+ anonymousActivity = 0;
62
+ reading = 0;
63
+ constructor(session, update) {
64
+ this.session = session;
65
+ this.update = update;
66
+ this.subscribe();
67
+ }
68
+ close() {
69
+ this.closed = true;
70
+ clearTimeout(this.resubscribe);
71
+ this.unsubscribe?.();
72
+ }
73
+ subscribe() {
74
+ this.unsubscribe = this.session.onEvent(event => {
75
+ if (this.closed)
76
+ return;
77
+ try {
78
+ this.consume(event);
79
+ }
80
+ catch (error) {
81
+ this.subscriptionFailed(error);
82
+ }
83
+ this.update();
84
+ }, { initialSnapshot: true, onError: error => this.subscriptionFailed(error) });
85
+ }
86
+ subscriptionFailed(error) {
87
+ if (this.closed)
88
+ return;
89
+ this.subscribing = true;
90
+ this.observationLost = true;
91
+ this.lastError = formatSessionError(error);
92
+ this.update();
93
+ if (this.resubscribe)
94
+ return;
95
+ this.resubscribe = setTimeout(() => {
96
+ this.resubscribe = undefined;
97
+ this.unsubscribe?.();
98
+ try {
99
+ this.subscribe();
100
+ }
101
+ catch (error) {
102
+ this.subscriptionFailed(error);
103
+ }
104
+ }, 250);
105
+ this.resubscribe.unref();
106
+ }
107
+ consume(event) {
108
+ switch (event.type) {
109
+ case 'snapshot':
110
+ case 'state':
111
+ if (this.state?.phase !== event.state.phase) {
112
+ this.revision++;
113
+ this.rememberActivity('', 'Run', { phase: event.state.phase });
114
+ }
115
+ this.state = event.state;
116
+ this.truncated ||= event.state.snapshotTruncated === true;
117
+ if (event.type === 'snapshot') {
118
+ this.subscribing = false;
119
+ this.messages.clear();
120
+ this.questions.clear();
121
+ for (const message of event.state.output)
122
+ this.restoreMessage(message);
123
+ }
124
+ for (const question of event.state.questions)
125
+ boundedMap(this.questions, question.questionId, question, 96);
126
+ if (event.state.result)
127
+ this.result = event.state.result;
128
+ break;
129
+ case 'question':
130
+ boundedMap(this.questions, event.question.questionId, event.question, 96);
131
+ break;
132
+ case 'result':
133
+ this.result = event.result;
134
+ for (const question of event.result.questions ?? [])
135
+ boundedMap(this.questions, question.questionId, question, 96);
136
+ break;
137
+ case 'event':
138
+ this.revision++;
139
+ this.observe(event.event);
140
+ break;
141
+ case 'operation':
142
+ for (const operation of this.operations.values()) {
143
+ if (operation.request.requestId === event.requestId && operation.status !== 'pending') {
144
+ operation.receipt = event.result;
145
+ operation.status = unresolvedHarnessReceipt(event.result) ? 'unknown' : 'confirmed';
146
+ }
147
+ }
148
+ break;
149
+ }
150
+ }
151
+ restoreMessage(value) {
152
+ const record = terminalObject(value);
153
+ if (typeof record.messageId !== 'string' || typeof record.agentId !== 'string')
154
+ return;
155
+ const message = this.message(record.agentId, record.messageId);
156
+ if (record.complete)
157
+ this.finishMessage(message, record.message);
158
+ else if (Array.isArray(record.blocks)) {
159
+ for (const entry of record.blocks.slice(0, 64)) {
160
+ if (Array.isArray(entry) && Number.isSafeInteger(entry[0]) && typeof entry[1] === 'string') {
161
+ message.blocks.set(entry[0], entry[1].slice(-contentLimit));
162
+ }
163
+ }
164
+ }
165
+ else if (typeof record.text === 'string')
166
+ message.blocks.set(0, record.text.slice(-contentLimit));
167
+ message.truncated ||= record.truncated === true;
168
+ }
169
+ message(agentId, id) {
170
+ const key = JSON.stringify([agentId, id]);
171
+ let current = this.messages.get(key);
172
+ if (!current) {
173
+ if (this.messages.size >= messageLimit)
174
+ this.truncated = true;
175
+ current = { order: this.revision, agentId, id, role: 'assistant', blocks: new Map(), hidden: false, complete: false, truncated: false };
176
+ boundedMap(this.messages, key, current, messageLimit);
177
+ }
178
+ return current;
179
+ }
180
+ finishMessage(message, raw) {
181
+ const final = terminalObject(raw);
182
+ message.complete = true;
183
+ message.hidden = final.display === false;
184
+ message.role = typeof final.role === 'string' ? final.role : message.role;
185
+ if (final.truncated === true) {
186
+ message.truncated = true;
187
+ return;
188
+ }
189
+ message.blocks.clear();
190
+ if (!message.hidden)
191
+ message.blocks.set(0, messageText(final));
192
+ }
193
+ observe(raw) {
194
+ const item = terminalObject(raw);
195
+ const event = item.kind === 'agent' ? terminalObject(item.event) : item;
196
+ const author = event.agentId ?? event.agent ?? event.role;
197
+ const agentId = typeof author === 'string' ? author : '';
198
+ const eventName = String(event.type ?? item.kind ?? 'event');
199
+ if (event.type === 'subscriberGap')
200
+ this.runtimeObservationLost = true;
201
+ if (event.type === 'error' &&
202
+ /worker event history has a gap/i.test(String(terminalObject(event.error).message)))
203
+ this.workerHistoryLost = true;
204
+ if (event.type !== 'session') {
205
+ if (!['output', 'workerProbe'].includes(eventName))
206
+ this.rememberActivity(agentId, eventName, typeof raw === 'string' ? { text: raw } : event);
207
+ return;
208
+ }
209
+ const session = terminalObject(event.event);
210
+ const name = String(session.type ?? 'event');
211
+ if (typeof session.messageId === 'string') {
212
+ const message = this.message(agentId, session.messageId);
213
+ if (name === 'messageStart') {
214
+ if (typeof session.role === 'string')
215
+ message.role = session.role;
216
+ message.hidden = session.display === false;
217
+ }
218
+ if (name === 'messageEnd')
219
+ this.finishMessage(message, session.message);
220
+ if (name === 'textDelta' && !message.complete && typeof session.delta === 'string') {
221
+ const index = Number.isSafeInteger(session.blockIndex) ? Number(session.blockIndex) : 0;
222
+ const text = (message.blocks.get(index) ?? '') + session.delta;
223
+ message.truncated ||= text.length > contentLimit || message.blocks.size >= 64;
224
+ boundedMap(message.blocks, index, text.slice(-contentLimit), 64);
225
+ }
226
+ return;
227
+ }
228
+ this.rememberActivity(agentId, name, session);
229
+ }
230
+ rememberActivity(agentId, event, detail) {
231
+ const toolKey = typeof detail.toolCallId === 'string' ? JSON.stringify([agentId, detail.toolCallId]) : undefined;
232
+ const text = [detail.summary, detail.message, detail.text, detail.toolName, detail.phase, detail.state, detail.status]
233
+ .find((value) => typeof value === 'string');
234
+ const summary = text?.slice(0, 1024).replace(/\s+/g, ' ').slice(0, 280);
235
+ boundedMap(this.activity, toolKey ?? String(this.anonymousActivity++), {
236
+ order: this.revision, agentId, event: event.slice(0, 128), summary,
237
+ }, activityLimit);
238
+ }
239
+ async mutate(key, payload, send) {
240
+ const previous = this.operations.get(key);
241
+ if (previous?.status === 'pending')
242
+ return;
243
+ const retry = previous?.status === 'unknown' && isDeepStrictEqual(previous.payload, payload);
244
+ const preservePrevious = !retry && previous?.status === 'unknown';
245
+ if ((!this.operations.has(key) || preservePrevious) && this.operations.size >= maxPending) {
246
+ const settled = [...this.operations].find(([, item]) => item.status === 'confirmed' || item.status === 'failed');
247
+ if (!settled)
248
+ throw new Error('Operation limit reached. Resolve an unknown operation before sending more.');
249
+ this.operations.delete(settled[0]);
250
+ }
251
+ if (preservePrevious)
252
+ this.operations.set(key + ':' + previous.request.requestId, previous);
253
+ const operation = retry ? previous : { payload, request: { requestId: randomUUID() }, send, status: 'pending' };
254
+ operation.status = 'pending';
255
+ this.operations.set(key, operation);
256
+ this.update();
257
+ try {
258
+ const receipt = await operation.send(operation.request);
259
+ operation.receipt = receipt;
260
+ operation.status = unresolvedHarnessReceipt(receipt) ? 'unknown' : 'confirmed';
261
+ return receipt;
262
+ }
263
+ catch (error) {
264
+ const { code } = terminalObject(error);
265
+ operation.status = ['RPC_TIMEOUT', 'RPC_DISCONNECTED', 'OPERATION_UNKNOWN'].includes(String(code)) ? 'unknown' : 'failed';
266
+ operation.receipt = formatSessionError(error);
267
+ throw error;
268
+ }
269
+ finally {
270
+ if (!this.closed)
271
+ this.update();
272
+ }
273
+ }
274
+ retry(key) {
275
+ const operation = this.operations.get(key);
276
+ if (operation?.status !== 'unknown')
277
+ return;
278
+ return this.mutate(key, operation.payload, operation.send);
279
+ }
280
+ async read(key, query) {
281
+ if (this.observations.get(key)?.pending || this.reading >= 4)
282
+ return;
283
+ this.reading++;
284
+ boundedMap(this.observations, key, { pending: true }, 20);
285
+ this.update();
286
+ let timer;
287
+ const running = Promise.resolve().then(query);
288
+ void running.finally(() => { this.reading--; }).catch(() => { });
289
+ try {
290
+ const result = await Promise.race([running, new Promise((_, reject) => {
291
+ timer = setTimeout(() => reject(new Error('Read timed out')), readTimeoutMs);
292
+ })]);
293
+ boundedMap(this.observations, key, { pending: false, result }, 20);
294
+ }
295
+ catch (error) {
296
+ boundedMap(this.observations, key, { pending: false, error: formatSessionError(error) }, 20);
297
+ }
298
+ finally {
299
+ clearTimeout(timer);
300
+ if (!this.closed)
301
+ this.update();
302
+ }
303
+ }
304
+ }
@@ -0,0 +1,41 @@
1
+ import { type Terminal } from '@earendil-works/pi-tui';
2
+ export declare function terminalText(value: string): string;
3
+ export declare class AnySwarmTerminal implements Terminal {
4
+ private readonly pasteRejected;
5
+ readonly kittyProtocolActive = false;
6
+ private readonly input;
7
+ private readonly stdout;
8
+ private readonly transport;
9
+ private readonly decoder;
10
+ private readonly keys;
11
+ private resize?;
12
+ private inputCallback?;
13
+ private raw?;
14
+ private paused;
15
+ private partial;
16
+ private partialTimer?;
17
+ enableRawMode(): void;
18
+ get enabled(): boolean;
19
+ private paste?;
20
+ private pasteBytes;
21
+ private surrogate;
22
+ constructor(pasteRejected: () => void);
23
+ start(onInput: (data: string) => void, onResize: () => void): void;
24
+ stop(): void;
25
+ private data;
26
+ get columns(): number;
27
+ get rows(): number;
28
+ write(data: string): void;
29
+ restoreDisplay(): void;
30
+ drained(): Promise<void>;
31
+ drainInput(): Promise<void>;
32
+ moveBy(lines: number): void;
33
+ hideCursor(): void;
34
+ showCursor(): void;
35
+ clearLine(): void;
36
+ clearFromCursor(): void;
37
+ clearScreen(): void;
38
+ setTitle(): void;
39
+ setProgress(): void;
40
+ setProgramStatus(): void;
41
+ }