@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
@@ -2,6 +2,7 @@ import type { InputIssue } from "./errors.js";
2
2
  import type { Settings } from "./store/index.js";
3
3
  import { type HarnessId } from "./harness.js";
4
4
  import { type Permission, type Pin } from "./tool-gate.js";
5
+ import { type BashPolicy } from "./bash-read-only.js";
5
6
  /**
6
7
  * The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
7
8
  * table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
@@ -9,7 +10,6 @@ import { type Permission, type Pin } from "./tool-gate.js";
9
10
  * never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
10
11
  */
11
12
  export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
12
- export type Capability = (typeof CAPABILITIES)[number];
13
13
  /** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
14
14
  * where there is one (never on claude-agent, where Claude's own search is picked as `native`), else Parallel where the
15
15
  * server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
@@ -37,9 +37,9 @@ export declare const permissionsOf: (name: string) => readonly Permission[];
37
37
  * give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
38
38
  * those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
39
39
  export declare const serverGate: (name: string, settings: ToolSettingsMap) => {
40
- permission: "deny" | "ask" | "allow";
41
- default_permission: "deny" | "ask" | "allow";
42
- permissions: ("deny" | "ask" | "allow")[];
40
+ permission: "deny" | "allow" | "ask";
41
+ default_permission: "deny" | "allow" | "ask";
42
+ permissions: ("deny" | "allow" | "ask")[];
43
43
  };
44
44
  /** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
45
45
  * workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
@@ -53,19 +53,13 @@ export declare const KIND_KEYS: readonly string[];
53
53
  export type ToolSetting = {
54
54
  provider?: string;
55
55
  permission?: Permission;
56
- pin?: Pin; /** Read as a stand-in for a value not offered (readToolSettings); never shown or written. */
56
+ pin?: Pin; /** bash's policy, an agent's own only (bash-read-only.ts). */
57
+ policy?: BashPolicy; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
57
58
  fallback?: true; /** The stand-in's value as written in the file, which a save that keeps the stand-in writes back (ToolSettings.put). Never shown. */
58
59
  raw?: unknown; /** A pin in the file that does not read (readToolSettings): the gate refuses every call of the tool, and a save keeps it (ToolSettings.put) until the owner sets a valid pin or removes the tool's setting. Served as `pin_broken: true`. */
59
60
  brokenPin?: true; /** The broken pin as written in the file, which a save that keeps it writes back. Never shown. */
60
61
  rawPin?: unknown;
61
62
  };
62
- /** Whether an agent's own settings (definition.tool_settings) keep a pin. Not yet: the agent store this server writes
63
- * today keeps a setting's values as names only, and refuses a pin; the store of the rewrite (store/, module A) keeps it
64
- * as given, and this is true from its cutover on. Until then a pin is set on the server (PUT /v2/settings/tools), which
65
- * the gate holds every run to; the gate reads an agent's pin wherever a revision carries one. */
66
- export declare const AGENT_LAYER_PINS: boolean;
67
- /** Why an agent's own pin is refused while AGENT_LAYER_PINS is false. */
68
- export declare const AGENT_PIN_LATER = "An agent's own pin is kept once this server's agent store takes it (the store cutover). Until then set the pin on this server, PUT /v2/settings/tools (Settings \u2192 Tools), which the tool gate holds every run to.";
69
63
  /** The longest pinned string. */
70
64
  export declare const MAX_PIN_TEXT = 1024;
71
65
  /** The one check of a pin, every place that takes one calls it (the server's settings, an agent's, a template's mcp
@@ -215,7 +209,7 @@ export declare const handsParallel: (plane: Plane) => boolean;
215
209
  * table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
216
210
  * has a choice and one offered for it, a permission one offered for the tool. */
217
211
  export declare function settingsIssues(value: unknown, at?: string, layer?: "server" | "agent"): InputIssue[];
