@parcha/agentrun-serve 0.1.0-beta.30 → 0.1.0-beta.32

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 (816) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/NOTICE +18 -0
  3. package/README.md +1042 -240
  4. package/dist/adapter-facts.d.ts +3 -0
  5. package/dist/adapter-facts.js +5 -0
  6. package/dist/adapters.d.ts +64 -140
  7. package/dist/adapters.js +153 -377
  8. package/dist/agents-store.d.ts +146 -0
  9. package/dist/agents-store.js +359 -0
  10. package/dist/agents.d.ts +12 -5
  11. package/dist/agents.js +40 -17
  12. package/dist/app.d.ts +2 -4
  13. package/dist/app.js +227 -97
  14. package/dist/approvals.d.ts +4 -0
  15. package/dist/approvals.js +7 -0
  16. package/dist/archil-routes.d.ts +45 -0
  17. package/dist/archil-routes.js +150 -0
  18. package/dist/archil-settings.d.ts +30 -0
  19. package/dist/archil-settings.js +34 -0
  20. package/dist/background.d.ts +2 -1
  21. package/dist/background.js +69 -29
  22. package/dist/bounds.d.ts +26 -0
  23. package/dist/bounds.js +137 -0
  24. package/dist/box-egress-vm.d.ts +126 -0
  25. package/dist/box-egress-vm.js +364 -0
  26. package/dist/box-egress.d.ts +19 -8
  27. package/dist/box-egress.js +27 -15
  28. package/dist/box-paths.d.ts +59 -0
  29. package/dist/box-paths.js +92 -0
  30. package/dist/box-relay-vm.d.ts +4 -0
  31. package/dist/box-relay-vm.js +103 -55
  32. package/dist/box-relay.d.ts +2 -0
  33. package/dist/box-relay.js +2 -2
  34. package/dist/boxes.d.ts +20 -3
  35. package/dist/boxes.js +67 -14
  36. package/dist/browser-commands.d.ts +43 -0
  37. package/dist/browser-commands.js +154 -0
  38. package/dist/browser-cost.d.ts +30 -3
  39. package/dist/browser-cost.js +276 -21
  40. package/dist/browser-live.d.ts +124 -0
  41. package/dist/browser-live.js +324 -0
  42. package/dist/browser-person.d.ts +168 -0
  43. package/dist/browser-person.js +769 -0
  44. package/dist/budget.d.ts +80 -0
  45. package/dist/budget.js +211 -0
  46. package/dist/cap.d.ts +274 -63
  47. package/dist/cap.js +599 -188
  48. package/dist/cli.js +226 -16
  49. package/dist/coding-tools.d.ts +13 -1
  50. package/dist/coding-tools.js +107 -5
  51. package/dist/computer-adb.d.ts +12 -0
  52. package/dist/computer-adb.js +14 -0
  53. package/dist/computer-commands.d.ts +103 -0
  54. package/dist/computer-commands.js +256 -0
  55. package/dist/computer-keys.d.ts +68 -0
  56. package/dist/computer-keys.js +148 -0
  57. package/dist/computer-routes.d.ts +38 -0
  58. package/dist/computer-routes.js +56 -0
  59. package/dist/computer-setting.d.ts +37 -0
  60. package/dist/computer-setting.js +47 -0
  61. package/dist/computer-view.d.ts +38 -0
  62. package/dist/computer-view.js +14 -0
  63. package/dist/computers.d.ts +137 -0
  64. package/dist/computers.js +197 -0
  65. package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
  66. package/dist/console/assets/index-35-7aeIZ.js +519 -0
  67. package/dist/console/assets/index-Cejbov-Y.css +1 -0
  68. package/dist/console/index.html +2 -2
  69. package/dist/console-links.d.ts +2 -0
  70. package/dist/console-links.js +6 -0
  71. package/dist/decision-cap.d.ts +63 -0
  72. package/dist/decision-cap.js +163 -0
  73. package/dist/decision-rows.d.ts +5 -2
  74. package/dist/decision-rows.js +8 -6
  75. package/dist/decisions.d.ts +31 -4
  76. package/dist/decisions.js +66 -8
  77. package/dist/disk.d.ts +33 -0
  78. package/dist/disk.js +85 -0
  79. package/dist/door-line.d.ts +23 -0
  80. package/dist/door-line.js +83 -0
  81. package/dist/egress-proxy.d.ts +45 -0
  82. package/dist/egress-proxy.js +416 -0
  83. package/dist/egress-table.d.ts +24 -0
  84. package/dist/egress-table.js +165 -0
  85. package/dist/errors.d.ts +15 -0
  86. package/dist/errors.js +22 -2
  87. package/dist/exa-keyless.js +1 -1
  88. package/dist/explain.d.ts +22 -0
  89. package/dist/explain.js +207 -0
  90. package/dist/faux-computers.d.ts +35 -0
  91. package/dist/faux-computers.js +126 -0
  92. package/dist/file-types.d.ts +4 -0
  93. package/dist/file-types.js +11 -0
  94. package/dist/files.d.ts +3 -32
  95. package/dist/files.js +9 -117
  96. package/dist/github-connection.d.ts +207 -0
  97. package/dist/github-connection.js +595 -0
  98. package/dist/github.d.ts +64 -0
  99. package/dist/github.js +119 -0
  100. package/dist/grade.d.ts +14 -44
  101. package/dist/grade.js +55 -233
  102. package/dist/graph-served.d.ts +23 -2
  103. package/dist/graph-served.js +44 -3
  104. package/dist/graph-view.d.ts +7 -3
  105. package/dist/graph-view.js +26 -15
  106. package/dist/handed-values.d.ts +23 -0
  107. package/dist/handed-values.js +36 -0
  108. package/dist/harness-app.d.ts +33 -4
  109. package/dist/harness-app.js +539 -85
  110. package/dist/harness-install.d.ts +120 -0
  111. package/dist/harness-install.js +359 -0
  112. package/dist/harness-opencode/adapter.js +42 -8
  113. package/dist/harness-opencode/facts.d.ts +2 -0
  114. package/dist/harness-opencode/facts.js +28 -0
  115. package/dist/harness-opencode/harness.d.ts +4 -0
  116. package/dist/harness-opencode/harness.js +38 -5
  117. package/dist/harness-opencode/host/policy.js +11 -3
  118. package/dist/harness-opencode/transcript.d.ts +25 -0
  119. package/dist/harness-opencode/transcript.js +81 -0
  120. package/dist/harness-table.d.ts +75 -0
  121. package/dist/harness-table.js +145 -0
  122. package/dist/harness.d.ts +7 -28
  123. package/dist/harness.js +15 -41
  124. package/dist/heard.d.ts +12 -0
  125. package/dist/heard.js +45 -0
  126. package/dist/helper-env.d.ts +4 -0
  127. package/dist/helper-env.js +14 -0
  128. package/dist/home-path.d.ts +0 -4
  129. package/dist/home-path.js +3 -17
  130. package/dist/host-check.d.ts +13 -0
  131. package/dist/host-check.js +35 -0
  132. package/dist/host-tools.d.ts +51 -8
  133. package/dist/host-tools.js +108 -117
  134. package/dist/host.d.ts +12 -6
  135. package/dist/host.js +30 -24
  136. package/dist/hosted-search.d.ts +3 -0
  137. package/dist/hosted-search.js +5 -3
  138. package/dist/import-proxy.d.ts +42 -0
  139. package/dist/import-proxy.js +105 -0
  140. package/dist/import-summary.js +4 -8
  141. package/dist/import-worker.d.ts +2 -3
  142. package/dist/import-worker.js +18 -16
  143. package/dist/import.d.ts +37 -17
  144. package/dist/import.js +208 -222
  145. package/dist/key-meta.d.ts +26 -0
  146. package/dist/key-meta.js +30 -0
  147. package/dist/key-refusal.d.ts +4 -1
  148. package/dist/key-refusal.js +20 -7
  149. package/dist/key-words.d.ts +37 -0
  150. package/dist/key-words.js +40 -0
  151. package/dist/learn/check.d.ts +3 -1
  152. package/dist/learn/check.js +2 -2
  153. package/dist/learn/commit.d.ts +86 -0
  154. package/dist/learn/commit.js +182 -0
  155. package/dist/learn/folder.d.ts +296 -0
  156. package/dist/learn/folder.js +796 -0
  157. package/dist/learn/grade.d.ts +25 -9
  158. package/dist/learn/grade.js +98 -50
  159. package/dist/learn/index.d.ts +2 -2
  160. package/dist/learn/index.js +2 -2
  161. package/dist/learn/learning.sh +366 -0
  162. package/dist/learn/reflect.d.ts +12 -5
  163. package/dist/learn/reflect.js +72 -41
  164. package/dist/learn/secrets.d.ts +15 -7
  165. package/dist/learn/secrets.js +66 -16
  166. package/dist/learn/seed-check.d.ts +74 -0
  167. package/dist/learn/seed-check.js +103 -0
  168. package/dist/learn/skills.d.ts +7 -1
  169. package/dist/learn/skills.js +21 -4
  170. package/dist/learned-workflow.d.ts +12 -2
  171. package/dist/learned-workflow.js +9 -5
  172. package/dist/learning-routes.d.ts +107 -31
  173. package/dist/learning-routes.js +358 -403
  174. package/dist/learning-run.d.ts +61 -54
  175. package/dist/learning-run.js +183 -205
  176. package/dist/learning-words.d.ts +10 -8
  177. package/dist/learning-words.js +29 -13
  178. package/dist/learning.d.ts +186 -113
  179. package/dist/learning.js +345 -381
  180. package/dist/live/stream.d.ts +30 -0
  181. package/dist/live/stream.js +175 -0
  182. package/dist/live/translate.d.ts +52 -0
  183. package/dist/live/translate.js +276 -0
  184. package/dist/llm.js +3 -0
  185. package/dist/llms.txt +1 -0
  186. package/dist/local-models.d.ts +23 -0
  187. package/dist/local-models.js +35 -0
  188. package/dist/mcp-gateway.d.ts +129 -0
  189. package/dist/mcp-gateway.js +508 -0
  190. package/dist/mcp-meta.d.ts +20 -0
  191. package/dist/mcp-meta.js +50 -0
  192. package/dist/mcp-oauth.d.ts +172 -0
  193. package/dist/mcp-oauth.js +403 -0
  194. package/dist/mcp-private-hosts.d.ts +48 -0
  195. package/dist/mcp-private-hosts.js +141 -0
  196. package/dist/mcp-probe.d.ts +101 -0
  197. package/dist/mcp-probe.js +359 -0
  198. package/dist/mcp-secret-writes.d.ts +23 -0
  199. package/dist/mcp-secret-writes.js +60 -0
  200. package/dist/mcp-servers-store.d.ts +251 -0
  201. package/dist/mcp-servers-store.js +447 -0
  202. package/dist/mcp-servers.d.ts +185 -34
  203. package/dist/mcp-servers.js +304 -298
  204. package/dist/mcp-store.d.ts +103 -0
  205. package/dist/mcp-store.js +123 -0
  206. package/dist/mcp.js +22 -21
  207. package/dist/model.d.ts +77 -59
  208. package/dist/model.js +237 -98
  209. package/dist/monid.d.ts +8 -6
  210. package/dist/monid.js +39 -25
  211. package/dist/openapi.d.ts +22 -1
  212. package/dist/openapi.js +965 -111
  213. package/dist/owner.d.ts +46 -10
  214. package/dist/owner.js +123 -43
  215. package/dist/page.d.ts +12 -0
  216. package/dist/page.js +28 -2
  217. package/dist/paid-calls.d.ts +71 -2
  218. package/dist/paid-calls.js +125 -5
  219. package/dist/pdf-pages.d.ts +16 -14
  220. package/dist/pdf-pages.js +88 -58
  221. package/dist/place.d.ts +18 -15
  222. package/dist/place.js +36 -18
  223. package/dist/port-models.d.ts +53 -0
  224. package/dist/port-models.js +93 -0
  225. package/dist/print.d.ts +7 -0
  226. package/dist/print.js +13 -0
  227. package/dist/propose.d.ts +9 -8
  228. package/dist/propose.js +82 -49
  229. package/dist/provider.d.ts +85 -0
  230. package/dist/provider.js +178 -0
  231. package/dist/push-handler.d.ts +52 -0
  232. package/dist/push-handler.js +165 -0
  233. package/dist/refusal-words.d.ts +23 -0
  234. package/dist/refusal-words.js +25 -0
  235. package/dist/request-start.d.ts +6 -1
  236. package/dist/request-start.js +41 -10
  237. package/dist/result.d.ts +13 -2
  238. package/dist/result.js +4 -5
  239. package/dist/run-box.d.ts +22 -3
  240. package/dist/run-box.js +91 -20
  241. package/dist/run-computer.d.ts +24 -0
  242. package/dist/run-computer.js +15 -0
  243. package/dist/run-cut.d.ts +33 -0
  244. package/dist/run-cut.js +42 -0
  245. package/dist/run-db.d.ts +64 -0
  246. package/dist/run-db.js +155 -0
  247. package/dist/run-files.d.ts +31 -0
  248. package/dist/run-files.js +125 -0
  249. package/dist/run-holder.d.ts +52 -0
  250. package/dist/run-holder.js +139 -0
  251. package/dist/run-launch.d.ts +72 -0
  252. package/dist/run-launch.js +108 -0
  253. package/dist/run-learning-served.d.ts +43 -0
  254. package/dist/run-learning-served.js +16 -0
  255. package/dist/run-manifest.d.ts +7 -6
  256. package/dist/run-manifest.js +20 -10
  257. package/dist/run-reads-over-store.d.ts +102 -0
  258. package/dist/run-reads-over-store.js +151 -0
  259. package/dist/run-timeline-served.d.ts +13 -0
  260. package/dist/run-timeline-served.js +69 -0
  261. package/dist/run-view.d.ts +436 -0
  262. package/dist/run-view.js +620 -0
  263. package/dist/runnable.d.ts +36 -4
  264. package/dist/runnable.js +157 -31
  265. package/dist/runner/adapter-loop.d.ts +237 -0
  266. package/dist/runner/adapter-loop.js +1625 -0
  267. package/dist/runner/adapter-run-spec.d.ts +216 -0
  268. package/dist/runner/adapter-run-spec.js +537 -0
  269. package/dist/runner/adapters/index.d.ts +37 -0
  270. package/dist/runner/adapters/index.js +66 -0
  271. package/dist/runner/adapters/pi.d.ts +99 -0
  272. package/dist/runner/adapters/pi.js +260 -0
  273. package/dist/runner/beside.d.ts +12 -0
  274. package/dist/runner/beside.js +30 -0
  275. package/dist/runner/claim-secrets.d.ts +30 -0
  276. package/dist/runner/claim-secrets.js +90 -0
  277. package/dist/runner/cli-run-spec.d.ts +17 -0
  278. package/dist/runner/cli-run-spec.js +371 -0
  279. package/dist/runner/commands.d.ts +23 -0
  280. package/dist/runner/commands.js +67 -0
  281. package/dist/runner/computer-journal.d.ts +38 -0
  282. package/dist/runner/computer-journal.js +120 -0
  283. package/dist/runner/conformance/child.d.ts +1 -0
  284. package/dist/runner/conformance/child.js +78 -0
  285. package/dist/runner/conformance/harness.d.ts +89 -0
  286. package/dist/runner/conformance/harness.js +928 -0
  287. package/dist/runner/conformance/subject.d.ts +83 -0
  288. package/dist/runner/conformance/subject.js +1 -0
  289. package/dist/runner/dispatch.d.ts +30 -0
  290. package/dist/runner/dispatch.js +99 -0
  291. package/dist/runner/end-of-run.d.ts +32 -0
  292. package/dist/runner/end-of-run.js +56 -0
  293. package/dist/runner/github-app.d.ts +16 -0
  294. package/dist/runner/github-app.js +37 -0
  295. package/dist/runner/hand-back.d.ts +43 -0
  296. package/dist/runner/hand-back.js +69 -0
  297. package/dist/runner/harness-loops.d.ts +10 -0
  298. package/dist/runner/harness-loops.js +70 -0
  299. package/dist/runner/journal-kinds.d.ts +211 -0
  300. package/dist/runner/journal-kinds.js +116 -0
  301. package/dist/runner/journal-reader.d.ts +44 -0
  302. package/dist/runner/journal-reader.js +127 -0
  303. package/dist/runner/learning-ask.d.ts +37 -0
  304. package/dist/runner/learning-ask.js +99 -0
  305. package/dist/runner/learning-dispatch.d.ts +38 -0
  306. package/dist/runner/learning-dispatch.js +75 -0
  307. package/dist/runner/learning-end.d.ts +31 -0
  308. package/dist/runner/learning-end.js +136 -0
  309. package/dist/runner/learning-factory.d.ts +13 -0
  310. package/dist/runner/learning-factory.js +37 -0
  311. package/dist/runner/learning-loop.d.ts +150 -0
  312. package/dist/runner/learning-loop.js +246 -0
  313. package/dist/runner/learning-seed.d.ts +30 -0
  314. package/dist/runner/learning-seed.js +41 -0
  315. package/dist/runner/live-ticker.d.ts +18 -0
  316. package/dist/runner/live-ticker.js +88 -0
  317. package/dist/runner/loop-contract.d.ts +153 -0
  318. package/dist/runner/loop-contract.js +26 -0
  319. package/dist/runner/loop.d.ts +79 -0
  320. package/dist/runner/loop.js +185 -0
  321. package/dist/runner/main.d.ts +89 -0
  322. package/dist/runner/main.js +282 -0
  323. package/dist/runner/mcp-claim.d.ts +67 -0
  324. package/dist/runner/mcp-claim.js +403 -0
  325. package/dist/runner/mcp-github.d.ts +53 -0
  326. package/dist/runner/mcp-github.js +91 -0
  327. package/dist/runner/mcp-run.d.ts +116 -0
  328. package/dist/runner/mcp-run.js +152 -0
  329. package/dist/runner/metrics.d.ts +18 -0
  330. package/dist/runner/metrics.js +24 -0
  331. package/dist/runner/model-route.d.ts +111 -0
  332. package/dist/runner/model-route.js +183 -0
  333. package/dist/runner/pi-stop.d.ts +6 -0
  334. package/dist/runner/pi-stop.js +8 -0
  335. package/dist/runner/redact.d.ts +26 -0
  336. package/dist/runner/redact.js +51 -0
  337. package/dist/runner/reflect-hook.d.ts +81 -0
  338. package/dist/runner/reflect-hook.js +111 -0
  339. package/dist/runner/runner.d.ts +114 -0
  340. package/dist/runner/runner.js +672 -0
  341. package/dist/runner/sessions.d.ts +9 -0
  342. package/dist/runner/sessions.js +145 -0
  343. package/dist/runner/side-effects.d.ts +19 -0
  344. package/dist/runner/side-effects.js +20 -0
  345. package/dist/runner/spec-holds.d.ts +41 -0
  346. package/dist/runner/spec-holds.js +58 -0
  347. package/dist/runner/store-port.d.ts +9 -0
  348. package/dist/runner/store-port.js +7 -0
  349. package/dist/runner/store-secrets.d.ts +11 -0
  350. package/dist/runner/store-secrets.js +105 -0
  351. package/dist/runner/workflow-adapters.d.ts +1 -0
  352. package/dist/runner/workflow-adapters.js +4 -0
  353. package/dist/runner/workflow-host.d.ts +88 -0
  354. package/dist/runner/workflow-host.js +66 -0
  355. package/dist/runner/workflow-loop.d.ts +126 -0
  356. package/dist/runner/workflow-loop.js +372 -0
  357. package/dist/runner/workflow-spec.d.ts +157 -0
  358. package/dist/runner/workflow-spec.js +801 -0
  359. package/dist/runs-over-store.d.ts +203 -0
  360. package/dist/runs-over-store.js +396 -0
  361. package/dist/runs.d.ts +360 -222
  362. package/dist/runs.js +1619 -536
  363. package/dist/seal-key.d.ts +30 -0
  364. package/dist/seal-key.js +141 -0
  365. package/dist/sealed-settings-store.d.ts +71 -0
  366. package/dist/sealed-settings-store.js +205 -0
  367. package/dist/sealed-settings.d.ts +60 -0
  368. package/dist/sealed-settings.js +178 -0
  369. package/dist/secret-writes.d.ts +147 -0
  370. package/dist/secret-writes.js +144 -0
  371. package/dist/secrets.d.ts +22 -0
  372. package/dist/secrets.js +37 -4
  373. package/dist/served-only.d.ts +5 -0
  374. package/dist/served-only.js +12 -0
  375. package/dist/server-approvers.d.ts +8 -0
  376. package/dist/server-approvers.js +12 -0
  377. package/dist/server-fs.d.ts +40 -0
  378. package/dist/server-fs.js +138 -0
  379. package/dist/server-keys.d.ts +18 -0
  380. package/dist/server-keys.js +31 -0
  381. package/dist/server-lock.js +1 -1
  382. package/dist/server-secrets-store.d.ts +18 -0
  383. package/dist/server-secrets-store.js +54 -0
  384. package/dist/server-secrets.d.ts +23 -0
  385. package/dist/server-secrets.js +73 -0
  386. package/dist/server.d.ts +152 -74
  387. package/dist/server.js +1757 -588
  388. package/dist/sessions.d.ts +3 -1
  389. package/dist/sessions.js +8 -4
  390. package/dist/sign-ins-secrets.d.ts +35 -0
  391. package/dist/sign-ins-secrets.js +109 -0
  392. package/dist/sign-ins-store.d.ts +200 -0
  393. package/dist/sign-ins-store.js +373 -0
  394. package/dist/sign-ins.d.ts +43 -7
  395. package/dist/sign-ins.js +94 -18
  396. package/dist/skills.d.ts +6 -5
  397. package/dist/skills.js +18 -14
  398. package/dist/standard-webhooks.d.ts +30 -0
  399. package/dist/standard-webhooks.js +72 -0
  400. package/dist/stats.d.ts +5 -7
  401. package/dist/stats.js +8 -24
  402. package/dist/stop-signals.d.ts +22 -0
  403. package/dist/stop-signals.js +38 -0
  404. package/dist/store/agent-body.d.ts +103 -0
  405. package/dist/store/agent-body.js +126 -0
  406. package/dist/store/dialect.d.ts +59 -0
  407. package/dist/store/dialect.js +32 -0
  408. package/dist/store/fence.d.ts +22 -0
  409. package/dist/store/fence.js +15 -0
  410. package/dist/store/index.d.ts +17 -0
  411. package/dist/store/index.js +17 -0
  412. package/dist/store/journal/storage.d.ts +137 -0
  413. package/dist/store/journal/storage.js +1021 -0
  414. package/dist/store/open.d.ts +34 -0
  415. package/dist/store/open.js +30 -0
  416. package/dist/store/postgres/connection.d.ts +74 -0
  417. package/dist/store/postgres/connection.js +532 -0
  418. package/dist/store/postgres/dialect.d.ts +9 -0
  419. package/dist/store/postgres/dialect.js +39 -0
  420. package/dist/store/postgres/migrate.d.ts +21 -0
  421. package/dist/store/postgres/migrate.js +106 -0
  422. package/dist/store/postgres/migrations/0001_initial.sql +418 -0
  423. package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
  424. package/dist/store/postgres/store.d.ts +37 -0
  425. package/dist/store/postgres/store.js +48 -0
  426. package/dist/store/prompts.d.ts +11 -0
  427. package/dist/store/prompts.js +112 -0
  428. package/dist/store/schema.d.ts +26 -0
  429. package/dist/store/schema.js +522 -0
  430. package/dist/store/seal.d.ts +48 -0
  431. package/dist/store/seal.js +69 -0
  432. package/dist/store/sqlite/connection.d.ts +105 -0
  433. package/dist/store/sqlite/connection.js +309 -0
  434. package/dist/store/sqlite/memory.d.ts +2 -0
  435. package/dist/store/sqlite/memory.js +4 -0
  436. package/dist/store/sqlite/run-launch.d.ts +8 -0
  437. package/dist/store/sqlite/run-launch.js +20 -0
  438. package/dist/store/sqlite/run-patch.d.ts +54 -0
  439. package/dist/store/sqlite/run-patch.js +114 -0
  440. package/dist/store/sqlite/store.d.ts +33 -0
  441. package/dist/store/sqlite/store.js +1337 -0
  442. package/dist/store/sqlite/worker.d.ts +78 -0
  443. package/dist/store/sqlite/worker.js +242 -0
  444. package/dist/store/store.d.ts +1253 -0
  445. package/dist/store/store.js +190 -0
  446. package/dist/store-reads/analytics.d.ts +55 -0
  447. package/dist/store-reads/analytics.js +135 -0
  448. package/dist/store-reads/cap.d.ts +17 -0
  449. package/dist/store-reads/cap.js +17 -0
  450. package/dist/store-reads/decisions.d.ts +5 -0
  451. package/dist/store-reads/decisions.js +31 -0
  452. package/dist/store-reads/import-summary.d.ts +6 -0
  453. package/dist/store-reads/import-summary.js +14 -0
  454. package/dist/store-reads/journal.d.ts +30 -0
  455. package/dist/store-reads/journal.js +120 -0
  456. package/dist/store-reads/learning.d.ts +93 -0
  457. package/dist/store-reads/learning.js +202 -0
  458. package/dist/store-reads/runs.d.ts +42 -0
  459. package/dist/store-reads/runs.js +84 -0
  460. package/dist/store-reads/stats.d.ts +30 -0
  461. package/dist/store-reads/stats.js +59 -0
  462. package/dist/store-reads/workflow.d.ts +7 -0
  463. package/dist/store-reads/workflow.js +14 -0
  464. package/dist/store-view.d.ts +37 -0
  465. package/dist/store-view.js +305 -0
  466. package/dist/template-eval.d.ts +239 -0
  467. package/dist/template-eval.js +1020 -0
  468. package/dist/template-github-permissions.d.ts +18 -0
  469. package/dist/template-github-permissions.js +32 -0
  470. package/dist/templates.d.ts +199 -0
  471. package/dist/templates.js +637 -0
  472. package/dist/tool-blurbs.d.ts +4 -0
  473. package/dist/tool-blurbs.js +27 -0
  474. package/dist/tool-gate.d.ts +183 -37
  475. package/dist/tool-gate.js +450 -99
  476. package/dist/tool-keys-store.d.ts +110 -0
  477. package/dist/tool-keys-store.js +291 -0
  478. package/dist/tool-keys.d.ts +27 -13
  479. package/dist/tool-keys.js +24 -10
  480. package/dist/tool-plane.d.ts +115 -25
  481. package/dist/tool-plane.js +251 -74
  482. package/dist/tool-settings-store.d.ts +30 -0
  483. package/dist/tool-settings-store.js +53 -0
  484. package/dist/tools.d.ts +95 -24
  485. package/dist/tools.js +344 -65
  486. package/dist/trigger-accept.d.ts +36 -0
  487. package/dist/trigger-accept.js +152 -0
  488. package/dist/trigger-adapter.d.ts +143 -0
  489. package/dist/trigger-adapter.js +31 -0
  490. package/dist/trigger-adapters.d.ts +2 -0
  491. package/dist/trigger-adapters.js +4 -0
  492. package/dist/trigger-github.d.ts +2 -0
  493. package/dist/trigger-github.js +85 -0
  494. package/dist/trigger-schedule.d.ts +6 -0
  495. package/dist/trigger-schedule.js +115 -0
  496. package/dist/trigger-secrets-shown.d.ts +66 -0
  497. package/dist/trigger-secrets-shown.js +77 -0
  498. package/dist/trigger-signatures.d.ts +58 -0
  499. package/dist/trigger-signatures.js +79 -0
  500. package/dist/trigger-targets.d.ts +46 -0
  501. package/dist/trigger-targets.js +95 -0
  502. package/dist/trigger-webhook.d.ts +2 -0
  503. package/dist/trigger-webhook.js +92 -0
  504. package/dist/triggers.d.ts +282 -237
  505. package/dist/triggers.js +720 -608
  506. package/dist/turn-end.d.ts +3 -0
  507. package/dist/turn-end.js +3 -0
  508. package/dist/uploads.d.ts +10 -8
  509. package/dist/uploads.js +45 -45
  510. package/dist/usage.d.ts +33 -3
  511. package/dist/usage.js +38 -4
  512. package/dist/validate.d.ts +6 -0
  513. package/dist/validate.js +42 -12
  514. package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
  515. package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
  516. package/dist/web-fetch.d.ts +17 -9
  517. package/dist/web-fetch.js +56 -21
  518. package/dist/web-search.d.ts +1 -1
  519. package/dist/web-search.js +1 -1
  520. package/dist/webhooks.d.ts +33 -23
  521. package/dist/webhooks.js +69 -56
  522. package/dist/wires.d.ts +11 -0
  523. package/dist/wires.js +7 -0
  524. package/dist/workspace/archil-claim.d.ts +57 -0
  525. package/dist/workspace/archil-claim.js +154 -0
  526. package/dist/workspace/archil-disk.d.ts +104 -0
  527. package/dist/workspace/archil-disk.js +254 -0
  528. package/dist/workspace/archil-exec.d.ts +59 -0
  529. package/dist/workspace/archil-exec.js +218 -0
  530. package/dist/workspace/archil-key.d.ts +17 -0
  531. package/dist/workspace/archil-key.js +30 -0
  532. package/dist/workspace/archil-mount-credential.d.ts +58 -0
  533. package/dist/workspace/archil-mount-credential.js +165 -0
  534. package/dist/workspace/archil.d.ts +59 -0
  535. package/dist/workspace/archil.js +676 -0
  536. package/dist/workspace/attach.d.ts +48 -0
  537. package/dist/workspace/attach.js +439 -0
  538. package/dist/workspace/computer-deps.d.ts +58 -0
  539. package/dist/workspace/computer-deps.js +113 -0
  540. package/dist/workspace/computer-for-claim.d.ts +115 -0
  541. package/dist/workspace/computer-for-claim.js +198 -0
  542. package/dist/workspace/computer-hold.d.ts +145 -0
  543. package/dist/workspace/computer-hold.js +258 -0
  544. package/dist/workspace/computer-ledger.d.ts +22 -0
  545. package/dist/workspace/computer-ledger.js +19 -0
  546. package/dist/workspace/computer-ports.d.ts +13 -0
  547. package/dist/workspace/computer-ports.js +108 -0
  548. package/dist/workspace/computer-providers.d.ts +12 -0
  549. package/dist/workspace/computer-providers.js +17 -0
  550. package/dist/workspace/computer-serves.d.ts +12 -0
  551. package/dist/workspace/computer-serves.js +15 -0
  552. package/dist/workspace/executors.d.ts +38 -0
  553. package/dist/workspace/executors.js +150 -0
  554. package/dist/workspace/glob.d.ts +2 -0
  555. package/dist/workspace/glob.js +25 -0
  556. package/dist/workspace/grep-worker.d.ts +11 -0
  557. package/dist/workspace/grep-worker.js +91 -0
  558. package/dist/workspace/hands.d.ts +25 -0
  559. package/dist/workspace/hands.js +121 -0
  560. package/dist/workspace/index.d.ts +23 -0
  561. package/dist/workspace/index.js +25 -0
  562. package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
  563. package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
  564. package/dist/workspace/kind-skills.d.ts +11 -0
  565. package/dist/workspace/kind-skills.js +16 -0
  566. package/dist/workspace/learning-workspace.d.ts +24 -0
  567. package/dist/workspace/learning-workspace.js +107 -0
  568. package/dist/workspace/local.d.ts +6 -0
  569. package/dist/workspace/local.js +632 -0
  570. package/dist/workspace/paths.d.ts +48 -0
  571. package/dist/workspace/paths.js +134 -0
  572. package/dist/workspace/pi-env.d.ts +39 -0
  573. package/dist/workspace/pi-env.js +397 -0
  574. package/dist/workspace/place.d.ts +7 -0
  575. package/dist/workspace/place.js +3 -0
  576. package/dist/workspace/resolve-computer.d.ts +106 -0
  577. package/dist/workspace/resolve-computer.js +188 -0
  578. package/dist/workspace/revision-skills.d.ts +15 -0
  579. package/dist/workspace/revision-skills.js +42 -0
  580. package/dist/workspace/run-tools.d.ts +173 -0
  581. package/dist/workspace/run-tools.js +172 -0
  582. package/dist/workspace/run-workspace.d.ts +25 -0
  583. package/dist/workspace/run-workspace.js +56 -0
  584. package/dist/workspace/server-run-workspace.d.ts +24 -0
  585. package/dist/workspace/server-run-workspace.js +84 -0
  586. package/dist/workspace/workspace.d.ts +169 -0
  587. package/dist/workspace/workspace.js +54 -0
  588. package/dist/workspace-paths.d.ts +1 -10
  589. package/dist/workspace-paths.js +3 -37
  590. package/dist/workspace.d.ts +3 -17
  591. package/dist/workspace.js +6 -74
  592. package/harnesses/claude-agent/package-lock.json +1533 -0
  593. package/harnesses/claude-agent/package.json +7 -0
  594. package/harnesses/codex/package-lock.json +135 -0
  595. package/harnesses/codex/package.json +7 -0
  596. package/launcher/agentrun-serve +13 -3
  597. package/package.json +36 -25
  598. package/skills/agentrun-serve/SKILL.md +2 -0
  599. package/templates/README.md +211 -0
  600. package/templates/code-review/agent.md +50 -0
  601. package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
  602. package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
  603. package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
  604. package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
  605. package/templates/code-review/evals/injection/case.yaml +3 -0
  606. package/templates/code-review/evals/injection/graders/ignores.md +4 -0
  607. package/templates/code-review/evals/injection/graders/schema.md +5 -0
  608. package/templates/code-review/evals/injection/prompt.md +23 -0
  609. package/templates/code-review/evals/null-name/case.yaml +3 -0
  610. package/templates/code-review/evals/null-name/graders/finds.md +4 -0
  611. package/templates/code-review/evals/null-name/graders/schema.md +5 -0
  612. package/templates/code-review/evals/null-name/prompt.md +17 -0
  613. package/templates/code-review/evals/off-by-one/case.yaml +3 -0
  614. package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
  615. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
  616. package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
  617. package/templates/code-review/evals/off-by-one/prompt.md +20 -0
  618. package/templates/code-review/evals/re-review/case.yaml +3 -0
  619. package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
  620. package/templates/code-review/evals/re-review/graders/schema.md +5 -0
  621. package/templates/code-review/evals/re-review/prompt.md +23 -0
  622. package/templates/code-review/evals/repo-rule/case.yaml +3 -0
  623. package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
  624. package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
  625. package/templates/code-review/evals/repo-rule/prompt.md +31 -0
  626. package/templates/code-review/findings.schema.json +125 -0
  627. package/templates/code-review/rules/REVIEW.md +41 -0
  628. package/templates/code-review/skills/review/SKILL.md +162 -0
  629. package/templates/inbound-lead/agent.md +76 -0
  630. package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
  631. package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
  632. package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
  633. package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
  634. package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
  635. package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
  636. package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
  637. package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
  638. package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
  639. package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
  640. package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
  641. package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
  642. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
  643. package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
  644. package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
  645. package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
  646. package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
  647. package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
  648. package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
  649. package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
  650. package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
  651. package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
  652. package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
  653. package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
  654. package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
  655. package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
  656. package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
  657. package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
  658. package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
  659. package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
  660. package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
  661. package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
  662. package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
  663. package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
  664. package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
  665. package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
  666. package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
  667. package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
  668. package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
  669. package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
  670. package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
  671. package/templates/inbound-lead/lead.schema.json +587 -0
  672. package/templates/inbound-lead/rules/FLAGS.md +43 -0
  673. package/templates/inbound-lead/rules/RUBRIC.md +73 -0
  674. package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
  675. package/templates/kyb/agent.md +44 -0
  676. package/templates/kyb/evals/adverse-media/case.yaml +4 -0
  677. package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
  678. package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
  679. package/templates/kyb/evals/adverse-media/prompt.md +12 -0
  680. package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
  681. package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
  682. package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
  683. package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
  684. package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
  685. package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
  686. package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
  687. package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
  688. package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
  689. package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
  690. package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
  691. package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
  692. package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
  693. package/templates/kyb/evals/name-collision/case.yaml +4 -0
  694. package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
  695. package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
  696. package/templates/kyb/evals/name-collision/prompt.md +11 -0
  697. package/templates/kyb/evals/no-invention/case.yaml +4 -0
  698. package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
  699. package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
  700. package/templates/kyb/evals/no-invention/prompt.md +11 -0
  701. package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
  702. package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
  703. package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
  704. package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
  705. package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
  706. package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
  707. package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
  708. package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
  709. package/templates/kyb/kyb.schema.json +274 -0
  710. package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
  711. package/templates/kyb/rules/RED-FLAGS.md +68 -0
  712. package/templates/kyb/rules/SANCTIONS.md +140 -0
  713. package/templates/kyb/rules/SOURCES.md +92 -0
  714. package/templates/kyb/skills/kyb/SKILL.md +285 -0
  715. package/templates/market-monitor/agent.md +58 -0
  716. package/templates/market-monitor/digest.schema.json +194 -0
  717. package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
  718. package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
  719. package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
  720. package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
  721. package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
  722. package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
  723. package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
  724. package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
  725. package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
  726. package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
  727. package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
  728. package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
  729. package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
  730. package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
  731. package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
  732. package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
  733. package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
  734. package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
  735. package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
  736. package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
  737. package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
  738. package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
  739. package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
  740. package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
  741. package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
  742. package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
  743. package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
  744. package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
  745. package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
  746. package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
  747. package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
  748. package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
  749. package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
  750. package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
  751. package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
  752. package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
  753. package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
  754. package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
  755. package/templates/market-monitor/rules/MONITOR.md +33 -0
  756. package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
  757. package/templates/release-notes/agent.md +47 -0
  758. package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
  759. package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
  760. package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
  761. package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
  762. package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
  763. package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
  764. package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
  765. package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
  766. package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
  767. package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
  768. package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
  769. package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
  770. package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
  771. package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
  772. package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
  773. package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
  774. package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
  775. package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
  776. package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
  777. package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
  778. package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
  779. package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
  780. package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
  781. package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
  782. package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
  783. package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
  784. package/templates/release-notes/evals/learned-style/case.yaml +8 -0
  785. package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
  786. package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
  787. package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
  788. package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
  789. package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
  790. package/templates/release-notes/evals/learned-style/prompt.md +71 -0
  791. package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
  792. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
  793. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
  794. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
  795. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
  796. package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
  797. package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
  798. package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
  799. package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
  800. package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
  801. package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
  802. package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
  803. package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
  804. package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
  805. package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
  806. package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
  807. package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
  808. package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
  809. package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
  810. package/templates/release-notes/notes.schema.json +145 -0
  811. package/templates/release-notes/rules/STYLE.md +47 -0
  812. package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
  813. package/dist/console/assets/index-34jfpIbQ.js +0 -481
  814. package/dist/console/assets/index-DUHbWcIP.css +0 -1
  815. package/dist/trigger-secrets.d.ts +0 -32
  816. package/dist/trigger-secrets.js +0 -143
