@tangle-network/agent-runtime 0.328.0 → 0.330.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.
Files changed (52) hide show
  1. package/dist/{activation-CZRtcDPo.d.ts → activation-Clj_x12h.d.ts} +2 -2
  2. package/dist/{activation-DfhOPF9_.js → activation-CrFcC-Sq.js} +2 -2
  3. package/dist/{activation-DfhOPF9_.js.map → activation-CrFcC-Sq.js.map} +1 -1
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-B7Z9jgFr.js → coordination-driver-C_uWKMgC.js} +81 -21
  7. package/dist/coordination-driver-C_uWKMgC.js.map +1 -0
  8. package/dist/{delegate-By9tikQT.js → delegate-CLMdrQh2.js} +2 -2
  9. package/dist/{delegate-By9tikQT.js.map → delegate-CLMdrQh2.js.map} +1 -1
  10. package/dist/durable.d.ts +1 -1
  11. package/dist/durable.js +3 -3
  12. package/dist/{graph-0iL-4gj2.js → graph-D0EkipP8.js} +4 -4
  13. package/dist/{graph-0iL-4gj2.js.map → graph-D0EkipP8.js.map} +1 -1
  14. package/dist/{improvement-cycle-sd7Y_buy.js → improvement-cycle-DD_Vplop.js} +3 -3
  15. package/dist/{improvement-cycle-sd7Y_buy.js.map → improvement-cycle-DD_Vplop.js.map} +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +7 -7
  18. package/dist/intelligence.d.ts +2 -2
  19. package/dist/intelligence.js +3 -3
  20. package/dist/kernel.d.ts +2 -2
  21. package/dist/kernel.js +8 -8
  22. package/dist/{loop-runner-bin-CNmBGFAu.js → loop-runner-bin-DNYj9kk7.js} +3 -3
  23. package/dist/{loop-runner-bin-CNmBGFAu.js.map → loop-runner-bin-DNYj9kk7.js.map} +1 -1
  24. package/dist/{loop-runner-bin-DDz4VTyE.d.ts → loop-runner-bin-DSOzyQnW.d.ts} +2 -2
  25. package/dist/loop-runner-bin.d.ts +1 -1
  26. package/dist/loop-runner-bin.js +1 -1
  27. package/dist/mcp/bin.js +3 -3
  28. package/dist/mcp/index.d.ts +3 -3
  29. package/dist/mcp/index.js +4 -4
  30. package/dist/{openai-tools-B3Z4i5_B.d.ts → openai-tools-CsqdULKE.d.ts} +2 -2
  31. package/dist/profiles.d.ts +1 -1
  32. package/dist/{provision-supervisor-CCoerJyv.js → provision-supervisor-tHY0kh2t.js} +3 -3
  33. package/dist/{provision-supervisor-CCoerJyv.js.map → provision-supervisor-tHY0kh2t.js.map} +1 -1
  34. package/dist/{runtime-CYjHXjec.js → runtime-BnY1mLgV.js} +8 -8
  35. package/dist/{runtime-CYjHXjec.js.map → runtime-BnY1mLgV.js.map} +1 -1
  36. package/dist/{search-executor-BgMpZuhl.js → search-executor-BeRAutxm.js} +2 -2
  37. package/dist/{search-executor-BgMpZuhl.js.map → search-executor-BeRAutxm.js.map} +1 -1
  38. package/dist/{server-Czsqviqu.js → server-W0_4mp2S.js} +3 -3
  39. package/dist/{server-Czsqviqu.js.map → server-W0_4mp2S.js.map} +1 -1
  40. package/dist/{supervise-9WPjMFrH.js → supervise-BZFnOpzd.js} +74 -11
  41. package/dist/supervise-BZFnOpzd.js.map +1 -0
  42. package/dist/{supervisor-hIpqcCJr.js → supervisor-6t1YG2PP.js} +77 -25
  43. package/dist/supervisor-6t1YG2PP.js.map +1 -0
  44. package/dist/testing.d.ts +1 -1
  45. package/dist/testing.js +12 -12
  46. package/dist/tui/index.d.ts +1 -1
  47. package/dist/tui/index.js +1 -1
  48. package/dist/{types-0czU5q4A.d.ts → types-B5Bs5Dav.d.ts} +70 -2
  49. package/package.json +1 -1
  50. package/dist/coordination-driver-B7Z9jgFr.js.map +0 -1
  51. package/dist/supervise-9WPjMFrH.js.map +0 -1
  52. package/dist/supervisor-hIpqcCJr.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { n as assertNoSymlinkDescendant } from "./durable-file-B_eJr6Mb.js";
