@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
@@ -13,10 +13,12 @@
13
13
  // merge's call merges once.
14
14
  import { BACKGROUND_CONTEXT, withAbortSignal } from "@earendil-works/chord/context";
15
15
  import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
16
+ import { GENERAL_NO_BUDGET, GENERAL_THRESHOLD, ONE_CASE } from "../learn/general.js";
16
17
  import { CONTRADICTED_REASON, CONTRADICTED_TWICE_REASON, CONTRADICTION_ASK, gradedItems, gradePrompt, parseVerdict, UNREADABLE_REASON } from "../learn/grade.js";
17
- import { mergedNote, parseNoteFile } from "../learn/notes.js";
18
+ import { mergedNote, parseNoteFile, ruleOf } from "../learn/notes.js";
18
19
  import { learnedPlace } from "../learn/skills.js";
19
- import { notKept, said, STOPPED } from "../learning-words.js";
20
+ import { blobOid } from "../learn/folder.js";
21
+ import { notKept, SAME_NOTE, said, STOPPED } from "../learning-words.js";
20
22
  import { journalEntries } from "./journal-reader.js";
21
23
  import { KINDS } from "./journal-kinds.js";
22
24
  /** The grader's bounds, as the server's grade had them (grade.ts): one ask, its answer cut at GRADE_MAX_TOKENS. */
@@ -25,6 +27,32 @@ export const GRADE_MAX_TOKENS = 16_000;
25
27
  /** A folder the merge could not reach (the workspace or its exec down): the run parks and is retried after this, doubling
26
28
  * per try up to the last. */
27
29
  export const UNAVAILABLE_BACKOFF_MS = [30_000, 120_000, 600_000, 1_800_000];
30
+ /** A grader call its learning run's cap refused before it was sent (learning-ask.ts bookedAsk: the run's cap left, its
31
+ * launch's max_cost_usd): nothing of it was spent, and the grade is skipped, said so (said.noRoomToGrade), never run past
32
+ * the cap, never a failure. `forGood`: no room could ever send it (its spend or price unknown), not only none now. */
33
+ export class GradeOverCap extends Error {
34
+ forGood;
35
+ booked;
36
+ /** `booked`: the grade's records when it was refused (GradeBooked), what it spent before it. */
37
+ constructor(message, forGood, booked) {
38
+ super(message);
39
+ this.forGood = forGood;
40
+ this.booked = booked;
41
+ this.name = "GradeOverCap";
42
+ }
43
+ }
44
+ /** A generality check its learning run's cap refused before any of its requests left (learning-dispatch.ts general: its
45
+ * worst case over the cap left): nothing of it was sent or spent, and it is skipped as `unchecked` "no_budget"
46
+ * (GENERAL_NO_BUDGET), said so, the grader then judged against the cap on its own. `forGood`: no room could ever send it
47
+ * (its provider's price unknown here), not only none now. */
48
+ export class GeneralOverCap extends Error {
49
+ forGood;
50
+ constructor(message, forGood) {
51
+ super(message);
52
+ this.forGood = forGood;
53
+ this.name = "GeneralOverCap";
54
+ }
55
+ }
28
56
  const ROOT = ROOT_CONVERSATION_ID;
29
57
  /** The graded item a proposal's file is judged as (grade.ts itemOf): a draft's README.md with its workflow.json, every
30
58
  * other file as itself. */
@@ -32,28 +60,117 @@ const itemOf = (file) => {
32
60
  const place = learnedPlace(file);
33
61
  return place?.kind === "readme" ? `workflows/${place.name}/workflow.json` : file;
34
62
  };