218
- /** `map` as a revision body keeps it: each tool's provider, permission and pin as written (never a stand-in's internal
212
+ /** `map` as a revision body keeps it: each tool's provider, permission, pin and policy as written (never a stand-in's internal
219
213
  * marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
220
214
  * revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
221
215
  * where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
@@ -225,12 +219,9 @@ export declare const withDefaults: (map: ToolSettingsMap) => ToolSettingsMap & R
225
219
  provider: string;
226
220
  permission?: Permission;
227
221
  }>;
228
- /** The tool settings in `dir` as the server and the tool gate read them, failing closed: each entry that reads is kept;
229
- * one that does not is dropped, but a known tool keeps what of it reads, and its permission, when not one offered,
230
- * reads ask (deny where ask is not offered), never its allow default. `problems`: one line for each entry dropped or
231
- * changed, naming the file and the field, never a value. `unreadable`: the file as a whole does not read (none, a
232
- * missing file is every default). */
233
- export declare function readToolSettings(dir: string): {
222
+ /** The server's tool settings as read (checkToolSettings, loadToolSettings): the map, a line for each problem, and whether
223
+ * the stored value as a whole does not read. */
224
+ export type ToolSettingsRead = {
234
225
  settings: ToolSettingsMap;
235
226
  problems: string[];
236
227
  unreadable?: true;
@@ -246,18 +237,14 @@ export declare function checkToolSettings(read: unknown, where: string): {
246
237
  };
247
238
  /** The key the server's tool settings live under in the one store (store.settings). */
248
239
  export declare const TOOL_SETTINGS_KEY = "tool-settings";
249
- /** The server's tool settings read from the one store (store.settings), failing closed as readToolSettings does: no row
250
- * is every default. The store-backed replacement for `new ToolSettings(dir)` + get(); the cut wires it. */
240
+ /** The server's tool settings read from the one store (store.settings), failing closed (checkToolSettings): no row is
241
+ * every default. */
251
242
  export declare function loadToolSettings(store: {
252
243
  settings: Pick<Settings, "get">;
253
- }): Promise<{
254
- settings: ToolSettingsMap;
255
- problems: string[];
256
- unreadable?: true;
257
- }>;
244
+ }): Promise<ToolSettingsRead>;
258
245
  /** A save of the server's tool settings: `map` (a tool it leaves out takes its defaults) over the settings read before it
259
246
  * (`current`), as kept (the marks within) and as written (the raw values, which a read turns back into those marks).
260
- * The one rule both writers keep (ToolSettings.put to the file, saveToolSettings to the store), so they cannot drift:
247
+ * The rule saveToolSettings keeps:
261
248
  * - a pin is kept as given, as a pin is a gate fence (tool-gate.ts pinRefusal);
262
249
  * - a broken pin (one that did not read) is kept by every save that keeps the tool's key and sets no pin of its own (a
263
250
  * console's whole map sends the key back, marked pin_broken): only a valid pin, or the key left out, clears it, so an
@@ -269,38 +256,22 @@ export declare function keptSettings(map: ToolSettingsMap, current: ToolSettings
269
256
  kept: ToolSettingsMap;
270
257
  written: Record<string, Record<string, unknown>>;
271
258
  };
272
- /** Replaces the server's tool settings in the one store, as ToolSettings.put does to the file, by the same rule
273
- * (keptSettings): a tool `map` leaves out takes its defaults, a pin is kept, a broken pin is kept until a valid one or the
274
- * key left out clears it, and a stand-in sent back unchanged stays a stand-in. Answers the settings as served (the marks
275
- * within). The store-backed replacement for ToolSettings.put; the cut wires it. */
259
+ /** Replaces the server's tool settings in the one store, by keptSettings's rule: a tool `map` leaves out takes its
260
+ * defaults, a pin is kept, a broken pin is kept until a valid one or the key left out clears it, and a stand-in sent
261
+ * back unchanged stays a stand-in. Answers the settings as served (the marks within). */
276
262
  export declare function saveToolSettings(store: {
277
263
  settings: Pick<Settings, "get" | "put">;
278
264
  }, map: ToolSettingsMap): Promise<ToolSettingsMap>;
279
- export declare class ToolSettings {
280
- private readonly dir;
281
- static readonly FILE = "tool-settings.json";
282
- private current;
283
- /** The file was present but did not read at the start: every tool takes its defaults until a PUT replaces it. */
284
- private unread;
285
- constructor(dir: string, warn?: (line: string) => void);
286
- /** The settings now. While the file does not read, the map carries SETTINGS_UNREAD (tool-gate.ts), so wherever it goes
287
- * (the gate's permission, the plane's providers, an agent's tools, a save's blockers) approvals "never" lifts no ask
288
- * over a deny the file may hold, as the gate itself fails closed. */
289
- get(): ToolSettingsMap;
290
- /** Replaces the settings: a tool `map` leaves out takes its defaults; pins, broken pins and stand-ins by the one rule
291
- * the store's save keeps too (keptSettings). Durable before it returns. */
292
- put(map: ToolSettingsMap): ToolSettingsMap;
293
- }
294
265
  /** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
295
266
  * permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
296
267
  * applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
297
268
  * provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
298
269
  * it resolves to on the agent's harness and model. */
299
270
  export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[]): ({
300
- permission: "deny" | "ask" | "allow";
271
+ permission: "deny" | "allow" | "ask";
301
272
  permission_from: import("./refusal-words.js").SettingFrom;
302
- default_permission: "deny" | "ask" | "allow";
303
- permissions: ("deny" | "ask" | "allow")[];
273
+ default_permission: "deny" | "allow" | "ask";
274
+ permissions: ("deny" | "allow" | "ask")[];
304
275
  blurb?: string | undefined;
305
276
  name: string;
306
277
  } | {
@@ -308,10 +279,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
308
279
  provider_from: string;
309
280
  default_provider: string;
310
281
  resolved: Resolution;
311
- permission: "deny" | "ask" | "allow";
282
+ permission: "deny" | "allow" | "ask";
312
283
  permission_from: import("./refusal-words.js").SettingFrom;
313
- default_permission: "deny" | "ask" | "allow";
314
- permissions: ("deny" | "ask" | "allow")[];
284
+ default_permission: "deny" | "allow" | "ask";
285
+ permissions: ("deny" | "allow" | "ask")[];
315
286
  blurb?: string | undefined;
316
287
  name: string;
317
288
  })[];
@@ -20,18 +20,15 @@
20
20
  // told a deny: its Plane resolves a denied capability as under ask, and the gate, which reads the permission at each
21
21
  // call, is the one place that refuses it, so a deny lifted mid-run is lifted at the next call.
