@parcha/agentrun-serve 0.1.0-beta.58 → 0.1.0-beta.60

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 (474) hide show
  1. package/CHANGELOG.md +402 -1
  2. package/README.md +516 -190
  3. package/dist/acp-package.d.ts +5 -1
  4. package/dist/acp-package.js +19 -2
  5. package/dist/adapters.d.ts +23 -2
  6. package/dist/adapters.js +106 -33
  7. package/dist/agent-delete.d.ts +6 -9
  8. package/dist/agent-delete.js +5 -3
  9. package/dist/agent-package.js +11 -1
  10. package/dist/agents-store.js +1 -1
  11. package/dist/answer-text.d.ts +3 -0
  12. package/dist/answer-text.js +22 -0
  13. package/dist/api-only.d.ts +2 -2
  14. package/dist/api-only.js +3 -3
  15. package/dist/archil-routes.d.ts +4 -1
  16. package/dist/archil-routes.js +15 -12
  17. package/dist/archil-settings.d.ts +18 -8
  18. package/dist/archil-settings.js +35 -17
  19. package/dist/attach-conformance.js +5 -4
  20. package/dist/box-paths.d.ts +3 -2
  21. package/dist/box-paths.js +5 -4
  22. package/dist/browser-computer.d.ts +3 -8
  23. package/dist/browser-computer.js +12 -35
  24. package/dist/browser-cost.js +94 -20
  25. package/dist/capacity.d.ts +1 -1
  26. package/dist/capacity.js +3 -3
  27. package/dist/chatgpt-plan.d.ts +7 -0
  28. package/dist/chatgpt-plan.js +35 -11
  29. package/dist/claude-login-token.d.ts +20 -11
  30. package/dist/claude-login-token.js +175 -107
  31. package/dist/claude-login.d.ts +124 -33
  32. package/dist/claude-login.js +562 -85
  33. package/dist/claude-sign-in.d.ts +3 -0
  34. package/dist/claude-sign-in.js +10 -1
  35. package/dist/cli-learning/connections.js +1 -1
  36. package/dist/cli.js +323 -292
  37. package/dist/composio-made.d.ts +1 -6
  38. package/dist/composio-made.js +1 -6
  39. package/dist/composio-owners.d.ts +26 -0
  40. package/dist/composio-owners.js +36 -0
  41. package/dist/composio-preset.d.ts +56 -23
  42. package/dist/composio-preset.js +173 -77
  43. package/dist/composio-triggers.d.ts +4 -4
  44. package/dist/composio-triggers.js +6 -7
  45. package/dist/compute-cost.js +11 -2
  46. package/dist/computer-attach.d.ts +6 -3
  47. package/dist/computer-attach.js +41 -29
  48. package/dist/computer-held-routes.d.ts +1 -1
  49. package/dist/computer-held-routes.js +9 -4
  50. package/dist/computer-keys.d.ts +11 -1
  51. package/dist/computer-keys.js +26 -1
  52. package/dist/computer-record.js +3 -1
  53. package/dist/computer-view.d.ts +5 -3
  54. package/dist/computer-view.js +10 -6
  55. package/dist/computer-viewer.js +36 -7
  56. package/dist/computers.d.ts +2 -1
  57. package/dist/computers.js +6 -3
  58. package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
  59. package/dist/console/assets/backend-QnwGVBeU.js +166 -0
  60. package/dist/console/assets/index-DZi-muIj.js +629 -0
  61. package/dist/console/assets/share-pz61zIn9.js +6 -0
  62. package/dist/console/assets/styles-CcceGcu2.js +291 -0
  63. package/dist/console/assets/styles-fjQBFfMv.css +1 -0
  64. package/dist/console/index.html +4 -3
  65. package/dist/console/share.html +17 -0
  66. package/dist/decisions.d.ts +17 -7
  67. package/dist/decisions.js +41 -15
  68. package/dist/dial-relay.js +10 -4
  69. package/dist/docker-daemon.js +4 -5
  70. package/dist/docker-host-addresses.js +29 -11
  71. package/dist/email/account.d.ts +6 -0
  72. package/dist/email/account.js +6 -0
  73. package/dist/email/authentication.d.ts +21 -0
  74. package/dist/email/authentication.js +106 -0
  75. package/dist/email/email-faux.d.ts +11 -2
  76. package/dist/email/email-faux.js +21 -5
  77. package/dist/email/mail.d.ts +25 -0
  78. package/dist/email/mail.js +58 -2
  79. package/dist/email/names.js +2 -2
  80. package/dist/email/tools.d.ts +9 -4
  81. package/dist/email/tools.js +95 -13
  82. package/dist/env-switch.d.ts +12 -2
  83. package/dist/env-switch.js +23 -3
  84. package/dist/errors.d.ts +1 -0
  85. package/dist/errors.js +2 -0
  86. package/dist/factory-activity.d.ts +68 -0
  87. package/dist/factory-activity.js +153 -0
  88. package/dist/factory-runs.d.ts +11 -0
  89. package/dist/factory-runs.js +52 -0
  90. package/dist/fal-price.d.ts +11 -1
  91. package/dist/fal-price.js +33 -0
  92. package/dist/faux-computers.js +1 -1
  93. package/dist/filed-answer.d.ts +2 -2
  94. package/dist/filed-answer.js +2 -2
  95. package/dist/filed-tool.d.ts +32 -0
  96. package/dist/filed-tool.js +122 -0
  97. package/dist/graph-served.d.ts +10 -5
  98. package/dist/graph-served.js +40 -10
  99. package/dist/handed-values.js +1 -2
  100. package/dist/harness-check.d.ts +2 -1
  101. package/dist/harness-check.js +45 -12
  102. package/dist/harness-keys.d.ts +1 -2
  103. package/dist/harness-keys.js +10 -8
  104. package/dist/harness-opencode/facts.js +2 -0
  105. package/dist/harness-recipe-entry.d.ts +9 -3
  106. package/dist/harness-recipe-entry.js +18 -9
  107. package/dist/harness-recipe.d.ts +21 -0
  108. package/dist/harness-recipe.js +25 -3
  109. package/dist/harness-table.d.ts +12 -0
  110. package/dist/harness-table.js +21 -6
  111. package/dist/harness.js +6 -2
  112. package/dist/helper-env.d.ts +4 -1
  113. package/dist/helper-env.js +4 -1
  114. package/dist/host-check.d.ts +2 -3
  115. package/dist/host-check.js +13 -7
  116. package/dist/hosted-search.js +1 -1
  117. package/dist/import-worker.js +2 -2
  118. package/dist/import.d.ts +20 -8
  119. package/dist/import.js +448 -187
  120. package/dist/key-refusal.d.ts +14 -2
  121. package/dist/key-refusal.js +97 -33
  122. package/dist/learn/audit.d.ts +28 -27
  123. package/dist/learn/audit.js +87 -62
  124. package/dist/learn/check.js +1 -1
  125. package/dist/learn/commit.d.ts +35 -43
  126. package/dist/learn/commit.js +62 -270
  127. package/dist/learn/compile.d.ts +9 -6
  128. package/dist/learn/compile.js +51 -28
  129. package/dist/learn/corrections.js +1 -1
  130. package/dist/learn/delete.d.ts +5 -12
  131. package/dist/learn/delete.js +17 -30
  132. package/dist/learn/field-check.d.ts +111 -0
  133. package/dist/learn/field-check.js +174 -0
  134. package/dist/learn/forget-run.d.ts +16 -0
  135. package/dist/learn/forget-run.js +53 -0
  136. package/dist/learn/index.js +1 -1
  137. package/dist/learn/learning-of.d.ts +0 -4
  138. package/dist/learn/learning-of.js +0 -5
  139. package/dist/learn/ledger.d.ts +32 -29
  140. package/dist/learn/ledger.js +26 -19
  141. package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
  142. package/dist/learn/{folder.js → legacy/folder.js} +4 -7
  143. package/dist/learn/legacy/place.d.ts +16 -0
  144. package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
  145. package/dist/learn/legacy/scrub.d.ts +28 -0
  146. package/dist/learn/legacy/scrub.js +258 -0
  147. package/dist/learn/promote.d.ts +119 -102
  148. package/dist/learn/promote.js +119 -262
  149. package/dist/learn/reset-ledger.d.ts +18 -0
  150. package/dist/learn/reset-ledger.js +14 -0
  151. package/dist/learn/rows.d.ts +186 -0
  152. package/dist/learn/rows.js +376 -0
  153. package/dist/learn/secrets.d.ts +4 -0
  154. package/dist/learn/secrets.js +12 -0
  155. package/dist/learn/workflow-draft.d.ts +4 -1
  156. package/dist/learn/workflow-draft.js +12 -2
  157. package/dist/learned-nodes.d.ts +8 -5
  158. package/dist/learned-nodes.js +8 -5
  159. package/dist/learned-workflow.d.ts +2 -1
  160. package/dist/learned-workflow.js +13 -10
  161. package/dist/learning-cost.d.ts +25 -8
  162. package/dist/learning-cost.js +23 -8
  163. package/dist/learning-reset.d.ts +1 -1
  164. package/dist/learning-reset.js +9 -11
  165. package/dist/learning-routes.d.ts +60 -81
  166. package/dist/learning-routes.js +187 -360
  167. package/dist/learning-setting.d.ts +6 -0
  168. package/dist/learning-setting.js +11 -1
  169. package/dist/learning-words.d.ts +2 -0
  170. package/dist/learning-words.js +2 -0
  171. package/dist/learning.d.ts +18 -24
  172. package/dist/learning.js +35 -66
  173. package/dist/listen-first.d.ts +5 -4
  174. package/dist/listen-first.js +4 -5
  175. package/dist/live-reach.d.ts +7 -0
  176. package/dist/live-reach.js +7 -0
  177. package/dist/mcp-api-only-origins.d.ts +15 -0
  178. package/dist/mcp-api-only-origins.js +40 -0
  179. package/dist/mcp-gateway.d.ts +22 -2
  180. package/dist/mcp-gateway.js +85 -11
  181. package/dist/mcp-oauth.d.ts +1 -1
  182. package/dist/mcp-oauth.js +3 -2
  183. package/dist/mcp-probe.d.ts +3 -0
  184. package/dist/mcp-probe.js +3 -0
  185. package/dist/mcp-resources.d.ts +1 -1
  186. package/dist/mcp-secret-writes.d.ts +24 -2
  187. package/dist/mcp-secret-writes.js +30 -2
  188. package/dist/mcp-servers-store.d.ts +52 -14
  189. package/dist/mcp-servers-store.js +165 -61
  190. package/dist/mcp-sources.d.ts +1 -2
  191. package/dist/mcp-sources.js +1 -2
  192. package/dist/mcp-store.d.ts +5 -5
  193. package/dist/mcp-store.js +3 -3
  194. package/dist/mcp.js +1 -1
  195. package/dist/model-gateway.d.ts +1 -1
  196. package/dist/model-gateway.js +20 -36
  197. package/dist/native/discovery.d.ts +6 -0
  198. package/dist/native/discovery.js +14 -1
  199. package/dist/native/remote.d.ts +5 -0
  200. package/dist/native/remote.js +16 -0
  201. package/dist/native/runtime.js +3 -2
  202. package/dist/observation/observer.d.ts +6 -6
  203. package/dist/ollama-provider.d.ts +23 -9
  204. package/dist/ollama-provider.js +49 -20
  205. package/dist/openapi.js +290 -79
  206. package/dist/otel/genai.d.ts +83 -7
  207. package/dist/otel/genai.js +69 -9
  208. package/dist/otel/tracer.d.ts +42 -13
  209. package/dist/otel/tracer.js +241 -56
  210. package/dist/page.d.ts +7 -1
  211. package/dist/page.js +76 -22
  212. package/dist/paid-calls.d.ts +6 -4
  213. package/dist/paid-calls.js +15 -7
  214. package/dist/place-offers.d.ts +58 -34
  215. package/dist/place-offers.js +96 -54
  216. package/dist/place.d.ts +41 -20
  217. package/dist/place.js +97 -47
  218. package/dist/print.js +1 -1
  219. package/dist/provider.d.ts +3 -2
  220. package/dist/provider.js +17 -8
  221. package/dist/purged-workflow.d.ts +0 -33
  222. package/dist/purged-workflow.js +3 -71
  223. package/dist/redact/match.d.ts +42 -9
  224. package/dist/redact/match.js +356 -54
  225. package/dist/run-census.d.ts +1 -1
  226. package/dist/run-census.js +4 -5
  227. package/dist/run-cut.js +4 -5
  228. package/dist/run-export-store.d.ts +15 -0
  229. package/dist/run-export-store.js +30 -0
  230. package/dist/run-export.d.ts +139 -0
  231. package/dist/run-export.js +379 -0
  232. package/dist/run-file-cut.d.ts +5 -0
  233. package/dist/run-file-cut.js +13 -0
  234. package/dist/run-launch.d.ts +3 -3
  235. package/dist/run-launch.js +16 -3
  236. package/dist/run-learning-served.d.ts +3 -3
  237. package/dist/run-learning-served.js +1 -1
  238. package/dist/run-listing.d.ts +1 -1
  239. package/dist/run-model-key.d.ts +15 -6
  240. package/dist/run-model-key.js +30 -31
  241. package/dist/run-reads-over-store.js +4 -4
  242. package/dist/run-secrets.js +3 -5
  243. package/dist/run-timeline-served.d.ts +1 -1
  244. package/dist/run-timeline-served.js +8 -5
  245. package/dist/runnable.js +26 -9
  246. package/dist/runner/adapter-loop.d.ts +35 -18
  247. package/dist/runner/adapter-loop.js +94 -47
  248. package/dist/runner/adapter-run-spec.d.ts +14 -1
  249. package/dist/runner/adapter-run-spec.js +73 -46
  250. package/dist/runner/adapters/pi.js +4 -2
  251. package/dist/runner/audit.d.ts +10 -9
  252. package/dist/runner/audit.js +64 -67
  253. package/dist/runner/beside.js +5 -6
  254. package/dist/runner/claim-secrets.d.ts +10 -3
  255. package/dist/runner/claim-secrets.js +29 -13
  256. package/dist/runner/cli-run-spec.d.ts +18 -0
  257. package/dist/runner/cli-run-spec.js +87 -58
  258. package/dist/runner/compare-end.d.ts +2 -3
  259. package/dist/runner/compare-end.js +30 -11
  260. package/dist/runner/conformance/harness.js +2 -3
  261. package/dist/runner/conformance/subject.d.ts +4 -1
  262. package/dist/runner/disk-free.d.ts +15 -4
  263. package/dist/runner/disk-free.js +25 -7
  264. package/dist/runner/feedback-round.d.ts +1 -1
  265. package/dist/runner/feedback-round.js +2 -2
  266. package/dist/runner/harness-loops.js +3 -4
  267. package/dist/runner/held.d.ts +5 -12
  268. package/dist/runner/held.js +0 -25
  269. package/dist/runner/journal-kinds.d.ts +8 -2
  270. package/dist/runner/journal-kinds.js +23 -5
  271. package/dist/runner/learned-first.d.ts +0 -2
  272. package/dist/runner/learned-first.js +23 -7
  273. package/dist/runner/learning-end.d.ts +14 -24
  274. package/dist/runner/learning-end.js +52 -94
  275. package/dist/runner/learning-seed.d.ts +13 -16
  276. package/dist/runner/learning-seed.js +13 -23
  277. package/dist/runner/live-ticker.js +7 -5
  278. package/dist/runner/loop-contract.d.ts +0 -2
  279. package/dist/runner/loop.d.ts +7 -0
  280. package/dist/runner/loop.js +1 -0
  281. package/dist/runner/main.js +13 -12
  282. package/dist/runner/mcp-claim.js +21 -5
  283. package/dist/runner/mcp-run.d.ts +4 -0
  284. package/dist/runner/mcp-run.js +2 -0
  285. package/dist/runner/meta-tools.js +3 -2
  286. package/dist/runner/metrics.d.ts +7 -0
  287. package/dist/runner/metrics.js +19 -0
  288. package/dist/runner/model-route.d.ts +10 -7
  289. package/dist/runner/model-route.js +79 -15
  290. package/dist/runner/native-loop.js +12 -11
  291. package/dist/runner/presence.d.ts +1 -4
  292. package/dist/runner/presence.js +6 -8
  293. package/dist/runner/promotion.d.ts +39 -36
  294. package/dist/runner/promotion.js +168 -112
  295. package/dist/runner/redact.d.ts +3 -1
  296. package/dist/runner/redact.js +5 -3
  297. package/dist/runner/reflect-hook.d.ts +2 -2
  298. package/dist/runner/reflect-hook.js +4 -1
  299. package/dist/runner/responses-fetch.d.ts +36 -0
  300. package/dist/runner/responses-fetch.js +511 -0
  301. package/dist/runner/run-child-host.d.ts +21 -14
  302. package/dist/runner/run-child-host.js +187 -141
  303. package/dist/runner/run-child.js +11 -4
  304. package/dist/runner/runner-check.js +5 -1
  305. package/dist/runner/runner.d.ts +3 -4
  306. package/dist/runner/runner.js +13 -9
  307. package/dist/runner/sdk-loop.js +10 -12
  308. package/dist/runner/spec-holds.d.ts +8 -1
  309. package/dist/runner/spec-holds.js +9 -4
  310. package/dist/runner/workflow-calls.d.ts +9 -0
  311. package/dist/runner/workflow-calls.js +150 -0
  312. package/dist/runner/workflow-first.d.ts +120 -32
  313. package/dist/runner/workflow-first.js +218 -94
  314. package/dist/runner/workflow-spec.js +1 -1
  315. package/dist/runs-over-store.js +8 -7
  316. package/dist/save-once.d.ts +14 -0
  317. package/dist/save-once.js +31 -0
  318. package/dist/scrub-command.d.ts +34 -31
  319. package/dist/scrub-command.js +116 -147
  320. package/dist/sdk/check.d.ts +1 -4
  321. package/dist/sdk/check.js +2 -3
  322. package/dist/sdk/runs.d.ts +26 -7
  323. package/dist/sdk/runs.js +194 -78
  324. package/dist/seal-key.js +4 -4
  325. package/dist/secret-cut.d.ts +3 -0
  326. package/dist/secret-cut.js +7 -1
  327. package/dist/secret-rules.d.ts +8 -1
  328. package/dist/secret-rules.js +482 -53
  329. package/dist/secrets.d.ts +55 -9
  330. package/dist/secrets.js +345 -21
  331. package/dist/server-fs.d.ts +1 -1
  332. package/dist/server-fs.js +1 -1
  333. package/dist/server-keys.d.ts +10 -3
  334. package/dist/server-keys.js +16 -3
  335. package/dist/server-secrets-store.js +2 -4
  336. package/dist/server.d.ts +30 -18
  337. package/dist/server.js +520 -238
  338. package/dist/share-context.d.ts +22 -0
  339. package/dist/share-context.js +76 -0
  340. package/dist/shell-lex.d.ts +105 -0
  341. package/dist/shell-lex.js +646 -0
  342. package/dist/sign-ins-store.d.ts +5 -7
  343. package/dist/sign-ins-store.js +12 -16
  344. package/dist/sign-ins.d.ts +7 -11
  345. package/dist/sign-ins.js +40 -41
  346. package/dist/skills/agentrun-serve/SKILL.md +5 -2
  347. package/dist/source-sync/auxiliary.js +2 -2
  348. package/dist/start-switches.d.ts +6 -5
  349. package/dist/start-switches.js +8 -4
  350. package/dist/stats.d.ts +5 -1
  351. package/dist/stats.js +1 -1
  352. package/dist/store/agent-body.js +2 -2
  353. package/dist/store/dialect.d.ts +4 -0
  354. package/dist/store/dialect.js +1 -0
  355. package/dist/store/index.d.ts +2 -2
  356. package/dist/store/index.js +1 -1
  357. package/dist/store/mcp-record-keys.d.ts +10 -0
  358. package/dist/store/mcp-record-keys.js +13 -0
  359. package/dist/store/postgres/dialect.js +2 -0
  360. package/dist/store/postgres/migrations/0029_run_launch_census_settle.sql +28 -0
  361. package/dist/store/postgres/migrations/0030_learning_ledger_epoch.sql +40 -0
  362. package/dist/store/postgres/migrations/0031_learning_ledger_calls.sql +12 -0
  363. package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
  364. package/dist/store/postgres/store.js +4 -0
  365. package/dist/store/schema.d.ts +60 -11
  366. package/dist/store/schema.js +147 -17
  367. package/dist/store/seal.d.ts +4 -1
  368. package/dist/store/sqlite/learning-rows.d.ts +23 -0
  369. package/dist/store/sqlite/learning-rows.js +559 -0
  370. package/dist/store/sqlite/run-launch.d.ts +3 -10
  371. package/dist/store/sqlite/run-launch.js +12 -23
  372. package/dist/store/sqlite/run-patch.d.ts +17 -10
  373. package/dist/store/sqlite/run-patch.js +50 -13
  374. package/dist/store/sqlite/store.d.ts +9 -0
  375. package/dist/store/sqlite/store.js +194 -46
  376. package/dist/store/store-schema.js +3 -4
  377. package/dist/store/store.d.ts +286 -38
  378. package/dist/store/store.js +27 -11
  379. package/dist/store-reads/analytics.d.ts +2 -1
  380. package/dist/store-reads/analytics.js +7 -5
  381. package/dist/store-reads/journal.d.ts +33 -3
  382. package/dist/store-reads/journal.js +99 -4
  383. package/dist/store-reads/learning.d.ts +50 -45
  384. package/dist/store-reads/learning.js +153 -116
  385. package/dist/store-reads/loop.js +1 -1
  386. package/dist/store-reads/stats.d.ts +2 -2
  387. package/dist/store-reads/stats.js +13 -7
  388. package/dist/store-view.d.ts +24 -2
  389. package/dist/store-view.js +49 -17
  390. package/dist/suggestions.d.ts +1 -1
  391. package/dist/suggestions.js +29 -13
  392. package/dist/template-eval.d.ts +72 -9
  393. package/dist/template-eval.js +358 -64
  394. package/dist/templates.d.ts +10 -2
  395. package/dist/templates.js +31 -4
  396. package/dist/timeline/labels.d.ts +1 -1
  397. package/dist/timeline/labels.js +4 -3
  398. package/dist/timeline/timeline.d.ts +23 -11
  399. package/dist/timeline/timeline.js +115 -31
  400. package/dist/timeline/web-calls.d.ts +8 -6
  401. package/dist/timeline/web-calls.js +10 -6
  402. package/dist/tool-gate.d.ts +13 -1
  403. package/dist/tool-gate.js +43 -3
  404. package/dist/tool-keys-store.js +2 -4
  405. package/dist/tool-keys.d.ts +11 -0
  406. package/dist/tool-keys.js +16 -0
  407. package/dist/tool-plane.d.ts +54 -13
  408. package/dist/tool-plane.js +103 -32
  409. package/dist/tools.d.ts +5 -1
  410. package/dist/tools.js +7 -7
  411. package/dist/trigger-email.js +12 -6
  412. package/dist/triggers.d.ts +15 -34
  413. package/dist/triggers.js +119 -126
  414. package/dist/validate.d.ts +8 -1
  415. package/dist/validate.js +163 -23
  416. package/dist/web-fake.d.ts +2 -1
  417. package/dist/web-fake.js +8 -6
  418. package/dist/web-fetch.d.ts +8 -6
  419. package/dist/web-fetch.js +13 -11
  420. package/dist/web-holds.d.ts +34 -0
  421. package/dist/web-holds.js +89 -0
  422. package/dist/web-run.d.ts +32 -5
  423. package/dist/web-run.js +76 -28
  424. package/dist/web-save.js +23 -12
  425. package/dist/web-search.js +14 -25
  426. package/dist/wires.d.ts +4 -3
  427. package/dist/wires.js +5 -4
  428. package/dist/workspace/archil-claim.d.ts +12 -5
  429. package/dist/workspace/archil-claim.js +45 -5
  430. package/dist/workspace/archil-exec.js +1 -1
  431. package/dist/workspace/archil.d.ts +1 -1
  432. package/dist/workspace/archil.js +1 -1
  433. package/dist/workspace/attach.js +52 -19
  434. package/dist/workspace/attached-computers.d.ts +6 -2
  435. package/dist/workspace/attached-computers.js +5 -4
  436. package/dist/workspace/computer-deps.d.ts +23 -6
  437. package/dist/workspace/computer-deps.js +38 -18
  438. package/dist/workspace/computer-for-claim.d.ts +21 -4
  439. package/dist/workspace/computer-for-claim.js +160 -54
  440. package/dist/workspace/computer-intervals.d.ts +2 -0
  441. package/dist/workspace/computer-intervals.js +1 -1
  442. package/dist/workspace/computer-janitor.d.ts +48 -14
  443. package/dist/workspace/computer-janitor.js +153 -44
  444. package/dist/workspace/computer-kept.d.ts +158 -32
  445. package/dist/workspace/computer-kept.js +288 -63
  446. package/dist/workspace/computer-providers.d.ts +19 -4
  447. package/dist/workspace/computer-providers.js +40 -6
  448. package/dist/workspace/index.d.ts +2 -3
  449. package/dist/workspace/index.js +2 -3
  450. package/dist/workspace/local.js +41 -1
  451. package/dist/workspace/mount-revoke-left.d.ts +31 -0
  452. package/dist/workspace/mount-revoke-left.js +72 -0
  453. package/dist/workspace/paired-route.js +4 -5
  454. package/dist/workspace/paths.d.ts +0 -4
  455. package/dist/workspace/paths.js +0 -6
  456. package/dist/workspace/resolve-computer.d.ts +5 -2
  457. package/dist/workspace/resolve-computer.js +9 -3
  458. package/dist/workspace/run-end-computers.d.ts +11 -5
  459. package/dist/workspace/run-end-computers.js +153 -28
  460. package/dist/workspace/run-tools.d.ts +22 -3
  461. package/dist/workspace/run-tools.js +17 -5
  462. package/dist/workspace/run-workspace.d.ts +14 -1
  463. package/dist/workspace/run-workspace.js +34 -1
  464. package/dist/workspace/workspace.d.ts +7 -1
  465. package/dist/workspace/workspace.js +1 -1
  466. package/package.json +13 -14
  467. package/skills/agentrun-serve/SKILL.md +5 -2
  468. package/templates/README.md +22 -6
  469. package/templates/TOOLS.md +46 -0
  470. package/dist/console/assets/backend-CSAWUqtZ.js +0 -166
  471. package/dist/console/assets/index-Bwn1oTem.css +0 -1
  472. package/dist/console/assets/index-DPh29cyz.js +0 -747
  473. package/dist/workspace/learning-workspace.d.ts +0 -24
  474. /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { PublicFetchOptions } from "@parcha/pi-browser";
