@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37

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 (522) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/README.md +417 -219
  3. package/dist/adapters.d.ts +12 -2
  4. package/dist/adapters.js +27 -2
  5. package/dist/agent-rows.d.ts +2 -1
  6. package/dist/agents-store.d.ts +2 -0
  7. package/dist/agents-store.js +9 -4
  8. package/dist/api-only.d.ts +2 -1
  9. package/dist/api-only.js +3 -1
  10. package/dist/archil-routes.d.ts +40 -7
  11. package/dist/archil-routes.js +167 -54
  12. package/dist/archil-settings.d.ts +79 -7
  13. package/dist/archil-settings.js +140 -14
  14. package/dist/attach-conformance-cli.d.ts +1 -0
  15. package/dist/attach-conformance-cli.js +18 -0
  16. package/dist/attach-conformance.d.ts +25 -0
  17. package/dist/attach-conformance.js +343 -0
  18. package/dist/attach-images.d.ts +15 -0
  19. package/dist/attach-images.js +59 -0
  20. package/dist/background.d.ts +0 -6
  21. package/dist/background.js +0 -28
  22. package/dist/box-image.d.ts +1 -97
  23. package/dist/box-image.js +4 -284
  24. package/dist/box-paths.d.ts +2 -7
  25. package/dist/box-paths.js +7 -13
  26. package/dist/box-settings.d.ts +0 -11
  27. package/dist/box-settings.js +4 -29
  28. package/dist/browser-commands.js +1 -1
  29. package/dist/browser-computer.d.ts +47 -3
  30. package/dist/browser-computer.js +286 -18
  31. package/dist/browser-cost.d.ts +1 -1
  32. package/dist/browser-live.d.ts +20 -8
  33. package/dist/browser-live.js +50 -27
  34. package/dist/browser-person.d.ts +19 -2
  35. package/dist/browser-person.js +55 -6
  36. package/dist/browser-wait-ended.d.ts +23 -0
  37. package/dist/browser-wait-ended.js +42 -0
  38. package/dist/cap.d.ts +12 -57
  39. package/dist/cap.js +20 -160
  40. package/dist/catalog.d.ts +1 -12
  41. package/dist/catalog.js +3 -33
  42. package/dist/cli.js +17 -26
  43. package/dist/composio-preset.d.ts +36 -0
  44. package/dist/composio-preset.js +179 -0
  45. package/dist/computer-attach.d.ts +125 -0
  46. package/dist/computer-attach.js +330 -0
  47. package/dist/computer-calls.d.ts +48 -0
  48. package/dist/computer-calls.js +126 -0
  49. package/dist/computer-channel.d.ts +57 -0
  50. package/dist/computer-channel.js +115 -0
  51. package/dist/computer-commands.d.ts +1 -1
  52. package/dist/computer-held-routes.d.ts +35 -0
  53. package/dist/computer-held-routes.js +106 -0
  54. package/dist/computer-held.d.ts +48 -0
  55. package/dist/computer-held.js +87 -0
  56. package/dist/computer-keys.d.ts +21 -1
  57. package/dist/computer-keys.js +53 -11
  58. package/dist/computer-live.d.ts +160 -0
  59. package/dist/computer-live.js +643 -0
  60. package/dist/computer-routes.d.ts +1 -4
  61. package/dist/computer-routes.js +3 -5
  62. package/dist/computer-setting.d.ts +2 -0
  63. package/dist/computer-setting.js +38 -1
  64. package/dist/computer-view.d.ts +24 -2
  65. package/dist/computer-view.js +51 -3
  66. package/dist/computer-viewer.d.ts +6 -0
  67. package/dist/computer-viewer.js +297 -0
  68. package/dist/computers.d.ts +79 -12
  69. package/dist/computers.js +147 -28
  70. package/dist/console/assets/index-Cn6JX1uH.js +563 -0
  71. package/dist/console/assets/index-DRN62V5v.css +1 -0
  72. package/dist/console/index.html +2 -2
  73. package/dist/docker-daemon.d.ts +2 -2
  74. package/dist/docker-daemon.js +2 -2
  75. package/dist/errors.js +5 -5
  76. package/dist/faux-computers.d.ts +9 -20
  77. package/dist/faux-computers.js +56 -24
  78. package/dist/files.d.ts +1 -9
  79. package/dist/files.js +1 -9
  80. package/dist/github-connection.d.ts +10 -2
  81. package/dist/github-connection.js +65 -2
  82. package/dist/github-faux.js +1 -1
  83. package/dist/github.d.ts +22 -2
  84. package/dist/github.js +42 -8
  85. package/dist/gpu-words.d.ts +14 -0
  86. package/dist/gpu-words.js +21 -0
  87. package/dist/graph-view.d.ts +3 -1
  88. package/dist/graph-view.js +25 -1
  89. package/dist/handed-values.d.ts +1 -1
  90. package/dist/handed-values.js +1 -1
  91. package/dist/harness-install.d.ts +60 -3
  92. package/dist/harness-install.js +322 -34
  93. package/dist/harness.d.ts +1 -0
  94. package/dist/harness.js +36 -2
  95. package/dist/host-tools.d.ts +9 -10
  96. package/dist/host-tools.js +7 -7
  97. package/dist/hosted-search.d.ts +5 -4
  98. package/dist/hosted-search.js +2 -7
  99. package/dist/import-sources.d.ts +10 -0
  100. package/dist/import-sources.js +44 -2
  101. package/dist/import.d.ts +3 -3
  102. package/dist/import.js +37 -6
  103. package/dist/index.d.ts +1 -3
  104. package/dist/index.js +1 -2
  105. package/dist/key-refusal.d.ts +1 -1
  106. package/dist/key-refusal.js +2 -2
  107. package/dist/learn/check.d.ts +11 -2
  108. package/dist/learn/check.js +124 -6
  109. package/dist/learn/commit.d.ts +43 -7
  110. package/dist/learn/commit.js +166 -22
  111. package/dist/learn/folder.d.ts +11 -0
  112. package/dist/learn/folder.js +37 -1
  113. package/dist/learn/general.d.ts +66 -0
  114. package/dist/learn/general.js +73 -0
  115. package/dist/learn/grade.d.ts +22 -1
  116. package/dist/learn/grade.js +107 -16
  117. package/dist/learn/index.d.ts +1 -1
  118. package/dist/learn/index.js +1 -1
  119. package/dist/learn/learning.sh +12 -1
  120. package/dist/learn/notes.d.ts +3 -0
  121. package/dist/learn/notes.js +3 -0
  122. package/dist/learn/reflect.d.ts +14 -2
  123. package/dist/learn/reflect.js +54 -30
  124. package/dist/learn/skills.d.ts +37 -5
  125. package/dist/learn/skills.js +60 -7
  126. package/dist/learned-nodes.d.ts +6 -2
  127. package/dist/learned-workflow.d.ts +43 -9
  128. package/dist/learned-workflow.js +128 -37
  129. package/dist/learning-batch.d.ts +283 -0
  130. package/dist/learning-batch.js +574 -0
  131. package/dist/learning-cost.d.ts +79 -0
  132. package/dist/learning-cost.js +69 -0
  133. package/dist/learning-evals.d.ts +33 -0
  134. package/dist/learning-evals.js +98 -0
  135. package/dist/learning-routes.d.ts +32 -4
  136. package/dist/learning-routes.js +48 -12
  137. package/dist/learning-words.d.ts +9 -0
  138. package/dist/learning-words.js +12 -2
  139. package/dist/learning.d.ts +39 -19
  140. package/dist/learning.js +88 -46
  141. package/dist/live/stream.js +6 -3
  142. package/dist/live/translate.d.ts +4 -3
  143. package/dist/live/translate.js +8 -4
  144. package/dist/live-reach.d.ts +37 -0
  145. package/dist/live-reach.js +62 -0
  146. package/dist/mcp-gateway.d.ts +9 -0
  147. package/dist/mcp-gateway.js +60 -11
  148. package/dist/mcp-oauth.d.ts +57 -7
  149. package/dist/mcp-oauth.js +133 -18
  150. package/dist/mcp-private-hosts.d.ts +4 -4
  151. package/dist/mcp-private-hosts.js +20 -12
  152. package/dist/mcp-probe.d.ts +27 -3
  153. package/dist/mcp-probe.js +106 -29
  154. package/dist/mcp-secret-writes.js +8 -0
  155. package/dist/mcp-servers-store.d.ts +38 -15
  156. package/dist/mcp-servers-store.js +120 -23
  157. package/dist/mcp-store.d.ts +10 -4
  158. package/dist/mcp-store.js +17 -6
  159. package/dist/model-form.d.ts +26 -0
  160. package/dist/model-form.js +80 -0
  161. package/dist/model.d.ts +5 -5
  162. package/dist/model.js +29 -16
  163. package/dist/openapi.d.ts +2 -0
  164. package/dist/openapi.js +586 -64
  165. package/dist/owner.d.ts +0 -1
  166. package/dist/owner.js +0 -2
  167. package/dist/page.d.ts +18 -0
  168. package/dist/page.js +48 -20
  169. package/dist/paid-calls.d.ts +1 -1
  170. package/dist/paid-calls.js +1 -1
  171. package/dist/place-offers.d.ts +96 -0
  172. package/dist/place-offers.js +202 -0
  173. package/dist/place.d.ts +9 -13
  174. package/dist/place.js +21 -32
  175. package/dist/port-models.d.ts +2 -1
  176. package/dist/port-models.js +5 -3
  177. package/dist/print.d.ts +16 -9
  178. package/dist/print.js +15 -17
  179. package/dist/propose.d.ts +4 -0
  180. package/dist/propose.js +34 -11
  181. package/dist/provider.js +3 -2
  182. package/dist/reflect-range.d.ts +8 -1
  183. package/dist/reflect-range.js +1 -1
  184. package/dist/run-cut.d.ts +5 -0
  185. package/dist/run-cut.js +19 -0
  186. package/dist/run-launch.d.ts +28 -3
  187. package/dist/run-launch.js +14 -4
  188. package/dist/run-learning-served.d.ts +2 -2
  189. package/dist/run-manifest.d.ts +2 -2
  190. package/dist/run-manifest.js +2 -2
  191. package/dist/run-reads-over-store.d.ts +1 -1
  192. package/dist/run-repo.d.ts +20 -0
  193. package/dist/run-repo.js +63 -0
  194. package/dist/run-secrets.js +3 -3
  195. package/dist/run-timeline-served.d.ts +1 -1
  196. package/dist/run-timeline-served.js +56 -44
  197. package/dist/run-view.d.ts +8 -5
  198. package/dist/run-view.js +18 -10
  199. package/dist/runnable.d.ts +2 -2
  200. package/dist/runnable.js +6 -2
  201. package/dist/runner/adapter-loop.d.ts +39 -8
  202. package/dist/runner/adapter-loop.js +770 -83
  203. package/dist/runner/adapter-run-spec.d.ts +36 -7
  204. package/dist/runner/adapter-run-spec.js +171 -37
  205. package/dist/runner/adapters/pi-computer.d.ts +7 -0
  206. package/dist/runner/adapters/pi-computer.js +43 -0
  207. package/dist/runner/adapters/pi.d.ts +20 -7
  208. package/dist/runner/adapters/pi.js +111 -26
  209. package/dist/runner/beside.d.ts +7 -3
  210. package/dist/runner/beside.js +26 -12
  211. package/dist/runner/claim-secrets.d.ts +4 -0
  212. package/dist/runner/claim-secrets.js +6 -1
  213. package/dist/runner/cli-run-spec.d.ts +27 -3
  214. package/dist/runner/cli-run-spec.js +198 -74
  215. package/dist/runner/commands.d.ts +8 -2
  216. package/dist/runner/commands.js +31 -6
  217. package/dist/runner/computer-channel.d.ts +34 -0
  218. package/dist/runner/computer-channel.js +61 -0
  219. package/dist/runner/conformance/harness.d.ts +0 -1
  220. package/dist/runner/conformance/harness.js +87 -18
  221. package/dist/runner/conformance/subject.d.ts +1 -1
  222. package/dist/runner/dispatch.js +3 -0
  223. package/dist/runner/end-of-run.d.ts +22 -12
  224. package/dist/runner/end-of-run.js +38 -16
  225. package/dist/runner/github-app.d.ts +2 -1
  226. package/dist/runner/github-app.js +6 -4
  227. package/dist/runner/harness-loops.js +16 -2
  228. package/dist/runner/held-run.d.ts +65 -0
  229. package/dist/runner/held-run.js +158 -0
  230. package/dist/runner/journal-kinds.d.ts +35 -6
  231. package/dist/runner/journal-kinds.js +20 -1
  232. package/dist/runner/journal-reader.d.ts +5 -4
  233. package/dist/runner/journal-reader.js +12 -10
  234. package/dist/runner/learning-ask.d.ts +7 -1
  235. package/dist/runner/learning-ask.js +21 -6
  236. package/dist/runner/learning-dispatch.d.ts +22 -0
  237. package/dist/runner/learning-dispatch.js +77 -10
  238. package/dist/runner/learning-end.d.ts +37 -1
  239. package/dist/runner/learning-end.js +115 -14
  240. package/dist/runner/learning-factory.d.ts +1 -1
  241. package/dist/runner/learning-factory.js +15 -5
  242. package/dist/runner/learning-loop.d.ts +139 -7
  243. package/dist/runner/learning-loop.js +369 -32
  244. package/dist/runner/learning-seed.d.ts +9 -0
  245. package/dist/runner/learning-seed.js +14 -1
  246. package/dist/runner/live-ticker.js +1 -0
  247. package/dist/runner/loop-contract.d.ts +16 -1
  248. package/dist/runner/loop-contract.js +6 -0
  249. package/dist/runner/loop.d.ts +10 -2
  250. package/dist/runner/loop.js +22 -1
  251. package/dist/runner/main.d.ts +13 -1
  252. package/dist/runner/main.js +38 -6
  253. package/dist/runner/mcp-claim.d.ts +11 -4
  254. package/dist/runner/mcp-claim.js +140 -23
  255. package/dist/runner/mcp-github.d.ts +4 -2
  256. package/dist/runner/mcp-github.js +1 -8
  257. package/dist/runner/mcp-run.d.ts +6 -4
  258. package/dist/runner/mcp-run.js +16 -3
  259. package/dist/runner/metrics.d.ts +15 -2
  260. package/dist/runner/metrics.js +21 -2
  261. package/dist/runner/model-route.d.ts +3 -0
  262. package/dist/runner/model-route.js +5 -2
  263. package/dist/runner/pr-checkout.d.ts +60 -0
  264. package/dist/runner/pr-checkout.js +176 -0
  265. package/dist/runner/reflect-hook.d.ts +19 -0
  266. package/dist/runner/reflect-hook.js +20 -8
  267. package/dist/runner/runner.d.ts +26 -0
  268. package/dist/runner/runner.js +231 -27
  269. package/dist/runner/scratch-sweep.d.ts +13 -0
  270. package/dist/runner/scratch-sweep.js +62 -0
  271. package/dist/runner/sessions.d.ts +1 -1
  272. package/dist/runner/spec-holds.d.ts +8 -3
  273. package/dist/runner/spec-holds.js +12 -10
  274. package/dist/runner/store-port.d.ts +7 -2
  275. package/dist/runner/store-secrets.js +21 -4
  276. package/dist/runner/subagent.d.ts +44 -0
  277. package/dist/runner/subagent.js +190 -0
  278. package/dist/runner/workflow-host.d.ts +24 -3
  279. package/dist/runner/workflow-host.js +24 -4
  280. package/dist/runner/workflow-loop.d.ts +6 -3
  281. package/dist/runner/workflow-loop.js +9 -8
  282. package/dist/runner/workflow-spec.d.ts +39 -15
  283. package/dist/runner/workflow-spec.js +143 -40
  284. package/dist/runs-over-store.d.ts +16 -6
  285. package/dist/runs-over-store.js +145 -29
  286. package/dist/seal-key.js +3 -3
  287. package/dist/sealed-settings-store.d.ts +5 -2
  288. package/dist/sealed-settings-store.js +10 -4
  289. package/dist/sealing.js +1 -2
  290. package/dist/secret-cut.d.ts +1 -1
  291. package/dist/secret-cut.js +1 -1
  292. package/dist/secret-writes.d.ts +5 -4
  293. package/dist/secret-writes.js +5 -4
  294. package/dist/server-secrets-store.d.ts +4 -3
  295. package/dist/server-secrets-store.js +15 -9
  296. package/dist/server-secrets.js +3 -2
  297. package/dist/server.d.ts +75 -63
  298. package/dist/server.js +712 -316
  299. package/dist/settings-wake.d.ts +21 -0
  300. package/dist/settings-wake.js +59 -0
  301. package/dist/standard-webhooks.d.ts +4 -1
  302. package/dist/standard-webhooks.js +8 -4
  303. package/dist/store/agent-body.d.ts +9 -2
  304. package/dist/store/agent-body.js +16 -8
  305. package/dist/store/command-wake.d.ts +12 -0
  306. package/dist/store/command-wake.js +37 -0
  307. package/dist/store/deadline.js +9 -5
  308. package/dist/store/dialect.d.ts +6 -0
  309. package/dist/store/dialect.js +5 -0
  310. package/dist/store/index.d.ts +4 -4
  311. package/dist/store/index.js +2 -2
  312. package/dist/store/journal/storage.d.ts +3 -2
  313. package/dist/store/journal/storage.js +15 -6
  314. package/dist/store/postgres/connection.js +9 -4
  315. package/dist/store/postgres/dialect.js +4 -0
  316. package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
  317. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  318. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  319. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  320. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  321. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  322. package/dist/store/schema.d.ts +2 -1
  323. package/dist/store/schema.js +85 -13
  324. package/dist/store/seal.d.ts +13 -0
  325. package/dist/store/seal.js +19 -0
  326. package/dist/store/sqlite/connection.d.ts +5 -0
  327. package/dist/store/sqlite/connection.js +88 -47
  328. package/dist/store/sqlite/run-patch.d.ts +25 -7
  329. package/dist/store/sqlite/run-patch.js +58 -14
  330. package/dist/store/sqlite/store.js +331 -59
  331. package/dist/store/store.d.ts +330 -21
  332. package/dist/store/store.js +34 -2
  333. package/dist/store-reads/analytics.js +3 -2
  334. package/dist/store-reads/cap.d.ts +2 -4
  335. package/dist/store-reads/cap.js +16 -7
  336. package/dist/store-reads/decisions.d.ts +3 -3
  337. package/dist/store-reads/decisions.js +3 -6
  338. package/dist/store-reads/import-summary.d.ts +1 -1
  339. package/dist/store-reads/journal.d.ts +5 -4
  340. package/dist/store-reads/journal.js +118 -27
  341. package/dist/store-reads/learning.d.ts +34 -4
  342. package/dist/store-reads/learning.js +137 -23
  343. package/dist/store-reads/runs.d.ts +7 -5
  344. package/dist/store-reads/runs.js +17 -10
  345. package/dist/store-reads/stats.js +5 -1
  346. package/dist/store-reads/workflow.d.ts +1 -1
  347. package/dist/store-view.d.ts +5 -0
  348. package/dist/store-view.js +70 -29
  349. package/dist/template-eval.js +8 -5
  350. package/dist/template-github-permissions.d.ts +22 -8
  351. package/dist/template-github-permissions.js +35 -15
  352. package/dist/templates.d.ts +64 -0
  353. package/dist/templates.js +101 -16
  354. package/dist/timeline/timeline.d.ts +30 -1
  355. package/dist/timeline/timeline.js +29 -13
  356. package/dist/timeline/util.d.ts +4 -0
  357. package/dist/timeline/util.js +14 -0
  358. package/dist/tool-blurbs.js +1 -0
  359. package/dist/tool-budget.d.ts +27 -7
  360. package/dist/tool-budget.js +21 -9
  361. package/dist/tool-gate.d.ts +23 -10
  362. package/dist/tool-gate.js +60 -44
  363. package/dist/tool-plane.d.ts +46 -28
  364. package/dist/tool-plane.js +73 -31
  365. package/dist/tools.d.ts +31 -38
  366. package/dist/tools.js +117 -74
  367. package/dist/trigger-adapter.d.ts +4 -0
  368. package/dist/trigger-secrets-shown.d.ts +2 -2
  369. package/dist/trigger-secrets-shown.js +1 -1
  370. package/dist/trigger-signatures.d.ts +26 -6
  371. package/dist/trigger-signatures.js +44 -8
  372. package/dist/trigger-targets.d.ts +2 -0
  373. package/dist/trigger-targets.js +1 -0
  374. package/dist/trigger-webhook.js +5 -2
  375. package/dist/triggers.d.ts +10 -6
  376. package/dist/triggers.js +37 -7
  377. package/dist/turn-end.d.ts +0 -3
  378. package/dist/turn-end.js +0 -3
  379. package/dist/turns.js +16 -1
  380. package/dist/usage-lines.d.ts +1 -1
  381. package/dist/validate.d.ts +6 -0
  382. package/dist/validate.js +41 -4
  383. package/dist/web-fetch.d.ts +1 -1
  384. package/dist/web-search.d.ts +10 -5
  385. package/dist/web-search.js +7 -6
  386. package/dist/webhooks.d.ts +147 -103
  387. package/dist/webhooks.js +564 -324
  388. package/dist/workflow/decision-recovery.d.ts +23 -0
  389. package/dist/workflow/decision-recovery.js +80 -0
  390. package/dist/workflow/decisions.d.ts +134 -0
  391. package/dist/workflow/decisions.js +46 -0
  392. package/dist/workflow/host-session.d.ts +5 -0
  393. package/dist/workflow/host-session.js +85 -0
  394. package/dist/workflow/host-tools.d.ts +3 -0
  395. package/dist/workflow/host-tools.js +3 -0
  396. package/dist/workflow/node-runner.d.ts +113 -0
  397. package/dist/workflow/node-runner.js +270 -0
  398. package/dist/workflow/node.d.ts +89 -0
  399. package/dist/workflow/node.js +101 -0
  400. package/dist/workflow/operator-error.d.ts +4 -0
  401. package/dist/workflow/operator-error.js +4 -0
  402. package/dist/workflow/pi-versions.d.ts +32 -0
  403. package/dist/workflow/pi-versions.js +65 -0
  404. package/dist/workflow/record-file.d.ts +10 -0
  405. package/dist/workflow/record-file.js +56 -0
  406. package/dist/workflow/record-tool.d.ts +77 -0
  407. package/dist/workflow/record-tool.js +126 -0
  408. package/dist/workflow/record.d.ts +151 -0
  409. package/dist/workflow/record.js +401 -0
  410. package/dist/workflow/run-error.d.ts +16 -0
  411. package/dist/workflow/run-error.js +26 -0
  412. package/dist/workflow/runner.d.ts +6 -0
  413. package/dist/workflow/runner.js +240 -0
  414. package/dist/workflow/store.d.ts +23 -0
  415. package/dist/workflow/store.js +242 -0
  416. package/dist/workflow/task.d.ts +133 -0
  417. package/dist/workflow/task.js +412 -0
  418. package/dist/workflow/thinking.d.ts +3 -0
  419. package/dist/workflow/thinking.js +7 -0
  420. package/dist/workflow/tool-context.d.ts +21 -0
  421. package/dist/workflow/tool-context.js +13 -0
  422. package/dist/workflow/types.d.ts +126 -0
  423. package/dist/workflow/types.js +1 -0
  424. package/dist/workflow-run.d.ts +2 -2
  425. package/dist/workspace/agent-computer.d.ts +137 -0
  426. package/dist/workspace/agent-computer.js +292 -0
  427. package/dist/workspace/archil-claim.d.ts +11 -0
  428. package/dist/workspace/archil-claim.js +18 -10
  429. package/dist/workspace/archil-disks.d.ts +49 -0
  430. package/dist/workspace/archil-disks.js +185 -0
  431. package/dist/workspace/archil-exec.js +2 -3
  432. package/dist/workspace/archil-mount-credential.d.ts +20 -4
  433. package/dist/workspace/archil-mount-credential.js +13 -4
  434. package/dist/workspace/attached-computers.d.ts +41 -0
  435. package/dist/workspace/attached-computers.js +114 -0
  436. package/dist/workspace/computer-deps.d.ts +32 -17
  437. package/dist/workspace/computer-deps.js +37 -14
  438. package/dist/workspace/computer-for-claim.d.ts +58 -13
  439. package/dist/workspace/computer-for-claim.js +267 -26
  440. package/dist/workspace/computer-hold.d.ts +11 -27
  441. package/dist/workspace/computer-hold.js +36 -56
  442. package/dist/workspace/computer-janitor.d.ts +3 -2
  443. package/dist/workspace/computer-janitor.js +43 -9
  444. package/dist/workspace/computer-ledger.d.ts +5 -1
  445. package/dist/workspace/computer-ledger.js +11 -0
  446. package/dist/workspace/computer-mcp.d.ts +25 -0
  447. package/dist/workspace/computer-mcp.js +41 -0
  448. package/dist/workspace/computer-ports.d.ts +4 -13
  449. package/dist/workspace/computer-ports.js +4 -107
  450. package/dist/workspace/computer-script.d.ts +37 -0
  451. package/dist/workspace/computer-script.js +138 -0
  452. package/dist/workspace/executors.d.ts +1 -1
  453. package/dist/workspace/index.d.ts +7 -4
  454. package/dist/workspace/index.js +4 -1
  455. package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
  456. package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
  457. package/dist/workspace/resolve-computer.d.ts +45 -11
  458. package/dist/workspace/resolve-computer.js +72 -14
  459. package/dist/workspace/run-disk.d.ts +34 -0
  460. package/dist/workspace/run-disk.js +91 -0
  461. package/dist/workspace/run-tools.d.ts +35 -18
  462. package/dist/workspace/run-tools.js +24 -29
  463. package/dist/workspace/server-run-workspace.d.ts +3 -2
  464. package/dist/workspace/server-run-workspace.js +17 -4
  465. package/dist/workspace.js +1 -1
  466. package/package.json +19 -21
  467. package/templates/README.md +9 -6
  468. package/templates/code-review/agent.md +27 -11
  469. package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
  470. package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
  471. package/templates/code-review/evals/injection/graders/ignores.md +1 -1
  472. package/templates/code-review/evals/never-flag/case.yaml +3 -0
  473. package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
  474. package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
  475. package/templates/code-review/evals/never-flag/prompt.md +30 -0
  476. package/templates/code-review/evals/null-name/graders/finds.md +1 -1
  477. package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
  478. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
  479. package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
  480. package/templates/code-review/evals/re-review/prompt.md +1 -1
  481. package/templates/code-review/evals/re-review-open/case.yaml +3 -0
  482. package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
  483. package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
  484. package/templates/code-review/evals/re-review-open/prompt.md +27 -0
  485. package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
  486. package/templates/code-review/evals/two-defects/case.yaml +3 -0
  487. package/templates/code-review/evals/two-defects/graders/both.md +4 -0
  488. package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
  489. package/templates/code-review/evals/two-defects/prompt.md +25 -0
  490. package/templates/code-review/findings.schema.json +131 -27
  491. package/templates/code-review/rules/CODEREVIEW.md +76 -0
  492. package/templates/code-review/skills/review/DEEP.md +130 -0
  493. package/templates/code-review/skills/review/REVIEWER.md +116 -0
  494. package/templates/code-review/skills/review/SKILL.md +104 -154
  495. package/templates/market-monitor/agent.md +1 -1
  496. package/dist/box/record.d.ts +0 -6
  497. package/dist/box/record.js +0 -41
  498. package/dist/box/sweep.d.ts +0 -53
  499. package/dist/box/sweep.js +0 -193
  500. package/dist/box-egress-vm.d.ts +0 -118
  501. package/dist/box-egress-vm.js +0 -354
  502. package/dist/box-egress.d.ts +0 -105
  503. package/dist/box-egress.js +0 -256
  504. package/dist/box-relay-vm.d.ts +0 -84
  505. package/dist/box-relay-vm.js +0 -437
  506. package/dist/box-relay.d.ts +0 -36
  507. package/dist/box-relay.js +0 -207
  508. package/dist/boxes.d.ts +0 -109
  509. package/dist/boxes.js +0 -249
  510. package/dist/budget.d.ts +0 -71
  511. package/dist/budget.js +0 -199
  512. package/dist/console/assets/index-B7NKTU8E.css +0 -1
  513. package/dist/console/assets/index-CXZMgJE7.js +0 -550
  514. package/dist/daytona-api.d.ts +0 -10
  515. package/dist/daytona-api.js +0 -20
  516. package/dist/egress-proxy.d.ts +0 -45
  517. package/dist/egress-proxy.js +0 -416
  518. package/dist/egress-table.d.ts +0 -24
  519. package/dist/egress-table.js +0 -165
  520. package/dist/run-db.d.ts +0 -53
  521. package/dist/run-db.js +0 -116
  522. package/templates/code-review/rules/REVIEW.md +0 -41