2
- import { $n as readHarnessTranscript, $r as renderUnsupported, A as scopeOwnerExecutorNodeContext, At as bindReusableExecutorExecutionId, B as consumeScopeRetainedOwnerResult, Bt as createRouterTranscript, C as deriveNodeExecutionIdentity, Ct as checkVerdictOf, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, F as seatExecutionProfile, Fn as bridgeRuntimeAttachmentsKey, G as scopeRetainedOwnerContext, Gr as defineProfileMaterializationContract, H as prepareScopeRetainedOwnerSeatSwitch, Hr as assertProfileMaterialization, Ht as WORKER_TRACE_PROPAGATION, I as abandonScopeRetainedOwnerInvocation, In as bridgeStopSignalKey, It as snapshotExecutorConfig, J as scopeRetainedOwnerResourceReader, Jn as linkAbort, Jr as promptControlProfileMaterialization, K as scopeRetainedOwnerJournalRoot, Kn as RunCancellationReason, Kr as fullProfileMaterialization, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mi as registerRetainedExecutorPreparation, N as SeatChainExhaustedError, Ni as retainedExecutorSeamKey, O as recordScopeOwnerPause, P as authoredSeatStages, Pt as createExecutor, Qn as persistHarnessTranscript, R as bindScopeRetainedOwnerEnvironmentId, Sa as spendFromUsageTotals, Sr as toOtelAttributes, St as bestComposite, T as meterRuntimeOwnedProviderAttempt, Tn as routerBrain, U as prepareScopeRetainedOwnerTask, V as noteScopeRetainedOwnerCoordination, W as reconcileScopeRetainedOwnerEnvironment, Wr as controlProfileMaterialization, X as scopeRetainedOwnerResult, Y as scopeRetainedOwnerRestorePoint, Yn as runAbortable, Yr as promptModelProfileMaterialization, Yt as createActivityLog, Z as scopeRetainedOwnerTurnEnded, Zt as createInbox, _ as isDriverSpec, _a as assertValidBudget, _i as runtimeOwnedExecutorExecutionBinding, _t as CONTINUATIONS_DIR, at as runtimeGraphMetadataKey, b as assertRecursiveReservationPolicy, ba as newUsageTotals, bi as runtimeOwnedPendingExecutorMaterialization, bt as admitContinuationPolicy, c as runTree, ca as parseWorkerToolTraceArtifact, cn as bridgeAdmissionRefusal, en as PEER_MAIL_WIRE_KEY, f as runDriverWithRetry, fa as detachedSnapshot, g as driverExecutorFactory, gi as runtimeOwnedDriveHarnessProviderEvidence, gr as createOtelExporter, h as driverChild, hi as recordRuntimeOwnedDriveHarnessProviderEvidence, ht as gateOnDeliverable, i as bestDelivered, ii as worktreeCliProfileMaterialization, it as providerVisibleProfile, jn as resolveAgentEnvironmentProvider, jt as captureReusableExecutorConfig, k as restoreScopeOwnerAcceptedExecution, ln as bridgeModelRouteRefusal, ma as errMessage, mi as providerAttemptEvidence, n as createRootHandle, ni as unsupportedProfileDimensions, nt as coordinationMcpAlias, oi as attestRuntimeOwnedScopeOwner, on as isLiveNodeStatus, p as summarizeDriverAttempts, pa as executorFailure, q as scopeRetainedOwnerPriorSpend, qr as profileMaterializationAxes$1, r as createSupervisor, rn as isPeerMailEnvelope, rt as coordinationProfileToolPrefix, s as runFinalizer, si as authoredAgentIdentity, ti as sandboxProfileMaterialization, u as HarnessTurnFailedError, ua as contentAddress, ui as inheritRuntimeOwnedExecutorAttestation, vi as runtimeOwnedExecutorMaterialization, vr as generateSpanId, w as meterRuntimeOwnedAccounting, wt as createContinuationKeeper, x as beginScopeOwnerAttempt, xi as runtimeOwnedScopeOwnerRuntime, ya as meterUsageEvent, yi as runtimeOwnedExecutorProviderEvidence, yt as CheckUnavailableError, z as bindScopeRetainedOwnerProvider } from "./supervisor-hIpqcCJr.js";
2
+ import { $n as persistHarnessTranscript, A as restoreScopeOwnerAcceptedExecution, B as bindScopeRetainedOwnerProvider, C as deriveNodeExecutionIdentity, Ca as spendFromUsageTotals, Cr as toOtelAttributes, Ct as bestComposite, D as recordScopeOwnerDriverAttempt, E as noteScopeOwnerPlannedExecution, En as routerBrain, F as authoredSeatStages, Ft as createExecutor, G as reconcileScopeRetainedOwnerEnvironment, Gr as controlProfileMaterialization, H as noteScopeRetainedOwnerCoordination, I as seatExecutionProfile, In as bridgeRuntimeAttachmentsKey, J as scopeRetainedOwnerPriorSpend, Jr as profileMaterializationAxes$1, K as scopeRetainedOwnerContext, Kr as defineProfileMaterializationContract, L as abandonScopeRetainedOwnerInvocation, Ln as bridgeStopSignalKey, Lt as snapshotExecutorConfig, Mn as resolveAgentEnvironmentProvider, Mt as captureReusableExecutorConfig, N as SeatChain, Ni as registerRetainedExecutorPreparation, O as recordScopeOwnerMaterialization, P as SeatChainExhaustedError, Pi as retainedExecutorSeamKey, Q as scopeRetainedOwnerTurnEnded, Qt as createInbox, R as beginScopeRetainedOwnerDrive, Si as runtimeOwnedScopeOwnerRuntime, T as meterRuntimeOwnedProviderAttempt, Tt as createContinuationKeeper, U as prepareScopeRetainedOwnerSeatSwitch, Ur as assertProfileMaterialization, Ut as WORKER_TRACE_PROPAGATION, V as consumeScopeRetainedOwnerResult, Vt as createRouterTranscript, W as prepareScopeRetainedOwnerTask, X as scopeRetainedOwnerRestorePoint, Xn as runAbortable, Xr as promptModelProfileMaterialization, Xt as createActivityLog, Y as scopeRetainedOwnerResourceReader, Yn as linkAbort, Yr as promptControlProfileMaterialization, Z as scopeRetainedOwnerResult, _ as isDriverSpec, _i as runtimeOwnedDriveHarnessProviderEvidence, _r as createOtelExporter, ai as worktreeCliProfileMaterialization, at as providerVisibleProfile, b as assertRecursiveReservationPolicy, ba as meterUsageEvent, bi as runtimeOwnedExecutorProviderEvidence, bt as CheckUnavailableError, c as runTree, ci as authoredAgentIdentity, da as contentAddress, di as inheritRuntimeOwnedExecutorAttestation, ei as renderUnsupported, er as readHarnessTranscript, f as runDriverWithRetry, g as driverExecutorFactory, gi as recordRuntimeOwnedDriveHarnessProviderEvidence, gt as gateOnDeliverable, h as driverChild, ha as errMessage, hi as providerAttemptEvidence, i as bestDelivered, in as isPeerMailEnvelope, it as coordinationProfileToolPrefix, j as scopeOwnerExecutorNodeContext, jt as bindReusableExecutorExecutionId, k as recordScopeOwnerPause, la as parseWorkerToolTraceArtifact, ln as bridgeAdmissionRefusal, ma as executorFailure, n as createRootHandle, ni as sandboxProfileMaterialization, ot as runtimeGraphMetadataKey, p as summarizeDriverAttempts, pa as detachedSnapshot, q as scopeRetainedOwnerJournalRoot, qn as RunCancellationReason, qr as fullProfileMaterialization, r as createSupervisor, ri as unsupportedProfileDimensions, rt as coordinationMcpAlias, s as runFinalizer, si as attestRuntimeOwnedScopeOwner, sn as isLiveNodeStatus, tn as PEER_MAIL_WIRE_KEY, u as HarnessTurnFailedError, un as bridgeModelRouteRefusal, va as assertValidBudget, vi as runtimeOwnedExecutorExecutionBinding, vt as CONTINUATIONS_DIR, w as meterRuntimeOwnedAccounting, wt as checkVerdictOf, x as beginScopeOwnerAttempt, xa as newUsageTotals, xi as runtimeOwnedPendingExecutorMaterialization, xt as admitContinuationPolicy, yi as runtimeOwnedExecutorMaterialization, yr as generateSpanId, z as bindScopeRetainedOwnerEnvironmentId } from "./supervisor-6t1YG2PP.js";
3
3
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
4
4
  import { $ as isAsyncIterable$1, Ot as teardownExecutor, U as addSpend, Y as errorMessage, at as sleep, dt as zeroSpend, gt as withBudgetResources, ht as resourceTelemetry, kt as teardownSurfaces, lt as unmeteredSpend, pt as addResourceSpend, ut as withTimeout, xt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS } from "./sandbox-profile-compat-CVgQWb7T.js";