22
22
  import { blurbOf } from "./tool-blurbs.js";
23
- import { readFileSync } from "node:fs";
24
- import { isToolSettingsKey } from "@parcha/pi-durable-agent";
25
- import { join } from "node:path";
26
23
  import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
27
24
  import { keyNeeded } from "./key-words.js";
28
- import { writeDurableSync } from "./server-fs.js";
29
25
  import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
30
26
  import { builtinHarness, harnessOf } from "./harness-table.js";
31
27
  import { viaOpenRouter, WIRES } from "./provider.js";
32
28
  import { savedIn } from "./secrets.js";
33
29
  import { hostModel } from "./model.js";
34
30
  import { canonicalPin, defaultPermission, isCatalogTool, isMcpTool, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS, permissionFrom, permissionOf, SETTINGS_UNREAD, SHELL_FAMILY } from "./tool-gate.js";
31
+ import { BASH_POLICIES } from "./bash-read-only.js";
35
32
  /**
36
33
  * The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
37
34
  * table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
@@ -71,14 +68,11 @@ export const KIND_KEYS = ["desktop", "phone"];
71
68
  /** A settings key: a tool of the table, one of the run's own tools (SERVE_OWN_TOOLS), a computer kind's (KIND_KEYS), a
72
69
  * catalog tool (`monid.<tool>`, `mcp:<server>/<tool>`), or an MCP server's wildcard (`mcp:<server>/*`), which sets each
73
70
  * of its tools. */
71
+ /** A tool's name in an agent's or the server's tool settings: a plain name, a catalog's tool (`monid.discover`), an MCP
72
+ * server's tool (`mcp:<server>/<tool>`) or its wildcard (`mcp:<server>/*`). */
73
+ const TOOL_KEY = /^(?:[a-z][a-z0-9_-]{0,63}(?:\.[A-Za-z0-9_-]{1,64})?|mcp:[A-Za-z0-9_.-]{1,64}\/(?:\*|[A-Za-z0-9_.-]{1,128}))$/;
74
+ const isToolSettingsKey = (name) => TOOL_KEY.test(name);
74
75
  const isSettingsKey = (name) => isToolSettingsKey(name) && (TABLE_TOOLS.includes(name) || SERVE_OWN_TOOLS.includes(name) || KIND_KEYS.includes(name) || isCatalogTool(name) || /^mcp:[^/]+\/\*$/.test(name));
75
- /** Whether an agent's own settings (definition.tool_settings) keep a pin. Not yet: the agent store this server writes
76
- * today keeps a setting's values as names only, and refuses a pin; the store of the rewrite (store/, module A) keeps it
77
- * as given, and this is true from its cutover on. Until then a pin is set on the server (PUT /v2/settings/tools), which
78
- * the gate holds every run to; the gate reads an agent's pin wherever a revision carries one. */
79
- export const AGENT_LAYER_PINS = true;
80
- /** Why an agent's own pin is refused while AGENT_LAYER_PINS is false. */
81
- export const AGENT_PIN_LATER = "An agent's own pin is kept once this server's agent store takes it (the store cutover). Until then set the pin on this server, PUT /v2/settings/tools (Settings → Tools), which the tool gate holds every run to.";
82
76
  /** The longest pinned string. */
83
77
  export const MAX_PIN_TEXT = 1024;
84
78
  /** A pinned argument's name: a top-level argument of the tool, as MCP tools name theirs. */
@@ -357,10 +351,16 @@ export function settingsIssues(value, at = "", layer = "server") {
357
351
  if (!isSettingsKey(name))
358
352
  return [{ field: field(name), reason: "not_allowed", message: `Tool settings are kept for this server's tools (${[...TABLE_TOOLS, ...SERVE_OWN_TOOLS, ...KIND_KEYS].join(", ")}), catalog tools (monid.<tool>, mcp:<server>/<tool>) and an MCP server's tools (mcp:<server>/*); ${name} is none of them.` }];
359
353
  if (!isPlain(setting))
360
- return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpTool(name) ? ", pin" : ""}}` }];
354
+ return [{ field: field(name), reason: "wrong_type", message: `${field(name)} is an object, {${pickable ? "provider, " : ""}permission${isMcpTool(name) ? ", pin" : ""}${layer === "agent" && name === "bash" ? ", policy" : ""}}` }];
361
355
  return Object.entries(setting).flatMap(([key, given]) => {
362
356
  if (key === "pin")
363
357
  return pinIssues(given, field(name, key), name);
358
+ // bash's policy (bash-read-only.ts): an agent's own, on bash's key only, as what its commands may do is the agent's.
359
+ if (key === "policy") {
360
+ if (layer !== "agent" || name !== "bash")
361
+ return [{ field: field(name, key), reason: "not_allowed", message: `A policy is set on bash in an agent's own tool settings (definition.tool_settings.bash.policy), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
362
+ return BASH_POLICIES.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${BASH_POLICIES.join(", ")}: read-only refuses, before it runs, any command that could write, run code or read outside the run's folder` }];
363
+ }
364
364
  // The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
365
365
  // sends back: it keeps the broken pin, and nothing else. Never an agent's.
366
366
  if (key === "pin_broken") {
@@ -380,7 +380,7 @@ export function settingsIssues(value, at = "", layer = "server") {
380
380
  });
