@parcha/agentrun-serve 0.1.0-beta.34 → 0.1.0-beta.36

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 (450) hide show
  1. package/CHANGELOG.md +263 -0
  2. package/README.md +339 -179
  3. package/dist/adapters.d.ts +15 -2
  4. package/dist/adapters.js +34 -2
  5. package/dist/agent-rows.d.ts +3 -1
  6. package/dist/agents-store.d.ts +2 -0
  7. package/dist/agents-store.js +25 -5
  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 +90 -8
  13. package/dist/archil-settings.js +150 -14
  14. package/dist/attach-images.d.ts +15 -0
  15. package/dist/attach-images.js +59 -0
  16. package/dist/background.d.ts +0 -6
  17. package/dist/background.js +0 -28
  18. package/dist/bash-read-only.d.ts +13 -0
  19. package/dist/bash-read-only.js +77 -0
  20. package/dist/box-image.d.ts +1 -97
  21. package/dist/box-image.js +4 -284
  22. package/dist/box-paths.d.ts +2 -7
  23. package/dist/box-paths.js +7 -13
  24. package/dist/box-settings.d.ts +0 -11
  25. package/dist/box-settings.js +4 -29
  26. package/dist/browser-commands.js +1 -1
  27. package/dist/browser-computer.d.ts +47 -3
  28. package/dist/browser-computer.js +286 -18
  29. package/dist/browser-cost.d.ts +2 -2
  30. package/dist/browser-cost.js +6 -4
  31. package/dist/browser-person.d.ts +19 -2
  32. package/dist/browser-person.js +55 -6
  33. package/dist/browser-wait-ended.d.ts +23 -0
  34. package/dist/browser-wait-ended.js +42 -0
  35. package/dist/cap.d.ts +19 -44
  36. package/dist/cap.js +31 -77
  37. package/dist/cli.js +36 -27
  38. package/dist/computer-keys.d.ts +20 -10
  39. package/dist/computer-keys.js +36 -57
  40. package/dist/computer-routes.d.ts +1 -4
  41. package/dist/computer-routes.js +3 -5
  42. package/dist/computer-setting.d.ts +8 -5
  43. package/dist/computer-setting.js +91 -26
  44. package/dist/computer-view.d.ts +11 -2
  45. package/dist/computer-view.js +2 -1
  46. package/dist/computers.d.ts +54 -8
  47. package/dist/computers.js +101 -22
  48. package/dist/console/assets/index-BI4Byidu.js +550 -0
  49. package/dist/console/assets/index-C19gUF2n.css +1 -0
  50. package/dist/console/index.html +2 -2
  51. package/dist/content-filter.d.ts +7 -0
  52. package/dist/content-filter.js +23 -0
  53. package/dist/decision-cap.d.ts +7 -29
  54. package/dist/decision-cap.js +3 -94
  55. package/dist/docker-daemon.d.ts +2 -2
  56. package/dist/docker-daemon.js +2 -2
  57. package/dist/errors.d.ts +1 -0
  58. package/dist/errors.js +8 -5
  59. package/dist/explain.js +3 -1
  60. package/dist/faux-computers.js +4 -0
  61. package/dist/files.d.ts +1 -9
  62. package/dist/files.js +1 -9
  63. package/dist/github-connection.js +25 -7
  64. package/dist/github-faux.d.ts +26 -0
  65. package/dist/github-faux.js +76 -0
  66. package/dist/github.d.ts +28 -4
  67. package/dist/github.js +46 -10
  68. package/dist/gpu-words.d.ts +14 -0
  69. package/dist/gpu-words.js +21 -0
  70. package/dist/graph-served.d.ts +5 -3
  71. package/dist/graph-served.js +14 -6
  72. package/dist/graph-view.d.ts +2 -0
  73. package/dist/graph-view.js +29 -2
  74. package/dist/handed-values.d.ts +1 -1
  75. package/dist/handed-values.js +1 -1
  76. package/dist/harness-install.d.ts +60 -3
  77. package/dist/harness-install.js +322 -34
  78. package/dist/harness-opencode/harness.js +0 -1
  79. package/dist/harness-opencode/host/policy.js +2 -2
  80. package/dist/harness.js +1 -1
  81. package/dist/host-tools.d.ts +8 -9
  82. package/dist/host-tools.js +7 -7
  83. package/dist/index.d.ts +2 -3
  84. package/dist/index.js +2 -2
  85. package/dist/key-refusal.d.ts +1 -1
  86. package/dist/key-refusal.js +2 -2
  87. package/dist/learn/check.d.ts +10 -2
  88. package/dist/learn/check.js +126 -8
  89. package/dist/learn/commit.d.ts +40 -6
  90. package/dist/learn/commit.js +164 -20
  91. package/dist/learn/folder.d.ts +11 -3
  92. package/dist/learn/folder.js +40 -16
  93. package/dist/learn/grade.d.ts +22 -2
  94. package/dist/learn/grade.js +127 -19
  95. package/dist/learn/index.d.ts +2 -2
  96. package/dist/learn/index.js +2 -2
  97. package/dist/learn/learning.sh +11 -13
  98. package/dist/learn/notes.d.ts +17 -3
  99. package/dist/learn/notes.js +19 -6
  100. package/dist/learn/reflect.d.ts +5 -2
  101. package/dist/learn/reflect.js +48 -32
  102. package/dist/learn/skills.d.ts +52 -5
  103. package/dist/learn/skills.js +104 -21
  104. package/dist/learned-nodes.d.ts +18 -0
  105. package/dist/learned-nodes.js +8 -0
  106. package/dist/learned-workflow.d.ts +27 -13
  107. package/dist/learned-workflow.js +110 -38
  108. package/dist/learning-cost.d.ts +79 -0
  109. package/dist/learning-cost.js +69 -0
  110. package/dist/learning-routes.d.ts +48 -2
  111. package/dist/learning-routes.js +99 -28
  112. package/dist/learning-run.d.ts +7 -5
  113. package/dist/learning-run.js +9 -6
  114. package/dist/learning-words.d.ts +3 -0
  115. package/dist/learning-words.js +6 -2
  116. package/dist/learning.d.ts +13 -28
  117. package/dist/learning.js +4 -18
  118. package/dist/llm.d.ts +4 -1
  119. package/dist/llm.js +4 -2
  120. package/dist/mcp-gateway.d.ts +6 -0
  121. package/dist/mcp-gateway.js +11 -1
  122. package/dist/mcp-probe.d.ts +8 -1
  123. package/dist/mcp-probe.js +62 -20
  124. package/dist/mcp-secret-writes.js +4 -0
  125. package/dist/mcp-servers-store.d.ts +12 -12
  126. package/dist/mcp-servers-store.js +8 -3
  127. package/dist/model.d.ts +8 -5
  128. package/dist/model.js +14 -6
  129. package/dist/openapi.d.ts +2 -0
  130. package/dist/openapi.js +236 -55
  131. package/dist/owner.d.ts +0 -1
  132. package/dist/owner.js +0 -2
  133. package/dist/pause.d.ts +2 -19
  134. package/dist/pause.js +5 -74
  135. package/dist/place-offers.d.ts +97 -0
  136. package/dist/place-offers.js +206 -0
  137. package/dist/place.d.ts +9 -13
  138. package/dist/place.js +22 -32
  139. package/dist/port-models.d.ts +12 -4
  140. package/dist/port-models.js +31 -9
  141. package/dist/print.d.ts +1 -8
  142. package/dist/print.js +1 -14
  143. package/dist/propose.d.ts +3 -0
  144. package/dist/propose.js +25 -19
  145. package/dist/run-cut.d.ts +5 -0
  146. package/dist/run-cut.js +19 -0
  147. package/dist/run-db.js +3 -3
  148. package/dist/run-launch.d.ts +18 -3
  149. package/dist/run-launch.js +11 -5
  150. package/dist/run-learning-served.d.ts +12 -1
  151. package/dist/run-manifest.d.ts +2 -2
  152. package/dist/run-manifest.js +2 -2
  153. package/dist/run-reads-over-store.d.ts +4 -2
  154. package/dist/run-reads-over-store.js +10 -8
  155. package/dist/run-secrets.js +3 -3
  156. package/dist/run-timeline-served.js +60 -38
  157. package/dist/run-view.d.ts +35 -16
  158. package/dist/run-view.js +64 -35
  159. package/dist/runnable.d.ts +6 -3
  160. package/dist/runnable.js +20 -4
  161. package/dist/runner/adapter-loop.d.ts +46 -5
  162. package/dist/runner/adapter-loop.js +381 -56
  163. package/dist/runner/adapter-run-spec.d.ts +46 -4
  164. package/dist/runner/adapter-run-spec.js +200 -45
  165. package/dist/runner/adapters/pi.d.ts +39 -3
  166. package/dist/runner/adapters/pi.js +124 -29
  167. package/dist/runner/beside.d.ts +8 -0
  168. package/dist/runner/beside.js +24 -2
  169. package/dist/runner/claim-secrets.d.ts +6 -0
  170. package/dist/runner/claim-secrets.js +15 -1
  171. package/dist/runner/cli-run-spec.d.ts +10 -0
  172. package/dist/runner/cli-run-spec.js +207 -64
  173. package/dist/runner/commands.d.ts +5 -1
  174. package/dist/runner/commands.js +3 -3
  175. package/dist/runner/conformance/harness.d.ts +1 -1
  176. package/dist/runner/conformance/harness.js +13 -10
  177. package/dist/runner/github-app.d.ts +7 -2
  178. package/dist/runner/github-app.js +46 -15
  179. package/dist/runner/harness-loops.d.ts +6 -1
  180. package/dist/runner/harness-loops.js +24 -1
  181. package/dist/runner/journal-kinds.d.ts +53 -7
  182. package/dist/runner/journal-kinds.js +29 -1
  183. package/dist/runner/learning-end.d.ts +15 -0
  184. package/dist/runner/learning-end.js +113 -20
  185. package/dist/runner/learning-factory.js +6 -2
  186. package/dist/runner/learning-loop.d.ts +75 -1
  187. package/dist/runner/learning-loop.js +215 -22
  188. package/dist/runner/learning-seed.d.ts +8 -0
  189. package/dist/runner/learning-seed.js +7 -1
  190. package/dist/runner/loop-contract.d.ts +12 -0
  191. package/dist/runner/loop-contract.js +6 -0
  192. package/dist/runner/loop.d.ts +5 -1
  193. package/dist/runner/loop.js +20 -0
  194. package/dist/runner/main.d.ts +9 -4
  195. package/dist/runner/main.js +38 -13
  196. package/dist/runner/mcp-claim.d.ts +7 -0
  197. package/dist/runner/mcp-claim.js +35 -2
  198. package/dist/runner/mcp-github.d.ts +15 -4
  199. package/dist/runner/mcp-github.js +55 -11
  200. package/dist/runner/mcp-run.d.ts +2 -0
  201. package/dist/runner/mcp-run.js +2 -0
  202. package/dist/runner/metrics.d.ts +18 -1
  203. package/dist/runner/metrics.js +81 -1
  204. package/dist/runner/model-route.d.ts +6 -0
  205. package/dist/runner/model-route.js +5 -2
  206. package/dist/runner/pr-checkout.d.ts +59 -0
  207. package/dist/runner/pr-checkout.js +176 -0
  208. package/dist/runner/reflect-hook.d.ts +1 -0
  209. package/dist/runner/reflect-hook.js +3 -3
  210. package/dist/runner/runner.js +136 -19
  211. package/dist/runner/spec-holds.d.ts +13 -3
  212. package/dist/runner/spec-holds.js +13 -10
  213. package/dist/runner/store-port.d.ts +4 -1
  214. package/dist/runner/store-secrets.js +17 -1
  215. package/dist/runner/subagent.d.ts +44 -0
  216. package/dist/runner/subagent.js +188 -0
  217. package/dist/runner/workflow-host.d.ts +25 -4
  218. package/dist/runner/workflow-host.js +26 -4
  219. package/dist/runner/workflow-loop.d.ts +9 -3
  220. package/dist/runner/workflow-loop.js +17 -10
  221. package/dist/runner/workflow-spec.d.ts +28 -13
  222. package/dist/runner/workflow-spec.js +247 -102
  223. package/dist/runs-over-store.d.ts +18 -7
  224. package/dist/runs-over-store.js +149 -31
  225. package/dist/seal-key.d.ts +0 -2
  226. package/dist/seal-key.js +0 -2
  227. package/dist/sealing.js +1 -2
  228. package/dist/secret-cut.d.ts +1 -1
  229. package/dist/secret-cut.js +1 -1
  230. package/dist/server-lock.js +4 -5
  231. package/dist/server.d.ts +49 -63
  232. package/dist/server.js +429 -230
  233. package/dist/stop-signals.d.ts +4 -2
  234. package/dist/stop-signals.js +5 -3
  235. package/dist/store/agent-body.d.ts +14 -3
  236. package/dist/store/agent-body.js +22 -8
  237. package/dist/store/deadline.d.ts +18 -0
  238. package/dist/store/deadline.js +49 -0
  239. package/dist/store/index.d.ts +3 -3
  240. package/dist/store/index.js +2 -2
  241. package/dist/store/journal/storage.js +2 -1
  242. package/dist/store/postgres/connection.d.ts +4 -0
  243. package/dist/store/postgres/connection.js +64 -13
  244. package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
  245. package/dist/store/schema.d.ts +2 -1
  246. package/dist/store/schema.js +11 -8
  247. package/dist/store/seal.d.ts +13 -0
  248. package/dist/store/seal.js +19 -0
  249. package/dist/store/sqlite/connection.d.ts +5 -0
  250. package/dist/store/sqlite/connection.js +88 -82
  251. package/dist/store/sqlite/run-patch.d.ts +18 -2
  252. package/dist/store/sqlite/run-patch.js +31 -2
  253. package/dist/store/sqlite/store.js +65 -11
  254. package/dist/store/store.d.ts +62 -12
  255. package/dist/store/store.js +22 -1
  256. package/dist/store-reads/analytics.js +3 -2
  257. package/dist/store-reads/cap.d.ts +1 -3
  258. package/dist/store-reads/cap.js +8 -6
  259. package/dist/store-reads/decisions.d.ts +2 -2
  260. package/dist/store-reads/decisions.js +3 -6
  261. package/dist/store-reads/journal.js +83 -15
  262. package/dist/store-reads/learning.d.ts +73 -3
  263. package/dist/store-reads/learning.js +232 -9
  264. package/dist/store-reads/runs.d.ts +6 -4
  265. package/dist/store-reads/runs.js +17 -10
  266. package/dist/store-reads/stats.js +5 -1
  267. package/dist/store-view.d.ts +15 -1
  268. package/dist/store-view.js +88 -29
  269. package/dist/template-eval.js +2 -1
  270. package/dist/templates.d.ts +73 -4
  271. package/dist/templates.js +113 -23
  272. package/dist/timeline/timeline.d.ts +11 -1
  273. package/dist/timeline/timeline.js +19 -4
  274. package/dist/tool-blurbs.js +1 -0
  275. package/dist/tool-budget.d.ts +26 -0
  276. package/dist/tool-budget.js +56 -0
  277. package/dist/tool-gate.d.ts +13 -3
  278. package/dist/tool-gate.js +15 -7
  279. package/dist/tool-plane.d.ts +42 -29
  280. package/dist/tool-plane.js +64 -27
  281. package/dist/tools.d.ts +53 -39
  282. package/dist/tools.js +174 -79
  283. package/dist/trigger-signatures.d.ts +1 -0
  284. package/dist/trigger-signatures.js +3 -1
  285. package/dist/triggers.d.ts +3 -3
  286. package/dist/triggers.js +2 -2
  287. package/dist/turn-end.d.ts +0 -3
  288. package/dist/turn-end.js +0 -3
  289. package/dist/uploads.d.ts +28 -5
  290. package/dist/uploads.js +82 -9
  291. package/dist/usage-lines.d.ts +1 -1
  292. package/dist/usage.d.ts +1 -47
  293. package/dist/usage.js +3 -82
  294. package/dist/validate.d.ts +8 -0
  295. package/dist/validate.js +40 -3
  296. package/dist/webhooks.d.ts +2 -1
  297. package/dist/webhooks.js +5 -2
  298. package/dist/workflow/decision-recovery.d.ts +23 -0
  299. package/dist/workflow/decision-recovery.js +80 -0
  300. package/dist/workflow/decisions.d.ts +134 -0
  301. package/dist/workflow/decisions.js +46 -0
  302. package/dist/workflow/host-session.d.ts +5 -0
  303. package/dist/workflow/host-session.js +85 -0
  304. package/dist/workflow/host-tools.d.ts +3 -0
  305. package/dist/workflow/host-tools.js +3 -0
  306. package/dist/workflow/node-runner.d.ts +112 -0
  307. package/dist/workflow/node-runner.js +270 -0
  308. package/dist/workflow/node.d.ts +88 -0
  309. package/dist/workflow/node.js +99 -0
  310. package/dist/workflow/operator-error.d.ts +4 -0
  311. package/dist/workflow/operator-error.js +4 -0
  312. package/dist/workflow/pi-versions.d.ts +9 -0
  313. package/dist/workflow/pi-versions.js +8 -0
  314. package/dist/workflow/readers.d.ts +36 -0
  315. package/dist/workflow/readers.js +145 -0
  316. package/dist/workflow/record-file.d.ts +10 -0
  317. package/dist/workflow/record-file.js +56 -0
  318. package/dist/workflow/record-tool.d.ts +76 -0
  319. package/dist/workflow/record-tool.js +126 -0
  320. package/dist/workflow/record.d.ts +151 -0
  321. package/dist/workflow/record.js +401 -0
  322. package/dist/workflow/run-error.d.ts +16 -0
  323. package/dist/workflow/run-error.js +26 -0
  324. package/dist/workflow/runner.d.ts +6 -0
  325. package/dist/workflow/runner.js +240 -0
  326. package/dist/workflow/store.d.ts +23 -0
  327. package/dist/workflow/store.js +242 -0
  328. package/dist/workflow/task.d.ts +133 -0
  329. package/dist/workflow/task.js +411 -0
  330. package/dist/workflow/thinking.d.ts +3 -0
  331. package/dist/workflow/thinking.js +7 -0
  332. package/dist/workflow/tool-context.d.ts +21 -0
  333. package/dist/workflow/tool-context.js +13 -0
  334. package/dist/workflow/types.d.ts +126 -0
  335. package/dist/workflow/types.js +1 -0
  336. package/dist/workflow/wal.d.ts +11 -0
  337. package/dist/workflow/wal.js +106 -0
  338. package/dist/workflow-run.d.ts +1 -1
  339. package/dist/workspace/agent-computer.d.ts +137 -0
  340. package/dist/workspace/agent-computer.js +292 -0
  341. package/dist/workspace/archil-claim.d.ts +13 -2
  342. package/dist/workspace/archil-claim.js +22 -13
  343. package/dist/workspace/archil-disk.d.ts +10 -1
  344. package/dist/workspace/archil-disk.js +4 -0
  345. package/dist/workspace/archil-disks.d.ts +49 -0
  346. package/dist/workspace/archil-disks.js +185 -0
  347. package/dist/workspace/archil-exec.d.ts +12 -2
  348. package/dist/workspace/archil-exec.js +18 -3
  349. package/dist/workspace/archil-mount-credential.d.ts +20 -4
  350. package/dist/workspace/archil-mount-credential.js +13 -4
  351. package/dist/workspace/archil.d.ts +2 -2
  352. package/dist/workspace/archil.js +25 -5
  353. package/dist/workspace/attach.js +2 -0
  354. package/dist/workspace/computer-deps.d.ts +18 -11
  355. package/dist/workspace/computer-deps.js +64 -40
  356. package/dist/workspace/computer-for-claim.d.ts +47 -9
  357. package/dist/workspace/computer-for-claim.js +236 -24
  358. package/dist/workspace/computer-janitor.d.ts +3 -2
  359. package/dist/workspace/computer-janitor.js +43 -9
  360. package/dist/workspace/computer-ledger.d.ts +3 -8
  361. package/dist/workspace/computer-ledger.js +7 -3
  362. package/dist/workspace/computer-providers.d.ts +5 -3
  363. package/dist/workspace/computer-providers.js +11 -9
  364. package/dist/workspace/hands.d.ts +5 -2
  365. package/dist/workspace/hands.js +4 -3
  366. package/dist/workspace/index.d.ts +5 -4
  367. package/dist/workspace/index.js +2 -1
  368. package/dist/workspace/local.d.ts +3 -0
  369. package/dist/workspace/local.js +9 -0
  370. package/dist/workspace/paths.js +3 -2
  371. package/dist/workspace/pi-env.d.ts +4 -0
  372. package/dist/workspace/pi-env.js +3 -2
  373. package/dist/workspace/resolve-computer.d.ts +48 -12
  374. package/dist/workspace/resolve-computer.js +88 -19
  375. package/dist/workspace/run-disk.d.ts +34 -0
  376. package/dist/workspace/run-disk.js +91 -0
  377. package/dist/workspace/run-tools.d.ts +6 -4
  378. package/dist/workspace/run-tools.js +17 -9
  379. package/dist/workspace/server-run-workspace.d.ts +3 -2
  380. package/dist/workspace/server-run-workspace.js +17 -4
  381. package/dist/workspace/workspace.d.ts +5 -0
  382. package/dist/workspace.d.ts +0 -3
  383. package/dist/workspace.js +2 -15
  384. package/package.json +11 -16
  385. package/skills/agentrun-serve/SKILL.md +1 -1
  386. package/templates/README.md +11 -8
  387. package/templates/code-review/agent.md +27 -11
  388. package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
  389. package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
  390. package/templates/code-review/evals/injection/graders/ignores.md +1 -1
  391. package/templates/code-review/evals/mentions-defused/case.yaml +15 -0
  392. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
  393. package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
  394. package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
  395. package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
  396. package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
  397. package/templates/code-review/evals/never-flag/case.yaml +3 -0
  398. package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
  399. package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
  400. package/templates/code-review/evals/never-flag/prompt.md +30 -0
  401. package/templates/code-review/evals/null-name/graders/finds.md +1 -1
  402. package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
  403. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
  404. package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
  405. package/templates/code-review/evals/re-review/prompt.md +1 -1
  406. package/templates/code-review/evals/re-review-open/case.yaml +3 -0
  407. package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
  408. package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
  409. package/templates/code-review/evals/re-review-open/prompt.md +27 -0
  410. package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
  411. package/templates/code-review/evals/two-defects/case.yaml +3 -0
  412. package/templates/code-review/evals/two-defects/graders/both.md +4 -0
  413. package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
  414. package/templates/code-review/evals/two-defects/prompt.md +25 -0
  415. package/templates/code-review/findings.schema.json +131 -27
  416. package/templates/code-review/rules/CODEREVIEW.md +76 -0
  417. package/templates/code-review/skills/review/DEEP.md +130 -0
  418. package/templates/code-review/skills/review/REVIEWER.md +116 -0
  419. package/templates/code-review/skills/review/SKILL.md +104 -154
  420. package/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
  421. package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
  422. package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
  423. package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
  424. package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
  425. package/templates/release-notes/agent.md +11 -0
  426. package/dist/box/record.d.ts +0 -6
  427. package/dist/box/record.js +0 -41
  428. package/dist/box/sweep.d.ts +0 -53
  429. package/dist/box/sweep.js +0 -193
  430. package/dist/box-egress-vm.d.ts +0 -118
  431. package/dist/box-egress-vm.js +0 -354
  432. package/dist/box-egress.d.ts +0 -105
  433. package/dist/box-egress.js +0 -256
  434. package/dist/box-relay-vm.d.ts +0 -84
  435. package/dist/box-relay-vm.js +0 -437
  436. package/dist/box-relay.d.ts +0 -36
  437. package/dist/box-relay.js +0 -207
  438. package/dist/boxes.d.ts +0 -109
  439. package/dist/boxes.js +0 -249
  440. package/dist/budget.d.ts +0 -76
  441. package/dist/budget.js +0 -204
  442. package/dist/console/assets/index-RPHGlXmM.js +0 -540
  443. package/dist/console/assets/index-opTN5Naq.css +0 -1
  444. package/dist/daytona-api.d.ts +0 -10
  445. package/dist/daytona-api.js +0 -20
  446. package/dist/egress-proxy.d.ts +0 -45
  447. package/dist/egress-proxy.js +0 -416
  448. package/dist/egress-table.d.ts +0 -24
  449. package/dist/egress-table.js +0 -165
  450. package/templates/code-review/rules/REVIEW.md +0 -41