2
- import type { McpKeys, McpMeter } from "./mcp-gateway.js";
2
+ import type { McpKeys, McpMeter, McpResults } from "./mcp-gateway.js";
3
3
  import { type SaveSlots } from "./web-save.js";
4
4
  /** The host of fal's hosted MCP server (its key endpoint /mcp and its sign-in endpoint /mcp-relay). */
5
5
  export declare const FAL_MCP_HOST = "mcp.fal.ai";
@@ -94,6 +94,16 @@ export declare const publicMedia: (guard: () => Promise<Omit<PublicFetchOptions,
94
94
  * (over KEY_ROOM) is refused unsent, in words. `back` reads each scoped key in a reply as the agent's by taking the
95
95
  * suffix off. */
96
96
  export declare function falKeys(run: string): McpKeys;
97
+ /** Where a fal job's result is filed in the run's files: evidence/fal/<request_id>.json. */
98
+ export declare const FAL_RESULTS_DIR = "evidence/fal";
99
+ /** fal's request ids: UUIDs. Only one names a file: anything else (a path, a dot name, a name past a filename's
100
+ * limit, a plain name fal never gives) is never filed. */
101
+ export declare const FAL_REQUEST_ID: RegExp;
102
+ /** The completed jobs of fal's answer to `tool`, each by its request_id with its `result` as fal answered it: the answer
103
+ * itself (run_model), and each entry of a list in it (submit_jobs', wait_for_jobs' `jobs`). A job is completed when
104
+ * fal says so (`status` "completed") and it carries a `result`. One whose request_id is not a UUID is left out, and a
105
+ * request_id twice in one answer is filed from its first entry. */
106
+ export declare const falResults: McpResults;
97
107
  /** A fal server's meter: fal's unit prices read through the gateway's `ask`, kept per endpoint for PRICE_TTL_MS.
98
108
  * `media` reads an input media file (none: such a job is unpriceable); `now`, the clock. */
99
109
  export declare function falMeter({ media, now }?: {
package/dist/fal-price.js CHANGED
@@ -510,6 +510,38 @@ export function falKeys(run) {
510
510
  back: (text) => (text.includes(mark) ? text.replace(suffix, "") : text),
511
511
  };
512
512
  }
513
+ /** Where a fal job's result is filed in the run's files: evidence/fal/<request_id>.json. */
514
+ export const FAL_RESULTS_DIR = "evidence/fal";
515
+ /** fal's request ids: UUIDs. Only one names a file: anything else (a path, a dot name, a name past a filename's
516
+ * limit, a plain name fal never gives) is never filed. */
517
+ export const FAL_REQUEST_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
518
+ /** fal's tools whose answers carry completed jobs: run_model's one, submit_jobs' and wait_for_jobs' each. */
519
+ const WITH_RESULTS = new Set(["run_model", "submit_jobs", "wait_for_jobs"]);
520
+ /** The completed jobs of fal's answer to `tool`, each by its request_id with its `result` as fal answered it: the answer
521
+ * itself (run_model), and each entry of a list in it (submit_jobs', wait_for_jobs' `jobs`). A job is completed when
522
+ * fal says so (`status` "completed") and it carries a `result`. One whose request_id is not a UUID is left out, and a
523
+ * request_id twice in one answer is filed from its first entry. */
524
+ export const falResults = {
525
+ dir: FAL_RESULTS_DIR,
526
+ of(tool, reply) {
527
+ if (!WITH_RESULTS.has(tool))
528
+ return [];
529
+ const body = bodyOf(reply);
530
+ if (!isObject(body))
531
+ return [];
532
+ const entries = [body, ...Object.values(body).flatMap((value) => (Array.isArray(value) ? value : []))];
533
+ const seen = new Set();
534
+ return entries.flatMap((entry) => {
535
+ if (!isObject(entry) || entry.status !== "completed" || !Object.hasOwn(entry, "result"))
536
+ return [];
537
+ const id = entry.request_id;
538
+ if (typeof id !== "string" || !FAL_REQUEST_ID.test(id) || seen.has(id))
539
+ return [];
540
+ seen.add(id);
541
+ return [{ name: id, value: entry.result }];
542
+ });
543
+ },
544
+ };
513
545
  /** A fal server's meter: fal's unit prices read through the gateway's `ask`, kept per endpoint for PRICE_TTL_MS.
514
546
  * `media` reads an input media file (none: such a job is unpriceable); `now`, the clock. */
515
547
  export function falMeter({ media, now = Date.now } = {}) {
@@ -624,6 +656,7 @@ export function falMeter({ media, now = Date.now } = {}) {
624
656
  };
625
657
  return {
626
658
  bills: falBills,
659
+ results: falResults,
627
660
  async quote(tool, args, ask, signal) {
628
661
  const quotes = [];
629
662
  // One at a time: each endpoint's price is read once, the next job's from what the last one kept.
@@ -143,7 +143,7 @@ export function fauxComputers() {
143
143
  async function fauxDial(dial, run) {
144
144
  // The computer package's words for a dial provider with no dial (hosted/provider.ts #dialed).
145
145
  if (dial === undefined)
146
- throw new Error("Faux dial machines dial in to this server, and this runner runs in a process of its own, with no attach hub to take their socket: start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)");
146
+ throw new Error("Faux dial machines dial in to this server, and this runner runs in a process of its own and relays no machine's socket: give the runner AGENTRUN_PUBLIC_URL (this server's public address), or start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)");
147
147
  if (!dial.url)
148
148
  throw new Error("Faux dial machines dial in to this server, which has no public address: set AGENTRUN_PUBLIC_URL");
149
149
  const name = `faux-dial-${randomBytes(6).toString("hex")}`;
@@ -24,8 +24,8 @@ export declare function laidOut(text: string): string | undefined;
24
24
  /** The model's text for `text`, longer than `clip` characters: the filed text's first lines, whole, within `clip`, then
25
25
  * a note naming the file (`<folder>/<stem>.txt`, or `.json` for JSON) and the read offset that goes on. A file that
26
26
  * cannot be written still answers its start, saying why in the Workspace's words (never an error's message, which
27
- * names paths). `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
28
- export declare function filedAnswer(work: Workspace | (() => Workspace), folder: string, stem: string, text: string, clip: number): Promise<string>;
27
+ * names paths), a Workspace that cannot be opened (`work` a thunk that rejects) too. `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
28
+ export declare function filedAnswer(work: Workspace | (() => Workspace | Promise<Workspace>), folder: string, stem: string, text: string, clip: number): Promise<string>;
29
29
  /** For a unified diff (`diff --git a/... b/...` lines), where each file not wholly shown starts in the filed text and
30
30
  * how many lines it runs, so a reader takes the files it needs by range (and passes a generated one by) rather than
31
31
  * paging through all of it: "; files past the cut, from the line each starts at (its lines): a.ts 908 (120), ...". */
@@ -100,7 +100,7 @@ export function laidOut(text) {
100
100
  /** The model's text for `text`, longer than `clip` characters: the filed text's first lines, whole, within `clip`, then
101
101
  * a note naming the file (`<folder>/<stem>.txt`, or `.json` for JSON) and the read offset that goes on. A file that
102
102
  * cannot be written still answers its start, saying why in the Workspace's words (never an error's message, which
103
- * names paths). `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
103
+ * names paths), a Workspace that cannot be opened (`work` a thunk that rejects) too. `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
104
104
  export async function filedAnswer(work, folder, stem, text, clip) {
105
105
  const filed = fileable(text);
106
106
  const lines = filed.text.split("\n");
@@ -120,7 +120,7 @@ export async function filedAnswer(work, folder, stem, text, clip) {
120
120
  const cut = `\n[cut at line ${shown} of ${total} (${head.length} of ${filed.text.length} characters${how.length ? `; ${how.join("; ")}` : ""}); `;
121
121
  const path = `${folder}/${stem}.${filed.json ? "json" : "txt"}`;
122
122
  try {
123
- await (typeof work === "function" ? work() : work).write(path, filed.text);
123
+ await (await (typeof work === "function" ? work() : work)).write(path, filed.text);
124
124
  }
125
125
  catch (error) {
126
126
  return `${head}${cut}the whole answer could not be saved (${workspaceErrorWords(error) ?? error?.code ?? "write failed"})]`;
@@ -0,0 +1,32 @@
1
+ import type { InputIssue } from "./errors.js";
2
+ /** A tool's file setting: the folder of the run's files its answers are filed in, and the paths of each answer the
3
+ * tool's result shows. */
4
+ export type FileSetting = {
5
+ folder: string;
6
+ show: string[];
7
+ };
8
+ /** The most show paths, and the most segments of one. */
9
+ export declare const MAX_SHOW_PATHS = 8;
10
+ export declare const MAX_SHOW_SEGMENTS = 6;
11
+ /** The longest shown string, in characters. */
12
+ export declare const SHOWN_CHARS = 200;
13
+ /** The issues of `given` as a file setting, its fields under `at`: none when it is one. */
14
+ export declare function fileIssues(given: unknown, at: string): InputIssue[];
15
+ /** A stored file setting that does not read (a rule tightened since it was written, a runner older than the server that
16
+ * wrote it): every call of its tool is refused, never answered unfiled (mcp-gateway.ts unsendable). */
17
+ export declare const UNREADABLE = "unreadable";
18
+ /** The file setting of `server`'s `tool` in an agent's tool settings as its revision keeps them (body.toolSettings):
19
+ * undefined when it has none (the tool answers the model as it always has), UNREADABLE when it has one that does not
20
+ * read. */
21
+ export declare function filedBy(toolSettings: unknown): (server: string, tool: string) => FileSetting | typeof UNREADABLE | undefined;
22
+ /** The value at `path` in `value`, as the model reads it: a scalar (a string cut at SHOWN_CHARS, … marking the cut),
23
+ * else null (absent, or an object or array). */
24
+ export declare function shownAt(value: unknown, path: string): string | number | boolean | null;
25
+ /** `value`'s shape: types, each array's length and what it holds, an object's keys that are short names while `depth`
26
+ * is under 2 (the rest counted); never a value. */
27
+ export declare function shapeOf(value: unknown, depth?: number): string;
28
+ /** The tool's result for an answer filed at `path` (in the run's files): its bytes, where it is, the values `show`
29
+ * names, and its shape. */
30
+ export declare function filedSummary(tool: string, text: string, path: string, show: readonly string[]): string;
31
+ /** The model's text when an answer could not be filed: none of it, the Workspace's words why. */
32
+ export declare const unfiledSummary: (tool: string, text: string, folder: string, why: string) => string;
@@ -0,0 +1,122 @@
1
+ /** The most show paths, and the most segments of one. */
2
+ export const MAX_SHOW_PATHS = 8;
3
+ export const MAX_SHOW_SEGMENTS = 6;
4
+ /** The longest shown string, in characters. */
5
+ export const SHOWN_CHARS = 200;
6
+ /** A folder segment: no dot first (no `..`, no hidden folder), nothing that names another place. */
7
+ const FOLDER_SEGMENT = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/;
8
+ /** A show path's segment: a key's name, an array's index, or -1 (its last item). */
9
+ const SHOW_SEGMENT = /^(?:[A-Za-z_$][A-Za-z0-9_$-]{0,63}|0|[1-9][0-9]{0,8}|-1)$/;
10
+ const FOLDER_WORDS = "1 to 3 segments joined by /, each letters, digits, _, - or . and never starting with a dot (no .., no hidden folder)";
11
+ const PATH_WORDS = `a path of 1 to ${MAX_SHOW_SEGMENTS} segments joined by ., each a key (a letter, _ or $ first), an index (0, 1, ...) or -1 (the last item)`;
12
+ const isPlain = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
13
+ /** The issues of `given` as a file setting, its fields under `at`: none when it is one. */
14
+ export function fileIssues(given, at) {
15
+ if (!isPlain(given) || Object.keys(given).some((key) => key !== "folder" && key !== "show") || given.folder === undefined || given.show === undefined) {
16
+ return [{ field: at, reason: "wrong_type", message: `${at} is {folder, show}: the folder of the run's files each answer of the tool is filed in, whole, and the paths of it the tool's result shows (at most ${MAX_SHOW_PATHS}); the result shows no other value of it` }];
17
+ }
18
+ const issues = [];
19
+ const folder = given.folder;
20
+ const segments = typeof folder === "string" ? folder.split("/") : [];
21
+ if (!(segments.length >= 1 && segments.length <= 3 && segments.every((segment) => FOLDER_SEGMENT.test(segment))))
22
+ issues.push({ field: `${at}.folder`, reason: "not_an_option", message: `${at}.folder is a folder in the run's files: ${FOLDER_WORDS}` });
23
+ const show = given.show;
24
+ if (!Array.isArray(show) || show.length > MAX_SHOW_PATHS) {
25
+ issues.push({ field: `${at}.show`, reason: "not_an_option", message: `${at}.show is a list of at most ${MAX_SHOW_PATHS} paths, each ${PATH_WORDS}` });
26
+ return issues;
27
+ }
28
+ show.forEach((path, i) => {
29
+ const parts = typeof path === "string" ? path.split(".") : [];
30
+ if (!(parts.length >= 1 && parts.length <= MAX_SHOW_SEGMENTS && parts.every((part) => SHOW_SEGMENT.test(part))))
31
+ issues.push({ field: `${at}.show[${i}]`, reason: "not_an_option", message: `${at}.show[${i}] ${JSON.stringify(path)} is ${PATH_WORDS}` });
32
+ });
33
+ const twice = show.find((path, i) => show.indexOf(path) !== i);
34
+ if (twice !== undefined)
35
+ issues.push({ field: `${at}.show`, reason: "not_an_option", message: `${at}.show names ${String(twice)} twice` });
36
+ return issues;
37
+ }
38
+ /** A stored file setting that does not read (a rule tightened since it was written, a runner older than the server that
39
+ * wrote it): every call of its tool is refused, never answered unfiled (mcp-gateway.ts unsendable). */
40
+ export const UNREADABLE = "unreadable";
41
+ /** The file setting of `server`'s `tool` in an agent's tool settings as its revision keeps them (body.toolSettings):
42
+ * undefined when it has none (the tool answers the model as it always has), UNREADABLE when it has one that does not
43
+ * read. */
44
+ export function filedBy(toolSettings) {
45
+ return (server, tool) => {
46
+ const key = `mcp:${server}/${tool}`;
47
+ const setting = isPlain(toolSettings) && Object.hasOwn(toolSettings, key) ? toolSettings[key] : undefined;
48
+ const file = isPlain(setting) ? setting.file : undefined;
49
+ if (file === undefined)
50
+ return undefined;
51
+ if (fileIssues(file, "file").length)
52
+ return UNREADABLE;
53
+ const { folder, show } = file;
54
+ return { folder, show: [...show] };
55
+ };
56
+ }
57
+ /** The value at `path` in `value`, as the model reads it: a scalar (a string cut at SHOWN_CHARS, … marking the cut),
58
+ * else null (absent, or an object or array). */
59
+ export function shownAt(value, path) {
60
+ let at = value;
61
+ for (const part of path.split(".")) {
62
+ if (Array.isArray(at))
63
+ at = part === "-1" ? at[at.length - 1] : /^\d+$/.test(part) ? at[Number(part)] : undefined;
64
+ else if (isPlain(at))
65
+ at = Object.hasOwn(at, part) ? at[part] : undefined;
66
+ else
67
+ at = undefined;
68
+ }
69
+ if (typeof at === "string") {
70
+ const chars = Array.from(at);
71
+ return chars.length > SHOWN_CHARS ? `${chars.slice(0, SHOWN_CHARS).join("")}…` : at;
72
+ }
73
+ return typeof at === "number" || typeof at === "boolean" ? at : null;
74
+ }
75
+ /** The most keys of one object the shape names, and the longest shape. */
76
+ const SHAPE_KEYS = 40;
77
+ const SHAPE_CHARS = 2_000;
78
+ /** A key the shape names: a short name. Any other key (an email, a person's name, an id) can be data, so it is counted,
79
+ * never named. */
80
+ const SHAPE_KEY = /^[A-Za-z_][A-Za-z0-9_]{0,31}$/;
81
+ /** `value`'s shape: types, each array's length and what it holds, an object's keys that are short names while `depth`
82
+ * is under 2 (the rest counted); never a value. */
83
+ export function shapeOf(value, depth = 0) {
84
+ if (value === null)
85
+ return "null";
86
+ if (Array.isArray(value)) {
87
+ const kinds = new Set(value.map((item) => (item === null ? "null" : Array.isArray(item) ? "array" : typeof item)));
88
+ const kind = kinds.size === 1 ? [...kinds][0] : "item";
89
+ return `[${value.length} ${kind}${value.length === 1 ? "" : "s"}]`;
90
+ }
91
+ if (isPlain(value)) {
92
+ if (depth >= 2)
93
+ return "object";
94
+ const keys = Object.keys(value);
95
+ const named = keys.filter((key) => SHAPE_KEY.test(key)).slice(0, SHAPE_KEYS).map((key) => `${JSON.stringify(key)}: ${shapeOf(value[key], depth + 1)}`);
96
+ const rest = keys.length - named.length;
97
+ const counted = rest ? `… ${rest} ${named.length ? "more " : ""}key${rest === 1 ? "" : "s"}` : "";
98
+ return `{${[...named, ...(counted ? [counted] : [])].join(", ")}}`;
99
+ }
100
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? typeof value : "unknown";
101
+ }
102
+ /** The tool's result for an answer filed at `path` (in the run's files): its bytes, where it is, the values `show`
103
+ * names, and its shape. */
104
+ export function filedSummary(tool, text, path, show) {
105
+ let value;
106
+ let json = true;
107
+ try {
108
+ value = JSON.parse(text);
109
+ }
110
+ catch {
111
+ json = false;
112
+ }
113
+ const shown = `{${show.map((one) => `${JSON.stringify(one)}: ${JSON.stringify(json ? shownAt(value, one) : null)}`).join(", ")}}`;
114
+ const shape = json ? shapeOf(value) : "text, not JSON";
115
+ return [
116
+ `${tool} answered ${Buffer.byteLength(text, "utf8").toLocaleString("en-US")} bytes, filed whole at ${path} for the skill's code; its values are not shown here (the agent's setting files this tool's answers); only these are:`,
117
+ shown,
118
+ `Shape: ${shape.length > SHAPE_CHARS ? `${shape.slice(0, SHAPE_CHARS)}…` : shape}`,
119
+ ].join("\n");
120
+ }
121
+ /** The model's text when an answer could not be filed: none of it, the Workspace's words why. */
122
+ export const unfiledSummary = (tool, text, folder, why) => `${tool} answered ${Buffer.byteLength(text, "utf8").toLocaleString("en-US")} bytes, which could not be filed in ${folder}/ (${why}). The agent's setting files this tool's answers, so none of it is shown here.`;
@@ -2,10 +2,12 @@
2
2
  export declare const LABEL_SHOWN = 200;
3
3
  export declare const ERROR_SHOWN = 2000;
4
4
  export type PartKind = "nodes" | "decision" | "effect";
5
- /** `value`, a part of a graph view of `kind`, as the graph serves it with `values` held: each string and number by
6
- * redactedOutput, then a map item's label cut at LABEL_SHOWN and an error at ERROR_SHOWN. A text stored cut (a
7
- * decision's state past 64 KB, an error marked cut, or one of exactly ERROR_CUT_BEFORE characters from before) has its
8
- * last 6 times the longest held value plus 16 characters held back, where a value the stored cut split would sit. */
5
+ /** `value`, a part of a graph view of `kind`, as the graph serves it with `values` held: read whole first, so a held
6
+ * value split across two of its fields withholds the part as "[redacted]", then each string and number by
7
+ * redactedOutput (redactedOutputWhole); then a map item's label cut at LABEL_SHOWN and an error at ERROR_SHOWN. A text
8
+ * stored cut (a decision's state past 64 KB, an error marked cut, or one of exactly ERROR_CUT_BEFORE characters from
9
+ * before) has its last 6 times the longest held value plus 16 characters held back, where a value the stored cut split
10
+ * would sit. */
9
11
  export declare function servedPart(kind: PartKind, value: unknown, values: readonly string[]): unknown;
10
12
  /** How many walks servedGraphView made, by what it walked: a part (servedPart over the nodes, a decision or a call) or a
11
13
  * field of the rest (redactedOutput over one top-level field). Counted for the tests, which read that a read again walks
@@ -18,7 +20,10 @@ export declare const graphWalks: {
18
20
  * over the same values), the parts by the file path's rule on top:
19
21
  * - its nodes, each decision and each call through servedPart (a map item's label and an error cut short after);
20
22
  * - every other top-level field (its run, its workflow, its structure `graph`, which echoes the workflow's nodes and their
21
- * words, its totals, and any field added later) through redactedOutput, each by itself, its keys included;
23
+ * words, its totals, and any field added later) through redactedOutputWhole, each by itself, its keys included: a
24
+ * field whose JSON holds a held value split across two of its strings is "[redacted]", but for `graph` and `run`,
25
+ * each served in its own shape (IN_SHAPE), so every reader that draws the run still reads a graph's nodes and edges
26
+ * and the run's status;
22
27
  * - `read_at`, which moves with every read: the server's clock as toISOString writes it, served as it is, never kept;
23
28
  * anything else under the name is cut each read.
24
29
  * Each part and each field, its name and its value, scalar or not, is cut once per content and held set and kept in
@@ -1,20 +1,22 @@
1
1
  // What GET /runs/{id}/graph serves of each part of a run's graph (servedGraphView, below): redacted by a run's answer's rule
2
- // (key-refusal.ts redactedOutput, over the values the server holds and handed the run), and only then cut. graph-view.ts
3
- // makes the view whole, so a key saved after it was made, or kept for a busy store's read, is still found.
2
+ // (key-refusal.ts redactedOutputWhole, over the values the server holds and handed the run), and only then cut.
3
+ // graph-view.ts makes the view whole, so a key saved after it was made, or kept for a busy store's read, is still found.
4
4
  import { createHash } from "node:crypto";
5
- import { redactedOutput } from "./key-refusal.js";
5
+ import { redactedOutput, redactedOutputWhole } from "./key-refusal.js";
6
6
  /** The most of a map item's label and of an error (a call's, a decision's) the graph shows. */
7
7
  export const LABEL_SHOWN = 200;
8
8
  export const ERROR_SHOWN = 2000;
9
9
  /** Where an error was cut when it was stored, before errors were stored whole: one this long may have been cut there. */
10
10
  const ERROR_CUT_BEFORE = 2000;
11
11
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
12
- /** `value`, a part of a graph view of `kind`, as the graph serves it with `values` held: each string and number by
13
- * redactedOutput, then a map item's label cut at LABEL_SHOWN and an error at ERROR_SHOWN. A text stored cut (a
14
- * decision's state past 64 KB, an error marked cut, or one of exactly ERROR_CUT_BEFORE characters from before) has its
15
- * last 6 times the longest held value plus 16 characters held back, where a value the stored cut split would sit. */
12
+ /** `value`, a part of a graph view of `kind`, as the graph serves it with `values` held: read whole first, so a held
13
+ * value split across two of its fields withholds the part as "[redacted]", then each string and number by
14
+ * redactedOutput (redactedOutputWhole); then a map item's label cut at LABEL_SHOWN and an error at ERROR_SHOWN. A text
15
+ * stored cut (a decision's state past 64 KB, an error marked cut, or one of exactly ERROR_CUT_BEFORE characters from
16
+ * before) has its last 6 times the longest held value plus 16 characters held back, where a value the stored cut split
17
+ * would sit. */
16
18
  export function servedPart(kind, value, values) {
17
- const shown = redactedOutput(value, values);
19
+ const shown = redactedOutputWhole(value, values);
18
20
  if (!isRecord(shown))
19
21
  return shown;
20
22
  const hold = 6 * values.reduce((most, held) => Math.max(most, held.length), 0) + 16;
@@ -38,13 +40,35 @@ export function servedPart(kind, value, values) {
38
40
  * nothing, with no clock. */
39
41
  export const graphWalks = { part: 0, rest: 0 };
40
42
  const isRecordOrArray = (value) => typeof value === "object" && value !== null;
43
+ /** The graph's structure (`graph`) when its JSON holds a held value split across two of its strings (a question's
44
+ * instructions ending with the value's head and its first option starting with the rest): the shape the contract gives
45
+ * the field, no nodes and no edges, and `withheld`, so a reader draws nothing and can say why. */
46
+ const WITHHELD_GRAPH = { nodes: [], edges: [], withheld: true };
47
+ /** The run's facts (`run`) when their JSON holds a held value split across two of them (its agent and its revision): the
48
+ * facts the server makes itself, which carry no one's words (its id, status, pause and times), each still cut as any
49
+ * string is, the agent and the revision "[redacted]", and `withheld`. */
50
+ const withheldRun = (run, values) => ({
51
+ ...Object.fromEntries(["id", "status", "paused", "startedAt", "endedAt"].filter((key) => key in run).map((key) => [key, redactedOutput(run[key], values)])),
52
+ agent: "[redacted]",
53
+ revision: "[redacted]",
54
+ withheld: true,
55
+ });
56
+ /** The top-level fields served in their own shape when withheld whole, by name: what a reader of the graph reads at once
57
+ * (the console draws the graph's nodes and reads the run's status). Any other field withheld whole is "[redacted]". */
58
+ const IN_SHAPE = {
59
+ graph: () => ({ ...WITHHELD_GRAPH }),
60
+ run: withheldRun,
61
+ };
41
62
  /** A time as Date's toISOString writes it, and nothing else: digits, its fixed separators and Z. */
42
63
  const ISO_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
43
64
  /** A graph view as GET /runs/{id}/graph serves it with `values` held, every field of it cut by the one rule (redactedOutput
44
65
  * over the same values), the parts by the file path's rule on top:
45
66
  * - its nodes, each decision and each call through servedPart (a map item's label and an error cut short after);
46
67
  * - every other top-level field (its run, its workflow, its structure `graph`, which echoes the workflow's nodes and their
47
- * words, its totals, and any field added later) through redactedOutput, each by itself, its keys included;
68
+ * words, its totals, and any field added later) through redactedOutputWhole, each by itself, its keys included: a
69
+ * field whose JSON holds a held value split across two of its strings is "[redacted]", but for `graph` and `run`,
70
+ * each served in its own shape (IN_SHAPE), so every reader that draws the run still reads a graph's nodes and edges
71
+ * and the run's status;
48
72
  * - `read_at`, which moves with every read: the server's clock as toISOString writes it, served as it is, never kept;
49
73
  * anything else under the name is cut each read.
50
74
  * Each part and each field, its name and its value, scalar or not, is cut once per content and held set and kept in
@@ -69,7 +93,13 @@ export function servedGraphView(view, values, cache) {
69
93
  // A field's name and its value, scalar or not, each cut once per content and held set: a poll walks none again.
70
94
  // (graphWalks.rest counts the walks of a field that holds more than one value, as before.)
71
95
  const cutName = kept(`name:${keys}:${digest(name)}`, () => redactedOutput(name, values));
72
- fields[cutName] = kept(`field:${keys}:${digest(name)}:${digest(value)}`, () => (isRecordOrArray(value) && graphWalks.rest++, redactedOutput(value, values)));
96
+ fields[cutName] = kept(`field:${keys}:${digest(name)}:${digest(value)}`, () => {
97
+ if (isRecordOrArray(value))
98
+ graphWalks.rest++;
99
+ const cut = redactedOutputWhole(value, values);
100
+ const shape = Object.hasOwn(IN_SHAPE, name) ? IN_SHAPE[name] : undefined;
101
+ return shape && isRecord(value) && cut === "[redacted]" ? shape(value, values) : cut;
102
+ });
73
103
  }
74
104
  return {
75
105
  // The read's own time, the server's clock as toISOString writes it, holds nothing of the run: served as it is. Any other
@@ -12,6 +12,7 @@ import { ServerSecrets } from "./server-secrets.js";
12
12
  import { sealedAt, unsealColumn } from "./store/seal.js";
13
13
  import { handedMark, handedPointers } from "./run-view.js";
14
14
  import { readLaunchBody } from "./run-launch.js";
15
+ import { SIGN_IN_VENDORS } from "./sign-ins-store.js";
15
16
  import { StoreLaunchMissing } from "./store/store.js";
16
17
  import { keptVendor } from "./tool-plane.js";
17
18
  /** The run's launch body read back, or undefined when it has none (an old run, or one not started with one). */
@@ -148,8 +149,6 @@ export function cutHanded(value, values) {
148
149
  };
149
150
  return walk(value);
150
151
  }
151
- /** The browser vendors that keep a sign-in (sign-ins-store.ts vendorOf). */
152
- const SIGN_IN_VENDORS = ["browserbase", "kernel"];
153
152
  /** Why what an agent learned is withheld (403): a pointer of its sign-in can't be read here, so the cut would be shorter
154
153
  * than what a note may hold. */
155
154
  export const WITHHELD_LEARNING = "This server can't read the agent's browser sign-in (its seal key changed or is missing, or the sign-in is damaged), so what it learned is not shown.";
@@ -12,7 +12,8 @@ export interface HarnessCheckOptions {
12
12
  /** The most the check may spend, USD. */
13
13
  capUsd?: number;
14
14
  platform?: string;
15
- /** For tests: the fetch the model proxy forwards with. */
15
+ /** For tests: the network the model proxy forwards to, under the check's recorder. A model the route translates goes
16
+ * through the route's own fetch instead, as on a server. */
16
17
  fetch?: typeof fetch;
17
18
  /** Each step as it happens, a line of words. */
18
19
  say?: (line: string) => void;
@@ -8,8 +8,9 @@
8
8
  // provider sees only the turns' Messages requests; anything it reaches for beyond loopback goes to the check's own
9
9
  // proxy, which refuses and lists it).
10
10
  // Stage 3, live: the agent is killed (SIGKILL) after a turn and the next turn resumes it (its own session/load, or a
11
- // fresh session told the conversation), a denied call never runs, one of our tools runs over MCP, and another runner
12
- // with its own directory picks the session up from the records.
11
+ // fresh session told the conversation), a denied call never runs, one of our tools runs over MCP without the agent
12
+ // asking permission for it (unless its recipe declares the title tie), and another runner with its own directory
13
+ // picks the session up from the records.
13
14
  // It prints the three facts a harness row carries: resume (load | restart), tool_gate (permission | config: whether the
14
15
  // agent asks before a tool call) and billing (proxy | plan).
15
16
  // The check spends: four short turns on the run's model, under a cap (default $0.25).
@@ -179,25 +180,44 @@ async function checkRun(options, held) {
179
180
  return refuse("HARNESS_CHECK_USAGE", `${recipe.label} is billed through the proxy: name the run's model with --model provider/model-id (openrouter/anthropic/claude-haiku-4.5, anthropic/claude-haiku-4-5)`);
180
181
  needs = { model: ref, models: await providerModels(env) };
181
182
  }
182
- // The session: the check's tools, its gate, its egress proxy, the recording fetch.
183
+ // The session: the check's tools, its gate, its egress proxy, its recorder.
183
184
  const nonce = randomBytes(6).toString("hex");
184
185
  const echoed = [];
185
186
  const deniedRan = [];
186
187
  const tools = [
187
- { name: "check_echo", description: "Echo the text back, prefixed with ECHO.", inputSchema: { type: "object", properties: { text: { type: "string" } }, required: ["text"] }, replay: "never", call: async (args) => (echoed.push(args), { text: `ECHO:${args?.text ?? ""}` }) },
188
+ // A path beside the text: Goose 1.59.2 titles a call whose arguments hold one with a summary of it (` · proof.txt`), so
189
+ // each release's title form for such a call runs here, and the adapter ties nothing to it.
190
+ { name: "check_echo", description: "Echo the text back, prefixed with ECHO.", inputSchema: { type: "object", properties: { text: { type: "string" }, path: { type: "string", description: "A file name to echo beside it." } }, required: ["text"] }, replay: "never", call: async (args) => (echoed.push(args), { text: `ECHO:${args?.text ?? ""}` }) },
188
191
  { name: "check_denied", description: "A tool this run refuses: calling it shows the refusal.", inputSchema: { type: "object", properties: { text: { type: "string" } }, required: ["text"] }, replay: "never", call: async (args) => (deniedRan.push(args), { text: "this call should never have run" }) },
189
192
  ];
190
193
  // The gate allows check_echo alone. Everything else is denied, the agent's own calls (`acp_<kind>`) included, as a
191
- // server's gate answers them: a call of ours whose title the adapter can't tie is one of those, so it fails mcp_tool.
194
+ // server's gate answers them: a permission request for a call of ours, on a recipe with no title tie or one whose title
195
+ // the adapter can't tie, is one of those: refused, so mcp_tool fails (on calls 0, or on ourAsks where the agent runs it
196
+ // anyway), and the row counts it in ourAsks either way.
192
197
  const gateAsked = [];
198
+ // The ids of check_echo's MCP calls, as the gate got them: the agent's announced toolCallId where the adapter matched
199
+ // the call to one. A permission request under one of these ids was for our tool.
200
+ const echoIds = new Set();
201
+ // The agent's toolCallIds (the gate call's args carry each) of the permission requests (`acp_<kind>`) whose input's
202
+ // `text` is the nonce, as check_echo's text argument is: requests for our tool by its arguments, as the adapter
203
+ // matches a call to its MCP call (CallIds), never by a title. The nonce is new for each check. Its `text` field and not
204
+ // anywhere in the input: an agent may write the nonce into proof.txt with an editor of its own (Goose's
205
+ // developer__text_editor, `file_text`), and Goose asks with kind "other" for every call, so the kind can't tell the
206
+ // two apart. This catches a request the gate refused and the agent never ran, which no check_echo id ever names.
207
+ const nonceToolCallIds = new Set();
193
208
  const gate = async (call) => {
194
209
  const answer = call.tool === "check_echo" ? "allow" : "deny";
210
+ if (call.tool === "check_echo")
211
+ echoIds.add(call.callId);
212
+ else if (call.tool.startsWith("acp_") && call.args?.input?.text === nonce && typeof call.args?.toolCallId === "string")
213
+ nonceToolCallIds.add(call.args.toolCallId);
195
214
  gateAsked.push({ tool: call.tool, answer });
196
215
  return answer === "allow" ? "allow" : { deny: "harness-check refuses this call on purpose" };
197
216
  };
198
217
  const forwarded = [];
199
- const forward = options.fetch ?? fetch;
200
- const recording = async (input, init) => {
218
+ // The recorder wraps the hop the proxy forwards with: the route's own fetch for a model it translates (an Ollama
219
+ // model), else the network (options.fetch in tests). So a check on such a model runs the route a server's run takes.
220
+ const record = (next) => async (input, init) => {
201
221
  const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url);
202
222
  const text = bodyText(init?.body);
203
223
  let toolNames = [];
@@ -209,7 +229,7 @@ async function checkRun(options, held) {
209
229
  // Not JSON: no tools.
210
230
  }
211
231
  forwarded.push({ method: init?.method ?? "GET", path: url.pathname, tools: toolNames, text });
212
- return forward(input, init);
232
+ return (next ?? options.fetch ?? fetch)(input, init);
213
233
  };
214
234
  const logs = [];
215
235
  const log = (message, fields) => void logs.push({ message, ...(fields ?? {}) });
@@ -239,8 +259,8 @@ async function checkRun(options, held) {
239
259
  starts += 1;
240
260
  };
241
261
  // The recipe's entry as a server builds it (harness-recipe-entry.ts), on this check's route, log, variables (its egress
242
- // proxy) and recording fetch.
243
- const entry = recipeEntryOf({ recipe, binary, release, route: () => route, beforeStart, vars: () => childVars, fetch: recording, log });
262
+ // proxy) and recorder.
263
+ const entry = recipeEntryOf({ recipe, binary, release, route: () => route, beforeStart, vars: () => childVars, record, log });
244
264
  const planNeeds = { model: { provider: recipe.id, modelId: planModel ?? "default" }, models: { getModel: () => undefined } };
245
265
  const adapterFor = async () => entry.adapter(hostEnv, needs ?? planNeeds);
246
266
  // The first runner's adapter is made before any turn, so a model this server can't run is refused before the agent
@@ -304,12 +324,25 @@ async function checkRun(options, held) {
304
324
  // Turn 1: one of our tools over MCP.
305
325
  say(`${recipe.label}: turn 1, a call of our check_echo tool over MCP`);
306
326
  const first = await sessionOn(join(work, "runner-a"));
307
- const t1 = await first.turn(`Use the check_echo tool once, with the text argument set to ${nonce}. Then reply with exactly what it returned and nothing else.`);
327
+ const t1 = await first.turn(`Use the check_echo tool once, with the text argument set to ${nonce} and the path argument set to proof.txt. Then reply with exactly what it returned and nothing else.`);
328
+ // The permissions the agent asked for in turn 1 (permissionAsks), and of those the ones for our tool (ourAsks), each
329
+ // counted once: a request whose toolCallId is the id a check_echo MCP call reached the gate under, or one whose gate
330
+ // question's input carried check_echo's nonce as its text (nonceToolCallIds, by the toolCallId its args carry).
331
+ // Matched by id and arguments, never by title. The adapter answers a request for our tool only where
332
+ // the recipe declares the title tie (quirks.permissionTie, Cursor's); any other agent must ask nothing for our tools
333
+ // (an allowFile, Goose's), since the server's gate asks at the MCP call. Any other request is the agent's own call:
334
+ // the gate denied it and lists it (gate.permissionsAsked), and it fails no stage.
335
+ const turnAsks = asked();
336
+ const permissionAsks = turnAsks.length;
337
+ const ourIds = new Set([...echoIds, ...nonceToolCallIds]);
338
+ const ourAsks = turnAsks.filter((l) => typeof l.toolCallId === "string" && ourIds.has(l.toolCallId)).length;
339
+ const tied = recipe.quirks.permissionTie === "title";
340
+ const askedProblem = ourAsks > 0 && !tied ? `the agent asked permission for our tool ${ourAsks} time(s) (a request under the id of a check_echo call, or with check_echo's arguments): its recipe needs an allowFile in the form the agent reads, so it runs our tools unasked, or the title tie (quirks.permissionTie) when the agent asks for every MCP call whatever its config says` : undefined;
308
341
  const firstOpen = opened()[0];
309
342
  // The environment while the agent runs.
310
343
  const environ = firstOpen?.pid ? environOf(firstOpen.pid) : undefined;
311
344
  const echoReached = messages().some((r) => r.text.includes(`ECHO:${nonce}`));
312
- stage3.mcp_tool = { ok: t1.status === "completed" && echoed.length >= 1 && (recipe.model.billing !== "proxy" || echoReached), turn: t1.status, ...(t1.error ? { error: t1.error } : {}), calls: echoed.length, resultReachedModel: recipe.model.billing === "proxy" ? echoReached : null };
345
+ stage3.mcp_tool = { ok: t1.status === "completed" && echoed.length >= 1 && (recipe.model.billing !== "proxy" || echoReached) && !askedProblem, turn: t1.status, ...(t1.error ? { error: t1.error } : {}), calls: echoed.length, resultReachedModel: recipe.model.billing === "proxy" ? echoReached : null, permissionAsks, ourAsks, ...(askedProblem ? { problem: askedProblem } : {}) };
313
346
  // Stage 2: the tools the agent offered its model on its first request. The proxy refuses a request that offers a tool
314
347
  // its policy does not allow, so one that reached the provider at all passed that rule: the stage is whether one did.
315
348
  // Its refusals are listed beside it, never counted: a port watcher's GET / is refused too.
@@ -114,8 +114,7 @@ export declare class HarnessKeysOverStore {
114
114
  private kept;
115
115
  /** GET: `recipe`'s keys, each by name, whether saved for it and when it changed, and those to enter again: never a value. */
116
116
  view(recipe: PlanRecipe): HarnessKeysView;
117
- /** Each id with keys saved whose recipe this server does not name, sorted: capabilities' harness_keys.kept, so the
118
- * console offers the page that removes them. */
117
+ /** Each id with keys saved whose recipe this server does not name, sorted: the page lists them (list), to remove. */
119
118
  unnamed(): string[];
120
119
  /** GET /settings/harness-keys: every plan-billed recipe this server is started with, its keys by name; then each id
121
120
  * with keys saved whose recipe it no longer names (unnamed), its keys kept. */
@@ -248,13 +248,12 @@ export class HarnessKeysOverStore {
248
248
  const entry = this.current.get(row);
249
249
  if (!entry || this.bound(recipe, name))
250
250
  return [];
251
- const why = "unreadable" in entry.opened ? entry.opened.unreadable : "recipe_changed";
251
+ const why = "unreadable" in entry.opened ? entry.opened.unreadable : entry.recipe === undefined ? "not_bound" : "recipe_changed";
252
252
  return [{ name: row, why }];
253
253
  });
254
254
  return { id: recipe.id, label: recipe.label, named: true, keys, kept: this.kept(recipe.id, recipe.keys), ready: this.saved(recipe), reenter };
255
255
  }
256
- /** Each id with keys saved whose recipe this server does not name, sorted: capabilities' harness_keys.kept, so the
257
- * console offers the page that removes them. */
256
+ /** Each id with keys saved whose recipe this server does not name, sorted: the page lists them (list), to remove. */
258
257
  unnamed() {
259
258
  const named = new Set(this.recipes.map((recipe) => recipe.id));
260
259
  return [...new Set([...this.current.keys()].flatMap((row) => rowParts(row)?.harness ?? []))].filter((id) => !named.has(id)).sort();
@@ -313,7 +312,7 @@ export class HarnessKeysOverStore {
313
312
  /** DELETE: `key`'s value for `held`'s harness gone from its runs, kept as a retired row for the cut. A row that does not
314
313
  * open under this server's seal key is removed too, so no claim counts it saved. */
315
314
  async remove(held, key) {
316
- known(held, key);
315
+ known(held, key, true);
317
316
  const row = harnessKeyRow(held.id, key);
318
317
  await this.serial(async () => {
319
318
  const was = this.current.get(row);
@@ -344,10 +343,13 @@ export class HarnessKeysOverStore {
344
343
  this.retired.set(of, list);
345
344
  }
346
345
  }
347
- /** 422 unless `key` is one `recipe` runs on (or, for a DELETE, one kept for it): a key no recipe names is never saved. */
348
- function known(recipe, key) {
349
- if (!recipe.keys.includes(key))
350
- throw invalid([{ field: "key", reason: "not_an_option", message: `${recipe.label} runs on ${recipe.keys.join(", ")}.` }]);
346
+ /** 422 unless `key` is one `recipe` runs on (or, for a DELETE, one it holds): a key no recipe names is never saved. A
347
+ * DELETE's refusal names the keys held, which for an id no recipe names are kept keys, never ones it runs on. */
348
+ function known(recipe, key, remove = false) {
349
+ if (recipe.keys.includes(key))
350
+ return;
351
+ const keys = recipe.keys.join(", ");
352
+ throw invalid([{ field: "key", reason: "not_an_option", message: remove ? `${recipe.label}'s keys are ${keys}.` : `${recipe.label} runs on ${keys}.` }]);
351
353
  }
352
354
  /** What a PUT may save: `body.value`, text of 8 to 1024 bytes with no whitespace or control character, for a key the
353
355
  * recipe names. No message holds the value. */
@@ -17,6 +17,8 @@ export const facts = Object.freeze({
17
17
  thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
18
18
  // OpenCode's model requests carry no provider-hosted tool: no search of its own.
19
19
  ownModel: false,
20
+ // Its proxy forwards with the fetch it is handed: a model the route translates onto its wire runs on it.
21
+ forwardsRoute: true,
20
22
  normalizeModel: (model) => model,
21
23
  // The server is named first, as the other lines name a package beside it: OpenCode's CLI is an optional peer of the
22
24
  // server's own.