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

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 (399) hide show
  1. package/CHANGELOG.md +282 -0
  2. package/README.md +155 -92
  3. package/dist/agent-rows.d.ts +1 -1
  4. package/dist/agents-store.d.ts +35 -3
  5. package/dist/agents-store.js +39 -14
  6. package/dist/answer-json.d.ts +34 -1
  7. package/dist/answer-json.js +91 -9
  8. package/dist/api-only.d.ts +1 -1
  9. package/dist/api-only.js +2 -2
  10. package/dist/browser-cost.js +52 -93
  11. package/dist/cap.d.ts +0 -390
  12. package/dist/cap.js +4 -937
  13. package/dist/catalog.js +1 -1
  14. package/dist/composio-preset.d.ts +17 -0
  15. package/dist/composio-preset.js +43 -1
  16. package/dist/computer-calls.d.ts +36 -24
  17. package/dist/computer-calls.js +110 -27
  18. package/dist/computer-live.d.ts +5 -0
  19. package/dist/computer-live.js +12 -0
  20. package/dist/computer-setting.d.ts +15 -2
  21. package/dist/computer-setting.js +20 -4
  22. package/dist/computer-view.d.ts +3 -2
  23. package/dist/computer-view.js +5 -4
  24. package/dist/computer-viewer.js +26 -12
  25. package/dist/computers.d.ts +4 -1
  26. package/dist/computers.js +12 -6
  27. package/dist/console/assets/index-CjqQirbo.css +1 -0
  28. package/dist/console/assets/index-b6-XY5A9.js +576 -0
  29. package/dist/console/index.html +2 -2
  30. package/dist/console-links.d.ts +2 -0
  31. package/dist/console-links.js +3 -0
  32. package/dist/decisions.js +4 -0
  33. package/dist/faux-computers.js +4 -2
  34. package/dist/harness-opencode/adapter.js +7 -3
  35. package/dist/harness-opencode/facts.js +0 -2
  36. package/dist/harness-opencode/host/policy.d.ts +2 -5
  37. package/dist/harness-opencode/host/policy.js +8 -32
  38. package/dist/harness-table.d.ts +0 -2
  39. package/dist/harness-table.js +0 -2
  40. package/dist/host-tools.d.ts +1 -5
  41. package/dist/host-tools.js +7 -10
  42. package/dist/hosted-search.d.ts +0 -2
  43. package/dist/hosted-search.js +0 -21
  44. package/dist/key-words.d.ts +3 -2
  45. package/dist/key-words.js +4 -2
  46. package/dist/learn/check.d.ts +6 -1
  47. package/dist/learn/check.js +12 -4
  48. package/dist/learn/commit.d.ts +10 -0
  49. package/dist/learn/commit.js +18 -4
  50. package/dist/learn/compile.d.ts +243 -0
  51. package/dist/learn/compile.js +471 -0
  52. package/dist/learn/general.d.ts +3 -0
  53. package/dist/learn/general.js +4 -2
  54. package/dist/learn/grade.d.ts +1 -1
  55. package/dist/learn/grade.js +7 -6
  56. package/dist/learn/notes.d.ts +8 -0
  57. package/dist/learn/notes.js +18 -0
  58. package/dist/learn/promote.d.ts +253 -0
  59. package/dist/learn/promote.js +428 -0
  60. package/dist/learn/refit.d.ts +39 -0
  61. package/dist/learn/refit.js +236 -0
  62. package/dist/learn/reflect.d.ts +5 -25
  63. package/dist/learn/reflect.js +14 -131
  64. package/dist/learn/replay-calls.d.ts +63 -0
  65. package/dist/learn/replay-calls.js +158 -0
  66. package/dist/learn/skills.d.ts +17 -9
  67. package/dist/learn/skills.js +132 -42
  68. package/dist/learn/workflow-nodes.d.ts +15 -0
  69. package/dist/learn/workflow-nodes.js +44 -0
  70. package/dist/learned-nodes.d.ts +50 -2
  71. package/dist/learned-nodes.js +41 -2
  72. package/dist/learned-workflow.d.ts +19 -3
  73. package/dist/learned-workflow.js +105 -26
  74. package/dist/learning-batch.d.ts +2 -2
  75. package/dist/learning-batch.js +1 -1
  76. package/dist/learning-cost.d.ts +18 -6
  77. package/dist/learning-cost.js +15 -7
  78. package/dist/learning-routes.d.ts +14 -2
  79. package/dist/learning-routes.js +14 -3
  80. package/dist/learning-words.d.ts +7 -0
  81. package/dist/learning-words.js +7 -0
  82. package/dist/learning.d.ts +31 -6
  83. package/dist/learning.js +7 -4
  84. package/dist/llm.js +0 -3
  85. package/dist/mcp-gateway.d.ts +12 -20
  86. package/dist/mcp-gateway.js +16 -44
  87. package/dist/mcp-oauth.d.ts +5 -0
  88. package/dist/mcp-oauth.js +1 -1
  89. package/dist/mcp-pin-first.d.ts +37 -0
  90. package/dist/mcp-pin-first.js +107 -0
  91. package/dist/mcp-probe.d.ts +8 -9
  92. package/dist/mcp-probe.js +16 -33
  93. package/dist/mcp-servers-store.d.ts +89 -22
  94. package/dist/mcp-servers-store.js +131 -25
  95. package/dist/mcp-sources.d.ts +39 -0
  96. package/dist/mcp-sources.js +74 -0
  97. package/dist/mcp-store.d.ts +11 -0
  98. package/dist/mcp-store.js +16 -2
  99. package/dist/mcp-wire.d.ts +22 -0
  100. package/dist/mcp-wire.js +36 -0
  101. package/dist/mcp.js +3 -3
  102. package/dist/meta-tool-names.d.ts +1 -0
  103. package/dist/meta-tool-names.js +3 -0
  104. package/dist/model.d.ts +13 -0
  105. package/dist/model.js +46 -15
  106. package/dist/monid.d.ts +51 -25
  107. package/dist/monid.js +226 -140
  108. package/dist/openapi.js +336 -66
  109. package/dist/paid-calls.d.ts +26 -29
  110. package/dist/paid-calls.js +46 -102
  111. package/dist/propose.d.ts +7 -1
  112. package/dist/propose.js +18 -6
  113. package/dist/provider.js +9 -2
  114. package/dist/reflect-range.js +2 -1
  115. package/dist/rows.d.ts +5 -3
  116. package/dist/rows.js +15 -4
  117. package/dist/run-launch.d.ts +13 -0
  118. package/dist/run-launch.js +6 -0
  119. package/dist/run-learning-served.d.ts +13 -2
  120. package/dist/run-manifest.d.ts +5 -0
  121. package/dist/run-manifest.js +20 -0
  122. package/dist/run-secrets.js +2 -3
  123. package/dist/run-timeline-served.js +5 -2
  124. package/dist/run-view.d.ts +17 -6
  125. package/dist/run-view.js +51 -22
  126. package/dist/runnable.d.ts +0 -3
  127. package/dist/runnable.js +37 -29
  128. package/dist/runner/adapter-loop.d.ts +24 -10
  129. package/dist/runner/adapter-loop.js +852 -314
  130. package/dist/runner/adapter-run-spec.d.ts +12 -6
  131. package/dist/runner/adapter-run-spec.js +97 -46
  132. package/dist/runner/adapters/pi-computer.d.ts +3 -1
  133. package/dist/runner/adapters/pi-computer.js +13 -5
  134. package/dist/runner/adapters/pi.d.ts +16 -7
  135. package/dist/runner/adapters/pi.js +94 -33
  136. package/dist/runner/cli-run-spec.js +67 -27
  137. package/dist/runner/computer-channel.js +2 -1
  138. package/dist/runner/conformance/harness.d.ts +3 -0
  139. package/dist/runner/conformance/harness.js +145 -4
  140. package/dist/runner/conformance/subject.d.ts +11 -4
  141. package/dist/runner/end-of-run.d.ts +6 -5
  142. package/dist/runner/end-of-run.js +9 -6
  143. package/dist/runner/feedback-round.d.ts +52 -0
  144. package/dist/runner/feedback-round.js +79 -0
  145. package/dist/runner/journal-kinds.d.ts +24 -6
  146. package/dist/runner/journal-kinds.js +15 -0
  147. package/dist/runner/learning-end.d.ts +54 -19
  148. package/dist/runner/learning-end.js +272 -99
  149. package/dist/runner/learning-loop.d.ts +19 -1
  150. package/dist/runner/learning-loop.js +5 -2
  151. package/dist/runner/learning-seed.d.ts +4 -0
  152. package/dist/runner/learning-seed.js +14 -0
  153. package/dist/runner/loop-contract.d.ts +19 -3
  154. package/dist/runner/loop.d.ts +16 -1
  155. package/dist/runner/loop.js +21 -1
  156. package/dist/runner/mcp-claim.d.ts +5 -1
  157. package/dist/runner/mcp-claim.js +66 -50
  158. package/dist/runner/mcp-run.d.ts +16 -52
  159. package/dist/runner/mcp-run.js +12 -84
  160. package/dist/runner/meta-tools.d.ts +37 -0
  161. package/dist/runner/meta-tools.js +268 -0
  162. package/dist/runner/metrics.js +14 -3
  163. package/dist/runner/model-route.js +12 -3
  164. package/dist/runner/monid-run.d.ts +16 -0
  165. package/dist/runner/monid-run.js +96 -0
  166. package/dist/runner/promotion.d.ts +80 -0
  167. package/dist/runner/promotion.js +562 -0
  168. package/dist/runner/reflect-hook.d.ts +36 -21
  169. package/dist/runner/reflect-hook.js +138 -49
  170. package/dist/runner/runner.js +26 -4
  171. package/dist/runner/sessions.d.ts +8 -3
  172. package/dist/runner/sessions.js +5 -1
  173. package/dist/runner/step-guard.d.ts +62 -0
  174. package/dist/runner/step-guard.js +93 -0
  175. package/dist/runner/subagent.d.ts +0 -3
  176. package/dist/runner/subagent.js +7 -12
  177. package/dist/runner/workflow-first.d.ts +216 -0
  178. package/dist/runner/workflow-first.js +303 -0
  179. package/dist/runner/workflow-loop.js +17 -10
  180. package/dist/runner/workflow-spec.d.ts +1 -0
  181. package/dist/runner/workflow-spec.js +7 -3
  182. package/dist/runs-over-store.d.ts +11 -2
  183. package/dist/runs-over-store.js +21 -11
  184. package/dist/server.d.ts +88 -16
  185. package/dist/server.js +380 -87
  186. package/dist/settings-wake.d.ts +8 -6
  187. package/dist/settings-wake.js +13 -7
  188. package/dist/store/agent-body.d.ts +14 -3
  189. package/dist/store/agent-body.js +14 -10
  190. package/dist/store/command-wake.d.ts +3 -2
  191. package/dist/store/command-wake.js +4 -4
  192. package/dist/store/postgres/connection.js +3 -1
  193. package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
  194. package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
  195. package/dist/store/schema.d.ts +9 -0
  196. package/dist/store/schema.js +28 -8
  197. package/dist/store/sqlite/connection.d.ts +2 -2
  198. package/dist/store/sqlite/connection.js +2 -2
  199. package/dist/store/sqlite/run-patch.js +19 -7
  200. package/dist/store/sqlite/store.js +59 -18
  201. package/dist/store/store.d.ts +46 -14
  202. package/dist/store-reads/journal.d.ts +25 -1
  203. package/dist/store-reads/journal.js +63 -49
  204. package/dist/store-reads/learning.d.ts +101 -15
  205. package/dist/store-reads/learning.js +195 -61
  206. package/dist/store-reads/loop.d.ts +61 -0
  207. package/dist/store-reads/loop.js +111 -0
  208. package/dist/store-view.d.ts +3 -2
  209. package/dist/store-view.js +35 -17
  210. package/dist/template-eval.d.ts +18 -9
  211. package/dist/template-eval.js +91 -66
  212. package/dist/template-github-permissions.d.ts +2 -2
  213. package/dist/template-github-permissions.js +2 -1
  214. package/dist/template-import.d.ts +31 -0
  215. package/dist/template-import.js +121 -0
  216. package/dist/template-source.d.ts +51 -0
  217. package/dist/template-source.js +371 -0
  218. package/dist/templates.d.ts +218 -46
  219. package/dist/templates.js +493 -181
  220. package/dist/timeline/computer.d.ts +48 -0
  221. package/dist/timeline/computer.js +169 -0
  222. package/dist/timeline/index.d.ts +4 -3
  223. package/dist/timeline/index.js +4 -3
  224. package/dist/timeline/labels.d.ts +6 -2
  225. package/dist/timeline/labels.js +93 -2
  226. package/dist/timeline/origin.d.ts +19 -5
  227. package/dist/timeline/origin.js +11 -4
  228. package/dist/timeline/timeline.d.ts +11 -17
  229. package/dist/timeline/timeline.js +24 -9
  230. package/dist/tool-gate.d.ts +73 -46
  231. package/dist/tool-gate.js +133 -66
  232. package/dist/tool-keys.d.ts +4 -1
  233. package/dist/tool-keys.js +8 -3
  234. package/dist/tool-list.d.ts +26 -0
  235. package/dist/tool-list.js +43 -0
  236. package/dist/tool-names.d.ts +71 -0
  237. package/dist/tool-names.js +99 -0
  238. package/dist/tool-plane.d.ts +29 -27
  239. package/dist/tool-plane.js +65 -37
  240. package/dist/tools.d.ts +22 -6
  241. package/dist/tools.js +24 -20
  242. package/dist/validate.d.ts +15 -7
  243. package/dist/validate.js +91 -44
  244. package/dist/web-fetch.d.ts +1 -7
  245. package/dist/web-fetch.js +2 -22
  246. package/dist/workspace/computer-deps.d.ts +3 -0
  247. package/dist/workspace/computer-deps.js +5 -2
  248. package/dist/workspace/computer-for-claim.d.ts +6 -0
  249. package/dist/workspace/computer-for-claim.js +32 -14
  250. package/dist/workspace/computer-hold.js +7 -1
  251. package/dist/workspace/computer-script.d.ts +23 -7
  252. package/dist/workspace/computer-script.js +48 -14
  253. package/dist/workspace/index.d.ts +2 -2
  254. package/dist/workspace/index.js +1 -1
  255. package/dist/workspace/kind-skills/desktop/SKILL.md +13 -0
  256. package/dist/workspace/kind-skills/phone/SKILL.md +4 -0
  257. package/dist/workspace/local.js +2 -2
  258. package/dist/workspace/resolve-computer.d.ts +21 -1
  259. package/dist/workspace/resolve-computer.js +32 -14
  260. package/dist/workspace/run-tools.d.ts +28 -10
  261. package/dist/workspace/run-tools.js +39 -11
  262. package/dist/{tool-budget.d.ts → wrap-up.d.ts} +1 -18
  263. package/dist/wrap-up.js +21 -0
  264. package/launcher/agentrun-serve +4 -2
  265. package/package.json +9 -9
  266. package/templates/README.md +111 -45
  267. package/templates/code-review/agent.md +30 -14
  268. package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
  269. package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
  270. package/templates/code-review/evals/injection/case.yaml +2 -1
  271. package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
  272. package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
  273. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
  274. package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
  275. package/templates/code-review/evals/never-flag/case.yaml +2 -1
  276. package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
  277. package/templates/code-review/evals/null-name/case.yaml +2 -1
  278. package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
  279. package/templates/code-review/evals/off-by-one/case.yaml +2 -1
  280. package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
  281. package/templates/code-review/evals/other-repo/case.yaml +16 -0
  282. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
  283. package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
  284. package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
  285. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
  286. package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
  287. package/templates/code-review/evals/other-repo/prompt.md +10 -0
  288. package/templates/code-review/evals/re-review/case.yaml +2 -1
  289. package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
  290. package/templates/code-review/evals/re-review-open/case.yaml +2 -1
  291. package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
  292. package/templates/code-review/evals/repo-rule/case.yaml +2 -1
  293. package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
  294. package/templates/code-review/evals/two-defects/case.yaml +2 -1
  295. package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
  296. package/templates/code-review/rules/CODEREVIEW.md +1 -1
  297. package/templates/code-review/skills/review/DEEP.md +3 -2
  298. package/templates/code-review/skills/review/REVIEWER.md +3 -2
  299. package/templates/code-review/skills/review/SKILL.md +4 -3
  300. package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
  301. package/templates/inbound-lead/agent.md +26 -16
  302. package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
  303. package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
  304. package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
  305. package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
  306. package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
  307. package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
  308. package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
  309. package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
  310. package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
  311. package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
  312. package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
  313. package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
  314. package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
  315. package/templates/kyb/agent.md +15 -5
  316. package/templates/kyb/evals/adverse-media/prompt.md +2 -7
  317. package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
  318. package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
  319. package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
  320. package/templates/kyb/evals/name-collision/prompt.md +2 -6
  321. package/templates/kyb/evals/no-invention/prompt.md +2 -6
  322. package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
  323. package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
  324. package/templates/kyb/kyb.schema.json +8 -7
  325. package/templates/kyb/skills/kyb/SKILL.md +9 -6
  326. package/templates/market-monitor/agent.md +19 -12
  327. package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
  328. package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
  329. package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
  330. package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
  331. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  332. package/templates/release-notes/agent.md +32 -10
  333. package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
  334. package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
  335. package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
  336. package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
  337. package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
  338. package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
  339. package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
  340. package/templates/release-notes/evals/learned-style/case.yaml +2 -1
  341. package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
  342. package/templates/release-notes/evals/other-repo/case.yaml +24 -0
  343. package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
  344. package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
  345. package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
  346. package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
  347. package/templates/release-notes/evals/other-repo/prompt.md +32 -0
  348. package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
  349. package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
  350. package/templates/release-notes/notes.schema.json +1 -1
  351. package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
  352. package/dist/console/assets/index-Cn6JX1uH.js +0 -563
  353. package/dist/console/assets/index-DRN62V5v.css +0 -1
  354. package/dist/tool-blurbs.d.ts +0 -4
  355. package/dist/tool-blurbs.js +0 -28
  356. package/dist/tool-budget.js +0 -62
  357. package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
  358. package/templates/code-review/evals/injection/graders/schema.md +0 -5
  359. package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
  360. package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
  361. package/templates/code-review/evals/null-name/graders/schema.md +0 -5
  362. package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
  363. package/templates/code-review/evals/re-review/graders/schema.md +0 -5
  364. package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
  365. package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
  366. package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
  367. package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
  368. package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
  369. package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
  370. package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
  371. package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
  372. package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
  373. package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
  374. package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
  375. package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
  376. package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
  377. package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
  378. package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
  379. package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
  380. package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
  381. package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
  382. package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
  383. package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
  384. package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
  385. package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
  386. package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
  387. package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
  388. package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
  389. package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
  390. package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
  391. package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
  392. package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
  393. package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
  394. package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
  395. package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
  396. package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
  397. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
  398. package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
  399. package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/README.md CHANGED
