@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
@@ -0,0 +1,99 @@
1
+ // A tool's catalog name, read and written in one place: the grammar every place that takes one holds it to (an agent's
2
+ // grant, the tool settings, a learned workflow, a template's manifest and evals, the API's schemas). A catalog name is
3
+ // <tool> a tool of this server (`read`, `web_fetch`, `decisions.jev`)
4
+ // <source>:<group>/<action> one tool of a source: `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`
5
+ // <source>:<group>/* every tool of a group (a settings key, and a grant read against its listing)
6
+ // An MCP server's name is lowercase letters, digits and `-`, starting with a letter, at most 32 (no `_`, so
7
+ // `mcp__<server>__<tool>` splits one way). An MCP tool's own name is letters, digits, `_` and `-`, at most 64: the
8
+ // characters the model APIs take in a tool's name, so there is one charset, and a name one place takes no other refuses.
9
+ // A monid provider's slug and an endpoint's path are monid's own (its listing, GET /v1/endpoints): a slug is lowercase
10
+ // letters, digits, `.` and `-` (`apollo`, `api.strale.io`); an endpoint is its path less the leading `/`, in letters,
11
+ // digits and `-._:{}/` (`people/match`, `people/{id}`). Its wire name is catalog.ts wireName's, hashed when long.
12
+ import { WIRE_NAME } from "./catalog.js";
13
+ const SERVER = "[a-z][a-z0-9-]{0,31}";
14
+ const TOOL = "[A-Za-z0-9_-]{1,64}";
15
+ const PROVIDER = "[a-z0-9][a-z0-9.-]{0,63}";
16
+ const ENDPOINT = "[A-Za-z0-9_.:{}-][A-Za-z0-9_.:{}/-]{0,199}";
17
+ const PLAIN = `[a-z][a-z0-9_-]{0,63}(?:\\.${TOOL})?`;
18
+ const MCP_PREFIX = "mcp:";
19
+ const MONID_PREFIX = "monid:";
20
+ const ALL = "*";
21
+ /** An MCP server's name. */
22
+ export const MCP_SERVER_NAME = new RegExp(`^${SERVER}$`);
23
+ /** An MCP tool's own name, as its server lists it. */
24
+ export const MCP_TOOL_NAME = new RegExp(`^${TOOL}$`);
25
+ /** A catalog tool's name, as a JSON Schema pattern (openapi.ts): `mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`,
26
+ * or either's wildcard. */
27
+ export const CATALOG_KEY_PATTERN = `^(?:mcp:${SERVER}/(?:\\*|${TOOL})|monid:${PROVIDER}/(?:\\*|${ENDPOINT}))$`;
28
+ const MCP_NAME = new RegExp(`^mcp:(${SERVER})/(\\*|${TOOL})$`);
29
+ const MONID_NAME = new RegExp(`^monid:(${PROVIDER})/(\\*|${ENDPOINT})$`);
30
+ const PLAIN_NAME = new RegExp(`^${PLAIN}$`);
31
+ /** Catalog name `name` read, or undefined for one outside the grammar. */
32
+ export function parseToolName(name) {
33
+ if (isMonidName(name)) {
34
+ const match = MONID_NAME.exec(name);
35
+ if (!match)
36
+ return undefined;
37
+ return match[2] === ALL ? { kind: "monid-provider", provider: match[1] } : { kind: "monid", provider: match[1], endpoint: match[2] };
38
+ }
39
+ if (!isMcpName(name))
40
+ return PLAIN_NAME.test(name) ? { kind: "plain", name } : undefined;
41
+ const match = MCP_NAME.exec(name);
42
+ if (!match)
43
+ return undefined;
44
+ return match[2] === ALL ? { kind: "mcp-server", server: match[1] } : { kind: "mcp", server: match[1], tool: match[2] };
45
+ }
46
+ /** The catalog name of `name`: parseToolName's inverse. */
47
+ export function formatToolName(name) {
48
+ if (name.kind === "plain")
49
+ return name.name;
50
+ if (name.kind === "monid" || name.kind === "monid-provider")
51
+ return `${MONID_PREFIX}${name.provider}/${name.kind === "monid" ? name.endpoint : ALL}`;
52
+ return `${MCP_PREFIX}${name.server}/${name.kind === "mcp" ? name.tool : ALL}`;
53
+ }
54
+ /** Whether `name` is in monid's namespace (`monid:`), well formed or not, as isMcpName is for MCP's. */
55
+ export const isMonidName = (name) => name.startsWith(MONID_PREFIX);
56
+ /** Whether `name` is a third-party catalog's (MCP's or monid's), well formed or not: its default is ask. */
57
+ export const isCatalogName = (name) => isMcpName(name) || isMonidName(name);
58
+ /** Why `name`, in monid's namespace, is refused as a grant by its name alone. */
59
+ export const MONID_NAME_WORDS = (name) => `${name} is not a monid endpoint's name: monid:<provider>/<endpoint> or monid:<provider>/*, the provider's slug (lowercase letters, digits, . and -) and the endpoint's path without its first / (letters, digits and -._:{}/), as monid lists them.`;
60
+ /** One monid endpoint's catalog name read (`monid:<provider>/<endpoint>`), or undefined for any other name. */
61
+ export function monidNameOf(name) {
62
+ const parsed = parseToolName(name);
63
+ return parsed?.kind === "monid" ? { provider: parsed.provider, endpoint: parsed.endpoint } : undefined;
64
+ }
65
+ /** One MCP tool's catalog name, `mcp:<server>/<tool>`: what the gate, the pin and the timeline key its calls by. */
66
+ export const mcpToolName = (server, tool) => formatToolName({ kind: "mcp", server, tool });
67
+ /** Whether `name` is in MCP's namespace (`mcp:`), well formed or not: a name MCP's checks answer for, so one that does
68
+ * not parse is refused in MCP's words, and the gate's default for it is MCP's (ask), never a built-in's. */
69
+ export const isMcpName = (name) => name.startsWith(MCP_PREFIX);
70
+ /** One MCP tool's catalog name read (`mcp:<server>/<tool>`), or undefined for any other name, a server's wildcard too. */
71
+ export function mcpNameOf(name) {
72
+ const parsed = parseToolName(name);
73
+ return parsed?.kind === "mcp" ? { server: parsed.server, tool: parsed.tool } : undefined;
74
+ }
75
+ /** The MCP server `name` names, one of its tools or its wildcard; undefined for any other name. */
76
+ export function mcpServerOf(name) {
77
+ const parsed = parseToolName(name);
78
+ return parsed?.kind === "mcp" || parsed?.kind === "mcp-server" ? parsed.server : undefined;
79
+ }
80
+ /** Whether `name` is an MCP server's wildcard, `mcp:<server>/*`. */
81
+ export const isMcpWildcard = (name) => parseToolName(name)?.kind === "mcp-server";
82
+ /** Why a grant of an MCP server's tool is refused by its name alone, said after the grant (`mcp:<server>/<tool> ...`): the
83
+ * one place the console's picker and the save's blockers (runnable.ts) both read it. `hands` is the harnesses' own tools'
84
+ * server. */
85
+ export const MCP_HANDS_WORDS = "names the MCP server hands, a name the harnesses keep for their own tools: save the server under another name.";
86
+ /** Why `mcp__<server>__<tool>`, the name every harness calls the tool by, is not within the budget their names share
87
+ * (52 characters of letters, digits, `_` and `-`), or undefined when it is. */
88
+ export function mcpWireProblem(server, tool) {
89
+ const wire = `mcp__${server}__${tool}`;
90
+ return WIRE_NAME.test(wire) ? undefined : `is too long: ${wire} must be at most 52 characters, the budget every harness's tool names share.`;
91
+ }
92
+ /** MCP_HANDS_WORDS or mcpWireProblem's, whichever refuses the name; undefined when neither does. */
93
+ export const mcpGrantNameProblem = (server, tool) => (server === "hands" ? MCP_HANDS_WORDS : mcpWireProblem(server, tool));
94
+ /** Why a harness's own MCP client drops or retypes `tool` of `server` (its facts' schemaProblems, `dropped` the first):
95
+ * the words a save's blocker and a saved server's read both say. */
96
+ export const mcpDroppedWords = (server, tool, harness, dropped) => `The MCP server ${server}'s tool ${tool} cannot be offered on ${harness}: ${dropped.replace(/^mcp__\S+: /, "")}.`;
97
+ /** Why the harness drops or retypes the pinned monid endpoint `tool`'s input (its facts' schemaProblems, `dropped` the
98
+ * first, under the endpoint's wire name): the words a save refuses its grant with. */
99
+ export const monidDroppedWords = (tool, harness, dropped) => `The monid endpoint ${tool} cannot be offered on ${harness}: ${dropped.replace(/^monid__\S+: /, "")}. Grant its provider's other endpoints by name, or pick another harness.`;
@@ -2,13 +2,14 @@ import type { InputIssue } from "./errors.js";
2
2
  import type { Settings } from "./store/index.js";
