@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
@@ -20,8 +20,14 @@
20
20
  // that dies: the run's next claim reads it back from the journal and takes the wait up (`adopt`).
21
21
  import { createHash } from "node:crypto";
22
22
  import { HOST_PHASE } from "./timeline/index.js";
23
- /** How long a person's time lasts at most before it expires: an unanswered ask, and a take-over with no input. Its worth of session time is held up front. */
23
+ /** How long a person's time lasts at most before it expires: an unanswered ask, a take-over with no input, and a run that
24
+ * waits for its person's answer with its browser kept open. Its worth of session time is held up front. The default of
25
+ * the server setting PERSON_WAIT_ENV. */
24
26
  export const PERSON_HOLD_MS = 15 * 60_000;
27
+ /** The server setting for that window, in whole minutes (1 to 360; anything else keeps the 15-minute default): how long a
28
+ * run waiting for its person keeps its browser open, how long an agent's hand-over ask waits, and how long a take-over
29
+ * lasts with no input. One setting for all three, so they never drift apart. */
30
+ export const PERSON_WAIT_ENV = "AGENTRUN_BROWSER_PERSON_WAIT_MIN";
25
31
  /** How long a take-over outlasts its viewer. */
26
32
  export const PERSON_AWAY_MS = 2 * 60_000;
27
33
  /** Under `--faux` only (the tests, beside the fake browser's own FAUX_BROWSER_LOG): the two windows above, in ms, `<hold>,<away>`. */
