@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
package/dist/runnable.js
CHANGED
|
@@ -14,7 +14,7 @@ import { llmTiers, MODEL_NODES, nodeTiers, unpricedModels, workflowNodes } from
|
|
|
14
14
|
import { boxAvailability, newAgentPlace, placeFix, RUN_BOXES } from "./place.js";
|
|
15
15
|
import { allows, BOUND_TOOLS, CALL_TOOLS, grantedTools, missingEnv, NODE_TOOLS, shellTools, toolOf, workflowTools } from "./tools.js";
|
|
16
16
|
import { DENIED, isUnavailable, NO_PARALLEL_KEY, planeFor, whyUnavailable } from "./tool-plane.js";
|
|
17
|
-
import { denyPlace, permissionFrom, permissionKeys, permissionOf } from "./tool-gate.js";
|
|
17
|
+
import { computerDenied, denyPlace, permissionFrom, permissionKeys, permissionOf } from "./tool-gate.js";
|
|
18
18
|
import { approvalsOf } from "./approvals.js";
|
|
19
19
|
import { PARALLEL_KEY_ENV } from "./decisions.js";
|
|
20
20
|
import { keyNeeded } from "./key-words.js";
|
|
@@ -54,6 +54,15 @@ const PRICE_FIX = "Set AGENT_MODEL_PRICE (USD per million input,output,cacheRead
|
|
|
54
54
|
/** Set to 1 (`--allow-code-nodes`), this server runs workflows' `code` nodes: in the run's process, through the DSL's
|
|
55
55
|
* `new Function` transform, which is no sandbox. Off by default. */
|
|
56
56
|
export const CODE_NODES_ENV = "AGENTRUN_SERVE_CODE_NODES";
|
|
57
|
+
/** The kind of an agentic `revision`'s computer setting when every tool that computer serves is set to deny under the
|
|
58
|
+
* server's tool `settings` (tool-gate.ts computerDenied), with its shell where `shellOf` puts it: a run of it never
|
|
59
|
+
* starts that computer (computer-for-claim.ts), so blockersOf asks nothing of it, and a save warns (server.ts saveable).
|
|
60
|
+
* Undefined for one with no computer setting, or with no `shellOf` to place its shell. */
|
|
61
|
+
export async function deniedComputer(revision, settings, shellOf) {
|
|
62
|
+
if (revision.kind !== "agentic" || !revision.computer || !shellOf)
|
|
63
|
+
return undefined;
|
|
64
|
+
return computerDenied({ kind: revision.kind, body: revision }, await shellOf(revision.computer), { settings, problems: [] });
|
|
65
|
+
}
|
|
57
66
|
/** What keeps `revision` from running in `env` under the server's tool `settings` (tool-plane.ts). `boxes`: what this
|
|
58
67
|
* server found at its start (place-offers.ts); none, every box is unavailable. `monid`: its pin. `offers`: the harnesses' offers
|
|
59
68
|
* the server already holds (its reading); none given, they are probed here. `computerReady`: whether an agent's computer
|
|
@@ -79,18 +88,21 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
|
|
|
79
88
|
};
|
|
80
89
|
const harness = revision.harness ?? DEFAULT_HARNESS;
|
|
81
90
|
const offer = (offers ?? (await harnessOffers(env))).find((h) => h.id === harness);
|
|
82
|
-
// One the table hides (HarnessEntry.hidden: Goose before its owner installs it) has no offer: its entry says why.
|
|
91
|
+
// One the table hides (HarnessEntry.hidden: Goose before its owner installs it) has no offer: its entry says why. One
|
|
92
|
+
// that lacks only a model key (its offer's `keys`: harness.ts harnessOffers keeps them on no other) is its model's
|
|
93
|
+
// blocker, which a held create defers.
|
|
83
94
|
if (!offer?.available)
|
|
84
|
-
out.push({ field: "definition.harness", reason: NOT_SET_UP, message: offer?.reason ?? harnessOf(env, harness)?.hidden?.(env) ?? `This server does not run ${harness}.`, host: true, harness });
|
|
95
|
+
out.push({ field: "definition.harness", reason: NOT_SET_UP, message: offer?.reason ?? harnessOf(env, harness)?.hidden?.(env) ?? `This server does not run ${harness}.`, host: true, harness, ...(offer?.keys?.length ? { model: true } : {}) });
|
|
85
96
|
const { place } = revision;
|
|
86
97
|
// A workflow's model and call nodes run on the runner here; in a box they do not run yet. Its fix names the runner: an
|
|
87
98
|
// edit that leaves the place out keeps the agent's (agents-store.ts), so removing the field would change nothing.
|
|
88
99
|
if (revision.kind === "workflow" && place && place.mode !== "runner")
|
|
89
100
|
out.push({ field: "definition.place", reason: "not_an_option", message: `A workflow runs on the runner here: its place is runner (or none), not ${place.mode} on ${place.box ?? "no box"}.`, fix: placeFix({ mode: "runner" }), host: false });
|
|
90
101
|
// An agent with a computer setting is checked by the claim's own answers (resolve-computer.ts computerReadiness: the
|
|
91
|
-
// provider and its kind, the mode's mount, its keys), not as a box; one with only an old place keeps the box check.
|
|
102
|
+
// provider and its kind, the mode's mount, its keys), not as a box; one with only an old place keeps the box check. One
|
|
103
|
+
// every tool of whose computer is set to deny is not: its runs never start it (deniedComputer).
|
|
92
104
|
else if (revision.kind === "agentic" && revision.computer && computerReady) {
|
|
93
|
-
const ready = await computerReady(revision.computer);
|
|
105
|
+
const ready = (await deniedComputer(revision, settings, shellOf)) ? { ok: true } : await computerReady(revision.computer);
|
|
94
106
|
if ("refused" in ready)
|
|
95
107
|
out.push({ field: "definition.computer", reason: NOT_SET_UP, message: ready.refused, host: true, ...(ready.box ? { box: ready.box } : {}) });
|
|
96
108
|
}
|
|
@@ -209,15 +221,15 @@ export async function blockersOf(env, revision, settings = {}, { capped = false,
|
|
|
209
221
|
if (!resolved)
|
|
210
222
|
return out;
|
|
211
223
|
if ("why" in resolved)
|
|
212
|
-
out.push({ field: "definition.model", reason: resolved.host ? NOT_SET_UP : "not_an_option", message: resolved.why, host: resolved.host });
|
|
224
|
+
out.push({ field: "definition.model", reason: resolved.host ? NOT_SET_UP : "not_an_option", message: resolved.why, host: resolved.host, model: true });
|
|
213
225
|
else if ("refused" in resolved)
|
|
214
|
-
out.push({ field: revision.model ? "definition.model" : "definition.harness", reason: NOT_SET_UP, message: resolved.refused, host: true, harness });
|
|
226
|
+
out.push({ field: revision.model ? "definition.model" : "definition.harness", reason: NOT_SET_UP, message: resolved.refused, host: true, harness, model: true });
|
|
215
227
|
// Under a cap, a model serve has no price for (unpricedModels: a gateway id no price names and the catalog does not
|
|
216
228
|
// list) cannot be kept to it: the run is refused now, never started and refused at its first request.
|
|
217
229
|
else if (capped) {
|
|
218
230
|
const unpriced = await unpricedModels(env, revision.model, ["default"], harness);
|
|
219
231
|
for (const id of unpriced)
|
|
220
|
-
out.push({ field: "definition.model", reason: NOT_SET_UP, message: `The model ${id} has no price here, so a run's spend cap cannot be kept on it.`, fix: PRICE_FIX, host: true, unpriced: true });
|
|
232
|
+
out.push({ field: "definition.model", reason: NOT_SET_UP, message: `The model ${id} has no price here, so a run's spend cap cannot be kept on it.`, fix: PRICE_FIX, host: true, unpriced: true, model: true });
|
|
221
233
|
// A save's cap (`capUsd`) below what the model needs for one more step and an answer: a warning, never a refusal
|
|
222
234
|
// (cap-short.ts). Asked of a save alone: a run under such a cap starts, and its wrap-up says the same.
|
|
223
235
|
if (capUsd !== undefined && unpriced.length === 0) {
|
|
@@ -4,6 +4,8 @@ import { type AdapterFacts, type AgentAdapter, type Refusal, type SessionRecord,
|
|
|
4
4
|
import type { KernelHooks, ToolCall } from "./conformance/subject.js";
|
|
5
5
|
import { type BudgetData, type EndData, type ToolCalls } from "./journal-kinds.js";
|
|
6
6
|
import { type MessageOrigin } from "../timeline/index.js";
|
|
7
|
+
import { type GenAiTracing } from "../otel/tracer.js";
|
|
8
|
+
import type { RouteTrace } from "../otel/genai.js";
|
|
7
9
|
type EndCost = Required<Pick<EndData, "costUsd" | "costUpperBound">>;
|
|
8
10
|
import { type Claim, type EndOfRunTurn, type LoopFactory } from "./loop-contract.js";
|
|
9
11
|
import type { HeldRedact } from "./redact.js";
|
|
@@ -248,6 +250,12 @@ export interface AdapterRunSpec {
|
|
|
248
250
|
* that misses it is asked again once, in the same session under the same cap (the output contract's retry); absent:
|
|
249
251
|
* the run's answer is never checked here. */
|
|
250
252
|
readonly outputSchema?: unknown;
|
|
253
|
+
/** The model route its requests take, as the run's GenAI trace names it (otel/genai.ts TracedRun): the provider id its
|
|
254
|
+
* model is named by, the host its requests go to, its model. Each where the spec knows it; absent, its spans name none.
|
|
255
|
+
* `routes`: the session's other routes (a subagent's tier), by the name its requests carry (ModelRequest.route). */
|
|
256
|
+
readonly trace?: RouteTrace & {
|
|
257
|
+
readonly routes?: ReadonlyMap<string, RouteTrace>;
|
|
258
|
+
};
|
|
251
259
|
}
|
|
252
260
|
/** A tool host's lifecycle, as its bindings registered it: run by the adapter loop (AdapterRunSpec.lifecycle). */
|
|
253
261
|
export interface HostLifecycle {
|
|
@@ -363,6 +371,9 @@ export interface AdapterLoopOptions {
|
|
|
363
371
|
/** For tests: awaited once a turn ended on its question to the person, before the wait in the claim (or the park, with
|
|
364
372
|
* nothing to hold open) takes their messages. */
|
|
365
373
|
readonly beforePersonWait?: () => Promise<void>;
|
|
374
|
+
/** The runs' GenAI tracing (otel/tracer.ts). Default the process's, from its OTEL_* env: none unless an OTLP endpoint is
|
|
375
|
+
* set. A test gives its own, over an in-memory exporter. */
|
|
376
|
+
readonly tracing?: Promise<GenAiTracing | undefined>;
|
|
366
377
|
}
|
|
367
378
|
/** A paid call's refusal an earlier claim kept (KINDS.pausePending) whose pause never landed: the newest one with no
|
|
368
379
|
* pause (KINDS.budget), no end and no park on a person's question (KINDS.personAsked: the turn ended on the ask with no
|
|
@@ -21,6 +21,7 @@ import { turnEndedOnAsk } from "../store-reads/journal.js";
|
|
|
21
21
|
import { CAP_REFUSED, CAP_WRAPUP, COMPUTER_NOTE, endsTurn, HOST_PHASE, MESSAGE_ORIGIN, originOf, REQUEST_ENDED, REQUEST_STARTED, RUN_RESUMED } from "../timeline/index.js";
|
|
22
22
|
import { raiseFollowUpId } from "../run-view.js";
|
|
23
23
|
import { durableWait } from "../workflow/pi-versions.js";
|
|
24
|
+
import { genAiTracing } from "../otel/tracer.js";
|
|
24
25
|
/** The root entries a claim writes before its turn, whatever the run's turns are (its session's key, a phase row, a
|
|
25
26
|
* takeover's note, its computer's hold, the learning seed it laid, the computer it made): read past when a claim asks
|
|
26
27
|
* whether the run's root ends on its end (a fresh reopen). */
|
|
@@ -69,20 +70,6 @@ import { LEARNED_CARD_FIELDS, LEARNED_CLIP, LEARNED_WORKFLOW_TOOL, learnedApprov
|
|
|
69
70
|
import { warnHoldShort } from "../print.js";
|
|
70
71
|
import { feedbackAsk, feedbackOf, jobEndOpen, pendingFeedbackOf } from "./feedback-round.js";
|
|
71
72
|
import { handbackText, servedAnswerOf, servedAnswerText, WORKFLOW_FIRST, WORKFLOW_FIRST_CALL } from "./workflow-first.js";
|
|
72
|
-
/** What a session's requests were charged (sessionSpendOf's figures of those answered, a crash's cut one at its hold among
|
|
73
|
-
* them), never one still in flight at its hold. Null: one charged has no figure. */
|
|
74
|
-
function chargedOf(records) {
|
|
75
|
-
const read = sessionSpendOf(records);
|
|
76
|
-
let usd = 0;
|
|
77
|
-
for (const figure of read.figures) {
|
|
78
|
-
if (!read.answered.has(figure.turn))
|
|
79
|
-
continue;
|
|
80
|
-
if (figure.usd === null)
|
|
81
|
-
return null;
|
|
82
|
-
usd += figure.usd;
|
|
83
|
-
}
|
|
84
|
-
return usd;
|
|
85
|
-
}
|
|
86
73
|
/** The end of a harness's own call (Claude Code's WebSearch) the gate held and then let run: the host ran nothing of it,
|
|
87
74
|
* and the harness's next call runs it. */
|
|
88
75
|
export const OWN_TOOL_RELEASED = "Allowed after it waited; the agent's own tool runs it on its next call.";
|
|
@@ -594,6 +581,12 @@ function adapterLoop(specOf, options, deps) {
|
|
|
594
581
|
const retry = options.retry ?? MODEL_RETRY;
|
|
595
582
|
const stream = options.stream ?? MODEL_STREAM;
|
|
596
583
|
const now = options.now ?? Date.now;
|
|
584
|
+
/** The runs' GenAI tracing (none unless the env turns it on), and this claim's trace of its run, open once its spec is
|
|
585
|
+
* known: its chat spans from the session's model port (counted), its tool spans from the session's events (io.onEvent),
|
|
586
|
+
* ended with the claim (traced). */
|
|
587
|
+
let tracing;
|
|
588
|
+
const tracingMade = (options.tracing ?? genAiTracing()).then((now) => (tracing = { now }), () => (tracing = { now: undefined }));
|
|
589
|
+
let trace;
|
|
597
590
|
/** The gate's clock as main's card says a time: ISO. */
|
|
598
591
|
const isoNow = () => new Date(now()).toISOString();
|
|
599
592
|
const inbox = [];
|
|
@@ -1350,7 +1343,25 @@ function adapterLoop(specOf, options, deps) {
|
|
|
1350
1343
|
await specNow?.hooks?.afterMessageSent?.();
|
|
1351
1344
|
return session.turnEnd();
|
|
1352
1345
|
};
|
|
1346
|
+
/** run(claim), its trace ended with it: every span still open ends, with the claim's failure where it failed, handed to
|
|
1347
|
+
* the exporter, which sends it in the background (tracer.ts: the claim's end never waits on a collector, and never
|
|
1348
|
+
* throws). */
|
|
1349
|
+
async function traced(claim) {
|
|
1350
|
+
try {
|
|
1351
|
+
const end = await run(claim);
|
|
1352
|
+
await trace?.end(end.state === "failed" ? end.error.code : undefined);
|
|
1353
|
+
return end;
|
|
1354
|
+
}
|
|
1355
|
+
catch (error) {
|
|
1356
|
+
await trace?.end("run-error");
|
|
1357
|
+
throw error;
|
|
1358
|
+
}
|
|
1359
|
+
finally {
|
|
1360
|
+
trace = undefined;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1353
1363
|
async function run(claim) {
|
|
1364
|
+
const claimedAt = Date.now();
|
|
1354
1365
|
context = withAbortSignal(deps.signal, BACKGROUND_CONTEXT);
|
|
1355
1366
|
// Every row the runner read for this claim is with the loop once delivered resolves (at once without a runner's).
|
|
1356
1367
|
void (deps.delivered ?? Promise.resolve()).then(() => {
|
|
@@ -1542,6 +1553,10 @@ function adapterLoop(specOf, options, deps) {
|
|
|
1542
1553
|
}
|
|
1543
1554
|
throw error;
|
|
1544
1555
|
}
|
|
1556
|
+
// The run's trace, from its claim's start, once its spec says what runs (a restart's spec changes nothing of it).
|
|
1557
|
+
// The tracing is made long before (as the loop is): waited for only on the rare claim whose spec beat it.
|
|
1558
|
+
trace ??= (tracing ?? (await tracingMade)).now?.open({ startedAt: claimedAt, mcp: (name) => mcp?.catalogOf(specNow?.facts?.hostName?.(name) ?? name) !== undefined });
|
|
1559
|
+
trace?.known({ runId: claim.runId, harness: spec.adapter.id, ...(spec.facts?.wire === "plan" ? { plan: true } : {}), ...spec.trace });
|
|
1545
1560
|
mcp = spec.mcp;
|
|
1546
1561
|
specNow = spec;
|
|
1547
1562
|
specKnown = true;
|
|
@@ -1582,18 +1597,18 @@ function adapterLoop(specOf, options, deps) {
|
|
|
1582
1597
|
// in flight may be the one that asked for the call (Claude Code books its cost after its calls; Codex starts a call
|
|
1583
1598
|
// with its response open), so the call is judged beside it and never waits on it. pi's request has answered by then.
|
|
1584
1599
|
// A call settled above its hold (a fal job whose output states more than its input asked, a monid call charged above
|
|
1585
|
-
// its maxCost) can take
|
|
1586
|
-
//
|
|
1587
|
-
//
|
|
1588
|
-
//
|
|
1589
|
-
//
|
|
1590
|
-
// admission, tells an overrun.
|
|
1600
|
+
// its maxCost) can take the run's charges past its cap: from then on, a settle that leaves them over it stops the run
|
|
1601
|
+
// in the cap's words (overCap, settled charges only; paid-calls.ts stopRun). A call still in flight counts only
|
|
1602
|
+
// toward admissions. Its hold, kept from its admission until it settles, tells an overrun (a host tool call's paid
|
|
1603
|
+
// steps, bookedIn below). An admit its ref had booked already opens no step and is never settled, so it keeps
|
|
1604
|
+
// nothing.
|
|
1591
1605
|
const holds = new Map();
|
|
1592
1606
|
let overran = false;
|
|
1593
1607
|
const paidUnder = {
|
|
1594
1608
|
admit: async (request) => {
|
|
1595
1609
|
const admitted = await paid.admit({ ...request, under: spec.session.key });
|
|
1596
|
-
|
|
1610
|
+
if (admitted?.booked !== true)
|
|
1611
|
+
holds.set(request.id, request.holdUsd);
|
|
1597
1612
|
return admitted;
|
|
1598
1613
|
},
|
|
1599
1614
|
settle: async (id, usd, options) => {
|
|
@@ -1632,13 +1647,14 @@ function adapterLoop(specOf, options, deps) {
|
|
|
1632
1647
|
for (const key of await sessions.keys()) {
|
|
1633
1648
|
if (key === spec.session.key)
|
|
1634
1649
|
continue;
|
|
1635
|
-
const
|
|
1650
|
+
const read = sessionSpendOf(await sessions.read(key));
|
|
1651
|
+
const spent = settled ? read.chargedUsd : read.spentUsd;
|
|
1636
1652
|
if (spent === null)
|
|
1637
1653
|
return undefined;
|
|
1638
1654
|
others += spent;
|
|
1639
1655
|
}
|
|
1640
1656
|
if (settled) {
|
|
1641
|
-
const own =
|
|
1657
|
+
const own = sessionSpendOf(await sessions.read(spec.session.key)).chargedUsd;
|
|
1642
1658
|
return own === null ? undefined : overCapEnd(others + own, cap);
|
|
1643
1659
|
}
|
|
1644
1660
|
// Its model session read as the cap reads it (the kernel's overCapOf: a request cut by a crash at its hold plus its
|
|
@@ -2234,6 +2250,8 @@ function adapterLoop(specOf, options, deps) {
|
|
|
2234
2250
|
bookingsWriting = 0;
|
|
2235
2251
|
// The conversation each request of this claim was asked in, by its turn, where its client named one.
|
|
2236
2252
|
const askedIn = new Map();
|
|
2253
|
+
// Each admitted model request's chat span, by its turn, until its afterRequest ends it (a paid tool's step is none).
|
|
2254
|
+
const chats = new Map();
|
|
2237
2255
|
const counted = {
|
|
2238
2256
|
beforeRequest: async (request) => {
|
|
2239
2257
|
// The CLI's next request of its main model after its question to the person: never admitted, it asks for the
|
|
@@ -2265,6 +2283,8 @@ function adapterLoop(specOf, options, deps) {
|
|
|
2265
2283
|
carried = undefined;
|
|
2266
2284
|
}
|
|
2267
2285
|
unbooked += 1;
|
|
2286
|
+
if (ticket && trace && request.paid === undefined)
|
|
2287
|
+
chats.set(ticket.turn, trace.request(request.model, request.route));
|
|
2268
2288
|
// The conversation that asked, as its client named it (pi's, one of several asking at once): whose answer reads
|
|
2269
2289
|
// this request's booking (bookedCost).
|
|
2270
2290
|
const conversation = request.conversation;
|
|
@@ -2296,6 +2316,11 @@ function adapterLoop(specOf, options, deps) {
|
|
|
2296
2316
|
const held = carried?.turn !== undefined && carried.turn === ticket?.turn ? carried : undefined;
|
|
2297
2317
|
if (held)
|
|
2298
2318
|
carried = undefined;
|
|
2319
|
+
const chat = ticket ? chats.get(ticket.turn) : undefined;
|
|
2320
|
+
if (chat) {
|
|
2321
|
+
chats.delete(ticket.turn);
|
|
2322
|
+
chat(usage, ended);
|
|
2323
|
+
}
|
|
2299
2324
|
// An answer the model gave, not the provider's error inside one (a stream ended in an error event, a translated
|
|
2300
2325
|
// route's failure in words included: the client drops it and asks again).
|
|
2301
2326
|
const row = held && ended?.end === "answered" && ended.label !== "error" ? tell(held) : undefined;
|
|
@@ -2430,7 +2455,13 @@ function adapterLoop(specOf, options, deps) {
|
|
|
2430
2455
|
ended: (callId, output, failed) => ownWrite(record.end(callId, failed ? "failed" : "done", output).catch(unlessSealed)),
|
|
2431
2456
|
}
|
|
2432
2457
|
: undefined;
|
|
2433
|
-
|
|
2458
|
+
// Every harness's events reach its trace first (its tool calls, a plan harness's turns), with a record or without.
|
|
2459
|
+
const recorded = record ? onEvent(record) : undefined;
|
|
2460
|
+
const traceAnd = (event) => {
|
|
2461
|
+
trace?.event(event);
|
|
2462
|
+
recorded?.(event);
|
|
2463
|
+
};
|
|
2464
|
+
const io = { writer, models: counted, signal: deps.signal, onEvent: traceAnd, gate: bridgeGate, ...(permission ? { permission } : {}), hostTool: hosted, ...(ownCalls ? { ownCalls } : {}), bookedCost, keepCalls, ...(record ? {} : { nestedEnded }) };
|
|
2434
2465
|
// The end-of-run turn an earlier claim asked and never saw end (its runner lost mid look-back or mid compile): the
|
|
2435
2466
|
// root's newest input still in flight is that turn's (end-of-run.ts REFLECT_PREFIX), which pi picks up again as its
|
|
2436
2467
|
// session opens. The job's turn ended before it, answered: this pass runs no job turn (no recovery as the job's, no
|
|
@@ -2448,7 +2479,8 @@ function adapterLoop(specOf, options, deps) {
|
|
|
2448
2479
|
reflecting = lookingBackOpen || jobKept;
|
|
2449
2480
|
// The MCP tools are host tools like any other (mcp.tools, wrapped above): every harness gets them on its own channel
|
|
2450
2481
|
// for host tools, each call through the gate before its intent.
|
|
2451
|
-
|
|
2482
|
+
// A harness's own search defers only where the host offers none (its facts' ownToolSearch).
|
|
2483
|
+
session = await spec.adapter.open({ ...spec.session, tools, deferCatalog: deferred && !offered }, io);
|
|
2452
2484
|
root = await harness.root(context);
|
|
2453
2485
|
// The root as the claim found it, before this pass writes anything of its own there (the computer's show-up, a
|
|
2454
2486
|
// takeover's note): what the reopen check below reads, so a fresh reopen is told by the run's own last entry.
|
|
@@ -4166,7 +4198,7 @@ function adapterLoop(specOf, options, deps) {
|
|
|
4166
4198
|
}
|
|
4167
4199
|
return {
|
|
4168
4200
|
start(claim) {
|
|
4169
|
-
finished =
|
|
4201
|
+
finished = traced(claim);
|
|
4170
4202
|
return finished;
|
|
4171
4203
|
},
|
|
4172
4204
|
async command(command) {
|
|
@@ -5,7 +5,7 @@ import type { Approvals } from "../approvals.js";
|
|
|
5
5
|
import type { installForClaim, installSettled } from "../harness-install.js";
|
|
6
6
|
import type { LiveHandover, LiveViewerStore } from "../browser-live.js";
|
|
7
7
|
import { type RunnerLive } from "../live-reach.js";
|
|
8
|
-
import { type PinnedModel, type Tier } from "../model.js";
|
|
8
|
+
import { type ModelRef, type PinnedModel, type Tier } from "../model.js";
|
|
9
9
|
import { type RunLaunch } from "../run-launch.js";
|
|
10
10
|
import type { Store } from "../store/store.js";
|
|
11
11
|
import { type ArgumentsOf, type Permission, type RunFiles, type SettingFrom, type ToolEffect } from "../tool-gate.js";
|
|
@@ -31,7 +31,7 @@ import { type RunComputerHold } from "./computer-journal.js";
|
|
|
31
31
|
import type { KeptKind, MadeKind, Replaced } from "../workspace/computer-for-claim.js";
|
|
32
32
|
import type { ShellPlace } from "../workspace/resolve-computer.js";
|
|
33
33
|
import type { Workspace } from "../workspace/workspace.js";
|
|
34
|
-
import { type HeldRedact } from "./redact.js";
|
|
34
|
+
import { type HeldRedact, type Redact } from "./redact.js";
|
|
35
35
|
import { type MonidFake } from "./monid-run.js";
|
|
36
36
|
/** What a claim gives the shared computerForClaim: the run, its epoch, the claim itself (a live view's row is fenced on it
|
|
37
37
|
* and names its runner), its revision, its place and any computer choice. */
|
|
@@ -166,30 +166,64 @@ export interface AdapterSpecDeps {
|
|
|
166
166
|
* case, and its harness's own search is never offered (web-fake.ts, fakedPlane). `now`: its clock, the date and time it
|
|
167
167
|
* is told wherever it reads "now" (environment.ts environmentLine, claude-agent's turn date); absent, the real clock.
|
|
168
168
|
* `monid`: its monid endpoints answer as monid unreachable does, never sent (monid-run.ts monidForClaim). `email`: the
|
|
169
|
-
* case's fake mail account's servers (eval-mailbox.ts), the only account its email tools open (email/tools.ts).
|
|
169
|
+
* case's fake mail account's servers (eval-mailbox.ts), the only account its email tools open (email/tools.ts). `files`:
|
|
170
|
+
* the case's files, by their path in the run's work folder, written there at its claim (seedEvalFiles). */
|
|
170
171
|
export type EvalFakes = {
|
|
171
172
|
readonly web?: WebFake;
|
|
172
173
|
readonly now?: Date;
|
|
173
174
|
readonly monid?: MonidFake;
|
|
174
175
|
readonly email?: EmailFake;
|
|
176
|
+
readonly files?: Readonly<Record<string, string>>;
|
|
175
177
|
};
|
|
178
|
+
/** A template eval case's files (EvalFakes.files) written into the run's work folder at its claim, after its inputs and
|
|
179
|
+
* before its computer and its first turn, so they reach a computer's /workspace as its uploads do. Each one the folder
|
|
180
|
+
* does not hold yet: a claim that resumes the run keeps what the run made of it. A write that fails ends the run failed,
|
|
181
|
+
* saying which file. */
|
|
182
|
+
export declare function seedEvalFiles(workspace: Workspace, files: Readonly<Record<string, string>> | undefined): Promise<void>;
|
|
176
183
|
/** A model as the cap prices it, from the route's catalog cost: its price WITH TIERS (the money rule — a request past a
|
|
177
184
|
* model's tier is held and booked at the tier, as main's calculateCost does). `api` is the proxy's shape, for the
|
|
178
185
|
* overhead its provider adds; the output ceiling is the route's when it carries one, else none. */
|
|
179
186
|
export declare function capModelOf(route: ModelRoute): CapModel;
|
|
187
|
+
/** The model of a held run its model kept from running at its create (run-launch.ts hold.refused): as its revision names
|
|
188
|
+
* it (`provider/model-id`). Its launch pins none (runs-over-store.ts skips modelOf for it). Nothing chooses it and
|
|
189
|
+
* nothing prices it. */
|
|
190
|
+
export declare function heldModelOf(ref: string | undefined): ModelRef;
|
|
191
|
+
/** The route of a held run its model kept from running at its create (run-launch.ts hold.refused): its provider is the
|
|
192
|
+
* stand-in (provider.ts heldRefusedProvider), so a host with no key for its model still opens its claim and holds its
|
|
193
|
+
* computer. Its agent never starts (its start and every message are refused in `why`, its create's words:
|
|
194
|
+
* computer-held.ts), and a request that reached its proxy anyway is refused in them too, and never sent. */
|
|
195
|
+
export declare function heldRefusedRoute(model: ModelRef, why: string): ModelRoute;
|
|
180
196
|
/** Particle requests are never automatically replayed after an uncertain failure. Retry is a harness-wide setting,
|
|
181
197
|
* so a claim with any Particle route disables it for all its conversations, including subagents on other tiers. */
|
|
182
198
|
export declare function modelRetryOf(routes: Iterable<Pick<ModelRoute, "like">>): Pick<AdapterRunSpec, "retry">;
|
|
183
|
-
/** A
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
199
|
+
/** A model route as the run's GenAI trace names it: its provider, the host its requests go to, its model. A route that
|
|
200
|
+
* translates its model's requests (its own `fetch`) is named by its upstream's host (ModelRoute.upstreamOrigin), never
|
|
201
|
+
* its proxy's placeholder origin; one whose upstream is unknown names no host. */
|
|
202
|
+
export declare const traceOfRoute: (route: ModelRoute) => import("../otel/genai.js").RouteTrace;
|
|
203
|
+
/** A replay run's or an audit shadow's grader route (runner/compare-end.ts): on the fast tier routedSubagentTiers names
|
|
204
|
+
* (the revision's modelTiers.fast, else AGENT_MODEL_FAST), on pi's wires, when its revision names no agree_on. Its route
|
|
205
|
+
* reads the saved key of that tier's model alone (subagentTierKeys), held by the run's redactors, on the route's env
|
|
206
|
+
* alone; in a run's own process its runner hands it that tier's model's key (run-child-host.ts subagentTierKeys). A run
|
|
207
|
+
* with its own model key carries that key, and no saved key is read. Undefined, with nothing read, when
|
|
208
|
+
* there is no fast tier or the revision names agree_on; undefined when no route can be made (logged: the pair is then
|
|
209
|
+
* compared whole). */
|
|
189
210
|
export declare function graderRouteOf(body: {
|
|
190
211
|
readonly modelTiers?: Readonly<Partial<Record<SubagentTier, string>>>;
|
|
191
212
|
readonly learning?: unknown;
|
|
192
213
|
}, keyed: boolean, runKey: ClaimModelKey | undefined, claimed: NodeJS.ProcessEnv, cut: HeldRedact, log: (line: string) => void, deps: Pick<AdapterSpecDeps, "store" | "sealKey" | "env" | "routeOf">, holds?: readonly HeldRedact[], claim?: Pick<Claim, "runId" | "turn" | "attempt">): Promise<ModelRoute | undefined>;
|
|
214
|
+
/** A subagent run's tier routes (runner/subagent.ts): each tier routedSubagentTiers names, on its model (the revision's
|
|
215
|
+
* modelTiers, else the host's tier variable), under its own key (subagentRoute), on a route of its own. A tier's model may
|
|
216
|
+
* be another provider's than the run's own, whose key claimSecrets never opened (it scopes the claim's keys to the run's
|
|
217
|
+
* model): so the routes read the saved model keys of those tiers' models alone (subagentTierKeys), held by the run's
|
|
218
|
+
* redactor, on the routes' env alone, never the run's tools (toolEnv). A run with its own model key carries that key,
|
|
219
|
+
* and no saved key is read. A tier no route can be made for here is in `why`, cut, and no failure of the run: a call on
|
|
220
|
+
* it answers why. */
|
|
221
|
+
export declare function subagentTierRoutes(body: {
|
|
222
|
+
readonly modelTiers?: Readonly<Partial<Record<SubagentTier, string>>>;
|
|
223
|
+
}, keyed: boolean, runKey: ClaimModelKey | undefined, toolEnv: NodeJS.ProcessEnv, cut: HeldRedact, deps: Pick<AdapterSpecDeps, "store" | "sealKey" | "env" | "routeOf">, claim?: Pick<Claim, "runId" | "turn" | "attempt">): Promise<{
|
|
224
|
+
readonly routes: Map<string, ModelRoute>;
|
|
225
|
+
readonly why: Map<SubagentTier, string>;
|
|
226
|
+
}>;
|
|
193
227
|
/** What the runner routes a claimed run on: the launch's model as its start pinned it, sent as pinned, with the
|
|
194
228
|
* revision's own ref beside it (main prices a gateway's id by the provider that ref names); the revision's ref alone
|
|
195
229
|
* when the start pinned none. Never the pin's provider and id joined into a ref: a gateway refuses the joined id, and
|
|
@@ -219,6 +253,11 @@ export declare function modelAskOf(pinned: {
|
|
|
219
253
|
*
|
|
220
254
|
* Whether anyone can answer an ask is the store's too (server-approvers.ts), read once at the claim: no one (the
|
|
221
255
|
* server's accounts off), an asked call is refused at once in words, never parked.
|
|
256
|
+
*
|
|
257
|
+
* The run's computer once off for the run (RunGate.computerOff): a call of its tools is refused before any settings read.
|
|
258
|
+
* `turnedOff`: an earlier claim turned it off (computer-journal.ts computerTurnedOff), so this claim's gate starts off.
|
|
259
|
+
* `onComputerOff`: told the computer's kind, and awaited, when this claim's first deny of a call of its tools turns it off,
|
|
260
|
+
* for the run's journal (computer-journal.ts recordComputerOff), so a later claim starts it off too.
|
|
222
261
|
*/
|
|
223
262
|
/** The run's tool permissions as a learned workflow's call nodes are held to them (learned-workflow.ts policy, denyFrom,
|
|
224
263
|
* refresh): the same gate as the run's own calls, its settings read again from the store before each call node. */
|
|
@@ -238,6 +277,8 @@ export declare function adapterRunGate(store: Pick<Store, "settings">, claim: Pi
|
|
|
238
277
|
readonly effectOf?: (name: string) => ToolEffect | undefined;
|
|
239
278
|
readonly argumentsOf?: ArgumentsOf;
|
|
240
279
|
readonly facts: AdapterFacts | undefined;
|
|
280
|
+
readonly turnedOff?: boolean;
|
|
281
|
+
readonly onComputerOff?: (kind: string) => Promise<void>;
|
|
241
282
|
}): Promise<NonNullable<AdapterRunSpec["gate"]> & {
|
|
242
283
|
readonly permissions: RunPermissions;
|
|
243
284
|
readonly learn: (flows: readonly LearnedWorkflow[]) => void;
|
|
@@ -323,8 +364,11 @@ export declare function liveViewersOf(store: LiveViewerStore, sealKey: Buffer |
|
|
|
323
364
|
};
|
|
324
365
|
/** `tool` with its answer's text, and a throw's message, cut by `cut` (the run's one redactor). A web call's answer is cut
|
|
325
366
|
* string by string inside its JSON (timeline/web-calls.ts webCut), so what the harness stores still parses and keeps
|
|
326
|
-
* its links whole for a grader's link check
|
|
327
|
-
|
|
367
|
+
* its links whole for a grader's link check; one whose strings, read joined, hold a held value no cut in place takes (a
|
|
368
|
+
* value split across two of them) is "[redacted]" (webHeld). The join is read against the values `cut` holds
|
|
369
|
+
* (key-refusal.ts withheldWhole), or through `cut` itself when it does not know them (joinCut). Each string is cut once
|
|
370
|
+
* in a call, for the join's read and the answer both. */
|
|
371
|
+
export declare function answersCut(tool: HostTool, cut: Redact): HostTool;
|
|
328
372
|
/** The ToolHost a run's non-hand tools bind through, the one both the pi spec and the CLI spec build: the run's folder and
|
|
329
373
|
* the claim's environment (claim-secrets.ts: the run's keys from the store, its plane set), the run's registry for an
|
|
330
374
|
* extension a binding installs, the install lifecycle (`life`, run by the adapter loop from the spec's `lifecycle`), the
|