3
3
  import { type HarnessId } from "./harness.js";
4
4
  import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
5
- import { type Permission, type Pin } from "./tool-gate.js";
5
+ import { type Permission, type Pin, type ToolEffect } from "./tool-gate.js";
6
6
  import { type BashPolicy } from "./bash-read-only.js";
7
7
  /**
8
8
  * The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
9
9
  * table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
10
10
  * provider (PROVIDERS); the rest are the kernel's own. Not capabilities: the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
11
- * never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
11
+ * never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
12
+ * catalog grants).
12
13
  */
13
14
  export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
14
15
  /** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
@@ -27,24 +28,23 @@ export declare const PROVIDERS: Readonly<{
27
28
  }>;
28
29
  export type Pickable = keyof typeof PROVIDERS;
29
30
  export declare const PICKABLE: Pickable[];
30
- /** Every tool of serve's table (tools.ts), by name, so this module needs no import of it: a test holds the two as one. */
31
- export declare const TABLE_TOOLS: readonly string[];
32
- /** The tools whose approved call the kernel runs itself, outside the model's turn (host-tools.ts's REPLAY): ask is
33
- * offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
34
- * run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
35
- export declare const ASKABLE: readonly string[];
36
- /** The permissions `name` may be set to. */
31
+ /** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
32
+ * the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
33
+ * allow or deny. */
37
34
  export declare const permissionsOf: (name: string) => readonly Permission[];