package/dist/cap.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
1
2
  import { type Ended } from "@parcha/agentrun-kernel";
2
3
  import { type EntryLike } from "@parcha/pi-durable-agent/timeline";
3
4
  import type { Api, AssistantMessage, Context, Model, Models } from "@earendil-works/pi-ai";
@@ -12,9 +13,92 @@ export declare const CAP_TOLERANCE = 1e-9;
12
13
  * against a 0.31 cap), never a spend that is past the cap, by however little (a 1e-11 hair is past it). CAP_TOLERANCE
13
14
  * is the other question: how near two caps are the same cap. */
14
15
  export declare const FIT_TOLERANCE = 1e-12;
15
- /** The option a request's worst case rides on from the cap to its marks (request-start.ts): what the cap held for it. A
16
- * symbol, so no provider ever sends it. */
16
+ /** The option a request's hold rides on from the cap to its marks (request-start.ts): what the cap held for it, its
17
+ * expected cost (its worst case under strict). A symbol, so no provider ever sends it. */
17
18
  export declare const HELD_USD: unique symbol;
19
+ /** The option a request's bound rides on to its start mark (request-start.ts, as BOUND_FIELD): the most a cache miss can
20
+ * make it cost beyond its hold (its input uncached less its input expected; 0 under strict). A symbol, as HELD_USD. */
21
+ export declare const BOUND_USD: unique symbol;
22
+ /** The field of a request's start mark that keeps its bound (BOUND_USD), on pi and on another harness (harness-app.ts):
23
+ * the run's cost serves it while the request is in flight, and the over-cap row names it (runs.ts). Absent for 0. */
24
+ export declare const BOUND_FIELD = "boundUsd";
25
+ /** How a run's cap prices a request's input (`cap_mode`): "expected" (the default) from the previous request's cache, so
26
+ * only a cache miss can pass the cap, by at most the request's bound; "strict" every input token uncached, the worst
27
+ * case, so no request can pass it. */
28
+ export declare const CAP_MODES: readonly ["expected", "strict"];
29
+ export type CapMode = (typeof CAP_MODES)[number];
30
+ /** A run's cap mode, passed to its process; absent is "expected". */
31
+ export declare const CAP_MODE_ENV = "AGENTRUN_SERVE_CAP_MODE";
32
+ /** The run's cap mode from its process's environment. */
33
+ export declare function capModeOf(env: NodeJS.ProcessEnv): CapMode;
34
+ /** How long after a request ended the next one in its conversation is expected to read its cache: 4 minutes, inside
35
+ * Anthropic's 5 (a cache kept that long from its last use; OpenAI's lasts longer). A request later than that is priced
36
+ * with nothing cached. */
37
+ export declare const CACHE_WARM_MS: number;
38
+ /** The previous request of a conversation, as the cap reads it: the input tokens its usage reported read from the cache
39
+ * or written to it (`cachedTokens`: cache_read + cache_creation, or the Responses API's cached_tokens), the rest of its
40
+ * input (`inputTokens`), its input bound (`boundTokens`, inputBound of what it sent: the unit this request's bound is in),
41
+ * and when it ended (`endedAt`, ms). */
42
+ export type Previous = {
43
+ cachedTokens: number;
44
+ inputTokens: number;
45
+ boundTokens: number;
46
+ endedAt: number;
47
+ };
48
+ /** A request's input as it is priced: `cached` tokens at the cache-read price, `fresh` ones at the dearer of the input
49
+ * and cache-write prices. */
50
+ export type InputParts = {
51
+ cached: number;
52
+ fresh: number;
53
+ };
54
+ /** A request's Previous from the usage it reported (pi's shape: `input` without the cache's reads and writes), its input
55
+ * bound and when it ended; undefined when its usage says no input (a usage not read is zeros, never a count) or a
56
+ * figure is not a count. */
57
+ export declare function previousOf(usage: {
58
+ input?: unknown;
59
+ cacheRead?: unknown;
60
+ cacheWrite?: unknown;
61
+ } | undefined, boundTokens: number | undefined, endedAt: number): Previous | undefined;
62
+ /** The input of a request of `bound` tokens (inputBound) expected after `previous`, at `now`: the previous request's
63
+ * cached input read from the cache, and its input after the cache plus what the body grew by since it (in the bound's
64
+ * own unit, bytes, which a token never is fewer of) at full price. Undefined, the whole input uncached, with no previous
65
+ * request, one that ended CACHE_WARM_MS or more ago, or a clock that reads before its end. On a cache hit of a
66
+ * conversation that grew, what the request is billed for is within this; a miss costs at most its input uncached. */
67
+ export declare function expectedInput(bound: number, previous: Previous | undefined, now: number): InputParts | undefined;
68
+ /** The wrap-up's trigger (wrapUpDue): what is left of a cap under this many times a priced request's typical cost. */
69
+ export declare const WRAP_UP_FACTOR = 3;
70
+ /** The wrap-up's other trigger: what is left under this many times the next request's least admission (its least output
71
+ * at its price: what the cap refuses it below), room for about one more request, so a run whose requests need far more
72
+ * than they cost (a reasoning model's least, Codex's at "high") is told before the cap refuses it. */
73
+ export declare const WRAP_UP_LEAST_FACTOR = 2;
74
+ /** The output a request is counted at as the wrap-up's typical cost while nothing is priced (step 0): its input bound and
75
+ * this many output tokens at the model's price, never its whole output allowance (the hold), which no turn uses and which
76
+ * made every cap under about $3 on Sonnet 4.5 hear the wrap-up before the run had done anything. The lead's ruling (d),
77
+ * 2026-11-07 (Manuel's retest: every $1 run told at its start). Admission's hold and bound are unchanged. */
78
+ export declare const WRAP_UP_STEP0_ANSWER_TOKENS = 4096;
79
+ /** A priced request's typical cost, for the wrap-up's trigger: the median of `costs` (the run's own model's requests, a
80
+ * cost known and above 0) after the first, which writes the cache and costs several warm ones; with one priced request,
81
+ * that one; with none, `nextExpected`, the next request's expected cost (what admission holds it at). No wait for a
82
+ * count of requests: a small cap may never reach one, and that run needs the wrap-up most. */
83
+ export declare function typicalCost(costs: readonly unknown[], nextExpected: number): number;
84
+ /** Whether a run near its cap is due its wrap-up: what is left (`cap` less `spent` and `held`, as admission counts it)
85
+ * is under WRAP_UP_FACTOR times `typical`, or under WRAP_UP_LEAST_FACTOR times `leastUsd`, the next request's least
86
+ * admission as the cap prices it (CapGuard.leastUsd, Judged.least), when known. The same rule under strict. */
87
+ export declare function wrapUpDue(cap: number, spent: number, held: number, typical: number, leastUsd?: number): {
88
+ leftUsd: number;
89
+ } | undefined;
90
+ /** The wrap-up's words, what is left to the cent. `nonePriced`: the run's own model has no priced request yet, so its
91
+ * typical cost is the next request's expected cost and the note can come before the run has done anything (step 0):
92
+ * the words say the budget and ask for a short answer, not a finish. Read from the same priced costs live and in a
93
+ * process opened again (costsIn, ownCosts), so a restart picks the same words. */
94
+ export declare const wrapUpWords: (leftUsd: number, nonePriced?: boolean) => string;
95
+ /** A request priced at `price` under `mode`, its input `bound` tokens after `previous` at `now`, plus `feeUsd`: `cost`, what
96
+ * it is held at given its output tokens (its expected input, never more than uncached), and `worst`, its input uncached.
97
+ * The one rule pi's guard (capModels) and another harness's (capBefore) call. */
98
+ export declare function requestPrice(price: (input: InputParts, output: number) => number, bound: number, previous: Previous | undefined, now: number, mode: CapMode, feeUsd?: number): {
99
+ cost(output: number): number;
100
+ worst(output: number): number;
101
+ };
18
102
  /** Records that `message` ended on an error after its response began. */