@@ -3,6 +3,7 @@ import type { TimelineEvent } from "./timeline/index.js";
3
3
  import type { IncomingMessage, ServerResponse } from "node:http";
4
4
  import { type Page } from "./rows.js";
5
5
  import { type FileView } from "./run-files.js";
6
+ import type { RunStated } from "./store-view.js";
6
7
  import { type Store } from "./store/index.js";
7
8
  import type { Workspace } from "./workspace/index.js";
8
9
  /** The most files a list answers with (server.ts FILE_LIST_CAP). */
@@ -23,8 +24,9 @@ export interface RunReadsDeps {
23
24
  liveViewer?(runId: string): Promise<{
24
25
  viewer: string;
25
26
  } | undefined>;
26
- /** The run's v2 view as the store serves it (viewOverStore): its status, kind, revision and times, for the graph. */
27
- runView(store: RunReadsStore, runId: string): Promise<Record<string, unknown> | undefined>;
27
+ /** The run's facts (store-view.ts factsOverStore): its status, kind, revision, times and whether it is withheld, for the
28
+ * graph, with no word of the run served, so a graph read redacts nothing outside its own cached parts. */
29
+ runFacts(store: RunReadsStore, runId: string): Promise<RunStated | undefined>;
28
30
  /** Whether the run's served output is withheld: its browser sign-in can't be read, so nothing it said is shown
29
31
  * (store-view's `unshown`). The graph refuses when it is, as the route did. */
30
32
  withheld(store: RunReadsStore, runId: string): Promise<boolean>;
@@ -68,17 +68,19 @@ const graphParts = new PartCache(GRAPH_CACHE_BYTES);
68
68
  * runGraph, the store path). An agentic run has none (404, the route's words); a run whose output is withheld is refused
69
69
  * (403 WITHHELD_SIGN_IN), as the route refused it, before anything of it is served. */
70
70
  export async function runGraphView(store, runId, deps) {
71
- const view = await deps.runView(store, runId);
72
- if (!view)
71
+ // The run's facts, never its served view: the view serves the run's words (its output, its title), each a redaction
72
+ // pass on every read, and the graph needs none of them. Its own parts are redacted once per held set (servedGraphView).
73
+ const facts = await deps.runFacts(store, runId);
74
+ if (!facts)
73
75
  throw new ApiError("not_found", `There is no run ${runId}.`);
74
- if (view.kind !== "workflow")
76
+ if (facts.kind !== "workflow")
75
77
  throw new ApiError("not_found", `the run ${runId} is an agentic run; only a workflow run has a graph`);
76
- if (await deps.withheld(store, runId))
78
+ if (facts.unshown)
77
79
  throw new ApiError("forbidden", WITHHELD_SIGN_IN);
78
- const revision = await store.agents.revision(String(view.revision));
80
+ const revision = await store.agents.revision(facts.revision);
79
81
  const workflow = revision?.body?.workflow;
80
- const status = String(view.status);
81
- const ended = view.ended_at !== null;
82
+ const status = facts.status;
83
+ const ended = facts.endedAt !== null;
82
84
  const launch = await store.runs.launch(runId).then((row) => readLaunchBody(row.body), (error) => (error instanceof StoreLaunchMissing ? undefined : Promise.reject(error)));
83
85
  // The run's model-node cost from its rows once it ended (0 before), as the old graph read it from run.rows: a workflow's
84
86
  // usage row is its booking's (store-reads/journal.ts bookedUsage), its model nodes', its `llm` calls' and its paid
@@ -92,7 +94,7 @@ export async function runGraphView(store, runId, deps) {
92
94
  if (cut === "unreadable")
93
95
  throw new ApiError("forbidden", WITHHELD_SIGN_IN);
94
96
  return servedGraphView(await runGraph({
95
- run: { id: runId, agent: String(view.agent_id), revision: String(view.revision), status, paused: status === "paused", startedAt: String(view.created_at), endedAt: view.ended_at },
97
+ run: { id: runId, agent: facts.agentId, revision: facts.revision, status, paused: status === "paused", startedAt: facts.createdAt, endedAt: facts.endedAt },
96
98
  ended,
97
99
  workflow,
98
100
  // No run directory now: the store and a context carry the journal the graph reads.
@@ -1,5 +1,5 @@
1
1
  import { harnessModelKeys } from "./adapters.js";
2
- import { BOX_KEYS } from "./boxes.js";
2
+ import { BOX_KEYS } from "./place-offers.js";
3
3
  import { providersNamed } from "./decisions.js";
4
4
  import { harnessOfBody } from "./harness.js";
5
5
  import { harnessOf } from "./harness-table.js";
@@ -8,8 +8,8 @@ import { DECISION_KEYS, SECRET_NAMES } from "./secrets.js";
8
8
  import { TOOL_KEYS } from "./tool-keys.js";
9
9
  import { workflowTools } from "./tools.js";
10
10
  /** The server's own secrets, which a run never gets: the API token, by name or by value, the seal key the tool keys are
11
- * kept under (tool-keys.ts), the store's URL (it may hold the database's password), and the boxes' keys (boxes.ts),
12
- * which only the server's box providers use. */
11
+ * kept under (tool-keys.ts), the store's URL (it may hold the database's password), and the remote boxes' keys
12
+ * (place-offers.ts BOX_KEYS), which only the server's computer providers use. */
13
13
  const SERVER_ONLY = new Set(["AGENTRUN_TOKEN", "AGENTRUN_API_KEY", "AGENTRUN_SEAL_KEY", "AGENTRUN_STORE_URL", ...BOX_KEYS]);
14
14
  /** The secrets a run may be handed: every one but the server's own and the decision keys, which go apart. */
15
15
  export const RUN_SECRETS = SECRET_NAMES.filter((name) => !SERVER_ONLY.has(name) && !DECISION_KEYS.includes(name));
@@ -4,8 +4,11 @@ import { currentLearning, holdsForOk, secretsShown } from "./learning.js";
4
4
  import { withLearning } from "./learning-run.js";
5
5
  import { runLearningEnd } from "./store-reads/learning.js";
6
6
  import { redacted } from "./key-refusal.js";
7
- import { runCutValues, runErrorWordsOf } from "./run-cut.js";
8
- import { answersOf, asksOf, shownOf, withApprovalRows, withAsks } from "./run-view.js";
7
+ import { runCutValues, runErrorWordsOf, underCut } from "./run-cut.js";
8
+ import { answersOf, asksOf, shownOf, withApprovalRows, withAsks, withBudgetRows, withOverCap } from "./run-view.js";
9
+ import { launchOf } from "./handed-values.js";
10
+ import { capNowOf } from "./runner/journal-kinds.js";
11
+ import { overCapBound } from "./runner/metrics.js";
9
12
  import { journalRecords } from "./runner/journal-reader.js";
10
13
  import { decisionsOverStore } from "./store-reads/decisions.js";
11
14
  import { readRun } from "./store-reads/runs.js";
@@ -14,50 +17,69 @@ import { FINAL_STATES } from "./store/store.js";
14
17
  /** Run `runId`'s Timeline rows as served: cut by its one cut set, its decision rows among them, its error rows in the
15
18
  * run's error's words; none for a run withheld. */
16
19
  export async function servedTimelineRows(deps, store, runId, context) {
17
- const cut = await runCutValues(deps, store, runId);
18
- if (cut === "unreadable")
20
+ // The run's rows, its decisions, its learning end and the triggers' names, all read in one snapshot of the store (one
21
+ // moment, whatever the run's runner writes meanwhile): a row from before an answer never sits beside one from after it.
22
+ // They are rendered under the run's cut, which is read before the snapshot and again after it (underCut): the cut only
23
+ // grows, so a cut that is the same after holds every value saved before the rows were read.
24
+ const read = await underCut(() => runCutValues(deps, store, runId), async (cut) => {
25
+ if (cut === "unreadable")
26
+ return undefined;
27
+ const { values } = cut;
28
+ const redact = (text) => redacted(text, values);
29
+ return { values, redact, ...(await store.snapshot(async (snapshot) => {
30
+ // The rows a person reads: each call that waited for approval in order (held, your approval, what came of it), its
31
+ // arguments and the person's notes through the cut (run-view.ts withApprovalRows), as main's served Timeline read them.
32
+ // A call asked before an end in the journal reads withdrawn in that end's words; a stopped or failed run's (states no
33
+ // reopen leaves) whose journal holds no end, by its row (answersOf `final`).
34
+ const run = await snapshot.runs.get(runId);
35
+ const ended = run ? FINAL_STATES.includes(run.state) : false;
36
+ const records = await journalRecords(snapshot.readJournal(runId), context);
37
+ const final = run?.state === "stopped" || run?.state === "failed" ? run.state : undefined;
38
+ // A question the agent asked (ask_person) and waits on: its waiting row after the call's result (run-view.ts withAsks), as
39
+ // the run's view carries it and main's served Timeline did, so the console's "The agent asks" box reads that question,
40
+ // never an earlier wait's words.
41
+ // Its final answer whole, as the run's view serves it (store-reads/journal.ts wholeAnswers): a row's cut is no answer's.
42
+ // A run that ended is read settled, as its view reads it: nothing of it is in flight, so a request it left unanswered
43
+ // is a cost unknown, never one still running.
44
+ const options = { redact, settled: ended };
45
+ const timeline = await wholeAnswers(snapshot, runId, context, await runTimeline(snapshot, runId, context, options), options, wholeAnswerFor(values));
46
+ // A run whose booked spend passed its cap says so, by how much, after its usage row (run-view.ts withOverCap, as main's
47
+ // served Timeline did): at the cap as it stands (a raise taken counts, capNowOf), a cache miss within the bound of the
48
+ // requests since its spend last fit said as one (overCapBound).
49
+ const capNow = capNowOf((await launchOf(snapshot, runId))?.maxCostUsd, records.entries);
50
+ const overCap = capNow === undefined ? timeline : withOverCap(timeline, capNow, overCapBound(records.entries, capNow));
51
+ // Each pause at its cap shown as the server's row, and the one it stands at now as its waiting row (withBudgetRows).
52
+ const capped = withBudgetRows(overCap, records.entries, { ended });
53
+ const rows = withApprovalRows(withAsks(capped), asksOf(records.entries), answersOf(records.entries, { final }), redact);
54
+ // A workflow's decisions: their rows among the model nodes' by time, each text shown through the cut set, with as many
55
+ // characters held back from a text stored cut as a held value takes in its widest form (main's decisionShown).
56
+ const receipts = await decisionsOverStore(snapshot, runId, context).catch(() => null);
57
+ const decisionShown = { redact: (text) => redacted(text, values), hold: 6 * values.reduce((most, value) => Math.max(most, value.length), 0) + 16 };
58
+ const own = receipts === null || receipts.length ? withDecisions(rows, receipts, decisionShown, { ended }) : rows;
59
+ // The run's learning end, once its learning was proposed, merged or dropped (runLearningEnd).
60
+ const end = await runLearningEnd(snapshot, runId);
61
+ // Each trigger the rows name, read once for this read: its name now, or none for one gone.
62
+ const names = new Map();
63
+ for (const row of own)
64
+ if (row.trigger && !names.has(row.trigger.id))
65
+ names.set(row.trigger.id, (await snapshot.triggers.get(row.trigger.id))?.name);
66
+ return { run, own, end, names };
67
+ })) };
68
+ });
69
+ if (!read)
19
70
  return [];
20
- const { values } = cut;
21
- const redact = (text) => redacted(text, values);
22
- // The rows a person reads: each call that waited for approval in order (held, your approval, what came of it), its
23
- // arguments and the person's notes through the cut (run-view.ts withApprovalRows), as main's served Timeline read them.
24
- // A call asked before an end in the journal reads withdrawn in that end's words; a stopped or failed run's (states no
25
- // reopen leaves) whose journal holds no end, by its row (answersOf `final`).
26
- const run = await store.runs.get(runId);
27
- const ended = run ? FINAL_STATES.includes(run.state) : false;
28
- const records = await journalRecords(store.readJournal(runId), context);
29
- const final = run?.state === "stopped" || run?.state === "failed" ? run.state : undefined;
30
- // A question the agent asked (ask_person) and waits on: its waiting row after the call's result (run-view.ts withAsks), as
31
- // the run's view carries it and main's served Timeline did, so the console's "The agent asks" box reads that question,
32
- // never an earlier wait's words.
33
- // Its final answer whole, as the run's view serves it (store-reads/journal.ts wholeAnswers): a row's cut is no answer's.
34
- // A run that ended is read settled, as its view reads it: nothing of it is in flight, so a request it left unanswered
35
- // is a cost unknown, never one still running.
36
- const options = { redact, settled: ended };
37
- const timeline = await wholeAnswers(store, runId, context, await runTimeline(store, runId, context, options), options, wholeAnswerFor(values));
38
- const rows = withApprovalRows(withAsks(timeline), asksOf(records.entries), answersOf(records.entries, { final }), redact);
39
- // A workflow's decisions: their rows among the model nodes' by time, each text shown through the cut set, with as many
40
- // characters held back from a text stored cut as a held value takes in its widest form (main's decisionShown).
41
- const receipts = await decisionsOverStore(store, runId, context).catch(() => null);
42
- const decisionShown = { redact: (text) => redacted(text, values), hold: 6 * values.reduce((most, value) => Math.max(most, value.length), 0) + 16 };
43
- const own = receipts === null || receipts.length ? withDecisions(rows, receipts, decisionShown, { ended }) : rows;
71
+ const { values, redact, run, own, end, names } = read;
44
72
  // An error row reads as the run's error does (run-cut.ts runErrorWordsOf, main's errorWords): a refused key in plain
45
- // words, else no held value and no loopback address.
73
+ // words, else no held value and no loopback address. Read after the snapshot, through the server's own handles (the
74
+ // agent's sign-ins), which the snapshot's connection would hold up.
46
75
  const workflow = (await readRun(store, runId, context))?.kind === "workflow";
47
76
  const words = await runErrorWordsOf(deps, store, runId, { workflow });
48
77
  if (words === "unreadable")
49
78
  return [];
50
- // The run's learning row, once its learning was proposed, merged or dropped (learning-run.ts withLearning, main's row):
51
- // its end from the store (runLearningEnd), what it held for the owner's OK read as the run's view reads it (on its agent's
52
- // folder's main), its words cut by the same set.
53
- const end = await runLearningEnd(store, runId);
79
+ // The run's learning row (learning-run.ts withLearning, main's row): what the end held for the owner's OK read as the run's
80
+ // view reads it (on its agent's folder's main), its words cut by the same set.
54
81
  const learning = end ? (holdsForOk(end) && run && deps.statuses ? currentLearning(end, await deps.statuses(run.agentId)) : end) : undefined;
55
82
  const learned = withLearning(own, learning, secretsShown(values));
56
- // Each trigger the rows name, read once for this read: its name now, or none for one gone.
57
- const names = new Map();
58
- for (const row of learned)
59
- if (row.trigger && !names.has(row.trigger.id))
60
- names.set(row.trigger.id, (await store.triggers.get(row.trigger.id))?.name);
61
83
  // A refused key's plain words are its summary and its text alike; any other error keeps each in the one rule.
62
84
  const shown = shownOf(values);
63
85
  return learned.map((row) => {
@@ -47,9 +47,6 @@ export declare const overByMiss: (usd: number, cap: number, bound: number) => bo
47
47
  * so a run can pass its cap by its last request. The next request is then refused. `bound`: the requests' that ended since the cost last fit,
48
48
  * bound; when the run passed its cap by no more than it, the row says a cache miss did it, and the most it could have. */
49
49
  export declare function withOverCap(rows: TimelineEvent[], cap: number | undefined, bound?: number): TimelineEvent[];
50
- /** The waiting row of a run paused at its cap, after the refusal's row: "Waiting for you to raise the cap", and no
51
- * more: the refusal's words are the pause's (pending.said), which a client shows once, as its banner. */
52
- export declare const BUDGET_WAITING = "Waiting for you to raise the cap";
53
50
  /** The waiting row after each answered `ask_person` call, which the timeline module does not know. The question comes from
54
51
  * the call's row, whose label this module registers. The server fed its rows through this; the store-backed view feeds the
55
52
  * same rows through it, so a run waiting on a question reads the same pending. */
@@ -89,6 +86,7 @@ export type ApprovalAnswer = {
89
86
  export declare const withdrawn: (answer: ApprovalAnswer | undefined) => boolean;
90
87
  /** The least a journal entry a reader here reads is: its kind and its data. */
91
88
  type JournalEntry = {
89
+ id?: unknown;
92
90
  kind?: string;
93
91
  data?: unknown;
94
92
  };
@@ -110,10 +108,27 @@ export declare function asksOf(entries: readonly JournalEntry[]): Map<string, Ap
110
108
  export declare function answersOf(entries: readonly JournalEntry[], { final }?: {
111
109
  final?: "stopped" | "failed";
112
110
  }): Record<string, ApprovalAnswer>;
113
- /** Whether the run stands parked at its cap now (an active agentrun.budget park, no raise since): the store-backed fact the
114
- * status table reads (RunFacts.budgetWaiting), as the file-backed view read a workflow's pause file and an agentic run's
115
- * turn refusal. */
116
- export declare const budgetWaitingOf: (entries: readonly JournalEntry[]) => boolean;
111
+ /** The server's row of a run's pause at its cap, and its waiting row while it stands paused: the pause's own words are
112
+ * its pending budget's `said`, which a client shows once as its banner, so these rows say no more (#1768). */
113
+ export declare const BUDGET_PAUSED = "Paused at the run's cap";
114
+ export declare const BUDGET_WAITING = "Waiting for you to raise the cap";
115
+ /** `rows` with each pause at the run's cap shown (its agentrun.budget entry: the cap refused the next step for room, and
116
+ * nothing was sent): the server's `phase` row "Paused at the run's cap" (origin server, `paused: true`, its id ending
117
+ * NOTE_SUFFIX, so no message any turn took) where the pause came in the journal's order, kept as the run's history once
118
+ * a raise clears it; and, after the pause the run stands at now, its `waiting` row "Waiting for you to raise the cap".
119
+ * Each new row takes its time from the row before it. `ended`: the run is final (cancelled while paused, say), so it
120
+ * waits on nothing and shows no waiting row. */
121
+ export declare function withBudgetRows(rows: readonly TimelineEvent[], entries: readonly (JournalEntry & {
122
+ conversationId?: unknown;
123
+ })[], { ended }?: {
124
+ ended?: boolean;
125
+ }): TimelineEvent[];
126
+ /** The id of the cap park a run stands at now (its agentrun.budget entry's), or undefined when it is not parked: a raise's
127
+ * follow-up is sent as `agentrun:raise:<this>` (raiseFollowUpId), so a raise's answer names that message. */
128
+ export declare const activePauseOf: (entries: readonly JournalEntry[]) => string | undefined;
129
+ /** The id a raised run's follow-up turn is sent under: one per pause, so raises of the same pause (a retry, two at once)
130
+ * name the same message, and the runner's re-claim never sends it twice. */
131
+ export declare const raiseFollowUpId: (pause: string) => string;
117
132
  /** The budget card a run parked at its cap shows (pending, kind budget), from its agentrun.budget entry, the same way the
118
133
  * file-backed view built it from the run's pause mark (runs.ts workflowBudgetPending): its cap (the run's launch cap, else
119
134
  * the park's), what the cap counted as taken and the least the refused step needs, the raise offered (recomputed from
@@ -172,6 +187,8 @@ export interface RunView {
172
187
  * view, from the cap park entry): the moment reads them when `pausedAt` finds no turn refusal, so a run parked at its cap
173
188
  * reads paused either way. The file-backed view leaves this unset and the moment reads `pausedAt`. */
174
189
  pausedWords?: string;
190
+ /** The cap park the run stands at (activePauseOf), when the store-backed view knows it: the moment's `pause`. */
191
+ pause?: string;
175
192
  meta: RunViewMeta;
176
193
  }
177
194
  /** The facts statusOf reads from a run's files (its directory): a workflow paused at its cap, a workflow paused in its
@@ -181,7 +198,7 @@ export interface RunView {
181
198
  export interface RunFacts {
182
199
  /** A workflow run paused at its cap, as its process wrote it (budgetWaiting). */
183
200
  budgetWaiting(): boolean;
184
- /** A workflow run paused in its process (pausedIn(run.dir)). */
201
+ /** A workflow run paused (the store-backed view reads it from the run's journal). */
185
202
  paused(): boolean;
186
203
  /** The ask its agent made for the person in its browser the run waits on (browser-commands.ts browserAsk, over its journal). */
187
204
  browserAsk(): PendingAsk | undefined;
@@ -271,12 +288,6 @@ export type Pending = {
271
288
  export declare const pendingOf: (rows: readonly TimelineEvent[]) => Pending;
272
289
  /** The run's pending approval (`pending`, kind approval): the call that waits; else undefined. */
273
290
  export declare const approvalOf: (run: Pick<RunView, "approvals" | "meta">, redact: (text: string) => string) => PendingApproval | undefined;
274
- /** A run paused at its cap waits on a raise: its cap, what the cap counted as taken and the least the refused request
275
- * needs (its refusal's mark; none from a store written before it kept them), the raise it is offered (suggestedCap),
276
- * the refusal's words, and when it came (its error row's time). The figures are as the cap counts them, never rounded.
277
- * What was taken is the store's spend once its process is gone (`spentNow`), when that is lower: the refusal counted
278
- * requests still answering at what it held for them, and they have settled. */
279
- export declare const budgetPending: (run: RunView, spentNow?: number) => Pending | undefined;
280
291
  /** A run whose agent asked for the person in its browser waits on their hand-back: what it asked them to do, when it is
281
292
  * done, and when the ask expires. Never the session's tag or the live view's link. The two texts are the model's, so
282
293
  * redacted with the run's redactor (`redact`), as a tool call's arguments are: a held value it echoes never shows. */
@@ -326,6 +337,9 @@ export interface RunMoment {
326
337
  readonly pausedWords?: string;
327
338
  /** The run is paused at its cap (pausedAt): raising the cap resumes it. */
328
339
  readonly paused: boolean;
340
+ /** The cap park it stands at (its agentrun.budget entry's id, activePauseOf), when the store knows it: a raise's answer
341
+ * names the follow-up message the runner sends for it (raiseFollowUpId). */
342
+ readonly pause?: string;
329
343
  /** The run has a live process now (a runner holds its claim): a raise's cap holds from its next step, not the one under
330
344
  * way. */
331
345
  readonly live: boolean;
@@ -335,6 +349,9 @@ export interface RunMoment {
335
349
  readonly waitingApprovalId?: string;
336
350
  /** The tool calls this run has or had waiting for approval, by id (for the not-found refusal). */
337
351
  readonly approvalIds?: ReadonlySet<string>;
352
+ /** What is archived of it, when anything is: its agent, else the run itself. Archiving closes a run: it takes no message
353
+ * (runs-over-store.ts message). Absent when neither is. */
354
+ readonly archived?: "run" | "agent";
338
355
  /** The approvals already answered, by call id, as the run view folds them (for the first-wins refusal and its words). */
339
356
  readonly answeredApprovals?: Readonly<Record<string, {
340
357
  readonly decision: ApprovalDecision;
@@ -359,7 +376,7 @@ export declare const WITHHELD_TITLE = "Withheld: a sign-in this run used can't b
359
376
  * hidden or withheld, never served uncut, and forget waits for it while it goes. */
360
377
  export declare const MALFORMED = "malformed";
361
378
  export type Handed = string[] | typeof MALFORMED;
362
- /** A run's `sign_in_handed` as read from its serve.json: undefined when absent (never handed one); the hashes it names;
379
+ /** A run's `sign_in_handed` as read from its stored row: undefined when absent (never handed one); the hashes it names;
363
380
  * MALFORMED for any other value. */
364
381
  export declare function handedMark(value: unknown): Handed | undefined;
365
382
  /** A run's redactor (decision-rows.ts, tool previews): redacted over its refused values. */
@@ -376,6 +393,8 @@ export declare const servedRunErrorWith: <E extends {
376
393
  * other words are while the run is hidden (`unshown`), as a list row read from disk withholds it. */
377
394
  export declare const servedReviewWith: <R extends {
378
395
  reason: string;
396
+ kind?: string | null;
397
+ node?: string | null;
379
398
  }>(shown: (text: string) => string, unshown: boolean | undefined, review: R | null) => R | null;
380
399
  /** The pointers a run was handed, read back to cut them (sign-ins-store.ts peek and forgotten), by its `sign_in_handed`: none
381
400
  * for a run with no mark (it was never handed one); else, for each hash it names, the live or forgotten pointer whose
@@ -387,7 +406,7 @@ export declare const servedReviewWith: <R extends {
387
406
  export declare function handedPointers(signIns: SignInReader | undefined, agentId: string, browser: string | undefined, handed: Handed | undefined): Promise<{
388
407
  refs: string[];
389
408
  } | "unreadable">;
390
- /** shown() for a run this server holds no Run for (an ended one a list reads from its row and serve.json alone): cut of
409
+ /** shown() for a run this server holds no Run for (an ended one a list reads from its row and journal alone): cut of
391
410
  * every secret this server never shows (serverSecrets) and of what the run was handed of its agent's sign-in
392
411
  * (handedPointers); `withheld` when that can't be read back here, as a load would hide the run. `browser` and `handed`
393
412
  * come from the run's record (its plane's vendor browser and its `sign_in_handed` mark); `damaged` when the record was
package/dist/run-view.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // The pieces here so far: the cost reads (a run's cost, its paid tools' charges, the cost a view shows, what it has cost so
7
7
  // far when the total is unknown) and the served row transforms a view applies to the timeline (the over-cap row, the
8
8
  // paused run's waiting row). All read the same rows the timeline renders.
9
- import { chargedTool, isMessageRow, registerLabel, registerTurnEnding, scrubUrls } from "./timeline/index.js";
9
+ import { chargedTool, isMessageRow, NOTE_SUFFIX, registerLabel, registerTurnEnding, scrubUrls } from "./timeline/index.js";
10
10
  import { CAP_TOLERANCE, FIT_TOLERANCE, money, roomRefusal } from "./cap.js";
11
11
  import { APPROVAL_ROW, previewOf } from "./tool-gate.js";
12
12
  import { ASK_TOOL } from "./tools.js";
@@ -85,9 +85,6 @@ export function withOverCap(rows, cap, bound = 0) {
85
85
  const over = { ...usage, id: `${usage.id}:over_cap`, kind: "phase", summary, text: null };
86
86
  return [...rows.slice(0, at + 1), over, ...rows.slice(at + 1)];
87
87
  }
88
- /** The waiting row of a run paused at its cap, after the refusal's row: "Waiting for you to raise the cap", and no
89
- * more: the refusal's words are the pause's (pending.said), which a client shows once, as its banner. */
90
- export const BUDGET_WAITING = "Waiting for you to raise the cap";
91
88
  /** A text clipped to `max` characters, with an ellipsis where it is cut (runs.ts' clip). */
92
89
  const clip = (text, max) => (text.length > max ? `${text.slice(0, max - 1)}…` : text);
93
90
  const ASKED = "Asked you: ";
@@ -197,19 +194,61 @@ export function answersOf(entries, { final } = {}) {
197
194
  * room, unless an agentrun.raise after it cleared the pause (the run goes on at the raised cap then). A re-park writes a
198
195
  * fresh budget entry, which a raise before it does not clear, so the last of the two in log order decides. */
199
196
  function activeBudget(entries) {
200
- let mark;
197
+ return activePark(entries)?.mark;
198
+ }
199
+ /** The active cap park and its entry's id: the pause the runner keys a raise's follow-up by (adapter-loop raiseStateOf). */
200
+ function activePark(entries) {
201
+ let park;
201
202
  for (const entry of entries) {
202
203
  if (entry.kind === KINDS.budget)
203
- mark = dataOf(entry);
204
+ park = { mark: dataOf(entry), id: String(entry.id) };
204
205
  else if (entry.kind === KINDS.raise)
205
- mark = undefined;
206
+ park = undefined;
206
207
  }
207
- return mark;
208
+ return park;
208
209
  }
209
- /** Whether the run stands parked at its cap now (an active agentrun.budget park, no raise since): the store-backed fact the
210
- * status table reads (RunFacts.budgetWaiting), as the file-backed view read a workflow's pause file and an agentic run's
211
- * turn refusal. */
212
- export const budgetWaitingOf = (entries) => activeBudget(entries) !== undefined;
210
+ /** The server's row of a run's pause at its cap, and its waiting row while it stands paused: the pause's own words are
211
+ * its pending budget's `said`, which a client shows once as its banner, so these rows say no more (#1768). */
212
+ export const BUDGET_PAUSED = "Paused at the run's cap";
213
+ export const BUDGET_WAITING = "Waiting for you to raise the cap";
214
+ /** `rows` with each pause at the run's cap shown (its agentrun.budget entry: the cap refused the next step for room, and
215
+ * nothing was sent): the server's `phase` row "Paused at the run's cap" (origin server, `paused: true`, its id ending
216
+ * NOTE_SUFFIX, so no message any turn took) where the pause came in the journal's order, kept as the run's history once
217
+ * a raise clears it; and, after the pause the run stands at now, its `waiting` row "Waiting for you to raise the cap".
218
+ * Each new row takes its time from the row before it. `ended`: the run is final (cancelled while paused, say), so it
219
+ * waits on nothing and shows no waiting row. */
220
+ export function withBudgetRows(rows, entries, { ended = false } = {}) {
221
+ const parks = entries.filter((entry) => entry.kind === KINDS.budget).map((entry) => ({ id: Number(entry.id), conversation: Number(entry.conversationId ?? 1) }));
222
+ if (parks.length === 0)
223
+ return [...rows];
224
+ const active = ended ? undefined : activePauseOf(entries);
225
+ const entryOf = (row) => Number(row.id.split(":")[1]);
226
+ const out = [...rows];
227
+ for (const park of parks) {
228
+ // Before the first row of a later entry; else before a trailing usage row, the run's last.
229
+ let at = out.findIndex((row) => entryOf(row) > park.id);
230
+ if (at < 0)
231
+ at = out.length > 0 && out[out.length - 1].kind === "usage" ? out.length - 1 : out.length;
232
+ const base = out[at - 1] ?? out[at];
233
+ const timestamp = base?.timestamp ?? new Date(0).toISOString();
234
+ const row = (id, kind, summary, more) => ({
235
+ id, timestamp, created_at: base?.created_at ?? timestamp, kind, summary, agent_label: null, tool_name: null, tool_use_id: null, tool_status: null,
236
+ tool_input_preview: null, tool_result_preview: null, tool_result_size_bytes: null, text: null, conversation_id: park.conversation,
237
+ ...(base?.seq !== undefined ? { seq: base.seq } : {}), ...more,
238
+ });
239
+ const shown = [row(`${park.conversation}:${park.id}${NOTE_SUFFIX}`, "phase", BUDGET_PAUSED, { origin: "server", paused: true })];
240
+ if (String(park.id) === active)
241
+ shown.push(row(`${park.conversation}:${park.id}:waiting`, "waiting", BUDGET_WAITING, { text: BUDGET_WAITING }));
242
+ out.splice(at, 0, ...shown);
243
+ }
244
+ return out;
245
+ }
246
+ /** The id of the cap park a run stands at now (its agentrun.budget entry's), or undefined when it is not parked: a raise's
247
+ * follow-up is sent as `agentrun:raise:<this>` (raiseFollowUpId), so a raise's answer names that message. */
248
+ export const activePauseOf = (entries) => activePark(entries)?.id;
249
+ /** The id a raised run's follow-up turn is sent under: one per pause, so raises of the same pause (a retry, two at once)
250
+ * name the same message, and the runner's re-claim never sends it twice. */
251
+ export const raiseFollowUpId = (pause) => `agentrun:raise:${pause}`;
213
252
  /** The budget card a run parked at its cap shows (pending, kind budget), from its agentrun.budget entry, the same way the
214
253
  * file-backed view built it from the run's pause mark (runs.ts workflowBudgetPending): its cap (the run's launch cap, else
215
254
  * the park's), what the cap counted as taken and the least the refused step needs, the raise offered (recomputed from
@@ -224,7 +263,8 @@ export function budgetOf(entries, run) {
224
263
  const figures = p.spent_usd !== undefined && p.needs_usd !== undefined
225
264
  ? { spent_usd: micro(p.spent_usd), needs_usd: micro(p.needs_usd), ...(p.least_cap_usd !== undefined ? { least_cap_usd: p.least_cap_usd } : {}), suggested_cap_usd: suggestedCap(cap, p.spent_usd, p.needs_usd), overshoot_bound_usd: microUp(0) }
226
265
  : {};
227
- return { kind: "budget", cap_usd: cap, ...figures, said: mark.words, at: meaningful(run.rows)?.timestamp ?? run.updatedAt };
266
+ // A workflow's pause names the node whose step waits (null when not known); an agentic run's names none.
267
+ return { kind: "budget", cap_usd: cap, ...figures, said: mark.words, at: meaningful(run.rows)?.timestamp ?? run.updatedAt, ...(mark.node !== undefined ? { node: mark.node } : {}) };
228
268
  }
229
269
  /** Read only on a run's `rows`, which hold no QUIET row (take). */
230
270
  const shows = (r) => r.kind !== "usage" && r.kind !== "phase";
@@ -316,25 +356,6 @@ export const approvalOf = (run, redact) => {
316
356
  const waiting = waitingApproval(run);
317
357
  return waiting ? { kind: "approval", id: waiting.id, tool: waiting.tool, call_id: waiting.call_id, args_preview: shownArgs(waiting, redact), requested_at: waiting.requested_at, ...(waiting.price !== undefined ? { price: waiting.price } : {}) } : undefined;
318
358
  };
319
- /** A run paused at its cap waits on a raise: its cap, what the cap counted as taken and the least the refused request
320
- * needs (its refusal's mark; none from a store written before it kept them), the raise it is offered (suggestedCap),
321
- * the refusal's words, and when it came (its error row's time). The figures are as the cap counts them, never rounded.
322
- * What was taken is the store's spend once its process is gone (`spentNow`), when that is lower: the refusal counted
323
- * requests still answering at what it held for them, and they have settled. */
324
- export const budgetPending = (run, spentNow) => {
325
- const said = pausedAt(run);
326
- const cap = run.meta.max_cost_usd;
327
- if (said === undefined || cap === undefined)
328
- return undefined;
329
- const r = run.capRefusal;
330
- const spent = r && spentNow !== undefined ? Math.min(r.spentUsd, spentNow) : r?.spentUsd;
331
- // Shown as cost.usd is (to a millionth of a dollar), the suggestion from the figures as the cap counts them. The least cap
332
- // that sends the refused request is the one its words name (`said`), carried from the refusal that wrote them, never
333
- // worked out again here from figures that may have moved since. With them, the most a cache miss could make the refused
334
- // request cost beyond what it needs (cap.ts), 0 for none.
335
- const figures = r && spent !== undefined ? { spent_usd: micro(spent), needs_usd: micro(r.needsUsd), least_cap_usd: r.leastCapUsd, suggested_cap_usd: suggestedCap(cap, spent, r.needsUsd), overshoot_bound_usd: microUp(r.boundUsd ?? 0) } : {};
336
- return { kind: "budget", cap_usd: cap, ...figures, said, at: meaningful(run.rows)?.timestamp ?? run.updatedAt };
337
- };
338
359
  /** A run whose agent asked for the person in its browser waits on their hand-back: what it asked them to do, when it is
339
360
  * done, and when the ask expires. Never the session's tag or the live view's link. The two texts are the model's, so
340
361
  * redacted with the run's redactor (`redact`), as a tool call's arguments are: a held value it echoes never shows. */
@@ -433,6 +454,7 @@ export function momentOf(run, facts, live) {
433
454
  ...(run.meta.max_cost_usd !== undefined ? { maxCostUsd: run.meta.max_cost_usd } : {}),
434
455
  ...(pausedWords !== undefined ? { pausedWords } : {}),
435
456
  paused: pausedWords !== undefined,
457
+ ...(pausedWords !== undefined && run.pause !== undefined ? { pause: run.pause } : {}),
436
458
  live,
437
459
  // Whether it waits on a person (runs.ts waitsOnPerson): a parked approval, a pause at its cap (read through a message
438
460
  // counted but not shown), or a question its turn ended on.
@@ -459,7 +481,7 @@ export const WITHHELD_TITLE = "Withheld: a sign-in this run used can't be read";
459
481
  * hash an older build wrote, or a damaged value) reads as: some pointer was handed, which one is not known, so the run is
460
482
  * hidden or withheld, never served uncut, and forget waits for it while it goes. */
461
483
  export const MALFORMED = "malformed";
462
- /** A run's `sign_in_handed` as read from its serve.json: undefined when absent (never handed one); the hashes it names;
484
+ /** A run's `sign_in_handed` as read from its stored row: undefined when absent (never handed one); the hashes it names;
463
485
  * MALFORMED for any other value. */
464
486
  export function handedMark(value) {
465
487
  if (value === undefined)
@@ -477,7 +499,14 @@ export const shownOf = (values) => (text) => withoutLoopback(redacted(text, valu
477
499
  export const servedRunErrorWith = (shown, error) => ({ ...error, message: shown(error.message), ...(error.details !== undefined ? { details: cutStrings(error.details, shown) } : {}) });
478
500
  /** A run's review as its view serves it: its reason (an escalation's own words) in `shown`'s terms, or withheld as its
479
501
  * other words are while the run is hidden (`unshown`), as a list row read from disk withholds it. */
480
- export const servedReviewWith = (shown, unshown, review) => (review && { ...review, reason: unshown ? WITHHELD_SIGN_IN : shown(review.reason) });
502
+ export const servedReviewWith = (shown, unshown, review) => review && {
503
+ ...review,
504
+ // Every word of it is the run's (its escalate node's kind and label, as the workflow wrote them): cut as the reason is,
505
+ // and withheld with it.
506
+ ...("kind" in review ? { kind: unshown || review.kind == null ? null : shown(review.kind) } : {}),
507
+ ...("node" in review ? { node: unshown || review.node == null ? null : shown(review.node) } : {}),
508
+ reason: unshown ? WITHHELD_SIGN_IN : shown(review.reason),
509
+ };
481
510
  /** The pointers a run was handed, read back to cut them (sign-ins-store.ts peek and forgotten), by its `sign_in_handed`: none
482
511
  * for a run with no mark (it was never handed one); else, for each hash it names, the live or forgotten pointer whose
483
512
  * SHA-256 it is. `unreadable` when what it was handed can't be read back here: a MALFORMED mark, no vendor browser kept
@@ -498,7 +527,7 @@ export async function handedPointers(signIns, agentId, browser, handed) {
498
527
  const refs = handed.map((hash) => kept.find((ref) => pointerHash(ref) === hash));
499
528
  return refs.every((ref) => ref !== undefined) ? { refs: refs } : "unreadable";
500
529
  }
501
- /** shown() for a run this server holds no Run for (an ended one a list reads from its row and serve.json alone): cut of
530
+ /** shown() for a run this server holds no Run for (an ended one a list reads from its row and journal alone): cut of
502
531
  * every secret this server never shows (serverSecrets) and of what the run was handed of its agent's sign-in
503
532
  * (handedPointers); `withheld` when that can't be read back here, as a load would hide the run. `browser` and `handed`
504
533
  * come from the run's record (its plane's vendor browser and its `sign_in_handed` mark); `damaged` when the record was
@@ -1,16 +1,18 @@
1
1
  import { type InputIssue } from "./errors.js";
2
2
  import { type HarnessCapability } from "./harness.js";
3
3
  import { type ModelRef } from "./model.js";
4
- import type { BoxOffer } from "./boxes.js";
4
+ import type { BoxOffer } from "./place-offers.js";
5
5
  import { type ToolSettingsMap } from "./tool-plane.js";
6
6
  import type { McpTool } from "@parcha/agentrun-kernel";
7
7
  import type { ShellPlace } from "@parcha/agentrun-kernel/kernel";
8
8
  /** The harnesses an agent's MCP tools run on here. */
9
9
  export declare const MCP_HARNESSES: readonly string[];
10
- /** A revision's computer setting: a kind, its provider, and a sandbox's GPUs (computer-setting.ts). */
10
+ /** A revision's computer setting: a kind, its provider, the image it starts from, and a sandbox's GPUs
11
+ * (computer-setting.ts). */
11
12
  export type RevisionComputer = {
12
13
  kind: string;
13
14
  provider?: string;
15
+ image?: string;
14
16
  gpu?: {
15
17
  type: string;
16
18
  count: number;
@@ -32,6 +34,7 @@ export type RevisionShape = {
32
34
  unnamed?: true;
33
35
  toolSettings?: ToolSettingsMap;
34
36
  approvals?: "never";
37
+ maxToolCalls?: number;
35
38
  } | {
36
39
  kind: "workflow";
37
40
  workflow: unknown;
@@ -96,7 +99,7 @@ export declare const NOT_SET_UP = "not_set_up_here";
96
99
  * `new Function` transform, which is no sandbox. Off by default. */
97
100
  export declare const CODE_NODES_ENV = "AGENTRUN_SERVE_CODE_NODES";
98
101
  /** What keeps `revision` from running in `env` under the server's tool `settings` (tool-plane.ts). `boxes`: what this
99
- * server's box registry set up at its start (boxes.ts); none, every box is unavailable. `offers`: the harnesses' offers
102
+ * server found at its start (place-offers.ts); none, every box is unavailable. `offers`: the harnesses' offers
100
103
  * the server already holds (its reading); none given, they are probed here. `computerReady`: whether an agent's computer
101
104
  * setting can be had here now, or its refusal (resolve-computer.ts computerReadiness); none given, the box check.
102
105
  * `shellOf`: where a run of an agent with that computer setting has its shell here now (resolve-computer.ts
package/dist/runnable.js CHANGED
@@ -54,7 +54,7 @@ const PRICE_FIX = "Set AGENT_MODEL_PRICE (USD per million input,output,cacheRead
54
54
  * `new Function` transform, which is no sandbox. Off by default. */
55
55
  export const CODE_NODES_ENV = "AGENTRUN_SERVE_CODE_NODES";
56
56
  /** What keeps `revision` from running in `env` under the server's tool `settings` (tool-plane.ts). `boxes`: what this
57
- * server's box registry set up at its start (boxes.ts); none, every box is unavailable. `offers`: the harnesses' offers
57
+ * server found at its start (place-offers.ts); none, every box is unavailable. `offers`: the harnesses' offers
58
58
  * the server already holds (its reading); none given, they are probed here. `computerReady`: whether an agent's computer
59
59
  * setting can be had here now, or its refusal (resolve-computer.ts computerReadiness); none given, the box check.
60
60
  * `shellOf`: where a run of an agent with that computer setting has its shell here now (resolve-computer.ts
@@ -160,6 +160,7 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
160
160
  return undefined;
161
161
  };
162
162
  if (revision.kind === "agentic") {
163
+ const browserComputer = revision.computer?.kind === "browser";
163
164
  if (!revision.instructions.trim())
164
165
  out.push({ field: "definition.instructions", reason: "too_short", message: "definition.instructions is empty: an agentic revision needs instructions.", host: false });
165
166
  (revision.tools ?? []).forEach((tool, index) => {
@@ -184,9 +185,16 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
184
185
  out.push({ field: `definition.tools[${index}]`, reason: NOT_SET_UP, message: `${tool} runs on pi here; on ${harness} it is not bound yet.`, host: true, tool });
185
186
  else {
186
187
  unset(`definition.tools[${index}]`, tool);
187
- unavailable(`definition.tools[${index}]`, revision.tools ?? [], tool);
188
+ // The browser of an agent whose computer is a browser is that computer (tools.ts browserComputer), on the keys
189
+ // saved for it in Settings → Computers and checked as its readiness above: the tool plane's vendor is not asked.
190
+ if (!(tool === "browser" && browserComputer))
191
+ unavailable(`definition.tools[${index}]`, revision.tools ?? [], tool);
188
192
  }
189
193
  });
194
+ // The tool-call budget is counted from pi's own journal (tool-budget.ts): on another harness it would hold nothing, so
195
+ // the definition is refused, never saved to run without it.
196
+ if (revision.maxToolCalls !== undefined && onAdapter(env, harness))
197
+ out.push({ field: "definition.max_tool_calls", reason: NOT_SET_UP, message: `A tool-call budget is held on pi here; on ${harness} it is not counted yet.`, fix: "Run the agent on pi, or set max_tool_calls to 0.", host: false, harness });
190
198
  const resolved = await harnessModel(env, harness, revision.model, offer?.available === true);
191
199
  if (!resolved)
192
200
  return out;
@@ -201,6 +209,16 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
201
209
  out.push({ field: "definition.model", reason: NOT_SET_UP, message: `The model ${id} has no price here, so a run's spend cap cannot be kept on it.`, fix: PRICE_FIX, host: true, unpriced: true });
202
210
  return out;
203
211
  }
212
+ const { inspectWorkflow } = await import("@parcha/agentrun-dsl");
213
+ // A workflow the DSL cannot read is the definition's fault (422 on the field), never the server's (500).
214
+ let inspection;
215
+ try {
216
+ inspection = inspectWorkflow(revision.workflow);
217
+ }
218
+ catch (error) {
219
+ out.push({ field: "definition.workflow", reason: "not_an_option", message: `The workflow is not one this server can read: ${String(error?.message ?? error).slice(0, 500)}`, host: false });
220
+ return out;
221
+ }
204
222
  // Every MCP tool a workflow grants, at its top level or on a node, is held to the one check (mcpGrant): refused at the
205
223
  // save, never a workflow whose run goes without it or cannot launch.
206
224
  const granted = await grantedTools(revision);
@@ -213,8 +231,6 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
213
231
  // A workflow's model nodes run on pi here; on another harness they are not bound yet, and never run on pi instead.
214
232
  if (onAdapter(env, harness))
215
233
  out.push({ field: "definition.workflow", reason: NOT_SET_UP, message: `A workflow runs on pi here; on ${harness} its model nodes are not bound yet.`, host: true, harness });
216
- const { inspectWorkflow } = await import("@parcha/agentrun-dsl");
217
- const inspection = inspectWorkflow(revision.workflow);
218
234
  const { requires } = inspection;
219
235
  const nodes = workflowNodes(revision.workflow, inspection);
220
236
  const runs = "agentrun-serve runs a workflow's model nodes (agent, decide, extract, report)";