@parcha/agentrun-serve 0.1.0-beta.31 → 0.1.0-beta.33

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