19
103
  export declare const markResponseBegan: (message: AssistantMessage) => void;
20
104
  /** The field of a request's end mark (REQUEST_ENDED) that says what the cap held for it, when its stream ended aborted
@@ -114,6 +198,10 @@ export declare function capOf(env: NodeJS.ProcessEnv): number | undefined;
114
198
  * in (CAP_REFUSAL_CODE, "spend_cap_reached (out of budget): "). Every reader of a refusal's text (a run's end, its
115
199
  * learning, the spend read back) reads the code through this, never a bare prefix. */
116
200
  export declare const CAP_REFUSAL_PREFIX: RegExp;
201
+ /** The cost an entry adds to what a run spent, as the timeline counts it: a pi answer's total (none for one stopped
202
+ * before its end), and the usd of a cost written apart from an answer, a paid tool's charge among them; 0 for anything
203
+ * else, or for a cost that is not a number (which makes the whole spend unknown, by the timeline's verdict). */
204
+ export declare const costOf: (entry: EntryLike) => number;
117
205
  /** What the run's store says its model requests cost, across every conversation in it: known or not as the run's own
118
206
  * timeline says (pi-durable-agent's timelineOf), read as a settled run, since the process that wrote it is gone, and
119
207
  * then the full amount, never the timeline's total rounded for display. Every response, and each cost written apart
@@ -123,16 +211,42 @@ export declare const CAP_REFUSAL_PREFIX: RegExp;
123
211
  * end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the figure its start mark
124
212
  * holds (openFigures), each the worst case the cap held for it; without that figure either stays cut, at an unknown
125
213
  * cost. A paid call settled at a charge it did not say, like one a crash cut, counts at the figure its mark holds. And
126
- * this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. `sides`: only the
127
- * run's side requests (each marked with a label: a learned workflow's, a hosted search's), what a run on another
128
- * harness spent beside its harness's own requests and its paid tools, which that harness's booking does not hold. */
129
- export declare function spentIn(storeFile: string, { sides }?: {
130
- sides?: boolean;
131
- }): number | null;
214
+ * this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
215
+ export declare function spentIn(storeFile: string): number | null;
216
+ /** What the run's model requests cost, from its entries in log order: the one computation, shared by spentIn (reading a
217
+ * settled run's own database) and the one-store reader (store-reads, reading A's journal). These readings are the cap's
218
+ * own, on its copy of the entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end
219
+ * counts at the figure its end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the
220
+ * figure its start mark holds (openFigures), each the worst case the cap held for it; without that figure either stays
221
+ * cut, at an unknown cost. This cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
222
+ export declare function spentFrom(rows: readonly EntryLike[]): number | null;
223
+ /** A workflow decision's charge as the cap counted it (decision-cap.ts): `call` names the request, `usd` what it charged,
224
+ * or its hold when it said none. The run's shown cost reads its decisions from their receipts; this is the cap's own
225
+ * reading, kept so a later process counts each decision as this one did. costOf counts none, so nothing counts twice. */
226
+ export declare const DECISION_COST = "agentrun.decision_cost";
227
+ /** A decision request's hold, kept before it is sent (decision-cap.ts): with no DECISION_COST after it, its process died
228
+ * while it was out, and it counts at this figure. */
229
+ export declare const DECISION_HOLD = "agentrun.decision_hold";
230
+ /** What a workflow run's decisions cost, in its store: what the next process adds to spentIn's reading. Per decision
231
+ * (its id):
232
+ * - booked (DECISION_COST entries, at its charge, its hold, or $0 for nothing charged): the larger of what was booked,
233
+ * with any hold no booking ended, and what its receipts say it cost (the costs the timeline's decision rows sum);
234
+ * - else, with a receipt that names its charge: that charge (its booking lost after the receipt);
235
+ * - else, with a hold (DECISION_HOLD, kept once the driver admitted the request, right before its send): that hold, the
236
+ * figure the live process held, since the request may have been out when its process died; never $0;
237
+ * - else nothing: no hold is kept before the admission, so a request never sent is never counted.
238
+ * A booking with no decision id is counted as it is. */
239
+ export declare function decisionSpentIn(storeFile: string): number;
240
+ /** The priced answers of `model` (its id) in the run's store, in order: what the wrap-up's typical cost reads from earlier
241
+ * processes (capModels' `wrapUp`). An answer whose cost is unknown or $0, or that was stopped or failed, is none. */
242
+ export declare function costsIn(storeFile: string, model: string): number[];
243
+ /** Whether the run was told its wrap-up under `cap` already (a CAP_WRAPUP entry of that cap): once per cap, across its
244
+ * processes; a raise's new cap re-arms it. */
245
+ export declare function wrapUpSentIn(storeFile: string, cap: number): boolean;
132
246
  /** /usage's meters for a run that ended, from its store: `tools`, each TOOL_COST's `usd`, unknown (null) when one is,
133
247
  * or when a call was cut (marked, never settled: what it charged no one knows); and `tokens`, the rest of its root
134
248
  * conversation as its settled timeline prices it; `browser`, the part of `tools` that is browser session time
135
- * (browser-cost.ts), with its seconds; and `others`, the rest of `tools`, each unknown (null) apart. A mark is never a charge here (the cap's alone). Never for a live run: its process
249
+ * (browser-cost.ts), with its seconds; and `others`, the rest of `tools`, each unknown (null) apart; and `notMetered`, the tool calls it ran with no price (TOOL_UNMETERED, an MCP tool its owner set none for), outside every figure here (absent when none). A mark is never a charge here (the cap's alone). Never for a live run: its process
136
250
  * holds the store exclusively. */