38
35
  /** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
39
36
  * give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
40
37
  * those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
41
- export declare const serverGate: (name: string, settings: ToolSettingsMap) => {
42
- permission: "deny" | "ask" | "allow";
43
- default_permission: "deny" | "ask" | "allow";
44
- permissions: ("deny" | "ask" | "allow")[];
38
+ export declare const serverGate: (name: string, settings: ToolSettingsMap, effect?: ToolEffect) => {
39
+ default_permission: "ask" | "deny" | "allow";
40
+ permissions: ("ask" | "deny" | "allow")[];
41
+ fallback_allow_reads?: true | undefined;
42
+ allow_reads?: true | undefined;
43
+ permission: "ask" | "deny" | "allow";
45
44
  };
46
45
  /** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
47
- * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
46
+ * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
47
+ * `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
48
48
  export declare const SERVE_OWN_TOOLS: readonly string[];
49
49
  /** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
50
50
  * held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
@@ -59,7 +59,8 @@ export declare const DECISION_PROVIDER_KEYS: readonly string[];
59
59
  export type ToolSetting = {
60
60
  provider?: string;
61
61
  permission?: Permission;
62
- pin?: Pin; /** bash's policy, an agent's own only (bash-read-only.ts). */
62
+ pin?: Pin; /** On an MCP server's wildcard (`mcp:<server>/*`) in the server's settings only: the tools its server marks read-only run with no approval (tool-gate.ts readsLift). Kept only when true. */
63
+ allow_reads?: true; /** bash's policy, an agent's own only (bash-read-only.ts). */
63
64
  policy?: BashPolicy; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
64
65
  fallback?: true; /** The stand-in's value as written in the file, which a save that keeps the stand-in writes back (ToolSettings.put). Never shown. */
65
66
  raw?: unknown; /** A pin in the file that does not read (readToolSettings): the gate refuses every call of the tool, and a save keeps it (ToolSettings.put) until the owner sets a valid pin or removes the tool's setting. Served as `pin_broken: true`. */
@@ -71,8 +72,9 @@ export declare const MAX_PIN_TEXT = 1024;
71
72
  /** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
72
73
  * entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
73
74
  * top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
74
- * true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list (sortedPin
75
- * is its one form). With
75
+ * true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list, or
76
+ * `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
77
+ * nothing else in it (sortedPin is its one form). With
76
78
  * `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
77
79
  * whose tools take other arguments, nor any other tool's. */
78
80
  export declare function pinIssues(pin: unknown, at: string, key?: string): InputIssue[];
@@ -277,19 +279,19 @@ export declare function shellUnavailable(name: string, shell: ShellPlace): Resol
277
279
  * provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
278
280
  * it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
279
281
  * computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