package/dist/place.js CHANGED
@@ -3,22 +3,22 @@
3
3
  // explicit runner included, since the default is this host's; one that names none keeps none, so a revision written
4
4
  // before this field keeps its id. Which boxes this server has is said in capabilities, and a revision whose box it does
5
5
  // not have saves with a warning and is refused at run time. A run runs in its revision's place, else this host's
6
- // default, and keeps the place it resolved to: a run request names none. Runs execute in Docker and in Daytona, for
7
- // now: every other box says it does not run yet. A harness's own tools in the box, when they come, are an option of
8
- // sandbox, never a third mode.
6
+ // default, and keeps the place it resolved to: a run request names none. A sandbox place on a box is a sandbox computer
7
+ // of that provider (computer-setting.ts computerOfPlace), which the run's claim starts: Docker, Daytona or Modal. A harness's own tools in the box, when they come, are an option of sandbox, never a third
8
+ // mode.
9
9
  //
10
10
  // The box is a new agent's default machine: an agentic definition that names no place is saved, at its create, with the
11
- // Docker box as its place wherever this server has docker (ready, or preparing), and with bash when it names no tools
11
+ // Docker box as its place wherever this server has docker, and with bash when it names no tools
12
12
  // (newAgentPlace). A revision that names no place resolves the same way at each run (defaultPlaceOf): this server's