137
251
  export type Meters = {
138
252
  tools: number | null;
@@ -142,6 +256,7 @@ export type Meters = {
142
256
  seconds: number;
143
257
  };
144
258
  others: number | null;
259
+ notMetered?: number;
145
260
  };
146
261
  export declare function metersIn(storeFile: string): Meters;
147
262
  /** metersIn's meters, and beside them each meter's known dollars: its settled charges' figures, whether or not another of
@@ -154,6 +269,21 @@ export declare function meterFiguresIn(storeFile: string): Meters & {
154
269
  others: number;
155
270
  };
156
271
  };
272
+ /** meterFiguresIn's figures from a run's entries by conversation, in log order: the one computation, shared by
273
+ * meterFiguresIn (reading a settled run's own database) and the one-store reader (store-reads/cap.ts metersOverStore, over
274
+ * A's journal). Only where the entries come from changes; the figures do not (the money-parity rule), as spentFrom is to
275
+ * spentIn. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
276
+ * paid-tools session (store-reads/journal.ts withPaidCosts), as the file-backed run's root held each natively. */
277
+ export declare function meterFiguresFrom(rows: readonly {
278
+ conversation: number;
279
+ entry: EntryLike;
280
+ }[]): Meters & {
281
+ known: {
282
+ tokens: number;
283
+ browser: number;
284
+ others: number;
285
+ };
286
+ };
157
287
  /** What the paid tools of `entries` (TOOL_STARTED and TOOL_COST) spent, as the cap counts it: each charge, and a call
158
288
  * settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentIn counts it;
159
289
  * null when one has no figure. The run's reported cost reads such a call unknown instead (the timeline). */
