@parcha/agentrun-serve 0.1.0-beta.61 → 0.1.0-beta.63

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 (228) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +128 -20
  3. package/dist/adapters.js +4 -2
  4. package/dist/agent-delete.d.ts +3 -3
  5. package/dist/agent-delete.js +50 -4
  6. package/dist/api-only.d.ts +4 -0
  7. package/dist/api-only.js +5 -1
  8. package/dist/archil-settings.d.ts +9 -0
  9. package/dist/archil-settings.js +8 -1
  10. package/dist/bash-read-only.d.ts +3 -0
  11. package/dist/bash-read-only.js +6 -3
  12. package/dist/chatgpt-plan.d.ts +33 -8
  13. package/dist/chatgpt-plan.js +141 -24
  14. package/dist/claude-login.d.ts +12 -5
  15. package/dist/claude-login.js +28 -3
  16. package/dist/cli.js +19 -8
  17. package/dist/composio-triggers.d.ts +9 -3
  18. package/dist/computers.d.ts +3 -0
  19. package/dist/computers.js +2 -1
  20. package/dist/console/assets/{backend-C9ffXUR5.js → backend-BxQ2G1M0.js} +2 -2
  21. package/dist/console/assets/index-C8Y5Zl8x.js +639 -0
  22. package/dist/console/assets/share-CjBJ_rxP.js +6 -0
  23. package/dist/console/assets/{styles-fjQBFfMv.css → styles-D0SufbzK.css} +1 -1
  24. package/dist/console/index.html +3 -3
  25. package/dist/console/share.html +3 -3
  26. package/dist/cut-pool.d.ts +14 -0
  27. package/dist/cut-pool.js +98 -0
  28. package/dist/cut-worker.d.ts +14 -0
  29. package/dist/cut-worker.js +16 -0
  30. package/dist/decisions.d.ts +4 -0
  31. package/dist/decisions.js +9 -1
  32. package/dist/env-switch.d.ts +3 -0
  33. package/dist/env-switch.js +3 -0
  34. package/dist/harness-opencode/adapter.d.ts +3 -1
  35. package/dist/harness-opencode/adapter.js +6 -2
  36. package/dist/harness-opencode/harness.d.ts +4 -0
  37. package/dist/harness-opencode/harness.js +6 -1
  38. package/dist/harness-table.d.ts +7 -0
  39. package/dist/harness-table.js +6 -3
  40. package/dist/host-tools.d.ts +18 -3
  41. package/dist/host-tools.js +27 -4
  42. package/dist/import.d.ts +8 -1
  43. package/dist/import.js +36 -5
  44. package/dist/key-check.js +22 -8
  45. package/dist/learn/ledger.d.ts +37 -16
  46. package/dist/learn/ledger.js +56 -24
  47. package/dist/learn/promote.d.ts +4 -1
  48. package/dist/learned-nodes.d.ts +2 -1
  49. package/dist/learned-nodes.js +2 -1
  50. package/dist/learning-cost.d.ts +5 -3
  51. package/dist/learning-model.js +7 -5
  52. package/dist/learning-work.d.ts +69 -0
  53. package/dist/learning-work.js +148 -0
  54. package/dist/mcp-gateway.d.ts +24 -0
  55. package/dist/mcp-gateway.js +97 -8
  56. package/dist/mcp-servers-store.d.ts +7 -10
  57. package/dist/mcp-servers-store.js +15 -9
  58. package/dist/native/cli.js +5 -1
  59. package/dist/ollama-provider.d.ts +10 -3
  60. package/dist/ollama-provider.js +17 -7
  61. package/dist/openapi.js +51 -20
  62. package/dist/otel/tracer.d.ts +6 -3
  63. package/dist/otel/tracer.js +24 -6
  64. package/dist/page.d.ts +7 -0
  65. package/dist/page.js +17 -4
  66. package/dist/place.d.ts +25 -9
  67. package/dist/place.js +37 -11
  68. package/dist/print.d.ts +3 -2
  69. package/dist/print.js +8 -6
  70. package/dist/run-export.js +7 -4
  71. package/dist/run-launch.d.ts +6 -1
  72. package/dist/run-launch.js +26 -6
  73. package/dist/run-model-key.d.ts +2 -1
  74. package/dist/run-model-key.js +2 -1
  75. package/dist/run-reads-over-store.d.ts +7 -0
  76. package/dist/run-reads-over-store.js +32 -4
  77. package/dist/run-view.js +9 -3
  78. package/dist/runnable.d.ts +6 -3
  79. package/dist/runnable.js +21 -11
  80. package/dist/runner/adapter-loop.js +95 -28
  81. package/dist/runner/adapter-run-spec.d.ts +20 -4
  82. package/dist/runner/adapter-run-spec.js +64 -30
  83. package/dist/runner/adapters/index.d.ts +6 -0
  84. package/dist/runner/adapters/index.js +5 -1
  85. package/dist/runner/adapters/pi.d.ts +42 -3
  86. package/dist/runner/adapters/pi.js +114 -13
  87. package/dist/runner/audit.d.ts +8 -2
  88. package/dist/runner/audit.js +34 -18
  89. package/dist/runner/book-cut.d.ts +6 -0
  90. package/dist/runner/book-cut.js +38 -0
  91. package/dist/runner/claim-secrets.d.ts +12 -5
  92. package/dist/runner/claim-secrets.js +28 -12
  93. package/dist/runner/cli-run-spec.d.ts +0 -2
  94. package/dist/runner/cli-run-spec.js +54 -25
  95. package/dist/runner/dispatch.js +2 -0
  96. package/dist/runner/harness-loops.d.ts +5 -0
  97. package/dist/runner/harness-loops.js +4 -1
  98. package/dist/runner/held.d.ts +6 -3
  99. package/dist/runner/learned-first.d.ts +5 -0
  100. package/dist/runner/learned-first.js +1 -1
  101. package/dist/runner/learning-end.d.ts +15 -8
  102. package/dist/runner/learning-end.js +23 -7
  103. package/dist/runner/live-ticker.js +3 -1
  104. package/dist/runner/loop-contract.d.ts +8 -1
  105. package/dist/runner/main.js +2 -0
  106. package/dist/runner/mcp-run.d.ts +5 -0
  107. package/dist/runner/mcp-run.js +18 -0
  108. package/dist/runner/meta-tools.js +4 -4
  109. package/dist/runner/metrics.d.ts +4 -2
  110. package/dist/runner/metrics.js +5 -3
  111. package/dist/runner/model-route.d.ts +4 -0
  112. package/dist/runner/model-route.js +1 -1
  113. package/dist/runner/native-loop.js +2 -2
  114. package/dist/runner/pr-checkout.d.ts +12 -0
  115. package/dist/runner/pr-checkout.js +21 -2
  116. package/dist/runner/promotion.d.ts +9 -2
  117. package/dist/runner/promotion.js +79 -28
  118. package/dist/runner/reflect-hook.d.ts +7 -0
  119. package/dist/runner/reflect-hook.js +2 -1
  120. package/dist/runner/run-child-host.d.ts +10 -6
  121. package/dist/runner/run-child-host.js +65 -41
  122. package/dist/runner/run-child.js +2 -0
  123. package/dist/runner/runner.d.ts +9 -0
  124. package/dist/runner/runner.js +158 -25
  125. package/dist/runner/store-port.d.ts +4 -1
  126. package/dist/runner/workflow-calls.d.ts +4 -3
  127. package/dist/runner/workflow-calls.js +41 -12
  128. package/dist/runner/workflow-first.js +4 -3
  129. package/dist/runner/workflow-loop.js +13 -1
  130. package/dist/runner/workflow-spec.js +1 -1
  131. package/dist/secret-cut.d.ts +4 -0
  132. package/dist/secret-cut.js +1 -1
  133. package/dist/secret-rules.d.ts +2 -1
  134. package/dist/secret-rules.js +88 -24
  135. package/dist/server.d.ts +10 -1
  136. package/dist/server.js +131 -44
  137. package/dist/share-host.d.ts +111 -0
  138. package/dist/share-host.js +669 -0
  139. package/dist/store/schema.d.ts +4 -3
  140. package/dist/store/schema.js +4 -3
  141. package/dist/store/seal.d.ts +8 -2
  142. package/dist/store/seal.js +13 -2
  143. package/dist/store/sqlite/learning-rows.js +2 -1
  144. package/dist/store/sqlite/run-patch.js +4 -4
  145. package/dist/store/sqlite/store.js +28 -4
  146. package/dist/store/store.d.ts +5 -0
  147. package/dist/store-reads/analytics.d.ts +15 -0
  148. package/dist/store-reads/analytics.js +17 -0
  149. package/dist/store-reads/journal.d.ts +2 -0
  150. package/dist/store-reads/journal.js +1 -1
  151. package/dist/store-reads/learning.d.ts +4 -3
  152. package/dist/store-reads/learning.js +62 -18
  153. package/dist/store-view.d.ts +3 -0
  154. package/dist/store-view.js +18 -1
  155. package/dist/suggestions.js +32 -3
  156. package/dist/templates.d.ts +3 -1
  157. package/dist/templates.js +7 -3
  158. package/dist/tool-gate.d.ts +25 -9
  159. package/dist/tool-gate.js +58 -19
  160. package/dist/tool-list.d.ts +4 -0
  161. package/dist/tool-list.js +4 -0
  162. package/dist/tool-plane.d.ts +1 -0
  163. package/dist/tool-plane.js +6 -2
  164. package/dist/tools.js +2 -2
  165. package/dist/trigger-composio.js +1 -1
  166. package/dist/webhooks.d.ts +3 -0
  167. package/dist/webhooks.js +5 -0
  168. package/dist/workspace/archil-claim.d.ts +7 -3
  169. package/dist/workspace/archil-claim.js +13 -5
  170. package/dist/workspace/archil-mount-credential.d.ts +6 -0
  171. package/dist/workspace/archil-mount-credential.js +11 -0
  172. package/dist/workspace/attach.js +22 -5
  173. package/dist/workspace/computer-deps.d.ts +5 -3
  174. package/dist/workspace/computer-deps.js +11 -9
  175. package/dist/workspace/computer-for-claim.d.ts +6 -2
  176. package/dist/workspace/computer-for-claim.js +43 -12
  177. package/dist/workspace/computer-janitor.d.ts +7 -4
  178. package/dist/workspace/computer-janitor.js +7 -4
  179. package/dist/workspace/computer-kept.d.ts +7 -1
  180. package/dist/workspace/computer-kept.js +7 -1
  181. package/dist/workspace/kind-skills/desktop/SKILL.md +17 -4
  182. package/dist/workspace/mount-revoke-left.d.ts +16 -4
  183. package/dist/workspace/mount-revoke-left.js +42 -22
  184. package/dist/workspace/resolve-computer.d.ts +11 -5
  185. package/dist/workspace/resolve-computer.js +22 -13
  186. package/dist/workspace/run-end-computers.js +1 -1
  187. package/dist/workspace/run-tools.d.ts +10 -3
  188. package/dist/workspace/run-tools.js +5 -4
  189. package/dist/wrapped.d.ts +29 -2
  190. package/dist/wrapped.js +20 -3
  191. package/launcher/agentrun-serve +1 -1
  192. package/package.json +12 -12
  193. package/templates/kyb/agent.md +7 -1
  194. package/templates/kyb/evals/list-file-fuzzy-alias/case.yaml +10 -0
  195. package/templates/kyb/evals/list-file-fuzzy-alias/fixtures/web.json +58 -0
  196. package/templates/kyb/evals/list-file-fuzzy-alias/graders/finds-the-transliteration.md +17 -0
  197. package/templates/kyb/evals/list-file-fuzzy-alias/graders/greps-the-files.md +11 -0
  198. package/templates/kyb/evals/list-file-fuzzy-alias/graders/saves-the-uk-file.md +8 -0
  199. package/templates/kyb/evals/list-file-fuzzy-alias/prompt.md +7 -0
  200. package/templates/kyb/evals/list-file-hit/case.yaml +10 -0
  201. package/templates/kyb/evals/list-file-hit/fixtures/web.json +58 -0
  202. package/templates/kyb/evals/list-file-hit/graders/greps-the-files.md +11 -0
  203. package/templates/kyb/evals/list-file-hit/graders/hits-by-company-number.md +18 -0
  204. package/templates/kyb/evals/list-file-hit/graders/saves-the-uk-file.md +8 -0
  205. package/templates/kyb/evals/list-file-hit/prompt.md +7 -0
  206. package/templates/kyb/evals/list-file-no-hit/case.yaml +10 -0
  207. package/templates/kyb/evals/list-file-no-hit/fixtures/web.json +58 -0
  208. package/templates/kyb/evals/list-file-no-hit/graders/greps-the-files.md +11 -0
  209. package/templates/kyb/evals/list-file-no-hit/graders/no-hit-by-whole-file.md +12 -0
  210. package/templates/kyb/evals/list-file-no-hit/graders/saves-the-uk-file.md +8 -0
  211. package/templates/kyb/evals/list-file-no-hit/prompt.md +7 -0
  212. package/templates/kyb/evals/list-file-short-name/case.yaml +9 -0
  213. package/templates/kyb/evals/list-file-short-name/fixtures/web.json +58 -0
  214. package/templates/kyb/evals/list-file-short-name/graders/finds-the-short-name.md +19 -0
  215. package/templates/kyb/evals/list-file-short-name/graders/greps-the-files.md +11 -0
  216. package/templates/kyb/evals/list-file-short-name/graders/saves-the-uk-file.md +8 -0
  217. package/templates/kyb/evals/list-file-short-name/prompt.md +7 -0
  218. package/templates/kyb/evals/list-file-split-name/case.yaml +11 -0
  219. package/templates/kyb/evals/list-file-split-name/fixtures/web.json +58 -0
  220. package/templates/kyb/evals/list-file-split-name/graders/finds-the-director.md +18 -0
  221. package/templates/kyb/evals/list-file-split-name/graders/greps-the-files.md +11 -0
  222. package/templates/kyb/evals/list-file-split-name/graders/saves-the-uk-file.md +8 -0
  223. package/templates/kyb/evals/list-file-split-name/prompt.md +7 -0
  224. package/templates/kyb/kyb.schema.json +2 -2
  225. package/templates/kyb/rules/SANCTIONS.md +82 -13
  226. package/dist/console/assets/index-BnZV3lvW.js +0 -639
  227. package/dist/console/assets/share-B1o5mJ56.js +0 -6
  228. /package/dist/console/assets/{styles-D_znYrHR.js → styles-BGZxYkky.js} +0 -0
