@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/CHANGELOG.md +452 -0
  2. package/README.md +311 -142
  3. package/dist/agent-rows.d.ts +1 -1
  4. package/dist/agents-store.d.ts +35 -3
  5. package/dist/agents-store.js +39 -14
  6. package/dist/answer-json.d.ts +34 -1
  7. package/dist/answer-json.js +91 -9
  8. package/dist/api-only.d.ts +1 -1
  9. package/dist/api-only.js +2 -2
  10. package/dist/attach-conformance-cli.d.ts +1 -0
  11. package/dist/attach-conformance-cli.js +18 -0
  12. package/dist/attach-conformance.d.ts +25 -0
  13. package/dist/attach-conformance.js +343 -0
  14. package/dist/browser-cost.d.ts +1 -1
  15. package/dist/browser-cost.js +52 -93
  16. package/dist/browser-live.d.ts +20 -8
  17. package/dist/browser-live.js +50 -27
  18. package/dist/cap.d.ts +0 -407
  19. package/dist/cap.js +4 -1028
  20. package/dist/catalog.d.ts +1 -12
  21. package/dist/catalog.js +4 -34
  22. package/dist/cli.js +13 -4
  23. package/dist/composio-preset.d.ts +53 -0
  24. package/dist/composio-preset.js +221 -0
  25. package/dist/computer-attach.d.ts +125 -0
  26. package/dist/computer-attach.js +330 -0
  27. package/dist/computer-calls.d.ts +60 -0
  28. package/dist/computer-calls.js +209 -0
  29. package/dist/computer-channel.d.ts +57 -0
  30. package/dist/computer-channel.js +115 -0
  31. package/dist/computer-commands.d.ts +1 -1
  32. package/dist/computer-held-routes.d.ts +35 -0
  33. package/dist/computer-held-routes.js +106 -0
  34. package/dist/computer-held.d.ts +48 -0
  35. package/dist/computer-held.js +87 -0
  36. package/dist/computer-keys.d.ts +21 -1
  37. package/dist/computer-keys.js +53 -11
  38. package/dist/computer-live.d.ts +165 -0
  39. package/dist/computer-live.js +655 -0
  40. package/dist/computer-setting.d.ts +15 -2
  41. package/dist/computer-setting.js +20 -4
  42. package/dist/computer-view.d.ts +14 -0
  43. package/dist/computer-view.js +51 -3
  44. package/dist/computer-viewer.d.ts +6 -0
  45. package/dist/computer-viewer.js +311 -0
  46. package/dist/computers.d.ts +37 -8
  47. package/dist/computers.js +62 -14
  48. package/dist/console/assets/index-CjqQirbo.css +1 -0
  49. package/dist/console/assets/index-b6-XY5A9.js +576 -0
  50. package/dist/console/index.html +2 -2
  51. package/dist/console-links.d.ts +2 -0
  52. package/dist/console-links.js +3 -0
  53. package/dist/decisions.js +4 -0
  54. package/dist/faux-computers.d.ts +9 -20
  55. package/dist/faux-computers.js +56 -26
  56. package/dist/github-connection.d.ts +10 -2
  57. package/dist/github-connection.js +65 -2
  58. package/dist/github-faux.js +1 -1
  59. package/dist/graph-view.d.ts +1 -1
  60. package/dist/harness-opencode/adapter.js +7 -3
  61. package/dist/harness-opencode/facts.js +0 -2
  62. package/dist/harness-opencode/host/policy.d.ts +2 -5
  63. package/dist/harness-opencode/host/policy.js +8 -32
  64. package/dist/harness-table.d.ts +0 -2
  65. package/dist/harness-table.js +0 -2
  66. package/dist/harness.d.ts +1 -0
  67. package/dist/harness.js +35 -1
  68. package/dist/host-tools.d.ts +2 -6
  69. package/dist/host-tools.js +7 -10
  70. package/dist/hosted-search.d.ts +5 -6
  71. package/dist/hosted-search.js +2 -28
  72. package/dist/import-sources.d.ts +10 -0
  73. package/dist/import-sources.js +44 -2
  74. package/dist/import.d.ts +3 -3
  75. package/dist/import.js +37 -6
  76. package/dist/key-words.d.ts +3 -2
  77. package/dist/key-words.js +4 -2
  78. package/dist/learn/check.d.ts +10 -2
  79. package/dist/learn/check.js +13 -5
  80. package/dist/learn/commit.d.ts +14 -2
  81. package/dist/learn/commit.js +23 -9
  82. package/dist/learn/compile.d.ts +243 -0
  83. package/dist/learn/compile.js +471 -0
  84. package/dist/learn/folder.d.ts +6 -0
  85. package/dist/learn/folder.js +4 -1
  86. package/dist/learn/general.d.ts +69 -0
  87. package/dist/learn/general.js +75 -0
  88. package/dist/learn/grade.d.ts +5 -1
  89. package/dist/learn/grade.js +29 -7
  90. package/dist/learn/notes.d.ts +8 -0
  91. package/dist/learn/notes.js +18 -0
  92. package/dist/learn/promote.d.ts +253 -0
  93. package/dist/learn/promote.js +428 -0
  94. package/dist/learn/refit.d.ts +39 -0
  95. package/dist/learn/refit.js +236 -0
  96. package/dist/learn/reflect.d.ts +9 -20
  97. package/dist/learn/reflect.js +18 -125
  98. package/dist/learn/replay-calls.d.ts +63 -0
  99. package/dist/learn/replay-calls.js +158 -0
  100. package/dist/learn/skills.d.ts +50 -14
  101. package/dist/learn/skills.js +183 -47
  102. package/dist/learn/workflow-nodes.d.ts +15 -0
  103. package/dist/learn/workflow-nodes.js +44 -0
  104. package/dist/learned-nodes.d.ts +50 -2
  105. package/dist/learned-nodes.js +41 -2
  106. package/dist/learned-workflow.d.ts +43 -3
  107. package/dist/learned-workflow.js +170 -28
  108. package/dist/learning-batch.d.ts +283 -0
  109. package/dist/learning-batch.js +574 -0
  110. package/dist/learning-cost.d.ts +18 -6
  111. package/dist/learning-cost.js +15 -7
  112. package/dist/learning-evals.d.ts +33 -0
  113. package/dist/learning-evals.js +98 -0
  114. package/dist/learning-routes.d.ts +37 -2
  115. package/dist/learning-routes.js +52 -8
  116. package/dist/learning-words.d.ts +13 -0
  117. package/dist/learning-words.js +13 -0
  118. package/dist/learning.d.ts +55 -17
  119. package/dist/learning.js +91 -48
  120. package/dist/live/stream.js +6 -3
  121. package/dist/live/translate.d.ts +4 -3
  122. package/dist/live/translate.js +8 -4
  123. package/dist/live-reach.d.ts +37 -0
  124. package/dist/live-reach.js +62 -0
  125. package/dist/llm.js +0 -3
  126. package/dist/mcp-gateway.d.ts +21 -20
  127. package/dist/mcp-gateway.js +76 -55
  128. package/dist/mcp-oauth.d.ts +62 -7
  129. package/dist/mcp-oauth.js +134 -19
  130. package/dist/mcp-pin-first.d.ts +37 -0
  131. package/dist/mcp-pin-first.js +107 -0
  132. package/dist/mcp-private-hosts.d.ts +4 -4
  133. package/dist/mcp-private-hosts.js +20 -12
  134. package/dist/mcp-probe.d.ts +27 -11
  135. package/dist/mcp-probe.js +60 -42
  136. package/dist/mcp-secret-writes.js +4 -0
  137. package/dist/mcp-servers-store.d.ts +115 -25
  138. package/dist/mcp-servers-store.js +241 -43
  139. package/dist/mcp-sources.d.ts +39 -0
  140. package/dist/mcp-sources.js +74 -0
  141. package/dist/mcp-store.d.ts +21 -4
  142. package/dist/mcp-store.js +33 -8
  143. package/dist/mcp-wire.d.ts +22 -0
  144. package/dist/mcp-wire.js +36 -0
  145. package/dist/mcp.js +3 -3
  146. package/dist/meta-tool-names.d.ts +1 -0
  147. package/dist/meta-tool-names.js +3 -0
  148. package/dist/model-form.d.ts +26 -0
  149. package/dist/model-form.js +80 -0
  150. package/dist/model.d.ts +13 -0
  151. package/dist/model.js +69 -25
  152. package/dist/monid.d.ts +51 -25
  153. package/dist/monid.js +226 -140
  154. package/dist/openapi.js +694 -59
  155. package/dist/page.d.ts +18 -0
  156. package/dist/page.js +48 -20
  157. package/dist/paid-calls.d.ts +26 -29
  158. package/dist/paid-calls.js +46 -102
  159. package/dist/place-offers.d.ts +2 -3
  160. package/dist/place-offers.js +3 -7
  161. package/dist/place.js +1 -2
  162. package/dist/print.d.ts +15 -1
  163. package/dist/print.js +14 -3
  164. package/dist/propose.d.ts +10 -1
  165. package/dist/propose.js +30 -10
  166. package/dist/provider.js +12 -4
  167. package/dist/reflect-range.d.ts +8 -1
  168. package/dist/reflect-range.js +3 -2
  169. package/dist/rows.d.ts +5 -3
  170. package/dist/rows.js +15 -4
  171. package/dist/run-launch.d.ts +27 -2
  172. package/dist/run-launch.js +15 -4
  173. package/dist/run-learning-served.d.ts +13 -2
  174. package/dist/run-manifest.d.ts +5 -0
  175. package/dist/run-manifest.js +20 -0
  176. package/dist/run-reads-over-store.d.ts +1 -1
  177. package/dist/run-repo.d.ts +20 -0
  178. package/dist/run-repo.js +63 -0
  179. package/dist/run-secrets.js +2 -3
  180. package/dist/run-timeline-served.d.ts +1 -1
  181. package/dist/run-timeline-served.js +5 -2
  182. package/dist/run-view.d.ts +19 -8
  183. package/dist/run-view.js +62 -26
  184. package/dist/runnable.d.ts +0 -3
  185. package/dist/runnable.js +37 -29
  186. package/dist/runner/adapter-loop.d.ts +47 -17
  187. package/dist/runner/adapter-loop.js +1427 -303
  188. package/dist/runner/adapter-run-spec.d.ts +23 -9
  189. package/dist/runner/adapter-run-spec.js +162 -56
  190. package/dist/runner/adapters/pi-computer.d.ts +9 -0
  191. package/dist/runner/adapters/pi-computer.js +51 -0
  192. package/dist/runner/adapters/pi.d.ts +25 -11
  193. package/dist/runner/adapters/pi.js +168 -45
  194. package/dist/runner/beside.d.ts +7 -3
  195. package/dist/runner/beside.js +21 -11
  196. package/dist/runner/claim-secrets.d.ts +4 -0
  197. package/dist/runner/claim-secrets.js +6 -1
  198. package/dist/runner/cli-run-spec.d.ts +20 -3
  199. package/dist/runner/cli-run-spec.js +174 -64
  200. package/dist/runner/commands.d.ts +3 -1
  201. package/dist/runner/commands.js +28 -3
  202. package/dist/runner/computer-channel.d.ts +34 -0
  203. package/dist/runner/computer-channel.js +62 -0
  204. package/dist/runner/conformance/harness.d.ts +3 -0
  205. package/dist/runner/conformance/harness.js +224 -17
  206. package/dist/runner/conformance/subject.d.ts +12 -5
  207. package/dist/runner/dispatch.js +3 -0
  208. package/dist/runner/end-of-run.d.ts +23 -12
  209. package/dist/runner/end-of-run.js +41 -16
  210. package/dist/runner/feedback-round.d.ts +52 -0
  211. package/dist/runner/feedback-round.js +79 -0
  212. package/dist/runner/github-app.d.ts +2 -1
  213. package/dist/runner/github-app.js +4 -2
  214. package/dist/runner/harness-loops.js +15 -1
  215. package/dist/runner/held-run.d.ts +65 -0
  216. package/dist/runner/held-run.js +158 -0
  217. package/dist/runner/journal-kinds.d.ts +44 -7
  218. package/dist/runner/journal-kinds.js +29 -0
  219. package/dist/runner/journal-reader.d.ts +5 -4
  220. package/dist/runner/journal-reader.js +12 -10
  221. package/dist/runner/learning-ask.d.ts +7 -1
  222. package/dist/runner/learning-ask.js +21 -6
  223. package/dist/runner/learning-dispatch.d.ts +22 -0
  224. package/dist/runner/learning-dispatch.js +77 -10
  225. package/dist/runner/learning-end.d.ts +69 -13
  226. package/dist/runner/learning-end.js +340 -87
  227. package/dist/runner/learning-factory.d.ts +1 -1
  228. package/dist/runner/learning-factory.js +11 -5
  229. package/dist/runner/learning-loop.d.ts +86 -8
  230. package/dist/runner/learning-loop.js +178 -23
  231. package/dist/runner/learning-seed.d.ts +11 -0
  232. package/dist/runner/learning-seed.js +27 -0
  233. package/dist/runner/live-ticker.js +1 -0
  234. package/dist/runner/loop-contract.d.ts +26 -3
  235. package/dist/runner/loop.d.ts +21 -2
  236. package/dist/runner/loop.js +23 -2
  237. package/dist/runner/main.d.ts +13 -1
  238. package/dist/runner/main.js +27 -5
  239. package/dist/runner/mcp-claim.d.ts +15 -8
  240. package/dist/runner/mcp-claim.js +176 -71
  241. package/dist/runner/mcp-github.js +1 -1
  242. package/dist/runner/mcp-run.d.ts +21 -57
  243. package/dist/runner/mcp-run.js +25 -85
  244. package/dist/runner/meta-tools.d.ts +37 -0
  245. package/dist/runner/meta-tools.js +268 -0
  246. package/dist/runner/metrics.d.ts +11 -2
  247. package/dist/runner/metrics.js +26 -5
  248. package/dist/runner/model-route.js +12 -3
  249. package/dist/runner/monid-run.d.ts +16 -0
  250. package/dist/runner/monid-run.js +96 -0
  251. package/dist/runner/pr-checkout.d.ts +1 -0
  252. package/dist/runner/pr-checkout.js +1 -1
  253. package/dist/runner/promotion.d.ts +80 -0
  254. package/dist/runner/promotion.js +562 -0
  255. package/dist/runner/reflect-hook.d.ts +46 -13
  256. package/dist/runner/reflect-hook.js +149 -48
  257. package/dist/runner/runner.d.ts +26 -0
  258. package/dist/runner/runner.js +208 -17
  259. package/dist/runner/scratch-sweep.d.ts +13 -0
  260. package/dist/runner/scratch-sweep.js +62 -0
  261. package/dist/runner/sessions.d.ts +9 -4
  262. package/dist/runner/sessions.js +5 -1
  263. package/dist/runner/step-guard.d.ts +62 -0
  264. package/dist/runner/step-guard.js +93 -0
  265. package/dist/runner/store-port.d.ts +4 -2
  266. package/dist/runner/store-secrets.js +4 -3
  267. package/dist/runner/subagent.d.ts +0 -3
  268. package/dist/runner/subagent.js +10 -13
  269. package/dist/runner/workflow-first.d.ts +216 -0
  270. package/dist/runner/workflow-first.js +303 -0
  271. package/dist/runner/workflow-host.d.ts +6 -1
  272. package/dist/runner/workflow-host.js +1 -1
  273. package/dist/runner/workflow-loop.d.ts +1 -1
  274. package/dist/runner/workflow-loop.js +17 -10
  275. package/dist/runner/workflow-spec.d.ts +15 -2
  276. package/dist/runner/workflow-spec.js +63 -23
  277. package/dist/runs-over-store.d.ts +17 -3
  278. package/dist/runs-over-store.js +59 -20
  279. package/dist/seal-key.js +3 -3
  280. package/dist/sealed-settings-store.d.ts +5 -2
  281. package/dist/sealed-settings-store.js +10 -4
  282. package/dist/secret-writes.d.ts +5 -4
  283. package/dist/secret-writes.js +5 -4
  284. package/dist/server-secrets-store.d.ts +4 -3
  285. package/dist/server-secrets-store.js +15 -9
  286. package/dist/server-secrets.js +3 -2
  287. package/dist/server.d.ts +119 -18
  288. package/dist/server.js +841 -202
  289. package/dist/settings-wake.d.ts +23 -0
  290. package/dist/settings-wake.js +65 -0
  291. package/dist/standard-webhooks.d.ts +4 -1
  292. package/dist/standard-webhooks.js +8 -4
  293. package/dist/store/agent-body.d.ts +14 -3
  294. package/dist/store/agent-body.js +14 -10
  295. package/dist/store/command-wake.d.ts +13 -0
  296. package/dist/store/command-wake.js +37 -0
  297. package/dist/store/dialect.d.ts +6 -0
  298. package/dist/store/dialect.js +5 -0
  299. package/dist/store/index.d.ts +1 -1
  300. package/dist/store/journal/storage.d.ts +3 -2
  301. package/dist/store/journal/storage.js +13 -5
  302. package/dist/store/postgres/connection.js +3 -1
  303. package/dist/store/postgres/dialect.js +4 -0
  304. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  305. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  306. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  307. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  308. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  309. package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
  310. package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
  311. package/dist/store/schema.d.ts +10 -1
  312. package/dist/store/schema.js +104 -15
  313. package/dist/store/sqlite/connection.d.ts +2 -2
  314. package/dist/store/sqlite/connection.js +2 -2
  315. package/dist/store/sqlite/run-patch.d.ts +7 -5
  316. package/dist/store/sqlite/run-patch.js +45 -18
  317. package/dist/store/sqlite/store.js +331 -72
  318. package/dist/store/store.d.ts +312 -21
  319. package/dist/store/store.js +12 -1
  320. package/dist/store-reads/cap.d.ts +1 -1
  321. package/dist/store-reads/cap.js +8 -1
  322. package/dist/store-reads/decisions.d.ts +2 -2
  323. package/dist/store-reads/decisions.js +1 -1
  324. package/dist/store-reads/import-summary.d.ts +1 -1
  325. package/dist/store-reads/journal.d.ts +30 -5
  326. package/dist/store-reads/journal.js +128 -56
  327. package/dist/store-reads/learning.d.ts +114 -12
  328. package/dist/store-reads/learning.js +238 -48
  329. package/dist/store-reads/loop.d.ts +61 -0
  330. package/dist/store-reads/loop.js +111 -0
  331. package/dist/store-reads/runs.d.ts +1 -1
  332. package/dist/store-reads/workflow.d.ts +1 -1
  333. package/dist/store-view.d.ts +6 -0
  334. package/dist/store-view.js +59 -26
  335. package/dist/template-eval.d.ts +18 -9
  336. package/dist/template-eval.js +95 -68
  337. package/dist/template-github-permissions.d.ts +24 -10
  338. package/dist/template-github-permissions.js +36 -15
  339. package/dist/template-import.d.ts +31 -0
  340. package/dist/template-import.js +121 -0
  341. package/dist/template-source.d.ts +51 -0
  342. package/dist/template-source.js +371 -0
  343. package/dist/templates.d.ts +218 -46
  344. package/dist/templates.js +493 -181
  345. package/dist/timeline/computer.d.ts +48 -0
  346. package/dist/timeline/computer.js +169 -0
  347. package/dist/timeline/index.d.ts +4 -3
  348. package/dist/timeline/index.js +4 -3
  349. package/dist/timeline/labels.d.ts +6 -2
  350. package/dist/timeline/labels.js +93 -2
  351. package/dist/timeline/origin.d.ts +19 -5
  352. package/dist/timeline/origin.js +11 -4
  353. package/dist/timeline/timeline.d.ts +22 -1
  354. package/dist/timeline/timeline.js +34 -18
  355. package/dist/timeline/util.d.ts +4 -0
  356. package/dist/timeline/util.js +14 -0
  357. package/dist/tool-gate.d.ts +84 -50
  358. package/dist/tool-gate.js +179 -101
  359. package/dist/tool-keys.d.ts +4 -1
  360. package/dist/tool-keys.js +8 -3
  361. package/dist/tool-list.d.ts +26 -0
  362. package/dist/tool-list.js +43 -0
  363. package/dist/tool-names.d.ts +71 -0
  364. package/dist/tool-names.js +99 -0
  365. package/dist/tool-plane.d.ts +33 -27
  366. package/dist/tool-plane.js +72 -39
  367. package/dist/tools.d.ts +32 -7
  368. package/dist/tools.js +37 -24
  369. package/dist/trigger-adapter.d.ts +4 -0
  370. package/dist/trigger-secrets-shown.d.ts +2 -2
  371. package/dist/trigger-secrets-shown.js +1 -1
  372. package/dist/trigger-signatures.d.ts +25 -6
  373. package/dist/trigger-signatures.js +41 -7
  374. package/dist/trigger-targets.d.ts +2 -0
  375. package/dist/trigger-targets.js +1 -0
  376. package/dist/trigger-webhook.js +5 -2
  377. package/dist/triggers.d.ts +7 -3
  378. package/dist/triggers.js +35 -5
  379. package/dist/turns.js +16 -1
  380. package/dist/validate.d.ts +15 -7
  381. package/dist/validate.js +102 -45
  382. package/dist/web-fetch.d.ts +2 -8
  383. package/dist/web-fetch.js +2 -22
  384. package/dist/web-search.d.ts +10 -5
  385. package/dist/web-search.js +7 -6
  386. package/dist/webhooks.d.ts +145 -102
  387. package/dist/webhooks.js +559 -322
  388. package/dist/workflow/decisions.d.ts +1 -1
  389. package/dist/workflow/node-runner.d.ts +2 -1
  390. package/dist/workflow/node.d.ts +2 -1
  391. package/dist/workflow/node.js +3 -1
  392. package/dist/workflow/pi-versions.d.ts +23 -0
  393. package/dist/workflow/pi-versions.js +57 -0
  394. package/dist/workflow/record-tool.d.ts +2 -1
  395. package/dist/workflow/store.d.ts +1 -1
  396. package/dist/workflow/task.js +3 -2
  397. package/dist/workflow-run.d.ts +1 -1
  398. package/dist/workspace/attached-computers.d.ts +41 -0
  399. package/dist/workspace/attached-computers.js +114 -0
  400. package/dist/workspace/computer-deps.d.ts +19 -9
  401. package/dist/workspace/computer-deps.js +24 -9
  402. package/dist/workspace/computer-for-claim.d.ts +23 -8
  403. package/dist/workspace/computer-for-claim.js +92 -33
  404. package/dist/workspace/computer-hold.d.ts +11 -27
  405. package/dist/workspace/computer-hold.js +41 -55
  406. package/dist/workspace/computer-ledger.d.ts +3 -1
  407. package/dist/workspace/computer-ledger.js +4 -0
  408. package/dist/workspace/computer-mcp.d.ts +25 -0
  409. package/dist/workspace/computer-mcp.js +41 -0
  410. package/dist/workspace/computer-ports.d.ts +4 -13
  411. package/dist/workspace/computer-ports.js +4 -107
  412. package/dist/workspace/computer-script.d.ts +53 -0
  413. package/dist/workspace/computer-script.js +172 -0
  414. package/dist/workspace/executors.d.ts +1 -1
  415. package/dist/workspace/index.d.ts +4 -2
  416. package/dist/workspace/index.js +3 -1
  417. package/dist/workspace/kind-skills/desktop/SKILL.md +132 -84
  418. package/dist/workspace/kind-skills/phone/SKILL.md +104 -85
  419. package/dist/workspace/local.js +2 -2
  420. package/dist/workspace/resolve-computer.d.ts +24 -1
  421. package/dist/workspace/resolve-computer.js +40 -16
  422. package/dist/workspace/run-tools.d.ts +56 -21
  423. package/dist/workspace/run-tools.js +55 -34
  424. package/dist/wrap-up.d.ts +21 -0
  425. package/dist/wrap-up.js +21 -0
  426. package/launcher/agentrun-serve +4 -2
  427. package/package.json +19 -16
  428. package/templates/README.md +111 -45
  429. package/templates/code-review/agent.md +30 -14
  430. package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
  431. package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
  432. package/templates/code-review/evals/injection/case.yaml +2 -1
  433. package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
  434. package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
  435. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
  436. package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
  437. package/templates/code-review/evals/never-flag/case.yaml +2 -1
  438. package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
  439. package/templates/code-review/evals/null-name/case.yaml +2 -1
  440. package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
  441. package/templates/code-review/evals/off-by-one/case.yaml +2 -1
  442. package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
  443. package/templates/code-review/evals/other-repo/case.yaml +16 -0
  444. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
  445. package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
  446. package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
  447. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
  448. package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
  449. package/templates/code-review/evals/other-repo/prompt.md +10 -0
  450. package/templates/code-review/evals/re-review/case.yaml +2 -1
  451. package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
  452. package/templates/code-review/evals/re-review-open/case.yaml +2 -1
  453. package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
  454. package/templates/code-review/evals/repo-rule/case.yaml +2 -1
  455. package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
  456. package/templates/code-review/evals/two-defects/case.yaml +2 -1
  457. package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
  458. package/templates/code-review/rules/CODEREVIEW.md +1 -1
  459. package/templates/code-review/skills/review/DEEP.md +3 -2
  460. package/templates/code-review/skills/review/REVIEWER.md +3 -2
  461. package/templates/code-review/skills/review/SKILL.md +4 -3
  462. package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
  463. package/templates/inbound-lead/agent.md +26 -16
  464. package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
  465. package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
  466. package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
  467. package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
  468. package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
  469. package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
  470. package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
  471. package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
  472. package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
  473. package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
  474. package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
  475. package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
  476. package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
  477. package/templates/kyb/agent.md +15 -5
  478. package/templates/kyb/evals/adverse-media/prompt.md +2 -7
  479. package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
  480. package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
  481. package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
  482. package/templates/kyb/evals/name-collision/prompt.md +2 -6
  483. package/templates/kyb/evals/no-invention/prompt.md +2 -6
  484. package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
  485. package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
  486. package/templates/kyb/kyb.schema.json +8 -7
  487. package/templates/kyb/skills/kyb/SKILL.md +9 -6
  488. package/templates/market-monitor/agent.md +19 -12
  489. package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
  490. package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
  491. package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
  492. package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
  493. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  494. package/templates/release-notes/agent.md +32 -10
  495. package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
  496. package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
  497. package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
  498. package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
  499. package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
  500. package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
  501. package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
  502. package/templates/release-notes/evals/learned-style/case.yaml +2 -1
  503. package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
  504. package/templates/release-notes/evals/other-repo/case.yaml +24 -0
  505. package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
  506. package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
  507. package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
  508. package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
  509. package/templates/release-notes/evals/other-repo/prompt.md +32 -0
  510. package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
  511. package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
  512. package/templates/release-notes/notes.schema.json +1 -1
  513. package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
  514. package/dist/console/assets/index-BI4Byidu.js +0 -550
  515. package/dist/console/assets/index-C19gUF2n.css +0 -1
  516. package/dist/run-db.d.ts +0 -53
  517. package/dist/run-db.js +0 -116
  518. package/dist/tool-blurbs.d.ts +0 -4
  519. package/dist/tool-blurbs.js +0 -28
  520. package/dist/tool-budget.d.ts +0 -26
  521. package/dist/tool-budget.js +0 -56
  522. package/dist/workflow/readers.d.ts +0 -36
  523. package/dist/workflow/readers.js +0 -145
  524. package/dist/workflow/wal.d.ts +0 -11
  525. package/dist/workflow/wal.js +0 -106
  526. package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
  527. package/templates/code-review/evals/injection/graders/schema.md +0 -5
  528. package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
  529. package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
  530. package/templates/code-review/evals/null-name/graders/schema.md +0 -5
  531. package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
  532. package/templates/code-review/evals/re-review/graders/schema.md +0 -5
  533. package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
  534. package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
  535. package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
  536. package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
  537. package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
  538. package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
  539. package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
  540. package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
  541. package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
  542. package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
  543. package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
  544. package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
  545. package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
  546. package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
  547. package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
  548. package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
  549. package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
  550. package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
  551. package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
  552. package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
  553. package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
  554. package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
  555. package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
  556. package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
  557. package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
  558. package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
  559. package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
  560. package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
  561. package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
  562. package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
  563. package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
  564. package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
  565. package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
  566. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
  567. package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
  568. package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