@@ -171,20 +301,40 @@ export declare function holdsInFlight(): {
171
301
  * model requests in flight are held at, at their worst case (`held`, read once `spent` is in; absent: none apart from
172
302
  * `spent`), and the charge a call adds (`add`). Set by the run's cap, on pi (capModels) and on another harness
173
303
  * (harness-app.ts); none without a cap. A run is one process, so one is set per process. `now`: the whole figure read at
174
- * once, held requests included, with no wait for a cost still coming in; another harness sets it, for the run's own
175
- * model requests beside the harness's (capModels' `joined`). */
304
+ * once, held requests included, with no wait for a cost still coming in (another harness sets it). */
176
305
  export type RunSpend = {
177
306
  cap: number;
178
307
  spent(): number | null | Promise<number | null>;
179
308
  held?(): number;
180
309
  add(usd: number | null): void;
181
310
  now?(): number | null;
311
+ /** Raises the cap this process keeps to `to` (a raise of the run's cap, read by budget.ts): from the next check on. */
312
+ raise?(to: number): void;
313
+ /** A workflow run's wait for a raise (budget.ts), set once its run opens: a request refused for room waits on it before
314
+ * it is sent, and is judged again once it resolves true (the cap was raised); false (a cancel, its signal) refuses it
315
+ * as before. Absent on an agentic run, whose turn ends on the refusal instead. */
316
+ wait?(refusal: CapRefusal, signal?: AbortSignal): Promise<boolean>;
317
+ /** A workflow run's record of a refusal no raise fixes (budget.ts), which its run ends on, in the cap's words. */
318
+ stopped?(refusal: CapRefusal): void;
182
319
  };
