@tangle-network/agent-runtime 0.311.2 → 0.313.1

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 (57) hide show
  1. package/dist/{activation-Dvl9gE_g.js → activation-DEtkkjNW.js} +2 -2
  2. package/dist/{activation-Dvl9gE_g.js.map → activation-DEtkkjNW.js.map} +1 -1
  3. package/dist/{activation-BxR-Im_k.d.ts → activation-yAlZTwYG.d.ts} +2 -3
  4. package/dist/agent.d.ts +1 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-CIfgl4Yj.js → coordination-driver-CeXe3km2.js} +14 -14
  7. package/dist/coordination-driver-CeXe3km2.js.map +1 -0
  8. package/dist/{delegate-05Ddb4_L.js → delegate-CG_iTxla.js} +2 -2
  9. package/dist/{delegate-05Ddb4_L.js.map → delegate-CG_iTxla.js.map} +1 -1
  10. package/dist/durable.d.ts +1 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-BNVGyp1P.js → graph-ua9uUqkA.js} +5 -5
  13. package/dist/graph-ua9uUqkA.js.map +1 -0
  14. package/dist/{improvement-cycle-Ig1_rWAw.js → improvement-cycle-Buz8X_hE.js} +3 -3
  15. package/dist/{improvement-cycle-Ig1_rWAw.js.map → improvement-cycle-Buz8X_hE.js.map} +1 -1
  16. package/dist/{index-B0c5PmmO.d.ts → index-Lm_RjfXs.d.ts} +11266 -2501
  17. package/dist/index.d.ts +46 -7
  18. package/dist/index.js +8 -8
  19. package/dist/intelligence.d.ts +2 -3
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +2 -4
  22. package/dist/kernel.js +8 -8
  23. package/dist/{loop-runner-bin-drXESgaI.d.ts → loop-runner-bin-CliCf9sW.d.ts} +2 -3
  24. package/dist/{loop-runner-bin-Beh7PECB.js → loop-runner-bin-DVqUUMrG.js} +3 -3
  25. package/dist/{loop-runner-bin-Beh7PECB.js.map → loop-runner-bin-DVqUUMrG.js.map} +1 -1
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +2 -5
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{openai-tools-CJHfmFzg.d.ts → openai-tools-BrOgOw66.d.ts} +2 -2
  32. package/dist/profiles.d.ts +1 -1
  33. package/dist/{provision-supervisor-CfKlAMTb.js → provision-supervisor-_dpcZKRl.js} +3 -3
  34. package/dist/{provision-supervisor-CfKlAMTb.js.map → provision-supervisor-_dpcZKRl.js.map} +1 -1
  35. package/dist/{runtime-DsnHqwNx.js → runtime-UQT_8tFV.js} +8 -8
  36. package/dist/{runtime-DsnHqwNx.js.map → runtime-UQT_8tFV.js.map} +1 -1
  37. package/dist/{search-executor-BNLvgp0X.js → search-executor-CTPMXtJ8.js} +2 -2
  38. package/dist/{search-executor-BNLvgp0X.js.map → search-executor-CTPMXtJ8.js.map} +1 -1
  39. package/dist/{server-Bx4d5imQ.js → server-DjzdO6s6.js} +3 -3
  40. package/dist/{server-Bx4d5imQ.js.map → server-DjzdO6s6.js.map} +1 -1
  41. package/dist/{supervise-D6MgxpMI.js → supervise-DUR_nu2t.js} +54 -24
  42. package/dist/supervise-DUR_nu2t.js.map +1 -0
  43. package/dist/{supervisor-WYRLsCp1.js → supervisor-CBBb97-G.js} +541 -35
  44. package/dist/supervisor-CBBb97-G.js.map +1 -0
  45. package/dist/testing.d.ts +1 -2
  46. package/dist/testing.js +12 -12
  47. package/dist/tui/index.d.ts +1 -1
  48. package/dist/tui/index.js +1 -1
  49. package/package.json +1 -1
  50. package/skills/profile-authoring/SKILL.md +1 -1
  51. package/dist/coordination-driver-CIfgl4Yj.js.map +0 -1
  52. package/dist/graph-BNVGyp1P.js.map +0 -1
  53. package/dist/stream-agent-turn-fd2XzrTv.d.ts +0 -2252
  54. package/dist/substrate-GW6LFx4A.d.ts +0 -284
  55. package/dist/supervise-D6MgxpMI.js.map +0 -1
  56. package/dist/supervisor-WYRLsCp1.js.map +0 -1
  57. package/dist/types-RlLmOHFR.d.ts +0 -6210
