@parcha/agentrun-serve 0.1.0-beta.55 → 0.1.0-beta.57

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 (296) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/README.md +228 -45
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +18 -5
  5. package/dist/adapters.js +23 -9
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/answer-json.d.ts +6 -2
  9. package/dist/answer-json.js +22 -4
  10. package/dist/api-keys.d.ts +76 -0
  11. package/dist/api-keys.js +217 -0
  12. package/dist/api-only.d.ts +17 -5
  13. package/dist/api-only.js +36 -8
  14. package/dist/browser-hold.d.ts +23 -0
  15. package/dist/browser-hold.js +48 -0
  16. package/dist/browser-person.d.ts +3 -0
  17. package/dist/browser-person.js +4 -1
  18. package/dist/calendar/tools.js +3 -2
  19. package/dist/chatgpt-plan.d.ts +28 -3
  20. package/dist/chatgpt-plan.js +182 -21
  21. package/dist/claude-login.d.ts +101 -14
  22. package/dist/claude-login.js +232 -49
  23. package/dist/claude-sign-in.d.ts +46 -0
  24. package/dist/claude-sign-in.js +93 -0
  25. package/dist/cli.js +63 -6
  26. package/dist/composio-made.d.ts +4 -0
  27. package/dist/composio-made.js +4 -0
  28. package/dist/composio-preset.d.ts +43 -2
  29. package/dist/composio-preset.js +92 -4
  30. package/dist/computer-held-routes.d.ts +5 -4
  31. package/dist/computer-held-routes.js +29 -8
  32. package/dist/computer-held.d.ts +6 -1
  33. package/dist/computer-held.js +14 -0
  34. package/dist/computer-record.js +4 -2
  35. package/dist/computer-viewer.js +4 -1
  36. package/dist/console/assets/{backend-D5EmB4N3.js → backend-DVhHzJX2.js} +19 -19
  37. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  38. package/dist/console/assets/index-okP-y8PK.js +747 -0
  39. package/dist/console/index.html +2 -2
  40. package/dist/decisions.d.ts +1 -1
  41. package/dist/decisions.js +1 -1
  42. package/dist/docker-host-addresses.d.ts +22 -11
  43. package/dist/docker-host-addresses.js +38 -26
  44. package/dist/env-switch.d.ts +10 -0
  45. package/dist/env-switch.js +33 -2
  46. package/dist/errors.d.ts +1 -0
  47. package/dist/errors.js +2 -0
  48. package/dist/fal-price.d.ts +58 -20
  49. package/dist/fal-price.js +341 -82
  50. package/dist/handed-values.d.ts +43 -1
  51. package/dist/handed-values.js +119 -2
  52. package/dist/harness-archive.d.ts +13 -10
  53. package/dist/harness-archive.js +60 -34
  54. package/dist/harness-check.d.ts +3 -1
  55. package/dist/harness-check.js +25 -46
  56. package/dist/harness-keys.d.ts +73 -27
  57. package/dist/harness-keys.js +194 -61
  58. package/dist/harness-recipe-entry.d.ts +8 -7
  59. package/dist/harness-recipe-entry.js +21 -32
  60. package/dist/harness-recipe.d.ts +38 -25
  61. package/dist/harness-recipe.js +49 -36
  62. package/dist/harness-sign-in.js +12 -23
  63. package/dist/harness-table.d.ts +10 -3
  64. package/dist/harness-table.js +26 -21
  65. package/dist/harness.d.ts +1 -0
  66. package/dist/harness.js +17 -5
  67. package/dist/host-check.d.ts +4 -0
  68. package/dist/host-check.js +4 -0
  69. package/dist/hosted-search.d.ts +1 -1
  70. package/dist/hosted-search.js +1 -2
  71. package/dist/import-worker.d.ts +4 -2
  72. package/dist/import-worker.js +9 -2
  73. package/dist/in-flight.d.ts +26 -0
  74. package/dist/in-flight.js +52 -0
  75. package/dist/key-refusal.d.ts +26 -5
  76. package/dist/key-refusal.js +313 -37
  77. package/dist/learn/secrets.d.ts +31 -11
  78. package/dist/learn/secrets.js +152 -191
  79. package/dist/learning-cost.d.ts +6 -3
  80. package/dist/learning-cost.js +4 -2
  81. package/dist/link-check.js +1 -1
  82. package/dist/llms.txt +2 -2
  83. package/dist/marketplace.d.ts +77 -0
  84. package/dist/marketplace.js +224 -0
  85. package/dist/mcp-api-only-origins.d.ts +30 -0
  86. package/dist/mcp-api-only-origins.js +57 -0
  87. package/dist/mcp-gateway.d.ts +7 -5
  88. package/dist/mcp-gateway.js +9 -12
  89. package/dist/mcp-secret-writes.js +5 -3
  90. package/dist/mcp-servers-store.d.ts +28 -6
  91. package/dist/mcp-servers-store.js +53 -4
  92. package/dist/media-duration.d.ts +3 -0
  93. package/dist/media-duration.js +90 -9
  94. package/dist/model-form.d.ts +5 -4
  95. package/dist/model-form.js +11 -7
  96. package/dist/model.d.ts +5 -2
  97. package/dist/model.js +9 -5
  98. package/dist/ollama-provider.d.ts +7 -1
  99. package/dist/ollama-provider.js +14 -2
  100. package/dist/openapi.d.ts +3 -3
  101. package/dist/openapi.js +245 -42
  102. package/dist/otel/genai.d.ts +65 -0
  103. package/dist/otel/genai.js +116 -0
  104. package/dist/otel/tracer.d.ts +55 -0
  105. package/dist/otel/tracer.js +308 -0
  106. package/dist/page.d.ts +2 -0
  107. package/dist/page.js +3 -1
  108. package/dist/paid-calls.d.ts +1 -32
  109. package/dist/paid-calls.js +4 -39
  110. package/dist/place-offers.d.ts +14 -6
  111. package/dist/place-offers.js +26 -13
  112. package/dist/provider.d.ts +9 -0
  113. package/dist/provider.js +50 -3
  114. package/dist/redact/match.d.ts +101 -0
  115. package/dist/redact/match.js +1152 -0
  116. package/dist/refusal-words.d.ts +11 -0
  117. package/dist/refusal-words.js +11 -0
  118. package/dist/run-census.d.ts +67 -0
  119. package/dist/run-census.js +240 -0
  120. package/dist/run-computer.d.ts +6 -3
  121. package/dist/run-computer.js +4 -1
  122. package/dist/run-cut.d.ts +15 -6
  123. package/dist/run-cut.js +30 -9
  124. package/dist/run-files.d.ts +3 -0
  125. package/dist/run-files.js +3 -0
  126. package/dist/run-launch.d.ts +12 -1
  127. package/dist/run-launch.js +9 -10
  128. package/dist/run-learning-served.d.ts +2 -0
  129. package/dist/run-model-key.d.ts +8 -0
  130. package/dist/run-model-key.js +31 -1
  131. package/dist/run-reads-over-store.d.ts +24 -6
  132. package/dist/run-reads-over-store.js +67 -23
  133. package/dist/run-recordings.d.ts +5 -1
  134. package/dist/run-recordings.js +39 -14
  135. package/dist/run-timeline-served.d.ts +3 -1
  136. package/dist/run-timeline-served.js +4 -4
  137. package/dist/run-usage.d.ts +1 -0
  138. package/dist/runnable.d.ts +10 -1
  139. package/dist/runnable.js +20 -8
  140. package/dist/runner/adapter-loop.d.ts +14 -0
  141. package/dist/runner/adapter-loop.js +56 -11
  142. package/dist/runner/adapter-run-spec.d.ts +45 -8
  143. package/dist/runner/adapter-run-spec.js +154 -29
  144. package/dist/runner/adapters/pi.js +25 -3
  145. package/dist/runner/beside.js +11 -6
  146. package/dist/runner/big-writes.js +1 -10
  147. package/dist/runner/claim-secrets.d.ts +18 -3
  148. package/dist/runner/claim-secrets.js +35 -6
  149. package/dist/runner/cli-run-spec.d.ts +6 -0
  150. package/dist/runner/cli-run-spec.js +85 -36
  151. package/dist/runner/computer-journal.d.ts +9 -1
  152. package/dist/runner/computer-journal.js +26 -0
  153. package/dist/runner/conformance/harness.js +1 -1
  154. package/dist/runner/feedback-round.js +3 -0
  155. package/dist/runner/harness-loops.d.ts +6 -5
  156. package/dist/runner/harness-loops.js +7 -7
  157. package/dist/runner/held.d.ts +11 -5
  158. package/dist/runner/journal-kinds.d.ts +5 -0
  159. package/dist/runner/journal-kinds.js +5 -0
  160. package/dist/runner/loop-contract.d.ts +4 -0
  161. package/dist/runner/main.js +15 -6
  162. package/dist/runner/mcp-claim.js +30 -3
  163. package/dist/runner/mcp-run.d.ts +12 -0
  164. package/dist/runner/mcp-run.js +12 -5
  165. package/dist/runner/model-route.d.ts +17 -0
  166. package/dist/runner/model-route.js +120 -2
  167. package/dist/runner/presence.d.ts +4 -3
  168. package/dist/runner/presence.js +4 -2
  169. package/dist/runner/run-child-host.d.ts +5 -0
  170. package/dist/runner/run-child-host.js +71 -30
  171. package/dist/runner/run-child.js +5 -2
  172. package/dist/runner/runner.d.ts +18 -3
  173. package/dist/runner/runner.js +162 -36
  174. package/dist/runner/store-port.d.ts +1 -1
  175. package/dist/runner/store-secrets.d.ts +6 -0
  176. package/dist/runner/store-secrets.js +49 -7
  177. package/dist/runner/subagent.js +4 -40
  178. package/dist/runner/workflow-first.d.ts +11 -4
  179. package/dist/runner/workflow-first.js +14 -8
  180. package/dist/runner/workflow-spec.js +3 -2
  181. package/dist/runs-over-store.d.ts +15 -6
  182. package/dist/runs-over-store.js +33 -21
  183. package/dist/scrub-command.d.ts +73 -0
  184. package/dist/scrub-command.js +307 -0
  185. package/dist/secret-cut.d.ts +73 -0
  186. package/dist/secret-cut.js +291 -4
  187. package/dist/secret-rules.d.ts +143 -0
  188. package/dist/secret-rules.js +2564 -0
  189. package/dist/secrets.d.ts +7 -0
  190. package/dist/secrets.js +20 -0
  191. package/dist/server-keys.d.ts +20 -0
  192. package/dist/server-keys.js +25 -6
  193. package/dist/server.d.ts +57 -13
  194. package/dist/server.js +371 -113
  195. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  196. package/dist/store/dialect.d.ts +3 -0
  197. package/dist/store/dialect.js +1 -0
  198. package/dist/store/index.d.ts +1 -1
  199. package/dist/store/index.js +1 -1
  200. package/dist/store/journal/storage.js +1 -1
  201. package/dist/store/postgres/dialect.js +3 -0
  202. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  203. package/dist/store/schema.d.ts +6 -0
  204. package/dist/store/schema.js +11 -1
  205. package/dist/store/seal.d.ts +6 -1
  206. package/dist/store/seal.js +5 -3
  207. package/dist/store/sqlite/run-launch.d.ts +9 -1
  208. package/dist/store/sqlite/run-launch.js +24 -13
  209. package/dist/store/sqlite/run-patch.d.ts +1 -1
  210. package/dist/store/sqlite/run-patch.js +13 -4
  211. package/dist/store/sqlite/store.js +76 -16
  212. package/dist/store/store.d.ts +53 -3
  213. package/dist/store/store.js +27 -0
  214. package/dist/store-reads/learning.d.ts +6 -3
  215. package/dist/store-reads/learning.js +22 -7
  216. package/dist/store-view.d.ts +3 -0
  217. package/dist/store-view.js +4 -4
  218. package/dist/suggestions.js +3 -2
  219. package/dist/template-eval.d.ts +22 -11
  220. package/dist/template-eval.js +124 -41
  221. package/dist/template-import.d.ts +10 -0
  222. package/dist/template-import.js +16 -7
  223. package/dist/templates.d.ts +10 -2
  224. package/dist/templates.js +28 -8
  225. package/dist/timeline/index.d.ts +1 -1
  226. package/dist/timeline/index.js +1 -1
  227. package/dist/timeline/labels.d.ts +6 -4
  228. package/dist/timeline/labels.js +18 -6
  229. package/dist/timeline/timeline.d.ts +17 -7
  230. package/dist/timeline/timeline.js +28 -14
  231. package/dist/timeline/util.js +1 -1
  232. package/dist/timeline/web-calls.d.ts +26 -9
  233. package/dist/timeline/web-calls.js +124 -37
  234. package/dist/tool-gate.d.ts +42 -3
  235. package/dist/tool-gate.js +69 -6
  236. package/dist/tool-keys-store.d.ts +2 -4
  237. package/dist/tool-keys-store.js +5 -21
  238. package/dist/tool-keys.d.ts +2 -2
  239. package/dist/tool-keys.js +2 -2
  240. package/dist/tool-list.js +1 -1
  241. package/dist/tool-plane.d.ts +2 -2
  242. package/dist/tool-plane.js +35 -33
  243. package/dist/tools.js +13 -7
  244. package/dist/trigger-targets.d.ts +4 -0
  245. package/dist/trigger-targets.js +9 -2
  246. package/dist/triggers.d.ts +67 -4
  247. package/dist/triggers.js +171 -22
  248. package/dist/until.d.ts +3 -0
  249. package/dist/until.js +11 -0
  250. package/dist/validate.js +1 -1
  251. package/dist/web-fake.d.ts +1 -3
  252. package/dist/web-fake.js +7 -18
  253. package/dist/web-fetch.d.ts +6 -72
  254. package/dist/web-fetch.js +11 -265
  255. package/dist/web-run.d.ts +31 -0
  256. package/dist/web-run.js +90 -0
  257. package/dist/web-save.d.ts +6 -4
  258. package/dist/web-save.js +9 -12
  259. package/dist/web-search.d.ts +9 -127
  260. package/dist/web-search.js +23 -259
  261. package/dist/wires.d.ts +13 -0
  262. package/dist/wires.js +11 -0
  263. package/dist/workflow-run.d.ts +5 -4
  264. package/dist/workflow-run.js +5 -4
  265. package/dist/workspace/computer-deps.d.ts +3 -1
  266. package/dist/workspace/computer-deps.js +12 -4
  267. package/dist/workspace/computer-for-claim.d.ts +19 -2
  268. package/dist/workspace/computer-for-claim.js +101 -13
  269. package/dist/workspace/computer-janitor.d.ts +15 -7
  270. package/dist/workspace/computer-janitor.js +33 -8
  271. package/dist/workspace/computer-kept.d.ts +55 -4
  272. package/dist/workspace/computer-kept.js +129 -8
  273. package/dist/workspace/index.d.ts +1 -1
  274. package/dist/workspace/index.js +1 -1
  275. package/dist/workspace/kind-skills.d.ts +4 -0
  276. package/dist/workspace/kind-skills.js +9 -0
  277. package/dist/workspace/run-end-computers.d.ts +5 -1
  278. package/dist/workspace/run-end-computers.js +27 -1
  279. package/dist/workspace/synced-folder.js +3 -4
  280. package/dist/wrapped.d.ts +65 -0
  281. package/dist/wrapped.js +77 -0
  282. package/package.json +17 -11
  283. package/skills/agentrun-serve/SKILL.md +4 -0
  284. package/templates/README.md +38 -15
  285. package/dist/console/assets/index-DUYLaqiR.js +0 -746
  286. package/dist/console/assets/index-DYhU4adm.css +0 -1
  287. package/dist/exa-keyless.d.ts +0 -34
  288. package/dist/exa-keyless.js +0 -118
  289. package/dist/firecrawl-keyless.d.ts +0 -41
  290. package/dist/firecrawl-keyless.js +0 -152
  291. package/dist/keyless-mcp.d.ts +0 -36
  292. package/dist/keyless-mcp.js +0 -127
  293. package/dist/text-urls.d.ts +0 -38
  294. package/dist/text-urls.js +0 -170
  295. package/dist/web-fetch-direct.d.ts +0 -119
  296. package/dist/web-fetch-direct.js +0 -190