@@ -8,25 +8,50 @@ import { KINDS } from "./journal-kinds.js";
8
8
  export const REFLECT_PREFIX = "learn-reflect-";
9
9
  /** The label a reader puts on the end-of-run turn's rows and messages: the server's (learning.ts LEARNING_LABEL). */
10
10
  export const REFLECT_LABEL = "learning";
11
- /** The end-of-run turn's request id, one per run: pi answers a repeat of it from its submission, so a turn asked again
12
- * on a later claim is never asked of the model twice. The server's own prefix, so the run's readers tell the turn's
13
- * rows apart by it (reflectFrom). */
14
- export const reflectRequestId = (runId, again = false) => `${REFLECT_PREFIX}${runId}${again ? REFLECT_AGAIN : ""}`;
15
- /** The suffix of the end-of-run turn's re-ask's request id (EndOfRunTurn ask's `again`): one per run too, so a repeat
11
+ /** The end-of-run turn's request id, one per round of a run, and one per `step` of a round (a turn of its own after the
12
+ * look-back: the compile turn's attempts, `compile-<n>`): pi answers a repeat of it from its submission, so a turn
13
+ * asked again on a later claim is never asked of the model twice. A run's first end is round 1; an end after a
14
+ * follow-up opened the run again is the next round, whose turn is asked of the model anew under an id of its own. The
15
+ * server's own prefix, so the run's readers tell the turn's rows apart by it (reflectRanges). */
16
+ export const reflectRequestId = (runId, again = false, round = 1, step) => `${REFLECT_PREFIX}${runId}${round > 1 ? `${REFLECT_ROUND}${round}` : ""}${step !== undefined ? `:${step}` : again ? REFLECT_AGAIN : ""}`;
17
+ /** The suffix of the end-of-run turn's re-ask's request id (EndOfRunTurn ask's `again`): one per round too, so a repeat
16
18
  * is answered from its submission, never asked of the model twice. */