@@ -35,7 +35,7 @@ Set your password: http://127.0.0.1:7340/setup (the first visit sets it)
35
35
  A Docker box's image is built on its first run, which shows that on its timeline. `npx @parcha/agentrun` prints the
36
36
  `Boxes:` line on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so new agents run on the
37
37
  runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart
38
- AgentRun.`); see [Boxes](#boxes).
38
+ AgentRun.`); see [Sandbox](#sandbox).
39
39
 
40
40
  `Open` is [the console](#the-console), which takes [your password](#your-password). For a client, export the two lines before
41
41
  it, then make an agent, start a run, and read its timeline until a page says `final`:
@@ -137,7 +137,7 @@ at=2026-10-25T21:04:09.010Z event=auth_failed route=/v2/runs reason=wrong_token
137
137
  A request's path has no query. `auth_failed` names the route and why (`no_credential`, `wrong_token`,
138
138
  `wrong_launch_code`, `wrong_password`, `sign_in_table_full`), never the token given nor any part of it. `AGENTRUN_LOG=quiet` leaves out the request lines; the
139
139
  run and `auth_failed` lines stay. A run whose process failed at its start says why in its `error.message`, in words.
140
- One line at start, `event=boxes`, says which boxes this server has ([Boxes](#boxes)); quiet keeps it too.
140
+ One line at start, `event=boxes`, says which boxes this server has ([Sandbox](#sandbox)); quiet keeps it too.
141
141
  `event=harness_offers why=start ms=<n>` says how long the server took to check what each harness offers (each CLI's
142
142
  package and pins; [harnesses](#harnesses)), the bulk of its start; quiet keeps it too. It is made at the start only: a
143
143
  PUT of `/settings/tools` and a save or delete of a tool key change no harness's offer, so they remake capabilities at
@@ -290,7 +290,7 @@ set (the environment, or Settings → Computers). No box holds a key. A Docker b
290
290
  and GitHub through a proxy, and nothing else; a Daytona or Modal box is made with no network when a host list is set, and
291
291
  capabilities say so in its `places.boxes` entry. Its `read`, `write` and `edit` work on that same `work/`: on this server, where the box binds it and this server
292
292
  holds directory handles (Docker on Linux), else in the box. The agent's loop, its log, its model calls and every key stay
293
- on the server. An agent says so in its [place](#place); the server says which [boxes](#boxes) it has; [a run in a Docker
293
+ on the server. An agent says so in its [place](#place); the server says which boxes it has (`places.boxes` in its capabilities); [a run in a Docker
294
294
  box](#a-run-in-a-docker-box) is what the container gets; [the box's image](#the-boxs-image) is what it starts from.
295
295
  [Sandbox in 60 seconds](#sandbox-in-60-seconds) is all of it
296
296
  end to end. The [published image](#in-the-published-image) hosts Docker boxes through the host's Docker socket.
@@ -357,7 +357,7 @@ link, and write through a temporary file renamed over the old one, keeping its m
357
357
  says so and names the box's path; `bash`, in the container, can still reach the file. Where this server reaches
358
358
  directories by path (no `/proc/self/fd`, as on macOS), or a box binds nothing, all four run in the container, made on
359
359
  the first of them.
360
- `web_fetch`, `web_search` and the `monid.*` tools stay on this server, and so do
360
+ `web_fetch`, `web_search` and monid's endpoints stay on this server, and so do
361
361
  the run's loop, its log, its model calls and every key. What the server itself files in `work/` (monid's long answers,
362
362
  the browser's evidence) never goes through a link a box's command planted there: each directory is held open on the
363
363
  way (`/proc/self/fd`). On a host without it (macOS), where a link swapped in mid-walk could still turn a write, a sandbox run's `work/` gets none of
@@ -672,10 +672,9 @@ computer is made with the GPUs asked.
672
672
  `types: ["H100"]`, `max: 1`); another type or count needs a snapshot of its own, so it is refused. A GPU sandbox is
673
673
  made from that snapshot, with its 16 vCPUs, 100 GiB of memory and 400 GiB of disk, in region `earth`. Stopping it
674
674
  deletes it: it has no pause and no snapshot, so nothing on it outlives the run. A Daytona GPU may be preempted, so a
675
- run on one can be cut short. The Daytona org needs GPU credits. It takes no mount (`mounts: []`: the snapshot's user
676
- is not root and has no Archil client), so it can't hold the run's folder from Archil: in Mode 2 this server refuses a
677
- Daytona sandbox with a `gpu`, and `GET /v2/computers` says why in Daytona's `gpu.why`. In Mode 1 a sandbox runs on
678
- Docker only, so a Daytona GPU sandbox runs on neither mode's server today.
675
+ run on one can be cut short. The Daytona org needs GPU credits. No Daytona sandbox takes an Archil mount, with a GPU
676
+ or without (Archil's client hangs on its sandboxes), so it can't hold the run's folder: Mode 2 refuses it, and in
677
+ Mode 1 a sandbox runs on Docker only, so a Daytona sandbox runs on neither mode's server today.
679
678
  - **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
680
679
  proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
681
680
 
@@ -739,9 +738,13 @@ passes the binding's conformance cases (below) needs no change here.
739
738
  region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
740
739
  `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
741
740
  because Archil's own has git 2.34 and a read-only bash policy runs git only at 2.43 or later. An image you name needs
742
- git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal, E2B or Agent37 sandbox mounts
743
- the run's folder from its disk with a mount credential minted for that run alone; Docker's sandbox is refused, since
744
- it cannot mount the disk.
741
+ git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Modal, E2B or Agent37 sandbox would mount
742
+ the run's folder from its disk, but it needs Archil's image in your own vendor account, and this server can't put it
743
+ there yet. Settings shows them not ready, an agent's save warns, and a run's start refuses them (409) before any
744
+ computer is made. Docker's sandbox is refused, since
745
+ it cannot mount the disk, and so is Daytona's, since Archil's client hangs on its sandboxes. So in Mode 2 no sandbox
746
+ runs for now. An E2B or Agent37 desktop would mount the folder as well (it has files and exec), so it is not ready
747
+ and refused at the start in the same words.
745
748
 
746
749
  The PUT is a secret write, so it takes the owner's signed-in session. A server with none to give it (API only, or
747
750
  `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
@@ -797,24 +800,22 @@ owner's.
797
800
  - **Later, narrower tokens.** Archil's tokens reach a whole disk; nothing narrower exists today. If Archil ships
798
801
  path-scoped tokens, a run's token narrows from its disk to its own folder with no other change.
799
802
 
800
- **A Daytona computer's snapshot.** The mount runs as root through the image's root helper and its pinned archil client,
801
- so a Daytona computer that mounts the run's folder must start from a snapshot of the computer package's
802
- `box/Dockerfile`; Daytona's default snapshot, whose user is not root, is refused before anything mounts. Build one in
803
- the organization of `DAYTONA_API_KEY` with Daytona's Python SDK (`pip install daytona`), which prints its name, a hash
804
- of the recipe:
803
+ **A Daytona computer's snapshot.** `AGENTRUN_DAYTONA_SNAPSHOT` names the snapshot (its id or name) every Daytona
804
+ computer is made from, as `AGENTRUN_DOCKER_IMAGE` names Docker's image; unset, it is Daytona's default snapshot. One of
805
+ the computer package's `box/Dockerfile` is built in the organization of `DAYTONA_API_KEY` with Daytona's Python SDK
806
+ (`pip install daytona`), which prints its name, a hash of the recipe:
805
807
 
806
808
  ```sh
807
809
  DAYTONA_API_KEY=... python3 packages/computer/box/build-daytona.py # prints snapshot=agentrun-archil-<12 hex>
808
810
  ```
809
811
 
810
- and name it in the server's environment, `AGENTRUN_DAYTONA_SNAPSHOT=agentrun-archil-<12 hex>` (the id or name of any
811
- Daytona snapshot), as `AGENTRUN_DOCKER_IMAGE` names Docker's image. Every Daytona computer is then made from it. Unset,
812
- it is Daytona's default snapshot, as before. A changed recipe is a new name, so build again after an upgrade that
813
- changes `box/`. The [Daytona box](#a-run-in-a-daytona-box) never reads it.
812
+ A Daytona computer takes no Archil mount, so this server never holds a run's folder on one (see Mode 2 above). A
813
+ Daytona [box](#sandbox) never reads it.
814
814
 
815
- A desktop, a phone and a browser run in either mode. The run's folder is at `/workspace` in every computer that mounts
816
- it: a sandbox always, and a desktop whose provider mounts the mode's folder (Docker's in Mode 1, E2B's in Mode 2). A
817
- phone and a browser never mount it.
815
+ A desktop, a phone and a browser run in either mode, except a desktop that would mount the owner's disk in Mode 2 (E2B's,
816
+ Agent37's), which needs Archil's image in your vendor account first (see Mode 2 above). The run's folder is at
817
+ `/workspace` in every computer that mounts it: a sandbox always, and a desktop whose provider mounts the mode's folder
818
+ (Docker's in Mode 1). A phone and a browser never mount it.
818
819
 
819
820
  **Where `bash` runs.** It follows the mount:
820
821
 
@@ -885,9 +886,13 @@ model with no price set that the catalog does not list in any form; null while `
885
886
 
886
887
  - `--faux MODULE`: every model is the module's (below), with no key and no network: `faux-1`, or for a tier the model
887
888
  id its variable names.
888
- - `AGENT_MODEL_BASE_URL`: every model id goes to that one OpenAI Responses endpoint, a gateway, at `<base>/v1/responses`
889
- with one trailing `/v1` taken off the base first, as for every harness (OpenRouter's is `https://openrouter.ai/api` or
890
- `https://openrouter.ai/api/v1`): a revision's `provider/model-id` is sent whole, as a gateway like OpenRouter names its
889
+ - `AGENT_MODEL_BASE_URL`: every model id goes to that one gateway, with one trailing `/v1` taken off the base first, as
890
+ for every harness (OpenRouter's is `https://openrouter.ai/api` or `https://openrouter.ai/api/v1`): a Claude model on
891
+ Anthropic's Messages API at `<base>/v1/messages`, where pi marks its prompt for Anthropic's cache (the Responses API
892
+ carries no cache mark, so a gateway's bridge from it reads none), and every other model on OpenAI's Responses API at
893
+ `<base>/v1/responses`. A model is Claude's when its id names Anthropic as its vendor (`anthropic/claude-sonnet-5.5`)
894
+ or names none and pi-ai's catalog lists it under Anthropic (`claude-opus-5-5`); the gateway serves both APIs, as
895
+ LiteLLM's proxy and OpenRouter do, with `AGENT_MODEL_API_KEY` as a bearer token on either. A revision's `provider/model-id` is sent whole, as a gateway like OpenRouter names its
891
896
  models `vendor/model`, and `AGENT_MODEL`, `AGENT_MODEL_FAST` and `AGENT_MODEL_STRONG` are sent as they are. For a
892
897
  gateway that wants the id alone, `AGENT_MODEL_GATEWAY_IDS=bare` sends a revision's model without its provider. `AGENT_MODEL_API_KEY` is its key when it needs one. `AGENT_MODEL_PRICE` is `input,output,cacheRead[,cacheWrite]`
893
898
  in USD per million tokens, so a run's cost estimate has a price; `AGENT_MODEL_FAST_PRICE` and `AGENT_MODEL_STRONG_PRICE`
@@ -965,12 +970,10 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
965
970
  | `web_fetch` | Read one web page from a public host through the guarded direct fetch, or through Parallel's extract where Parallel is picked ([search and fetch](#search-and-fetch)), a part at a time: `{url, offset?, max_chars?}` in, a Page out, `{ok, url, status, title, text, chars, truncated?, original_chars?, beyond_read?, offset?, next_offset?, html_chars?, converted?, links, links_omitted?, via, parallel?, refused?, error?}` | nothing (`PARALLEL_API_KEY` for Parallel, one billed extract a page a run) | yes, yes |
966
971
  | `web_search` | Search the web, natively where the harness or the model's provider can, else through Parallel where the server holds its key, else keyless through Exa, or through the provider picked ([search and fetch](#search-and-fetch)): `{query, n?}` in, `{provider, query, results: [{url, title, snippet, published?}], text?}` or `{error}` out | nothing (`PARALLEL_API_KEY` for Parallel) | yes, yes |
967
972
  | `browser` | A hosted browser, Browserbase's or Kernel's, on pi-browser's durable adapter: `snapshot`, `run`, `screenshot`, `browser_read`, `browser_release`, `browser_relaunch`, `browser_downloads` and `browser_upload` (into and from the run's `work/`); Kernel keeps no downloads, so a run on Kernel has no `browser_downloads` | `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, or `KERNEL_API_KEY` | yes, no |
968
- | `monid.discover` | Search monid's catalog of paid data endpoints in plain words: `{query, limit?, minScore?}` in, `{results: [{provider, endpoint, description, score, price}]}` out | `MONID_API_KEY` | no, no |
969
- | `monid.inspect` | One monid endpoint before it runs: `{provider, endpoint}` in, the JSON Schemas of its input (`pathParams`, `queryParams`, `body`), its price, notes and documentation out | `MONID_API_KEY` | no, no |
970
- | `monid.run` | Run one monid endpoint, paid per call from the monid wallet: `{provider, endpoint, input}` in, the run's `output`, `price` and `cost` out | `MONID_API_KEY` | no, no |
973
+ | `monid:<provider>/<endpoint>`, `monid:<provider>/*` | One monid endpoint, or every endpoint monid lists for a provider (at most 50), each pinned at the save and run as a tool of its own, paid per call from the monid wallet: `{body?, queryParams?, pathParams?}` in, the run's `output`, `price` and `cost` out ([monid](#monid)) | `MONID_API_KEY` | no, no |
971
974
  | `pdf_pages` | A workflow call only: `{path, maxPages?, dpi?}` in, `{name, pageCount, dpi, pages: [{page, image}], text}` out. Draws a document's first pages (3 by default, at 110 dpi) as PNGs under the run's `work/pages/<stem>/<dpi>/` (`<stem>`: the document's path below its directory made one name, with a short hash, so two documents of one file name never share pages), the dpi lowered so a page's long side is at most 1568 px, with its text (`pdftotext`, cut at 20,000 characters). A PNG or JPEG passes through as one page, scaled down to 1568 px. `path` is under `--documents` or the run's `work/`, never outside | `pdftoppm`, `pdftotext` | no, yes |
972
975
  | `llm` | A workflow call only: `{prompt, system?, maxTokens?, tier?}` in, `{text, model, usage, cost_usd}` out. One completion on the run's model of the tier (`default`; a tier the state fills in, such as `"{requestedTier}"`, may be any of the three, and a tier with no model fails the call), no tools and no loop; `cost_usd` is null when the model has no price, never 0 | a model | no, yes |
973
- | `subagent` | pi only: `{prompt, tools?, model?, max_tool_calls?, effort?}` in, the child's last text out, bounded like a host tool's result. Runs a fresh conversation whose whole task is `prompt`, with `tools` a subset of the agent's own (by catalog or session name, MCP tools and `bash` included; absent, none), on the agent's own model or the tier `model` names (`fast` or `strong`: the definition's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`, else the agent's own model) ([subagents](#subagents)) | a pi run | no, no |
976
+ | `subagent` | pi only: `{prompt, tools?, model?, effort?}` in, the child's last text out, bounded like a host tool's result. Runs a fresh conversation whose whole task is `prompt`, with `tools` a subset of the agent's own (by catalog or session name, MCP tools and `bash` included; absent, none), on the agent's own model or the tier `model` names (`fast` or `strong`: the definition's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`, else the agent's own model) ([subagents](#subagents)) | a pi run | no, no |
974
977
 
975
978
  `bash` and the background tools run only in a box: a runner agent, and a workflow, get no shell on this machine (see [Safety](#safety)). In a
976
979
  sandbox place `read`, `write` and `edit` run in the box too.
@@ -1013,6 +1016,34 @@ to read it, which a run's confinement refuses, Codex keeps only the ends of a re
1013
1016
  would cut one past 2,000 lines or 51,200 bytes and save the rest to a file the session has no tool to read. A
1014
1017
  `web_search` answer past 100,000 characters leaves out its least relevant results, `omitted` counting them.
1015
1018
 
1019
+ ### Finding and calling the run's tools
1020
+
1021
+ A run lists every tool to the model in full until its catalog tools (an MCP server's, a monid one) pass 20
1022
+ (`DEFER_CATALOG_OVER`, `defersCatalog` in the kernel). Then they are deferred: not listed, found with `tools_search` and
1023
+ run with `tools_call` (built-ins and pi's own tools are always listed). Under 20, there is no search or call: they
1024
+ would find tools the model already has, at about 640 tokens on every request. Claude Code defers MCP tools itself (its
1025
+ ToolSearch, on under the same test), so it is offered neither of the two; Codex has them and keeps its own code mode.
1026
+ `codemode` is offered on every run (not Codex). Each of the three has a tool-settings key of its own, allow by default:
1027
+ set to `deny`, it is not offered at all, and a call to it is refused. None of them goes around the run's tool settings:
1028
+
1029
+ - `tools_search {query, limit?}` ranks the run's tools by what they do and answers each match's name, description and
1030
+ input schema (8 by default, at most 25). It finds only tools the run may call: never one set to deny, and never these
1031
+ three.
1032
+ - `tools_call {name, args}` calls one of the run's tools by name. The call is the tool's own: it is asked about at the
1033
+ gate by that tool's name, and recorded and booked under `<callId>/call`. An ask parks the run, a deny refuses it in the gate's words, and a name the run has no tool by (or one of these three)
1034
+ is refused in words with nothing run.
1035
+ - `codemode {script}` runs a JavaScript script (the body of an async function) in a QuickJS sandbox. Its
1036
+ `await tools.<name>(args)` calls are each the tool's own call, under `<callId>/s<n>`, answered one at a time. The
1037
+ sandbox has the tools and nothing else of the run: no environment, key, file, network or timer. A script runs at most
1038
+ 10 minutes in 256 MiB. A call that needs approval parks the run, and the script follows Codex's rule. Once a person
1039
+ answers, the script runs again from its start, and the calls it already made answer from their records. The parked
1040
+ call runs once (or is refused), its outcome is the script's answer, and the rest of the script does not run. A
1041
+ refused call ends the script with the refusal. A call cut off by a crash is told as possibly done and never run again.
1042
+
1043
+ A paid call made through `tools_call` or a script is held at its price before it is sent and settled once, as a direct
1044
+ call is, so the cap holds it. On pi with a desktop or a phone, `codemode` is pi's own code mode (see
1045
+ [Computers](#computers)), offered in place of this one.
1046
+
1016
1047
  ### Subagents
1017
1048
 
1018
1049
  `subagent` is one primitive: a prompt, a fresh context and a subset of the agent's own tools, on the agent's own model
@@ -1022,10 +1053,8 @@ given `subagent` or `ask_person`), and at most 4 children of a run work at once;
1022
1053
  child under its call, and the run's cost counts every child's requests. How to split work and merge answers is the
1023
1054
  agent's own instructions, never the engine's.
1024
1055
 
1025
- A call may set its child's `max_tool_calls` and `effort`. `max_tool_calls` narrows the agent's own budget (its definition's
1026
- `max_tool_calls`, which holds each conversation) for that child and never widens it; with no budget of the agent's, the
1027
- call's holds. `effort` (`low`, `medium` or `high`) is the child's thinking level; absent, the child thinks as the agent
1028
- does. So one template can run wide reviewers at `medium` with 30 calls and deep ones at `high` with 90.
1056
+ A call may set its child's `effort` (`low`, `medium` or `high`), its thinking level; absent, the child thinks as the agent
1057
+ does. So one template can run wide reviewers at `medium` and deep ones at `high`. The run's cap bounds every child's work.
1029
1058
 
1030
1059
  A child is a conversation in the run's own journal, owned by its call, so it lives and ends with the run:
1031
1060
 
@@ -1119,7 +1148,7 @@ A workflow's tools are those its revision lists and those its model and call nod
1119
1148
 
1120
1149
  Upgrading to the tool gate: a workflow whose call node's tool is set to ask, by a setting or a default, now refuses its
1121
1150
  run (`409` with `details.asks`); set that tool to allow for the agent (`definition.tool_settings`). Built-in tools are
1122
- allowed by default; catalog (`monid.*`) and MCP tools, which ask by default, are no call node's tools here.
1151
+ allowed by default; catalog (`monid:<provider>/<endpoint>`) and MCP tools, which ask by default, are no call node's tools here.
1123
1152
 
1124
1153
  Upgrading: a server holding `PARALLEL_API_KEY` used to read every `web_fetch` page through Parallel's extract on its own.
1125
1154
  Now `web_fetch` is the guarded direct fetch unless Parallel is picked; to keep the old behaviour, set
@@ -1380,36 +1409,47 @@ picks which one a run gets, never the model.
1380
1409
  sign-in a forget finds. It is kept only so a later server still cuts it from what a run that was handed it said: one
1381
1410
  that ended before the forget, or one opened again since on a new sign-in. Archiving an agent keeps its sign-ins; this server has no route that deletes an agent.
1382
1411
 
1383
- `monid.discover`, `monid.inspect` and `monid.run` give an agent [monid](https://monid.ai)'s whole catalog of data
1384
- endpoints on one key, `MONID_API_KEY`: it finds an endpoint in plain words, reads its input schemas and price, and runs
1385
- it. Each run is paid per call from the monid workspace's wallet, and is sent once, never retried. An async provider's
1412
+ <a id="monid"></a>
1413
+ An agent is granted [monid](https://monid.ai)'s data endpoints on one key, `MONID_API_KEY`, by name:
1414
+ `monid:<provider>/<endpoint>` (one, such as `monid:apollo/people/match`) or `monid:<provider>/*` (every endpoint monid
1415
+ lists for the provider, at most 50). Each grant is read against monid's listing when the agent is saved, and pinned on
1416
+ that revision with the endpoint's description, its input schema (`pathParams`, `queryParams`, `body`) and its price; a
1417
+ provider or endpoint monid does not list, or a grant saved with no monid key, is refused at the save in words. Only an
1418
+ endpoint with a fixed price is pinned: one monid prices by usage (per result, per unit, metered) costs what it used,
1419
+ known only after it has run, and monid bounds no such call's charge (its `maxCost` checks only its estimate, which such
1420
+ a call can pass), so no hold could keep a run's cap. It is refused at the save as a named grant, naming the endpoint
1421
+ and why, and a provider's wildcard leaves it out, each left-out endpoint named in the save's `warnings`; a wildcard that
1422
+ leaves every endpoint out is refused. An edit pins again. A workflow's nodes do not bind monid endpoints yet. Each pinned endpoint is a tool of its own on every
1423
+ harness, named on the wire with `__` for `:` and `/` (`monid__apollo__people__match`), asked about by default, and set by
1424
+ its own name or its provider's wildcard in tool settings.
1425
+ Each run is paid per call from the monid workspace's wallet, and is sent once, never retried. An async provider's
1386
1426
  run is read until it ends, about two minutes at most, and asked to stop at monid when the run stops or it outlasts that.
1387
1427
  A refusal comes back as `{error, status?}` in words: the wallet too low (402), a workspace control such as its budget
1388
1428
  (`BLOCKED`), `FAILED`, `TIMED_OUT`, the provider's own error (not charged). The model reads each answer as JSON cut at
1389
1429
  60,000 characters, the whole of it then filed under the run's `work/evidence/monid/`. An answer carries what monid
1390
1430
  charged (`cost`, in dollars), and that charge is the run's spend: booked once in the run's own records as a tool cost
1391
- (`agentrun.tool_cost`: `tool` `monid.run`, `charged_by` `"monid"`, `usd`), shown in its timeline on a line of its own
1392
- (`Tool cost: monid charged $0.0030 for monid.run`) and summed into its cost, the total its [spend cap](#spend-cap)
1393
- reads, and `/usage` grouped by meter shows it as its own meter, `tools`, apart from `tokens`. Each run is marked in the
1394
- run's records before it is sent, held at the price an earlier `monid.inspect` of the run quoted for that endpoint, else
1395
- at an allowance of $1; its charge settles the mark. A mark a crash left unsettled leaves the run's cost unknown, as a
1431
+ (`agentrun.tool_cost`: `tool` the endpoint's name, `charged_by` `"monid"`, `usd`), shown in its timeline on a line of its
1432
+ own (`Tool cost: monid charged $0.0260 for monid:apollo/people/match`) and summed into its cost, the total its
1433
+ [spend cap](#spend-cap) reads, and `/usage` grouped by meter shows it as its own meter, `tools`, apart from `tokens`.
1434
+ Each run is marked in the run's records before it is sent, held at its pinned price (a per-call price; the dearest
1435
+ variant of a matrix; a tiered price's default and every tier), and its approval card shows that hold; its charge
1436
+ settles the mark. It is sent with that hold as monid's `maxCost`, so an endpoint monid prices higher now than when the
1437
+ agent was saved is refused by monid unrun and uncharged, never booked past its hold. Before it is sent, its price is
1438
+ read again from monid (an inspect, which monid does not charge): one monid now prices by usage, whose estimate could
1439
+ pass that `maxCost` while its charge does not, is refused unsent, in words naming how monid prices it now. A mark a crash left unsettled leaves the run's cost unknown, as a
1396
1440
  model request a crash cut does, and its cap counts it at its held figure, never $0. A run that may have charged and says
1397
1441
  no cost (`FAILED`, `TIMED_OUT`, one stopped by the run or the wait, one whose sending failed) books an unknown charge,
1398
1442
  never $0: the run's cost reads `null`, and under a cap it counts at its held figure, the bound the cap let it go at, as
1399
1443
  a crash-cut mark does, so the run goes on while its cap allows, in its process and in one opened again from its store;
1400
1444
  one monid says it did not charge (refused as sent, `BLOCKED`, `STOPPED`, the provider's error) books nothing. Under a
1401
- cap, each `monid.run` is held as a model request is: unless what the run has spent plus what the run is held at (the
1402
- price an inspect quoted, else the $1 allowance) fits its `max_cost_usd`, or when the spend is unknown, the call is
1403
- refused with a `spend_cap_reached` error the model reads, naming its price and the cap (and, when the allowance was
1404
- used, that `monid.inspect` gives a quote), and monid is never called. Runs go one at a time under a cap, and on
1445
+ cap, each endpoint's call is held as a model request is: unless what the run has spent plus what the call is held at
1446
+ fits its `max_cost_usd`, or when the spend is unknown, the call is refused with a `spend_cap_reached` error the model
1447
+ reads, naming the endpoint, its hold and the cap, the run pauses on its cap, and monid is never called. Runs go one at a time under a cap, and on
1405
1448
  claude-agent and codex the check holds each model request still in flight at its worst case. A run sent holds its
1406
1449
  figure until its charge is in, on every harness: a model request checked meanwhile counts it beside what the run has
1407
- spent, and a run that fails without an answer counts at it. `discover` and `inspect`
1408
- cost nothing and are never refused. They run on every harness: pi binds them, and claude-agent and codex call them as
1409
- host tools in the run's process, where a `monid.run` call a crash cut off is answered interrupted, never sent again
1410
- (`discover` and `inspect` may run again). On each, the model, the call's journal and the run's timeline name them
1411
- `monid_discover`, `monid_inspect` and `monid_run`: a model API takes no dot in a tool's name. The key is a secret like
1412
- the model keys: a run's process gets it over its pipe, never in its environment.
1450
+ spent, and a run that fails without an answer counts at it. Every harness calls an endpoint as a host tool in the run's
1451
+ process, where a call a crash cut off is answered interrupted, never sent again. The key is a secret like the model
1452
+ keys: a run's process gets it over its pipe, never in its environment.
1413
1453
 
1414
1454
  ## Tool keys
1415
1455
 
@@ -1517,7 +1557,9 @@ out an action it was allowed (it did for `HACKERNEWS_GET_FRONTPAGE`), so the ans
1517
1557
  action the saved server doesn't list. Both routes are the owner's
1518
1558
  session alone, and a saved Composio server is gated, approved and shown on the Timeline as any MCP server's tools are,
1519
1559
  "not metered" until you price them. Composio's own meta tools stay refused, and the helper actions that connect an
1520
- account are left off the server's address.
1560
+ account are left off the server's address. Deleting the server in Settings deletes the Composio MCP server it made too, with the saved key (Composio's "already gone" is fine); if Composio refuses or does not answer, the server is still forgotten here, and the `DELETE` answers `200 {deleted: true, composio: {removed: false, note}}` saying what to remove in Composio yourself, which the console shows.
1561
+ [Connect Composio tools and triggers](../../docs/tutorials/composio.md) walks through the preset and a Composio
1562
+ trigger in the console, with each step's API call.
1521
1563
 
1522
1564
  What can go wrong, told apart:
1523
1565
 
@@ -1541,6 +1583,14 @@ data directory's store, which holds no value in the clear. The server does not s
1541
1583
  sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's origin stay the
1542
1584
  same: a saved credential never goes to another origin unless you send it again.
1543
1585
 
1586
+ Each saved server records where its tools come from, `source` and `toolkit`, which a template's `mcp` needs are matched
1587
+ on at apply ([templates](templates/README.md#agentmd)). The source is what made the server, recorded when it is saved
1588
+ and never read off its address or its name: the Composio preset records `composio` and its toolkit, a `github_app`
1589
+ server is `github`/`github`, and any other is `url` with no toolkit until you set one (`toolkit` in the `PUT`, in
1590
+ `POST .../oauth/start` for a server you sign in to, or Settings → MCP servers). A `PUT` with no `toolkit` keeps the
1591
+ record, and `DELETE` removes it with the server. A record counts only for the server it was saved with: a server saved
1592
+ again under the same name after a `DELETE` starts afresh.
1593
+
1544
1594
  `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `unreadable` (sealed
1545
1595
  under another key, or damaged: a `PUT` with the credential seals it again) or `expired` (an OAuth sign-in whose refresh
1546
1596
  its authorization server refused: sign in again), null for `auth.type` none. No read, log line or error shows a
@@ -1639,11 +1689,15 @@ method, tool and whether an `Authorization` header came, never its value.
1639
1689
  ### Agents call a server's tools
1640
1690
 
1641
1691
  An agent grants a saved server's tool by its catalog name, `mcp:<server>/<tool>`, in `definition.tools`
1642
- (`"tools": ["mcp:github/list_issues"]`). A save checks each one against the server's saved tools: a server that is not
1643
- saved, or a tool it did not list, is `422` naming the server's tools, and so is a name whose wire name,
1692
+ (`"tools": ["mcp:github/list_issues"]`). A save lists each server it grants a tool of, once, and checks each grant
1693
+ against that listing: a server that is not saved, or can't be listed right now, is `422` naming it ("save again once it
1694
+ answers"; an edit that grants nothing new from it keeps the agent's current pin for it instead), a tool it does not list
1695
+ is `422` naming the server's tools, and so is a name whose wire name,
1644
1696
  `mcp__<server>__<tool>`, is over 52 characters, or a tool whose `x-mcp-header` declaration cannot be sent (on a
1645
1697
  property not reached through `properties` alone, not a string, integer or boolean, not a header name, or declared twice). pi, claude-agent and codex run them (`features.mcp_client.harnesses`); on
1646
- another harness the save warns that they are not bound there yet, and a run is refused. A workflow's nodes bind no MCP
1698
+ another harness the save warns that they are not bound there yet, and a run is refused. On claude-agent, a run with MCP
1699
+ tools has the Claude CLI's own tool search on: the server's tools reach the model only once its ToolSearch finds them,
1700
+ and the run's other tools load as they always do. A workflow's nodes bind no MCP
1647
1701
  tool yet: a workflow that grants one, in its `tools` or on a node, is `422` ("a workflow's nodes don't bind MCP tools
1648
1702
  here yet; grant it to an agentic agent").
1649
1703
 
@@ -1657,28 +1711,30 @@ action it runs and deny could target none. Reads mark it `grantable: false` with
1657
1711
  `details.not_grantable` (each with its `tool` and `reason`), and a run that pinned one before is refused at its launch. Use the server's direct tools instead:
1658
1712
  each of these providers has a direct mode. The list is closed: a meta tool it doesn't know is an MCP tool like any other,
1659
1713
  asked by default.
1660
-
1661
- - **Pinned.** A run's first launch keeps each granted tool as the server listed it when you saved it (its description
1662
- and schema) and the server's URL then, in the run's directory (`mcp-tools.json`). A refresh or a new save never
1663
- changes a running agent's tools. If the server's URL has changed since, that run's calls answer "the server's
1714
+ A saved server's read also gives each tool its `grant_problems` when a grant of it is refused where it would run, in the words the
1715
+ save's `422` says: under `*` for every harness (its wire name `mcp__<server>__<tool>` is past the 52 characters every harness's
1716
+ tool names share), or under a harness id when that harness's own MCP client would drop or retype its schema.
1717
+
1718
+ - **Pinned.** The save keeps each granted tool on the new revision as the server listed it then (its name,
1719
+ description, input schema, annotations and price) with the server's URL then, shown as the agent's `mcp_pin` (never
1720
+ the URL); each run of that revision calls those tools, and no run lists the server. A refresh never changes a
1721
+ revision's tools; saving the agent again re-pins (an unchanged definition whose server changed a granted
1722
+ tool is a new revision). A server that keeps no credential of its own (`per_run`), or an OAuth server, that refuses the
1723
+ save's listing for its credential is pinned as its last save or refresh listed it. If the server's URL has changed since, that run's calls answer "the server's
1664
1724
  address changed since this run started" and nothing is sent, the new credential least of all.
1665
1725
  - **The credential.** A run whose revision grants a server's tool is handed that server's credential at each launch
1666
1726
  (so a new one counts at the next), over its secrets pipe, never its environment; a run that grants none of a
1667
1727
  server's tools gets none of it. It stays in the run's process: no harness's CLI, file or log holds it, and a run
1668
1728
  that writes it into a learned note is refused by the secret scan.
1669
- - **pi** binds each granted tool in the run's process as `mcp__<server>__<tool>`, with the pinned description and
1670
- schema, and calls the server from there.
1671
- - **claude-agent** uses the Claude CLI's own MCP client: one HTTP server entry per granted server at the session's
1672
- model proxy, `/mcp/<server>`, behind the session's key, sent over the CLI's stdin (never its arguments), with only
1673
- those servers (`strictMcpConfig`) and only the granted tools allowed. The proxy answers the MCP exchange itself and
1674
- makes the call with the credential. The CLI's tool search is off in such a session, so the granted tools are
1675
- offered whole. The proxy answers the handshake and the tool list itself, so a remote server that can't be reached
1676
- shows at the first call, as that call's error; only a proxy route the CLI can't connect to fails the turn.
1677
- - **codex** uses Codex's own MCP client the same way: the harness writes each granted server in Codex's
1678
- `mcp_servers` (an agent's own `config` still may not), at the session's model proxy with the session's key, with
1679
- only the granted tools enabled. Each call runs without Codex asking (`default_tools_approval_mode = "approve"`): the
1680
- proxy is the gate. Codex sends a call as soon as it starts it, so the proxy records the call in the session before
1681
- it sends anything. Each server is `required`, but the proxy answers its handshake, so a remote server that can't be reached shows at the first call, as that call's error; only a proxy route Codex can't reach fails the turn. A tool whose schema Codex would drop or retype (a `not`, `patternProperties`, ...) is `422` at the save, naming the place and why.
1729
+ - **Every harness** gets each granted tool as a host tool, `mcp__<server>__<tool>`, with the pinned description and
1730
+ schema, on its own channel for host tools: pi binds it in the run's process, claude-agent serves it from its `hands`
1731
+ MCP server (`mcp__hands__mcp__<server>__<tool>`; the CLI's tool search is off in such a session, so the granted tools
1732
+ are offered whole), codex hands it to Codex as a dynamic tool named `mcp_<server>__<tool>` (Codex refuses a
1733
+ dynamic tool named `mcp__*`), and opencode serves it from its `hands` MCP server. No harness's own MCP client is
1734
+ handed a server. Each call passes the run's one tool gate before anything is sent, is booked and recorded like any
1735
+ host tool, and the runner calls the server with the credential: a call set to ask parks the run with nothing sent,
1736
+ and the claim that resumes it runs the call once on the person's allow, or refuses it in their words. A tool whose
1737
+ schema Codex would drop or retype (a `not`, `patternProperties`, ...) is `422` at the save, naming the place and why.
1682
1738
  - **A call** goes to the pinned URL alone, the 2026-07-28 revision first and a 2025-era server through its
1683
1739
  `initialize`; on 2026-07-28 each `x-mcp-header` parameter of the pinned tool is sent as its `Mcp-Param-*` header. No
1684
1740
  redirect is followed, at most 4 MiB is read, and it may take 120 s. The
@@ -1708,7 +1764,17 @@ asked by default.
1708
1764
  list of 1 to 16 of them, the argument one of the list, compared strictly:
1709
1765
  `{"mcp:slack/slack_send_message": {"permission": "allow", "pin": {"channel_id": "C0123"}}}`,
1710
1766
  `{"mcp:github/pull_request_review_write": {"pin": {"event": [null, "COMMENT"], "method": ["create", "delete_pending", "submit_pending"]}}}`
1711
- (the `code-review` template's pin). The gate checks a pinned
1767
+ (the `code-review` template's pin). An object argument may be pinned to its keys instead: `{"keys": [...]}`, 1 to 16
1768
+ key names, holds a call whose argument, when given, is an object of those keys alone, any values (left out or `null`
1769
+ holds too), so `{"mcp:hubspot/HUBSPOT_UPDATE_CONTACT": {"pin": {"properties": {"keys": ["hs_lead_score"]}}}}` lets a
1770
+ write set that one field and no other, and refuses one that sets another with "properties keys in (hs_lead_score)".
1771
+ Two layers' keys pins of one argument hold as the keys in both. A pinned tool takes only its listed arguments: a
1772
+ call of a tool with a pin in either layer may carry only the top-level arguments its listing declares under its
1773
+ inputSchema's `properties` (the listing the run pinned when it started, the one its model is offered), beside the
1774
+ pinned ones. So an alias a server takes for a pinned argument, one its listing does not declare (Gmail's `to` for
1775
+ `recipient_email`, Slack's `channel_id` for `channel`), is refused with "`to` is not an argument of
1776
+ GMAIL_SEND_EMAIL; a pinned tool takes only its listed arguments (recipient_email is pinned)", and a pin need not
1777
+ null aliases by hand. A listing with no `properties` object closes nothing, and a tool with no pin is not closed. The gate checks a pinned
1712
1778
  tool's call before it runs or asks anyone, whatever the permission (an allow, an ask, a grant): a call whose arguments
1713
1779
  are not as pinned is refused, never sent and never asked about, and the model reads "mcp:slack/slack_send_message may
1714
1780
  only be called with channel_id = C0123: its destination is fixed by the agent's settings". The run's process logs a
@@ -2106,7 +2172,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2106
2172
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
2107
2173
  | `GET /openapi.json` | Without a credential: this API as an OpenAPI 3.1 document, the `agentrun.v2/0` contract (vendored in `src/openapi/`, its source in `info`) with this server's own routes marked `x-agentrun-serve` the operations it answers `501` marked `x-agentrun-serve-unsupported`, and a contract operation that takes more than the contract gives marked `x-agentrun-serve-changed` with each change named; `links.openapi` in capabilities points at it. |
2108
2174
  | `GET /capabilities` | Without a credential. `backend: local`, every feature flag present and true only when it works; `tools`, the tools an agentic revision may name; `workflows`, what a workflow revision's model nodes get and, in `workflows.decisions.providers`, the decision providers its typed questions run on; `models`, where models come from and the model of each tier. |
2109
- | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), `max_tool_calls` (agentic only, on pi): the tool calls each conversation of a run may make ([tool-call budget](#tool-call-budget)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
2175
+ | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
2110
2176
  | `PUT /agents/{id}/definition` | The same body, checked [the same way](#models): a new revision, its parent the current one, made current. Without `skills` the current revision's skill files carry over. A definition that is the current revision already writes nothing, so a PUT sent twice makes one revision. An agent's id, name and description stay those it was made with. `If-Match` that is not the current ETag is `412 precondition_failed`; the store compares it again inside the commit, so of two edits that read the same revision exactly one lands. The contract's body is taken too: the definition itself, with `If-Match` required (`412` without it) and `definition.version` greater than the current one (`422`). Any such version is taken, and always makes a new revision, the same definition included; the revision is numbered as this server numbers them, the next, and the answer says which; the route reads a body holding `definition` as this one, any other as the contract's. |
2111
2177
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
2112
2178
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
@@ -2988,7 +3054,13 @@ where thinking takes one (Anthropic's, 1,024, the budget squeezed to it at the l
2988
3054
  budget, since its reasoning then shares the limit (minimal 1,024, low 2,048, medium 8,192, high 16,384). The input bound is one token per UTF-8 byte of what is sent (a byte-level tokenizer never makes
2989
3055
  a token of less than one byte), each image counted at what its model's provider bills it by its size in place of its
2990
3056
  base64's bytes, plus what the provider adds server-side (a tool-use prompt), from the same table the model proxy of
2991
- claude-agent, codex and opencode uses; there the proxy measures each request's body. On a route straight to Anthropic
3057
+ claude-agent, codex and opencode uses; there the proxy measures each request's body. On codex and opencode (the
3058
+ Responses API) the text the model reads as it is (a message, a call's arguments, a tool's output, a reasoning summary)
3059
+ counts at its own bytes, not the JSON escapes around it (`\"`, `\n`), which no token is billed for; tool definitions and
3060
+ encrypted reasoning keep every byte. On a route straight to OpenAI (`https://api.openai.com`, codex and opencode), each
3061
+ answer request is also counted by OpenAI's own token count (`POST /v1/responses/input_tokens`, with only the credential
3062
+ and account headers, and never through a gateway or any other base), and its bound is that count when it is below the
3063
+ byte bound. On a route straight to Anthropic
2992
3064
  (`https://api.anthropic.com`, on pi and claude-agent), each answer request is also counted by Anthropic's own free
2993
3065
  token count (`POST /v1/messages/count_tokens`, with only the credential and version headers, and never through a
2994
3066
  gateway or any other base), and its bound is that count plus the tool-use prompt when that is below its bytes. A count
@@ -3011,8 +3083,8 @@ CLI's measured 6,926 bytes with five tools: $0.04 for its first request through
3011
3083
  once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on. (In `strict` mode through a gateway, a run a cent under the five-step figure is not parked before its last step: the cap's wrap-up refuses its last screenshot, and the run answers from what it has.)
3012
3084
  `packages/serve/test/cap-minimum.test.mjs` holds these figures to what the cap does. A request in flight holds what it was admitted at until it answers, so requests
3013
3085
  sent side by side cannot pass the cap together. Spent so far is read from the run's store each time its process starts, so it
3014
- survives a restart, plus each response since, and with them each charge a paid tool booked (`monid.run`, which is itself
3015
- refused once the spend reaches the cap; see [monid](#tools)).
3086
+ survives a restart, plus each response since, and with them each charge a paid tool booked (a monid endpoint's call, which is itself
3087
+ refused once the spend reaches the cap; see [monid](#monid)).
3016
3088
 
3017
3089
  The `browser` tool's session time is held the same way, before it runs, so no browser minute passes the cap. Its next
3018
3090
  stretch is the most a session can run before the run can check again: the provider's minimum (what its release may top
@@ -3168,13 +3240,13 @@ its held worst case.
3168
3240
 
3169
3241
  ### A workflow run under its cap
3170
3242
 
3171
- A workflow run is capped by the same checks, in its own process, each before the paid step is sent:
3243
+ A workflow run is capped by the same checks, on the run's one ledger (the kernel cap), each before the paid step is sent:
3172
3244
 
3173
3245
  | Step | Held at | Where |
3174
3246
  |---|---|---|
3175
- | A model node's request | its expected cost, as an agentic run's request | the run's models (`cap.ts` capModels) |
3247
+ | A model node's request | its expected cost, as an agentic run's request | the run's ledger |
3176
3248
  | A call node's `llm` call | the same | the same, as a side request |
3177
- | A call node's paid tool call (Parallel's search or extract) | its fee | `paidCall`, as an agentic run's |
3249
+ | A call node's paid tool call (Parallel's search or extract) | its fee | the run's ledger, as an agentic run's |
3178
3250
  | A decision on Parallel | its list price for one request, $0.001 | before the driver admits it (`decision-cap.ts`) |
3179
3251
  | A decision on Jev | TypeSafe's published price, $0.042 a million input tokens, one token a byte of its state and questions | the same |
3180
3252
  | A decision on an OpenRouter Decisions model | its catalog price: per request, per image, per input token, and per output token for 256 a question (`expected`) or the catalog's most (`strict`) | the same |
@@ -3194,15 +3266,6 @@ OpenRouter Decisions model the catalog lists no price for: `409 agent_not_runnab
3194
3266
  node's label and its fix. A step no cap fixes all the same (a spend no one knows) ends the run `failed`,
3195
3267
  `spend_cap_reached`, in the cap's words, after the node's label.
3196
3268
 
3197
- ## Tool-call budget
3198
-
3199
- An agentic definition's `max_tool_calls: N` gives each conversation of its runs on pi N tool calls: the run's own, and
3200
- each conversation a tool opens, counted apart. Past N the run's tool gate refuses every call before it runs, before
3201
- any setting or approval is read, with one fixed text: the budget is spent, don't call another tool, answer now from
3202
- what you have. That refusal is not counted and never ends the run, so the model's next answer is the turn's. The count
3203
- is read from the conversation's committed journal, so a restart or a claim moved to another runner keeps it. Above 0
3204
- sets the budget, 0 clears it, an edit that leaves it out keeps it; a workflow's, or one on another harness, is `422`.
3205
-
3206
3269
  ## The faux model
3207
3270
 
3208
3271
  `--faux MODULE` loads `MODULE` in each run's process. Its default export is called for every model request with the
@@ -3289,7 +3352,7 @@ carries no cost at all, as from a provider that does not price the model. The te
3289
3352
  `SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
3290
3353
  `keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
3291
3354
  run needs are read from the store at its claim, opened with the seal key, and are put on that run's environment alone.
3292
- It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
3355
+ It gets none of the boxes' keys ([Sandbox](#sandbox)). A tool key reaches it only when its
3293
3356
  revision names a tool the key unlocks (`MONID_API_KEY` a monid tool, `BROWSERBASE_API_KEY` and `KERNEL_API_KEY` `browser`; a workflow's
3294
3357
  tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
3295
3358
  from the revision at each claim, a resume after a restart included.
@@ -41,8 +41,8 @@ export type AgenticBody = {
41
41
  approvals?: "never";
42
42
  maxCostUsd?: number;
43
43
  capMode?: string;
44
+ inputSchema?: Record<string, unknown>;
44
45
  outputSchema?: Record<string, unknown>;
45
- maxToolCalls?: number;
46
46
  checkout?: "pull_request";
47
47
  };
48
48
  export type WorkflowBody = {
@@ -1,4 +1,4 @@
1
- import { type AgentRow, type NewRevision, type RevisionPlace, type RevisionRow, type Store } from "./store/index.js";
1
+ import { type AgentRow, type NewRevision, type RevisionPlace, type RevisionRow, type Store, type TemplatePackage } from "./store/index.js";
2
2
  import { type DefinitionBody, type Json } from "./validate.js";
3
3
  /** A UUIDv7: time-ordered, so a listing by (created_at, id) is stable, and unique per revision and per minted agent. Two
4
4
  * minted in one millisecond keep their order: the 12 bits after the time count them up (RFC 9562's monotonic counter),
@@ -16,6 +16,8 @@ export type AgentEntry = {
16
16
  version: number;
17
17
  revisions: number;
18
18
  sizes: Map<string, number>;
19
+ /** The template package it was applied from, as its first revision keeps it; absent or null for one made otherwise. */
20
+ template?: TemplatePackage | null;
19
21
  };
20
22
  /** Refuses a write to an externally owned agent: one that mirrors an agent in another system (its `externalRef` set) is
21
23
  * read-only here — its source is the truth, which writes a new version by running it. Edits, set-current and archive are
@@ -36,6 +38,15 @@ export declare const externalKey: ({ source, kind, id }: ExternalRef) => string;
36
38
  export declare function externalOf(agent: AgentRow, revision: RevisionRow | null): (ExternalRef & {
37
39
  version: string | null;
38
40
  }) | null;
41
+ /** What a save's check stamps on the revision it let through: its MCP pin (the granted MCP tools as their servers listed
42
+ * them at this save), when it grants any. */
43
+ export type SaveStamp = {
44
+ readonly mcpPin?: unknown;
45
+ };
46
+ /** A save's check (server.ts saveable): it sees the revision before anything is written, may refuse it, and answers what
47
+ * to stamp on it. `on`: the revision this save is built on (an edit's: the agent's current one as this try read it, so a
48
+ * retry on a newer one sees that one; null for a new agent), whose MCP pin a server that can't be listed keeps. */
49
+ export type SaveCheck = (revision: NewRevision, on: RevisionRow | null) => Promise<SaveStamp | void>;
39
50
  /** The agent `id` as an entry, or null when there is no such agent: its row, its current revision (by the agent row's
40
51
  * current_revision), that revision's number (newest is the count), and the skill sizes. */
41
52
  export declare function getAgent(store: AgentsStore, id: string): Promise<AgentEntry | null>;
@@ -47,11 +58,12 @@ export declare function listAgents(store: AgentsStore, options?: {
47
58
  * here is 409 agent_exists. `check` sees the revision before anything is written and may refuse it (a workflow's own
48
59
  * check). `fresh`: the place and tools a new agent that names none is saved with (an agentic definition alone). */
49
60
  export declare function createAgent(store: AgentsStore, { definition, skills, note }: DefinitionBody, options?: {
50
- check?: (revision: NewRevision) => Promise<void>;
61
+ check?: SaveCheck;
51
62
  fresh?: {
52
63
  place: RevisionPlace;
53
64
  tools: readonly string[];
54
65
  };
66
+ template?: TemplatePackage;
55
67
  }): Promise<AgentEntry>;
56
68
  /** NewRevision from a definition and its skill files, with its note kept (note is not part of the body or its dedup). A
57
69
  * body the validator refuses is mapped to an input refusal here (never thrown raw). Nothing is written: POST /runs makes
@@ -70,7 +82,7 @@ export declare function makeRevision(definition: Json, files: Record<string, str
70
82
  * revision it does not follow. `contract`: an edit that always makes a new revision, even one equal to the current. */
71
83
  export declare function commitAgent(store: AgentsStore, read: AgentEntry, { definition, skills, note }: DefinitionBody, { ifCurrent, check, contract }?: {
72
84
  ifCurrent?: string | null;
73
- check?: (revision: NewRevision) => Promise<void>;
85
+ check?: SaveCheck;
74
86
  contract?: boolean;
75
87
  }): Promise<AgentEntry>;
76
88
  /** Makes `revisionId`, one of the agent's own, its current one (POST /agents/{id}/current). */
@@ -112,9 +124,18 @@ export declare function agentView(entry: AgentEntry, origin: string, extra?: {
112
124
  } | undefined;
113
125
  definition: Json | null;
114
126
  kind: string | null;
127
+ mcp_pin: Record<string, {
128
+ tools: Record<string, unknown>[];
129
+ prices?: Record<string, number>;
130
+ }> | null;
115
131
  revision: string | null;
116
132
  revisions: number;
117
133
  source: null;
134
+ template: {
135
+ id: string;
136
+ version: string;
137
+ sha: string | null;
138
+ } | null;
118
139
  skills: {
119
140
  path: string;
120
141
  sha256: string;
@@ -149,4 +170,15 @@ export declare function revisionView(agent: AgentRow, row: RevisionRow & {
149
170
  note: string | null;
150
171
  created_at: string;
151
172
  definition: Json;
173
+ mcp_pin: Record<string, {
174
+ tools: Record<string, unknown>[];
175
+ prices?: Record<string, number>;
176
+ }> | null;
152
177
  };
178
+ /** A revision's MCP pin as the API shows it: per server, the granted tools as the server listed them when the revision was
179
+ * saved (name, title, description, input schema, annotations) and the prices its owner set for them; null when it grants
180
+ * no MCP tool. Never the server's URL, whose path or query may be a secret. */
181
+ export declare function pinView(pin: unknown): Record<string, {
182
+ tools: Record<string, unknown>[];
183
+ prices?: Record<string, number>;
184
+ }> | null;