@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.58
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 +281 -0
- package/README.md +246 -66
- package/dist/acp-package.d.ts +2 -0
- package/dist/adapters.d.ts +15 -3
- package/dist/adapters.js +17 -6
- package/dist/agent-package.d.ts +3 -3
- package/dist/agent-package.js +17 -8
- package/dist/api-keys.d.ts +76 -0
- package/dist/api-keys.js +217 -0
- package/dist/api-only.d.ts +15 -5
- package/dist/api-only.js +32 -8
- package/dist/box-paths.d.ts +4 -3
- package/dist/box-paths.js +7 -4
- package/dist/browser-hold.d.ts +23 -0
- package/dist/browser-hold.js +48 -0
- package/dist/browser-person.d.ts +3 -0
- package/dist/browser-person.js +4 -1
- package/dist/chatgpt-plan.d.ts +18 -8
- package/dist/chatgpt-plan.js +91 -34
- package/dist/claude-login-token.d.ts +117 -0
- package/dist/claude-login-token.js +737 -0
- package/dist/claude-login.d.ts +120 -22
- package/dist/claude-login.js +347 -63
- package/dist/claude-sign-in.d.ts +17 -6
- package/dist/claude-sign-in.js +42 -39
- package/dist/cli.js +33 -10
- package/dist/composio-made.d.ts +4 -0
- package/dist/composio-made.js +4 -0
- package/dist/composio-preset.d.ts +43 -2
- package/dist/composio-preset.js +92 -4
- package/dist/computer-attach.d.ts +35 -17
- package/dist/computer-attach.js +301 -49
- package/dist/computer-held-routes.d.ts +5 -4
- package/dist/computer-held-routes.js +29 -8
- package/dist/computer-held.d.ts +6 -1
- package/dist/computer-held.js +14 -0
- package/dist/computer-record.js +4 -2
- package/dist/computer-viewer.js +4 -1
- package/dist/computers.d.ts +10 -10
- package/dist/computers.js +5 -5
- package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
- package/dist/console/assets/index-Bwn1oTem.css +1 -0
- package/dist/console/assets/index-DPh29cyz.js +747 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +1 -1
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +129 -1
- package/dist/docker-host-addresses.d.ts +22 -11
- package/dist/docker-host-addresses.js +38 -26
- package/dist/env-switch.d.ts +8 -0
- package/dist/env-switch.js +31 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +56 -20
- package/dist/fal-price.js +400 -90
- package/dist/handed-values.d.ts +43 -1
- package/dist/handed-values.js +119 -2
- package/dist/harness-archive.d.ts +13 -10
- package/dist/harness-archive.js +60 -34
- package/dist/harness-check.d.ts +3 -1
- package/dist/harness-check.js +25 -46
- package/dist/harness-keys.d.ts +73 -27
- package/dist/harness-keys.js +194 -61
- package/dist/harness-recipe-entry.d.ts +8 -7
- package/dist/harness-recipe-entry.js +21 -32
- package/dist/harness-recipe.d.ts +38 -25
- package/dist/harness-recipe.js +49 -36
- package/dist/harness-sign-in.js +12 -23
- package/dist/harness-table.d.ts +10 -3
- package/dist/harness-table.js +26 -21
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +17 -5
- package/dist/hosted-search.d.ts +1 -1
- package/dist/hosted-search.js +1 -2
- package/dist/import-worker.d.ts +4 -2
- package/dist/import-worker.js +9 -2
- package/dist/in-flight.d.ts +26 -0
- package/dist/in-flight.js +52 -0
- package/dist/key-refusal.d.ts +9 -4
- package/dist/key-refusal.js +107 -25
- package/dist/learn/ledger.d.ts +170 -0
- package/dist/learn/ledger.js +218 -0
- package/dist/learn/promote.d.ts +3 -3
- package/dist/learn/promote.js +1 -1
- package/dist/learn/secrets.d.ts +13 -3
- package/dist/learn/secrets.js +118 -17
- package/dist/learning-cost.d.ts +28 -23
- package/dist/learning-cost.js +19 -23
- package/dist/link-check.js +1 -1
- package/dist/live-reach.d.ts +2 -0
- package/dist/live-reach.js +2 -0
- package/dist/llms.txt +1 -1
- package/dist/marketplace.d.ts +77 -0
- package/dist/marketplace.js +224 -0
- package/dist/mcp-api-only-origins.d.ts +35 -0
- package/dist/mcp-api-only-origins.js +57 -0
- package/dist/mcp-gateway.d.ts +7 -5
- package/dist/mcp-gateway.js +9 -12
- package/dist/mcp-secret-writes.js +5 -3
- package/dist/mcp-servers-store.d.ts +28 -6
- package/dist/mcp-servers-store.js +53 -4
- package/dist/media-duration.d.ts +3 -0
- package/dist/media-duration.js +90 -9
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-form.d.ts +5 -4
- package/dist/model-form.js +11 -7
- package/dist/model.d.ts +10 -6
- package/dist/model.js +16 -11
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +7 -1
- package/dist/ollama-provider.js +14 -2
- package/dist/openapi.js +210 -37
- package/dist/otel/genai.d.ts +65 -0
- package/dist/otel/genai.js +116 -0
- package/dist/otel/tracer.d.ts +55 -0
- package/dist/otel/tracer.js +308 -0
- package/dist/page.d.ts +2 -0
- package/dist/page.js +3 -1
- package/dist/paid-calls.d.ts +1 -32
- package/dist/paid-calls.js +4 -39
- package/dist/place-offers.d.ts +4 -0
- package/dist/place-offers.js +7 -4
- package/dist/provider.d.ts +11 -2
- package/dist/provider.js +59 -8
- package/dist/redact/match.d.ts +30 -3
- package/dist/redact/match.js +422 -41
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +11 -0
- package/dist/run-census.d.ts +67 -0
- package/dist/run-census.js +240 -0
- package/dist/run-computer.d.ts +6 -3
- package/dist/run-computer.js +4 -1
- package/dist/run-cut.d.ts +15 -6
- package/dist/run-cut.js +30 -9
- package/dist/run-files.d.ts +3 -0
- package/dist/run-files.js +3 -0
- package/dist/run-launch.d.ts +12 -1
- package/dist/run-launch.js +9 -10
- package/dist/run-learning-served.d.ts +4 -2
- package/dist/run-model-key.d.ts +8 -0
- package/dist/run-model-key.js +31 -1
- package/dist/run-reads-over-store.d.ts +24 -6
- package/dist/run-reads-over-store.js +67 -23
- package/dist/run-recordings.d.ts +5 -1
- package/dist/run-recordings.js +39 -14
- package/dist/run-timeline-served.d.ts +2 -0
- package/dist/run-timeline-served.js +2 -2
- package/dist/run-usage.d.ts +1 -0
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.d.ts +10 -1
- package/dist/runnable.js +20 -8
- package/dist/runner/adapter-loop.d.ts +11 -0
- package/dist/runner/adapter-loop.js +58 -26
- package/dist/runner/adapter-run-spec.d.ts +55 -11
- package/dist/runner/adapter-run-spec.js +183 -52
- package/dist/runner/adapters/pi.js +25 -3
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +27 -9
- package/dist/runner/big-writes.js +1 -10
- package/dist/runner/claim-secrets.d.ts +27 -10
- package/dist/runner/claim-secrets.js +49 -22
- package/dist/runner/cli-run-spec.d.ts +6 -0
- package/dist/runner/cli-run-spec.js +97 -38
- package/dist/runner/computer-journal.d.ts +9 -1
- package/dist/runner/computer-journal.js +26 -0
- package/dist/runner/conformance/harness.js +1 -1
- package/dist/runner/feedback-round.js +3 -0
- package/dist/runner/harness-loops.d.ts +6 -5
- package/dist/runner/harness-loops.js +7 -7
- package/dist/runner/held.d.ts +24 -6
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/journal-kinds.js +5 -0
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +19 -9
- package/dist/runner/mcp-claim.js +31 -3
- package/dist/runner/mcp-run.d.ts +9 -0
- package/dist/runner/mcp-run.js +11 -5
- package/dist/runner/model-route.d.ts +17 -0
- package/dist/runner/model-route.js +120 -2
- package/dist/runner/presence.d.ts +11 -1
- package/dist/runner/presence.js +7 -0
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/run-child-host.d.ts +22 -8
- package/dist/runner/run-child-host.js +128 -41
- package/dist/runner/run-child.js +5 -2
- package/dist/runner/runner.d.ts +17 -3
- package/dist/runner/runner.js +130 -34
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +6 -0
- package/dist/runner/store-secrets.js +49 -7
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +16 -38
- package/dist/runner/workflow-first.d.ts +35 -15
- package/dist/runner/workflow-first.js +38 -25
- package/dist/runner/workflow-spec.js +4 -3
- package/dist/runs-over-store.d.ts +15 -6
- package/dist/runs-over-store.js +33 -21
- package/dist/scrub-command.d.ts +73 -0
- package/dist/scrub-command.js +307 -0
- package/dist/secret-cut.d.ts +73 -0
- package/dist/secret-cut.js +291 -4
- package/dist/secret-rules.d.ts +143 -0
- package/dist/secret-rules.js +2564 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +20 -0
- package/dist/server-keys.d.ts +20 -0
- package/dist/server-keys.js +25 -6
- package/dist/server.d.ts +65 -13
- package/dist/server.js +470 -157
- package/dist/skills/agentrun-serve/SKILL.md +4 -0
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.js +1 -1
- package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/schema.d.ts +23 -0
- package/dist/store/schema.js +58 -2
- package/dist/store/seal.d.ts +6 -1
- package/dist/store/seal.js +5 -3
- package/dist/store/sqlite/run-launch.d.ts +9 -1
- package/dist/store/sqlite/run-launch.js +24 -13
- package/dist/store/sqlite/run-patch.d.ts +12 -2
- package/dist/store/sqlite/run-patch.js +42 -5
- package/dist/store/sqlite/store.js +105 -12
- package/dist/store/store.d.ts +57 -2
- package/dist/store/store.js +20 -0
- package/dist/store-reads/learning.d.ts +84 -124
- package/dist/store-reads/learning.js +210 -274
- package/dist/store-view.d.ts +3 -0
- package/dist/store-view.js +3 -3
- package/dist/suggestions.js +3 -2
- package/dist/template-eval.d.ts +39 -9
- package/dist/template-eval.js +191 -60
- package/dist/template-import.js +6 -2
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +28 -8
- package/dist/timeline/labels.d.ts +6 -4
- package/dist/timeline/labels.js +18 -6
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +14 -8
- package/dist/timeline/util.js +1 -1
- package/dist/timeline/web-calls.d.ts +22 -7
- package/dist/timeline/web-calls.js +106 -35
- package/dist/tool-gate.d.ts +42 -3
- package/dist/tool-gate.js +66 -5
- package/dist/tool-keys-store.d.ts +2 -4
- package/dist/tool-keys-store.js +5 -21
- package/dist/tool-keys.d.ts +2 -2
- package/dist/tool-keys.js +2 -2
- package/dist/tool-list.js +1 -1
- package/dist/tool-plane.d.ts +2 -2
- package/dist/tool-plane.js +35 -33
- package/dist/tools.js +13 -7
- package/dist/trigger-targets.d.ts +4 -0
- package/dist/trigger-targets.js +9 -2
- package/dist/triggers.d.ts +67 -4
- package/dist/triggers.js +171 -22
- package/dist/until.d.ts +3 -0
- package/dist/until.js +11 -0
- package/dist/web-fake.d.ts +1 -3
- package/dist/web-fake.js +7 -18
- package/dist/web-fetch.d.ts +6 -72
- package/dist/web-fetch.js +11 -265
- package/dist/web-run.d.ts +31 -0
- package/dist/web-run.js +90 -0
- package/dist/web-save.d.ts +10 -13
- package/dist/web-save.js +13 -55
- package/dist/web-search.d.ts +9 -127
- package/dist/web-search.js +23 -259
- package/dist/wires.d.ts +13 -0
- package/dist/wires.js +11 -0
- package/dist/workflow-run.d.ts +5 -4
- package/dist/workflow-run.js +5 -4
- package/dist/workspace/attached-computers.d.ts +32 -9
- package/dist/workspace/attached-computers.js +77 -13
- package/dist/workspace/computer-deps.d.ts +8 -2
- package/dist/workspace/computer-deps.js +10 -3
- package/dist/workspace/computer-for-claim.d.ts +12 -1
- package/dist/workspace/computer-for-claim.js +83 -11
- package/dist/workspace/computer-kept.d.ts +3 -0
- package/dist/workspace/computer-kept.js +11 -2
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills.d.ts +4 -0
- package/dist/workspace/kind-skills.js +9 -0
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +153 -0
- package/dist/workspace/synced-folder.js +3 -4
- package/dist/wrapped.d.ts +20 -6
- package/dist/wrapped.js +66 -25
- package/package.json +17 -11
- package/skills/agentrun-serve/SKILL.md +4 -0
- package/templates/README.md +32 -10
- package/dist/console/assets/index-CQ3cJRzI.js +0 -746
- package/dist/console/assets/index-DKkaS3a0.css +0 -1
- package/dist/exa-keyless.d.ts +0 -34
- package/dist/exa-keyless.js +0 -118
- package/dist/firecrawl-keyless.d.ts +0 -41
- package/dist/firecrawl-keyless.js +0 -152
- package/dist/keyless-mcp.d.ts +0 -36
- package/dist/keyless-mcp.js +0 -127
- package/dist/text-urls.d.ts +0 -38
- package/dist/text-urls.js +0 -170
- package/dist/web-fetch-direct.d.ts +0 -119
- package/dist/web-fetch-direct.js +0 -190
|
@@ -17,12 +17,13 @@ import { existsSync } from "node:fs";
|
|
|
17
17
|
import { chmod, mkdir, rm } from "node:fs/promises";
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
20
|
-
import { encode, SECRET_NAMES, SECRETS_FD_ENV, SECRETS_LEN_ENV, withoutSecrets } from "../secrets.js";
|
|
20
|
+
import { encode, OTEL_PAIR, SECRET_NAMES, SECRETS_FD_ENV, SECRETS_LEN_ENV, withoutSecrets } from "../secrets.js";
|
|
21
|
+
import { otelSettings } from "../otel/tracer.js";
|
|
21
22
|
import { putLiveViewer, dropLiveViewer } from "../browser-live.js";
|
|
22
23
|
import { CALENDAR_EVENTS } from "../calendar/names.js";
|
|
23
24
|
import { openCalendar } from "../calendar/address.js";
|
|
24
25
|
import { openAccount } from "../email/account.js";
|
|
25
|
-
import { harnessOf,
|
|
26
|
+
import { harnessOf, planRecipeOf, recipeHarness } from "../harness-table.js";
|
|
26
27
|
import { openHarnessKeys } from "../harness-keys.js";
|
|
27
28
|
import { installDirOf, installForClaim, shareInstall } from "../harness-install.js";
|
|
28
29
|
import { loadArchilSettings } from "../archil-settings.js";
|
|
@@ -34,7 +35,7 @@ import { DECISION_PROVIDER_KEYS } from "../tool-plane.js";
|
|
|
34
35
|
import { learningEndOfRun } from "./learning-end.js";
|
|
35
36
|
import { cutDeep, runnerSecrets } from "./redact.js";
|
|
36
37
|
import { storeSecrets } from "./store-secrets.js";
|
|
37
|
-
import { FAUX_ENV, GATEWAY_KEY_ENV } from "../model.js";
|
|
38
|
+
import { FAUX_ENV, FAUX_PROVIDER, GATEWAY_KEY_ENV } from "../model.js";
|
|
38
39
|
import { SAVED_GATEWAY_ENV, savedGatewayIn } from "../model-gateway.js";
|
|
39
40
|
import { FAUX_VENDOR_API_ENV } from "../tools.js";
|
|
40
41
|
import { withinCarried } from "../paid-calls.js";
|
|
@@ -42,6 +43,7 @@ import { openRunMcpAuth, sealRunMcpAuth } from "../store/seal.js";
|
|
|
42
43
|
import { runZone } from "../environment.js";
|
|
43
44
|
import { shadowRunId } from "../learn/audit.js";
|
|
44
45
|
import { LEARNING_SCRIPT, learningWorkspace } from "../learn/folder.js";
|
|
46
|
+
import { agreeOnOf } from "../learning-setting.js";
|
|
45
47
|
import { openRunWorkspace } from "../workspace/run-workspace.js";
|
|
46
48
|
import { archilClaim, MOUNT_TTL_MS } from "../workspace/archil-claim.js";
|
|
47
49
|
import { agentDirName, recordingsFolder, runFolder, scratchFolder } from "../workspace/paths.js";
|
|
@@ -59,12 +61,13 @@ import { withAudit } from "./audit.js";
|
|
|
59
61
|
import { compareEndOfRun } from "./compare-end.js";
|
|
60
62
|
import { learnedFirst } from "./learned-first.js";
|
|
61
63
|
import { workflowsAt } from "./learning-seed.js";
|
|
62
|
-
import { heldMcpOf, mcpForClaim } from "./mcp-run.js";
|
|
64
|
+
import { claimMetering, heldMcpOf, mcpForClaim } from "./mcp-run.js";
|
|
63
65
|
import { learnedTiers, learnsWorkflows, mcpReachOf } from "./adapter-run-spec.js";
|
|
64
66
|
import { createDispatchLoop } from "./dispatch.js";
|
|
65
67
|
import { refuseRecipeTriggerRun, resolveRunnerLoop, withSavedGatewayDeps } from "./harness-loops.js";
|
|
66
68
|
import { isWorkflowRevision } from "./workflow-loop.js";
|
|
67
69
|
import { loginForRun } from "../claude-login.js";
|
|
70
|
+
import { agentRunLogin, LOGIN_NOT_HANDED, loginRunnerInProcess, loginTokensFor } from "../claude-login-token.js";
|
|
68
71
|
import { heardComputerHold } from "./computer-journal.js";
|
|
69
72
|
import { ClaimRefused } from "./loop-contract.js";
|
|
70
73
|
import { Channel, ChannelClosed } from "./run-channel.js";
|
|
@@ -73,7 +76,7 @@ import { exposeSaveSlots } from "./save-slots.js";
|
|
|
73
76
|
import { runBigWrites } from "./big-writes.js";
|
|
74
77
|
import { SERVER_SLOTS } from "../web-save.js";
|
|
75
78
|
import { launchOnItsDisk, readLaunchBody } from "../run-launch.js";
|
|
76
|
-
import { SUBAGENT_TOOL } from "./subagent.js";
|
|
79
|
+
import { routedSubagentTiers, SUBAGENT_TOOL } from "./subagent.js";
|
|
77
80
|
import { sourceSyncOf } from "../source-sync/types.js";
|
|
78
81
|
import { sourceAuxiliaryAdmitter } from "../source-sync/auxiliary.js";
|
|
79
82
|
import { beginSourceIO } from "../source-sync/io.js";
|
|
@@ -622,6 +625,11 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
622
625
|
/** Whether the claim's run holds a model key of its own now (its launch, as this runner opens it): its process is then
|
|
623
626
|
* handed none of the server's (claim-secrets.ts keyedAtClaim, held here for the runner's answers). */
|
|
624
627
|
const runKeyed = async () => (await openRunModelKey(keys, claim.runId)) !== undefined;
|
|
628
|
+
/** Whether the claim's run is held, its model kept from running at its create (hold.refused): it routes no model, so
|
|
629
|
+
* whatever its process asks, the runner hands it no model key, answers it keyless and refuses it a learning step (its
|
|
630
|
+
* learned workflows and its end-of-run step), as its spec asks for none of them (adapter-run-spec.ts, cli-run-spec.ts). */
|
|
631
|
+
const modelRefused = launch.hold?.refused !== undefined;
|
|
632
|
+
const refusedSpend = () => new ClaimRefused("a held run its model kept from running asks its runner for no model spend: it routes no model and takes no learning step");
|
|
625
633
|
const learningFolder = async () => {
|
|
626
634
|
const made = await archilOf();
|
|
627
635
|
return made === undefined ? learningFolderOf(deps.data, run.agentId) : learningWorkspace({ mode: "archil", agentId: run.agentId, archil: made });
|
|
@@ -701,6 +709,35 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
701
709
|
return undefined;
|
|
702
710
|
return { state: plan.state, models: [...plan.models], token: () => plan.token(), refused: (sent) => plan.refused(sent), watch: (listener) => plan.watch(listener) };
|
|
703
711
|
},
|
|
712
|
+
// The claim's own login, as this runner reads the claim (its harness, its place, no model key of its own), whatever
|
|
713
|
+
// the process names: its access token alone, read again at each ask and renewed here when it must be (near its end,
|
|
714
|
+
// or refused); never its folder or its refresh token. Each token is carried into the runner's redactor for this run
|
|
715
|
+
// (redact.ts carry) before it is handed, a renewed one too: model text that repeats it is cut from the run's journal
|
|
716
|
+
// as the runner writes it (runner.ts fenced), from what it stages and from its rows, as the run's own tool keys are.
|
|
717
|
+
// This answer is the claim's one decision whether it goes on the login: none, it does not; a login other than
|
|
718
|
+
// AgentRun's own folder is refused in words, never left to a model key. The process reads no setting or machine id.
|
|
719
|
+
claudeLogin: async () => {
|
|
720
|
+
if (await runKeyed())
|
|
721
|
+
return undefined;
|
|
722
|
+
const harness = launch.harness ?? revision.body.harness;
|
|
723
|
+
const at = await loginForRun(store.settings, deps.data, deps.env ?? {}, harness, launch.place);
|
|
724
|
+
if (!at)
|
|
725
|
+
return undefined;
|
|
726
|
+
if (!agentRunLogin(at, deps.data))
|
|
727
|
+
throw new ClaimRefused(LOGIN_NOT_HANDED);
|
|
728
|
+
const carry = cut.carry;
|
|
729
|
+
if (!carry)
|
|
730
|
+
throw new ClaimRefused("This runner has no redactor that can cut the login's token from what its run writes, so it hands none.");
|
|
731
|
+
const tokens = loginTokensFor(at);
|
|
732
|
+
return {
|
|
733
|
+
token: async () => {
|
|
734
|
+
const token = await tokens.token();
|
|
735
|
+
carry.call(cut, claim.runId, [token]);
|
|
736
|
+
return token;
|
|
737
|
+
},
|
|
738
|
+
refused: (sent) => tokens.refused(sent),
|
|
739
|
+
};
|
|
740
|
+
},
|
|
704
741
|
signInReadsBack: () => handedSignInReadsBack(store, sealKey, run),
|
|
705
742
|
runSignIn: (resolution) => {
|
|
706
743
|
const vendorFetch = async () => (claimed[FAUX_ENV] ? fauxFetch(claimed, FAUX_VENDOR_API_ENV) : fetch);
|
|
@@ -710,7 +747,7 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
710
747
|
mcp: (ask) => projectCall(async () => {
|
|
711
748
|
const reach = await mcpReachOf(deps);
|
|
712
749
|
const harness = { commit: (change) => change({ appendEntry: async (_conversation, entry) => void (await ask.appendRoot(dataOnly(entry))) }) };
|
|
713
|
-
const made = await mcpForClaim({ claim, store, sealKey, grants: granted, harness: harness, work: () => runFolder(deps.data, run.agentId, claim.runId), launchInput: launch.input, githubAppAccess: () => github(), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...(deps.composioMcpOrigin ? { composioMcpOrigin: deps.composioMcpOrigin } : {}), ...reach,
|
|
750
|
+
const made = await mcpForClaim({ claim, store, sealKey, grants: granted, harness: harness, work: () => runFolder(deps.data, run.agentId, claim.runId), launchInput: launch.input, githubAppAccess: () => github(), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...(deps.composioMcpOrigin ? { composioMcpOrigin: deps.composioMcpOrigin } : {}), ...reach, ...claimMetering(deps, undefined, launch) });
|
|
714
751
|
if (!made)
|
|
715
752
|
return undefined;
|
|
716
753
|
releases.push(() => made.release());
|
|
@@ -742,19 +779,31 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
742
779
|
};
|
|
743
780
|
return { api: access.api, target: bound, mint, ...(access.revoke ? { revoke: access.revoke } : {}), ...(access.same ? { same: access.same } : {}) };
|
|
744
781
|
},
|
|
745
|
-
|
|
746
|
-
//
|
|
747
|
-
//
|
|
748
|
-
//
|
|
749
|
-
|
|
782
|
+
subagentTierKeys: async () => {
|
|
783
|
+
// A subagent's tiers alone: an agentic run granted the subagent tool routes each tier its revision's modelTiers or
|
|
784
|
+
// the host's tier variable names, and no other (adapter-run-spec.ts), so its process is handed those tiers' models'
|
|
785
|
+
// keys (tierModelKeys, the revision's model of a tier over the host's): never a provider's no tier of it reaches, nor
|
|
786
|
+
// a key for a tier it routes no model on. A replay's or an audit's grade (adapter-run-spec.ts graderRouteOf) routes
|
|
787
|
+
// the fast tier of that same answer, whose model may be another provider's than its agent's: its process is handed
|
|
788
|
+
// that tier's model's key alone (through a gateway, the gateway's), none when the revision names agree_on (no
|
|
789
|
+
// grader). A learning run's grade and an SDK run's compile turn stay in the runner (runsInRunner): their process
|
|
790
|
+
// never asks, and gets none. And never for a run that holds a key of its own (its launch's, read now): the server's
|
|
791
|
+
// keys are not its to spend, whatever its process asks; nor for a held run its model kept from running, which routes
|
|
792
|
+
// no model and grades nothing.
|
|
793
|
+
const subagent = !modelRefused && revision.kind === "agentic" && granted.includes(SUBAGENT_TOOL);
|
|
794
|
+
const grades = !modelRefused && (launch.replay !== undefined || launch.audit !== undefined) && !agreeOnOf(revision.body.learning)?.length;
|
|
795
|
+
if (!subagent && !grades)
|
|
796
|
+
return {};
|
|
797
|
+
const { tiers, refs } = routedSubagentTiers(revision.body, keys.env ?? {});
|
|
750
798
|
const keyed = await runKeyed();
|
|
751
|
-
return
|
|
799
|
+
return stringsOf(keyed ? {} : await tierModelKeys(keys, subagent ? tiers : tiers.filter((tier) => tier === "fast"), refs));
|
|
752
800
|
},
|
|
753
801
|
tierModelKeys: async (tiers) => {
|
|
754
802
|
// The tiers the claim's learned workflows name (learnedTiers), as this runner chose them (learnedFirst below): a
|
|
755
|
-
// tier the process names beyond them gets no key, and none before the choice
|
|
803
|
+
// tier the process names beyond them gets no key, and none before the choice (a held run its model kept from running
|
|
804
|
+
// makes none: its learnedFirst is refused).
|
|
756
805
|
const asked = new Set(tiers.filter((tier) => typeof tier === "string"));
|
|
757
|
-
const named = learnsWorkflows(revision.kind, learnedFlows) ? learnedTiers(learnedFlows).filter((tier) => asked.has(tier)) : [];
|
|
806
|
+
const named = !modelRefused && learnsWorkflows(revision.kind, learnedFlows) ? learnedTiers(learnedFlows).filter((tier) => asked.has(tier)) : [];
|
|
758
807
|
const keyed = await runKeyed();
|
|
759
808
|
const got = keyed ? {} : await tierModelKeys(keys, named);
|
|
760
809
|
const plan = planOf(got);
|
|
@@ -768,15 +817,18 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
768
817
|
},
|
|
769
818
|
// The claim's own run's key alone (its launch, as the runner reads it), whatever run the process would name.
|
|
770
819
|
runModelKey: () => openRunModelKey(keys, claim.runId),
|
|
771
|
-
|
|
820
|
+
// A held run its model kept from running is answered keyless, no saved key read: none of its spend is the server's.
|
|
821
|
+
serverKeyless: async () => modelRefused || serverKeyless(keys),
|
|
772
822
|
// The zone alone, from the claim's own launch's trigger: the process never reads a trigger's row.
|
|
773
823
|
runZone: () => runZone(store, launch.inputOrigin),
|
|
774
824
|
// The keys saved for the claim's own harness alone (harness-keys.ts), whatever the process names: none unless that
|
|
775
|
-
// harness is a plan-billed recipe on this runner's table, and never another harness's.
|
|
776
|
-
|
|
825
|
+
// harness is a plan-billed recipe on this runner's table, and never another harness's. Opened for the recipe file
|
|
826
|
+
// the process loaded (`digest`), never the one this runner's table read at its start: a file swapped for another
|
|
827
|
+
// vendor's under the same id since then runs its own binary, and a key bound to the first file never opens for it.
|
|
828
|
+
harnessKeys: async (digest) => {
|
|
777
829
|
const harness = launch.harness ?? revision.body.harness;
|
|
778
|
-
const
|
|
779
|
-
return
|
|
830
|
+
const recipe = harness === undefined ? undefined : planRecipeOf(deps.env, harness);
|
|
831
|
+
return recipe?.keys.length && typeof digest === "string" ? openHarnessKeys(store, sealKey, { ...recipe, digest }) : {};
|
|
780
832
|
},
|
|
781
833
|
liveViewerPut: (handover) => putLiveViewer(store, sealKey, claim, handover),
|
|
782
834
|
liveViewerDrop: (tag) => dropLiveViewer(store, claim, tag),
|
|
@@ -816,6 +868,7 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
816
868
|
...deps.computerDeps, mode, workspace: ws.workspace, sealKey,
|
|
817
869
|
recordings: { folder: recordingsFolder(deps.data, run.agentId, claim.runId), say: (words) => say?.(cut(words)) },
|
|
818
870
|
hadComputer: async () => (await ask.hadComputer()) === true,
|
|
871
|
+
...(typeof ask.turnedOff === "string" ? { turnedOff: ask.turnedOff } : {}),
|
|
819
872
|
...(ask.signal instanceof AbortSignal ? { signal: ask.signal } : {}),
|
|
820
873
|
...(made ? { revokeMount: () => made.revoke(), inheritMount: () => made.inherit() } : {}),
|
|
821
874
|
...(typeof ask.onImageWait === "function" ? { onImageWait: ask.onImageWait } : {}),
|
|
@@ -851,6 +904,10 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
851
904
|
revoke: () => cleanProject(() => made.revoke()), inherit: () => projectCall(async () => made.inherit()), release: async () => { } };
|
|
852
905
|
}),
|
|
853
906
|
endOfRun: async (input) => {
|
|
907
|
+
// None for a held run its model kept from running: its spec builds no end-of-run step, and its runner reads no saved
|
|
908
|
+
// key and starts no audit for one, whatever its process asks.
|
|
909
|
+
if (modelRefused)
|
|
910
|
+
throw refusedSpend();
|
|
854
911
|
// The step as the run's spec builds it in a runner (adapter-run-spec.ts), over the runner's reads of the claim: what
|
|
855
912
|
// the run must never learn is every secret this runner holds, the keys its claim handed it, every secret the server
|
|
856
913
|
// keeps sealed and its sign-in's pointers, none of which the run's process is given.
|
|
@@ -902,7 +959,8 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
902
959
|
});
|
|
903
960
|
return rows === undefined ? undefined : { also: dataOnly(rows.also ?? []) };
|
|
904
961
|
},
|
|
905
|
-
|
|
962
|
+
// None for a held run its model kept from running: it settles no audit, starts no replay run and serves no workflow.
|
|
963
|
+
learnedFirst: (ask) => (modelRefused ? Promise.reject(refusedSpend()) : chosen ??= (async () => {
|
|
906
964
|
// The workflows the claim's seed lays, read by this runner at the launch's seed (learning-seed.ts workflowsAt), as
|
|
907
965
|
// the process's lay chose them: none where its lay laid none (`laid` false: a read that failed, a seed with no
|
|
908
966
|
// workflows).
|
|
@@ -1013,19 +1071,26 @@ export const childArgv = () => [process.execPath, "--import", new URL("../secret
|
|
|
1013
1071
|
* A native run (launch.native): its agent is the source machine's own sign-in, reached through the server's
|
|
1014
1072
|
* connectors, whose rows are the server's. */
|
|
1015
1073
|
export const runsInRunner = (harness, launch) => harness === "learning" || Boolean(launch.sdk) || Boolean(launch.native) || Boolean(launch.cli_learning);
|
|
1016
|
-
/** The words a run on
|
|
1017
|
-
|
|
1074
|
+
/** The words a run on this machine's own Claude Code login (the `machine` place: claude-login.ts machineFolder, ~/.claude
|
|
1075
|
+
* or the server's CLAUDE_CONFIG_DIR) is refused in where each run is a user of its own: only AgentRun's own login folder
|
|
1076
|
+
* is handed to such a run, as its access token. */
|
|
1077
|
+
export const LOGIN_MACHINE_NEEDS_SERVER_USER = `A run on this machine's own Claude Code login (~/.claude, or the CLAUDE_CONFIG_DIR AgentRun was started with) needs runs under the server's own user, and this runner runs each run as a user of its own: switch to AgentRun's own login folder under Settings → Model keys, set ${RUN_USER_ENV}=same, or give the run a model_key.`;
|
|
1078
|
+
/** The words a run on the login is refused in where each run is a user of its own while runner `other`, on the same data
|
|
1079
|
+
* folder, runs its runs on the login in its own process, whose CLI renews the login in that folder itself. */
|
|
1080
|
+
export const loginRunnerInProcessWords = (other) => `This runner runs each run as a user of its own, and runner ${other} on the same data folder runs Claude Code's login runs in its own process, whose CLI renews that login itself: stop ${other}, set ${RUN_USER_ENV}=same on this runner too, or give the run a model_key.`;
|
|
1018
1081
|
/** The words a run on a harness recipe is refused in where each run is a user of its own (harness-table.ts recipeHarness). */
|
|
1019
1082
|
export const RECIPE_NEEDS_SERVER_USER = `A run on a harness recipe needs runs under the server's own user, since its install, its check and its owner's sign-in are that user's alone, and this runner runs each run as a user of its own: set ${RUN_USER_ENV}=same on this runner.`;
|
|
1020
1083
|
export { RECIPE_SIGN_IN_PERSON_ONLY } from "./harness-loops.js";
|
|
1021
1084
|
/** Whether run `runId` stays in its runner's process: runsInRunner's, and a workflow run on a server with a documents
|
|
1022
1085
|
* directory (launch.documents), whose reads and writes (a pdf_pages call's pages) are rooted in a folder the server's
|
|
1023
1086
|
* user holds and no slot's user is given; its nodes run the server's own tools alone, no agent's code. A run on Claude
|
|
1024
|
-
* Code's login on this machine (claude-login.ts loginForRun)
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
* the
|
|
1028
|
-
*
|
|
1087
|
+
* Code's login on this machine (claude-login.ts loginForRun), where runs are the runner's own user (`process`), stays in
|
|
1088
|
+
* the runner, its CLI on the login's folder. Where each run is a user of its own (`uid`), a run on AgentRun's own login
|
|
1089
|
+
* folder is a process of its own handed the login's access token alone (held.ts claudeLogin, claude-login-token.ts),
|
|
1090
|
+
* never the folder; it is refused at its claim (ClaimRefused, in words) on this machine's own login (machineFolder), and
|
|
1091
|
+
* while a `process` runner on the same data folder is live (its CLI renews the folder's login itself). A run its caller
|
|
1092
|
+
* handed a model key (model_key) runs on that key and never on the login (cli-run-spec.ts), so it is a process of its
|
|
1093
|
+
* own like any other. */
|
|
1029
1094
|
export async function staysInRunner(deps, harness, launch, runId, isolation) {
|
|
1030
1095
|
// A recipe's harness reads its install, its check's note and its owner's sign-in, each the server user's alone: never
|
|
1031
1096
|
// opened to a slot's user (the sign-in least of all), so where each run is a user of its own it is refused here. And a
|
|
@@ -1042,13 +1107,19 @@ export async function staysInRunner(deps, harness, launch, runId, isolation) {
|
|
|
1042
1107
|
if (revision && isWorkflowRevision(revision))
|
|
1043
1108
|
return true;
|
|
1044
1109
|
}
|
|
1045
|
-
|
|
1110
|
+
const login = await loginForRun(deps.store.settings, deps.data, deps.env ?? {}, harness, launch.place);
|
|
1111
|
+
if (login === undefined)
|
|
1046
1112
|
return false;
|
|
1047
1113
|
if ((await openRunModelKey({ store: deps.store, sealKey: deps.sealKey }, runId)) !== undefined)
|
|
1048
1114
|
return false;
|
|
1049
|
-
if (isolation.kind
|
|
1050
|
-
|
|
1051
|
-
|
|
1115
|
+
if (isolation.kind !== "uid")
|
|
1116
|
+
return true;
|
|
1117
|
+
if (!agentRunLogin(login, deps.data))
|
|
1118
|
+
throw new ClaimRefused(LOGIN_MACHINE_NEEDS_SERVER_USER);
|
|
1119
|
+
const other = await loginRunnerInProcess(deps.data, deps.store.runners);
|
|
1120
|
+
if (other !== undefined)
|
|
1121
|
+
throw new ClaimRefused(loginRunnerInProcessWords(other));
|
|
1122
|
+
return false;
|
|
1052
1123
|
}
|
|
1053
1124
|
/** The runner's loop factory where each run is a process of its own: a ChildLoop per claim, but for a run that stays in
|
|
1054
1125
|
* the runner (staysInRunner). */
|
|
@@ -1071,6 +1142,12 @@ function withGatewayKey(claimed, key) {
|
|
|
1071
1142
|
Object.defineProperty(out, GATEWAY_KEY_ENV, { value: key, enumerable: false, writable: false, configurable: false });
|
|
1072
1143
|
return out;
|
|
1073
1144
|
}
|
|
1145
|
+
/** The pair a run's process is handed this runner's OpenTelemetry settings in (secrets.ts OTEL_PAIR): none when it has
|
|
1146
|
+
* none. */
|
|
1147
|
+
export const otelPair = (env = process.env) => {
|
|
1148
|
+
const settings = otelSettings(env);
|
|
1149
|
+
return Object.keys(settings).length ? [[OTEL_PAIR, JSON.stringify(settings)]] : [];
|
|
1150
|
+
};
|
|
1074
1151
|
/** The environment a run's process starts with: the runner's run environment's plain values (runEnv: its secrets are
|
|
1075
1152
|
* not enumerable, so none is here), no key-shaped name, and where its keys come from. */
|
|
1076
1153
|
function childEnv(base, keys, extra) {
|
|
@@ -1173,11 +1250,15 @@ function childLoop(options, slots, loopDeps) {
|
|
|
1173
1250
|
throw new ClaimRefused("project_mode_fidelity: This runner rewrites local project file permissions for per-user isolation. A moved project needs a destination that preserves its original permissions.");
|
|
1174
1251
|
}
|
|
1175
1252
|
const savedGateway = savedGatewayIn(claimEnv);
|
|
1176
|
-
// The run's own keys: those its claim opens (claim-secrets.ts), the one list its loop in this process read.
|
|
1253
|
+
// The run's own keys: those its claim opens (claim-secrets.ts), the one list its loop in this process read. Its model
|
|
1254
|
+
// keys are its pinned model's (claimSecrets scopes them by the launch's model), the one its route sends: never the
|
|
1255
|
+
// host's default's now, where its revision names no model and a key saved since moved that default.
|
|
1177
1256
|
const claimed = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv, redact: loopDeps.redact }, revisionRow, launch, claim.runId);
|
|
1178
|
-
//
|
|
1179
|
-
// handed its
|
|
1180
|
-
|
|
1257
|
+
// A --faux start alone is pinned to the faux model (model.ts chooseModel), which stands in for its revision's and
|
|
1258
|
+
// sends no key: its process is handed its revision's model's key with them, as a run of that model is handed it.
|
|
1259
|
+
// Only on a runner in faux mode too: a faux launch claimed where FAUX_ENV is unset gets no second claim. A held run its
|
|
1260
|
+
// model kept from running at its create (hold.refused) is laid no model key here either: its model runs nowhere.
|
|
1261
|
+
const ofRevision = launch.model?.provider === FAUX_PROVIDER && claimEnv[FAUX_ENV] ? await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv, redact: loopDeps.redact }, revisionRow, { ...(launch.plane ? { plane: launch.plane } : {}), ...(launch.hold ? { hold: launch.hold } : {}) }) : {};
|
|
1181
1262
|
// A run that holds a model key of its own (model_key, its launch's) spends that key alone: its process is handed
|
|
1182
1263
|
// none of the server's model keys, as its spec drops them from its tools' (claim-secrets.ts withoutModelKeys).
|
|
1183
1264
|
// Copies: the runner's own reads (heldFor's `claimed`: what the run's learning must never keep) stay whole.
|
|
@@ -1185,13 +1266,19 @@ function childLoop(options, slots, loopDeps) {
|
|
|
1185
1266
|
const toProcess = keyed ? [withoutModelKeys({ ...claimed }), withoutModelKeys({ ...ofRevision })] : [claimed, ofRevision];
|
|
1186
1267
|
// The saved gateway's key, kept off the claim's tool keys (claimSecrets), is handed for the run's model routes alone,
|
|
1187
1268
|
// read as the server's model keys are (savedModelKeys, over the claim's environment the gateway was laid over), as a
|
|
1188
|
-
// run in this process reads it from its environment by name; none to a run that brings its own key
|
|
1189
|
-
|
|
1269
|
+
// run in this process reads it from its environment by name; none to a run that brings its own key, and none to a
|
|
1270
|
+
// held run its model kept from running, which routes no model.
|
|
1271
|
+
const gatewayKey = savedGateway && !launch.hold?.refused ? (keyed ? {} : await savedModelKeys({ store: deps.store, sealKey: deps.sealKey, env: claimEnv }))[GATEWAY_KEY_ENV] || undefined : undefined;
|
|
1190
1272
|
const handed = (name) => (name === GATEWAY_KEY_ENV && savedGateway ? gatewayKey : toProcess.map((from) => from[name]).find((value) => typeof value === "string" && value !== ""));
|
|
1191
|
-
const keys = encode(
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1273
|
+
const keys = encode([
|
|
1274
|
+
...SECRET_NAMES.flatMap((name) => {
|
|
1275
|
+
const value = handed(name);
|
|
1276
|
+
return value === undefined ? [] : [[name, value]];
|
|
1277
|
+
}),
|
|
1278
|
+
// The runner's OpenTelemetry settings, so the run's process exports its trace as this one would: on the pipe,
|
|
1279
|
+
// since no run's environment has them (runEnv), never in the process's environment.
|
|
1280
|
+
...otelPair(),
|
|
1281
|
+
]);
|
|
1195
1282
|
const slot = await slots?.take();
|
|
1196
1283
|
if (slots && slot === undefined) {
|
|
1197
1284
|
// Every free slot of this runner is held by another runner on the data directory (ranges that overlap): the run
|
package/dist/runner/run-child.js
CHANGED
|
@@ -20,14 +20,16 @@ import { remoteSaveSlots } from "./save-slots.js";
|
|
|
20
20
|
import { runEnv } from "./main.js";
|
|
21
21
|
import { carriedLedger } from "../paid-calls.js";
|
|
22
22
|
import { heldHands } from "../workspace/computer-hold.js";
|
|
23
|
+
import { flushTraces } from "../otel/tracer.js";
|
|
23
24
|
/** How often the run's process reads its loop's held state (LoopDeps.live) and posts it to its runner when it moved: the
|
|
24
25
|
* runner's live ticker reads the newest it was posted. */
|
|
25
26
|
const LIVE_POLL_MS = 200;
|
|
26
27
|
registerRunErrors();
|
|
27
28
|
const socket = new Socket({ fd: 4, readable: true, writable: true });
|
|
28
29
|
const channel = new Channel(socket, {
|
|
29
|
-
// The runner closed the channel (the loop's end answered) or is gone: nothing of the run's goes on
|
|
30
|
-
|
|
30
|
+
// The runner closed the channel (the loop's end answered) or is gone: nothing of the run's goes on, but its trace's last
|
|
31
|
+
// spans are sent first (flushTraces: at most FLUSH_MS, at once when tracing is off).
|
|
32
|
+
onClose: () => void setImmediate(() => void flushTraces().finally(() => process.exit(0))),
|
|
31
33
|
// Each call carries the ledger of the tool call it is made in: what the runner does for it (an MCP tool's call, a
|
|
32
34
|
// computer's) books on the run's one ledger, as it would in the run's own process.
|
|
33
35
|
context: carriedLedger,
|
|
@@ -160,6 +162,7 @@ function childDeps(init, store, journal, held) {
|
|
|
160
162
|
const recordings = given.recordings;
|
|
161
163
|
const ask = {
|
|
162
164
|
hadComputer: given.hadComputer,
|
|
165
|
+
...(typeof given.turnedOff === "string" ? { turnedOff: given.turnedOff } : {}),
|
|
163
166
|
...(given.signal instanceof AbortSignal ? { signal: given.signal } : {}),
|
|
164
167
|
...(recordings?.say ? { say: recordings.say } : {}),
|
|
165
168
|
...(typeof given.onImageWait === "function" ? { onImageWait: given.onImageWait } : {}),
|
package/dist/runner/runner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Claim, type LoopEnd, type LoopFactory } from "./loop-contract.js";
|
|
2
2
|
import { type RunnerStore } from "./store-port.js";
|
|
3
|
-
import { type RunState } from "../store/store.js";
|
|
3
|
+
import { type RunPatch, type RunState } from "../store/store.js";
|
|
4
4
|
import { type Redact } from "./redact.js";
|
|
5
5
|
import { type LiveTickerOptions } from "./live-ticker.js";
|
|
6
6
|
import { type Presence } from "./presence.js";
|
|
@@ -34,6 +34,9 @@ export declare const END_RETRY_BACKOFF_MS = 5000;
|
|
|
34
34
|
export declare const END_RETRY_CAP_MS = 300000;
|
|
35
35
|
/** The tries at that cap before the run ends stopped on its row alone (about an hour of retries in all; endRefused). */
|
|
36
36
|
export declare const END_RETRY_AT_CAP = 11;
|
|
37
|
+
/** The most a run's end waits for its census (RunnerOptions.census): 60 s, for up to CENSUS_BYTES_MAX (64 MiB) read
|
|
38
|
+
* over the run's Workspace (an Archil disk's included). Past it the end goes on without one. */
|
|
39
|
+
export declare const CENSUS_MS = 60000;
|
|
37
40
|
export interface RunnerOptions {
|
|
38
41
|
store: RunnerStore;
|
|
39
42
|
createLoop: LoopFactory;
|
|
@@ -47,6 +50,9 @@ export interface RunnerOptions {
|
|
|
47
50
|
* answers on the same row, under the same incarnation): used as is, never closed here. Default: one of its own,
|
|
48
51
|
* removed at its close. */
|
|
49
52
|
presence?: Presence;
|
|
53
|
+
/** The incarnation its own presence says (no `presence` given): the runner beside a server runs under the one the
|
|
54
|
+
* server gave it (Serve.beside), which its paired computers' routes name. Default: a new one. */
|
|
55
|
+
incarnation?: string;
|
|
50
56
|
/** Most runs held at once. */
|
|
51
57
|
loops?: number;
|
|
52
58
|
/** How long a claim lasts unless renewed. */
|
|
@@ -82,6 +88,14 @@ export interface RunnerOptions {
|
|
|
82
88
|
* runs behind it wait too and a heavy run is never passed over for ever by light ones. A run heavier than the whole
|
|
83
89
|
* budget is claimed when the runner holds nothing, so it never waits for ever. Absent: by count alone (`loops`). */
|
|
84
90
|
memory?: RunnerMemory;
|
|
91
|
+
/** The census a run's end writes in the place of the secrets its caller handed it, which that end erases
|
|
92
|
+
* (run-census.ts; RunPatch.census): made just before each final patch this runner writes, while the run's launch
|
|
93
|
+
* still holds them, and undefined for a run that holds none. One not made within censusMs, or that fails, is left
|
|
94
|
+
* out, said as an error event (step "census", the run's id and why): the end then writes the marker "unscanned", and
|
|
95
|
+
* the run's files are withheld from a cut read after it. Absent: no census (every such end writes the marker). */
|
|
96
|
+
census?: (runId: string) => Promise<RunPatch["census"] | undefined>;
|
|
97
|
+
/** The most a run's end waits for its census. Default CENSUS_MS. */
|
|
98
|
+
censusMs?: number;
|
|
85
99
|
/** A refused stopped end that withdraws a call (endRefused): the first wait, its cap, and the tries at the cap before
|
|
86
100
|
* the run ends on its row alone. Defaults END_RETRY_BACKOFF_MS, END_RETRY_CAP_MS, END_RETRY_AT_CAP. */
|
|
87
101
|
endRetryBackoffMs?: number;
|
|
@@ -92,8 +106,8 @@ export interface RunnerOptions {
|
|
|
92
106
|
* it: what the run's earlier claims left is let go (workspace/run-end-computers.ts, their computers). A throw is said
|
|
93
107
|
* as an error; the run's end stands. Absent: nothing. */
|
|
94
108
|
runEnded?: (claim: Claim) => Promise<void>;
|
|
95
|
-
/** The runner's clock (epoch ms) for what it writes itself: a withdrawn answer's time in an end it writes
|
|
96
|
-
* Date.now. */
|
|
109
|
+
/** The runner's clock (epoch ms) for what it writes itself: a withdrawn answer's time in an end it writes, and every
|
|
110
|
+
* backoff it releases a run with (the store reads them on its own clock, the same one). Default Date.now. */
|
|
97
111
|
now?: () => number;
|
|
98
112
|
/** The one redactor (redact.ts secretRedactor over the secrets the runner holds): every error text this runner writes
|
|
99
113
|
* to a run's row or end, or emits, passes through it, and each loop gets it (LoopDeps.redact). Default: the one over every secret this process's environment holds (runnerSecrets), so a runner
|