381
381
  });
382
382
  }
383
- /** `map` as a revision body keeps it: each tool's provider, permission and pin as written (never a stand-in's internal
383
+ /** `map` as a revision body keeps it: each tool's provider, permission, pin and policy as written (never a stand-in's internal
384
384
  * marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
385
385
  * revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
386
386
  * where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
@@ -389,7 +389,7 @@ export function canonicalToolSettings(map) {
389
389
  return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
390
390
  if (!setting)
391
391
  return [];
392
- const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
392
+ const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
393
393
  return Object.keys(kept).length ? [[name, kept]] : [];
394
394
  })));
395
395
  }
@@ -399,31 +399,9 @@ export const withDefaults = (map) => ({
399
399
  ...Object.fromEntries(Object.entries(map).map(([name, setting]) => [name, setting && { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : {}), ...(setting.brokenPin ? { pin_broken: true } : {}) }])),
400
400
  ...Object.fromEntries(PICKABLE.map((name) => [name, { provider: map[name]?.provider ?? PROVIDERS[name][0], ...(map[name]?.permission ? { permission: map[name].permission } : {}) }])),
401
401
  });
402
- /** The server's tool settings, beside the agent store in its data directory: not a secret, and not in store.sqlite,
403
- * which runs hold open. Read once at the start, written whole and durably (0600) at each PUT; a missing file is every
404
- * default, and so is one it cannot read, which it says in one line. */
405
- /** An empty settings map marked as standing for a file that does not read (SETTINGS_UNREAD, tool-gate.ts): every caller of
406
- * readToolSettings inherits the mark, a direct read too (learning's draft check, the learned-draft tools), so none lifts an
407
- * ask over a file whose deny it cannot see. */
402
+ /** An empty settings map marked as standing for settings that do not read (SETTINGS_UNREAD, tool-gate.ts): every reader
403
+ * inherits the mark, so none lifts an ask over settings whose deny it cannot see. */
408
404
  const unreadMap = () => Object.assign({}, { [SETTINGS_UNREAD]: true });
409
- /** The tool settings in `dir` as the server and the tool gate read them, failing closed: each entry that reads is kept;
410
- * one that does not is dropped, but a known tool keeps what of it reads, and its permission, when not one offered,
411
- * reads ask (deny where ask is not offered), never its allow default. `problems`: one line for each entry dropped or
412
- * changed, naming the file and the field, never a value. `unreadable`: the file as a whole does not read (none, a
413
- * missing file is every default). */
414
- export function readToolSettings(dir) {
415
- const file = join(dir, ToolSettings.FILE);
416
- let read;
417
- try {
418
- read = JSON.parse(readFileSync(file, "utf8"));
419
- }
420
- catch (error) {
421
- if (error.code === "ENOENT")
422
- return { settings: {}, problems: [] };
423
- return { settings: unreadMap(), problems: [`${file} does not read as JSON`], unreadable: true };
424
- }
425
- return checkToolSettings(read, file);
426
- }
427
405
  /** A parsed tool-settings object (from the file, or the store), checked and failed closed: each entry that reads is kept;
428
406
  * one that does not is dropped, but a known tool keeps what of it reads, and its permission, when not one offered, reads
429
407
  * ask (deny where ask is not offered), never its allow default. `where` names the source in each problem line (the file's
@@ -472,15 +450,14 @@ export function checkToolSettings(read, where) {
472
450
  }
473
451
  /** The key the server's tool settings live under in the one store (store.settings). */
474
452
  export const TOOL_SETTINGS_KEY = "tool-settings";
