@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/tool-plane.js
CHANGED
|
@@ -211,18 +211,57 @@ export const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guar
|
|
|
211
211
|
* only where it is the model provider's hosted search (pi's), never a harness's own search inside its CLI. */
|
|
212
212
|
const searchesOwn = (resolves, facts) => WEB_RUNS.web_search.includes(resolves) && (resolves !== "native" || !facts?.webSearch);
|
|
213
213
|
const ranksOwn = (resolves, input) => searchesOwn(resolves, input.facts);
|
|
214
|
+
/** The server's settings that are a ceiling an agent's pick cannot raise: web_fetch `kernel` keeps every URL on the
|
|
215
|
+
* server; web_search `native` sends every query to the harness's own search, and `off` sends none (Jev, where it is
|
|
216
|
+
* on, still sees a kernel fetch's page or a native pi search's results: web-run.ts jevWebOf). Under one, an
|
|
217
|
+
* agent's pick that would send anywhere but the ceiling's own resolves as the server's setting does: a keyless third
|
|
218
|
+
* party (Firecrawl, Exa), Parallel even when the agent names it, and under `off` a native search even when the agent
|
|
219
|
+
* names it (ceilingOver). An operator who wants Parallel sets it server-wide; that is no ceiling. */
|
|
220
|
+
const CEILINGS = { web_fetch: [DIRECT_FETCH], web_search: ["native", "off"] };
|
|
221
|
+
/** The ceiling a claim holds each capability to where the server's tool settings could not be read: the strictest that
|
|
222
|
+
* leaves the run a tool (claimPlane). */
|
|
223
|
+
const UNREAD_CEILINGS = { web_fetch: DIRECT_FETCH, web_search: "native" };
|
|
224
|
+
/** A capability a claim held to UNREAD_CEILINGS: it runs nothing, and says why without the store's words. */
|
|
225
|
+
export const SETTINGS_NOT_READ = "unavailable: the server's tool settings could not be read";
|
|
226
|
+
/** A capability a claim found past a ceiling where today's resolution (planeFor) gives none in its place, as where its
|
|
227
|
+
* tool is not granted in today's tooling: it runs nothing, never the value it was kept with (claimPlane). */
|
|
228
|
+
export const CEILING_LEAVES_NONE = "unavailable: the server's tool setting keeps it from this run, with nothing it allows in its place";
|
|
229
|
+
const KEYLESS = ["firecrawl-keyless", "exa-keyless"];
|
|
230
|
+
/** Whether `provider`, as picked or as resolved, goes past ceiling `pick`: a keyless third party or Parallel, under any
|
|
231
|
+
* ceiling; a native search, under one that is not native search itself (`off`). */
|
|
232
|
+
const pastCeiling = (pick, provider) => provider !== undefined && (KEYLESS.includes(provider) || provider === "parallel" || (provider === "native" && pick !== "native"));
|
|
233
|
+
/** The ceiling `pick` (the server's setting for `capability`) sets over a run's capability, where it goes past it; else
|
|
234
|
+
* undefined. Past it: the agent's `choice` named past it, whatever it resolves to (Parallel with no key, a native
|
|
235
|
+
* search the harness lacks), or `resolves`, what it resolves to (the agent's auto, or a kept run's from before the
|
|
236
|
+
* setting), past it. One that sends nothing (unavailable, denied, off) from a choice within it, the guarded direct
|
|
237
|
+
* fetch and the ceiling's own native search go past none. */
|
|
238
|
+
const ceilingOver = (capability, pick, choice, resolves) => {
|
|
239
|
+
if (pick === undefined || !CEILINGS[capability]?.includes(pick))
|
|
240
|
+
return undefined;
|
|
241
|
+
return pastCeiling(pick, choice) || pastCeiling(pick, resolves) ? pick : undefined;
|
|
242
|
+
};
|
|
214
243
|
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
215
244
|
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
216
245
|
* a deny), say what Jev does with it and what it sends TypeSafe, where the server has a Jev key, or that Jev is off
|
|
217
|
-
* (`jevWhy`, `jevFetchWhy`).
|
|
246
|
+
* (`jevWhy`, `jevFetchWhy`). An agent's pick the server's setting is a ceiling over (CEILINGS) resolves as the server's
|
|
247
|
+
* setting does, and the why says so. */
|
|
218
248
|
export function explainCapability(capability, input) {
|
|
219
|
-
const said =
|
|
249
|
+
const said = ceilinged(capability, input);
|
|
220
250
|
if (capability === "web_search" && input.jevWhy && ranksOwn(said.resolves, input))
|
|
221
251
|
return { ...said, why: `${said.why}; ${input.jevWhy}` };
|
|
222
252
|
if (capability === "web_fetch" && input.jevFetchWhy && WEB_RUNS.web_fetch.includes(said.resolves))
|
|
223
253
|
return { ...said, why: `${said.why}; ${input.jevFetchWhy}` };
|
|
224
254
|
return said;
|
|
225
255
|
}
|
|
256
|
+
function ceilinged(capability, input) {
|
|
257
|
+
const said = explained(capability, input);
|
|
258
|
+
const ceiling = input.override === undefined ? undefined : ceilingOver(capability, input.pick, input.override, said.resolves);
|
|
259
|
+
if (ceiling === undefined)
|
|
260
|
+
return said;
|
|
261
|
+
const { override, ...server } = input;
|
|
262
|
+
const kept = explained(capability, server);
|
|
263
|
+
return { resolves: kept.resolves, why: `the server's setting, ${ceiling}, is a ceiling over this agent's pick of ${override}; ${kept.why}` };
|
|
264
|
+
}
|
|
226
265
|
function explained(capability, input) {
|
|
227
266
|
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
228
267
|
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
@@ -450,6 +489,36 @@ export function relaunchPlane(kept, env, tooling, settings, { capped = false, fi
|
|
|
450
489
|
return recheckPlane(kept, env, { fresh, permission: (name) => permissionOf(name, settings, tooling?.overrides ?? {}, tooling?.approvals ?? "ask") });
|
|
451
490
|
return tooling ? recheckPlane(keptFromBefore(fresh), env) : {};
|
|
452
491
|
}
|
|
492
|
+
/** The ceiling over capability `name` of `kept` (a launch's Plane) under the server's `settings` now, for a run of
|
|
493
|
+
* `tooling` (its agent's own picks): ceilingOver, or, where the settings could not be read (`unread`), the strictest
|
|
494
|
+
* (UNREAD_CEILINGS). */
|
|
495
|
+
const claimCeiling = (name, kept, tooling, settings, unread) => ceilingOver(name, unread ? UNREAD_CEILINGS[name] : settings[name]?.provider, tooling.overrides?.[name]?.provider, kept[name]);
|
|
496
|
+
/** Whether a capability of `kept` goes past a ceiling of the server's `settings` now (claimCeiling). */
|
|
497
|
+
export const overCeilings = (kept, tooling, settings, { unread = false } = {}) => PICKABLE.some((name) => kept[name] !== undefined && claimCeiling(name, kept, tooling, settings, unread) !== undefined);
|
|
498
|
+
/** The Plane a claim hands its run (runner/harness-loops.ts, before anything binds): `kept`, the launch's (resolved at
|
|
499
|
+
* the run's start), under the server's `settings` now. A capability kept past a ceiling the server's setting now sets
|
|
500
|
+
* (claimCeiling) takes today's resolution (planeFor in `env` for `tooling`) on `model`, the run's pinned one (its
|
|
501
|
+
* launch's), so a resume, a follow-up or a reclaim sends nothing the setting keeps from it, and its native search asks
|
|
502
|
+
* the model the run sends. Where the settings could not be read (`unread`), one past the strictest ceiling runs nothing
|
|
503
|
+
* (SETTINGS_NOT_READ), and so does one today's resolution leaves without one (CEILING_LEAVES_NONE). Every other value
|
|
504
|
+
* stays as kept; the same Plane where nothing is past a ceiling. */
|
|
505
|
+
export function claimPlane(kept, env, tooling, settings, { capped = false, model, unread = false } = {}) {
|
|
506
|
+
const past = PICKABLE.filter((name) => kept[name] !== undefined && claimCeiling(name, kept, tooling, settings, unread) !== undefined);
|
|
507
|
+
if (!past.length)
|
|
508
|
+
return kept;
|
|
509
|
+
const out = { ...kept };
|
|
510
|
+
if (unread) {
|
|
511
|
+
for (const name of past)
|
|
512
|
+
out[name] = SETTINGS_NOT_READ;
|
|
513
|
+
return out;
|
|
514
|
+
}
|
|
515
|
+
const fresh = planeFor(env, model ? { ...tooling, model } : tooling, settings, { capped, run: true });
|
|
516
|
+
for (const name of past)
|
|
517
|
+
out[name] = fresh[name] ?? CEILING_LEAVES_NONE;
|
|
518
|
+
if (out.web_search === "native" && kept.web_search !== "native" && fresh.model)
|
|
519
|
+
out.model = fresh.model;
|
|
520
|
+
return out;
|
|
521
|
+
}
|
|
453
522
|
/** The Plane the server handed this run's process; empty when it handed none. */
|
|
454
523
|
export function planeOf(env) {
|
|
455
524
|
try {
|
|
@@ -685,6 +754,9 @@ export function agentTools(env, settings, agent, order, shell = "computer", effe
|
|
|
685
754
|
const pick = name;
|
|
686
755
|
const own = agent.overrides?.[pick]?.provider;
|
|
687
756
|
const server = settings[pick]?.provider;
|
|
688
|
-
|
|
757
|
+
// The server's setting a ceiling over the agent's own pick (ceilingOver): the pick named past it, or what the pick
|
|
758
|
+
// would resolve to with no server setting past it. `resolved` is then the server's, and `ceiling` says why.
|
|
759
|
+
const ceiling = own === undefined ? undefined : ceilingOver(pick, server, own, planeFor(env, agent, { ...settings, [pick]: { ...settings[pick], provider: undefined } })[pick]);
|
|
760
|
+
return { ...shown, ...gate, provider: own ?? server ?? PROVIDERS[pick][0], provider_from: own ? "agent" : server ? "server" : "default", default_provider: server ?? PROVIDERS[pick][0], resolved: plane[pick], ...(ceiling ? { ceiling } : {}) };
|
|
689
761
|
});
|
|
690
762
|
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { type WebFake } from "./web-fake.js";
|
|
|
14
14
|
import { type SaveSlots } from "./web-save.js";
|
|
15
15
|
import { type Plane, type Resolution, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
16
16
|
import type { DenyFrom, SettingFrom } from "./tool-gate.js";
|
|
17
|
+
import { type Redact } from "./runner/redact.js";
|
|
17
18
|
import type { LiveHandover, LiveViewerStore } from "./browser-live.js";
|
|
18
19
|
import { type RunnerLive } from "./live-reach.js";
|
|
19
20
|
import type { Claim, Store } from "./store/store.js";
|
|
@@ -110,8 +111,8 @@ export type ToolHost = {
|
|
|
110
111
|
flush: () => Promise<void>;
|
|
111
112
|
};
|
|
112
113
|
/** The run's one redactor (the runner's: every secret value the runner and the claim hold, in every form): what the
|
|
113
|
-
* browser's answers pass through before pi stores them or the model reads them.
|
|
114
|
-
redact
|
|
114
|
+
* browser's answers pass through before pi stores them or the model reads them. */
|
|
115
|
+
redact: (text: string) => string;
|
|
115
116
|
/** The run's own Workspace (on the runner: the run's local folder in Mode 1, its folder on the run's disk in Mode 2),
|
|
116
117
|
* where a tool files what the run's read finds later (monid's whole answer past the model's cut). Absent, the local
|
|
117
118
|
* folder at `where.work`. */
|
|
@@ -243,6 +244,15 @@ export declare const uploadsFrom: (work: Workspace, maxBytes: number, mime: (nam
|
|
|
243
244
|
* run of more than 8,192 characters with no whitespace as "[redacted]" (key-refusal.ts redactedAnswer), which no model
|
|
244
245
|
* takes as an image. Any other `data`, on a block of any type, is cut like every other string. */
|
|
245
246
|
export declare function cutAnswer<T>(value: T, cut: (text: string) => string): T;
|
|
247
|
+
/** One call's web answer cut by `cut` (timeline/web-calls.ts webCut): each of its JSON's strings cut once, and the whole
|
|
248
|
+
* "[redacted]" when its strings, read joined, hold a held value no cut in place takes (a value split across two of
|
|
249
|
+
* them). The join is read against the values `cut` holds (key-refusal.ts withheldWhole), or through `cut` itself when
|
|
250
|
+
* it does not know them (joinCut). Undefined for an answer that is not a web call's JSON. Make one per call. */
|
|
251
|
+
export declare function webAnswerCut(cut: Redact): (tool: string, text: string) => string | undefined;
|
|
252
|
+
/** `tool` whose answer, and a throw's message, pass `cut` inside its execute: before pi stores the result or the model
|
|
253
|
+
* reads it. A web call's JSON is cut as the agentic specs' answersCut cuts it (webAnswerCut), so it still parses and
|
|
254
|
+
* keeps its links, and a held value split across its strings withholds it whole. */
|
|
255
|
+
export declare function answersCutInside(tool: ToolRegistration, cut: Redact): ToolRegistration;
|
|
246
256
|
/** `provider`, its sessions' profile as this launch was handed it, whatever the policy a conversation was made with (a
|
|
247
257
|
* follow-up's was made under an earlier launch, which may have had no sign-in, or another lease): with a sign-in, every
|
|
248
258
|
* session opens on the profile `default`, saving only as `kept.save` says; without one, none asks for a profile. */
|
package/dist/tools.js
CHANGED
|
@@ -15,7 +15,7 @@ import { mcpNameOf } from "./tool-names.js";
|
|
|
15
15
|
import { appendFileSync } from "node:fs";
|
|
16
16
|
import { pathToFileURL } from "node:url";
|
|
17
17
|
import { defineExtension, defineTool, ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
18
|
-
import { registerTurnEnding } from "./timeline/index.js";
|
|
18
|
+
import { registerTurnEnding, webCut } from "./timeline/index.js";
|
|
19
19
|
import { BACKGROUND_LOG_BYTES, BACKGROUND_MAX, BACKGROUND_PAGE_BYTES } from "./background.js";
|
|
20
20
|
import { isWorkspaceError, localWorkspace } from "./workspace/index.js";
|
|
21
21
|
import { HTML_READ_CHARS, TEXT_CAP } from "@parcha/agentrun-web";
|
|
@@ -41,7 +41,7 @@ import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
|
41
41
|
import { keyNeeded } from "./key-words.js";
|
|
42
42
|
import { unattachable } from "./attach-images.js";
|
|
43
43
|
import { handedSignIn } from "./secrets.js";
|
|
44
|
-
import { redactedAnswer } from "./key-refusal.js";
|
|
44
|
+
import { redactedAnswer, withheldWhole } from "./key-refusal.js";
|
|
45
45
|
import { SIGN_IN_KEY, vendorsOver } from "./sign-ins.js";
|
|
46
46
|
import { answerIn, answerOnce } from "./runner/hand-back.js";
|
|
47
47
|
import { waitingAsk } from "./browser-commands.js";
|
|
@@ -229,14 +229,49 @@ export function cutAnswer(value, cut) {
|
|
|
229
229
|
}
|
|
230
230
|
return value;
|
|
231
231
|
}
|
|
232
|
+
/** One call's web answer cut by `cut` (timeline/web-calls.ts webCut): each of its JSON's strings cut once, and the whole
|
|
233
|
+
* "[redacted]" when its strings, read joined, hold a held value no cut in place takes (a value split across two of
|
|
234
|
+
* them). The join is read against the values `cut` holds (key-refusal.ts withheldWhole), or through `cut` itself when
|
|
235
|
+
* it does not know them (joinCut). Undefined for an answer that is not a web call's JSON. Make one per call. */
|
|
236
|
+
export function webAnswerCut(cut) {
|
|
237
|
+
const seen = new Map();
|
|
238
|
+
const once = (text) => {
|
|
239
|
+
let out = seen.get(text);
|
|
240
|
+
if (out === undefined)
|
|
241
|
+
seen.set(text, (out = cut(text)));
|
|
242
|
+
return out;
|
|
243
|
+
};
|
|
244
|
+
const holds = (joined, parts) => {
|
|
245
|
+
const values = cut.heldValues?.();
|
|
246
|
+
return values ? withheldWhole(joined, values) : joinCut(joined, parts, once);
|
|
247
|
+
};
|
|
248
|
+
return (tool, text) => webCut(tool, text, once, holds);
|
|
249
|
+
}
|
|
250
|
+
/** Whether `cut`, a redactor that does not know its values, takes from `joined` (`parts` joined by line breaks) what it
|
|
251
|
+
* does not take from the parts each read alone: a held value split across two parts. Its cut of the join whole being
|
|
252
|
+
* "[redacted]" is not enough: it reads a text longer than a piece in pieces of 8,192 characters (key-refusal.ts
|
|
253
|
+
* redactedAnswer), and a value split inside one piece withholds only that piece, the rest of the join served. It misses
|
|
254
|
+
* nothing: no value split across parts is in a part to cut, so the join's cut and the parts' differ wherever the join
|
|
255
|
+
* holds one; where nothing spans two parts they are the same, as every piece ends at whitespace or inside a run longer
|
|
256
|
+
* than a piece, and a line break ends each part. */
|
|
257
|
+
function joinCut(joined, parts, cut) {
|
|
258
|
+
const whole = cut(joined);
|
|
259
|
+
return whole === "[redacted]" || whole !== parts.map(cut).join("\n");
|
|
260
|
+
}
|
|
232
261
|
/** `tool` whose answer, and a throw's message, pass `cut` inside its execute: before pi stores the result or the model
|
|
233
|
-
* reads it.
|
|
234
|
-
|
|
262
|
+
* reads it. A web call's JSON is cut as the agentic specs' answersCut cuts it (webAnswerCut), so it still parses and
|
|
263
|
+
* keeps its links, and a held value split across its strings withholds it whole. */
|
|
264
|
+
export function answersCutInside(tool, cut) {
|
|
265
|
+
// Fail closed and loud: a host with no redactor would only throw inside each call, an error a model may read past.
|
|
266
|
+
if (typeof cut !== "function")
|
|
267
|
+
throw new TypeError(`${tool.name}: the run's redactor (host.redact) is required to cut its answers`);
|
|
235
268
|
return {
|
|
236
269
|
...tool,
|
|
237
270
|
execute: (async (...args) => {
|
|
238
271
|
try {
|
|
239
|
-
|
|
272
|
+
const web = webAnswerCut(cut);
|
|
273
|
+
const textCut = (text) => web(tool.name, text) ?? cut(text);
|
|
274
|
+
return cutAnswer(await tool.execute(...args), textCut);
|
|
240
275
|
}
|
|
241
276
|
catch (error) {
|
|
242
277
|
if (error instanceof Error) {
|
|
@@ -383,7 +418,7 @@ const browserTool = {
|
|
|
383
418
|
// The model's words for the person, with every value this run holds cut, whole, before they are cut to their bound:
|
|
384
419
|
// the run's own cut on the runner (host.redact: the claim's keys too, every tool's, in every form), and the secrets
|
|
385
420
|
// its env holds (runnerSecrets: hostSecrets and every launcher name's value) with its sign-in's pointer.
|
|
386
|
-
redact: (text) => redactedAnswer(host.redact
|
|
421
|
+
redact: (text) => redactedAnswer(host.redact(text), [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])]),
|
|
387
422
|
// The Screen tab's ended state, one settings row the server reads per poll (browser-wait-ended.ts); cleared as a
|
|
388
423
|
// session opens (onSessions, below).
|
|
389
424
|
waitEnded: (at, why) => {
|
|
@@ -493,7 +528,7 @@ const browserTool = {
|
|
|
493
528
|
const browser = createBrowserExtension({ provider, driver: parts.driver, evidence: evidenceIn(work), ...files, gates, handoff: hands.handoff, onSession: onSessions, signIns: kept !== undefined, beforeCreate: spend.opening, redact: { values: () => [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])] }, prices: { sessionUsdPerHour: price.usdPerHour, sessionMinimumS: price.minimumS }, onCharge: spend.onCharge });
|
|
494
529
|
// On the runner, every answer the browser's tools give passes the run's one redactor inside the call, so what pi stores
|
|
495
530
|
// (its result record) and what the model reads hold no value the runner or the claim holds.
|
|
496
|
-
const tools = browser.tools.map(spend.capped).map((tool) =>
|
|
531
|
+
const tools = browser.tools.map(spend.capped).map((tool) => answersCutInside(tool, host.redact));
|
|
497
532
|
const extension = { ...browser.extension, tools };
|
|
498
533
|
host.install(extension);
|
|
499
534
|
host.onConversation(async (tx, conversationId) => {
|
package/dist/trigger-composio.js
CHANGED
|
@@ -194,7 +194,7 @@ function fieldsOf(value, bad) {
|
|
|
194
194
|
if (typeof event !== "string" || !COMPOSIO_EVENT.test(event))
|
|
195
195
|
fail("event", event === undefined ? "missing" : "invalid", "event is one of the server's toolkit's events, as Composio slugs it (GITHUB_ISSUE_ADDED_EVENT): GET /v2/settings/mcp-servers/{name}/composio/events lists them");
|
|
196
196
|
if (!isObject(config) || Buffer.byteLength(JSON.stringify(config), "utf8") > CONFIG_BYTES)
|
|
197
|
-
fail("config", config === undefined ? "missing" : "invalid", `config is the event's config, an object as its schema says (GitHub's {owner, repo}), at most ${CONFIG_BYTES} bytes as JSON`);
|
|
197
|
+
fail("config", config === undefined ? "missing" : "invalid", `config is the event's config, an object as its schema says (GitHub's {owner, repo}; {} for an event whose schema needs no field), at most ${CONFIG_BYTES} bytes as JSON`);
|
|
198
198
|
if (instance !== undefined && !(typeof instance === "string" && INSTANCE.test(instance)))
|
|
199
199
|
fail("instance_id", "invalid", "instance_id is Composio's id for the trigger's instance, set by this server");
|
|
200
200
|
if (hook !== undefined && !(typeof hook === "string" && COMPOSIO_HOOK.test(hook)))
|
|
@@ -8,8 +8,8 @@ export declare const LAUNCH_HOOK_TIMEOUT_MS = 10000;
|
|
|
8
8
|
* trigger's max_active_runs, or one a stop cut short and the next start handed again reaches the host late, and its
|
|
9
9
|
* host gets the same 10 minutes as any. */
|
|
10
10
|
export declare const LAUNCH_HOOK_LATE_START_MS: number;
|
|
11
|
-
/** The hook a server hands its firings to: where, and the secret it signs with. `bound`: a test's seam,
|
|
12
|
-
* POST
|
|
11
|
+
/** The hook a server hands its firings to: where, and the secret it signs with. `bound`: a test's seam, a signal that can
|
|
12
|
+
* cut a POST before LAUNCH_HOOK_TIMEOUT_MS, never after: the 10 s bound is always set as well. */
|
|
13
13
|
export type LaunchHook = {
|
|
14
14
|
readonly url: string;
|
|
15
15
|
readonly secret: string;
|
|
@@ -79,7 +79,7 @@ export async function handToHost(hook, firing, stop, now = Date.now) {
|
|
|
79
79
|
const body = JSON.stringify(firing);
|
|
80
80
|
const timestamp = String(Math.floor(now() / 1000));
|
|
81
81
|
const headers = signedRequest(hook.secret, firing.firing_id, timestamp, body, "agentrun-serve-launch-hook/1");
|
|
82
|
-
const signal = AbortSignal.any([hook.bound ? hook.bound(LAUNCH_HOOK_TIMEOUT_MS) :
|
|
82
|
+
const signal = AbortSignal.any([AbortSignal.timeout(LAUNCH_HOOK_TIMEOUT_MS), ...(hook.bound ? [hook.bound(LAUNCH_HOOK_TIMEOUT_MS)] : []), stop]);
|
|
83
83
|
let res;
|
|
84
84
|
try {
|
|
85
85
|
res = await undiciFetch(hook.url, { method: "POST", redirect: "manual", signal, headers, body });
|
package/dist/triggers.d.ts
CHANGED
|
@@ -434,13 +434,16 @@ export declare class Triggers {
|
|
|
434
434
|
id: string;
|
|
435
435
|
name: string;
|
|
436
436
|
}[]>;
|
|
437
|
-
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off
|
|
438
|
-
*
|
|
439
|
-
*
|
|
437
|
+
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off that `turnOn`
|
|
438
|
+
* takes (by source and target), each turned on as a PATCH with enabled true does (an API-only server's with the launch
|
|
439
|
+
* hook: api-only.ts apiOnlyTurnsOn). The triggers its archive turned off that are off still, by name: each is
|
|
440
440
|
* turned on by a PATCH. One `turnOn` takes that can't be on (a schedule with no time left), or that its first check
|
|
441
441
|
* turns off again, is named: what is off is read from the store after the turn-ons, never taken from whether one
|
|
442
442
|
* resolved. */
|
|
443
|
-
agentUnarchived(agentId: string, turnOn?: (
|
|
443
|
+
agentUnarchived(agentId: string, turnOn?: (trigger: {
|
|
444
|
+
source: Source;
|
|
445
|
+
target: Target;
|
|
446
|
+
}) => boolean): Promise<{
|
|
444
447
|
id: string;
|
|
445
448
|
name: string;
|
|
446
449
|
}[]>;
|
package/dist/triggers.js
CHANGED
|
@@ -458,9 +458,9 @@ export class Triggers {
|
|
|
458
458
|
await this.offThere((await Promise.all(off.map((t) => this.find(t.id)))).filter((t) => t !== undefined));
|
|
459
459
|
return off;
|
|
460
460
|
}
|
|
461
|
-
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off
|
|
462
|
-
*
|
|
463
|
-
*
|
|
461
|
+
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off that `turnOn`
|
|
462
|
+
* takes (by source and target), each turned on as a PATCH with enabled true does (an API-only server's with the launch
|
|
463
|
+
* hook: api-only.ts apiOnlyTurnsOn). The triggers its archive turned off that are off still, by name: each is
|
|
464
464
|
* turned on by a PATCH. One `turnOn` takes that can't be on (a schedule with no time left), or that its first check
|
|
465
465
|
* turns off again, is named: what is off is read from the store after the turn-ons, never taken from whether one
|
|
466
466
|
* resolved. */
|
|
@@ -468,7 +468,7 @@ export class Triggers {
|
|
|
468
468
|
await this.store.agents.archive(agentId, false);
|
|
469
469
|
const off = (await this.store.triggers.list(agentId)).map(asTrigger).filter((t) => !t.enabled && reasonOf(t.disabled) === "agent_archived");
|
|
470
470
|
for (const t of off)
|
|
471
|
-
if (turnOn(t
|
|
471
|
+
if (turnOn(t))
|
|
472
472
|
await this.update(t.id, { enabled: true }, { onAgent: agentId }).catch(() => undefined);
|
|
473
473
|
const ids = new Set(off.map((t) => t.id));
|
|
474
474
|
return (await this.store.triggers.list(agentId)).filter((t) => ids.has(t.id) && !t.enabled).map((t) => ({ id: t.id, name: t.name }));
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -176,6 +176,9 @@ export declare class Webhooks {
|
|
|
176
176
|
constructor(store: WebhooksStore, key: Buffer, say: (fields: Record<string, string | number>) => void, options?: WebhooksOptions,
|
|
177
177
|
/** Which outbox this is: the webhook's (WEBHOOK_OUTBOUND), or another destination's over the same machinery. */
|
|
178
178
|
outbound?: Outbound);
|
|
179
|
+
/** Reads the saved secrets alone (signingSecrets), writing nothing and sending nothing: a share host's start, which
|
|
180
|
+
* sends no message but still holds every value this server saved, so an upload carrying one is refused. */
|
|
181
|
+
readSecrets(): Promise<void>;
|
|
179
182
|
/** Reads the webhook, its secret and its ledger once, and goes on with the messages an earlier server left queued, each
|
|
180
183
|
* at its next try's time; a test send is tried once, so one left queued failed. Awaited once at start. */
|
|
181
184
|
load(): Promise<void>;
|
package/dist/webhooks.js
CHANGED
|
@@ -184,6 +184,11 @@ export class Webhooks {
|
|
|
184
184
|
this.privateTargets = options.privateTargets ?? false;
|
|
185
185
|
this.lookup = options.lookup ?? (async (host) => (await dns.lookup(host, { all: true })).map((a) => a.address));
|
|
186
186
|
}
|
|
187
|
+
/** Reads the saved secrets alone (signingSecrets), writing nothing and sending nothing: a share host's start, which
|
|
188
|
+
* sends no message but still holds every value this server saved, so an upload carrying one is refused. */
|
|
189
|
+
async readSecrets() {
|
|
190
|
+
await this.secrets.load();
|
|
191
|
+
}
|
|
187
192
|
/** Reads the webhook, its secret and its ledger once, and goes on with the messages an earlier server left queued, each
|
|
188
193
|
* at its next try's time; a test send is tried once, so one left queued failed. Awaited once at start. */
|
|
189
194
|
async load() {
|
|
@@ -51,6 +51,9 @@ export interface ArchilClaimOptions {
|
|
|
51
51
|
readonly settings: RunDiskOptions["store"]["settings"] & Pick<Settings, "replaceIf">;
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
+
/** Where a remove the claim's end could not leave for the janitor is said (its release's, a lost claim's). Default: the
|
|
55
|
+
* runner's stderr. */
|
|
56
|
+
readonly log?: (line: string) => void;
|
|
54
57
|
}
|
|
55
58
|
export interface ArchilClaim {
|
|
56
59
|
/** The claim's disk: its key is this step's, asked for on every call. */
|
|
@@ -69,9 +72,10 @@ export interface ArchilClaim {
|
|
|
69
72
|
/** Takes on the credential an earlier claim of the run minted, the one in the computer that claim kept at the run's
|
|
70
73
|
* park (computer-kept.ts) and this claim attached again: nothing is minted, and this claim's revoke removes it. */
|
|
71
74
|
inherit(): void;
|
|
72
|
-
/** The claim's end with its last revoke failed: the remove left for the janitor (mount-revoke-left.ts),
|
|
73
|
-
* Nothing owed, nothing written. The release does it too, and so
|
|
74
|
-
*
|
|
75
|
+
/** The claim's end with its last revoke failed: the remove left for the janitor (mount-revoke-left.ts), written once; a
|
|
76
|
+
* write that failed is tried again by the next leave. Nothing owed, nothing written. The release does it too, and so
|
|
77
|
+
* does a revoke that fails after the release (a lost claim's), each saying on the log a write that failed. Never
|
|
78
|
+
* before the claim's end: until then it may mint again under its own epoch. */
|
|
75
79
|
leave(): Promise<void>;
|
|
76
80
|
/** Every value held, for the redaction set. */
|
|
77
81
|
readonly secrets: ReadonlySet<string>;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// the store's sealed keys and the seal key are handed in.
|
|
20
20
|
import { ARCHIL_API_KEY_ROW, DEFAULT_ARCHIL_EXEC_IMAGE } from "../archil-settings.js";
|
|
21
21
|
import { leaveMountRevoke } from "./mount-revoke-left.js";
|
|
22
|
+
import { stderrLog } from "./computer-intervals.js";
|
|
22
23
|
import { archilApiKey } from "./archil-key.js";
|
|
23
24
|
import { archilDisk, pinnedImage } from "./archil-disk.js";
|
|
24
25
|
import { mintMountToken, nicknameOf, removeMountToken, removeOlderMountTokens, removeRunMountTokens } from "./archil-mount-credential.js";
|
|
@@ -127,7 +128,8 @@ export async function archilClaim(options) {
|
|
|
127
128
|
let live;
|
|
128
129
|
/** The last revoke failed: a credential of this claim may stand at Archil, its remove owed. */
|
|
129
130
|
let owed = false;
|
|
130
|
-
/** The remove left for the janitor, once written (or being written): at most one per claim.
|
|
131
|
+
/** The remove left for the janitor, once written (or being written): at most one per claim. A write that failed is
|
|
132
|
+
* forgotten, so the next leave tries again. */
|
|
131
133
|
let left;
|
|
132
134
|
/** The claim's end with a remove owed: the remove left for the janitor (mount-revoke-left.ts), by this claim's epoch on
|
|
133
135
|
* its disk, stamped on the store's clock. */
|
|
@@ -135,13 +137,19 @@ export async function archilClaim(options) {
|
|
|
135
137
|
const mount = options.mount;
|
|
136
138
|
if (!owed || mount === undefined)
|
|
137
139
|
return Promise.resolve();
|
|
138
|
-
left ??= options.keys.clock().then((until) => leaveMountRevoke(options.run.store.settings, mount.runId, { epoch: mount.epoch, disk: chosen.diskId, until }));
|
|
139
|
-
|
|
140
|
+
const writing = (left ??= options.keys.clock().then((until) => leaveMountRevoke(options.run.store.settings, mount.runId, { epoch: mount.epoch, disk: chosen.diskId, until })));
|
|
141
|
+
void writing.catch(() => {
|
|
142
|
+
if (left === writing)
|
|
143
|
+
left = undefined;
|
|
144
|
+
});
|
|
145
|
+
return writing;
|
|
140
146
|
};
|
|
147
|
+
/** A leave at the claim's end, whose failure no caller hears: said on the log, as the credential then lapses at its ttl. */
|
|
148
|
+
const leaveSaid = () => leave().catch((error) => (options.log ?? stderrLog)(`run ${options.mount?.runId}'s Archil mount credential remove could not be left for the janitor, so it lapses at its ttl: ${error instanceof Error ? error.message : String(error)}`));
|
|
141
149
|
const release = () => {
|
|
142
150
|
released = true;
|
|
143
151
|
held.clear();
|
|
144
|
-
void
|
|
152
|
+
void leaveSaid();
|
|
145
153
|
};
|
|
146
154
|
/** Removes the credential minted, by its identifier: idempotent. Then the run's users of this claim's epoch and earlier,
|
|
147
155
|
* by their names, once per mint asked for: a mint whose answer was lost (Archil made the user, this claim never heard
|
|
@@ -159,7 +167,7 @@ export async function archilClaim(options) {
|
|
|
159
167
|
owed = true;
|
|
160
168
|
// After the release (a lost claim's, or a run's process's revoke its runner made last) nothing revokes again.
|
|
161
169
|
if (released)
|
|
162
|
-
await
|
|
170
|
+
await leaveSaid();
|
|
163
171
|
throw error;
|
|
164
172
|
}
|
|
165
173
|
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** The control plane of each Archil region, as Archil's SDK (`disk` 1.12.0, src/regions.ts) names them. */
|
|
2
2
|
export declare const ARCHIL_CONTROL_URLS: Readonly<Record<string, string>>;
|
|
3
|
+
/** Whether each region serve knows has Archil's serverless exec (https://docs.archil.com/reference/regions): its AWS
|
|
4
|
+
* regions do; gcp-us-central1 doesn't, and every exec there answers "Exec is not enabled". */
|
|
5
|
+
export declare const ARCHIL_EXEC_REGIONS: Readonly<Record<string, boolean>>;
|
|
6
|
+
/** Whether region `region` has Archil's serverless exec (ARCHIL_EXEC_REGIONS). A region serve doesn't know (one given
|
|
7
|
+
* with its own S3 URL, a BYOC deployment) is taken to have it: Archil's own error says why where it hasn't. */
|
|
8
|
+
export declare const archilHasExec: (region: string) => boolean;
|
|
3
9
|
/** Archil's control plane, for the account's calls (archil-disks.ts) as for a disk's. */
|
|
4
10
|
export interface ArchilControlOptions {
|
|
5
11
|
/** The region: it names the control plane. */
|
|
@@ -17,6 +17,17 @@ export const ARCHIL_CONTROL_URLS = Object.freeze({
|
|
|
17
17
|
"aws-eu-west-1": "https://control.green.eu-west-1.aws.prod.archil.com",
|
|
18
18
|
"gcp-us-central1": "https://control.blue.us-central1.gcp.prod.archil.com",
|
|
19
19
|
});
|
|
20
|
+
/** Whether each region serve knows has Archil's serverless exec (https://docs.archil.com/reference/regions): its AWS
|
|
21
|
+
* regions do; gcp-us-central1 doesn't, and every exec there answers "Exec is not enabled". */
|
|
22
|
+
export const ARCHIL_EXEC_REGIONS = Object.freeze({
|
|
23
|
+
"aws-us-east-1": true,
|
|
24
|
+
"aws-us-west-2": true,
|
|
25
|
+
"aws-eu-west-1": true,
|
|
26
|
+
"gcp-us-central1": false,
|
|
27
|
+
});
|
|
28
|
+
/** Whether region `region` has Archil's serverless exec (ARCHIL_EXEC_REGIONS). A region serve doesn't know (one given
|
|
29
|
+
* with its own S3 URL, a BYOC deployment) is taken to have it: Archil's own error says why where it hasn't. */
|
|
30
|
+
export const archilHasExec = (region) => !Object.hasOwn(ARCHIL_EXEC_REGIONS, region) || ARCHIL_EXEC_REGIONS[region] === true;
|
|
20
31
|
const LOOPBACK = /^(?:127\.\d+\.\d+\.\d+|localhost|\[::1\])$/; // key-gate: loopback-rule names loopback hosts to allow plain http only to them, in tests
|
|
21
32
|
/** Why the control plane refused, in words: its status and Archil's own message, with no secret in them. */
|
|
22
33
|
export class ArchilMountCredentialError extends Error {
|
|
@@ -43,7 +43,7 @@ export type DockerComputerOptions = {
|
|
|
43
43
|
};
|
|
44
44
|
export declare function dockerVolumeOf(paths: DockerPaths): DockerComputerOptions | undefined;
|
|
45
45
|
/** The deps computerForClaim takes once per process: all but the claim's own. */
|
|
46
|
-
export type ComputerDeps = Omit<ComputerForClaimDeps, "mode" | "workspace" | "sealKey" | "revokeMount" | "signal">;
|
|
46
|
+
export type ComputerDeps = Omit<ComputerForClaimDeps, "mode" | "noExec" | "workspace" | "sealKey" | "revokeMount" | "signal">;
|
|
47
47
|
export interface ComputerDepsOptions {
|
|
48
48
|
/** The server's environment: a provider key named here wins over its saved one; AGENTRUN_DOCKER_IMAGE names Docker's
|
|
49
49
|
* image. Passed in, never read here. */
|
|
@@ -118,8 +118,10 @@ export declare const computerStartingWords: ({ provider, kind }: Pick<ComputerSa
|
|
|
118
118
|
* (`kept`) says it is the same; a new one after a kept one's time passed (`replaced.lapsed`) says why first, as does
|
|
119
119
|
* one after a kept one pinned to a runner that was gone by the resume (`replaced.lost`, computerLostWords), or still
|
|
120
120
|
* there and ending it itself (`replaced.elsewhere`, computerHeldWords), and one after the kept one's provider refused
|
|
121
|
-
* to attach it again (`replaced.refused`,
|
|
122
|
-
*
|
|
121
|
+
* to attach it again (`replaced.refused`, computerRefusedWords: serve's words, never the provider's, which name host
|
|
122
|
+
* paths). A runner gone or still there says why first, though its provider refused too: that is why no runner that
|
|
123
|
+
* could reach the machine took the run. Where that runner is still there, the one before runs until its end, so the
|
|
124
|
+
* words say only that nothing on it comes with the new one, never that it is gone. */
|
|
123
125
|
export declare const computerReadyWords: ({ provider, kind, hello, replaced, kept }: ComputerSaid) => string;
|
|
124
126
|
/** The run's timeline phase as its run parks with its computer kept (ClaimComputer.keeps), such as "The desktop is kept
|
|
125
127
|
* for 10 minutes while you decide." */
|
|
@@ -29,7 +29,7 @@ import { BOX_CPUS_ENV, BOX_MEMORY_ENV, BOX_PIDS_ENV } from "../start-switches.js
|
|
|
29
29
|
import { readLaunchBody } from "../run-launch.js";
|
|
30
30
|
import { SERVER_NOTE_LABEL } from "@parcha/agentrun-kernel/kernel/cap";
|
|
31
31
|
import { computerForClaim } from "./computer-for-claim.js";
|
|
32
|
-
import { computerHeldWords, computerLapsedWords, computerLostWords, KEEP_WORDS } from "./computer-kept.js";
|
|
32
|
+
import { computerHeldWords, computerLapsedWords, computerLostWords, computerRefusedWords, KEEP_WORDS } from "./computer-kept.js";
|
|
33
33
|
import { storeLedger } from "./computer-ledger.js";
|
|
34
34
|
import { computerProviderFactories, computerProviderMakers, providerSecretsOf } from "./computer-providers.js";
|
|
35
35
|
import { aLabel, needsNetwork, noNetworkRefusal, vendorNetworkOnly } from "./resolve-computer.js";
|
|
@@ -208,20 +208,22 @@ export const computerStartingWords = ({ provider, kind }) => `Starting a ${kind}
|
|
|
208
208
|
* (`kept`) says it is the same; a new one after a kept one's time passed (`replaced.lapsed`) says why first, as does
|
|
209
209
|
* one after a kept one pinned to a runner that was gone by the resume (`replaced.lost`, computerLostWords), or still
|
|
210
210
|
* there and ending it itself (`replaced.elsewhere`, computerHeldWords), and one after the kept one's provider refused
|
|
211
|
-
* to attach it again (`replaced.refused`,
|
|
212
|
-
*
|
|
211
|
+
* to attach it again (`replaced.refused`, computerRefusedWords: serve's words, never the provider's, which name host
|
|
212
|
+
* paths). A runner gone or still there says why first, though its provider refused too: that is why no runner that
|
|
213
|
+
* could reach the machine took the run. Where that runner is still there, the one before runs until its end, so the
|
|
214
|
+
* words say only that nothing on it comes with the new one, never that it is gone. */
|
|
213
215
|
export const computerReadyWords = ({ provider, kind, hello, replaced, kept }) => {
|
|
214
216
|
const ready = `The ${kind} is ready: ${[OS_NAMES[hello.os] ?? hello.os, hello.osVersion].filter(Boolean).join(" ")} (${hello.arch}), from ${provider}.`;
|
|
215
217
|
if (kept)
|
|
216
218
|
return `${ready} It's the same ${kind}, as the wait left it.`;
|
|
217
219
|
if (!replaced)
|
|
218
220
|
return ready;
|
|
219
|
-
const why = replaced.
|
|
220
|
-
? `
|
|
221
|
-
: replaced.
|
|
222
|
-
? ` ${
|
|
223
|
-
: replaced.
|
|
224
|
-
? ` ${
|
|
221
|
+
const why = replaced.lost
|
|
222
|
+
? ` ${computerLostWords(kind)}`
|
|
223
|
+
: replaced.elsewhere
|
|
224
|
+
? ` ${computerHeldWords(kind)}`
|
|
225
|
+
: replaced.refused
|
|
226
|
+
? ` ${computerRefusedWords(kind)}`
|
|
225
227
|
: replaced.lapsed
|
|
226
228
|
? ` ${computerLapsedWords(kind)}`
|
|
227
229
|
: "";
|
|
@@ -87,6 +87,9 @@ export type OpenComputerView = (args: {
|
|
|
87
87
|
export interface ComputerForClaimDeps {
|
|
88
88
|
/** The server's folder mode: 1, a folder of this machine; 2, Archil. */
|
|
89
89
|
readonly mode: 1 | 2;
|
|
90
|
+
/** In Mode 2, the server's Archil region where it has no serverless exec (archil-settings.ts noExecRegionOf): a run
|
|
91
|
+
* with no computer that mounts its folder has no shell there (resolve-computer.ts shellPlaceOf). */
|
|
92
|
+
readonly noExec: string | undefined;
|
|
90
93
|
/** The computer module's kind registry (or --faux's). */
|
|
91
94
|
readonly kinds: KindRegistry;
|
|
92
95
|
/** The server's seal key: absent, no key is opened, so a provider that needs one is refused in words. */
|
|
@@ -254,14 +257,15 @@ export type KeptKind = Kept["kind"];
|
|
|
254
257
|
* process of this runner's name), that runner was gone by this claim, and this claim could not reach it. `elsewhere`:
|
|
255
258
|
* the same, but that runner was still there (refusing claims, or its word late), so this claim gave the row back for
|
|
256
259
|
* that runner to end the machine (restoreKept). `refused`: the earlier one was kept at a park, and its provider refused
|
|
257
|
-
* to attach it again
|
|
260
|
+
* to attach it again (a Docker computer made before its egress bridge, or bound from another runner's home); the
|
|
261
|
+
* provider's words went to the runner's log alone. */
|
|
258
262
|
export type Replaced = {
|
|
259
263
|
readonly kind: MadeKind;
|
|
260
264
|
readonly folderKept: boolean;
|
|
261
265
|
readonly lapsed?: true;
|
|
262
266
|
readonly lost?: true;
|
|
263
267
|
readonly elsewhere?: true;
|
|
264
|
-
readonly refused?:
|
|
268
|
+
readonly refused?: true;
|
|
265
269
|
};
|
|
266
270
|
/** The agent's computer setting: the launch's, else its revision's (computer, else place), else the launch's place. The
|
|
267
271
|
* run's end reads it the same way (run-end-computers.ts). */
|