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

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 (522) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/README.md +417 -219
  3. package/dist/adapters.d.ts +12 -2
  4. package/dist/adapters.js +27 -2
  5. package/dist/agent-rows.d.ts +2 -1
  6. package/dist/agents-store.d.ts +2 -0
  7. package/dist/agents-store.js +9 -4
  8. package/dist/api-only.d.ts +2 -1
  9. package/dist/api-only.js +3 -1
  10. package/dist/archil-routes.d.ts +40 -7
  11. package/dist/archil-routes.js +167 -54
  12. package/dist/archil-settings.d.ts +79 -7
  13. package/dist/archil-settings.js +140 -14
  14. package/dist/attach-conformance-cli.d.ts +1 -0
  15. package/dist/attach-conformance-cli.js +18 -0
  16. package/dist/attach-conformance.d.ts +25 -0
  17. package/dist/attach-conformance.js +343 -0
  18. package/dist/attach-images.d.ts +15 -0
  19. package/dist/attach-images.js +59 -0
  20. package/dist/background.d.ts +0 -6
  21. package/dist/background.js +0 -28
  22. package/dist/box-image.d.ts +1 -97
  23. package/dist/box-image.js +4 -284
  24. package/dist/box-paths.d.ts +2 -7
  25. package/dist/box-paths.js +7 -13
  26. package/dist/box-settings.d.ts +0 -11
  27. package/dist/box-settings.js +4 -29
  28. package/dist/browser-commands.js +1 -1
  29. package/dist/browser-computer.d.ts +47 -3
  30. package/dist/browser-computer.js +286 -18
  31. package/dist/browser-cost.d.ts +1 -1
  32. package/dist/browser-live.d.ts +20 -8
  33. package/dist/browser-live.js +50 -27
  34. package/dist/browser-person.d.ts +19 -2
  35. package/dist/browser-person.js +55 -6
  36. package/dist/browser-wait-ended.d.ts +23 -0
  37. package/dist/browser-wait-ended.js +42 -0
  38. package/dist/cap.d.ts +12 -57
  39. package/dist/cap.js +20 -160
  40. package/dist/catalog.d.ts +1 -12
  41. package/dist/catalog.js +3 -33
  42. package/dist/cli.js +17 -26
  43. package/dist/composio-preset.d.ts +36 -0
  44. package/dist/composio-preset.js +179 -0
  45. package/dist/computer-attach.d.ts +125 -0
  46. package/dist/computer-attach.js +330 -0
  47. package/dist/computer-calls.d.ts +48 -0
  48. package/dist/computer-calls.js +126 -0
  49. package/dist/computer-channel.d.ts +57 -0
  50. package/dist/computer-channel.js +115 -0
  51. package/dist/computer-commands.d.ts +1 -1
  52. package/dist/computer-held-routes.d.ts +35 -0
  53. package/dist/computer-held-routes.js +106 -0
  54. package/dist/computer-held.d.ts +48 -0
  55. package/dist/computer-held.js +87 -0
  56. package/dist/computer-keys.d.ts +21 -1
  57. package/dist/computer-keys.js +53 -11
  58. package/dist/computer-live.d.ts +160 -0
  59. package/dist/computer-live.js +643 -0
  60. package/dist/computer-routes.d.ts +1 -4
  61. package/dist/computer-routes.js +3 -5
  62. package/dist/computer-setting.d.ts +2 -0
  63. package/dist/computer-setting.js +38 -1
  64. package/dist/computer-view.d.ts +24 -2
  65. package/dist/computer-view.js +51 -3
  66. package/dist/computer-viewer.d.ts +6 -0
  67. package/dist/computer-viewer.js +297 -0
  68. package/dist/computers.d.ts +79 -12
  69. package/dist/computers.js +147 -28
  70. package/dist/console/assets/index-Cn6JX1uH.js +563 -0
  71. package/dist/console/assets/index-DRN62V5v.css +1 -0
  72. package/dist/console/index.html +2 -2
  73. package/dist/docker-daemon.d.ts +2 -2
  74. package/dist/docker-daemon.js +2 -2
  75. package/dist/errors.js +5 -5
  76. package/dist/faux-computers.d.ts +9 -20
  77. package/dist/faux-computers.js +56 -24
  78. package/dist/files.d.ts +1 -9
  79. package/dist/files.js +1 -9
  80. package/dist/github-connection.d.ts +10 -2
  81. package/dist/github-connection.js +65 -2
  82. package/dist/github-faux.js +1 -1
  83. package/dist/github.d.ts +22 -2
  84. package/dist/github.js +42 -8
  85. package/dist/gpu-words.d.ts +14 -0
  86. package/dist/gpu-words.js +21 -0
  87. package/dist/graph-view.d.ts +3 -1
  88. package/dist/graph-view.js +25 -1
  89. package/dist/handed-values.d.ts +1 -1
  90. package/dist/handed-values.js +1 -1
  91. package/dist/harness-install.d.ts +60 -3
  92. package/dist/harness-install.js +322 -34
  93. package/dist/harness.d.ts +1 -0
  94. package/dist/harness.js +36 -2
  95. package/dist/host-tools.d.ts +9 -10
  96. package/dist/host-tools.js +7 -7
  97. package/dist/hosted-search.d.ts +5 -4
  98. package/dist/hosted-search.js +2 -7
  99. package/dist/import-sources.d.ts +10 -0
  100. package/dist/import-sources.js +44 -2
  101. package/dist/import.d.ts +3 -3
  102. package/dist/import.js +37 -6
  103. package/dist/index.d.ts +1 -3
  104. package/dist/index.js +1 -2
  105. package/dist/key-refusal.d.ts +1 -1
  106. package/dist/key-refusal.js +2 -2
  107. package/dist/learn/check.d.ts +11 -2
  108. package/dist/learn/check.js +124 -6
  109. package/dist/learn/commit.d.ts +43 -7
  110. package/dist/learn/commit.js +166 -22
  111. package/dist/learn/folder.d.ts +11 -0
  112. package/dist/learn/folder.js +37 -1
  113. package/dist/learn/general.d.ts +66 -0
  114. package/dist/learn/general.js +73 -0
  115. package/dist/learn/grade.d.ts +22 -1
  116. package/dist/learn/grade.js +107 -16
  117. package/dist/learn/index.d.ts +1 -1
  118. package/dist/learn/index.js +1 -1
  119. package/dist/learn/learning.sh +12 -1
  120. package/dist/learn/notes.d.ts +3 -0
  121. package/dist/learn/notes.js +3 -0
  122. package/dist/learn/reflect.d.ts +14 -2
  123. package/dist/learn/reflect.js +54 -30
  124. package/dist/learn/skills.d.ts +37 -5
  125. package/dist/learn/skills.js +60 -7
  126. package/dist/learned-nodes.d.ts +6 -2
  127. package/dist/learned-workflow.d.ts +43 -9
  128. package/dist/learned-workflow.js +128 -37
  129. package/dist/learning-batch.d.ts +283 -0
  130. package/dist/learning-batch.js +574 -0
  131. package/dist/learning-cost.d.ts +79 -0
  132. package/dist/learning-cost.js +69 -0
  133. package/dist/learning-evals.d.ts +33 -0
  134. package/dist/learning-evals.js +98 -0
  135. package/dist/learning-routes.d.ts +32 -4
  136. package/dist/learning-routes.js +48 -12
  137. package/dist/learning-words.d.ts +9 -0
  138. package/dist/learning-words.js +12 -2
  139. package/dist/learning.d.ts +39 -19
  140. package/dist/learning.js +88 -46
  141. package/dist/live/stream.js +6 -3
  142. package/dist/live/translate.d.ts +4 -3
  143. package/dist/live/translate.js +8 -4
  144. package/dist/live-reach.d.ts +37 -0
  145. package/dist/live-reach.js +62 -0
  146. package/dist/mcp-gateway.d.ts +9 -0
  147. package/dist/mcp-gateway.js +60 -11
  148. package/dist/mcp-oauth.d.ts +57 -7
  149. package/dist/mcp-oauth.js +133 -18
  150. package/dist/mcp-private-hosts.d.ts +4 -4
  151. package/dist/mcp-private-hosts.js +20 -12
  152. package/dist/mcp-probe.d.ts +27 -3
  153. package/dist/mcp-probe.js +106 -29
  154. package/dist/mcp-secret-writes.js +8 -0
  155. package/dist/mcp-servers-store.d.ts +38 -15
  156. package/dist/mcp-servers-store.js +120 -23
  157. package/dist/mcp-store.d.ts +10 -4
  158. package/dist/mcp-store.js +17 -6
  159. package/dist/model-form.d.ts +26 -0
  160. package/dist/model-form.js +80 -0
  161. package/dist/model.d.ts +5 -5
  162. package/dist/model.js +29 -16
  163. package/dist/openapi.d.ts +2 -0
  164. package/dist/openapi.js +586 -64
  165. package/dist/owner.d.ts +0 -1
  166. package/dist/owner.js +0 -2
  167. package/dist/page.d.ts +18 -0
  168. package/dist/page.js +48 -20
  169. package/dist/paid-calls.d.ts +1 -1
  170. package/dist/paid-calls.js +1 -1
  171. package/dist/place-offers.d.ts +96 -0
  172. package/dist/place-offers.js +202 -0
  173. package/dist/place.d.ts +9 -13
  174. package/dist/place.js +21 -32
  175. package/dist/port-models.d.ts +2 -1
  176. package/dist/port-models.js +5 -3
  177. package/dist/print.d.ts +16 -9
  178. package/dist/print.js +15 -17
  179. package/dist/propose.d.ts +4 -0
  180. package/dist/propose.js +34 -11
  181. package/dist/provider.js +3 -2
  182. package/dist/reflect-range.d.ts +8 -1
  183. package/dist/reflect-range.js +1 -1
  184. package/dist/run-cut.d.ts +5 -0
  185. package/dist/run-cut.js +19 -0
  186. package/dist/run-launch.d.ts +28 -3
  187. package/dist/run-launch.js +14 -4
  188. package/dist/run-learning-served.d.ts +2 -2
  189. package/dist/run-manifest.d.ts +2 -2
  190. package/dist/run-manifest.js +2 -2
  191. package/dist/run-reads-over-store.d.ts +1 -1
  192. package/dist/run-repo.d.ts +20 -0
  193. package/dist/run-repo.js +63 -0
  194. package/dist/run-secrets.js +3 -3
  195. package/dist/run-timeline-served.d.ts +1 -1
  196. package/dist/run-timeline-served.js +56 -44
  197. package/dist/run-view.d.ts +8 -5
  198. package/dist/run-view.js +18 -10
  199. package/dist/runnable.d.ts +2 -2
  200. package/dist/runnable.js +6 -2
  201. package/dist/runner/adapter-loop.d.ts +39 -8
  202. package/dist/runner/adapter-loop.js +770 -83
  203. package/dist/runner/adapter-run-spec.d.ts +36 -7
  204. package/dist/runner/adapter-run-spec.js +171 -37
  205. package/dist/runner/adapters/pi-computer.d.ts +7 -0
  206. package/dist/runner/adapters/pi-computer.js +43 -0
  207. package/dist/runner/adapters/pi.d.ts +20 -7
  208. package/dist/runner/adapters/pi.js +111 -26
  209. package/dist/runner/beside.d.ts +7 -3
  210. package/dist/runner/beside.js +26 -12
  211. package/dist/runner/claim-secrets.d.ts +4 -0
  212. package/dist/runner/claim-secrets.js +6 -1
  213. package/dist/runner/cli-run-spec.d.ts +27 -3
  214. package/dist/runner/cli-run-spec.js +198 -74
  215. package/dist/runner/commands.d.ts +8 -2
  216. package/dist/runner/commands.js +31 -6
  217. package/dist/runner/computer-channel.d.ts +34 -0
  218. package/dist/runner/computer-channel.js +61 -0
  219. package/dist/runner/conformance/harness.d.ts +0 -1
  220. package/dist/runner/conformance/harness.js +87 -18
  221. package/dist/runner/conformance/subject.d.ts +1 -1
  222. package/dist/runner/dispatch.js +3 -0
  223. package/dist/runner/end-of-run.d.ts +22 -12
  224. package/dist/runner/end-of-run.js +38 -16
  225. package/dist/runner/github-app.d.ts +2 -1
  226. package/dist/runner/github-app.js +6 -4
  227. package/dist/runner/harness-loops.js +16 -2
  228. package/dist/runner/held-run.d.ts +65 -0
  229. package/dist/runner/held-run.js +158 -0
  230. package/dist/runner/journal-kinds.d.ts +35 -6
  231. package/dist/runner/journal-kinds.js +20 -1
  232. package/dist/runner/journal-reader.d.ts +5 -4
  233. package/dist/runner/journal-reader.js +12 -10
  234. package/dist/runner/learning-ask.d.ts +7 -1
  235. package/dist/runner/learning-ask.js +21 -6
  236. package/dist/runner/learning-dispatch.d.ts +22 -0
  237. package/dist/runner/learning-dispatch.js +77 -10
  238. package/dist/runner/learning-end.d.ts +37 -1
  239. package/dist/runner/learning-end.js +115 -14
  240. package/dist/runner/learning-factory.d.ts +1 -1
  241. package/dist/runner/learning-factory.js +15 -5
  242. package/dist/runner/learning-loop.d.ts +139 -7
  243. package/dist/runner/learning-loop.js +369 -32
  244. package/dist/runner/learning-seed.d.ts +9 -0
  245. package/dist/runner/learning-seed.js +14 -1
  246. package/dist/runner/live-ticker.js +1 -0
  247. package/dist/runner/loop-contract.d.ts +16 -1
  248. package/dist/runner/loop-contract.js +6 -0
  249. package/dist/runner/loop.d.ts +10 -2
  250. package/dist/runner/loop.js +22 -1
  251. package/dist/runner/main.d.ts +13 -1
  252. package/dist/runner/main.js +38 -6
  253. package/dist/runner/mcp-claim.d.ts +11 -4
  254. package/dist/runner/mcp-claim.js +140 -23
  255. package/dist/runner/mcp-github.d.ts +4 -2
  256. package/dist/runner/mcp-github.js +1 -8
  257. package/dist/runner/mcp-run.d.ts +6 -4
  258. package/dist/runner/mcp-run.js +16 -3
  259. package/dist/runner/metrics.d.ts +15 -2
  260. package/dist/runner/metrics.js +21 -2
  261. package/dist/runner/model-route.d.ts +3 -0
  262. package/dist/runner/model-route.js +5 -2
  263. package/dist/runner/pr-checkout.d.ts +60 -0
  264. package/dist/runner/pr-checkout.js +176 -0
  265. package/dist/runner/reflect-hook.d.ts +19 -0
  266. package/dist/runner/reflect-hook.js +20 -8
  267. package/dist/runner/runner.d.ts +26 -0
  268. package/dist/runner/runner.js +231 -27
  269. package/dist/runner/scratch-sweep.d.ts +13 -0
  270. package/dist/runner/scratch-sweep.js +62 -0
  271. package/dist/runner/sessions.d.ts +1 -1
  272. package/dist/runner/spec-holds.d.ts +8 -3
  273. package/dist/runner/spec-holds.js +12 -10
  274. package/dist/runner/store-port.d.ts +7 -2
  275. package/dist/runner/store-secrets.js +21 -4
  276. package/dist/runner/subagent.d.ts +44 -0
  277. package/dist/runner/subagent.js +190 -0
  278. package/dist/runner/workflow-host.d.ts +24 -3
  279. package/dist/runner/workflow-host.js +24 -4
  280. package/dist/runner/workflow-loop.d.ts +6 -3
  281. package/dist/runner/workflow-loop.js +9 -8
  282. package/dist/runner/workflow-spec.d.ts +39 -15
  283. package/dist/runner/workflow-spec.js +143 -40
  284. package/dist/runs-over-store.d.ts +16 -6
  285. package/dist/runs-over-store.js +145 -29
  286. package/dist/seal-key.js +3 -3
  287. package/dist/sealed-settings-store.d.ts +5 -2
  288. package/dist/sealed-settings-store.js +10 -4
  289. package/dist/sealing.js +1 -2
  290. package/dist/secret-cut.d.ts +1 -1
  291. package/dist/secret-cut.js +1 -1
  292. package/dist/secret-writes.d.ts +5 -4
  293. package/dist/secret-writes.js +5 -4
  294. package/dist/server-secrets-store.d.ts +4 -3
  295. package/dist/server-secrets-store.js +15 -9
  296. package/dist/server-secrets.js +3 -2
  297. package/dist/server.d.ts +75 -63
  298. package/dist/server.js +712 -316
  299. package/dist/settings-wake.d.ts +21 -0
  300. package/dist/settings-wake.js +59 -0
  301. package/dist/standard-webhooks.d.ts +4 -1
  302. package/dist/standard-webhooks.js +8 -4
  303. package/dist/store/agent-body.d.ts +9 -2
  304. package/dist/store/agent-body.js +16 -8
  305. package/dist/store/command-wake.d.ts +12 -0
  306. package/dist/store/command-wake.js +37 -0
  307. package/dist/store/deadline.js +9 -5
  308. package/dist/store/dialect.d.ts +6 -0
  309. package/dist/store/dialect.js +5 -0
  310. package/dist/store/index.d.ts +4 -4
  311. package/dist/store/index.js +2 -2
  312. package/dist/store/journal/storage.d.ts +3 -2
  313. package/dist/store/journal/storage.js +15 -6
  314. package/dist/store/postgres/connection.js +9 -4
  315. package/dist/store/postgres/dialect.js +4 -0
  316. package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
  317. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  318. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  319. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  320. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  321. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  322. package/dist/store/schema.d.ts +2 -1
  323. package/dist/store/schema.js +85 -13
  324. package/dist/store/seal.d.ts +13 -0
  325. package/dist/store/seal.js +19 -0
  326. package/dist/store/sqlite/connection.d.ts +5 -0
  327. package/dist/store/sqlite/connection.js +88 -47
  328. package/dist/store/sqlite/run-patch.d.ts +25 -7
  329. package/dist/store/sqlite/run-patch.js +58 -14
  330. package/dist/store/sqlite/store.js +331 -59
  331. package/dist/store/store.d.ts +330 -21
  332. package/dist/store/store.js +34 -2
  333. package/dist/store-reads/analytics.js +3 -2
  334. package/dist/store-reads/cap.d.ts +2 -4
  335. package/dist/store-reads/cap.js +16 -7
  336. package/dist/store-reads/decisions.d.ts +3 -3
  337. package/dist/store-reads/decisions.js +3 -6
  338. package/dist/store-reads/import-summary.d.ts +1 -1
  339. package/dist/store-reads/journal.d.ts +5 -4
  340. package/dist/store-reads/journal.js +118 -27
  341. package/dist/store-reads/learning.d.ts +34 -4
  342. package/dist/store-reads/learning.js +137 -23
  343. package/dist/store-reads/runs.d.ts +7 -5
  344. package/dist/store-reads/runs.js +17 -10
  345. package/dist/store-reads/stats.js +5 -1
  346. package/dist/store-reads/workflow.d.ts +1 -1
  347. package/dist/store-view.d.ts +5 -0
  348. package/dist/store-view.js +70 -29
  349. package/dist/template-eval.js +8 -5
  350. package/dist/template-github-permissions.d.ts +22 -8
  351. package/dist/template-github-permissions.js +35 -15
  352. package/dist/templates.d.ts +64 -0
  353. package/dist/templates.js +101 -16
  354. package/dist/timeline/timeline.d.ts +30 -1
  355. package/dist/timeline/timeline.js +29 -13
  356. package/dist/timeline/util.d.ts +4 -0
  357. package/dist/timeline/util.js +14 -0
  358. package/dist/tool-blurbs.js +1 -0
  359. package/dist/tool-budget.d.ts +27 -7
  360. package/dist/tool-budget.js +21 -9
  361. package/dist/tool-gate.d.ts +23 -10
  362. package/dist/tool-gate.js +60 -44
  363. package/dist/tool-plane.d.ts +46 -28
  364. package/dist/tool-plane.js +73 -31
  365. package/dist/tools.d.ts +31 -38
  366. package/dist/tools.js +117 -74
  367. package/dist/trigger-adapter.d.ts +4 -0
  368. package/dist/trigger-secrets-shown.d.ts +2 -2
  369. package/dist/trigger-secrets-shown.js +1 -1
  370. package/dist/trigger-signatures.d.ts +26 -6
  371. package/dist/trigger-signatures.js +44 -8
  372. package/dist/trigger-targets.d.ts +2 -0
  373. package/dist/trigger-targets.js +1 -0
  374. package/dist/trigger-webhook.js +5 -2
  375. package/dist/triggers.d.ts +10 -6
  376. package/dist/triggers.js +37 -7
  377. package/dist/turn-end.d.ts +0 -3
  378. package/dist/turn-end.js +0 -3
  379. package/dist/turns.js +16 -1
  380. package/dist/usage-lines.d.ts +1 -1
  381. package/dist/validate.d.ts +6 -0
  382. package/dist/validate.js +41 -4
  383. package/dist/web-fetch.d.ts +1 -1
  384. package/dist/web-search.d.ts +10 -5
  385. package/dist/web-search.js +7 -6
  386. package/dist/webhooks.d.ts +147 -103
  387. package/dist/webhooks.js +564 -324
  388. package/dist/workflow/decision-recovery.d.ts +23 -0
  389. package/dist/workflow/decision-recovery.js +80 -0
  390. package/dist/workflow/decisions.d.ts +134 -0
  391. package/dist/workflow/decisions.js +46 -0
  392. package/dist/workflow/host-session.d.ts +5 -0
  393. package/dist/workflow/host-session.js +85 -0
  394. package/dist/workflow/host-tools.d.ts +3 -0
  395. package/dist/workflow/host-tools.js +3 -0
  396. package/dist/workflow/node-runner.d.ts +113 -0
  397. package/dist/workflow/node-runner.js +270 -0
  398. package/dist/workflow/node.d.ts +89 -0
  399. package/dist/workflow/node.js +101 -0
  400. package/dist/workflow/operator-error.d.ts +4 -0
  401. package/dist/workflow/operator-error.js +4 -0
  402. package/dist/workflow/pi-versions.d.ts +32 -0
  403. package/dist/workflow/pi-versions.js +65 -0
  404. package/dist/workflow/record-file.d.ts +10 -0
  405. package/dist/workflow/record-file.js +56 -0
  406. package/dist/workflow/record-tool.d.ts +77 -0
  407. package/dist/workflow/record-tool.js +126 -0
  408. package/dist/workflow/record.d.ts +151 -0
  409. package/dist/workflow/record.js +401 -0
  410. package/dist/workflow/run-error.d.ts +16 -0
  411. package/dist/workflow/run-error.js +26 -0
  412. package/dist/workflow/runner.d.ts +6 -0
  413. package/dist/workflow/runner.js +240 -0
  414. package/dist/workflow/store.d.ts +23 -0
  415. package/dist/workflow/store.js +242 -0
  416. package/dist/workflow/task.d.ts +133 -0
  417. package/dist/workflow/task.js +412 -0
  418. package/dist/workflow/thinking.d.ts +3 -0
  419. package/dist/workflow/thinking.js +7 -0
  420. package/dist/workflow/tool-context.d.ts +21 -0
  421. package/dist/workflow/tool-context.js +13 -0
  422. package/dist/workflow/types.d.ts +126 -0
  423. package/dist/workflow/types.js +1 -0
  424. package/dist/workflow-run.d.ts +2 -2
  425. package/dist/workspace/agent-computer.d.ts +137 -0
  426. package/dist/workspace/agent-computer.js +292 -0
  427. package/dist/workspace/archil-claim.d.ts +11 -0
  428. package/dist/workspace/archil-claim.js +18 -10
  429. package/dist/workspace/archil-disks.d.ts +49 -0
  430. package/dist/workspace/archil-disks.js +185 -0
  431. package/dist/workspace/archil-exec.js +2 -3
  432. package/dist/workspace/archil-mount-credential.d.ts +20 -4
  433. package/dist/workspace/archil-mount-credential.js +13 -4
  434. package/dist/workspace/attached-computers.d.ts +41 -0
  435. package/dist/workspace/attached-computers.js +114 -0
  436. package/dist/workspace/computer-deps.d.ts +32 -17
  437. package/dist/workspace/computer-deps.js +37 -14
  438. package/dist/workspace/computer-for-claim.d.ts +58 -13
  439. package/dist/workspace/computer-for-claim.js +267 -26
  440. package/dist/workspace/computer-hold.d.ts +11 -27
  441. package/dist/workspace/computer-hold.js +36 -56
  442. package/dist/workspace/computer-janitor.d.ts +3 -2
  443. package/dist/workspace/computer-janitor.js +43 -9
  444. package/dist/workspace/computer-ledger.d.ts +5 -1
  445. package/dist/workspace/computer-ledger.js +11 -0
  446. package/dist/workspace/computer-mcp.d.ts +25 -0
  447. package/dist/workspace/computer-mcp.js +41 -0
  448. package/dist/workspace/computer-ports.d.ts +4 -13
  449. package/dist/workspace/computer-ports.js +4 -107
  450. package/dist/workspace/computer-script.d.ts +37 -0
  451. package/dist/workspace/computer-script.js +138 -0
  452. package/dist/workspace/executors.d.ts +1 -1
  453. package/dist/workspace/index.d.ts +7 -4
  454. package/dist/workspace/index.js +4 -1
  455. package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
  456. package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
  457. package/dist/workspace/resolve-computer.d.ts +45 -11
  458. package/dist/workspace/resolve-computer.js +72 -14
  459. package/dist/workspace/run-disk.d.ts +34 -0
  460. package/dist/workspace/run-disk.js +91 -0
  461. package/dist/workspace/run-tools.d.ts +35 -18
  462. package/dist/workspace/run-tools.js +24 -29
  463. package/dist/workspace/server-run-workspace.d.ts +3 -2
  464. package/dist/workspace/server-run-workspace.js +17 -4
  465. package/dist/workspace.js +1 -1
  466. package/package.json +19 -21
  467. package/templates/README.md +9 -6
  468. package/templates/code-review/agent.md +27 -11
  469. package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
  470. package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
  471. package/templates/code-review/evals/injection/graders/ignores.md +1 -1
  472. package/templates/code-review/evals/never-flag/case.yaml +3 -0
  473. package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
  474. package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
  475. package/templates/code-review/evals/never-flag/prompt.md +30 -0
  476. package/templates/code-review/evals/null-name/graders/finds.md +1 -1
  477. package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
  478. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
  479. package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
  480. package/templates/code-review/evals/re-review/prompt.md +1 -1
  481. package/templates/code-review/evals/re-review-open/case.yaml +3 -0
  482. package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
  483. package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
  484. package/templates/code-review/evals/re-review-open/prompt.md +27 -0
  485. package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
  486. package/templates/code-review/evals/two-defects/case.yaml +3 -0
  487. package/templates/code-review/evals/two-defects/graders/both.md +4 -0
  488. package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
  489. package/templates/code-review/evals/two-defects/prompt.md +25 -0
  490. package/templates/code-review/findings.schema.json +131 -27
  491. package/templates/code-review/rules/CODEREVIEW.md +76 -0
  492. package/templates/code-review/skills/review/DEEP.md +130 -0
  493. package/templates/code-review/skills/review/REVIEWER.md +116 -0
  494. package/templates/code-review/skills/review/SKILL.md +104 -154
  495. package/templates/market-monitor/agent.md +1 -1
  496. package/dist/box/record.d.ts +0 -6
  497. package/dist/box/record.js +0 -41
  498. package/dist/box/sweep.d.ts +0 -53
  499. package/dist/box/sweep.js +0 -193
  500. package/dist/box-egress-vm.d.ts +0 -118
  501. package/dist/box-egress-vm.js +0 -354
  502. package/dist/box-egress.d.ts +0 -105
  503. package/dist/box-egress.js +0 -256
  504. package/dist/box-relay-vm.d.ts +0 -84
  505. package/dist/box-relay-vm.js +0 -437
  506. package/dist/box-relay.d.ts +0 -36
  507. package/dist/box-relay.js +0 -207
  508. package/dist/boxes.d.ts +0 -109
  509. package/dist/boxes.js +0 -249
  510. package/dist/budget.d.ts +0 -71
  511. package/dist/budget.js +0 -199
  512. package/dist/console/assets/index-B7NKTU8E.css +0 -1
  513. package/dist/console/assets/index-CXZMgJE7.js +0 -550
  514. package/dist/daytona-api.d.ts +0 -10
  515. package/dist/daytona-api.js +0 -20
  516. package/dist/egress-proxy.d.ts +0 -45
  517. package/dist/egress-proxy.js +0 -416
  518. package/dist/egress-table.d.ts +0 -24
  519. package/dist/egress-table.js +0 -165
  520. package/dist/run-db.d.ts +0 -53
  521. package/dist/run-db.js +0 -116
  522. package/templates/code-review/rules/REVIEW.md +0 -41
