@tangle-network/agent-runtime 0.320.1 → 0.321.0
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/dist/{activation-BSwcsNSQ.d.ts → activation-BxOOvwjo.d.ts} +2 -2
- package/dist/{activation-BKglRwjB.js → activation-CXFl5YVE.js} +2 -2
- package/dist/{activation-BKglRwjB.js.map → activation-CXFl5YVE.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/candidate-execution/index.js +3 -3
- package/dist/{coordination-driver-D85RWATT.js → coordination-driver-Bpn05N-Y.js} +4 -3
- package/dist/coordination-driver-Bpn05N-Y.js.map +1 -0
- package/dist/{delegate-BHRR-4hh.js → delegate-BHlcTOdK.js} +2 -2
- package/dist/{delegate-BHRR-4hh.js.map → delegate-BHlcTOdK.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +3 -3
- package/dist/{graph-BGMcJJP1.js → graph-DE2dLhDI.js} +4 -4
- package/dist/{graph-BGMcJJP1.js.map → graph-DE2dLhDI.js.map} +1 -1
- package/dist/{improvement-cycle-0cnwWPFY.js → improvement-cycle-CyChbojL.js} +5 -5
- package/dist/{improvement-cycle-0cnwWPFY.js.map → improvement-cycle-CyChbojL.js.map} +1 -1
- package/dist/{index-t672ISFX.d.ts → index-BxiHetnG.d.ts} +241 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +6 -6
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-CFudOt5T.js → loop-runner-bin-CT02Vzco.js} +3 -3
- package/dist/{loop-runner-bin-CFudOt5T.js.map → loop-runner-bin-CT02Vzco.js.map} +1 -1
- package/dist/{loop-runner-bin-Fgmf_PQU.d.ts → loop-runner-bin-DInJZNgs.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-DCfdg0UD.d.ts → openai-tools-DLTw576v.d.ts} +2 -2
- package/dist/{prepare-DjCLEN-q.js → prepare-CFQLx9e3.js} +2 -2
- package/dist/{prepare-DjCLEN-q.js.map → prepare-CFQLx9e3.js.map} +1 -1
- package/dist/{profile-DmVM4Gxb.js → profile-BTbpdL9h.js} +40 -4
- package/dist/profile-BTbpdL9h.js.map +1 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/{protected-model-port-D1fcnYdj.js → protected-model-port-f1N2f0Uq.js} +3 -3
- package/dist/{protected-model-port-D1fcnYdj.js.map → protected-model-port-f1N2f0Uq.js.map} +1 -1
- package/dist/{provision-supervisor-BUMhF1yb.js → provision-supervisor-DvgBNtoJ.js} +3 -3
- package/dist/{provision-supervisor-BUMhF1yb.js.map → provision-supervisor-DvgBNtoJ.js.map} +1 -1
- package/dist/{runtime-B47V5Omi.js → runtime-wLgjMOaj.js} +398 -10
- package/dist/runtime-wLgjMOaj.js.map +1 -0
- package/dist/{search-executor-DjKdQluM.js → search-executor-TEKWC579.js} +2 -2
- package/dist/{search-executor-DjKdQluM.js.map → search-executor-TEKWC579.js.map} +1 -1
- package/dist/{server-Gpgr0WP-.js → server-qYhzITTm.js} +3 -3
- package/dist/{server-Gpgr0WP-.js.map → server-qYhzITTm.js.map} +1 -1
- package/dist/{supervise-C2ThvLgZ.js → supervise-C4bLIU7J.js} +37 -14
- package/dist/supervise-C4bLIU7J.js.map +1 -0
- package/dist/{supervisor-CCtmmmOz.js → supervisor-bkq2b8k-.js} +383 -43
- package/dist/supervisor-bkq2b8k-.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +4 -4
- package/dist/coordination-driver-D85RWATT.js.map +0 -1
- package/dist/profile-DmVM4Gxb.js.map +0 -1
- package/dist/runtime-B47V5Omi.js.map +0 -1
- package/dist/supervise-C2ThvLgZ.js.map +0 -1
- package/dist/supervisor-CCtmmmOz.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { a as graphRunsFor, d as recordGraphRun, i as graphRegistry, l as lookupGraph, p as taskShapeDigest, r as graphFromStored, t as digestOfGraph } from "./graph-registry-BuJbzTzF.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Cn as readPromptOptions, Hn as InMemoryResultBlobStore, It as createWorktreeCliExecutor, Nt as createExecutor, Ot as verdictFromJudgeScore, Pr as contentAddress, Pt as createExecutorRegistry, Sn as assertBoxlessPromptOptions, Tn as runBrainLoop, Un as InMemorySpawnJournal, Wn as insideCursorNamespace, Xn as readCommittedJsonLines, Yn as prepareJsonlAppend, Zn as writeAllBytes, _n as runAgentRounds, aa as executableAgentSpecSnapshot, er as isTraceAnalysisStore, hn as defaultSelectWinner, ht as mapExecutorResult, ia as executableAgentProfileSnapshot, j as settledToIteration, mt as gateOnDeliverable, oa as detachedFrozen, pt as rollingDispatch, r as createSupervisor, rt as coordinationProfileToolPrefix, sa as detachedSnapshot, v as withDriverExecutor, va as notifySandboxEventObserver, vn as createSandboxLineage, vt as CheckUnavailableError, wn as routerBrain } from "./supervisor-bkq2b8k-.js";
|
|
3
3
|
import { i as ConfigError, m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
4
|
-
import { B as runAgentic, G as observe, K as renderReport, U as ObservationError, V as sample, X as strategyAuthorMethod, a as reconcileInterruptedSearchCalls, c as searchExecutor, q as profileChatClient, r as dedicatedLane, x as runtimeShipDecision, z as refine } from "./search-executor-
|
|
4
|
+
import { B as runAgentic, G as observe, K as renderReport, U as ObservationError, V as sample, X as strategyAuthorMethod, a as reconcileInterruptedSearchCalls, c as searchExecutor, q as profileChatClient, r as dedicatedLane, x as runtimeShipDecision, z as refine } from "./search-executor-TEKWC579.js";
|
|
5
5
|
import { A as markPutStreamVerified, J as fnv1a32Hex, L as immutableCandidateValue, N as canonicalCandidateDigest$1, S as captureMaterializedWorkspace, U as chargedTokens, V as addSpend, W as cloneSpend, X as isAbortError, Y as hasCompleteCacheBreakdown, Z as isAsyncIterable, et as randomSuffix, it as stringifySafe, lt as zeroSpend, q as errorMessage, rt as sleep, xt as armDeadlineTimer, y as WorkspaceScanLimitError, z as sha256Bytes$1 } from "./workspace-streams-DFAhW7hF.js";
|
|
6
|
-
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, p as canonicalObservedModelParts, t as assertExecutableAgentProfile } from "./model-policy-CNe257pB.js";
|
|
6
|
+
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, p as canonicalObservedModelParts, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CNe257pB.js";
|
|
7
7
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
8
8
|
import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction-DylCC_ot.js";
|
|
9
|
-
import { D as foldCoordinationRecords, w as createInMemoryRunContext } from "./coordination-driver-
|
|
10
|
-
import { r as supervise } from "./supervise-
|
|
9
|
+
import { D as foldCoordinationRecords, w as createInMemoryRunContext } from "./coordination-driver-Bpn05N-Y.js";
|
|
10
|
+
import { r as supervise } from "./supervise-C4bLIU7J.js";
|
|
11
11
|
import "./run-layout-DSCWdbX2.js";
|
|
12
|
-
import "./provision-supervisor-
|
|
13
|
-
import "./delegate-
|
|
14
|
-
import "./graph-
|
|
12
|
+
import "./provision-supervisor-DvgBNtoJ.js";
|
|
13
|
+
import "./delegate-BHlcTOdK.js";
|
|
14
|
+
import "./graph-DE2dLhDI.js";
|
|
15
15
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256Bytes, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
16
16
|
import { CODING_HARNESSES, DEFAULT_TRACE_ANALYST_KINDS, InMemoryTraceStore, OUTPUT_VALUE, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, createTraceAnalyst, expandProfileAxes, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
|
|
17
17
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -7539,6 +7539,394 @@ async function bestProfileFor(reg, name) {
|
|
|
7539
7539
|
} : void 0;
|
|
7540
7540
|
}
|
|
7541
7541
|
//#endregion
|
|
7542
|
+
//#region src/runtime/supervise/search-spec.ts
|
|
7543
|
+
/**
|
|
7544
|
+
* SearchSpec: one data value for a multi-agent research configuration, and the compiler that maps
|
|
7545
|
+
* it onto exactly one existing call, `supervise(profile, task, options)` or `runGraph(graph,
|
|
7546
|
+
* options)`. The design record is `docs/design/search-spec.md`.
|
|
7547
|
+
*
|
|
7548
|
+
* Nothing here runs anything. The compiler only chooses options those two calls already take, so
|
|
7549
|
+
* the control loop, the budget, the check, the continuation and the journal stay theirs. A spec is
|
|
7550
|
+
* plain data with a canonical digest; the compiled call records that digest on the run's root as
|
|
7551
|
+
* `execution.correlation.searchSpecDigest`, which the journal's root registration and the settle
|
|
7552
|
+
* record's tree both carry, so two runs can be compared as the same design on two problems.
|
|
7553
|
+
*
|
|
7554
|
+
* Every axis value compiles to an option, or to a refusal before any compute. An axis value the
|
|
7555
|
+
* compiled call would not read is refused rather than recorded, because a digest that names a knob
|
|
7556
|
+
* which changes nothing would make two different runs look like one design.
|
|
7557
|
+
*/
|
|
7558
|
+
/** The correlation key the compiled call records the spec's digest under. Runtime writes it; a
|
|
7559
|
+
* caller that supplies it is refused. */
|
|
7560
|
+
const SEARCH_SPEC_CORRELATION_KEY = "searchSpecDigest";
|
|
7561
|
+
const SPAWN_GRANT = `${coordinationProfileToolPrefix}spawn_worker`;
|
|
7562
|
+
function refuse(message) {
|
|
7563
|
+
throw new ValidationError(`SearchSpec: ${message}`);
|
|
7564
|
+
}
|
|
7565
|
+
const quoted = (values) => values.map((v) => `'${v}'`).join(", ");
|
|
7566
|
+
function record(value, where, required, optional = []) {
|
|
7567
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) refuse(`${where} must be an object`);
|
|
7568
|
+
const fields = value;
|
|
7569
|
+
const known = /* @__PURE__ */ new Set([...required, ...optional]);
|
|
7570
|
+
const unknown = Object.keys(fields).filter((key) => !known.has(key));
|
|
7571
|
+
if (unknown.length > 0) refuse(`${where} has unknown ${unknown.length === 1 ? "key" : "keys"} ${quoted(unknown)}; it takes ${quoted([...required, ...optional])}`);
|
|
7572
|
+
const missing = required.filter((key) => fields[key] === void 0);
|
|
7573
|
+
if (missing.length > 0) refuse(`${where} is missing ${quoted(missing)}`);
|
|
7574
|
+
return fields;
|
|
7575
|
+
}
|
|
7576
|
+
function oneOf(value, where, values) {
|
|
7577
|
+
if (typeof value === "string" && values.includes(value)) return value;
|
|
7578
|
+
return refuse(`${where} is ${JSON.stringify(value)}; it must be one of ${quoted(values)}`);
|
|
7579
|
+
}
|
|
7580
|
+
function names(value, where) {
|
|
7581
|
+
if (!Array.isArray(value) || value.length === 0 || !value.every((item) => typeof item === "string" && item.trim() !== "")) refuse(`${where} must be a non-empty list of non-empty strings`);
|
|
7582
|
+
const list = value;
|
|
7583
|
+
if (new Set(list).size !== list.length) refuse(`${where} lists a name twice`);
|
|
7584
|
+
return Object.freeze([...list].sort());
|
|
7585
|
+
}
|
|
7586
|
+
function integer(value, where, min) {
|
|
7587
|
+
if (!Number.isSafeInteger(value) || value < min) refuse(`${where} must be an integer >= ${min}`);
|
|
7588
|
+
return value;
|
|
7589
|
+
}
|
|
7590
|
+
/**
|
|
7591
|
+
* Check a spec and return its canonical frozen form: every axis present, no unknown key, no
|
|
7592
|
+
* contradictory pair of values. Lists are sorted, so two specs that mean the same digest the same.
|
|
7593
|
+
*/
|
|
7594
|
+
function assertSearchSpec(spec) {
|
|
7595
|
+
const axes = [
|
|
7596
|
+
"state",
|
|
7597
|
+
"context",
|
|
7598
|
+
"select",
|
|
7599
|
+
"workers",
|
|
7600
|
+
"comms",
|
|
7601
|
+
"evaluate",
|
|
7602
|
+
"stop"
|
|
7603
|
+
];
|
|
7604
|
+
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) refuse("a spec must be an object with the axes state, context, select, workers, comms, evaluate and stop");
|
|
7605
|
+
const top = spec;
|
|
7606
|
+
const unknownAxes = Object.keys(top).filter((key) => !axes.includes(key));
|
|
7607
|
+
if (unknownAxes.length > 0) refuse(`unknown axis ${quoted(unknownAxes)}; the axes are ${quoted(axes)}`);
|
|
7608
|
+
const missingAxes = axes.filter((axis) => top[axis] === void 0);
|
|
7609
|
+
if (missingAxes.length > 0) refuse(`axis ${quoted(missingAxes)} is missing`);
|
|
7610
|
+
if (top.state === "conversation") refuse("state 'conversation' is not a value: research memory that lives only in a harness conversation cannot be checkpointed, inspected or ablated; it is always harness");
|
|
7611
|
+
const state = oneOf(top.state, "state", ["harness"]);
|
|
7612
|
+
const context = oneOf(top.context, "context", ["fresh", "native"]);
|
|
7613
|
+
const select = oneOf(top.select, "select", [
|
|
7614
|
+
"lead",
|
|
7615
|
+
"advisor",
|
|
7616
|
+
"code",
|
|
7617
|
+
"self",
|
|
7618
|
+
"fixed"
|
|
7619
|
+
]);
|
|
7620
|
+
const workersIn = record(top.workers, "workers", ["count", "isolation"], ["models"]);
|
|
7621
|
+
const count = integer(workersIn.count, "workers.count", 0);
|
|
7622
|
+
const isolation = oneOf(workersIn.isolation, "workers.isolation", ["isolated", "shared"]);
|
|
7623
|
+
const models = workersIn.models === void 0 ? void 0 : names(workersIn.models, "workers.models");
|
|
7624
|
+
const comms = oneOf(top.comms, "comms", [
|
|
7625
|
+
"none",
|
|
7626
|
+
"assignments",
|
|
7627
|
+
"messages"
|
|
7628
|
+
]);
|
|
7629
|
+
const evaluateIn = record(top.evaluate, "evaluate", ["feedback", "bar"], ["analysts"]);
|
|
7630
|
+
const feedback = oneOf(evaluateIn.feedback, "evaluate.feedback", ["verbatim", "off"]);
|
|
7631
|
+
const bar = oneOf(evaluateIn.bar, "evaluate.bar", ["on", "off"]);
|
|
7632
|
+
const analysts = evaluateIn.analysts === void 0 ? void 0 : names(evaluateIn.analysts, "evaluate.analysts");
|
|
7633
|
+
const stopIn = record(top.stop, "stop", ["maxBarren"], ["plateau"]);
|
|
7634
|
+
const maxBarren = integer(stopIn.maxBarren, "stop.maxBarren", 1);
|
|
7635
|
+
let plateau;
|
|
7636
|
+
if (stopIn.plateau !== void 0) {
|
|
7637
|
+
const plateauIn = record(stopIn.plateau, "stop.plateau", ["window", "minDelta"]);
|
|
7638
|
+
const minDelta = plateauIn.minDelta;
|
|
7639
|
+
if (typeof minDelta !== "number" || !Number.isFinite(minDelta) || minDelta < 0) refuse("stop.plateau.minDelta must be a finite number >= 0");
|
|
7640
|
+
plateau = Object.freeze({
|
|
7641
|
+
window: integer(plateauIn.window, "stop.plateau.window", 1),
|
|
7642
|
+
minDelta
|
|
7643
|
+
});
|
|
7644
|
+
}
|
|
7645
|
+
if (select === "advisor" && context === "native") refuse("select 'advisor' sees each epoch only through the coordinator's projection, so it needs context 'fresh'; with 'native' its earlier turns would stay in its context");
|
|
7646
|
+
if (select === "code" && context === "fresh") refuse("select 'code' runs the root in your brain, in process; it has no harness session for context 'fresh' to renew");
|
|
7647
|
+
if (select === "advisor" && count === 0) refuse("select 'advisor' only assigns work, so workers.count must be at least 1");
|
|
7648
|
+
if (count === 0 && comms !== "none") refuse(`workers.count 0 runs the root alone, so comms must be 'none', not '${comms}'`);
|
|
7649
|
+
if (count > 0 && comms === "none") refuse(`comms 'none' leaves ${count} worker(s) with no channel; use 'assignments' or 'messages'`);
|
|
7650
|
+
if (comms === "messages" && count < 2) refuse(`comms 'messages' needs at least two peers to message each other; workers.count is ${count}`);
|
|
7651
|
+
if (select === "self" && comms !== "messages") refuse("select 'self' lets the peers divide the work by messages, so comms must be 'messages'; use select 'fixed' for independent attempts");
|
|
7652
|
+
if (count === 0 && isolation === "shared") refuse("workers.isolation 'shared' places workers in shared boxes, and workers.count is 0");
|
|
7653
|
+
if (count === 0 && models !== void 0) refuse("workers.models lists the models workers may use, and workers.count is 0");
|
|
7654
|
+
return Object.freeze({
|
|
7655
|
+
state,
|
|
7656
|
+
context,
|
|
7657
|
+
select,
|
|
7658
|
+
workers: Object.freeze({
|
|
7659
|
+
count,
|
|
7660
|
+
...models === void 0 ? {} : { models },
|
|
7661
|
+
isolation
|
|
7662
|
+
}),
|
|
7663
|
+
comms,
|
|
7664
|
+
evaluate: Object.freeze({
|
|
7665
|
+
feedback,
|
|
7666
|
+
bar,
|
|
7667
|
+
...analysts === void 0 ? {} : { analysts }
|
|
7668
|
+
}),
|
|
7669
|
+
stop: Object.freeze({
|
|
7670
|
+
maxBarren,
|
|
7671
|
+
...plateau === void 0 ? {} : { plateau }
|
|
7672
|
+
})
|
|
7673
|
+
});
|
|
7674
|
+
}
|
|
7675
|
+
/** The canonical digest of a spec: equal for two specs that mean the same, different otherwise. */
|
|
7676
|
+
function searchSpecDigest(spec) {
|
|
7677
|
+
return canonicalCandidateDigest({
|
|
7678
|
+
kind: "agent-runtime.search-spec.v1",
|
|
7679
|
+
spec: assertSearchSpec(spec)
|
|
7680
|
+
});
|
|
7681
|
+
}
|
|
7682
|
+
const presetEvaluate = Object.freeze({
|
|
7683
|
+
feedback: "verbatim",
|
|
7684
|
+
bar: "off"
|
|
7685
|
+
});
|
|
7686
|
+
const presetStop = Object.freeze({ maxBarren: 2 });
|
|
7687
|
+
/**
|
|
7688
|
+
* The five configurations Runtime ships, as specs. Each is an ordinary spec: its digest is its
|
|
7689
|
+
* value's, and a consumer that changes any axis passes an inline spec with its own digest.
|
|
7690
|
+
*/
|
|
7691
|
+
const searchPresets = Object.freeze({
|
|
7692
|
+
/** One root alone in one session. */
|
|
7693
|
+
solo: () => assertSearchSpec({
|
|
7694
|
+
state: "harness",
|
|
7695
|
+
context: "native",
|
|
7696
|
+
select: "lead",
|
|
7697
|
+
workers: {
|
|
7698
|
+
count: 0,
|
|
7699
|
+
isolation: "isolated"
|
|
7700
|
+
},
|
|
7701
|
+
comms: "none",
|
|
7702
|
+
evaluate: presetEvaluate,
|
|
7703
|
+
stop: presetStop
|
|
7704
|
+
}),
|
|
7705
|
+
/** A doing lead with up to `width` workers at once, each in its own environment; any of them
|
|
7706
|
+
* may lead its own team within the same bound. */
|
|
7707
|
+
tree: (width) => assertSearchSpec({
|
|
7708
|
+
state: "harness",
|
|
7709
|
+
context: "native",
|
|
7710
|
+
select: "lead",
|
|
7711
|
+
workers: {
|
|
7712
|
+
count: width,
|
|
7713
|
+
isolation: "isolated"
|
|
7714
|
+
},
|
|
7715
|
+
comms: "assignments",
|
|
7716
|
+
evaluate: presetEvaluate,
|
|
7717
|
+
stop: presetStop
|
|
7718
|
+
}),
|
|
7719
|
+
/** A doing lead with up to `width` workers at once that may share boxes. */
|
|
7720
|
+
swarm: (width) => assertSearchSpec({
|
|
7721
|
+
state: "harness",
|
|
7722
|
+
context: "native",
|
|
7723
|
+
select: "lead",
|
|
7724
|
+
workers: {
|
|
7725
|
+
count: width,
|
|
7726
|
+
isolation: "shared"
|
|
7727
|
+
},
|
|
7728
|
+
comms: "assignments",
|
|
7729
|
+
evaluate: presetEvaluate,
|
|
7730
|
+
stop: presetStop
|
|
7731
|
+
}),
|
|
7732
|
+
/** `count` peers started by a convener, dividing the work by peer mail. */
|
|
7733
|
+
peers: (count) => assertSearchSpec({
|
|
7734
|
+
state: "harness",
|
|
7735
|
+
context: "native",
|
|
7736
|
+
select: "self",
|
|
7737
|
+
workers: {
|
|
7738
|
+
count,
|
|
7739
|
+
isolation: "isolated"
|
|
7740
|
+
},
|
|
7741
|
+
comms: "messages",
|
|
7742
|
+
evaluate: presetEvaluate,
|
|
7743
|
+
stop: presetStop
|
|
7744
|
+
}),
|
|
7745
|
+
/** Stateless Language Agents (arXiv 2610.07625): an assign-only advisor re-entered fresh every
|
|
7746
|
+
* epoch from the coordinator's projection, over `width` isolated leaf workers. */
|
|
7747
|
+
sla: (width) => assertSearchSpec({
|
|
7748
|
+
state: "harness",
|
|
7749
|
+
context: "fresh",
|
|
7750
|
+
select: "advisor",
|
|
7751
|
+
workers: {
|
|
7752
|
+
count: width,
|
|
7753
|
+
isolation: "isolated"
|
|
7754
|
+
},
|
|
7755
|
+
comms: "assignments",
|
|
7756
|
+
evaluate: presetEvaluate,
|
|
7757
|
+
stop: presetStop
|
|
7758
|
+
})
|
|
7759
|
+
});
|
|
7760
|
+
/** The `SuperviseOptions` an axis decides. A caller value for one is refused, naming the axis. */
|
|
7761
|
+
const ownedBy = Object.freeze({
|
|
7762
|
+
budget: "inputs.budget",
|
|
7763
|
+
deliverable: "inputs.deliverable",
|
|
7764
|
+
continuation: "context, evaluate, stop and inputs.continuation",
|
|
7765
|
+
workerSlots: "workers.count",
|
|
7766
|
+
allowedModels: "workers.models",
|
|
7767
|
+
peerMail: "comms 'messages'",
|
|
7768
|
+
analysts: "inputs.analysts",
|
|
7769
|
+
analyzeOnSettle: "evaluate.analysts",
|
|
7770
|
+
stopRule: "stop.plateau",
|
|
7771
|
+
maxDepth: "select 'advisor'",
|
|
7772
|
+
inheritSpawnRights: "select 'advisor'"
|
|
7773
|
+
});
|
|
7774
|
+
function grantsSpawn(profile) {
|
|
7775
|
+
return profile.tools?.[SPAWN_GRANT] === true;
|
|
7776
|
+
}
|
|
7777
|
+
function profileTable(entries) {
|
|
7778
|
+
const table = /* @__PURE__ */ new Map();
|
|
7779
|
+
for (const item of entries) {
|
|
7780
|
+
const entry = "profile" in item ? item : { profile: item };
|
|
7781
|
+
const name = entry.profile.name;
|
|
7782
|
+
if (typeof name !== "string" || name.trim() === "") refuse("every profile in inputs.workers needs a name, which the root spawns it by");
|
|
7783
|
+
if (table.has(name)) refuse(`inputs.workers names profile '${name}' twice`);
|
|
7784
|
+
table.set(name, entry);
|
|
7785
|
+
}
|
|
7786
|
+
const listed = Object.freeze([...table.keys()]);
|
|
7787
|
+
return Object.freeze({
|
|
7788
|
+
resolve: (name) => table.get(name),
|
|
7789
|
+
names: () => listed
|
|
7790
|
+
});
|
|
7791
|
+
}
|
|
7792
|
+
/** The worker backend with the spec's placement, refusing a placement the spec contradicts. */
|
|
7793
|
+
function placedBackend(spec, inputs) {
|
|
7794
|
+
const backend = inputs.options?.backend;
|
|
7795
|
+
const sharedAlready = backend?.backend === "provider" && backend.shared !== void 0;
|
|
7796
|
+
if (spec.workers.isolation === "isolated") {
|
|
7797
|
+
if (inputs.sharedPlacement !== void 0 || sharedAlready) refuse("workers.isolation 'isolated' gives every worker its own environment; drop the shared placement or use isolation 'shared'");
|
|
7798
|
+
return backend;
|
|
7799
|
+
}
|
|
7800
|
+
if (inputs.sharedPlacement === void 0) return backend;
|
|
7801
|
+
if (backend?.backend !== "provider") refuse(`inputs.sharedPlacement places workers through a 'provider' backend; options.backend is ${backend === void 0 ? "absent" : `'${backend.backend}'`}`);
|
|
7802
|
+
if (sharedAlready) refuse("options.backend already carries a shared placement; pass it once");
|
|
7803
|
+
return Object.freeze({
|
|
7804
|
+
...backend,
|
|
7805
|
+
shared: inputs.sharedPlacement
|
|
7806
|
+
});
|
|
7807
|
+
}
|
|
7808
|
+
/** The one root of a graph: the node that delegates and is never delegated to. */
|
|
7809
|
+
function graphRoot(graph) {
|
|
7810
|
+
const delegates = graph.edges.filter((edge) => edge.kind === "delegates");
|
|
7811
|
+
const targets = new Set(delegates.map((edge) => edge.to));
|
|
7812
|
+
const roots = [...new Set(delegates.map((edge) => edge.from))].filter((id) => !targets.has(id));
|
|
7813
|
+
return roots.length === 1 ? graph.nodes.find((node) => node.id === roots[0])?.profile : void 0;
|
|
7814
|
+
}
|
|
7815
|
+
/**
|
|
7816
|
+
* Compile a spec onto exactly one existing call. Every refusal names the axis or input and what
|
|
7817
|
+
* would have gone wrong, and happens before any compute.
|
|
7818
|
+
*
|
|
7819
|
+
* ```ts
|
|
7820
|
+
* const compiled = compileSearchSpec(searchPresets.sla(3), { profile, task, budget, deliverable,
|
|
7821
|
+
* deadline, continuation: { profile: words }, workers, options: { backend, coordination, runDir } })
|
|
7822
|
+
* const result = compiled.call === 'supervise'
|
|
7823
|
+
* ? await supervise(compiled.profile, compiled.task, compiled.options)
|
|
7824
|
+
* : (await runGraph(compiled.graph, compiled.options)).result
|
|
7825
|
+
* ```
|
|
7826
|
+
*/
|
|
7827
|
+
function compileSearchSpec(raw, inputs) {
|
|
7828
|
+
const spec = assertSearchSpec(raw);
|
|
7829
|
+
const digest = searchSpecDigest(spec);
|
|
7830
|
+
const passed = inputs.options ?? {};
|
|
7831
|
+
for (const [key, axis] of Object.entries(ownedBy)) if (passed[key] !== void 0) refuse(`options.${key} is decided by ${axis}; change the spec or that input instead`);
|
|
7832
|
+
if (inputs.deliverable === void 0) refuse("inputs.deliverable is required: a spec run is sent back by its check");
|
|
7833
|
+
const correlation = passed.execution?.correlation ?? {};
|
|
7834
|
+
if (Object.hasOwn(correlation, "searchSpecDigest")) refuse(`options.execution.correlation cannot set ${SEARCH_SPEC_CORRELATION_KEY}; Runtime records it`);
|
|
7835
|
+
const execution = Object.freeze({
|
|
7836
|
+
...passed.execution,
|
|
7837
|
+
correlation: Object.freeze({
|
|
7838
|
+
...correlation,
|
|
7839
|
+
[SEARCH_SPEC_CORRELATION_KEY]: digest
|
|
7840
|
+
})
|
|
7841
|
+
});
|
|
7842
|
+
const continuation = {
|
|
7843
|
+
deadline: inputs.deadline,
|
|
7844
|
+
maxBarren: spec.stop.maxBarren,
|
|
7845
|
+
profile: inputs.continuation.profile,
|
|
7846
|
+
failures: spec.evaluate.feedback,
|
|
7847
|
+
panel: "off",
|
|
7848
|
+
bar: spec.evaluate.bar,
|
|
7849
|
+
session: spec.context,
|
|
7850
|
+
...inputs.continuation.reference === void 0 ? {} : { reference: inputs.continuation.reference },
|
|
7851
|
+
...inputs.continuation.append === void 0 ? {} : { append: inputs.continuation.append }
|
|
7852
|
+
};
|
|
7853
|
+
const backend = placedBackend(spec, inputs);
|
|
7854
|
+
const callerOwnsLeaves = passed.makeLeafAgent !== void 0 || passed.makeWorkerAgent !== void 0;
|
|
7855
|
+
if (spec.comms === "messages" && backend !== void 0 && backend.backend !== "bridge" && !callerOwnsLeaves) refuse(`comms 'messages' needs workers that can call peer mail: Runtime mounts it on 'bridge' workers, and '${backend.backend}' workers run no client for it. Run the workers on a bridge, or mount WorkerSpawnContext.peerMailUrl through makeLeafAgent`);
|
|
7856
|
+
const analystKinds = spec.evaluate.analysts ?? [];
|
|
7857
|
+
if (analystKinds.length > 0 && inputs.analysts === void 0) refuse("evaluate.analysts names analyst kinds, and inputs.analysts holds no registry to run them");
|
|
7858
|
+
const axisOptions = {
|
|
7859
|
+
continuation,
|
|
7860
|
+
execution,
|
|
7861
|
+
...spec.workers.count > 0 ? { workerSlots: spec.workers.count } : {},
|
|
7862
|
+
...spec.workers.models === void 0 ? {} : { allowedModels: spec.workers.models },
|
|
7863
|
+
...spec.comms === "messages" ? { peerMail: true } : {},
|
|
7864
|
+
...spec.stop.plateau === void 0 ? {} : { stopRule: { plateau: spec.stop.plateau } },
|
|
7865
|
+
...backend === void 0 ? {} : { backend }
|
|
7866
|
+
};
|
|
7867
|
+
if (spec.select === "code" || spec.select === "fixed") {
|
|
7868
|
+
const graph = inputs.graph ?? refuse(`select '${spec.select}' needs inputs.graph`);
|
|
7869
|
+
if (inputs.profile !== void 0 || inputs.task !== void 0) refuse(`select '${spec.select}' runs inputs.graph, whose root is its own node and whose task is the deliverable's description; drop inputs.profile and inputs.task`);
|
|
7870
|
+
if (inputs.workers !== void 0) refuse(`select '${spec.select}' spawns the graph's nodes; drop inputs.workers`);
|
|
7871
|
+
if (analystKinds.length > 0) refuse(`select '${spec.select}' declares a graph's analysts as analyzes edges, not evaluate.analysts`);
|
|
7872
|
+
if (spec.workers.count === 0) refuse(`select '${spec.select}' runs a graph's worker nodes, so workers.count must be at least 1`);
|
|
7873
|
+
if (spec.select === "code" && inputs.brain === void 0) refuse("select 'code' needs inputs.brain, the caller's brain that drives the root");
|
|
7874
|
+
if (spec.select === "fixed" && inputs.brain !== void 0) refuse("select 'fixed' runs the graph's root profile; a brain is select 'code'");
|
|
7875
|
+
if (passed.registry !== void 0) refuse("options.registry is supervise's name table, which a graph cannot read; pass the graph's directive registry as inputs.directives");
|
|
7876
|
+
if (spec.context === "fresh" && !harnessRunsAgent(graphRoot(graph)?.harness)) refuse("context 'fresh' renews an external harness root's session at each re-entry, and the graph's root runs on the router brain");
|
|
7877
|
+
return Object.freeze({
|
|
7878
|
+
call: "runGraph",
|
|
7879
|
+
spec,
|
|
7880
|
+
digest,
|
|
7881
|
+
graph: Object.freeze({
|
|
7882
|
+
nodes: graph.nodes,
|
|
7883
|
+
edges: graph.edges,
|
|
7884
|
+
deliverable: inputs.deliverable,
|
|
7885
|
+
budget: inputs.budget
|
|
7886
|
+
}),
|
|
7887
|
+
options: Object.freeze({
|
|
7888
|
+
...passed,
|
|
7889
|
+
...axisOptions,
|
|
7890
|
+
...inputs.brain === void 0 ? {} : { brain: inputs.brain },
|
|
7891
|
+
...inputs.analysts === void 0 ? {} : { analysts: inputs.analysts },
|
|
7892
|
+
...inputs.directives === void 0 ? {} : { registry: inputs.directives }
|
|
7893
|
+
})
|
|
7894
|
+
});
|
|
7895
|
+
}
|
|
7896
|
+
const profile = inputs.profile ?? refuse(`select '${spec.select}' needs inputs.profile, the root`);
|
|
7897
|
+
if (inputs.task === void 0) refuse(`select '${spec.select}' needs inputs.task`);
|
|
7898
|
+
if (inputs.graph !== void 0 || inputs.brain !== void 0 || inputs.directives !== void 0) refuse(`select '${spec.select}' runs inputs.profile; a graph, brain or directives is select 'code' or 'fixed'`);
|
|
7899
|
+
if (!harnessRunsAgent(profile.harness)) refuse(`select '${spec.select}' runs the root under Runtime's continuation (context, evaluate and stop), which drives an external harness; profile '${profile.name}' runs on the router brain. Give it a harness such as claude-code or codex, or use select 'code'`);
|
|
7900
|
+
if (spec.workers.count === 0 && grantsSpawn(profile)) refuse(`workers.count 0 runs the root alone, but profile '${profile.name}' grants ${SPAWN_GRANT}`);
|
|
7901
|
+
if (spec.workers.count > 0 && !grantsSpawn(profile)) refuse(`workers.count ${spec.workers.count} needs a root that spawns, and profile '${profile.name}' does not grant ${SPAWN_GRANT}`);
|
|
7902
|
+
if (spec.select === "self" && inputs.workers?.length !== spec.workers.count) refuse(`select 'self' starts exactly workers.count peers; inputs.workers holds ${inputs.workers?.length ?? 0}, and workers.count is ${spec.workers.count}`);
|
|
7903
|
+
if (inputs.workers !== void 0 && passed.registry?.profiles !== void 0) refuse("inputs.workers and options.registry.profiles both name spawnable profiles; pass them once");
|
|
7904
|
+
const registry = inputs.workers === void 0 ? passed.registry : Object.freeze({
|
|
7905
|
+
...passed.registry,
|
|
7906
|
+
profiles: profileTable(inputs.workers)
|
|
7907
|
+
});
|
|
7908
|
+
return Object.freeze({
|
|
7909
|
+
call: "supervise",
|
|
7910
|
+
spec,
|
|
7911
|
+
digest,
|
|
7912
|
+
profile,
|
|
7913
|
+
task: inputs.task,
|
|
7914
|
+
options: Object.freeze({
|
|
7915
|
+
...passed,
|
|
7916
|
+
...axisOptions,
|
|
7917
|
+
budget: inputs.budget,
|
|
7918
|
+
deliverable: inputs.deliverable,
|
|
7919
|
+
...registry === void 0 ? {} : { registry },
|
|
7920
|
+
...inputs.analysts === void 0 ? {} : { analysts: inputs.analysts },
|
|
7921
|
+
...analystKinds.length > 0 ? { analyzeOnSettle: analystKinds } : {},
|
|
7922
|
+
...spec.select === "advisor" ? {
|
|
7923
|
+
maxDepth: 1,
|
|
7924
|
+
inheritSpawnRights: false
|
|
7925
|
+
} : {}
|
|
7926
|
+
})
|
|
7927
|
+
});
|
|
7928
|
+
}
|
|
7929
|
+
//#endregion
|
|
7542
7930
|
//#region src/runtime/supervise/sql-run-context.ts
|
|
7543
7931
|
/**
|
|
7544
7932
|
* A cross-machine run context on the existing autocommit SqlAdapter. Reuse the same database,
|
|
@@ -8824,6 +9212,6 @@ function tail(s) {
|
|
|
8824
9212
|
return s.slice(-400);
|
|
8825
9213
|
}
|
|
8826
9214
|
//#endregion
|
|
8827
|
-
export {
|
|
9215
|
+
export { createPrivateCasArtifactPort as $, connectStdioMcp as $t, bestProfileFor as A, loopCampaignDispatch as At, chatWorkerSeam as B, completionAuthorizes as Bt, analyzeTrace as C, inProcessSandboxClient as Ct, compileSearchSpec as D, resolveSandboxClient as Dt, assertSearchSpec as E, defineLeaderboard as Et, recordProfileRun as F, declaredCheckDeliverable as Ft, authorStrategy as G, pairwiseSignificance as Gt, runStrategyEvolution as H, sentinelCompletion as Ht, patchDelivered as I, declaredCheckDigest as It, SandboxRunAbortError as J, renderLeaderboardSvg as Jt, strategyAuthorContract as K, renderLeaderboardHtml as Kt, runCoderChecks as L, declaredCheckJudge as Lt, pickBestProfile as M, superviseDispatch as Mt, profileRegistry as N, assertDeclaredCheck as Nt, searchPresets as O, localSandboxClient as Ot, profileRunsForName as P, checkProgramDigest as Pt, runBenchmark as Q, McpSpawnFault as Qt, graphDesignerExtraTools as R, readDeclaredCheck as Rt, withUntrackedArtifacts as S, observationFromRegistry as St, SEARCH_SPEC_CORRELATION_KEY as T, harvestCorpus as Tt, strategyTournament as U, stopSentinel as Ut, createChatSessionStore as V, deterministicCompletion as Vt, assertStrategyContract as W, leaderboard as Wt, createS3PrivateCasStore as X, SqlRunOwnershipError as Xt, openSandboxRun as Y, renderPairwiseMarkdown as Yt, printBenchmarkReport as Z, openSqlRunStore as Zt, VERIFY_TAIL_CHARS as _, widen as _t, localShell as a, resolveMcpServerLaunch as an, createShapeRegistry as at, settledWorkerOut as b, createScopeAnalyst as bt, createVerifierEnvironment as c, createTangleSandboxExactProcessProvider as cn, InMemoryCorpus as ct, harvestSurfaceDiffs as d, flatWidenGate as dt, materializeLocalMcp as en, equalKOnCost as et, analystsFromRegistry as f, loopUntil as ft, NOTE_MAX_CHARS as g, verify as gt, EVIDENCE_MAX_CHARS as h, selectValidWinner as ht, jjWorkspace as i, mcpSecretEnvMetadataKey as in, builtinShapes as it, loadProfile as j, loopDispatch as jt, searchSpecDigest as k, inlineSandboxClient as kt, boxSurfaceReader as l, renderCorpusToInstructions as lt, worktreeFanout as m, pipeline as mt, makeFinding$1 as n, sanitizeMcpToolSchema as nn, definePersona as nt, runInWorkspace as o, resolveSecretEnv as on, registerShape as ot, failuresAnalyst as p, panel as pt, strategyAuthorSystemPrompt as q, renderLeaderboardMarkdown as qt, gitWorkspace as r, envKeyProvider as rn, runPersonified as rt, createWaterfallCollector as s, secretEnvOfMcpServer as sn, FileCorpus as st, computeFindingId$1 as t, createMcpEnvironment as tn, trajectoryReport as tt, fsSurfaceReader as u, fanout as ut, closingWorkerNote as v, assertTraceDerivedFindings as vt, createFencedSqlRunContext as w, HarvestError as wt, copyUntrackedIntoClone as x, registryScopeAnalyst as xt, composeWorkerEvidence as y, buildSteerContext as yt, chatTransportExecutor as z, runIsolatedCheck as zt };
|
|
8828
9216
|
|
|
8829
|
-
//# sourceMappingURL=runtime-
|
|
9217
|
+
//# sourceMappingURL=runtime-wLgjMOaj.js.map
|