@parcha/agentrun-serve 0.1.0-beta.60 → 0.1.0-beta.62
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.
- package/CHANGELOG.md +124 -0
- package/README.md +139 -22
- package/dist/acp-package.d.ts +4 -0
- package/dist/api-only.d.ts +23 -1
- package/dist/api-only.js +43 -4
- package/dist/archil-settings.d.ts +9 -0
- package/dist/archil-settings.js +8 -1
- package/dist/bash-read-only.d.ts +3 -0
- package/dist/bash-read-only.js +6 -3
- package/dist/browser-person.d.ts +1 -1
- package/dist/browser-person.js +1 -1
- package/dist/calendar/tools.js +1 -1
- package/dist/chatgpt-plan.d.ts +26 -8
- package/dist/chatgpt-plan.js +89 -21
- package/dist/claude-login.d.ts +12 -5
- package/dist/claude-login.js +28 -3
- package/dist/cli.js +61 -18
- package/dist/composio-triggers.d.ts +9 -3
- package/dist/computers.d.ts +3 -0
- package/dist/computers.js +2 -1
- package/dist/console/assets/{backend-QnwGVBeU.js → backend-DEgVn5lC.js} +1 -1
- package/dist/console/assets/index-CG5tELph.js +639 -0
- package/dist/console/assets/share-CIeFK2Oe.js +6 -0
- package/dist/console/assets/{styles-CcceGcu2.js → styles-BGZxYkky.js} +2 -2
- package/dist/console/assets/{styles-fjQBFfMv.css → styles-D0SufbzK.css} +1 -1
- package/dist/console/index.html +3 -3
- package/dist/console/share.html +3 -3
- package/dist/cut-pool.d.ts +14 -0
- package/dist/cut-pool.js +98 -0
- package/dist/cut-worker.d.ts +14 -0
- package/dist/cut-worker.js +16 -0
- package/dist/decisions.d.ts +4 -0
- package/dist/decisions.js +9 -1
- package/dist/env-switch.d.ts +3 -0
- package/dist/env-switch.js +3 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/harness-check.js +2 -1
- package/dist/harness-recipe.d.ts +13 -2
- package/dist/harness-recipe.js +30 -7
- package/dist/harness-sign-in.js +2 -1
- package/dist/harness-table.d.ts +12 -3
- package/dist/harness-table.js +13 -8
- package/dist/import.d.ts +8 -1
- package/dist/import.js +36 -5
- package/dist/key-check.js +22 -8
- package/dist/key-refusal.js +6 -4
- package/dist/learn/secrets.d.ts +2 -1
- package/dist/learn/secrets.js +2 -2
- package/dist/learned-nodes.d.ts +37 -0
- package/dist/learned-nodes.js +24 -0
- package/dist/local-model.d.ts +144 -0
- package/dist/local-model.js +214 -0
- package/dist/mcp-gateway.d.ts +24 -0
- package/dist/mcp-gateway.js +97 -8
- package/dist/mcp-probe.d.ts +7 -0
- package/dist/mcp-probe.js +7 -0
- package/dist/mcp-servers-store.d.ts +7 -10
- package/dist/mcp-servers-store.js +15 -9
- package/dist/native/cli.js +5 -1
- package/dist/ollama-provider.d.ts +42 -0
- package/dist/ollama-provider.js +118 -2
- package/dist/openapi.js +85 -16
- package/dist/otel/tracer.d.ts +6 -3
- package/dist/otel/tracer.js +24 -6
- package/dist/page.d.ts +7 -0
- package/dist/page.js +17 -4
- package/dist/place.d.ts +28 -11
- package/dist/place.js +43 -14
- package/dist/print.d.ts +3 -2
- package/dist/print.js +8 -6
- package/dist/redact/match.d.ts +17 -4
- package/dist/redact/match.js +57 -15
- package/dist/run-export.js +4 -2
- package/dist/run-launch.js +16 -3
- package/dist/run-model-key.d.ts +2 -1
- package/dist/run-model-key.js +2 -1
- package/dist/run-reads-over-store.d.ts +7 -0
- package/dist/run-reads-over-store.js +32 -4
- package/dist/run-usage.js +3 -2
- package/dist/runnable.d.ts +6 -3
- package/dist/runnable.js +16 -6
- package/dist/runner/adapter-loop.d.ts +8 -1
- package/dist/runner/adapter-loop.js +148 -29
- package/dist/runner/adapter-run-spec.d.ts +9 -6
- package/dist/runner/adapter-run-spec.js +38 -52
- package/dist/runner/adapters/index.d.ts +4 -0
- package/dist/runner/adapters/index.js +2 -1
- package/dist/runner/adapters/pi.d.ts +3 -2
- package/dist/runner/adapters/pi.js +3 -1
- package/dist/runner/audit.d.ts +1 -1
- package/dist/runner/claim-secrets.d.ts +3 -1
- package/dist/runner/claim-secrets.js +18 -7
- package/dist/runner/cli-run-spec.js +24 -17
- package/dist/runner/compare-end.d.ts +1 -1
- package/dist/runner/dispatch.js +4 -2
- package/dist/runner/harness-loops.d.ts +14 -0
- package/dist/runner/harness-loops.js +51 -5
- package/dist/runner/held.d.ts +4 -1
- package/dist/runner/live-ticker.js +5 -4
- package/dist/runner/loop-contract.d.ts +4 -1
- package/dist/runner/mcp-claim.js +3 -2
- package/dist/runner/mcp-run.d.ts +24 -4
- package/dist/runner/mcp-run.js +47 -2
- package/dist/runner/meta-tools.js +4 -4
- package/dist/runner/metrics.d.ts +6 -0
- package/dist/runner/metrics.js +12 -4
- package/dist/runner/monid-run.js +3 -1
- package/dist/runner/native-loop.js +3 -3
- package/dist/runner/redact.d.ts +3 -0
- package/dist/runner/redact.js +7 -0
- package/dist/runner/run-child-host.d.ts +10 -6
- package/dist/runner/run-child-host.js +44 -29
- package/dist/runner/run-child.js +1 -0
- package/dist/runner/runner.js +2 -0
- package/dist/runner/sdk-loop.js +5 -3
- package/dist/runner/workflow-calls.d.ts +5 -1
- package/dist/runner/workflow-calls.js +65 -19
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +3 -1
- package/dist/runner/workflow-spec.d.ts +4 -0
- package/dist/runner/workflow-spec.js +18 -13
- package/dist/runs-over-store.d.ts +2 -2
- package/dist/runs-over-store.js +1 -1
- package/dist/secret-cut.js +7 -4
- package/dist/secret-rules.d.ts +0 -1
- package/dist/secret-rules.js +122 -88
- package/dist/server.d.ts +17 -1
- package/dist/server.js +208 -69
- package/dist/share-host.d.ts +111 -0
- package/dist/share-host.js +666 -0
- package/dist/slack.js +2 -1
- package/dist/store/postgres/migrate.js +3 -1
- package/dist/store-reads/analytics.d.ts +15 -0
- package/dist/store-reads/analytics.js +17 -0
- package/dist/store-reads/learning.d.ts +5 -4
- package/dist/store-reads/learning.js +7 -4
- package/dist/suggestions.js +32 -3
- package/dist/templates.d.ts +3 -1
- package/dist/templates.js +7 -3
- package/dist/tool-gate.d.ts +25 -9
- package/dist/tool-gate.js +58 -19
- package/dist/tool-plane.d.ts +24 -1
- package/dist/tool-plane.js +75 -3
- package/dist/tools.d.ts +12 -2
- package/dist/tools.js +42 -7
- package/dist/trigger-composio.js +1 -1
- package/dist/trigger-launch-hook.d.ts +2 -2
- package/dist/trigger-launch-hook.js +1 -1
- package/dist/triggers.d.ts +7 -4
- package/dist/triggers.js +4 -4
- package/dist/webhooks.d.ts +3 -0
- package/dist/webhooks.js +5 -0
- package/dist/workspace/archil-claim.d.ts +7 -3
- package/dist/workspace/archil-claim.js +13 -5
- package/dist/workspace/archil-mount-credential.d.ts +6 -0
- package/dist/workspace/archil-mount-credential.js +11 -0
- package/dist/workspace/computer-deps.d.ts +5 -3
- package/dist/workspace/computer-deps.js +11 -9
- package/dist/workspace/computer-for-claim.d.ts +6 -2
- package/dist/workspace/computer-for-claim.js +43 -12
- package/dist/workspace/computer-janitor.d.ts +7 -4
- package/dist/workspace/computer-janitor.js +7 -4
- package/dist/workspace/computer-kept.d.ts +7 -1
- package/dist/workspace/computer-kept.js +7 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +12 -3
- package/dist/workspace/mount-revoke-left.d.ts +16 -4
- package/dist/workspace/mount-revoke-left.js +42 -22
- package/dist/workspace/resolve-computer.d.ts +11 -5
- package/dist/workspace/resolve-computer.js +22 -13
- package/dist/workspace/run-end-computers.js +1 -1
- package/dist/workspace/run-tools.d.ts +10 -3
- package/dist/workspace/run-tools.js +5 -4
- package/dist/wrapped.d.ts +29 -2
- package/dist/wrapped.js +20 -3
- package/launcher/agentrun-serve +1 -1
- package/package.json +12 -12
- package/dist/console/assets/index-DZi-muIj.js +0 -629
- package/dist/console/assets/share-pz61zIn9.js +0 -6
package/dist/place.js
CHANGED
|
@@ -15,9 +15,24 @@
|
|
|
15
15
|
// it names a box or the runner, and no other box that answers is picked for it. A revision that names no place resolves
|
|
16
16
|
// the same way at each run (defaultPlaceOf): with a shell tool, this server's default_place, so where docker is there
|
|
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
|
-
// tools need no shell, and one with a tool the box refuses run on the runner.
|
|
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
|
+
// 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. 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";
|
|
19
24
|
import { BOX_IDS, BOXES_ENV, DEFAULT_BOX } from "./place-offers.js";
|
|
20
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
|
+
});
|
|
21
36
|
export const PLACE_MODES = ["runner", "sandbox"];
|
|
22
37
|
/** Every box, from what this server found at its start (place-offers.ts): one it did not find is not set up. */
|
|
23
38
|
export function boxAvailability(registry) {
|
|
@@ -56,9 +71,11 @@ export function newAgentPlace(registry) {
|
|
|
56
71
|
* (newAgentPlace) for an agentic revision with a tool that runs only in a box (`flags`, tools.ts: bash and the
|
|
57
72
|
* background tools); the runner for a workflow, which is never given a box, for one whose tools need no shell (none, or
|
|
58
73
|
* only read and write: a container would only hold up its start), and for one that names a tool the box refuses (the
|
|
59
|
-
* browser, runner-only for now).
|
|
60
|
-
|
|
61
|
-
|
|
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. */
|
|
77
|
+
export function defaultPlaceOf(kind, tools, registry, flags, runnerShell) {
|
|
78
|
+
if (kind === "workflow" || runnerShell !== false || !wantsBox(tools, flags))
|
|
62
79
|
return { mode: "runner" };
|
|
63
80
|
const fresh = newAgentPlace(registry);
|
|
64
81
|
return "place" in fresh ? fresh.place : { mode: "runner" };
|
|
@@ -73,10 +90,15 @@ const wantsBox = (tools, flags) => {
|
|
|
73
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
|
|
74
91
|
* tool that runs only in a box) and this server does not have Docker's box, and where the runner has no shell
|
|
75
92
|
* (`runnerShell` false: Mode 1). On Mode 2 the runner's exec is a shell, and such a definition saves for the runner as
|
|
76
|
-
* it always did, its tools checked there (runnable.ts)
|
|
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. */
|
|
77
97
|
export function noBoxRefusal(tools, registry, flags, runnerShell) {
|
|
78
|
-
if (runnerShell || !wantsBox(tools ?? NEW_AGENT_TOOLS, flags))
|
|
98
|
+
if (runnerShell === true || !wantsBox(tools ?? (runnerShell === false ? NEW_AGENT_TOOLS : []), flags))
|
|
79
99
|
return undefined;
|
|
100
|
+
if (runnerShell !== false)
|
|
101
|
+
return noExecIssue(runnerShell.noExec);
|
|
80
102
|
const fresh = newAgentPlace(registry);
|
|
81
103
|
return "reason" in fresh ? noPlaceIssue(registry) : undefined;
|
|
82
104
|
}
|
|
@@ -111,8 +133,10 @@ export function noBoxReason(registry, listed) {
|
|
|
111
133
|
* AGENTRUN_BOXES lists (`listed`), and, when none is ready, the boxes it does not list, with what to do.
|
|
112
134
|
* `byDefault`, with AGENTRUN_BOXES not set at all: short, the local box alone, said to be on by default, or why it is
|
|
113
135
|
* not, and where a new agent with no place goes then: it names its place, or, where the runner has a shell
|
|
114
|
-
* (`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. */
|
|
115
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.`] : [];
|
|
116
140
|
const boxes = boxAvailability(registry);
|
|
117
141
|
const ready = boxes.filter((box) => box.available).map((box) => box.id);
|
|
118
142
|
const said = ready.length ? [`${and(ready)} ${ready.length === 1 ? "is" : "are"} ready, so sandbox agents run their tools there.`] : [];
|
|
@@ -124,21 +148,26 @@ export function boxesLine(registry, listed, allow = "none", byDefault = false, r
|
|
|
124
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}` : ""}`));
|
|
125
149
|
if (byDefault) {
|
|
126
150
|
const box = defaultBox(registry);
|
|
151
|
+
if (!box?.available && noExec.length)
|
|
152
|
+
return [`Boxes: none.`, ...noExec, sentence(box?.reason ?? NO_REASON)].join(" ");
|
|
127
153
|
if (!box?.available)
|
|
128
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)}`;
|
|
129
|
-
return [`Boxes: ${box.id} (on by default; set ${BOXES_ENV} to change).`, ...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(" ");
|
|
130
156
|
}
|
|
131
|
-
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(" ");
|
|
132
158
|
}
|
|
133
159
|
/** `places` in capabilities: the modes a revision may name, the place a new agent is saved with and a revision that
|
|
134
160
|
* names none runs in (`default_place`), each box, and the hosts a box whose `network` is `allowlist` reaches (`allow`,
|
|
135
|
-
* box-settings.ts boxAllowOf; empty for `none`). `default_place` is
|
|
136
|
-
*
|
|
137
|
-
* place, and `default_reason` is the words a no-place create is refused in
|
|
138
|
-
*
|
|
161
|
+
* box-settings.ts boxAllowOf; empty for `none`). `default_place` is the runner where it has a shell (`runnerShell`:
|
|
162
|
+
* Mode 2's Archil exec), Docker answering or not (defaultPlaceOf); else Docker's box where this server has it; else
|
|
163
|
+
* null, no default: a new agent names its place, and `default_reason` is the words a no-place create is refused in
|
|
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. */
|
|
139
166
|
export const placesOf = (registry, allow = "none", runnerShell = false) => {
|
|
140
167
|
const fresh = newAgentPlace(registry);
|
|
141
|
-
const byDefault =
|
|
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 };
|
|
142
171
|
return { modes: [...PLACE_MODES], ...byDefault, boxes: boxAvailability(registry).map(stated), allow: allow === "none" ? [] : [...allow] };
|
|
143
172
|
};
|
|
144
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. `
|
|
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. `
|
|
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.
|
|
19
|
-
?
|
|
20
|
-
: o.
|
|
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
|
}
|
package/dist/redact/match.d.ts
CHANGED
|
@@ -70,12 +70,23 @@ export type Needles = {
|
|
|
70
70
|
export declare function merged(found: readonly (readonly [number, number])[]): Span[];
|
|
71
71
|
/** `text` with each of `spans` (merged, in order) replaced by "[redacted]". */
|
|
72
72
|
export declare function cutAt(text: string, spans: readonly Span[]): string;
|
|
73
|
+
/** What ends each pass of a join (joinOf). Every view keeps it, and no needle holds it, so no held value reads across
|
|
74
|
+
* it. It cannot be a NUL, as the views drop control characters wherever they come from (the text, or an escape or an
|
|
75
|
+
* encoding that decodes to one), and a separator they dropped would join the passes. It is U+FFFF, a noncharacter:
|
|
76
|
+
* squeeze, which every plain and joined needle is made with, drops it, and a hex, folded or base64 needle is ASCII.
|
|
77
|
+
* Only the one joinOf puts there separates. One the text brought shows as a box at most, and a reader reads a held
|
|
78
|
+
* value through it, so the views drop it as they drop a control character, as it stands or as a decoder made it, and
|
|
79
|
+
* joinOf reads one in a part's text as a NUL (one character for one, so every offset stays, and dropped too). A
|
|
80
|
+
* caller that marks places in a text with its own (secret-cut.ts) asks holds for `separated`. */
|
|
81
|
+
export declare const SEPARATOR = "\uFFFF";
|
|
73
82
|
/** `text` as a view reads it, and as a held value's needles are read: decomposed (NFKD), its combining marks dropped,
|
|
74
83
|
* then NFKC, with its whitespace and its characters that render as nothing gone, before (so one between a letter and
|
|
75
84
|
* its accent hides neither) and after. A held value with a zero-width space or a soft hyphen between its characters
|
|
76
|
-
* reads as itself
|
|
85
|
+
* reads as itself, and so does one with a control character between them (a NUL, an escape); so does one with a
|
|
86
|
+
* combining mark after a letter, which NFKC alone composes into another letter
|
|
77
87
|
* ("Z" and U+0301 into "Ź"), and one written with a precomposed letter in place of its own ("Ź" for "Z"). A held
|
|
78
|
-
* value's accents are dropped the same way, so it reads as itself with them or without: more cutting, never less.
|
|
88
|
+
* value's accents are dropped the same way, so it reads as itself with them or without: more cutting, never less.
|
|
89
|
+
* SEPARATOR goes too, so no needle holds it (a join's view keeps it, never squeezing it). */
|
|
79
90
|
export declare const squeeze: (text: string) => string;
|
|
80
91
|
/** One of Python's own escapes at `at`, as its repr writes a str: an escaped apostrophe ("\'", in a string that holds
|
|
81
92
|
* both quotes) is an apostrophe, "\x" and two hex digits the character they number; with `levels` 2, either written
|
|
@@ -112,10 +123,12 @@ export declare function entityAt(text: string, at: number): {
|
|
|
112
123
|
* form encoded, an NFKC variant, its hex in any case, a hex identifier folded (`fold`), split across two strings of a
|
|
113
124
|
* JSON text (joinOf; a "+" after its head or a quote of its own in it too), or split there at its own "," or ":"
|
|
114
125
|
* (`joined`). With `cuts`, a value whose every character the view read comes from inside the cuts is not held: it is
|
|
115
|
-
* cut in place.
|
|
116
|
-
|
|
126
|
+
* cut in place. A U+FFFF in `text` is nothing to the views (SEPARATOR); with `separated`, each one is the caller's
|
|
127
|
+
* mark and separates there in every view. */
|
|
128
|
+
export declare function holds(text: string, needles: Needles, { fold, cuts, separated }?: {
|
|
117
129
|
fold?: boolean;
|
|
118
130
|
cuts?: readonly Span[];
|
|
131
|
+
separated?: boolean;
|
|
119
132
|
}): boolean;
|
|
120
133
|
/** planCut's first step: every form, hex, folded identifier and shape of `text` as it came, and `held`, merged. */
|
|
121
134
|
export declare function cutSpans(text: string, needles: Needles, shapes: readonly Shape[], held?: readonly (readonly [number, number])[]): Span[];
|
package/dist/redact/match.js
CHANGED
|
@@ -724,17 +724,33 @@ export function cutAt(text, spans) {
|
|
|
724
724
|
}
|
|
725
725
|
const HEX = only("0123456789abcdefABCDEF");
|
|
726
726
|
const BLANKS = /[\t-\r ]+/y;
|
|
727
|
-
/**
|
|
728
|
-
|
|
727
|
+
/** Whether a UTF-16 unit is a control character that is no whitespace: U+0000-0008, U+000E-001F, U+007F-009F (a NUL,
|
|
728
|
+
* an escape, a delete, a C1 control). It renders as nothing, so the views drop it as they drop whitespace. Tab, line
|
|
729
|
+
* feed, vertical tab, form feed and carriage return (U+0009-000D) are whitespace (isSpace) and read as such. */
|
|
730
|
+
const isControl = (code) => code <= 0x08 || (code >= 0x0e && code <= 0x1f) || (code >= 0x7f && code <= 0x9f);
|
|
731
|
+
/** What ends each pass of a join (joinOf). Every view keeps it, and no needle holds it, so no held value reads across
|
|
732
|
+
* it. It cannot be a NUL, as the views drop control characters wherever they come from (the text, or an escape or an
|
|
733
|
+
* encoding that decodes to one), and a separator they dropped would join the passes. It is U+FFFF, a noncharacter:
|
|
734
|
+
* squeeze, which every plain and joined needle is made with, drops it, and a hex, folded or base64 needle is ASCII.
|
|
735
|
+
* Only the one joinOf puts there separates. One the text brought shows as a box at most, and a reader reads a held
|
|
736
|
+
* value through it, so the views drop it as they drop a control character, as it stands or as a decoder made it, and
|
|
737
|
+
* joinOf reads one in a part's text as a NUL (one character for one, so every offset stays, and dropped too). A
|
|
738
|
+
* caller that marks places in a text with its own (secret-cut.ts) asks holds for `separated`. */
|
|
739
|
+
export const SEPARATOR = "\uffff";
|
|
740
|
+
/** A character that renders as nothing (a zero-width space, a soft hyphen, a byte order mark, a variation selector, a
|
|
741
|
+
* control character that is no whitespace: isControl), and SEPARATOR. */
|
|
742
|
+
const IGNORABLE = /[\p{Default_Ignorable_Code_Point}\u0000-\u0008\u000e-\u001f\u007f-\u009f\uffff]+/gu;
|
|
729
743
|
const GONE = /[\s\p{Default_Ignorable_Code_Point}]+/gu;
|
|
730
744
|
/** Combining marks: an accent, a cedilla, an enclosing circle. */
|
|
731
745
|
const MARKS = /\p{M}+/gu;
|
|
732
746
|
/** `text` as a view reads it, and as a held value's needles are read: decomposed (NFKD), its combining marks dropped,
|
|
733
747
|
* then NFKC, with its whitespace and its characters that render as nothing gone, before (so one between a letter and
|
|
734
748
|
* its accent hides neither) and after. A held value with a zero-width space or a soft hyphen between its characters
|
|
735
|
-
* reads as itself
|
|
749
|
+
* reads as itself, and so does one with a control character between them (a NUL, an escape); so does one with a
|
|
750
|
+
* combining mark after a letter, which NFKC alone composes into another letter
|
|
736
751
|
* ("Z" and U+0301 into "Ź"), and one written with a precomposed letter in place of its own ("Ź" for "Z"). A held
|
|
737
|
-
* value's accents are dropped the same way, so it reads as itself with them or without: more cutting, never less.
|
|
752
|
+
* value's accents are dropped the same way, so it reads as itself with them or without: more cutting, never less.
|
|
753
|
+
* SEPARATOR goes too, so no needle holds it (a join's view keeps it, never squeezing it). */
|
|
738
754
|
export const squeeze = (text) => text.replace(IGNORABLE, "").normalize("NFKD").replace(MARKS, "").normalize("NFKC").replace(GONE, "");
|
|
739
755
|
/** A run of percent-encoded bytes, decoded as UTF-8 (decoded). */
|
|
740
756
|
const PERCENT = {
|
|
@@ -941,7 +957,7 @@ function familiesOf(text) {
|
|
|
941
957
|
const viewSpec = (when, decoders, join) => ({
|
|
942
958
|
when,
|
|
943
959
|
decoders,
|
|
944
|
-
special: new RegExp(`[\\s${decoders.map((decoder) => `\\${decoder.trigger}`).join("")}\\
|
|
960
|
+
special: new RegExp(`[\\s${decoders.map((decoder) => `\\${decoder.trigger}`).join("")}\\u0000-\\u0008\\u000e-\\u001f\\u007f-\\uffff]`, "g"),
|
|
945
961
|
...(join ? { join } : {}),
|
|
946
962
|
});
|
|
947
963
|
/** The views of a text read for each held value, in order:
|
|
@@ -1080,8 +1096,8 @@ function partsOf(text, from, to, level, out, kind = "nested", written) {
|
|
|
1080
1096
|
}
|
|
1081
1097
|
/** `text`'s join of `kind` (JoinKind): its parts (partsOf) read three times over, each time joined, each part followed by a space (gone
|
|
1082
1098
|
* from the view, and no escape reads past it): the values and the runs outside strings; the property names; then all
|
|
1083
|
-
* of them. Each pass is closed by
|
|
1084
|
-
* passes. A held value split across two values with a name between them ({"title":"see <H>","snippet":"<R> more"}),
|
|
1099
|
+
* of them. Each pass is closed by SEPARATOR, which a view of a join keeps and no needle holds, so no value reads across
|
|
1100
|
+
* two passes (holds reads a U+FFFF the text brought as a NUL first, so it is the only one). A held value split across two values with a name between them ({"title":"see <H>","snippet":"<R> more"}),
|
|
1085
1101
|
* across two names, across a name and its value, across a quote of JSON written in a string, or across a string and
|
|
1086
1102
|
* the line after the JSON reads whole in one of them. A view decodes and squeezes the join as any text (viewOf), each
|
|
1087
1103
|
* part's characters keeping their source: with `cuts` (merged spans of `text`), the spans of each part a cut covers
|
|
@@ -1125,7 +1141,7 @@ function joinOf(text, kind, cuts) {
|
|
|
1125
1141
|
pieces.push(text.slice(part.from, part.to), " ");
|
|
1126
1142
|
length += part.to - part.from + 1;
|
|
1127
1143
|
}
|
|
1128
|
-
pieces.push(
|
|
1144
|
+
pieces.push(SEPARATOR);
|
|
1129
1145
|
length++;
|
|
1130
1146
|
}
|
|
1131
1147
|
// The join written once.
|
|
@@ -1144,9 +1160,12 @@ function bothOf(first, second) {
|
|
|
1144
1160
|
/** `text` as the whole-text check reads it: decoded by `spec`'s decoders, then squeezed (squeeze: NFKC, its whitespace
|
|
1145
1161
|
* and its characters that render as nothing gone), as a held value's needles are. The squeeze is applied to each
|
|
1146
1162
|
* stretch of non-ASCII characters with the ASCII character before it, which gives what it gives over the whole text (an
|
|
1147
|
-
* ASCII character is a starter nothing composes onto), and each character it makes comes from that whole stretch.
|
|
1163
|
+
* ASCII character is a starter nothing composes onto), and each character it makes comes from that whole stretch. A
|
|
1164
|
+
* control character (isControl) is dropped, as it stands or as a decoder made it, and so is SEPARATOR, unless
|
|
1165
|
+
* `separates` and it stands in the text as it is (a join's own, or a caller's: holds), where it is copied, never
|
|
1166
|
+
* squeezed. With `cuts` (merged spans of `text`), the view's
|
|
1148
1167
|
* covered stretches: where every character comes from inside one cut. */
|
|
1149
|
-
function viewOf(text, spec, cuts) {
|
|
1168
|
+
function viewOf(text, spec, cuts, separates = false) {
|
|
1150
1169
|
const out = [];
|
|
1151
1170
|
const covered = [];
|
|
1152
1171
|
let length = 0;
|
|
@@ -1222,7 +1241,12 @@ function viewOf(text, spec, cuts) {
|
|
|
1222
1241
|
group = undefined;
|
|
1223
1242
|
};
|
|
1224
1243
|
const unit = (char, from, to) => {
|
|
1225
|
-
|
|
1244
|
+
const code = char.charCodeAt(0);
|
|
1245
|
+
// A control character, or SEPARATOR, as it stands or decoded, is nothing: dropped before anything is flushed, so
|
|
1246
|
+
// the characters either side of it compose as they would with it gone (as squeeze drops it before NFKD).
|
|
1247
|
+
if (isControl(code) || char === SEPARATOR)
|
|
1248
|
+
return;
|
|
1249
|
+
if (code >= 128) {
|
|
1226
1250
|
if (group) {
|
|
1227
1251
|
group.chars += char;
|
|
1228
1252
|
group.to = to;
|
|
@@ -1271,6 +1295,13 @@ function viewOf(text, spec, cuts) {
|
|
|
1271
1295
|
held = { char: text[BLANKS.lastIndex - 1], from: BLANKS.lastIndex - 1, to: BLANKS.lastIndex };
|
|
1272
1296
|
at = BLANKS.lastIndex;
|
|
1273
1297
|
}
|
|
1298
|
+
else if (separates && char === SEPARATOR) {
|
|
1299
|
+
// A separator as it stands is copied, never squeezed, and nothing composes across it.
|
|
1300
|
+
flushGroup();
|
|
1301
|
+
flushHeld();
|
|
1302
|
+
emit(char, stop, stop + 1);
|
|
1303
|
+
at = stop + 1;
|
|
1304
|
+
}
|
|
1274
1305
|
else {
|
|
1275
1306
|
unit(char, stop, stop + 1);
|
|
1276
1307
|
at = stop + 1;
|
|
@@ -1382,24 +1413,35 @@ function holdsIn(view, covered, needles) {
|
|
|
1382
1413
|
* form encoded, an NFKC variant, its hex in any case, a hex identifier folded (`fold`), split across two strings of a
|
|
1383
1414
|
* JSON text (joinOf; a "+" after its head or a quote of its own in it too), or split there at its own "," or ":"
|
|
1384
1415
|
* (`joined`). With `cuts`, a value whose every character the view read comes from inside the cuts is not held: it is
|
|
1385
|
-
* cut in place.
|
|
1386
|
-
|
|
1416
|
+
* cut in place. A U+FFFF in `text` is nothing to the views (SEPARATOR); with `separated`, each one is the caller's
|
|
1417
|
+
* mark and separates there in every view. */
|
|
1418
|
+
export function holds(text, needles, { fold = true, cuts, separated = false } = {}) {
|
|
1387
1419
|
const folds = fold ? needles.folds : [];
|
|
1388
1420
|
if (!needles.plain.length && !needles.hexes.length && !folds.length)
|
|
1389
1421
|
return false;
|
|
1390
1422
|
const has = familiesOf(text);
|
|
1423
|
+
// What the joins read: the text with each U+FFFF it brought read as a NUL (SEPARATOR), so the only one in a join is
|
|
1424
|
+
// the one joinOf puts after each pass; with `separated`, the text as it is. Read once, on the first join.
|
|
1425
|
+
let source;
|
|
1426
|
+
const joinText = () => {
|
|
1427
|
+
if (source === undefined) {
|
|
1428
|
+
scanned.chars += text.length;
|
|
1429
|
+
source = !separated && text.includes(SEPARATOR) ? text.replaceAll(SEPARATOR, "\u0000") : text;
|
|
1430
|
+
}
|
|
1431
|
+
return source;
|
|
1432
|
+
};
|
|
1391
1433
|
const joins = new Map();
|
|
1392
1434
|
const joinFor = (kind) => {
|
|
1393
1435
|
let join = joins.get(kind);
|
|
1394
1436
|
if (!join)
|
|
1395
|
-
joins.set(kind, (join = kind === "both" ? bothOf(joinFor("quoted"), joinFor("again")) : joinOf(
|
|
1437
|
+
joins.set(kind, (join = kind === "both" ? bothOf(joinFor("quoted"), joinFor("again")) : joinOf(joinText(), kind, cuts)));
|
|
1396
1438
|
return join;
|
|
1397
1439
|
};
|
|
1398
1440
|
for (const spec of VIEWS) {
|
|
1399
1441
|
if (!spec.when(has))
|
|
1400
1442
|
continue;
|
|
1401
1443
|
const join = spec.join ? joinFor(spec.join) : undefined;
|
|
1402
|
-
const view = join ? viewOf(join.text, spec, join.cuts) : viewOf(text, spec, cuts);
|
|
1444
|
+
const view = join ? viewOf(join.text, spec, join.cuts, true) : viewOf(text, spec, cuts, separated);
|
|
1403
1445
|
const covered = cuts ? view.covered : undefined;
|
|
1404
1446
|
if (holdsIn(view.text, covered, needles.plain))
|
|
1405
1447
|
return true;
|
package/dist/run-export.js
CHANGED
|
@@ -147,7 +147,9 @@ export async function exportBundle(input) {
|
|
|
147
147
|
// before the scrubber reads them: a held value the scrubber's own reading misses (wrapped over line breaks, re-encoded)
|
|
148
148
|
// is withheld there. A census-cut run carries no file at all (filesOf), so no census applies here.
|
|
149
149
|
const listed = await filesOf(input.files, input.filesTruncated, input.filesUncounted === true, caps);
|
|
150
|
-
|
|
150
|
+
// `source` is the path as the run wrote it, never written into the bundle: the scrubber reads a file's content knowing
|
|
151
|
+
// it (a `.env.<held value>` file is still an env file, cut whole), and the bundle carries the cut path alone.
|
|
152
|
+
const carried = listed.carried.map((file) => ({ path: cutFileText(file.path, input.held), source: file.path, content: cutFileText(file.content, input.held) }));
|
|
151
153
|
const omitted = listed.omitted.map((one) => (one.what === "file" ? { ...one, path: cutFileText(one.path, input.held) } : one));
|
|
152
154
|
const kind = String(input.view.kind);
|
|
153
155
|
// What is cut: everything that came from the run. The format and source are this server's own words.
|
|
@@ -244,7 +246,7 @@ export async function exportBundle(input) {
|
|
|
244
246
|
const cutFile = async (file, index, restoring) => {
|
|
245
247
|
const before = { cuts: cuts.length, restored: restored.length, seen: new Set(seen.keys()) };
|
|
246
248
|
const path = await cutString(file.path, `/files/${index}/path`, undefined, restoring);
|
|
247
|
-
const content = await cutString(file.content, `/files/${index}/content`, { path: file.
|
|
249
|
+
const content = await cutString(file.content, `/files/${index}/content`, { path: file.source }, restoring);
|
|
248
250
|
const undo = () => {
|
|
249
251
|
cuts.splice(before.cuts);
|
|
250
252
|
restored.splice(before.restored);
|
package/dist/run-launch.js
CHANGED
|
@@ -149,7 +149,7 @@ export function readLaunchBody(stored) {
|
|
|
149
149
|
const model = readModel(stored.model);
|
|
150
150
|
const boxAllow = readBoxAllow(stored.box_allow);
|
|
151
151
|
const archilDisk = readDisk(stored.archil_disk);
|
|
152
|
-
const
|
|
152
|
+
const hold = readHold(stored.hold);
|
|
153
153
|
return {
|
|
154
154
|
input: stored.input,
|
|
155
155
|
...(isObject(stored.sdk) && sdkBindingOf(stored.sdk) && typeof stored.sdk.instructions === "string" ? { sdk: stored.sdk } : {}),
|
|
@@ -178,9 +178,22 @@ export function readLaunchBody(stored) {
|
|
|
178
178
|
...(inputOrigin ? { inputOrigin } : {}),
|
|
179
179
|
...(stored.follow_up === true ? { followUp: true } : {}),
|
|
180
180
|
...(archilDisk ? { archilDisk } : {}),
|
|
181
|
-
...(
|
|
181
|
+
...(hold ? { hold } : {}),
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
+
/** A launch's hold as it keeps it, else undefined (none kept). A minutes that isn't a number waits HOLD_MINUTES. A hold
|
|
185
|
+
* kept that is not an object (a corrupt row, another version's) is a hold whose model was refused, in words that name
|
|
186
|
+
* the field and never what it holds: read as none, the run would start and its claim open its model's keys. */
|
|
187
|
+
function readHold(value) {
|
|
188
|
+
if (value === undefined)
|
|
189
|
+
return undefined;
|
|
190
|
+
if (!isObject(value))
|
|
191
|
+
return { minutes: HOLD_MINUTES, refused: unreadable("hold") };
|
|
192
|
+
const refused = readRefusal(value.refused);
|
|
193
|
+
return { minutes: typeof value.minutes === "number" ? value.minutes : HOLD_MINUTES, ...(refused ? { refused } : {}) };
|
|
194
|
+
}
|
|
195
|
+
/** The refusal of a held run whose launch's `field` can't be read. */
|
|
196
|
+
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
197
|
/** 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
198
|
* row, another version's) is a refusal still, in words that name the field and never what it holds: read as none, the
|
|
186
199
|
* run would start and its claim open the keys its model was refused for. */
|
|
@@ -188,7 +201,7 @@ function readRefusal(value) {
|
|
|
188
201
|
if (value === undefined)
|
|
189
202
|
return undefined;
|
|
190
203
|
if (!isObject(value) || typeof value.message !== "string" || !Array.isArray(value.fields) || !isObject(value.details))
|
|
191
|
-
return
|
|
204
|
+
return unreadable("hold.refused");
|
|
192
205
|
return { message: value.message, fields: value.fields, details: value.details };
|
|
193
206
|
}
|
|
194
207
|
/** The run's learning start (its seed sha, its # Learned section and its learned workflows), read from one place by learning's
|
package/dist/run-model-key.d.ts
CHANGED
|
@@ -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;
|
package/dist/run-model-key.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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-usage.js
CHANGED
|
@@ -350,7 +350,8 @@ const RESOURCE_ORDER = { vcpu: 0, memory: 1, gpu: 2, disk: 3 };
|
|
|
350
350
|
const micro = (value) => Math.round(value * 1e6) / 1e6;
|
|
351
351
|
/** The run's `compute_time` lines: one per provider and resource of the computers it made (`rows`), each second of each at
|
|
352
352
|
* its figure, an open one's up to `at` (the read), and the part no claim held (its life less its booked time) apart in
|
|
353
|
-
* `unheld_quantity
|
|
353
|
+
* `unheld_quantity` (0 for a provider that bills nothing: none of its time costs anything, booked or not, so none is
|
|
354
|
+
* outside the run's cost). Its money is what the run's ledger booked for it (`booked`, by computeKey): `estimate` when any was;
|
|
354
355
|
* $0 for a provider that bills nothing; else `unpriced`, its usd null. A figure no one said makes its quantity null. */
|
|
355
356
|
function computeLinesOf(rows, at, booked, spans) {
|
|
356
357
|
const sums = new Map();
|
|
@@ -395,7 +396,7 @@ function computeLinesOf(rows, at, booked, spans) {
|
|
|
395
396
|
return {
|
|
396
397
|
meter: "compute_time", model: null, provider: sum.provider, charged_by: sum.provider,
|
|
397
398
|
quantity: sum.quantity === null ? null : micro(sum.quantity), unit: COMPUTE_UNITS[sum.resource], basis: charged || free ? "estimate" : "unpriced", ...sum.at, ...words,
|
|
398
|
-
resource: sum.resource, gpu_type: sum.gpuType, unheld_quantity: sum.unheld === null ? null : micro(sum.unheld), open_computers: sum.open,
|
|
399
|
+
resource: sum.resource, gpu_type: sum.gpuType, unheld_quantity: unmetered(sum.provider) ? 0 : sum.unheld === null ? null : micro(sum.unheld), open_computers: sum.open,
|
|
399
400
|
...(sum.open > 0 ? { measured_to: new Date(at).toISOString() } : {}),
|
|
400
401
|
};
|
|
401
402
|
});
|
package/dist/runnable.d.ts
CHANGED
|
@@ -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. `
|
|
119
|
-
*
|
|
120
|
-
|
|
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;
|