@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
@@ -4,32 +4,34 @@
4
4
  // model sees do not change. runs.ts still answers the API from files; this is the store-backed path the server cut switches
5
5
  // onto. viewOverStore answers the run read, summaryOverStore the run list, momentOverStore the one acceptance each act reads.
6
6
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
7
+ import { CAPS } from "./timeline/index.js";
7
8
  import { runLink } from "./console-links.js";
8
9
  import { redacted, redactedAnswer, redactedOutput, withoutLoopback } from "./key-refusal.js";
9
10
  import { structuredAnswer } from "./answer-json.js";
10
11
  import { currentLearning, holdsForOk, learningView, LEARNING_LABEL, secretsShown, shortOf } from "./learning.js";
11
12
  import { said } from "./learning-words.js";
13
+ import { CONTENT_FILTER_WORDS, contentFiltered, MODERATED } from "./content-filter.js";
12
14
  import { launchOf } from "./handed-values.js";
13
15
  import { learningStartOf, seedFailed } from "./run-launch.js";
14
- import { momentOf, pendingOf, approvalOf, asksOf, answersOf, budgetOf, browserPending, computerPending, redactorOf, servedRunErrorWith, servedReviewWith, statusOf, WITHHELD_SIGN_IN, WITHHELD_TITLE, costView, soFarOf, withAsks, withApprovalRows, } from "./run-view.js";
16
+ import { momentOf, pendingOf, approvalOf, asksOf, answersOf, activePauseOf, budgetOf, browserPending, computerPending, redactorOf, servedRunErrorWith, servedReviewWith, statusOf, WITHHELD_SIGN_IN, WITHHELD_TITLE, costView, soFarOf, usersOf, withAsks, withApprovalRows, } from "./run-view.js";
15
17
  import { reflects } from "./reflect-range.js";
16
18
  import { overCapMessage, SPEND_CAP_REACHED } from "@parcha/agentrun-kernel/kernel/cap";
17
19
  import { bookedSpend } from "./runner/metrics.js";
18
20
  import { journalRecords, recordOf } from "./runner/journal-reader.js";
19
- import { KINDS } from "./runner/journal-kinds.js";
21
+ import { capNowOf, KINDS } from "./runner/journal-kinds.js";
20
22
  import { notesReadOf, runLearningEnd, withNotes } from "./store-reads/learning.js";
21
23
  import { runReflect, runTimeline, wholeAnswerFor, wholeAnswers } from "./store-reads/journal.js";
22
24
  import { readRun } from "./store-reads/runs.js";
23
- import { runCutValues, runErrorWordsOf } from "./run-cut.js";
25
+ import { runCutValues, runErrorWordsOf, underCut } from "./run-cut.js";
24
26
  import { Turns } from "./turns.js";
25
27
  import { harnessOfBody } from "./harness.js";
26
28
  import { browserAsk as browserAskOf, BROWSER_HANDOVER_KIND } from "./browser-commands.js";
27
29
  import { computerAsk as computerAskOf, COMPUTER_HANDOVER_KIND } from "./computer-commands.js";
28
30
  import { approvalsOf } from "./approvals.js";
29
- import { FINAL_STATES } from "./store/store.js";
31
+ import { FINAL_STATES, stoppedByPerson } from "./store/store.js";
30
32
  /** A run that has ended reads one of these (the old RunRow state → the v2 status: an escalation is a completion with a
31
33
  * review; a stopped run is a cancellation), as runs.ts's STATUS_OF mapped them. A running run reads its status from the
32
- * journal. */
34
+ * journal, and so does an agentic run a person stopped, which reads running (runReadState). */
33
35
  const STATUS_OF = { completed: "completed", failed: "failed", escalated: "completed", stopped: "cancelled" };
34
36
  /** A run that has reached a last state (its view is its ended shape). */
35
37
  const TERMINAL = new Set(["completed", "failed", "cancelled"]);
@@ -41,9 +43,9 @@ const iso = (ms) => new Date(ms).toISOString();
41
43
  const servedByStore = new WeakMap();
42
44
  const SERVED_KEPT = 32;