35
- /** `proposal` with only what `verdict` keeps (a verdict per item): a note or file its item keeps or holds. */
63
+ /** The why of a note whose name main already holds with other text, which it does not supersede: never written over,
64
+ * and the rest of what the run learned merges. */
65
+ export const NOTE_NAME_TAKEN = (name) => `A note named ${name} was added since this run started, or was there already; this one wasn't kept.`;
66
+ /** The why of a skill re-filed as a note whose file this run's own kept note (or another re-filed skill) takes: the run's
67
+ * own stands, and the skill is not written over it. */
68
+ export const NOTE_NAME_IN_RUN = (name) => `This run also kept a note named ${name}, so the rule was not re-filed over it.`;
69
+ /** What `verdict` merges once each note it keeps (a new note's, or a skill's re-filed as one: its item's `note`) is set
70
+ * beside the run's other kept notes and what main holds at that file (`onMain`, by path), one item at a time, never a
71
+ * refusal of the whole merge. One file is one item's: a skill re-filed as a note whose file the run's own kept note
72
+ * (or an earlier re-filed skill) takes is dropped, saying so (NOTE_NAME_IN_RUN), so one text is written and the item
73
+ * that holds it is the one whose hold it keeps. Against main: a note main holds the same is no change, dropped unsaid
74
+ * (SAME_NOTE); one whose own front matter supersedes the note of its name is a modification, written over it
75
+ * (`replace`, main's blob in `graded`, so a change since is a conflict); any other is dropped, saying so
76
+ * (NOTE_NAME_TAKEN), and main's note stands. No suffixed name: it would hold the same rule twice. A rule another note
77
+ * holds is the merge's own to settle, against the main it commits on (learn/commit.ts mergeOf). Merge when the grader
78
+ * said so and it still keeps an item. */
79
+ /** Whether `held`, the note main holds at `file`, says the same rule as `text`: their bodies, whitespace and case aside
80
+ * (notes.ts ruleOf), as readMain and the merge's own settle (learn/commit.ts) read it, whatever their front matter. A
81
+ * text that is no note is the same only when it is the same text. */
82
+ /** The rule a re-filed note says (notes.ts ruleOf), "" when its text is no note: what the merge checks main still holds
83
+ * before it retires the skill that note replaces. */
84
+ const ruleOfText = (file, text) => {
85
+ const note = parseNoteFile(file, text);
86
+ return Array.isArray(note) ? "" : ruleOf(note.body);
87
+ };
88
+ const sameRule = (file, held, text) => {
89
+ const [theirs, ours] = [parseNoteFile(file, held), parseNoteFile(file, text)];
90
+ return !Array.isArray(theirs) && !Array.isArray(ours) ? ruleOf(theirs.body) === ruleOf(ours.body) : held === text;
91
+ };
92
+ export function takenOnMain(proposal, verdict, onMain) {
93
+ const texts = new Map(proposal.notes.map(({ file, text }) => [file, text]));
94
+ const replace = [];
95
+ const graded = {};
96
+ const items = oneItemAFile(proposal, verdict).items.map((item) => {
97
+ const note = item.note ?? (texts.has(item.file) ? { file: item.file, text: texts.get(item.file) } : undefined);
98
+ const held = item.keep && note ? onMain[note.file] : undefined;
99
+ if (!note || held === undefined)
100
+ return item;
101
+ const identical = held === note.text || held === mergedNote(note.text, { origin: item.origin ?? "run", ...(item.pending ? { pending: true } : {}) });
102
+ const parsed = parseNoteFile(note.file, note.text);
103
+ // One that supersedes the note of its own name and is not the very text main holds: a modification, written over it.
104
+ if (!identical && !item.note && !Array.isArray(parsed) && parsed.supersedes.includes(note.file)) {
105
+ replace.push(note.file);
106
+ graded[note.file] = blobOid(held);
107
+ return item;
108
+ }
109
+ // Else the same rule an active note of main keeps (whatever its front matter, case or spacing) is no change, dropped
110
+ // unsaid, and a skill re-filed as it retired (mergeChangeOf); a retired or superseded note of that rule keeps it out
111
+ // of every run, so it is a name main holds, and nothing is retired: the rule never vanishes. Any other is a name main
112
+ // holds with another rule.
113
+ const theirs = parseNoteFile(note.file, held);
114
+ const same = !Array.isArray(theirs) && theirs.status === "active" && (identical || sameRule(note.file, held, note.text));
115
+ return { file: item.file, keep: false, question: "Duplicate", why: same ? SAME_NOTE : NOTE_NAME_TAKEN(note.file.replace(/\.md$/, "")), ...(item.note ? { note: item.note } : {}) };
116
+ });
117
+ return { verdict: { ...verdict, items, merge: verdict.merge && items.some((item) => item.keep) }, replace, graded };
118
+ }
119
+ /** `verdict` with one item per file a kept note is written as, within the run: the files the run's own kept notes are,
120
+ * then each re-filed skill's as it is kept; a re-filed skill whose note file one of those takes is left out, saying so
121
+ * (NOTE_NAME_IN_RUN). The merge (takenOnMain) and its resume (resumedOf, from the saved grade) settle it the one way. */
122
+ export function oneItemAFile(proposal, verdict) {
123
+ const own = new Set(proposal.notes.map(({ file }) => file));
124
+ const claimed = new Set(verdict.items.filter((item) => item.keep && !item.note && own.has(item.file)).map((item) => item.file));
125
+ const items = verdict.items.map((item) => {
126
+ if (!item.keep || !item.note)
127
+ return item;
128
+ if (claimed.has(item.note.file))
129
+ return { file: item.file, keep: false, question: "Duplicate", why: NOTE_NAME_IN_RUN(item.note.file.replace(/\.md$/, "")) };
130
+ claimed.add(item.note.file);
131
+ return item;
132
+ });
133
+ return { ...verdict, items, merge: verdict.merge && items.some((item) => item.keep) };
134
+ }
135
+ /** `proposal` with only what `verdict` keeps (a verdict per item): a note or file its item keeps or holds; a skill its
136
+ * item re-filed (`note`: a standing rule for every reply) is kept as that note instead, never as a skill. */
36
137
  export function keptOf(proposal, verdict) {
37
138
  if (!verdict.items.length)
38
139
  return proposal;
39
- const kept = new Set(verdict.items.filter((item) => item.keep).map((item) => item.file));
40
- return { ...proposal, notes: proposal.notes.filter(({ file }) => kept.has(file)), files: (proposal.files ?? []).filter(({ file }) => kept.has(itemOf(file))) };
140
+ const kept = new Set(verdict.items.filter((item) => item.keep && !item.note).map((item) => item.file));
141
+ const refiled = verdict.items.flatMap((item) => (item.keep && item.note ? [item.note] : []));
142
+ return { ...proposal, notes: [...proposal.notes.filter(({ file }) => kept.has(file)), ...refiled], files: (proposal.files ?? []).filter(({ file }) => kept.has(itemOf(file))) };
41
143
  }
144
+ /** Each item the verdict keeps by the file it is merged as: a re-filed skill's item by its note's file too. A dropped
145
+ * item names no file it merges as; of two kept items for one file (takenOnMain lets none through), the held one stands,
146
+ * so a hold is never lost to the order of the items. */
147
+ const itemsByFile = (verdict) => {
148
+ const byFile = new Map();
149
+ for (const item of verdict.items.filter((one) => one.keep)) {
150
+ for (const file of [item.file, ...(item.note ? [item.note.file] : [])])
151
+ if (!byFile.get(file)?.pending)
152
+ byFile.set(file, item);
153
+ }
154
+ return byFile;
155
+ };
42
156
  /** The merge of `merging` (what the verdict kept), the one rule learningCommit's merge is made by: each note with
43
157
  * the origin its item gives (`you` for the user's own words, else the run's) and held for its owner's OK when its item
44
158
  * is pending; a skill's SKILL.md or a draft's README.md held when its item is (a draft's workflow.json is held by its
45
159
  * README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict. */