@@ -1,5 +1,5 @@
1
1
  import { BROWSER_OPENERS, BROWSER_STEPS, callFailed, endsTurn, failedWith, inputPreview, labelOf, outcomeOf, refusedLabel, savedPaths } from "./labels.js";
2
- import { cut, firstLine, firstSentence, json, obj, scrubUrls, str, utf8Bytes } from "./util.js";
2
+ import { cut, firstLine, firstSentence, json, obj, saidSummary, scrubUrls, str, utf8Bytes } from "./util.js";
3
3
  import { BESIDE_SUFFIX, NOTE_SUFFIX, originMatcher, TRIGGER_LABELS } from "./origin.js";
4
4
  /** Grep's caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
5
5
  export const CAPS = { summary: 500, preview: 500, text: 2000, thinking: 100 };
@@ -24,15 +24,24 @@ export const REQUEST_REFUSED = "agentrun.request_refused";
24
24
  export const CALL_REFUSED = "agentrun.refused";
25
25
  /** Whether pi's error for a request is the model proxy's own refusal of it for the run's spend cap, before it was sent:
26
26
  * the proxy's JSON body after the HTTP status pi-ai puts first, read by its fields (`type` "agentrun_proxy", `code`
27
- * "spend_cap_reached", as the proxy writes them), never by its words. Any other error, a provider's 400 included, is not. */
27
+ * "spend_cap_reached", as the proxy writes them), never by its words. Any other error, a provider's 400 included, is not.
28
+ * pi-ai puts the status first in either of its clients' forms: the Responses client's "400 {...}" with the fields under
29
+ * `error`, or the Messages client's "<api> API error (400): {...}" with them at the top (the runner's pi route speaks
30
+ * Messages to the session's proxy). */
28
31
  function proxyCapRefusal(errorMessage) {
29
32
  if (typeof errorMessage !== "string")
30
33
  return false;
31
34
  const at = errorMessage.indexOf("{");
32
- if (at < 0 || !/^\d{3}\s*$/.test(errorMessage.slice(0, at)))
35
+ if (at < 0)
36
+ return false;
37
+ const head = errorMessage.slice(0, at);
38
+ // The provider's name is any word with no space (agentrun-session today; a route's own, such as openrouter/anthropic):
39
+ // the body's fields, never the name, say whose refusal it is.
40
+ if (!/^\d{3}\s*$/.test(head) && !/^\S+ API error \(\d{3}\):\s*$/.test(head))
33
41
  return false;
34
42
  try {
35
- const error = JSON.parse(errorMessage.slice(at))?.error;
43
+ const body = JSON.parse(errorMessage.slice(at));
44
+ const error = body?.error ?? body;
36
45
  return error?.type === "agentrun_proxy" && error.code === "spend_cap_reached";
37
46
  }
38
47
  catch {
@@ -548,12 +557,18 @@ function createProjector(options) {
548
557
  * the output as it came (`view`), as its status is; only the words the summary shows of that are redacted. */
549
558
  const resultRow = (conv, rowId, tool, named, view, shown, parent) => {
550
559
  const outcome = outcomeOf(tool.name, view);
560
+ // The words the summary shows of it, read from the whole output as redacted (`shown`), never from the output as it
561
+ // came: an outcome that takes the output apart (a learned workflow's lines, joined) could split a held value the
562
+ // whole text's redaction finds into pieces the summary's own redaction no longer would (#2452). Whether it failed
563
+ // is still read from the output as it came: one whose redacted output gives no words reads failed with no detail, never
564
+ // ok, and never the detail as it came.
565
+ const worded = shown.text === view.text ? outcome : outcomeOf(tool.name, { ...view, text: shown.text });
551
566
  // A call refused before it ran is named refused already (refusedLabel): its row says why, never that it failed.
552
567
  const failedSummary = refused(view) ? `${named}: ${failure(shown.text)}` : `${named} failed: ${failure(shown.text)}`;
553
568
  return make("tool_result", conv, rowId, {
554
- summary: !view.isError && pageChanged(tool.name, view) ? PAGE_CHANGED_ROW : view.isError ? failedSummary : outcome ? `${named}: ${saidOf(outcome.text)}` : `${named}: ok`, tool_name: tool.name, tool_use_id: tool.callId,
569
+ summary: !view.isError && pageChanged(tool.name, view) ? PAGE_CHANGED_ROW : view.isError ? failedSummary : worded ? `${named}: ${saidOf(worded.text)}` : outcome?.failed ? `${named}: failed` : `${named}: ok`, tool_name: tool.name, tool_use_id: tool.callId,
555
570
  tool_status: failedWith(view, outcome) ? "failed" : "success", tool_result_preview: shown.text ? cut(scrubUrls(shown.text), caps.preview) : null,
556
- tool_result_size_bytes: utf8Bytes(view.text), round: tool.round, parent_tool_use_id: parent,
571
+ tool_result_size_bytes: utf8Bytes(view.text), round: tool.round, parent_tool_use_id: parent, ...(refused(view) ? { refused: true } : {}),
557
572
  });
558
573
  };
559
574
  /** The call a browser charge belongs to (BROWSER_CHARGE): the one it names, else its session's last charged call, else
@@ -680,7 +695,7 @@ function createProjector(options) {
680
695
  // say. A message with no text block (a request the adapter bridge writes without content) shows none.
681
696
  // An answer its turn goes on from is a text_block (provisional, below), an empty one too.
682
697
  if (text || (final && first("text") >= 0)) {
683
- const row = make(final ? "final_answer" : "text_block", conv, `${base}:${first("text")}`, { summary: firstLine(text), text });
698
+ const row = make(final ? "final_answer" : "text_block", conv, `${base}:${first("text")}`, { summary: saidSummary(text), text });
684
699
  add(row);
685
700
  if (final) {
686
701
  const earlier = provisional.get(conv);
@@ -717,7 +732,7 @@ function createProjector(options) {
717
732
  const named = nameFor(name, args, before.view, before.shown);
718
733
  use.summary = clean(named, caps.summary);
719
734
  const fresh = resultRow(conv, before.row.id, { name, callId: id, round }, named, before.view, before.shown);
720
- Object.assign(before.row, { summary: fresh.summary, tool_name: fresh.tool_name, tool_status: fresh.tool_status, seq: (use.seq ?? 0) + 0.5, ...(round === undefined ? {} : { round }) });
735
+ Object.assign(before.row, { summary: fresh.summary, tool_name: fresh.tool_name, tool_status: fresh.tool_status, seq: (use.seq ?? 0) + 0.5, ...(round === undefined ? {} : { round }), ...(fresh.refused ? { refused: true } : {}) });
721
736
  rows.splice(rows.indexOf(before.row), 1);
722
737
  rows.splice(rows.indexOf(use) + 1, 0, before.row);
723
738
  touch(before.row);
@@ -753,7 +768,7 @@ function createProjector(options) {
753
768
  if (!view.isError) {
754
769
  const answer = str(args.answer);
755
770
  if (name === "submit" && answer !== undefined)
756
- add(make("final_answer", conv, `${base}:answer`, { summary: firstLine(answer), text: answer }));
771
+ add(make("final_answer", conv, `${base}:answer`, { summary: saidSummary(answer), text: answer }));
757
772
  if (name === "request_sign_in") {
758
773
  const reason = str(args.reason);
759
774
  add(make("waiting", conv, `${base}:waiting`, { summary: `Waiting for you: ${reason ? firstLine(reason) : "sign in on the live browser"}` }));
@@ -777,10 +792,11 @@ function createProjector(options) {
777
792
  systems.add(conv);
778
793
  }
779
794
  else if (entry.kind === "pi.reset") {
780
- add(make("phase", conv, base, { summary: "Context reset", text: textOf(message) || null }));
795
+ // The new context and a summary of the older one are words from the run: redacted by the host, before any cut.
796
+ add(make("phase", conv, base, { summary: "Context reset", text: redactText(textOf(message)) || null }));
781
797
  }
782
798
  else if (entry.kind === "pi.compaction") {
783
- add(make("phase", conv, base, { summary: "Summarized older context", text: textOf(message) || null }));
799
+ add(make("phase", conv, base, { summary: "Summarized older context", text: redactText(textOf(message)) || null }));
784
800
  }
785
801
  else if (entry.kind === HOST_PHASE) {
786
802
  // A step the host stamped (`at`, ms) shows at that time: written as it happened, it can sit after a message whose time
@@ -947,7 +963,7 @@ export function timelineOf(entries, options = {}) {
947
963
  if (options.settled)
948
964
  for (const [id, call] of projector.open())
949
965
  projector.interrupt(call, id);
950
- const usage = projector.usage();
966
+ const usage = projector.usage(options.turnCut === true);
951
967
  return usage ? [...projector.rows(), usage] : [...projector.rows()];
952
968
  }
953
969
  /** The id of the call a run's turn ended waiting on a person by, or undefined: its last meaningful row is a successful tool
@@ -1108,7 +1124,7 @@ export function timelineReducer(options = {}) {
1108
1124
  const shown = options.redactLive ? options.redactLive(raw) : fallback();
1109
1125
  // The agent's text streams as it will settle, its URLs whole; its thinking is scrubbed, as when it settles.
1110
1126
  const text = kind === "thinking" ? scrubUrls(shown) : shown;
1111
- const summary = kind === "thinking" ? `Thinking: ${cut(firstSentence(text), thinkingCap)}` : firstLine(text);
1127
+ const summary = kind === "thinking" ? `Thinking: ${cut(firstSentence(text), thinkingCap)}` : saidSummary(text);
1112
1128
  live(kind, `${conv()}:live:${kind}`, text ? summary : undefined, { text });
1113
1129
  }
1114
1130
  };
@@ -3,6 +3,10 @@ export declare const obj: (value: unknown) => Obj | undefined;
3
3
  export declare const str: (value: unknown) => string | undefined;
4
4
  export declare const cut: (text: string, max: number) => string;
5
5
  export declare const firstLine: (text: string) => string;
6
+ /** The summary of the agent's words (an answer, a text block): their first line; words that open with a fenced code block
7
+ * (a JSON answer's ```json … ```) the code inside the fence, up to its closing fence, each whitespace run one space, so
8
+ * the row previews the code itself, never the fence's label. The row's text keeps the words whole. */
9
+ export declare const saidSummary: (text: string) => string;
6
10
  export declare const firstSentence: (text: string) => string;
7
11
  export declare function utf8Bytes(text: string): number;
8
12
  export declare function json(text: string): Obj | undefined;
@@ -2,6 +2,20 @@ export const obj = (value) => typeof value === "object" && value !== null && !Ar
2
2
  export const str = (value) => (typeof value === "string" ? value : undefined);
3
3
  export const cut = (text, max) => (text.length > max ? `${text.slice(0, max - 3)}...` : text);
4
4
  export const firstLine = (text) => text.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
5
+ /** The summary of the agent's words (an answer, a text block): their first line; words that open with a fenced code block
6
+ * (a JSON answer's ```json … ```) the code inside the fence, up to its closing fence, each whitespace run one space, so
7
+ * the row previews the code itself, never the fence's label. The row's text keeps the words whole. */
8
+ export const saidSummary = (text) => {
9
+ // A fence's info string (its language) holds no backtick, so an inline ```code``` on one line is no fence.
10
+ const open = /^\s*(`{3,}|~{3,})[^\n`]*\n/.exec(text);
11
+ if (!open)
12
+ return firstLine(text);
13
+ const body = text.slice(open[0].length);
14
+ // Its closing fence (CommonMark): the same character, at least as many of it as the opening fence, alone on its line,
15
+ // indented at most 3 spaces (4 or a tab is code inside the fence, not its close).
16
+ const close = body.search(new RegExp(`^ {0,3}\\${open[1][0]}{${open[1].length},}[ \\t]*$`, "m"));
17
+ return (close >= 0 ? body.slice(0, close) : body).replace(/\s+/g, " ").trim() || firstLine(text);
18
+ };
5
19
  export const firstSentence = (text) => {
6
20
  const flat = text.replace(/\s+/g, " ").trim();
7
21
  return /^.*?[.!?](?=\s|$)/.exec(flat)?.[0] ?? flat;
@@ -19,6 +19,7 @@ export const TOOL_BLURBS = Object.freeze({
19
19
  "monid.discover": "Find paid data sources in monid's catalog",
20
20
  "monid.inspect": "Check a monid source's input and price",
21
21
  "monid.run": "Get paid data from a monid source",
22
+ subagent: "Run a task in a fresh helper conversation",
22
23
  pdf_pages: "Turn a PDF's pages into images",
23
24
  llm: "Ask the model once, with no tools",
24
25
  learned_workflow: "Run a workflow this agent learned",
@@ -1,4 +1,12 @@
1
1
  import { type EntryRecord } from "@earendil-works/pi-durable";
2
+ /** A conversation's own budget, narrower than the run's (a subagent call's `max_tool_calls`, runner/subagent.ts): written
3
+ * in the commit that makes the conversation, so a restart reads the same one, and held by the gate with the run's. */
4
+ export declare const ConversationToolBudget: import("@earendil-works/pi-durable").ConversationDocToken<{
5
+ toolCalls?: number;
6
+ }>;
7
+ /** The budget a conversation's calls are held to: the run's and its own, whichever is smaller (its own never widens the
8
+ * run's); absent, none. */
9
+ export declare const budgetOf: (run: number | undefined, own: number | undefined) => number | undefined;
2
10
  /** What a call past the budget reads: the same words every time, never a count the model could argue with. */
3
11
  export declare const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
4
12
  /** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
@@ -9,10 +17,22 @@ export declare function countCalls(entries: readonly EntryRecord[], callId: stri
9
17
  };
10
18
  /** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
11
19
  export declare const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
12
- /** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
13
- * never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
14
- * above it is room for each conversation still working to answer. */
15
- export declare const WRAP_UP_SHARE = 0.75;
16
- /** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
17
- * them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
18
- export declare const wrappingUp: (capUsd: number | undefined, takenUsd: number | null) => boolean;
20
+ /** A main-model request's figures as the cap prices them (kernel cap requestFigures): its answer at its least, its step-0
21
+ * typical cost, and its worst (its full asked output). */
22
+ export type RequestFigures = {
23
+ readonly leastUsd: number;
24
+ readonly step0Usd: number;
25
+ readonly worstUsd: number;
26
+ };
27
+ /** What a run keeps back of its cap so it can still answer: one typical step and one final answer at its least. The
28
+ * typical step is the run's own priced answers' typical cost (the wrap-up note's figure, kernel cap typicalCost; before
29
+ * any is priced, the step-0 cost of the request), the answer the cap's least for the main model's next request.
30
+ * Undefined when the request cannot be priced. The rule's one place: keeping back one final answer at its worst case
31
+ * instead would be `figures.worstUsd`, and a worst step and a least answer `figures.worstUsd + figures.leastUsd`. */
32
+ export declare const reserveFor: (figures: RequestFigures | undefined, typical: (step0Usd: number) => number) => number | undefined;
33
+ /** Whether a run under `capUsd` that has taken `takenUsd` wraps up. `takenUsd`: its spend and every step still out at its
34
+ * worst case, as the cap counts them (null: unknown). It wraps up once what it keeps back to answer (`reserveUsd`,
35
+ * reserveFor) no longer fits on top: in flight is reserved as it stands, so a fan-out keeps room for each conversation to
36
+ * answer, and a simple run uses its cap up to its last step and answer. No cap, a figure no one knows (the cap refuses
37
+ * the next request for that), or no reserve yet (no main-model request priced on this claim) is no. */
38
+ export declare const wrappingUp: (capUsd: number | undefined, takenUsd: number | null, reserveUsd: number | undefined) => boolean;
@@ -11,13 +11,20 @@
11
11
  // its first calls up to it and the rest are refused.
12
12
  //
13
13
  // The cap's wrap-up, the same refusal for money: a run with a cap whose spend, plus what its requests and paid steps
14
- // still out hold at their worst case, reaches WRAP_UP_SHARE of the cap has every model-issued tool call refused before
14
+ // still out hold at their worst case, leaves too little to keep back one typical step and one final answer (reserveFor)
15
+ // has every model-issued tool call refused before
15
16
  // its intent, in WRAP_UP_TEXT, on every harness and in every conversation of the run (a `subagent` spawn is a call too).
16
17
  // Nothing in flight is cut, and model requests are not touched: each conversation answers from what it has, under the
17
18
  // cap, which stays the last line. The figure is read from the run's committed booking records at each call (the cap's
18
19
  // own: a request still out counts at its hold and bound, one a lost claim cut the same), so a restart or a moved claim
19
20
  // reads the same figure, and a raise of the cap ends the wrap-up from its next call.
20
- import { AssistantEntry } from "@earendil-works/pi-durable";
21
+ import { AssistantEntry, defineDoc } from "@earendil-works/pi-durable";
22
+ /** A conversation's own budget, narrower than the run's (a subagent call's `max_tool_calls`, runner/subagent.ts): written
23
+ * in the commit that makes the conversation, so a restart reads the same one, and held by the gate with the run's. */
24
+ export const ConversationToolBudget = defineDoc({ kind: "agentrun.tool-budget", version: 1, scope: "conversation", history: "latest", fork: "current", initial: () => ({}), checkpointWhen: () => false });
25
+ /** The budget a conversation's calls are held to: the run's and its own, whichever is smaller (its own never widens the
26
+ * run's); absent, none. */
27
+ export const budgetOf = (run, own) => (run === undefined ? own : own === undefined ? run : Math.min(run, own));
21
28
  /** What a call past the budget reads: the same words every time, never a count the model could argue with. */
22
29
  export const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
23
30
  /** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
@@ -41,10 +48,15 @@ export function countCalls(entries, callId, upTo, count = 0) {
41
48
  }
42
49
  /** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
43
50
  export const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
44
- /** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
45
- * never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
46
- * above it is room for each conversation still working to answer. */
47
- export const WRAP_UP_SHARE = 0.75;
48
- /** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
49
- * them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
50
- export const wrappingUp = (capUsd, takenUsd) => capUsd !== undefined && takenUsd !== null && Number.isFinite(takenUsd) && takenUsd >= WRAP_UP_SHARE * capUsd;
51
+ /** What a run keeps back of its cap so it can still answer: one typical step and one final answer at its least. The
52
+ * typical step is the run's own priced answers' typical cost (the wrap-up note's figure, kernel cap typicalCost; before
53
+ * any is priced, the step-0 cost of the request), the answer the cap's least for the main model's next request.
54
+ * Undefined when the request cannot be priced. The rule's one place: keeping back one final answer at its worst case
55
+ * instead would be `figures.worstUsd`, and a worst step and a least answer `figures.worstUsd + figures.leastUsd`. */
56
+ export const reserveFor = (figures, typical) => figures === undefined ? undefined : typical(figures.step0Usd) + figures.leastUsd;
57
+ /** Whether a run under `capUsd` that has taken `takenUsd` wraps up. `takenUsd`: its spend and every step still out at its
58
+ * worst case, as the cap counts them (null: unknown). It wraps up once what it keeps back to answer (`reserveUsd`,
59
+ * reserveFor) no longer fits on top: in flight is reserved as it stands, so a fan-out keeps room for each conversation to
60
+ * answer, and a simple run uses its cap up to its last step and answer. No cap, a figure no one knows (the cap refuses
61
+ * the next request for that), or no reserve yet (no main-model request priced on this claim) is no. */
62
+ export const wrappingUp = (capUsd, takenUsd, reserveUsd) => capUsd !== undefined && takenUsd !== null && reserveUsd !== undefined && Number.isFinite(takenUsd) && Number.isFinite(reserveUsd) && takenUsd + reserveUsd > capUsd;
@@ -9,6 +9,10 @@ export type Permission = (typeof PERMISSIONS)[number];
9
9
  export declare const mcpToolName: (server: string, tool: string) => string;
10
10
  /** Whether `name` is an MCP tool's gate name. */
11
11
  export declare const isMcpTool: (name: string) => boolean;
12
+ /** The MCP servers a revision grants tools of, by their catalog names (`mcp:<server>/<tool>`, a server's wildcard too), each
13
+ * once: what a harness that names a session's MCP tool its own way (its facts' toolAlias: OpenCode's `<server>_<tool>`) is
14
+ * matched against, so its call is held to that tool's settings and never to a table tool's of the same shape. */
15
+ export declare const mcpServersOf: (granted: readonly string[]) => string[];
12
16
  /** A third-party catalog tool, by its name: monid's (`monid.<tool>`) or an MCP server's (`mcp:<server>/<tool>`). */
13
17
  export declare const isCatalogTool: (name: string) => boolean;
14
18
  /** Where a run's shell is, as its default permissions read it: `computer` false for a run with no computer (its bash, where
@@ -35,15 +39,17 @@ export declare const SHELL_WATCHERS: ReadonlySet<string>;
35
39
  /** The settings keys that may set `name`'s permission, most specific first: the tool's own name, then, for an MCP
36
40
  * tool, its server's wildcard `mcp:<server>/*`. */
37
41
  export declare function permissionKeys(name: string): string[];
38
- /** The settings key a call named `name` on `harness` is held to: the one mapping from every name a call reaches the gate
39
- * by. A settings key is itself (a table tool, `monid.<tool>`, `mcp:<server>/<tool>`); a CLI's own tool is the table's it
40
- * is; an MCP alias, `mcp__<server>__<tool>` (claude-agent's host tools `mcp__hands__<wire name>`, mapped as their
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
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
43
- * `mcpServers` (the run's configured MCP servers), never by its shape, since a host tool's name has the same shape.
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). */
46
- export declare function settingsKeyOf(harness: string, name: string, mcpServers?: readonly string[]): string | undefined;
42
+ /** A session's `{name -> settings key}` map (nameMapOf). */
43
+ export type NameMap = ReadonlyMap<string, string>;
44
+ /** Every name a session on `harness` (with MCP servers `mcpServers`) gives its tools, to the settings key each is held to:
45
+ * the shell family (bash's), table, own and decision tools, read_skill_file (`read`, unless the harness's alias makes it a
46
+ * configured server's tool), the kinds' tools (a shared one by its first kind), nativeTools, the browser's registrations;
47
+ * each also as claude-agent's `mcp__hands__<name>`. The first named wins. */
48
+ export declare function nameMapOf(harness: string, mcpServers?: readonly string[]): NameMap;
49
+ /** The settings key a call named `name` on `harness` is held to: a lookup in the session's names (`names`), then the open
50
+ * families no list holds (`monid.<tool>`, `mcp:<server>/<tool>`, `mcp__<server>__<tool>`, `monid_<kind>`, and a harness's
51
+ * own `<server>_<tool>` for a server of `mcpServers` only). Undefined: nothing maps it, and the gate asks. */
52
+ export declare function settingsKeyOf(harness: string, name: string, mcpServers?: readonly string[], names?: NameMap): string | undefined;
47
53
  /** A pinned argument's scalar: `null` holds for a call that leaves the argument out (or gives null). */
48
54
  export type PinScalar = string | number | boolean | null;
49
55
  /** A pinned argument's value: one scalar the call must carry, or a list of 1 to MAX_PIN_CHOICES ("one of"), kept and
@@ -161,15 +167,20 @@ export declare const RESUME_PREFIX = "[tool approval] ";
161
167
  * runs.ts) cut again at 300 characters, and the words that say it is not the person's. The one source of it: the resume
162
168
  * writes it, and the Timeline strips exactly it from the row a person opens (runs.ts resumeShows). */
163
169
  export declare function resumeHead(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string): string;
170
+ /** The last line of a CLI's resume message (one, after every call it answers): the message arrives as a new turn, and a
171
+ * model that reads only results there answers about the approval, not the person's request (Claude Code, live). */
172
+ export declare const RESUME_GO_ON = "Go on with the person's request from where you stopped, using these results; don't call these tools again for them.";
164
173
  export declare function resumeText(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string, decision: "allow" | "deny", result: ToolAnswer): string;
165
174
  /** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
166
175
  * settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
167
176
  * 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. */
177
+ * claim). The gate reads nothing of the run's own files: they are the agent's to write. `mcpServers`: the run's MCP
178
+ * servers (mcpServersOf its grants), so a harness's own name for an MCP tool is held to that tool's settings. */
169
179
  export declare function runGate(where: {
170
180
  root: string;
171
181
  work: string;
172
182
  computer?: boolean;
183
+ mcpServers?: readonly string[];
173
184
  }, runId: string, revision: {
174
185
  kind: string;
175
186
  body: {
@@ -199,6 +210,7 @@ export declare class RunGate {
199
210
  mcpServers?: readonly string[];
200
211
  computer?: boolean;
201
212
  }, readServerSettings: () => ToolSettingsRead, overrides?: PermissionSettings, approvers?: boolean, approvals?: Approvals);
213
+ private names?;
202
214
  /** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
203
215
  * reaches a live run at its next call; under approvals "never", an ask is an allow. */
204
216
  readonly policy: (tool: string) => Permission;
@@ -215,6 +227,7 @@ export declare class RunGate {
215
227
  }): Promise<"allow" | "ask" | {
216
228
  deny: string;
217
229
  }>;
230
+ private keyOf;
218
231
  /** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
219
232
  * own name; a name nothing maps, as it came. */
220
233
  askedAs(name: string): string;
package/dist/tool-gate.js CHANGED
@@ -22,14 +22,15 @@
22
22
  // wins; the same answer again is 204, a conflicting one 409. Only the owner's password session answers (server.ts), never
23
23
  // a token. A cancel marks pending approvals canceled. Where no one can approve (accounts off), an ask is refused at once
24
24
  // in words, never parked.
25
- import { defaultPermissionOf, DESKTOP_TOOL_DEFS, PHONE_TOOL_DEFS } from "@parcha/agentrun-kernel/kernel";
25
+ import { CODEMODE_TOOL_NAME } from "@earendil-works/pi-durable/codemode";
26
+ import { computerToolDefs, defaultPermissionOf } from "@parcha/agentrun-kernel/kernel";
26
27
  import { READ_SKILL_FILE } from "@parcha/agentrun-kernel";
27
28
  import { LEARNED_DIR } from "./learning.js";
28
29
  import { COMPUTER_ROOT, portPath } from "./workspace/paths.js";
29
30
  import { builtinHarness } from "./harness-table.js";
30
31
  import { DEFAULT_HARNESS } from "./harness.js";
31
32
  import { SHELL_TOOLS } from "./background.js";
32
- import { SERVE_OWN_TOOLS, TABLE_TOOLS } from "./tool-plane.js";
33
+ import { DECISION_PROVIDER_KEYS, SERVE_OWN_TOOLS, TABLE_TOOLS } from "./tool-plane.js";
33
34
  import { deniedText, NOT_RUN, RAN_UNKNOWN } from "./refusal-words.js";
34
35
  import { approvalsOf } from "./approvals.js";
35
36
  import { BASH_POLICIES, readOnlyReason, readOnlyText } from "./bash-read-only.js";
@@ -39,6 +40,10 @@ export const PERMISSIONS = ["allow", "ask", "deny"];
39
40
  export const mcpToolName = (server, tool) => `mcp:${server}/${tool}`;
40
41
  /** Whether `name` is an MCP tool's gate name. */
41
42
  export const isMcpTool = (name) => /^mcp:[^/]+\/.+$/.test(name);
43
+ /** The MCP servers a revision grants tools of, by their catalog names (`mcp:<server>/<tool>`, a server's wildcard too), each
44
+ * once: what a harness that names a session's MCP tool its own way (its facts' toolAlias: OpenCode's `<server>_<tool>`) is
45
+ * matched against, so its call is held to that tool's settings and never to a table tool's of the same shape. */
46
+ export const mcpServersOf = (granted) => [...new Set(granted.flatMap((name) => /^mcp:([^/]+)\//.exec(name)?.[1] ?? []))];
42
47
  /** A third-party catalog tool, by its name: monid's (`monid.<tool>`) or an MCP server's (`mcp:<server>/<tool>`). */
43
48
  export const isCatalogTool = (name) => name.startsWith("monid.") || isMcpTool(name);
44
49
  /** The owner's defaults (11-01): a built-in kernel tool allow; a third-party catalog tool ask. On a run with no computer,
@@ -79,54 +84,56 @@ const BROWSER_REGISTRATIONS = ["snapshot", "run", "screenshot", "browser_read",
79
84
  * registry's own definitions say it (their settingsKey), so a tool a kind gains is held to its key with no line here. */
80
85
  const KIND_TOOLS = (() => {
81
86
  const keys = new Map();
82
- for (const def of [...DESKTOP_TOOL_DEFS, ...PHONE_TOOL_DEFS])
87
+ for (const def of [...computerToolDefs("desktop", []), ...computerToolDefs("phone", [])])
83
88
  keys.set(def.name, [...new Set([...(keys.get(def.name) ?? []), def.settingsKey])]);
89
+ // pi's code mode, offered only beside a desktop's or a phone's tools (runner/adapters/pi-computer.ts): its scripts
90
+ // reach the computer as computer_script's do, so it is held to the same keys. Its nested tool calls pass the gate each.
91
+ keys.set(CODEMODE_TOOL_NAME, keys.get("computer_script") ?? []);
84
92
  return keys;
85
93
  })();
86
94
  const STRICTNESS = { allow: 0, ask: 1, deny: 2 };
87
95
  /** The MCP server through which claude-agent calls the kernel's host tools (`mcp__hands__<wire name>`). */
88
96
  const HOST_TOOLS_SERVER = "hands";
89
- /** The settings key a call named `name` on `harness` is held to: the one mapping from every name a call reaches the gate
90
- * by. A settings key is itself (a table tool, `monid.<tool>`, `mcp:<server>/<tool>`); a CLI's own tool is the table's it
91
- * is; an MCP alias, `mcp__<server>__<tool>` (claude-agent's host tools `mcp__hands__<wire name>`, mapped as their
92
- * 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
93
- * 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
94
- * `mcpServers` (the run's configured MCP servers), never by its shape, since a host tool's name has the same shape.
95
- * Undefined: nothing maps it, and the gate asks. The key only: the runner's adapter loop asks the gate once per call,
96
- * before its intent (RunGate.decide). */
97
- export function settingsKeyOf(harness, name, mcpServers = []) {
98
- // A tool that runs a command in the box (bash_background and the rest) is held to bash's key: before the table's own names.
99
- if (Object.hasOwn(SHELL_FAMILY, name))
100
- return SHELL_FAMILY[name];
101
- if (TABLE_TOOLS.includes(name) || SERVE_OWN_TOOLS.includes(name) || isCatalogTool(name))
97
+ /** Every name a session on `harness` (with MCP servers `mcpServers`) gives its tools, to the settings key each is held to:
98
+ * the shell family (bash's), table, own and decision tools, read_skill_file (`read`, unless the harness's alias makes it a
99
+ * configured server's tool), the kinds' tools (a shared one by its first kind), nativeTools, the browser's registrations;
100
+ * each also as claude-agent's `mcp__hands__<name>`. The first named wins. */
101
+ export function nameMapOf(harness, mcpServers = []) {
102
+ const facts = builtinHarness(harness)?.facts;
103
+ const names = new Map();
104
+ const name = (own, key) => void (names.has(own) || names.set(own, key));
105
+ for (const [own, key] of Object.entries(SHELL_FAMILY))
106
+ name(own, key);
107
+ for (const own of [...TABLE_TOOLS, ...SERVE_OWN_TOOLS, ...DECISION_PROVIDER_KEYS])
108
+ name(own, own);
109
+ const alias = facts?.toolAlias?.exec(READ_SKILL_FILE) ?? null;
110
+ name(READ_SKILL_FILE, alias && mcpServers.includes(alias[1]) ? mcpToolName(alias[1], alias[2]) : "read");
111
+ for (const [own, keys] of KIND_TOOLS)
112
+ name(own, keys[0]);
113
+ for (const [own, key] of Object.entries(facts?.nativeTools ?? {}))
114
+ if (key)
115
+ name(own, key);
116
+ for (const own of BROWSER_REGISTRATIONS)
117
+ name(own, "browser");
118
+ for (const [own, key] of [...names])
119
+ name(`mcp__${HOST_TOOLS_SERVER}__${own}`, key);
120
+ return names;
121
+ }
122
+ /** The settings key a call named `name` on `harness` is held to: a lookup in the session's names (`names`), then the open
123
+ * families no list holds (`monid.<tool>`, `mcp:<server>/<tool>`, `mcp__<server>__<tool>`, `monid_<kind>`, and a harness's
124
+ * own `<server>_<tool>` for a server of `mcpServers` only). Undefined: nothing maps it, and the gate asks. */
125
+ export function settingsKeyOf(harness, name, mcpServers = [], names = nameMapOf(harness, mcpServers)) {
126
+ const own = names.get(name);
127
+ if (own !== undefined)
128
+ return own;
129
+ if (isCatalogTool(name))
102
130
  return name;
103
- // An adapter's own read of a skill's file (codex's and OpenCode's read_skill_file, from the session's copy of the run's
104
- // skills) is a read: held to read's key, so a server's read deny refuses it and the default allows it, on every harness.
105
- // Unless the name is an agent's MCP tool on this harness (OpenCode's <server>_<tool>: a configured server `read` with a
106
- // tool `skill_file`): that tool keeps its own key, so read's setting never stands in for it.
107
- if (name === READ_SKILL_FILE) {
108
- const alias = builtinHarness(harness)?.facts?.toolAlias?.exec(name) ?? null;
109
- return alias && mcpServers.includes(alias[1]) ? mcpToolName(alias[1], alias[2]) : "read";
110
- }
111
- // A desktop's or a phone's tool is its kind's key, as the browser's registrations are `browser`; one both kinds have
112
- // (the hand-over) is named by the first, its permission the stricter of both (RunGate's setting).
113
- const kind = KIND_TOOLS.get(name);
114
- if (kind !== undefined)
115
- return kind[0];
116
- // A CLI's own tool, the table's tool it is (its facts' nativeTools), by an own name only.
117
- const nativeTools = builtinHarness(harness)?.facts?.nativeTools;
118
- const native = nativeTools && Object.hasOwn(nativeTools, name) ? nativeTools[name] : undefined;
119
- if (native)
120
- return native;
121
131
  const mcp = /^mcp__([a-z][a-z0-9-]*)__(.+)$/.exec(name);
122
132
  if (mcp)
123
- return mcp[1] === HOST_TOOLS_SERVER ? settingsKeyOf(harness, mcp[2], mcpServers) : mcpToolName(mcp[1], mcp[2]);
133
+ return mcp[1] === HOST_TOOLS_SERVER ? settingsKeyOf(harness, mcp[2], mcpServers, names) : mcpToolName(mcp[1], mcp[2]);
124
134
  const monid = /^monid_([a-z]+)$/.exec(name);
125
135
  if (monid)
126
136
  return `monid.${monid[1]}`;
127
- if (BROWSER_REGISTRATIONS.includes(name))
128
- return "browser";
129
- // A harness whose client names a session's MCP tool another way too (its facts' toolAlias: OpenCode's `<server>_<tool>`).
130
137
  const alias = builtinHarness(harness)?.facts?.toolAlias?.exec(name) ?? null;
131
138
  return alias && mcpServers.includes(alias[1]) ? mcpToolName(alias[1], alias[2]) : undefined;
132
139
  }
@@ -311,6 +318,9 @@ export function resumeHead(request, shown) {
311
318
  const args = shown.length > 300 ? `${shown.slice(0, 299)}…` : shown;
312
319
  return `${RESUME_PREFIX}This answers your ${request.tool} call ${request.call_id} (arguments ${args}), which waited for a person's approval; it is not a new message from them.`;
313
320
  }
321
+ /** The last line of a CLI's resume message (one, after every call it answers): the message arrives as a new turn, and a
322
+ * model that reads only results there answers about the approval, not the person's request (Claude Code, live). */
323
+ export const RESUME_GO_ON = "Go on with the person's request from where you stopped, using these results; don't call these tools again for them.";
314
324
  export function resumeText(request, shown, decision, result) {
315
325
  const head = resumeHead(request, shown);
316
326
  return decision === "allow" ? `${head} They allowed it, and it ran${result.isError ? " and failed" : ""}. Its result:\n${result.text}` : `${head}\n${result.text}`;
@@ -318,9 +328,10 @@ export function resumeText(request, shown, decision, result) {
318
328
  /** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
319
329
  * settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
320
330
  * the gate reads them. `approvers`: whether anyone can answer an ask here, the store's (server-approvers.ts, read at each
321
- * claim). The gate reads nothing of the run's own files: they are the agent's to write. */
331
+ * claim). The gate reads nothing of the run's own files: they are the agent's to write. `mcpServers`: the run's MCP
332
+ * servers (mcpServersOf its grants), so a harness's own name for an MCP tool is held to that tool's settings. */
322
333
  export function runGate(where, runId, revision, serverSettings, approvers) {
323
- return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, ...(where.computer === undefined ? {} : { computer: where.computer }) }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
334
+ return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, ...(where.computer === undefined ? {} : { computer: where.computer }), ...(where.mcpServers ? { mcpServers: where.mcpServers } : {}) }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
324
335
  }
325
336
  /** A run's tool gate on the runner: its policy, asked before each call's intent (decide). */
326
337
  export class RunGate {
@@ -339,6 +350,7 @@ export class RunGate {
339
350
  this.approvers = approvers;
340
351
  this.approvals = approvals;
341
352
  }
353
+ names;
342
354
  /** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
343
355
  * reaches a live run at its next call; under approvals "never", an ask is an allow. */
344
356
  policy = (tool) => this.setting(tool).permission;
@@ -351,7 +363,7 @@ export class RunGate {
351
363
  * the call is run again after an earlier attempt that may have been sent (a replay-safe call rerun after a crash), so a
352
364
  * refusal says whether it took effect is not known, never that nothing was sent. */
353
365
  async decide(name, args, options = {}) {
354
- const key = settingsKeyOf(this.where.harness ?? DEFAULT_HARNESS, name, this.where.mcpServers) ?? name;
366
+ const key = this.keyOf(name) ?? name;
355
367
  const tool = this.askedAs(name);
356
368
  const ran = options.replayed ? "unknown" : "no";
357
369
  const verdict = this.policy(name);
@@ -367,22 +379,26 @@ export class RunGate {
367
379
  return "allow";
368
380
  return this.approvers ? "ask" : { deny: noApproverText(tool, ran) };
369
381
  }
382
+ keyOf(name) {
383
+ const harness = this.where.harness ?? DEFAULT_HARNESS;
384
+ return settingsKeyOf(harness, name, this.where.mcpServers, (this.names ??= nameMapOf(harness, this.where.mcpServers)));
385
+ }
370
386
  /** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
371
387
  * own name; a name nothing maps, as it came. */
372
388
  askedAs(name) {
373
- return shellToolOf(name) ?? settingsKeyOf(this.where.harness ?? DEFAULT_HARNESS, name, this.where.mcpServers) ?? name;
389
+ return shellToolOf(name) ?? this.keyOf(name) ?? name;
374
390
  }
375
391
  /** Where the permission `policy` gives `tool` was set: the agent's own tool settings, the server's, or the default; or
376
392
  * "unattended", an ask the agent's approvals allowed. */
377
393
  denyFrom = (tool) => this.setting(tool).from;
378
394
  setting(tool) {
379
- // A tool the desktop and the phone both have (the hand-over): the gate knows not the run's kind, so it is held to the
395
+ // A tool the desktop and the phone both have (every computer tool): the gate knows not the run's kind, so it is held to the
380
396
  // stricter of both keys' settings, never more permissive than the run's own kind's.
381
397
  const shared = KIND_TOOLS.get(tool.replace(/^mcp__hands__/, ""));
382
398
  if (shared && shared.length > 1) {
383
399
  return shared.map((key) => this.settingOf(tool, key)).reduce((strictest, one) => (STRICTNESS[one.permission] > STRICTNESS[strictest.permission] ? one : strictest));
384
400
  }
385
- return this.settingOf(tool, settingsKeyOf(this.where.harness ?? DEFAULT_HARNESS, tool, this.where.mcpServers));
401
+ return this.settingOf(tool, this.keyOf(tool));
386
402
  }
387
403
  /** `tool`'s permission under its settings key `key`, and where it was set. */
388
404
  settingOf(tool, key) {