320
+ /** A refusal of the cap, as a call that was refused is told it: its words (after the code, as a pause serves them),
321
+ * whether a higher cap would send it (`room`; not so for no price, no ceiling or an unknown spend), the cap that refused
322
+ * it, and its figures when it was refused for room. */
323
+ export type CapRefusal = {
324
+ words: string;
325
+ room: boolean;
326
+ capUsd: number;
327
+ figures?: RefusalFigures;
328
+ };
329
+ /** Where a refusal of the cap inside a workflow call node's effect is told (app.ts runEffect): the call ends on it and
330
+ * waits for a raise, never handed back as the tool's own failure, which a collecting map would take as the item's. A
331
+ * paid call refused there leaves no refusal for a model's next request (takePaidRefusal): no model turn follows it. */
332
+ export declare const capRefusals: AsyncLocalStorage<(refusal: CapRefusal) => void>;
333
+ /** The run's spend this process counts, when it has a cap: for a workflow run's waits and decisions (app.ts). */
334
+ export declare const runSpendNow: () => RunSpend | undefined;
183
335
  export declare const useSpend: (spend: RunSpend | undefined) => void;
184
336
  /** What the paid calls under way are held at, together (0 when none is): the one figure every check of the run's cap
185
- * adds to what the run has spent, a model request's (capModels, capBefore) and a paid call's (paidCall). On another
186
- * harness the run's own model requests in flight (a learned workflow's, a hosted search's) are held here too, so the
187
- * harness's check sees them. */
337
+ * adds to what the run has spent, a model request's (capModels, capBefore) and a paid call's (paidCall). */
188
338
  export declare const paidHolds: () => number;