46
- export function mergeChangeOf(runId, merging, verdict, graded) {
47
- const judged = new Map(verdict.items.map((item) => [item.file, item]));
160
+ export function mergeChangeOf(runId, merging, verdict, graded, round = 1) {
161
+ const judged = itemsByFile(verdict);
48
162
  const notes = merging.notes.map(({ file, text }) => ({ path: file, text: mergedNote(text, { origin: judged.get(file)?.origin ?? "run" }) }));
49
163
  const files = (merging.files ?? []).map(({ file, text }) => ({ path: file, text }));
50
164
  const held = [
51
165
  ...merging.notes.filter(({ file }) => judged.get(file)?.pending === true).map(({ file }) => file),
52
166
  ...files.filter(({ path }) => learnedPlace(path)?.kind !== "workflow" && judged.get(itemOf(path))?.pending === true).map(({ path }) => path),
53
167
  ];
168
+ // Each skill re-filed as a note is retired on main in the same write (learn/commit.ts mergeOf): a kept one, and one
169
+ // main already holds the same rule of as a note (dropped unsaid), so no old skill stays served beside its note.
170
+ const retire = verdict.items.flatMap((item) => (item.note && (item.keep || item.why === SAME_NOTE) && learnedPlace(item.file)?.kind === "skill" ? [{ skill: item.file, note: item.note.file, rule: ruleOfText(item.note.file, item.note.text) }] : []));
54
171
  return {
55
- kind: "merge", runId, reason: verdict.reason || "The grader kept every new note.", files: [...notes, ...files],
56
- ...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}),
172
+ kind: "merge", runId, ...(round > 1 ? { round } : {}), reason: verdict.reason || "The grader kept every new note.", files: [...notes, ...files],
173
+ ...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}), ...(retire.length ? { retire } : {}),
57
174
  };
58
175
  }
59
176
  /** What a merge of `merging` learned, as the server's grade named it on the run (learning-run.ts grade): the notes it
@@ -61,7 +178,7 @@ export function mergeChangeOf(runId, merging, verdict, graded) {
61
178
  * drafts, each pending when it waits. The merge's words and the reader of a run's learning end (store-reads/learning.ts)
62
179
  * both name it so. */