17
19
  export const REFLECT_AGAIN = ":again";
18
- /** Where the end-of-run turn began in a run's journal: the entry its input placed, from the input submission under the
19
- * turn's request id; else, on a CLI harness, the turn's prompt the CLI record wrote as it asked the turn (`entries`:
20
- * adapter-loop.ts asking, an end-of-run-turn entry of the person's, written before the turn's submission, which only
21
- * its answer writes). Undefined before either, or for a run that asked none. Every entry from it on, until the run's
22
- * end, is the turn's (the server's labelled: after the entry before it). */
23
- export function reflectFrom(submissions, entries = []) {
24
- const placed = submissions.filter((record) => record.type === "input" && typeof record.requestId === "string" && record.requestId.startsWith(REFLECT_PREFIX) && record.entry !== undefined);
25
- if (placed.length)
26
- return Math.min(...placed.map((record) => Number(record.entry)));
27
- const asked = entries.find((entry) => entry.kind === KINDS.endOfRunTurn && entry.data?.role === "person");
28
- return asked === undefined ? undefined : Number(asked.id);
20
+ /** What names a later round in the end-of-run turn's request id, before its number. */
21
+ const REFLECT_ROUND = ":round-";
22
+ /** What a round's re-ask or step adds to its request id (reflectRequestId): the round is the id without it. */
23
+ const REFLECT_STEP = /:(?:again|compile-\d+)$/;
24
+ /** Each round of the end-of-run turn in a run's journal, oldest first: each begins at the entry its input placed, from the
25
+ * input submissions under its request ids (its re-ask's within it); else, on a CLI harness, at the turn's prompt the CLI
26
+ * record wrote as it asked it (`entries`: adapter-loop.ts answering, an end-of-run-turn entry of the person's with its
27
+ * request id, written before the turn's submission, which only its answer writes). Each ends at the first end entry
28
+ * after it (the run's end that round closed with); the newest may not have ended yet. None for a run that asked none.
29
+ * A follow-up's messages, between one round's end and the next round, are no round's. */
30
+ export function reflectRanges(submissions, entries = []) {
31
+ const starts = new Map();
32
+ const note = (requestId, entry) => {
33
+ if (!Number.isFinite(entry))
34
+ return;
35
+ const round = requestId.replace(REFLECT_STEP, "");
36
+ starts.set(round, Math.min(starts.get(round) ?? entry, entry));
37
+ };
38
+ for (const record of submissions) {
39
+ if (record.type === "input" && typeof record.requestId === "string" && record.requestId.startsWith(REFLECT_PREFIX) && record.entry !== undefined)
40
+ note(record.requestId, Number(record.entry));
41
+ }
42
+ for (const entry of entries) {
43
+ const data = entry.data;
44
+ if (entry.kind === KINDS.endOfRunTurn && data?.role === "person" && typeof data.requestId === "string" && data.requestId.startsWith(REFLECT_PREFIX))
45
+ note(data.requestId, Number(entry.id));
46
+ }
47
+ const ends = entries.filter((entry) => entry.kind === KINDS.end).map((entry) => Number(entry.id)).sort((a, b) => a - b);
48
+ return [...starts.values()].sort((a, b) => a - b).map((from) => {
49
+ const until = ends.find((end) => end >= from);
50
+ return until === undefined ? { from } : { from, until };
51
+ });
29
52
  }
53
+ /** Whether entry `entry` (a number) is one of `ranges`' end-of-run turns. */
54
+ export const inReflect = (ranges, entry) => ranges.some(({ from, until }) => entry >= from && (until === undefined || entry <= until));
30
55
  /** The refusal of the end-of-run turn's write or edit under work/.learning/: the tool gate's one text (NOTE_ONLY_TEXT), so
31
56
  * the adapter loop's refusal and the gate's are the same words. */
32
57
  export { NOTE_ONLY_TEXT as REFLECT_NOTE_ONLY } from "../tool-gate.js";
@@ -0,0 +1,52 @@
1
+ import type { Grade } from "../learn/promote.js";
2
+ import type { RunPath } from "../learning-cost.js";
3
+ import { type Store } from "../store/store.js";
4
+ export declare const FEEDBACK_ROUNDS: readonly ["revise", "look_back"];
5
+ export type FeedbackRound = (typeof FEEDBACK_ROUNDS)[number];
6
+ /** The most characters a grade's words (`label`) may hold. */
7
+ export declare const LABEL_MAX = 4000;
8
+ /** A feedback round, as its steer's body carries it (`feedback`) and its FEEDBACK entry keeps it: the round, whether the
9
+ * grade said right, the workflow a revision is asked of, and the grade's words (`text`). */
10
+ export interface FeedbackData {
11
+ readonly round: FeedbackRound;
12
+ readonly correct: boolean;
13
+ readonly workflow?: string;
14
+ readonly text: string;
15
+ }
16
+ /** What a grade asks for: `revise` for a wrong grade of a run its learned workflow answered alone, `look_back` for a
17
+ * graded run the agent finished when the grade has words, else none (undefined). A replay run is never graded. */
18
+ export declare function feedbackRoundOf(grade: {
19
+ readonly correct: boolean;
20
+ readonly path: RunPath;
21
+ readonly workflow?: string;
22
+ }, label: string | undefined): FeedbackRound | undefined;
23
+ /** The grade's words as the round says them: its `label`, else, for a wrong grade, that it was wrong and the fields a
24
+ * right answer holds (`expected`). */
25
+ export declare function feedbackWords(correct: boolean, label: string | undefined, expected: Readonly<Record<string, unknown>> | undefined): string;
26
+ /** The feedback round a steer's body asks for (`body.feedback`, the server's own: server.ts gradeRun writes it, and the
27
+ * message API never does), else undefined. */
28
+ export declare function feedbackOf(body: unknown): FeedbackData | undefined;
29
+ /** The feedback round the run's root `entries` say its next end closes: its newest FEEDBACK entry when no end came after
30
+ * it, else undefined. */
31
+ export declare function pendingFeedbackOf(entries: readonly {
32
+ readonly kind: string;
33
+ readonly data?: unknown;
34
+ }[]): FeedbackData | undefined;
35
+ /** What the end-of-run turn of a feedback round is told before its prompt: for a run whose agent never took the job (its
36
+ * learned workflow answered alone, so its session saw nothing), the job and what the workflow answered first
37
+ * (`job`, `served`); then the grade and its words. The look-back keeps notes only: a revision's ask to give the workflow
38
+ * again changed is the compile turn's, after it (learning-end.ts compileAskOf reads the round, learn/compile.ts asks). */
39
+ export declare function feedbackAsk(feedback: FeedbackData, seen?: {
40
+ readonly job: string;
41
+ readonly served: {
42
+ readonly workflow: string;
43
+ readonly answer: string;
44
+ };
45
+ }): string;
46
+ /** Opens run `grade.run` again on the feedback round its grade asks for (feedbackRoundOf), with the grade's words
47
+ * (`label`, else feedbackWords'), and says which: only a run that learns (its launch's learning start, never one that
48
+ * only uses what was learned, nor a notes-only run's revision ask), neither archived nor of an archived agent (closed
49
+ * history: a grade of it starts no paid work), and one the store opens again (an agentic run that answered or that a
50
+ * person stopped). Null when the grade asks for nothing more, or the run can't be opened again (the grade is kept either
51
+ * way). */
52
+ export declare function openFeedbackRound(store: Pick<Store, "runs" | "agents">, grade: Grade, label: string | undefined): Promise<FeedbackRound | null>;
@@ -0,0 +1,79 @@
1
+ import { readLaunchBody } from "../run-launch.js";
2
+ import { RunFinal } from "../store/store.js";
3
+ import { KINDS } from "./journal-kinds.js";
4
+ import { servedAnswerText } from "./workflow-first.js";
5
+ export const FEEDBACK_ROUNDS = ["revise", "look_back"];
6
+ /** The most characters a grade's words (`label`) may hold. */
7
+ export const LABEL_MAX = 4000;
8
+ /** What a grade asks for: `revise` for a wrong grade of a run its learned workflow answered alone, `look_back` for a
9
+ * graded run the agent finished when the grade has words, else none (undefined). A replay run is never graded. */
10
+ export function feedbackRoundOf(grade, label) {
11
+ if (grade.path === "workflow")
12
+ return !grade.correct && grade.workflow ? "revise" : undefined;
13
+ if (grade.path === "agent" || grade.path === "handed_back")
14
+ return label ? "look_back" : undefined;
15
+ return undefined;
16
+ }
17
+ /** The grade's words as the round says them: its `label`, else, for a wrong grade, that it was wrong and the fields a
18
+ * right answer holds (`expected`). */
19
+ export function feedbackWords(correct, label, expected) {
20
+ if (label?.trim())
21
+ return label.trim();
22
+ if (correct)
23
+ return "A reviewer graded this run's answer right.";
24
+ return `A reviewer graded this run's answer wrong.${expected ? ` A right answer holds: ${JSON.stringify(expected)}` : ""}`;
25
+ }
26
+ /** The feedback round a steer's body asks for (`body.feedback`, the server's own: server.ts gradeRun writes it, and the
27
+ * message API never does), else undefined. */
28
+ export function feedbackOf(body) {
29
+ const fed = body?.feedback;
30
+ const text = body?.text;
31
+ if (!fed || typeof fed !== "object" || !FEEDBACK_ROUNDS.includes(fed.round) || typeof fed.correct !== "boolean" || typeof text !== "string")
32
+ return undefined;
33
+ return { round: fed.round, correct: fed.correct, ...(typeof fed.workflow === "string" ? { workflow: fed.workflow } : {}), text };
34
+ }
35
+ /** The feedback round the run's root `entries` say its next end closes: its newest FEEDBACK entry when no end came after
36
+ * it, else undefined. */
37
+ export function pendingFeedbackOf(entries) {
38
+ const at = entries.findLastIndex((entry) => entry.kind === KINDS.feedback);
39
+ if (at < 0 || entries.slice(at + 1).some((entry) => entry.kind === KINDS.end))
40
+ return undefined;
41
+ return feedbackOf({ feedback: entries[at].data, text: entries[at].data?.text });
42
+ }
43
+ /** What the end-of-run turn of a feedback round is told before its prompt: for a run whose agent never took the job (its
44
+ * learned workflow answered alone, so its session saw nothing), the job and what the workflow answered first
45
+ * (`job`, `served`); then the grade and its words. The look-back keeps notes only: a revision's ask to give the workflow
46
+ * again changed is the compile turn's, after it (learning-end.ts compileAskOf reads the round, learn/compile.ts asks). */
47
+ export function feedbackAsk(feedback, seen) {
48
+ const graded = `A reviewer graded ${seen ? "that" : "this run's"} answer ${feedback.correct ? "right" : "wrong"}. What they said:`;
49
+ return [...(seen ? [seen.job, servedAnswerText(seen.served.workflow, seen.served.answer)] : []), graded, "", feedback.text].join("\n\n").replace(/\n{3,}/g, "\n\n");
50
+ }
51
+ /** Opens run `grade.run` again on the feedback round its grade asks for (feedbackRoundOf), with the grade's words
52
+ * (`label`, else feedbackWords'), and says which: only a run that learns (its launch's learning start, never one that
53
+ * only uses what was learned, nor a notes-only run's revision ask), neither archived nor of an archived agent (closed
54
+ * history: a grade of it starts no paid work), and one the store opens again (an agentic run that answered or that a
55
+ * person stopped). Null when the grade asks for nothing more, or the run can't be opened again (the grade is kept either
56
+ * way). */
57
+ export async function openFeedbackRound(store, grade, label) {
58
+ const words = label?.trim() ? label.trim() : undefined;
59
+ const round = feedbackRoundOf(grade, words);
60
+ if (!round)
61
+ return null;
62
+ const run = await store.runs.get(grade.run);
63
+ if (!run || run.archivedAt !== null || (await store.agents.get(run.agentId))?.archivedAt !== null)
64
+ return null;
65
+ const launched = await store.runs.launch(grade.run).catch(() => undefined);
66
+ const learning = launched ? readLaunchBody(launched.body)?.learning : undefined;
67
+ if (!learning || learning.use || (round === "revise" && learning.notesOnly))
68
+ return null;
69
+ const feedback = { round, correct: grade.correct, ...(round === "revise" && grade.workflow ? { workflow: grade.workflow } : {}) };
70
+ try {
71
+ await store.runs.reopen(grade.run, { kind: "steer", body: { text: feedbackWords(grade.correct, words, grade.expected), feedback } });
72
+ return round;
73
+ }
74
+ catch (error) {
75
+ if (error instanceof RunFinal)
76
+ return null;
77
+ throw error;
78
+ }
79
+ }
@@ -13,9 +13,10 @@ export type GithubAppAccessAt = GithubAppAccess & {
13
13
  * joins the run's redactor (its `cut`), the first and every one after. */
14
14
  export declare function githubAppAccess(store: {
15
15
  readonly triggerSettings: Pick<TriggerSettings, "get">;
16
- }, sealKey: Buffer | undefined, firstInput: unknown, { api, now, fromGitHub, hold }?: {
16
+ }, sealKey: Buffer | undefined, firstInput: unknown, { api, now, fromGitHub, hold, repo }?: {
17
17
  api?: string;
18
18
  now?: () => number;
19
19
  fromGitHub?: boolean;
20
20
  hold?: (values: string[]) => void;
21
+ repo?: string;
21
22
  }): Promise<GithubAppAccessAt | undefined>;
@@ -36,13 +36,15 @@ async function appOf(store, sealKey) {
36
36
  * `fromGitHub`: the run's first input is a github trigger's firing (its launch's inputOrigin), whose payload tag names
37
37
  * the repository and installation; any other run's tag is never read, only its owner's words. `hold`: each token minted
38
38
  * joins the run's redactor (its `cut`), the first and every one after. */
39
- export async function githubAppAccess(store, sealKey, firstInput, { api = GITHUB_API, now = Date.now, fromGitHub = false, hold } = {}) {
39
+ export async function githubAppAccess(store, sealKey, firstInput, { api = GITHUB_API, now = Date.now, fromGitHub = false, hold, repo } = {}) {
40
40
  if (!sealKey)
41
41
  return undefined;
42
42
  const app = await appOf(store, sealKey);
43
43
  if (!app)
44
44
  return undefined;
45
- const target = githubTargetOf(isObject(firstInput) ? firstInput.content : firstInput, { payload: fromGitHub });
45
+ // `repo`: the launch's (run-launch.ts repo), which the server checked against the agent's binding at the start: a run a
46
+ // person started with `repo`, or whose agent is bound to one repository. It comes before any URL in the words.
47
+ const target = repo !== undefined ? { repo } : githubTargetOf(isObject(firstInput) ? firstInput.content : firstInput, { payload: fromGitHub });
46
48
  return {
47
49
  api,
48
50
  target,
@@ -11,7 +11,10 @@ import { hostMemory, neverFits } from "../host.js";
11
11
  import { resolveHarness } from "./adapters/index.js";
12
12
  import { adapterRunSpecFromLaunch, PI_WIRES } from "./adapter-run-spec.js";
13
13
  import { createAdapterLoop } from "./adapter-loop.js";
14
- import { savedModelKeys, withModelKeys } from "./claim-secrets.js";
14
+ import { hostDecisionKeys, savedModelKeys, withModelKeys } from "./claim-secrets.js";
15
+ import { decisionProvidersIn, DEFAULT_DECISION_PROVIDER, FAUX_JEV_ENV } from "../decisions.js";
16
+ import { FAUX_ENV } from "../model.js";
17
+ import { generalThresholdOf } from "../learn/general.js";
15
18
  import { createDispatchLoop } from "./dispatch.js";
16
19
  import { cliRunSpecFromLaunch } from "./cli-run-spec.js";
17
20
  import { gradeModelFor, gradeRouteOf, learningLoopOf } from "./learning-dispatch.js";
@@ -58,6 +61,17 @@ export function resolveRunnerLoop(deps) {
58
61
  },
59
62
  ...(deps.log ? { log: deps.log } : {}),
60
63
  ...(deps.gradeBound ? { gradeBound: deps.gradeBound } : {}),
64
+ // The generality pre-check (learn/general.ts) on this host's Jev, built as a learning end builds its check's
65
+ // decision providers (hostDecisionKeys: the runner's environment first, then the key saved in Settings), on the
66
+ // client and model a workflow's decision node gets when it names none. No Jev key: none asked. A faux host asks only
67
+ // its faux Jev (FAUX_JEV_ENV), as its grade goes only to the faux route: a key it inherited never sends a note out.
68
+ jev: async () => {
69
+ const env = deps.env ?? process.env;
70
+ if (env[FAUX_ENV] && !env[FAUX_JEV_ENV])
71
+ return undefined;
72
+ return (await decisionProvidersIn({ ...env, ...(await hostDecisionKeys({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, [DEFAULT_DECISION_PROVIDER])) }))?.providers[DEFAULT_DECISION_PROVIDER];
73
+ },
74
+ generalThreshold: generalThresholdOf(deps.env ?? process.env),
61
75
  });
62
76
  }
63
77
  // The harness's own entry decides which spec builds the run, by the entry's facts and never the harness's name: an entry
@@ -0,0 +1,65 @@
1
+ import { type HeldRead, type HeldState } from "../computer-held.js";
2
+ import type { LoopComputer } from "./computer-channel.js";
3
+ import type { RootEntry } from "./computer-journal.js";
4
+ import type { Command } from "./loop-contract.js";
5
+ /** A run's held computer, as its spec gives it: the hold's minutes (its computer is the spec's `computer`). */
6
+ export type HeldSpec = {
7
+ readonly minutes: number;
8
+ };
9
+ /** What came of an owner's row: refused in words, or the change to commit (the commit takes the row). */
10
+ export type HeldDecision = {
11
+ readonly refused: string;
12
+ } | {
13
+ readonly write: () => Promise<void>;
14
+ };
15
+ /** How the hold's wait ended: its state moved on (started, or released by the owner or its lapse), or `cut` settled first. */
16
+ export type HeldWait = "moved" | "cut";
17
+ /** The journal's side of a run's held computer, for the pass whose Harness `commit` writes root entries (in one commit, in
18
+ * order). `now` is the clock its entries are stamped with. */
19
+ export declare function journalHeld(spec: HeldSpec, commit: (entries: readonly RootEntry[]) => Promise<void>, now?: () => number): {
20
+ /** The run's computer is up for this pass. `prior`, the run's root entries before it. A run's first pass writes the
21
+ * hold waiting. Every pass starts its own computer (the last pass's went at its close: a new claim, or a restart after
22
+ * a fault within one), so a pass that finds a hold not over finds it gone with the computer that held it, and what
23
+ * the owner set up on it: released, `lost` (the loop ends the run in those words). */
24
+ up(prior: readonly {
25
+ readonly kind: string;
26
+ readonly data?: unknown;
27
+ }[]): Promise<"held" | "lost" | "released">;
28
+ /** Where the hold is now. */
29
+ state: () => HeldState | undefined;
30
+ /** Why the hold ended without a release, if it did. */
31
+ lapse: () => HeldRead["why"];
32
+ /** Before the agent's first input: waits for the owner's start, a release, the hold's lapse, or `cut`. */
33
+ untilStarted: (cut: Promise<unknown>) => Promise<HeldWait>;
34
+ /** The agent's end (or a person's stop of it): the run keeps its computer (the hold ended, the Timeline saying so in
35
+ * `words`) until the owner releases it, the hold lapses, or `cut` settles first (a lost claim, a cancel). A hold
36
+ * already released waits for nothing. */
37
+ heldAtEnd(cut: Promise<unknown>, words?: string): Promise<HeldWait>;
38
+ /** The hold's minutes. */
39
+ minutes: number;
40
+ /** Why an owner's call is refused now: the hold is over (released, lapsed or lost). Undefined while the computer is
41
+ * held: waiting, started or ended. */
42
+ refusesCall(): string | undefined;
43
+ /** An owner's call starts: the hold cannot lapse until every call in flight has ended. */
44
+ callStarted(): void;
45
+ /** An owner's call ended at `at`: the hold's count starts again from it once the last call in flight is done. */
46
+ callEnded(at: number): void;
47
+ /** The hold's count starts again from `at`. */
48
+ touched(at: number): void;
49
+ /** An owner's row: a start or a release. */
50
+ decide(command: Command): HeldDecision;
51
+ /** Whether `data`, a hold or call entry's, is the change row `id` made: the commit that writes it takes the row. */
52
+ madeBy: (data: Record<string, unknown>, id: number) => boolean;
53
+ /** Every commit asked for so far is done. */
54
+ settled: () => Promise<void>;
55
+ };
56
+ export type JournalHeld = ReturnType<typeof journalHeld>;
57
+ /** The spec's `held` for a run whose launch holds its computer (run-launch.ts hold), given the loop's computer: none for a
58
+ * run that holds none, or whose computer speaks no protocol (none, or a browser). */
59
+ export declare function heldSpecOf(launch: {
60
+ readonly hold?: {
61
+ readonly minutes: number;
62
+ };
63
+ }, computer: LoopComputer | undefined): HeldSpec | undefined;
64
+ /** Whether a command row is the owner's, for a held computer. */
65
+ export declare const isHeldCommand: (command: Pick<Command, "kind">) => boolean;
@@ -0,0 +1,158 @@
1
+ // A held computer on the runner (computer-held.ts has the contract): the run's computer waits for its owner before the
2
+ // agent's first input and after the agent's end, and the owner's start and release rows are applied here. Every change is
3
+ // committed to the run's journal; the commit that writes it takes its row. The owner's calls go through the computer call
4
+ // channel (computer-channel.ts) as any run's do; each one starts the hold's count again (touched).
5
+ //
6
+ // The adapter loop makes one per pass, for a spec that carries `held`, once the run's Harness is open (as it does the
7
+ // take-over's journalHold), and reads the hold's state from the journal, so a restart within the claim goes on where the
8
+ // last pass left it. A new claim has a new computer: a hold an earlier claim left open is gone with that claim's computer.
9
+ import { HOST_PHASE } from "../timeline/index.js";
10
+ import { COMPUTER_RELEASE, COMPUTER_START, HELD_COMMANDS, HELD_KIND, heldIn, heldWords } from "../computer-held.js";
11
+ /** The journal's side of a run's held computer, for the pass whose Harness `commit` writes root entries (in one commit, in
12
+ * order). `now` is the clock its entries are stamped with. */
13
+ export function journalHeld(spec, commit, now = Date.now) {
14
+ const ms = spec.minutes * 60_000;
15
+ let read;
16
+ /** The owner's calls in flight: the hold's idle count cannot lapse while any is. */
17
+ let calls = 0;
18
+ let queue = Promise.resolve();
19
+ let wake = () => { };
20
+ let changed = new Promise((resolve) => (wake = resolve));
21
+ const poke = () => {
22
+ const was = wake;
23
+ changed = new Promise((resolve) => (wake = resolve));
24
+ was();
25
+ };
26
+ const write = (entries) => {
27
+ const next = queue.then(() => commit(entries));
28
+ queue = next.catch(() => undefined);
29
+ return next;
30
+ };
31
+ const phase = (summary, at) => ({ kind: HOST_PHASE, data: { summary, at } });
32
+ /** Why a row finds the hold over, in words. */
33
+ const released = () => (read?.why === "timeout" ? `The run's computer was let go: no call came for ${spec.minutes} minutes.` : read?.why === "lost" ? heldWords.lost : "The run's computer was already released.");
34
+ /** The hold moves to `state` now: read here at once, committed in order. */
35
+ const move = (state, extra, words) => {
36
+ const at = now();
37
+ read = { state, minutes: spec.minutes, until: at + ms, ...(extra.why ? { why: extra.why } : {}) };
38
+ poke();
39
+ return write([{ kind: HELD_KIND, data: { state, at, minutes: spec.minutes, ...extra } }, ...(words ? [phase(words, at)] : [])]);
40
+ };
41
+ /** Waits while the hold is in one of `states`: until a row moves it, its lapse releases it, or `cut` settles. */
42
+ const waitWhile = async (states, cut) => {
43
+ let isCut = false;
44
+ const cutDone = () => {
45
+ isCut = true;
46
+ poke();
47
+ };
48
+ cut.then(cutDone, cutDone);
49
+ while (read && states.includes(read.state)) {
50
+ if (isCut)
51
+ return "cut";
52
+ const left = read.until - now();
53
+ // An owner's call in flight keeps the hold: its count starts again when the last one ends (callEnded pokes this wait).
54
+ if (calls > 0) {
55
+ await changed;
56
+ continue;
57
+ }
58
+ if (left <= 0) {
59
+ // A row the journal refuses (a lost claim's fence) is the cut's to answer, not this wait's.
60
+ await move("released", { why: "timeout" }, heldWords.timeout(spec.minutes)).catch(() => undefined);
61
+ return "moved";
62
+ }
63
+ let timer;
64
+ await Promise.race([changed, new Promise((resolve) => (timer = setTimeout(resolve, left)))]);
65
+ clearTimeout(timer);
66
+ }
67
+ return isCut ? "cut" : "moved";
68
+ };
69
+ return {
70
+ /** The run's computer is up for this pass. `prior`, the run's root entries before it. A run's first pass writes the
71
+ * hold waiting. Every pass starts its own computer (the last pass's went at its close: a new claim, or a restart after
72
+ * a fault within one), so a pass that finds a hold not over finds it gone with the computer that held it, and what
73
+ * the owner set up on it: released, `lost` (the loop ends the run in those words). */
74
+ async up(prior) {
75
+ const before = heldIn(prior.map((entry) => ({ kind: entry.kind, data: entry.data })));
76
+ if (before === undefined) {
77
+ await move("waiting", {}, heldWords.waiting(spec.minutes));
78
+ return "held";
79
+ }
80
+ read = before;
81
+ if (before.state === "released")
82
+ return "released";
83
+ await move("released", { why: "lost" }, heldWords.lost);
84
+ return "lost";
85
+ },
86
+ /** Where the hold is now. */
87
+ state: () => read?.state,
88
+ /** Why the hold ended without a release, if it did. */
89
+ lapse: () => read?.why,
90
+ /** Before the agent's first input: waits for the owner's start, a release, the hold's lapse, or `cut`. */
91
+ untilStarted: (cut) => waitWhile(["waiting"], cut),
92
+ /** The agent's end (or a person's stop of it): the run keeps its computer (the hold ended, the Timeline saying so in
93
+ * `words`) until the owner releases it, the hold lapses, or `cut` settles first (a lost claim, a cancel). A hold
94
+ * already released waits for nothing. */
95
+ async heldAtEnd(cut, words = heldWords.ended(spec.minutes)) {
96
+ if (read?.state === "released")
97
+ return "moved";
98
+ if (read?.state !== "ended")
99
+ await move("ended", {}, words).catch(() => undefined);
100
+ return waitWhile(["ended"], cut);
101
+ },
102
+ /** The hold's minutes. */
103
+ minutes: spec.minutes,
104
+ /** Why an owner's call is refused now: the hold is over (released, lapsed or lost). Undefined while the computer is
105
+ * held: waiting, started or ended. */
106
+ refusesCall() {
107
+ if (read?.state !== "released")
108
+ return undefined;
109
+ return released();
110
+ },
111
+ /** An owner's call starts: the hold cannot lapse until every call in flight has ended. */
112
+ callStarted() {
113
+ calls += 1;
114
+ this.touched(now());
115
+ },
116
+ /** An owner's call ended at `at`: the hold's count starts again from it once the last call in flight is done. */
117
+ callEnded(at) {
118
+ calls = Math.max(0, calls - 1);
119
+ this.touched(at);
120
+ },
121
+ /** The hold's count starts again from `at`. */
122
+ touched(at) {
123
+ if (!read || read.state === "released")
124
+ return;
125
+ read = { ...read, until: Math.max(read.until, at + ms) };
126
+ poke();
127
+ },
128
+ /** An owner's row: a start or a release. */
129
+ decide(command) {
130
+ const state = read?.state;
131
+ if (state === undefined)
132
+ return { refused: "The run's computer is not up yet." };
133
+ if (state === "released")
134
+ return { refused: released() };
135
+ if (command.kind === COMPUTER_START) {
136
+ if (state !== "waiting")
137
+ return { refused: "The run's agent has already started." };
138
+ return { write: () => move("started", { by: command.id }, heldWords.started) };
139
+ }
140
+ if (command.kind === COMPUTER_RELEASE)
141
+ return { write: () => move("released", { by: command.id }, heldWords.released) };
142
+ return { refused: `a held computer takes no ${command.kind} row` };
143
+ },
144
+ /** Whether `data`, a hold or call entry's, is the change row `id` made: the commit that writes it takes the row. */
145
+ madeBy: (data, id) => data.by === id,
146
+ /** Every commit asked for so far is done. */
147
+ settled: () => queue,
148
+ };
149
+ }
150
+ /** The spec's `held` for a run whose launch holds its computer (run-launch.ts hold), given the loop's computer: none for a
151
+ * run that holds none, or whose computer speaks no protocol (none, or a browser). */
152
+ export function heldSpecOf(launch, computer) {
153
+ if (!launch.hold || !computer)
154
+ return undefined;
155
+ return { minutes: launch.hold.minutes };
156
+ }
157
+ /** Whether a command row is the owner's, for a held computer. */
158
+ export const isHeldCommand = (command) => HELD_COMMANDS.has(command.kind);
@@ -25,6 +25,13 @@ export declare const KINDS: {
25
25
  * the Timeline's attribution (the timeline reads a host's user entry's own origin). The model
26
26
  * reads it as any message. */
27
27
  readonly input: "agentrun.input";
28
+ /** A CLI run's turn opens: written in the same commit as the message that starts it (the person's, a trigger's or a
29
+ * follow-up's), so the run reads as working from that commit on, as pi's open input does. Data only: the reader passes
30
+ * over it, and turns.ts reads it. */
31
+ readonly turnStart: "agentrun.turn.start";
32
+ /** A CLI run's turn is over (`TurnRecordData`): written once its last model text is on the record, before the run's end
33
+ * or the next turn. It closes the newest turn still open. Data only, as the start is. */
34
+ readonly turnEnd: "agentrun.turn.end";
28
35
  /** A tool call the gate asked a person about: the run parks on it. */
29
36
  readonly ask: "agentrun.ask";
30
37
  /** The person's answer to an ask, written by the commit that takes the approve or deny row. */
@@ -53,6 +60,11 @@ export declare const KINDS: {
53
60
  * (adapter-loop.ts pauseFor), and a claim lost before that restores it from here (pendingPauseOf). No run patch, and
54
61
  * neither a call nor a message, so the reader passes over it. */
55
62
  readonly pausePending: "agentrun.pause.pending";
63
+ /** On the run's model session (resume log, never read as a call or a message): the session's recent requests as the
64
+ * cap's expected pricing reads them (the kernel's RecentRequest list, recentAfter), written each time one answers.
65
+ * A later claim or pass starts from the newest record, so its first request reads the cache a recent answer left warm
66
+ * when it ended under CACHE_WARM_MS ago by the cap's clock, and uncached after that (adapter-loop.ts recentIn). */
67
+ readonly capRecent: "agentrun.cap.recent";
56
68
  /** A workflow call node's effect, as it starts and as it ends (pause.ts NodeLine: its path, item, tool, label, input,
57
69
  * then its status and output or error), on the run's node-log session (NODE_LOG_SESSION): the run's graph lists its
58
70
  * effects from these. Written as the effect runs, never for one the driver answers from its receipt. */
@@ -62,15 +74,32 @@ export declare const KINDS: {
62
74
  * same submission pi's adapter writes, so the step reads both alike. Neither a call nor a message: the reader passes
63
75
  * over it, and the turn is never on the run's visible record. */
64
76
  readonly endOfRunTurn: "agentrun.end-of-run.turn";
77
+ /** What an end-of-run turn kept as it was first asked (its `keep`, by its `requestId`), for a harness that keeps its own
78
+ * record (pi; a CLI's record keeps it on its endOfRunTurn prompt): written once, before the turn's first request, so a
79
+ * later claim that asks the same turn again reads the first ask's (the commit of main a compile turn was asked at among
80
+ * them), never its own. Neither a call nor a message: the reader passes over it. */
81
+ readonly endOfRunKept: "agentrun.end-of-run.kept";
65
82
  /** What a learning run's claim laid of its seed: the learned skills it was given (`skills`, by name) and the learned
66
83
  * workflows its learned_workflow tool runs (`workflows`, by name). Written once per claim, on the root; the newest is
67
84
  * what the run was given. Neither a call nor a message. */
68
85
  readonly learningLaid: "agentrun.learning.laid";
86
+ /** A grade's feedback round (runner/feedback-round.ts): the run opened again on a grade's words, asked no turn of the
87
+ * job's; its next end's end-of-run turn reads them (`text`, the `round`, whether the grade said right, the workflow a
88
+ * revision is asked of). Written on the root by the commit that takes the round's steer row. Neither a call nor a
89
+ * message: pi never reads it, and the Timeline shows its words as the reviewer's. */
90
+ readonly feedback: "agentrun.feedback";
69
91
  /** A workflow run's model node's execution, as the runner kept it before running it (workflow-spec.ts onModelNode):
70
92
  * `{ path, tier?, model }`, its execution path, the tier it asked for (absent for none) and the model id the run's route
71
93
  * sent it to. On the node log (NODE_LOG_SESSION), for GET /runs/{id}/graph's nodes' `model` (graph-view.ts). Neither a
72
94
  * call nor a message. */
73
95
  readonly nodeModel: "agentrun.node.model";
96
+ /** A learning run's generality pre-check (learn/general.ts), its Jev requests about to leave: committed and made
97
+ * durable before they do, as a grade request's record is (learning-ask.ts bookedAsk), so a restart that finds one with
98
+ * no answer after it books what they spent as unknown (null) before it asks again. Paid, and Jev dedupes none. */
99
+ readonly learningGeneralSent: "agentrun.learning.general.sent";
100
+ /** That check's end, kept before the grader starts: its scores, or why it could not run (`unchecked`), and what it spent.
101
+ * A restart reuses it and never asks Jev again. */
102
+ readonly learningGeneral: "agentrun.learning.general";
74
103
  /** A learning run's grade: the verdict and what it spent, written before its merge (a resumed run never asks again). */
75
104
  readonly learningGraded: "agentrun.learning.graded";
76
105
  /** A learning run's merge: the new main and its commit, with the run's end. */
@@ -159,12 +188,13 @@ export interface CallStartData {
159
188
  readonly input: unknown;
160
189
  /** May run again after a crash (it changes nothing outside the run): the tool registry's own flag. */
161
190
  readonly replaySafe: boolean;
162
- /** Written as the call reached its gate through a CLI's own MCP client, or its tool bridge's gate asked about it, before
163
- * any answer: nothing is sent until its agentrun.call.sent mark (KINDS.callSent). */
191
+ /** Written as its CLI's tool bridge's gate asked about it (adapter-loop.ts bridgeGate), before any answer: nothing is sent
192
+ * until its agentrun.call.sent mark (KINDS.callSent). The bridge holds the call and hands the CLI nothing while it waits,
193
+ * so no waiting result shows for it, as on pi. */
164
194
  readonly parked?: true;
165
- /** Parked in its CLI's tool bridge (adapter-loop.ts bridgeGate), not at an MCP door: the bridge holds the call and hands
166
- * the CLI nothing while it waits, so no waiting result shows for it (store-reads/journal.ts piShaped), as on pi. */
167
- readonly bridge?: true;
195
+ /** A tool that only nests calls (tools_call, codemode; HostTool.nests): its calls start after it, each its own, and it
196
+ * runs again whole after a crash, so a start a crash left open is never ended interrupted (adapter-loop.ts). */
197
+ readonly nests?: true;
168
198
  /** The harness's working directory (a CLI's), which an absolute path in `input` is built from: the run's rows name a
169
199
  * path under it by its name in the workspace (store-reads/journal.ts runTimeline). */
170
200
  readonly cwd?: string;
@@ -190,6 +220,11 @@ export declare function endedAnswer(tool: string, end: {
190
220
  isError: boolean;
191
221
  };
192
222
  export type MessageRole = "person" | "steer" | "model";
223
+ /** What a CLI turn's end (KINDS.turnEnd) says: how the adapter ended it, and its error when it failed with one. */
224
+ export interface TurnRecordData {
225
+ readonly status: "completed" | "failed" | "interrupted";
226
+ readonly error?: string;
227
+ }
193
228
  export interface MessageData {
194
229
  readonly role: MessageRole;
195
230
  readonly text: string;
@@ -213,8 +248,10 @@ export interface AskData {
213
248
  readonly args?: unknown;
214
249
  /** When it was asked (ISO), from the loop's clock; a re-ask on a resume keeps the first. */
215
250
  readonly requestedAt?: string;
216
- /** Its approval price (the spec's approvalPrice); null when it has none. */
251
+ /** Its approval price (a catalog tool's, the spec's mcp priceOf); null when it has none. */
217
252
  readonly price?: ApprovalPrice | null;
253
+ /** An MCP tool its run's pin marks destructive (tool-gate.ts toolEffect): an allow of it needs confirm_destructive. */
254
+ readonly destructive?: true;
218
255
  }
219
256
  /** How an ask was answered: approved, denied, withdrawn (a stop while the call waited) or canceled (a cancel). */
220
257
  export type AnswerDecision = "allow" | "deny" | "withdrawn" | "canceled";
@@ -230,7 +267,7 @@ export interface AnswerData {
230
267
  readonly note?: string;
231
268
  /** "message": a deny a person's message gave while the call waited (the message route's deny row), which its approval
232
269
  * row reads as "Declined by your message". Absent for an answer given directly. */
233
- readonly by?: "message";
270
+ readonly by?: "message" | "setting";
234
271
  /** The allow a stop overrode (main's ApprovalAnswer.superseded): the call was approved but had not finished when its
235
272
  * run was stopped, so the stop withdrew it. Kept as it was given. */
236
273
  readonly superseded?: {