@parcha/agentrun-serve 0.1.0-beta.51 → 0.1.0-beta.53
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 +160 -1
- package/README.md +306 -36
- package/dist/adapters.js +1 -1
- package/dist/agent-delete.d.ts +14 -4
- package/dist/agent-delete.js +30 -58
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agents-store.d.ts +28 -18
- package/dist/agents-store.js +48 -34
- package/dist/api-only.d.ts +30 -8
- package/dist/api-only.js +40 -16
- package/dist/archil-routes.d.ts +1 -0
- package/dist/archil-routes.js +28 -2
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +70 -7
- package/dist/composio-preset.d.ts +2 -1
- package/dist/composio-preset.js +4 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +9 -0
- package/dist/computer-setting.js +19 -1
- package/dist/computers.d.ts +6 -2
- package/dist/computers.js +2 -2
- package/dist/console/assets/index-BFgyZzF_.js +734 -0
- package/dist/console/assets/index-DbilxljH.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.d.ts +76 -0
- package/dist/fal-price.js +365 -0
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +19 -1
- package/dist/learn/commit.js +160 -2
- package/dist/learn/compile.d.ts +13 -5
- package/dist/learn/compile.js +46 -15
- package/dist/learn/delete.d.ts +12 -6
- package/dist/learn/delete.js +17 -11
- package/dist/learn/folder.d.ts +16 -0
- package/dist/learn/folder.js +30 -4
- package/dist/learn/learning-of.d.ts +8 -0
- package/dist/learn/learning-of.js +8 -0
- package/dist/learn/learning.sh +29 -4
- package/dist/learn/promote.d.ts +51 -7
- package/dist/learn/promote.js +51 -8
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-reset.d.ts +18 -0
- package/dist/learning-reset.js +115 -0
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning-words.d.ts +5 -0
- package/dist/learning-words.js +5 -0
- package/dist/learning.d.ts +15 -10
- package/dist/learning.js +14 -8
- package/dist/llms.txt +1 -0
- package/dist/mcp-gateway.d.ts +39 -2
- package/dist/mcp-gateway.js +56 -12
- package/dist/mcp-pin-first.js +1 -1
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +7 -2
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +17 -12
- package/dist/mcp-servers-store.js +2 -1
- package/dist/media-duration.d.ts +2 -0
- package/dist/media-duration.js +136 -0
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +211 -47
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +14 -2
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/refusal-words.d.ts +0 -3
- package/dist/refusal-words.js +0 -3
- package/dist/request-metadata.d.ts +20 -0
- package/dist/request-metadata.js +24 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +29 -5
- package/dist/run-launch.js +44 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-usage.d.ts +48 -4
- package/dist/run-usage.js +156 -39
- package/dist/run-view.d.ts +18 -1
- package/dist/run-view.js +28 -8
- package/dist/runner/adapter-loop.d.ts +14 -4
- package/dist/runner/adapter-loop.js +150 -31
- package/dist/runner/adapter-run-spec.d.ts +1 -1
- package/dist/runner/adapter-run-spec.js +35 -22
- package/dist/runner/audit.d.ts +10 -3
- package/dist/runner/audit.js +30 -7
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +31 -4
- package/dist/runner/claim-secrets.js +43 -7
- package/dist/runner/cli-run-spec.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +32 -20
- package/dist/runner/conformance/harness.js +4 -2
- package/dist/runner/dispatch.js +4 -2
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +16 -3
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +9 -3
- package/dist/runner/learning-end.js +66 -29
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +7 -2
- package/dist/runner/mcp-run.d.ts +12 -0
- package/dist/runner/mcp-run.js +14 -1
- package/dist/runner/model-route.js +7 -4
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +51 -24
- package/dist/runner/promotion.js +206 -78
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +174 -42
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.js +5 -2
- package/dist/runner/runner.js +41 -12
- package/dist/runner/sdk-loop.d.ts +2 -2
- package/dist/runner/sdk-loop.js +3 -3
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +4 -4
- package/dist/runs-over-store.d.ts +39 -8
- package/dist/runs-over-store.js +147 -32
- package/dist/sdk/check.d.ts +6 -5
- package/dist/sdk/check.js +17 -16
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +185 -78
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +68 -32
- package/dist/server.js +678 -124
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +8 -0
- package/dist/store/agent-body.js +20 -6
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.d.ts +2 -0
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/migrations/0025_run_attempts.sql +27 -0
- package/dist/store/postgres/migrations/0026_run_disk.sql +23 -0
- package/dist/store/schema.d.ts +15 -1
- package/dist/store/schema.js +43 -4
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +14 -0
- package/dist/store/sqlite/run-launch.js +58 -7
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +4 -3
- package/dist/store/sqlite/store.js +319 -153
- package/dist/store/store-schema.js +2 -2
- package/dist/store/store.d.ts +173 -33
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +12 -8
- package/dist/store-reads/learning.js +33 -24
- package/dist/store-reads/loop.d.ts +4 -3
- package/dist/store-reads/loop.js +7 -5
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/template-eval.js +4 -4
- package/dist/template-import.d.ts +10 -2
- package/dist/template-import.js +116 -13
- package/dist/templates.d.ts +29 -5
- package/dist/templates.js +68 -14
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/labels.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/tools.js +1 -1
- package/dist/trigger-launch-hook.d.ts +47 -0
- package/dist/trigger-launch-hook.js +90 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +2 -1
- package/dist/uploads.d.ts +0 -3
- package/dist/uploads.js +2 -11
- package/dist/validate.js +4 -1
- package/dist/web-save.d.ts +3 -0
- package/dist/web-save.js +17 -2
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/revision-skills.js +24 -11
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/dist/workspace/synced-folder.d.ts +3 -3
- package/dist/workspace/synced-folder.js +7 -6
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +5 -2
- package/dist/console/assets/index-Bt1B51b7.js +0 -733
- package/dist/console/assets/index-sVftE9Ht.css +0 -1
|
@@ -18,7 +18,7 @@ import { stopRunWith } from "../paid-calls.js";
|
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
20
20
|
import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
21
|
-
import { checkRaise, followUpOf,
|
|
21
|
+
import { checkRaise, followUpOf, freeRequestLimitOf, parkOf, planCapModel } from "@parcha/agentrun-kernel/kernel/cap";
|
|
22
22
|
import { PLAN_LIMIT_WORDS } from "@parcha/agentrun-kernel";
|
|
23
23
|
import { modelWire } from "../wires.js";
|
|
24
24
|
import { confineOf, noNewPrivsPrefix, standsIn, thinkingFor } from "../adapters.js";
|
|
@@ -56,7 +56,7 @@ import { isWebHostTool } from "../tool-list.js";
|
|
|
56
56
|
import { hostToolOf } from "../host-tools.js";
|
|
57
57
|
import { ASK_TOOL, askPerson } from "../tools.js";
|
|
58
58
|
import { fakedPlane } from "../web-fake.js";
|
|
59
|
-
import { claimModelEnv, claimModelKey, claimSecrets, claimSpendOff, holdRunKey, keyedAtClaim, hostDecisionKeys, learnedDecisionKeys, tierModelKeys, withoutModelKeys } from "./claim-secrets.js";
|
|
59
|
+
import { claimModelEnv, claimModelKey, claimSecrets, claimSpendOff, holdRunKey, keyedAtClaim, hostDecisionKeys, learnedDecisionKeys, tierModelKeys, underClaimed, withoutModelKeys } from "./claim-secrets.js";
|
|
60
60
|
import { mcpWhereHeld } from "./mcp-run.js";
|
|
61
61
|
import { held as runnerSeam, heldSignInReads } from "./held.js";
|
|
62
62
|
import { DECISION_PROVIDER_KEYS, TOOL_PLANE_ENV } from "../tool-plane.js";
|
|
@@ -83,6 +83,9 @@ import { prCheckoutForClaim } from "./pr-checkout.js";
|
|
|
83
83
|
import { holdStored, storeSecrets } from "./store-secrets.js";
|
|
84
84
|
import { bashPolicyOf } from "../bash-read-only.js";
|
|
85
85
|
import { monidForClaim, withMonid } from "./monid-run.js";
|
|
86
|
+
import { verifyPlacedProject, movedSkillFiles } from "../source-sync/claim.js";
|
|
87
|
+
import { projectCheckpointForRun } from "./project-checkpoint.js";
|
|
88
|
+
import { sourceAuxiliaryAdmitter } from "../source-sync/auxiliary.js";
|
|
86
89
|
/** What a CLI harness refuses of an agent's computer, in words: a browser, which only pi's browser tool drives. */
|
|
87
90
|
export const cliRefusesKind = (kind) => kind === "browser" ? "This agent's computer is a browser, which only the pi harness drives here: pick pi for this agent, or another kind of computer in Settings → Computers." : undefined;
|
|
88
91
|
/** The run's model and the catalog that prices it, as main chooses a CLI run's (app.ts wireModels and runModels): on the
|
|
@@ -146,9 +149,10 @@ export async function cliCapModel(entry, env, ref) {
|
|
|
146
149
|
* run whose plane resolves it to native gets the harness's own search (#2458), this run's alone; whatever the runner's
|
|
147
150
|
* own environment says of a plane is never the run's. Whether each search runs is the tool's setting at that search
|
|
148
151
|
* (SessionIO.permission, the gate), never this plane, which is frozen when the run is made. */
|
|
149
|
-
export function cliRunEnv(env, data, claimed = {}, plane, runKey) {
|
|
150
|
-
// A run with its own model key: that key alone, in the variables its route sends (claimModelEnv, never enumerable)
|
|
151
|
-
|
|
152
|
+
export function cliRunEnv(env, data, claimed = {}, plane, runKey, claim) {
|
|
153
|
+
// A run with its own model key: that key alone, in the variables its route sends (claimModelEnv, never enumerable), and
|
|
154
|
+
// the claim's request metadata beside it (request-metadata.ts, never enumerable either).
|
|
155
|
+
const out = claimModelEnv(env ?? {}, claimed, runKey, claim);
|
|
152
156
|
Object.defineProperty(out, DATA_ENV, { value: data, enumerable: true, writable: true, configurable: true });
|
|
153
157
|
delete out[TOOL_PLANE_ENV];
|
|
154
158
|
if (plane && Object.keys(plane).length)
|
|
@@ -276,6 +280,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
276
280
|
if (!revisionRow)
|
|
277
281
|
throw new Error(`run ${claim.runId}: its revision ${runRow.revisionId} is gone from the store`);
|
|
278
282
|
const body = (revisionRow.body ?? {});
|
|
283
|
+
const movedProject = await verifyPlacedProject(deps.store, runRow, revisionRow, launch, { data: deps.data, sealKey: deps.sealKey, env: deps.env, ...(run.signal ? { signal: run.signal } : {}), control: { ...deps.mountControl, ...(deps.makeArchilDisk ? { makeDisk: deps.makeArchilDisk } : {}) } });
|
|
279
284
|
const revision = { kind: revisionRow.kind, body };
|
|
280
285
|
const granted = body.tools ?? [];
|
|
281
286
|
// The harness: the launch's, else the revision's. Its table entry (facts, model choice, adapter, skill check), read from
|
|
@@ -330,7 +335,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
330
335
|
// A credential the claim opens mid-run (a GitHub App token, a saved or per_run server's) joins the run's redactors.
|
|
331
336
|
const hold = (values) => { for (const redact of [...(run.redact ? [heldRedactor(run.redact)] : []), cut])
|
|
332
337
|
redact.hold(values); };
|
|
333
|
-
const mcp = await mcpWhereHeld({ claim, store: deps.store, sealKey: deps.sealKey, grants: granted, harness: run.harness, work: () => runFolder(deps.data, runRow.agentId, claim.runId), launchInput: launch.input, hold, githubAppAccess: (store, key, input) => githubAppAccess(store, key, input, { ...(deps.githubApi ? { api: deps.githubApi } : {}), fromGitHub: launch.inputOrigin?.kind === "trigger" && launch.inputOrigin.source === "github", hold, ...(launch.repo !== undefined ? { repo: launch.repo } : {}) }), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...reach });
|
|
338
|
+
const mcp = await mcpWhereHeld({ claim, store: deps.store, sealKey: deps.sealKey, grants: granted, harness: run.harness, work: () => runFolder(deps.data, runRow.agentId, claim.runId), launchInput: launch.input, hold, githubAppAccess: (store, key, input) => githubAppAccess(store, key, input, { ...(deps.githubApi ? { api: deps.githubApi } : {}), fromGitHub: launch.inputOrigin?.kind === "trigger" && launch.inputOrigin.source === "github", hold, ...(launch.repo !== undefined ? { repo: launch.repo } : {}) }), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...reach, capped: launch.maxCostUsd !== undefined, media: { env: deps.env, web, slots: deps.saveSlots } });
|
|
334
339
|
// The claim's MCP goes to the loop, which lets it go; a build that throws lets it go itself.
|
|
335
340
|
holds.hold({ passed: mcp });
|
|
336
341
|
// The run's mode is the server's: Mode 2 where its Archil settings are saved (archil-settings.ts), the run's folder then
|
|
@@ -369,13 +374,14 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
369
374
|
const start = learningStartOf(launch);
|
|
370
375
|
// The revision's own skills laid before they are read, as the pi spec lays them (adapter-run-spec.ts), with the kind's
|
|
371
376
|
// skill of a desktop or a phone (the revision's computer setting), in the harness's skill list beside the revision's.
|
|
372
|
-
const kindSkills = await layOwnSkills(ws.workspace, (revisionRow.skills ?? {}), { computer: settingOfDefinition(body)?.computer.kind });
|
|
377
|
+
const kindSkills = movedProject ? [] : await layOwnSkills(ws.workspace, (revisionRow.skills ?? {}), { computer: settingOfDefinition(body)?.computer.kind });
|
|
378
|
+
const currentSkills = movedProject ? await movedSkillFiles(ws.workspace, body.skills ?? {}, settingOfDefinition(body)?.computer.kind) : [...Object.keys(body.skills ?? {}), ...kindSkills];
|
|
373
379
|
// A learning run's seed read as the pi spec reads it (runner/learning-seed.ts): its learned workflows, the ones
|
|
374
380
|
// learned_workflow runs.
|
|
375
381
|
const shown = async () => secretsShown(runnerSecrets(deps.env, await storeSecrets(deps.store, deps.sealKey, deps.data)), { local: true });
|
|
376
382
|
const learningFolder = () => (archil === undefined ? learningFolderOf(deps.data, runRow.agentId) : learningWorkspace({ mode: "archil", agentId: runRow.agentId, archil }));
|
|
377
383
|
const seedLaid = start && !seedFailed(start)
|
|
378
|
-
? await layLearningSeed({ seed: start.seed, folder: learningFolder, shown, log, ...(start.noWorkflows ? { workflows: false } : {}) })
|
|
384
|
+
? await layLearningSeed({ seed: start.seed, folder: learningFolder, store: deps.sealKey ? deps.store : null, shown, log, ...(start.noWorkflows ? { workflows: false } : {}) })
|
|
379
385
|
: undefined;
|
|
380
386
|
// The run's computer, from the one shared claim-time function (the pi spec takes the same): none for a runner place.
|
|
381
387
|
// It throws computer_unavailable (nothing made) when the computer cannot be had: the run fails in its words.
|
|
@@ -416,7 +422,8 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
416
422
|
const bashPolicy = bashPolicyOf(body.toolSettings);
|
|
417
423
|
// A computer that replaced an earlier claim's holds its acts to what it showed, as the pi spec's does.
|
|
418
424
|
const tools = await runTools(ws.workspace, computer.computer, { mode, context, aliases: [scratch], ...(computer.hold ? { hold: computer.hold } : {}), ...(bashPolicy === undefined ? {} : { bashPolicy }), ...(computer.replaced ? { replaced: true } : {}) });
|
|
419
|
-
|
|
425
|
+
let remoteProjectCapture = false;
|
|
426
|
+
holds.hold({ tools: { end: () => remoteProjectCapture ? Promise.resolve() : tools.end() } });
|
|
420
427
|
const root = runFolder(deps.data, runRow.agentId, claim.runId);
|
|
421
428
|
// The system prompt, as main's harness branch builds it: the environment line, the instructions with what the agent
|
|
422
429
|
// learned laid in (learning.ts laidLearned, from the launch's learning start, so the runner reads no learning folder), its
|
|
@@ -425,8 +432,8 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
425
432
|
// pi spec gives it), then the effort guidance.
|
|
426
433
|
// A start whose seed failed tells the run nothing: it is never asked what to keep (learning-end.ts drops it).
|
|
427
434
|
const laid = start && !seedFailed(start) ? laidLearned(body.instructions ?? "", start.section) : (body.instructions ?? "");
|
|
428
|
-
const check = await entry.skillCheck?.();
|
|
429
|
-
const { system: instructions, native } = await systemOf(laid,
|
|
435
|
+
const check = movedProject ? undefined : await entry.skillCheck?.();
|
|
436
|
+
const { system: instructions, native } = await systemOf(laid, currentSkills, ws.workspace, check, { onDemand: movedProject || readsFiles(granted) });
|
|
430
437
|
const guidance = effortGuidance(launch.effort);
|
|
431
438
|
// The run's model (the launch's, pinned at start, else the revision's) and its adapter, as main builds them, on the
|
|
432
439
|
// environment main's server gives its runs: the server's data directory named (DATA_ENV), so the CLI's install is
|
|
@@ -435,7 +442,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
435
442
|
// store's), held by the runner's one redactor and this spec's log cut before anything can echo one. Its model's key goes
|
|
436
443
|
// to the model choice and the adapter's provider (withModelKeys, never enumerable), so a key saved in
|
|
437
444
|
// Settings → Model keys runs the next run with no restart, as one set where AgentRun starts does.
|
|
438
|
-
const claimed = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, revisionRow, launch);
|
|
445
|
+
const claimed = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: deps.env, redact: run.redact }, revisionRow, launch, claim.runId);
|
|
439
446
|
// The run's own model key, when its caller handed one (model_key): opened at every claim, held by the redactors, read by
|
|
440
447
|
// its model route alone; the CLI's process and its tools never carry it, nor any other model key then.
|
|
441
448
|
// A run that starts on the server's key holds the claim's key holder too: a message's first key reaches its next request.
|
|
@@ -452,7 +459,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
452
459
|
// carries only where it is, and its CLI says it is signed in before the run starts. A run that brought its own key
|
|
453
460
|
// runs on that key, and a run in a sandbox place on the model keys.
|
|
454
461
|
const login = keyed ? undefined : await loginForRun(deps.store.settings, deps.data, deps.env ?? {}, name, launch.place);
|
|
455
|
-
const env = withClaudeLogin(cliRunEnv(deps.env, deps.data, claimed, launch.plane, runKey), login);
|
|
462
|
+
const env = withClaudeLogin(cliRunEnv(deps.env, deps.data, claimed, launch.plane, runKey, claim), login);
|
|
456
463
|
const chosen = await modelsOf(entry, env, modelAskOf(launch.model, body.model));
|
|
457
464
|
await planBeforeRun(env, chosen.model);
|
|
458
465
|
if (login && entry.priceModel(env, chosen.model).provider === CLAUDE_LOGIN_PROVIDER) {
|
|
@@ -533,8 +540,8 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
533
540
|
},
|
|
534
541
|
// What its audit's shadow took beside it, read by every gate with its own sessions (none: it starts none).
|
|
535
542
|
...(besideOf ? { beside: besideOf } : {}),
|
|
536
|
-
// The most requests on free models it makes, capped or not (AGENTRUN_FREE_MODEL_REQUESTS).
|
|
537
|
-
freeRequests:
|
|
543
|
+
// The most requests on free models it makes, capped or not (AGENTRUN_FREE_MODEL_REQUESTS, or the agent's lower max_requests).
|
|
544
|
+
freeRequests: freeRequestLimitOf(deps.env, body.maxRequests),
|
|
538
545
|
};
|
|
539
546
|
const cap = capUsd === undefined
|
|
540
547
|
? undefined
|
|
@@ -593,15 +600,16 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
593
600
|
// Model spend beside the run that its caller's key does not pay for (claimSpendOff): a shadow audit and a replay check
|
|
594
601
|
// are skipped, in words, where the run brought its own key or the server holds none.
|
|
595
602
|
const spendOff = await claimSpendOff({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, runKey);
|
|
596
|
-
const
|
|
603
|
+
const admitAuxiliary = runnerSeam() ? undefined : sourceAuxiliaryAdmitter(deps.store, { data: deps.data, sealKey: deps.sealKey, env: deps.env, control: { ...deps.mountControl, ...(deps.makeArchilDisk ? { makeDisk: deps.makeArchilDisk } : {}) } });
|
|
604
|
+
const audits = { store: deps.store, agentId: runRow.agentId, revisionId: runRow.revisionId, context, log, folder: learningFolder, shown, sealKey: deps.sealKey, spendOff, admitAuxiliary };
|
|
597
605
|
// A replay run's or a shadow's grader (runner/compare-end.ts), on a proxy of its own beside the CLI session's, as pi's
|
|
598
606
|
// is (adapter-run-spec.ts graderRouteOf), reached through the session's port while it is up. None: compared whole.
|
|
599
|
-
const graderRoute = launch.replay || launch.audit ? await graderRouteOf(body, keyed, runKey, claimed, cut, log, deps, [held, cut]) : undefined;
|
|
607
|
+
const graderRoute = launch.replay || launch.audit ? await graderRouteOf(body, keyed, runKey, claimed, cut, log, deps, [held, cut], claim) : undefined;
|
|
600
608
|
if (graderRoute)
|
|
601
609
|
tierRoutes.set(GRADER, graderRoute);
|
|
602
610
|
// Each step writes the store or reads another run (runner/learned-first.ts): in a run's own process its runner takes
|
|
603
611
|
// them (held.ts learnedFirst), over the workflows it reads at the claim's seed itself.
|
|
604
|
-
const learned = await learnedFirstWhereHeld(deps, { agentId: runRow.agentId, runId: claim.runId, revisionId: runRow.revisionId, kind: revision.kind, outputSchema: revision.body.outputSchema, launch, context, log, folder: learningFolder, shown, spendOff }, seedLaid?.workflows ?? []);
|
|
612
|
+
const learned = await learnedFirstWhereHeld(deps, { agentId: runRow.agentId, runId: claim.runId, revisionId: runRow.revisionId, kind: revision.kind, outputSchema: revision.body.outputSchema, launch, context, log, folder: learningFolder, shown, spendOff, admitAuxiliary }, seedLaid?.workflows ?? []);
|
|
605
613
|
const firstChoice = learned.choice;
|
|
606
614
|
// A replay run's call nodes: reads live through a cache seeded from the graded run's recorded calls, writes only ever
|
|
607
615
|
// answered from that recording (runner/promotion.ts replayCallsOver, learn/replay-calls.ts).
|
|
@@ -620,7 +628,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
620
628
|
const learnedKeys = await learnedDecisionKeys({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, workflows, (provider) => gate.permissions.policy(provider) !== "deny");
|
|
621
629
|
for (const redact of new Set([held, cut]))
|
|
622
630
|
holdClaimed(redact, learnedKeys);
|
|
623
|
-
|
|
631
|
+
underClaimed(toolEnv, learnedKeys);
|
|
624
632
|
}
|
|
625
633
|
handedKeys = runnerSecrets(toolEnv);
|
|
626
634
|
// The run's resolved tool plane (its web tools' providers), as the pi spec hands it its web tools.
|
|
@@ -643,7 +651,7 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
643
651
|
const tierKeys = keyed ? {} : await tierModelKeys({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, learnedTiers(workflows));
|
|
644
652
|
for (const redact of new Set([held, cut]))
|
|
645
653
|
holdClaimed(redact, tierKeys);
|
|
646
|
-
const modelEnv = claimModelEnv(deps.env, { ...claimed, ...tierKeys }, runKey);
|
|
654
|
+
const modelEnv = claimModelEnv(deps.env, { ...claimed, ...tierKeys }, runKey, claim);
|
|
647
655
|
const tiers = new Map();
|
|
648
656
|
for (const [tier, routed] of await learnedTierRoutes(workflows, modelEnv, (tier) => deps.routeOf(undefined, modelEnv, tier, PI_WIRES, undefined, cut))) {
|
|
649
657
|
if ("why" in routed)
|
|
@@ -769,6 +777,10 @@ async function cliSpec(launch, run, deps, claim, holds) {
|
|
|
769
777
|
// resume instead, its mount credential with it, as the pi spec's.
|
|
770
778
|
...(computer.keeps ? { keptWords: computerKeptWords(computer.keeps) } : {}),
|
|
771
779
|
release: (how) => holds.release(how),
|
|
780
|
+
...(movedProject ? { projectCheckpoint: projectCheckpointForRun({ store: deps.store, agentId: runRow.agentId, claim, launch, tools, computer,
|
|
781
|
+
workspace: { data: deps.data, sealKey: deps.sealKey, env: deps.env, control: { ...deps.mountControl, ...(deps.makeArchilDisk ? { makeDisk: deps.makeArchilDisk } : {}) } },
|
|
782
|
+
secrets: async () => runnerSecrets(deps.env, await storeSecrets(deps.store, deps.sealKey, deps.data)),
|
|
783
|
+
}, () => { remoteProjectCapture = true; }) } : {}),
|
|
772
784
|
endCheckout: () => holds.endCheckout(),
|
|
773
785
|
};
|
|
774
786
|
}
|
|
@@ -1059,7 +1059,9 @@ const CASES = [
|
|
|
1059
1059
|
await w.ended("parked");
|
|
1060
1060
|
const callId = await w.askedCall();
|
|
1061
1061
|
// Both sent before either is awaited (on Postgres, each on its own pooled connection). Whichever is written first, the
|
|
1062
|
-
// store
|
|
1062
|
+
// store refuses the other: no order is imposed, so the case holds for either winner. The other meets the one-answer
|
|
1063
|
+
// index (AnswerTaken) or, when the winner's answer already ended the run, the run's end (RunFinal): which one is
|
|
1064
|
+
// timing, so either stands, and the index itself is approval-double-click's (its call held so the run cannot end).
|
|
1063
1065
|
const settled = await Promise.allSettled([
|
|
1064
1066
|
sendCommand(w.server, RUN, { kind: "approve", body: { approval: callId } }),
|
|
1065
1067
|
sendCommand(w.server, RUN, { kind: "deny", body: { approval: callId } }),
|
|
@@ -1067,7 +1069,7 @@ const CASES = [
|
|
|
1067
1069
|
const won = settled.filter((r) => r.status === "fulfilled");
|
|
1068
1070
|
const lost = settled.filter((r) => r.status === "rejected");
|
|
1069
1071
|
assert.equal(won.length, 1, `one answer is written, not both: ${JSON.stringify(settled.map((r) => r.status))}`);
|
|
1070
|
-
assert.ok(lost[0]?.reason instanceof AnswerTaken, `the other is refused by the store
|
|
1072
|
+
assert.ok(lost[0]?.reason instanceof AnswerTaken || lost[0]?.reason instanceof RunFinal, `the other is refused by the store, answered already (AnswerTaken) or the run ended on the winner (RunFinal), never a bare constraint: ${String(lost[0]?.reason)}`);
|
|
1071
1073
|
await w.ended("ended");
|
|
1072
1074
|
const winner = won[0].value;
|
|
1073
1075
|
assert.equal(ran.asked, winner.kind === "approve" ? 1 : 0, "the run acted on the answer written, never the other");
|
package/dist/runner/dispatch.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// through the inner loop the moment it is chosen. A launch whose harness this runner does not run, or whose body cannot
|
|
9
9
|
// be read, fails the run in words (the dispatch's start() throws, which the runner records as the run failing).
|
|
10
10
|
import { harnessOfBody } from "../harness.js";
|
|
11
|
-
import { readLaunchBody } from "../run-launch.js";
|
|
11
|
+
import { launchOnItsDisk, readLaunchBody } from "../run-launch.js";
|
|
12
12
|
/** A launch naming a harness this runner does not run. */
|
|
13
13
|
export class UnknownHarness extends Error {
|
|
14
14
|
harness;
|
|
@@ -58,7 +58,9 @@ function dispatchLoop(deps, loopDeps) {
|
|
|
58
58
|
const innerDeps = { ...loopDeps, delivered: Promise.all([loopDeps.delivered ?? Promise.resolve(), earlyReplayed]).then(() => undefined) };
|
|
59
59
|
async function begin(claim) {
|
|
60
60
|
const row = await deps.launchOf(claim.runId);
|
|
61
|
-
|
|
61
|
+
// The launch as this run runs it: on a named disk, with nothing learned on another disk (launchOnItsDisk).
|
|
62
|
+
const read = readLaunchBody(row.body);
|
|
63
|
+
const launch = read && launchOnItsDisk(read);
|
|
62
64
|
if (!launch)
|
|
63
65
|
throw new LaunchUnreadable(claim.runId);
|
|
64
66
|
const harness = harnessOfBody(row.body);
|
|
@@ -6,6 +6,12 @@ import { ClaimRefused, type LoopFactory } from "./loop-contract.js";
|
|
|
6
6
|
export declare class NeverFits extends ClaimRefused {
|
|
7
7
|
name: string;
|
|
8
8
|
}
|
|
9
|
+
/** The words a scheduled or triggered run on a plan-billed harness recipe is refused in (harness-recipe-entry.ts
|
|
10
|
+
* serverRoute): such a run takes keys saved for that harness, never its owner's own sign-in, and none are saved yet. */
|
|
11
|
+
export declare const RECIPE_SIGN_IN_PERSON_ONLY = "A scheduled or triggered run on a harness recipe billed to its vendor's plan runs on keys saved for that harness, never on its owner's own sign-in, and this server saves no harness's keys yet: start this run yourself, or run the agent on a harness billed through this server's model proxy.";
|
|
12
|
+
/** Refuses at its claim a run no person started (a schedule's, a trigger's: launch.trigger) on a plan-billed recipe's
|
|
13
|
+
* harness (harness-table.ts recipeHarness), on every path a claim takes (run-child-host.ts staysInRunner, and here). */
|
|
14
|
+
export declare function refuseRecipeTriggerRun(env: NodeJS.ProcessEnv, harness: string, launch: Pick<RunLaunch, "trigger">): void;
|
|
9
15
|
/** The dispatch's `resolve`, built from the runner's deps: it reads the run's revision (for a workflow revision) and
|
|
10
16
|
* returns the loop the run runs on, or undefined when this runner does not run it (the dispatch fails it in words). */
|
|
11
17
|
export declare function resolveRunnerLoop(given: AdapterSpecDeps): (harness: string, launch: RunLaunch, runId: string) => Promise<LoopFactory | undefined>;
|
|
@@ -13,12 +13,13 @@ import { createNativeLoop } from "./native-loop.js";
|
|
|
13
13
|
// module adds with no adapter facts of its own, on its runner's adapter;
|
|
14
14
|
// - a CLI harness (claude-agent, codex, opencode) runs on the adapter loop with its own adapter;
|
|
15
15
|
// - anything else fails the run in words (the dispatch's UnknownHarness).
|
|
16
|
-
import { harnessOf } from "../harness-table.js";
|
|
16
|
+
import { harnessOf, recipeHarness } from "../harness-table.js";
|
|
17
17
|
import { hostMemory, neverFits } from "../host.js";
|
|
18
18
|
import { resolveHarness } from "./adapters/index.js";
|
|
19
19
|
import { adapterRunSpecFromLaunch, PI_WIRES } from "./adapter-run-spec.js";
|
|
20
20
|
import { createAdapterLoop } from "./adapter-loop.js";
|
|
21
21
|
import { savedModelKeys, withModelKeys } from "./claim-secrets.js";
|
|
22
|
+
import { withRequestMetadata } from "../request-metadata.js";
|
|
22
23
|
import { noServerKeyFor } from "../run-model-key.js";
|
|
23
24
|
import { createDispatchLoop } from "./dispatch.js";
|
|
24
25
|
import { cliRunSpecFromLaunch } from "./cli-run-spec.js";
|
|
@@ -31,10 +32,20 @@ import { workflowSpecOf } from "./workflow-spec.js";
|
|
|
31
32
|
export class NeverFits extends ClaimRefused {
|
|
32
33
|
name = "NeverFits";
|
|
33
34
|
}
|
|
35
|
+
/** The words a scheduled or triggered run on a plan-billed harness recipe is refused in (harness-recipe-entry.ts
|
|
36
|
+
* serverRoute): such a run takes keys saved for that harness, never its owner's own sign-in, and none are saved yet. */
|
|
37
|
+
export const RECIPE_SIGN_IN_PERSON_ONLY = "A scheduled or triggered run on a harness recipe billed to its vendor's plan runs on keys saved for that harness, never on its owner's own sign-in, and this server saves no harness's keys yet: start this run yourself, or run the agent on a harness billed through this server's model proxy.";
|
|
38
|
+
/** Refuses at its claim a run no person started (a schedule's, a trigger's: launch.trigger) on a plan-billed recipe's
|
|
39
|
+
* harness (harness-table.ts recipeHarness), on every path a claim takes (run-child-host.ts staysInRunner, and here). */
|
|
40
|
+
export function refuseRecipeTriggerRun(env, harness, launch) {
|
|
41
|
+
if (launch.trigger !== undefined && recipeHarness(env, harness) === "plan")
|
|
42
|
+
throw new ClaimRefused(RECIPE_SIGN_IN_PERSON_ONLY);
|
|
43
|
+
}
|
|
34
44
|
/** The dispatch's `resolve`, built from the runner's deps: it reads the run's revision (for a workflow revision) and
|
|
35
45
|
* returns the loop the run runs on, or undefined when this runner does not run it (the dispatch fails it in words). */
|
|
36
46
|
export function resolveRunnerLoop(given) {
|
|
37
47
|
return async (harness, launch, runId) => {
|
|
48
|
+
refuseRecipeTriggerRun(given.env ?? {}, harness, launch);
|
|
38
49
|
// The model gateway saved in the console (model-gateway.ts), read from the store at each claim and laid over the run
|
|
39
50
|
// environment as its variables would be, so a gateway saved or removed since reaches the next run with no restart. A
|
|
40
51
|
// gateway the runner's environment names wins, and nothing saved is read over it.
|
|
@@ -73,11 +84,13 @@ async function loopOn(deps, harness, launch, runId) {
|
|
|
73
84
|
// A backend SDK run's compile turn is asked on the runner's one model route, on the agent's own model (its learning
|
|
74
85
|
// start's), its key from the runner's environment, else the one saved in Settings → Model keys, read at each ask.
|
|
75
86
|
if (launch.sdk || launch.cli_learning)
|
|
76
|
-
return createSdkLoop(launch, deps, async () => {
|
|
87
|
+
return createSdkLoop(launch, deps, async (claim) => {
|
|
77
88
|
if (launch.cli_learning)
|
|
78
89
|
throw new Error("Connected CLI capture has no workflow execution bridge.");
|
|
79
90
|
const base = deps.env ?? process.env;
|
|
80
|
-
|
|
91
|
+
// Its requests on serve's gateway name the claim's run, turn and attempt, as every other request of a claim does
|
|
92
|
+
// (request-metadata.ts): withModelKeys makes the env this ask's own.
|
|
93
|
+
const env = withRequestMetadata(withModelKeys(base, await savedModelKeys({ store: deps.store, sealKey: deps.sealKey, env: base })), claim);
|
|
81
94
|
// It runs after its backend reported the run complete, on no run's key: on a server that holds no gateway key it is
|
|
82
95
|
// skipped in words (run-model-key.ts noServerKeyFor), nothing sent.
|
|
83
96
|
const off = noServerKeyFor(env, "An SDK run's compile turn");
|
package/dist/runner/held.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { HarnessInstallEntry, HarnessPins } from "../harness-install.js";
|
|
|
13
13
|
import type { RunModelKey } from "../store/seal.js";
|
|
14
14
|
import type { EndOfRunKept, EndOfRunTurn } from "./loop-contract.js";
|
|
15
15
|
import type { LearnedFirst } from "./learned-first.js";
|
|
16
|
+
import type { ProjectCheckpoint } from "../source-sync/checkpoints.js";
|
|
16
17
|
/** One MCP tool of the claim, its call made by the runner (mcp-run.ts mcpForClaim), with what the gate reads of it. */
|
|
17
18
|
export interface HeldMcpTool {
|
|
18
19
|
readonly name: string;
|
|
@@ -54,6 +55,9 @@ export interface HeldComputerAsk {
|
|
|
54
55
|
readonly onComputerNote?: (words: string) => void;
|
|
55
56
|
}
|
|
56
57
|
export interface Held {
|
|
58
|
+
/** The host captures this claim's placed project once after draining its exported capabilities. No child-selected
|
|
59
|
+
* identifiers, paths, callbacks, workspace or secret values cross this boundary. */
|
|
60
|
+
projectCheckpoint(signal?: AbortSignal): Promise<ProjectCheckpoint>;
|
|
57
61
|
/** The ChatGPT sign-in's reader (chatgpt-plan.ts planReaderOf), for a run whose models reach the plan; else none. */
|
|
58
62
|
plan(): Promise<PlanReader | undefined>;
|
|
59
63
|
/** Whether a browser sign-in handed to the run reads back here (sign-ins-store.ts handedSignInReadsBack). */
|
|
@@ -260,6 +260,9 @@ export interface AskData {
|
|
|
260
260
|
readonly tool: string;
|
|
261
261
|
/** The call's input as the gate saw it; null when it had none. */
|
|
262
262
|
readonly args?: unknown;
|
|
263
|
+
/** Why a call its setting allows asks a person anyway (a tool's own ask, tools.ts ToolEntry.asks): the gate's alone,
|
|
264
|
+
* never one of the call's arguments. */
|
|
265
|
+
readonly because?: string;
|
|
263
266
|
/** When it was asked (ISO), from the loop's clock; a re-ask on a resume keeps the first. */
|
|
264
267
|
readonly requestedAt?: string;
|
|
265
268
|
/** Its approval price (a catalog tool's, the spec's mcp priceOf); null when it has none. */
|
|
@@ -322,6 +325,8 @@ export declare function withdrawnAnswers(entries: readonly {
|
|
|
322
325
|
readonly model?: unknown;
|
|
323
326
|
}[], answeredAt: string, decision?: "withdrawn" | "canceled"): AnswerData[];
|
|
324
327
|
export interface EndData {
|
|
328
|
+
/** Immutable moved-project candidate or explicit uncertainty, committed atomically with this run end. */
|
|
329
|
+
readonly projectCheckpoint?: import("../source-sync/checkpoints.js").ProjectCheckpoint;
|
|
325
330
|
readonly state: "ended" | "stopped" | "failed";
|
|
326
331
|
readonly summary?: string;
|
|
327
332
|
/** How the run ended beside its state (the store's RunOutcome): an escalation's 'escalated'; a stopped end's 'stopped'
|
|
@@ -4,10 +4,12 @@ import type { LearningFolder } from "../learn/folder.js";
|
|
|
4
4
|
import type { Recorded } from "../learn/replay-calls.js";
|
|
5
5
|
import type { RunLaunch } from "../run-launch.js";
|
|
6
6
|
import type { Store } from "../store/store.js";
|
|
7
|
+
import type { AuxiliaryAdmitter } from "../source-sync/auxiliary.js";
|
|
7
8
|
import { type FirstChoice } from "./workflow-first.js";
|
|
8
9
|
/** The claim, as the runner read it, for learnedFirst. */
|
|
9
10
|
export interface LearnedFirstDeps {
|
|
10
11
|
readonly store: Store;
|
|
12
|
+
readonly admitAuxiliary?: AuxiliaryAdmitter;
|
|
11
13
|
readonly sealKey?: Buffer;
|
|
12
14
|
readonly agentId: string;
|
|
13
15
|
readonly runId: string;
|
|
@@ -8,7 +8,7 @@ import { workflowFirstOf } from "./workflow-first.js";
|
|
|
8
8
|
* claim that is refused throws ClaimRefused, as replayClaimed does. */
|
|
9
9
|
export async function learnedFirst(deps, laid) {
|
|
10
10
|
const { store, agentId, runId, revisionId, launch, context, log, folder, shown } = deps;
|
|
11
|
-
const own = { ...(deps.sealKey ? { sealKey: deps.sealKey } : {}), ...(deps.spendOff ? { spendOff: deps.spendOff } : {}) };
|
|
11
|
+
const own = { ...(deps.sealKey ? { sealKey: deps.sealKey } : {}), ...(deps.spendOff ? { spendOff: deps.spendOff } : {}), ...(deps.admitAuxiliary ? { admitAuxiliary: deps.admitAuxiliary } : {}) };
|
|
12
12
|
// A replay run lays only the workflow it replays (promotion.ts replayLaid).
|
|
13
13
|
const laidFlows = replayLaid(launch, laid);
|
|
14
14
|
if (launch.learning && !launch.replay && !launch.audit)
|
|
@@ -131,12 +131,15 @@ export declare function checkDraftOf(deps: LearningEndDeps, input: {
|
|
|
131
131
|
readonly base: string;
|
|
132
132
|
};
|
|
133
133
|
}): Promise<DraftChecked<DraftCommit>>;
|
|
134
|
+
/** The digest of the failed-draft record run `runId`'s compile keeps (recordDraftFailed): one per run. */
|
|
135
|
+
export declare const draftFailedDigest: (runId: string) => string;
|
|
134
136
|
/** Compile once: run `runId`'s compile turn whose drafts all failed their checks is the compile's attempt, kept as a
|
|
135
137
|
* promotion record of the shape a check's stop has (runner/promotion.ts stopUnchecked): a hold with nothing checked,
|
|
136
138
|
* its reason (DRAFT_FAILED) naming the failed checks. A first compile's earns the one recompile, as a check's hold
|
|
137
139
|
* does (the agent's next due run compiles once more: learn/compile.ts newCompileAttempt); a recompile's (a revision of
|
|
138
140
|
* a held workflow, or a new one after a first compile's failed drafts) stops (compileStoppedOf, heldNamesOf): nothing
|
|
139
|
-
* compiles it again.
|
|
141
|
+
* compiles it again. A revision of a connected agent's hold on give-backs is no recompile (runner/promotion.ts
|
|
142
|
+
* reviseAttemptOf). One record per run (its digest is the run's), written once: a claim that ends the run again
|
|
140
143
|
* writes none. */
|
|
141
144
|
export declare function recordDraftFailed(deps: Pick<LearningEndDeps, "store" | "log">, input: {
|
|
142
145
|
runId: string;
|
|
@@ -158,7 +161,8 @@ export declare function traceFrom(timeline: readonly TimelineEvent[], refuse: re
|
|
|
158
161
|
* that fits the run's input and whose promotion holds it at main's digest (runner/promotion.ts: its one check on the
|
|
159
162
|
* agent's own runs fell under the bar; its champion served the run, or the agent did by hand), its text as main holds
|
|
160
163
|
* it, with the check's numbers and the inputs it disagreed on, once per hold (none when any run since the hold compiled
|
|
161
|
-
* it, read from the agent's kept learning; a stopped check's none
|
|
164
|
+
* it, read from the agent's kept learning; a stopped check's none; a connected agent's hold on give-backs only once it
|
|
165
|
+
* is due, as a first compile is, on its runs since the hold); else, when the job is due (compileDue: the run
|
|
162
166
|
* completed, the agent has no learned workflow active or waiting, and it has its definition's compile_after completed
|
|
163
167
|
* agent runs), a new one, compiled once: one more after a first compile whose drafts all failed their checks, and none
|
|
164
168
|
* after a recompile's (recordDraftFailed). A draft that passes is on main at once (a learned workflow then), so nothing
|
|
@@ -168,7 +172,8 @@ export declare function traceFrom(timeline: readonly TimelineEvent[], refuse: re
|
|
|
168
172
|
* run's input (`input`, its fields for the workflow's input schema), the agent's output schema when it has one (its
|
|
169
173
|
* final output's shape) and the DSL's language with this host's addendum. An SDK run's compile, asked outside its
|
|
170
174
|
* session, also carries the owner's standing corrections it was laid with (`corrections`, its # Learned section), as an
|
|
171
|
-
* in-session compile reads them in its session
|
|
175
|
+
* in-session compile reads them in its session; its held workflow is the one its task fits (`sdkTask`: sdkTakes, as its
|
|
176
|
+
* start reserves a check). Undefined when it compiles nothing, or when the folder can't be read. */
|
|
172
177
|
export declare function compileAskOf(deps: LearningEndDeps, input: {
|
|
173
178
|
runId: string;
|
|
174
179
|
agentId: string;
|
|
@@ -176,6 +181,7 @@ export declare function compileAskOf(deps: LearningEndDeps, input: {
|
|
|
176
181
|
refuse: readonly string[];
|
|
177
182
|
round?: number;
|
|
178
183
|
input?: unknown;
|
|
184
|
+
sdkTask?: string;
|
|
179
185
|
seedWorkflows?: number;
|
|
180
186
|
corrections?: string;
|
|
181
187
|
}): Promise<CompileAsk | undefined>;
|