@@ -509,7 +515,8 @@ export function personHands(options) {
509
515
  * and its release lets the browser go, booking its time to then. `pauses: false`: a refusal pauses nothing, the run
510
516
  * parks on its question as it would with no browser. Refused in the cap's words when there is no room. `lapsed`
511
517
  * settles, in words, at the bound, when the cap refuses a re-hold (a take-over's sharing the session), or when a
512
- * session it keeps is let go (sessionEnded); drop() lets the shares go, once. */
518
+ * session it keeps is let go (sessionEnded); confirmed() writes that lapse's row and ended state once the runner
519
+ * parked the run on it; drop() lets the shares go, once. */
513
520
  async wait(callId, tags, since = now()) {
514
521
  const user = `wait:${callId}`;
515
522
  const held = [];
@@ -524,25 +531,57 @@ export function personHands(options) {
524
531
  const expiresAt = since + holdMs;
525
532
  if (expiresAt <= now())
526
533
  return { refused: waitExpired(holdMs) };
534
+ const record = (row, at) => {
535
+ void note(HOST_PHASE, { summary: row, at });
536
+ try {
537
+ options.waitEnded?.(at, row);
538
+ }
539
+ catch { /* the Screen tab's state is a convenience; the row stands */ }
540
+ };
527
541
  for (const tag of new Set(tags)) {
528
542
  const refused = await acquire(tag, user, WAIT_WHAT, false, expiresAt);
529
543
  if (refused) {
530
544
  letGo();
545
+ // The cap has no room for the person's time: the run parks and its release lets the browser go, and the person is told why.
546
+ if (!closed)
547
+ record(`The browser was released while the run waited for you: ${refused.refused}`, now());
531
548
  return refused;
532
549
  }
533
550
  held.push(tag);
534
551
  }
535
- let lapse = () => { };
536
- const lapsed = new Promise((resolve) => (lapse = resolve));
552
+ let settle = () => { };
553
+ const lapsed = new Promise((resolve) => (settle = resolve));
554
+ // The wait ends once: at its window, when a session it keeps ends, or at the cap. Each settles `lapsed` at once, and its
555
+ // timeline row and the Screen tab's state are written when the runner confirms the run parked on it (a lapse during
556
+ // the answer's placement is ignored by the runner: the answer's turn goes on, on the same browser). The answer ends it
557
+ // too (drop: no row, the run goes on).
558
+ let over = false;
559
+ let pending;
560
+ const end = (words, row) => {
561
+ if (over)
562
+ return;
563
+ over = true;
564
+ pending = { row, at: now() };
565
+ settle(words);
566
+ };
567
+ const lapse = (words) => end(words, words === WAIT_SESSION_GONE ? BROWSER_GONE_WHILE_WAITING : `The browser was released while the run waited for you: ${words}`);
537
568
  const entry = { tags: new Set(held), lapse };
538
569
  waits.set(user, entry);
539
- bound = timers.set(() => lapse(waitExpired(holdMs)), Math.max(0, expiresAt - now()));
570
+ bound = timers.set(() => end(waitExpired(holdMs), releasedAfterWait(holdMs)), Math.max(0, expiresAt - now()));
540
571
  // A session let go while its hold was being admitted: told before this wait was there to hear it.
541
572
  if (held.some((tag) => ended.has(tag)))
542
573
  lapse(WAIT_SESSION_GONE);
543
574
  return {
544
575
  lapsed,
576
+ confirmed: () => {
577
+ const ended = pending;
578
+ pending = undefined;
579
+ if (ended)
580
+ record(ended.row, ended.at);
581
+ },
545
582
  drop: () => {
583
+ over = true;
584
+ pending = undefined;
546
585
  if (waits.get(user) === entry)
547
586
  waits.delete(user);
548
587
  letGo();
@@ -580,5 +619,15 @@ export function personHands(options) {
580
619
  * tests' (FAUX_PERSON_MS_ENV). */
581
620
  export function personWindows(env, faux) {
582
621
  const [hold, away] = (faux ? env[FAUX_PERSON_MS_ENV] ?? "" : "").split(",").map(Number);
583
- return { holdMs: hold && hold > 0 ? hold : PERSON_HOLD_MS, awayMs: away && away > 0 ? away : PERSON_AWAY_MS };
622
+ return { holdMs: hold && hold > 0 ? hold : personWaitMs(env), awayMs: away && away > 0 ? away : PERSON_AWAY_MS };
623
+ }
624
+ /** The person's window from the server setting PERSON_WAIT_ENV, in ms: whole minutes from 1 to 360, else the default. */
625
+ export function personWaitMs(env) {
626
+ const raw = env[PERSON_WAIT_ENV]?.trim();
627
+ const minutes = raw && /^\d+$/.test(raw) ? Number(raw) : NaN;
628
+ return minutes >= 1 && minutes <= 360 ? minutes * 60_000 : PERSON_HOLD_MS;
584
629
  }
630
+ /** The timeline row when a run's wait for its person ends at its window and its browser is let go. */
631
+ export const releasedAfterWait = (holdMs) => `The browser was released after ${Math.round(holdMs / 60_000) || 1} min waiting for you`;
632
+ /** The timeline row when a browser the run kept open for its person ended before their answer (its provider ended it). */
633
+ export const BROWSER_GONE_WHILE_WAITING = "The browser session ended while the run waited for you";
@@ -0,0 +1,23 @@
1
+ /** The store seam: the server's settings (store/store.ts Settings), the three calls this uses. */
2
+ export type WaitEndedSettings = {
3
+ get(key: string): Promise<unknown | undefined>;
4
+ put(key: string, value: unknown): Promise<void>;
5
+ remove(key: string): Promise<void>;
6
+ };
7
+ /** A browser let go while its run waited for its person: when (ISO) and the timeline row's words. */
8
+ export type WaitEnded = {
9
+ at: string;
10
+ why: string;
11
+ };
12
+ /** The run's process, as its wait ends with the browser let go: kept for the Screen tab. */
13
+ export declare function markWaitEnded(settings: WaitEndedSettings, runId: string, ended: WaitEnded, epoch?: number): Promise<void>;
14
+ /** The run's process, as any browser session of the run opens, or at the run's end: nothing ended any more. Given the
15
+ * claim's `epoch`, a message a later claim wrote stays (a follow-up that started on another runner while this claim's
16
+ * loop was still closing keeps its own). */
17
+ export declare function clearWaitEnded(settings: WaitEndedSettings, runId: string, epoch?: number): Promise<void>;
18
+ /** The server's Screen read: for a run that has ended, nothing, and its row goes (a run that ended with no browser after
19
+ * the wait leaves none behind: the runner removes it at the end too, this catches any end that didn't); for a going
20
+ * run, the ended state. */
21
+ export declare function screenWaitEnded(settings: WaitEndedSettings, runId: string, terminal: boolean): Promise<WaitEnded | undefined>;
22
+ /** The ended state, or undefined. One settings read; a value of another shape is no ended state. */
23
+ export declare function readWaitEnded(settings: Pick<WaitEndedSettings, "get">, runId: string): Promise<WaitEnded | undefined>;
@@ -0,0 +1,42 @@
1
+ // Why a run's browser is not up while the run is still going, for GET /v2/runs/{run_id}/computer's `none`: the browser
2
+ // was let go while the run waited for its person (browser-person.ts personHands.wait ends with a timeline row saying so),
3
+ // and the run has opened none since. The Screen tab says that, with when, instead of waiting for a browser nobody is
4
+ // opening.
5
+ //
6
+ // One small server setting per run holds it (`browser_wait_ended:<run id>`: { at, why }), written by the run's process as
7
+ // the wait ends and removed as any browser session of the run opens, whatever let the old one go (its idle release, the
8
+ // tool, a close at the park). So a Screen poll, every few seconds on a parked run, reads one row, never the run's journal.
9
+ const keyOf = (runId) => `browser_wait_ended:${runId}`;
10
+ /** The run's process, as its wait ends with the browser let go: kept for the Screen tab. */
11
+ export async function markWaitEnded(settings, runId, ended, epoch) {
12
+ await settings.put(keyOf(runId), epoch === undefined ? ended : { ...ended, epoch });
13
+ }
14
+ /** The run's process, as any browser session of the run opens, or at the run's end: nothing ended any more. Given the
15
+ * claim's `epoch`, a message a later claim wrote stays (a follow-up that started on another runner while this claim's
16
+ * loop was still closing keeps its own). */
17
+ export async function clearWaitEnded(settings, runId, epoch) {
18
+ if (epoch !== undefined) {
19
+ const written = (await settings.get(keyOf(runId)))?.epoch;
20
+ if (typeof written === "number" && written > epoch)
21
+ return;
22
+ }
23
+ await settings.remove(keyOf(runId));
24
+ }
25
+ /** The server's Screen read: for a run that has ended, nothing, and its row goes (a run that ended with no browser after
26
+ * the wait leaves none behind: the runner removes it at the end too, this catches any end that didn't); for a going
27
+ * run, the ended state. */
28
+ export async function screenWaitEnded(settings, runId, terminal) {
29
+ if (terminal) {
30
+ await settings.remove(keyOf(runId)).catch(() => undefined);
31
+ return undefined;
32
+ }
33
+ return readWaitEnded(settings, runId);
34
+ }
35
+ /** The ended state, or undefined. One settings read; a value of another shape is no ended state. */
36
+ export async function readWaitEnded(settings, runId) {
37
+ const value = await settings.get(keyOf(runId));
38
+ if (!value || typeof value !== "object")
39
+ return undefined;
40
+ const { at, why } = value;
41
+ return typeof at === "string" && typeof why === "string" ? { at, why } : undefined;
42
+ }
package/dist/cap.d.ts CHANGED
@@ -84,7 +84,7 @@ export declare function wrapUpDue(cap: number, spent: number, held: number, typi
84
84
  /** The wrap-up's words, what is left to the cent. `nonePriced`: the run's own model has no priced request yet, so its
85
85
  * typical cost is the next request's expected cost and the note can come before the run has done anything (step 0):
86
86
  * the words say the budget and ask for a short answer, not a finish. Read from the same priced costs live and in a
87
- * process opened again (costsIn, ownCosts), so a restart picks the same words. */
87
+ * process opened again (ownCosts), so a restart picks the same words. */
88
88
  export declare const wrapUpWords: (leftUsd: number, nonePriced?: boolean) => string;
89
89
  /** A request priced at `price` under `mode`, its input `bound` tokens after `previous` at `now`, plus `feeUsd`: `cost`, what
90
90
  * it is held at given its output tokens (its expected input, never more than uncached), and `worst`, its input uncached.
@@ -167,7 +167,7 @@ export declare const attemptLost: (a: Attempt, last: boolean) => boolean;
167
167
  export declare const anyAttemptLost: (attempts: readonly Attempt[] | undefined) => boolean;
168
168
  export declare function piEnded(message: Pick<AssistantMessage, "stopReason" | "usage" | "api">, began: boolean, attempts: readonly Attempt[] | undefined): Ended;
169
169
  /** How pi's error for a request whose start mark could not be written begins (request-start.ts builds it from this): the
170
- * request never left, so the entry answers none, and spentIn leaves it out by this. */
170
+ * request never left, so the entry answers none, and spentFrom leaves it out by this. */
171
171
  export declare const MARK_NOT_WRITTEN = "the model request was not sent: its mark could not be written";
172
172
  /** pi's error for a request that left and whose end mark the store refused (request-start.ts): its cost is not recorded
173
173
  * as booked, so it stays open, read at its start mark's hold, never closed by this entry at its own usage. */
@@ -194,47 +194,13 @@ export declare const CAP_REFUSAL_PREFIX: RegExp;
194
194
  * before its end), and the usd of a cost written apart from an answer, a paid tool's charge among them; 0 for anything
195
195
  * else, or for a cost that is not a number (which makes the whole spend unknown, by the timeline's verdict). */
196
196
  export declare const costOf: (entry: EntryLike) => number;
197
- /** What the run's store says its model requests cost, across every conversation in it: known or not as the run's own
198
- * timeline says (pi-durable-agent's timelineOf), read as a settled run, since the process that wrote it is gone, and
199
- * then the full amount, never the timeline's total rounded for display. Every response, and each cost written apart
200
- * from one (a compaction summary's; a harness request's that came in after its answer). A cost that is not a number, or
201
- * one still pending, leaves it unknown, as the timeline says. These readings are the cap's own, on its copy of the
202
- * entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end counts at the figure its
203
- * end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the figure its start mark
204
- * holds (openFigures), each the worst case the cap held for it; without that figure either stays cut, at an unknown
205
- * cost. A paid call settled at a charge it did not say, like one a crash cut, counts at the figure its mark holds. And
206
- * this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
207
- export declare function spentIn(storeFile: string): number | null;
208
- /** What the run's model requests cost, from its entries in log order: the one computation, shared by spentIn (reading a
209
- * settled run's own database) and the one-store reader (store-reads, reading A's journal). These readings are the cap's
197
+ /** What the run's model requests cost, from its entries in log order: the one computation, which the one-store reader
198
+ * (store-reads/cap.ts spentOverStore) runs over A's journal. These readings are the cap's
210
199
  * own, on its copy of the entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end
211
200
  * counts at the figure its end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the
212
201
  * figure its start mark holds (openFigures), each the worst case the cap held for it; without that figure either stays
213
202
  * cut, at an unknown cost. This cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
214
203
  export declare function spentFrom(rows: readonly EntryLike[]): number | null;
215
- /** A workflow decision's charge as the cap counted it (decision-cap.ts): `call` names the request, `usd` what it charged,
216
- * or its hold when it said none. The run's shown cost reads its decisions from their receipts; this is the cap's own
217
- * reading, kept so a later process counts each decision as this one did. costOf counts none, so nothing counts twice. */
218
- export declare const DECISION_COST = "agentrun.decision_cost";
219
- /** A decision request's hold, kept before it is sent (decision-cap.ts): with no DECISION_COST after it, its process died
220
- * while it was out, and it counts at this figure. */
221
- export declare const DECISION_HOLD = "agentrun.decision_hold";
222
- /** What a workflow run's decisions cost, in its store: what the next process adds to spentIn's reading. Per decision
223
- * (its id):
224
- * - booked (DECISION_COST entries, at its charge, its hold, or $0 for nothing charged): the larger of what was booked,
225
- * with any hold no booking ended, and what its receipts say it cost (the costs the timeline's decision rows sum);
226
- * - else, with a receipt that names its charge: that charge (its booking lost after the receipt);
227
- * - else, with a hold (DECISION_HOLD, kept once the driver admitted the request, right before its send): that hold, the
228
- * figure the live process held, since the request may have been out when its process died; never $0;
229
- * - else nothing: no hold is kept before the admission, so a request never sent is never counted.
230
- * A booking with no decision id is counted as it is. */
231
- export declare function decisionSpentIn(storeFile: string): number;
232
- /** The priced answers of `model` (its id) in the run's store, in order: what the wrap-up's typical cost reads from earlier
233
- * processes (capModels' `wrapUp`). An answer whose cost is unknown or $0, or that was stopped or failed, is none. */
234
- export declare function costsIn(storeFile: string, model: string): number[];
235
- /** Whether the run was told its wrap-up under `cap` already (a CAP_WRAPUP entry of that cap): once per cap, across its
236
- * processes; a raise's new cap re-arms it. */
237
- export declare function wrapUpSentIn(storeFile: string, cap: number): boolean;
238
204
  /** /usage's meters for a run that ended, from its store: `tools`, each TOOL_COST's `usd`, unknown (null) when one is,
239
205
  * or when a call was cut (marked, never settled: what it charged no one knows); and `tokens`, the rest of its root
240
206
  * conversation as its settled timeline prices it; `browser`, the part of `tools` that is browser session time
@@ -250,17 +216,6 @@ export type Meters = {
250
216
  others: number | null;
251
217
  notMetered?: number;
252
218
  };
253
- export declare function metersIn(storeFile: string): Meters;
254
- /** metersIn's meters, and beside them each meter's known dollars: its settled charges' figures, whether or not another of
255
- * its charges is unknown (a hold, a call cut or never settled, is no charge here: it adds nothing). What a run of
256
- * unknown cost is known to have spent on each (server.ts /usage). */
257
- export declare function meterFiguresIn(storeFile: string): Meters & {
258
- known: {
259
- tokens: number;
260
- browser: number;
261
- others: number;
262
- };
263
- };
264
219
  /** A browser charge's record on the run's root when the run books its money on the runner's one ledger (browser-cost.ts
265
220
  * browserSpend's `paid`): the same record a browser TOOL_COST is, for what the browser's process holds and the seconds
266
221
  * it was for, under a kind no cost reads. The charge's money is the ledger's paid step alone, which the cap counts and
@@ -268,10 +223,10 @@ export declare function meterFiguresIn(storeFile: string): Meters & {
268
223
  * as every paid tool's on the runner: a TOOL_COST beside it would count the same charge twice. Its seconds are the
269
224
  * browser_time meter's (meterFiguresFrom). */
270
225
  export declare const BROWSER_CHARGED = "agentrun.browser_charged";
271
- /** meterFiguresIn's figures from a run's entries by conversation, in log order: the one computation, shared by
272
- * meterFiguresIn (reading a settled run's own database) and the one-store reader (store-reads/cap.ts metersOverStore, over
273
- * A's journal). Only where the entries come from changes; the figures do not (the money-parity rule), as spentFrom is to
274
- * spentIn. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
226
+ /** /usage's meter figures from a run's entries by conversation, in log order, and beside them each meter's known dollars:
227
+ * its settled charges' figures, whether or not another of its charges is unknown (a hold, a call cut or never settled, is
228
+ * no charge here: it adds nothing). The one computation, which the one-store reader (store-reads/cap.ts metersOverStore)
229
+ * runs over A's journal. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
275
230
  * paid-tools session (store-reads/journal.ts withPaidCosts), as the file-backed run's root held each natively. */
276
231
  export declare function meterFiguresFrom(rows: readonly {
277
232
  conversation: number;
@@ -284,7 +239,7 @@ export declare function meterFiguresFrom(rows: readonly {
284
239
  };
285
240
  };
286
241
  /** What the paid tools of `entries` (TOOL_STARTED and TOOL_COST) spent, as the cap counts it: each charge, and a call
287
- * settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentIn counts it;
242
+ * settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentFrom counts it;
288
243
  * null when one has no figure. The run's reported cost reads such a call unknown instead (the timeline). */
289
244
  export declare function capToolSpend(entries: readonly EntryLike[]): number | null;
290
245
  /** The worst case of each model request a cap admitted and whose cost is not booked yet, by its turn, for a paid tool's
@@ -503,8 +458,8 @@ export declare function requestParts(overhead?: (model: Model<Api>, context: Con
503
458
  feeUsd: number;
504
459
  } | undefined;
505
460
  /** The wrap-up on pi (capModels' `wrapUp`): the run's own model (`model`, its id), that model's priced requests so far
506
- * (`costs`, earlier processes' from the store, costsIn; capModels adds each one it books), whether it was told under this
507
- * cap already (`sent`, wrapUpSentIn), and `record`, which writes its row (request-start.ts, CAP_WRAPUP). */
461
+ * (`costs`; capModels adds each one it books), whether it was told under this
462
+ * cap already (`sent`), and `record`, which writes its row (request-start.ts, CAP_WRAPUP). */
508
463
  /** The wrap-up's state on pi. `sent`: told, in an answered request, once per cap. `pending`: a request carries the note
509
464
  * and has not ended: no other request takes it until that one is answered (told) or not (re-armed). */
510
465
  export type WrapUp = {
@@ -524,7 +479,7 @@ export type WrapUp = {
524
479
  * and, under the cap,
525
480
  * each request to a model in `unpriced` (one serve has no price for) or whose output is priced and that has no output
526
481
  * ceiling, each whose input cannot be bounded, and every request once what the run has spent is unknown: `spent` null
527
- * (spentIn), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
482
+ * (spentFrom), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
528
483
  * `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0. It is
529
484
  * priced by requestPrice under `mode`, after the previous request of its conversation (the context's last answer, read
530
485
  * by previousIn; its end as `now` read it when it settled here, else its own timestamp, which is when it began). Each
package/dist/cap.js CHANGED
@@ -30,7 +30,7 @@
30
30
  // timeline (runs.ts withOverCap).
31
31
  //
32
32
  // A paid tool's charge (monid.run's, monid.ts) is the run's spend too: booked in the run's store as a TOOL_COST, which
33
- // the run's cost and spentIn both count, and added to what the run's process counts as spent (useSpend), so the next
33
+ // the run's cost and spentFrom both count, and added to what the run's process counts as spent (useSpend), so the next
34
34
  // request's check sees it. A charge the call does not say (null: stopped, timed out, failed with no cost) leaves the
35
35
  // run's cost unknown, and the cap counts the call at what it was held at, the bound it let the call go at, as it counts
36
36
  // one a crash cut: in the run's process and from its mark in the store. Before each paid call, paidCall holds it as a
@@ -44,13 +44,10 @@
44
44
  // on a refusal for room and waits for a raise without its process, a workflow's refused step waits where it stands
45
45
  // (RunSpend.wait, budget.ts): a model node's request before it is sent, a call node's call and a decision before they are
46
46
  // admitted again. A refusal inside a call node's effect is told to the call (capRefusals), never only to the model.
47
- import { readRunDbSync } from "./run-db.js";
48
- import { durableDecisions } from "@parcha/agentrun-pi/durable";
49
47
  import { AsyncLocalStorage } from "node:async_hooks";
50
- import { existsSync } from "node:fs";
51
48
  import { imageInputOf, providerInputOverhead } from "@parcha/agentrun-kernel/host";
52
49
  import { bookRequest, isConnectCode, isGatewayTimeout, rejectionCode } from "@parcha/agentrun-kernel";
53
- import { CAP_WRAPUP, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, timelineOf, TOOL_COST, TOOL_STARTED } from "./timeline/index.js";
50
+ import { REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, timelineOf, TOOL_COST, TOOL_STARTED } from "./timeline/index.js";
54
51
  /** How a request the cap refused begins its error, which the server ends the run with. */
55
52
  export const SPEND_CAP_REACHED = "spend_cap_reached";
56
53
  /** How near two dollar figures are the same figure: a sum a float puts a hair past the cap (0.0028 + 0.3072 is
@@ -139,7 +136,7 @@ export function wrapUpDue(cap, spent, held, typical, leastUsd) {
139
136
  /** The wrap-up's words, what is left to the cent. `nonePriced`: the run's own model has no priced request yet, so its
140
137
  * typical cost is the next request's expected cost and the note can come before the run has done anything (step 0):
141
138
  * the words say the budget and ask for a short answer, not a finish. Read from the same priced costs live and in a
142
- * process opened again (costsIn, ownCosts), so a restart picks the same words. */
139
+ * process opened again (ownCosts), so a restart picks the same words. */
143
140
  export const wrapUpWords = (leftUsd, nonePriced = false) => {
144
141
  const left = centsMoney(Math.max(0, leftUsd));
145
142
  return nonePriced ? `This run's budget is about ${left}, enough for little work: answer as soon as you can.` : `About ${left} left of this run's budget: finish now with your answer.`;
@@ -286,7 +283,7 @@ export function piEnded(message, began, attempts) {
286
283
  return { end: "nothing", label: last === undefined || "code" in last ? "never_left" : "status" };
287
284
  }
288
285
  /** How pi's error for a request whose start mark could not be written begins (request-start.ts builds it from this): the
289
- * request never left, so the entry answers none, and spentIn leaves it out by this. */
286
+ * request never left, so the entry answers none, and spentFrom leaves it out by this. */
290
287
  export const MARK_NOT_WRITTEN = "the model request was not sent: its mark could not be written";
291
288
  /** pi's error for a request that left and whose end mark the store refused (request-start.ts): its cost is not recorded
292
289
  * as booked, so it stays open, read at its start mark's hold, never closed by this entry at its own usage. */
@@ -337,7 +334,7 @@ const close = (open, figure) => {
337
334
  open.splice(at, 1);
338
335
  };
339
336
  /** The figures of the requests of each kind that `entries` leave open, marked as sent with no answer, cost or end, read in
340
- * order, as the run's timeline counts them (pi-durable-agent's meter), so the two agree on how many were cut. A start adds
337
+ * order, as the run's timeline counts them, so the two agree on how many were cut. A start adds
341
338
  * its figure. An end mark closes its own start: a stopped request's at the figure it names, a withdrawn one's (`unsent`,
342
339
  * which names none) the smallest. An end that names none for a request that left (an older store) closes nothing, so
343
340
  * that request stays cut. An answer, or a summary's cost, closes the smallest figure still open, since when requests
@@ -376,33 +373,8 @@ function openFigures(entries) {
376
373
  }
377
374
  return open;
378
375
  }
379
- /** What the run's store says its model requests cost, across every conversation in it: known or not as the run's own
380
- * timeline says (pi-durable-agent's timelineOf), read as a settled run, since the process that wrote it is gone, and
381
- * then the full amount, never the timeline's total rounded for display. Every response, and each cost written apart
382
- * from one (a compaction summary's; a harness request's that came in after its answer). A cost that is not a number, or
383
- * one still pending, leaves it unknown, as the timeline says. These readings are the cap's own, on its copy of the
384
- * entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end counts at the figure its
385
- * end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the figure its start mark
386
- * holds (openFigures), each the worst case the cap held for it; without that figure either stays cut, at an unknown
387
- * cost. A paid call settled at a charge it did not say, like one a crash cut, counts at the figure its mark holds. And
388
- * this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
389
- export function spentIn(storeFile) {
390
- if (!existsSync(storeFile))
391
- return 0;
392
- // Fresh, read-only and lock-free (run-db.ts): its process may hold it.
393
- const rows = [];
394
- readRunDbSync(storeFile, false, (db) => {
395
- // A read made again (its file changed during it) starts from none.
396
- rows.length = 0;
397
- for (const row of db.prepare("SELECT record FROM entries ORDER BY rowid").iterate()) {
398
- const entry = JSON.parse(String(row.record));
399
- rows.push(entry);
400
- }
401
- });
402
- return spentFrom(rows);
403
- }
404
- /** What the run's model requests cost, from its entries in log order: the one computation, shared by spentIn (reading a
405
- * settled run's own database) and the one-store reader (store-reads, reading A's journal). These readings are the cap's
376
+ /** What the run's model requests cost, from its entries in log order: the one computation, which the one-store reader
377
+ * (store-reads/cap.ts spentOverStore) runs over A's journal. These readings are the cap's
406
378
  * own, on its copy of the entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end
407
379
  * counts at the figure its end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the
408
380
  * figure its start mark holds (openFigures), each the worst case the cap held for it; without that figure either stays
@@ -539,120 +511,6 @@ export function spentFrom(rows) {
539
511
  return null;
540
512
  return entries.reduce((sum, entry) => sum + costOf(entry), 0);
541
513
  }
542
- /** A workflow decision's charge as the cap counted it (decision-cap.ts): `call` names the request, `usd` what it charged,
543
- * or its hold when it said none. The run's shown cost reads its decisions from their receipts; this is the cap's own
544
- * reading, kept so a later process counts each decision as this one did. costOf counts none, so nothing counts twice. */
545
- export const DECISION_COST = "agentrun.decision_cost";
546
- /** A decision request's hold, kept before it is sent (decision-cap.ts): with no DECISION_COST after it, its process died
547
- * while it was out, and it counts at this figure. */
548
- export const DECISION_HOLD = "agentrun.decision_hold";
549
- /** What a workflow run's decisions cost, in its store: what the next process adds to spentIn's reading. Per decision
550
- * (its id):
551
- * - booked (DECISION_COST entries, at its charge, its hold, or $0 for nothing charged): the larger of what was booked,
552
- * with any hold no booking ended, and what its receipts say it cost (the costs the timeline's decision rows sum);
553
- * - else, with a receipt that names its charge: that charge (its booking lost after the receipt);
554
- * - else, with a hold (DECISION_HOLD, kept once the driver admitted the request, right before its send): that hold, the
555
- * figure the live process held, since the request may have been out when its process died; never $0;
556
- * - else nothing: no hold is kept before the admission, so a request never sent is never counted.
557
- * A booking with no decision id is counted as it is. */
558
- export function decisionSpentIn(storeFile) {
559
- const booked = new Map();
560
- /** The decisions with any booking, a $0 one included. */
561
- const ended = new Set();
562
- /** Each decision's holds kept and not yet followed by a booking, in order. */
563
- const open = new Map();
564
- let loose = 0;
565
- for (const entry of entriesIn(storeFile)) {
566
- if (entry.kind !== DECISION_COST && entry.kind !== DECISION_HOLD)
567
- continue;
568
- const data = entry.data;
569
- const usd = figureOf(data?.usd);
570
- const id = typeof data?.decision === "string" ? data.decision : undefined;
571
- if (entry.kind === DECISION_HOLD) {
572
- if (id !== undefined && usd !== undefined)
573
- open.set(id, [...(open.get(id) ?? []), usd]);
574
- continue;
575
- }
576
- // A booking ends its decision's oldest hold still open, whatever it charged ($0 for nothing sent).
577
- if (id !== undefined) {
578
- ended.add(id);
579
- open.get(id)?.shift();
580
- }
581
- if (usd === undefined || !(usd > 0))
582
- continue;
583
- if (id !== undefined)
584
- booked.set(id, (booked.get(id) ?? 0) + usd);
585
- else
586
- loose += usd;
587
- }
588
- const receipted = new Map();
589
- let receipts = [];
590
- // Receipts that cannot be read leave the bookings alone to say it.
591
- if (existsSync(storeFile))
592
- try {
593
- receipts = durableDecisions(storeFile, { unlocked: true });
594
- }
595
- catch {
596
- receipts = [];
597
- }
598
- for (const receipt of receipts) {
599
- const usd = figureOf(receipt.cost_usd);
600
- // A stored receipt row names its decision `decision_id` (agentrun-pi decision-recovery.ts rowOf).
601
- const id = typeof receipt.decision_id === "string" ? receipt.decision_id : typeof receipt.id === "string" ? receipt.id : undefined;
602
- if (id !== undefined && usd !== undefined && usd > 0)
603
- receipted.set(id, (receipted.get(id) ?? 0) + usd);
604
- }
605
- let sum = loose;
606
- for (const id of new Set([...ended, ...booked.keys(), ...receipted.keys(), ...open.keys()])) {
607
- const held = (open.get(id) ?? []).reduce((total, usd) => total + (usd > 0 ? usd : 0), 0);
608
- if (ended.has(id))
609
- sum += Math.max((booked.get(id) ?? 0) + held, receipted.get(id) ?? 0);
610
- else if (receipted.has(id))
611
- sum += receipted.get(id);
612
- else
613
- sum += held;
614
- }
615
- return sum;
616
- }
617
- /** The entries of the run's store, in order (none when it has no store yet). */
618
- function entriesIn(storeFile) {
619
- if (!existsSync(storeFile))
620
- return [];
621
- // Fresh, read-only and lock-free (run-db.ts), as spentIn reads it.
622
- const rows = [];
623
- readRunDbSync(storeFile, false, (db) => {
624
- rows.length = 0;
625
- for (const row of db.prepare("SELECT record FROM entries ORDER BY rowid").iterate())
626
- rows.push(JSON.parse(String(row.record)));
627
- });
628
- return rows;
629
- }
630
- /** The priced answers of `model` (its id) in the run's store, in order: what the wrap-up's typical cost reads from earlier
631
- * processes (capModels' `wrapUp`). An answer whose cost is unknown or $0, or that was stopped or failed, is none. */
632
- export function costsIn(storeFile, model) {
633
- return entriesIn(storeFile).flatMap((entry) => {
634
- const message = entry.kind === "pi.assistant" ? entry.model?.[0] : undefined;
635
- const total = message?.usage?.cost?.total;
636
- return message?.model === model && message.stopReason !== "error" && message.stopReason !== "aborted" && typeof total === "number" && Number.isFinite(total) && total > 0 ? [total] : [];
637
- });
638
- }
639
- /** Whether the run was told its wrap-up under `cap` already (a CAP_WRAPUP entry of that cap): once per cap, across its
640
- * processes; a raise's new cap re-arms it. */
641
- export function wrapUpSentIn(storeFile, cap) {
642
- return entriesIn(storeFile).some((entry) => entry.kind === CAP_WRAPUP && typeof entry.data?.capUsd === "number" && Math.abs(entry.data.capUsd - cap) <= CAP_TOLERANCE);
643
- }
644
- export function metersIn(storeFile) {
645
- const { known: _, ...meters } = meterFiguresIn(storeFile);
646
- return meters;
647
- }
648
- /** metersIn's meters, and beside them each meter's known dollars: its settled charges' figures, whether or not another of
649
- * its charges is unknown (a hold, a call cut or never settled, is no charge here: it adds nothing). What a run of
650
- * unknown cost is known to have spent on each (server.ts /usage). */
651
- export function meterFiguresIn(storeFile) {
652
- if (!existsSync(storeFile))
653
- return { tools: 0, tokens: null, browser: { usd: 0, seconds: 0 }, others: 0, known: { tokens: 0, browser: 0, others: 0 } };
654
- return readRunDbSync(storeFile, false, (db) => meterFiguresFrom(db.prepare("SELECT conversation_id AS conversation, record FROM entries ORDER BY rowid").all().map((row) => ({ conversation: Number(row.conversation), entry: JSON.parse(String(row.record)) }))));
655
- }
656
514
  /** A browser charge's record on the run's root when the run books its money on the runner's one ledger (browser-cost.ts
657
515
  * browserSpend's `paid`): the same record a browser TOOL_COST is, for what the browser's process holds and the seconds
658
516
  * it was for, under a kind no cost reads. The charge's money is the ledger's paid step alone, which the cap counts and
@@ -660,10 +518,10 @@ export function meterFiguresIn(storeFile) {
660
518
  * as every paid tool's on the runner: a TOOL_COST beside it would count the same charge twice. Its seconds are the
661
519
  * browser_time meter's (meterFiguresFrom). */
662
520
  export const BROWSER_CHARGED = "agentrun.browser_charged";
663
- /** meterFiguresIn's figures from a run's entries by conversation, in log order: the one computation, shared by
664
- * meterFiguresIn (reading a settled run's own database) and the one-store reader (store-reads/cap.ts metersOverStore, over
665
- * A's journal). Only where the entries come from changes; the figures do not (the money-parity rule), as spentFrom is to
666
- * spentIn. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
521
+ /** /usage's meter figures from a run's entries by conversation, in log order, and beside them each meter's known dollars:
522
+ * its settled charges' figures, whether or not another of its charges is unknown (a hold, a call cut or never settled, is
523
+ * no charge here: it adds nothing). The one computation, which the one-store reader (store-reads/cap.ts metersOverStore)
524
+ * runs over A's journal. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
667
525
  * paid-tools session (store-reads/journal.ts withPaidCosts), as the file-backed run's root held each natively. */
668
526
  export function meterFiguresFrom(rows) {
669
527
  const root = rows.reduce((min, row) => Math.min(min, row.conversation), Infinity);
@@ -702,7 +560,7 @@ export function meterFiguresFrom(rows) {
702
560
  return { tools, tokens: usage ? (usage.usage?.usd ?? null) : 0, browser, others: otherTools, known, ...(notMetered ? { notMetered } : {}) };
703
561
  }
704
562
  /** What the paid tools of `entries` (TOOL_STARTED and TOOL_COST) spent, as the cap counts it: each charge, and a call
705
- * settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentIn counts it;
563
+ * settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentFrom counts it;
706
564
  * null when one has no figure. The run's reported cost reads such a call unknown instead (the timeline). */
707
565
  export function capToolSpend(entries) {
708
566
  const open = new Map();
@@ -766,7 +624,7 @@ export const runCap = () => runSpend?.cap;
766
624
  * quote, else an allowance, `basis` saying which) fits the cap, and whenever the spend is unknown; else run, one paid
767
625
  * call at a time, so each check sees the charge before it, and held at that figure (paidHolds) until the charge it
768
626
  * reports (`charge` of its result, undefined for none) joins the spend. A charge it does not say (null), or a call that
769
- * fails, counts at its held figure, as its mark does from the store (spentIn), since it may have charged that much.
627
+ * fails, counts at its held figure, as its mark does from the store (spentFrom), since it may have charged that much.
770
628
  * With no cap it just runs. */
771
629
  /** A paid call this run's cap refused for room (paidCall): its words, after the code, and its figures as a model
772
630
  * request's refusal keeps them (what was taken, and the call's hold as what it needs). The model's next request is
@@ -955,7 +813,9 @@ const whyOf = ({ text, figures }) => ({ why: text, figures });
955
813
  * (RefusalFigures, the pause's spent_usd). */
956
814
  const spentOf = (spent, held, cap) => {
957
815
  const holds = centsMoney(held);
958
- return holds !== "$0" ? `spent ${centsMoney(spent)} and holds ${holds} for steps still running, of its ${money(cap)} cap` : `spent ${centsMoney(spent)} of its ${money(cap)} cap`;
816
+ // A spend above $0 that rounds to it reads "less than a cent", never "$0" (the kernel's spentMoney).
817
+ const spentWords = spent > 0 && centsMoney(spent) === "$0" ? "less than a cent" : centsMoney(spent);
818
+ return holds !== "$0" ? `spent ${spentWords} and holds ${holds} for steps still running, of its ${money(cap)} cap` : `spent ${spentWords} of its ${money(cap)} cap`;
959
819
  };
960
820
  /** An amount in words, to the nearest cent ($0.0237416 is $0.02), as money says it ($1, $0.20, $0). */
961
821
  export const centsMoney = (usd) => money(Math.round(usd * 100) / 100);
@@ -1078,7 +938,7 @@ export function requestParts(overhead = piOverhead) {
1078
938
  * and, under the cap,
1079
939
  * each request to a model in `unpriced` (one serve has no price for) or whose output is priced and that has no output
1080
940
  * ceiling, each whose input cannot be bounded, and every request once what the run has spent is unknown: `spent` null
1081
- * (spentIn), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
941
+ * (spentFrom), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
1082
942
  * `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0. It is
1083
943
  * priced by requestPrice under `mode`, after the previous request of its conversation (the context's last answer, read
1084
944
  * by previousIn; its end as `now` read it when it settled here, else its own timestamp, which is when it began). Each
@@ -1251,7 +1111,7 @@ export async function capModels(models, cap, spent, { unpriced = new Set(), over
1251
1111
  * of what it streamed (stoppedFigure, at most `worst`), unless an attempt before the stop was lost: then at `worst`, as
1252
1112
  * its lost mark reads in a later process; one that ended on an error after its response began
1253
1113
  * (markResponseBegan: its usage is what had streamed, not what the provider can have billed), or that failed with no
1254
- * answer, at `worst`, what the cap held for it; each as spentIn reads its end mark. Without a figure (a deferred
1114
+ * answer, at `worst`, what the cap held for it; each as spentFrom reads its end mark. Without a figure (a deferred
1255
1115
  * response) it is unknown, as is a cost that is not a number, from then on. */
1256
1116
  const count = (answer, turn, worst, stopped, attempts) => {
1257
1117
  const plus = (sum, cost) => (sum !== null && typeof cost === "number" && Number.isFinite(cost) ? sum + cost : null);
@@ -1259,7 +1119,7 @@ export async function capModels(models, cap, spent, { unpriced = new Set(), over
1259
1119
  // One rule (bookRequest), from how the request ended (piEnded) as its marks read it too.
1260
1120
  const at = (message) => message.stopReason === "aborted" ? (stopped && !anyAttemptLost(attempts) ? stopped(message) : worst)
1261
1121
  : bookRequest(piEnded(message, responseBegan.has(message), attempts), worst === undefined ? {} : { hold: worst }).usd;
1262
- // A priced turn answer of the run's own model: the wrap-up's typical cost counts it, as costsIn reads it again (its
1122
+ // A priced turn answer of the run's own model: the wrap-up's typical cost counts it, as a process opened again reads it (its
1263
1123
  // pi.assistant entries). Never a compaction summary's or a native search's request on the same model (completeSimple
1264
1124
  // calls, `turn` false): no pi.assistant entry keeps them, so a process opened again would count without them.
1265
1125
  const priced = (message) => {
@@ -1342,7 +1202,7 @@ export async function capModels(models, cap, spent, { unpriced = new Set(), over
1342
1202
  const refused = createAssistantMessageEventStream();
1343
1203
  const message = refusal(model, judged.why);
1344
1204
  // Its own start mark first, so pi's error entry for it answers that mark, never an earlier request a stop or a crash
1345
- // cut. A mark that cannot be written still ends the request: spentIn leaves refusals out either way.
1205
+ // cut. A mark that cannot be written still ends the request: spentFrom leaves refusals out either way.
1346
1206
  void Promise.resolve()
1347
1207
  .then(() => markRefused?.(judged.figures))
1348
1208
  .catch(() => undefined)
package/dist/catalog.d.ts CHANGED
@@ -5,16 +5,5 @@
5
5
  export declare const WIRE_NAME: RegExp;
6
6
  /** A catalog name's wire name: itself when it already is one within the budget, else `:` and `/` to `__`, `.` to `_`,
7
7
  * any other character to `_`, and a `-<8 hex of the catalog name>` suffix (prefix trimmed to fit) when the result is
8
- * too long. The suffix makes a long name unique; a collision between two names is refused at the save (collisions,
9
- * reverseOf), never suffixed away. The reverse is a lookup, never a parse. */
8
+ * too long. The suffix makes a long name unique. */
10
9
  export declare function wireName(catalog: string): string;
11
- /** The reverse of {@link wireName} over `names`: a map from each name's wire name back to the catalog name. A collision
12
- * (two catalog names with one wire name) throws here, so a catalog that would shadow a name never loads; the save path
13
- * reports the same collision as a 422 before it reaches this. */
14
- export declare function reverseOf(names: Iterable<string>): ReadonlyMap<string, string>;
15
- /** The catalog names in `names` whose wire names collide, each paired with the name it clashes with: a definition that
16
- * holds a pair is refused (a 422 on the second one), so {@link reverseOf} never throws for a loaded catalog. */
17
- export declare function collisions(names: readonly string[]): {
18
- name: string;
19
- clashesWith: string;
20
- }[];