280
- export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace): ({
282
+ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace, effectOf?: (name: string) => ToolEffect | undefined): ({
281
283
  resolved: Resolution;
282
- permission: "deny" | "ask" | "allow";
284
+ permission: "ask" | "deny" | "allow";
283
285
  permission_from: import("./refusal-words.js").SettingFrom;
284
- default_permission: "deny" | "ask" | "allow";
285
- permissions: ("deny" | "ask" | "allow")[];
286
+ default_permission: "ask" | "deny" | "allow";
287
+ permissions: ("ask" | "deny" | "allow")[];
286
288
  blurb?: string | undefined;
287
289
  name: string;
288
290
  } | {
289
- permission: "deny" | "ask" | "allow";
291
+ permission: "ask" | "deny" | "allow";
290
292
  permission_from: import("./refusal-words.js").SettingFrom;
291
- default_permission: "deny" | "ask" | "allow";
292
- permissions: ("deny" | "ask" | "allow")[];
293
+ default_permission: "ask" | "deny" | "allow";
294
+ permissions: ("ask" | "deny" | "allow")[];
293
295
  blurb?: string | undefined;
294
296
  name: string;
295
297
  } | {
@@ -297,10 +299,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
297
299
  provider_from: string;
298
300
  default_provider: string;
299
301
  resolved: Resolution;
300
- permission: "deny" | "ask" | "allow";
302
+ permission: "ask" | "deny" | "allow";
301
303
  permission_from: import("./refusal-words.js").SettingFrom;
302
- default_permission: "deny" | "ask" | "allow";
303
- permissions: ("deny" | "ask" | "allow")[];
304
+ default_permission: "ask" | "deny" | "allow";
305
+ permissions: ("ask" | "deny" | "allow")[];
304
306
  blurb?: string | undefined;
305
307
  name: string;
306
308
  })[];
@@ -19,7 +19,8 @@
19
19
  // harness's own search (inside its CLI, where no call can wait for a person) gives way to the kernel's. A run is never
20
20
  // told a deny: its Plane resolves a denied capability as under ask, and the gate, which reads the permission at each
21
21
  // call, is the one place that refuses it, so a deny lifted mid-run is lifted at the next call.
22
- import { blurbOf } from "./tool-blurbs.js";
22
+ import { META_TOOLS } from "./meta-tool-names.js";
23
+ import { blurbOf, isAskable, isTableTool, tableTools } from "./tool-list.js";
23
24
  import { PROVIDERS as COMPUTER_PROVIDERS } from "@parcha/agentrun-computer";
24
25
  import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
25
26
  import { keyNeeded } from "./key-words.js";
@@ -29,13 +30,15 @@ import { viaOpenRouter, WIRES } from "./provider.js";
29
30
  import { savedIn } from "./secrets.js";
30
31
  import { hostModel } from "./model.js";
31
32
  import { NEEDS_A_COMPUTER, NO_SHELL } from "@parcha/agentrun-kernel/kernel";
32
- import { canonicalPin, defaultPermission, isCatalogTool, isMcpTool, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS, permissionFrom, permissionOf, SETTINGS_UNREAD, SHELL_FAMILY } from "./tool-gate.js";
33
+ import { canonicalPin, defaultPermission, isCatalogTool, isPinKeys, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS, permissionFrom, permissionOf, SETTINGS_UNREAD, SHELL_FAMILY } from "./tool-gate.js";
33
34
  import { BASH_POLICIES } from "./bash-read-only.js";
35
+ import { isMcpName, mcpNameOf, parseToolName } from "./tool-names.js";
34
36
  /**
35
37
  * The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
36
38
  * table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
37
39
  * provider (PROVIDERS); the rest are the kernel's own. Not capabilities: the workflow call nodes' `pdf_pages` and `llm` (a workflow's call node names them, a grant
38
- * never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
40
+ * never does), and a catalog's tools (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`: catalog tools, which their
41
+ * catalog grants).
39
42
  */
40
43
  export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
41
44
  /** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
@@ -49,21 +52,36 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
49
52
  * (browserBy). */
50
53
  export const PROVIDERS = Object.freeze({ web_search: ["auto", "native", "exa-keyless", "parallel", "off"], web_fetch: ["kernel", "parallel"], browser: Object.freeze(["auto", ...browserProviderIds(), "chrome"]) });
51
54
  export const PICKABLE = Object.keys(PROVIDERS);
52
- /** Every tool of serve's table (tools.ts), by name, so this module needs no import of it: a test holds the two as one. */
53
- export const TABLE_TOOLS = ["read", "write", "edit", "bash", "ask_person", "web_fetch", "web_search", "browser", "subagent", "pdf_pages", "llm"];
54
- /** The tools whose approved call the kernel runs itself, outside the model's turn (host-tools.ts's REPLAY): ask is
55
- * offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
56
- * run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
57
- export const ASKABLE = ["read", "write", "edit", "bash", "web_fetch", "web_search", "learned_workflow"];
58
- /** The permissions `name` may be set to. */
59
- export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : ASKABLE.includes(name) || isCatalogTool(name) ? PERMISSIONS : ["allow", "deny"]);
55
+ /** The permissions `name` may be set to: ask is offered for the tools whose approved call the kernel runs itself, outside
56
+ * the model's turn (tool-list.ts `askable`) and for catalog tools. Any other (browser, ask_person, the call-only ones) is
57
+ * allow or deny. */
58
+ export const permissionsOf = (name) => (Object.hasOwn(SHELL_FAMILY, name) && SHELL_FAMILY[name] !== name ? permissionsOf(SHELL_FAMILY[name]) : isAskable(name) || isCatalogTool(name) ? PERMISSIONS : ["allow", "deny"]);
60
59
  /** A tool's permission as this server applies it to an agent that sets none, as capabilities and an MCP server's read
61
60
  * give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
62
61
  * those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
63
- export const serverGate = (name, settings) => ({ permission: permissionOf(name, settings), default_permission: defaultPermission(name), permissions: [...permissionsOf(name)] });
62
+ export const serverGate = (name, settings, effect) => {
63
+ const permission = permissionOf(name, settings, {}, "ask", effect);
64
+ // `allow_reads`: the allow is its server's "allow reads" (a read-only tool's ask lifted), not a setting or a default.
65
+ const lifted = effect === "read" && permission === "allow" && permissionOf(name, settings) === "ask";
66
+ // `fallback_allow_reads`: with no permission on the tool's own key, its server's "allow reads" would lift its ask, so
67
+ // allow is what applies once that setting goes, whatever the setting says now (the console's "allow reads" fallback).
68
+ const unset = effect === "read" ? withoutOwnPermission(name, settings) : undefined;
69
+ const falls = unset !== undefined && permissionOf(name, unset, {}, "ask", effect) === "allow" && permissionOf(name, unset) === "ask";
70
+ return { permission, ...(lifted ? { allow_reads: true } : {}), ...(falls ? { fallback_allow_reads: true } : {}), default_permission: defaultPermission(name), permissions: [...permissionsOf(name)] };
71
+ };
72
+ /** `settings` with no permission on `name`'s own key (its other fields kept), a copy that keeps the map's marks
73
+ * (SETTINGS_UNREAD, carried by the spread). */
74
+ const withoutOwnPermission = (name, settings) => {
75
+ const own = settings[name];
76
+ if (own?.permission === undefined)
77
+ return settings;
78
+ const { permission: _gone, ...kept } = own;
79
+ return { ...settings, [name]: kept };
80
+ };
64
81
  /** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
65
- * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
66
- export const SERVE_OWN_TOOLS = ["learned_workflow"];
82
+ * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL), and the host's
83
+ * `tools_search`, `tools_call` and `codemode` (runner/meta-tools.ts): set to deny, one is not offered to a run. */
84
+ export const SERVE_OWN_TOOLS = ["learned_workflow", ...META_TOOLS];
67
85
  /** A computer kind's tools, one settings key per kind, as `browser` holds the browser's family: every desktop tool is
68
86
  * held to `desktop`, every phone tool to `phone` (the kernel registry's definitions name the key; tool-gate.ts
69
87
  * settingsKeyOf reads it there). Allowed by default like a table tool; allow or deny. */