package/dist/place.js CHANGED
@@ -17,9 +17,22 @@
17
17
  // now it runs in the Docker box, and where it is not its run is refused in the same words. A workflow, a revision whose
18
18
  // tools need no shell, and one with a tool the box refuses run on the runner. In Mode 2 (the runner's shell is Archil's
19
19
  // serverless exec) the default is the runner, Docker answering or not: Mode 2 keeps the run's folder on Archil, which
20
- // Docker's box can't mount, so a run given that box would only be refused.
20
+ // Docker's box can't mount, so a run given that box would only be refused. In Mode 2 on an Archil region with no
21
+ // serverless exec there is no default at all: the runner has no shell and Docker's box can't mount Archil, so a new
22
+ // agent with a shell tool names a sandbox computer (noExecIssue), Docker answering or not.
23
+ import { noExecWords } from "./archil-settings.js";
21
24
  import { BOX_IDS, BOXES_ENV, DEFAULT_BOX } from "./place-offers.js";
22
25
  import { sentence } from "./errors.js";
26
+ /** What a new agent with a shell tool and no computer sets on a Mode 2 server whose Archil region has no exec. */
27
+ const NO_EXEC_FIX = "Give the agent a sandbox computer (a box): set computer to {kind: sandbox, provider: <a sandbox provider in Settings → Computers>}; or leave bash out of its tools.";
28
+ /** The refusal of a new agent with a shell tool and no computer, at its save or deploy, on a Mode 2 server whose Archil
29
+ * region `region` has no serverless exec (RunnerShell `noExec`): it names a sandbox computer, never Docker's box. */
30
+ export const noExecIssue = (region) => ({
31
+ field: "definition.computer",
32
+ reason: "missing",
33
+ message: `name a sandbox computer: ${noExecWords(region)}, so a run with no computer has no shell, and the docker box can't mount Archil. ${NO_EXEC_FIX}`,
34
+ fix: NO_EXEC_FIX,
35
+ });
23
36
  export const PLACE_MODES = ["runner", "sandbox"];
