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

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 (466) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +341 -208
  3. package/dist/adapters.d.ts +3 -4
  4. package/dist/adapters.js +18 -15
  5. package/dist/agent-rows.d.ts +99 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +75 -25
  9. package/dist/agents.d.ts +9 -125
  10. package/dist/agents.js +15 -305
  11. package/dist/answer-json.d.ts +23 -0
  12. package/dist/answer-json.js +58 -0
  13. package/dist/api-only.d.ts +1 -1
  14. package/dist/api-only.js +2 -2
  15. package/dist/archil-settings.d.ts +11 -1
  16. package/dist/archil-settings.js +10 -0
  17. package/dist/bash-read-only.d.ts +35 -0
  18. package/dist/bash-read-only.js +778 -0
  19. package/dist/box-settings.d.ts +3 -23
  20. package/dist/box-settings.js +7 -51
  21. package/dist/boxes.d.ts +17 -0
  22. package/dist/boxes.js +27 -20
  23. package/dist/browser-commands.d.ts +5 -2
  24. package/dist/browser-commands.js +4 -4
  25. package/dist/browser-computer.d.ts +5 -0
  26. package/dist/browser-computer.js +21 -0
  27. package/dist/browser-cost.d.ts +9 -6
  28. package/dist/browser-cost.js +95 -51
  29. package/dist/browser-live.d.ts +7 -20
  30. package/dist/browser-live.js +15 -93
  31. package/dist/browser-person.d.ts +18 -51
  32. package/dist/browser-person.js +94 -277
  33. package/dist/budget.d.ts +0 -5
  34. package/dist/budget.js +0 -5
  35. package/dist/cap.d.ts +14 -8
  36. package/dist/cap.js +19 -9
  37. package/dist/cli.js +71 -18
  38. package/dist/closed-pipes.d.ts +2 -0
  39. package/dist/closed-pipes.js +13 -0
  40. package/dist/computer-commands.d.ts +2 -0
  41. package/dist/computer-commands.js +2 -0
  42. package/dist/computer-keys.d.ts +20 -10
  43. package/dist/computer-keys.js +36 -54
  44. package/dist/computer-setting.d.ts +20 -3
  45. package/dist/computer-setting.js +58 -10
  46. package/dist/computers.d.ts +35 -2
  47. package/dist/computers.js +72 -11
  48. package/dist/confine.d.ts +120 -0
  49. package/dist/confine.js +436 -0
  50. package/dist/console/assets/index-B7NKTU8E.css +1 -0
  51. package/dist/console/assets/index-CXZMgJE7.js +550 -0
  52. package/dist/console/index.html +2 -2
  53. package/dist/content-filter.d.ts +7 -0
  54. package/dist/content-filter.js +23 -0
  55. package/dist/decision-cap.d.ts +7 -29
  56. package/dist/decision-cap.js +3 -94
  57. package/dist/decision-rows.d.ts +1 -1
  58. package/dist/decision-rows.js +1 -1
  59. package/dist/docker-daemon.d.ts +31 -0
  60. package/dist/docker-daemon.js +56 -0
  61. package/dist/effort-guidance.js +4 -3
  62. package/dist/environment.d.ts +0 -3
  63. package/dist/environment.js +3 -5
  64. package/dist/errors.d.ts +1 -2
  65. package/dist/errors.js +9 -9
  66. package/dist/explain.js +3 -1
  67. package/dist/filed-answer.d.ts +32 -0
  68. package/dist/filed-answer.js +160 -0
  69. package/dist/files.d.ts +1 -3
  70. package/dist/files.js +2 -4
  71. package/dist/github-connection.d.ts +1 -1
  72. package/dist/github-connection.js +25 -7
  73. package/dist/github-faux.d.ts +26 -0
  74. package/dist/github-faux.js +76 -0
  75. package/dist/github.d.ts +6 -2
  76. package/dist/github.js +5 -3
  77. package/dist/graph-served.d.ts +5 -3
  78. package/dist/graph-served.js +14 -6
  79. package/dist/graph-view.d.ts +3 -5
  80. package/dist/graph-view.js +9 -16
  81. package/dist/handed-values.d.ts +9 -0
  82. package/dist/handed-values.js +26 -0
  83. package/dist/harness-install.d.ts +1 -7
  84. package/dist/harness-install.js +1 -18
  85. package/dist/harness-opencode/adapter.d.ts +7 -0
  86. package/dist/harness-opencode/adapter.js +23 -6
  87. package/dist/harness-opencode/harness.js +0 -1
  88. package/dist/harness-opencode/host/policy.js +2 -2
  89. package/dist/harness-opencode/index.d.ts +1 -1
  90. package/dist/harness-opencode/index.js +1 -1
  91. package/dist/harness-opencode/verify.d.ts +17 -0
  92. package/dist/harness-opencode/verify.js +30 -10
  93. package/dist/harness-table.js +6 -1
  94. package/dist/heard.js +1 -1
  95. package/dist/held-fd.d.ts +5 -0
  96. package/dist/held-fd.js +14 -0
  97. package/dist/host-calls.d.ts +20 -0
  98. package/dist/host-calls.js +12 -0
  99. package/dist/host-tools.d.ts +4 -21
  100. package/dist/host-tools.js +4 -61
  101. package/dist/host.d.ts +2 -4
  102. package/dist/host.js +2 -7
  103. package/dist/import-summary.d.ts +1 -5
  104. package/dist/import-summary.js +0 -21
  105. package/dist/import.d.ts +6 -6
  106. package/dist/import.js +14 -15
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.js +1 -0
  109. package/dist/key-refusal.d.ts +5 -1
  110. package/dist/key-refusal.js +19 -4
  111. package/dist/learn/check.d.ts +8 -2
  112. package/dist/learn/check.js +85 -31
  113. package/dist/learn/folder.d.ts +11 -4
  114. package/dist/learn/folder.js +17 -19
  115. package/dist/learn/grade.d.ts +18 -1
  116. package/dist/learn/grade.js +108 -14
  117. package/dist/learn/index.d.ts +5 -5
  118. package/dist/learn/index.js +5 -5
  119. package/dist/learn/learning.sh +1 -14
  120. package/dist/learn/notes.d.ts +14 -3
  121. package/dist/learn/notes.js +16 -6
  122. package/dist/learn/reflect.d.ts +31 -2
  123. package/dist/learn/reflect.js +83 -6
  124. package/dist/learn/relevance.d.ts +24 -0
  125. package/dist/learn/relevance.js +91 -0
  126. package/dist/learn/secrets.d.ts +7 -1
  127. package/dist/learn/secrets.js +86 -19
  128. package/dist/learn/skills.d.ts +159 -18
  129. package/dist/learn/skills.js +644 -64
  130. package/dist/learned-nodes.d.ts +14 -0
  131. package/dist/learned-nodes.js +8 -0
  132. package/dist/learned-workflow.d.ts +41 -6
  133. package/dist/learned-workflow.js +153 -18
  134. package/dist/learning-routes.d.ts +49 -4
  135. package/dist/learning-routes.js +113 -31
  136. package/dist/learning-run.d.ts +16 -31
  137. package/dist/learning-run.js +31 -38
  138. package/dist/learning-words.d.ts +12 -5
  139. package/dist/learning-words.js +18 -9
  140. package/dist/learning.d.ts +91 -97
  141. package/dist/learning.js +176 -320
  142. package/dist/live/stream.js +1 -1
  143. package/dist/live/translate.js +12 -2
  144. package/dist/llm.d.ts +4 -1
  145. package/dist/llm.js +4 -2
  146. package/dist/local-models.d.ts +11 -5
  147. package/dist/local-models.js +13 -8
  148. package/dist/mcp-gateway.d.ts +17 -49
  149. package/dist/mcp-gateway.js +55 -136
  150. package/dist/mcp-oauth.d.ts +10 -14
  151. package/dist/mcp-oauth.js +14 -32
  152. package/dist/mcp-probe.d.ts +0 -7
  153. package/dist/mcp-probe.js +4 -10
  154. package/dist/mcp-servers-store.d.ts +18 -18
  155. package/dist/mcp-servers-store.js +12 -14
  156. package/dist/mcp-store.js +3 -4
  157. package/dist/mcp.js +4 -3
  158. package/dist/model.d.ts +9 -7
  159. package/dist/model.js +51 -27
  160. package/dist/monid.d.ts +0 -2
  161. package/dist/monid.js +3 -6
  162. package/dist/openapi.d.ts +8 -1
  163. package/dist/openapi.js +156 -58
  164. package/dist/page.d.ts +1 -3
  165. package/dist/page.js +6 -18
  166. package/dist/paid-calls.d.ts +21 -27
  167. package/dist/paid-calls.js +26 -61
  168. package/dist/pause.d.ts +2 -19
  169. package/dist/pause.js +5 -74
  170. package/dist/port-models.d.ts +10 -3
  171. package/dist/port-models.js +26 -6
  172. package/dist/propose.d.ts +2 -0
  173. package/dist/propose.js +80 -45
  174. package/dist/push-handler.d.ts +1 -1
  175. package/dist/reflect-range.d.ts +25 -0
  176. package/dist/reflect-range.js +30 -0
  177. package/dist/refusal-words.d.ts +5 -1
  178. package/dist/refusal-words.js +5 -1
  179. package/dist/rows.d.ts +1 -1
  180. package/dist/run-cut.d.ts +0 -6
  181. package/dist/run-cut.js +0 -6
  182. package/dist/run-db.d.ts +2 -11
  183. package/dist/run-db.js +2 -37
  184. package/dist/run-launch.d.ts +21 -2
  185. package/dist/run-launch.js +14 -5
  186. package/dist/run-learning-served.d.ts +21 -4
  187. package/dist/run-learning-served.js +23 -13
  188. package/dist/run-reads-over-store.d.ts +5 -3
  189. package/dist/run-reads-over-store.js +25 -14
  190. package/dist/run-secrets.d.ts +1 -1
  191. package/dist/run-timeline-served.d.ts +5 -1
  192. package/dist/run-timeline-served.js +27 -6
  193. package/dist/run-view.d.ts +37 -22
  194. package/dist/run-view.js +85 -38
  195. package/dist/runnable.d.ts +21 -10
  196. package/dist/runnable.js +35 -12
  197. package/dist/runner/adapter-loop.d.ts +36 -5
  198. package/dist/runner/adapter-loop.js +663 -69
  199. package/dist/runner/adapter-run-spec.d.ts +42 -8
  200. package/dist/runner/adapter-run-spec.js +186 -52
  201. package/dist/runner/adapters/index.js +11 -1
  202. package/dist/runner/adapters/pi.d.ts +40 -2
  203. package/dist/runner/adapters/pi.js +110 -27
  204. package/dist/runner/beside.d.ts +38 -3
  205. package/dist/runner/beside.js +54 -5
  206. package/dist/runner/claim-secrets.d.ts +16 -1
  207. package/dist/runner/claim-secrets.js +62 -14
  208. package/dist/runner/cli-run-spec.d.ts +5 -0
  209. package/dist/runner/cli-run-spec.js +159 -41
  210. package/dist/runner/commands.js +1 -1
  211. package/dist/runner/computer-journal.d.ts +15 -2
  212. package/dist/runner/computer-journal.js +41 -5
  213. package/dist/runner/conformance/harness.d.ts +1 -0
  214. package/dist/runner/conformance/harness.js +123 -13
  215. package/dist/runner/conformance/subject.d.ts +4 -1
  216. package/dist/runner/dispatch.d.ts +8 -1
  217. package/dist/runner/dispatch.js +81 -7
  218. package/dist/runner/end-of-run.d.ts +8 -2
  219. package/dist/runner/end-of-run.js +10 -4
  220. package/dist/runner/github-app.d.ts +7 -2
  221. package/dist/runner/github-app.js +47 -16
  222. package/dist/runner/harness-loops.d.ts +15 -2
  223. package/dist/runner/harness-loops.js +38 -2
  224. package/dist/runner/journal-kinds.d.ts +60 -6
  225. package/dist/runner/journal-kinds.js +43 -5
  226. package/dist/runner/journal-reader.d.ts +1 -1
  227. package/dist/runner/journal-reader.js +2 -2
  228. package/dist/runner/learning-ask.d.ts +4 -0
  229. package/dist/runner/learning-ask.js +15 -1
  230. package/dist/runner/learning-end.d.ts +18 -3
  231. package/dist/runner/learning-end.js +194 -20
  232. package/dist/runner/learning-loop.d.ts +7 -0
  233. package/dist/runner/learning-loop.js +36 -8
  234. package/dist/runner/learning-seed.d.ts +6 -0
  235. package/dist/runner/learning-seed.js +6 -0
  236. package/dist/runner/loop-contract.d.ts +4 -0
  237. package/dist/runner/main.d.ts +61 -9
  238. package/dist/runner/main.js +144 -20
  239. package/dist/runner/mcp-claim.d.ts +3 -0
  240. package/dist/runner/mcp-claim.js +7 -3
  241. package/dist/runner/mcp-github.d.ts +11 -2
  242. package/dist/runner/mcp-github.js +55 -4
  243. package/dist/runner/mcp-run.d.ts +2 -0
  244. package/dist/runner/mcp-run.js +16 -5
  245. package/dist/runner/memory-claim.d.ts +9 -0
  246. package/dist/runner/memory-claim.js +25 -0
  247. package/dist/runner/metrics.d.ts +46 -1
  248. package/dist/runner/metrics.js +156 -1
  249. package/dist/runner/model-route.d.ts +16 -0
  250. package/dist/runner/model-route.js +134 -10
  251. package/dist/runner/reflect-hook.d.ts +12 -1
  252. package/dist/runner/reflect-hook.js +33 -3
  253. package/dist/runner/runner.d.ts +20 -0
  254. package/dist/runner/runner.js +146 -18
  255. package/dist/runner/spec-holds.d.ts +7 -2
  256. package/dist/runner/spec-holds.js +4 -3
  257. package/dist/runner/store-port.d.ts +1 -1
  258. package/dist/runner/store-secrets.d.ts +3 -3
  259. package/dist/runner/store-secrets.js +8 -12
  260. package/dist/runner/text-tools.d.ts +44 -0
  261. package/dist/runner/text-tools.js +237 -0
  262. package/dist/runner/workflow-host.d.ts +7 -2
  263. package/dist/runner/workflow-host.js +3 -1
  264. package/dist/runner/workflow-loop.d.ts +10 -1
  265. package/dist/runner/workflow-loop.js +14 -6
  266. package/dist/runner/workflow-spec.d.ts +21 -0
  267. package/dist/runner/workflow-spec.js +217 -93
  268. package/dist/runs-over-store.d.ts +14 -3
  269. package/dist/runs-over-store.js +100 -23
  270. package/dist/seal-key.d.ts +0 -2
  271. package/dist/seal-key.js +5 -45
  272. package/dist/sealed-settings-store.d.ts +19 -4
  273. package/dist/sealed-settings-store.js +9 -9
  274. package/dist/sealing.d.ts +4 -0
  275. package/dist/sealing.js +20 -0
  276. package/dist/secret-cut.d.ts +1 -1
  277. package/dist/secret-cut.js +1 -1
  278. package/dist/secret-name.d.ts +9 -0
  279. package/dist/secret-name.js +15 -0
  280. package/dist/secret-writes.d.ts +0 -1
  281. package/dist/secret-writes.js +0 -1
  282. package/dist/server-fs.d.ts +4 -0
  283. package/dist/server-fs.js +8 -2
  284. package/dist/server-lock.d.ts +0 -24
  285. package/dist/server-lock.js +5 -85
  286. package/dist/server-secrets-store.d.ts +4 -4
  287. package/dist/server-secrets-store.js +9 -31
  288. package/dist/server-secrets.d.ts +4 -9
  289. package/dist/server-secrets.js +12 -36
  290. package/dist/server.d.ts +37 -56
  291. package/dist/server.js +322 -134
  292. package/dist/sign-ins-store.d.ts +34 -36
  293. package/dist/sign-ins-store.js +27 -38
  294. package/dist/sign-ins.d.ts +2 -119
  295. package/dist/sign-ins.js +5 -311
  296. package/dist/standard-webhooks.d.ts +1 -1
  297. package/dist/standard-webhooks.js +1 -1
  298. package/dist/stats.d.ts +3 -2
  299. package/dist/stats.js +1 -1
  300. package/dist/stop-signals.d.ts +4 -2
  301. package/dist/stop-signals.js +5 -3
  302. package/dist/store/agent-body.d.ts +12 -2
  303. package/dist/store/agent-body.js +22 -4
  304. package/dist/store/deadline.d.ts +18 -0
  305. package/dist/store/deadline.js +45 -0
  306. package/dist/store/index.d.ts +2 -2
  307. package/dist/store/index.js +2 -2
  308. package/dist/store/open.d.ts +6 -3
  309. package/dist/store/open.js +2 -2
  310. package/dist/store/postgres/connection.d.ts +22 -2
  311. package/dist/store/postgres/connection.js +211 -41
  312. package/dist/store/postgres/migrate.d.ts +4 -0
  313. package/dist/store/postgres/migrate.js +9 -2
  314. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  315. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  316. package/dist/store/postgres/store.d.ts +9 -2
  317. package/dist/store/postgres/store.js +9 -0
  318. package/dist/store/schema.js +1 -1
  319. package/dist/store/seal.js +2 -2
  320. package/dist/store/sqlite/connection.js +14 -5
  321. package/dist/store/sqlite/run-patch.d.ts +3 -0
  322. package/dist/store/sqlite/run-patch.js +3 -0
  323. package/dist/store/sqlite/store.js +41 -12
  324. package/dist/store/store.d.ts +35 -6
  325. package/dist/store/store.js +12 -2
  326. package/dist/store-reads/cap.d.ts +1 -1
  327. package/dist/store-reads/cap.js +22 -4
  328. package/dist/store-reads/journal.d.ts +9 -6
  329. package/dist/store-reads/journal.js +129 -18
  330. package/dist/store-reads/learning.d.ts +82 -8
  331. package/dist/store-reads/learning.js +184 -11
  332. package/dist/store-reads/workflow.d.ts +1 -1
  333. package/dist/store-reads/workflow.js +1 -1
  334. package/dist/store-view.d.ts +19 -1
  335. package/dist/store-view.js +95 -27
  336. package/dist/template-eval.d.ts +60 -4
  337. package/dist/template-eval.js +120 -54
  338. package/dist/templates.d.ts +33 -14
  339. package/dist/templates.js +82 -46
  340. package/dist/timeline/group.d.ts +33 -0
  341. package/dist/timeline/group.js +77 -0
  342. package/dist/timeline/index.d.ts +7 -0
  343. package/dist/timeline/index.js +7 -0
  344. package/dist/timeline/labels.d.ts +79 -0
  345. package/dist/timeline/labels.js +150 -0
  346. package/dist/timeline/origin.d.ts +56 -0
  347. package/dist/timeline/origin.js +92 -0
  348. package/dist/timeline/render-text.d.ts +11 -0
  349. package/dist/timeline/render-text.js +62 -0
  350. package/dist/timeline/timeline.d.ts +282 -0
  351. package/dist/timeline/timeline.js +1308 -0
  352. package/dist/timeline/util.d.ts +17 -0
  353. package/dist/timeline/util.js +49 -0
  354. package/dist/tool-budget.d.ts +18 -0
  355. package/dist/tool-budget.js +50 -0
  356. package/dist/tool-gate.d.ts +47 -218
  357. package/dist/tool-gate.js +87 -545
  358. package/dist/tool-keys-store.d.ts +11 -12
  359. package/dist/tool-keys-store.js +24 -31
  360. package/dist/tool-keys.d.ts +5 -101
  361. package/dist/tool-keys.js +8 -267
  362. package/dist/tool-plane.d.ts +23 -52
  363. package/dist/tool-plane.js +23 -81
  364. package/dist/tool-settings-store.d.ts +1 -2
  365. package/dist/tool-settings-store.js +5 -8
  366. package/dist/tools.d.ts +67 -25
  367. package/dist/tools.js +170 -119
  368. package/dist/trigger-adapter.d.ts +2 -2
  369. package/dist/trigger-targets.d.ts +13 -1
  370. package/dist/trigger-targets.js +31 -1
  371. package/dist/triggers.d.ts +2 -2
  372. package/dist/triggers.js +3 -3
  373. package/dist/turn-end.d.ts +1 -1
  374. package/dist/turn-end.js +1 -1
  375. package/dist/turns.d.ts +0 -6
  376. package/dist/turns.js +0 -19
  377. package/dist/uploads.d.ts +28 -5
  378. package/dist/uploads.js +83 -10
  379. package/dist/usage.d.ts +1 -49
  380. package/dist/usage.js +3 -84
  381. package/dist/validate.d.ts +4 -0
  382. package/dist/validate.js +33 -14
  383. package/dist/webhooks.d.ts +102 -76
  384. package/dist/webhooks.js +266 -233
  385. package/dist/workflow-run.d.ts +114 -0
  386. package/dist/workflow-run.js +144 -0
  387. package/dist/workspace/archil-claim.d.ts +2 -2
  388. package/dist/workspace/archil-claim.js +4 -3
  389. package/dist/workspace/archil-disk.d.ts +10 -1
  390. package/dist/workspace/archil-disk.js +4 -0
  391. package/dist/workspace/archil-exec.d.ts +12 -2
  392. package/dist/workspace/archil-exec.js +16 -0
  393. package/dist/workspace/archil.d.ts +2 -2
  394. package/dist/workspace/archil.js +25 -5
  395. package/dist/workspace/attach.js +2 -0
  396. package/dist/workspace/beneath.d.ts +19 -0
  397. package/dist/workspace/beneath.js +106 -0
  398. package/dist/workspace/computer-deps.d.ts +26 -9
  399. package/dist/workspace/computer-deps.js +144 -43
  400. package/dist/workspace/computer-for-claim.d.ts +17 -14
  401. package/dist/workspace/computer-for-claim.js +99 -26
  402. package/dist/workspace/computer-hold.d.ts +6 -1
  403. package/dist/workspace/computer-hold.js +6 -1
  404. package/dist/workspace/computer-janitor.d.ts +47 -0
  405. package/dist/workspace/computer-janitor.js +182 -0
  406. package/dist/workspace/computer-ledger.d.ts +1 -8
  407. package/dist/workspace/computer-ledger.js +0 -3
  408. package/dist/workspace/computer-providers.d.ts +5 -3
  409. package/dist/workspace/computer-providers.js +11 -9
  410. package/dist/workspace/grep-worker.d.ts +5 -0
  411. package/dist/workspace/grep-worker.js +9 -6
  412. package/dist/workspace/hands.d.ts +5 -2
  413. package/dist/workspace/hands.js +4 -3
  414. package/dist/workspace/index.d.ts +6 -5
  415. package/dist/workspace/index.js +4 -4
  416. package/dist/workspace/local.d.ts +14 -2
  417. package/dist/workspace/local.js +170 -43
  418. package/dist/workspace/paths.js +3 -2
  419. package/dist/workspace/pi-env.d.ts +4 -0
  420. package/dist/workspace/pi-env.js +3 -2
  421. package/dist/workspace/resolve-computer.d.ts +55 -10
  422. package/dist/workspace/resolve-computer.js +66 -14
  423. package/dist/workspace/run-tools.d.ts +15 -31
  424. package/dist/workspace/run-tools.js +19 -30
  425. package/dist/workspace/workspace.d.ts +5 -0
  426. package/dist/workspace-paths.d.ts +0 -17
  427. package/dist/workspace-paths.js +1 -41
  428. package/dist/workspace.d.ts +0 -17
  429. package/dist/workspace.js +4 -110
  430. package/package.json +14 -14
  431. package/skills/agentrun-serve/SKILL.md +1 -1
  432. package/templates/README.md +11 -5
  433. package/templates/code-review/evals/mentions-defused/case.yaml +15 -0
  434. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
  435. package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
  436. package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
  437. package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
  438. package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
  439. package/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
  440. package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
  441. package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
  442. package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
  443. package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
  444. package/templates/market-monitor/agent.md +2 -2
  445. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  446. package/templates/release-notes/agent.md +11 -0
  447. package/dist/bound-files.d.ts +0 -4
  448. package/dist/bound-files.js +0 -164
  449. package/dist/coding-tools.d.ts +0 -47
  450. package/dist/coding-tools.js +0 -189
  451. package/dist/computer-adb.d.ts +0 -12
  452. package/dist/computer-adb.js +0 -14
  453. package/dist/console/assets/index-Dn0ngwG9.js +0 -535
  454. package/dist/console/assets/index-DvW6Aled.css +0 -1
  455. package/dist/grade.d.ts +0 -63
  456. package/dist/grade.js +0 -150
  457. package/dist/mcp-servers.d.ts +0 -269
  458. package/dist/mcp-servers.js +0 -456
  459. package/dist/packs.d.ts +0 -71
  460. package/dist/packs.js +0 -180
  461. package/dist/sealed-settings.d.ts +0 -60
  462. package/dist/sealed-settings.js +0 -171
  463. package/dist/sessions.d.ts +0 -6
  464. package/dist/sessions.js +0 -109
  465. package/dist/workspace/computer-serves.d.ts +0 -12
  466. package/dist/workspace/computer-serves.js +0 -15