@@ -74,13 +92,9 @@ export const KIND_KEYS = ["desktop", "phone"];
74
92
  export const DECISION_PROVIDER_KEYS = ["jev", "parallel", "openrouter"];
75
93
  /** A settings key: a tool of the table, one of the run's own tools (SERVE_OWN_TOOLS), a computer kind's (KIND_KEYS), a
76
94
  * decision provider's (DECISION_PROVIDER_KEYS), a
77
- * catalog tool (`monid.<tool>`, `mcp:<server>/<tool>`), or an MCP server's wildcard (`mcp:<server>/*`), which sets each
78
- * of its tools. */
79
- /** A tool's name in an agent's or the server's tool settings: a plain name, a catalog's tool (`monid.discover`), an MCP
80
- * server's tool (`mcp:<server>/<tool>`) or its wildcard (`mcp:<server>/*`). */
81
- const TOOL_KEY = /^(?:[a-z][a-z0-9_-]{0,63}(?:\.[A-Za-z0-9_-]{1,64})?|mcp:[A-Za-z0-9_.-]{1,64}\/(?:\*|[A-Za-z0-9_.-]{1,128}))$/;
82
- const isToolSettingsKey = (name) => TOOL_KEY.test(name);
83
- const isSettingsKey = (name) => isToolSettingsKey(name) && (TABLE_TOOLS.includes(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || DECISION_PROVIDER_KEYS.includes(name) || isCatalogTool(name) || /^mcp:[^/]+\/\*$/.test(name));
95
+ * catalog tool (`mcp:<server>/<tool>`, `monid:<provider>/<endpoint>`), or a group's wildcard (`mcp:<server>/*`,
96
+ * `monid:<provider>/*`), which sets each of its tools. */
97
+ const isSettingsKey = (name) => parseToolName(name) !== undefined && (isTableTool(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || DECISION_PROVIDER_KEYS.includes(name) || isCatalogTool(name));
84
98
  /** The longest pinned string. */
85
99
  export const MAX_PIN_TEXT = 1024;
86
100
  /** A pinned argument's name: a top-level argument of the tool, as MCP tools name theirs. */
@@ -88,12 +102,13 @@ const PIN_ARG = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
88
102
  /** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
89
103
  * entry, the store's revision bodies at the cutover): `pin` under `at`, an object of 1 to MAX_PIN_ARGS of a tool's
90
104
  * top-level arguments (PIN_ARG), each to a JSON scalar (a string of at most MAX_PIN_TEXT characters, a finite number,
91
- * true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list (sortedPin
92
- * is its one form). With
105
+ * true or false, or null: left out) or a list of 1 to MAX_PIN_CHOICES of them, the argument one of the list, or
106
+ * `{keys: [...]}`, 1 to MAX_PIN_CHOICES key names (text of 1 to MAX_PIN_TEXT characters) an object argument may hold,
107
+ * nothing else in it (sortedPin is its one form). With
93
108
  * `key`, the settings key it is set on, which is one MCP tool's own (`mcp:<server>/<tool>`), never a server's wildcard,
94
109
  * whose tools take other arguments, nor any other tool's. */
95
110
  export function pinIssues(pin, at, key) {
96
- if (key !== undefined && (!isMcpTool(key) || /\/\*$/.test(key)))
111
+ if (key !== undefined && !mcpNameOf(key))
97
112
  return [{ field: at, reason: "not_allowed", message: `A pin is set on one MCP tool's own key (mcp:<server>/<tool>), never on ${key}.` }];
98
113
  const entries = typeof pin === "object" && pin !== null && !Array.isArray(pin) ? Object.entries(pin) : undefined;
99
114
  if (!entries || !entries.length || entries.length > MAX_PIN_ARGS)
@@ -102,10 +117,15 @@ export function pinIssues(pin, at, key) {
102
117
  return entries.flatMap(([arg, value]) => {
103
118
  if (!PIN_ARG.test(arg))
104
119
  return [{ field: `${at}.${arg}`, reason: "bad_format", message: `${at} names a top-level argument of the tool (${PIN_ARG.source}); ${JSON.stringify(arg).slice(0, 60)} is none` }];
105
- const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : scalar(value);
106
- return held ? [] : [{ field: `${at}.${arg}`, reason: "wrong_type", message: `${at}.${arg} is a JSON scalar (a string of at most ${MAX_PIN_TEXT} characters, a number, true or false, or null: the argument left out) or a list of 1 to ${MAX_PIN_CHOICES} of them, the argument one of the list` }];
120
+ const held = Array.isArray(value) ? value.length >= 1 && value.length <= MAX_PIN_CHOICES && value.every(scalar) : isPinKeys(value) ? keysRead(value) : scalar(value);
121
+ return held ? [] : [{ field: `${at}.${arg}`, reason: "wrong_type", message: `${at}.${arg} is a JSON scalar (a string of at most ${MAX_PIN_TEXT} characters, a number, true or false, or null: the argument left out) or a list of 1 to ${MAX_PIN_CHOICES} of them, the argument one of the list; or {keys: [<key>, ...]}: 1 to ${MAX_PIN_CHOICES} names (each text of 1 to ${MAX_PIN_TEXT} characters) of the keys an object argument may hold, any values, nothing else beside keys` }];
107
122
  });
108
123
  }
124
+ /** Whether a keys pin's object reads: `keys` alone, a list of 1 to MAX_PIN_CHOICES non-empty texts of at most MAX_PIN_TEXT. */
125
+ const keysRead = (value) => {
126
+ const { keys, ...rest } = value;
127
+ return !Object.keys(rest).length && Array.isArray(keys) && keys.length >= 1 && keys.length <= MAX_PIN_CHOICES && keys.every((key) => typeof key === "string" && key.length >= 1 && key.length <= MAX_PIN_TEXT);
128
+ };
109
129
  /** `pin` in the one form a revision's body keeps (tool-gate.ts canonicalPin): its arguments sorted, each one-of list
110
130
  * de-duplicated and sorted, null first, then by each value's JSON text. Equal meanings are one text, so one revision. */
111
131
  export const sortedPin = (pin) => canonicalPin(pin);
@@ -374,9 +394,9 @@ export function settingsIssues(value, at = "", layer = "server") {
374
394
  return Object.entries(value).flatMap(([name, setting]) => {
375
395
  const pickable = Object.hasOwn(PROVIDERS, name);
376
396
  if (!isSettingsKey(name))
377
- return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...TABLE_TOOLS, ...SERVE_OWN_TOOLS, ...KIND_KEYS, ...DECISION_PROVIDER_KEYS].join(", ")}), catalog tools (monid.<tool>, mcp:<server>/<tool>) and an MCP server's tools (mcp:<server>/*); ${name} is none of them.` }];
397
+ return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...tableTools(), ...SERVE_OWN_TOOLS, ...KIND_KEYS, ...DECISION_PROVIDER_KEYS].join(", ")}), catalog tools (mcp:<server>/<tool>, monid:<provider>/<endpoint>) and a group's tools (mcp:<server>/*, monid:<provider>/*); ${name} is none of them.` }];
378
398
  if (!isPlain(setting))