24
37
  /** Every box, from what this server found at its start (place-offers.ts): one it did not find is not set up. */
25
38
  export function boxAvailability(registry) {
@@ -58,10 +71,11 @@ export function newAgentPlace(registry) {
58
71
  * (newAgentPlace) for an agentic revision with a tool that runs only in a box (`flags`, tools.ts: bash and the
59
72
  * background tools); the runner for a workflow, which is never given a box, for one whose tools need no shell (none, or
60
73
  * only read and write: a container would only hold up its start), and for one that names a tool the box refuses (the
61
- * browser, runner-only for now). Where the runner has a shell (`runnerShell`: Mode 2's Archil exec), the runner for
62
- * every revision: Docker's box can't mount the folder Mode 2 keeps on Archil. */
74
+ * browser, runner-only for now). In Mode 2 (`runnerShell` not false), the runner for every revision: Docker's box can't
75
+ * mount the folder Mode 2 keeps on Archil. Where the runner has no shell there either (`noExec`), a shell tool's agent
76
+ * is refused at its save (noBoxRefusal) and its run (runnable.ts), never given Docker's box. */
63
77
  export function defaultPlaceOf(kind, tools, registry, flags, runnerShell) {
64
- if (kind === "workflow" || runnerShell || !wantsBox(tools, flags))
78
+ if (kind === "workflow" || runnerShell !== false || !wantsBox(tools, flags))
65
79
  return { mode: "runner" };
66
80
  const fresh = newAgentPlace(registry);
67
81
  return "place" in fresh ? fresh.place : { mode: "runner" };
@@ -76,10 +90,15 @@ const wantsBox = (tools, flags) => {
76
90
  * save it, where it would be given the default box (it names no tools, `tools` undefined, so it would get a shell, or a
77
91
  * tool that runs only in a box) and this server does not have Docker's box, and where the runner has no shell
78
92
  * (`runnerShell` false: Mode 1). On Mode 2 the runner's exec is a shell, and such a definition saves for the runner as
79
- * it always did, its tools checked there (runnable.ts). Undefined for one that saves. */
93
+ * it always did, its tools checked there (runnable.ts); on a Mode 2 region with no exec (`noExec`) there is no shell
94
+ * for a shell tool it names, Docker answering or not: it names a sandbox computer (noExecIssue). One that names no tools
95
+ * is saved on Mode 2's runner with none (server.ts defaultToolsAt), so it has no shell tool to refuse. Undefined for one
96
+ * that saves. */
80
97
  export function noBoxRefusal(tools, registry, flags, runnerShell) {
81
- if (runnerShell || !wantsBox(tools ?? NEW_AGENT_TOOLS, flags))
98
+ if (runnerShell === true || !wantsBox(tools ?? (runnerShell === false ? NEW_AGENT_TOOLS : []), flags))
82
99
  return undefined;
100
+ if (runnerShell !== false)
101
+ return noExecIssue(runnerShell.noExec);
83
102
  const fresh = newAgentPlace(registry);
84
103
  return "reason" in fresh ? noPlaceIssue(registry) : undefined;
85
104
  }
@@ -114,8 +133,10 @@ export function noBoxReason(registry, listed) {
114
133
  * AGENTRUN_BOXES lists (`listed`), and, when none is ready, the boxes it does not list, with what to do.
115
134
  * `byDefault`, with AGENTRUN_BOXES not set at all: short, the local box alone, said to be on by default, or why it is
116
135
  * not, and where a new agent with no place goes then: it names its place, or, where the runner has a shell
117
- * (`runnerShell`: Mode 2), it runs on the runner (placesOf). */
136
+ * (`runnerShell`: Mode 2), it runs on the runner (placesOf). On a Mode 2 region with no exec (`noExec`), every form says
137
+ * a new agent with bash names a sandbox computer, and why. */
118
138
  export function boxesLine(registry, listed, allow = "none", byDefault = false, runnerShell = false) {
139
+ const noExec = typeof runnerShell === "object" ? [`A new agent with bash names a sandbox computer (a box), or leaves bash out: ${noExecWords(runnerShell.noExec)}, and Mode 2 keeps workspaces on Archil, which the docker box can't mount.`] : [];
119
140
  const boxes = boxAvailability(registry);
120
141
  const ready = boxes.filter((box) => box.available).map((box) => box.id);
121
142
  const said = ready.length ? [`${and(ready)} ${ready.length === 1 ? "is" : "are"} ready, so sandbox agents run their tools there.`] : [];
@@ -127,21 +148,26 @@ export function boxesLine(registry, listed, allow = "none", byDefault = false, r
127
148
  const reach = boxes.filter((box) => box.available && box.network).map((box) => box.network === "allowlist" ? sentence(`${box.id} boxes reach only ${hosts}`) : sentence(`${box.id} boxes have no network${box.network_reason ? `: ${box.network_reason}` : ""}`));
128
149
  if (byDefault) {
129
150
  const box = defaultBox(registry);
151
+ if (!box?.available && noExec.length)
152
+ return [`Boxes: none.`, ...noExec, sentence(box?.reason ?? NO_REASON)].join(" ");
130
153
  if (!box?.available)
131
154
  return `Boxes: none, so ${runnerShell ? "new agents run on the runner" : "a new agent must name its place: a box, or the runner"}. ${sentence(box?.reason ?? NO_REASON)}`;
132
- return [`Boxes: ${box.id} (on by default; set ${BOXES_ENV} to change).`, ...(runnerShell ? [`New agents run on the runner: Mode 2 keeps workspaces on Archil, which the ${box.id} box can't mount.`] : []), ...reach].join(" ");
155
+ return [`Boxes: ${box.id} (on by default; set ${BOXES_ENV} to change).`, ...(runnerShell === true ? [`New agents run on the runner: Mode 2 keeps workspaces on Archil, which the ${box.id} box can't mount.`] : noExec), ...reach].join(" ");
133
156
  }
134
- return ["Boxes:", ...(none ? ["none is ready, so sandbox agents do not run here."] : said), ...reach, ...why.map((box) => sentence(`${box.id}: ${box.reason ?? "not available"}`)), ...(rest ? [sentence(rest)] : [])].join(" ");
157
+ return ["Boxes:", ...(none ? ["none is ready, so sandbox agents do not run here."] : said), ...noExec, ...reach, ...why.map((box) => sentence(`${box.id}: ${box.reason ?? "not available"}`)), ...(rest ? [sentence(rest)] : [])].join(" ");
135
158
  }
136
159
  /** `places` in capabilities: the modes a revision may name, the place a new agent is saved with and a revision that
137
160
  * names none runs in (`default_place`), each box, and the hosts a box whose `network` is `allowlist` reaches (`allow`,
138
161
  * box-settings.ts boxAllowOf; empty for `none`). `default_place` is the runner where it has a shell (`runnerShell`:
139
162
  * Mode 2's Archil exec), Docker answering or not (defaultPlaceOf); else Docker's box where this server has it; else
140
163
  * null, no default: a new agent names its place, and `default_reason` is the words a no-place create is refused in
141
- * (noBoxRefusal). `default_reason` is there exactly when `default_place` is null. */
164
+ * (noBoxRefusal). On a Mode 2 region with no exec (`noExec`) it is null, Docker answering or not, and `default_reason`
165
+ * says to name a sandbox computer (noExecIssue). `default_reason` is there exactly when `default_place` is null. */
142
166
  export const placesOf = (registry, allow = "none", runnerShell = false) => {
143
167
  const fresh = newAgentPlace(registry);
144
- const byDefault = runnerShell ? { default_place: { mode: "runner" } } : "place" in fresh ? { default_place: fresh.place } : { default_place: null, default_reason: fresh.reason };
168
+ const byDefault = runnerShell === true ? { default_place: { mode: "runner" } }
169
+ : runnerShell !== false ? { default_place: null, default_reason: noExecIssue(runnerShell.noExec).message }
170
+ : "place" in fresh ? { default_place: fresh.place } : { default_place: null, default_reason: fresh.reason };
145
171
  return { modes: [...PLACE_MODES], ...byDefault, boxes: boxAvailability(registry).map(stated), allow: allow === "none" ? [] : [...allow] };
146
172
  };
147
173
  /** A box with its state, `ready` when it is available and `unavailable` when not; and, on an available box, its network as the server set it, with
package/dist/print.d.ts CHANGED
@@ -6,8 +6,8 @@ export type TokenSource = "made" | "file" | "env" | "list";
6
6
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
7
7
  * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
8
8
  * token. `tokenIds`: the ids of the tokens the server takes (api-token.ts), named when there is more than one or a list
9
- * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
10
- * words (Serve's boxesLine), last. */
9
+ * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `shareHost`: the
10
+ * same, and its API is under /r/v2. `boxes`: which boxes are ready, in words (Serve's boxesLine), last. */
11
11
  export declare function banner(o: {
12
12
  url: string;
13
13
  baseUrl: string;
@@ -19,6 +19,7 @@ export declare function banner(o: {
19
19
  publicUrl?: string;
20
20
  accounts?: boolean;
21
21
  apiOnly?: boolean;
22
+ shareHost?: boolean;
22
23
  launchCode?: string;
23
24
  boxes?: string;
24
25
  }): string[];
package/dist/print.js CHANGED
@@ -5,19 +5,21 @@ import { join } from "node:path";
5
5
  * people open (AGENTRUN_PUBLIC_URL), which the base URL and the link use. With `accounts` the page is the owner's
6
6
  * password, so its link holds nothing; with none, the link holds this start's launch code (`launchCode`), never the
7
7
  * token. `tokenIds`: the ids of the tokens the server takes (api-token.ts), named when there is more than one or a list
8
- * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `boxes`: which boxes are ready, in
9
- * words (Serve's boxesLine), last. */
8
+ * gave them, never a secret. `apiOnly`: no console to open, so the line says what is served instead. `shareHost`: the
9
+ * same, and its API is under /r/v2. `boxes`: which boxes are ready, in words (Serve's boxesLine), last. */
10
10
  export function banner(o) {
11
11
  const where = o.source === "env" ? "$AGENTRUN_TOKEN" : o.source === "list" ? "<a secret in $AGENTRUN_TOKENS>" : `<in ${join(o.data, ".token")}>`;
12
12
  const key = o.source === "made" ? o.token : where;
13
13
  return [
14
14
  `agentrun-serve on ${o.baseUrl} (agent store in ${o.data}${o.listen ? `, listening on ${o.listen}` : ""})`,
15
- `AGENTRUN_BASE_URL=${o.publicUrl ? `${o.publicUrl}/v2` : o.baseUrl}`,
15
+ `AGENTRUN_BASE_URL=${o.shareHost ? `${o.publicUrl ?? o.url}/r/v2` : o.publicUrl ? `${o.publicUrl}/v2` : o.baseUrl}`,
16
16
  `AGENTRUN_API_KEY=${key}`,
17
17
  ...(o.tokenIds && (o.tokenIds.length > 1 || o.source === "list") ? [`API tokens taken (ids): ${o.tokenIds.join(", ")}`] : []),
18
- o.apiOnly
19
- ? "API only (AGENTRUN_API_ONLY=1): the run and deploy routes, a trigger's reads and its turn on or off, the MCP server names, a Composio server's save, a per_run server's save at an origin AGENTRUN_API_ONLY_MCP_ORIGINS lists and a server's delete are served; the console, sign-in, setup, other settings, the MCP endpoint, the other trigger routes and hooks are refused."
20
- : o.accounts || o.launchCode === undefined ? `Open ${o.publicUrl ?? o.url}/` : `Open ${o.publicUrl ?? o.url}/?launch=${o.launchCode}`,
18
+ o.shareHost
19
+ ? `Share host (--share-host): shares at ${o.publicUrl ?? o.url}/r/<id>; uploads to /r/v2/shares take a token and are re-scrubbed; every other address is a 404, and no runner, model key or computer runs here.`
20
+ : o.apiOnly
21
+ ? "API only (AGENTRUN_API_ONLY=1): the run and deploy routes, a trigger's reads and its turn on or off, the MCP server names, a Composio server's save, a per_run server's save at an origin AGENTRUN_API_ONLY_MCP_ORIGINS lists and a server's delete are served; the console, sign-in, setup, other settings, the MCP endpoint, the other trigger routes and hooks are refused."
22
+ : o.accounts || o.launchCode === undefined ? `Open ${o.publicUrl ?? o.url}/` : `Open ${o.publicUrl ?? o.url}/?launch=${o.launchCode}`,
21
23
  ...(o.boxes ? [o.boxes] : []),
22
24
  ];
23
25
  }
@@ -176,7 +176,7 @@ export async function exportBundle(input) {
176
176
  };
177
177
  let result;
178
178
  try {
179
- result = await cutPass(text, { mode: "cut", held: input.held, keep, ...(context?.path !== undefined ? { path: context.path } : {}), ...(context?.command !== undefined ? { command: context.command } : {}) });
179
+ result = await cutPass(text, { mode: "cut", held: input.held, keep, ...(context?.path !== undefined ? { path: context.path } : {}), ...(context?.command !== undefined ? { command: context.command } : {}), ...(context?.flattened ? { flattened: true } : {}) });
180
180
  }
181
181
  catch {
182
182
  throw new ExportFailed("a scrub threw");
@@ -232,9 +232,12 @@ export async function exportBundle(input) {
232
232
  const context = effectContext(effect);
233
233
  return context === undefined ? walk(effect, at) : each(effect, at, (item, here, key) => walk(item, here, key === "output" ? context : undefined));
234
234
  };
235
- const walkPart = (key, value, at) => key === "rows" ? each(value, at, walkRow)
236
- : key === "graph" ? each(value, at, (item, here, field) => (field === "effects" ? each(item, here, walkEffect) : walk(item, here)))
237
- : walk(value, at);
235
+ // The run's title is its first message flattened onto one line (runs-over-store.ts prepareLaunch): it is cut as such,
236
+ // so a transcript's env command and its output, one line there, is still a dump (secret-cut.ts ScrubOptions.flattened).
237
+ const walkPart = (key, value, at) => key === "run" ? each(value, at, (item, here, field) => (field === "title" && typeof item === "string" ? cutString(item, here, { flattened: true }) : walk(item, here)))
238
+ : key === "rows" ? each(value, at, walkRow)
239
+ : key === "graph" ? each(value, at, (item, here, field) => (field === "effects" ? each(item, here, walkEffect) : walk(item, here)))
240
+ : walk(value, at);
238
241
  // A file's content is cut knowing its path (a .env* file or one under ~/.ssh is dropped whole); then its bytes and digest
239
242
  // are the carried text's. The caps hold for those bytes, as a share host checks them: a cut can make a file longer than it
240
243
  // was read (a marker longer than the value), so one whose cut text is over the file cap, or the files' total, is left out
@@ -136,11 +136,16 @@ export interface SourceProjectLaunch {
136
136
  readonly inputs?: readonly string[];
137
137
  }
138
138
  export declare function sourceProjectOf(value: unknown): SourceProjectLaunch | undefined;
139
- /** What a replay run replays: the graded run, and the learned workflow at the digest it decides. */
139
+ /** What a replay run replays: the graded run, and the learned workflow at the digest it decides. `paidBy`: a replay
140
+ * that spends on run `paidBy`'s own model key (a keyed check, runner/promotion.ts), whose learning its cost is
141
+ * (learn/ledger.ts record), never its revision's. `deadlineAt` (ms): a learning child's deadline, its start +
142
+ * learning-work.ts LEARNING_CHILD_MS; the runner holding it cancels it there (runner.ts). */
140
143
  export interface Replay {
141
144
  readonly of: string;
142
145
  readonly workflow: string;
143
146
  readonly digest: string;
147
+ readonly paidBy?: string;
148
+ readonly deadlineAt?: number;
144
149
  }
145
150
  /** The disk a launch record names, and whose it is. */
146
151
  export interface LaunchDisk {
@@ -38,7 +38,14 @@ export function sourceProjectOf(value) {
38
38
  /** The disk a launch body names, as read back, or undefined. */
39
39
  const readDisk = (value) => isObject(value) && typeof value.disk_id === "string" && (value.kind === "launch" || value.kind === "agent") ? { diskId: value.disk_id, kind: value.kind } : undefined;
40
40
  /** The replay a launch body names, as read back, or undefined. */
41
- const readReplay = (value) => isObject(value) && typeof value.of === "string" && typeof value.workflow === "string" && typeof value.digest === "string" ? { of: value.of, workflow: value.workflow, digest: value.digest } : undefined;
41
+ const readReplay = (value) => {
42
+ if (!(isObject(value) && typeof value.of === "string" && typeof value.workflow === "string" && typeof value.digest === "string"))
43
+ return undefined;
44
+ const deadline = typeof value.deadline_at === "string" ? Date.parse(value.deadline_at) : Number.NaN;
45
+ return { of: value.of, workflow: value.workflow, digest: value.digest, ...(typeof value.paid_by === "string" ? { paidBy: value.paid_by } : {}), ...(Number.isFinite(deadline) ? { deadlineAt: deadline } : {}) };
46
+ };
47
+ /** A replay or an audit as a launch body keeps it. */
48
+ const replayBody = (replay) => ({ of: replay.of, workflow: replay.workflow, digest: replay.digest, ...(replay.paidBy ? { paid_by: replay.paidBy } : {}), ...(replay.deadlineAt !== undefined ? { deadline_at: new Date(replay.deadlineAt).toISOString() } : {}) });
42
49
  /** The trigger a launch body names, as read back: `{ id, firing_key }` and its firing's `attrs` (each a string) when it
43
50
  * kept them, or null (triggerOf of the old serve.json). */
44
51
  function readTrigger(value) {
@@ -98,8 +105,8 @@ export function launchBody(launch) {
98
105
  ...(launch.sourceProject ? { source_project: launch.sourceProject } : {}),
99
106
  ...(launch.learning ? { learning: { seed: launch.learning.seed, section: launch.learning.section, ...(launch.learning.workflows?.length ? { workflows: [...launch.learning.workflows] } : {}), ...(launch.learning.noWorkflows ? { noWorkflows: true } : {}), ...(launch.learning.model ? { model: launch.learning.model } : {}), ...(launch.learning.seedFailed ? { seedFailed: launch.learning.seedFailed } : {}), ...(launch.learning.use ? { use: true } : {}), ...(launch.learning.seededAt !== undefined ? { seededAt: launch.learning.seededAt } : {}) } } : {}),
100
107
  ...(launch.workflowFirst === false ? { workflow_first: false } : {}),
101
- ...(launch.replay ? { replay: { of: launch.replay.of, workflow: launch.replay.workflow, digest: launch.replay.digest } } : {}),
102
- ...(launch.audit ? { audit: { of: launch.audit.of, workflow: launch.audit.workflow, digest: launch.audit.digest } } : {}),
108
+ ...(launch.replay ? { replay: replayBody(launch.replay) } : {}),
109
+ ...(launch.audit ? { audit: replayBody({ of: launch.audit.of, workflow: launch.audit.workflow, digest: launch.audit.digest, ...(launch.audit.deadlineAt !== undefined ? { deadlineAt: launch.audit.deadlineAt } : {}) }) } : {}),
103
110
  ...(launch.trigger ? { trigger: launch.trigger } : {}),
104
111
  ...(launch.inputOrigin ? { input_origin: launch.inputOrigin } : {}),
105
112
  ...(launch.followUp ? { follow_up: true } : {}),
@@ -149,7 +156,7 @@ export function readLaunchBody(stored) {
149
156
  const model = readModel(stored.model);
150
157
  const boxAllow = readBoxAllow(stored.box_allow);
151
158
  const archilDisk = readDisk(stored.archil_disk);
152
- const refused = isObject(stored.hold) ? readRefusal(stored.hold.refused) : undefined;
159
+ const hold = readHold(stored.hold);
153
160
  return {
154
161
  input: stored.input,
155
162
  ...(isObject(stored.sdk) && sdkBindingOf(stored.sdk) && typeof stored.sdk.instructions === "string" ? { sdk: stored.sdk } : {}),
@@ -178,9 +185,22 @@ export function readLaunchBody(stored) {
178
185
  ...(inputOrigin ? { inputOrigin } : {}),
179
186
  ...(stored.follow_up === true ? { followUp: true } : {}),
180
187
  ...(archilDisk ? { archilDisk } : {}),
181
- ...(isObject(stored.hold) ? { hold: { minutes: typeof stored.hold.minutes === "number" ? stored.hold.minutes : HOLD_MINUTES, ...(refused ? { refused } : {}) } } : {}),
188
+ ...(hold ? { hold } : {}),
182
189
  };
183
190
  }
191
+ /** A launch's hold as it keeps it, else undefined (none kept). A minutes that isn't a number waits HOLD_MINUTES. A hold
192
+ * kept that is not an object (a corrupt row, another version's) is a hold whose model was refused, in words that name
193
+ * the field and never what it holds: read as none, the run would start and its claim open its model's keys. */
194
+ function readHold(value) {
195
+ if (value === undefined)
196
+ return undefined;
197
+ if (!isObject(value))
198
+ return { minutes: HOLD_MINUTES, refused: unreadable("hold") };
199
+ const refused = readRefusal(value.refused);
200
+ return { minutes: typeof value.minutes === "number" ? value.minutes : HOLD_MINUTES, ...(refused ? { refused } : {}) };
201
+ }
202
+ /** The refusal of a held run whose launch's `field` can't be read. */
203
+ const unreadable = (field) => ({ message: `This run's model was kept from running at its create, and its launch's ${field} can't be read: it holds its computer only. Start a new run to run its agent.`, fields: [], details: {} });
184
204
  /** A held run's model refusal as its launch keeps it, else undefined (none kept). One kept that can't be read (a corrupt
185
205
  * row, another version's) is a refusal still, in words that name the field and never what it holds: read as none, the
186
206
  * run would start and its claim open the keys its model was refused for. */
@@ -188,7 +208,7 @@ function readRefusal(value) {
188
208
  if (value === undefined)
189
209
  return undefined;
190
210
  if (!isObject(value) || typeof value.message !== "string" || !Array.isArray(value.fields) || !isObject(value.details))
191
- return { message: "This run's model was kept from running at its create, and its launch's hold.refused can't be read: it holds its computer only. Start a new run to run its agent.", fields: [], details: {} };
211
+ return unreadable("hold.refused");
192
212
  return { message: value.message, fields: value.fields, details: value.details };
193
213
  }
194
214
  /** The run's learning start (its seed sha, its # Learned section and its learned workflows), read from one place by learning's
@@ -35,7 +35,8 @@ export type ModelKeyTarget = {
35
35
  };
36
36
  /** A created run's ModelKeyTarget: its revision's kind and its launch's pinned model. A held run its model kept from
37
37
  * running (run-launch.ts hold.refused) pins none and makes no model call: no key is required for it, and one handed
38
- * with it is refused as never used (modelKeyMisfit). */
38
+ * with it is refused as never used (modelKeyMisfit). So its create asks no key (serverKeyMissing is false for it): a
39
+ * change that lets such a hold become an agent turn must check the run's model key at that turn. */
39
40
  export declare function keyTargetOf(launch: Pick<RunLaunch, "model" | "native">, revision: {
40
41
  readonly kind: string;
41
42
  }): ModelKeyTarget;
@@ -87,7 +87,8 @@ export function gatewayMove(env) {
87
87
  export const modelKeyRequired = (message, env) => new ApiError("model_key_required", `This server holds no model key for this run's model (AGENT_MODEL_API_KEY is not set and none is saved in Settings → Model keys), so each run's caller brings its own: send model_key with ${message ? "a message that starts a turn" : "the run"}, a key for the model gateway at AGENT_MODEL_BASE_URL (such as a LiteLLM virtual key) minted for ${message ? "that turn" : "this run"}.${env ? gatewayMove(env) : ""}`, { fields: [{ field: "model_key", reason: "missing", message: "model_key is required here: the server holds no model key for this run's model." }] });
88
88
  /** A created run's ModelKeyTarget: its revision's kind and its launch's pinned model. A held run its model kept from
89
89
  * running (run-launch.ts hold.refused) pins none and makes no model call: no key is required for it, and one handed
90
- * with it is refused as never used (modelKeyMisfit). */
90
+ * with it is refused as never used (modelKeyMisfit). So its create asks no key (serverKeyMissing is false for it): a
91
+ * change that lets such a hold become an agent turn must check the run's model key at that turn. */
91
92
  export function keyTargetOf(launch, revision) {
92
93
  return { kind: revision.kind, ...(launch.model ? { model: launch.model } : {}), native: Boolean(launch.native) };
93
94
  }
@@ -2,6 +2,7 @@ import { type InFlight } from "./in-flight.js";
2
2
  import type { Context } from "@earendil-works/chord/context";
3
3
  import type { TimelineEvent } from "./timeline/index.js";
4
4
  import type { IncomingMessage, ServerResponse } from "node:http";
5
+ import { cutInWorker } from "./cut-pool.js";
5
6
  import { type RunCut } from "./run-cut.js";
6
7
  import { type Page } from "./rows.js";
7
8
  import { type FileView } from "./run-files.js";
@@ -42,6 +43,12 @@ export interface RunReadsDeps {
42
43
  readonly context: Context;
43
44
  /** The server's seal key: a run's census names each file by a MAC under it (run-census.ts fileMac). */
44
45
  readonly sealKey: Buffer | undefined;
46
+ /** How long a cut read waits for its file's cut, made in the cut worker (cut-pool.ts), before it is refused 503: CUT_MS
47
+ * unless a test names less. */
48
+ readonly cutMs?: number;
49
+ /** What makes a cut read's cut: the server's cut worker (cutInWorker) unless a test names another, to see that the read
50
+ * answers the worker's text and refuses what the worker refuses. */
51
+ readonly cut?: typeof cutInWorker;
45
52
  }
46
53
  /** A run's files, through its Workspace (listRunFiles): every file, path-sorted, cut at the cap. A run with no folder lists
47
54
  * none; a run whose output is withheld refuses (403), as its graph does. The same shape the route answered. With `cut`
@@ -9,6 +9,7 @@ import { ApiError } from "./errors.js";
9
9
  import { GRAPH_CACHE_BYTES, PartCache, servedGraphView } from "./graph-served.js";
10
10
  import { runGraph } from "./graph-view.js";
11
11
  import { checkedPath, decodedPath } from "./home-path.js";
12
+ import { CUT_MS, cutInWorker, CutUnserved } from "./cut-pool.js";
12
13
  import { censusCut, censusDigest } from "./run-census.js";
13
14
  import { cutFileText } from "./run-file-cut.js";
14
15
  import { underCut } from "./run-cut.js";
@@ -80,7 +81,10 @@ export const WITHHELD_UNCOUNTED = "This run was handed secrets of its own, and i
80
81
  /** File `rel` of the run's `workspace` as UTF-8 text cut of everything the run's own cut holds (deps.cutValues, the set its
81
82
  * timeline's calls are cut of: the server's keys, the keys a person saved, its secret stores' values, the sign-in refs
82
83
  * the run was handed, and while its launch holds them what its caller handed it: its own model key, tool keys and MCP
83
- * credentials), through redactSecrets over the whole text, each value and secret shape replaced by "[redacted]" in
84
+ * credentials), through cutFileText (run-file-cut.ts: redactSecrets over the whole text) in the cut worker
85
+ * (cut-pool.ts), off this server's event loop and under one deadline for the read (deps.cutMs, CUT_MS): past it, or
86
+ * when the worker fails, the read is 503
87
+ * (`unavailable`), never the text uncut. Each value and secret shape is replaced by "[redacted]" in
84
88
  * place, and the text "[redacted]" whole when a value still shows in another form. A long run with no whitespace
85
89
  * (compact JSON) is never blanked for its length. Once an end erased what its caller handed it, the run's census says
86
90
  * where those sat (run-census.ts censusCut): a file still as counted is cut there too, and any other is withheld (403,
@@ -116,11 +120,33 @@ async function cutRunFile(store, runId, workspace, rel, req, res, deps) {
116
120
  }
117
121
  if (text.includes("\u0000"))
118
122
  throw new ApiError("unsupported_media_type", "a cut read answers text, and this file holds a NUL byte");
119
- const shown = await underCut(() => deps.cutValues(store, runId), async (cut) => {
123
+ // The cut is made in the cut worker, off this server's event loop, under one deadline for the whole read: every cut
124
+ // underCut asks for, and every read of the run's cut and census around them. Past it, or when the worker fails, the read
125
+ // is refused 503, never answered uncut, and never answered late.
126
+ const timeMs = deps.cutMs ?? CUT_MS;
127
+ const until = Date.now() + timeMs;
128
+ const unmade = (why) => new ApiError("unavailable", `this file's cut was not made (${why}), and it is never served uncut: read it again`);
129
+ const lateRead = `the read did not finish within ${timeMs} ms`;
130
+ const cutText = (values, held = []) => {
131
+ // Asked for past the deadline (the read has already been refused): no worker is started for it.
132
+ const left = until - Date.now();
133
+ if (left <= 0)
134
+ return Promise.reject(unmade(lateRead));
135
+ return (deps.cut ?? cutInWorker)(text, values, Buffer.byteLength(text), held, left).catch((error) => {
136
+ if (error instanceof CutUnserved)
137
+ throw unmade(error.message);
138
+ throw error;
139
+ });
140
+ };
141
+ let deadline;
142
+ const late = new Promise((_, reject) => {
143
+ deadline = setTimeout(() => reject(unmade(lateRead)), timeMs);
144
+ });
145
+ const made = underCut(() => deps.cutValues(store, runId), async (cut) => {
120
146
  if (cut === "unreadable")
121
147
  return { withheld: WITHHELD_SIGN_IN };
122
148
  if (cut.censusDigest === undefined)
123
- return { text: cutFileText(text, cut.values) };
149
+ return { text: await cutText(cut.values) };
124
150
  // The run's end erased what its caller handed it: where those sat in this file is its census's to say. Read here, the
125
151
  // one read that cuts by it; the cut names it by digest, so a census written since withholds this answer and the cut
126
152
  // read again after it (underCut) builds it anew.
@@ -130,8 +156,10 @@ async function cutRunFile(store, runId, workspace, rel, req, res, deps) {
130
156
  const held = censusCut(census, rel, bytes, text, deps.sealKey);
131
157
  if (held === "unreadable")
132
158
  return { withheld: WITHHELD_UNCOUNTED };
133
- return { text: cutFileText(text, cut.values, held) };
159
+ return { text: held === "whole" ? "[redacted]" : await cutText(cut.values, held) };
134
160
  });
161
+ // Whichever settles first. A read refused at its deadline leaves underCut to finish on its own, its answer dropped.
162
+ const shown = await Promise.race([made, late]).finally(() => clearTimeout(deadline));
135
163
  if ("withheld" in shown)
136
164
  throw new ApiError("forbidden", shown.withheld);
137
165
  const body = Buffer.from(shown.text);
package/dist/run-view.js CHANGED
@@ -234,7 +234,10 @@ export function answersOf(entries, { final } = {}) {
234
234
  }
235
235
  /** The run's active cap park, from its journal: the last agentrun.budget entry the cap wrote when it parked the run for
236
236
  * room, unless an agentrun.raise after it cleared the pause (the run goes on at the raised cap then). A re-park writes a
237
- * fresh budget entry, which a raise before it does not clear, so the last of the two in log order decides. */
237
+ * fresh budget entry, which a raise before it does not clear, so the last of the two in log order decides. A raise entry
238
+ * clears the park it names (its `pause`, as the runner reads it: raiseStateOf), or any when it names none (one written
239
+ * before raises named their pause): a retry of an earlier raise names that raise's pause, and the park the run stands at
240
+ * since stays. */
238
241
  function activeBudget(entries) {
239
242
  return activePark(entries)?.mark;
240
243
  }
@@ -244,8 +247,11 @@ function activePark(entries) {
244
247
  for (const entry of entries) {
245
248
  if (entry.kind === KINDS.budget)
246
249
  park = { mark: dataOf(entry), id: String(entry.id) };
247
- else if (entry.kind === KINDS.raise)
248
- park = undefined;
250
+ else if (entry.kind === KINDS.raise && park) {
251
+ const named = entry.data?.pause;
252
+ if (named === undefined || String(named) === park.id)
253
+ park = undefined;
254
+ }
249
255
  }
250
256
  return park;
251
257
  }
@@ -115,9 +115,11 @@ export declare function deniedComputer(revision: RevisionShape, settings: ToolSe
115
115
  * setting can be had here now, or its refusal (resolve-computer.ts computerReadiness); none given, the box check.
116
116
  * `shellOf`: where a run of an agent with that computer setting has its shell here now (resolve-computer.ts
117
117
  * runShellOf, in the server's mode): a sandbox-only tool on the runner is let by it (Mode 2's Archil exec runs bash);
118
- * none given, the runner has no shell. `capUsd`: a save's cap (with `capped`), whose shortfall for one more step and an
119
- * answer is a warning of its own (`short`, cap-short.ts); a run's check never names one. */
120
- export declare function blockersOf(env: NodeJS.ProcessEnv, revision: RevisionShape, settings?: ToolSettingsMap, { capped, capUsd, boxes, offers, mcp, monid, decisionPrice, computerReady, shellOf }?: {
118
+ * none given, the runner has no shell. `noExec`: in Mode 2, the server's Archil region where it has no serverless exec
119
+ * (archil-settings.ts noExecRegionOf), so a sandbox-only tool on the runner names a sandbox computer, never Docker's box,
120
+ * which can't mount Archil. `capUsd`: a save's cap (with `capped`), whose shortfall for one more step and an answer is
121
+ * a warning of its own (`short`, cap-short.ts); a run's check never names one. */
122
+ export declare function blockersOf(env: NodeJS.ProcessEnv, revision: RevisionShape, settings?: ToolSettingsMap, { capped, capUsd, boxes, offers, mcp, monid, decisionPrice, computerReady, shellOf, noExec }?: {
121
123
  capped?: boolean;
122
124
  capUsd?: number;
123
125
  boxes?: readonly BoxOffer[];
@@ -135,6 +137,7 @@ export declare function blockersOf(env: NodeJS.ProcessEnv, revision: RevisionSha
135
137
  readonly box?: string;
136
138
  }>;
137
139
  shellOf?: (setting: RevisionComputer) => Promise<ShellPlace>;
140
+ noExec?: string;
138
141
  }): Promise<Blocker[]>;
139
142
  /** A blocker as a field issue, for a 422 or a warning. */
140
143
  export declare const issueOf: ({ field, reason, message, fix }: Blocker) => InputIssue;
package/dist/runnable.js CHANGED
@@ -4,14 +4,15 @@
4
4
  // provider's key, a default model, a tier's model) saves as a warning. Either refuses a run, 409 agent_not_runnable.
5
5
  import { WORKFLOW_ADAPTERS } from "./runner/workflow-adapters.js";
6
6
  import { DECISION_ADAPTER, decisionModelsNamed, providerMissing, providersNamed } from "./decisions.js";
7
- import { isHostTool } from "./tool-list.js";
7
+ import { adapterBinds } from "./tool-list.js";
8
8
  import { sentence } from "./errors.js";
9
9
  import { DEFAULT_HARNESS, harnessOffers } from "./harness.js";
10
10
  import { harnessOf, onAdapter } from "./harness-table.js";
11
11
  import { capShortOf } from "./cap-short.js";
12
12
  import { chooseModel } from "./model.js";
13
13
  import { llmTiers, MODEL_NODES, nodeTiers, unpricedModels, workflowNodes } from "./model.js";
14
- import { boxAvailability, newAgentPlace, noPlaceIssue, placeFix } from "./place.js";
14
+ import { noExecWords } from "./archil-settings.js";
15
+ import { boxAvailability, newAgentPlace, noExecIssue, noPlaceIssue, placeFix } from "./place.js";
15
16
  import { allows, BOUND_TOOLS, CALL_TOOLS, grantedTools, missingEnv, NODE_TOOLS, shellTools, toolOf, workflowTools } from "./tools.js";
16
17
  import { DENIED, isUnavailable, NO_PARALLEL_KEY, planeFor, whyUnavailable } from "./tool-plane.js";
17
18
  import { computerDenied, denyPlace, permissionFrom, permissionKeys, permissionOf } from "./tool-gate.js";
@@ -69,9 +70,11 @@ export async function deniedComputer(revision, settings, shellOf) {
69
70
  * setting can be had here now, or its refusal (resolve-computer.ts computerReadiness); none given, the box check.
70
71
  * `shellOf`: where a run of an agent with that computer setting has its shell here now (resolve-computer.ts
71
72
  * runShellOf, in the server's mode): a sandbox-only tool on the runner is let by it (Mode 2's Archil exec runs bash);
72
- * none given, the runner has no shell. `capUsd`: a save's cap (with `capped`), whose shortfall for one more step and an
73
- * answer is a warning of its own (`short`, cap-short.ts); a run's check never names one. */
74
- export async function blockersOf(env, revision, settings = {}, { capped = false, capUsd, boxes = [], offers, mcp, monid, decisionPrice, computerReady, shellOf } = {}) {
73
+ * none given, the runner has no shell. `noExec`: in Mode 2, the server's Archil region where it has no serverless exec
74
+ * (archil-settings.ts noExecRegionOf), so a sandbox-only tool on the runner names a sandbox computer, never Docker's box,
75
+ * which can't mount Archil. `capUsd`: a save's cap (with `capped`), whose shortfall for one more step and an answer is
76
+ * a warning of its own (`short`, cap-short.ts); a run's check never names one. */
77
+ export async function blockersOf(env, revision, settings = {}, { capped = false, capUsd, boxes = [], offers, mcp, monid, decisionPrice, computerReady, shellOf, noExec } = {}) {
75
78
  const out = [];
76
79
  /** A web tool its run would resolve unavailable (tool-plane.ts): a warning at save, a 409 at a run, never another
77
80
  * provider in its place. One set to deny is not: its run starts, and the gate refuses each call. */
@@ -124,6 +127,12 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
124
127
  * Docker's box is not here and both ways out, fixing that or keeping the agent on the runner without the tool. Where
125
128
  * the runner has a shell that runs others (Mode 2's Archil exec runs bash), it says which. */
126
129
  const shellOnRunner = (tool, field, named) => {
130
+ // On a Mode 2 region with no exec the runner has no shell and Docker's box can't mount Archil: a sandbox computer is
131
+ // the one way to run the tool. With no place named, in the words its save is refused in (noExecIssue).
132
+ if (noExec !== undefined && !named)
133
+ return { ...noExecIssue(noExec), host: false, tool };
134
+ if (noExec !== undefined)
135
+ return { field, reason: "not_an_option", message: `${tool} runs only in a box, and this agent's place is the runner, which has no shell here: ${noExecWords(noExec)}, and the docker box can't mount Archil. Give it a sandbox computer (a box), or remove "${tool}" from definition.tools.`, fix: `Remove "${tool}" from definition.tools.`, host: false, tool };
127
136
  const fresh = newAgentPlace(boxes);
128
137
  if (!named && !runnerShell.size && "reason" in fresh) {
129
138
  // A tool the box refuses (the browser) keeps this agent out of every box, so naming one is no way out: its words
@@ -212,19 +221,20 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
212
221
  if (!allows(BOUND_TOOLS, tool))
213
222
  out.push({ field: `definition.tools[${index}]`, reason: "not_an_option", message: `${tool} is not a tool here: grant one of ${BOUND_TOOLS.join(", ")}, an MCP server's tool as mcp:<server>/<tool>, or a monid endpoint as monid:<provider>/<endpoint>.`, host: false, tool });
214
223
  // A shell runs in a box; on the runner (no place names one) only what its shell here runs (runnerShell).
215
- // One that names no place is refused at its place, once, whatever shell tools it names.
224
+ // One that names no place is refused once, whatever shell tools it names: at its place (Mode 1), or at its computer
225
+ // on a Mode 2 region with no exec.
216
226
  else if (toolOf(tool).sandboxOnly && (place?.mode ?? "runner") === "runner" && !runnerShell.has(tool)) {
217
227
  const blocker = shellOnRunner(tool, `definition.tools[${index}]`, !!place && !revision.unnamed);
218
- if (!out.some((b) => b.field === "definition.place" && b.message === blocker.message))
228
+ if (!out.some((b) => b.field === blocker.field && b.message === blocker.message))
219
229
  out.push(blocker);
220
230
  }
221
231
  // Its writes into work/ go by path from this machine, and a box's command could swap a link in on their way.
222
232
  else if (toolOf(tool).runnerOnly && place?.mode === "sandbox")
223
233
  out.push({ field: `definition.tools[${index}]`, reason: "not_an_option", message: `${tool} does not run in a sandbox place yet: it saves files into the run's work/ from this server, outside the box, and a command in the box could point those writes elsewhere on this server. Give it to an agent whose place is the runner.`, fix: `Remove "${tool}" from definition.tools.`, host: false, tool });
224
- // Another harness gets the host tools only (host-tools.ts: the file tools, ask_person, web_fetch and web_search):
225
- // any other tool this host binds (the browser, subagent, pdf_pages, llm) is pi's here and refuses the
226
- // run, never runs without it.
227
- else if (onAdapter(env, harness) && !isHostTool(tool))
234
+ // Another harness gets the host tools (host-tools.ts: the file tools, ask_person, web_fetch and web_search) and the
235
+ // browser (tool-list.ts adapterBinds): any other tool this host binds (subagent, pdf_pages, llm) is pi's here and
236
+ // refuses the run, never runs without it.
237
+ else if (onAdapter(env, harness) && !adapterBinds(tool))
228
238
  out.push({ field: `definition.tools[${index}]`, reason: NOT_SET_UP, message: `${tool} runs on pi here; on ${harness} it is not bound yet.`, host: true, tool });
229
239
  else {
230
240
  unset(`definition.tools[${index}]`, tool);