475
- /** The server's tool settings read from the one store (store.settings), failing closed as readToolSettings does: no row
476
- * is every default. The store-backed replacement for `new ToolSettings(dir)` + get(); the cut wires it. */
453
+ /** The server's tool settings read from the one store (store.settings), failing closed (checkToolSettings): no row is
454
+ * every default. */
477
455
  export async function loadToolSettings(store) {
478
456
  const read = await store.settings.get(TOOL_SETTINGS_KEY);
479
457
  if (read === undefined)
480
458
  return { settings: {}, problems: [] };
481
459
  const checked = checkToolSettings(read, "the stored tool settings");
482
- // A stored row that does not read carries SETTINGS_UNREAD (tool-gate.ts), as ToolSettings.get does for the file: wherever
483
- // these settings go (the plane's providers, an agent's tools, a save's blockers) approvals "never" lifts no ask over a
460
+ // A stored row that does not read carries SETTINGS_UNREAD (tool-gate.ts): wherever these settings go (the plane's providers, an agent's tools, a save's blockers) approvals "never" lifts no ask over a
484
461
  // deny the row may hold. A save over it (saveToolSettings) writes a row that reads.
485
462
  if (checked.unreadable)
486
463
  checked.settings[SETTINGS_UNREAD] = true;
@@ -488,7 +465,7 @@ export async function loadToolSettings(store) {
488
465
  }
489
466
  /** A save of the server's tool settings: `map` (a tool it leaves out takes its defaults) over the settings read before it
490
467
  * (`current`), as kept (the marks within) and as written (the raw values, which a read turns back into those marks).
491
- * The one rule both writers keep (ToolSettings.put to the file, saveToolSettings to the store), so they cannot drift:
468
+ * The rule saveToolSettings keeps:
492
469
  * - a pin is kept as given, as a pin is a gate fence (tool-gate.ts pinRefusal);
493
470
  * - a broken pin (one that did not read) is kept by every save that keeps the tool's key and sets no pin of its own (a
494
471
  * console's whole map sends the key back, marked pin_broken): only a valid pin, or the key left out, clears it, so an
@@ -509,50 +486,15 @@ export function keptSettings(map, current) {
509
486
  const written = Object.fromEntries(Object.entries(kept).map(([name, setting]) => [name, { ...(setting.provider ? { provider: setting.provider } : {}), ...(setting.fallback ? { permission: setting.raw } : setting.permission ? { permission: setting.permission } : {}), ...(setting.pin ? { pin: setting.pin } : setting.brokenPin ? { pin: setting.rawPin } : {}) }]));
510
487
  return { kept, written };
511
488
  }
512
- /** Replaces the server's tool settings in the one store, as ToolSettings.put does to the file, by the same rule
513
- * (keptSettings): a tool `map` leaves out takes its defaults, a pin is kept, a broken pin is kept until a valid one or the
514
- * key left out clears it, and a stand-in sent back unchanged stays a stand-in. Answers the settings as served (the marks
515
- * within). The store-backed replacement for ToolSettings.put; the cut wires it. */
489
+ /** Replaces the server's tool settings in the one store, by keptSettings's rule: a tool `map` leaves out takes its
490
+ * defaults, a pin is kept, a broken pin is kept until a valid one or the key left out clears it, and a stand-in sent
491
+ * back unchanged stays a stand-in. Answers the settings as served (the marks within). */
516
492
  export async function saveToolSettings(store, map) {
517
493
  const { settings: current } = await loadToolSettings(store);
518
494
  const { kept, written } = keptSettings(map, current);
519
495
  await store.settings.put(TOOL_SETTINGS_KEY, written);
520
496
  return structuredClone(kept);
521
497
  }
522
- export class ToolSettings {
523
- dir;
524
- static FILE = "tool-settings.json";
525
- current;
526
- /** The file was present but did not read at the start: every tool takes its defaults until a PUT replaces it. */
527
- unread;
528
- constructor(dir, warn = (line) => void process.stderr.write(`${line}\n`)) {
529
- this.dir = dir;
530
- const { settings, problems, unreadable } = readToolSettings(dir);
531
- for (const line of problems)
532
- warn(`agentrun-serve: ${line}; ${unreadable ? "every tool takes its defaults" : "that entry is dropped (a permission that is not offered reads ask)"} until a PUT /v2/settings/tools`);
533
- this.current = settings;
534
- this.unread = unreadable === true;
535
- }
536
- /** The settings now. While the file does not read, the map carries SETTINGS_UNREAD (tool-gate.ts), so wherever it goes
537
- * (the gate's permission, the plane's providers, an agent's tools, a save's blockers) approvals "never" lifts no ask
538
- * over a deny the file may hold, as the gate itself fails closed. */
539
- get() {
540
- const map = structuredClone(this.current);
541
- if (this.unread)
542
- map[SETTINGS_UNREAD] = true;
543
- return map;
544
- }
545
- /** Replaces the settings: a tool `map` leaves out takes its defaults; pins, broken pins and stand-ins by the one rule
546
- * the store's save keeps too (keptSettings). Durable before it returns. */
547
- put(map) {
548
- const { kept, written } = keptSettings(map, this.current);
549
- writeDurableSync(join(this.dir, ToolSettings.FILE), `${JSON.stringify(written)}\n`);
550
- this.current = kept;
551
- // The file is the one just written: it reads.
552
- this.unread = false;
553
- return this.get();
554
- }
555
- }
556
498
  /** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
557
499
  * permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
558
500
  * applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
@@ -25,6 +25,5 @@ declare class ToolSettingsOverStore {
25
25
  put(map: ToolSettingsMap): Promise<ToolSettingsMap>;
26
26
  }
27
27
  export type { ToolSettingsOverStore };
28
- /** The ToolSettings surface over the one store: the switch swaps `new ToolSettings(dir)` for this, then awaits load() once
29
- * at start before the first get(). */
28
+ /** The server's tool settings over the one store: the server awaits load() once at start, before the first get(). */
30
29
  export declare function toolSettingsOverStore(store: ToolSettingsStore, warn?: (line: string) => void): ToolSettingsOverStore;
@@ -1,9 +1,7 @@
1
- // The server's tool settings over the one store (store.settings), the store-backed replacement for the ToolSettings class
2
- // (tool-plane.ts) that read and wrote tool-settings.json. It keeps the same surface the server calls: a synchronous get()
3
- // off an in-memory snapshot the server (the one writer of this row) loads once at start and keeps in step with every
4
- // put(), and a put() that returns the settings as served. put() returns a promise the handler awaits (durable before the
5
- // 204, as writeDurableSync was). The read and write go through loadToolSettings / saveToolSettings; this layer is
6
- // only the snapshot and the sync surface the switch swaps `new ToolSettings(dir)` for.
1
+ // The server's tool settings over the one store (store.settings): a synchronous get() off an in-memory snapshot the server
2
+ // (the one writer of this row) loads once at start and keeps in step with every put(), and a put() that returns the
3
+ // settings as served, durable before the handler's answer. The read and write go through loadToolSettings /
4
+ // saveToolSettings; this layer is only the snapshot and the sync surface.
7
5
  import { SETTINGS_UNREAD } from "./tool-gate.js";
8
6
  import { loadToolSettings, saveToolSettings } from "./tool-plane.js";
9
7
  class ToolSettingsOverStore {
@@ -46,8 +44,7 @@ class ToolSettingsOverStore {
46
44
  return this.get();
47
45
  }
48
46
  }
49
- /** The ToolSettings surface over the one store: the switch swaps `new ToolSettings(dir)` for this, then awaits load() once
50
- * at start before the first get(). */
47
+ /** The server's tool settings over the one store: the server awaits load() once at start, before the first get(). */
51
48
  export function toolSettingsOverStore(store, warn = (line) => void process.stderr.write(`${line}\n`)) {
52
49
  return new ToolSettingsOverStore(store, warn);
53
50
  }
package/dist/tools.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import type { TSchema } from "typebox";
2
2
  import { type Extension, type Harness, type ToolRegistration, type Tx } from "@earendil-works/pi-durable";
3
- import type { AppContext } from "@parcha/pi-durable-disk";
4
- import type { Revision } from "@parcha/pi-durable-agent";
5
- import type { CodingSource } from "./coding-tools.js";
3
+ import type { Revision } from "./agent-rows.js";
6
4
  import { type Workspace } from "./workspace/index.js";
5
+ import type { ClaimBrowser } from "./workspace/resolve-computer.js";
7
6
  import { type Complete } from "./llm.js";
8
7
  import { type Ledger, type PaidBooking } from "./paid-calls.js";
9
8
  import type { Refusal } from "@parcha/agentrun-kernel";
9
+ import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
10
10
  import { type Plane, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
11
11
  import type { DenyFrom, SettingFrom } from "./tool-gate.js";
12
12
  import type { LiveHandover, LiveViewerStore } from "./browser-live.js";
@@ -23,13 +23,19 @@ export declare const FAUX_VENDOR_API_ENV = "AGENTRUN_SERVE_FAUX_VENDOR_API";
23
23
  /** What the result of `ask_person` says; the person's page shows the question as a waiting row. */
24
24
  export declare const asked: (question: string) => string;
25
25
  export declare const askPerson: ToolRegistration<TSchema, import("@earendil-works/chord").JsonValue>;
26
+ /** Where a run's tools are bound: the run, by its id, its folder and the folder its tools work in. */
27
+ export type RunWhere = {
28
+ readonly ref: {
29
+ readonly id: string;
30
+ };
31
+ readonly root: string;
32
+ readonly work: string;
33
+ };
26
34
  /** What a tool's binding gets from the run's process. */
27
35
  export type ToolHost = {
28
- where: AppContext;
36
+ where: RunWhere;
29
37
  /** The run's environment: the server's, without the server's token. */
30
38
  env: NodeJS.ProcessEnv;
31
- /** The run's coding tools, by its place (coding-tools.ts codingSource). */
32
- coding: CodingSource;
33
39
  /** Installs an extension in the run's registry, before the run opens. */
34
40
  install(extension: Extension): void;
35
41
  /** Runs in the commit that creates each of the run's conversations. */
@@ -52,16 +58,12 @@ export type ToolHost = {
52
58
  * takes (adapter-loop AdapterRun.rowSummaryOn): a hand-over's wait sets the row's waiting summary in its waiting
53
59
  * entry's commit, and its answer's commit clears it, so the server tells run.needs_input for a run held in its claim. */
54
60
  rowSummaryOn?(kind: string, test: (data: Record<string, unknown>) => boolean, summary: string | null): void;
55
- /** The run is on the runner: its browser hand-over's answers are entries of its journal (a browser_hand_back row the
56
- * runner applies, the live view's hand-back, the ask's expiry), read and written there, never as answer files
57
- * (browser-person.ts personHands `answered`). */
58
- handoverInJournal?: boolean;
59
61
  /** The run is on the runner: its live viewers are handed over through the store, not through files in its directory
60
62
  * (browser-live.ts putLiveViewer/dropLiveViewer). The browser tool's live-viewer writers hang off this: `put` hands a
61
63
  * session's viewer over (its token sealed under the run's `sealKey`), `drop` takes one (or all of the run's) back. The
62
64
  * three fields below are what builds these (the one store, the claim the row is written under, the seal key); a tool's
63
- * binding reads `liveViewers`, never them directly. Absent on the server path, where the viewer lives in the run's
64
- * directory (browser-live.ts sessionHandovers: writeHandover/dropHandover). */
65
+ * binding reads `liveViewers`, never them directly. Absent, no viewer is handed over (browser-live.ts
66
+ * sessionHandovers), and nothing is written in the run's folder. */
65
67
  liveViewers?: {
66
68
  put(handover: LiveHandover): Promise<boolean>;
67
69
  drop(tag?: string): Promise<void>;
@@ -77,11 +79,13 @@ export type ToolHost = {
77
79
  /** The run's ledger, as the adapter loop hands it (spendcap-1's AdapterRun.ledger): `paid`, the claim's one-ledger
78
80
  * booking (the kernel cap's paidCalls, paid-calls.ts PaidBooking), and `pause`, how a refusal at the cap parks the run.
79
81
  * The browser passes `paid` to browserSpend, so its calls are held and settled there and a session's release is booked
80
- * there, never on this process's own spend. The runner installs the browser only with `paid` and the grant, on pi's
81
- * native route (adapter-run-spec.ts browserListed). */
82
+ * there, never on this process's own spend; `flush`, the runner's store flush, puts a session's open record on disk
83
+ * before the vendor is asked. The runner installs the browser only with `paid` and the grant, on pi's native route
84
+ * (adapter-run-spec.ts browserListed). */
82
85
  ledger?: {
83
86
  paid: PaidBooking;
84
87
  pause?: (refusal: Refusal) => Promise<void>;
88
+ flush: () => Promise<void>;
85
89
  };
86
90
  /** The run's one redactor (the runner's: every secret value the runner and the claim hold, in every form): what the
87
91
  * browser's answers pass through before pi stores them or the model reads them. Absent on the old per-run process. */
@@ -90,6 +94,9 @@ export type ToolHost = {
90
94
  * where a tool files what the run's read finds later (monid's whole answer past the model's cut). Absent, the local
91
95
  * folder at `where.work`. */
92
96
  workspace?: Workspace;
97
+ /** The agent's computer, where it is a browser (computer-for-claim.ts): the browser tool opens its sessions through the
98
+ * claim's provider and drives each over its CDP URL with pi-browser's raw-CDP driver, in place of the plane's vendor. */
99
+ browserComputer?: ClaimBrowser;
93
100
  };
94
101
  /** What a name stands for in the run: the pi tools it offers, and the extensions a conversation selects for them. */
95
102
  export type ToolBinding = {
@@ -146,6 +153,18 @@ export declare const evidenceIn: (work: Workspace) => {
146
153
  bodyLine?: undefined;
147
154
  }>;
148
155
  };
156
+ /** What browser_upload may choose: a file of the run's Workspace, the one its read opens, by a path relative to it. The
157
+ * Workspace refuses a path that would leave it (absolute, "..", a link anywhere on the way), so nothing outside the run's
158
+ * folder is ever read; a file must be a regular one of at most `maxBytes`. `mime` names its media type by its name. */
159
+ export declare const uploadsFrom: (work: Workspace, maxBytes: number, mime: (name: string) => string) => {
160
+ resolve(rel: string): Promise<{
161
+ bytes: Uint8Array;
162
+ name: string;
163
+ mime: string;
164
+ } | {
165
+ refused: string;
166
+ }>;
167
+ };
149
168
  /** The Browserbase contexts a run's browser may open: its agent's saved sign-in's alone, by its profile name, never one
150
169
  * made here (nothing a run makes is kept for its agent). */
151
170
  export declare const keptContexts: (ref: string | undefined) => {
@@ -187,7 +206,7 @@ export declare const savedOnRelease: (row: {
187
206
  /** On the runner, the per-session hook that verifies the run's saved sign-in: a session that saved to it (savedOnRelease,
188
207
  * in a run handed it to save) verifies it under the run's claim, at the session's own end (its time, else now), as the
189
208
  * saved mark main reads at the lease's end. Answers whether it verified (sign-ins-store.ts verifyRunSignIn). */
190
- export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer | undefined, claim: Claim, kept: RunSignIn) => (row: {
209
+ export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer, claim: Claim, kept: RunSignIn) => (row: {
191
210
  session: {
192
211
  resourceId: string | null;
193
212
  releaseReason: string | null;
@@ -202,17 +221,35 @@ export declare const CALL_TOOLS: readonly string[];
202
221
  /** Whether `name` is one of `allowed`. */
203
222
  export declare const allows: (allowed: readonly string[], name: string) => boolean;
204
223
  /** The tools a run's learned workflow may name (learn/check.ts at learn time, learned-workflow.ts at a call): those of the
205
- * agent's `granted` tools a workflow's call node runs here (CALL_TOOLS), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
224
+ * agent's `granted` tools a workflow's call node runs here (CALL_TOOLS, and each MCP tool granted by its own name,
225
+ * skills.ts LEARNED_MCP_TOOL: a wildcard is read against its server's listing first, mcpGrantsListed), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
206
226
  * learned model node runs without tools (learn/skills.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
207
227
  * exec_command, apply_patch) is never one, so the DSL refuses a draft that names it. */
208
- export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane) => string[];
228
+ export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane, options?: LearnedMcp) => string[];
229
+ /** `mcp: true` at learn time (the end-of-run step's draft tools, a person's write): an MCP tool the revision grants by its
230
+ * own name may be named. Without it (the runtime's read at a call, learned-workflow.ts), none is: the run's MCP tools are
231
+ * its pin's, which the runtime reads apart and holds to the gate itself (#2424). `approvers`: whether anyone can answer
232
+ * an ask here (server-approvers.ts). Only then is an MCP tool set to ask offered: with no one, #2424 refuses the
233
+ * learned call's ask at once, so offering it would only teach a workflow that never runs. Not said: no one. */
234
+ export type LearnedMcp = {
235
+ readonly mcp?: boolean;
236
+ readonly approvers?: boolean;
237
+ };
238
+ /** `granted` with each MCP server's wildcard (`mcp:<server>/*`) read as the tools its server lists now (`listed`, by the
239
+ * server's name: none for a server not saved), each `mcp:<server>/<tool>`, in place; every other name as it is, each
240
+ * once. What a revision grants under a wildcard is every tool of its server, so a learned draft may name each one
241
+ * (learnedWorkflowTools), its gate holding it as any tool (learnedDraftTools: the wildcard's setting, or the tool's own).
242
+ * At proposal time there is no run and no pin: whether the run's pin has the tool is the runtime's to check at the call,
243
+ * in the gate's words (learned-workflow.ts). */
244
+ export declare function mcpGrantsListed(granted: readonly string[], listed: (server: string) => readonly string[]): string[];
209
245
  /** The tools a learned draft may name (learnedWorkflowTools) that the gate allows: `permission` is what the gate holds a
210
246
  * tool to now (tool-gate.ts permissionOf, or the run's gate's policy), by its settings key. One set to ask or deny is left out of `tools`, so the end-of-run prompt never offers it, and named
211
247
  * in `gated` with its setting, which the checker and a learned workflow's check before it runs refuse a draft for. */
212
- export declare const learnedDraftTools: (granted: readonly string[], permission: (name: string) => string, plane?: Plane, from?: (name: string) => SettingFrom) => {
248
+ export declare const learnedDraftTools: (granted: readonly string[], permission: (name: string) => string, plane?: Plane, from?: (name: string) => SettingFrom, options?: LearnedMcp) => {
213
249
  tools: string[];
214
250
  gated: Record<string, string>;
215
251
  deniedBy: Record<string, DenyFrom>;
252
+ asked: string[];
216
253
  };
217
254
  /** The tools a workflow names (`nodes` from workflowNodes): on its model nodes (`tools`), and on its `call` nodes
218
255
  * `via: "tool"` (`tool`). */
@@ -229,6 +266,10 @@ export declare function grantedTools(revision: {
229
266
  }): Promise<string[]>;
230
267
  /** The table's entry for `name`, or undefined for a name it does not hold. */
231
268
  export declare const toolOf: (name: string) => ToolEntry | undefined;
269
+ /** The sandbox-only tools a run whose shell is `shell` has (resolve-computer.ts shellPlaceOf): every one in a computer
270
+ * that mounts its folder, bash alone on Mode 2's Archil exec ("local"), none with no shell. The kernel registry's
271
+ * hostToolDefs says which, the one list the run's tools are bound from. The save check asks it for "local" alone. */
272
+ export declare const shellTools: (shell: ShellPlace) => ReadonlySet<string>;
232
273
  /** What a stored revision's tools resolve from (tool-plane.ts): the tools it grants, its harness, model and settings. */
233
274
  export declare function toolingOf(revision: Revision): Promise<Tooling>;
234
275
  /** The variables `entry` needs that `env` does not set, by name. */
@@ -246,19 +287,20 @@ export declare function toolRefusal(names: readonly string[], env: NodeJS.Proces
246
287
  * sets none), the default, and what it resolves to on each harness under the server's `settings`: available where any
247
288
  * is not unavailable, and missing PARALLEL_API_KEY where Parallel is picked without it. An unavailable tool says why
248
289
  * (`reason`). `noBox`: why no box can run a sandbox-only tool here (place.ts noBoxReason), which leaves it
249
- * unavailable with that reason; undefined, a box can. `refused`: the variables of the keys this server was started with
250
- * that their provider refused at the start (ToolKeys.refused), each with why: a tool that needs one is unavailable,
290
+ * unavailable with that reason; undefined, a box can. `runnerShell`: the sandbox-only tools a run on the runner has a
291
+ * shell for here (shellTools: bash on Archil's exec in Mode 2), which need no box. `refused`: the variables of the keys this server was started with
292
+ * that their provider refused at the start (tool-keys-store.ts refused), each with why: a tool that needs one is unavailable,
251
293
  * saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
252
294
  * and the permissions it may be set to. */
253
- export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>) => {
254
- providers?: ("auto" | "native" | "parallel" | "browserbase" | "kernel" | "off" | "exa-keyless" | "chrome")[] | undefined;
295
+ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>, runnerShell?: ReadonlySet<string>) => {
296
+ providers?: ("auto" | "native" | "parallel" | "off" | "kernel" | "browserbase" | "exa-keyless" | "chrome")[] | undefined;
255
297
  provider?: string | undefined;
256
298
  default_provider?: "auto" | "kernel" | undefined;
257
299
  resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent", import("./tool-plane.js").Resolution> | undefined;
258
300
  why?: Record<"opencode" | "codex" | "pi" | "claude-agent", string> | undefined;
259
- permission: "deny" | "ask" | "allow";
260
- default_permission: "deny" | "ask" | "allow";
261
- permissions: ("deny" | "ask" | "allow")[];
301
+ permission: "deny" | "allow" | "ask";
302
+ default_permission: "deny" | "allow" | "ask";
303
+ permissions: ("deny" | "allow" | "ask")[];
262
304
  harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
263
305
  missing?: string[] | undefined;
264
306
  reason?: string | undefined;