379
- return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpTool(name) ? ", pin" : ""}${layer === "agent" && name === "bash" ? ", policy" : ""}}` }];
399
+ return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpName(name) ? ", pin" : ""}${layer === "agent" && name === "bash" ? ", policy" : ""}}` }];
380
400
  return Object.entries(setting).flatMap(([key, given]) => {
381
401
  if (key === "pin")
382
402
  return pinIssues(given, field(name, key), name);
@@ -389,10 +409,16 @@ export function settingsIssues(value, at = "", layer = "server") {
389
409
  // The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
390
410
  // sends back: it keeps the broken pin, and nothing else. Never an agent's.
391
411
  if (key === "pin_broken") {
392
- if (layer === "agent" || !isMcpTool(name) || /\/\*$/.test(name))
412
+ if (layer === "agent" || !mcpNameOf(name))
393
413
  return [{ field: field(name, key), reason: "not_allowed", message: `pin_broken is the server's mark of a pin in its tool settings that does not read, on an MCP tool's own key; ${field(name)} keeps no such field.` }];
394
414
  return given === true ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is true, as the server serves it: it keeps the broken pin until a valid pin replaces it` }];
395
415
  }
416
+ // "Allow reads" (tool-gate.ts readsLift): the server's, on an MCP server's wildcard only; false clears it.
417
+ if (key === "allow_reads") {
418
+ if (layer === "agent" || !/^mcp:[^/]+\/\*$/.test(name))
419
+ return [{ field: field(name, key), reason: "not_allowed", message: `allow_reads is set on an MCP server's wildcard (mcp:<server>/*) in this server's tool settings, never ${layer === "agent" ? "in an agent's own" : `on ${name}`}.` }];
420
+ return typeof given === "boolean" ? [] : [{ field: field(name, key), reason: "wrong_type", message: `${field(name, key)} is true (its read-only tools run with no approval) or false` }];
421
+ }
396
422
  if (key === "permission") {
397
423
  // A wildcard sets each tool of its server's: a catalog tool's permissions.
398
424
  const offered = permissionsOf(name);
@@ -414,14 +440,14 @@ export function canonicalToolSettings(map) {
414
440
  return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
415
441
  if (!setting)
416
442
  return [];
417
- const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
443
+ const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
418
444
  return Object.keys(kept).length ? [[name, kept]] : [];
419
445
  })));
420
446
  }
421
447
  /** `map` with each capability's provider, its default where none is picked; a permission where one is set. */
422
448
  export const withDefaults = (map) => ({
423
449
  // As served: what is in force, never the internal mark of a stand-in.
424
- ...Object.fromEntries(Object.entries(map).map(([name, setting]) => [name, setting && { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : {}), ...(setting.brokenPin ? { pin_broken: true } : {}) }])),
450
+ ...Object.fromEntries(Object.entries(map).map(([name, setting]) => [name, setting && { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: setting.pin } : {}), ...(setting.brokenPin ? { pin_broken: true } : {}) }])),
425
451
  ...Object.fromEntries(PICKABLE.map((name) => [name, { provider: map[name]?.provider ?? PROVIDERS[name][0], ...(map[name]?.permission ? { permission: map[name].permission } : {}) }])),
426
452
  });
427
453
  /** An empty settings map marked as standing for settings that do not read (SETTINGS_UNREAD, tool-gate.ts): every reader
@@ -500,7 +526,7 @@ export async function loadToolSettings(store) {
500
526
  * SHELL_WATCHERS). A different permission is a choice, written as given. */
501
527
  export function keptSettings(map, current) {
502
528
  const kept = Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
503
- const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
529
+ const set = { ...(setting?.provider ? { provider: setting.provider } : {}), ...(setting?.permission ? { permission: setting.permission } : {}), ...(setting?.allow_reads === true ? { allow_reads: true } : {}), ...(setting?.pin ? { pin: setting.pin } : {}) };
504
530
  const before = current[name];
505
531
  if (before?.fallback && set.permission === before.permission)
506
532
  Object.assign(set, { fallback: true, raw: before.raw });
@@ -508,7 +534,7 @@ export function keptSettings(map, current) {
508
534
  Object.assign(set, { brokenPin: true, rawPin: before.rawPin });
509
535
  return Object.keys(set).length ? [[name, set]] : [];
510
536
  }));
511
- const written = Object.fromEntries(Object.entries(kept).map(([name, setting]) => [name, { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.fallback ? { permission: setting.raw } : setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : setting.brokenPin ? { pin: setting.rawPin } : {}) }]));
537
+ const written = Object.fromEntries(Object.entries(kept).map(([name, setting]) => [name, { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.fallback ? { permission: setting.raw } : setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads ? { allow_reads: true } : {}), ...(setting.pin ? { pin: setting.pin } : setting.brokenPin ? { pin: setting.rawPin } : {}) }]));
512
538
  return { kept, written };
513
539
  }
514
540
  /** Replaces the server's tool settings in the one store, by keptSettings's rule: a tool `map` leaves out takes its
@@ -538,13 +564,15 @@ export function shellUnavailable(name, shell) {
538
564
  * provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
539
565
  * it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
540
566
  * computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
541
- export function agentTools(env, settings, agent, order, shell = "computer") {
567
+ export function agentTools(env, settings, agent, order, shell = "computer", effectOf = () => undefined) {
542
568
  const plane = planeFor(env, agent, settings);
543
569
  const rank = (name) => order.indexOf(name);
544
570
  return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
545
- const { permission, from } = permissionFrom(name, settings, (agent.overrides ?? {}), agent.approvals ?? "ask");
546
- const gate = { permission, permission_from: from, default_permission: permissionOf(name, settings), permissions: [...permissionsOf(name)] };
547
- // One short line for people (tool-blurbs.ts), as capabilities serves it.
571
+ // An MCP tool's effect as its saved server lists it now (what a run started now pins): "allow reads" reads it.
572
+ const effect = effectOf(name);
573
+ const { permission, from } = permissionFrom(name, settings, (agent.overrides ?? {}), agent.approvals ?? "ask", {}, effect);
574
+ const gate = { permission, permission_from: from, default_permission: permissionOf(name, settings, {}, "ask", effect), permissions: [...permissionsOf(name)] };
575
+ // One short line for people (tool-list.ts), as capabilities serves it.
548
576
  const blurb = blurbOf(name);
549
577
  const shown = { name, ...(blurb ? { blurb } : {}) };
550
578
  // A tool of bash's family the agent's computer gives no shell for: unavailable, in the words its run's call gets.
package/dist/tools.d.ts CHANGED
@@ -222,7 +222,7 @@ export declare const CALL_TOOLS: readonly string[];
222
222
  export declare const allows: (allowed: readonly string[], name: string) => boolean;
223
223
  /** The tools a run's learned workflow may name (learn/check.ts at learn time, learned-workflow.ts at a call): those of the
224
224
  * agent's `granted` tools a workflow's call node runs here (CALL_TOOLS, and each MCP tool granted by its own name,
225
- * skills.ts LEARNED_MCP_TOOL: a wildcard is read against its server's listing first, mcpGrantsListed), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
225
+ * tool-names.ts mcpNameOf: a wildcard is read against its server's listing first, mcpGrantsListed), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
226
226
  * learned model node runs without tools (learn/skills.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
227
227
  * exec_command, apply_patch) is never one, so the DSL refuses a draft that names it. */
228
228
  export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane, options?: LearnedMcp) => string[];
@@ -285,15 +285,17 @@ export declare const missingEnv: (entry: ToolEntry, env: NodeJS.ProcessEnv) => s
285
285
  * that their provider refused at the start (tool-keys-store.ts refused), each with why: a tool that needs one is unavailable,
286
286
  * saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
287
287
  * and the permissions it may be set to. */
288
- export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>, runnerShell?: ReadonlySet<string>) => {
288
+ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>, runnerShell?: ReadonlySet<string>) => ({
289
289
  providers?: string[] | undefined;
290
290
  provider?: string | undefined;
291
291
  default_provider?: string | undefined;
292
292
  resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent", Resolution> | undefined;
293
293
  why?: Record<"opencode" | "codex" | "pi" | "claude-agent", string> | undefined;
294
- permission: "deny" | "ask" | "allow";
295
- default_permission: "deny" | "ask" | "allow";
296
- permissions: ("deny" | "ask" | "allow")[];
294
+ default_permission: "ask" | "deny" | "allow";
295
+ permissions: ("ask" | "deny" | "allow")[];
296
+ fallback_allow_reads?: true | undefined;
297
+ allow_reads?: true | undefined;
298
+ permission: "ask" | "deny" | "allow";
297
299
  harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
298
300
  missing?: string[] | undefined;
299
301
  reason?: string | undefined;
@@ -305,4 +307,18 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
305
307
  blurb?: string | undefined;
306
308
  name: string;
307
309
  summary: string;
308
- }[];
310
+ } | {
311
+ default_permission: "ask" | "deny" | "allow";
312
+ permissions: ("ask" | "deny" | "allow")[];
313
+ fallback_allow_reads?: true | undefined;
314
+ allow_reads?: true | undefined;
315
+ permission: "ask" | "deny" | "allow";
316
+ name: string;
317
+ summary: string;
318
+ blurb: string;
319
+ nodes: boolean;
320
+ calls: boolean;
321
+ meta: true;
322
+ available: boolean;
323
+ harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
324
+ })[];