@tangle-network/agent-runtime 0.264.0 → 0.266.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-DHFdvps3.js → activation-BERiJjx5.js} +2 -2
- package/dist/{activation-DHFdvps3.js.map → activation-BERiJjx5.js.map} +1 -1
- package/dist/{activation-Bx4kfVU3.d.ts → activation-VpxSbDKJ.d.ts} +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-Bz-H17bC.js → coordination-driver-DdZ-nh_4.js} +73 -39
- package/dist/coordination-driver-DdZ-nh_4.js.map +1 -0
- package/dist/{delegate-CwbWhX5W.js → delegate-Ajx_PVyu.js} +3 -3
- package/dist/delegate-Ajx_PVyu.js.map +1 -0
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-5NrpTg0h.js → graph-CK50N9vG.js} +7 -5
- package/dist/graph-CK50N9vG.js.map +1 -0
- package/dist/{improvement-cycle-WRWcFyuO.js → improvement-cycle-GRPoHLm1.js} +3 -3
- package/dist/{improvement-cycle-WRWcFyuO.js.map → improvement-cycle-GRPoHLm1.js.map} +1 -1
- package/dist/{index-9wXpbjbX.d.ts → index-CU2mlMfc.d.ts} +59 -73
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-DPewOZMn.d.ts → loop-runner-bin-XKZXM08Q.d.ts} +3 -3
- package/dist/{loop-runner-bin-DC1Lm0nM.js → loop-runner-bin-cC16EPUq.js} +3 -3
- package/dist/{loop-runner-bin-DC1Lm0nM.js.map → loop-runner-bin-cC16EPUq.js.map} +1 -1
- 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 +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-ByTMUJcD.d.ts → openai-tools-D3ajI_D2.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-BZ6_uBGR.js → provision-supervisor-Bf_bPaCv.js} +4 -4
- package/dist/{provision-supervisor-BZ6_uBGR.js.map → provision-supervisor-Bf_bPaCv.js.map} +1 -1
- package/dist/{runtime-CUZC75EX.js → runtime-hOLlAc1i.js} +938 -18
- package/dist/runtime-hOLlAc1i.js.map +1 -0
- package/dist/{server-KpdpN627.js → server-DOb67ohd.js} +3 -3
- package/dist/{server-KpdpN627.js.map → server-DOb67ohd.js.map} +1 -1
- package/dist/{stream-agent-turn-D1zelVx6.d.ts → stream-agent-turn-Gw9hLpBn.d.ts} +182 -3
- package/dist/{structural-rollout-D17I5CwF.js → structural-rollout-DV9YoQF6.js} +2 -2
- package/dist/{structural-rollout-D17I5CwF.js.map → structural-rollout-DV9YoQF6.js.map} +1 -1
- package/dist/{substrate-qQphD9f0.d.ts → substrate-CLt9S9ym.d.ts} +2 -2
- package/dist/{supervise-_DTVHXPC.js → supervise--njTtSL3.js} +77 -27
- package/dist/supervise--njTtSL3.js.map +1 -0
- package/dist/{supervisor-C26k7X5-.js → supervisor-B8UMAXya.js} +990 -401
- package/dist/supervisor-B8UMAXya.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-BV14WTyW.d.ts → types-CrnwLVYQ.d.ts} +204 -34
- package/package.json +2 -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/runtime-CUZC75EX.js.map +0 -1
- package/dist/supervise-_DTVHXPC.js.map +0 -1
- package/dist/supervisor-C26k7X5-.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fi as Driver, Ni as AgentRunSpec, na as OutputAdapter, sa as Validator } from "./types-CrnwLVYQ.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-CLt9S9ym.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $r as profileMaterializationAxes$1, A as restoreScopeOwnerAcceptedExecution, Ai as runtimeOwnedScopeOwnerRuntime, An as routerBrain, B as bindScopeRetainedOwnerEnvironmentId, C as beginScopeOwnerAttempt, Ci as providerAttemptEvidence, D as meterRuntimeOwnedProviderAttempt, Di as runtimeOwnedExecutorMaterialization, E as meterRuntimeOwnedAccounting, Ei as runtimeOwnedExecutorExecutionBinding, G as scopeRetainedOwnerContext, Gt as WORKER_TRACE_PROPAGATION, H as consumeScopeRetainedOwnerResult, Ht as newUsageTotals, Ii as detachedSnapshot, J as scopeRetainedOwnerResult, Jn as errMessage, K as scopeRetainedOwnerPriorSpend, Kn as registerRetainedExecutorPreparation, O as recordScopeOwnerMaterialization, Oi as runtimeOwnedExecutorProviderEvidence, Qr as fullProfileMaterialization, S as assertRecursiveReservationPolicy, Sr as createOtelExporter, T as deriveNodeExecutionIdentity, Ti as runtimeOwnedDriveHarnessProviderEvidence, Tr as generateSpanId, U as prepareScopeRetainedOwnerTask, V as bindScopeRetainedOwnerProvider, Vt as meterUsageEvent, W as reconcileScopeRetainedOwnerEnvironment, Wt as spendFromUsageTotals, Xr as controlProfileMaterialization, Yr as assertProfileMaterialization, Zi as addSpend, Zr as defineProfileMaterializationContract, _ as driverChild, aa as sleep, ai as renderUnsupported, ar as runAbortable, ba as teardownExecutor, c as runTree, d as HarnessTurnFailedError, da as zeroSpend, dn as executorFailure, ei as promptControlProfileMaterialization, en as createInbox, fa as addResourceSpend, fi as prepareJsonlAppend, fn as bridgeAdmissionRefusal, fr as contentAddress, ft as bindReusableExecutorExecutionId, gi as attestRuntimeOwnedScopeOwner, gt as createExecutor, h as summarizeDriverAttempts, i as bestDelivered, ir as linkAbort, j as scopeOwnerExecutorNodeContext, k as recordScopeOwnerPause, ki as runtimeOwnedPendingExecutorMaterialization, kr as toOtelAttributes, la as unmeteredSpend, li as worktreeCliProfileMaterialization, m as runDriverWithRetry, ma as withBudgetResources, n as createRootHandle, nr as RunCancellationReason, p as defaultUnmetContractSteer, pa as resourceTelemetry, pi as readCommittedJsonLines, pn as bridgeModelRouteRefusal, pt as captureReusableExecutorConfig, q as scopeRetainedOwnerResourceReader, qn as retainedExecutorSeamKey, r as createSupervisor, s as runFinalizer, si as unsupportedProfileDimensions, ti as promptModelProfileMaterialization, ua as withTimeout, ui as isNoEntError, v as driverExecutorFactory, va as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, vn as bridgeRuntimeAttachmentsKey, vt as snapshotExecutorConfig, wi as recordRuntimeOwnedDriveHarnessProviderEvidence, xa as teardownSurfaces, y as isDriverSpec, yi as inheritRuntimeOwnedExecutorAttestation, yn as bridgeStopSignalKey, zn as resolveAgentEnvironmentProvider, zt as assertValidBudget } from "./supervisor-B8UMAXya.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 { 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-DdZ-nh_4.js";
|
|
6
7
|
import { n as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-x9NEhvHZ.js";
|
|
7
|
-
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-Bz-H17bC.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",
|
|
@@ -3313,7 +3347,8 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3313
3347
|
"repromptOnUnmet",
|
|
3314
3348
|
"onUnmetContract",
|
|
3315
3349
|
"workerRetry",
|
|
3316
|
-
"onWorkerRetry"
|
|
3350
|
+
"onWorkerRetry",
|
|
3351
|
+
"workerSlots"
|
|
3317
3352
|
]);
|
|
3318
3353
|
/**
|
|
3319
3354
|
* Refuse a top-level option key `supervise()` reads nowhere, naming it.
|
|
@@ -3390,7 +3425,7 @@ function rootSpawnResourceRoot(backend) {
|
|
|
3390
3425
|
}
|
|
3391
3426
|
function captureSuperviseOptions(opts) {
|
|
3392
3427
|
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;
|
|
3428
|
+
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, workerSlots, ...decisionData } = opts;
|
|
3394
3429
|
assertNoUncapturedExecutableOption(decisionData);
|
|
3395
3430
|
const capturedData = detachedSnapshot(decisionData, "supervise options");
|
|
3396
3431
|
const capturedCoordination = coordination === void 0 ? void 0 : (() => {
|
|
@@ -3454,6 +3489,7 @@ function captureSuperviseOptions(opts) {
|
|
|
3454
3489
|
...resolveSpawnProfile === void 0 ? {} : { resolveSpawnProfile },
|
|
3455
3490
|
...blobs === void 0 ? {} : { blobs },
|
|
3456
3491
|
...journal === void 0 ? {} : { journal },
|
|
3492
|
+
...workerSlots === void 0 ? {} : { workerSlots },
|
|
3457
3493
|
...probes === void 0 ? {} : { probes },
|
|
3458
3494
|
...authorizeSpawn === void 0 ? {} : { authorizeSpawn },
|
|
3459
3495
|
...authorizeMessage === void 0 ? {} : { authorizeMessage },
|
|
@@ -3552,15 +3588,19 @@ function assertPerWorkerWithinPool(perWorker, pool) {
|
|
|
3552
3588
|
].filter((x) => x !== null);
|
|
3553
3589
|
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
3590
|
}
|
|
3555
|
-
|
|
3591
|
+
/** The slice a child gets when its manager names none: a quarter of the part of the manager's
|
|
3592
|
+
* budget its children may reserve, so four default children fill that part and the manager's
|
|
3593
|
+
* own share stays free for its turns. Each nested manager divides its own slice the same way. */
|
|
3594
|
+
function defaultPerWorker(budget, ownerShare) {
|
|
3595
|
+
const share = (1 - ownerShare) / 4;
|
|
3556
3596
|
return {
|
|
3557
3597
|
...budget.resources === void 0 ? {} : { resources: Object.fromEntries(Object.entries(budget.resources).map(([name, value]) => [name, {
|
|
3558
3598
|
unit: value.unit,
|
|
3559
|
-
limit: Math.floor(value.limit
|
|
3599
|
+
limit: Math.floor(value.limit * share)
|
|
3560
3600
|
}])) },
|
|
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
|
|
3601
|
+
maxIterations: Math.max(1, Math.floor(budget.maxIterations * share)),
|
|
3602
|
+
maxTokens: Math.max(1, Math.floor(budget.maxTokens * share)),
|
|
3603
|
+
...budget.maxUsd !== void 0 ? { maxUsd: budget.maxUsd * share } : {}
|
|
3564
3604
|
};
|
|
3565
3605
|
}
|
|
3566
3606
|
function freezeDetached(value) {
|
|
@@ -3721,10 +3761,11 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3721
3761
|
assertCoordinationBinding(options.coordination);
|
|
3722
3762
|
const ctx = options.runDir !== void 0 ? createFileRunContext(options.runDir, { withDriver: true }) : createInMemoryRunContext({ withDriver: true });
|
|
3723
3763
|
const blobs = options.blobs ?? ctx.blobs;
|
|
3724
|
-
|
|
3764
|
+
assertRecursiveReservationPolicy(options.reservationPolicy);
|
|
3765
|
+
const ownerShare = options.reservationPolicy?.ownerShare ?? 0;
|
|
3766
|
+
const perWorker = options.perWorker ?? defaultPerWorker(options.budget, ownerShare);
|
|
3725
3767
|
assertValidBudget(perWorker, "supervise perWorker");
|
|
3726
3768
|
assertPerWorkerWithinPool(perWorker, options.budget);
|
|
3727
|
-
assertRecursiveReservationPolicy(options.reservationPolicy, options.maxDepth ?? 8, options.maxLiveWorkers);
|
|
3728
3769
|
const journal = options.journal ?? ctx.journal;
|
|
3729
3770
|
const runId = options.runId ?? "supervise";
|
|
3730
3771
|
const runNamespace = supervisionRunNamespace(options.runDir, runId);
|
|
@@ -3742,6 +3783,16 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3742
3783
|
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
3784
|
const driverMaterialization = hasCustomDriveHarness ? options.driveHarnessMaterialization ?? fullProfileMaterialization : managerBackend && automaticDriverBackendSupported(managerBackend, options.coordination) ? backendProfileMaterialization(managerBackend) : void 0;
|
|
3744
3785
|
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`);
|
|
3786
|
+
const externalManagersAvailable = hasCustomDriveHarness || managerBackend !== void 0 && automaticDriverBackendSupported(managerBackend, options.coordination);
|
|
3787
|
+
const canLead = (child) => isExternalSupervisor(child) ? externalManagersAvailable : options.router !== void 0;
|
|
3788
|
+
const childrenCanSubmit = deliverable !== void 0 || options.resolveDeliverable !== void 0;
|
|
3789
|
+
const composeSpawnProfileFor = (parent) => {
|
|
3790
|
+
if (options.inheritSpawnRights === false || options.makeWorkerAgent !== void 0 || !childrenCanSubmit) return composeSpawnProfile;
|
|
3791
|
+
return (authored) => {
|
|
3792
|
+
const composed = composeSpawnProfile ? composeSpawnProfile(authored) : authored;
|
|
3793
|
+
return canLead(composed) ? withInheritedSpawnRights(parent, composed) : composed;
|
|
3794
|
+
};
|
|
3795
|
+
};
|
|
3745
3796
|
const harnessClaims = /* @__PURE__ */ new WeakMap();
|
|
3746
3797
|
const claimDriveHarness = (rawHarness, ownerId) => {
|
|
3747
3798
|
if (typeof rawHarness !== "function") throw new ValidationError("supervise: resolveDriveHarness must return a DriveHarness function");
|
|
@@ -3861,7 +3912,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3861
3912
|
assertProfileContract(authorized, isExternalSupervisor(authorized) ? driverMaterialization : promptModelProfileMaterialization, `supervise driver ${JSON.stringify(spawnContext.label)}`, true);
|
|
3862
3913
|
if (managerBackend) assertBridgeProfileMaterializes(profileWithoutDeclaredRuntimeCoordinationTools(authorized), managerBackend, `supervise driver ${JSON.stringify(spawnContext.label)}`);
|
|
3863
3914
|
const childFactory = makeRecursiveWorkerFor(authorized, childExecution.identity, depth + 1, ownerId);
|
|
3864
|
-
const nestedPerWorker = defaultPerWorker(spawnContext.budget);
|
|
3915
|
+
const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare);
|
|
3865
3916
|
const authorizeNestedMessage = authorizeDownFor(authorized, depth + 1);
|
|
3866
3917
|
let acceptedSubmission = false;
|
|
3867
3918
|
return driverChild(authorized, supervisorAgent(authorized, {
|
|
@@ -3869,7 +3920,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3869
3920
|
makeWorkerAgent: childFactory,
|
|
3870
3921
|
...authorizeNestedMessage ? { authorizeDownMessage: authorizeNestedMessage } : {},
|
|
3871
3922
|
perWorker: nestedPerWorker,
|
|
3872
|
-
...
|
|
3923
|
+
...ownerShare > 0 ? { preserveOwnerTurns: true } : {},
|
|
3873
3924
|
...options.router ? { router: options.router } : {},
|
|
3874
3925
|
...nestedDriveHarness ? { driveHarness: nestedDriveHarness } : {},
|
|
3875
3926
|
...options.coordination && isExternalSupervisor(authorized) ? { coordination: options.coordination } : {},
|
|
@@ -3895,7 +3946,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3895
3946
|
...options.continuityByProfile ? { continuityByProfile: options.continuityByProfile } : {},
|
|
3896
3947
|
...spawnPreflight ? { preflightSpawn: spawnPreflight } : {},
|
|
3897
3948
|
...options.resolveSpawnProfile ? { resolveSpawnProfile: options.resolveSpawnProfile } : {},
|
|
3898
|
-
...
|
|
3949
|
+
...composeSpawnProfileFor(authorized) ? { composeSpawnProfile: composeSpawnProfileFor(authorized) } : {},
|
|
3899
3950
|
...profileTable ? { profiles: profileTable } : {},
|
|
3900
3951
|
...options.peerMail ? { peerMail: options.peerMail } : {},
|
|
3901
3952
|
...options.stopRule ? { stopRule: options.stopRule } : {},
|
|
@@ -3967,7 +4018,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3967
4018
|
makeWorkerAgent: workerFactory,
|
|
3968
4019
|
...authorizeRootMessage ? { authorizeDownMessage: authorizeRootMessage } : {},
|
|
3969
4020
|
perWorker,
|
|
3970
|
-
...
|
|
4021
|
+
...ownerShare > 0 ? { preserveOwnerTurns: true } : {},
|
|
3971
4022
|
...log ? { onEvent: (_event, record) => log.append(runId, record, rootOwnerId) } : {},
|
|
3972
4023
|
...deliverable ? { deliverable } : {},
|
|
3973
4024
|
onProviderModel(model) {
|
|
@@ -3981,11 +4032,10 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
3981
4032
|
...options.coordination && isExternalSupervisor(canonicalProfile) ? { coordination: options.coordination } : {},
|
|
3982
4033
|
...spawnPreflight ? { preflightSpawn: spawnPreflight } : {},
|
|
3983
4034
|
...options.resolveSpawnProfile ? { resolveSpawnProfile: options.resolveSpawnProfile } : {},
|
|
3984
|
-
...
|
|
4035
|
+
...composeSpawnProfileFor(canonicalProfile) ? { composeSpawnProfile: composeSpawnProfileFor(canonicalProfile) } : {},
|
|
3985
4036
|
...profileTable ? { profiles: profileTable } : {},
|
|
3986
4037
|
...spawnResourceRoot === void 0 ? {} : { spawnResourceRoot },
|
|
3987
4038
|
...options.peerMail ? { peerMail: options.peerMail } : {},
|
|
3988
|
-
...options.maxLiveWorkers !== void 0 ? { maxLiveWorkers: options.maxLiveWorkers } : {},
|
|
3989
4039
|
...options.router ? { router: options.router } : {},
|
|
3990
4040
|
...rootDriveHarness ? { driveHarness: rootDriveHarness } : {},
|
|
3991
4041
|
nodeContext: {
|
|
@@ -4056,12 +4106,12 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4056
4106
|
declaration: "deferred",
|
|
4057
4107
|
authoredProfile: canonicalProfile
|
|
4058
4108
|
} },
|
|
4059
|
-
maxDepth: options.maxDepth ??
|
|
4109
|
+
maxDepth: options.maxDepth ?? 16,
|
|
4060
4110
|
...options.childSettleGraceMs !== void 0 ? { childSettleGraceMs: options.childSettleGraceMs } : {},
|
|
4061
4111
|
...options.teardownConfirmMs !== void 0 ? { teardownConfirmMs: options.teardownConfirmMs } : {},
|
|
4062
4112
|
...options.retainedAtSettlement !== void 0 ? { retainedAtSettlement: options.retainedAtSettlement } : {},
|
|
4063
4113
|
ownerWorkspaceRetention: managerBackend?.backend === "provider" && managerBackend.workspaceRetention !== void 0,
|
|
4064
|
-
...options.
|
|
4114
|
+
...options.workerSlots !== void 0 ? { workerSlots: options.workerSlots } : {},
|
|
4065
4115
|
...options.reservationPolicy ? { reservationPolicy: options.reservationPolicy } : {},
|
|
4066
4116
|
...probes ? { probes } : {},
|
|
4067
4117
|
...ctx.resume === true ? { resume: true } : {},
|
|
@@ -4140,4 +4190,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
4140
4190
|
//#endregion
|
|
4141
4191
|
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
4192
|
|
|
4143
|
-
//# sourceMappingURL=supervise
|
|
4193
|
+
//# sourceMappingURL=supervise--njTtSL3.js.map
|