5
5
  import { a as readCommittedJsonLines, n as isNoEntError, r as prepareJsonlAppend } from "./jsonl-file-DBv31uPi.js";
6
- import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CyCUwHed.js";
6
+ import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, l as profileProviderModel, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CyCUwHed.js";
7
7
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
8
- import { C as createFileRunContext, F as createCoordinationToolsForManager, N as coordinationVerbNames, O as applyRunCancellation, T as withRunContext, c as refreshedWake, g as progressStop, h as plateau, k as watchRunCancellation, l as resolveWakePolicy, n as createSteerAcknowledger, o as composeWakeInput, p as createProgressTracker, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as createInMemoryRunContext } from "./coordination-driver-B7Z9jgFr.js";
8
+ import { C as createFileRunContext, F as createCoordinationToolsForManager, N as coordinationVerbNames, O as applyRunCancellation, T as withRunContext, c as refreshedWake, g as progressStop, h as plateau, k as watchRunCancellation, l as resolveWakePolicy, n as createSteerAcknowledger, o as composeWakeInput, p as createProgressTracker, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as createInMemoryRunContext } from "./coordination-driver-C_uWKMgC.js";
9
9
  import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
10
10
  import { c as loadGraph, i as graphRegistry } from "./graph-registry-DAI6KNXB.js";
