@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,253 @@
1
+ import type { GuardRow } from "../learned-nodes.js";
2
+ import type { RunPath } from "../learning-cost.js";
3
+ import type { Settings } from "../store/store.js";
4
+ /** How many of the agent's newest graded inputs a replay runs on. */
5
+ export declare const REPLAY_INPUTS = 20;
6
+ /** The fewest graded inputs a replay runs on: with fewer, a workflow is promoted on its passing dry run, as before. */
7
+ export declare const REPLAY_MIN = 5;
8
+ /** How far below the agent path's accuracy on the same inputs a workflow may be and still serve: 2 points. */
9
+ export declare const PROMOTE_BAR = 0.02;
10
+ /** A serving revision's thresholds are refit at most once per this many graded runs it served. */
11
+ export declare const REFIT_EVERY = 20;
12
+ /** How many grades, and how many promotion records, an agent keeps (newest kept). */
13
+ export declare const GRADES_KEPT = 500;
14
+ export declare const PROMOTIONS_KEPT = 200;
15
+ export declare const GRADE_SOURCES: readonly ["feedback", "eval"];
16
+ export type GradeSource = (typeof GRADE_SOURCES)[number];
17
+ /** One graded run: whether its answer was right (`correct`), the answer's expected fields when the grader knows them
18
+ * (`expected`: a replay's answer is right when its JSON holds each of them), who said so, and, read from the run's record
19
+ * when it was graded, the path it took and the learned workflow and digest that served it. */
20
+ export interface Grade {
21
+ readonly run: string;
22
+ readonly correct: boolean;
23
+ readonly expected?: Readonly<Record<string, unknown>>;
24
+ readonly source: GradeSource;
25
+ readonly at: string;
26
+ readonly path: RunPath;
27
+ readonly workflow?: string;
28
+ readonly digest?: string;
29
+ /** Its place among the agent's grades, one more than the grade put before it (a re-grade takes a new one): a cursor a
30
+ * serving digest's check counts new grades from (PromotionRecord.checked) that the GRADES_KEPT trim never moves back. */
31
+ readonly seq?: number;
32
+ }
33
+ /** What a replay says, the shape the promotion record keeps (SPEC: replay {n, agree, agent_acc, wf_acc, delta}):
34
+ * `n` inputs; `agree`, how many the workflow answered alone with the agent's recorded answer; `agent_acc`, the agent's
35
+ * recorded answers' accuracy; `wf_acc`, the workflow's, a hand-back counting as the agent's answer; `delta` = wf_acc -
36
+ * agent_acc; `handed_back`, how many it handed back (it answered n - handed_back alone: answersAlone). Accuracies to
37
+ * 1e-4. */
38
+ export interface ReplayScore {
39
+ readonly n: number;
40
+ readonly agree: number;
41
+ readonly agent_acc: number;
42
+ readonly wf_acc: number;
43
+ readonly delta: number;
44
+ readonly handed_back: number;
45
+ }
46
+ /** Whether a replay or refit answered alone on at least one of its inputs: one that hands back every input would never
47
+ * serve. The one spelling of it (clears, settle's hold, the compile's held line); the count is n - handed_back. */
48
+ export declare const answersAlone: (score: Pick<ReplayScore, "n" | "handed_back">) => boolean;
49
+ /** A learned workflow's promotion record at one digest. `decided`: `promote` (it serves first), `hold` (it does not: the
50
+ * champion, championOf, takes its runs, else the agent, until a new revision), `replaying` (its replay runs, `runs`,
51
+ * are at work; the champion serves meanwhile, else the agent), or `superseded` (a newer revision, `superseded_by`, came
52
+ * while it replayed: one challenger at a time, so its replay runs were cancelled and it never serves). `source`: `replay` (decided on its replay), `dry_run` (fewer than REPLAY_MIN graded inputs: promoted on
53
+ * its passing dry run), `refit` (a threshold refit wrote this revision, decided on the rows it was fit on), `graded` (a
54
+ * serving revision's graded runs fell below the bar: held). `replay`: the numbers it was decided on, with the graded runs
55
+ * replayed (`of`), what its replay runs cost (`cost_usd`, null when one's is unknown) and how many of its inputs were
56
+ * skipped (`skipped_write`: each needed a write the graded run's recording does not have, learn/replay-calls.ts; never
57
+ * run, never scored) and at which tools (`skipped_tools`, SkippedTool). `refit`: the guards a refit
58
+ * changed. `checked`: the newest grade (its seq) the last refit check read (refits run once per REFIT_EVERY more graded runs
59
+ * it served, counted by seq: a count of the grades kept stalls once the GRADES_KEPT trim holds it). */
60
+ export interface PromotionRecord {
61
+ readonly workflow: string;
62
+ readonly digest: string;
63
+ readonly at: string;
64
+ readonly decided: "promote" | "hold" | "replaying" | "superseded";
65
+ readonly source: "replay" | "dry_run" | "refit" | "graded";
66
+ readonly reason: string;
67
+ readonly replay?: ReplayScore & {
68
+ readonly of: readonly string[];
69
+ readonly cost_usd?: number | null;
70
+ readonly skipped_write?: number;
71
+ readonly skipped_tools?: readonly SkippedTool[];
72
+ };
73
+ readonly runs?: readonly string[];
74
+ /** A replaying record's graded runs, one per `runs` entry in order: the input each reserved replay run replays, so a
75
+ * launch interrupted after the reservation is finished by a later claim (runner/promotion.ts relaunch). */
76
+ readonly inputs?: readonly string[];
77
+ readonly refit?: {
78
+ readonly from: string;
79
+ readonly guards: readonly RefitGuard[];
80
+ };
81
+ readonly checked?: number;
82
+ /** A superseded revision's newer one: the digest whose claim cancelled its replay. */
83
+ readonly superseded_by?: string;
84
+ /** The learning commit whose workflows/<workflow>/workflow.json is this digest's text: the seed of the claim that
85
+ * recorded it, or a refit's own commit. What the digest serves from as the champion (championOf) once a newer revision
86
+ * is on the folder's main. */
87
+ readonly commit?: string;
88
+ }
89
+ /** A tool that stopped a replay's inputs (each a skipped_write row): its catalog name, how many inputs it stopped, and
90
+ * whether it is an MCP tool its server listed with no readOnlyHint (`no_read_only_hint`: replay may only lack the hint,
91
+ * not a recording). */
92
+ export interface SkippedTool {
93
+ readonly tool: string;
94
+ readonly inputs: number;
95
+ readonly no_read_only_hint: boolean;
96
+ }
97
+ /** The tools that stopped `rows`' skipped inputs, most inputs first (then by name). */
98
+ export declare function skippedToolsOf(rows: readonly ReplayRow[]): SkippedTool[];
99
+ /** One switch a refit changed: a guard's step, its threshold before and after (`threshold` null: the guard switched off,
100
+ * gone from the revision), and its new fit when one was fit; or an escalate node a replay recorded (softEscalatesOf),
101
+ * switched off (`escalate`: gone from the revision; `was` and `threshold` null, it had none). */
102
+ export interface RefitGuard {
103
+ readonly node: string;
104
+ readonly was: number | null;
105
+ readonly threshold: number | null;
106
+ readonly fit?: {
107
+ readonly w: readonly number[];
108
+ readonly b: number;
109
+ readonly n: number;
110
+ readonly fitted_at: string;
111
+ };
112
+ readonly escalate?: true;
113
+ }
114
+ export declare const gradesKey: (agentId: string) => string;
115
+ export declare const promotionsKey: (agentId: string) => string;
116
+ /** The agent's grades, oldest first. */
117
+ export declare const gradesOf: (settings: Pick<Settings, "get">, agentId: string) => Promise<Grade[]>;
118
+ /** Keeps `grade`, in place of any earlier grade of the same run, the newest GRADES_KEPT kept, at the next `seq`. */
119
+ export declare const putGrade: (settings: Pick<Settings, "get" | "putIfAbsent" | "replaceIf">, agentId: string, grade: Grade) => Promise<Grade>;
120
+ /** The agent's promotion records, oldest first. */
121
+ export declare const promotionsOf: (settings: Pick<Settings, "get">, agentId: string) => Promise<PromotionRecord[]>;
122
+ /** The newest record of `workflow` at `digest`, or undefined. */
123
+ export declare const promotionOf: (records: readonly PromotionRecord[], workflow: string, digest: string) => PromotionRecord | undefined;
124
+ /** The champion of `workflow`: the newest record of the digest promoted last (a digest's place is its first promote
125
+ * record's), while that digest's newest record still says promote. A newer revision replaying or held never stops it; a
126
+ * wrong served grade asks for a revision and never stops it; it stops when a newer revision's replay promotes that one
127
+ * (then the champion), or its own graded runs hold it (source graded: no champion until a revision is promoted). The
128
+ * money rule stops it on its own (runner/workflow-first.ts). Undefined: none. */
129
+ export declare function championOf(records: readonly PromotionRecord[], workflow: string): PromotionRecord | undefined;
130
+ /** The revisions of `workflow` other than `digest` whose newest record still says replaying, newest first: at most one
131
+ * once each new revision supersedes the one replaying (runner/promotion.ts). */
132
+ export declare function replayingOf(records: readonly PromotionRecord[], workflow: string, digest: string | null): PromotionRecord[];
133
+ /** What each learned workflow with a record serves, by name: `digest`, its champion's (championOf; null: none serves,
134
+ * the agent takes its runs), and `replaying`, the revision other than it whose replay is at work (null: none; a
135
+ * superseded one's replay was cancelled, never at work). What the promotions list says beside the records
136
+ * (GET /agents/{id}/learning/promotions). */
137
+ export declare function servingOf(records: readonly PromotionRecord[]): {
138
+ workflow: string;
139
+ digest: string | null;
140
+ replaying: string | null;
141
+ }[];
142
+ /** The promotions list as it leaves (GET /agents/{id}/learning/promotions): the records and what serves (servingOf), every
143
+ * text in them cut by `shown` (learning.ts secretsShown, as the other learning reads cut theirs), at any depth and under
144
+ * any field, so a field added later is cut too: a workflow's name whole (`shown.name`), any other text of its part
145
+ * (`shown.text`: a reason, a refit guard's label, a digest, a run id). Numbers and the rest as they are. */
146
+ export declare function promotionsShown(records: readonly PromotionRecord[], shown: {
147
+ readonly text: (text: string) => string;
148
+ readonly name: (name: string) => string;
149
+ }): {
150
+ promotions: PromotionRecord[];
151
+ serving: ReturnType<typeof servingOf>;
152
+ };
153
+ /** What a guarded promotion write did:`won`, whether this write kept its record (else `still` did not hold when it
154
+ * wrote: another claim's decision came first); `record`, the newest record of its workflow at its digest after (the one
155
+ * written when won, else the one there, undefined when none). A claim acts on a decision (starts replay runs, refits,
156
+ * cancels) only when it won the write: the loser reads the winner's record, never its turn to act. */
157
+ export type Recorded = {
158
+ readonly record: PromotionRecord | undefined;
159
+ readonly won: boolean;
160
+ };
161
+ /** Keeps `record` as the newest of its workflow at its digest, when `still` holds of the one there now (none: undefined)
162
+ * and of every record kept (`items`: a check across revisions, one challenger at a time, in the same guarded write): so
163
+ * of two claims deciding at once only the first decision is kept, and only its claim acts on it (Recorded.won). */
164
+ export declare function recordPromotion(settings: Pick<Settings, "get" | "putIfAbsent" | "replaceIf">, agentId: string, record: PromotionRecord, still: (now: PromotionRecord | undefined, items: readonly PromotionRecord[]) => boolean): Promise<Recorded>;
165
+ /** The newest records, at most PROMOTIONS_KEPT, in order, with each workflow's champion (championOf) the same after as
166
+ * before, whatever was dropped. championOf reads two things, and the trim keeps both: the place of every digest it can
167
+ * still see promoted (a promote record kept keeps its digest's first promote record beside it, so an older revision's
168
+ * late graded check never reads as a newer promotion), and the digest promoted last, its first promote record and its
169
+ * newest record (so a held last revision is never trimmed into handing the champion back). */
170
+ export declare function trimPromotions(items: readonly PromotionRecord[]): PromotionRecord[];
171
+ /** One replayed input: the graded run it replays (`of`), the agent's recorded answer and its grade, and what the workflow
172
+ * did on it: answered alone (`answer`), handed back (it escalated: an escalate node or a guard), or failed (a step failed,
173
+ * on a credential or tool the replay lacked among them, or its output off its schema; no workflow, a stale digest, a run
174
+ * that did not end completed); with its guard rows, read record-only (recordOnly) so each step's p is known. A failed
175
+ * row is no evidence either way (replayScore leaves it out): the replay ran without what the run it replays had. A
176
+ * skipped one (`skipped_write`) is none either: its workflow stopped at a write the graded run's recording does not have,
177
+ * which a replay never runs (learn/replay-calls.ts), the one named in `skipped`. */
178
+ export interface ReplayRow {
179
+ readonly of: string;
180
+ readonly recorded: {
181
+ readonly answer: string | null;
182
+ readonly correct: boolean;
183
+ readonly expected?: Readonly<Record<string, unknown>>;
184
+ };
185
+ readonly outcome: "answered" | "handed_back" | "failed" | "skipped_write";
186
+ readonly skipped?: {
187
+ readonly tool: string;
188
+ readonly unmarked?: true;
189
+ };
190
+ readonly answer: string | null;
191
+ readonly guards: readonly GuardRow[];
192
+ }
193
+ /** Whether two answers say the same: equal as JSON values, else as trimmed text. */
194
+ export declare const sameAnswer: (a: string | null, b: string | null) => boolean;
195
+ /** Whether the workflow's `answer` to a graded input is right: with the grade's expected fields, when its JSON holds each
196
+ * of them (or, one field expected, when the answer is that field's text: a workflow whose output is one text field
197
+ * answers with that text, learned-workflow.ts learnedOutput); else when it says what the agent's graded answer said,
198
+ * that answer's grade. An answer that differs from the agent's when the agent's was wrong is counted wrong: nothing says
199
+ * it is right (a replay never flatters the workflow). */
200
+ export declare function answerCorrect(answer: string | null, recorded: ReplayRow["recorded"]): boolean;
201
+ /** The thresholds a workflow's guards serve at, by step label (the guard rows' `node`): every step of the workflow
202
+ * with a `guard` and a `label` (walkGuards). A label names one step: a learned draft that repeats one never runs
203
+ * (skills.ts draftProblems, repeatedLabels), so no two steps' rows share a threshold here or in a refit. */
204
+ export declare function thresholdsOf(workflowText: string): Map<string, number>;
205
+ /** Each node of a workflow document with a guard, by its label as the DSL names its step when it runs, in document order:
206
+ * a step of a child workflow (a `workflow` node's `workflow`) as `parent/child`, as the DSL prefixes its events and its
207
+ * guard rows (scopeDepsToChild), so a nested guard's serving threshold and its refit read the rows it made. Only the
208
+ * workflow's node positions (workflow-nodes.ts): a call's args or a schema shaped like `{label, guard}` is data, never
209
+ * a guard, so a replay or a refit never changes it. */
210
+ export declare function walkGuards(doc: unknown, visit: (label: string, guard: Record<string, unknown>, node: Record<string, unknown>) => void): void;
211
+ /** The threshold a soft escalate's row (GuardRow signal `escalate`) is read at: its p is 0 when it fired, else 1, so it
212
+ * hands back at its serving setting exactly when it fired. */
213
+ export declare const SOFT_ESCALATE_THRESHOLD = 0.5;
214
+ /** The escalate nodes of a workflow document a replay records instead of obeying, by label as the DSL names its step (a
215
+ * child's `parent/child`): each whose `when` (under any number of `not`s) reads a field a judge node wrote, the judge
216
+ * being the step that last wrote that path's head on every path the run can take to the escalate (walkWriters: a judge
217
+ * an extract overwrites, one in only some of a route's branches, one a code node with no `as` may have overwritten, are
218
+ * not). A judge's field is one model's opinion of a draft the workflow already wrote: the replay goes on to that draft
219
+ * and records whether the escalate fired (WorkflowDeps.softEscalate), so a refit can weigh the check against the drafts
220
+ * it stopped (learn/refit.ts). Every other escalate (on a call's result, a route's, the input) stays hard in a replay: it
221
+ * stops the run, as serving does. A document too deep to walk has none. */
222
+ export declare function softEscalatesOf(doc: unknown): Set<string>;
223
+ /** The threshold a replay's guards read at: the least the DSL takes (a threshold is in (0, 1), exclusive), so a guard
224
+ * hands back only when p is null (a signal it reads is missing) or 0. */
225
+ export declare const RECORD_ONLY_THRESHOLD = 1e-9;
226
+ /** A workflow's text with every guard's threshold at RECORD_ONLY_THRESHOLD: each guard still reads its signals and
227
+ * records its row. What a replay runs, so every step's p is known for the refit and the serving thresholds are applied
228
+ * after (replayScore). The text unchanged when it has no guard. */
229
+ export declare function recordOnly(workflowText: string): string;
230
+ /** Whether a replayed input would have been handed back serving at `thresholds` (by step; a step not named keeps its
231
+ * row's): it did not answer alone, or one of its guards read no p, or a p under its step's threshold (a soft escalate
232
+ * that fired among them: its row's p 0). */
233
+ export declare function escalates(row: Pick<ReplayRow, "outcome" | "guards">, thresholds: ReadonlyMap<string, number>): boolean;
234
+ /** The replayed inputs a replay scores: those its workflow answered or handed back, never one it failed on or skipped. */
235
+ export declare const scoredRows: (rows: readonly ReplayRow[]) => ReplayRow[];
236
+ /** What a replay says at the serving `thresholds`, over the inputs it answered or handed back (scoredRows: a failed or
237
+ * skipped one is no evidence): each the workflow would have answered alone graded by answerCorrect, each it would have handed back the
238
+ * agent's recorded answer and grade. */
239
+ export declare function replayScore(all: readonly ReplayRow[], thresholds: ReadonlyMap<string, number>): ReplayScore;
240
+ /** Whether a score clears the bar: the workflow's accuracy at most PROMOTE_BAR under the agent path's, and it answered
241
+ * alone on at least one input (one that hands back every input scores the agent's own accuracy, and would never serve). */
242
+ export declare const clears: (score: Pick<ReplayScore, "delta" | "n" | "handed_back">) => boolean;
243
+ /** A grade as the API answers it (PUT /runs/{id}/grade). */
244
+ export declare const gradeView: (grade: Grade) => {
245
+ source: "feedback" | "eval";
246
+ graded_at: string;
247
+ path: "workflow" | "handed_back" | "agent" | "replay";
248
+ workflow: string | null;
249
+ workflow_digest: string | null;
250
+ expected?: Readonly<Record<string, unknown>> | undefined;
251
+ run_id: string;
252
+ correct: boolean;
253
+ };