@@ -1,10 +1,10 @@
1
- import { $n as parseWorkerToolTraceArtifact, A as scopeOwnerExecutorNodeContext, Ai as worktreeCliProfileMaterialization, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, Bi as recordRuntimeOwnedDriveHarnessProviderEvidence, C as deriveNodeExecutionIdentity, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, Ei as renderUnsupported, F as seatExecutionProfile, Fi as inheritRuntimeOwnedExecutorAttestation, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as runtimeOwnedPendingExecutorMaterialization, H as prepareScopeRetainedOwnerSeatSwitch, Hi as runtimeOwnedExecutorExecutionBinding, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Jn as readCommittedJsonLines, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Ki as runtimeOwnedScopeOwnerRuntime, Kn as isNoEntError, Kr as generateSpanId, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mi as attestRuntimeOwnedScopeOwner, Mr as contentAddress, N as SeatChainExhaustedError, Nt as createExecutor, O as recordScopeOwnerPause, Oi as unsupportedProfileDimensions, Or as persistHarnessTranscript, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, Qi as detachedSnapshot, R as bindScopeRetainedOwnerEnvironmentId, Si as promptModelProfileMaterialization, Sr as RunCancellationReason, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, Tr as runAbortable, U as prepareScopeRetainedOwnerTask, Ui as runtimeOwnedExecutorMaterialization, V as noteScopeRetainedOwnerCoordination, Vi as runtimeOwnedDriveHarnessProviderEvidence, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wi as runtimeOwnedExecutorProviderEvidence, Wr as createOtelExporter, X as scopeRetainedOwnerResult, Xr as toOtelAttributes, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Z as scopeRetainedOwnerTurnEnded, _ as isDriverSpec, _i as controlProfileMaterialization, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, bi as profileMaterializationAxes$1, c as runTree, cn as bridgeModelRouteRefusal, dr as bridgeStopSignalKey, f as runDriverWithRetry, fr as errMessage, g as driverExecutorFactory, gi as assertProfileMaterialization, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ir as assertValidBudget, it as providerVisibleProfile, k as restoreScopeOwnerAcceptedExecution, kr as readHarnessTranscript, kt as bindReusableExecutorExecutionId, lr as spendFromUsageTotals, mt as gateOnDeliverable, n as createRootHandle, nt as coordinationMcpAlias, or as meterUsageEvent, p as summarizeDriverAttempts, q as scopeRetainedOwnerPriorSpend, qn as prepareJsonlAppend, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, sr as newUsageTotals, tr as executorFailure, u as HarnessTurnFailedError, ur as bridgeRuntimeAttachmentsKey, vi as defineProfileMaterializationContract, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wn as routerBrain, wr as linkAbort, x as beginScopeOwnerAttempt, xi as promptControlProfileMaterialization, xt as bestComposite, yi as fullProfileMaterialization, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zi as providerAttemptEvidence, zt as createRouterTranscript } from "./supervisor-WYRLsCp1.js";
1
+ import { $n as parseWorkerToolTraceArtifact, $r as toOtelAttributes, A as scopeOwnerExecutorNodeContext, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ci as profileMaterializationAxes$1, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, F as seatExecutionProfile, Fi as attestRuntimeOwnedScopeOwner, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as runtimeOwnedExecutorExecutionBinding, H as prepareScopeRetainedOwnerSeatSwitch, Hi as providerAttemptEvidence, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Ji as runtimeOwnedPendingExecutorMaterialization, Jn as readCommittedJsonLines, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Ki as runtimeOwnedExecutorMaterialization, Kn as isNoEntError, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mr as contentAddress, N as SeatChainExhaustedError, Ni as worktreeCliProfileMaterialization, Nt as createExecutor, O as recordScopeOwnerPause, Or as persistHarnessTranscript, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, R as bindScopeRetainedOwnerEnvironmentId, Ri as inheritRuntimeOwnedExecutorAttestation, Si as fullProfileMaterialization, Sr as RunCancellationReason, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, Ti as promptModelProfileMaterialization, Tr as runAbortable, U as prepareScopeRetainedOwnerTask, Ui as recordRuntimeOwnedDriveHarnessProviderEvidence, V as noteScopeRetainedOwnerCoordination, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wi as runtimeOwnedDriveHarnessProviderEvidence, X as scopeRetainedOwnerResult, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Yi as runtimeOwnedScopeOwnerRuntime, Yr as generateSpanId, Z as scopeRetainedOwnerTurnEnded, _ as isDriverSpec, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, bi as controlProfileMaterialization, c as runTree, cn as bridgeModelRouteRefusal, dr as bridgeStopSignalKey, f as runDriverWithRetry, fr as errMessage, g as driverExecutorFactory, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ir as assertValidBudget, it as providerVisibleProfile, ji as unsupportedProfileDimensions, k as restoreScopeOwnerAcceptedExecution, ki as renderUnsupported, kr as readHarnessTranscript, kt as bindReusableExecutorExecutionId, lr as spendFromUsageTotals, mt as gateOnDeliverable, n as createRootHandle, nt as coordinationMcpAlias, or as meterUsageEvent, p as summarizeDriverAttempts, q as scopeRetainedOwnerPriorSpend, qi as runtimeOwnedExecutorProviderEvidence, qn as prepareJsonlAppend, qr as createOtelExporter, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, sr as newUsageTotals, ta as detachedSnapshot, tr as executorFailure, u as HarnessTurnFailedError, ur as bridgeRuntimeAttachmentsKey, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wi as promptControlProfileMaterialization, wn as routerBrain, wr as linkAbort, x as beginScopeOwnerAttempt, xi as defineProfileMaterializationContract, xt as bestComposite, yi as assertProfileMaterialization, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zt as createRouterTranscript } from "./supervisor-CBBb97-G.js";
2
2
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
3
3
  import { G as errorMessage, Tt as teardownSurfaces, Y as isAsyncIterable$1, _t as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, at as unmeteredSpend, dt as resourceTelemetry, ft as withBudgetResources, lt as addResourceSpend, ot as withTimeout, st as zeroSpend, tt as sleep, wt as teardownExecutor, z as addSpend } from "./workspace-streams-BEvSX97P.js";
