@parcha/agentrun-serve 0.1.0-beta.54 → 0.1.0-beta.55
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 +110 -2
- package/README.md +266 -88
- package/dist/adapters.d.ts +10 -0
- package/dist/adapters.js +46 -0
- package/dist/agent-package.d.ts +3 -3
- package/dist/agent-package.js +6 -13
- package/dist/agents-store.js +6 -5
- package/dist/api-only.d.ts +16 -4
- package/dist/api-only.js +21 -7
- package/dist/cli.js +5 -3
- package/dist/composio-made.d.ts +26 -1
- package/dist/composio-made.js +39 -2
- package/dist/composio-preset.d.ts +3 -2
- package/dist/composio-preset.js +46 -14
- package/dist/computer-held-routes.js +2 -3
- package/dist/computer-setting.d.ts +4 -2
- package/dist/computer-setting.js +0 -2
- package/dist/computers-running.d.ts +8 -0
- package/dist/computers-running.js +27 -0
- package/dist/console/assets/backend-D5EmB4N3.js +166 -0
- package/dist/console/assets/index-DUYLaqiR.js +746 -0
- package/dist/console/assets/index-DYhU4adm.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-host-addresses.d.ts +23 -3
- package/dist/docker-host-addresses.js +90 -18
- package/dist/exa-keyless.d.ts +2 -3
- package/dist/exa-keyless.js +43 -127
- package/dist/firecrawl-keyless.d.ts +41 -0
- package/dist/firecrawl-keyless.js +152 -0
- package/dist/handed-secret.d.ts +3 -1
- package/dist/handed-secret.js +4 -2
- package/dist/harness-keys.d.ts +98 -0
- package/dist/harness-keys.js +247 -0
- package/dist/harness-recipe-entry.d.ts +14 -9
- package/dist/harness-recipe-entry.js +25 -14
- package/dist/harness-table.d.ts +16 -1
- package/dist/harness-table.js +19 -7
- package/dist/harness.d.ts +4 -0
- package/dist/harness.js +12 -1
- package/dist/host-check.d.ts +2 -0
- package/dist/host-check.js +6 -0
- package/dist/import-summary.d.ts +1 -1
- package/dist/import-summary.js +1 -1
- package/dist/import.d.ts +5 -5
- package/dist/import.js +54 -67
- package/dist/keyless-mcp.d.ts +36 -0
- package/dist/keyless-mcp.js +127 -0
- package/dist/learn/audit.d.ts +3 -3
- package/dist/learn/audit.js +3 -3
- package/dist/learn/commit.d.ts +8 -7
- package/dist/learn/commit.js +60 -20
- package/dist/learn/compile.d.ts +4 -3
- package/dist/learn/compile.js +7 -5
- package/dist/learn/folder.d.ts +16 -3
- package/dist/learn/folder.js +46 -13
- package/dist/learn/promote.d.ts +37 -13
- package/dist/learn/promote.js +112 -40
- package/dist/learn/secrets.js +10 -2
- package/dist/learning-routes.d.ts +22 -17
- package/dist/learning-routes.js +40 -39
- package/dist/learning.js +2 -2
- package/dist/manifest.d.ts +10 -0
- package/dist/manifest.js +30 -0
- package/dist/mcp-pin-first.d.ts +4 -2
- package/dist/mcp-pin-first.js +5 -2
- package/dist/mcp-secret-writes.d.ts +16 -7
- package/dist/mcp-secret-writes.js +35 -27
- package/dist/mcp-servers-store.d.ts +30 -6
- package/dist/mcp-servers-store.js +112 -28
- package/dist/mcp-sources.d.ts +10 -2
- package/dist/mcp-sources.js +9 -2
- package/dist/mcp-store.d.ts +13 -7
- package/dist/mcp-store.js +12 -9
- package/dist/model-form.d.ts +3 -2
- package/dist/model-form.js +11 -7
- package/dist/model.d.ts +20 -4
- package/dist/model.js +68 -9
- package/dist/native/history.d.ts +1 -1
- package/dist/native/history.js +2 -2
- package/dist/ollama-provider.d.ts +92 -0
- package/dist/ollama-provider.js +495 -0
- package/dist/openapi/agentrun-v2.openapi.json +2 -2
- package/dist/openapi.js +127 -37
- package/dist/page.d.ts +11 -3
- package/dist/page.js +22 -7
- package/dist/place-offers.d.ts +17 -1
- package/dist/place-offers.js +46 -5
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +35 -7
- package/dist/purged-workflow.js +73 -26
- package/dist/run-computer.d.ts +2 -0
- package/dist/run-computer.js +2 -0
- package/dist/run-files.d.ts +4 -0
- package/dist/run-files.js +4 -0
- package/dist/run-keys.d.ts +2 -4
- package/dist/run-keys.js +6 -7
- package/dist/run-launch.d.ts +4 -0
- package/dist/run-launch.js +4 -0
- package/dist/run-reads-over-store.d.ts +3 -2
- package/dist/run-reads-over-store.js +66 -2
- package/dist/run-secrets.js +5 -2
- package/dist/runner/adapter-loop.d.ts +6 -3
- package/dist/runner/adapter-loop.js +34 -15
- package/dist/runner/adapter-run-spec.d.ts +3 -0
- package/dist/runner/adapter-run-spec.js +5 -3
- package/dist/runner/audit.js +8 -4
- package/dist/runner/beside.d.ts +2 -1
- package/dist/runner/beside.js +6 -2
- package/dist/runner/claim-secrets.d.ts +5 -8
- package/dist/runner/claim-secrets.js +6 -0
- package/dist/runner/cli-run-spec.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +38 -6
- package/dist/runner/harness-loops.d.ts +22 -9
- package/dist/runner/harness-loops.js +21 -11
- package/dist/runner/held.d.ts +3 -0
- package/dist/runner/learning-end.d.ts +1 -1
- package/dist/runner/learning-end.js +8 -3
- package/dist/runner/loop-contract.d.ts +5 -4
- package/dist/runner/main.js +4 -2
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +26 -2
- package/dist/runner/mcp-run.d.ts +3 -0
- package/dist/runner/mcp-run.js +2 -1
- package/dist/runner/metrics.d.ts +10 -10
- package/dist/runner/metrics.js +19 -38
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +6 -2
- package/dist/runner/promotion.d.ts +15 -9
- package/dist/runner/promotion.js +25 -15
- package/dist/runner/run-child-host.js +17 -7
- package/dist/runner/run-child.js +3 -1
- package/dist/runner/sdk-loop.js +2 -0
- package/dist/runner/workflow-loop.d.ts +2 -2
- package/dist/runner/workflow-loop.js +1 -2
- package/dist/runner/workflow-spec.d.ts +1 -1
- package/dist/runner/workflow-spec.js +6 -6
- package/dist/sdk/check.d.ts +4 -1
- package/dist/sdk/check.js +2 -1
- package/dist/sdk/runs.d.ts +2 -2
- package/dist/sdk/runs.js +8 -6
- package/dist/secret-cut.js +2 -1
- package/dist/secret-writes.d.ts +3 -2
- package/dist/secret-writes.js +1 -1
- package/dist/server.d.ts +44 -8
- package/dist/server.js +283 -108
- package/dist/standard-webhooks.d.ts +11 -0
- package/dist/standard-webhooks.js +20 -2
- package/dist/store/index.d.ts +1 -1
- package/dist/store/schema.js +5 -2
- package/dist/store/sqlite/store.js +90 -34
- package/dist/store/store.d.ts +54 -14
- package/dist/store-reads/journal.d.ts +7 -2
- package/dist/store-reads/journal.js +9 -6
- package/dist/store-reads/learning.d.ts +12 -9
- package/dist/store-reads/learning.js +18 -24
- package/dist/store-view.d.ts +0 -5
- package/dist/store-view.js +9 -8
- package/dist/template-eval.d.ts +49 -4
- package/dist/template-eval.js +168 -45
- package/dist/template-import.js +4 -2
- package/dist/templates.d.ts +5 -3
- package/dist/templates.js +19 -40
- package/dist/timeline/labels.d.ts +2 -2
- package/dist/timeline/labels.js +2 -2
- package/dist/timeline/timeline.d.ts +2 -2
- package/dist/timeline/timeline.js +1 -1
- package/dist/tool-plane.d.ts +17 -9
- package/dist/tool-plane.js +38 -17
- package/dist/tools.js +2 -2
- package/dist/trigger-launch-hook.d.ts +16 -8
- package/dist/trigger-launch-hook.js +32 -23
- package/dist/trigger-targets.d.ts +18 -8
- package/dist/trigger-targets.js +42 -19
- package/dist/triggers.d.ts +85 -23
- package/dist/triggers.js +303 -96
- package/dist/web-fake.js +3 -3
- package/dist/web-fetch-direct.d.ts +4 -0
- package/dist/web-fetch-direct.js +8 -1
- package/dist/web-fetch.d.ts +12 -3
- package/dist/web-fetch.js +47 -14
- package/dist/web-search.d.ts +33 -4
- package/dist/web-search.js +100 -41
- package/dist/webhooks.js +4 -5
- package/launcher/agentrun-serve +5 -1
- package/package.json +17 -13
- package/templates/README.md +2 -2
- package/dist/console/assets/index-B_85An2t.js +0 -745
- package/dist/console/assets/index-n1YsbnYh.css +0 -1
- package/dist/import-sources.d.ts +0 -116
- package/dist/import-sources.js +0 -693
package/dist/runner/promotion.js
CHANGED
|
@@ -56,6 +56,7 @@ import { listed } from "../learning-words.js";
|
|
|
56
56
|
import { isObject } from "../validate.js";
|
|
57
57
|
import { agentRun, lastOwnRuns, newCompileAttempt, sinceReset } from "../learn/compile.js";
|
|
58
58
|
import { checkPasses, checkShares, CHECK_TEXT_MAX, championOf, compareAnswers, comparedOf, promotionOf, promotionsOf, recordPromotion, replayingOf, skippedToolsOf } from "../learn/promote.js";
|
|
59
|
+
import { refusedIn } from "../purged-workflow.js";
|
|
59
60
|
import { sendCommand } from "./commands.js";
|
|
60
61
|
import { ClaimRefused } from "./loop-contract.js";
|
|
61
62
|
import { readSnapshot } from "../learn/folder.js";
|
|
@@ -78,6 +79,7 @@ export function claimPromotion(deps) {
|
|
|
78
79
|
...deps,
|
|
79
80
|
kept: async () => (deps.runId ? servedOf(await runEntries(deps.store, deps.runId, deps.context).catch(() => [])) : undefined),
|
|
80
81
|
champion: async (name, commit) => (await workflowsAt({ folder: deps.folder, store: deps.store, shown: deps.shown }, commit)).find((one) => one.name === name),
|
|
82
|
+
refused: refusedIn(deps.folder, deps.store, deps.log),
|
|
81
83
|
newest: async (name) => {
|
|
82
84
|
const folder = deps.folder();
|
|
83
85
|
let main;
|
|
@@ -145,7 +147,7 @@ export async function toolFlowsFor(deps, launch, laid, choice) {
|
|
|
145
147
|
continue;
|
|
146
148
|
}
|
|
147
149
|
const digest = workflowDigest(one);
|
|
148
|
-
const { champion, text } = await championTextOf(records, one, deps.champion);
|
|
150
|
+
const { champion, text } = await championTextOf(records, one, deps.champion, deps.refused);
|
|
149
151
|
if (text === one)
|
|
150
152
|
out.push(one);
|
|
151
153
|
else if (text) {
|
|
@@ -159,10 +161,11 @@ export async function toolFlowsFor(deps, launch, laid, choice) {
|
|
|
159
161
|
}
|
|
160
162
|
/** `flow`'s champion (championOf) and the text it serves from: `flow` itself when it is the champion, else the
|
|
161
163
|
* champion's text read at its record's commit (`read`), kept only when its digest is the champion's. No text: none is
|
|
162
|
-
* promoted, or its text cannot be read. The
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
* promoted, or its text cannot be read. The champion skips what `refused` says the purge gate refuses (PromotionDeps
|
|
165
|
+
* refused), so after a purge of its run the newest promotion the gate lets through serves. The one champion lookup a
|
|
166
|
+
* claim's gate (servingNow), the learned_workflow tool (toolFlowsFor) and a connected agent's start (sdk/runs.ts) share. */
|
|
167
|
+
export async function championTextOf(records, flow, read, refused) {
|
|
168
|
+
const champion = championOf(records, flow.name, refused ? await refused(records, [flow.name]) : undefined);
|
|
166
169
|
if (!champion)
|
|
167
170
|
return {};
|
|
168
171
|
if (champion.digest === workflowDigest(flow))
|
|
@@ -217,7 +220,7 @@ export const promotionGate = (deps) => {
|
|
|
217
220
|
* serves: none promoted, the champion held, or its text cannot be read (the agent takes the run). */
|
|
218
221
|
async function servingNow(deps, workflow, digest, laid) {
|
|
219
222
|
const records = await promotionsOf(deps.store.settings, deps.agentId);
|
|
220
|
-
const { champion, text } = await championTextOf(records, workflow, deps.champion);
|
|
223
|
+
const { champion, text } = await championTextOf(records, workflow, deps.champion, deps.refused);
|
|
221
224
|
const own = promotionOf(records, workflow.name, digest);
|
|
222
225
|
if (!champion) {
|
|
223
226
|
if (own?.decided === "promote")
|
|
@@ -259,7 +262,7 @@ async function holdRefused(deps, serving) {
|
|
|
259
262
|
return serving;
|
|
260
263
|
const reason = excerptShown(`${DSL_REFUSES}: ${refused}`, await deps.shown(), CHECK_TEXT_MAX);
|
|
261
264
|
const record = { workflow: name, digest, at: iso((deps.now ?? Date.now)()), decided: "hold", reason, ...(current.commit ? { commit: current.commit } : {}) };
|
|
262
|
-
const kept = await recordPromotion(deps.store.settings, deps.agentId, record, (was) => was?.decided === "promote" && was.at === current.at);
|
|
265
|
+
const kept = await recordPromotion(deps.store.settings, deps.agentId, record, (was) => was?.decided === "promote" && was.at === current.at, deps.refused);
|
|
263
266
|
if (kept.won)
|
|
264
267
|
deps.log(`workflow-first: ${name} at ${digest} is held: ${reason}; the agent's next run recompiles it once`);
|
|
265
268
|
return serving;
|
|
@@ -440,7 +443,7 @@ export const differentDecisionWords = (k, n, example) => `its answers reached a
|
|
|
440
443
|
* or its owner acts, and `extra` on the record (a connected agent's check: what its reservation carries). Kept only while
|
|
441
444
|
* `still` holds of the digest's record (the one write), and logged. */
|
|
442
445
|
async function holdUnchecked(deps, name, digest, bar, reason, still, { stopped = false, check = {}, extra = {} } = {}) {
|
|
443
|
-
const decided = await recordPromotion(deps.store.settings, deps.agentId, { workflow: name, digest, at: iso((deps.now ?? Date.now)()), decided: "hold", reason, check: { ...bar, n: 0, agreed: 0, alone: 0, of: [], ...check, ...(stopped ? { stopped: true } : {}) }, ...seedOf(deps), ...extra }, still);
|
|
446
|
+
const decided = await recordPromotion(deps.store.settings, deps.agentId, { workflow: name, digest, at: iso((deps.now ?? Date.now)()), decided: "hold", reason, check: { ...bar, n: 0, agreed: 0, alone: 0, of: [], ...check, ...(stopped ? { stopped: true } : {}) }, ...seedOf(deps), ...extra }, still, deps.refused);
|
|
444
447
|
if (decided.won)
|
|
445
448
|
deps.log(`workflow-first: ${name} at ${digest} ${stopped ? "stopped" : "held"}: ${reason}`);
|
|
446
449
|
return decided;
|
|
@@ -563,7 +566,8 @@ async function scoreRows(deps, bar, rows, before) {
|
|
|
563
566
|
/** Two outcome counts added. */
|
|
564
567
|
const outcomesAdded = (a, b) => b ? { answered: a.answered + b.answered, handed_back: a.handed_back + b.handed_back, failed: a.failed + b.failed, skipped_write: a.skipped_write + b.skipped_write } : a;
|
|
565
568
|
/** Decides a check on its rows, with a connected agent's turns checked before them (`before`), scored on its bar
|
|
566
|
-
* (scoreRows). Promoted when it clears the bar (checkPasses)
|
|
569
|
+
* (scoreRows). Promoted when it clears the bar (checkPasses) and the purge gate lets its revision through at its commit
|
|
570
|
+
* (`refused`: else held, a purged run's text); else held with the inputs it did not agree on, which the
|
|
567
571
|
* agent's next run's compile turn reads as data (its one recompile); a recompile's check that holds it too stops:
|
|
568
572
|
* nothing compiles again. No grade, refit, queue or second replay. Kept only while `still` holds of the digest's record
|
|
569
573
|
* (the one write: of two claims at once, one decides). */
|
|
@@ -604,9 +608,15 @@ export async function decideCheck(deps, name, digest, bar, read, still, extra) {
|
|
|
604
608
|
const verbatim = ok || bar.agree_on?.length ? "" : grader ? (differed > 0 ? `; ${differentDecisionWords(differed, score.alone, example)}` : "") : score.alone > 0 && score.agreed === 0 ? `; ${read.exactMismatchReason ?? NEVER_WORD_FOR_WORD}` : "";
|
|
605
609
|
const reason = ok ? `${said}: promoted` : stopped ? `${said}: held${verbatim}, and this was the recompile's check, so it stops: nothing compiles again until a hold or its owner acts` : `${said}: held${verbatim}; the agent's next run recompiles it once with the inputs it did not agree on`;
|
|
606
610
|
const check = { ...bar, ...score, ...numbers, ...(disagreements.length ? { disagreements } : {}), ...(stopped ? { stopped: true } : {}), ...(grader ? { grader } : {}) };
|
|
607
|
-
const
|
|
611
|
+
const record = { workflow: name, digest, at: iso(now()), decided: ok ? "promote" : "hold", reason, check, ...seedOf(deps), ...extra };
|
|
612
|
+
// A check that outlives its revision's run: the run's purge never stops it (it replays other runs' inputs), and the
|
|
613
|
+
// purge gate refuses the revision at the commit it was checked at (purged-workflow.ts refusedOf). It is held, never
|
|
614
|
+
// promoted, so no promotion of the purged run's text lands.
|
|
615
|
+
const gone = ok && deps.refused !== undefined && (await deps.refused([record], [name]))(record);
|
|
616
|
+
const kept = gone ? { ...record, decided: "hold", reason: `${said}: held, never promoted: a purged run wrote this revision, and its text is gone` } : record;
|
|
617
|
+
const decided = await recordPromotion(deps.store.settings, deps.agentId, kept, still, deps.refused);
|
|
608
618
|
if (decided.won)
|
|
609
|
-
deps.log(`workflow-first: ${name} at ${digest} ${
|
|
619
|
+
deps.log(`workflow-first: ${name} at ${digest} ${kept.decided === "promote" ? "promoted" : "held"}: ${kept.reason}`);
|
|
610
620
|
return decided;
|
|
611
621
|
}
|
|
612
622
|
/** Reserves a check of `workflow` at `digest` on `inputs`, then starts its runs: its replaying record names the replay
|
|
@@ -618,7 +628,7 @@ async function reserve(deps, workflow, digest, inputs, reason, still, check) {
|
|
|
618
628
|
const now = deps.now ?? Date.now;
|
|
619
629
|
const ids = inputs.map(() => uuidv7());
|
|
620
630
|
const launch = replayLaunchOf(deps);
|
|
621
|
-
const reserved = await recordPromotion(deps.store.settings, deps.agentId, { workflow: workflow.name, digest, at: iso(now()), decided: "replaying", reason, runs: ids, inputs: inputs.map((one) => one.run), replay_id: uuidv7(), launch, ...seedOf(deps), check }, (was, items) => still(was) && replayingOf(items, workflow.name, digest).length === 0);
|
|
631
|
+
const reserved = await recordPromotion(deps.store.settings, deps.agentId, { workflow: workflow.name, digest, at: iso(now()), decided: "replaying", reason, runs: ids, inputs: inputs.map((one) => one.run), replay_id: uuidv7(), launch, ...seedOf(deps), check }, (was, items) => still(was) && replayingOf(items, workflow.name, digest).length === 0, deps.refused);
|
|
622
632
|
if (reserved.won)
|
|
623
633
|
for (const [i, one] of inputs.entries())
|
|
624
634
|
await startReplay(deps, workflow, digest, one.run, one.launch, ids[i], launch);
|
|
@@ -699,7 +709,7 @@ export async function reserveSdkCheck(deps, turn) {
|
|
|
699
709
|
workflow: flow.name, digest, at: iso(now()), decided: "replaying", via: "sdk",
|
|
700
710
|
reason: `Checking it in the connected agent against an independent native turn before it can be reused: ${sdkTurnsWords(check)}.`,
|
|
701
711
|
replay_id: id, runs: [turn.runId], inputs: [turn.runId], commit: revision, check,
|
|
702
|
-
}, (was, current) => (own ? waitingSdk(was) && was.replay_id === own.replay_id : was === undefined) && blocking(current, flow.name, digest).length === 0);
|
|
712
|
+
}, (was, current) => (own ? waitingSdk(was) && was.replay_id === own.replay_id : was === undefined) && blocking(current, flow.name, digest).length === 0, deps.refused);
|
|
703
713
|
if (reserved.won)
|
|
704
714
|
return { id, revision, digest, workflow: flow };
|
|
705
715
|
}
|
|
@@ -743,7 +753,7 @@ export async function sdkCheckTurn(deps, record, row, still, read = {}) {
|
|
|
743
753
|
* as waiting: a turn's row (sdkCheckTurn) and a give-back (releaseSdkCheck). */
|
|
744
754
|
function waitAgain(deps, record, check, reason, still = () => true) {
|
|
745
755
|
const { runs: _runs, inputs: _inputs, ...rest } = record;
|
|
746
|
-
return recordPromotion(deps.store.settings, deps.agentId, { ...rest, at: iso((deps.now ?? Date.now)()), check, reason }, (was, current) => still(was, current) && sameReplay(was, record) && heldTurn(was, record) && !overtaken(current, was));
|
|
756
|
+
return recordPromotion(deps.store.settings, deps.agentId, { ...rest, at: iso((deps.now ?? Date.now)()), check, reason }, (was, current) => still(was, current) && sameReplay(was, record) && heldTurn(was, record) && !overtaken(current, was), deps.refused);
|
|
747
757
|
}
|
|
748
758
|
/** A connected agent's check whose native turn did not settle it by REPLAY_DEADLINE_MS (the backend never completed the
|
|
749
759
|
* turn, or the server stopped before the run's end): one failed row of its turns (sdkCheckTurn), as a managed check's
|
|
@@ -1052,7 +1062,7 @@ export async function askReplay(ask, name, digest, inputs) {
|
|
|
1052
1062
|
throw new ReplayRefused("conflict", PROJECT_REPLAY_REFUSED);
|
|
1053
1063
|
if (!launch.learning || launch.learning.noWorkflows)
|
|
1054
1064
|
throw new ReplayRefused("conflict", `A replay runs ${name} as a run of the agent that learns does, and the agent's runs do not take learned workflows here (its learning is off, it takes no workflows, or this server's is off).`);
|
|
1055
|
-
const deps = { store: ask.store, agentId: ask.agentId, revisionId, launch: { ...launch, learning: { ...launch.learning, seed: found.commit } }, context: ask.context, log: ask.log, shown: ask.shown, ...(ask.admitAuxiliary ? { admitAuxiliary: ask.admitAuxiliary } : {}), ...(ask.now ? { now: ask.now } : {}) };
|
|
1065
|
+
const deps = { store: ask.store, agentId: ask.agentId, revisionId, launch: { ...launch, learning: { ...launch.learning, seed: found.commit } }, context: ask.context, log: ask.log, shown: ask.shown, refused: refusedIn(ask.folder, ask.store, ask.log), ...(ask.admitAuxiliary ? { admitAuxiliary: ask.admitAuxiliary } : {}), ...(ask.now ? { now: ask.now } : {}) };
|
|
1056
1066
|
const bar = { ...loop, attempt: attemptOf(records, name, digest) };
|
|
1057
1067
|
const said = `checking it on ${plural(picked.length, "input")} of the agent's own runs, as its owner asked`;
|
|
1058
1068
|
// Kept only while the revision's newest record is still the one read here: each record write stamps a new `at`.
|
|
@@ -22,7 +22,8 @@ import { putLiveViewer, dropLiveViewer } from "../browser-live.js";
|
|
|
22
22
|
import { CALENDAR_EVENTS } from "../calendar/names.js";
|
|
23
23
|
import { openCalendar } from "../calendar/address.js";
|
|
24
24
|
import { openAccount } from "../email/account.js";
|
|
25
|
-
import { harnessOf, recipeHarness } from "../harness-table.js";
|
|
25
|
+
import { harnessOf, recipeHarness, recipeKeysOf } from "../harness-table.js";
|
|
26
|
+
import { openHarnessKeys } from "../harness-keys.js";
|
|
26
27
|
import { installDirOf, installForClaim, shareInstall } from "../harness-install.js";
|
|
27
28
|
import { loadArchilSettings } from "../archil-settings.js";
|
|
28
29
|
import { planOf } from "../chatgpt-plan.js";
|
|
@@ -31,7 +32,7 @@ import { vendorsOver } from "../sign-ins.js";
|
|
|
31
32
|
import { decisionProvidersIn, fauxFetch } from "../decisions.js";
|
|
32
33
|
import { DECISION_PROVIDER_KEYS } from "../tool-plane.js";
|
|
33
34
|
import { learningEndOfRun } from "./learning-end.js";
|
|
34
|
-
import { cutDeep,
|
|
35
|
+
import { cutDeep, runnerSecrets } from "./redact.js";
|
|
35
36
|
import { storeSecrets } from "./store-secrets.js";
|
|
36
37
|
import { FAUX_ENV, GATEWAY_KEY_ENV } from "../model.js";
|
|
37
38
|
import { SAVED_GATEWAY_ENV, savedGatewayIn } from "../model-gateway.js";
|
|
@@ -709,7 +710,7 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
709
710
|
mcp: (ask) => projectCall(async () => {
|
|
710
711
|
const reach = await mcpReachOf(deps);
|
|
711
712
|
const harness = { commit: (change) => change({ appendEntry: async (_conversation, entry) => void (await ask.appendRoot(dataOnly(entry))) }) };
|
|
712
|
-
const made = await mcpForClaim({ claim, store, sealKey, grants: granted, harness: harness, work: () => runFolder(deps.data, run.agentId, claim.runId), launchInput: launch.input, githubAppAccess: () => github(), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...reach, capped: launch.maxCostUsd !== undefined, media: { env: deps.env, web: deps.evalFakes?.(run.agentId)?.web, slots: deps.saveSlots } });
|
|
713
|
+
const made = await mcpForClaim({ claim, store, sealKey, grants: granted, harness: harness, work: () => runFolder(deps.data, run.agentId, claim.runId), launchInput: launch.input, githubAppAccess: () => github(), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}), ...(deps.composioMcpOrigin ? { composioMcpOrigin: deps.composioMcpOrigin } : {}), ...reach, capped: launch.maxCostUsd !== undefined, media: { env: deps.env, web: deps.evalFakes?.(run.agentId)?.web, slots: deps.saveSlots } });
|
|
713
714
|
if (!made)
|
|
714
715
|
return undefined;
|
|
715
716
|
releases.push(() => made.release());
|
|
@@ -770,6 +771,13 @@ export function heldFor(deps, reads, cut, log, bigs = runBigWrites()) {
|
|
|
770
771
|
serverKeyless: () => serverKeyless(keys),
|
|
771
772
|
// The zone alone, from the claim's own launch's trigger: the process never reads a trigger's row.
|
|
772
773
|
runZone: () => runZone(store, launch.inputOrigin),
|
|
774
|
+
// The keys saved for the claim's own harness alone (harness-keys.ts), whatever the process names: none unless that
|
|
775
|
+
// harness is a plan-billed recipe on this runner's table, and never another harness's.
|
|
776
|
+
harnessKeys: async () => {
|
|
777
|
+
const harness = launch.harness ?? revision.body.harness;
|
|
778
|
+
const names = harness === undefined ? undefined : recipeKeysOf(deps.env, harness);
|
|
779
|
+
return harness !== undefined && names?.length ? openHarnessKeys(store, sealKey, harness, names) : {};
|
|
780
|
+
},
|
|
773
781
|
liveViewerPut: (handover) => putLiveViewer(store, sealKey, claim, handover),
|
|
774
782
|
liveViewerDrop: (tag) => dropLiveViewer(store, claim, tag),
|
|
775
783
|
// The claim's own run, whatever the process names: its view on this runner hears the change.
|
|
@@ -1021,10 +1029,11 @@ export { RECIPE_SIGN_IN_PERSON_ONLY } from "./harness-loops.js";
|
|
|
1021
1029
|
export async function staysInRunner(deps, harness, launch, runId, isolation) {
|
|
1022
1030
|
// A recipe's harness reads its install, its check's note and its owner's sign-in, each the server user's alone: never
|
|
1023
1031
|
// opened to a slot's user (the sign-in least of all), so where each run is a user of its own it is refused here. And a
|
|
1024
|
-
// plan-billed one's run that no person started (a schedule's, a trigger's) never runs on its owner's sign-in
|
|
1032
|
+
// plan-billed one's run that no person started (a schedule's, a trigger's) never runs on its owner's sign-in: only on
|
|
1033
|
+
// keys saved for its harness.
|
|
1025
1034
|
if (isolation.kind === "uid" && recipeHarness(deps.env ?? {}, harness))
|
|
1026
1035
|
throw new ClaimRefused(RECIPE_NEEDS_SERVER_USER);
|
|
1027
|
-
refuseRecipeTriggerRun(deps
|
|
1036
|
+
await refuseRecipeTriggerRun(deps, harness, launch);
|
|
1028
1037
|
if (runsInRunner(harness, launch))
|
|
1029
1038
|
return true;
|
|
1030
1039
|
if (launch.documents !== undefined) {
|
|
@@ -1165,10 +1174,10 @@ function childLoop(options, slots, loopDeps) {
|
|
|
1165
1174
|
}
|
|
1166
1175
|
const savedGateway = savedGatewayIn(claimEnv);
|
|
1167
1176
|
// The run's own keys: those its claim opens (claim-secrets.ts), the one list its loop in this process read.
|
|
1168
|
-
const claimed = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv, redact: loopDeps.redact
|
|
1177
|
+
const claimed = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv, redact: loopDeps.redact }, revisionRow, launch, claim.runId);
|
|
1169
1178
|
// With them, its revision's own model's (a launch pinned at its start to another model, a --faux start's, is still
|
|
1170
1179
|
// handed its agent's model's key, as a run's own process was handed it before: run-secrets.ts secretsFor).
|
|
1171
|
-
const ofRevision = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv }, revisionRow, { ...(launch.plane ? { plane: launch.plane } : {}) });
|
|
1180
|
+
const ofRevision = await claimSecrets({ store: deps.store, sealKey: deps.sealKey, env: claimEnv, redact: loopDeps.redact }, revisionRow, { ...(launch.plane ? { plane: launch.plane } : {}) });
|
|
1172
1181
|
// A run that holds a model key of its own (model_key, its launch's) spends that key alone: its process is handed
|
|
1173
1182
|
// none of the server's model keys, as its spec drops them from its tools' (claim-secrets.ts withoutModelKeys).
|
|
1174
1183
|
// Copies: the runner's own reads (heldFor's `claimed`: what the run's learning must never keep) stay whole.
|
|
@@ -1277,6 +1286,7 @@ function childLoop(options, slots, loopDeps) {
|
|
|
1277
1286
|
...(deps.githubApi ? { githubApi: deps.githubApi } : {}),
|
|
1278
1287
|
...(deps.githubWeb ? { githubWeb: deps.githubWeb } : {}),
|
|
1279
1288
|
...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}),
|
|
1289
|
+
...(deps.composioMcpOrigin ? { composioMcpOrigin: deps.composioMcpOrigin } : {}),
|
|
1280
1290
|
};
|
|
1281
1291
|
const ended = channel.call("loop", "start", [init]);
|
|
1282
1292
|
// From here a command or a stop goes to the run's process, after its start on the channel.
|
package/dist/runner/run-child.js
CHANGED
|
@@ -185,6 +185,7 @@ function childDeps(init, store, journal, held) {
|
|
|
185
185
|
...(init.githubApi ? { githubApi: init.githubApi } : {}),
|
|
186
186
|
...(init.githubWeb ? { githubWeb: init.githubWeb } : {}),
|
|
187
187
|
...(init.githubMcpOrigin ? { githubMcpOrigin: init.githubMcpOrigin } : {}),
|
|
188
|
+
...(init.composioMcpOrigin ? { composioMcpOrigin: init.composioMcpOrigin } : {}),
|
|
188
189
|
...(init.mcpLoopback ? { mcpLoopback: true, mcpOwn: init.mcpOwn ?? [] } : {}),
|
|
189
190
|
};
|
|
190
191
|
}
|
|
@@ -215,7 +216,8 @@ channel.expose("loop", async (method, args) => {
|
|
|
215
216
|
live: (reader) => void (read = reader),
|
|
216
217
|
redact: heldRedactor(processSecretRedactor()),
|
|
217
218
|
};
|
|
218
|
-
|
|
219
|
+
// Its runner counted the harness's key rows before it made this process (staysInRunner): never again here.
|
|
220
|
+
loop = createDispatchLoop({ launchOf: (runId) => store.runs.launch(runId), resolve: resolveRunnerLoop(deps, { keysCounted: true }) })(loopDeps);
|
|
219
221
|
made(loop);
|
|
220
222
|
// The loop's held state and whether a plain stop keeps its computer, posted when either moved.
|
|
221
223
|
let last = "";
|
package/dist/runner/sdk-loop.js
CHANGED
|
@@ -6,6 +6,7 @@ import { BACKGROUND_CONTEXT, withAbortSignal } from "@earendil-works/chord/conte
|
|
|
6
6
|
import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
7
7
|
import { freeRequestLimitOf } from "@parcha/agentrun-kernel/kernel/cap";
|
|
8
8
|
import { learningFolderOf, secretsShown } from "../learning.js";
|
|
9
|
+
import { refusedIn } from "../purged-workflow.js";
|
|
9
10
|
import { said, STOPPED } from "../learning-words.js";
|
|
10
11
|
import { cliPolicyOf, closeSdkInbox, sdkInbox } from "../sdk/runs.js";
|
|
11
12
|
import { settleSdkCheck } from "../sdk/check.js";
|
|
@@ -103,6 +104,7 @@ export function createSdkLoop(launch, host, route) {
|
|
|
103
104
|
store: host.store, agentId: agent, launch, inbox,
|
|
104
105
|
shown: async () => secretsShown(Object.values(await storeSecrets(host.store, host.sealKey, host.data)), { local: true }),
|
|
105
106
|
log: (line) => host.log?.(line),
|
|
107
|
+
refused: refusedIn(() => learningFolderOf(host.data, agent), host.store, (line) => host.log?.(line)),
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
catch (error) {
|
|
@@ -5,7 +5,7 @@ import type { Workflow } from "@parcha/agentrun-dsl";
|
|
|
5
5
|
import { type WorkflowTaskHost } from "../workflow/task.js";
|
|
6
6
|
import { type BudgetData, type EndData } from "./journal-kinds.js";
|
|
7
7
|
import { type Claim, type Journal, type LoopFactory } from "./loop-contract.js";
|
|
8
|
-
import {
|
|
8
|
+
import type { HeldRedact } from "./redact.js";
|
|
9
9
|
/** A cap refusal, as the kernel cap hands one to parkOf/checkRaise (the loop never imports the cap; its rule is handed in
|
|
10
10
|
* via the spec, so flat or tiered pricing is the cap's, not this loop's). */
|
|
11
11
|
/** `node`: the label of the workflow node whose step the cap held (a model node's request, a call node's call, a
|
|
@@ -130,7 +130,7 @@ export declare const isWorkflowRevision: (revision: {
|
|
|
130
130
|
/** What a claim's spec is built from beside the claim: the runner's one redactor (LoopDeps.redact), which holds the keys
|
|
131
131
|
* the claim opens from the store (redact.ts holdClaimed). */
|
|
132
132
|
export interface WorkflowSpecRun {
|
|
133
|
-
readonly redact
|
|
133
|
+
readonly redact: HeldRedact;
|
|
134
134
|
/** A fresh journal of the claim, for what the spec reads from the run's records at its end (its decisions' booked
|
|
135
135
|
* cost): a fresh one, since the Harness closes its own before the end is written. */
|
|
136
136
|
readonly journal?: () => Journal;
|
|
@@ -23,7 +23,6 @@ import { createWorkflowExtension } from "../workflow/task.js";
|
|
|
23
23
|
import { readWorkflowRun, startWorkflowRevision, workflowCarry } from "../workflow-run.js";
|
|
24
24
|
import { KINDS } from "./journal-kinds.js";
|
|
25
25
|
import { stopEnd } from "./loop-contract.js";
|
|
26
|
-
import { heldRedactor } from "./redact.js";
|
|
27
26
|
import { END_PATCH_MS, END_PATCH_UNKNOWN, readAgain } from "./loop.js";
|
|
28
27
|
/** A paused run's words, its row's summary while it waits for a resume. */
|
|
29
28
|
export const PAUSED_WORDS = "Paused.";
|
|
@@ -218,7 +217,7 @@ function workflowLoop(specOf, deps) {
|
|
|
218
217
|
const parkController = new AbortController();
|
|
219
218
|
let heldRefusal;
|
|
220
219
|
const context = withAbortSignal(AbortSignal.any([deps.signal, parkController.signal]), BACKGROUND_CONTEXT);
|
|
221
|
-
spec = await specOf(claim, {
|
|
220
|
+
spec = await specOf(claim, { redact: deps.redact, journal: () => deps.journal(claim) });
|
|
222
221
|
claimNow = claim;
|
|
223
222
|
specReady();
|
|
224
223
|
const revision = { id: spec.revisionId, kind: "workflow", body: { workflow: spec.workflow, tools: [...spec.tools] } };
|
|
@@ -83,7 +83,7 @@ interface DecisionProviders {
|
|
|
83
83
|
export declare function workflowSpecOf(deps: WorkflowSpecDeps): (claim: {
|
|
84
84
|
runId: string;
|
|
85
85
|
runner?: string;
|
|
86
|
-
}, run
|
|
86
|
+
}, run: WorkflowSpecRun) => Promise<WorkflowRunSpec>;
|
|
87
87
|
/** The run's rule with a park on a refusal: `before` (runCap's one rule for the model session) is asked, and on a refusal
|
|
88
88
|
* the run parks through the loop's hook (parkOf decides room vs for good from the refusal), the same as the pi adapter's
|
|
89
89
|
* parkAtCap. It still returns the refusal, so the proxy refuses the request and the node's turn ends. */
|
|
@@ -15,7 +15,7 @@ import { defineExtension, ROOT_CONVERSATION_ID, wrapTool } from "@earendil-works
|
|
|
15
15
|
import { chargedCost, DecisionProviderError, EffectFailure, inspectWorkflow } from "@parcha/agentrun-dsl";
|
|
16
16
|
import { modelPortFor } from "@parcha/agentrun-kernel";
|
|
17
17
|
import { startModelProxy } from "@parcha/agentrun-kernel/host";
|
|
18
|
-
import { CapRefused, checkRaise, DecisionPriceUnreadable, DECISION_SESSION, followUpOf, freeCeilingMessage, freeRequestLimitOf, parkOf, runCap } from "@parcha/agentrun-kernel/kernel/cap";
|
|
18
|
+
import { CapRefused, checkRaise, DecisionPriceUnreadable, DECISION_SESSION, followUpOf, freeCeilingMessage, freeRequestLimitOf, maxRequestsOf, parkOf, runCap } from "@parcha/agentrun-kernel/kernel/cap";
|
|
19
19
|
import { completer } from "../llm.js";
|
|
20
20
|
// The decision providers' list prices, the catalog's read and the replay check (decision-cap.ts), with holdOf, which the
|
|
21
21
|
// parity tests hold this cap's figures to.
|
|
@@ -43,7 +43,7 @@ import { KINDS, NODE_LOG_SESSION, WORKFLOW_SESSION } from "./journal-kinds.js";
|
|
|
43
43
|
import { cutStrings } from "../key-refusal.js";
|
|
44
44
|
import { CLOSE_MS } from "./loop.js";
|
|
45
45
|
import { PAUSED_WORDS } from "./workflow-loop.js";
|
|
46
|
-
import {
|
|
46
|
+
import { holdClaimed } from "./redact.js";
|
|
47
47
|
import { holdStored } from "./store-secrets.js";
|
|
48
48
|
import { workflowHost } from "./workflow-host.js";
|
|
49
49
|
import { SUBMIT_TOOL } from "../workflow/host-tools.js";
|
|
@@ -140,7 +140,7 @@ export function workflowSpecOf(deps) {
|
|
|
140
140
|
const holding = async (opening) => {
|
|
141
141
|
const opened = await opening;
|
|
142
142
|
if (run?.redact)
|
|
143
|
-
holdClaimed(
|
|
143
|
+
holdClaimed(run.redact, opened);
|
|
144
144
|
return opened;
|
|
145
145
|
};
|
|
146
146
|
const claimed = await readClaim(deps, claim.runId);
|
|
@@ -153,7 +153,7 @@ export function workflowSpecOf(deps) {
|
|
|
153
153
|
throw new Error(nodeToolUnboundText(unbound));
|
|
154
154
|
// Every secret the server keeps sealed (store-secrets.ts) held by the runner's one redactor before the workflow runs.
|
|
155
155
|
if (run?.redact && deps.sealKey)
|
|
156
|
-
await holdStored(
|
|
156
|
+
await holdStored(run.redact, deps.store, deps.sealKey, deps.data);
|
|
157
157
|
const tiers = tiersOf(claimed.workflow);
|
|
158
158
|
// The run's own keys, as the server's runnable check reads them: each by its name from the runner's environment first,
|
|
159
159
|
// then the store's sealed value (claim-secrets.ts; the environment wins, rule 4), scoped to what the run needs. Its
|
|
@@ -171,7 +171,7 @@ export function workflowSpecOf(deps) {
|
|
|
171
171
|
if (keyedAtClaim(runKey))
|
|
172
172
|
withoutModelKeys(claimedEnv);
|
|
173
173
|
if (runKey && run?.redact)
|
|
174
|
-
holdRunKey(
|
|
174
|
+
holdRunKey(run.redact, runKey);
|
|
175
175
|
const providerOf = deps.providerOf ?? routeProviderOf(claimModelEnv(deps.env ?? process.env, claimedEnv, runKey, claim));
|
|
176
176
|
// Each tier's provider and cap model, resolved once; the proxies start here (before the Harness opens, since the models
|
|
177
177
|
// catalog the Harness takes points at them), their hooks deferred to the booking wired at harnessReady.
|
|
@@ -342,7 +342,7 @@ export function workflowSpecOf(deps) {
|
|
|
342
342
|
const writer = await sessions.open(SESSION);
|
|
343
343
|
// Its model nodes' requests on free models count toward the run's limit of them, capped or not. A step waiting for
|
|
344
344
|
// room under it (a map's branch, beside its siblings' holds) leaves at the run's stop or park, unsent.
|
|
345
|
-
const run = runCap({ sessions: sessions, capUsd: () => effectiveCapUsd, modelOf: capModelOf, freeRequests: freeRequestLimitOf(deps.env ?? process.env, claimed.revision.body.maxRequests), ...(context.abortSignal ? { stopped: context.abortSignal } : {}) });
|
|
345
|
+
const run = runCap({ sessions: sessions, capUsd: () => effectiveCapUsd, modelOf: capModelOf, freeRequests: freeRequestLimitOf(deps.env ?? process.env, claimed.revision.body.maxRequests), ...(maxRequestsOf(claimed.revision.body.maxRequests) === undefined ? {} : { maxRequests: maxRequestsOf(claimed.revision.body.maxRequests) }), ...(context.abortSignal ? { stopped: context.abortSignal } : {}) });
|
|
346
346
|
booking = await modelPortFor(writer, {
|
|
347
347
|
key: SESSION,
|
|
348
348
|
label: SESSION,
|
package/dist/sdk/check.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Shown } from "../learning.js";
|
|
2
|
+
import { type PromotionDeps } from "../runner/promotion.js";
|
|
2
3
|
import type { RunLaunch } from "../run-launch.js";
|
|
3
4
|
import type { Store } from "../store/store.js";
|
|
4
5
|
import type { SdkInbox } from "./runs.js";
|
|
@@ -21,7 +22,8 @@ export type SdkWorkflowCheckEvent = {
|
|
|
21
22
|
* the check (sdkCheckTurn: kept until the check holds compile_after rows, the one that makes compile_after deciding on
|
|
22
23
|
* them all); any other turn is given back (releaseSdkCheck) and the check waits for the next turn; a turn the backend
|
|
23
24
|
* never completed before its inbox expired is one failed row (sdkCheckDeadline). Exact retries and reclaims compete on
|
|
24
|
-
* the reservation.
|
|
25
|
+
* the reservation. `refused`: what the purge gate refuses of the records, so the promotions trim keeps the champion its
|
|
26
|
+
* readers serve (purged-workflow.ts refusedIn). */
|
|
25
27
|
export declare function settleSdkCheck(deps: {
|
|
26
28
|
store: Store;
|
|
27
29
|
agentId: string;
|
|
@@ -29,4 +31,5 @@ export declare function settleSdkCheck(deps: {
|
|
|
29
31
|
inbox: SdkInbox;
|
|
30
32
|
shown: () => Promise<Shown>;
|
|
31
33
|
log: (line: string) => void;
|
|
34
|
+
refused?: PromotionDeps["refused"];
|
|
32
35
|
}): Promise<import("../learn/promote.js").Recorded | undefined>;
|
package/dist/sdk/check.js
CHANGED
|
@@ -25,7 +25,8 @@ function notBaseline(inbox, reported) {
|
|
|
25
25
|
* the check (sdkCheckTurn: kept until the check holds compile_after rows, the one that makes compile_after deciding on
|
|
26
26
|
* them all); any other turn is given back (releaseSdkCheck) and the check waits for the next turn; a turn the backend
|
|
27
27
|
* never completed before its inbox expired is one failed row (sdkCheckDeadline). Exact retries and reclaims compete on
|
|
28
|
-
* the reservation.
|
|
28
|
+
* the reservation. `refused`: what the purge gate refuses of the records, so the promotions trim keeps the champion its
|
|
29
|
+
* readers serve (purged-workflow.ts refusedIn). */
|
|
29
30
|
export async function settleSdkCheck(deps) {
|
|
30
31
|
const { inbox } = deps;
|
|
31
32
|
const check = inbox.learning_check;
|
package/dist/sdk/runs.d.ts
CHANGED
|
@@ -131,8 +131,8 @@ export declare class SdkRuns {
|
|
|
131
131
|
workflows: LearnedWorkflow[];
|
|
132
132
|
};
|
|
133
133
|
}>;
|
|
134
|
-
/** The purged run (
|
|
135
|
-
*
|
|
134
|
+
/** The purged run (purgeGate) that wrote a workflow of `pinned`, each read at the learning commit a start took its
|
|
135
|
+
* text from. One read-only exec per commit. */
|
|
136
136
|
private purgedPinned;
|
|
137
137
|
/** The workflows a start delivers and the learning commit each was read at (`commits`: the seed's, or its champion
|
|
138
138
|
* record's), and the drafts a check may take. */
|
package/dist/sdk/runs.js
CHANGED
|
@@ -18,7 +18,7 @@ import { secretRedactor } from "../runner/redact.js";
|
|
|
18
18
|
import { redactedOutput } from "../key-refusal.js";
|
|
19
19
|
import { decodedStrings, draftProblems } from "../learn/workflow-draft.js";
|
|
20
20
|
import { snapshotAt } from "../learn/folder.js";
|
|
21
|
-
import { purgedRun,
|
|
21
|
+
import { purgedRun, purgeGate, refusedIn, refusedOf } from "../purged-workflow.js";
|
|
22
22
|
import { sdkWorkflowManifest, sdkDraftTools } from "./workflows.js";
|
|
23
23
|
import { promotionOf, promotionsOf, resetAtOf } from "../learn/promote.js";
|
|
24
24
|
import { championTextOf, releaseSdkCheck, reserveSdkCheck } from "../runner/promotion.js";
|
|
@@ -308,7 +308,7 @@ export class SdkRuns {
|
|
|
308
308
|
// A turn is a check only when it can be one's baseline: no protected value in its task or policy, and an input the
|
|
309
309
|
// draft takes (sdkTakes). A prose turn whose input the client cannot resolve is given back (releaseSdkCheck).
|
|
310
310
|
const takes = (flow) => !redacted && sdkTakes(flow, input, resolveSchemaForWorkflow);
|
|
311
|
-
const checkDeps = { store: this.store, agentId: entry.agent.id, log: () => { }, shown: async () => secretsShown(this.secrets(), { local: true }) };
|
|
311
|
+
const checkDeps = { store: this.store, agentId: entry.agent.id, log: () => { }, shown: async () => secretsShown(this.secrets(), { local: true }), refused: refusedIn(() => learningFolderOf(this.data, entry.agent.id), this.store) };
|
|
312
312
|
const check = learning ? await reserveSdkCheck(checkDeps, { runId, revision: learning.seed, learning: revisionBody.learning, flows: selected.candidates, takes }) : undefined;
|
|
313
313
|
// A shadow check needs the original agent's own answer, not an answer produced by its existing champion.
|
|
314
314
|
const workflows = check ? [] : selected.workflows;
|
|
@@ -407,15 +407,15 @@ export class SdkRuns {
|
|
|
407
407
|
},
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
/** The purged run (
|
|
411
|
-
*
|
|
410
|
+
/** The purged run (purgeGate) that wrote a workflow of `pinned`, each read at the learning commit a start took its
|
|
411
|
+
* text from. One read-only exec per commit. */
|
|
412
412
|
async purgedPinned(agentId, pinned) {
|
|
413
413
|
if (pinned.length === 0)
|
|
414
414
|
return undefined;
|
|
415
415
|
const folder = learningFolderOf(this.data, agentId);
|
|
416
416
|
try {
|
|
417
417
|
const reads = new Map();
|
|
418
|
-
const at = (commit) => reads.get(commit) ?? reads.set(commit, snapshotAt(folder.workspace, commit).then((snapshot) =>
|
|
418
|
+
const at = (commit) => reads.get(commit) ?? reads.set(commit, snapshotAt(folder.workspace, commit).then(async (snapshot) => (await purgeGate(snapshot, this.store)).workflows)).get(commit);
|
|
419
419
|
for (const [flow, commit] of pinned) {
|
|
420
420
|
const row = (await at(commit)).get(flow.name);
|
|
421
421
|
if (row)
|
|
@@ -447,8 +447,10 @@ export class SdkRuns {
|
|
|
447
447
|
};
|
|
448
448
|
const workflows = [], candidates = [], commits = {};
|
|
449
449
|
const atCommit = async (name, commit) => chooseWorkflows(await seedAt(folder.workspace, commit, this.store), secretsShown(this.secrets(), { local: true })).flows.find((one) => one.name === name);
|
|
450
|
+
// The champion skips a record the purge gate refuses at its commit (purged-workflow.ts refusedOf), as a claim's does.
|
|
451
|
+
const refused = async (all, names) => refusedOf(all, names ?? all.map((one) => one.workflow), folder.workspace, this.store);
|
|
450
452
|
for (const flow of flows) {
|
|
451
|
-
const { text: serving, champion } = await championTextOf(records, flow, atCommit);
|
|
453
|
+
const { text: serving, champion } = await championTextOf(records, flow, atCommit, refused);
|
|
452
454
|
if (serving && compatible(serving)) {
|
|
453
455
|
workflows.push(serving);
|
|
454
456
|
commits[serving.name] = serving === flow ? seed.sha : champion.commit;
|
package/dist/secret-cut.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// cut, for what the importer writes (a transcript can hold a key a tool printed or was given). The import adds the keys
|
|
3
3
|
// secretlint finds in what it reads (`secretsIn`): keys of a known format, whoever's they are.
|
|
4
4
|
import { lintSource } from "@secretlint/core";
|
|
5
|
+
// The recommended preset's rules, built into core since secretlint v14 (the preset's own package is deprecated).
|
|
6
|
+
import { recommendedRules as recommended } from "@secretlint/core/builtin";
|
|
5
7
|
import { secretLintProfiler } from "@secretlint/profiler";
|
|
6
|
-
import { rules as recommended } from "@secretlint/secretlint-rule-preset-recommend";
|
|
7
8
|
// No performance marks: the profiler would leave about 14 a call in the process's global buffer.
|
|
8
9
|
secretLintProfiler.setEnabled(false);
|
|
9
10
|
import { keyShaped } from "./secret-name.js";
|
package/dist/secret-writes.d.ts
CHANGED
|
@@ -63,10 +63,11 @@ export type SecretPredicate = (body: unknown) => boolean;
|
|
|
63
63
|
/** What a request is besides its body, for a predicate that must read what is stored: the route's path parameters (in
|
|
64
64
|
* the order its pattern names them) and the server's one store. `seen`: what the predicate read to let the request
|
|
65
65
|
* through, which the dispatch hands its operation, so a write allowed against one stored state is refused when that
|
|
66
|
-
* state changed before the write lands. */
|
|
66
|
+
* state changed before the write lands. `apiOnly`: the server is API-only (api-only.ts), with no owner to write one. */
|
|
67
67
|
export type SecretRequest = {
|
|
68
68
|
readonly params: readonly string[];
|
|
69
69
|
readonly store: unknown;
|
|
70
|
+
readonly apiOnly?: boolean;
|
|
70
71
|
seen?: unknown;
|
|
71
72
|
};
|
|
72
73
|
/** Whether a request writes a secret by what it would do to what is stored (drop or replace a sealed credential), read
|
|
@@ -139,7 +140,7 @@ export declare const SECRET_META_SCHEMA: {
|
|
|
139
140
|
readonly name: {
|
|
140
141
|
readonly type: "string";
|
|
141
142
|
readonly pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$";
|
|
142
|
-
readonly description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`.";
|
|
143
|
+
readonly description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, harness:<harness>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`.";
|
|
143
144
|
};
|
|
144
145
|
readonly set: {
|
|
145
146
|
readonly type: "boolean";
|
package/dist/secret-writes.js
CHANGED
|
@@ -160,7 +160,7 @@ export const SECRET_META_SCHEMA = {
|
|
|
160
160
|
required: ["name", "set", "source", "changed_at"],
|
|
161
161
|
description: "What a secret's view says of it: its name, whether it is set, where it came from, and when it last changed. Never a value, a prefix, a length or a hash.",
|
|
162
162
|
properties: {
|
|
163
|
-
name: { type: "string", pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$", description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`." },
|
|
163
|
+
name: { type: "string", pattern: "^[a-z][a-z0-9-]*(:[^:]+)+$", description: "The secret's name, \"<plane>:<id>\": a lowercase plane and the id as the plane keys it, joined with \":\": tool:<KEY_NAME>, model:<KEY_NAME>, mcp:<server> (several of one server: mcp:<server>:<field>), computer:<provider>:<KEY>, harness:<harness>:<KEY>, workspace:archil, trigger:<id>, webhook:outbound, github:app, source:<adapter>:<field>. An object holding one secret carries it as `secret`, one holding several as `secrets`." },
|
|
164
164
|
set: { type: "boolean", description: "Whether a value is set." },
|
|
165
165
|
source: { enum: ["env", "console", "sign-in", null], description: "Where it came from: env, the environment the server starts with (which always wins, by the same name, and greys the console's field); console, pasted in the console by the owner's session; sign-in, obtained by an OAuth sign-in or Connect. null when not set." },
|
|
166
166
|
changed_at: { type: ["string", "null"], format: "date-time", description: "When the credential itself last changed (pasted, signed in, rotated); null when not set or not known." },
|