@tangle-network/agent-runtime 0.264.0 → 0.271.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-Bx4kfVU3.d.ts → activation-BrJmwTLB.d.ts} +4 -4
- package/dist/{activation-DHFdvps3.js → activation-DGbFPGR3.js} +2 -2
- package/dist/{activation-DHFdvps3.js.map → activation-DGbFPGR3.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-Bz-H17bC.js → coordination-driver-iBGMKDvB.js} +90 -50
- package/dist/coordination-driver-iBGMKDvB.js.map +1 -0
- package/dist/{delegate-CwbWhX5W.js → delegate-DOqUvaIz.js} +3 -3
- package/dist/delegate-DOqUvaIz.js.map +1 -0
- package/dist/durable.d.ts +5 -4
- package/dist/durable.js +3 -3
- package/dist/durable.js.map +1 -1
- package/dist/{graph-5NrpTg0h.js → graph-DnMcepkN.js} +12 -7
- package/dist/graph-DnMcepkN.js.map +1 -0
- package/dist/{improvement-cycle-WRWcFyuO.js → improvement-cycle-1IyRJo5h.js} +9 -9
- package/dist/improvement-cycle-1IyRJo5h.js.map +1 -0
- package/dist/{index-9wXpbjbX.d.ts → index-CL1dduJd.d.ts} +123 -73
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +9 -3
- package/dist/intelligence.js +11 -5
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-DC1Lm0nM.js → loop-runner-bin-BPZ9tt1W.js} +3 -3
- package/dist/{loop-runner-bin-DC1Lm0nM.js.map → loop-runner-bin-BPZ9tt1W.js.map} +1 -1
- package/dist/{loop-runner-bin-DPewOZMn.d.ts → loop-runner-bin-O_vM1w8Y.d.ts} +3 -3
- 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 +12 -6
- package/dist/mcp/index.js +7 -7
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/{memory-server-Cn8LbAxO.js → memory-server-DXQ8IxGR.js} +2 -2
- package/dist/{memory-server-Cn8LbAxO.js.map → memory-server-DXQ8IxGR.js.map} +1 -1
- package/dist/{openai-tools-ByTMUJcD.d.ts → openai-tools-DWHxpwx2.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-BZ6_uBGR.js → provision-supervisor-Cy8pqE95.js} +4 -4
- package/dist/{provision-supervisor-BZ6_uBGR.js.map → provision-supervisor-Cy8pqE95.js.map} +1 -1
- package/dist/{runtime-CUZC75EX.js → runtime-DVjIH1eo.js} +1160 -18
- package/dist/runtime-DVjIH1eo.js.map +1 -0
- package/dist/{server-KpdpN627.js → server-CN9vzbSe.js} +4 -4
- package/dist/{server-KpdpN627.js.map → server-CN9vzbSe.js.map} +1 -1
- package/dist/{stream-agent-turn-D1zelVx6.d.ts → stream-agent-turn-DbEsKgb_.d.ts} +200 -3
- package/dist/{structural-rollout-D17I5CwF.js → structural-rollout-I92sIfNl.js} +2 -2
- package/dist/{structural-rollout-D17I5CwF.js.map → structural-rollout-I92sIfNl.js.map} +1 -1
- package/dist/{substrate-qQphD9f0.d.ts → substrate-CbC03Vzo.d.ts} +2 -2
- package/dist/{supervise-_DTVHXPC.js → supervise-DJ_1i9vj.js} +85 -30
- package/dist/supervise-DJ_1i9vj.js.map +1 -0
- package/dist/{supervisor-C26k7X5-.js → supervisor-Cvd5mf7x.js} +1276 -488
- package/dist/supervisor-Cvd5mf7x.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +14 -14
- package/dist/testing.js.map +1 -1
- package/dist/{tool-server-x9NEhvHZ.js → tool-server-Dqer2M4_.js} +30 -12
- package/dist/tool-server-Dqer2M4_.js.map +1 -0
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-BV14WTyW.d.ts → types-Bo7z5aG5.d.ts} +311 -75
- package/package.json +3 -2
- package/dist/coordination-driver-Bz-H17bC.js.map +0 -1
- package/dist/delegate-CwbWhX5W.js.map +0 -1
- package/dist/graph-5NrpTg0h.js.map +0 -1
- package/dist/improvement-cycle-WRWcFyuO.js.map +0 -1
- package/dist/runtime-CUZC75EX.js.map +0 -1
- package/dist/supervise-_DTVHXPC.js.map +0 -1
- package/dist/supervisor-C26k7X5-.js.map +0 -1
- package/dist/tool-server-x9NEhvHZ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ii as Driver, Pi as AgentRunSpec, ca as Validator, ra as OutputAdapter } from "./types-Bo7z5aG5.js";
|
|
2
2
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
3
3
|
//#region src/profiles/coder.d.ts
|
|
4
4
|
/**
|
|
@@ -281,4 +281,4 @@ interface UiFinding {
|
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
export { CoderTask as _, UiFindingSeverity as a, KnowledgeUpdate as c, ResearchSource as d, ResearchTask as f, researcherProfile as g, multiHarnessResearcherFanout as h, UiFindingScreenshot as i, MultiHarnessResearcherFanoutOptions as l, createResearcherValidator as m, UI_LENSES as n, UiLens as o, ResearcherProfileOptions as p, UiFinding as r, KnowledgeItem as s, UI_FINDING_SEVERITIES as t, ResearchOutput as u, coderTaskToPrompt as v };
|
|
284
|
-
//# sourceMappingURL=substrate-
|
|
284
|
+
//# sourceMappingURL=substrate-CbC03Vzo.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $r as controlProfileMaterialization, A as restoreScopeOwnerAcceptedExecution, Ai as runtimeOwnedExecutorMaterialization, B as bindScopeRetainedOwnerEnvironmentId, C as beginScopeOwnerAttempt, Ca as teardownExecutor, D as meterRuntimeOwnedProviderAttempt, Di as recordRuntimeOwnedDriveHarnessProviderEvidence, E as meterRuntimeOwnedAccounting, Ei as providerAttemptEvidence, G as scopeRetainedOwnerContext, Gt as newUsageTotals, H as consumeScopeRetainedOwnerResult, Hn as resolveAgentEnvironmentProvider, Ht as assertValidBudget, J as scopeRetainedOwnerResult, Jt as WORKER_TRACE_PROPAGATION, K as scopeRetainedOwnerPriorSpend, Mi as runtimeOwnedPendingExecutorMaterialization, Mr as toOtelAttributes, Ni as runtimeOwnedScopeOwnerRuntime, Nn as routerBrain, O as recordScopeOwnerMaterialization, Oi as runtimeOwnedDriveHarnessProviderEvidence, Or as generateSpanId, Qr as assertProfileMaterialization, S as assertRecursiveReservationPolicy, Si as inheritRuntimeOwnedExecutorAttestation, Sn as bridgeStopSignalKey, T as deriveNodeExecutionIdentity, Tr as createOtelExporter, U as prepareScopeRetainedOwnerTask, V as bindScopeRetainedOwnerProvider, W as reconcileScopeRetainedOwnerEnvironment, Wt as meterUsageEvent, Xn as retainedExecutorSeamKey, Yn as registerRetainedExecutorPreparation, Zn as errMessage, _ as driverChild, _a as withBudgetResources, ar as RunCancellationReason, c as runTree, ca as sleep, ci as renderUnsupported, cr as runAbortable, d as HarnessTurnFailedError, ea as addSpend, ei as defineProfileMaterializationContract, fa as unmeteredSpend, fi as worktreeCliProfileMaterialization, ft as bindReusableExecutorExecutionId, ga as resourceTelemetry, gi as readCommittedJsonLines, gn as bridgeModelRouteRefusal, gt as createExecutor, h as summarizeDriverAttempts, ha as addResourceSpend, hi as prepareJsonlAppend, hn as bridgeAdmissionRefusal, hr as contentAddress, i as bestDelivered, ii as promptModelProfileMaterialization, j as scopeOwnerExecutorNodeContext, ji as runtimeOwnedExecutorProviderEvidence, k as recordScopeOwnerPause, ki as runtimeOwnedExecutorExecutionBinding, m as runDriverWithRetry, ma as zeroSpend, mn as executorFailure, n as createRootHandle, ni as profileMaterializationAxes$1, p as defaultUnmetContractSteer, pa as withTimeout, pi as isNoEntError, pt as captureReusableExecutorConfig, q as scopeRetainedOwnerResourceReader, qt as spendFromUsageTotals, r as createSupervisor, ri as promptControlProfileMaterialization, rn as createInbox, s as runFinalizer, sr as linkAbort, ti as fullProfileMaterialization, ui as unsupportedProfileDimensions, v as driverExecutorFactory, vt as snapshotExecutorConfig, wa as teardownSurfaces, xa as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, xn as bridgeRuntimeAttachmentsKey, y as isDriverSpec, yi as attestRuntimeOwnedScopeOwner, zi as detachedSnapshot } from "./supervisor-Cvd5mf7x.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
3
|
import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, f as harnessRunsAgent, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-BbSCSak0.js";
|
|
4
4
|
import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
5
5
|
import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
6
|
+
import { D as coordinationVerbNames, S as watchRunCancellation, c as createProgressTracker, d as progressStop, k as createCoordinationToolsForManager, n as createSteerAcknowledger, r as driverAgent, t as createCancelAcknowledger, v as createFileRunContext, w as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, x as applyRunCancellation, y as createInMemoryRunContext } from "./coordination-driver-iBGMKDvB.js";
|
|
7
|
+
import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
|
|
8
8
|
import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-vwd4SwX_.js";
|
|
9
9
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
10
10
|
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -690,7 +690,6 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
690
690
|
perWorker: opts.perWorker,
|
|
691
691
|
...opts.deliverable ? { deliverable: opts.deliverable } : {},
|
|
692
692
|
...opts.onStop ? { onStop: opts.onStop } : {},
|
|
693
|
-
...opts.maxLiveWorkers !== void 0 ? { maxLiveWorkers: opts.maxLiveWorkers } : {},
|
|
694
693
|
awaitTimeoutMs: opts.awaitTimeoutMs ?? responseFenceMs,
|
|
695
694
|
...opts.analysts ? { analysts: opts.analysts } : {},
|
|
696
695
|
...opts.analyzeOnSettle ? { analyzeOnSettle: opts.analyzeOnSettle } : {},
|
|
@@ -1572,7 +1571,7 @@ function observeWorkerControls(options) {
|
|
|
1572
1571
|
const coordinationMcpAlias = "agent-runtime-coordination";
|
|
1573
1572
|
/** A profile declares Runtime-owned tools with this provider-neutral prefix. */
|
|
1574
1573
|
const coordinationProfileToolPrefix = `${coordinationMcpAlias.replaceAll("-", "_")}_`;
|
|
1575
|
-
const coordinationVerbNameSet = new Set(coordinationVerbNames);
|
|
1574
|
+
const coordinationVerbNameSet$1 = new Set(coordinationVerbNames);
|
|
1576
1575
|
/** Bare Runtime tool names explicitly enabled by one exact profile. */
|
|
1577
1576
|
function declaredRuntimeToolNames(profile) {
|
|
1578
1577
|
const names = Object.entries(profile.tools ?? {}).filter(([name, enabled]) => enabled === true && name.startsWith(coordinationProfileToolPrefix)).map(([name]) => name.slice(coordinationProfileToolPrefix.length));
|
|
@@ -1581,7 +1580,7 @@ function declaredRuntimeToolNames(profile) {
|
|
|
1581
1580
|
/** Describe Runtime declarations that cannot resolve without a product tool provider. */
|
|
1582
1581
|
function runtimeToolDeclarationError(profile, hasProductToolResolver, mountedStaticToolNames = []) {
|
|
1583
1582
|
const mountedStaticToolNameSet = new Set(mountedStaticToolNames);
|
|
1584
|
-
const unresolved = declaredRuntimeToolNames(profile).filter((name) => !coordinationVerbNameSet.has(name) && !hasProductToolResolver && !mountedStaticToolNameSet.has(name));
|
|
1583
|
+
const unresolved = declaredRuntimeToolNames(profile).filter((name) => !coordinationVerbNameSet$1.has(name) && !hasProductToolResolver && !mountedStaticToolNameSet.has(name));
|
|
1585
1584
|
if (unresolved.length === 0) return void 0;
|
|
1586
1585
|
return `the profile declares ${unresolved.map((name) => JSON.stringify(`${coordinationProfileToolPrefix}${name}`)).join(", ")}, but this run has no resolveSupervisorTools provider or router-mounted static tool for those tools`;
|
|
1587
1586
|
}
|
|
@@ -1780,7 +1779,6 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
1780
1779
|
...deps.onAcceptedSubmission ? { onAcceptedSubmission: deps.onAcceptedSubmission } : {},
|
|
1781
1780
|
toolNames: runtimeToolNames,
|
|
1782
1781
|
...nodeTools?.length ? { nodeTools } : {},
|
|
1783
|
-
...deps.maxLiveWorkers !== void 0 ? { maxLiveWorkers: deps.maxLiveWorkers } : {},
|
|
1784
1782
|
...deps.extraTools ? { extraTools: deps.extraTools } : {},
|
|
1785
1783
|
...deps.executeExtraTool ? { executeExtraTool: deps.executeExtraTool } : {},
|
|
1786
1784
|
...deps.analysts ? { analysts: deps.analysts } : {},
|
|
@@ -1879,7 +1877,6 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
1879
1877
|
onStop: (reason) => {
|
|
1880
1878
|
if (!stopController.signal.aborted) stopController.abort(reason ?? "coordination stop");
|
|
1881
1879
|
},
|
|
1882
|
-
...deps.maxLiveWorkers !== void 0 ? { maxLiveWorkers: deps.maxLiveWorkers } : {},
|
|
1883
1880
|
...deps.analysts ? { analysts: deps.analysts } : {},
|
|
1884
1881
|
...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
|
|
1885
1882
|
...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
|
|
@@ -2575,6 +2572,34 @@ function assertProfileContract(profile, contract, context, runtimeConsumesCoordi
|
|
|
2575
2572
|
* has asynchronously resolved its exact product-tool descriptors. Runtime-owned declarations are
|
|
2576
2573
|
* not provider tools; unsupported declarations still fail when the coordination surface resolves.
|
|
2577
2574
|
*/
|
|
2575
|
+
/** The child with its manager's Runtime coordination grants, unless the child's author wrote any
|
|
2576
|
+
* coordination entry: an explicit grant or refusal is the author's choice and stands. A refusal
|
|
2577
|
+
* (`false`) grants nothing, so it is removed once it has decided the child stays a leaf; a
|
|
2578
|
+
* harness-less leaf carries no tools axis at all. */
|
|
2579
|
+
function withInheritedSpawnRights(parent, child) {
|
|
2580
|
+
const childTools = child.tools ?? {};
|
|
2581
|
+
const authored = Object.entries(childTools).filter(([name]) => name.startsWith(coordinationProfileToolPrefix));
|
|
2582
|
+
if (authored.length > 0) {
|
|
2583
|
+
if (authored.every(([, enabled]) => enabled !== false)) return child;
|
|
2584
|
+
const kept = Object.entries(childTools).filter(([name, enabled]) => !(name.startsWith(coordinationProfileToolPrefix) && enabled === false));
|
|
2585
|
+
const { tools: _tools, ...rest } = child;
|
|
2586
|
+
return agentProfileSchema.parse(kept.length === 0 ? rest : {
|
|
2587
|
+
...rest,
|
|
2588
|
+
tools: Object.fromEntries(kept)
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
const inherited = Object.entries(parent.tools ?? {}).filter(([name, enabled]) => enabled === true && name.startsWith(coordinationProfileToolPrefix) && coordinationVerbNameSet.has(name.slice(coordinationProfileToolPrefix.length)));
|
|
2592
|
+
if (!inherited.some(([name]) => name === `${coordinationProfileToolPrefix}spawn_worker`)) return child;
|
|
2593
|
+
return agentProfileSchema.parse({
|
|
2594
|
+
...child,
|
|
2595
|
+
tools: {
|
|
2596
|
+
...childTools,
|
|
2597
|
+
...Object.fromEntries(inherited),
|
|
2598
|
+
[`${coordinationProfileToolPrefix}submit_result`]: true
|
|
2599
|
+
}
|
|
2600
|
+
});
|
|
2601
|
+
}
|
|
2602
|
+
const coordinationVerbNameSet = new Set(coordinationVerbNames);
|
|
2578
2603
|
function profileWithoutDeclaredRuntimeCoordinationTools(profile) {
|
|
2579
2604
|
return providerVisibleProfile(profile);
|
|
2580
2605
|
}
|
|
@@ -2752,6 +2777,15 @@ const DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY = Object.freeze({
|
|
|
2752
2777
|
allowedMcpHosts: defaultAllowedMcpHosts,
|
|
2753
2778
|
allowConnections: false
|
|
2754
2779
|
});
|
|
2780
|
+
/**
|
|
2781
|
+
* A manager keeps a dedicated environment. It serves its coordination credential through
|
|
2782
|
+
* create-time environment, and every co-tenant of a shared box could read it.
|
|
2783
|
+
*/
|
|
2784
|
+
function managerExecutorConfig(config) {
|
|
2785
|
+
if (config.backend !== "provider" || config.shared === void 0) return config;
|
|
2786
|
+
const { shared: _shared, ...dedicated } = config;
|
|
2787
|
+
return Object.freeze(dedicated);
|
|
2788
|
+
}
|
|
2755
2789
|
function isExternalSupervisor(profile) {
|
|
2756
2790
|
return harnessRunsAgent(profile.harness);
|
|
2757
2791
|
}
|
|
@@ -2770,7 +2804,7 @@ async function providerAcceptsCoordinationAttachments(backend) {
|
|
|
2770
2804
|
function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns, rootStream) {
|
|
2771
2805
|
if (maxTurns !== void 0 && maxTurns < 0) throw new ValidationError("driveHarnessFromBackend: maxTurns must be >= 0 (0 lifts the turn cap; bounds become the conserved pool + deadline + abort)");
|
|
2772
2806
|
const turnCap = maxTurns ?? 0;
|
|
2773
|
-
const boundBackend = bindReusableExecutorExecutionId(captureReusableExecutorConfig(backend, "driveHarnessFromBackend"), executionId);
|
|
2807
|
+
const boundBackend = bindReusableExecutorExecutionId(managerExecutorConfig(captureReusableExecutorConfig(backend, "driveHarnessFromBackend")), executionId);
|
|
2774
2808
|
const baseFactory = createExecutor(boundBackend);
|
|
2775
2809
|
const ownerRuntime = boundBackend.backend === "provider" ? boundBackend.runtime ?? resolveAgentEnvironmentProvider(boundBackend.provider, boundBackend.registry).name : "cli";
|
|
2776
2810
|
let activeExecutor;
|
|
@@ -3276,12 +3310,12 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3276
3310
|
"extraTools",
|
|
3277
3311
|
"finalizer",
|
|
3278
3312
|
"hooks",
|
|
3313
|
+
"inheritSpawnRights",
|
|
3279
3314
|
"journal",
|
|
3280
3315
|
"makeLeafAgent",
|
|
3281
3316
|
"makeWorkerAgent",
|
|
3282
3317
|
"escalateQuestion",
|
|
3283
3318
|
"maxDepth",
|
|
3284
|
-
"maxLiveWorkers",
|
|
3285
3319
|
"maxTurns",
|
|
3286
3320
|
"now",
|
|
3287
3321
|
"onCoordinationEvent",
|
|
@@ -3303,6 +3337,7 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3303
3337
|
"rootHandle",
|
|
3304
3338
|
"router",
|
|
3305
3339
|
"runDir",
|
|
3340
|
+
"resume",
|
|
3306
3341
|
"runId",
|
|
3307
3342
|
"signal",
|
|
3308
3343
|
"stallAfterMs",
|
|
@@ -3313,7 +3348,9 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3313
3348
|
"repromptOnUnmet",
|
|
3314
3349
|
"onUnmetContract",
|
|
3315
3350
|
"workerRetry",
|
|
3316
|
-
"onWorkerRetry"
|
|
3351
|
+
"onWorkerRetry",
|
|
3352
|
+
"workerSlots",
|
|
3353
|
+
"recoverExecutor"
|
|
3317
3354
|
]);
|
|
3318
3355
|
/**
|
|
3319
3356
|
* Refuse a top-level option key `supervise()` reads nowhere, naming it.
|
|
@@ -3353,6 +3390,7 @@ Object.freeze([...[
|
|
|
3353
3390
|
"onProgressStop",
|
|
3354
3391
|
"onUnmetContract",
|
|
3355
3392
|
"onWorkerRetry",
|
|
3393
|
+
"recoverExecutor",
|
|
3356
3394
|
"resolveDeliverable",
|
|
3357
3395
|
"resolveDriveHarness",
|
|
3358
3396
|
"resolveSpawnProfile",
|
|
@@ -3390,7 +3428,7 @@ function rootSpawnResourceRoot(backend) {
|
|
|
3390
3428
|
}
|
|
3391
3429
|
function captureSuperviseOptions(opts) {
|
|
3392
3430
|
assertSuperviseOptionKeys(opts, "supervise");
|
|
3393
|
-
const { backend, coordination, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, resolveSpawnProfile, blobs, journal, probes, registry, hooks, otel, authorizeSpawn, authorizeMessage, driveHarness, resolveDriveHarness, resolveSupervisorTools, escalateQuestion, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, onUnmetContract, workerRetry, onWorkerRetry, finalizer, now, signal, rootHandle, ...decisionData } = opts;
|
|
3431
|
+
const { backend, coordination, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, recoverExecutor, resume, resolveSpawnProfile, blobs, journal, probes, registry, hooks, otel, authorizeSpawn, authorizeMessage, driveHarness, resolveDriveHarness, resolveSupervisorTools, escalateQuestion, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, onUnmetContract, workerRetry, onWorkerRetry, finalizer, now, signal, rootHandle, workerSlots, ...decisionData } = opts;
|
|
3394
3432
|
assertNoUncapturedExecutableOption(decisionData);
|
|
3395
3433
|
const capturedData = detachedSnapshot(decisionData, "supervise options");
|
|
3396
3434
|
const capturedCoordination = coordination === void 0 ? void 0 : (() => {
|
|
@@ -3451,9 +3489,12 @@ function captureSuperviseOptions(opts) {
|
|
|
3451
3489
|
...capturedAnalysts === void 0 ? {} : { analysts: capturedAnalysts },
|
|
3452
3490
|
...makeWorkerAgent === void 0 ? {} : { makeWorkerAgent },
|
|
3453
3491
|
...makeLeafAgent === void 0 ? {} : { makeLeafAgent },
|
|
3492
|
+
...recoverExecutor === void 0 ? {} : { recoverExecutor },
|
|
3454
3493
|
...resolveSpawnProfile === void 0 ? {} : { resolveSpawnProfile },
|
|
3455
3494
|
...blobs === void 0 ? {} : { blobs },
|
|
3456
3495
|
...journal === void 0 ? {} : { journal },
|
|
3496
|
+
...resume === void 0 ? {} : { resume },
|
|
3497
|
+
...workerSlots === void 0 ? {} : { workerSlots },
|
|
3457
3498
|
...probes === void 0 ? {} : { probes },
|
|
3458
3499
|
...authorizeSpawn === void 0 ? {} : { authorizeSpawn },
|
|
3459
3500
|
...authorizeMessage === void 0 ? {} : { authorizeMessage },
|
|
@@ -3552,15 +3593,19 @@ function assertPerWorkerWithinPool(perWorker, pool) {
|
|
|
3552
3593
|
].filter((x) => x !== null);
|
|
3553
3594
|
if (problems.length > 0) throw new ValidationError(`${problems.join("; ")} — a per-child ceiling cannot exceed the pool it draws from, and accepting it silently leaves the caller believing a knob is in effect when the reservation still clamps the child.`);
|
|
3554
3595
|
}
|
|
3555
|
-
|
|
3596
|
+
/** The slice a child gets when its manager names none: a quarter of the part of the manager's
|
|
3597
|
+
* budget its children may reserve, so four default children fill that part and the manager's
|
|
3598
|
+
* own share stays free for its turns. Each nested manager divides its own slice the same way. */
|
|
3599
|
+
function defaultPerWorker(budget, ownerShare) {
|
|
3600
|
+
const share = (1 - ownerShare) / 4;
|
|
3556
3601
|
return {
|
|
3557
3602
|
...budget.resources === void 0 ? {} : { resources: Object.fromEntries(Object.entries(budget.resources).map(([name, value]) => [name, {
|
|
3558
3603
|
unit: value.unit,
|
|
3559
|
-
limit: Math.floor(value.limit
|
|
3604
|
+
limit: Math.floor(value.limit * share)
|
|
3560
3605
|
}])) },
|
|
3561
|
-
maxIterations: Math.max(1, Math.floor(budget.maxIterations
|
|
3562
|
-
maxTokens: Math.max(1, Math.floor(budget.maxTokens
|
|
3563
|
-
...budget.maxUsd !== void 0 ? { maxUsd: budget.maxUsd
|
|
3606
|
+
maxIterations: Math.max(1, Math.floor(budget.maxIterations * share)),
|
|
3607
|
+
maxTokens: Math.max(1, Math.floor(budget.maxTokens * share)),
|
|
3608
|
+
...budget.maxUsd !== void 0 ? { maxUsd: budget.maxUsd * share } : {}
|
|
3564
3609
|
};
|
|
3565
3610
|
}
|
|
3566
3611
|
function freezeDetached(value) {
|
|
@@ -3721,10 +3766,11 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3721
3766
|
assertCoordinationBinding(options.coordination);
|
|
3722
3767
|
const ctx = options.runDir !== void 0 ? createFileRunContext(options.runDir, { withDriver: true }) : createInMemoryRunContext({ withDriver: true });
|
|
3723
3768
|
const blobs = options.blobs ?? ctx.blobs;
|
|
3724
|
-
|
|
3769
|
+
assertRecursiveReservationPolicy(options.reservationPolicy);
|
|
3770
|
+
const ownerShare = options.reservationPolicy?.ownerShare ?? 0;
|
|
3771
|
+
const perWorker = options.perWorker ?? defaultPerWorker(options.budget, ownerShare);
|
|
3725
3772
|
assertValidBudget(perWorker, "supervise perWorker");
|
|
3726
3773
|
assertPerWorkerWithinPool(perWorker, options.budget);
|
|
3727
|
-
assertRecursiveReservationPolicy(options.reservationPolicy, options.maxDepth ?? 8, options.maxLiveWorkers);
|
|
3728
3774
|
const journal = options.journal ?? ctx.journal;
|
|
3729
3775
|
const runId = options.runId ?? "supervise";
|
|
3730
3776
|
const runNamespace = supervisionRunNamespace(options.runDir, runId);
|
|
@@ -3742,6 +3788,16 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3742
3788
|
const spawnPreflight = composeSpawnPreflights(profileToolSpawnPreflight(options.makeWorkerAgent === void 0, options.resolveSupervisorTools !== void 0), coordinationChannelSpawnPreflight(options.makeWorkerAgent === void 0, hasCustomDriveHarness, managerBackend, options.coordination), options.backend?.backend === "bridge" ? bridgeSpawnPreflight(options.backend) : void 0);
|
|
3743
3789
|
const driverMaterialization = hasCustomDriveHarness ? options.driveHarnessMaterialization ?? fullProfileMaterialization : managerBackend && automaticDriverBackendSupported(managerBackend, options.coordination) ? backendProfileMaterialization(managerBackend) : void 0;
|
|
3744
3790
|
if (isExternalSupervisor(canonicalProfile) && !options.driveHarness && !options.resolveDriveHarness && (!managerBackend || !automaticDriverBackendSupported(managerBackend, options.coordination))) throw new ValidationError(`supervise: external supervisor profile.harness=${JSON.stringify(canonicalProfile.harness)} requires a local bridge, a provider with authenticated coordination.publicUrl and runtime MCP attachments, or an explicit driveHarness with reachable coordination transport`);
|
|
3791
|
+
const externalManagersAvailable = hasCustomDriveHarness || managerBackend !== void 0 && automaticDriverBackendSupported(managerBackend, options.coordination);
|
|
3792
|
+
const canLead = (child) => isExternalSupervisor(child) ? externalManagersAvailable : options.router !== void 0;
|
|
3793
|
+
const childrenCanSubmit = deliverable !== void 0 || options.resolveDeliverable !== void 0;
|
|
3794
|
+
const composeSpawnProfileFor = (parent) => {
|
|
3795
|
+
if (options.inheritSpawnRights === false || options.makeWorkerAgent !== void 0 || !childrenCanSubmit) return composeSpawnProfile;
|
|
3796
|
+
return (authored) => {
|
|
3797
|
+
const composed = composeSpawnProfile ? composeSpawnProfile(authored) : authored;
|
|
3798
|
+
return canLead(composed) ? withInheritedSpawnRights(parent, composed) : composed;
|
|
3799
|
+
};
|
|
3800
|
+
};
|
|
3745
3801
|
const harnessClaims = /* @__PURE__ */ new WeakMap();
|
|
3746
3802
|
const claimDriveHarness = (rawHarness, ownerId) => {
|
|
3747
3803
|
if (typeof rawHarness !== "function") throw new ValidationError("supervise: resolveDriveHarness must return a DriveHarness function");
|
|
@@ -3861,7 +3917,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3861
3917
|
assertProfileContract(authorized, isExternalSupervisor(authorized) ? driverMaterialization : promptModelProfileMaterialization, `supervise driver ${JSON.stringify(spawnContext.label)}`, true);
|
|
3862
3918
|
if (managerBackend) assertBridgeProfileMaterializes(profileWithoutDeclaredRuntimeCoordinationTools(authorized), managerBackend, `supervise driver ${JSON.stringify(spawnContext.label)}`);
|
|
3863
3919
|
const childFactory = makeRecursiveWorkerFor(authorized, childExecution.identity, depth + 1, ownerId);
|
|
3864
|
-
const nestedPerWorker = defaultPerWorker(spawnContext.budget);
|
|
3920
|
+
const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare);
|
|
3865
3921
|
const authorizeNestedMessage = authorizeDownFor(authorized, depth + 1);
|
|
3866
3922
|
let acceptedSubmission = false;
|
|
3867
3923
|
return driverChild(authorized, supervisorAgent(authorized, {
|
|
@@ -3869,7 +3925,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3869
3925
|
makeWorkerAgent: childFactory,
|
|
3870
3926
|
...authorizeNestedMessage ? { authorizeDownMessage: authorizeNestedMessage } : {},
|
|
3871
3927
|
perWorker: nestedPerWorker,
|
|
3872
|
-
...
|
|
3928
|
+
...ownerShare > 0 ? { preserveOwnerTurns: true } : {},
|
|
3873
3929
|
...options.router ? { router: options.router } : {},
|
|
3874
3930
|
...nestedDriveHarness ? { driveHarness: nestedDriveHarness } : {},
|
|
3875
3931
|
...options.coordination && isExternalSupervisor(authorized) ? { coordination: options.coordination } : {},
|
|
@@ -3895,7 +3951,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3895
3951
|
...options.continuityByProfile ? { continuityByProfile: options.continuityByProfile } : {},
|
|
3896
3952
|
...spawnPreflight ? { preflightSpawn: spawnPreflight } : {},
|
|
3897
3953
|
...options.resolveSpawnProfile ? { resolveSpawnProfile: options.resolveSpawnProfile } : {},
|
|
3898
|
-
...
|
|
3954
|
+
...composeSpawnProfileFor(authorized) ? { composeSpawnProfile: composeSpawnProfileFor(authorized) } : {},
|
|
3899
3955
|
...profileTable ? { profiles: profileTable } : {},
|
|
3900
3956
|
...options.peerMail ? { peerMail: options.peerMail } : {},
|
|
3901
3957
|
...options.stopRule ? { stopRule: options.stopRule } : {},
|
|
@@ -3967,7 +4023,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3967
4023
|
makeWorkerAgent: workerFactory,
|
|
3968
4024
|
...authorizeRootMessage ? { authorizeDownMessage: authorizeRootMessage } : {},
|
|
3969
4025
|
perWorker,
|
|
3970
|
-
...
|
|
4026
|
+
...ownerShare > 0 ? { preserveOwnerTurns: true } : {},
|
|
3971
4027
|
...log ? { onEvent: (_event, record) => log.append(runId, record, rootOwnerId) } : {},
|
|
3972
4028
|
...deliverable ? { deliverable } : {},
|
|
3973
4029
|
onProviderModel(model) {
|
|
@@ -3981,11 +4037,10 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3981
4037
|
...options.coordination && isExternalSupervisor(canonicalProfile) ? { coordination: options.coordination } : {},
|
|
3982
4038
|
...spawnPreflight ? { preflightSpawn: spawnPreflight } : {},
|
|
3983
4039
|
...options.resolveSpawnProfile ? { resolveSpawnProfile: options.resolveSpawnProfile } : {},
|
|
3984
|
-
...
|
|
4040
|
+
...composeSpawnProfileFor(canonicalProfile) ? { composeSpawnProfile: composeSpawnProfileFor(canonicalProfile) } : {},
|
|
3985
4041
|
...profileTable ? { profiles: profileTable } : {},
|
|
3986
4042
|
...spawnResourceRoot === void 0 ? {} : { spawnResourceRoot },
|
|
3987
4043
|
...options.peerMail ? { peerMail: options.peerMail } : {},
|
|
3988
|
-
...options.maxLiveWorkers !== void 0 ? { maxLiveWorkers: options.maxLiveWorkers } : {},
|
|
3989
4044
|
...options.router ? { router: options.router } : {},
|
|
3990
4045
|
...rootDriveHarness ? { driveHarness: rootDriveHarness } : {},
|
|
3991
4046
|
nodeContext: {
|
|
@@ -4049,22 +4104,22 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4049
4104
|
journal,
|
|
4050
4105
|
blobs,
|
|
4051
4106
|
executors: ctx.executors,
|
|
4052
|
-
...recoveryFactories.get(workerFactory) ? { recoverExecutor: recoveryFactories.get(workerFactory) } : {},
|
|
4107
|
+
...options.recoverExecutor ?? recoveryFactories.get(workerFactory) ? { recoverExecutor: options.recoverExecutor ?? recoveryFactories.get(workerFactory) } : {},
|
|
4053
4108
|
rootIdentity: rootExecution.identity,
|
|
4054
4109
|
...rootOwnerRuntime === void 0 ? {} : { rootMaterialization: {
|
|
4055
4110
|
runtime: rootOwnerRuntime,
|
|
4056
4111
|
declaration: "deferred",
|
|
4057
4112
|
authoredProfile: canonicalProfile
|
|
4058
4113
|
} },
|
|
4059
|
-
maxDepth: options.maxDepth ??
|
|
4114
|
+
maxDepth: options.maxDepth ?? 16,
|
|
4060
4115
|
...options.childSettleGraceMs !== void 0 ? { childSettleGraceMs: options.childSettleGraceMs } : {},
|
|
4061
4116
|
...options.teardownConfirmMs !== void 0 ? { teardownConfirmMs: options.teardownConfirmMs } : {},
|
|
4062
4117
|
...options.retainedAtSettlement !== void 0 ? { retainedAtSettlement: options.retainedAtSettlement } : {},
|
|
4063
4118
|
ownerWorkspaceRetention: managerBackend?.backend === "provider" && managerBackend.workspaceRetention !== void 0,
|
|
4064
|
-
...options.
|
|
4119
|
+
...options.workerSlots !== void 0 ? { workerSlots: options.workerSlots } : {},
|
|
4065
4120
|
...options.reservationPolicy ? { reservationPolicy: options.reservationPolicy } : {},
|
|
4066
4121
|
...probes ? { probes } : {},
|
|
4067
|
-
...ctx.resume === true ? { resume: true } : {},
|
|
4122
|
+
...ctx.resume === true || options.runDir === void 0 && options.resume === true ? { resume: true } : {},
|
|
4068
4123
|
...options.now ? { now: options.now } : {},
|
|
4069
4124
|
signal: options.signal ? AbortSignal.any([options.signal, durableCancellation.signal]) : durableCancellation.signal,
|
|
4070
4125
|
...hooks ? { hooks } : {},
|
|
@@ -4140,4 +4195,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
4140
4195
|
//#endregion
|
|
4141
4196
|
export { gateOnDeliverable as C, serveCoordinationMcp as S, readRootStream as _, superviseWithTestBrain as a, composeReentryTask as b, resolveWorkerSpawnRetry as c, assertCoordinationBinding as d, coordinationProfileToolPrefix as f, ROOT_STREAM_FILE as g, supervisorAgentWithTestBrain as h, superviseRootProfile as i, retryPreSpawnRefusals as l, supervisorAgent as m, profileGuidanceComposer as n, workerFromBackend as o, resolveSupervisorProfile as p, supervise as r, isPreSpawnExecutorFailure as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, withWorkerSpawnRetry as u, readRootStreamReceipt as v, mapExecutorResult as w, createSupervisorSpanRecorder as x, UNPROVEN_CONTINUITY as y };
|
|
4142
4197
|
|
|
4143
|
-
//# sourceMappingURL=supervise-
|
|
4198
|
+
//# sourceMappingURL=supervise-DJ_1i9vj.js.map
|