@@ -3,10 +3,11 @@ import { cut, firstLine, json, list, obj, scrubUrls, str, where } from "./util.j
3
3
  const labels = new Map();
4
4
  const folds = new Map();
5
5
  const names = new Map();
6
- const saying = new Set();
6
+ const saying = new Map();
7
7
  /** Registers the label of one tool, in the past tense, and with `name` what the tool is called where calls are counted
8
8
  * (a run's analytics). `saysFailure`: the label of a call that errored says so itself ("Could not take a screenshot"),
9
- * so its row adds only why. A host adds its own tools here. */
9
+ * so its row adds only why; `true` for every error, or a test of the errored result for the errors whose label says so.
10
+ * A host adds its own tools here. */
10
11
  export function registerLabel(tool, label, fold, { name, saysFailure } = {}) {
11
12
  labels.set(tool, label);
12
13
  if (fold)
@@ -14,10 +15,11 @@ export function registerLabel(tool, label, fold, { name, saysFailure } = {}) {
14
15
  if (name)
15
16
  names.set(tool, name);
16
17
  if (saysFailure)
17
- saying.add(tool);
18
+ saying.set(tool, saysFailure === true ? () => true : saysFailure);
18
19
  }
19
- /** Whether `tool`'s label says a call that errored failed (registerLabel's saysFailure). */
20
- export const saysFailure = (tool) => saying.has(tool);
20
+ /** Whether `tool`'s label says that its errored call `result` failed (registerLabel's saysFailure). `result` is the one
21
+ * the label was given, so the two read the same text. */
22
+ export const saysFailure = (tool, result) => saying.get(tool)?.(result) === true;
21
23
  /** A remote MCP server's tool, read `<server> · <tool>`: by its catalog name, `mcp:<server>/<tool>`, or by the name the
22
24
  * harnesses call it, `mcp__<server>__<tool>` (a server's name has no `_`; `hands` is a harness's own tools'). A tool whose
23
25
  * `mcp__<server>__<tool>` is too long is called by a hashed name (the server's catalog.ts wireName), which reads as no
@@ -162,8 +164,18 @@ registerLabel("browser_read", (_a, result) => {
162
164
  }, { many: (n) => `Read ${n} pages`, subject: (_input, output) => { const url = output && /^url: (\S+)/m.exec(output)?.[1]; return url ? where(url) : undefined; } }, { name: "Read the browser's page" });
163
165
  registerLabel("snapshot", () => "Looked at the page structure", { many: (n) => `Looked at the page structure ${n} times` }, { name: "Look at the page structure" });
164
166
  registerLabel("screenshot", () => "Took a screenshot", { many: (n) => `Took ${n} screenshots` }, { name: "Take screenshots" });
167
+ /** Whether a browser call errored as the browser's refusal before it ran: pi-browser's typed failure, `code: "refused"`
168
+ * with `effect: "none"` (code sent to a browser that takes only actions, an op it does not take), read by those fields,
169
+ * never by its words. A refusal after some of its actions ran (`effect: "partial"`, a take-over mid-batch) is not one. */
170
+ const browserRefused = (result) => {
171
+ const failure = result?.isError === true ? obj(json(result.text)) : undefined;
172
+ return str(failure?.code) === "refused" && str(failure?.effect) === "none";
173
+ };
165
174
  registerLabel("run", (a, result) => {
166
175
  const goto = GOTO.exec(str(a.code) ?? "")?.[1];
176
+ // Refused before it ran: the row says what the browser refused, never that a page failed to open.
177
+ if (browserRefused(result))
178
+ return str(a.code) === undefined ? "The browser refused the action" : goto ? `The browser refused the code to open ${where(goto)}` : "The browser refused the agent's code";
167
179
  if (goto)
168
180
  return `Opened ${where(goto)}`;
169
181
  const sent = obj(result?.details)?.sent;
@@ -171,7 +183,7 @@ registerLabel("run", (a, result) => {
171
183
  ? sent.flatMap((request) => { const r = obj(request); const [method, url] = [str(r?.method), str(r?.url)]; return method && url ? `${method} ${where(url)}` : []; })
172
184
  : [];
173
185
  return requests.length ? `Acted on the page (${requests.length} request${requests.length === 1 ? "" : "s"} sent: ${list(requests)})` : "Acted on the page";
174
- }, { many: (n) => `Acted on the page ${n} times` }, { name: "Open or act on a page in the browser" });
186
+ }, { many: (n) => `Acted on the page ${n} times` }, { name: "Open or act on a page in the browser", saysFailure: browserRefused });
175
187
  registerLabel("browser_downloads", (_a, result) => {
176
188
  const fetched = result && json(result.text)?.fetched;
177
189
  const names = Array.isArray(fetched) ? fetched.flatMap((file) => str(obj(file)?.name) ?? []) : [];
@@ -95,9 +95,9 @@ export type TimelineEvent = {
95
95
  /** On a `tool_use` row of a timeline read with `calls` (TimelineOptions): the call's arguments, each string as `redact`
96
96
  * makes it where the call is first seen, cut at CAPS.text. */
97
97
  tool_input?: Obj;
98
- /** On a `tool_result` row of a timeline read with `calls`: the head of the call's output, to `calls.result` characters,
99
- * as `calls.redact` makes it, its URLs' query values elided as the preview's are; a web call's every url, its long
100
- * texts cut to fit (CALL_RESULT_CHARS). */
98
+ /** On a `tool_result` row of a timeline read with `calls`: the call's output whole to `calls.result` characters (its
99
+ * head past that), as `calls.redact` makes it, its URLs' query values elided as the preview's are; a web call's every
100
+ * url, its long texts cut to fit (CALL_RESULT_CHARS). */
101
101
  tool_result_text?: string | null;
102
102
  };
103
103
  /** A pi conversation entry as stored: `pi.assistant`, `pi.tool-result`, a host's own kind. */
@@ -125,11 +125,16 @@ export declare const CAPS: {
125
125
  text: number;
126
126
  thinking: number;
127
127
  };
128
- /** The most of a call's output a read for a grader shows (`calls`, tool_result_text): a tool's output's head, still one
129
- * redaction pass of the size an answer's pieces take (key-refusal.ts ANSWER_PIECE). A web call's is not its head: a
128
+ /** The most of a call's output a read for a grader shows (`calls`, tool_result_text): as much as a grader's whole prompt
129
+ * takes (template-eval.ts GRADER_PROMPT_MAX), so a grader judges what the run read, not a head of it; the grader's own
130
+ * fit (fitCalls) shares that room among the calls. The run's redaction reads it in pieces of an answer's size
131
+ * (key-refusal.ts redactedCall), so a long head costs no more a pass than a short one. Past it, a tool's output's head; a
132
+ * web call's is not its head: a
130
133
  * web_search's every result keeps its url, title and published date, and a web_fetch its url and title, their snippets
131
- * and page text cut to fit (web-calls.ts), past this only when its urls alone pass it (25 results, long titles). */
132
- export declare const CALL_RESULT_CHARS = 8000;
134
+ * and page text cut to fit (web-calls.ts), past this only when its urls alone pass it. */
135
+ export declare const CALL_RESULT_CHARS = 120000;
136
+ /** The most rows a `calls=whole` timeline page holds, and its default: each row's result may be CALL_RESULT_CHARS long. */
137
+ export declare const CALLS_PAGE_ROWS = 100;
133
138
  /** A host's marks of a model request: as it leaves (written before it does), and as its stream ends aborted. A request
134
139
  * that answered or failed has a `pi.assistant` entry; one aborted before its first content has none; a start with no
135
140
  * end and no entry is in flight when it is the latest, unless the run is settled, and was cut by a crash when a later
@@ -288,6 +293,11 @@ export type TimelineOptions = {
288
293
  redact?: (text: string) => string;
289
294
  held?: (value: number | bigint) => boolean;
290
295
  };
296
+ /** Whether a text holds a held value no cut in place takes (key-refusal.ts withheldWhole). A web call's output is read
297
+ * through it joined, its JSON's strings as they came (web-calls.ts webHeld), before any of its rows shows any of it: a
298
+ * value split across two of its strings, which `redact` and `calls.redact` never read side by side, withholds the
299
+ * output, so its preview, its summary and a `calls` read's text read "[redacted]". Default: none withheld. */
300
+ holds?: (text: string) => boolean;
291
301
  };
292
302
  /** A tool's calls in a run, and how many failed. */
293
303
  export type ToolMetrics = {
@@ -1,7 +1,7 @@
1
1
  import { BROWSER_OPENERS, BROWSER_STEPS, callFailed, endsTurn, failedWith, inputPreview, labelOf, outcomeOf, refusedLabel, savedPaths, saysFailure } from "./labels.js";
2
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
- import { webShownOf, webWithin } from "./web-calls.js";
4
+ import { webHeld, webShownOf, webWithin } from "./web-calls.js";
5
5
  /** The call a nested call (the kernel's NestedCalls: a script's, tools_call's) was made in, read off its id
6
6
  * (`<callId>/<key>`); undefined for a call the model made itself. */
7
7
  export const nestingCallOf = (callId) => {
@@ -10,11 +10,16 @@ export const nestingCallOf = (callId) => {
10
10
  };
11
11
  /** The base caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
12
12
  export const CAPS = { summary: 500, preview: 500, text: 2000, thinking: 100 };
13
- /** The most of a call's output a read for a grader shows (`calls`, tool_result_text): a tool's output's head, still one
14
- * redaction pass of the size an answer's pieces take (key-refusal.ts ANSWER_PIECE). A web call's is not its head: a
13
+ /** The most of a call's output a read for a grader shows (`calls`, tool_result_text): as much as a grader's whole prompt
14
+ * takes (template-eval.ts GRADER_PROMPT_MAX), so a grader judges what the run read, not a head of it; the grader's own
15
+ * fit (fitCalls) shares that room among the calls. The run's redaction reads it in pieces of an answer's size
16
+ * (key-refusal.ts redactedCall), so a long head costs no more a pass than a short one. Past it, a tool's output's head; a
17
+ * web call's is not its head: a
15
18
  * web_search's every result keeps its url, title and published date, and a web_fetch its url and title, their snippets
16
- * and page text cut to fit (web-calls.ts), past this only when its urls alone pass it (25 results, long titles). */
17
- export const CALL_RESULT_CHARS = 8000;
19
+ * and page text cut to fit (web-calls.ts), past this only when its urls alone pass it. */
20
+ export const CALL_RESULT_CHARS = 120_000;
21
+ /** The most rows a `calls=whole` timeline page holds, and its default: each row's result may be CALL_RESULT_CHARS long. */
22
+ export const CALLS_PAGE_ROWS = 100;
18
23
  /** A host's marks of a model request: as it leaves (written before it does), and as its stream ends aborted. A request
19
24
  * that answered or failed has a `pi.assistant` entry; one aborted before its first content has none; a start with no
20
25
  * end and no entry is in flight when it is the latest, unless the run is settled, and was cut by a crash when a later
@@ -678,9 +683,13 @@ function createProjector(options) {
678
683
  const verdict = /^(\w+): /.exec(text);
679
684
  return verdict ? `${verdict[1]}: ${scrubUrls(firstLine(redactText(text.slice(verdict[0].length))))}` : scrubUrls(firstLine(redactText(text)));
680
685
  };
681
- /** A result as its rows show it: its whole output redacted once, which its label, summary and preview are all taken
682
- * from (resultRow); its details and error flag as they came. */
683
- const shownOf = (view) => options.redact ? { ...view, text: view.text ? options.redact(view.text) : view.text, details: redactValue(view.details) } : view;
686
+ /** A result as its rows show it: its whole output redacted once, or "[redacted]" when it is withheld whole (`withheld`),
687
+ * which its label, summary and preview are all taken from (resultRow); its details and error flag as they came. */
688
+ const shownOf = (tool, view) => withheld(tool, view.text) ? { ...view, text: "[redacted]", details: redactValue(view.details) }
689
+ : options.redact ? { ...view, text: view.text ? options.redact(view.text) : view.text, details: redactValue(view.details) } : view;
690
+ /** Whether a call of `tool`'s output is withheld whole before any row shows it: a web call's strings, read joined
691
+ * (TimelineOptions.holds). */
692
+ const withheld = (tool, text) => (options.holds && text ? webHeld(tool, text, options.holds) : false);
684
693
  const failure = (text) => scrubUrls(firstLine(str(json(text)?.message) ?? diagnosticOf(text) ?? text)) || "no detail";
685
694
  /** Whether a result is a call's refusal before it ran: an error its host marked so in its details (CALL_REFUSED),
686
695
  * read by that field, never by its words. */
@@ -696,13 +705,18 @@ function createProjector(options) {
696
705
  const shown = options.calls ? obj(inputShown(args, caps.text, options.redact, options.calls.held)) : undefined;
697
706
  return shown ? { tool_input: shown } : {};
698
707
  };
699
- /** A call's output as a `calls` read shows it (tool_result_text): redacted by its redactor, else the rows' own, its
700
- * URLs' query values elided, cut at `calls.result`; a web call's every url whole, only its long texts cut (web-calls.ts). */
708
+ /** A call's output as a `calls` read shows it (tool_result_text): redacted by its redactor, else the rows' own, then its
709
+ * URLs' query values elided, cut at `calls.result`; a web call's every url whole, only its long texts cut
710
+ * (web-calls.ts). Every secret check reads the text as it came, never as shown: elided, a URL's query and userinfo are
711
+ * cut apart, and a held value in one no longer reads as itself. The served redactor (redactedCall) elides each piece it
712
+ * read after redacting it, so what it returns is already as shown and the elision here changes nothing in it. */
701
713
  const wholeRedact = options.calls?.redact ?? options.redact;
702
714
  const callShown = (text) => scrubUrls(wholeRedact ? wholeRedact(text) : text);
703
715
  const resultText = (tool, text) => {
704
716
  if (!text)
705
717
  return null;
718
+ if (withheld(tool, text))
719
+ return "[redacted]";
706
720
  const web = webShownOf(tool, text, callShown);
707
721
  return web ? webWithin(web, options.calls.result) : cut(callShown(text), options.calls.result);
708
722
  };
@@ -722,8 +736,8 @@ function createProjector(options) {
722
736
  // ok, and never the detail as it came.
723
737
  const worded = shown.text === view.text ? outcome : outcomeOf(tool.name, { ...view, text: shown.text });
724
738
  // A call refused before it ran is named refused already (refusedLabel), and a computer step's label says it could not
725
- // (saysFailure): its row says why, never that it failed.
726
- const failedSummary = refused(view) || saysFailure(tool.name) ? `${named}: ${failure(shown.text)}` : `${named} failed: ${failure(shown.text)}`;
739
+ // (saysFailure, asked of an error alone, with the text its label read): its row says why, never that it failed.
740
+ const failedSummary = refused(view) || (view.isError && saysFailure(tool.name, { text: shown.text, details: view.details, isError: true })) ? `${named}: ${failure(shown.text)}` : `${named} failed: ${failure(shown.text)}`;
727
741
  // One the run's end closed has no outcome: interrupted, as a call cut off reads (interrupt), with no status.
728
742
  const unended = endedWithRun(view);
729
743
  return make("tool_result", conv, rowId, {
@@ -922,7 +936,7 @@ function createProjector(options) {
922
936
  const call = calls.get(`${conv}:${id}`);
923
937
  const name = call?.name ?? str(message.toolName) ?? "tool";
924
938
  const view = viewOf(message);
925
- const shown = shownOf(view);
939
+ const shown = shownOf(name, view);
926
940
  // A call that failed ended nothing: the agent goes on after it, so a message then is still a steer.
927
941
  ended.set(conv, (previous.get(conv) !== "pi.tool-result" || ended.get(conv) === true) && endsTurn(name) && !view.isError);
928
942
  // One an abort cut did end the turn. A round's results come in as its calls end, so one that ended before the abort
@@ -1070,7 +1084,7 @@ function createProjector(options) {
1070
1084
  const text = typeof output === "string" ? output : output !== undefined ? JSON.stringify(output) : (diagnostic ?? "");
1071
1085
  const failed = result.isError === true;
1072
1086
  const view = { text, details: result.details, isError: failed };
1073
- const shown = shownOf(view);
1087
+ const shown = shownOf(call.name, view);
1074
1088
  const named = nameFor(call.name, call.args, view, shown);
1075
1089
  call.done = true;
1076
1090
  call.use.summary = clean(named, caps.summary);
@@ -1,4 +1,4 @@
1
- import { SCRUBBED_URL, trimmed } from "../text-urls.js";
1
+ import { SCRUBBED_URL, trimmed } from "@parcha/agentrun-web/text-urls";
2
2
  export const obj = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
3
3
  export const str = (value) => (typeof value === "string" ? value : undefined);
4
4
  export const cut = (text, max) => (text.length > max ? `${text.slice(0, max - 3)}...` : text);
@@ -1,17 +1,34 @@
1
1
  /** A web call's output with each text that gives way cut to `keep` characters (a cut one ending "…"), the rest whole. */
2
2
  export type WebShown = (keep: number) => string;
3
- /** `text`, a call of `tool`'s output, with `cut` (the run's redactor) applied to each string of its JSON by itself and to
4
- * the lines after it, never to its JSON line whole: the redactor reads a run of more than 8,192 characters with no
5
- * whitespace as "[redacted]" (key-refusal.ts redactedAnswer), and a JSON line, whose newlines are escapes, is one such
6
- * run from its text's last space through its links, so cut whole it loses its links and no longer parses. Undefined for
7
- * a tool other than web_search and web_fetch, or an output whose first line is not a JSON object: that one is cut as
8
- * any other tool's. */
9
- export declare function webCut(tool: string, text: string, cut: (text: string) => string): string | undefined;
3
+ /** Whether a text holds a held value no cut in place takes (key-refusal.ts withheldWhole): `joined` is `parts` joined
4
+ * by line breaks, for a reader that reads each part by itself too (adapter-run-spec.ts answersCut). */
5
+ export type WebHolds = (joined: string, parts: readonly string[]) => boolean;
6
+ /** Whether `text`, a web call's output, is withheld whole: `holds` (whether a text holds a held value no cut in place
7
+ * takes: key-refusal.ts withheldWhole) reads its JSON's strings as they came joined by line breaks, then the lines after
8
+ * the JSON: once its values alone, so two values side by side in the output are side by side in the join, and once with
9
+ * each property name before its value, so a name and its value are too. Each string is cut on its own wherever the
10
+ * output is shown (webCut, webShownOf), and the JSON's punctuation between two strings is no whitespace any view of the
11
+ * whole text joins across, so a held value split across two of them is found only here. The strings are read in the
12
+ * order the output is written back in (stringsOf: what webCut stores and webShownOf shows), and, where that differs
13
+ * (an integer-like name, a name written twice), in the order the text was written too (writtenStrings: what a row's
14
+ * preview shows of the text as it came). Every reader of a web call's output asks this first: the runner before it
15
+ * stores the answer (adapter-run-spec.ts answersCut), a timeline before its row shows any of it (timeline.ts shownOf,
16
+ * resultText). False for an output that is not a web call's JSON. */
17
+ export declare function webHeld(tool: string, text: string, holds: WebHolds): boolean;
18
+ /** `text`, a call of `tool`'s output, with `cut` (the run's redactor) applied to each string of its JSON by itself, its
19
+ * property names too, and to the lines after it, never to its JSON line whole: the redactor reads a run of more than
20
+ * 8,192 characters with no whitespace as "[redacted]" (key-refusal.ts redactedAnswer), and a JSON line, whose newlines
21
+ * are escapes, is one such run from its text's last space through its links, so cut whole it loses its links and no
22
+ * longer parses. "[redacted]" when `holds` finds a held value split across its strings (webHeld). Undefined for a tool
23
+ * other than web_search and web_fetch, or an output whose first line is not a JSON object: that one is cut as any other
24
+ * tool's. */
25
+ export declare function webCut(tool: string, text: string, cut: (text: string) => string, holds?: WebHolds): string | undefined;
10
26
  /** `text`, a call of `tool`'s output, as a grader reads it (WebShown), each of its strings through `each` first (the
11
27
  * run's redaction, its URLs' query values elided), so a cut never falls inside what that takes out. Undefined for a
12
28
  * tool other than web_search and web_fetch, or an output that is not its JSON. A page's links past a cut are counted
13
- * in `links_cut`. */
14
- export declare function webShownOf(tool: string, text: string, each?: (text: string) => string): WebShown | undefined;
29
+ * in `links_cut`. With `holds`, an output it withholds (webHeld: a held value split across two strings, which `each`
30
+ * reads one at a time) shows "[redacted]". */
31
+ export declare function webShownOf(tool: string, text: string, each?: (text: string) => string, holds?: WebHolds): WebShown | undefined;
15
32
  /** `shown` in `room` characters: whole when it fits, else each text that gives way cut to the longest length that
16
33
  * fits, the same for each; past `room` only when its url lists alone pass it, every such text then cut to nothing. */
17
34
  export declare function webWithin(shown: WebShown, room: number): string;
@@ -8,33 +8,67 @@ function clip(text, keep) {
8
8
  const code = keep > 0 ? text.charCodeAt(keep - 1) : 0;
9
9
  return `${text.slice(0, code >= 0xd800 && code <= 0xdbff ? keep - 1 : keep)}…`;
10
10
  }
11
- /** Every string in `value`, property names aside, through `each`. */
11
+ /** Every string in `value` through `each`, property names too (a tool may write a value as one): two names `each` makes
12
+ * one are both kept, the later ones numbered, as the runner's cutDeep keeps them (runner/redact.ts). Each name's next
13
+ * number is kept (`next`), so k names that cut to one cost k lookups, not k²/2: no name is ever taken back, so every
14
+ * number below it is still taken, and the one it finds is the lowest free one, as a count from 2 finds. */
12
15
  function eachString(value, each) {
13
16
  if (typeof value === "string")
14
17
  return each(value);
15
18
  if (Array.isArray(value))
16
19
  return value.map((item) => eachString(item, each));
17
- if (isObj(value))
18
- return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, eachString(item, each)]));
19
- return value;
20
- }
21
- /** How many of `links`, in order, fit in `keep` characters of JSON. */
22
- function linksWithin(links, keep) {
23
- let used = 0;
24
- for (const [i, link] of links.entries()) {
25
- used += JSON.stringify(link).length + 1;
26
- if (used > keep)
27
- return i;
20
+ if (!isObj(value))
21
+ return value;
22
+ const out = {};
23
+ let next;
24
+ for (const [key, item] of Object.entries(value)) {
25
+ const once = each(key);
26
+ let name = once;
27
+ if (Object.hasOwn(out, name)) {
28
+ next ??= new Map();
29
+ let n = next.get(once) ?? 2;
30
+ while (Object.hasOwn(out, `${once} (${n})`))
31
+ n++;
32
+ name = `${once} (${n})`;
33
+ next.set(once, n + 1);
34
+ }
35
+ Object.defineProperty(out, name, { value: eachString(item, each), enumerable: true, writable: true, configurable: true });
28
36
  }
29
- return links.length;
37
+ return out;
30
38
  }
31
- /** `text`, a call of `tool`'s output, with `cut` (the run's redactor) applied to each string of its JSON by itself and to
32
- * the lines after it, never to its JSON line whole: the redactor reads a run of more than 8,192 characters with no
33
- * whitespace as "[redacted]" (key-refusal.ts redactedAnswer), and a JSON line, whose newlines are escapes, is one such
34
- * run from its text's last space through its links, so cut whole it loses its links and no longer parses. Undefined for
35
- * a tool other than web_search and web_fetch, or an output whose first line is not a JSON object: that one is cut as
36
- * any other tool's. */
37
- export function webCut(tool, text, cut) {
39
+ /** Every string in `value` in the order its object reads (Object.entries: integer-like names first, a name written twice
40
+ * once, with its last value): the order JSON.stringify writes it back in (webCut, webShownOf). With `names`, each
41
+ * property name before its value. */
42
+ function stringsOf(value, names, out = []) {
43
+ if (typeof value === "string")
44
+ out.push(value);
45
+ else if (Array.isArray(value))
46
+ for (const item of value)
47
+ stringsOf(item, names, out);
48
+ else if (isObj(value))
49
+ for (const [key, item] of Object.entries(value)) {
50
+ if (names)
51
+ out.push(key);
52
+ stringsOf(item, names, out);
53
+ }
54
+ return out;
55
+ }
56
+ /** A JSON string as written, and the colon after it when it is a property name. */
57
+ const JSON_STRING = /("(?:[^"\\]|\\.)*")(\s*:)?/g;
58
+ /** Every string in `line`, a JSON text that parses, in the order it is written, each value of a name written twice too;
59
+ * with `names`, each property name as well, before its value. In JSON that parses, a quote outside a string only
60
+ * ever opens one, so the strings are read by JSON_STRING alone. */
61
+ function writtenStrings(line, names) {
62
+ const out = [];
63
+ for (const [, quoted, colon] of line.matchAll(JSON_STRING))
64
+ if (names || !colon)
65
+ out.push(JSON.parse(quoted));
66
+ return out;
67
+ }
68
+ /** `text`, a call of `tool`'s output, read as its tool writes it: the JSON object on its first line, and where that line
69
+ * ends (-1 when it is the whole text). Undefined for a tool other than web_search and web_fetch, or an output whose
70
+ * first line is not a JSON object. */
71
+ function webRead(tool, text) {
38
72
  if (tool !== WEB_SEARCH && tool !== WEB_FETCH)
39
73
  return undefined;
40
74
  const end = text.indexOf("\n");
@@ -45,33 +79,84 @@ export function webCut(tool, text, cut) {
45
79
  catch {
46
80
  return undefined;
47
81
  }
48
- if (!isObj(read))
82
+ return isObj(read) ? { read, end } : undefined;
83
+ }
84
+ /** Whether `text`, a web call's output, is withheld whole: `holds` (whether a text holds a held value no cut in place
85
+ * takes: key-refusal.ts withheldWhole) reads its JSON's strings as they came joined by line breaks, then the lines after
86
+ * the JSON: once its values alone, so two values side by side in the output are side by side in the join, and once with
87
+ * each property name before its value, so a name and its value are too. Each string is cut on its own wherever the
88
+ * output is shown (webCut, webShownOf), and the JSON's punctuation between two strings is no whitespace any view of the
89
+ * whole text joins across, so a held value split across two of them is found only here. The strings are read in the
90
+ * order the output is written back in (stringsOf: what webCut stores and webShownOf shows), and, where that differs
91
+ * (an integer-like name, a name written twice), in the order the text was written too (writtenStrings: what a row's
92
+ * preview shows of the text as it came). Every reader of a web call's output asks this first: the runner before it
93
+ * stores the answer (adapter-run-spec.ts answersCut), a timeline before its row shows any of it (timeline.ts shownOf,
94
+ * resultText). False for an output that is not a web call's JSON. */
95
+ export function webHeld(tool, text, holds) {
96
+ const web = webRead(tool, text);
97
+ return web ? heldIn(web, text, holds) : false;
98
+ }
99
+ /** webHeld of an output already read (webRead). */
100
+ function heldIn(web, text, holds) {
101
+ const after = web.end < 0 ? [] : [text.slice(web.end + 1)];
102
+ const line = web.end < 0 ? text : text.slice(0, web.end);
103
+ const asked = (strings) => {
104
+ const parts = [...strings, ...after];
105
+ return holds(parts.join("\n"), parts);
106
+ };
107
+ return [false, true].some((names) => {
108
+ const back = stringsOf(web.read, names);
109
+ const written = writtenStrings(line, names);
110
+ return asked(back) || (!sameStrings(back, written) && asked(written));
111
+ });
112
+ }
113
+ /** Whether two lists hold the same strings in the same order. */
114
+ const sameStrings = (a, b) => a.length === b.length && a.every((one, i) => one === b[i]);
115
+ /** What a web call withheld whole shows. */
116
+ const WITHHELD = () => "[redacted]";
117
+ /** How many of `links`, in order, fit in `keep` characters of JSON. */
118
+ function linksWithin(links, keep) {
119
+ let used = 0;
120
+ for (const [i, link] of links.entries()) {
121
+ used += JSON.stringify(link).length + 1;
122
+ if (used > keep)
123
+ return i;
124
+ }
125
+ return links.length;
126
+ }
127
+ /** `text`, a call of `tool`'s output, with `cut` (the run's redactor) applied to each string of its JSON by itself, its
128
+ * property names too, and to the lines after it, never to its JSON line whole: the redactor reads a run of more than
129
+ * 8,192 characters with no whitespace as "[redacted]" (key-refusal.ts redactedAnswer), and a JSON line, whose newlines
130
+ * are escapes, is one such run from its text's last space through its links, so cut whole it loses its links and no
131
+ * longer parses. "[redacted]" when `holds` finds a held value split across its strings (webHeld). Undefined for a tool
132
+ * other than web_search and web_fetch, or an output whose first line is not a JSON object: that one is cut as any other
133
+ * tool's. */
134
+ export function webCut(tool, text, cut, holds) {
135
+ const web = webRead(tool, text);
136
+ if (!web)
49
137
  return undefined;
50
- return `${JSON.stringify(eachString(read, cut))}${end < 0 ? "" : cut(text.slice(end))}`;
138
+ if (holds && heldIn(web, text, holds))
139
+ return "[redacted]";
140
+ return `${JSON.stringify(eachString(web.read, cut))}${web.end < 0 ? "" : cut(text.slice(web.end))}`;
51
141
  }
52
142
  /** `text`, a call of `tool`'s output, as a grader reads it (WebShown), each of its strings through `each` first (the
53
143
  * run's redaction, its URLs' query values elided), so a cut never falls inside what that takes out. Undefined for a
54
144
  * tool other than web_search and web_fetch, or an output that is not its JSON. A page's links past a cut are counted
55
- * in `links_cut`. */
56
- export function webShownOf(tool, text, each = (part) => part) {
57
- if (tool !== WEB_SEARCH && tool !== WEB_FETCH)
58
- return undefined;
59
- const end = text.indexOf("\n");
60
- let read;
61
- try {
62
- read = JSON.parse(end < 0 ? text : text.slice(0, end));
63
- }
64
- catch {
65
- return undefined;
66
- }
67
- const shown = eachString(read, each);
68
- if (!isObj(shown))
145
+ * in `links_cut`. With `holds`, an output it withholds (webHeld: a held value split across two strings, which `each`
146
+ * reads one at a time) shows "[redacted]". */
147
+ export function webShownOf(tool, text, each = (part) => part, holds) {
148
+ const web = webRead(tool, text);
149
+ if (!web)
69
150
  return undefined;
70
- const after = end < 0 ? "" : each(text.slice(end));
151
+ const shown = eachString(web.read, each);
152
+ const after = web.end < 0 ? "" : each(text.slice(web.end));
153
+ const withheld = () => (holds ? heldIn(web, text, holds) : false);
71
154
  if (tool === WEB_SEARCH) {
72
155
  const results = shown.results;
73
156
  if (!Array.isArray(results) || !results.every(isObj))
74
157
  return undefined;
158
+ if (withheld())
159
+ return WITHHELD;
75
160
  return (keep) => {
76
161
  const hits = results.map((hit) => (typeof hit.snippet === "string" ? { ...hit, snippet: clip(hit.snippet, keep) } : hit));
77
162
  return `${JSON.stringify({ ...shown, ...(typeof shown.text === "string" ? { text: clip(shown.text, keep) } : {}), results: hits })}${after}`;
@@ -81,6 +166,8 @@ export function webShownOf(tool, text, each = (part) => part) {
81
166
  return undefined;
82
167
  const page = shown;
83
168
  const links = Array.isArray(page.links) ? page.links : undefined;
169
+ if (withheld())
170
+ return WITHHELD;
84
171
  return (keep) => {
85
172
  const kept = links ? linksWithin(links, keep) : 0;
86
173
  const cut = links ? links.length - kept : 0;
@@ -1,4 +1,4 @@
1
- import { SHELL_FAMILY, SHELL_WATCHERS, shellToolOf } from "@parcha/agentrun-kernel/kernel";
1
+ import { SHELL_FAMILY, SHELL_WATCHERS, type ShellPlace, shellToolOf } from "@parcha/agentrun-kernel/kernel";
2
2
  import { type AdapterFacts } from "@parcha/agentrun-kernel";
3
3
  import type { Workspace } from "./workspace/workspace.js";
4
4
  import { type ToolSettingsRead } from "./tool-plane.js";
@@ -130,8 +130,8 @@ export declare const SETTINGS_UNREAD: unique symbol;
130
130
  export declare const permissionOf: (name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals, effect?: ToolEffect) => Permission;
131
131
  /** An approval's price for the person who answers it: USD where the tool declares one (booked through the spend cap's
132
132
  * paidCall), else "not metered" (an unpriced MCP call, the owner's ruling of 11-04), or "priced by usage" for a monid
133
- * endpoint priced by usage: monid estimates its cost only when the call runs, after the person's allow, and its charge
134
- * can pass that estimate (runner/monid-run.ts). */
133
+ * endpoint priced by usage or a fal job: each is priced only when the call runs, after the person's allow, and its
134
+ * charge can pass that estimate (runner/monid-run.ts, fal-price.ts). */
135
135
  export type ApprovalPrice = number | "not metered" | "priced by usage";
136
136
  /** One pending approval, as the run's view shows it (`pending`) and the console's approval card reads it. */
137
137
  export type PendingApproval = {
@@ -197,6 +197,25 @@ export declare function runGate(where: {
197
197
  place?: unknown;
198
198
  };
199
199
  }, serverSettings: () => ToolSettingsRead, approvers: boolean): RunGate;
200
+ /** The tools a run's computer of `kind` serves, by the names its gate decides them by: a desktop's or a phone's own
201
+ * (COMPUTER_TOOLS, held to its kind's key), a browser's (its key), and, where the run's shell is on the computer
202
+ * (`shell` "computer": a sandbox, a desktop that mounts the run's folder), each host tool the agent grants. */
203
+ export declare function computerToolsOf(kind: string, granted: readonly string[], shell: ShellPlace): readonly string[];
204
+ /** The kind of the agent's computer when every tool it serves (computerToolsOf) is set to deny for `revision` under the
205
+ * server's `server` settings, as its run's gate reads them: a run of it never starts that computer. Undefined for an agent
206
+ * with no computer, one whose computer serves none of its tools, or one any of them is allowed or asked of. `shell`: where
207
+ * a run of it has its shell (resolve-computer.ts runShellOf). Settings that do not read deny nothing (the gate asks). */
208
+ export declare function computerDenied(revision: {
209
+ kind: string;
210
+ body: {
211
+ tools?: readonly string[];
212
+ toolSettings?: unknown;
213
+ harness?: string;
214
+ approvals?: Approvals;
215
+ computer?: unknown;
216
+ place?: unknown;
217
+ };
218
+ }, shell: ShellPlace, server: ToolSettingsRead): string | undefined;
200
219
  /** The top-level arguments the listing of the MCP tool `name` (`mcp:<server>/<tool>`) in the run's pin declares under
201
220
  * its inputSchema's `properties`, the snapshot the run offers the model, never a live listing; undefined for a listing
202
221
  * with no `properties` object (nothing to close a pinned call to) and for any other tool. */
@@ -244,6 +263,26 @@ export declare class RunGate {
244
263
  }): Promise<"allow" | "ask" | {
245
264
  deny: string;
246
265
  }>;
266
+ /** The refusal of a call of the run's computer's own tools (computerOwns) once that computer is off for the rest of the
267
+ * run (computerOff): short, decided with no setting read and nothing sent to it, a setting changed since included.
268
+ * Undefined for any other call, or while the computer is on. */
269
+ offRefusal(name: string, options?: {
270
+ readonly replayed?: boolean;
271
+ }): {
272
+ deny: string;
273
+ } | undefined;
274
+ /** The run's computer's kind once it is off for the rest of the run: by the first deny of a call of its own tools
275
+ * (decide, whose refusal says so once), or from a claim's start (turnOff). Undefined while it is on. */
276
+ get computerOff(): string | undefined;
277
+ /** The run's computer off from this claim's start: an earlier claim's deny turned it off for the run
278
+ * (computer-journal.ts computerTurnedOff), so each call of its tools is refused short, never said off again. */
279
+ turnOff(): void;
280
+ /** Set by the first deny of a call of the run's computer's own tools (computerOwns), or by turnOff. */
281
+ private off;
282
+ /** The run's computer kind (where.kind) when `name` is one of that computer's own tools: a desktop's or a phone's
283
+ * (KIND_TOOLS), a browser's (held to the browser key). Undefined for any other call, a shell or file tool the computer
284
+ * runs included: a deny of one of those leaves the computer's own tools as they are. */
285
+ private computerOwns;
247
286
  /** The settings key a call of `name` is held to, the one its refusal and its ask name: a computer tool's is the kind
248
287
  * whose setting decides it (kindSetting), any other's its session's name map. */
249
288
  private keyOf;