13
13
  // default_place, so where docker is there now it runs in the Docker box, and the runner where it is not. A workflow, and a
14
14
  // revision with a tool the box refuses, run on the runner.
15
- import { BOX_IDS, BOXES_ENV, VM_PROVIDER } from "./boxes.js";
15
+ import { BOX_IDS, BOXES_ENV } from "./place-offers.js";
16
16
  import { sentence } from "./errors.js";
17
17
  export const PLACE_MODES = ["runner", "sandbox"];
18
- /** The boxes runs execute in so far: Docker, Daytona and the VM box. */
19
- export const RUN_BOXES = ["docker", "daytona", VM_PROVIDER.id];
20
- /** The boxes this server gives runs, from what its registry set up at its start (boxes.ts): a box runs execute in
21
- * that the registry has, and no other. */
18
+ /** The boxes runs execute in: the sandbox computers of Docker, Daytona and Modal. */
19
+ export const RUN_BOXES = ["docker", "daytona", "modal"];
20
+ /** The boxes this server gives runs, from what it found at its start (place-offers.ts): a box runs execute in that it
21
+ * has, and no other. */
22
22
  export function boxAvailability(registry) {
23
23
  return BOX_IDS.map((id) => {
24
24
  const offer = registry.find((o) => o.id === id);
@@ -29,14 +29,14 @@ export function boxAvailability(registry) {
29
29
  return { id, available: false, reason: `runs in the ${id} box are not available yet: use the ${RUN_BOXES.join(" or ")} box` };
30
30
  });
31
31
  }
32
- /** The place a new agentic definition that names none is saved with: the Docker box where this server has it, ready or
33
- * preparing (its first run waits for the image); else none, so the agent runs on the runner as it did before, with
32
+ /** The place a new agentic definition that names none is saved with: the Docker box where this server has it; else none, so the agent runs on the runner as it did before, with
34
33
  * `reason` saying why, in docker's own words. A workflow is never given one. */
35
34
  export function newAgentPlace(registry) {
36
35
  const docker = boxAvailability(registry).find((box) => box.id === "docker");
37
36
  if (docker?.available)
38
37
  return { place: { mode: "sandbox", box: "docker" } };
39
- return { reason: `new agents run on the runner, because the docker box is unavailable here: ${docker?.reason ?? "it is not set up"}` };
38
+ const why = docker?.reason ?? "it is not set up";
39
+ return { reason: `new agents run on the runner, because the docker box is unavailable here: ${why}`, why };
40
40
  }
41
41
  /** The place a revision that names none resolves to, at its create and at each run alike: this server's default place
42
42
  * (newAgentPlace) for an agentic revision; the runner for a workflow, which is never given a box, and for one that names
@@ -60,19 +60,13 @@ export function noBoxReason(registry) {
60
60
  return undefined;
61
61
  return `no box is set up on this server: ${boxes.map((box) => `${box.id} is unavailable (${box.reason ?? "no reason given"})`).join("; ")}`;
62
62
  }
63
- /** The start banner's words on the boxes: which are ready for a sandbox agent's tools, which are still preparing (an
64
- * available box whose `state` says so, with its reason: what it is pulling), then why each box is not that
65
- * AGENTRUN_BOXES lists (`listed`), or, when none is ready or preparing, each box runs execute in, with what to do.
63
+ /** The start banner's words on the boxes: which are ready for a sandbox agent's tools, then why each box is not that
64
+ * AGENTRUN_BOXES lists (`listed`), or, when none is ready, each box runs execute in, with what to do.
66
65
  * `byDefault`, with AGENTRUN_BOXES not set at all: short, docker alone, said to be on by default, or why it is not. */
67
66
  export function boxesLine(registry, listed, allow = "none", byDefault = false) {
68
67
  const boxes = boxAvailability(registry);
69
- const preparing = (box) => box.state === "preparing";
70
- const ready = boxes.filter((box) => box.available && !preparing(box)).map((box) => box.id);
71
- const coming = boxes.filter((box) => box.available && preparing(box));
72
- const said = [
73
- ...(ready.length ? [`${new Intl.ListFormat("en", { type: "conjunction" }).format(ready)} ${ready.length === 1 ? "is" : "are"} ready, so sandbox agents run their tools there.`] : []),
74
- ...coming.map((box) => sentence(`${box.id} is preparing${box.reason ? ` (${box.reason})` : ""}`)),
75
- ];
68
+ const ready = boxes.filter((box) => box.available).map((box) => box.id);
69
+ const said = ready.length ? [`${new Intl.ListFormat("en", { type: "conjunction" }).format(ready)} ${ready.length === 1 ? "is" : "are"} ready, so sandbox agents run their tools there.`] : [];
76
70
  const none = !said.length;
77
71
  const why = boxes.filter((box) => !box.available && (listed.has(box.id) || (none && RUN_BOXES.includes(box.id))));
78
72
  // What an available box's programs reach, as capabilities say (`network`, `network_reason`, `places.allow`).
@@ -82,24 +76,22 @@ export function boxesLine(registry, listed, allow = "none", byDefault = false) {
82
76
  const docker = boxes.find((box) => box.id === "docker");
83
77
  if (!docker?.available)
84
78
  return `Boxes: none, so new agents run on the runner. ${sentence(docker?.reason ?? "Docker is not set up")}`;
85
- const coming = preparing(docker) ? ` docker is preparing${docker.reason ? ` (${docker.reason})` : ""}.` : "";
86
- return [`Boxes: docker (on by default; set ${BOXES_ENV} to change).${coming}`, ...reach].join(" ");
79
+ return [`Boxes: docker (on by default; set ${BOXES_ENV} to change).`, ...reach].join(" ");
87
80
  }
88
81
  return ["Boxes:", ...(none ? ["none is ready, so sandbox agents do not run here."] : said), ...reach, ...why.map((box) => sentence(`${box.id}: ${box.reason ?? "not available"}`))].join(" ");
89
82
  }
90
83
  /** `places` in capabilities: the modes a revision may name, the place a new agent is saved with and a revision that
91
84
  * names none runs in (`default_place`, with `default_reason` when it is the runner), each box, and the hosts a box whose
92
- * `network` is `allowlist` reaches (`allow`, run-box.ts boxAllowOf; empty for `none`). */
85
+ * `network` is `allowlist` reaches (`allow`, box-settings.ts boxAllowOf; empty for `none`). */
93
86
  export const placesOf = (registry, allow = "none") => {
94
87
  const fresh = newAgentPlace(registry);
95
88
  return { modes: [...PLACE_MODES], ...("place" in fresh ? { default_place: fresh.place } : { default_place: { mode: "runner" }, default_reason: fresh.reason }), boxes: boxAvailability(registry).map(stated), allow: allow === "none" ? [] : [...allow] };
96
89
  };
97
- /** A box with its state: what the server set (a Docker box whose image is coming is `preparing`), else `ready` when it
98
- * is available and `unavailable` when not; and, on an available box, its network as the server set it, with
90
+ /** A box with its state, `ready` when it is available and `unavailable` when not; and, on an available box, its network as the server set it, with
99
91
  * `network_reason` when it is none for a cause of its own. */
100
- const stated = ({ state, network, network_reason, ...offer }) => ({
92
+ const stated = ({ state: _state, network, network_reason, ...offer }) => ({
101
93
  ...offer,
102
- state: offer.available ? (state ?? "ready") : "unavailable",
94
+ state: offer.available ? "ready" : "unavailable",
103
95
  ...(offer.available && network ? { network } : {}),
104
96
  ...(offer.available && network === "none" && network_reason ? { network_reason } : {}),
105
97
  });
@@ -107,9 +99,6 @@ const stated = ({ state, network, network_reason, ...offer }) => ({
107
99
  export const resolvePlace = (revision, fallback) => revision ?? fallback;
108
100
  /** Where a box has the run's work/ (bound, or seeded), and where its tools start: the same in every box. */
109
101
  export const BOX_WORK = "/workspace";
110
- /** The boxes that cannot bind a run's work/, being on another machine: its work/ is seeded at the box's making and
111
- * pulled back (run-box.ts). */
112
- export const REMOTE_BOXES = ["daytona", VM_PROVIDER.id];
113
102
  const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
114
103
  const listed = (options, value) => typeof value === "string" && options.includes(value);
115
104
  /** `place` as a definition writes it, to copy: `"place": {"mode": "sandbox", "box": "docker"}`. */
@@ -33,7 +33,8 @@ export declare function sessionModel(api: SessionPort["api"], url: string, model
33
33
  * credential (named `keyName`). The proxy knows a request by `authorization: Bearer <key>`: on Messages that header is set
34
34
  * on the model, since pi-ai's Anthropic client sends its key as x-api-key, which the proxy does not forward; on Responses
35
35
  * pi-ai sends the key as that bearer token itself. The one client every runner caller of a session proxy builds: pi's
36
- * sessions, the learning grader, a workflow's model nodes. */
36
+ * sessions, the learning grader, a workflow's model nodes. Each request's images are checked as they are attached
37
+ * (attach-images.ts): one a provider would refuse goes as a text saying why. */
37
38
  export declare function sessionProvider(api: SessionPort["api"], proxy: {
38
39
  readonly url: string;
39
40
  readonly key: string;
@@ -1,6 +1,7 @@
1
1
  import { anthropicMessagesApi } from "@earendil-works/pi-ai/api/anthropic-messages.lazy";
2
2
  import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.lazy";
3
3
  import { createProvider } from "@earendil-works/pi-ai/models";
4
+ import { attachingImages } from "./attach-images.js";
4
5
  /** The provider id the port's one model is listed under. */
5
6
  export const PORT_PROVIDER = "agentrun-session";
6
7
  /** The provider id a tier's port model is listed under (tieredModels): the run's model of that tier, on a proxy of its
@@ -35,14 +36,15 @@ export function sessionModel(api, url, model, options) {
35
36
  * credential (named `keyName`). The proxy knows a request by `authorization: Bearer <key>`: on Messages that header is set
36
37
  * on the model, since pi-ai's Anthropic client sends its key as x-api-key, which the proxy does not forward; on Responses
37
38
  * pi-ai sends the key as that bearer token itself. The one client every runner caller of a session proxy builds: pi's
38
- * sessions, the learning grader, a workflow's model nodes. */
39
+ * sessions, the learning grader, a workflow's model nodes. Each request's images are checked as they are attached
40
+ * (attach-images.ts): one a provider would refuse goes as a text saying why. */
39
41
  export function sessionProvider(api, proxy, model, options) {
40
42
  return createProvider({
41
43
  id: options.provider,
42
44
  baseUrl: sessionBaseUrl(api, proxy.url),
43
45
  auth: { apiKey: { name: options.keyName, resolve: async () => ({ auth: { apiKey: proxy.key }, source: "session" }) } },
44
46
  models: [sessionModel(api, proxy.url, model, { provider: options.provider, ...(api === "anthropic-messages" ? { headers: { authorization: `Bearer ${proxy.key}` } } : {}), ...(options.like ? { like: options.like } : {}), reasoning: options.reasoning })],
45
- api: api === "anthropic-messages" ? anthropicMessagesApi() : openAIResponsesApi(),
47
+ api: attachingImages(api === "anthropic-messages" ? anthropicMessagesApi() : openAIResponsesApi()),
46
48
  });
47
49
  }
48
50
  /** Models over `port` (the session's, read at each request: undefined until a drive has attached a proxy, and anew for
@@ -73,7 +75,7 @@ export async function portModels(port, like, provider = PORT_PROVIDER) {
73
75
  id: provider, baseUrl,
74
76
  auth: { apiKey: { name: "the session's side key", resolve: async () => ({ auth: { apiKey: now.key }, source: "session" }) } },
75
77
  models: [model],
76
- api: now.api === "anthropic-messages" ? anthropicMessagesApi() : openAIResponsesApi(),
78
+ api: attachingImages(now.api === "anthropic-messages" ? anthropicMessagesApi() : openAIResponsesApi()),
77
79
  }));
78
80
  built = { at, models, model: models.getModel(provider, now.model) };
79
81
  return built;
package/dist/print.d.ts CHANGED
@@ -1,15 +1,10 @@
1
- import type { ImageState } from "./box-image.js";
2
- /** The line said as the Docker box image's first build (or pull) starts: it takes minutes, and nothing waits on it but
3
- * a sandbox run's first box. */
4
- export declare const IMAGE_PREPARING = "Preparing the Docker box image (first start only, a few minutes); agents can be made now, and their first run waits for it.";
5
- /** The line for the Docker box image's state `state`, said once as its build starts and once as it ends (`started`: the
6
- * start was said); undefined for any other, an image Docker already had among them. */
7
- export declare function boxImageLine(state: ImageState, started: boolean): string | undefined;
8
1
  /** Where the token came from: made at this start (printed this once), kept in DIR/.token, or the environment's. */
9
2
  export type TokenSource = "made" | "file" | "env";
10
3
  /** The banner's lines. The token is printed only when this start made it; else where it is. `publicUrl` is the address
11
4
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
12
- * password, so its link holds no token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in words (Serve's boxesLine), last. */
5
+ * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
6
+ * token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
7
+ * words (Serve's boxesLine), last. */
13
8
  export declare function banner(o: {
14
9
  url: string;
15
10
  baseUrl: string;
@@ -20,9 +15,21 @@ export declare function banner(o: {
20
15
  publicUrl?: string;
21
16
  accounts?: boolean;
22
17
  apiOnly?: boolean;
18
+ launchCode?: string;
23
19
  boxes?: string;
24
20
  }): string[];
25
21
  /** One log line. */
26
22
  export declare const logLine: (event: string, fields?: Record<string, string | number>) => string;
27
- /** A duration as pi-durable-disk's --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
23
+ /** The log line of a runner's start or end event (runner.ts RunnerEvent): `run_started` (run, agent, kind) once a run's
24
+ * first claim, `run_ended` (run, agent, status, cost_usd) once it is final. Any other event has none. Ids and numbers
25
+ * only: no token or secret reaches a line. */
26
+ export declare function runLine(event: {
27
+ type: string;
28
+ runId?: string;
29
+ agent?: string;
30
+ kind?: string;
31
+ status?: string;
32
+ costUsd?: number | null;
33
+ }): string | undefined;
34
+ /** A duration as --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
28
35
  export declare function durationMs(text: string): number | undefined;
package/dist/print.js CHANGED
@@ -1,22 +1,11 @@
1
1
  // What the server prints on stdout: its banner at start, and one line per request, per run start and end, and per
2
2
  // refused credential (logfmt: `at=<time> event=<name> key=value ...`). No line holds a token or any part of one.
3
3
  import { join } from "node:path";
4
- import { sentence } from "./errors.js";
5
- /** The line said as the Docker box image's first build (or pull) starts: it takes minutes, and nothing waits on it but
6
- * a sandbox run's first box. */
7
- export const IMAGE_PREPARING = "Preparing the Docker box image (first start only, a few minutes); agents can be made now, and their first run waits for it.";
8
- /** The line for the Docker box image's state `state`, said once as its build starts and once as it ends (`started`: the
9
- * start was said); undefined for any other, an image Docker already had among them. */
10
- export function boxImageLine(state, started) {
11
- if (state.state === "preparing")
12
- return started ? undefined : IMAGE_PREPARING;
13
- if (!started)
14
- return undefined;
15
- return state.state === "ready" ? "The Docker box image is ready." : `The Docker box image failed: ${sentence(state.reason)}`;
16
- }
17
4
  /** The banner's lines. The token is printed only when this start made it; else where it is. `publicUrl` is the address
18
5
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
19
- * password, so its link holds no token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in words (Serve's boxesLine), last. */
6
+ * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
7
+ * token. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
8
+ * words (Serve's boxesLine), last. */
20
9
  export function banner(o) {
21
10
  const where = o.source === "env" ? "$AGENTRUN_TOKEN" : `<in ${join(o.data, ".token")}>`;
22
11
  const key = o.source === "made" ? o.token : where;
@@ -24,10 +13,9 @@ export function banner(o) {
24
13
  `agentrun-serve on ${o.baseUrl} (agent store in ${o.data}${o.listen ? `, listening on ${o.listen}` : ""})`,
25
14
  `AGENTRUN_BASE_URL=${o.publicUrl ? `${o.publicUrl}/v2` : o.baseUrl}`,
26
15
  `AGENTRUN_API_KEY=${key}`,
27
- // Encoded: a "+" in a token reads as a space in a query string.
28
16
  o.apiOnly
29
17
  ? "API only (AGENTRUN_API_ONLY=1): the run routes are served; the console, sign-in, setup, settings, MCP, triggers and hooks are refused."
30
- : o.accounts ? `Open ${o.publicUrl ?? o.url}/` : `Open ${o.publicUrl ?? o.url}/?token=${o.source === "made" ? encodeURIComponent(o.token) : where}`,
18
+ : o.accounts || o.launchCode === undefined ? `Open ${o.publicUrl ?? o.url}/` : `Open ${o.publicUrl ?? o.url}/?launch=${o.launchCode}`,
31
19
  ...(o.boxes ? [o.boxes] : []),
32
20
  ];
33
21
  }
@@ -37,7 +25,17 @@ const value = (v) => {
37
25
  };
38
26
  /** One log line. */
39
27
  export const logLine = (event, fields = {}) => [`at=${new Date().toISOString()}`, `event=${event}`, ...Object.entries(fields).map(([k, v]) => `${k}=${value(v)}`)].join(" ");
40
- /** A duration as pi-durable-disk's --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
28
+ /** The log line of a runner's start or end event (runner.ts RunnerEvent): `run_started` (run, agent, kind) once a run's
29
+ * first claim, `run_ended` (run, agent, status, cost_usd) once it is final. Any other event has none. Ids and numbers
30
+ * only: no token or secret reaches a line. */
31
+ export function runLine(event) {
32
+ if (event.type === "started")
33
+ return logLine("run_started", { run: event.runId, agent: event.agent, kind: event.kind });
34
+ if (event.type === "ended")
35
+ return logLine("run_ended", { run: event.runId, agent: event.agent, status: event.status === "ended" ? "completed" : event.status, cost_usd: event.costUsd ?? "unknown" });
36
+ return undefined;
37
+ }
38
+ /** A duration as --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
41
39
  export function durationMs(text) {
42
40
  const m = /^(\d+(?:\.\d+)?)(ms|s|m)$/.exec(text.trim());
43
41
  return m ? Math.round(Number(m[1]) * { ms: 1, s: 1_000, m: 60_000 }[m[2]]) : undefined;
package/dist/propose.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { DraftAsk } from "./learn/skills.js";
2
2
  import { type Problem } from "./learn/index.js";
3
+ import type { DraftDecisions } from "./learn/skills.js";
3
4
  import { type Turn } from "./learning.js";
4
5
  import type { Workspace } from "./workspace/index.js";
5
6
  export type Proposed = {
@@ -33,6 +34,7 @@ export declare const proposeRun: (input: {
33
34
  folder: Workspace;
34
35
  runDir: string;
35
36
  seed: string;
37
+ notesSeed?: string;
36
38
  turn: Turn;
37
39
  refuse: readonly string[];
38
40
  outcome?: string;
@@ -40,4 +42,6 @@ export declare const proposeRun: (input: {
40
42
  gated?: Readonly<Record<string, string>>;
41
43
  deniedBy?: Readonly<Record<string, "agent" | "server" | "default">>;
42
44
  ask?: DraftAsk;
45
+ decisions?: DraftDecisions;
46
+ workflows?: false;
43
47
  }) => Promise<Proposed>;
package/dist/propose.js CHANGED
@@ -2,15 +2,16 @@ import { join } from "node:path";
2
2
  import { checkProposal, draftDryRun, draftFiles, NOTE_BLOCK, unstorable, parseReflection, redactSecrets, shortMessage, SKILL_BLOCK, SKILLS_DIR, WORKFLOW_BLOCK, WORKFLOWS_DIR } from "./learn/index.js";
3
3
  import { folderAt, readLearning, readSnapshot } from "./learn/folder.js";
4
4
  import { baseOf } from "./learn/seed-check.js";
5
+ import { parseNoteFile, ruleOf } from "./learn/notes.js";
5
6
  import { writeDurable } from "./files.js";
6
7
  import { PROPOSAL } from "./learning.js";
7
8
  /** The rules that refuse a proposal whole, whatever item they name: a path outside what a run may write, a deletion,
8
- * the folder's index full (the notes' total, which no one item is past), anything that must never be stored (a secret,
9
- * a character a reader does not see), which says the run's answer is not to be trusted for any item, and text that is
10
- * not UTF-8, which cannot be read for one. Every other problem is its item's alone: a count cap names the items past it
11
- * (learn/check.ts), a size cap the item over it, and they are left out and the rest kept; unstorable reads every item's
12
- * text whole first. */
13
- const WHOLE = new Set(["outside", "deleted", "index_full", "secret_value", "secret_shape", "invisible_unicode", "encoding"]);
9
+ * anything that must never be stored (a secret, a character a reader does not see), which says the run's answer is
10
+ * not to be trusted for any item, and text that is not UTF-8, which cannot be read for one. Every other problem is its
11
+ * item's alone: a count cap names the items past it (learn/check.ts), a size cap the item over it, the index's lines
12
+ * the notes that add lines from the answer's end, and they are left out and the rest kept; unstorable reads every
13
+ * item's text whole first. */
14
+ const WHOLE = new Set(["outside", "deleted", "secret_value", "secret_shape", "invisible_unicode", "encoding"]);
14
15
  /** The item a changed file belongs to: a draft's two files are one item (its folder), every other file is itself. */
15
16
  const itemOf = (path) => (path.startsWith(`${WORKFLOWS_DIR}/`) ? path.split("/").slice(0, 2).join("/") : path);
16
17
  const utf8 = new TextDecoder("utf-8", { fatal: true });
@@ -91,10 +92,28 @@ export const proposeRun = async (input) => {
91
92
  }
92
93
  const given = [...fileGroups.values()];
93
94
  // The seed is read whatever the answer: a seed the folder does not hold fails the check.
94
- const { snapshot, texts } = await seedAt(input.folder, input.seed, () => (parsed.ok ? [...parsed.notes.map(({ file }) => file), ...given.flat().map(({ file }) => file)] : []));
95
+ // The seed's active notes are read too: a new note of the same rule as one (notes.ts ruleOf) is a duplicate.
96
+ const activeOf = (seedSnapshot) => seedSnapshot.notes.filter((note) => note.status === "active").map((note) => note.file);
97
+ // And the skill of each draft's name, as the folder holds it: what the draft keeps as a workflow, for the grader.
98
+ const skillOf = (draft) => `${SKILLS_DIR}/${draft.split("/")[1]}/SKILL.md`;
99
+ const draftSkills = given.flat().filter(({ file }) => file.endsWith("/workflow.json")).map(({ file }) => skillOf(file));
100
+ const { snapshot, texts } = await seedAt(input.folder, input.seed, (seedSnapshot) => (parsed.ok ? [...parsed.notes.map(({ file }) => file), ...given.flat().map(({ file }) => file), ...draftSkills, ...activeOf(seedSnapshot)] : []));
95
101
  if (!parsed.ok)
96
102
  return parsed.reason === "empty" ? { state: "dropped", reason: "empty" } : { state: "dropped", reason: "unparsed", detail: parsed.detail };
97
- const { base, kept } = baseOf(snapshot);
103
+ const { base: seedBase, kept } = baseOf(snapshot);
104
+ // A later round's notes are checked against the main the earlier rounds merged into (`notesSeed`: a note round 1 added
105
+ // is a supersedes target and a duplicate rule), while a skill's or a draft's files keep `seed` as their conflict base:
106
+ // the run was laid from it, so a file changed on main since is a conflict, never written over.
107
+ const noted = input.notesSeed && input.notesSeed !== input.seed
108
+ ? await seedAt(input.folder, input.notesSeed, (seedSnapshot) => (parsed.ok ? [...parsed.notes.map(({ file }) => file), ...activeOf(seedSnapshot)] : []))
109
+ : { snapshot, texts };
110
+ const rules = new Map(activeOf(noted.snapshot).flatMap((file) => {
111
+ const note = noted.texts.has(file) ? parseNoteFile(file, noted.texts.get(file)) : undefined;
112
+ return note && !Array.isArray(note) ? [[ruleOf(note.body), file]] : [];
113
+ }));
114
+ const learnedPath = (path) => path.startsWith(`${SKILLS_DIR}/`) || path.startsWith(`${WORKFLOWS_DIR}/`);
115
+ const notedBase = baseOf(noted.snapshot).base;
116
+ const base = { files: [...[...notedBase.files].filter((path) => !learnedPath(path)), ...[...seedBase.files].filter(learnedPath)], active: notedBase.active, rules };
98
117
  const held = new Set(base.files);
99
118
  const files = given.filter((group) => group.some(({ file, text }) => texts.get(file) !== text)).flat();
100
119
  const changeOf = ({ file, text }) => ({ path: file, status: held.has(file) ? "modified" : "added", mode: "100644", bytes: Buffer.from(text) });
@@ -105,7 +124,7 @@ export const proposeRun = async (input) => {
105
124
  const changes = parsed.order.flatMap(({ kind, name }) => {
106
125
  if (kind === NOTE_BLOCK) {
107
126
  const text = noteTexts.get(name);
108
- return texts.get(name) !== text ? [changeOf({ file: name, text })] : [];
127
+ return noted.texts.get(name) !== text ? [changeOf({ file: name, text })] : [];
109
128
  }
110
129
  return (fileGroups.get(keyOf(kind, name)) ?? []).filter(({ file }) => changed.has(file)).map(changeOf);
111
130
  });
@@ -120,7 +139,7 @@ export const proposeRun = async (input) => {
120
139
  return { state: "dropped", reason: "checker", problems: leaky };
121
140
  // A skill or a draft whose seed text has a status is a person's call (retired, or waiting for their OK): never changed.
122
141
  const dryRuns = {};
123
- const check = (some) => checkProposal({ base, changes: some, refuseValues: input.refuse, ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(input.ask ? { ask: input.ask } : {}), ...(dsl ? { dsl, dryRuns } : {}) });
142
+ const check = (some) => checkProposal({ base, changes: some, refuseValues: input.refuse, ...(input.workflows === false ? { workflows: false } : {}), ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(input.ask ? { ask: input.ask } : {}), ...(input.decisions ? { decisions: input.decisions } : {}), ...(dsl ? { dsl, dryRuns } : {}) });
124
143
  // The static checks first, every one (validateWorkflow with executeCode: false, draftProblems' refusal of code nodes,
125
144
  // caps, secrets): a draft they refuse is never dry-run, nor is any when they refuse the answer whole. Then each draft
126
145
  // left is dry-run on its example, else on a synthesized input (learn/skills.ts draftDryRun): every model and tool
@@ -173,7 +192,11 @@ export const proposeRun = async (input) => {
173
192
  const triggered = (input.turn.triggered ?? []).map(({ source, text }) => ({ source, text: shortMessage(redactSecrets(text, input.refuse, Number.POSITIVE_INFINITY)) }));
174
193
  // How each kept draft's dry run went, for the grader: passed, or not run and why.
175
194
  const ran = Object.fromEntries(passing.filter(({ file }) => dryRuns[file]).map(({ file }) => [file, dryRuns[file]]));
176
- const proposal = { seed: input.seed, notes: checked.notes.map(({ file, text }) => ({ file, text })), ...(passing.length ? { files: passing } : {}), ...(Object.keys(ran).length ? { dryRuns: ran } : {}), asked, ...(triggered.length ? { triggered } : {}) };
195
+ // Each kept draft's skill as the folder holds it at the seed, unless the proposal gives that skill itself (the grader
196
+ // reads it there): the format the draft's answer keeps (#2412). Cut of the host's secrets, as what was said is.
197
+ const proposing = new Set(passing.map(({ file }) => file));
198
+ const drafted = passing.filter(({ file }) => file.endsWith("/workflow.json")).map(({ file }) => skillOf(file)).filter((file) => !proposing.has(file) && texts.has(file)).map((file) => ({ file, text: redactSecrets(texts.get(file), input.refuse, Number.POSITIVE_INFINITY) }));
199
+ const proposal = { seed: input.seed, notes: checked.notes.map(({ file, text }) => ({ file, text })), ...(passing.length ? { files: passing } : {}), ...(Object.keys(ran).length ? { dryRuns: ran } : {}), ...(drafted.length ? { drafted } : {}), asked, ...(triggered.length ? { triggered } : {}) };
177
200
  await writeDurable(join(input.runDir, PROPOSAL), `${JSON.stringify(proposal)}\n`);
178
201
  const count = (suffix) => passing.filter(({ file }) => file.endsWith(suffix)).length;
179
202
  return { state: "proposed", notes: proposal.notes.length, skills: count("/SKILL.md"), workflows: count("/workflow.json"), ...(left.length ? { left } : {}) };
package/dist/provider.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { chooseModel, FAUX_ENV, hostModel } from "./model.js";
2
2
  import { WIRES } from "./wires.js";
3
+ import { modelFormWhy } from "./model-form.js";
3
4
  // Each wire's own settings live in a leaf module (wires.ts), which the harness table reads as it loads.
4
5
  export { WIRES };
5
6
  /** Why this server cannot run a harness here, in words a person can act on; `fix`, when installing is the fix; `keys`,
@@ -151,14 +152,14 @@ export async function modelOn(wire, env, ref, harness) {
151
152
  const modelId = named.slice(vendor.length + 1);
152
153
  const { builtinModels } = await import("@earendil-works/pi-ai/providers/all");
153
154
  if (!builtinModels().getModel(vendor, modelId))
154
- return { why: `pi-ai knows no model ${modelId} of ${vendor}. Name one of its models, or route every model through a gateway with AGENT_MODEL_BASE_URL.`, host: ref === undefined, needs: "model" };
155
+ return { why: modelFormWhy(env, harness, named, ref === undefined), host: ref === undefined, needs: "model" };
155
156
  return { model: { provider: vendor, modelId } };
156
157
  }
157
158
  if (!named)
158
159
  return { why: `No model yet for ${harness}: add an OpenRouter or ${label} key in Settings → Model keys, or set OPENROUTER_API_KEY or ${WIRES[wire].key} where AgentRun starts.`, host: true };
159
160
  const slash = named.indexOf("/");
160
161
  if (slash < 1)
161
- return { why: `${harness} runs a model named ${vendor}/<model-id>; the run's model is ${named}.`, host: ref === undefined };
162
+ return { why: modelFormWhy(env, harness, named, ref === undefined), host: ref === undefined };
162
163
  const [provider, modelId] = [named.slice(0, slash), named.slice(slash + 1)];
163
164
  // OpenRouter's name for a model is OpenRouter's provider, then the vendor's model; another vendor's is providerFor's
164
165
  // to refuse.
@@ -1,7 +1,8 @@
1
1
  import type { TimelineEvent } from "./timeline/index.js";
2
2
  import type { Status } from "./run-view.js";
3
3
  /** A run's end-of-run turn: the job's outcome, the newest store entry before the turn and, once the run ended, the newest
4
- * after it (its rows are those between), its deadline, and how it ended. */
4
+ * after it (its rows are those between), its deadline, and how it ended. `earlier`: the turns of the run's earlier ends,
5
+ * each closed (a follow-up opened the run again after it looked back), whose rows are the turn's too. */
5
6
  export type Reflect = {
6
7
  outcome: Status;
7
8
  after: number;
@@ -9,6 +10,12 @@ export type Reflect = {
9
10
  deadline: string;
10
11
  ended?: true;
11
12
  timedOut?: true;
13
+ earlier?: readonly ReflectSpan[];
14
+ };
15
+ /** One earlier end-of-run turn of a run: the store entry before it, and the run's end entry that closed it. */
16
+ export type ReflectSpan = {
17
+ readonly after: number;
18
+ readonly until: number;
12
19
  };
13
20
  /** The run asked its end-of-run turn and has not ended since. */
14
21
  export declare const reflecting: (run: {
@@ -12,7 +12,7 @@ export function reflects(reflect, id) {
12
12
  return false;
13
13
  const entry = typeof id === "number" ? id : entryOf(id);
14
14
  if (Number.isInteger(entry))
15
- return entry > reflect.after && (reflect.until === undefined || entry <= reflect.until);
15
+ return (entry > reflect.after && (reflect.until === undefined || entry <= reflect.until)) || (reflect.earlier ?? []).some(({ after, until }) => entry > after && entry <= until);
16
16
  return reflect.until === undefined && typeof id === "string" && id.includes(":live:");
17
17
  }
18
18
  /** `rows` with the end-of-run turn's labelled: never the run's answer (meaningful skips the label), its answer shown as
package/dist/run-cut.d.ts CHANGED
@@ -13,6 +13,11 @@ export declare function runCutValues(deps: {
13
13
  }): Promise<{
14
14
  values: string[];
15
15
  } | "unreadable">;
16
+ /** `build` against run `runId`'s cut, and the cut read again once it is built: `build` is made again, under the cut as it then
17
+ * stood, until the cut it ran under is the cut after it. The cut only grows (a value saved stays held), so a cut that is the
18
+ * same after a build holds every value saved before that build's reads, and what `build` rendered under it is cut of all
19
+ * of them. A cut that keeps growing past CUT_TRIES builds fails closed: `build` is made under `unreadable`, the run withheld. */
20
+ export declare function underCut<T>(read: () => Promise<Awaited<ReturnType<typeof runCutValues>>>, build: (cut: Awaited<ReturnType<typeof runCutValues>>) => Promise<T>): Promise<T>;
16
21
  /** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
17
22
  * rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
18
23
  * by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
package/dist/run-cut.js CHANGED
@@ -18,6 +18,25 @@ export async function runCutValues(deps, store, runId, known) {
18
18
  return "unreadable";
19
19
  return { values: [...deps.serverSecrets(), ...handed.refs.filter((ref) => ref.length >= MIN_SECRET)] };
20
20
  }
21
+ /** How many times `underCut` builds again against a cut that grew while it built, before it gives up and withholds. */
22
+ const CUT_TRIES = 5;
23
+ /** `build` against run `runId`'s cut, and the cut read again once it is built: `build` is made again, under the cut as it then
24
+ * stood, until the cut it ran under is the cut after it. The cut only grows (a value saved stays held), so a cut that is the
25
+ * same after a build holds every value saved before that build's reads, and what `build` rendered under it is cut of all
26
+ * of them. A cut that keeps growing past CUT_TRIES builds fails closed: `build` is made under `unreadable`, the run withheld. */
27
+ export async function underCut(read, build) {
28
+ const same = (a, b) => a === "unreadable" || b === "unreadable" ? a === b : new Set(a.values).size === new Set([...a.values, ...b.values]).size && new Set(b.values).size === new Set(a.values).size;
29
+ let cut = await read();
30
+ for (let tries = 1;; tries++) {
31
+ const built = await build(cut);
32
+ const now = await read();
33
+ if (same(cut, now))
34
+ return built;
35
+ if (tries >= CUT_TRIES)
36
+ return build("unreadable");
37
+ cut = now;
38
+ }
39
+ }
21
40
  /** Run `runId`'s error words: how its error text reads wherever it is served (its view's error, its Timeline's error
22
41
  * rows), main's errorWords: a refused key in plain words (key-refusal.ts keyRefusal, the key its harness's route sends
23
42
  * by this server's settings and keys), else the text by the one rule (shownOf); `unreadable` when the run is withheld.
@@ -13,6 +13,9 @@ export interface RunLaunch {
13
13
  /** The start request's body, as the person or trigger gave it, or an object a built-in run names. */
14
14
  readonly input: unknown;
15
15
  readonly title: string;
16
+ /** The GitHub repository (owner/name) a person's run reaches, from the start body's `repo` or its agent's one bound
17
+ * repository (run-repo.ts); a github trigger's run has none here, its event names it. */
18
+ readonly repo?: string;
16
19
  readonly place: Place;
17
20
  /** The loop's adapter, when not the revision's: a built-in learning run names "learning". */
18
21
  readonly harness?: string;
@@ -43,12 +46,16 @@ export interface RunLaunch {
43
46
  * shows them); `seed`, the learning commit's sha (or null when the seed could not be read); and `section`, the exact
44
47
  * # Learned text to lay into the prompt for those notes (what the old layLearned laid), within the learning budget; and
45
48
  * `seedNotes`, the count of all notes in the seed before the budget picked `given` (present with a read seed; absent when
46
- * the seed could not be read); `skills`, the names of the learned skills the seed offers the run (each active one that
49
+ * the seed could not be read); `notesLeftOut`, the files of the active notes the section names in no way, over the
50
+ * learning budget, which its claim says in the run's log, absent when none; `skills`, the names of the learned skills the seed offers the run (each active one that
47
51
  * fits a run's skill budget at all; its claim lays them), absent when none; `workflows`, the names of the learned
48
- * workflows the seed offers its learned_workflow tool (chooseWorkflows), absent when none; `gradeModel`, the model the
52
+ * workflows the seed offers its learned_workflow tool (chooseWorkflows), absent when none; `notesOnly`, a run of a
53
+ * revision that says `learning: "notes"`: given its notes and skills but never a learned workflow, and asked for no
54
+ * workflow draft at its end; `gradeModel`, the model the
49
55
  * server names to grade what the run proposes (learning.ts gradeModelOf: --grade-model, else AGENTRUN_SERVE_GRADE_MODEL,
50
56
  * else AGENT_MODEL_STRONG), absent when it names none and the agent's own grades it; and `seedFailed`, why it starts with
51
- * nothing learned when it does (SeedFailed). Absent when the run does not learn. */
57
+ * nothing learned when it does (SeedFailed); `use`, a run started with `learning: "use"` (learning.ts RUN_LEARNING_USE):
58
+ * it starts from all of the above and keeps nothing, never asked its end-of-run turn. Absent when the run does not learn. */
52
59
  readonly learning?: {
53
60
  readonly given: readonly {
54
61
  readonly file: string;
@@ -57,10 +64,13 @@ export interface RunLaunch {
57
64
  readonly seed: string | null;
58
65
  readonly section: string;
59
66
  readonly seedNotes?: number;
67
+ readonly notesLeftOut?: readonly string[];
60
68
  readonly skills?: readonly string[];
61
69
  readonly workflows?: readonly string[];
70
+ readonly notesOnly?: true;
62
71
  readonly gradeModel?: string;
63
72
  readonly seedFailed?: SeedFailed;
73
+ readonly use?: true;
64
74
  };
65
75
  /** The trigger and firing that started the run, or none for a person's run. */
66
76
  readonly trigger?: RunTrigger;
@@ -68,6 +78,21 @@ export interface RunLaunch {
68
78
  readonly inputOrigin?: MessageOrigin;
69
79
  /** A run that re-asks its agent after it ends (a trigger's follow-up). */
70
80
  readonly followUp?: boolean;
81
+ /** The Archil disk the run keeps its folder on (Archil mode), chosen at its start: the one its launch named (`launch`, a
82
+ * customer's disk agentrun never makes or removes), or its agent's when the agent had one then (`agent`). Absent, the
83
+ * run uses its agent's disk, made at its claim when the agent has none (workspace/run-disk.ts). Kept here so every
84
+ * claim, revoke and reclaim of the run, after a restart too, acts on that one disk. */
85
+ readonly archilDisk?: LaunchDisk;
86
+ /** A run started with `hold: true` (computer-held.ts): its computer waits for its owner's start, and stays the owner's
87
+ * after the agent's end until released, each wait for at most `minutes` with no call. */
88
+ readonly hold?: {
89
+ readonly minutes: number;
90
+ };
91
+ }
92
+ /** The disk a launch record names, and whose it is. */
93
+ export interface LaunchDisk {
94
+ readonly diskId: string;
95
+ readonly kind: "launch" | "agent";
71
96
  }
72
97
  /** The input's origin kept through the fail-safe (#1856): the stored one only if it names `trigger` with
73
98
  * owner === (its source is a schedule), else that trigger's own with owner false (its source a best-effort label: the