@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
@@ -6,8 +6,8 @@
6
6
  <meta name="color-scheme" content="light dark" />
7
7
  <title>AgentRun</title>
8
8
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23ff8000'/%3E%3Cpath d='M12 9l11 7-11 7z' fill='%23000'/%3E%3C/svg%3E" />
9
- <script type="module" crossorigin src="./assets/index-Cn6JX1uH.js"></script>
10
- <link rel="stylesheet" crossorigin href="./assets/index-DRN62V5v.css">
9
+ <script type="module" crossorigin src="./assets/index-b6-XY5A9.js"></script>
10
+ <link rel="stylesheet" crossorigin href="./assets/index-CjqQirbo.css">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
@@ -1,2 +1,4 @@
1
1
  export declare const runLink: (origin: string, runId: string) => string;
2
2
  export declare const agentLink: (origin: string, agentId: string) => string;
3
+ export declare const templateLink: (origin: string, id: string) => string;
4
+ export declare const templateInstallLink: (origin: string, source: string) => string;
@@ -4,3 +4,6 @@ export const runLink = (origin, runId) => `${origin}/#/runs/${encodeURIComponent
4
4
  // `#/agents/new` is the console's new-agent form, so an agent whose id is "new" gets its Runs tab, as the console's own
5
5
  // agentHash gives it (apps/console AgentPage.tsx).
6
6
  export const agentLink = (origin, agentId) => `${origin}/#/agents/${encodeURIComponent(agentId)}${agentId === "new" ? "/runs" : ""}`;
7
+ // A template package's apply page; for a package not stored (a dry run), the install page, which shows it whole first.
8
+ export const templateLink = (origin, id) => `${origin}/#/templates/${encodeURIComponent(id)}`;
9
+ export const templateInstallLink = (origin, source) => `${origin}/#/templates/install?src=${encodeURIComponent(source)}`;
package/dist/decisions.js CHANGED
@@ -145,6 +145,10 @@ export function providersNamed(nodes) {
145
145
  }
146
146
  if (node.verify)
147
147
  ids.add(DEFAULT_DECISION_PROVIDER);
148
+ // A step guard that reads Jev (runner/step-guard.ts) asks Jev, whatever provider its node names.
149
+ const signal = node.guard?.signal;
150
+ if (signal === "jev" || signal === "both")
151
+ ids.add("jev");
148
152
  }
149
153
  return [...ids];
150
154
  }
@@ -80,8 +80,8 @@ const FRAME_MS = 1_000;
80
80
  /** --faux's computers: the server's Settings → Computers and start check read them, and its runner's claim launches them. */