@@ -0,0 +1,17 @@
1
+ export type Obj = Record<string, unknown>;
2
+ export declare const obj: (value: unknown) => Obj | undefined;
3
+ export declare const str: (value: unknown) => string | undefined;
4
+ export declare const cut: (text: string, max: number) => string;
5
+ export declare const firstLine: (text: string) => string;
6
+ export declare const firstSentence: (text: string) => string;
7
+ export declare function utf8Bytes(text: string): number;
8
+ export declare function json(text: string): Obj | undefined;
9
+ /** `host/path` of a URL: no scheme, no credentials, no query, no fragment. */
10
+ export declare function where(url: string): string;
11
+ /**
12
+ * Every http(s) URL in `text` keeps its origin, its path and its query keys. Query values, the fragment and the
13
+ * userinfo are dropped, the rule pi-browser applies to the URLs a model sees.
14
+ */
15
+ export declare function scrubUrls(text: string): string;
16
+ /** `a, b, +2 more`. */
17
+ export declare const list: (items: readonly string[]) => string;
@@ -0,0 +1,49 @@
1
+ export const obj = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
2
+ export const str = (value) => (typeof value === "string" ? value : undefined);
3
+ export const cut = (text, max) => (text.length > max ? `${text.slice(0, max - 3)}...` : text);
4
+ export const firstLine = (text) => text.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
5
+ export const firstSentence = (text) => {
6
+ const flat = text.replace(/\s+/g, " ").trim();
7
+ return /^.*?[.!?](?=\s|$)/.exec(flat)?.[0] ?? flat;
8
+ };
9
+ export function utf8Bytes(text) {
10
+ let bytes = 0;
11
+ for (const char of text) {
12
+ const code = char.codePointAt(0);
13
+ bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;
14
+ }
15
+ return bytes;
16
+ }
17
+ export function json(text) {
18
+ try {
19
+ return obj(JSON.parse(text));
20
+ }
21
+ catch {
22
+ return undefined;
23
+ }
24
+ }
25
+ const URL_SHAPE = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/?#]*@)?([^/?#]+)([^?#]*)/i;
26
+ /** `host/path` of a URL: no scheme, no credentials, no query, no fragment. */
27
+ export function where(url) {
28
+ const parts = URL_SHAPE.exec(url.trim());
29
+ return cut(parts ? `${parts[1]}${parts[2] === "/" ? "" : parts[2]}` : (url.split(/[?#]/)[0] ?? ""), 80);
30
+ }
31
+ const ELIDED = "\u2026";
32
+ const TEXT_URL = /https?:\/\/[^\s"'`<>\\]+/gi;
33
+ const URL_PARTS = /^(https?:\/\/)(?:[^@/?#]*@)?([^/?#]*)([^?#]*)(?:\?([^#]*))?/i;
34
+ /**
35
+ * Every http(s) URL in `text` keeps its origin, its path and its query keys. Query values, the fragment and the
36
+ * userinfo are dropped, the rule pi-browser applies to the URLs a model sees.
37
+ */
38
+ export function scrubUrls(text) {
39
+ return text.replace(TEXT_URL, (raw) => {
40
+ const tail = /[.,;:!?)\]}]+$/.exec(raw)?.[0] ?? "";
41
+ const parts = URL_PARTS.exec(raw.slice(0, raw.length - tail.length));
42
+ if (!parts)
43
+ return raw;
44
+ const keys = [...new Set((parts[4] ?? "").split("&").map((pair) => pair.split("=")[0]).filter(Boolean))];
45
+ return `${parts[1]}${parts[2]}${parts[3]}${keys.length ? `?${keys.map((key) => `${key}=${ELIDED}`).join("&")}` : ""}${tail}`;
46
+ });
47
+ }
48
+ /** `a, b, +2 more`. */
49
+ export const list = (items) => items.length > 2 ? `${items.slice(0, 2).join(", ")}, +${items.length - 2} more` : items.join(", ");
@@ -0,0 +1,18 @@
1
+ import { type EntryRecord } from "@earendil-works/pi-durable";
2
+ /** What a call past the budget reads: the same words every time, never a count the model could argue with. */
3
+ export declare const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
4
+ /** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
5
+ * `count`, the earlier pages': `done` once the call is reached or the count is `upTo`, where a reader stops. */
6
+ export declare function countCalls(entries: readonly EntryRecord[], callId: string, upTo: number, count?: number): {
7
+ count: number;
8
+ done: boolean;
9
+ };
10
+ /** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
11
+ export declare const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
12
+ /** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
13
+ * never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
14
+ * above it is room for each conversation still working to answer. */
15
+ export declare const WRAP_UP_SHARE = 0.75;
16
+ /** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
17
+ * them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
18
+ export declare const wrappingUp: (capUsd: number | undefined, takenUsd: number | null) => boolean;
@@ -0,0 +1,50 @@
1
+ // A tool-call budget: an agent's `max_tool_calls`, held by the run's tool gate on pi. Each conversation of the run (the
2
+ // root, and any conversation a tool opens) may make that many tool calls; past it, every call is refused before its
3
+ // intent with one fixed text that tells the model to answer now from what it has. The refusal is not counted, and the
4
+ // run is never ended by it: the model's next answer is the turn's.
5
+ //
6
+ // The count is read from the conversation's committed entries, never kept in memory, so a restart or a moved claim counts
7
+ // the same calls: the tool calls of its assistant entries before this one, oldest first. The read stops at the budget: no
8
+ // refusal can come before the budget's last allowed call, so every call it counts is one that was let through, and a
9
+ // check never reads past them however long the run goes on. A call of the same round whose result has not landed yet
10
+ // counts as made: a round's calls are counted in the order the model gave them, so a round that crosses the line runs
11
+ // its first calls up to it and the rest are refused.
12
+ //
13
+ // The cap's wrap-up, the same refusal for money: a run with a cap whose spend, plus what its requests and paid steps
14
+ // still out hold at their worst case, reaches WRAP_UP_SHARE of the cap has every model-issued tool call refused before
15
+ // its intent, in WRAP_UP_TEXT, on every harness and in every conversation of the run (a `subagent` spawn is a call too).
16
+ // Nothing in flight is cut, and model requests are not touched: each conversation answers from what it has, under the
17
+ // cap, which stays the last line. The figure is read from the run's committed booking records at each call (the cap's
18
+ // own: a request still out counts at its hold and bound, one a lost claim cut the same), so a restart or a moved claim
19
+ // reads the same figure, and a raise of the cap ends the wrap-up from its next call.
20
+ import { AssistantEntry } from "@earendil-works/pi-durable";
21
+ /** What a call past the budget reads: the same words every time, never a count the model could argue with. */
22
+ export const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
23
+ /** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
24
+ * `count`, the earlier pages': `done` once the call is reached or the count is `upTo`, where a reader stops. */
25
+ export function countCalls(entries, callId, upTo, count = 0) {
26
+ for (const entry of entries) {
27
+ if (!AssistantEntry.is(entry))
28
+ continue;
29
+ const content = entry.model?.[0]?.content;
30
+ if (!Array.isArray(content))
31
+ continue;
32
+ for (const part of content) {
33
+ if (part?.type !== "toolCall" || typeof part.id !== "string")
34
+ continue;
35
+ if (part.id === callId || count >= upTo)
36
+ return { count, done: true };
37
+ count++;
38
+ }
39
+ }
40
+ return { count, done: count >= upTo };
41
+ }
42
+ /** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
43
+ export const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
44
+ /** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
45
+ * never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
46
+ * above it is room for each conversation still working to answer. */
47
+ export const WRAP_UP_SHARE = 0.75;
48
+ /** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
49
+ * them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
50
+ export const wrappingUp = (capUsd, takenUsd) => capUsd !== undefined && takenUsd !== null && Number.isFinite(takenUsd) && takenUsd >= WRAP_UP_SHARE * capUsd;
@@ -1,9 +1,5 @@
1
- import type { Context } from "@earendil-works/chord";
2
- import { type Extension, type Harness, type ToolRegistration, type Tx } from "@earendil-works/pi-durable";
3
- import { type DurableRun, type SyncTarget } from "@parcha/pi-durable-disk";
4
- import type { TurnOrigin } from "./learning-run.js";
5
1
  import type { Workspace } from "./workspace/workspace.js";
6
- import { readToolSettings } from "./tool-plane.js";
2
+ import { type ToolSettingsRead } from "./tool-plane.js";
7
3
  import { type SettingFrom } from "./refusal-words.js";
8
4
  import { type Approvals } from "./approvals.js";
9
5
  /** What the gate does with a tool's calls. */
@@ -15,8 +11,16 @@ export declare const mcpToolName: (server: string, tool: string) => string;
15
11
  export declare const isMcpTool: (name: string) => boolean;
16
12
  /** A third-party catalog tool, by its name: monid's (`monid.<tool>`) or an MCP server's (`mcp:<server>/<tool>`). */
17
13
  export declare const isCatalogTool: (name: string) => boolean;
18
- /** The owner's defaults (11-01): a built-in kernel tool allow; a third-party catalog tool ask. */
19
- export declare const defaultPermission: (name: string) => Permission;
14
+ /** Where a run's shell is, as its default permissions read it: `computer` false for a run with no computer (its bash, where
15
+ * it has one, runs on the run's folder's own exec: Archil's in Mode 2); undefined where no run is in view (the server's
16
+ * settings page, capabilities), which reads the computer's defaults. */
17
+ export type ShellWhere = {
18
+ readonly computer?: boolean;
19
+ };
20
+ /** The owner's defaults (11-01): a built-in kernel tool allow; a third-party catalog tool ask. On a run with no computer,
21
+ * the kernel's ruled rule (defaultPermissionOf): bash asks first, and the background tools, which need a computer, are
22
+ * refused. */
23
+ export declare const defaultPermission: (name: string, where?: ShellWhere) => Permission;
20
24
  /** The tools that run a command in the run's box (background.ts SHELL_TOOLS), each held to bash's setting: bash: deny
21
25
  * refuses bash_background as it refuses bash, and none of them is a settings key of its own. Under bash: ask the
22
26
  * watchers (SHELL_WATCHERS) run unasked. */
@@ -37,8 +41,8 @@ export declare function permissionKeys(name: string): string[];
37
41
  * wire name) and a harness's own (its facts' toolAlias: OpenCode's `<server>_<tool>`), is `mcp:<server>/<tool>`; a catalog's wire name (`monid_run`) is its
38
42
  * catalog name; the browser's registrations are `browser`; an adapter's read_skill_file is `read` (but an agent's MCP tool of that name is its own). OpenCode's `<server>_<tool>` maps only for a server of
39
43
  * `mcpServers` (the run's configured MCP servers), never by its shape, since a host tool's name has the same shape.
40
- * Undefined: nothing maps it, and the gate asks. The key only: an MCP call enters the gate once, in the MCP gateway for a
41
- * registration it marks (GATED_BY_GATEWAY), else where its tool is wrapped. */
44
+ * Undefined: nothing maps it, and the gate asks. The key only: the runner's adapter loop asks the gate once per call,
45
+ * before its intent (RunGate.decide). */
42
46
  export declare function settingsKeyOf(harness: string, name: string, mcpServers?: readonly string[]): string | undefined;
43
47
  /** A pinned argument's scalar: `null` holds for a call that leaves the argument out (or gives null). */
44
48
  export type PinScalar = string | number | boolean | null;
@@ -53,10 +57,11 @@ export declare const MAX_PIN_CHOICES = 16;
53
57
  /** A layer of tool settings (the server's, PUT /v2/settings/tools, or an agent's own, definition.tool_settings) as the
54
58
  * gate reads it: a permission by settings key, and an MCP tool's pin. */
55
59
  export type PermissionSettings = Readonly<Record<string, {
56
- permission?: Permission; /** Not as written: a value not offered, read as its fail-closed stand-in (tool-plane.ts readToolSettings). Never shown. */
60
+ permission?: Permission; /** Not as written: a value not offered, read as its fail-closed stand-in (tool-plane.ts checkToolSettings). Never shown. */
57
61
  fallback?: true;
58
- pin?: Pin; /** A pin in the server's file that does not read (tool-plane.ts readToolSettings): every call of the tool is refused. Never shown. */
59
- brokenPin?: true;
62
+ pin?: Pin; /** A pin in the server's settings that does not read (tool-plane.ts checkToolSettings): every call of the tool is refused. Never shown. */
63
+ brokenPin?: true; /** bash's policy, in an agent's own settings only (bash-read-only.ts): what its commands may do. */
64
+ policy?: string;
60
65
  } | undefined>>;
61
66
  /** A one-of list in its one form: each value once, null first, then by its JSON text; any other value as it is. The
62
67
  * same meaning is the same text (a revision's id) and the same words (a refusal). */
@@ -84,12 +89,12 @@ export declare function pinRefusal(name: string, args: unknown, server: Permissi
84
89
  * layer, nor an ask that stands in for a setting that does not read. Nor is anything RunGate.enter refuses before it
85
90
  * decides between running and parking ever lifted (a template's pin, among them). Without never, the answer is as it
86
91
  * always was. */
87
- export declare function permissionFrom(name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals): {
92
+ export declare function permissionFrom(name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals, where?: ShellWhere): {
88
93
  permission: Permission;
89
94
  from: SettingFrom;
90
95
  };
91
- /** Marks the server's settings map when its file is present but does not read (tool-plane.ts ToolSettings.get): every
92
- * tool then takes its defaults, and the deny the file may hold can't be seen, so nothing lifts an ask over it. A symbol:
96
+ /** Marks the server's settings map when its stored value does not read (tool-plane.ts loadToolSettings): every
97
+ * tool then takes its defaults, and a deny it may hold can't be seen, so nothing lifts an ask over it. A symbol:
93
98
  * carried by a spread, never by JSON (it is never served) nor by Object.entries (no reader takes it for a tool). */
94
99
  export declare const SETTINGS_UNREAD: unique symbol;
95
100
  /** `name`'s permission in force (permissionFrom): the one rule every path reads, the gate's, the tool plane's and a
@@ -115,80 +120,15 @@ export type PendingApproval = {
115
120
  requested_at: string;
116
121
  price?: ApprovalPrice;
117
122
  };
118
- /** The run's journal commit for the call, which makes the request durable before the gate answers, and who is told it
119
- * parked, so its turn ends (harness-app.ts endsTurn): by the call's id, or, where the caller cannot name it, by its tool
120
- * and its arguments' digest. */
121
- export type Park = {
122
- commit<T>(change: (tx: unknown) => Promise<T>): Promise<T>;
123
- parked?(callId: string): void;
124
- parkedBy?(match: {
125
- tool: string;
126
- argsDigest: string;
127
- }): void; /** The message the turn running the call took (harness-app's), kept with its request. */
128
- turn?(): string | undefined;
129
- };
130
- /** What a call's ask carries beyond the call. */
131
- export type EnterOptions = {
132
- /** What the approval card shows the call costs. */
133
- price?: ApprovalPrice;
134
- /** The call is a replay: a crash cut an earlier attempt that may have been sent (the kernel's attempt above 0). A
135
- * refusal then never says nothing was sent or charged. */
136
- replayed?: true;
137
- };
138
- /** enter's answer. `undefined`: run the call. Otherwise the answer the model reads instead: a refusal
139
- * (`isError: true`), or the waiting text with `parked: true`, after which the caller ends the turn. */
140
- export type Entered = undefined | (ToolAnswer & {
141
- parked?: true;
142
- });
143
- /** Runs an APPROVED parked call of a tool family the gate does not own (the MCP gateway's), exactly once. It owns the
144
- * call's deadline: the gate puts no wall-clock bound on it (only a stop or a cancel cuts it, through `signal`), so an
145
- * executor bounds its own work and answers a timeout as an error result (`isError: true`), never by waiting on. */
146
- export type Executor = (tool: string, args: unknown, callId: string, signal: AbortSignal) => Promise<ToolAnswer>;
147
- /** The mark a tool registration carries when its calls are gated by whoever registered it (the MCP gateway, which marks
148
- * its registrations only when it holds this run's gate and park, and enters the gate in each call): RunGate.extension
149
- * does not wrap it again. A private symbol, never `Symbol.for`: a global-registry key could be recreated by any code
150
- * with the string alone. Only code that imports this export can set it (mcp-gateway.ts does). */
151
- export declare const GATED_BY_GATEWAY: unique symbol;
152
- /** A registration that may carry GATED_BY_GATEWAY. */
153
- export type GatewayMarked = ToolRegistration & {
154
- [GATED_BY_GATEWAY]?: true;
155
- };
156
- /** The gate of one run, in the run's process. */
157
- export interface Gate {
158
- /** One model-initiated call at the gate: allow, deny, or ask, which parks (see the header). */
159
- enter(tool: string, args: unknown, callId: string, park: Park, options?: EnterOptions): Promise<Entered>;
160
- /** Registers how an approved parked call of tools named `prefix…` (e.g. "mcp:") runs; one per prefix and run. */
161
- executor(prefix: string, run: Executor): void;
162
- /** A call's result text as the model gets it: as it is, a host tool's result already cut by HOST_RESULT_MAX_CHARS. */
163
- spill(callId: string, text: string): string;
164
- }
165
123
  export { type DenyFrom, deniedText, denyPlace, NOT_RUN, RAN_UNKNOWN, refusedText, type SettingFrom } from "./refusal-words.js";
166
124
  /** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token. */
167
125
  export declare const noApproverText: (tool: string, ran?: "no" | "unknown") => string;
168
- /** Set by the server in a run's environment when no one can approve here (accounts off): the gate refuses each ask. */
169
- export declare const NO_APPROVER_ENV = "AGENTRUN_SERVE_NO_APPROVER";
170
126
  /** A parked call's answer: the run pauses here. */
171
127
  export declare const waitingText: (tool: string) => string;
172
128
  /** The Timeline row of a call that waits for an approval. */
173
129
  export declare const APPROVAL_ROW: "tool_approval_requested";
174
130
  /** A call's arguments shown on its approval, at most this many bytes. */
175
131
  export declare const ARGS_PREVIEW_BYTES = 2048;
176
- /** A gate of `policy` (the run's permission of a tool now) with no run behind it: allow and deny are enforced and
177
- * executors are kept; an ask throws, since nothing here can park a call (a run's is RunGate), and spill returns
178
- * the text as it is. */
179
- export declare function gateOf(policy: (tool: string) => Permission): Gate;
180
- /** The file in a run's directory that names the origin of the turn it runs now: written by the server alone, as it sends
181
- * the learning lane's reflect turn (runs.ts's toLiveDoor), and gone before a person's turn is sent (runs.ts's personsTurn).
182
- * The gate refuses that turn's writes under work/.learning/ (NOTE_ONLY_TEXT). */
183
- export declare const TURN_ORIGIN_FILE = "turn-origin.json";
184
- /** The run's store's record of a call that waits for approval (`phase: "requested"`), and of its answer acted on
185
- * (`phase: "resolved"`), on its root conversation. */
186
- export declare const APPROVAL_ENTRY = "agentrun.tool_approval";
187
- /** The run's store's record that the gate let a replay-safe pi call that can bill through (`{ callId }`), written before
188
- * the tool runs. pi-durable reruns a cut replay-safe call with the same call id and no sign that it is a rerun: this mark
189
- * is how the gate knows an earlier attempt may have been sent, so a deny of the rerun never says nothing was charged.
190
- * Outside `agentrun.tool_`, the tool ledger's kinds (paid-calls.ts), which readers of a run's charges take by prefix. */
191
- export declare const GATE_PASSED_ENTRY = "agentrun.gate_passed";
192
132
  /** The refusal of the end-of-run turn's write or edit under work/.learning/: its notes are kept only from its answer's
193
133
  * note blocks (learn/reflect.ts parseReflection), which the host merges in its own store; a file there is never kept. */
194
134
  export declare const NOTE_ONLY_TEXT = "A note is kept only from your answer: write it in a ```note block, not to a file.";
@@ -208,19 +148,6 @@ export type ApprovalRequest = {
208
148
  price?: ApprovalPrice; /** Parked on a replay: a crash cut an earlier attempt that may have been sent, so a refusal never says nothing was charged. Kept in the store, so a restart keeps it. */
209
149
  replayed?: true;
210
150
  };
211
- /** Resumes the session with `content` as one message of its own (`approval-<id>`), writing `mark` with it or after it. */
212
- export type Resume = (id: string, content: string, mark: (tx: Tx) => Promise<unknown>, origin?: ResumeOrigin) => Promise<void>;
213
- /** Who wrote a resume, for the Timeline (pi-durable-agent's MessageOrigin): the server, carrying an answer, so it never
214
- * shows as the person's message. A person's message that declined the call: `said`, their words, which the Timeline
215
- * shows as theirs beside the server's row. */
216
- export type ResumeOrigin = {
217
- kind: "server";
218
- reason: "approval";
219
- } | {
220
- kind: "server";
221
- reason: "approval_declined";
222
- said: string;
223
- };
224
151
  /** `text` cut to at most ARGS_PREVIEW_BYTES. What is shown of a call's arguments is the whole of them redacted first, then
225
152
  * cut (runs.ts), so a cut never leaves the head of a key no redaction recognizes. */
226
153
  export declare function previewOf(text: string): string;
@@ -235,15 +162,14 @@ export declare const RESUME_PREFIX = "[tool approval] ";
235
162
  * writes it, and the Timeline strips exactly it from the row a person opens (runs.ts resumeShows). */
236
163
  export declare function resumeHead(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string): string;
237
164
  export declare function resumeText(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string, decision: "allow" | "deny", result: ToolAnswer): string;
238
- /** The gate of the run `runId` at `where` (its directory, under the data directory's runs/), on its pinned revision:
239
- * an agentic run's parks an asked call; a workflow's model node cannot. `serverSettings`: where the server's tool
240
- * settings are read from, read at each call as the gate reads them; absent, the file beside the run's data directory (the
241
- * old per-run process). The runner gives the one store's (tool-plane.ts loadToolSettings), read once at the claim.
242
- * `approvers`: whether anyone can answer an ask here. The runner gives the store's (server-approvers.ts, read at each
243
- * claim); absent, the old per-run process's environment says (NO_APPROVER_ENV, set for it by runs.ts). */
165
+ /** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
166
+ * settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
167
+ * the gate reads them. `approvers`: whether anyone can answer an ask here, the store's (server-approvers.ts, read at each
168
+ * claim). The gate reads nothing of the run's own files: they are the agent's to write. */
244
169
  export declare function runGate(where: {
245
170
  root: string;
246
171
  work: string;
172
+ computer?: boolean;
247
173
  }, runId: string, revision: {
248
174
  kind: string;
249
175
  body: {
@@ -251,60 +177,42 @@ export declare function runGate(where: {
251
177
  harness?: string;
252
178
  approvals?: Approvals;
253
179
  };
254
- }, serverSettings?: () => ReturnType<typeof readToolSettings>, files?: RunFiles, approvers?: boolean): RunGate;
255
- /** Where a gate reads the run's own files (the turn's origin): the run's Workspace (Mode 2: its folder on the run's disk,
256
- * read by path in the folder, never a folder of this machine), or the local folder's path. */
180
+ }, serverSettings: () => ToolSettingsRead, approvers: boolean): RunGate;
181
+ /** A run's folder as its spec names it: the run's Workspace (Mode 2: its folder on the run's disk, never a folder of this
182
+ * machine), or the local folder's path. The gate checks paths against it and reads nothing in it. */
257
183
  export type RunFiles = Pick<Workspace, "read"> | string;
258
- /** The gate in a run's process, park mode: its policy, the turn's origin, the calls that wait, and the answers acted on. */
184
+ /** A run's tool gate on the runner: its policy, asked before each call's intent (decide). */
259
185
  export declare class RunGate {
260
186
  private readonly where;
187
+ private readonly readServerSettings;
261
188
  private readonly overrides;
262
- private readonly parks;
263
189
  private readonly approvers;
264
190
  private readonly approvals;
265
- private readonly readServerSettings?;
266
- private readonly files;
267
- private readonly requests;
268
- /** The replay-safe pi calls the gate let through (GATE_PASSED_ENTRY), by call id: a rerun of one is a replay. */
269
- private readonly passed;
270
- private durable?;
271
- /** The run's store, for the barrier before a call that is not replay-safe: from `prime` (before the resume) or `load`. */
272
- private syncTarget?;
273
- private context?;
274
- private coding?;
275
- /** The run's own tools beyond the table (its learned_workflow), on which an approved call of one runs. */
276
- private extra;
277
- private resume?;
278
- /** Told just before an allowed call runs (harness-app's): the run is un-parked, so the call's own model requests (a
279
- * learned workflow's node) go out; the harness is idle then, as the park ended its turn. */
280
- private unpark?;
281
- private drive?;
282
- private timer?;
283
- private settling;
284
- private readonly stop;
285
- /** `where.data`: the server's data directory, its tool settings beside the store; `overrides`: the pinned revision's
286
- * own; `parks`: whether an asked call parks the run (an agentic run's), which a workflow's model node cannot;
191
+ /** `readServerSettings`: the server's tool settings, read at each call; `overrides`: the pinned revision's own;
287
192
  * `approvers`: whether anyone can answer an ask here (the owner's password session: accounts on); `approvals`: the
288
- * pinned revision's (definition.approvals): "never" runs the agent unattended, an ask allowed (permissionFrom);
289
- * `files`: where the run's own files are read (RunFiles), the run's folder `where.root` when absent. */
193
+ * pinned revision's (definition.approvals): "never" runs the agent unattended, an ask allowed (permissionFrom). */
290
194
  constructor(where: {
291
195
  root: string;
292
196
  work: string;
293
- data: string;
294
197
  runId: string;
295
198
  harness?: string;
296
199
  mcpServers?: readonly string[];
297
- }, overrides?: PermissionSettings, parks?: boolean, approvers?: boolean, approvals?: Approvals, readServerSettings?: (() => ReturnType<typeof readToolSettings>) | undefined, files?: RunFiles);
200
+ computer?: boolean;
201
+ }, readServerSettings: () => ToolSettingsRead, overrides?: PermissionSettings, approvers?: boolean, approvals?: Approvals);
298
202
  /** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
299
203
  * reaches a live run at its next call; under approvals "never", an ask is an allow. */
300
204
  readonly policy: (tool: string) => Permission;
301
205
  /** The gate's answer for one call before its intent, for a loop that parks and answers asks itself (the runner's adapter
302
- * loops, pi's and the CLI harnesses'): run it, ask a person, or refuse it with the words the model reads. `enter`'s
303
- * order: the end-of-run turn's write under .learning/ (learningRefusal), the deny (with where it was set, and that
304
- * nothing was sent or charged), a pin, then the allow, then the ask, so an allow that approvals "never" made is decided
206
+ * loops, pi's and the CLI harnesses'): run it, ask a person, or refuse it with the words the model reads. The order:
207
+ * the deny (with where it was set, and that nothing was sent or charged), a pin, bash's policy (policyRefusal), then
208
+ * the allow, then the ask, so an allow that approvals "never" made is decided
305
209
  * only after every refusal. Where no one can approve (accounts off: the store's approvers row a runner reads at each
306
- * claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it. */
307
- decide(name: string, args: unknown): Promise<"allow" | "ask" | {
210
+ * claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it. `replayed`:
211
+ * the call is run again after an earlier attempt that may have been sent (a replay-safe call rerun after a crash), so a
212
+ * refusal says whether it took effect is not known, never that nothing was sent. */
213
+ decide(name: string, args: unknown, options?: {
214
+ readonly replayed?: boolean;
215
+ }): Promise<"allow" | "ask" | {
308
216
  deny: string;
309
217
  }>;
310
218
  /** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
@@ -319,6 +227,10 @@ export declare class RunGate {
319
227
  /** Why a pin refuses the call of `key` with `args` now (pinRefusal): the revision's own pins and the server's, read at
320
228
  * each call as its permission is, so a pin set or changed reaches a live run at its next call. */
321
229
  private pinned;
230
+ /** Why bash's policy refuses the call `name` (held to `key`) with `args` now, or undefined: the revision's own setting
231
+ * (an agent's tool_settings.bash.policy), so every shell tool under every harness's name for it is held to it. A policy
232
+ * this server does not know refuses every shell call (fail closed), as a pin that does not read does. */
233
+ private policyRefusal;
322
234
  private lastGood?;
323
235
  private readonly told;
324
236
  /** The server's settings now: read at each call, so a change reaches a live run; settings that do not read keep the
@@ -326,87 +238,4 @@ export declare class RunGate {
326
238
  * while the read fails, as a deny may be in what did not read (undefined: none read yet, every tool asks). Each problem
327
239
  * is said once, by file and field, never a value. */
328
240
  private serverSettings;
329
- /** The origin of the turn running now: what the server's internal path wrote for it (TURN_ORIGIN_FILE in the run's
330
- * folder, read through `files`: the run's Workspace or the local folder's path); none for a person's turn, or a file
331
- * that is not there or does not read. */
332
- turnOrigin(): Promise<TurnOrigin | undefined>;
333
- /** The end-of-run turn's refusal of a write or edit under work/.learning/ (NOTE_ONLY_TEXT, the adapter loop's one text
334
- * too), whatever the tool's permission: its notes are kept only from its answer. Undefined for any other call or turn,
335
- * whose write there follows its permission, as anywhere. The first check of `enter` and `decide`. */
336
- private learningRefusal;
337
- /** One model-initiated call at the gate: undefined when it may run; else its answer, refused at once (deny) or parked
338
- * (ask). One call waits at a time: another asked meanwhile is answered so, not run. */
339
- enter(name: string, args: unknown, callId: string, park: Park, options?: EnterOptions): Promise<Entered>;
340
- /** pi's `tools` behind the gate: wraps, by name, for the run's registry, which apply wherever it is selected (every
341
- * agent selects it: the root by default, a workflow's model node by name, app.ts). */
342
- extension(tools: readonly ToolRegistration[]): Extension;
343
- private wrap;
344
- /** Takes the open run, as the run's process opens (its app's onOpen), reading what its store holds of the gate unless
345
- * `prime` read it before the resume. `coding`: the run's coding source (coding-tools.ts), on which an approved coding
346
- * call runs, as the run's own would; `extra`, the run's own tools beyond the table (its learned_workflow), on which an
347
- * approved call of one runs. */
348
- load(durable: DurableRun, context: Context, coding?: readonly ToolRegistration[], extra?: readonly ToolRegistration[]): Promise<void>;
349
- private primed;
350
- /** Reads what the run's store holds of the gate (the calls that wait, the answers acted on, the calls it let through)
351
- * before the run resumes: its app's beforeResume hook, ahead of harness.resume(), which dispatches the calls a crash
352
- * cut. Read here, not in onOpen, which a recovered call races. A workflow's run calls only this; load reads nothing more. */
353
- prime(harness: Pick<Harness, "conversation">, context: Context, syncTarget?: SyncTarget): Promise<void>;
354
- /** Whether a call waits for its answer, or for its answer to be acted on: a harness keeps the turn it ended closed. */
355
- waiting(): boolean;
356
- /** Whether a call of the turn that took `message` was parked, answered or not: that turn ended at the park, though a
357
- * process that went before the next open settled it leaves it open in its session. */
358
- parkedIn(message: string | undefined): boolean;
359
- /** Acts on the answers from now on, resuming the session through `resume`; by default pi's root conversation. */
360
- start(resume?: Resume, unpark?: () => void): void;
361
- private note;
362
- /** Reads the run's serve.json for answers while a call waits. */
363
- private watch;
364
- /** pi's resume: an input to the root conversation under the request's own id, which pi takes once however often it
365
- * is sent, then the mark. */
366
- private readonly submit;
367
- private settle;
368
- /** The approved call in flight, and its own abort: a stop or a cancel of the run cuts it (cutIfWithdrawn). */
369
- private inFlight?;
370
- /** Cuts the approved call in flight when a stop or a cancel since withdrew its answer (runs.ts supersede). */
371
- private cutIfWithdrawn;
372
- /** A call withdrawn with its run: resolved in the run's store with nothing run and nothing resumed. */
373
- private resolveSilently;
374
- /** The run's own `approvals:` session, the journal every approved call runs through: opened once. */
375
- private journal;
376
- /** An approved call whose tool was set to deny (or pinned so that its arguments no longer hold) before the gate acted
377
- * on the answer. A call whose outcome is in the
378
- * journal RAN (a crash came between it and its resume): the model gets that outcome, as any allowed call's, and nothing
379
- * runs again; a later deny can't un-run it. One with an intent and no outcome may have been sent: denied, with no claim
380
- * either way. One the journal never saw is denied, not run and not charged. */
381
- private ranOrDenied;
382
- /** The approved call, run once by the kernel through the journal any host tool's call goes through, as an effect of
383
- * the run's own `approvals:` session, on the run's coding source: its intent is durable before it runs, its outcome
384
- * after; a replay-safe call a crash cut off runs again, any other is answered interrupted and never runs again. */
385
- private run;
386
- private readonly executors;
387
- /** Registers how an approved call of tools named `prefix…` runs (the MCP gateway's, "mcp:"): one per prefix and run.
388
- * The gate runs it exactly once on its journaled path, as it runs a kernel host tool, with no deadline of its own: the
389
- * executor bounds the call (Executor). */
390
- executor(prefix: string, run: Executor): void;
391
- /** What runs an approved call: the executor its tool's prefix names, which may have effects anywhere, so a call a
392
- * crash cut off is never run again; else the kernel's host tool of the name, as replay-safe as that tool is. Neither:
393
- * refused, in words, and never run. */
394
- private runnerOf;
395
241
  }
396
- /** A parked call: by its id, or, where the caller cannot name it (OpenCode's MCP calls carry none), by its tool, as the
397
- * harness reports it, and its arguments' digest (argsDigest). */
398
- export type ParkedCall = {
399
- callId: string;
400
- } | {
401
- tool: string;
402
- argsDigest: string;
403
- };
404
- /** The digest a park by tool and arguments is matched on: the sha256 of the arguments' canonical JSON, in hex. */
405
- export declare const argsDigest: (args: unknown) => string;
406
- /** Whether the tool result `result` ends the turn `parked` waits in (harness-app.ts asks it at each one): the parked
407
- * call's own, by its id; or, for a park by tool and arguments, the next result of that tool with those arguments. */
408
- export declare function endsTurn(parked: ParkedCall | undefined, result: {
409
- callId: string;
410
- tool: string;
411
- args: unknown;
412
- }): boolean;