11
11
  import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-Cu8H7aeh.js";
@@ -660,6 +660,7 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
660
660
  ...opts.replaySettlements ? { replaySettlements: true } : {},
661
661
  ...opts.questionPolicy ? { questionPolicy: opts.questionPolicy } : {},
662
662
  ...opts.escalateQuestion ? { escalateQuestion: opts.escalateQuestion } : {},
663
+ ...opts.onChildQuestionInbox ? { onChildQuestionInbox: opts.onChildQuestionInbox } : {},
663
664
  ...opts.priorEscalations?.length ? { priorEscalations: opts.priorEscalations } : {},
664
665
  ...opts.priorQuestions?.length ? { priorQuestions: opts.priorQuestions } : {},
665
666
  ...opts.priorJournal?.length ? { priorJournal: opts.priorJournal } : {},
@@ -2666,7 +2667,8 @@ function createVerbSlot() {
2666
2667
  const ROUTER_TRANSPORT_FIELDS = /* @__PURE__ */ new Set([
2667
2668
  "routerBaseUrl",
2668
2669
  "routerKey",
2669
- "complete"
2670
+ "complete",
2671
+ "routing"
2670
2672
  ]);
2671
2673
  /** Capture the transport-only Router seam before any profile lowering. TypeScript excess-property
2672
2674
  * checks are not a runtime boundary: JavaScript and widened objects can otherwise smuggle private
@@ -2681,7 +2683,20 @@ function snapshotRouterTransportConfig(input) {
2681
2683
  return Object.freeze({
2682
2684
  routerBaseUrl: input.routerBaseUrl,
2683
2685
  routerKey: input.routerKey,
2684
- ...input.complete !== void 0 ? { complete: input.complete } : {}
2686
+ ...input.complete !== void 0 ? { complete: input.complete } : {},
2687
+ ...input.routing !== void 0 ? { routing: snapshotRouterRouting(input.routing) } : {}
2688
+ });
2689
+ }
2690
+ /** Copy provider routing after checking its shape, so a malformed field fails before any turn. */
2691
+ function snapshotRouterRouting(input) {
2692
+ if (typeof input !== "object" || input === null || Array.isArray(input)) throw new ValidationError("supervisorAgent: deps.router.routing must be an object");
2693
+ const { only, allowFallbacks, requireModel } = input;
2694
+ if (only !== void 0 && (!Array.isArray(only) || only.some((name) => typeof name !== "string" || name.length === 0))) throw new ValidationError("supervisorAgent: deps.router.routing.only must be an array of provider names");
2695
+ for (const [name, value] of [["allowFallbacks", allowFallbacks], ["requireModel", requireModel]]) if (value !== void 0 && typeof value !== "boolean") throw new ValidationError(`supervisorAgent: deps.router.routing.${name} must be a boolean`);
2696
+ return Object.freeze({
2697
+ ...only !== void 0 ? { only: Object.freeze([...only]) } : {},
2698
+ ...allowFallbacks !== void 0 ? { allowFallbacks } : {},
2699
+ ...requireModel !== void 0 ? { requireModel } : {}
2685
2700
  });
2686
2701
  }
2687
2702
  /** Build a supervisor `Agent` from its profile: the brain resolves from `profile.harness`
@@ -2752,6 +2767,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2752
2767
  ...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
2753
2768
  ...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
2754
2769
  ...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
2770
+ ...deps.onChildQuestionInbox ? { onChildQuestionInbox: deps.onChildQuestionInbox } : {},
2755
2771
  ...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
2756
2772
  ...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
2757
2773
  ...deps.wake !== void 0 ? { wake: deps.wake } : {},
@@ -2872,6 +2888,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2872
2888
  ...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
2873
2889
  ...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
2874
2890
  ...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
2891
+ ...deps.onChildQuestionInbox ? { onChildQuestionInbox: deps.onChildQuestionInbox } : {},
2875
2892
  ...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
2876
2893
  ...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
2877
2894
  ...deps.continuityByProfile ? { continuityByProfile: deps.continuityByProfile } : {},
@@ -3153,6 +3170,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
3153
3170
  try {
3154
3171
  const wake = await controls.awaitWake({
3155
3172
  attempt: nextAttempt,
3173
+ quietWhileProgressing: true,
3156
3174
  signal: AbortSignal.any([scope.signal, stopController.signal]),
3157
3175
  heartbeatMs: wakePolicy.heartbeatMs,
3158
3176
  ...deps.peerMailUrl ? { alsoWakeOn: peerInbox.pending() > 0 ? Promise.resolve() : peerInbox.nextDelivery() } : {},
@@ -3317,6 +3335,7 @@ function routerBrainFromProfile(profile, router) {
3317
3335
  routerBaseUrl: router.routerBaseUrl,
3318
3336
  routerKey: router.routerKey,
3319
3337
  ...router.complete !== void 0 ? { complete: router.complete } : {},
3338
+ ...router.routing !== void 0 ? { routing: router.routing } : {},
3320
3339
  model: modelId,
3321
3340
  ...settings.retry !== void 0 ? { retry: settings.retry } : {},
3322
3341
  ...enforceTokenLimits(settings.tokenLimits, "router", "supervisorAgent").applied,
@@ -4419,6 +4438,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
4419
4438
  if (pending !== void 0) {
4420
4439
  if (pending.runtime !== executor.runtime || pending.binding.attemptId !== scopeOwnerExecutorNodeContext(scope).attemptId) throw new ValidationError("driveHarnessFromBackend: pending executor did not bind the kernel-minted attempt");
4421
4440
  if (canonicalAgentProfileDigest(pending.declaration.effectiveProfile) !== canonicalAgentProfileDigest(providerDriverProfile)) throw new ValidationError("driveHarnessFromBackend: pending executor changed the provider-visible AgentProfile before execution");
4441
+ noteScopeOwnerPlannedExecution(scope, pending.declaration.execution);
4422
4442
  } else {
4423
4443
  await publishMaterialization(declaration, executionBinding);
4424
4444
  ownerMaterializationPublished = true;
@@ -5351,6 +5371,14 @@ function superviseInternal(profile, task, opts, testBrain) {
5351
5371
  const runNamespace = ctx.namespace ?? supervisionRunNamespace(options.runDir, runId);
5352
5372
  const log = ctx.coordinationLog;
5353
5373
  const rootOwnerId = rootCoordinationOwner(rootExecution.identity);
5374
+ const childQuestionInboxes = /* @__PURE__ */ new Map();
5375
+ const askParentManager = (parentOwnerId, assignmentId, question) => {
5376
+ const inbox = childQuestionInboxes.get(parentOwnerId);
5377
+ return inbox === void 0 ? {
5378
+ delivered: false,
5379
+ reason: "the parent manager has no question intake in this process"
5380
+ } : inbox(assignmentId, question);
5381
+ };
5354
5382
  const rootProviderModels = [];
5355
5383
  const rootStreamSink = options.runDir === void 0 ? void 0 : createRootStreamSink(resolve(options.runDir), options.now ?? Date.now);
5356
5384
  const observeNodeEvent = options.onCoordinationEvent ? async (context, event, record) => {
@@ -5522,6 +5550,7 @@ function superviseInternal(profile, task, opts, testBrain) {
5522
5550
  });
5523
5551
  if (typeof decision !== "object" || decision === null || Array.isArray(decision)) throw new ValidationError("supervise: authorizeSpawn must return an AuthorizedSpawn");
5524
5552
  const authorized = freezeDetachedProfile(applyTraceTools(decision.profile));
5553
+ const modelSubstitution = spawnModelSubstitution(input, authorized);
5525
5554
  const childExecution = canonicalExecution(authorized, spawnContext.task, decision.execution, `supervise spawn ${JSON.stringify(spawnContext.label)}`);
5526
5555
  const authorizedContext = Object.freeze({
5527
5556
  ...spawnContext,
@@ -5548,10 +5577,10 @@ function superviseInternal(profile, task, opts, testBrain) {
5548
5577
  const seatManagedLeaf = authoredSeatStages(authorized) !== void 0 && declaredRuntimeToolNames(authorized).length === 0 && isExternalSupervisor(authorized);
5549
5578
  if (!(declaredRuntimeToolNames(authorized).length > 0 || seatManagedLeaf)) {
5550
5579
  if (childDeliverable !== deliverable && !options.backend) throw new ValidationError("supervise: resolveDeliverable selected a per-spawn deliverable but there is no backend to derive that leaf from; makeLeafAgent owns its own completion check");
5551
- return (childDeliverable === deliverable ? makeLeaf : withRetry(workerFromBackend(options.backend, childDeliverable)))(authorized, Object.freeze({
5580
+ return withModelSubstitution((childDeliverable === deliverable ? makeLeaf : withRetry(workerFromBackend(options.backend, childDeliverable)))(authorized, Object.freeze({
5552
5581
  ...authorizedContext,
5553
5582
  assignmentId: workerAssignmentNamespace(runNamespace, parentOwnerId, spawnContext.assignmentId)
5554
- }));
5583
+ })), modelSubstitution);
5555
5584
  }
5556
5585
  const ownerId = childCoordinationOwner(parentOwnerId, childExecution.identity, spawnContext, depth);
5557
5586
  const subtask = graphSubtaskOf(authorized);
@@ -5594,7 +5623,7 @@ function superviseInternal(profile, task, opts, testBrain) {
5594
5623
  let acceptedSubmission = false;
5595
5624
  let unassessedOutput = false;
5596
5625
  const peerAudit = depth === 1 ? peerAuditFor(spawnContext.parentNodeId) : void 0;
5597
- return driverChild(authorized, supervisorAgent(authorized, {
5626
+ return withModelSubstitution(driverChild(authorized, supervisorAgent(authorized, {
5598
5627
  ...spawnContext.peerMailUrl ? { peerMailUrl: spawnContext.peerMailUrl } : {},
5599
5628
  ...peerAudit ? { peerAudit } : {},
5600
5629
  blobs,
@@ -5626,7 +5655,10 @@ function superviseInternal(profile, task, opts, testBrain) {
5626
5655
  replaySettlements: true
5627
5656
  } : {},
5628
5657
  ...analysts ? { analysts } : {},
5629
- ...options.escalateQuestion ? { escalateQuestion: options.escalateQuestion } : {},
5658
+ escalateQuestion: options.escalateQuestion ?? ((question) => askParentManager(parentOwnerId, spawnContext.assignmentId, question)),
5659
+ onChildQuestionInbox: (inbox) => {
5660
+ childQuestionInboxes.set(ownerId, inbox);
5661
+ },
5630
5662
  ...!analystLineage && spawnContext.analyst === void 0 && !spawnContext.assignmentId.startsWith("analyst:") && nestedAnalyzeOnSettle ? { analyzeOnSettle: nestedAnalyzeOnSettle } : {},
5631
5663
  ...options.watchWorkers ? { watchWorkers: options.watchWorkers } : {},
5632
5664
  ...options.stallAfterMs !== void 0 ? { stallAfterMs: options.stallAfterMs } : {},
@@ -5663,7 +5695,7 @@ function superviseInternal(profile, task, opts, testBrain) {
5663
5695
  },
5664
5696
  ...options.steerDir === void 0 ? {} : { steerDir: resolve(options.steerDir) },
5665
5697
  ...options.runDir === void 0 && options.steerDir === void 0 ? {} : { controlScope: "subtree" }
5666
- }), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory), () => unassessedOutput, seatManagedLeaf ? managerDeliverable : void 0, ownGraph ? (out) => graphSubtaskOutput(ownGraph, out) : void 0);
5698
+ }), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory), () => unassessedOutput, seatManagedLeaf ? managerDeliverable : void 0, ownGraph ? (out) => graphSubtaskOutput(ownGraph, out) : void 0), modelSubstitution);
5667
5699
  };
5668
5700
  if (options.makeLeafAgent === void 0 && options.backend?.backend === "provider" && !options.backend.steering) {
5669
5701
  const factory = registerRetainedExecutorPreparation(createExecutor(options.backend), ({ spawned, profile, task }) => {
@@ -5754,6 +5786,9 @@ function superviseInternal(profile, task, opts, testBrain) {
5754
5786
  ...options.executeExtraTool ? { executeExtraTool: options.executeExtraTool } : {},
5755
5787
  ...analysts ? { analysts } : {},
5756
5788
  ...options.escalateQuestion ? { escalateQuestion: options.escalateQuestion } : {},
5789
+ onChildQuestionInbox: (inbox) => {
5790
+ childQuestionInboxes.set(rootOwnerId, inbox);
5791
+ },
5757
5792
  ...options.analyzeOnSettle ? { analyzeOnSettle: options.analyzeOnSettle } : {},
5758
5793
  ...options.watchWorkers ? { watchWorkers: options.watchWorkers } : {},
5759
5794
  ...options.stallAfterMs !== void 0 ? { stallAfterMs: options.stallAfterMs } : {},
@@ -5922,7 +5957,35 @@ function rootProviderModelEvidence(observations) {
5922
5957
  function rootProviderModelEvidenceFromExecution(evidence) {
5923
5958
  return evidence ?? rootProviderModelEvidence([]);
5924
5959
  }
5960
+ /**
5961
+ * The route a spawn authorization replaced, when the parent authored part of it. Only a part the
5962
+ * parent named counts: authorization filling an omitted harness or provider is not a substitution.
5963
+ */
5964
+ function spawnModelSubstitution(authored, authorized) {
5965
+ const harness = agentHarness(authored.harness);
5966
+ const provider = authored.model?.provider?.trim() || void 0;
5967
+ const model = profileProviderModel(authored);
5968
+ if (model === void 0) return void 0;
5969
+ if (!(harness !== void 0 && harness !== agentHarness(authorized.harness) || provider !== void 0 && provider !== authorized.model?.provider?.trim() || model !== profileProviderModel(authorized))) return void 0;
5970
+ return Object.freeze({
5971
+ requested: profileBridgeWireModel(authored) ?? model,
5972
+ ran: profileBridgeWireModel(authorized) ?? "unspecified"
5973
+ });
5974
+ }
5975
+ /** The worker agent with the substitution on its spec, which Scope journals on `spawned`. */
5976
+ function withModelSubstitution(agent, substitution) {
5977
+ if (substitution === void 0) return agent;
5978
+ const spec = agent.executorSpec;
5979
+ if (spec === void 0) return agent;
5980
+ return {
5981
+ ...agent,
5982
+ executorSpec: {
5983
+ ...spec,
5984
+ modelSubstitution: substitution
5985
+ }
5986
+ };
5987
+ }
5925
5988
  //#endregion
5926
5989
  export { dumbContinuationPassPrompt as A, defaultEdgeTraversalCap as C, createPromptRegistry as D, analyzesFindingsReportPrompt as E, serveCoordinationMcp as F, kernelPromptRegistry as M, naiveContinuationPrompt as N, delegatesWorkerBriefPrompt as O, promptHandle as P, createGraphOverlay as S, validateGraphTopology as T, readRootStream as _, superviseRootProfile as a, composeReentryTask as b, isPreSpawnExecutorFailure as c, withWorkerSpawnRetry as d, assertCoordinationBinding as f, ROOT_STREAM_FILE as g, supervisorAgentWithTestBrain as h, superviseFleetCapabilities as i, formatPromptHandle as j, dumbContinuationFailPrompt as k, resolveWorkerSpawnRetry as l, supervisorAgent as m, profileGuidanceComposer as n, superviseWithTestBrain as o, resolveSupervisorProfile as p, supervise as r, workerFromBackend as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, retryPreSpawnRefusals as u, readRootStreamReceipt as v, graphRootProfile as w, createSupervisorSpanRecorder as x, UNPROVEN_CONTINUITY as y };
5927
5990
 
5928
- //# sourceMappingURL=supervise-9WPjMFrH.js.map
5991
+ //# sourceMappingURL=supervise-BZFnOpzd.js.map