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

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 (444) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/README.md +343 -246
  3. package/dist/adapters.d.ts +0 -7
  4. package/dist/adapters.js +11 -22
  5. package/dist/agent-rows.d.ts +98 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +60 -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 +14 -0
  14. package/dist/api-only.js +33 -0
  15. package/dist/archil-routes.d.ts +1 -1
  16. package/dist/bash-read-only.d.ts +22 -0
  17. package/dist/bash-read-only.js +701 -0
  18. package/dist/box-egress-vm.d.ts +0 -8
  19. package/dist/box-egress-vm.js +0 -10
  20. package/dist/box-egress.d.ts +0 -4
  21. package/dist/box-egress.js +1 -16
  22. package/dist/box-paths.d.ts +25 -2
  23. package/dist/box-paths.js +79 -11
  24. package/dist/box-relay.d.ts +0 -11
  25. package/dist/box-relay.js +0 -20
  26. package/dist/box-settings.d.ts +26 -0
  27. package/dist/box-settings.js +63 -0
  28. package/dist/boxes.d.ts +21 -1
  29. package/dist/boxes.js +27 -20
  30. package/dist/browser-commands.d.ts +5 -2
  31. package/dist/browser-commands.js +4 -4
  32. package/dist/browser-computer.d.ts +5 -0
  33. package/dist/browser-computer.js +21 -0
  34. package/dist/browser-cost.d.ts +9 -6
  35. package/dist/browser-cost.js +94 -51
  36. package/dist/browser-live.d.ts +7 -20
  37. package/dist/browser-live.js +15 -93
  38. package/dist/browser-person.d.ts +18 -53
  39. package/dist/browser-person.js +94 -279
  40. package/dist/budget.d.ts +0 -4
  41. package/dist/budget.js +0 -7
  42. package/dist/cap.d.ts +8 -12
  43. package/dist/cap.js +12 -27
  44. package/dist/cli.js +61 -20
  45. package/dist/closed-pipes.d.ts +2 -0
  46. package/dist/closed-pipes.js +13 -0
  47. package/dist/computer-commands.d.ts +2 -0
  48. package/dist/computer-commands.js +2 -0
  49. package/dist/computer-keys.js +5 -2
  50. package/dist/computer-setting.d.ts +20 -4
  51. package/dist/computer-setting.js +25 -5
  52. package/dist/computers.d.ts +31 -3
  53. package/dist/computers.js +70 -11
  54. package/dist/confine.d.ts +120 -0
  55. package/dist/confine.js +436 -0
  56. package/dist/console/assets/index-RPHGlXmM.js +540 -0
  57. package/dist/console/assets/index-opTN5Naq.css +1 -0
  58. package/dist/console/index.html +2 -2
  59. package/dist/daytona-api.d.ts +0 -11
  60. package/dist/daytona-api.js +1 -82
  61. package/dist/decision-rows.d.ts +1 -1
  62. package/dist/decision-rows.js +1 -1
  63. package/dist/docker-daemon.d.ts +31 -0
  64. package/dist/docker-daemon.js +56 -0
  65. package/dist/docker-host-addresses.d.ts +37 -0
  66. package/dist/docker-host-addresses.js +110 -0
  67. package/dist/effort-guidance.js +4 -3
  68. package/dist/environment.d.ts +0 -3
  69. package/dist/environment.js +3 -5
  70. package/dist/errors.d.ts +0 -2
  71. package/dist/errors.js +6 -9
  72. package/dist/filed-answer.d.ts +32 -0
  73. package/dist/filed-answer.js +160 -0
  74. package/dist/files.d.ts +1 -11
  75. package/dist/files.js +2 -21
  76. package/dist/github-connection.d.ts +2 -2
  77. package/dist/github-connection.js +1 -1
  78. package/dist/graph-view.d.ts +3 -5
  79. package/dist/graph-view.js +4 -14
  80. package/dist/handed-values.d.ts +9 -0
  81. package/dist/handed-values.js +26 -0
  82. package/dist/harness-install.d.ts +22 -5
  83. package/dist/harness-install.js +98 -20
  84. package/dist/harness-opencode/adapter.d.ts +7 -0
  85. package/dist/harness-opencode/adapter.js +23 -6
  86. package/dist/harness-opencode/index.d.ts +1 -1
  87. package/dist/harness-opencode/index.js +1 -1
  88. package/dist/harness-opencode/verify.d.ts +17 -0
  89. package/dist/harness-opencode/verify.js +30 -10
  90. package/dist/harness-table.js +6 -1
  91. package/dist/harness.d.ts +4 -3
  92. package/dist/harness.js +16 -1
  93. package/dist/heard.js +1 -1
  94. package/dist/held-fd.d.ts +5 -0
  95. package/dist/held-fd.js +14 -0
  96. package/dist/host-calls.d.ts +20 -0
  97. package/dist/host-calls.js +12 -0
  98. package/dist/host-tools.d.ts +4 -21
  99. package/dist/host-tools.js +4 -61
  100. package/dist/host.d.ts +2 -4
  101. package/dist/host.js +2 -7
  102. package/dist/import-summary.d.ts +1 -5
  103. package/dist/import-summary.js +0 -21
  104. package/dist/import.d.ts +6 -6
  105. package/dist/import.js +62 -24
  106. package/dist/key-refusal.d.ts +5 -1
  107. package/dist/key-refusal.js +19 -4
  108. package/dist/learn/check.d.ts +6 -2
  109. package/dist/learn/check.js +83 -29
  110. package/dist/learn/folder.d.ts +5 -1
  111. package/dist/learn/folder.js +10 -3
  112. package/dist/learn/grade.d.ts +14 -0
  113. package/dist/learn/grade.js +68 -12
  114. package/dist/learn/index.d.ts +4 -4
  115. package/dist/learn/index.js +4 -4
  116. package/dist/learn/reflect.d.ts +31 -2
  117. package/dist/learn/reflect.js +79 -4
  118. package/dist/learn/relevance.d.ts +24 -0
  119. package/dist/learn/relevance.js +91 -0
  120. package/dist/learn/secrets.d.ts +8 -1
  121. package/dist/learn/secrets.js +95 -15
  122. package/dist/learn/skills.d.ts +112 -14
  123. package/dist/learn/skills.js +556 -52
  124. package/dist/learned-workflow.d.ts +37 -5
  125. package/dist/learned-workflow.js +106 -12
  126. package/dist/learning-routes.d.ts +16 -49
  127. package/dist/learning-routes.js +46 -36
  128. package/dist/learning-run.d.ts +6 -250
  129. package/dist/learning-run.js +11 -665
  130. package/dist/learning-words.d.ts +12 -5
  131. package/dist/learning-words.js +18 -9
  132. package/dist/learning.d.ts +93 -77
  133. package/dist/learning.js +176 -304
  134. package/dist/live/stream.js +1 -1
  135. package/dist/live/translate.js +13 -3
  136. package/dist/local-models.d.ts +11 -5
  137. package/dist/local-models.js +13 -8
  138. package/dist/mcp-gateway.d.ts +11 -52
  139. package/dist/mcp-gateway.js +44 -148
  140. package/dist/mcp-oauth.d.ts +10 -14
  141. package/dist/mcp-oauth.js +14 -32
  142. package/dist/mcp-probe.d.ts +0 -7
  143. package/dist/mcp-probe.js +4 -10
  144. package/dist/mcp-servers-store.d.ts +6 -6
  145. package/dist/mcp-servers-store.js +13 -15
  146. package/dist/mcp-store.js +3 -4
  147. package/dist/mcp.js +4 -3
  148. package/dist/model.d.ts +6 -7
  149. package/dist/model.js +43 -27
  150. package/dist/monid.d.ts +0 -2
  151. package/dist/monid.js +3 -6
  152. package/dist/openapi.d.ts +8 -1
  153. package/dist/openapi.js +124 -50
  154. package/dist/page.d.ts +1 -3
  155. package/dist/page.js +9 -19
  156. package/dist/paid-calls.d.ts +21 -27
  157. package/dist/paid-calls.js +28 -62
  158. package/dist/pause.d.ts +0 -2
  159. package/dist/pause.js +1 -8
  160. package/dist/place.d.ts +0 -5
  161. package/dist/place.js +0 -10
  162. package/dist/print.d.ts +2 -1
  163. package/dist/print.js +4 -2
  164. package/dist/propose.js +83 -39
  165. package/dist/push-handler.d.ts +1 -1
  166. package/dist/reflect-range.d.ts +25 -0
  167. package/dist/reflect-range.js +30 -0
  168. package/dist/refusal-words.d.ts +5 -1
  169. package/dist/refusal-words.js +5 -1
  170. package/dist/rows.d.ts +1 -1
  171. package/dist/run-cut.d.ts +0 -6
  172. package/dist/run-cut.js +0 -6
  173. package/dist/run-db.d.ts +2 -13
  174. package/dist/run-db.js +2 -41
  175. package/dist/run-launch.d.ts +19 -2
  176. package/dist/run-launch.js +13 -5
  177. package/dist/run-learning-served.d.ts +46 -2
  178. package/dist/run-learning-served.js +26 -7
  179. package/dist/run-reads-over-store.d.ts +1 -1
  180. package/dist/run-reads-over-store.js +15 -6
  181. package/dist/run-secrets.d.ts +33 -0
  182. package/dist/run-secrets.js +53 -0
  183. package/dist/run-timeline-served.d.ts +5 -1
  184. package/dist/run-timeline-served.js +19 -5
  185. package/dist/run-view.d.ts +12 -17
  186. package/dist/run-view.js +29 -28
  187. package/dist/runnable.d.ts +18 -10
  188. package/dist/runnable.js +21 -10
  189. package/dist/runner/adapter-loop.d.ts +14 -3
  190. package/dist/runner/adapter-loop.js +464 -62
  191. package/dist/runner/adapter-run-spec.d.ts +29 -8
  192. package/dist/runner/adapter-run-spec.js +96 -37
  193. package/dist/runner/adapters/index.js +11 -1
  194. package/dist/runner/adapters/pi.d.ts +15 -1
  195. package/dist/runner/adapters/pi.js +19 -5
  196. package/dist/runner/beside.d.ts +30 -3
  197. package/dist/runner/beside.js +54 -12
  198. package/dist/runner/claim-secrets.d.ts +10 -1
  199. package/dist/runner/claim-secrets.js +49 -15
  200. package/dist/runner/cli-run-spec.d.ts +2 -0
  201. package/dist/runner/cli-run-spec.js +60 -17
  202. package/dist/runner/commands.js +1 -1
  203. package/dist/runner/computer-journal.d.ts +15 -2
  204. package/dist/runner/computer-journal.js +41 -5
  205. package/dist/runner/conformance/harness.js +118 -8
  206. package/dist/runner/conformance/subject.d.ts +4 -1
  207. package/dist/runner/dispatch.d.ts +8 -1
  208. package/dist/runner/dispatch.js +81 -7
  209. package/dist/runner/end-of-run.d.ts +8 -2
  210. package/dist/runner/end-of-run.js +10 -4
  211. package/dist/runner/github-app.js +1 -1
  212. package/dist/runner/harness-loops.d.ts +9 -1
  213. package/dist/runner/harness-loops.js +15 -2
  214. package/dist/runner/journal-kinds.d.ts +30 -6
  215. package/dist/runner/journal-kinds.js +20 -5
  216. package/dist/runner/journal-reader.d.ts +1 -1
  217. package/dist/runner/journal-reader.js +2 -2
  218. package/dist/runner/learning-ask.d.ts +4 -0
  219. package/dist/runner/learning-ask.js +15 -1
  220. package/dist/runner/learning-end.d.ts +18 -3
  221. package/dist/runner/learning-end.js +113 -11
  222. package/dist/runner/learning-loop.d.ts +5 -0
  223. package/dist/runner/learning-loop.js +26 -6
  224. package/dist/runner/live-ticker.d.ts +1 -1
  225. package/dist/runner/live-ticker.js +28 -4
  226. package/dist/runner/loop-contract.d.ts +3 -2
  227. package/dist/runner/main.d.ts +64 -10
  228. package/dist/runner/main.js +165 -27
  229. package/dist/runner/mcp-claim.d.ts +1 -1
  230. package/dist/runner/mcp-claim.js +2 -3
  231. package/dist/runner/mcp-run.d.ts +2 -0
  232. package/dist/runner/mcp-run.js +15 -5
  233. package/dist/runner/memory-claim.d.ts +9 -0
  234. package/dist/runner/memory-claim.js +25 -0
  235. package/dist/runner/metrics.d.ts +33 -1
  236. package/dist/runner/metrics.js +85 -1
  237. package/dist/runner/model-route.d.ts +13 -0
  238. package/dist/runner/model-route.js +154 -11
  239. package/dist/runner/redact.d.ts +8 -2
  240. package/dist/runner/redact.js +11 -2
  241. package/dist/runner/reflect-hook.d.ts +12 -1
  242. package/dist/runner/reflect-hook.js +33 -3
  243. package/dist/runner/runner.d.ts +20 -0
  244. package/dist/runner/runner.js +56 -10
  245. package/dist/runner/store-port.d.ts +1 -1
  246. package/dist/runner/store-secrets.d.ts +3 -3
  247. package/dist/runner/store-secrets.js +8 -12
  248. package/dist/runner/text-tools.d.ts +44 -0
  249. package/dist/runner/text-tools.js +237 -0
  250. package/dist/runner/workflow-loop.d.ts +6 -0
  251. package/dist/runner/workflow-loop.js +6 -4
  252. package/dist/runner/workflow-spec.d.ts +18 -0
  253. package/dist/runner/workflow-spec.js +68 -26
  254. package/dist/runs-over-store.d.ts +8 -3
  255. package/dist/runs-over-store.js +76 -19
  256. package/dist/seal-key.d.ts +54 -15
  257. package/dist/seal-key.js +232 -82
  258. package/dist/sealed-settings-store.d.ts +19 -4
  259. package/dist/sealed-settings-store.js +9 -9
  260. package/dist/sealing.d.ts +4 -0
  261. package/dist/sealing.js +20 -0
  262. package/dist/secret-cut.d.ts +1 -1
  263. package/dist/secret-cut.js +1 -1
  264. package/dist/secret-name.d.ts +9 -0
  265. package/dist/secret-name.js +15 -0
  266. package/dist/secret-writes.d.ts +0 -1
  267. package/dist/secret-writes.js +0 -1
  268. package/dist/secrets.d.ts +2 -10
  269. package/dist/secrets.js +21 -17
  270. package/dist/server-fs.d.ts +4 -0
  271. package/dist/server-fs.js +8 -2
  272. package/dist/server-lock.d.ts +0 -24
  273. package/dist/server-lock.js +1 -80
  274. package/dist/server-secrets-store.d.ts +4 -4
  275. package/dist/server-secrets-store.js +10 -32
  276. package/dist/server-secrets.d.ts +4 -9
  277. package/dist/server-secrets.js +12 -33
  278. package/dist/server.d.ts +26 -44
  279. package/dist/server.js +229 -142
  280. package/dist/sign-ins-store.d.ts +34 -36
  281. package/dist/sign-ins-store.js +27 -38
  282. package/dist/sign-ins.d.ts +2 -119
  283. package/dist/sign-ins.js +5 -311
  284. package/dist/standard-webhooks.d.ts +1 -1
  285. package/dist/standard-webhooks.js +1 -1
  286. package/dist/stats.d.ts +3 -2
  287. package/dist/stats.js +1 -1
  288. package/dist/store/agent-body.d.ts +8 -2
  289. package/dist/store/agent-body.js +16 -4
  290. package/dist/store/index.d.ts +3 -3
  291. package/dist/store/index.js +3 -3
  292. package/dist/store/open.d.ts +18 -5
  293. package/dist/store/open.js +23 -3
  294. package/dist/store/postgres/connection.d.ts +18 -2
  295. package/dist/store/postgres/connection.js +156 -32
  296. package/dist/store/postgres/migrate.d.ts +4 -0
  297. package/dist/store/postgres/migrate.js +27 -3
  298. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  299. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  300. package/dist/store/postgres/store.d.ts +9 -2
  301. package/dist/store/postgres/store.js +9 -0
  302. package/dist/store/schema.js +1 -1
  303. package/dist/store/seal.js +2 -2
  304. package/dist/store/sqlite/connection.js +49 -5
  305. package/dist/store/sqlite/run-patch.d.ts +3 -0
  306. package/dist/store/sqlite/run-patch.js +3 -0
  307. package/dist/store/sqlite/store.js +64 -20
  308. package/dist/store/store.d.ts +38 -6
  309. package/dist/store/store.js +12 -2
  310. package/dist/store-reads/cap.d.ts +1 -1
  311. package/dist/store-reads/cap.js +22 -4
  312. package/dist/store-reads/journal.d.ts +25 -6
  313. package/dist/store-reads/journal.js +173 -21
  314. package/dist/store-reads/learning.d.ts +26 -8
  315. package/dist/store-reads/learning.js +12 -4
  316. package/dist/store-reads/workflow.d.ts +1 -1
  317. package/dist/store-reads/workflow.js +1 -1
  318. package/dist/store-view.d.ts +5 -1
  319. package/dist/store-view.js +91 -23
  320. package/dist/template-eval.d.ts +60 -4
  321. package/dist/template-eval.js +120 -54
  322. package/dist/templates.d.ts +24 -10
  323. package/dist/templates.js +69 -38
  324. package/dist/timeline/group.d.ts +33 -0
  325. package/dist/timeline/group.js +77 -0
  326. package/dist/timeline/index.d.ts +7 -0
  327. package/dist/timeline/index.js +7 -0
  328. package/dist/timeline/labels.d.ts +79 -0
  329. package/dist/timeline/labels.js +150 -0
  330. package/dist/timeline/origin.d.ts +56 -0
  331. package/dist/timeline/origin.js +92 -0
  332. package/dist/timeline/render-text.d.ts +11 -0
  333. package/dist/timeline/render-text.js +62 -0
  334. package/dist/timeline/timeline.d.ts +274 -0
  335. package/dist/timeline/timeline.js +1308 -0
  336. package/dist/timeline/util.d.ts +17 -0
  337. package/dist/timeline/util.js +49 -0
  338. package/dist/tool-gate.d.ts +41 -216
  339. package/dist/tool-gate.js +79 -540
  340. package/dist/tool-keys-store.d.ts +11 -12
  341. package/dist/tool-keys-store.js +24 -31
  342. package/dist/tool-keys.d.ts +9 -104
  343. package/dist/tool-keys.js +15 -271
  344. package/dist/tool-plane.d.ts +14 -42
  345. package/dist/tool-plane.js +23 -81
  346. package/dist/tool-settings-store.d.ts +1 -2
  347. package/dist/tool-settings-store.js +5 -8
  348. package/dist/tools.d.ts +31 -19
  349. package/dist/tools.js +101 -108
  350. package/dist/trigger-adapter.d.ts +2 -2
  351. package/dist/trigger-schedule.js +2 -1
  352. package/dist/trigger-secrets-shown.js +5 -1
  353. package/dist/trigger-targets.d.ts +13 -1
  354. package/dist/trigger-targets.js +31 -1
  355. package/dist/triggers.d.ts +2 -2
  356. package/dist/triggers.js +3 -3
  357. package/dist/turn-end.d.ts +1 -1
  358. package/dist/turn-end.js +1 -1
  359. package/dist/turns.d.ts +0 -6
  360. package/dist/turns.js +0 -19
  361. package/dist/uploads.js +1 -1
  362. package/dist/usage.d.ts +0 -2
  363. package/dist/usage.js +0 -2
  364. package/dist/validate.d.ts +2 -0
  365. package/dist/validate.js +23 -14
  366. package/dist/webhooks.d.ts +102 -76
  367. package/dist/webhooks.js +266 -233
  368. package/dist/workflow-run.d.ts +114 -0
  369. package/dist/workflow-run.js +144 -0
  370. package/dist/workspace/beneath.d.ts +19 -0
  371. package/dist/workspace/beneath.js +106 -0
  372. package/dist/workspace/computer-deps.d.ts +52 -5
  373. package/dist/workspace/computer-deps.js +154 -19
  374. package/dist/workspace/computer-for-claim.d.ts +19 -14
  375. package/dist/workspace/computer-for-claim.js +77 -16
  376. package/dist/workspace/computer-hold.d.ts +6 -1
  377. package/dist/workspace/computer-hold.js +6 -1
  378. package/dist/workspace/computer-janitor.d.ts +47 -0
  379. package/dist/workspace/computer-janitor.js +182 -0
  380. package/dist/workspace/computer-providers.d.ts +6 -2
  381. package/dist/workspace/computer-providers.js +1 -1
  382. package/dist/workspace/grep-worker.d.ts +5 -0
  383. package/dist/workspace/grep-worker.js +9 -6
  384. package/dist/workspace/index.d.ts +4 -3
  385. package/dist/workspace/index.js +4 -4
  386. package/dist/workspace/local.d.ts +11 -2
  387. package/dist/workspace/local.js +161 -43
  388. package/dist/workspace/resolve-computer.d.ts +50 -10
  389. package/dist/workspace/resolve-computer.js +46 -11
  390. package/dist/workspace/run-tools.d.ts +13 -31
  391. package/dist/workspace/run-tools.js +10 -27
  392. package/dist/workspace-paths.d.ts +0 -17
  393. package/dist/workspace-paths.js +1 -41
  394. package/dist/workspace.d.ts +0 -17
  395. package/dist/workspace.js +3 -99
  396. package/launcher/agentrun-serve +6 -33
  397. package/package.json +14 -14
  398. package/templates/README.md +9 -3
  399. package/templates/inbound-lead/agent.md +1 -1
  400. package/templates/kyb/agent.md +1 -1
  401. package/templates/market-monitor/agent.md +2 -2
  402. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  403. package/dist/app.d.ts +0 -5
  404. package/dist/app.js +0 -514
  405. package/dist/bound-files.d.ts +0 -4
  406. package/dist/bound-files.js +0 -164
  407. package/dist/bounds.d.ts +0 -26
  408. package/dist/bounds.js +0 -137
  409. package/dist/coding-tools.d.ts +0 -47
  410. package/dist/coding-tools.js +0 -189
  411. package/dist/computer-adb.d.ts +0 -12
  412. package/dist/computer-adb.js +0 -14
  413. package/dist/console/assets/index-35-7aeIZ.js +0 -519
  414. package/dist/console/assets/index-Cejbov-Y.css +0 -1
  415. package/dist/content-filter.d.ts +0 -7
  416. package/dist/content-filter.js +0 -23
  417. package/dist/disk.d.ts +0 -33
  418. package/dist/disk.js +0 -85
  419. package/dist/door-line.d.ts +0 -23
  420. package/dist/door-line.js +0 -83
  421. package/dist/grade.d.ts +0 -63
  422. package/dist/grade.js +0 -150
  423. package/dist/harness-app.d.ts +0 -69
  424. package/dist/harness-app.js +0 -1162
  425. package/dist/mcp-servers.d.ts +0 -269
  426. package/dist/mcp-servers.js +0 -456
  427. package/dist/packs.d.ts +0 -71
  428. package/dist/packs.js +0 -180
  429. package/dist/request-start.d.ts +0 -27
  430. package/dist/request-start.js +0 -381
  431. package/dist/run-box.d.ts +0 -205
  432. package/dist/run-box.js +0 -661
  433. package/dist/run-holder.d.ts +0 -52
  434. package/dist/run-holder.js +0 -139
  435. package/dist/runs.d.ts +0 -1200
  436. package/dist/runs.js +0 -4103
  437. package/dist/sealed-settings.d.ts +0 -60
  438. package/dist/sealed-settings.js +0 -178
  439. package/dist/served-only.d.ts +0 -5
  440. package/dist/served-only.js +0 -12
  441. package/dist/sessions.d.ts +0 -6
  442. package/dist/sessions.js +0 -109
  443. package/dist/workspace/computer-serves.d.ts +0 -12
  444. 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(", ");
@@ -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,57 +177,35 @@ 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
210
  * claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it. */
307
211
  decide(name: string, args: unknown): Promise<"allow" | "ask" | {
@@ -319,6 +223,10 @@ export declare class RunGate {
319
223
  /** Why a pin refuses the call of `key` with `args` now (pinRefusal): the revision's own pins and the server's, read at
320
224
  * each call as its permission is, so a pin set or changed reaches a live run at its next call. */
321
225
  private pinned;
226
+ /** Why bash's policy refuses the call `name` (held to `key`) with `args` now, or undefined: the revision's own setting
227
+ * (an agent's tool_settings.bash.policy), so every shell tool under every harness's name for it is held to it. A policy
228
+ * this server does not know refuses every shell call (fail closed), as a pin that does not read does. */
229
+ private policyRefusal;
322
230
  private lastGood?;
323
231
  private readonly told;
324
232
  /** 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 +234,4 @@ export declare class RunGate {
326
234
  * while the read fails, as a deny may be in what did not read (undefined: none read yet, every tool asks). Each problem
327
235
  * is said once, by file and field, never a value. */
328
236
  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
237
  }
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;