43
45
  function servedOnce(store, runId, input, values) {
44
- let served = servedByStore.get(store);
46
+ let served = servedByStore.get(store.origin);
45
47
  if (!served)
46
- servedByStore.set(store, (served = new Map()));
48
+ servedByStore.set(store.origin, (served = new Map()));
47
49
  const key = wholeAnswerFor(values).key;
48
50
  const last = served.get(runId);
49
51
  if (last && last.key === key && last.input === input)
@@ -62,14 +64,17 @@ function servedOnce(store, runId, input, values) {
62
64
  const answerOf = (rows) => rows.findLast((r) => r.kind === "final_answer" && r.agent_label !== LEARNING_LABEL)?.text ?? null;
63
65
  /** A failed run's error from its row (its own words are the summary; the store keeps no code or detail apart). A run
64
66
  * its cap ended once its cost passed it (the kernel's overCapEnd) is code spend_cap_reached, its message the words after
65
- * the code, as main served it; every other failure is run_failed. */
67
+ * the code, as main served it; a provider's content-filter stop is `moderated`, in words a person can act on
68
+ * (content-filter.ts); every other failure is run_failed. */
66
69
  const errorOfRow = (summary) => {
67
70
  const over = overCapMessage(summary);
68
71
  if (over !== undefined)
69
72
  return { code: SPEND_CAP_REACHED, message: over, retryable: false };
73
+ if (summary !== null && contentFiltered(summary))
74
+ return { code: MODERATED, message: CONTENT_FILTER_WORDS, retryable: false };
70
75
  return { code: "run_failed", message: summary ?? "The run failed.", retryable: false };
71
76
  };
72
- const reviewOfRow = (state, summary) => (state !== "escalated" ? null : { kind: null, node: null, reason: summary ?? "The workflow escalated." });
77
+ const reviewOfRow = (state, summary, kept) => (state !== "escalated" ? null : (kept ?? { kind: null, node: null, reason: summary ?? "The workflow escalated." }));
73
78
  const reviewAt = (review, endedAt) => (review ? { kind: review.kind, node: review.node, reason: review.reason, at: endedAt } : null);
74
79
  /** A run's facts as statusOf and momentOf read them, built from the run's journal: whether it stands parked at its cap
75
80
  * (an active agentrun.budget park), and the browser ask it waits on (wired next). A terminal run reaches none of them
@@ -94,8 +99,32 @@ function pausedOf(runRow, entries) {
94
99
  function liveOf(runRow, now) {
95
100
  return !FINAL_STATES.includes(runRow.state) && runRow.runner !== null && runRow.claimedUntil !== null && runRow.claimedUntil >= now;
96
101
  }
97
- /** Reads the run from the store and builds the RunView the view functions read. */
102
+ /** Reads the run from the store and builds the RunView the view functions read. Every read of the run (its row, launch,
103
+ * journal, live tick and commands) is made in one snapshot of the store (Store.snapshot), so the view is of one moment: a
104
+ * runner's commit that lands while it is built is in all of it or in none. What is read through the server's own handles
105
+ * (the run's cut, which reads the agent's sign-ins, and the learning statuses of its folder) is read outside the snapshot,
106
+ * before and after it: neither is part of the run's moment, and neither may wait on the snapshot's connection. */
98
107
  async function storeRunOf(store, runId, deps) {
108
+ // The run's one cut (run-cut.ts): the pointers it was handed read back and every secret this server never shows, so a
109
+ // run whose words could repeat one is cut of it, rows and all, or withheld when this server cannot read back what it
110
+ // was handed (rowShown's choke point). The snapshot renders under it, so it is read first, and read again after: the cut
111
+ // only grows, so one that is the same after the snapshot holds every value saved before the rows were read (underCut
112
+ // builds again under a cut that grew meanwhile).
113
+ const cutOf = async () => {
114
+ const known = await store.runs.get(runId);
115
+ return known ? runCutValues(deps, store, runId, { runRow: known, launch: await launchOf(store, runId) }) : undefined;
116
+ };
117
+ if (!(await store.runs.get(runId)))
118
+ return undefined;
119
+ const run = await underCut(async () => (await cutOf()) ?? "unreadable", (cut) => store.snapshot((snapshot) => storeRunIn(snapshot, runId, deps, cut)));
120
+ if (!run?.shownEnd || !holdsForOk(run.shownEnd) || !deps.statuses)
121
+ return run && { ...run, learningEnd: run.shownEnd };
122
+ // What the learning end held for its owner's OK reads as it stands now on its agent's folder's main (learning.ts
123
+ // currentLearning); its record stays as the merge wrote it.
124
+ return { ...run, learningEnd: currentLearning(run.shownEnd, await deps.statuses(run.row.agent)) };
125
+ }
126
+ /** `storeRunOf`'s reads, over `store` (a snapshot) and the run's cut. */
127
+ async function storeRunIn(store, runId, deps, cut) {
99
128
  const context = BACKGROUND_CONTEXT;
100
129
  const row = await readRun(store, runId, context);
101
130
  if (!row)
@@ -104,10 +133,6 @@ async function storeRunOf(store, runId, deps) {
104
133
  if (!runRow)
105
134
  return undefined;
106
135
  const launch = await launchOf(store, runId);
107
- // The run's one cut (run-cut.ts): the pointers it was handed read back and every secret this server never shows, so a
108
- // run whose words could repeat one is cut of it, rows and all, or withheld when this server cannot read back what it
109
- // was handed (rowShown's choke point).
110
- const cut = await runCutValues(deps, store, runId, { runRow, launch });
111
136
  const unshown = cut === "unreadable";
112
137
  const values = cut === "unreadable" ? [] : cut.values;
113
138
  const revision = await store.agents.revision(row.revision);
@@ -147,9 +172,6 @@ async function storeRunOf(store, runId, deps) {
147
172
  const under = !ended && started && !seedFailed(started) ? underWay(started, reflectRange, iso(runRow.startedAt)) : null;
148
173
  const sofar = ended ?? under;
149
174
  const shownEnd = sofar && withNotes(sofar, started, read);
150
- // What it held for its owner's OK as it reads now, on its agent's folder's main (learning.ts currentLearning); its record
151
- // stays as the merge wrote it.
152
- const learningEnd = shownEnd && holdsForOk(shownEnd) && deps.statuses ? currentLearning(shownEnd, await deps.statuses(row.agent)) : shownEnd;
153
175
  const turns = new Turns();
154
176
  turns.note(recordOf(records.entries), records.submissions ?? [], skip, liveRow?.updatedAt ?? deps.now?.() ?? Date.now());
155
177
  const working = live && turns.open > 0;
@@ -165,14 +187,20 @@ async function storeRunOf(store, runId, deps) {
165
187
  // The rows a person reads: each call that waited for approval in order (held, your approval, what came of it), its
166
188
  // arguments and the person's notes through the run's redactor, as the file path's withApprovals served them.
167
189
  const rows = withApprovalRows(timeline, approvals, answers, redactorOf(values));
168
- // The run's cap as it stands: its newest raise's (the agentrun.raise entries the runner's loop holds it to, adapter-loop
169
- // capNow), else its launch's; a raise taken shows in the run's cost.cap_usd and its budget card, never the old cap.
170
- const raisedCapUsd = records.entries.findLast((entry) => entry.kind === KINDS.raise && typeof entry.data?.capUsd === "number" && entry.data.capUsd > 0)?.data;
171
- const capUsd = launch?.maxCostUsd === undefined ? undefined : Math.max(launch.maxCostUsd, raisedCapUsd?.capUsd ?? 0);
172
- const meta = { ...(capUsd !== undefined ? { max_cost_usd: capUsd } : {}), ...(Object.keys(answers).length ? { approvals: answers } : {}) };
190
+ // The run's cap as it stands, through the one reader the runner's gate reads too (capNowOf): a raise taken shows in the
191
+ // run's cost.cap_usd and its budget card, never the old cap.
192
+ const capUsd = capNowOf(launch?.maxCostUsd, records.entries);
193
+ // A person's stop of an agentic run (stoppedByPerson: its row reads running, readRun) is main's stop mark: the run is
194
+ // stopped while no message is newer than the stop (statusOf: input_required and idle), and a message reopens it.
195
+ const meta = {
196
+ ...(capUsd !== undefined ? { max_cost_usd: capUsd } : {}),
197
+ ...(Object.keys(answers).length ? { approvals: answers } : {}),
198
+ ...(stoppedByPerson(runRow, row.kind) ? { stopped_after: usersOf(rows) } : {}),
199
+ };
173
200
  // The budget card the run shows while it stands parked at its cap, from its journal's agentrun.budget park (none once a
174
201
  // raise clears it). Read over the same meta cap and rows the card's figures and time come from.
175
202
  const budget = budgetOf(records.entries, { meta, rows, updatedAt: iso(updatedAtMs) });
203
+ const pause = activePauseOf(records.entries);
176
204
  // Whether a workflow run stands paused in its process now (its parked row with the pause's words, its newest pause not
177
205
  // resumed), the `paused` fact the status table reads for a paused workflow.
178
206
  const paused = pausedOf(runRow, records.entries);
@@ -207,8 +235,8 @@ async function storeRunOf(store, runId, deps) {
207
235
  ...(row.importedFrom ? { imported: { source: row.importedFrom.source, session: row.importedFrom.session } } : {}),
208
236
  kind: row.kind,
209
237
  ...(outcome ? { outcome } : {}),
210
- // The store's "stopped" state is a cancellation; its moment reads cancelled.
211
- cancel: row.state === "stopped",
238
+ // A cancel is the run's outcome 'cancelled', never its state alone: a person's stop is stopped too, and is no cancel.
239
+ cancel: runRow.outcome === "cancelled",
212
240
  working,
213
241
  submitted,
214
242
  updatedAt: iso(updatedAtMs),
@@ -218,15 +246,19 @@ async function storeRunOf(store, runId, deps) {
218
246
  // The cap pause's words, so the moment reads paused for a store budget park (the write half's raiseCap/sendMessage read
219
247
  // moment.paused/pausedWords); the file path's turns-based pausedAt gives nothing over the store.
220
248
  ...(budget?.kind === "budget" ? { pausedWords: budget.said } : {}),
249
+ // The park's own id: a raise's answer names the follow-up the runner sends for this pause (raiseFollowUpId).
250
+ ...(budget?.kind === "budget" && pause !== undefined ? { pause } : {}),
221
251
  meta,
222
252
  };
223
253
  // A completed workflow run's output, from its end (the workflow loop keeps it there, as main kept it on the run).
224
254
  const end = row.kind === "workflow" ? records.entries.findLast((entry) => entry.kind === KINDS.end) : undefined;
225
255
  const output = end?.data?.output ?? null;
256
+ // An escalated workflow run's review, as its end kept it (the escalate node's kind, label and summary).
257
+ const review = end?.data?.review;
226
258
  // What its decisions booked (their own session, never on the usage row, which counts its model requests and paid tools).
227
259
  const booked = bookedSpend(records.entries, "decisions");
228
260
  const decisions = booked.requests ? booked : undefined;
229
- return { row, runRow, launch, rows, version, harness, learningEnd, view, unshown, values, live, updatedAtMs, lastProgressAt, budget, paused, browserAsk, computerAsk, approvalsMode, output, structured, decisions };
261
+ return { row, runRow, launch, rows, version, harness, learningEnd: shownEnd, shownEnd, view, unshown, values, live, updatedAtMs, lastProgressAt, budget, paused, browserAsk, computerAsk, approvalsMode, output, ...(review ? { review } : {}), structured, decisions };
230
262
  }
231
263
  /** A run's learning as the view shows it: its end from the store (what it held for the owner's OK as it reads now), in a
232
264
  * person's words cut of the host's secrets now, and, for an ended run, the notes it read. */
@@ -263,7 +295,7 @@ export async function viewOverStore(store, runId, deps) {
263
295
  const run = await storeRunOf(store, runId, deps);
264
296
  if (!run)
265
297
  return undefined;
266
- const { row, runRow, launch, view, unshown, values, output, structured } = run;
298
+ const { row, runRow, launch, view, unshown, values, output, review: kept, structured } = run;
267
299
  const { status, state } = statusOf(view, factsOf(run));
268
300
  const terminal = TERMINAL.has(status);
269
301
  const endedAtMs = terminal ? (runRow.endedAt ?? runRow.startedAt) : null;
@@ -278,7 +310,20 @@ export async function viewOverStore(store, runId, deps) {
278
310
  // run's sign-in can't be read back.
279
311
  const ownOutput = row.kind === "workflow" ? output : status === "completed" && structured && "value" in structured ? structured.value : null;
280
312
  const servedOutput = !unshown && ownOutput !== null && ownOutput !== undefined ? redactedOutput(ownOutput, values) : null;
281
- const result = status === "completed" ? { output: servedOutput, final_answer: servedAnswer(finalAnswer) } : null;
313
+ // A run its cap ended once its cost passed it (spend_cap_reached) keeps the answer it paid for, as main kept it: the
314
+ // response that crossed the cap was answered and billed, so its text is the run's answer, cut as it came.
315
+ // Its answer is the newest answer row, else (a response cut at its length) the newest text it said; never the row's
316
+ // summary, which holds the cap's words.
317
+ const overCap = status === "failed" && overCapMessage(row.summary ?? null) !== undefined;
318
+ // A text the timeline cut at its cap is read whole from the journal and served as an answer row is (wholeAnswerFor).
319
+ const capRow = overCap && !unshown ? (run.rows.findLast((r) => r.kind === "final_answer" && r.agent_label !== LEARNING_LABEL) ?? run.rows.findLast((r) => r.kind === "text_block" && r.agent_label !== LEARNING_LABEL)) : undefined;
320
+ let capAnswer = capRow?.text ?? null;
321
+ if (capRow?.kind === "text_block" && capAnswer !== null && (capAnswer.length >= CAPS.text || capAnswer.endsWith("...") || capAnswer === "[redacted]")) {
322
+ const whole = (await runTimeline(store, runId, BACKGROUND_CONTEXT, { settled: true, caps: { text: Number.POSITIVE_INFINITY } })).find((r) => r.id === capRow.id)?.text;
323
+ if (typeof whole === "string")
324
+ capAnswer = wholeAnswerFor(values).serve(whole);
325
+ }
326
+ const result = status === "completed" ? { output: servedOutput, final_answer: servedAnswer(finalAnswer) } : overCap ? { output: null, final_answer: servedAnswer(capAnswer) } : null;
282
327
  // A failed run's reason in the model's own words when the store holds them: the last model-error row's text (a provider's
283
328
  // refusal, rendered from its pi.assistant error entry), else the run row's summary (the runner's generic "gave no answer").
284
329
  // It reads as the run's Timeline error row does (run-cut.ts runErrorWordsOf, main's errorWords): a refused key in plain
@@ -288,7 +333,7 @@ export async function viewOverStore(store, runId, deps) {
288
333
  const errorWords = status === "failed" && !unshown ? await runErrorWordsOf({ ...deps, keyEnv: deps.keyEnv ?? (() => process.env) }, store, runId, { workflow: row.kind === "workflow" }) : undefined;
289
334
  const withheld = unshown || errorWords === "unreadable";
290
335
  const error = status === "failed" ? (withheld ? { code: "run_failed", message: WITHHELD_SIGN_IN, retryable: false } : servedRunErrorWith(errorWords ?? shownWords, errorOfRow(failedReason))) : null;
291
- const review = endedAtMs === null ? null : servedReviewWith(shownWords, unshown, reviewAt(reviewOfRow(row.state, row.summary ?? null), iso(endedAtMs)));
336
+ const review = endedAtMs === null ? null : servedReviewWith(shownWords, unshown, reviewAt(reviewOfRow(row.state, row.summary ?? null, kept), iso(endedAtMs)));
292
337
  // The card the run shows while it waits, in the order the file-backed view (runs.ts) picks them: a tool call parked for a
293
338
  // person's approval (approvalOf, its arguments shown through the run's redactor), else a run parked at its cap (the budget
294
339
  // card), else its agent waiting on a person in its browser (browserPending), else the question its turn ended on (pendingOf).
@@ -348,13 +393,27 @@ export async function summaryOverStore(store, runId, deps) {
348
393
  learning: learning ? shortOf(learning) : null,
349
394
  };
350
395
  }
396
+ /** A run's facts as its view states them, and none of its words: its kind, revision, agent, status and times, and whether
397
+ * its output is withheld (`unshown`). What a read that serves its own parts (the graph) needs of the run: read off the
398
+ * run as viewOverStore reads it, with nothing of it served, so nothing is redacted here. Undefined for an unknown run. */
399
+ export async function factsOverStore(store, runId, deps) {
400
+ const run = await storeRunOf(store, runId, deps);
401
+ if (!run)
402
+ return undefined;
403
+ const { status } = statusOf(run.view, factsOf(run));
404
+ const endedAtMs = TERMINAL.has(status) ? (run.runRow.endedAt ?? run.runRow.startedAt) : null;
405
+ return { kind: run.row.kind, revision: run.row.revision, agentId: run.row.agent, status, createdAt: iso(run.runRow.startedAt), endedAt: endedAtMs === null ? null : iso(endedAtMs), unshown: run.unshown };
406
+ }
351
407
  /** A run's live moment from the store (momentOf), for the one acceptance each act a run takes reads. A run no runner holds
352
408
  * (ended, or running with no live claim) reads live false. */
353
409
  export async function momentOverStore(store, runId, deps = { origin: "", serverSecrets: () => [] }) {
354
410
  const run = await storeRunOf(store, runId, deps);
355
411
  if (!run)
356
412
  return undefined;
357
- return momentOf(run.view, factsOf(run), run.live);
413
+ // What is archived of it: its agent (whose archive holds its runs too, so it is said first: unarchiving the run alone would
414
+ // not open it), else the run's own archive time.
415
+ const archived = (await store.agents.get(run.row.agent))?.archivedAt ? "agent" : run.row.archivedAt ? "run" : undefined;
416
+ return { ...momentOf(run.view, factsOf(run), run.live), ...(archived ? { archived } : {}) };
358
417
  }
359
418
  /** A run's timeline rows as the VIEW renders them (storeRunOf's view.rows: withAsks, so a run waiting on a question carries
360
419
  * its `:waiting` row). The run-ended/run-needs-input follower reads these for its wait marker, main's marker and webhook-id.
@@ -954,7 +954,8 @@ async function sameAsLocal(ctx, one, agent) {
954
954
  }
955
955
  const served = ctx.served;
956
956
  const view = JSON.parse(JSON.stringify(packageView(pkg)));
957
- const differs = [...new Set([...Object.keys(view), ...Object.keys(served)])].filter((key) => !same(view[key], served[key]));
957
+ // computer_here is the server's answer to the package's computer list, never the package: not compared.
958
+ const differs = [...new Set([...Object.keys(view), ...Object.keys(served)])].filter((key) => key !== "computer_here" && !same(view[key], served[key]));
958
959
  const { parameters } = applyBodyOf(pkg, { parameters: one.parameters, grants: one.grants });
959
960
  const local = compiled(pkg, parameters, { mcp: [], defaultTools: [], grants: [] }).agent;
960
961
  const sha = (text) => createHash("sha256").update(text).digest("hex");
@@ -20,6 +20,10 @@ export declare const PARAMETER_TYPES: readonly ["string", "number", "integer", "
20
20
  * (market-monitor's schedule). A form shows a schedule picker and a time-zone choice; the value is the same text. */
21
21
  export declare const PARAMETER_FORMATS: readonly ["cron", "timezone"];
22
22
  export declare const GRADER_TYPES: readonly ["llm", "regex", "tool_used", "file_exists", "schema"];
23
+ /** The entries of a package's `computer` preference list: `shell`, a computer that gives the agent a shell here (bash);
24
+ * `none`, no shell, the file tools alone. Apply takes the first this server meets now (pickComputer). */
25
+ export declare const COMPUTER_ENTRIES: readonly ["shell", "none"];
26
+ export type ComputerEntry = (typeof COMPUTER_ENTRIES)[number];
23
27
  /** The keys a package may need: those Settings saves (a tool's or a model provider's), each one a run is handed. */
24
28
  export declare const PACKAGE_SECRETS: readonly string[];
25
29
  /** A package's bounds: each file, all its files together (POST /agents' own body limit), and how many it holds. */
@@ -60,9 +64,13 @@ export type Package = {
60
64
  repository?: string;
61
65
  /** Harness ids in the order the package prefers them; absent, any (the server's default). */
62
66
  harness?: string[];
67
+ /** The agent's tier and the model it prefers on it; `fast` and `strong`, the model it prefers for each of those tiers
68
+ * when a subagent runs on it (runner/subagent.ts), compiled into the definition's model_tiers (packageTiers). */
63
69
  model?: {
64
70
  tier: string;
65
71
  prefer?: string;
72
+ fast?: string;
73
+ strong?: string;
66
74
  };
67
75
  effort?: string;
68
76
  /** Absent, the tools the server gives a new agent that names none. */
@@ -70,15 +78,24 @@ export type Package = {
70
78
  /** MCP servers by the name a server saves them under, and the tools of each the agent is granted. One `required`
71
79
  * refuses an apply on a server that has not saved it; any other is skipped there, with a warning. */
72
80
  mcp: McpNeed[];
81
+ /** The computers it prefers, in order (`[shell, none]`): apply takes the first this server meets now (pickComputer)
82
+ * and writes it as the agent's computer. Absent (or `default` in the manifest): where this server puts a new agent. */
83
+ computer?: ComputerEntry[];
73
84
  /** A policy by tool (bash only: `read-only`, bash-read-only.ts), which apply writes as the tool's `policy` in the
74
85
  * agent's tool settings, so the gate holds its runs to it whatever the tool's permission. */
75
86
  toolPolicy?: {
76
87
  bash: BashPolicy;
77
88
  };
89
+ /** What the server checks out in each run's folder before its first turn (the definition's `checkout`,
90
+ * runner/pr-checkout.ts): the pull request the run's GitHub event names. */
91
+ checkout?: "pull_request";
78
92
  parameters: Record<string, Parameter>;
79
93
  secrets: string[];
94
+ /** Each run's limits: its spend cap (the agent's max_cost_usd) and the tool calls each of its conversations may make
95
+ * (the agent's max_tool_calls, tool-budget.ts). */
80
96
  budget?: {
81
- per_run_usd: number;
97
+ per_run_usd?: number;
98
+ tool_calls?: number;
82
99
  };
83
100
  learning?: boolean;
84
101
  /** Whether the agent asks its person before a tool runs (`ask`) or runs unattended (`never`): the package's default,
@@ -107,8 +124,9 @@ export declare class PackageError extends Error {
107
124
  * to acme/widgets." The package's name says what runs; the events are its accept's, the repositories its where
108
125
  * conditions on /repository/full_name, when every rule names some. */
109
126
  export declare function githubTriggerWords(packageName: string, source: Json): string;
110
- /** What an apply says of a github trigger it skipped because GitHub is not connected here. */
111
- export declare const GITHUB_TRIGGER_UNCONNECTED = "Connect GitHub in Settings, then apply again to review pull requests automatically.";
127
+ /** What an apply says of a github trigger it skipped because GitHub is not connected here: what to do, and what the
128
+ * trigger would then run on, in the package's own words ("Code review runs on each pull request to acme/widgets."). */
129
+ export declare const githubTriggerUnconnected: (packageName: string, source: Json) => string;
112
130
  /** Reads `dir` checked whole: a valid package, or PackageError with every problem found. */
113
131
  export declare function readPackage(dir: string): Package;
114
132
  /** What is wrong with the trigger bodies an apply makes (compiled's `triggers`), as POST /v2/triggers checks a body, all
@@ -135,12 +153,16 @@ export declare function packageView(p: Package): {
135
153
  model: {
136
154
  tier: string;
137
155
  prefer?: string;
156
+ fast?: string;
157
+ strong?: string;
138
158
  } | null;
139
159
  effort: string | null;
140
160
  tools: string[] | null;
141
161
  tool_policy: {
142
162
  bash: BashPolicy;
143
163
  } | null;
164
+ computer: ("none" | "shell")[] | null;
165
+ checkout: "pull_request" | null;
144
166
  mcp: {
145
167
  server: string;
146
168
  required: boolean;
@@ -154,7 +176,8 @@ export declare function packageView(p: Package): {
154
176
  parameters: Record<string, Parameter>;
155
177
  secrets: string[];
156
178
  budget: {
157
- per_run_usd: number;
179
+ per_run_usd?: number;
180
+ tool_calls?: number;
158
181
  } | null;
159
182
  learning: boolean;
160
183
  approvals_default: "ask" | "never";
@@ -181,6 +204,50 @@ export declare function packageModel(env: NodeJS.ProcessEnv, model: Package["mod
181
204
  model?: string;
182
205
  warning?: string;
183
206
  }>;
207
+ /** A computer setting as a definition names it (`definition.computer`). */
208
+ export type PickedSetting = {
209
+ kind: string;
210
+ provider?: string;
211
+ };
212
+ /** The shell this server can give an agent now (server.ts shellHere): the computer setting that gives it, the shell
213
+ * tools a run there has (tools.ts shellTools), and the shell in words; else, `none`, why it has none. */
214
+ export type ShellHere = {
215
+ computer: PickedSetting;
216
+ tools: readonly string[];
217
+ words: string;
218
+ } | {
219
+ none: string;
220
+ };
221
+ /** What a package's computer list picks here: the entry, the setting the agent is saved with, the shell in words (null
222
+ * for none), the package's shell tools that shell does not run (`dropped`, never granted), the shell tools a package
223
+ * that names no tools is given (`defaults`), and the words an apply says of it (`note`: a fallback, or a tool dropped). */
224
+ export type ComputerPick = {
225
+ entry: ComputerEntry;
226
+ computer: PickedSetting;
227
+ shell: string | null;
228
+ dropped: string[];
229
+ defaults: string[];
230
+ note: string | null;
231
+ };
232
+ /** What to do where a package's computer list has no shell to take: in the apply's refusal and its fallback warning. */
233
+ export declare const COMPUTER_FIX = "Turn on Archil in Settings \u2192 Workspace, or run AgentRun where Docker answers, then apply again to give it a shell.";
234
+ /** The first entry of a package's computer list (`[shell, none]`) this server meets now, given the shell it has
235
+ * (`here`): shell, where it has one; none, always (kind none, and no shell tool: a run on the runner in Mode 2 has bash,
236
+ * so a shell tool is dropped rather than left to it). Undefined for a package with no list (it runs where a new agent
237
+ * does); `refused`, in words, when no entry is met. The rule is the package's preference alone: nothing here knows a
238
+ * template. */
239
+ export declare function pickComputer(p: Pick<Package, "name" | "computer" | "tools">, here: ShellHere): ComputerPick | {
240
+ refused: string;
241
+ } | undefined;
242
+ /** The model of each tier a package's subagents run on here (the definition's model_tiers), as `{modelTiers?, warning?}`:
243
+ * a tier's model the package names (`model.fast`, `model.strong`) when this server runs it on `harness` with a key for its
244
+ * provider, never through a gateway, as packageModel keeps `prefer`; else none, the tier then this server's own
245
+ * (AGENT_MODEL_FAST, AGENT_MODEL_STRONG), and a warning says so. The agent's own tier, named nowhere else, is the model
246
+ * the agent itself got (`own`), so a subagent on the agent's tier runs on the agent's model. */
247
+ export declare function packageTiers(env: NodeJS.ProcessEnv, model: Package["model"], harness: string, own?: string): Promise<{
248
+ modelTiers?: Record<string, string>;
249
+ warning?: string;
250
+ }>;
184
251
  /** The bodies an apply makes: POST /v2/agents' (its definition and skill files) and each trigger's, with no agent_id,
185
252
  * every `${parameters.x}` filled. `mcp`: the package's MCP servers this server has saved, whose tools are granted beside
186
253
  * the package's tools (or, when it names none, `defaultTools`, those this server gives a new agent), each at the
@@ -191,10 +258,12 @@ export declare function packageModel(env: NodeJS.ProcessEnv, model: Package["mod
191
258
  export declare function compiled(p: Package, parameters: Json, chosen: {
192
259
  harness?: string;
193
260
  model?: string;
261
+ modelTiers?: Record<string, string>;
194
262
  mcp: McpNeed[];
195
263
  defaultTools: readonly string[];
196
264
  grants: readonly string[];
197
265
  approvals?: Approvals;
266
+ computer?: ComputerPick;
198
267
  }, _deps?: TemplatesDeps): {
199
268
  agent: Json;
200
269
  triggers: Json[];