63
180
  export function learnedOf(merging, verdict) {
64
- const waiting = new Set(verdict.items.filter((item) => item.pending).map((item) => item.file));
181
+ const waiting = new Set(verdict.items.filter((item) => item.pending).flatMap((item) => [item.file, ...(item.note ? [item.note.file] : [])]));
65
182
  const notes = merging.notes.flatMap(({ file, text }) => {
66
183
  const note = parseNoteFile(file, text);
67
184
  return Array.isArray(note) ? [] : [{ file, name: note.name, supersedes: note.supersedes }];
@@ -78,9 +195,55 @@ export function learnedOf(merging, verdict) {
78
195
  * the checks left out (the kept row's `left`). */
79
196
  function mergedWords(merging, verdict, checked) {
80
197
  const { learned, pending, skills, workflows } = learnedOf(merging, verdict);
81
- const left = verdict.items.filter((item) => !item.keep).map((item) => ({ why: item.why }));
198
+ // A re-filed rule main already holds the same is no change: never said.
199
+ const left = verdict.items.filter((item) => !item.keep && item.why !== SAME_NOTE).map((item) => ({ why: item.why }));
82
200
  return said.merged(learned, pending, [...skills, ...workflows], left, checked);
83
201
  }
202
+ /** `merging` and `verdict` once the merge left out `left` (learn/commit.ts LeftNote): each note it left out is no longer
203
+ * merged, and its item is dropped, unsaid when its rule is held already (SAME_NOTE), else saying its name is taken. */
204
+ export function leftOf(merging, verdict, left) {
205
+ if (!left.length)
206
+ return { merging, verdict };
207
+ const why = new Map(left.map(({ path, reason }) => [path, reason === "same" ? SAME_NOTE : NOTE_NAME_TAKEN(path.replace(/\.md$/, ""))]));
208
+ const items = verdict.items.map((item) => {
209
+ const file = item.note?.file ?? item.file;
210
+ return item.keep && why.has(file) ? { file: item.file, keep: false, question: "Duplicate", why: why.get(file), ...(item.note ? { note: item.note } : {}) } : item;
211
+ });
212
+ return { merging: { ...merging, notes: merging.notes.filter(({ file }) => !why.has(file)) }, verdict: { ...verdict, items } };
213
+ }
214
+ /** What a merge already on main settled (learn/commit.ts: its files, and `left`, the new notes it did not write): each
215
+ * note the grade kept is kept when the merge wrote it, its path changed and main holding its rule there now (`onMain`,
216
+ * the texts main holds at the kept notes' paths), else left out, saying why as takenOnMain said it (`taken`, its
217
+ * verdict after main was read), or by main's text there (the same rule, or a name it holds with another), else as the
218
+ * commit does. Skills and drafts as the grade kept them. */
219
+ export function resumedOf(proposal, graded, taken, result, onMain) {
220
+ const written = new Set(result.files);
221
+ const texts = new Map(proposal.notes.map(({ file, text }) => [file, text]));
222
+ const said = new Map((result.left ?? []).map(({ path, reason }) => [path, reason]));
223
+ const notes = new Set(proposal.notes.map(({ file }) => file));
224
+ // One item per file, as the first attempt's takenOnMain settled it: the saved grade keeps both a run's note and a skill
225
+ // re-filed as a note of its file, and only one of them was written.
226
+ const settled = oneItemAFile(proposal, graded);
227
+ const items = settled.items.map((item, i) => {
228
+ const file = item.note?.file ?? item.file;
229
+ if (!item.keep || !(item.note || notes.has(file)))
230
+ return item;
231
+ // Saved: the merge changed its path and main holds its rule there now (`onMain`, read after the merge). A path the
232
+ // merge changed for another reason (a note it marked superseded) holds another rule, and saves no item of its own.
233
+ const text = item.note?.text ?? texts.get(file);
234
+ const held = onMain[file];
235
+ if (written.has(file) && (held === undefined || text === undefined || sameRule(file, held, text)))
236
+ return item;
237
+ const before = taken.items[i];
238
+ if (before && !before.keep && before.why !== SAME_NOTE)
239
+ return before;
240
+ const same = held !== undefined && text !== undefined ? sameRule(file, held, text) : said.get(file) !== "taken";
241
+ const why = same ? SAME_NOTE : NOTE_NAME_TAKEN(file.replace(/\.md$/, ""));
242
+ return { file: item.file, keep: false, question: "Duplicate", why, ...(item.note ? { note: item.note } : {}) };
243
+ });
244
+ const verdict = { ...settled, items };
245
+ return { merging: keptOf(proposal, verdict), verdict };
246
+ }
84
247
  /** The skills and drafts a proposal names, by their item's file: what a merge the grader refused loses (notKept). */
85
248
  export const lostOf = (proposal) => (proposal.files ?? []).flatMap(({ file }) => {
86
249
  const place = learnedPlace(file);
@@ -142,7 +305,8 @@ export function createLearningLoop(learning) {
142
305
  await append(KINDS.learningDropped, { source: "", reason: "no_source", detail: said.stopped(STOPPED.notChecked) }, "failed");
143
306
  return { state: "failed", error: { code: "learning_no_source", message: "the learning run names no run that learned" } };
144
307
  }
145
- const kept = await learning.proposal(source.runId);
308
+ const round = source.round ?? 1;
309
+ const kept = await learning.proposal(source.runId, round);
146
310
  if (!kept) {
147
311
  await append(KINDS.learningDropped, { source: source.runId, reason: "no_proposal", detail: said.stopped(STOPPED.notChecked) }, "ended");
148
312
  return { state: "ended" };
@@ -172,15 +336,134 @@ export function createLearningLoop(learning) {
172
336
  await append(KINDS.learningDropped, { source: source.runId, reason: "checker", detail: said.stale(main.problems), problems: main.problems }, "ended");
173
337
  return { state: "ended" };
174
338
  }
175
- const items = gradedItems(proposal.notes, (proposal.files ?? []));
176
- const prompt = gradePrompt({
177
- run: source.runId, ...(source.instructions ? { instructions: source.instructions } : {}), active: main.active, superseded: main.superseded, proposed: proposal.notes,
178
- ...(proposal.files?.length ? { files: proposal.files } : {}), ...(proposal.dryRuns ? { dryRuns: proposal.dryRuns } : {}), ...(proposal.asked ? { asked: proposal.asked } : {}), ...(proposal.triggered ? { triggered: proposal.triggered } : {}), ...(proposal.held ? { held: proposal.held } : {}),
179
- });
180
- // What the grade spends, as the server's grade counted it (grade.ts counter): each ask's dollars and tokens
339
+ // A note named like one main holds now is settled alone, out of the grade (readMain's `taken`); the rest is
340
+ // graded. Nothing left to grade keeps nothing.
341
+ const taken = new Map((main.taken ?? []).map(({ path, reason }) => [path, reason]));
342
+ let grading = proposal.notes.filter(({ file }) => !taken.has(file));
343
+ const settledItems = [...taken].map(([file, reason]) => ({ file, keep: false, question: "Duplicate", why: reason === "same" ? SAME_NOTE : NOTE_NAME_TAKEN(file.replace(/\.md$/, "")) }));
344
+ // What the grader spends, as the server's grade counted it (grade.ts counter): each ask's dollars and tokens
181
345
  // added, either unknown (null) once any ask's is, and an ask that fails spent what nobody knows.
182
346
  let usd = 0;
183
347
  let tokens = { input: 0, cache_read: 0, cache_write: 0, output: 0 };
348
+ // What the generality pre-check's Jev requests spent (its kept dollars, null once unknown), outside the
349
+ // grader's records, and the most they may have spent (`beside`: those dollars, else their worst case), which
350
+ // each grader call's room under the cap leaves out. The grade ends with both: Jev's and the grader's.
351
+ let checkUsd = 0;
352
+ let beside = 0;
353
+ const spent = () => (checkUsd === null || usd === null ? null : checkUsd + usd);
354
+ // The generality pre-check: a note Jev scores under the bar rests on its one input, and is dropped before the
355
+ // grader reads it, its why said with the grader's items. Jev down or not set up here: every note is graded.
356
+ let screened = false;
357
+ // Why the check could not run, kept on the grade's (or the drop's) entry: never a silent skip.
358
+ let unchecked;
359
+ if (grading.length && learning.general) {
360
+ const threshold = learning.generalThreshold ?? GENERAL_THRESHOLD;
361
+ const input = proposal.asked?.[0] ?? proposal.triggered?.[0]?.text;
362
+ // The check is paid and Jev dedupes none, so it is made durable as the grade's ask is (learning-ask.ts
363
+ // bookedAsk): marked sent before its requests leave, and its end kept before the grader starts. A restart
364
+ // reuses a check that ended, paying nothing again; one an earlier attempt sent with no end after it was cut,
365
+ // what it spent is unknown (null, as a cut grade request is booked before it is asked again), and it is
366
+ // asked again with that unknown kept.
367
+ let ended = [...entries].reverse().find((entry) => entry.kind === KINDS.learningGeneral)?.data;
368
+ if (!ended) {
369
+ const sentMarks = entries.filter((entry) => entry.kind === KINDS.learningGeneralSent);
370
+ const cut = sentMarks.length > 0;
371
+ if (cut)
372
+ learning.log?.(`learning run ${claim.runId}: a generality check an earlier attempt sent was cut, so what it spent is unknown; it is asked again`);
373
+ // Under a cap: the most the cut attempts' requests may have spent (each mark's worst case), and this one's.
374
+ const cutHeld = sentMarks.reduce((sum, entry) => sum + (entry.data?.held ?? 0), 0);
375
+ let sentHeld = 0;
376
+ let checked;
377
+ let failed;
378
+ let overCap;
379
+ try {
380
+ checked = await learning.general(grading, { ...(source.instructions ? { job: source.instructions } : {}), ...(input !== undefined ? { input } : {}) }, AbortSignal.any([deps.signal, stopAsk.signal]), source.runId, async (held) => {
381
+ sentHeld += held ?? 0;
382
+ await append(KINDS.learningGeneralSent, { source: source.runId, ...(held !== undefined ? { held } : {}) });
383
+ await deps.flush();
384
+ }, cutHeld);
385
+ }
386
+ catch (error) {
387
+ // Cut by a stop, a lost claim or a shutdown: what it sent spent what nobody knows. A stop row ends the run
388
+ // stopped with that unknown; otherwise nothing more is written, and the next attempt finds it sent with no
389
+ // end, books it unknown and asks again.
390
+ if (stopped || deps.signal.aborted) {
391
+ spend = null;
392
+ return (await halted()) ?? { state: "interrupted" };
393
+ }
394
+ // No room under the run's cap for its worst case: nothing sent, skipped, said so (never silent), and the
395
+ // grader judged against the cap on its own.
396
+ if (error instanceof GeneralOverCap)
397
+ overCap = error;
398
+ else {
399
+ // Its requests were sent and one failed: what they spent is unknown, never 0 (as an ask that fails is).
400
+ // Its error is kept and logged cut of the runner's secrets (LoopDeps.redact).
401
+ const message = error?.message ?? String(error);
402
+ failed = deps.redact ? deps.redact(message) : message;
403
+ learning.log?.(`learning run ${claim.runId}: the generality check could not run, so the grader reads every note: ${failed}`);
404
+ }
405
+ }
406
+ const held = cutHeld + sentHeld;
407
+ const bound = held > 0 ? { held } : {};
408
+ if (checked)
409
+ ended = { source: source.runId, scores: checked.scores, usd: cut ? null : checked.usd, ...bound };
410
+ else if (overCap) {
411
+ learning.log?.(`learning run ${claim.runId}: the generality check has no room under the cap (${overCap.message}), so the grader reads every note`);
412
+ ended = { source: source.runId, unchecked: GENERAL_NO_BUDGET, usd: cut ? null : 0, ...bound };
413
+ }
414
+ else if (failed !== undefined)
415
+ ended = { source: source.runId, unchecked: failed, usd: null, ...bound };
416
+ else if (cut)
417
+ ended = { source: source.runId, unchecked: "no Jev is set up on this host now", usd: null, ...bound };
418
+ // Kept, durably, before the grader starts: a restart from here on asks Jev nothing.
419
+ if (ended) {
420
+ await append(KINDS.learningGeneral, ended);
421
+ await deps.flush();
422
+ }
423
+ }
424
+ if (ended) {
425
+ checkUsd = ended.usd;
426
+ beside = ended.usd ?? ended.held ?? 0;
427
+ if (ended.unchecked !== undefined)
428
+ unchecked = ended.unchecked;
429
+ if (ended.scores) {
430
+ screened = true;
431
+ const scores = ended.scores;
432
+ const below = grading.filter(({ file }) => typeof scores[file] === "number" && scores[file] < threshold);
433
+ settledItems.push(...below.map(({ file }) => ({ file, keep: false, question: "General", why: ONE_CASE(scores[file], threshold) })));
434
+ grading = grading.filter((note) => !below.includes(note));
435
+ }
436
+ }
437
+ }
438
+ // The notes the graded ones supersede, of those main gave: a dropped note's are not the grade's.
439
+ const replacing = new Set(grading.flatMap((note) => { const parsed = parseNoteFile(note.file, note.text); return Array.isArray(parsed) ? [] : parsed.supersedes; }));
440
+ const superseded = main.superseded.filter(({ file }) => replacing.has(file));
441
+ if (!grading.length && !proposal.files?.length) {
442
+ const verdict = { merge: false, reason: settledItems.some(({ question }) => question === "General") ? "No new note holds beyond the one input it came from, or each is named like one the agent holds now." : "Every new note is named like one the agent holds now.", items: settledItems };
443
+ // A proposal the generality check emptied is recorded as a grade (its verdict, each item's why, what the check
444
+ // spent) before it is dropped, so the run's learning reads why each note was left out.
445
+ if (screened)
446
+ await append(KINDS.learningGraded, { source: source.runId, verdict, usd: spent(), tokens, graded: main.graded });
447
+ await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(verdict, lostOf(proposal)), usd: spent(), tokens }, "ended");
448
+ return { state: "ended" };
449
+ }
450
+ const items = gradedItems(grading, (proposal.files ?? []));
451
+ const prompt = gradePrompt({
452
+ run: source.runId, ...(source.instructions ? { instructions: source.instructions } : {}), active: main.active, superseded, proposed: grading,
453
+ ...(proposal.files?.length ? { files: proposal.files } : {}), ...(proposal.dryRuns ? { dryRuns: proposal.dryRuns } : {}), ...(proposal.drafted?.length ? { drafted: proposal.drafted } : {}), ...(proposal.asked ? { asked: proposal.asked } : {}), ...(proposal.triggered ? { triggered: proposal.triggered } : {}), ...(proposal.held ? { held: proposal.held } : {}),
454
+ });
455
+ /** The asks of this attempt that answered: the records holding more requests than these is an earlier attempt's. */
456
+ let answered = 0;
457
+ // Once an ask read the grade's records (`booked`), its dollars are theirs: an earlier attempt's requests counted too.
458
+ const fromRecords = (booked) => {
459
+ if (!booked)
460
+ return;
461
+ usd = booked.usd;
462
+ // A request an earlier attempt sent (a restart before the grade was saved): its dollars are in the records,
463
+ // its tokens in nothing this attempt read, so they are unknown, never none.
464
+ if (booked.turns > answered)
465
+ tokens = null;
466
+ };
184
467
  // `again`: what the grade is told after its last answer, below the same prompt.
185
468
  const ask = async (again) => {
186
469
  // Stopped before this ask: nothing is sent, so nothing of it is spent (what it spent stays as it was).
@@ -189,16 +472,24 @@ export function createLearningLoop(learning) {
189
472
  const timer = AbortSignal.timeout(GRADE_TIMEOUT_MS);
190
473
  let answer;
191
474
  try {
192
- answer = await learning.ask({ prompt: again ? `${prompt}\n\n${again}` : prompt, maxTokens: GRADE_MAX_TOKENS }, AbortSignal.any([deps.signal, timer, stopAsk.signal]), { journal: () => deps.journal(claim), flush: () => deps.flush() });
475
+ answer = await learning.ask({ prompt: again ? `${prompt}\n\n${again}` : prompt, maxTokens: GRADE_MAX_TOKENS, ...(beside > 0 ? { beside } : {}) }, AbortSignal.any([deps.signal, timer, stopAsk.signal]), { journal: () => deps.journal(claim), flush: () => deps.flush() });
193
476
  }
194
477
  catch (error) {
195
- usd = null;
196
- tokens = null;
478
+ // A call the cap refused was never sent: it spent nothing, and what the grade spent before it stands, as its
479
+ // records hold it (an earlier attempt's included).
480
+ if (error instanceof GradeOverCap)
481
+ fromRecords(error.booked);
482
+ else {
483
+ usd = null;
484
+ tokens = null;
485
+ }
197
486
  throw error;
198
487
  }
488
+ answered += 1;
199
489
  usd = usd === null || answer.usd === null || !Number.isFinite(answer.usd) ? null : usd + answer.usd;
200
490
  const more = answer.tokens ?? null;
201
491
  tokens = tokens === null || more === null ? null : { input: tokens.input + more.input, cache_read: tokens.cache_read + more.cache_read, cache_write: tokens.cache_write + more.cache_write, output: tokens.output + more.output };
492
+ fromRecords(answer.booked);
202
493
  return answer.text;
203
494
  };
204
495
  let verdict;
@@ -216,17 +507,26 @@ export function createLearningLoop(learning) {
216
507
  }
217
508
  }
218
509
  catch (error) {
219
- // What the asks spent: a cut one's unknown (null), kept on a stopped run's row as on a dropped one's.
220
- spend = usd;
510
+ // What the asks spent (and the check before them): a cut one's unknown (null), kept on a stopped run's row as
511
+ // on a dropped one's.
512
+ spend = spent();
221
513
  const end = await halted();
222
514
  if (end)
223
515
  return end;
224
- await append(KINDS.learningDropped, { source: source.runId, reason: "grade_failed", detail: said.stopped(STOPPED.noReview), usd, tokens }, "ended");
516
+ // No room under the run's cap for the grade (a call the cap refused): skipped, said so, with what it spent
517
+ // before (an earlier ask's), never a failure and never past the cap.
518
+ if (error instanceof GradeOverCap) {
519
+ await append(KINDS.learningDropped, { source: source.runId, reason: "no_budget", detail: error.forGood ? said.gradeUncapped : said.noRoomToGrade, usd: spent(), tokens, ...(unchecked !== undefined ? { unchecked } : {}) }, "ended");
520
+ return { state: "ended" };
521
+ }
522
+ await append(KINDS.learningDropped, { source: source.runId, reason: "grade_failed", detail: said.stopped(STOPPED.noReview), usd: spent(), tokens, ...(unchecked !== undefined ? { unchecked } : {}) }, "ended");
225
523
  void error;
226
524
  return { state: "ended" };
227
525
  }
228
- graded = { source: source.runId, verdict, usd, tokens, graded: main.graded };
229
- spend = usd;
526
+ if (settledItems.length)
527
+ verdict = { ...verdict, items: [...verdict.items, ...settledItems] };
528
+ graded = { source: source.runId, verdict, usd: spent(), tokens, graded: main.graded, ...(unchecked !== undefined ? { unchecked } : {}) };
529
+ spend = graded.usd;
230
530
  await append(KINDS.learningGraded, graded);
231
531
  // The verdict is durable before the merge, its side effect.
232
532
  await deps.flush();
@@ -234,15 +534,52 @@ export function createLearningLoop(learning) {
234
534
  const halt = await halted();
235
535
  if (halt)
236
536
  return halt;
237
- if (!graded.verdict.merge) {
238
- await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(graded.verdict, lostOf(proposal)) }, "ended");
537
+ // Each note it keeps whose file main already holds (another run merged one by that name since, or a skill
538
+ // re-filed as one) is settled alone (takenOnMain): never written over unless it supersedes it, and never a
539
+ // refusal of everything else the run learned. Not when this run's own merge is on main already (the runner
540
+ // stopped after its commit, before it recorded it): the notes there are that merge's, never "already there", so
541
+ // the grade's verdict goes to the commit, which answers with that merge, and each item is settled by the text that
542
+ // merge's own commit holds at its file (resumedOf: its rule there, not only a changed path, and never main's
543
+ // text now, which a person may have edited since).
544
+ const notePaths = graded.verdict.items.flatMap((item) => (!item.keep ? [] : item.note ? [item.note.file] : proposal.notes.some(({ file }) => file === item.file) ? [item.file] : []));
545
+ let onMain = {};
546
+ let already = false;
547
+ try {
548
+ const merge = await learning.merged(ws, source.runId, notePaths, source.round);
549
+ already = merge !== undefined;
550
+ onMain = merge ? merge.texts : notePaths.length ? await learning.mainTexts(ws, notePaths) : {};
551
+ }
552
+ catch (error) {
553
+ // Main could not be read: parked as for a write that could not reach the folder, tried again after a backoff.
554
+ await append(KINDS.learningUnavailable, { source: source.runId, error: error?.message ?? String(error) }, "parked");
555
+ return { state: "parked", wakeAt: now() + UNAVAILABLE_BACKOFF_MS[Math.min(unavailable, UNAVAILABLE_BACKOFF_MS.length - 1)] };
556
+ }
557
+ const taken = already ? { verdict: oneItemAFile(proposal, graded.verdict), replace: [], graded: {} } : takenOnMain(proposal, graded.verdict, onMain);
558
+ const verdict = taken.verdict;
559
+ const merging = keptOf(proposal, verdict);
560
+ const change = mergeChangeOf(source.runId, merging, verdict, { ...graded.graded, ...taken.graded }, round);
561
+ // Nothing new left to merge: dropped, unless the grader kept a re-filed skill whose rule main already holds as a
562
+ // note (takenOnMain's SAME_NOTE). Its old SKILL.md is still retired (mergeChangeOf's retire), in a write of that
563
+ // alone, so no old skill stays served beside the note.
564
+ if (!verdict.merge && !(graded.verdict.merge && change.retire?.length)) {
565
+ await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(verdict, lostOf(proposal)) }, "ended");
239
566
  return { state: "ended" };
240
567
  }
241
- const merging = keptOf(proposal, graded.verdict);
242
- const result = await learning.commit(ws, mergeChangeOf(source.runId, merging, graded.verdict, graded.graded));
568
+ const result = await learning.commit(ws, taken.replace.length ? { ...change, replace: taken.replace } : change);
243
569
  if (result.ok) {
244
- const detail = mergedWords(merging, graded.verdict, checked);
245
- await append(KINDS.learningMerged, { source: source.runId, main: result.main, commit: result.commit, files: result.files, detail }, "ended");
570
+ // What the merge left out against the main it committed on (a rule a note holds, a name one holds), each
571
+ // item alone: said as takenOnMain says it, and nothing of it learned.
572
+ // A merge already on main (a resume after its commit): what it wrote is what its files say, so each note is
573
+ // settled by the files: one written is kept as the grade kept it, one not written is left out (as takenOnMain
574
+ // or the commit says why).
575
+ const settled = result.already ? resumedOf(proposal, graded.verdict, verdict, result, onMain) : leftOf(merging, verdict, result.left ?? []);
576
+ if (!settled.verdict.items.some((item) => item.keep) && !result.files.length) {
577
+ await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(settled.verdict, lostOf(proposal)) }, "ended");
578
+ return { state: "ended" };
579
+ }
580
+ // A write that retired a skill alone learned nothing new: said so.
581
+ const detail = mergedWords(settled.merging, settled.verdict, checked) || said.empty;
582
+ await append(KINDS.learningMerged, { source: source.runId, main: result.main, commit: result.commit, files: result.files, detail, verdict: settled.verdict }, "ended");
246
583
  return { state: "ended" };
247
584
  }
248
585
  if (result.reason === "conflict") {
@@ -15,7 +15,16 @@ export interface LearningSeedLay {
15
15
  readonly shown: () => Promise<Shown>;
16
16
  /** One line of the run's log. */
17
17
  readonly log: (line: string) => void;
18
+ /** False for a run of a revision that says `learning: "notes"`: its notes and skills are laid, never a learned workflow. */
19
+ readonly workflows?: false;
20
+ /** The notes its # Learned section names in no way, over the learning budget (the launch's `notesLeftOut`), by file:
21
+ * said in the run's log, so a run that read only some of what its agent learned says which it did not. */
22
+ readonly notesLeftOut?: readonly string[];
18
23
  }
24
+ /** The most notes the log line names: past it, it says how many more. */
25
+ export declare const LEFT_OUT_NAMED = 100;
26
+ /** The run's log line for the notes its # Learned section leaves out, or undefined for none. */
27
+ export declare const notesLeftOutLine: (files: readonly string[] | undefined) => string | undefined;
19
28
  /** What the claim laid of the run's seed: the seed it read, the learned skills' files it laid, by their paths under
20
29
  * `.agents/skills/`, for the skill list the run's harness is handed beside the revision's own, and the learned workflows
21
30
  * the run's learned_workflow tool runs, cut of the server's secrets as the skills are (none of either when the lay
@@ -1,4 +1,14 @@
1
1
  import { chooseSkills, chooseWorkflows, layLearned, LEARNED_DIR, laySkills, readerOf, seedFrom, takeSkills } from "../learning.js";
2
+ /** The most notes the log line names: past it, it says how many more. */
3
+ export const LEFT_OUT_NAMED = 100;
4
+ /** The run's log line for the notes its # Learned section leaves out, or undefined for none. */
5
+ export const notesLeftOutLine = (files) => {
6
+ if (!files?.length)
7
+ return undefined;
8
+ const named = files.slice(0, LEFT_OUT_NAMED).join(", ");
9
+ const more = files.length > LEFT_OUT_NAMED ? `, and ${files.length - LEFT_OUT_NAMED} more` : "";
10
+ return `starts without ${files.length} of the notes its agent learned in its # Learned section, over the learning budget (the notes that bear most on it are given whole; the rest stay in ${LEARNED_DIR}/): ${named}${more}`;
11
+ };
2
12
  const message = (error) => (error instanceof Error ? error.message : String(error));
3
13
  /** What a claim laid of a run's learning seed, by name, as the adapter loop records it (KINDS.learningLaid): each learned
4
14
  * skill whose files it laid, and each learned workflow it handed the tool; none when nothing was laid. */
@@ -29,9 +39,12 @@ export async function layLearningSeed(lay) {
29
39
  await laySkills(lay.work, taken, made);
30
40
  for (const path of seed.skipped)
31
41
  lay.log(`its learning folder's ${path} was not read`);
42
+ const leftOut = notesLeftOutLine(lay.notesLeftOut);
43
+ if (leftOut)
44
+ lay.log(leftOut);
32
45
  for (const name of left)
33
46
  lay.log(`starts without the skill ${name} its agent learned: it is over what is left of the learned skills' budget, or holds a secret`);
34
- const workflows = chooseWorkflows(seed, shown);
47
+ const workflows = lay.workflows === false ? { flows: [], left: [] } : chooseWorkflows(seed, shown);
35
48
  for (const name of workflows.left)
36
49
  lay.log(`starts without the learned workflow ${name} its agent learned: it is over what is left of the learned workflows' budget, or holds a secret`);
37
50
  return { seed, skills: taken.flatMap(({ name, files = {} }) => Object.keys(files).sort().map((path) => `${name}/${path}`)), workflows: workflows.flows };
@@ -95,6 +95,7 @@ export function withLiveTicker(store, createLoop, options = {}) {
95
95
  },
96
96
  command: (command) => loop.command(command),
97
97
  stop: (reason) => loop.stop(reason),
98
+ keepsComputer: (reason) => loop.keepsComputer?.(reason) ?? false,
98
99
  };
99
100
  },
100
101
  close: async () => {
@@ -34,11 +34,14 @@ export type EndOfRunTurn = (input: {
34
34
  /** The run was cut before it could look back: by a person's stop (`stopped`), by one during the end-of-run turn
35
35
  * (`stopped-looking`), or by a fault (`faulted`). The step must not call `ask`: it returns only what a cut run keeps. */
36
36
  readonly cut?: "stopped" | "stopped-looking" | "faulted";
37
- /** `again`: the turn asked once more in the same session (its first answer out of format), as its own request. */
37
+ /** `again`: the turn asked once more in the same session (its first answer out of format), as its own request.
38
+ * `round`: which end of the run this is (1, its first, when absent): an end after a follow-up opened the run again is
39
+ * a later round, asked of the model anew under a request of its own. */
38
40
  ask(prompt: string, opts: {
39
41
  readonly origin: "reflect";
40
42
  readonly deadlineMs: number;
41
43
  readonly again?: true;
44
+ readonly round?: number;
42
45
  }): Promise<EndOfRunAnswer>;
43
46
  readonly signal: AbortSignal;
44
47
  }) => Promise<{
@@ -87,6 +90,14 @@ export declare class ClaimRefused extends Error {
87
90
  }
88
91
  /** The end a person's stop or cancel writes: stopped, in words that say which. A cancel's are main's ("cancelled"). */
89
92
  export declare function endedBy(cancel: boolean | undefined): string;
93
+ /** The run's end on a person's stop or a cancel, as every loop and the runner write it: state 'stopped', words that say
94
+ * which (endedBy), and the outcome the store tells them apart by: 'stopped' (the turn is over, never the run, as main's
95
+ * stop leaves a run: a message reopens it) or 'cancelled' (over for good). */
96
+ export declare function stopEnd(cancel: boolean | undefined): {
97
+ readonly state: "stopped";
98
+ readonly summary: string;
99
+ readonly outcome: "stopped" | "cancelled";
100
+ };
90
101
  /** The refusal a denied call's model reads: serve's own words for a call a person denied (refusal-words.ts refusedText,
91
102
  * one copy with the tool gate's), the person's note with it. Asked before its intent, the call never ran. */
92
103
  export declare function deniedText(tool: string, note?: string): string;
@@ -113,6 +124,10 @@ export interface Loop {
113
124
  command(command: Command): Promise<CommandOutcome>;
114
125
  /** Aborts the in-flight turn; resolves once the loop will write nothing more. */
115
126
  stop(reason: StopReason): Promise<void>;
127
+ /** Whether a person's stop `reason` ends only the agent, the run keeping its computer for its owner (a held computer,
128
+ * computer-held.ts): the runner then goes on handing it rows (the owner's calls and release) until it ends. Absent:
129
+ * never. */
130
+ keepsComputer?(reason: StopReason): boolean;
116
131
  }
117
132
  export interface LoopDeps {
118
133
  /** The run's journal (store.journal(claim)) behind the runner's own fence: after a claim-lost stop, a commit is