@parcha/agentrun-serve 0.1.0-beta.60 → 0.1.0-beta.61
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 +58 -0
- package/README.md +42 -14
- package/dist/acp-package.d.ts +4 -0
- package/dist/api-only.d.ts +19 -1
- package/dist/api-only.js +38 -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/cli.js +42 -10
- package/dist/console/assets/{backend-QnwGVBeU.js → backend-C9ffXUR5.js} +1 -1
- package/dist/console/assets/index-BnZV3lvW.js +639 -0
- package/dist/console/assets/{share-pz61zIn9.js → share-B1o5mJ56.js} +2 -2
- package/dist/console/assets/{styles-CcceGcu2.js → styles-D_znYrHR.js} +2 -2
- package/dist/console/index.html +2 -2
- package/dist/console/share.html +2 -2
- 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 +5 -3
- package/dist/harness-table.js +7 -5
- 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 +36 -0
- package/dist/learned-nodes.js +23 -0
- package/dist/local-model.d.ts +144 -0
- package/dist/local-model.js +214 -0
- package/dist/mcp-probe.d.ts +7 -0
- package/dist/mcp-probe.js +7 -0
- package/dist/ollama-provider.d.ts +35 -0
- package/dist/ollama-provider.js +108 -2
- package/dist/openapi.js +59 -7
- package/dist/place.d.ts +7 -6
- package/dist/place.js +13 -10
- package/dist/print.js +1 -1
- 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-usage.js +3 -2
- package/dist/runner/adapter-loop.d.ts +8 -1
- package/dist/runner/adapter-loop.js +100 -20
- package/dist/runner/adapter-run-spec.d.ts +3 -5
- package/dist/runner/adapter-run-spec.js +26 -43
- 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/cli-run-spec.js +13 -10
- package/dist/runner/compare-end.d.ts +1 -1
- package/dist/runner/dispatch.js +2 -2
- package/dist/runner/harness-loops.d.ts +9 -0
- package/dist/runner/harness-loops.js +47 -4
- package/dist/runner/held.d.ts +4 -1
- package/dist/runner/live-ticker.js +3 -4
- package/dist/runner/mcp-claim.js +3 -2
- package/dist/runner/mcp-run.d.ts +19 -4
- package/dist/runner/mcp-run.js +29 -2
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -3
- package/dist/runner/monid-run.js +3 -1
- package/dist/runner/native-loop.js +1 -1
- package/dist/runner/redact.d.ts +3 -0
- package/dist/runner/redact.js +7 -0
- package/dist/runner/run-child-host.js +1 -1
- package/dist/runner/sdk-loop.js +5 -3
- package/dist/runner/workflow-calls.d.ts +4 -1
- package/dist/runner/workflow-calls.js +35 -18
- 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.js +97 -83
- package/dist/server.d.ts +7 -0
- package/dist/server.js +97 -34
- package/dist/slack.js +2 -1
- package/dist/store/postgres/migrate.js +3 -1
- package/dist/store-reads/learning.d.ts +5 -4
- package/dist/store-reads/learning.js +7 -4
- package/dist/tool-plane.d.ts +23 -1
- package/dist/tool-plane.js +70 -2
- package/dist/tools.d.ts +12 -2
- package/dist/tools.js +42 -7
- 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/package.json +12 -12
- package/dist/console/assets/index-DZi-muIj.js +0 -629
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { WORKFLOW_CALLERS } from "../learning-cost.js";
|
|
8
8
|
import { learnedCallEntries } from "../learned-nodes.js";
|
|
9
9
|
import { KINDS } from "./journal-kinds.js";
|
|
10
|
-
import { callCostOf } from "./metrics.js";
|
|
10
|
+
import { callCostOf, callTurnsOf } from "./metrics.js";
|
|
11
11
|
import { WORKFLOW_FIRST, WORKFLOW_FIRST_CALL } from "./workflow-first.js";
|
|
12
12
|
const dataOf = (entry) => (entry.data ?? {});
|
|
13
13
|
const callIdOf = (entry) => {
|
|
@@ -82,24 +82,23 @@ function piShared(entries, from, to) {
|
|
|
82
82
|
}
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
function callUsdOf(entries, callId, recordAt) {
|
|
85
|
+
/** Call `callId`'s window in `entries`, from its start (its call start entry, or on pi the answer that asked for it) to
|
|
86
|
+
* the later of its end (its call end, or pi's tool result) and its record (`recordAt`); none when the window is not its
|
|
87
|
+
* alone: no start, a pi answer that asked for another call beside it, another conversation's tool at work in it on pi
|
|
88
|
+
* (piShared: a sibling subagent's), or another call (none of its own) started within it or still open at its start (a
|
|
89
|
+
* nesting tool's, or the call it runs inside, is its own). */
|
|
90
|
+
function callWindowOf(entries, callId, recordAt) {
|
|
92
91
|
const started = entries.findIndex((entry) => entry.kind === KINDS.callStart && callIdOf(entry) === callId);
|
|
93
92
|
const asked = started < 0 ? entries.findIndex((entry) => piCallsOf(entry).includes(callId)) : -1;
|
|
94
93
|
const from = started >= 0 ? started : asked;
|
|
95
94
|
if (from < 0 || from > recordAt)
|
|
96
|
-
return
|
|
95
|
+
return undefined;
|
|
97
96
|
if (asked >= 0 && piCallsOf(entries[asked]).length > 1)
|
|
98
|
-
return
|
|
97
|
+
return undefined;
|
|
99
98
|
const start = (started >= 0 ? entries[from].data : {});
|
|
100
99
|
const to = Math.max(recordAt, entries.findLastIndex((entry) => (entry.kind === KINDS.callEnd && callIdOf(entry) === callId) || piResultOf(entry) === callId));
|
|
101
100
|
if (asked >= 0 && piShared(entries, from, to))
|
|
102
|
-
return
|
|
101
|
+
return undefined;
|
|
103
102
|
// A call that holds this one (a nesting tool's: its id a prefix of this one's, or the harness's own call it runs in).
|
|
104
103
|
const holds = (id) => callId.startsWith(`${id}/`) || start.parent === id || start.parentCallId === id;
|
|
105
104
|
const open = new Set();
|
|
@@ -114,21 +113,36 @@ function callUsdOf(entries, callId, recordAt) {
|
|
|
114
113
|
open.delete(id);
|
|
115
114
|
}
|
|
116
115
|
if ([...open].some((id) => !holds(id)))
|
|
117
|
-
return
|
|
116
|
+
return undefined;
|
|
118
117
|
for (let at = from + 1; at <= to; at++) {
|
|
119
118
|
const entry = entries[at];
|
|
120
119
|
const id = callIdOf(entry);
|
|
121
120
|
if (entry.kind === KINDS.callStart && id !== undefined && !within(id, callId))
|
|
122
|
-
return
|
|
121
|
+
return undefined;
|
|
123
122
|
}
|
|
124
|
-
return
|
|
123
|
+
return { from, to };
|
|
124
|
+
}
|
|
125
|
+
/** What call `callId` booked (runner/metrics.ts callCostOf) over its window (callWindowOf); null with none. Never a
|
|
126
|
+
* guess: a cost that can't be told apart is unknown. */
|
|
127
|
+
function callUsdOf(entries, callId, recordAt) {
|
|
128
|
+
const window = callWindowOf(entries, callId, recordAt);
|
|
129
|
+
return window ? callCostOf(entries, callId, window.from, window.to) : null;
|
|
130
|
+
}
|
|
131
|
+
/** Whether anything was booked under call `callId` (runner/metrics.ts callTurnsOf): a request named under it, or one of
|
|
132
|
+
* host work in its window while that window is its alone. */
|
|
133
|
+
function bookedUnder(entries, callId, recordAt) {
|
|
134
|
+
const window = callWindowOf(entries, callId, recordAt);
|
|
135
|
+
return callTurnsOf(entries, callId, window?.from ?? -1, window?.to ?? -1).size > 0;
|
|
125
136
|
}
|
|
126
137
|
/** Each learned workflow call run `entries` show (every conversation's, in log order: store-reads/journal.ts runEntries),
|
|
127
138
|
* in the order the calls first kept a record, from the record that counts for each (a call run again after a park or a
|
|
128
139
|
* crash keeps one each time: learnedCallEntries): its workflow, digest and caller, how it ended, and what it booked (callUsdOf). The
|
|
129
140
|
* platform's call ends as the run's WORKFLOW_FIRST entry says (its answer shaped, or taken back to the agent); one a
|
|
130
141
|
* crash cut before its record was kept is that entry's alone, its cost unknown. A call its record says was refused
|
|
131
|
-
* before any node ran (`refused`) is `refused`, whoever called it
|
|
142
|
+
* before any node ran (`refused`) is `refused`, whoever called it, and booked $0, while nothing was booked under its
|
|
143
|
+
* call id (bookedUnder); one an earlier attempt spent under (a crash cut it, and its rerun was refused: at its gate, at
|
|
144
|
+
* runLearned's check of its call nodes' tools, or the platform's at serveFirst) is `failed`, at what it booked. A
|
|
145
|
+
* record that names no digest or caller is left out. */
|
|
132
146
|
export function workflowCallsOf(entries) {
|
|
133
147
|
// The record that counts for each call (learned-nodes.ts learnedCallEntries): a rerun refused before any node ran leaves
|
|
134
148
|
// the attempt that ran standing, as the call's timeline row does.
|
|
@@ -139,9 +153,12 @@ export function workflowCallsOf(entries) {
|
|
|
139
153
|
const served = entries.findLast((entry) => entry.kind === WORKFLOW_FIRST && ["answered", "handed_back"].includes(String(entry.data?.outcome)))?.data;
|
|
140
154
|
const calls = [...newest].map(([call, at]) => {
|
|
141
155
|
const data = dataOf(entries[at]);
|
|
142
|
-
// Refused before any node ran (its record's `refused`): it ran nothing, whatever the
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
// Refused before any node ran (its record's `refused`) with nothing booked under its id: it ran nothing, whatever the
|
|
157
|
+
// run did after. Refused with something booked: an earlier attempt ran and spent, so it failed.
|
|
158
|
+
const refused = data.refused === true && !bookedUnder(entries, call, at);
|
|
159
|
+
const outcome = refused ? "refused" : data.refused === true ? "failed" : call === WORKFLOW_FIRST_CALL && served ? served.outcome : outcomeOf(data.ended);
|
|
160
|
+
// A refused call ran nothing: its $ is 0, never a shared window's unknown (two denied calls in one pi answer).
|
|
161
|
+
return { workflow: data.workflow, digest: data.digest, caller: data.caller, outcome, usd: refused ? 0 : callUsdOf(entries, call, at) };
|
|
145
162
|
});
|
|
146
163
|
if (served && !newest.has(WORKFLOW_FIRST_CALL) && typeof served.workflow === "string" && typeof served.digest === "string") {
|
|
147
164
|
calls.unshift({ workflow: served.workflow, digest: served.digest, caller: "platform", outcome: served.outcome, usd: null });
|
|
@@ -5,7 +5,7 @@ import type { Workflow } from "@parcha/agentrun-dsl";
|
|
|
5
5
|
import { type WorkflowTaskHost } from "../workflow/task.js";
|
|
6
6
|
import { type BudgetData, type EndData } from "./journal-kinds.js";
|
|
7
7
|
import { type Claim, type Journal, type LoopFactory } from "./loop-contract.js";
|
|
8
|
-
import type
|
|
8
|
+
import { type HeldRedact } from "./redact.js";
|
|
9
9
|
/** A cap refusal, as the kernel cap hands one to parkOf/checkRaise (the loop never imports the cap; its rule is handed in
|
|
10
10
|
* via the spec, so flat or tiered pricing is the cap's, not this loop's). */
|
|
11
11
|
/** `node`: the label of the workflow node whose step the cap held (a model node's request, a call node's call, a
|
|
@@ -23,6 +23,7 @@ import { createWorkflowExtension } from "../workflow/task.js";
|
|
|
23
23
|
import { readWorkflowRun, startWorkflowRevision, workflowCarry } from "../workflow-run.js";
|
|
24
24
|
import { KINDS } from "./journal-kinds.js";
|
|
25
25
|
import { stopEnd } from "./loop-contract.js";
|
|
26
|
+
import { mustHold } from "./redact.js";
|
|
26
27
|
import { END_PATCH_MS, END_PATCH_UNKNOWN, readAgain } from "./loop.js";
|
|
27
28
|
/** A paused run's words, its row's summary while it waits for a resume. */
|
|
28
29
|
export const PAUSED_WORDS = "Paused.";
|
|
@@ -34,6 +35,7 @@ export function createWorkflowLoop(specOf) {
|
|
|
34
35
|
return (deps) => workflowLoop(specOf, deps);
|
|
35
36
|
}
|
|
36
37
|
function workflowLoop(specOf, deps) {
|
|
38
|
+
mustHold(deps.redact, "A workflow loop");
|
|
37
39
|
let harness;
|
|
38
40
|
let workflows;
|
|
39
41
|
let runId;
|
|
@@ -193,7 +195,7 @@ function workflowLoop(specOf, deps) {
|
|
|
193
195
|
const patch = await readAgain(() => endPatch(data), late, (error, tries, last) => {
|
|
194
196
|
// Cut of every secret the runner holds (LoopDeps.redact): an error's text may echo one.
|
|
195
197
|
const text = error?.message ?? String(error);
|
|
196
|
-
const cut = deps.redact
|
|
198
|
+
const cut = deps.redact(text);
|
|
197
199
|
console.warn(last ? `[runner] ${runId}: its end's patch failed ${tries} times, last: ${cut}; the end is written with its cost and metrics unknown` : `[runner] ${runId}: its end's patch failed: ${cut}; read again`);
|
|
198
200
|
});
|
|
199
201
|
if (patch === "late") {
|
|
@@ -3,6 +3,7 @@ import { type DecisionProvider, type LoadImage, type Workflow } from "@parcha/ag
|
|
|
3
3
|
import { type BeforeRequest, type Wire } from "@parcha/agentrun-kernel";
|
|
4
4
|
import { type ProviderPolicy, type ProxyUsage } from "@parcha/agentrun-kernel/host";
|
|
5
5
|
import { type CapModel, type RunDecisions } from "@parcha/agentrun-kernel/kernel/cap";
|
|
6
|
+
import type { RunLaunch } from "../run-launch.js";
|
|
6
7
|
import { type Tier } from "../model.js";
|
|
7
8
|
import { deniedText } from "../refusal-words.js";
|
|
8
9
|
import { type PaidBooking } from "../paid-calls.js";
|
|
@@ -61,6 +62,9 @@ export interface WorkflowSpecDeps {
|
|
|
61
62
|
readonly sealKey?: Buffer;
|
|
62
63
|
/** The runner's data directory: what the server keeps sealed beside the store is read from it (store-secrets.ts). */
|
|
63
64
|
readonly data?: string;
|
|
65
|
+
/** The claim's plane as the runner hands it (harness-loops.ts: the launch's, under the server's settings now), over the
|
|
66
|
+
* launch's own. */
|
|
67
|
+
readonly plane?: RunLaunch["plane"];
|
|
64
68
|
/** Resolves the provider and cap model for each tier the workflow names (byTier's model, its provider, its price).
|
|
65
69
|
* Absent: the runner's model route (routeProviderOf), so a workflow and a pi run resolve models one way; a test gives a
|
|
66
70
|
* scripted one. */
|
|
@@ -23,7 +23,7 @@ import { askedBefore, catalogPrice, JEV_INPUT_USD, PARALLEL_DECISION_USD } from
|
|
|
23
23
|
import { decisionProvidersIn } from "../decisions.js";
|
|
24
24
|
import { imageLoader } from "../pdf-pages.js";
|
|
25
25
|
import { llmTiers, nodeTiers, workflowNodes } from "../model.js";
|
|
26
|
-
import { CALL_TOOLS, toolOf, workflowTools } from "../tools.js";
|
|
26
|
+
import { answersCutInside, CALL_TOOLS, toolOf, workflowTools } from "../tools.js";
|
|
27
27
|
import { forModel } from "../result.js";
|
|
28
28
|
import { WEB_FETCH_TOOL } from "../web-fetch.js";
|
|
29
29
|
import { runGate } from "../tool-gate.js";
|
|
@@ -44,7 +44,7 @@ import { KINDS, NODE_LOG_SESSION, WORKFLOW_SESSION } from "./journal-kinds.js";
|
|
|
44
44
|
import { cutStrings } from "../key-refusal.js";
|
|
45
45
|
import { CLOSE_MS } from "./loop.js";
|
|
46
46
|
import { PAUSED_WORDS } from "./workflow-loop.js";
|
|
47
|
-
import { holdClaimed } from "./redact.js";
|
|
47
|
+
import { holdClaimed, mustHold } from "./redact.js";
|
|
48
48
|
import { holdStored } from "./store-secrets.js";
|
|
49
49
|
import { workflowHost } from "./workflow-host.js";
|
|
50
50
|
import { SUBMIT_TOOL } from "../workflow/host-tools.js";
|
|
@@ -137,11 +137,11 @@ export function workflowSpecOf(deps) {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
async function claimSpec(claim, run, proxies) {
|
|
140
|
+
const redact = mustHold(run?.redact, "A workflow run's spec");
|
|
140
141
|
/** The keys a claim opens, held by the runner's one redactor (run.redact) before a decision can echo one. */
|
|
141
142
|
const holding = async (opening) => {
|
|
142
143
|
const opened = await opening;
|
|
143
|
-
|
|
144
|
-
holdClaimed(run.redact, opened);
|
|
144
|
+
holdClaimed(redact, opened);
|
|
145
145
|
return opened;
|
|
146
146
|
};
|
|
147
147
|
const claimed = await readClaim(deps, claim.runId);
|
|
@@ -153,15 +153,15 @@ export function workflowSpecOf(deps) {
|
|
|
153
153
|
if (unbound !== undefined)
|
|
154
154
|
throw new Error(nodeToolUnboundText(unbound));
|
|
155
155
|
// Every secret the server keeps sealed (store-secrets.ts) held by the runner's one redactor before the workflow runs.
|
|
156
|
-
if (
|
|
157
|
-
await holdStored(
|
|
156
|
+
if (deps.sealKey)
|
|
157
|
+
await holdStored(redact, deps.store, deps.sealKey, deps.data);
|
|
158
158
|
const tiers = tiersOf(claimed.workflow);
|
|
159
159
|
// The run's own keys, as the server's runnable check reads them: each by its name from the runner's environment first,
|
|
160
160
|
// then the store's sealed value (claim-secrets.ts; the environment wins, rule 4), scoped to what the run needs. Its
|
|
161
161
|
// models, its decisions, its call nodes' effects and its model nodes' tools all run on these, never on another run's
|
|
162
162
|
// keys or on this process's whole environment.
|
|
163
163
|
// Held by the runner's one redactor before anything can echo one (holding: run.redact), as the decision keys were.
|
|
164
|
-
const claimedEnv = await holding(claimSecrets({ store: deps.store, sealKey: deps.sealKey, ...(deps.env ? { env: deps.env } : {}), redact
|
|
164
|
+
const claimedEnv = await holding(claimSecrets({ store: deps.store, sealKey: deps.sealKey, ...(deps.env ? { env: deps.env } : {}), redact }, claimed.revision, { plane: claimed.plane }, claim.runId));
|
|
165
165
|
// The run's models resolve the one way the runner resolves any (routeProviderOf over routeOf), unless a test gives its
|
|
166
166
|
// own: each tier's key from the runner's environment, else the one the claim opened (a key saved in
|
|
167
167
|
// Settings → Model keys runs the next run with no restart).
|
|
@@ -171,8 +171,8 @@ export function workflowSpecOf(deps) {
|
|
|
171
171
|
const runKey = await claimModelKey({ store: deps.store, sealKey: deps.sealKey, env: deps.env ?? process.env }, claim.runId);
|
|
172
172
|
if (keyedAtClaim(runKey))
|
|
173
173
|
withoutModelKeys(claimedEnv);
|
|
174
|
-
if (runKey
|
|
175
|
-
holdRunKey(
|
|
174
|
+
if (runKey)
|
|
175
|
+
holdRunKey(redact, runKey);
|
|
176
176
|
const providerOf = deps.providerOf ?? routeProviderOf(claimModelEnv(deps.env ?? process.env, [claimedEnv], runKey, claim));
|
|
177
177
|
// Each tier's provider and cap model, resolved once; the proxies start here (before the Harness opens, since the models
|
|
178
178
|
// catalog the Harness takes points at them), their hooks deferred to the booking wired at harnessReady.
|
|
@@ -265,6 +265,7 @@ export function workflowSpecOf(deps) {
|
|
|
265
265
|
const nodeHost = {
|
|
266
266
|
where: { root: claimed.workRoot, work: claimed.workRoot, ref: { id: claim.runId } },
|
|
267
267
|
env: callEnv,
|
|
268
|
+
redact,
|
|
268
269
|
install: (extension) => void installed.push(extension),
|
|
269
270
|
onConversation: () => { },
|
|
270
271
|
beforeResume: () => { },
|
|
@@ -272,11 +273,15 @@ export function workflowSpecOf(deps) {
|
|
|
272
273
|
};
|
|
273
274
|
const nodeBindings = await bindNodeTools(nodeNames, nodeHost);
|
|
274
275
|
// Each node tool as the node gets it and the registry holds it: booked on the run's one ledger (bookedNodeTools), in an
|
|
275
|
-
// extension of its own; the binding's raw extension (installed through `installed`) is never put in the registry.
|
|
276
|
+
// extension of its own; the binding's raw extension (installed through `installed`) is never put in the registry. Its
|
|
277
|
+
// answer, and a throw's words, pass the run's one redactor (tools.ts answersCutInside) before the node's model or the
|
|
278
|
+
// journal sees them, as an agentic run's tools do (adapter-run-spec.ts answersCut): a page or a search result can
|
|
279
|
+
// echo a key the run holds.
|
|
276
280
|
const nodeTools = new Map();
|
|
277
281
|
for (const [name, binding] of nodeBindings) {
|
|
278
282
|
const booked = bookedNodeTools(binding, () => paidTools, parkAt);
|
|
279
|
-
|
|
283
|
+
const tools = run?.redact ? booked.tools.map((tool) => answersCutInside(tool, run.redact)) : booked.tools;
|
|
284
|
+
nodeTools.set(name, { tools, extensions: [defineExtension({ name: `node-tool-${name}`, tools: tools })] });
|
|
280
285
|
}
|
|
281
286
|
const nodePolicy = callPolicyOf(deps.store, claim.runId, claimed);
|
|
282
287
|
const tierModel = (tier) => (providers.get(tier ?? "default") ?? providers.get("default"))?.capModel;
|
|
@@ -310,7 +315,7 @@ export function workflowSpecOf(deps) {
|
|
|
310
315
|
// would book beside the run's ledger), and the run's gate over them by name (main's registry.install).
|
|
311
316
|
sharedExtensions: [nodeToolGate(nodeNames, nodePolicy), ...[...nodeTools.values()].flatMap((binding) => binding.extensions)],
|
|
312
317
|
nodeTool: (name) => nodeTools.get(name),
|
|
313
|
-
runEffect: runEffectOf(claimed, complete, callEnv, callPolicyOf(deps.store, claim.runId, claimed), () => paidTools, (line) => nodeLog?.append([{ kind: KINDS.nodeEffect, data:
|
|
318
|
+
runEffect: runEffectOf(claimed, complete, callEnv, callPolicyOf(deps.store, claim.runId, claimed), () => paidTools, (line) => nodeLog?.append([{ kind: KINDS.nodeEffect, data: cutStrings(line, redact) }]) ?? Promise.resolve()),
|
|
314
319
|
workRoot: claimed.workRoot,
|
|
315
320
|
flush: () => deps.store.flush(),
|
|
316
321
|
// A decision node books through the run's one cap (admitted and settled as main holds it); a cap refusal for room
|
|
@@ -1049,6 +1054,6 @@ async function readClaim(deps, runId) {
|
|
|
1049
1054
|
const input = launch && typeof launch.input === "object" && launch.input !== null ? launch.input : {};
|
|
1050
1055
|
const capUsd = typeof launch?.max_cost_usd === "number" ? launch.max_cost_usd : undefined;
|
|
1051
1056
|
const workRoot = typeof launch?.documents === "string" ? launch.documents : "/tmp";
|
|
1052
|
-
return { agentId: run.agentId, revisionId: run.revisionId, revision: revision, workflow: revision.body.workflow, input, capUsd, workRoot, plane: launch?.plane };
|
|
1057
|
+
return { agentId: run.agentId, revisionId: run.revisionId, revision: revision, workflow: revision.body.workflow, input, capUsd, workRoot, plane: deps.plane ?? launch?.plane };
|
|
1053
1058
|
}
|
|
1054
1059
|
export { BACKGROUND_CONTEXT };
|
|
@@ -172,8 +172,8 @@ export interface StartDeps {
|
|
|
172
172
|
admitted?(): Promise<void>;
|
|
173
173
|
} | undefined>;
|
|
174
174
|
};
|
|
175
|
-
/** Where a revision naming these tools and no place runs here (server.ts fallbackPlace). */
|
|
176
|
-
fallbackPlace(kind: "agentic" | "workflow", tools: readonly unknown[]): Place
|
|
175
|
+
/** Where a revision naming these tools and no place runs here, in the folder mode of now (server.ts fallbackPlace). */
|
|
176
|
+
fallbackPlace(kind: "agentic" | "workflow", tools: readonly unknown[]): Promise<Place>;
|
|
177
177
|
/** The Archil disk the run's launch record keeps (server.ts launchDiskOf): the one its body's `archil_disk` names, else
|
|
178
178
|
* its agent's when it has one now; undefined for neither, or in Mode 1. A disk named in Mode 1 is refused. Absent, no
|
|
179
179
|
* disk is kept. */
|
package/dist/runs-over-store.js
CHANGED
|
@@ -756,7 +756,7 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
|
|
|
756
756
|
const refused = await deps.runnersRefused?.();
|
|
757
757
|
if (refused !== undefined)
|
|
758
758
|
throw new ApiError("runner_refused", refused);
|
|
759
|
-
const place = resolvePlace(rbody.place, deps.fallbackPlace(revision.kind, revision.kind === "agentic" ? (rbody.tools ?? []) : []));
|
|
759
|
+
const place = resolvePlace(rbody.place, await deps.fallbackPlace(revision.kind, revision.kind === "agentic" ? (rbody.tools ?? []) : []));
|
|
760
760
|
// A held computer (computer-held.ts): only one that speaks the protocol, its kind as the claim reads it (the
|
|
761
761
|
// revision's computer, else its place's). Read before the run's check, which defers a held run's model refusal.
|
|
762
762
|
const hold = holdOf(body, (settingOfDefinition(rbody)?.computer ?? computerOfPlace(place)).kind);
|
package/dist/secret-cut.js
CHANGED
|
@@ -10,6 +10,7 @@ secretLintProfiler.setEnabled(false);
|
|
|
10
10
|
import { keyShaped } from "./secret-name.js";
|
|
11
11
|
import { secretValues } from "./api-token.js";
|
|
12
12
|
import { MIN_SECRET, valueMatcher } from "./learn/secrets.js";
|
|
13
|
+
import { SEPARATOR } from "./redact/match.js";
|
|
13
14
|
import { userInfo } from "node:os";
|
|
14
15
|
import { commandReadPath, decodedTimes, inputSpan, isPlaceholder, KEY_RUN_MAX, lineBounds, lineCount, RESTORABLE, SCRUB_RULES, shapeOf, viewsOf } from "./secret-rules.js";
|
|
15
16
|
export { isPlaceholder, RESTORABLE, RULE_PATTERNS, SCRUB_RULES, viewsOf } from "./secret-rules.js";
|
|
@@ -378,7 +379,9 @@ function contextOf(view, opts) {
|
|
|
378
379
|
/** Whether a cut text holds nothing the scrub must cut: no known format the format rules still find in any view of any
|
|
379
380
|
* chunk of it (each marker read as a blank, so a marker is never one), and no held value in any form (valueMatcher:
|
|
380
381
|
* split by whitespace, partly encoded) in the text as written or in any decoding of it, each marker read as a
|
|
381
|
-
* character no form holds
|
|
382
|
+
* character no form holds and every view keeps (SEPARATOR, read with valueMatcher's `separated`: a NUL would not do,
|
|
383
|
+
* as the views drop control characters). A U+FFFF the text brought is read as a NUL first, nothing to the views, so
|
|
384
|
+
* only a marker separates. The time budget holds here too (a throw). */
|
|
382
385
|
async function clean(rules, out, opts, run) {
|
|
383
386
|
const blanked = out.replace(MARKER, (found) => " ".repeat(found.length));
|
|
384
387
|
const formats = rules.filter((rule) => rule.kind === "format");
|
|
@@ -395,9 +398,9 @@ async function clean(rules, out, opts, run) {
|
|
|
395
398
|
const held = heldOf(opts);
|
|
396
399
|
if (!held.length)
|
|
397
400
|
return true;
|
|
398
|
-
const matches = valueMatcher(held);
|
|
399
|
-
for (const view of viewsOf(out
|
|
400
|
-
if (matches(view.source))
|
|
401
|
+
const matches = valueMatcher(held, { separated: true });
|
|
402
|
+
for (const view of viewsOf(out)) {
|
|
403
|
+
if (matches(view.source.replaceAll(SEPARATOR, "\u0000").replace(MARKER, SEPARATOR)))
|
|
401
404
|
return false;
|
|
402
405
|
inTime(run);
|
|
403
406
|
}
|
package/dist/secret-rules.js
CHANGED
|
@@ -2517,6 +2517,10 @@ function after(lines, at, fits) {
|
|
|
2517
2517
|
/** A shell's prompt opening a line: the next command, where a file's printed contents end. */
|
|
2518
2518
|
const PROMPT_LINE = /^\s{0,8}(?:[$#%❯]|>>?)\s{1,3}\S/;
|
|
2519
2519
|
const notPrompt = (body) => !PROMPT_LINE.test(body);
|
|
2520
|
+
/** A user's prompt opening a line, `$`, `%` or `❯`, and the command after it. `#` and `>` are left out: they open a
|
|
2521
|
+
* markdown heading or quote far more often than a root prompt (`# Export`), and their env commands are read by
|
|
2522
|
+
* ENV_COMMAND as before. */
|
|
2523
|
+
const PROMPT_HEAD = /^\s{0,8}[$%❯]\s{1,3}(?=\S)/;
|
|
2520
2524
|
/** A line that is a dump's cut already made: no file's content (ruling VIII: a cut text read again is cut no more). */
|
|
2521
2525
|
const DUMP_MARKER_LINE = /^\s{0,8}\[redacted:[a-z0-9-]{1,64}(?: \d{1,9} lines)?\]\s{0,8}$/;
|
|
2522
2526
|
const notMarker = (body) => !DUMP_MARKER_LINE.test(body);
|
|
@@ -2534,12 +2538,28 @@ const ENV_NAMES = new Set(["PATH", "HOME", "SHELL", "USER", "PWD", "LANG"]);
|
|
|
2534
2538
|
const ENV_UNCOMMANDED_LINES = 8;
|
|
2535
2539
|
/** NAME=value lines in a row printed by an env command on the line before (a blank between allowed), any number of
|
|
2536
2540
|
* them; eight or more holding two login names; or all `declare -x` lines (export -p's own output, its command's mark).
|
|
2537
|
-
* And the values printenv NAME... or echo $KEY prints, one line a name
|
|
2541
|
+
* And the values printenv NAME... or echo $KEY prints, one line a name; and all of a prompted command's output when
|
|
2542
|
+
* the command prints the environment. */
|
|
2538
2543
|
function envDumps(text) {
|
|
2539
2544
|
const lines = linesOf(text);
|
|
2540
2545
|
const out = [];
|
|
2541
2546
|
for (let at = 0; at < lines.length;) {
|
|
2542
2547
|
const body = lines[at].body;
|
|
2548
|
+
// A prompt line whose command prints the environment (11-25 r2): its output runs to the next `$`, `%` or `❯`
|
|
2549
|
+
// prompt or a dump's marker, whatever its lines look like: a multi-line value no longer ends it.
|
|
2550
|
+
const prompt = PROMPT_HEAD.exec(body);
|
|
2551
|
+
if (prompt && printsEnvironment(body.slice(prompt[0].length))) {
|
|
2552
|
+
let to = at;
|
|
2553
|
+
// Only a `$`, `%` or `❯` prompt ends it: a `#` or `>` line is a value's comment or quote, or a continued command.
|
|
2554
|
+
while (to + 1 < lines.length && !PROMPT_HEAD.test(lines[to + 1].body) && notMarker(lines[to + 1].body))
|
|
2555
|
+
to++;
|
|
2556
|
+
while (to > at && blank(lines[to]))
|
|
2557
|
+
to--;
|
|
2558
|
+
if (to > at)
|
|
2559
|
+
out.push({ start: rawStart(text, lines[at + 1].start), end: lines[to].end });
|
|
2560
|
+
at = to + 1;
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2543
2563
|
const named = PRINTENV_NAMES.exec(body);
|
|
2544
2564
|
const echoed = ECHO_VARIABLE.exec(body);
|
|
2545
2565
|
if (named || (echoed && secretName(echoed[2]))) {
|
|
@@ -2579,63 +2599,56 @@ const readPath = (body) => READ_COMMAND.exec(body)?.[2] ?? READ_TOOL.exec(body)?
|
|
|
2579
2599
|
/** The file a command prints whole, when it is one read alone (`cat ~/.pgpass`): its output is that file's content
|
|
2580
2600
|
* (ruling LVI). */
|
|
2581
2601
|
export const commandReadPath = (command) => (command === undefined ? undefined : readPath(command));
|
|
2602
|
+
/** Quote and escape characters, dropped before a command line is read: a quoted script's words are the line's own
|
|
2603
|
+
* words however deep its shells nest (`bash -c "bash -c 'env'"`), and a word spelled across quotes or behind a
|
|
2604
|
+
* backslash (`e"n"v`, `\env`) reads whole. No depth is followed, so none can run out. */
|
|
2605
|
+
const COMMAND_QUOTES = /["'\\]/g;
|
|
2582
2606
|
/** Where a command line splits into the commands it runs: `;`, `&&`, `||`, a pipe, a lone `&` (not a redirection's:
|
|
2583
|
-
* `2>&1`, `&>`), a line break, a subshell's or a substitution's `(` and `)`, a backtick.
|
|
2584
|
-
* inside them only makes more pieces to read, and an env word in one is read as a command (`echo "a; env"`, an over-cut
|
|
2585
|
-
* that fails closed). */
|
|
2607
|
+
* `2>&1`, `&>`), a line break, a subshell's or a substitution's `(` and `)`, a backtick. */
|
|
2586
2608
|
const COMMAND_SPLIT = /;|&&|\|\||\||(?<![<>&])&(?![&>])|\n|\(|\)|`/;
|
|
2587
2609
|
const COMMAND_BLANKS = /[ \t\r]{1,4096}/;
|
|
2588
|
-
/** A shell prompt standing as a piece's first word (`$ env`, `C:\app> set`). */
|
|
2589
|
-
const PROMPT_WORD = /^(?:[$#%>❯]|[A-Za-z]:\\[^>\n]{0,256}>)$/;
|
|
2590
|
-
/** A leading assignment (`FOO=1 printenv A`): the command follows it. */
|
|
2591
|
-
const ASSIGNMENT_WORD = /^[A-Za-z_][A-Za-z0-9_]{0,127}=/;
|
|
2592
2610
|
/** A redirection (`2>&1`, `>/tmp/e`, `&>log`); one that is its operator alone takes the next word as its file. */
|
|
2593
2611
|
const REDIRECT_WORD = /^(?:\d{1,2}|&)?(?:<<?|>>?)(?:&\d{0,2}-?)?/;
|
|
2594
2612
|
const REDIRECT_ALONE = /^(?:\d{1,2}|&)?(?:<<?|>>?)$/;
|
|
2595
|
-
/** A
|
|
2596
|
-
const
|
|
2597
|
-
/**
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2613
|
+
/** A redirection written against a word (`env>/tmp/e`): the word is what comes before it. */
|
|
2614
|
+
const WORD_REDIRECT = /\d{0,2}[<>]/;
|
|
2615
|
+
/** Where a line, quotes dropped and lower-cased, splits into the tokens an env name is read from: anything but a
|
|
2616
|
+
* letter, a digit, `_` or `-`. A name joined to other characters is a token of its own (`process["env"]`,
|
|
2617
|
+
* `env.APP_SEED`, `o.environ`, `Bun.env`, `ENVIRON[`, `</proc/1/environ`, `$env:A`, `std::env`). */
|
|
2618
|
+
const ENV_TOKEN_BREAK = /[^a-z0-9_-]{1,4096}/;
|
|
2619
|
+
/** A dotfile `.env` (`.env`, `.env.example`, `src/.env`) named as a word or after a path's `/`, `=`, `<`, `>`, `,` or
|
|
2620
|
+
* `:`: a file, which env-file reads, not the environment. `process.env`, `process?.env`, `Bun.env` keep the character
|
|
2621
|
+
* before their dot and are read. */
|
|
2622
|
+
const DOT_ENV_FILE = /(^|[ \t/=<>,:])\.env(?![a-z0-9_-])/gi;
|
|
2623
|
+
/** A token that runs, names or reads the environment wherever it stands in a line: env, printenv, envsubst, environ (a
|
|
2624
|
+
* /proc file, awk's ENVIRON, Python's os.environ), getenv and GetEnvironmentVariables, PHP's $_ENV and $_SERVER,
|
|
2625
|
+
* compgen, systemd's show-environment, a container's inspect, xtrace. An env token in a file's name is read so too
|
|
2626
|
+
* (`ls src/env.ts`, `cp .env.example .env`): an over-cut, ruled so. */
|
|
2627
|
+
const ENV_WORD = /^(?:(?:print)?env|envsubst|environ|compgen|show-environment|inspect|_env|_server|xtrace)$|^getenv/;
|
|
2628
|
+
/** A variable's expansion: sh's `$NAME` and any `${...}` (`${!v}` too), cmd's `%NAME%`. */
|
|
2629
|
+
const VARIABLE_WORD = /\$(?:\{|[A-Za-z_])|%[A-Za-z_][A-Za-z0-9_]{0,127}%/;
|
|
2630
|
+
/** A flag that turns xtrace on (`set -x`, `set -ex`, `bash -x`, `sh -xc`): each command is printed with its variables
|
|
2631
|
+
* expanded. */
|
|
2632
|
+
const XTRACE_FLAG = /^-[a-z]{0,8}x[a-z]{0,8}$/;
|
|
2633
|
+
/** A here-document or here-string: what it holds is expanded into a command's input. */
|
|
2634
|
+
const HERE_INPUT = /<</;
|
|
2602
2635
|
/** export's or declare's flag that prints (`-p`, `-px`). */
|
|
2603
2636
|
const PRINT_FLAG = /^-[A-Za-z]{0,8}p/;
|
|
2604
|
-
/**
|
|
2605
|
-
const
|
|
2606
|
-
/** Commands that
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2613
|
-
|
|
2637
|
+
/** ps's BSD-style option word that adds each process's environment (`ps e`, `ps eww`, `ps auxe`). */
|
|
2638
|
+
const PS_ENV_OPTION = /^[a-z]{0,16}e[a-z]{0,16}$/;
|
|
2639
|
+
/** Commands that print their arguments: with a variable anywhere in the line, its value is read as printed. */
|
|
2640
|
+
const PRINT_WORDS = new Set(["echo", "printf", "print", "puts", "say", "write-output", "write-host"]);
|
|
2641
|
+
/** Builtins that print every variable given no name to set: with flags alone, or a printing flag. */
|
|
2642
|
+
const DECLARE_WORDS = new Set(["export", "declare", "typeset", "readonly"]);
|
|
2643
|
+
/** set and the shells, whose -x flag turns xtrace on. */
|
|
2644
|
+
const XTRACE_WORDS = new Set(["set", "sh", "bash", "zsh", "dash", "ksh"]);
|
|
2645
|
+
/** A word's name: before a redirection written against it, past its path, lower case. */
|
|
2646
|
+
const wordName = (word) => {
|
|
2647
|
+
const bare = word.split(WORD_REDIRECT)[0];
|
|
2648
|
+
return bare.slice(bare.lastIndexOf("/") + 1).toLowerCase();
|
|
2614
2649
|
};
|
|
2615
|
-
/**
|
|
2616
|
-
|
|
2617
|
-
* or printf of a variable, or a shell's `-c` script that does. Read past a prompt, grouping and control-flow words,
|
|
2618
|
-
* wrappers (`sudo -E`, `nice -n 5`, `exec`, a path), leading assignments and redirections. An echo of any variable
|
|
2619
|
-
* counts, a secret name or not (`cd x && echo $PWD && npm test` cuts the test's output too: an over-cut, fails
|
|
2620
|
-
* closed). */
|
|
2621
|
-
function pieceDumps(piece, depth) {
|
|
2622
|
-
const words = piece.split(COMMAND_BLANKS).filter(Boolean);
|
|
2623
|
-
let at = 0;
|
|
2624
|
-
while (at < words.length) {
|
|
2625
|
-
const word = words[at];
|
|
2626
|
-
if (PROMPT_WORD.test(word) || LEAD_WORDS.has(word) || ASSIGNMENT_WORD.test(word)) {
|
|
2627
|
-
at++;
|
|
2628
|
-
continue;
|
|
2629
|
-
}
|
|
2630
|
-
if (!WRAPPERS.has(commandName(word)))
|
|
2631
|
-
break;
|
|
2632
|
-
at++;
|
|
2633
|
-
while (at < words.length && (words[at].startsWith("-") || NUMBER_WORD.test(words[at])))
|
|
2634
|
-
at += WRAPPER_ARG_FLAGS.has(words[at]) ? 2 : 1;
|
|
2635
|
-
}
|
|
2636
|
-
if (at >= words.length)
|
|
2637
|
-
return false;
|
|
2638
|
-
const name = commandName(words[at]);
|
|
2650
|
+
/** A command's arguments after the word at `at`, its redirections left out. */
|
|
2651
|
+
function argsAfter(words, at) {
|
|
2639
2652
|
const args = [];
|
|
2640
2653
|
for (let i = at + 1; i < words.length; i++) {
|
|
2641
2654
|
if (REDIRECT_ALONE.test(words[i]))
|
|
@@ -2643,44 +2656,45 @@ function pieceDumps(piece, depth) {
|
|
|
2643
2656
|
else if (!REDIRECT_WORD.test(words[i]))
|
|
2644
2657
|
args.push(words[i]);
|
|
2645
2658
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2659
|
+
return args;
|
|
2660
|
+
}
|
|
2661
|
+
/** Whether a command of a line, quotes dropped, prints the environment by its builtins' arguments: set with nothing
|
|
2662
|
+
* after it, or set or a shell with an xtrace flag; export, declare, typeset or readonly with flags alone or a printing
|
|
2663
|
+
* flag; ps with an `e` option. */
|
|
2664
|
+
function pieceDumps(piece) {
|
|
2665
|
+
const words = piece.split(COMMAND_BLANKS).filter(Boolean);
|
|
2666
|
+
return words.some((word, at) => {
|
|
2667
|
+
const name = wordName(word);
|
|
2668
|
+
if (!XTRACE_WORDS.has(name) && !DECLARE_WORDS.has(name) && name !== "ps")
|
|
2669
|
+
return false;
|
|
2670
|
+
const args = argsAfter(words, at);
|
|
2671
|
+
if (XTRACE_WORDS.has(name) && args.some((arg) => XTRACE_FLAG.test(arg.toLowerCase())))
|
|
2657
2672
|
return true;
|
|
2658
|
-
|
|
2673
|
+
if (name === "set")
|
|
2659
2674
|
return args.length === 0;
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
case "compgen":
|
|
2665
|
-
return args.includes("-v");
|
|
2666
|
-
case "echo":
|
|
2667
|
-
case "printf":
|
|
2668
|
-
return args.some((arg) => VARIABLE_WORD.test(arg));
|
|
2669
|
-
default: {
|
|
2670
|
-
if (!SHELLS.has(name) || depth >= 2)
|
|
2671
|
-
return false;
|
|
2672
|
-
const flag = args.findIndex((arg) => SCRIPT_FLAG.test(arg));
|
|
2673
|
-
return flag >= 0 && printsEnvironment(args.slice(flag + 1).join(" ").replace(WORD_EDGE_QUOTES, ""), depth + 1);
|
|
2674
|
-
}
|
|
2675
|
-
}
|
|
2675
|
+
if (DECLARE_WORDS.has(name))
|
|
2676
|
+
return args.every((arg) => arg.startsWith("-")) || args.some((arg) => PRINT_FLAG.test(arg));
|
|
2677
|
+
return name === "ps" && args.some((arg) => PS_ENV_OPTION.test(arg));
|
|
2678
|
+
});
|
|
2676
2679
|
}
|
|
2677
|
-
/** Whether a call's command line prints the environment or a variable's value
|
|
2678
|
-
* `
|
|
2679
|
-
*
|
|
2680
|
-
|
|
2680
|
+
/** Whether a call's command line prints the environment or a variable's value (`env`, `cd app && env | sort`,
|
|
2681
|
+
* `bash -c "bash -c 'env'"`, `cat</proc/self/environ`, `node -p 'process["env"]'`). Quotes and escapes are dropped,
|
|
2682
|
+
* and the line is read as tokens, not command shapes (11-25 r2: a reader of shapes, wrappers, env's own command or
|
|
2683
|
+
* nested shells, missed one more each time). A dump when any token is an env token (`sudo -n env`, `ssh host env`,
|
|
2684
|
+
* `jq -rn 'env.A'`), a builtin's arguments make one (pieceDumps), or a token that prints (echo, printf, print, an
|
|
2685
|
+
* awk program's print) or a here-string stands in a line with a variable anywhere (`cd x && echo $PWD && npm test`
|
|
2686
|
+
* cuts the test's output too: an over-cut, fails closed). A line longer than is read is read so too. Not seen: what
|
|
2687
|
+
* an earlier call set up (an alias, a symlink to an environ file, a script it wrote), which no line reader can. */
|
|
2688
|
+
function printsEnvironment(command) {
|
|
2681
2689
|
if (command.length > COMMAND_MAX)
|
|
2682
2690
|
return true;
|
|
2683
|
-
|
|
2691
|
+
const line = command.replace(COMMAND_QUOTES, "").replace(DOT_ENV_FILE, "$1");
|
|
2692
|
+
const tokens = line.toLowerCase().split(ENV_TOKEN_BREAK);
|
|
2693
|
+
if (tokens.some((token) => ENV_WORD.test(token)))
|
|
2694
|
+
return true;
|
|
2695
|
+
if (VARIABLE_WORD.test(command) && (HERE_INPUT.test(command) || tokens.some((token) => PRINT_WORDS.has(token))))
|
|
2696
|
+
return true;
|
|
2697
|
+
return line.split(COMMAND_SPLIT).some(pieceDumps);
|
|
2684
2698
|
}
|
|
2685
2699
|
/** All of a call's output as one dump, from its first character that is not a blank to its last (11-25 read): its
|
|
2686
2700
|
* lines can't be told apart by command, a value can span lines, and a first line that opens like a JSON field or a
|
|
@@ -2984,7 +2998,7 @@ export const RULE_PATTERNS = Object.freeze({
|
|
|
2984
2998
|
CODE_CALL, IDENT_CHAIN, MEMBER_CHAIN, CODE_CASE, CAMEL_OR_SNAKE, CALL_AFTER, LITERAL_START, YAML_NODE, ELIDED_AFTER, REFERENCE, ELIDED, TRAILING_PUNCTUATION, SENTENCE_END, BARE_START, EDGE_BLANK, EDGE_TOKEN_PUNCT, SLUG_OFF, SLUG_ENDS, PEM_END, PEM_BEGIN, PEM_OFF, PEM_TAIL, PEM_BODY_LINE, PEM_LAST_LINE, PEM_END_LINE, LEAD_TOKEN, DIGIT_START, BASE64_CHAR, BACKSLASH_RUN, BARE_STOP, URL_USERINFO, NAME_KEY_OFF, IDENTIFIER, ENDS_ENTRY, ENTRY_END_AFTER, TYPE_SUFFIX, TYPE_AFTER, LOCAL_LEAD, LOCAL_END, NESTED_ESCAPE, COOKIE_SPLIT, LINT_URL, CAMEL_HUMP, NAME_SEPARATORS, DIGITS_ONLY,
|
|
2985
2999
|
UPPER_NAME, LEAD_AT_START, LINE_PREFIX, LINE_REST, CODE_KEYWORD, CODE_EXPRESSION, OPENERS, CLOSERS, INI_HEADER, INI_LINE, NPMRC_AUTH, NPM_COMMAND, NPM_SET_SCAN, NPM_SET_AUTH, NPM_AUTH_KEY, ESCAPED_QUOTE_BEFORE, ESCAPED_QUOTE_AFTER, DOTTED_KEY_BEFORE, CODE_END, MEMBER_OBJECT_BEFORE, CODE_ROOT_BEFORE, STATEMENT_END_AFTER, REFERENCE_START, ENV_ASSIGN, HF_TOKEN, DIGITALOCEAN_TOKEN, PYPI_TOKEN, SENDGRID_KEY, ASSIGN, ASSIGN_SPACED, ASSIGN_COLON, SSHPASS, MYSQL_COMMAND, PASSWORD_FLAG, LOGIN_COMMAND,
|
|
2986
3000
|
REDIS_COMMAND, LOGIN_SCAN, LOGIN_P, REDIS_SCAN, REDIS_A, MYSQL_SCAN, MYSQL_P, OPENSSL_PASS, NETRC, AUTH_HEADER, TOKEN_RUN, CODE_KEY_BEFORE, URL_SAFE_RUN, BASE64_RUN_BEFORE, BASE64_RUN_AFTER, LETTER_OR_DIGIT, ENV_NAME_RUN, BASE64_CHARS, COOKIE_HEADER, COOKIE_PAIR, CURL_COMMAND, CURL_SCAN, CURL_USER, GLUED_STOP, NUMBERED, JSON_FIELD_OPEN, PROMPT_LINE,
|
|
2987
|
-
ENV_LINE, ENV_COMMAND, PRINTENV_NAMES, ECHO_VARIABLE, COMMAND_SPLIT, COMMAND_BLANKS,
|
|
3001
|
+
ENV_LINE, ENV_COMMAND, PRINTENV_NAMES, ECHO_VARIABLE, COMMAND_QUOTES, COMMAND_SPLIT, COMMAND_BLANKS, REDIRECT_WORD, REDIRECT_ALONE, WORD_REDIRECT, ENV_TOKEN_BREAK, DOT_ENV_FILE, ENV_WORD, VARIABLE_WORD, XTRACE_FLAG, HERE_INPUT, PRINT_FLAG, PS_ENV_OPTION, PROMPT_HEAD, NAME_RUN, READ_COMMAND, READ_TOOL, PATH_SEPARATOR, ENV_FILE_NAME, ENV_TEMPLATE, SSH_FILE,
|
|
2988
3002
|
CREDENTIAL_FILE, FILE_VARIABLE, ENV_FILE_LINE, KEY_LINE, SSH_CONFIG, COMMENT_LINE, PEM_LINE, BASE64_LINE, PEM_HEADER_LINE, HOME_UNIX, HOME_WINDOWS, SEGMENT_AFTER,
|
|
2989
3003
|
TRAILING_SLASHES, HOME_USER, CLAUDE_SLUG, CLAUDE_PROJECTS_BEFORE, SLUG_OFF_CHARS, SLUG_USER, BOT_TRAILER, DUMP_MARKER_LINE, EMAIL, EXAMPLE_DOMAIN, NO_REPLY_LOCAL, NO_REPLY_DOMAIN, FORGE_NO_REPLY, USER_ONLY_BEFORE, PORT_PASSWORD, HOST_SHAPED, IPV4, VERSION_BEFORE, PRE_RELEASE_AFTER,
|
|
2990
3004
|
BUILD_AFTER, RANGE_AFTER, IPV6, IPV6_GROUPS, ENV_PREFIX_BEFORE, ENV_PREFIX_AFTER, ENV_PREFIX_CHAIN, ENV_PREFIX_STATEMENT, ENV_FLAG, HELM_LIST_FLAG, HELM_SET, HELM_NAME, RESOURCE_NAME, SECRET_OBJECT_NAME, CONNECTION_PASSWORD, ADO_PAIR, CONNECTION_KEY_PAIR, BLANKS, LIBPQ_PAIR_AFTER, FORMAT_FIELD, PWD_PATH, QUERY_VALUE_STOP, QUERY_PASSWORD, ARGUMENT_TAIL, NEXT_ASSIGNMENT, ASSIGNMENT_BEFORE,
|
package/dist/server.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { type Place } from "./place.js";
|
|
|
9
9
|
import { type ApiToken } from "./api-token.js";
|
|
10
10
|
import { type CutScrub } from "./run-export.js";
|
|
11
11
|
import { type Store } from "./store/index.js";
|
|
12
|
+
import { type Machine } from "./local-model.js";
|
|
12
13
|
import { type BoxOffer, type ContainerFacts } from "./place-offers.js";
|
|
13
14
|
import { type Wait } from "./docker-host-addresses.js";
|
|
14
15
|
import { type StoredKeys } from "./secrets.js";
|
|
@@ -202,6 +203,12 @@ export type ServeOptions = {
|
|
|
202
203
|
/** How often a timeline page that waits (`wait_ms`) reads the store again while nothing changed (default 1000 ms,
|
|
203
204
|
* run-reads-over-store.ts). A test's server reads sooner, so a change is served without the rest of a second's wait. */
|
|
204
205
|
timelinePollMs?: number;
|
|
206
|
+
/** For tests: this machine as GET /settings/local-model reads it (local-model.ts Machine), in place of the real one, so no
|
|
207
|
+
* test reads the hardware it runs on. */
|
|
208
|
+
machine?: () => Promise<Machine>;
|
|
209
|
+
/** For tests: how long a local model pull may go with no byte from Ollama before it stops (ollama-provider.ts
|
|
210
|
+
* PULL_STALL_MS, two minutes, by default). */
|
|
211
|
+
pullStallMs?: number;
|
|
205
212
|
/** No runner beside this server in its process (the CLI's --no-runner, the image's server-and-runner): a paired
|
|
206
213
|
* computer's socket is held here while no run holds it, and relayed to the runner that holds a run of it
|
|
207
214
|
* (workspace/paired-route.ts); while no runner relays, a pairing code, the pair answer and each paired computer say no
|