81
81
  export function fauxComputers() {
82
82
  let started = 0;
83
- /** A faux desktop for a run: screen.shot gives a grey screen, input.actions does each action and performs none, and its
84
- * watch gives the same grey frame, the next a second after each ack, and takes every input (performing none) until it
83
+ /** A faux desktop for a run: ping answers, as every computer's does; screen.shot gives a grey screen, input.actions does
84
+ * each action and performs none, and its watch gives the same grey frame, the next a second after each ack, and takes every input (performing none) until it
85
85
  * is closed or the desktop is released, which ends it gone. */
86
86
  function fauxDesktop() {
87
87
  const id = `faux-desktop-${++started}`;
@@ -91,6 +91,8 @@ export function fauxComputers() {
91
91
  const call = async (method, params) => {
92
92
  if (method === "hello")
93
93
  return { ok: true, value: hello };
94
+ if (method === "ping")
95
+ return { ok: true, value: {} };
94
96
  if (method === "screen.shot")
95
97
  return { ok: true, value: { id: `${id}-shot`, data: png.toString("base64"), eof: true, size: png.length, width: WIDTH, height: HEIGHT } };
96
98
  if (method === "input.actions")
@@ -34,13 +34,18 @@ function kernelTool(tool) {
34
34
  description: tool.description,
35
35
  inputSchema: tool.inputSchema,
36
36
  replay: tool.replay,
37
+ ...(tool.nests ? { nests: true } : {}),
38
+ ...(tool.deferred ? { deferred: true } : {}),
37
39
  async execute(input, io) {
38
40
  // The effect's step is `tool:<the model's call id>#<attempt>`: the host sees the model's call id.
39
41
  const callId = (io.stepId ?? "").replace(/^tool:/, "").replace(/#\d+$/, "");
40
- const result = await tool.call(input, { callId, signal: io.signal });
42
+ // A tool that nests calls (tools_call, codemode) gets the session's tools as its nested calls, through the bridge.
43
+ const result = await tool.call(input, { callId, signal: io.signal, ...(io.nested ? { nested: io.nested } : {}) });
41
44
  if (result.isError)
42
45
  throw new Error(result.text);
43
- return result.images?.length ? { text: result.text, images: result.images } : result.text;
46
+ // Its value, recorded with the outcome: a script's nested call is answered it (meta-tools.ts).
47
+ const structured = result.structured !== undefined ? { structured: result.structured } : {};
48
+ return result.images?.length ? { text: result.text, images: result.images, ...structured } : result.structured === undefined ? result.text : { text: result.text, ...structured };
44
49
  },
45
50
  };
46
51
  }
@@ -105,7 +110,6 @@ export function openCodeAdapter(options) {
105
110
  };
106
111
  return {
107
112
  id: "opencode",
108
- capabilities: () => ({}),
109
113
  check(spec) {
110
114
  const problems = [];
111
115
  if (spec.context === "fork")
@@ -13,8 +13,6 @@ export const facts = Object.freeze({
13
13
  // One run's memory, measured with the server's (host.ts): OpenCode's server beside the run's process.
14
14
  runMib: 704,
15
15
  // OpenAI's reasoning efforts stop at xhigh.
16
- // Its MCP client is not bound to the session's remote MCP servers yet.
17
- mcp: false,
18
16
  thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
19
17
  // OpenCode's model requests carry no provider-hosted tool: no search of its own.
20
18
  ownModel: false,
@@ -37,12 +37,9 @@ export interface OpenCodePolicyOptions {
37
37
  */
38
38
  export declare function filtered(text: string, lineStarts?: readonly string[]): boolean;
39
39
  /** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
40
- * line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
41
- * in the text. Undefined, an unknown cost, when there is none. */
40
+ * line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
41
+ * in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
42
42
  export declare function usageOf(text: string): ProxyUsage | undefined;
43
- /** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
44
- * input has no stated bound, so a body with one cannot be measured. */
45
- export declare function responsesServerInputOverhead(body: Record<string, unknown>): number;
46
43
  /** The tokens a request keeps for its answer when a spend cap limits its output. */
47
44
  export declare const ANSWER_TOKENS_LEAST = 1024;
48
45
  /** What a reasoning request at each effort is allowed for its reasoning beside its answer, when its output is limited:
@@ -1,4 +1,4 @@
1
- import { providerInputOverhead, ProxyRefusal, responsesImagesIn } from "@parcha/agentrun-kernel/host";
1
+ import { lastObjectOf, OPENAI_INPUT_COUNTER, ProxyRefusal, responsesInputOverhead } from "@parcha/agentrun-kernel/host";
2
2
  /** The prefix OpenCode gives the adapter's MCP tools: the server is `hands`. */
3
3
  export const TOOL_PREFIX = "hands_";
4
4
  export const OPENCODE_RESPONSES_ROUTES = Object.freeze([
@@ -168,8 +168,8 @@ function startOfResponse(data) {
168
168
  }
169
169
  }
170
170
  /** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
171
- * line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
172
- * in the text. Undefined, an unknown cost, when there is none. */
171
+ * line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
172
+ * in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
173
173
  export function usageOf(text) {
174
174
  let found;
175
175
  let ended = false;
@@ -202,34 +202,7 @@ export function usageOf(text) {
202
202
  }
203
203
  catch { }
204
204
  }
205
- const mark = "\"usage\":{";
206
- const at = text.lastIndexOf(mark);
207
- if (at < 0)
208
- return undefined;
209
- const json = objectAt(text, at + mark.length - 1);
210
- if (json === undefined)
211
- return undefined;
212
- try {
213
- return usageFrom(JSON.parse(json));
214
- }
215
- catch {
216
- return undefined;
217
- }
218
- }
219
- /** The items of `type` in `value`, at any depth. */
220
- function itemsIn(value, type) {
221
- if (Array.isArray(value))
222
- return value.reduce((n, item) => n + itemsIn(item, type), 0);
223
- if (!isPlain(value))
224
- return 0;
225
- return (value.type === type ? 1 : 0) + Object.values(value).reduce((n, item) => n + itemsIn(item, type), 0);
226
- }
227
- /** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
228
- * input has no stated bound, so a body with one cannot be measured. */
229
- export function responsesServerInputOverhead(body) {
230
- if (itemsIn(body.input, "input_file") > 0)
231
- throw new Error("a file input's billed size has no stated bound");
232
- return providerInputOverhead("openai-responses", { tools: Array.isArray(body.tools) && body.tools.length > 0, images: responsesImagesIn(body.input), ...(typeof body.model === "string" ? { model: body.model } : {}) });
205
+ return usageFrom(lastObjectOf(text, "usage"));
233
206
  }
234
207
  /** An event that is not whole by this many characters is not read. */
235
208
  const EVENT_CAP = 4 * 1024 * 1024;
@@ -418,7 +391,10 @@ export function openCodePolicy(options) {
418
391
  outputAsked: responsesOutputAsked,
419
392
  outputLeast: responsesOutputLeast,
420
393
  limitOutput: limitResponsesOutput,
421
- serverInputOverhead: responsesServerInputOverhead,
394
+ // Its bytes less the escapes in the text it carries (codex's figure: the same Responses API), and on a route straight
395
+ // to OpenAI, OpenAI's own count when that is lower.
396
+ serverInputOverhead: responsesInputOverhead,
397
+ countInput: OPENAI_INPUT_COUNTER,
422
398
  // A stop counts the content it streamed, not the wire, and the part of its reasoning budget that did not stream.
423
399
  reasoningHidden: (body) => responsesReasoningHidden(body, maxOutputTokens),
424
400
  reasoningBytesOf: responsesReasoningBytes,
@@ -24,8 +24,6 @@ export interface HarnessEntry {
24
24
  readonly steer: boolean;
25
25
  /** What one of its runs reserves in memory while its process lives, in MiB (host.ts). */
26
26
  readonly runMib: number;
27
- /** Whether it binds a run's remote MCP servers. */
28
- readonly mcp: boolean;
29
27
  /** A server too small for even one of its runs still runs one at a time (pi's, as before runs were admitted by memory). */
30
28
  readonly oneAlwaysFits: boolean;
31
29
  /** Its adapter's facts; none for pi, which runs in the run's own process on its own models. */
@@ -42,7 +42,6 @@ const PI = Object.freeze({
42
42
  id: DEFAULT_HARNESS,
43
43
  steer: true,
44
44
  runMib: 128,
45
- mcp: true,
46
45
  oneAlwaysFits: true,
47
46
  runs: () => true,
48
47
  onWire: () => false,
@@ -61,7 +60,6 @@ function adapterEntry(facts, make, extra = {}) {
61
60
  id,
62
61
  steer: facts.steer,
63
62
  runMib: facts.runMib,
64
- mcp: facts.mcp,
65
63
  oneAlwaysFits: false,
66
64
  facts,
67
65
  ...(installs ? { installs } : {}),
@@ -2,10 +2,6 @@ import type { Context } from "@earendil-works/chord/context";
2
2
  import { type ToolExecutionApi, type ToolRegistration } from "@earendil-works/pi-durable";
3
3
  import type { HostTool } from "@parcha/agentrun-kernel";
4
4
  export { workspaceRelative } from "./workspace-paths.js";
5
- /** Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again.
6
- * `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL, named here as a string so the modules do not import
7
- * each other) is never run again. */
8
- export declare const REPLAY: Record<string, "safe" | "never">;
9
5
  export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
10
6
  /** One call's result, kept by its call id for the run's timeline (an adapter's tool_end carries none). */
11
7
  export type ToolResults = Map<string, {
@@ -51,5 +47,5 @@ export interface HostToolCtx {
51
47
  /** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
52
48
  * the paid-call seam, then the tool on the run's environment and harness, its answer the text a
53
49
  * model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
54
- * `name` is not one a host runs (REPLAY). */
50
+ * `name` is not one a host runs (tool-list.ts `replay`). */
55
51
  export declare function hostToolOf(name: string, tool: ToolRegistration, ctx: HostToolCtx): HostTool | undefined;
@@ -1,15 +1,12 @@
1
1
  import { withAbortSignal } from "@earendil-works/chord/context";
2
2
  import { createModels } from "@earendil-works/pi-ai/models";
3
3
  import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
4
- import { WEB_FETCH_TOOL } from "./web-fetch.js";
5
- import { WEB_SEARCH_TOOL } from "./web-search.js";
4
+ import { replayOf } from "./tool-list.js";
6
5
  import { realOf, workspaceRelative } from "./workspace-paths.js";
7
6
  import { bounded, imagesOf, textOf } from "./workspace/executors.js";
8
7
  export { workspaceRelative } from "./workspace-paths.js";
9
- /** Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again.
10
- * `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL, named here as a string so the modules do not import
11
- * each other) is never run again. */
12
- export const REPLAY = { read: "safe", write: "never", edit: "never", bash: "never", [WEB_FETCH_TOOL]: "safe", [WEB_SEARCH_TOOL]: "safe", "monid.discover": "safe", "monid.inspect": "safe", "monid.run": "never", bash_background: "never", bash_output: "safe", bash_input: "never", bash_signal: "never", bash_list: "safe", learned_workflow: "never" };
8
+ // Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again, is its
9
+ // row's `replay` (tool-list.ts). `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL) is never run again.
13
10
  // pi's limits on a tool's output, and how a call's output is held within them, are the executors' (workspace/executors.ts).
14
11
  export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
15
12
  /** The members of pi's ToolExecutionApi a host tool's api gives. They are typed against pi's own type (`HostApi`), so a
@@ -38,9 +35,9 @@ const SAYS_PATH = new Set(["write", "edit"]);
38
35
  /** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
39
36
  * the paid-call seam, then the tool on the run's environment and harness, its answer the text a
40
37
  * model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
41
- * `name` is not one a host runs (REPLAY). */
38
+ * `name` is not one a host runs (tool-list.ts `replay`). */
42
39
  export function hostToolOf(name, tool, ctx) {
43
- const replay = REPLAY[name];
40
+ const replay = replayOf(name);
44
41
  if (!replay)
45
42
  return undefined;
46
43
  return {
@@ -59,7 +56,7 @@ export function hostToolOf(name, tool, ctx) {
59
56
  const out = bounded(tool.outputLimits);
60
57
  const notes = [];
61
58
  const env = await ctx.env();
62
- // The call's id and the run's store, as pi's: a paid call marks and books its charge there (monid.ts).
59
+ // The call's id and the run's store, as pi's: a paid call marks and books its charge there.
63
60
  const api = hostApi({
64
61
  env, callId,
65
62
  commit: ctx.commit,
@@ -71,7 +68,7 @@ export function hostToolOf(name, tool, ctx) {
71
68
  snapshot: ctx.snapshot, waitForTask: ctx.waitForTask,
72
69
  });
73
70
  // A tool that throws (bash on a non-zero exit or a timeout) still answers with its output, as pi's harness does;
74
- // monid's answer a failure as an error result, which is kept as it is.
71
+ // one that answers a failure as an error result is kept as it is.
75
72
  const result = await tool.execute(args, api, withAbortSignal(signal, ctx.context)).catch((error) => ({ failed: error.message, isError: true }));
76
73
  // pi names a result's blocks `output`; its bash answers its exit as a result's diagnostic.
77
74
  const given = result;
@@ -21,8 +21,6 @@ export declare const OPENAI_SEARCH_TOOL: Readonly<{
21
21
  export declare const OPENAI_SEARCH_LIMIT: Readonly<{
22
22
  max_tool_calls: 5;
23
23
  }>;
24
- /** $10 per 1,000 searches (Anthropic) or calls (OpenAI). */
25
- export declare const SEARCH_USD = 0.01;
26
24
  /** What a hosted search asks: the run's models a search request goes through (on the runner, the session's port: its
27
25
  * proxy, policy, key, price and cap), handed to each search by its run, never kept per process. */
28
26
  export type SearchModels = Pick<Models, "getModel" | "completeSimple">;
@@ -1,5 +1,4 @@
1
1
  import { clip, TITLE_CAP } from "./web-fetch-direct.js";
2
- import { sideRequests } from "./cap.js";
3
2
  import { ANSWER_MAX, snippetOf } from "./web-search.js";
4
3
  export const HOSTED_MAX_USES = 5;
5
4
  /** One search's results billed as input: about 25,000 tokens, a working estimate. */
@@ -13,11 +12,6 @@ export const OPENAI_SEARCH_TOOL = Object.freeze({ type: "web_search", external_w
13
12
  /** OpenAI's hosted search has no per-tool limit: the Responses API's `max_tool_calls` caps the built-in tool calls of the
14
13
  * request at the HOSTED_MAX_USES its fee is reserved for, as Anthropic's tool's `max_uses` does. */
15
14
  export const OPENAI_SEARCH_LIMIT = Object.freeze({ max_tool_calls: HOSTED_MAX_USES });
16
- /** $10 per 1,000 searches (Anthropic) or calls (OpenAI). */
17
- export const SEARCH_USD = 0.01;
18
- /** OpenAI's models that bill each call's search content as a fixed block of 8,000 input tokens apart from the response's
19
- * usage: the block is added to the fee at the model's input price. */
20
- const BLOCK_BILLED = /^gpt-(?:4o|4\.1)-mini(?:-|$)/;
21
15
  const ANSWER_TOKENS = 2_048;
22
16
  /** As Exa's and Parallel's searches stop. */
23
17
  const TIMEOUT_MS = 60_000;
@@ -32,13 +26,9 @@ function reader(anthropic) {
32
26
  const hit = hits.get(url) ?? {};
33
27
  hits.set(url, { ...found, ...Object.fromEntries(Object.entries(hit).filter(([, value]) => value)) });
34
28
  };
35
- let reported;
36
- let calls = 0;
37
29
  let failed;
38
30
  const anthropicEvent = (event) => {
39
31
  const block = event.content_block;
40
- if (event.type === "content_block_start" && block?.type === "server_tool_use" && block.name === "web_search")
41
- calls += 1;
42
32
  if (event.type === "content_block_start" && block?.type === "web_search_tool_result") {
43
33
  if (!Array.isArray(block.content))
44
34
  failed = text(block.content?.error_code) ?? "the search failed";
@@ -49,14 +39,10 @@ function reader(anthropic) {
49
39
  const citation = event.delta?.type === "citations_delta" ? event.delta.citation : undefined;
50
40
  if (citation)
51
41
  add(citation.url, { title: text(citation.title), snippet: text(citation.cited_text) });
52
- const used = event.usage?.server_tool_use?.web_search_requests;
53
- if (event.type === "message_delta" && typeof used === "number")
54
- reported = used;
55
42
  };
56
43
  const openaiEvent = (event) => {
57
44
  const item = event.item;
58
45
  if (event.type === "response.output_item.done" && item?.type === "web_search_call") {
59
- calls += 1;
60
46
  for (const source of list(item.action?.sources))
61
47
  add(source.url, {});
62
48
  }
@@ -72,14 +58,9 @@ function reader(anthropic) {
72
58
  }
73
59
  }
74
60
  }
75
- const used = (event.response?.tool_usage?.web_search)?.num_requests;
76
- if ((event.type === "response.completed" || event.type === "response.incomplete") && typeof used === "number")
77
- reported = used;
78
61
  };
79
62
  return {
80
63
  event: (event) => (anthropic ? anthropicEvent : openaiEvent)((event ?? {})),
81
- /** The searches the provider reported, else the search calls its answer held. */
82
- searches: () => reported ?? calls,
83
64
  failed: () => (hits.size ? undefined : failed),
84
65
  hits: () => [...hits].map(([url, hit]) => ({ url, title: clip(hit.title ?? "", TITLE_CAP), snippet: snippetOf(hit.snippet ?? ""), ...(hit.published ? { published: hit.published } : {}) })),
85
66
  };
@@ -100,8 +81,6 @@ export async function hostedSearch(query, n, ref, signal, models) {
100
81
  return { error: `web_search: ${ref} has no hosted web search here` };
101
82
  const read = reader(anthropic);
102
83
  const context = { messages: [{ role: "user", content: [{ type: "text", text: `Search the web for: ${query}\n\nAnswer briefly from what the search finds, and name each source by its URL.` }], timestamp: Date.now() }] };
103
- const block = BLOCK_BILLED.test(model.id) ? (8_000 * (model.cost?.input ?? 0)) / 1e6 : 0;
104
- sideRequests.set(context, { label: "web_search", extraInputTokens: HOSTED_SEARCH_ALLOWANCE_TOKENS, maxFeeUsd: HOSTED_MAX_USES * (SEARCH_USD + block), feeUsd: () => read.searches() * (SEARCH_USD + block) });
105
84
  let answer;
106
85
  try {
107
86
  answer = await models.completeSimple(model, context, {
@@ -1,5 +1,6 @@
1
1
  /** Each tool key a person may save, fixed here: its fields (BROWSERBASE_PROJECT_ID is no secret, and is kept the same
2
- * way), and what it may unlock: tools by name, and `decisions.<id>`, a workflow's decision provider. */
2
+ * way), and what it may unlock: tools by name, `<source>:*` every tool of a catalog source, and `decisions.<id>`, a
3
+ * workflow's decision provider. */
3
4
  export declare const TOOL_KEY_ROWS: readonly [{
4
5
  readonly id: "parallel";
5
6
  readonly kind: "tool";
@@ -11,7 +12,7 @@ export declare const TOOL_KEY_ROWS: readonly [{
11
12
  readonly kind: "tool";
12
13
  readonly label: "Monid";
13
14
  readonly fields: readonly ["MONID_API_KEY"];
14
- readonly unlocks: readonly ["monid.discover", "monid.inspect", "monid.run"];
15
+ readonly unlocks: readonly ["monid:*"];
15
16
  }, {
16
17
  readonly id: "browserbase";
17
18
  readonly kind: "tool";
package/dist/key-words.js CHANGED
@@ -3,10 +3,12 @@
3
3
  // variable to set where the server starts, since a key saved and then removed in Settings was never in the environment.
4
4
  import { MODEL_KEYS } from "./model.js";
5
5
  /** Each tool key a person may save, fixed here: its fields (BROWSERBASE_PROJECT_ID is no secret, and is kept the same
6
- * way), and what it may unlock: tools by name, and `decisions.<id>`, a workflow's decision provider. */
6
+ * way), and what it may unlock: tools by name, `<source>:*` every tool of a catalog source, and `decisions.<id>`, a
7
+ * workflow's decision provider. */
7
8
  export const TOOL_KEY_ROWS = [
8
9
  { id: "parallel", kind: "tool", label: "Parallel", fields: ["PARALLEL_API_KEY"], unlocks: ["web_fetch", "web_search", "decisions.parallel"] },
9
- { id: "monid", kind: "tool", label: "Monid", fields: ["MONID_API_KEY"], unlocks: ["monid.discover", "monid.inspect", "monid.run"] },
10
+ // Every monid endpoint (`monid:<provider>/<endpoint>`, a provider's wildcard too): `<source>:*` unlocks a source's tools.
11
+ { id: "monid", kind: "tool", label: "Monid", fields: ["MONID_API_KEY"], unlocks: ["monid:*"] },
10
12
  { id: "browserbase", kind: "tool", label: "Browserbase", fields: ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"], unlocks: ["browser"] },
11
13
  // The browser's other vendor (tool-plane.ts BROWSER_KEYS): a run's browser is the one its plane picks.
12
14
  { id: "kernel", kind: "tool", label: "Kernel", fields: ["KERNEL_API_KEY"], unlocks: ["browser"] },
@@ -1,8 +1,13 @@
1
1
  import { type LearnedNote } from "./notes.js";
2
2
  import { type DraftAsk, type DraftDecisions, type DraftDryRun, type DraftReader } from "./skills.js";
3
+ /** A note's bytes as the note cap counts them: all of `text` but the `compiled_into` line the host adds when a learned
4
+ * workflow is compiled from it (notes.ts compiledLineBytes). A note at the cap stays one once marked: it retires,
5
+ * restores, and a later note supersedes it through the grader, each checked against `note`. A run never sets the line
6
+ * (checkProposal refuses it), so a run's note is counted whole. */
7
+ export declare const noteBytes: (text: string) => number;
3
8
  /** Byte caps (UTF-8) and counts. Over a cap is refused, never cut. */
4
9
  export declare const CAPS: Readonly<{
5
- /** One note's file. */
10
+ /** One note's file, as noteBytes counts it: the host's `compiled_into` line on top. */
6
11
  note: 4096;
7
12
  /** One note a run proposes: the note cap less HOST_LINES, so a run's note stays within `note` once the host merges
8
13
  * it, and a person can still retire it and a later run supersede it, each read and checked against `note`. */
@@ -4,15 +4,20 @@
4
4
  // here with its bytes; nothing the checker refuses is ever written to git. Every problem it reports is printable: its
5
5
  // path and detail are cut of the host's secrets and of text shaped like one, and a field over PRINT_MAX is redacted whole.
6
6
  import { hiddenCharacter } from "./invisible.js";
7
- import { INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile, ruleOf } from "./notes.js";
7
+ import { compiledLineBytes, INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile, ruleOf } from "./notes.js";
8
8
  import { learnedSecretShapes, redactLearned, valueMatcher } from "./secrets.js";
9
9
  import { draftProblems, decodedStrings, DECODED_DEPTH, DRY_RUN_FAILED, frontKeys, frontValues, LEARNED_KEYS, learnedName, learnedPlace, setsStatus, skillProblems, WORKFLOWS_DIR } from "./skills.js";
10
10
  /** The most the host adds to a run's note as it merges it: `origin: you` and `status: pending`, a front matter line
11
11
  * each (notes.ts mergedNote). */
12
12
  const HOST_LINES = Buffer.byteLength("origin: you\nstatus: pending\n");
13
+ /** A note's bytes as the note cap counts them: all of `text` but the `compiled_into` line the host adds when a learned
14
+ * workflow is compiled from it (notes.ts compiledLineBytes). A note at the cap stays one once marked: it retires,
15
+ * restores, and a later note supersedes it through the grader, each checked against `note`. A run never sets the line
16
+ * (checkProposal refuses it), so a run's note is counted whole. */
17
+ export const noteBytes = (text) => Buffer.byteLength(text) - compiledLineBytes(text);
13
18
  /** Byte caps (UTF-8) and counts. Over a cap is refused, never cut. */
14
19
  export const CAPS = Object.freeze({
15
- /** One note's file. */
20
+ /** One note's file, as noteBytes counts it: the host's `compiled_into` line on top. */
16
21
  note: 4096,
17
22
  /** One note a run proposes: the note cap less HOST_LINES, so a run's note stays within `note` once the host merges
18
23
  * it, and a person can still retire it and a later run supersede it, each read and checked against `note`. */
@@ -68,6 +73,9 @@ function nameChecked(path, refused, add, outside = "only a .md file at the folde
68
73
  * values, its front matter in shape. The note when it is. */
69
74
  function textChecked(path, size, bytes, refused, add, run = false) {
70
75
  const cap = run ? CAPS.runNote : CAPS.note;
76
+ // A person's note (or one main holds) is counted without the host's compiled_into line; a run's whole (it may not set it).
77
+ if (!run && bytes)
78
+ size -= compiledLineBytes(Buffer.from(bytes).toString("utf8"));
71
79
  if (size > cap)
72
80
  return void add("too_large", `${size} bytes; the cap is ${cap}${run ? " for a run's note" : ""}`, path);
73
81
  const text = textOf(path, bytes, refused, add);
@@ -262,8 +270,8 @@ export function checkProposal(input) {
262
270
  const note = textChecked(path, change.size ?? change.bytes?.length ?? 0, change.bytes, refused, add, true);
263
271
  if (!note)
264
272
  return;
265
- if (["status", "superseded_by", "retired_from", "origin"].some((key) => note.keys.includes(key)))
266
- return add("status", "a run never sets status, superseded_by, retired_from or origin: the host does, when it merges the note, a later one supersedes it or a person retires it", path);
273
+ if (["status", "superseded_by", "retired_from", "origin", "compiled_into"].some((key) => note.keys.includes(key)))
274
+ return add("status", "a run never sets status, superseded_by, retired_from, origin or compiled_into: the host does, when it merges the note, a later one supersedes it, a learned workflow is compiled from it or a person retires it", path);
267
275
  candidates.push(note);
268
276
  };
269
277
  for (const change of changes)
@@ -28,6 +28,10 @@ export type LearningChange = {
28
28
  * it (a person retired or approved it, another run's merge changed it) is a conflict, never written over. The
29
29
  * script checks it on main as it commits. Optional, past COMMIT-API.md v1. */
30
30
  seed?: string;
31
+ /** A file checked against another commit than `seed`, by its path: a workflow the run's compile turn revised from
32
+ * main's text, against the commit it read that text at (a change to it before that read is what the revision was
33
+ * written over; one after it is a conflict). */
34
+ bases?: Readonly<Record<string, string>>;
31
35
  /** New notes written over the note main holds by the same name: each one the run's note supersedes by its own
32
36
  * name (the learning loop's takenOnMain), its blob on main in `graded`, so a change since is a conflict. Any
33
37
  * other new note main holds a note by when the merge commits is left out alone (`left`, `taken`). */
@@ -41,6 +45,12 @@ export type LearningChange = {
41
45
  note: string;
42
46
  rule: string;
43
47
  }[];
48
+ /** A learned workflow this merge writes, compiled from notes (learn/compile.ts): each of `notes` that is active on
49
+ * main as it commits gets `compiled_into: <workflow>` in the same write (notes.ts compiledInto), and stays served. */
50
+ compiled?: {
51
+ workflow: string;
52
+ notes: string[];
53
+ };
44
54
  } | {
45
55
  kind: "person";
46
56
  action: "edited" | "created" | "retired" | "approved" | "restored";
@@ -4,8 +4,8 @@
4
4
  // the folder's snapshot and the bodies it names. A main that moved under it (the script's exit 3) is computed again on
5
5
  // the main that won, as long as no oid the caller read (`graded`, `ifMatch`) changed: a change it did not see is a
6
6
  // conflict, never written over. A folder with no main yet is made in the same call (the script's init first).
7
- import { isHeld, held, retiredLearned } from "./skills.js";
8
- import { buildIndex, INDEX_FILE, INDEX_LINES, mergedNote, NOTE_FILE, parseNoteFile, ruleOf, supersede } from "./notes.js";
7
+ import { isHeld, held, retiredLearned, WORKFLOWS_DIR } from "./skills.js";
8
+ import { buildIndex, compiledInto, INDEX_FILE, INDEX_LINES, mergedNote, NOTE_FILE, parseNoteFile, ruleOf, supersede } from "./notes.js";
9
9
  import { mergeProblems, supersededBy } from "./check.js";
10
10
  import { FolderRefused, FolderTooLarge, readLearning, readRunDiff, readSnapshot, runDiffKey, snapshotNotes, textsAt, topOf, writeLearning } from "./folder.js";
11
11
  /** The blob `path` is on the snapshot's main: the index, a note, a learned folder's file. */
@@ -156,6 +156,17 @@ async function mergeOf(change, snapshot, body) {
156
156
  else
157
157
  files.set(path, supersede(await body(path, blobOf(snapshot, path)), by));
158
158
  }
159
+ // The notes the merge's compiled workflow does the work of, marked: an active one this merge writes nothing else to
160
+ // (a note it supersedes is no longer one to serve), its text on main as it is now. One gone or not active is left alone.
161
+ const compiledMarks = new Set();
162
+ if (change.compiled && files.has(`${WORKFLOWS_DIR}/${change.compiled.workflow}/workflow.json`)) {
163
+ for (const path of change.compiled.notes) {
164
+ if (!active.has(path) || files.has(path))
165
+ continue;
166
+ files.set(path, compiledInto(await body(path, blobOf(snapshot, path)), change.compiled.workflow));
167
+ compiledMarks.add(path);
168
+ }
169
+ }
159
170
  const added = [];
160
171
  const written = [];
161
172
  for (const [path, text] of files) {
@@ -170,7 +181,7 @@ async function mergeOf(change, snapshot, body) {
170
181
  // A merge adds notes and marks the ones they supersede: it never writes over another note main holds.
171
182
  if (blobOf(snapshot, path) === undefined)
172
183
  added.push(note);
173
- else if (!marks.some((one) => one.path === path) && !replaced.has(path))
184
+ else if (!marks.some((one) => one.path === path) && !replaced.has(path) && !compiledMarks.has(path))
174
185
  refused.push({ rule: "exists", path, detail: "the folder has a note by this name" });
175
186
  }
176
187
  // mergeProblems asks of the new notes what a merge always asks: a free name, what they supersede active and named
@@ -187,7 +198,10 @@ async function mergeOf(change, snapshot, body) {
187
198
  by: { run: change.runId, reason: change.reason, ...(change.round !== undefined && change.round > 1 ? { round: change.round } : {}) },
188
199
  writes: [...files].map(([path, text]) => ({ path, text })),
189
200
  absent: added.map((note) => note.file),
190
- ...(change.seed ? { same: [...change.files.filter(({ path }) => !isNote(path)).map(({ path }) => path), ...retiring].map((path) => ({ commit: change.seed, path })) } : {}),
201
+ ...(change.seed || change.bases ? { same: [...change.files.filter(({ path }) => !isNote(path)).map(({ path }) => path), ...retiring].flatMap((path) => {
202
+ const commit = change.bases?.[path] ?? change.seed;
203
+ return commit ? [{ commit, path }] : [];
204
+ }) } : {}),
191
205
  },
192
206
  };
193
207
  }