4
4
  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-DydyWTQg.js";
5
5
  import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
6
6
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
7
- import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-CIfgl4Yj.js";
7
+ import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-CeXe3km2.js";
8
8
  import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
9
9
  import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-DSCWdbX2.js";
10
10
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
@@ -1788,6 +1788,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1788
1788
  const exactProfile = agentProfileSchema.parse(profile);
1789
1789
  assertExecutableAgentProfile(exactProfile, "supervisorAgent");
1790
1790
  const stableProfile = detachedSnapshot(exactProfile, "supervisorAgent profile");
1791
+ const registeredProfile = deps.registeredProfile === void 0 ? stableProfile : detachedSnapshot(agentProfileSchema.parse(deps.registeredProfile), "supervisorAgent registered profile");
1791
1792
  const stableRouter = deps.router === void 0 ? void 0 : snapshotRouterTransportConfig(deps.router);
1792
1793
  const resolveTools = deps.resolveSupervisorTools;
1793
1794
  assertNoReservedCoordinationMcpAlias(stableProfile, "supervisorAgent");
@@ -1808,7 +1809,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1808
1809
  if (harness === null && deps.continuation !== void 0) throw new ValidationError("supervisorAgent: continuation applies to an EXTERNAL-harness supervisor only (profile.harness set). A router-brained supervisor runs its own turn loop in process, so the policy would be silently ignored.");
1809
1810
  if (deps.continuation !== void 0 && deps.deliverable === void 0) throw new ValidationError("supervisorAgent: continuation needs a `deliverable` completion check — with no check there is no contract that can be unmet");