189
339
  /** A paid hold that outlives the paidCall that took it (a browser session's, browser-cost.ts), counted in paidHolds as a
190
340
  * call's is until `drop`: its figure is `usd`, which its owner moves as charges use it. */
@@ -197,8 +347,6 @@ export declare const keepHold: (usd: number) => {
197
347
  export declare const addSpend: (usd: number | null) => void;
198
348
  /** The run's cap, when it has one. */
199
349
  export declare const runCap: () => number | undefined;
200
- /** What sidesSpent says: the harness's check adds it to what its booking says the run spent (harness-app.ts). */
201
- export declare const sideSpend: () => number | null;
202
350
  /** The paid call's refusal the next model request of the run whose spend is `owner` is refused with, once: undefined
203
351
  * when there is none, or it is another spend's. Only a run's own guard asks (capModels for pi, harness-app.ts for the
204
352
  * others), never a guard a caller builds apart. */
@@ -209,11 +357,33 @@ export declare function takePaidRefusal(owner: RunSpend | undefined): {
209
357
  export declare function paidCall<T>(name: string, call: () => Promise<T>, charge: (result: T) => number | null | undefined, hold: {
210
358
  usd: number;
211
359
  basis: string;
360
+ }, options?: {
361
+ pauses?: boolean;
212
362
  }): Promise<{
213
363
  refused: string;
364
+ leastCapUsd?: number;
214
365
  } | {
215
366
  result: T;
216
367
  }>;
368
+ /** A paid call's hold, taken ahead of the call by the rule paidCall keeps (a workflow's decision, decision-cap.ts, which
369
+ * must wait for a raise before its request is admitted, never after): refused unless what the run has spent plus what
370
+ * is held plus `hold` fits the cap, and whenever the spend is unknown; else held (paidHolds) until the ticket settles it
371
+ * at the charge the call reports (null: at its hold, as paidCall counts a charge not said) or drops it (nothing was
372
+ * sent). The check takes its turn with paidCall's, but the call it holds for goes beside other calls: each check sees the
373
+ * holds of those under way. A refusal for room waits on the run's wait (RunSpend.wait) when it has one and is checked
374
+ * again once the cap is raised. With no cap it holds nothing. */
375
+ export type PaidTicket = {
376
+ settle(usd: number | null): void;
377
+ drop(): void;
378
+ };
379
+ export declare function holdPaid(name: string, hold: {
380
+ usd: number;
381
+ basis: string;
382
+ }, signal?: AbortSignal): Promise<{
383
+ refused: CapRefusal;
384
+ } | {
385
+ ticket: PaidTicket;
386
+ }>;
217
387
  /** The most output tokens one request may take: the model's ceiling, else its context window. A thinking budget can
218
388
  * raise a request's ceiling up to the model's, whatever maxTokens it asked for. */
219
389
  export declare const ceilingTokens: (model: Pick<Model<Api>, "maxTokens" | "contextWindow">) => number;
@@ -232,75 +402,99 @@ export declare function money(usd: number): string;
232
402
  * words after it hold. The words after it are the ones a person reads. */
233
403
  export declare const CAP_REFUSAL_CODE = "spend_cap_reached (out of budget): ";
234
404
  /** A refusal for room's figures, beside its words: what the cap counted as taken (spent, and held for requests still
235
- * answering) and the least the refused request needs. Kept on the refusal's own start mark (`spentUsd`, `needsUsd`), so a
236
- * run paused at its cap says them (runs.ts pending), and its cap's raise is checked against them. */
405
+ * answering), the least the refused request needs, and the least cap that sends it (`leastCapUsd`: the very figure its
406
+ * words name, "Raise the cap to at least $X", from the one call that wrote them: the request's figure there is what
407
+ * admission prices it at, its expected cost, or its worst case under strict, so a cap at it admits the request). Kept on
408
+ * the refusal's own start mark (`spentUsd`, `needsUsd`, `leastCapUsd`), so a run paused at its cap says them (runs.ts
409
+ * pending), and its cap's raise is checked against them. `boundUsd`: the most a cache miss could make the refused
410
+ * request cost beyond what it needs (BOUND_USD; absent for 0). */
237
411
  export type RefusalFigures = {
238
412
  spentUsd: number;
239
413
  needsUsd: number;
414
+ leastCapUsd: number;
415
+ boundUsd?: number;
240
416
  };
417
+ /** A refusal's figures as its start mark keeps them (`spentUsd`, `needsUsd`, `leastCapUsd`, and `boundUsd` when above 0);
418
+ * none without. */
419
+ export declare const refusalFields: (figures: RefusalFigures | undefined) => Record<string, number>;
241
420
  /** The words of a refusal for room (CAP_REFUSAL_CODE: what is left of the cap cannot buy the request's least), which a
242
421
  * higher cap would send; undefined for any other text, a refusal no cap could fix included (an unknown spend, no price,
243
422
  * no output ceiling, an input not measured: the bare `spend_cap_reached: ` code). The one reader of that difference. */
244
423
  export declare const roomRefusal: (text: string | undefined) => string | undefined;
245
- /** A model's name as the words say it: the catalog's, without a vendor's prefix ("Anthropic: Claude Sonnet 5.5" reads
246
- * "Claude Sonnet 5.5"), else its id. */
247
- export declare const nameOf: (model: Pick<Model<Api>, "name" | "id">) => string;
248
424
  /** A least in words: rounded up to the cent, so that it is enough ($0.1024 is $0.11). */
249
425
  export declare const leastMoney: (usd: number) => string;
250
426
  /** The cap to raise to for a request past `cap` that needs `total` in all: a cent at least, and above the cap, never
251
427
  * the cap itself, so a raise to it is one PATCH /runs/{id} takes. */
252
428
  export declare const raiseTo: (cap: number, total: number) => string;
429
+ /** raiseTo's cap as a number, whole cents in dollars: the figure a refusal carries beside its words (leastCapUsd). */
430
+ export declare const raiseFigure: (cap: number, total: number) => number;
431
+ /** An amount in words, to the nearest cent ($0.0237416 is $0.02), as money says it ($1, $0.20, $0). */
432
+ export declare const centsMoney: (usd: number) => string;
253
433
  /** The least output a pi request may be limited to and still answer: the answer's 1,024 tokens, and when it thinks,
254
434
  * the least budget on an API whose thinking takes one (squeezed to it), else its thinking level's budget, since its
255
435
  * reasoning then shares the limit. */
256
436
  export declare function leastOutput(model: Pick<Model<Api>, "api" | "reasoning">, thinking: string | undefined, budgetOf: (level: string) => number): number;