1810
1811
  if (harness !== null && deps.deliverable !== void 0 && deps.continuation === void 0) throw new ValidationError("supervisorAgent: a manager with a completion check needs a continuation policy (deadline, maxBarren, the note profile and switches). Runtime supplies no default: how long to send a director back, and what to tell it, is the record's decision");
1811
- if (deps.deliverable !== void 0 && runtimeToolNames.includes("stop")) throw new ValidationError(`supervisorAgent: the profile grants ${coordinationProfileToolPrefix}stop to a manager with a completion check. Such a manager ends only through submit_result (the check passes) or report_blocked (a failed probe); remove stop from its tools`);
1812
+ if (deps.deliverable !== void 0 && runtimeToolNames.includes("stop")) throw new ValidationError(`supervisorAgent: the profile grants ${coordinationProfileToolPrefix}stop to a manager with a completion check. Such a manager ends only through submit_result (the check passes) or a bound (deadline, budget, cancellation, no progress); remove stop from its tools`);
1812
1813
  const continuationDeadlineMs = deps.continuation === void 0 ? void 0 : admitContinuationPolicy(deps.continuation, "supervisorAgent");
1813
1814
  if (harness === null) {
1814
1815
  assertRouterArmResourcePolicy(stableProfile);
@@ -2119,12 +2120,14 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2119
2120
  const describe = deps.deliverable?.describe;
2120
2121
  const settleLoop = () => {
2121
2122
  const stopReason = controls.stopReason() ?? progressStopReason;
2122
- const closedBy = mcp.submittedResult() ? "result-accepted" : controls.blocked() !== void 0 ? "blocked" : mcp.isStopped() ? "stop" : progressStopReason !== void 0 ? "stop-rule" : void 0;
2123
+ const closedBy = mcp.submittedResult() ? "result-accepted" : mcp.isStopped() ? "stop" : progressStopReason !== void 0 ? "stop-rule" : void 0;
2124
+ const blocked = controls.blocked();
2123
2125
  deps.onDriverLoopSettled?.({
2124
2126
  ...summarizeDriverAttempts(loopRecords),
2125
2127
  environmentReplacements,
2126
2128
  workspaceRestores,
2127
2129
  ...closedBy === void 0 ? {} : { closedBy },
2130
+ ...blocked.length === 0 ? {} : { blocked },
2128
2131
  ...stopReason === void 0 ? {} : { stopReason },
2129
2132
  continuations: keeper?.entries() ?? []
2130
2133
  });
@@ -2153,6 +2156,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2153
2156
  await driveHarness({
2154
2157
  profile: providerProfile,
2155
2158
  authoredProfile: stableProfile,
2159
+ ...registeredProfile === stableProfile ? {} : { registeredProfile },
2156
2160
  ...profilePrompt !== void 0 ? { systemPrompt: profilePrompt } : {},
2157
2161
  task: compose === void 0 ? task : compose(UNPROVEN_CONTINUITY),
2158
2162
  ...compose === void 0 ? {} : { reentry: {
@@ -3094,7 +3098,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3094
3098
  let seatChain;
3095
3099
  let activeSeat;
3096
3100
  let switchedProviderCheckpointAt;
3097
- const drive = async ({ profile, authoredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, stopSignal, coordinationTools, reentry }) => {
3101
+ const drive = async ({ profile, authoredProfile, registeredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, stopSignal, coordinationTools, reentry }) => {
3098
3102
  const priorCommittedArtifact = managerArtifact;
3099
3103
  managerArtifact = void 0;
3100
3104
  switchedProviderCheckpointAt = void 0;
@@ -3359,7 +3363,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3359
3363
  let ownerMaterializationPublished = false;
3360
3364
  const ownerDeclaration = (exactDeclaration) => ({
3361
3365
  ...exactDeclaration,
3362
- authoredProfile: canonicalDriverProfile,
3366
+ authoredProfile: registeredProfile === void 0 ? canonicalDriverProfile : agentProfileSchema.parse(registeredProfile),
3363
3367
  effectiveProfile: providerDriverProfile,
3364
3368
  platformAttachments: { [coordinationMcpAlias]: {
3365
3369
  kind: "coordination-mcp",
@@ -3740,7 +3744,7 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
3740
3744
  "router",
3741
3745
  "runDir",
3742
3746
  "resume",
3743
- "modelChange",
3747
+ "segment",
3744
3748
  "runContext",
3745
3749
  "runId",
3746
3750
  "signal",
@@ -4149,23 +4153,44 @@ function superviseRootProfile(profile, profileGuidance) {
4149
4153
  const compose = profileGuidanceComposer(profileGuidance);
4150
4154
  return freezeDetachedProfile(compose ? compose(parsedProfile.data) : parsedProfile.data);
4151
4155
  }
4152
- /** The model a root runs on, as a `model-changed` record names it. */
4153
- function rootModelOf(profile) {
4156
+ /** What a root profile runs on, as a `root-segment` record names it. */
4157
+ function rootSegmentOf(profile) {
4154
4158
  return {
4159
+ ...profile.model?.provider === void 0 ? {} : { provider: profile.model.provider },
4155
4160
  ...profile.model?.default === void 0 ? {} : { model: profile.model.default },
4156
- ...profile.model?.reasoningEffort === void 0 ? {} : { reasoningEffort: profile.model.reasoningEffort }
4161
+ ...profile.model?.reasoningEffort === void 0 ? {} : { reasoningEffort: profile.model.reasoningEffort },
4162
+ ...profile.harness === void 0 ? {} : { harness: profile.harness }
4157
4163
  };
4158
4164
  }
4159
- /** The recorded root profile with only its model, and its reasoning effort when given, replaced. */
4160
- function withRootModel(profile, change) {
4161
- if (typeof change.model !== "string" || change.model.trim().length === 0) throw new ValidationError("supervise: modelChange.model must name a model");
4162
- if (typeof change.reason !== "string" || change.reason.trim().length === 0) throw new ValidationError("supervise: modelChange.reason must say why the model changed");
4165
+ /** Refuse a segment that names nothing usable before any compute. */
4166
+ function admitSegment(segment) {
4167
+ if (typeof segment !== "object" || segment === null) throw new ValidationError("supervise: segment must be an object");
4168
+ for (const key of [
4169
+ "provider",
4170
+ "model",
4171
+ "harness"
4172
+ ]) {
4173
+ const value = segment[key];
4174
+ if (value !== void 0 && (typeof value !== "string" || value.trim().length === 0)) throw new ValidationError(`supervise: segment.${key} must name a ${key}`);
4175
+ }
4176
+ if (typeof segment.reason !== "string" || segment.reason.trim().length === 0) throw new ValidationError("supervise: segment.reason must say why the segment starts");
4177
+ if (segment.stack !== void 0) {
4178
+ if (typeof segment.stack !== "object" || segment.stack === null || Array.isArray(segment.stack)) throw new ValidationError("supervise: segment.stack must map package names to versions");
4179
+ for (const [name, version] of Object.entries(segment.stack)) if (typeof version !== "string" || version.length === 0) throw new ValidationError(`supervise: segment.stack.${name} must be a version string`);
4180
+ }
4181
+ }
4182
+ /** The recorded root profile with only its provider, model, reasoning effort and harness replaced
4183
+ * where the segment names them. */
4184
+ function withRootSegment(profile, segment) {
4185
+ if (segment.provider === void 0 && segment.model === void 0 && segment.reasoningEffort === void 0 && segment.harness === void 0) return profile;
4163
4186
  return superviseRootProfile({
4164
4187
  ...profile,
4188
+ ...segment.harness === void 0 ? {} : { harness: segment.harness },
4165
4189
  model: {
4166
4190
  ...profile.model,
4167
- default: change.model,
4168
- ...change.reasoningEffort === void 0 ? {} : { reasoningEffort: change.reasoningEffort }
4191
+ ...segment.provider === void 0 ? {} : { provider: segment.provider },
4192
+ ...segment.model === void 0 ? {} : { default: segment.model },
4193
+ ...segment.reasoningEffort === void 0 ? {} : { reasoningEffort: segment.reasoningEffort }
4169
4194
  }
4170
4195
  }, void 0);
4171
4196
  }
@@ -4189,7 +4214,8 @@ function superviseInternal(profile, task, opts, testBrain) {
4189
4214
  assertValidBudget(options.budget, "supervise budget");
4190
4215
  const composeSpawnProfile = profileGuidanceComposer(options.profileGuidance);
4191
4216
  const registeredProfile = superviseRootProfile(profile, options.profileGuidance);
4192
- const canonicalProfile = options.modelChange === void 0 ? registeredProfile : withRootModel(registeredProfile, options.modelChange);
4217
+ if (options.segment !== void 0) admitSegment(options.segment);
4218
+ const canonicalProfile = options.segment === void 0 ? registeredProfile : withRootSegment(registeredProfile, options.segment);
4193
4219
  assertExecutableAgentProfile(canonicalProfile, "supervise root");
4194
4220
  if (authoredSeatStages(canonicalProfile) !== void 0 && options.selectSeat === void 0) throw new ValidationError("supervise: AgentProfile.seats requires selectSeat before execution");
4195
4221
  const canonicalTask = freezeDetached(task);
@@ -4590,7 +4616,8 @@ function superviseInternal(profile, task, opts, testBrain) {
4590
4616
  controlDir: resolve(options.runDir),
4591
4617
  abortRun: cancelDurableRun
4592
4618
  },
4593
- ...options.steerDir === void 0 ? {} : { steerDir: resolve(options.steerDir) }
4619
+ ...options.steerDir === void 0 ? {} : { steerDir: resolve(options.steerDir) },
4620
+ ...canonicalProfile === registeredProfile ? {} : { registeredProfile }
4594
4621
  };
4595
4622
  const agent = testBrain === void 0 ? supervisorAgent(canonicalProfile, agentDeps) : supervisorAgentWithTestBrain(canonicalProfile, {
4596
4623
  ...agentDeps,
@@ -4621,15 +4648,18 @@ function superviseInternal(profile, task, opts, testBrain) {
4621
4648
  executors: ctx.executors,
4622
4649
  ...options.recoverExecutor ?? recoveryFactories.get(workerFactory) ? { recoverExecutor: options.recoverExecutor ?? recoveryFactories.get(workerFactory) } : {},
4623
4650
  rootIdentity: rootExecution.identity,
4624
- ...options.modelChange === void 0 ? {} : { rootModelChange: {
4625
- from: rootModelOf(registeredProfile),
4626
- to: rootModelOf(canonicalProfile),
4627
- reason: options.modelChange.reason
4651
+ ...options.segment === void 0 ? {} : { rootSegment: {
4652
+ registered: rootSegmentOf(registeredProfile),
4653
+ current: {
4654
+ ...rootSegmentOf(canonicalProfile),
4655
+ ...options.segment.stack === void 0 ? {} : { stack: { ...options.segment.stack } }
4656
+ },
4657
+ reason: options.segment.reason
4628
4658
  } },
4629
4659
  ...rootOwnerRuntime === void 0 ? {} : { rootMaterialization: {
4630
4660
  runtime: rootOwnerRuntime,
4631
4661
  declaration: "deferred",
4632
- authoredProfile: canonicalProfile
4662
+ authoredProfile: registeredProfile
4633
4663
  } },
4634
4664
  maxDepth: options.maxDepth ?? 16,
4635
4665
  ...options.childSettleGraceMs !== void 0 ? { childSettleGraceMs: options.childSettleGraceMs } : {},
@@ -4717,4 +4747,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
4717
4747
  //#endregion
4718
4748
  export { readRootStreamReceipt as _, superviseWithTestBrain as a, createSupervisorSpanRecorder as b, resolveWorkerSpawnRetry as c, assertCoordinationBinding as d, resolveSupervisorProfile as f, readRootStream as g, ROOT_STREAM_FILE as h, superviseRootProfile as i, retryPreSpawnRefusals as l, supervisorAgentWithTestBrain as m, profileGuidanceComposer as n, workerFromBackend as o, supervisorAgent as p, supervise as r, isPreSpawnExecutorFailure as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, withWorkerSpawnRetry as u, UNPROVEN_CONTINUITY as v, serveCoordinationMcp as x, composeReentryTask as y };
4719
4749
 
4720
- //# sourceMappingURL=supervise-D6MgxpMI.js.map
4750
+ //# sourceMappingURL=supervise-DUR_nu2t.js.map