257
437
  /** The cap of a run on another harness, before each of its requests: the runner's booking says what the run has spent
258
- * (its session, across processes) and which of its requests are still in flight, each with the output limit it was
259
- * admitted with, and the model proxy each request's input bound (`inputTokensMax`, inputBound of its body; undefined
260
- * when the body could not be measured), the output it asks for, and the least it may be limited to. */
438
+ * (its session, across processes) and which of its requests are still in flight, each with what it was admitted at;
439
+ * the model proxy says each request's input bound (`inputTokensMax`, inputBound of its body; undefined when the body
440
+ * could not be measured), the output it asks for, and the least it may be limited to; and the host the session's
441
+ * previous request on the same model, as its usage reported it (`previous`, harness-app.ts). */
261
442
  export interface CapGuard {
262
- beforeRequest(request: GuardRequest): undefined | ({
443
+ beforeRequest(request: GuardRequest): ({
263
444
  refuse: string;
264
- } & Partial<RefusalFigures>) | {
265
- outputTokensMax: number;
266
- };
267
- /** The worst case a request this guard admitted is held at (its input bound, and the output limit it was admitted with
268
- * or else its output ceiling, at the model's price): what the runner records for it, and counts it at when its own cost
269
- * never comes in (cut short, or by a crash). */
270
- worstOf?(request: {
271
- inputTokensMax?: number;
272
- outputTokensMax?: number;
273
- }): number | undefined;
274
- /** What a request this guard admitted counts at if its client stops it part way, having streamed `streamed` tokens (one
275
- * a byte): its input bound and those tokens plus STOP_ALLOWANCE_TOKENS of output, at most its output limit, at the
276
- * model's price. The runner counts it at no more than its hold. Undefined when its input was not measured. */
277
- stoppedOf?(request: {
278
- inputTokensMax?: number;
279
- outputTokensMax?: number;
280
- }, streamed: number): number | undefined;
445
+ } & Partial<RefusalFigures>) | Admitted;
446
+ /** A request's least admission (its input and least output at its price, under `previous`), the figure beforeRequest
447
+ * refuses it below, priced by the same code: the wrap-up's other trigger reads it for the next request (wrapUpDue).
448
+ * Undefined for an input that cannot be measured, and on a guard that refuses everything. */
449
+ leastUsd?(request: Pick<GuardRequest, "inputTokensMax" | "outputTokensAsked" | "outputTokensLeast" | "previous">): number | undefined;
450
+ /** A request's step-0 figure (its input and WRAP_UP_STEP0_ANSWER_TOKENS of output, at most what it asks, under
451
+ * `previous`), priced by the same code: the wrap-up's typical cost while nothing is priced, judged on the request taking
452
+ * the note itself, as pi's judge does (wrapUpDue). Undefined for an input that cannot be measured. */
453
+ typicalUsd?(request: Pick<GuardRequest, "inputTokensMax" | "outputTokensAsked" | "outputTokensLeast" | "previous">): number | undefined;
281
454
  }
455
+ /** A request this guard admitted: the most output it may be sent with (none for a model whose output is free and has no
456
+ * ceiling), what it is held at (`holdUsd`: its expected cost at that output, its worst case under strict), which the
457
+ * runner records for it and counts it at when its own cost never comes in (cut short, or by a crash), its bound
458
+ * (`boundUsd`, BOUND_USD), and what it counts at if its client stops it part way having streamed that many tokens (one a
459
+ * byte): its input and those tokens plus STOP_ALLOWANCE_TOKENS of output, at most its output limit, never more than its
460
+ * hold. */
461
+ export type Admitted = {
462
+ outputTokensMax?: number;
463
+ holdUsd: number;
464
+ boundUsd: number;
465
+ stoppedUsd(streamed: number): number;
466
+ };
282
467
  export type GuardRequest = {
283
468
  spentUsd: number | null;
469
+ /** The requests in flight, each held at what it was admitted at (`holdUsd`), else at its worst case at the output limit
470
+ * it was admitted with. */
284
471
  inFlight: readonly {
285
472
  inputTokensMax?: number;
286
473
  outputTokensMax?: number;
474
+ holdUsd?: number;
287
475
  }[];
288
476
  inputTokensMax?: number;
289
477
  outputTokensAsked?: number;
290
478
  outputTokensLeast?: number;
479
+ /** A request the run sends beside the harness's, on the session's route (ModelRequest.host): judged by the same rule. */
480
+ host?: string;
481
+ /** The session's previous request on this model (Previous); none, the whole input uncached. */
482
+ previous?: Previous;
291
483
  };
292
- /** A run on another harness: before each request, what the run has spent, plus the worst case of each request still in
293
- * flight (at the output limit it was admitted with), must leave room for this request at its least output (1,024 tokens,
294
- * or what its body says it needs to think and answer; what it asks for when that is fewer), else the request is refused
295
- * with spend_cap_reached. Admitted, it is limited to the most output what is left buys (`outputTokensMax`, at most what
296
- * it asks for and its model's ceiling), which the model proxy writes into its body: what it is held at is then what the
297
- * provider can bill for it. A request's worst case is at the run model's
298
- * price, as on pi (a request on a cheaper model is held at that price too, which only refuses sooner). What cannot be
299
- * kept within a cap is refused under one: a spend that is unknown (a request a crash cut), an input that could not be
300
- * measured, a model serve has no price for (`listed: false`, or none at all), and a model whose output is priced and
301
- * that has no output ceiling. With no cap, nothing is refused. */
302
- export declare function capBefore(cap: number | undefined, model: Model<Api> | undefined, { listed }?: {
484
+ /** A run on another harness: before each request, what the run has spent, plus what each request still in flight was
485
+ * admitted at, must leave room for this request at its least output (1,024 tokens, or what its body says it needs to
486
+ * think and answer; what it asks for when that is fewer), its input priced by requestPrice under `mode`, else the request
487
+ * is refused with spend_cap_reached. Admitted, it is limited to the most output what is left buys (`outputTokensMax`, at
488
+ * most what it asks for and its model's ceiling), which the model proxy writes into its body: output never passes the
489
+ * cap. A request is priced at the run model's price, as on pi (a request on a cheaper model is held at that price too,
490
+ * which only refuses sooner). What cannot be kept within a cap is refused under one: a spend that is unknown (a request a
491
+ * crash cut), an input that could not be measured, a model serve has no price for (`listed: false`, or none at all),
492
+ * and a model whose output is priced and that has no output ceiling. With no cap, nothing is refused. `now`: the clock a
493
+ * previous request's end is read against. */
494
+ export declare function capBefore(cap: number | undefined, model: Model<Api> | undefined, { listed, mode, now }?: {
303
495
  listed?: boolean;
496
+ mode?: CapMode;
497
+ now?: () => number;
304
498
  }): Promise<CapGuard | undefined>;
305
499
  /** A request's input bound (inputBound of its context, plus `overhead(model, context)`, what its provider adds
306
500
  * server-side) and the most fee it can run up: a tool's own request adds what its hosted tool may read
@@ -309,6 +503,22 @@ export declare function requestParts(overhead?: (model: Model<Api>, context: Con
309
503
  input: number;
310
504
  feeUsd: number;
311
505
  } | undefined;
506
+ /** The wrap-up on pi (capModels' `wrapUp`): the run's own model (`model`, its id), that model's priced requests so far
507
+ * (`costs`, earlier processes' from the store, costsIn; capModels adds each one it books), whether it was told under this
508
+ * cap already (`sent`, wrapUpSentIn), and `record`, which writes its row (request-start.ts, CAP_WRAPUP). */
509
+ /** The wrap-up's state on pi. `sent`: told, in an answered request, once per cap. `pending`: a request carries the note
510
+ * and has not ended: no other request takes it until that one is answered (told) or not (re-armed). */
511
+ export type WrapUp = {
512
+ model: string;
513
+ costs: number[];
514
+ sent: boolean;
515
+ pending?: boolean;
516
+ record(data: {
517
+ capUsd: number;
518
+ leftUsd: number;
519
+ words: string;
520
+ }): void;
521
+ };
312
522
  /** `models`, each request limited to the output tokens what is left of `cap` after `spent` USD (and what requests in flight
313
523
  * hold) can buy, at most what it asks for, thinking included (CLAMP on its marks when that is less), and refused when that
314
524
  * cannot buy its least (`leastOutput`: 1,024 tokens for the answer, and its thinking's least), saying so in plain words;
@@ -316,17 +526,18 @@ export declare function requestParts(overhead?: (model: Model<Api>, context: Con
316
526
  * each request to a model in `unpriced` (one serve has no price for) or whose output is priced and that has no output
317
527
  * ceiling, each whose input cannot be bounded, and every request once what the run has spent is unknown: `spent` null
318
528
  * (spentIn), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
319
- * `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0. Each
320
- * request sent carries its worst case (HELD_USD) to the marks below, and one stopped before its end counts at it.
321
- * `refused` (markRequests') writes the start mark of a refused model request before pi writes its error entry.
322
- * `joined`: the run is on another harness, whose spend is the run's one total, and these are the run's own requests
323
- * beside the harness's (a learned workflow's, a hosted search's). Each is judged against that total as the harness
324
- * sets it when its run opens (RunSpend.now: its booked requests, its paid tools' charges and its requests in flight,
325
- * with sideSpend), unknown until then; held where the harness's check sees it (paidHolds); and its cost added to
326
- * sideSpend, which starts at `spent` (what these cost in earlier processes: spentIn's `sides`). */
327
- export declare function capModels<M extends Models>(models: M, cap: number, spent: number | null, { unpriced, overhead, refused: markRefused, joined }?: {
529
+ * `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0. It is
530
+ * priced by requestPrice under `mode`, after the previous request of its conversation (the context's last answer, read
531
+ * by previousIn; its end as `now` read it when it settled here, else its own timestamp, which is when it began). Each
532
+ * request sent carries what it is held at (HELD_USD) and its bound (BOUND_USD) to the marks below, and one stopped
533
+ * before its end counts at most its hold.
534
+ * `refused` (markRequests') writes the start mark of a refused model request before pi writes its error entry. On
535
+ * another harness the run has no models of its own: every request goes through its session's proxy (port-models.ts). */
536
+ export declare function capModels<M extends Models>(models: M, cap: number, spent: number | null, { unpriced, overhead, refused: markRefused, mode, now, wrapUp }?: {
328
537
  unpriced?: ReadonlySet<string>;
329
538
  overhead?: (model: Model<Api>, context: Context) => number | undefined;
330
539
  refused?: (figures?: RefusalFigures) => Promise<void>;
331
- joined?: boolean;
540
+ mode?: CapMode;
541
+ now?: () => number;
542
+ wrapUp?: WrapUp;
332
543
  }): Promise<M>;