@caupulican/pi-adaptative 0.94.0 → 0.94.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 (103) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/agent-paths.d.ts +2 -0
  3. package/dist/core/agent-paths.d.ts.map +1 -1
  4. package/dist/core/agent-paths.js +7 -0
  5. package/dist/core/agent-paths.js.map +1 -1
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +5 -1
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/background-lane-controller.d.ts +8 -0
  10. package/dist/core/background-lane-controller.d.ts.map +1 -1
  11. package/dist/core/background-lane-controller.js +75 -5
  12. package/dist/core/background-lane-controller.js.map +1 -1
  13. package/dist/core/background-tool-task-controller.d.ts +15 -0
  14. package/dist/core/background-tool-task-controller.d.ts.map +1 -1
  15. package/dist/core/background-tool-task-controller.js +122 -15
  16. package/dist/core/background-tool-task-controller.js.map +1 -1
  17. package/dist/core/context/long-term-memory-trigger.d.ts +3 -1
  18. package/dist/core/context/long-term-memory-trigger.d.ts.map +1 -1
  19. package/dist/core/context/long-term-memory-trigger.js +1 -1
  20. package/dist/core/context/long-term-memory-trigger.js.map +1 -1
  21. package/dist/core/context/okf-memory-provider.d.ts +3 -0
  22. package/dist/core/context/okf-memory-provider.d.ts.map +1 -1
  23. package/dist/core/context/okf-memory-provider.js +66 -31
  24. package/dist/core/context/okf-memory-provider.js.map +1 -1
  25. package/dist/core/context/okf-memory.d.ts +18 -1
  26. package/dist/core/context/okf-memory.d.ts.map +1 -1
  27. package/dist/core/context/okf-memory.js +48 -0
  28. package/dist/core/context/okf-memory.js.map +1 -1
  29. package/dist/core/delegation/worker-agent-control.d.ts +4 -0
  30. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
  31. package/dist/core/delegation/worker-agent-control.js.map +1 -1
  32. package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
  33. package/dist/core/delegation/worker-execution-policy.js +1 -1
  34. package/dist/core/delegation/worker-execution-policy.js.map +1 -1
  35. package/dist/core/delegation/worker-notification-coordinator.d.ts +10 -0
  36. package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
  37. package/dist/core/delegation/worker-notification-coordinator.js +69 -3
  38. package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
  39. package/dist/core/foreground-terminal-handoff-controller.d.ts +17 -0
  40. package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
  41. package/dist/core/foreground-terminal-handoff-controller.js +78 -10
  42. package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
  43. package/dist/core/learning/learning-audit.d.ts +5 -1
  44. package/dist/core/learning/learning-audit.d.ts.map +1 -1
  45. package/dist/core/learning/learning-audit.js +32 -1
  46. package/dist/core/learning/learning-audit.js.map +1 -1
  47. package/dist/core/learning/reflection-engine.d.ts +20 -0
  48. package/dist/core/learning/reflection-engine.d.ts.map +1 -1
  49. package/dist/core/learning/reflection-engine.js +58 -0
  50. package/dist/core/learning/reflection-engine.js.map +1 -1
  51. package/dist/core/memory/okf-project-memory-store.d.ts +28 -0
  52. package/dist/core/memory/okf-project-memory-store.d.ts.map +1 -0
  53. package/dist/core/memory/okf-project-memory-store.js +111 -0
  54. package/dist/core/memory/okf-project-memory-store.js.map +1 -0
  55. package/dist/core/memory/providers/file-store.d.ts +42 -1
  56. package/dist/core/memory/providers/file-store.d.ts.map +1 -1
  57. package/dist/core/memory/providers/file-store.js +274 -13
  58. package/dist/core/memory/providers/file-store.js.map +1 -1
  59. package/dist/core/memory-controller.d.ts +10 -1
  60. package/dist/core/memory-controller.d.ts.map +1 -1
  61. package/dist/core/memory-controller.js +72 -8
  62. package/dist/core/memory-controller.js.map +1 -1
  63. package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
  64. package/dist/core/provider-prompt-contracts.js +9 -19
  65. package/dist/core/provider-prompt-contracts.js.map +1 -1
  66. package/dist/core/reflection-controller.d.ts +7 -0
  67. package/dist/core/reflection-controller.d.ts.map +1 -1
  68. package/dist/core/reflection-controller.js +94 -15
  69. package/dist/core/reflection-controller.js.map +1 -1
  70. package/dist/core/tools/delegate-status.d.ts +2 -0
  71. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  72. package/dist/core/tools/delegate-status.js +4 -0
  73. package/dist/core/tools/delegate-status.js.map +1 -1
  74. package/dist/core/tools/delegate.d.ts +2 -0
  75. package/dist/core/tools/delegate.d.ts.map +1 -1
  76. package/dist/core/tools/delegate.js +83 -21
  77. package/dist/core/tools/delegate.js.map +1 -1
  78. package/dist/core/tools/tool-task.d.ts +1 -0
  79. package/dist/core/tools/tool-task.d.ts.map +1 -1
  80. package/dist/core/tools/tool-task.js +13 -8
  81. package/dist/core/tools/tool-task.js.map +1 -1
  82. package/dist/core/util/atomic-file.d.ts +2 -0
  83. package/dist/core/util/atomic-file.d.ts.map +1 -1
  84. package/dist/core/util/atomic-file.js +4 -0
  85. package/dist/core/util/atomic-file.js.map +1 -1
  86. package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
  87. package/dist/modes/interactive/auto-learn-controller.js +2 -0
  88. package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
  89. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
  90. package/dist/modes/interactive/components/activity-lane.js +12 -23
  91. package/dist/modes/interactive/components/activity-lane.js.map +1 -1
  92. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  93. package/dist/modes/interactive/components/custom-message.js +125 -1
  94. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  95. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  96. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  97. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  98. package/examples/extensions/sandbox/package-lock.json +2 -2
  99. package/examples/extensions/sandbox/package.json +1 -1
  100. package/examples/extensions/with-deps/package-lock.json +2 -2
  101. package/examples/extensions/with-deps/package.json +1 -1
  102. package/npm-shrinkwrap.json +12 -12
  103. package/package.json +4 -4
@@ -66,6 +66,8 @@ export declare class BackgroundLaneController implements WorkerAgentControlPort
66
66
  private _workerLifecycle;
67
67
  /** Shared terminal outbox for managed and in-process workers; lazy under UAC omission. */
68
68
  private _workerNotifications;
69
+ /** Active event waits consume matching terminal edges before a redundant parent wake is admitted. */
70
+ private readonly _workerWaitConsumers;
69
71
  private readonly deps;
70
72
  /** Emit a warning without ever throwing — used from disposal-adjacent persistence where a
71
73
  * listener failure (or a bare test double missing `emit`) must never block or crash cleanup. */
@@ -75,6 +77,12 @@ export declare class BackgroundLaneController implements WorkerAgentControlPort
75
77
  private _getWorkerController;
76
78
  private _getWorkerLifecycle;
77
79
  private _getWorkerNotificationCoordinator;
80
+ private _workerAgentIdForRecord;
81
+ private _isWorkerTerminalAwaited;
82
+ private _retainWorkerWaitConsumers;
83
+ /** Observe only logical-agent terminals explicitly exposed by a bounded model result. */
84
+ observeWorkerAgentTerminals(agentIds: readonly string[]): void;
85
+ observeWorkerTerminalRecords(records: readonly LaneRecord[]): void;
78
86
  /**
79
87
  * Backfills a durable notification for every record about to be flushed, through the SAME
80
88
  * durable notification store `_getWorkerLifecycle()` already replays from on construction
@@ -1 +1 @@
1
- {"version":3,"file":"background-lane-controller.d.ts","sourceRoot":"","sources":["../../src/core/background-lane-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,4BAA4B,CAAC;AAG1E,OAAO,KAAK,EACX,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,sCAAsC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AC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAEjH;IAED,mGAAmG;IACnG,4BAA4B,IAAI,IAAI,CAEnC;IAED,mGAAmG;IACnG,uBAAuB,IAAI,mBAAmB,EAAE,CAE/C;CACD"}
1
+ {"version":3,"file":"background-lane-controller.d.ts","sourceRoot":"","sources":["../../src/core/background-lane-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAwB,KAAK,UAAU,EAAe,MAAM,4BAA4B,CAAC;AAGhG,OAAO,KAAK,EACX,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACX,oCAAoC,EACpC,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEN,KAAK,8BAA8B,EACnC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,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,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAEjH;IAED,mGAAmG;IACnG,4BAA4B,IAAI,IAAI,CAEnC;IAED,mGAAmG;IACnG,uBAAuB,IAAI,mBAAmB,EAAE,CAE/C;CACD"}
@@ -13,7 +13,7 @@
13
13
  * delegations; goal auto-continue itself only ever asks the session to `continueGoalLoop`, so this
14
14
  * controller never touches `prompt()`, the last-assistant-message, retry, or streaming state.
15
15
  */
16
- import { LaneTracker } from "./autonomy/lane-tracker.js";
16
+ import { isLaneTerminalStatus, LaneTracker } from "./autonomy/lane-tracker.js";
17
17
  import { appendLaneRecordSnapshot, getLatestLaneRecordSnapshots } from "./autonomy/session-lane-record.js";
18
18
  import { ManagedLaneController } from "./delegation/managed-lane-controller.js";
19
19
  import { WorkerDelegationController, } from "./delegation/worker-delegation-controller.js";
@@ -43,6 +43,8 @@ export class BackgroundLaneController {
43
43
  constructor(deps) {
44
44
  /** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */
45
45
  this._laneTracker = new LaneTracker();
46
+ /** Active event waits consume matching terminal edges before a redundant parent wake is admitted. */
47
+ this._workerWaitConsumers = new Map();
46
48
  this.deps = deps;
47
49
  this._laneModels = new LaneModelResolver(deps);
48
50
  this._research = new ResearchLaneController(deps, this._laneTracker, this._laneModels);
@@ -102,9 +104,45 @@ export class BackgroundLaneController {
102
104
  notify: (records) => this.deps.notifyWorkerTerminalHandoff(records),
103
105
  warn: (message) => this._safeWarn(message),
104
106
  markDurableDelivered: (notificationIds) => this._workerLifecycle?.markNotificationsDelivered(notificationIds),
107
+ isObserved: (record) => this._isWorkerTerminalAwaited(record),
105
108
  });
106
109
  return this._workerNotifications;
107
110
  }
111
+ _workerAgentIdForRecord(record) {
112
+ const attempt = this._workerLifecycle?.getActiveAttempt(record.laneId) ??
113
+ this._workerLifecycle?.getManagedAttempt(record.laneId);
114
+ return attempt?.agentId ?? attempt?.dispatch.logicalLaneId ?? record.laneId;
115
+ }
116
+ _isWorkerTerminalAwaited(record) {
117
+ return (this._workerWaitConsumers.get(this._workerAgentIdForRecord(record)) ?? 0) > 0;
118
+ }
119
+ _retainWorkerWaitConsumers(agentIds) {
120
+ const unique = [...new Set(agentIds)];
121
+ for (const agentId of unique) {
122
+ this._workerWaitConsumers.set(agentId, (this._workerWaitConsumers.get(agentId) ?? 0) + 1);
123
+ }
124
+ return () => {
125
+ for (const agentId of unique) {
126
+ const remaining = (this._workerWaitConsumers.get(agentId) ?? 1) - 1;
127
+ if (remaining > 0)
128
+ this._workerWaitConsumers.set(agentId, remaining);
129
+ else
130
+ this._workerWaitConsumers.delete(agentId);
131
+ }
132
+ };
133
+ }
134
+ /** Observe only logical-agent terminals explicitly exposed by a bounded model result. */
135
+ observeWorkerAgentTerminals(agentIds) {
136
+ if (!this._workerLifecycle)
137
+ return;
138
+ const targets = new Set(agentIds);
139
+ this.observeWorkerTerminalRecords(this.getLaneRecords().filter((record) => isLaneTerminalStatus(record.status) && targets.has(this._workerAgentIdForRecord(record))));
140
+ }
141
+ observeWorkerTerminalRecords(records) {
142
+ const terminal = records.filter((record) => isLaneTerminalStatus(record.status));
143
+ if (terminal.length > 0)
144
+ this._getWorkerNotificationCoordinator().observeTerminals(terminal);
145
+ }
108
146
  /**
109
147
  * Backfills a durable notification for every record about to be flushed, through the SAME
110
148
  * durable notification store `_getWorkerLifecycle()` already replays from on construction
@@ -288,12 +326,16 @@ export class BackgroundLaneController {
288
326
  getWorkerAgentActivity(agentId, scope) {
289
327
  if (!this.deps.isDelegateToolActive())
290
328
  throw new Error("Worker delegation control is unavailable in this UAC surface.");
291
- return this._getWorkerController().getAgentControl().getWorkerAgentActivity(agentId, scope);
329
+ const activity = this._getWorkerController().getAgentControl().getWorkerAgentActivity(agentId, scope);
330
+ this.observeWorkerAgentTerminals([agentId]);
331
+ return activity;
292
332
  }
293
333
  readWorkerAgentTranscript(agentId, options) {
294
334
  if (!this.deps.isDelegateToolActive())
295
335
  throw new Error("Worker delegation control is unavailable in this UAC surface.");
296
- return this._getWorkerController().getAgentControl().readWorkerAgentTranscript(agentId, options);
336
+ const page = this._getWorkerController().getAgentControl().readWorkerAgentTranscript(agentId, options);
337
+ this.observeWorkerAgentTerminals([agentId]);
338
+ return page;
297
339
  }
298
340
  sendWorkerAgentMessage(agentId, message, options) {
299
341
  if (!this.deps.isDelegateToolActive())
@@ -370,12 +412,40 @@ export class BackgroundLaneController {
370
412
  waitForWorkerAgent(agentId, timeoutMs, scope) {
371
413
  if (!this.deps.isDelegateToolActive())
372
414
  throw new Error("Worker delegation control is unavailable in this UAC surface.");
373
- return this._getWorkerController().getAgentControl().waitForWorkerAgent(agentId, timeoutMs, scope);
415
+ const release = this._retainWorkerWaitConsumers([agentId]);
416
+ let wait;
417
+ try {
418
+ wait = this._getWorkerController().getAgentControl().waitForWorkerAgent(agentId, timeoutMs, scope);
419
+ }
420
+ catch (error) {
421
+ release();
422
+ throw error;
423
+ }
424
+ return wait
425
+ .then((result) => {
426
+ this.observeWorkerAgentTerminals([agentId]);
427
+ return result;
428
+ })
429
+ .finally(release);
374
430
  }
375
431
  waitForWorkerAgents(agentIds, mode, timeoutMs, scope) {
376
432
  if (!this.deps.isDelegateToolActive())
377
433
  throw new Error("Worker delegation control is unavailable in this UAC surface.");
378
- return this._getWorkerController().getAgentControl().waitForWorkerAgents(agentIds, mode, timeoutMs, scope);
434
+ const release = this._retainWorkerWaitConsumers(agentIds);
435
+ let wait;
436
+ try {
437
+ wait = this._getWorkerController().getAgentControl().waitForWorkerAgents(agentIds, mode, timeoutMs, scope);
438
+ }
439
+ catch (error) {
440
+ release();
441
+ throw error;
442
+ }
443
+ return wait
444
+ .then((result) => {
445
+ this.observeWorkerAgentTerminals(agentIds);
446
+ return result;
447
+ })
448
+ .finally(release);
379
449
  }
380
450
  broadcastWorkerAgentMessage(agentIds, message, options) {
381
451
  if (!this.deps.isDelegateToolActive())
@@ -1 +1 @@
1
- {"version":3,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,CAC5B,OAAgC,EAChC,SAAwC,EACxC,cAA2B;QAE3B,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAChF,CAAC;IACD;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,IAKrB;QACA,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,mGAAmG;IACnG,4BAA4B;QAC3B,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE;YAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;IAC7E,CAAC;IAED,mGAAmG;IACnG,uBAAuB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;CACD","sourcesContent":["/**\n * Execution-plane coordinator for goal continuation, research, managed lanes, worker delegation,\n * and model fitness.\n *\n * Coordination state is owned by focused controllers. This coordinator retains one AgentSession\n * composition seam and a shared lane read model. Everything it needs\n * — the session manager, settings, model registry, live model, capability envelope, the goal\n * continuation LOOP, the isolated-completion primitive, spawned-usage accounting, and the telemetry\n * sink — is reached through narrow deps accessors rather than the whole AgentSession.\n *\n * Drive-loop boundary (deliberate): the idle triggers ({@link scheduleGoalAutoContinueFromIdle},\n * {@link scheduleResearchLaneFromIdle}) are invoked from the session's prompt tail as one-line\n * delegations; goal auto-continue itself only ever asks the session to `continueGoalLoop`, so this\n * controller never touches `prompt()`, the last-assistant-message, retry, or streaming state.\n */\n\nimport type { Api, Model } from \"@caupulican/pi-ai\";\nimport type {\n\tGoalContinuationLoopOptions,\n\tGoalContinuationLoopResult,\n\tPromptOptions,\n\tResearchLaneRunOutcome,\n\tWorkerDelegationRunOutcome,\n} from \"./agent-session-contracts.ts\";\nimport { type LaneRecord, LaneTracker } from \"./autonomy/lane-tracker.ts\";\nimport { appendLaneRecordSnapshot, getLatestLaneRecordSnapshots } from \"./autonomy/session-lane-record.ts\";\nimport { ManagedLaneController } from \"./delegation/managed-lane-controller.ts\";\nimport type {\n\tSessionRootReply,\n\tSessionRootReplyQuery,\n\tSessionRootReplyWaitOptions,\n\tSessionRootReplyWaitResult,\n} from \"./delegation/session-root-mailbox.ts\";\nimport type {\n\tSessionRootWorkerAgentMessageOptions,\n\tWorkerAgentActivity,\n\tWorkerAgentBroadcastOptions,\n\tWorkerAgentBroadcastResult,\n\tWorkerAgentControlPort,\n\tWorkerAgentControlScope,\n\tWorkerAgentMessageOptions,\n\tWorkerAgentReplyResult,\n\tWorkerAgentRetireResult,\n\tWorkerAgentTaskStartOptions,\n\tWorkerAgentTranscriptOptions,\n\tWorkerAgentWaitMode,\n\tWorkerAgentWaitResult,\n} from \"./delegation/worker-agent-control.ts\";\nimport {\n\tWorkerDelegationController,\n\ttype WorkerDelegationControllerDeps,\n} from \"./delegation/worker-delegation-controller.ts\";\nimport type { WorkerDelegationRequest } from \"./delegation/worker-delegation-request.ts\";\nimport { WorkerLifecycle } from \"./delegation/worker-lifecycle.ts\";\nimport { WorkerNotificationCoordinator } from \"./delegation/worker-notification-coordinator.ts\";\nimport type { ManagedLaneEvent } from \"./extensions/types.ts\";\nimport { GoalAutoContinueController } from \"./goals/goal-auto-continue-controller.ts\";\nimport type { GoalRuntimeSnapshot, GoalRuntimeSnapshotSettings } from \"./goals/goal-runtime-snapshot.ts\";\nimport type { GoalState } from \"./goals/goal-state.ts\";\nimport type { ModelCapabilityProfile } from \"./model-capability.ts\";\nimport type { StoredFitnessReport } from \"./models/fitness-store.ts\";\nimport type { WorkerResultContract } from \"./orchestration/contracts.ts\";\nimport type {\n\tTaskProfileCreateInput,\n\tTaskProfileCreateResult,\n\tTaskProfileInspection,\n} from \"./orchestration/task-profile-writer.ts\";\nimport type { TaskRuntimeProjection } from \"./orchestration/task-runtime.ts\";\nimport { LaneModelResolver, type LaneModelResolverDeps } from \"./research/lane-model-resolver.ts\";\nimport type { ModelFitnessReport } from \"./research/model-fitness.ts\";\nimport { ModelFitnessController, type ModelFitnessControllerDeps } from \"./research/model-fitness-controller.ts\";\nimport { ResearchLaneController, type ResearchLaneControllerDeps } from \"./research/research-lane-controller.ts\";\nimport { getActiveSessionBranchEntries } from \"./session-snapshot.ts\";\n\nexport { isLocalExecutionModel } from \"./delegation/worker-delegation-controller.ts\";\nexport { clampLaneMaxUsd } from \"./research/lane-model-resolver.ts\";\n\nexport interface BackgroundLaneControllerDeps\n\textends WorkerDelegationControllerDeps,\n\t\tResearchLaneControllerDeps,\n\t\tModelFitnessControllerDeps,\n\t\tLaneModelResolverDeps {\n\t/** True iff the active surface can terminalize a goal through `goal` or `update_goal`.\n\t * Explicit tool/profile exclusion and the worker-role ceiling still disable continuation. */\n\tisGoalToolActive(): boolean;\n\t/** Capability profile of the SESSION model (gates background lanes, scales continuation budgets). */\n\tgetModelCapabilityProfile(): ModelCapabilityProfile;\n\t/** Continuation gate + goal state for the idle autosteer scheduler. */\n\tgetGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot;\n\t/** Drive-loop boundary: the session's bounded goal-continuation loop (owns `prompt()`, not us). */\n\tcontinueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;\n\t/** True while the session owns a foreground prompt/retry/follow-up run. */\n\tisForegroundBusy(): boolean;\n\t/** Resolve only after the complete foreground retry/follow-up run releases the session. */\n\twaitForForegroundIdle(): Promise<void>;\n\t/** Persist an explicit stopped state when the selected surface cannot drive the active goal. */\n\tmarkGoalToolUnavailable(): void;\n}\n\nexport class BackgroundLaneController implements WorkerAgentControlPort {\n\t/** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */\n\tprivate readonly _laneTracker = new LaneTracker();\n\tprivate readonly _laneModels: LaneModelResolver;\n\tprivate readonly _goalAutoContinue: GoalAutoContinueController;\n\tprivate readonly _research: ResearchLaneController;\n\tprivate readonly _fitness: ModelFitnessController;\n\t/** Lazily materialized only when managed-lane state is queried or reported. */\n\tprivate _managedLanes: ManagedLaneController | undefined;\n\t/** Lazily materialized so a UAC surface without `delegate` allocates no worker runtime state. */\n\tprivate _workers: WorkerDelegationController | undefined;\n\t/** One durable lifecycle shared by every worker execution adapter. */\n\tprivate _workerLifecycle: WorkerLifecycle | undefined;\n\t/** Shared terminal outbox for managed and in-process workers; lazy under UAC omission. */\n\tprivate _workerNotifications: WorkerNotificationCoordinator | undefined;\n\tprivate readonly deps: BackgroundLaneControllerDeps;\n\n\t/** Emit a warning without ever throwing — used from disposal-adjacent persistence where a\n\t * listener failure (or a bare test double missing `emit`) must never block or crash cleanup. */\n\tprivate _safeWarn(message: string): void {\n\t\ttry {\n\t\t\tthis.deps.emit({ type: \"warning\", message });\n\t\t} catch {\n\t\t\t// Dispose must never throw.\n\t\t}\n\t}\n\n\tprivate _recordWorkerTerminal(record: LaneRecord, durableNotificationId: string): void {\n\t\tthis._getWorkerNotificationCoordinator().recordTerminal(record, durableNotificationId);\n\t}\n\n\tconstructor(deps: BackgroundLaneControllerDeps) {\n\t\tthis.deps = deps;\n\t\tthis._laneModels = new LaneModelResolver(deps);\n\t\tthis._research = new ResearchLaneController(deps, this._laneTracker, this._laneModels);\n\t\tthis._fitness = new ModelFitnessController(deps, this._laneModels);\n\t\tthis._goalAutoContinue = new GoalAutoContinueController({\n\t\t\tisDisposed: deps.isDisposed,\n\t\t\tisGoalToolActive: deps.isGoalToolActive,\n\t\t\tgetSettingsManager: deps.getSettingsManager,\n\t\t\tgetGoalRuntimeSnapshot: deps.getGoalRuntimeSnapshot,\n\t\t\thasInFlightLaneForGoal: (goalId) => this._hasInFlightLaneForGoal(goalId),\n\t\t\tcontinueGoalLoop: deps.continueGoalLoop,\n\t\t\tisForegroundBusy: deps.isForegroundBusy,\n\t\t\twaitForForegroundIdle: deps.waitForForegroundIdle,\n\t\t\tmarkGoalToolUnavailable: deps.markGoalToolUnavailable,\n\t\t\temit: deps.emit,\n\t\t});\n\t}\n\n\tprivate _getWorkerController(): WorkerDelegationController {\n\t\tthis._workers ??= new WorkerDelegationController(\n\t\t\tthis.deps,\n\t\t\tthis._getWorkerNotificationCoordinator(),\n\t\t\tthis._getWorkerLifecycle(),\n\t\t);\n\t\treturn this._workers;\n\t}\n\n\tprivate _getWorkerLifecycle(): WorkerLifecycle {\n\t\tif (this._workerLifecycle) return this._workerLifecycle;\n\t\tconst lifecycle = new WorkerLifecycle({\n\t\t\tagentDir: this.deps.getAgentDir(),\n\t\t\tsessionId: this.deps.getSessionId(),\n\t\t});\n\t\tthis._workerLifecycle = lifecycle;\n\t\tfor (const notification of lifecycle.getPendingTerminalNotifications()) {\n\t\t\tthis._getWorkerNotificationCoordinator().recordTerminal(notification.record, notification.notificationId);\n\t\t}\n\t\treturn lifecycle;\n\t}\n\n\tprivate _getWorkerNotificationCoordinator(): WorkerNotificationCoordinator {\n\t\tthis._workerNotifications ??= new WorkerNotificationCoordinator({\n\t\t\tgetWorkerRecords: () => this._workerLifecycle?.getAllRecords() ?? [],\n\t\t\temitStatus: (status) => {\n\t\t\t\t// Runs once per flush, with the EXACT batch about to be handed to notify() -- the\n\t\t\t\t// natural checkpoint to backfill durability before that batch can get stuck behind\n\t\t\t\t// an unsettled notify() call with no durable trace. (getOutstandingRecords() is not\n\t\t\t\t// usable here: the coordinator emits status BEFORE moving this same batch from\n\t\t\t\t// `pending` into `inFlight`, so at this exact moment it would report nothing\n\t\t\t\t// outstanding — status.terminalSinceFlush is the batch, directly, no timing gap.)\n\t\t\t\tthis._ensureDurableNotifications(status.terminalSinceFlush);\n\t\t\t\ttry {\n\t\t\t\t\tthis.deps.emit({\n\t\t\t\t\t\ttype: \"delegate_workers\",\n\t\t\t\t\t\t...status,\n\t\t\t\t\t\tterminalSinceFlush: [...status.terminalSinceFlush],\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\t// A partial integration must not crash the event-driven terminal outbox.\n\t\t\t\t}\n\t\t\t},\n\t\t\tnotify: (records) => this.deps.notifyWorkerTerminalHandoff(records),\n\t\t\twarn: (message) => this._safeWarn(message),\n\t\t\tmarkDurableDelivered: (notificationIds) => this._workerLifecycle?.markNotificationsDelivered(notificationIds),\n\t\t});\n\t\treturn this._workerNotifications;\n\t}\n\n\t/**\n\t * Backfills a durable notification for every record about to be flushed, through the SAME\n\t * durable notification store `_getWorkerLifecycle()` already replays from on construction\n\t * (`getPendingTerminalNotifications()` / `markNotificationsDelivered()`) -- not a new\n\t * persistence subsystem. `WorkerLifecycle.getTerminalNotification()` is idempotent (it reuses\n\t * an existing durable entry for the same laneId/attemptId or creates exactly one), so calling\n\t * it for a record that already has a durable notification is a safe no-op. Without this, a\n\t * \"transient:<laneId>:<completedAt>\" record (recorded without a durableNotificationId — e.g.\n\t * because no attempt was resolvable at record time) has no trace in the durable ledger at all:\n\t * if it's still stuck behind an unresolved notify() when the process restarts, the replay on\n\t * the next construction can only find what was durably enqueued, so it would be lost instead of\n\t * replayed.\n\t */\n\tprivate _ensureDurableNotifications(records: readonly Pick<LaneRecord, \"laneId\">[]): void {\n\t\tif (!this._workerLifecycle) return;\n\t\tfor (const record of records) {\n\t\t\ttry {\n\t\t\t\tthis._workerLifecycle.getTerminalNotification(record.laneId);\n\t\t\t} catch (error) {\n\t\t\t\tthis._safeWarn(\n\t\t\t\t\t`Failed to durably back the worker terminal notification for ${record.laneId}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _getManagedLaneController(): ManagedLaneController {\n\t\tthis._managedLanes ??= new ManagedLaneController(\n\t\t\tthis.deps,\n\t\t\tthis._getWorkerLifecycle(),\n\t\t\t(record, notificationId) => this._recordWorkerTerminal(record, notificationId),\n\t\t\t(message) => this._safeWarn(message),\n\t\t);\n\t\treturn this._managedLanes;\n\t}\n\n\tprivate _hydrateManagedLanes(): void {\n\t\tif (this._managedLanes) {\n\t\t\tthis._managedLanes.ensureHydrated();\n\t\t\treturn;\n\t\t}\n\t\tconst hasPersistedActiveManagedLane = getLatestLaneRecordSnapshots(\n\t\t\tgetActiveSessionBranchEntries(this.deps.getSessionManager()),\n\t\t).some((record) => record.type === \"tmux-worker\" && (record.status === \"queued\" || record.status === \"running\"));\n\t\tif (hasPersistedActiveManagedLane) this._getManagedLaneController().ensureHydrated();\n\t}\n\n\t/** Live lane records tracked by this process (running and terminal). */\n\tgetLaneRecords(): LaneRecord[] {\n\t\tthis._hydrateManagedLanes();\n\t\tconst workerRecords =\n\t\t\tthis._workers?.getRecords() ??\n\t\t\t(this.deps.isDelegateToolActive?.() ? this._getWorkerController().getRecords() : []);\n\t\treturn [\n\t\t\t...this._laneTracker.getRecords(),\n\t\t\t...workerRecords,\n\t\t\t...(this._workerLifecycle?.getManagedRecords() ?? []),\n\t\t];\n\t}\n\n\t/** Does not materialize the worker controller when UAC omitted delegation. */\n\tgetTaskRuntimeSnapshot(): TaskRuntimeProjection | undefined {\n\t\treturn this._workerLifecycle?.getTaskRuntimeSnapshot();\n\t}\n\n\tgetWorkerResult(laneId: string): WorkerResultContract | undefined {\n\t\treturn this._workerLifecycle?.getResult(laneId);\n\t}\n\n\t/** Reconcile only when delegation has already been materialized; UAC omission stays zero-load. */\n\tsynchronizeGoalState(goal: GoalState): void {\n\t\tthis._workers?.synchronizeGoalState(goal);\n\t}\n\n\t/**\n\t * Resolve a tracked managed-lane dispatch. The caller's stable id is also the canonical durable\n\t * lane id, so this is an existence check rather than an id translation.\n\t */\n\tresolveManagedLaneId(callerLaneId: string): string | undefined {\n\t\treturn this._getManagedLaneController().resolve(callerLaneId);\n\t}\n\n\t/** Live count of active lanes — the real source for AutonomyStatusSnapshot.activeLaneCount. */\n\tgetActiveLaneCount(): number {\n\t\treturn this.getLaneRecords().filter((record) => record.status === \"queued\" || record.status === \"running\").length;\n\t}\n\n\t/** Belt-and-braces guard: whether ANY queued/running lane is tagged with this goalId. */\n\tprivate _hasInFlightLaneForGoal(goalId: string): boolean {\n\t\treturn this.getLaneRecords().some(\n\t\t\t(record) => record.goalId === goalId && (record.status === \"queued\" || record.status === \"running\"),\n\t\t);\n\t}\n\n\t/** Delegate the out-of-process dispatch/terminal claim to its single lifecycle owner. */\n\trecordManagedLane(event: ManagedLaneEvent): LaneRecord | undefined {\n\t\treturn this._getManagedLaneController().record(event);\n\t}\n\n\t/** Why the last idle research-lane evaluation skipped, for /autonomy diagnostics. */\n\tgetLastResearchLaneSkipReason(): string | undefined {\n\t\treturn this._research.getLastSkipReason();\n\t}\n\n\t/**\n\t * Abort in-flight research and delegate worker disposal to its single owning controller.\n\t *\n\t * This synchronous body is the LAST provably-safe write window for canceled/in-flight work.\n\t * `dispose()` (agent-session.ts) has already set the session's own disposed flag but has not yet\n\t * returned — no successor session (e.g. a `/reload` adoption) can exist yet, so an append here\n\t * cannot interleave with one; a post-await continuation resuming AFTER this method returns must\n\t * not append (see the disposed branch in `runWorkerDelegationOnce`). Persist FIRST, then\n\t * complete-in-memory, so a throw from one lane's persist cannot skip another's; each persist gets\n\t * its own try/catch — dispose must never throw.\n\t */\n\tabortInFlightLanes(): void {\n\t\tthis._goalAutoContinue.clearTimer();\n\t\tthis._research.abort();\n\t\tthis._fitness.abort();\n\t\tfor (const record of this._laneTracker.getRecords()) {\n\t\t\tif (record.status !== \"queued\" && record.status !== \"running\") continue;\n\t\t\tif (record.type === \"tmux-worker\") continue;\n\t\t\tconst canceled = this._laneTracker.complete(record.laneId, {\n\t\t\t\tstatus: \"canceled\",\n\t\t\t\treasonCode: \"session_disposed\",\n\t\t\t});\n\t\t\tif (!canceled) continue;\n\t\t\ttry {\n\t\t\t\tappendLaneRecordSnapshot(this.deps.getSessionManager(), canceled);\n\t\t\t} catch (error) {\n\t\t\t\tthis._safeWarn(\n\t\t\t\t\t`Failed to persist canceled lane record ${canceled.laneId}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthis._managedLanes?.release();\n\n\t\tthis._workers?.abort();\n\t\tthis._workerNotifications?.dispose();\n\t}\n\n\tclearGoalAutoContinueTimer(): void {\n\t\tthis._goalAutoContinue.clearTimer();\n\t}\n\n\tscheduleGoalAutoContinueFromIdle(options?: PromptOptions): void {\n\t\tthis._goalAutoContinue.scheduleFromIdle(options);\n\t}\n\n\t/**\n\t * Single-flight entry point for EVERY goal-continuation loop invocation — idle autosteer\n\t * ({@link _runScheduledGoalAutoContinue}) AND the manual `/goal start` / `/goal-continue`\n\t * commands (reached through `AgentSession.continueGoalLoop`). Both paths ultimately submit\n\t * continuation prompts through the session's single `prompt()` path, so two loops racing throws\n\t * \"Agent is already processing\" from whichever submits second. `_isGoalAutoContinuing` is the\n\t * ONE owner of that mutex; `deps.continueGoalLoop` (the raw {@link GoalLoopController} loop)\n\t * must never be called directly outside this method, or the guard is bypassed.\n\t */\n\tasync continueGoalLoopExclusive(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult> {\n\t\treturn this._goalAutoContinue.continueExclusive(options);\n\t}\n\n\tclearResearchLaneTimer(): void {\n\t\tthis._research.clearTimer();\n\t}\n\n\tscheduleResearchLaneFromIdle(): void {\n\t\tthis._research.scheduleFromIdle();\n\t}\n\n\tresolveLaneModel(configuredPattern: string | undefined): Model<Api> | undefined {\n\t\treturn this._laneModels.resolveModel(configuredPattern);\n\t}\n\n\tgetOrchestrationProfileCatalog(): Array<{ profileId: string; role: string; description: string }> {\n\t\treturn this._getWorkerController().getProfileCatalog();\n\t}\n\n\tinspectTaskProfileOptions(): TaskProfileInspection {\n\t\treturn this._getWorkerController().inspectTaskProfileOptions();\n\t}\n\n\tcreateTaskProfile(input: TaskProfileCreateInput): TaskProfileCreateResult {\n\t\treturn this._getWorkerController().createTaskProfile(input);\n\t}\n\n\t/**\n\t * Run one bounded, read-only research pass and persist its results: evidence bundle snapshot,\n\t * terminal lane record, and spawned-usage cost report (single-hop invariant, idempotent on the\n\t * lane's reportId). Explicit calls (e.g. `/autonomy research`) express user intent and bypass the\n\t * enabled/mode/dedupe gates the idle scheduler enforces; budget and capability gates always apply.\n\t */\n\tasync runResearchLaneOnce(request?: {\n\t\tquery?: string;\n\t\tcontext?: string;\n\t\tgoalId?: string;\n\t}): Promise<ResearchLaneRunOutcome> {\n\t\treturn this._research.runOnce(request);\n\t}\n\t/** Start a durable recursive agent with inherited, preset, or model-selected authority. */\n\tstartWorkerDelegation(\n\t\trequest: WorkerDelegationRequest,\n\t): { started: false; skipReason: string } | { started: true; record: LaneRecord } {\n\t\treturn this._getWorkerController().start(request);\n\t}\n\n\t/** Durable logical-worker controls. Each checks UAC before materializing worker state. */\n\tlistWorkerAgents(scope?: WorkerAgentControlScope): ReturnType<WorkerAgentControlPort[\"listWorkerAgents\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().listWorkerAgents(scope);\n\t}\n\n\tgetWorkerTaskSessionView(): ReturnType<WorkerAgentControlPort[\"getWorkerTaskSessionView\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().getWorkerTaskSessionView();\n\t}\n\n\tgetWorkerAgentActivity(agentId: string, scope?: WorkerAgentControlScope): WorkerAgentActivity {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().getWorkerAgentActivity(agentId, scope);\n\t}\n\n\treadWorkerAgentTranscript(\n\t\tagentId: string,\n\t\toptions?: WorkerAgentTranscriptOptions,\n\t): ReturnType<WorkerAgentControlPort[\"readWorkerAgentTranscript\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().readWorkerAgentTranscript(agentId, options);\n\t}\n\n\tsendWorkerAgentMessage(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentMessageOptions,\n\t): { messageId: string; queued: true } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().sendWorkerAgentMessage(agentId, message, options);\n\t}\n\n\tfollowUpWorkerAgent(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentMessageOptions,\n\t): { started: boolean; steering: boolean; messageId: string; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().followUpWorkerAgent(agentId, message, options);\n\t}\n\n\tsendSessionRootWorkerAgentMessage(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: SessionRootWorkerAgentMessageOptions,\n\t): { messageId: string; queued: true } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().sendSessionRootWorkerAgentMessage(agentId, message, options);\n\t}\n\n\tfollowUpSessionRootWorkerAgent(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: SessionRootWorkerAgentMessageOptions,\n\t): { started: boolean; steering: boolean; messageId: string; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().followUpSessionRootWorkerAgent(agentId, message, options);\n\t}\n\n\treplyToWorkerAgentMessage(sourceAgentId: string, message: string, replyToMessageId: string): WorkerAgentReplyResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController()\n\t\t\t.getAgentControl()\n\t\t\t.replyToWorkerAgentMessage(sourceAgentId, message, replyToMessageId);\n\t}\n\n\tlistSessionRootReplies(query?: SessionRootReplyQuery): SessionRootReply[] {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().listSessionRootReplies(query);\n\t}\n\n\twaitForSessionRootReplies(options?: SessionRootReplyWaitOptions): Promise<SessionRootReplyWaitResult> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().waitForSessionRootReplies(options);\n\t}\n\n\tacknowledgeSessionRootReply(messageId: string, ackToken: string): boolean {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().acknowledgeSessionRootReply(messageId, ackToken);\n\t}\n\n\treconcileSessionRootReplies(): void {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tthis._getWorkerController().getAgentControl().reconcileSessionRootReplies();\n\t}\n\n\tstartWorkerAgentTask(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentTaskStartOptions,\n\t): ReturnType<WorkerAgentControlPort[\"startWorkerAgentTask\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().startWorkerAgentTask(agentId, message, options);\n\t}\n\n\tinterruptWorkerAgent(agentId: string, scope?: WorkerAgentControlScope): { interrupted: boolean; reason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().interruptWorkerAgent(agentId, scope);\n\t}\n\n\tresumeWorkerAgent(\n\t\tagentId: string,\n\t\tscope?: WorkerAgentControlScope,\n\t): { started: boolean; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().resumeWorkerAgent(agentId, scope);\n\t}\n\n\tcancelWorkerAgent(agentId: string, reasonCode?: string, scope?: WorkerAgentControlScope): LaneRecord | undefined {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().cancelWorkerAgent(agentId, reasonCode, scope);\n\t}\n\n\tretireWorkerAgent(agentId: string, scope?: WorkerAgentControlScope): WorkerAgentRetireResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().retireWorkerAgent(agentId, scope);\n\t}\n\n\twaitForWorkerAgent(\n\t\tagentId: string,\n\t\ttimeoutMs?: number,\n\t\tscope?: WorkerAgentControlScope,\n\t): ReturnType<WorkerAgentControlPort[\"waitForWorkerAgent\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().waitForWorkerAgent(agentId, timeoutMs, scope);\n\t}\n\n\twaitForWorkerAgents(\n\t\tagentIds: readonly string[],\n\t\tmode: WorkerAgentWaitMode,\n\t\ttimeoutMs?: number,\n\t\tscope?: WorkerAgentControlScope,\n\t): Promise<WorkerAgentWaitResult> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().waitForWorkerAgents(agentIds, mode, timeoutMs, scope);\n\t}\n\n\tbroadcastWorkerAgentMessage(\n\t\tagentIds: readonly string[],\n\t\tmessage: string,\n\t\toptions: WorkerAgentBroadcastOptions,\n\t): WorkerAgentBroadcastResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().broadcastWorkerAgentMessage(agentIds, message, options);\n\t}\n\n\t/** Run one worker immediately; used by focused integrations and tests. */\n\tasync runWorkerDelegationOnce(\n\t\trequest: WorkerDelegationRequest,\n\t\tonStarted?: (record: LaneRecord) => void,\n\t\texistingRecord?: LaneRecord,\n\t): Promise<WorkerDelegationRunOutcome> {\n\t\treturn this._getWorkerController().runOnce(request, onStarted, existingRecord);\n\t}\n\t/**\n\t * Probe a candidate model against the subagent contracts (research/worker/judge/search/\n\t * tool-call surfaces) via {@link runModelFitnessProbe}. The model must resolve and\n\t * authenticate; every probe call runs as an isolated completion on that model, and probe\n\t * spend is reported through spawned-usage accounting.\n\t */\n\tasync runModelFitness(args: {\n\t\tmodel: string;\n\t\ttrials?: number;\n\t\t/** LLM tool-call id, present only via the model_fitness tool path — see model-fitness.ts. */\n\t\ttoolCallId?: string;\n\t}): Promise<{ started: true; model: string; report: ModelFitnessReport } | { started: false; skipReason: string }> {\n\t\treturn this._fitness.run(args);\n\t}\n\n\t/** Start every capacity-eligible queued worker at the owner session's foreground-idle boundary. */\n\tdrainQueuedWorkerDelegations(): void {\n\t\tif (this.deps.isDelegateToolActive?.()) this._getWorkerController().drain();\n\t}\n\n\t/** Fitness reports persisted for THIS host (measured evidence for architect/profile decisions). */\n\tgetStoredFitnessReports(): StoredFitnessReport[] {\n\t\treturn this._fitness.getStoredReports();\n\t}\n}\n"]}
1
+ {"version":3,"file":"background-lane-controller.js","sourceRoot":"","sources":["../../src/core/background-lane-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAAE,oBAAoB,EAAmB,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,C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AC;QACf,CAAC,CAAC;aACD,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAED,2BAA2B,CAC1B,QAA2B,EAC3B,OAAe,EACf,OAAoC;QAEpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,eAAe,EAAE,CAAC,2BAA2B,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,uBAAuB,CAC5B,OAAgC,EAChC,SAAwC,EACxC,cAA2B;QAE3B,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAChF,CAAC;IACD;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,IAKrB;QACA,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,mGAAmG;IACnG,4BAA4B;QAC3B,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE;YAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,CAAC;IAC7E,CAAC;IAED,mGAAmG;IACnG,uBAAuB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;CACD","sourcesContent":["/**\n * Execution-plane coordinator for goal continuation, research, managed lanes, worker delegation,\n * and model fitness.\n *\n * Coordination state is owned by focused controllers. This coordinator retains one AgentSession\n * composition seam and a shared lane read model. Everything it needs\n * — the session manager, settings, model registry, live model, capability envelope, the goal\n * continuation LOOP, the isolated-completion primitive, spawned-usage accounting, and the telemetry\n * sink — is reached through narrow deps accessors rather than the whole AgentSession.\n *\n * Drive-loop boundary (deliberate): the idle triggers ({@link scheduleGoalAutoContinueFromIdle},\n * {@link scheduleResearchLaneFromIdle}) are invoked from the session's prompt tail as one-line\n * delegations; goal auto-continue itself only ever asks the session to `continueGoalLoop`, so this\n * controller never touches `prompt()`, the last-assistant-message, retry, or streaming state.\n */\n\nimport type { Api, Model } from \"@caupulican/pi-ai\";\nimport type {\n\tGoalContinuationLoopOptions,\n\tGoalContinuationLoopResult,\n\tPromptOptions,\n\tResearchLaneRunOutcome,\n\tWorkerDelegationRunOutcome,\n} from \"./agent-session-contracts.ts\";\nimport { isLaneTerminalStatus, type LaneRecord, LaneTracker } from \"./autonomy/lane-tracker.ts\";\nimport { appendLaneRecordSnapshot, getLatestLaneRecordSnapshots } from \"./autonomy/session-lane-record.ts\";\nimport { ManagedLaneController } from \"./delegation/managed-lane-controller.ts\";\nimport type {\n\tSessionRootReply,\n\tSessionRootReplyQuery,\n\tSessionRootReplyWaitOptions,\n\tSessionRootReplyWaitResult,\n} from \"./delegation/session-root-mailbox.ts\";\nimport type {\n\tSessionRootWorkerAgentMessageOptions,\n\tWorkerAgentActivity,\n\tWorkerAgentBroadcastOptions,\n\tWorkerAgentBroadcastResult,\n\tWorkerAgentControlPort,\n\tWorkerAgentControlScope,\n\tWorkerAgentMessageOptions,\n\tWorkerAgentReplyResult,\n\tWorkerAgentRetireResult,\n\tWorkerAgentTaskStartOptions,\n\tWorkerAgentTranscriptOptions,\n\tWorkerAgentWaitMode,\n\tWorkerAgentWaitResult,\n} from \"./delegation/worker-agent-control.ts\";\nimport {\n\tWorkerDelegationController,\n\ttype WorkerDelegationControllerDeps,\n} from \"./delegation/worker-delegation-controller.ts\";\nimport type { WorkerDelegationRequest } from \"./delegation/worker-delegation-request.ts\";\nimport { WorkerLifecycle } from \"./delegation/worker-lifecycle.ts\";\nimport { WorkerNotificationCoordinator } from \"./delegation/worker-notification-coordinator.ts\";\nimport type { ManagedLaneEvent } from \"./extensions/types.ts\";\nimport { GoalAutoContinueController } from \"./goals/goal-auto-continue-controller.ts\";\nimport type { GoalRuntimeSnapshot, GoalRuntimeSnapshotSettings } from \"./goals/goal-runtime-snapshot.ts\";\nimport type { GoalState } from \"./goals/goal-state.ts\";\nimport type { ModelCapabilityProfile } from \"./model-capability.ts\";\nimport type { StoredFitnessReport } from \"./models/fitness-store.ts\";\nimport type { WorkerResultContract } from \"./orchestration/contracts.ts\";\nimport type {\n\tTaskProfileCreateInput,\n\tTaskProfileCreateResult,\n\tTaskProfileInspection,\n} from \"./orchestration/task-profile-writer.ts\";\nimport type { TaskRuntimeProjection } from \"./orchestration/task-runtime.ts\";\nimport { LaneModelResolver, type LaneModelResolverDeps } from \"./research/lane-model-resolver.ts\";\nimport type { ModelFitnessReport } from \"./research/model-fitness.ts\";\nimport { ModelFitnessController, type ModelFitnessControllerDeps } from \"./research/model-fitness-controller.ts\";\nimport { ResearchLaneController, type ResearchLaneControllerDeps } from \"./research/research-lane-controller.ts\";\nimport { getActiveSessionBranchEntries } from \"./session-snapshot.ts\";\n\nexport { isLocalExecutionModel } from \"./delegation/worker-delegation-controller.ts\";\nexport { clampLaneMaxUsd } from \"./research/lane-model-resolver.ts\";\n\nexport interface BackgroundLaneControllerDeps\n\textends WorkerDelegationControllerDeps,\n\t\tResearchLaneControllerDeps,\n\t\tModelFitnessControllerDeps,\n\t\tLaneModelResolverDeps {\n\t/** True iff the active surface can terminalize a goal through `goal` or `update_goal`.\n\t * Explicit tool/profile exclusion and the worker-role ceiling still disable continuation. */\n\tisGoalToolActive(): boolean;\n\t/** Capability profile of the SESSION model (gates background lanes, scales continuation budgets). */\n\tgetModelCapabilityProfile(): ModelCapabilityProfile;\n\t/** Continuation gate + goal state for the idle autosteer scheduler. */\n\tgetGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot;\n\t/** Drive-loop boundary: the session's bounded goal-continuation loop (owns `prompt()`, not us). */\n\tcontinueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;\n\t/** True while the session owns a foreground prompt/retry/follow-up run. */\n\tisForegroundBusy(): boolean;\n\t/** Resolve only after the complete foreground retry/follow-up run releases the session. */\n\twaitForForegroundIdle(): Promise<void>;\n\t/** Persist an explicit stopped state when the selected surface cannot drive the active goal. */\n\tmarkGoalToolUnavailable(): void;\n}\n\nexport class BackgroundLaneController implements WorkerAgentControlPort {\n\t/** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */\n\tprivate readonly _laneTracker = new LaneTracker();\n\tprivate readonly _laneModels: LaneModelResolver;\n\tprivate readonly _goalAutoContinue: GoalAutoContinueController;\n\tprivate readonly _research: ResearchLaneController;\n\tprivate readonly _fitness: ModelFitnessController;\n\t/** Lazily materialized only when managed-lane state is queried or reported. */\n\tprivate _managedLanes: ManagedLaneController | undefined;\n\t/** Lazily materialized so a UAC surface without `delegate` allocates no worker runtime state. */\n\tprivate _workers: WorkerDelegationController | undefined;\n\t/** One durable lifecycle shared by every worker execution adapter. */\n\tprivate _workerLifecycle: WorkerLifecycle | undefined;\n\t/** Shared terminal outbox for managed and in-process workers; lazy under UAC omission. */\n\tprivate _workerNotifications: WorkerNotificationCoordinator | undefined;\n\t/** Active event waits consume matching terminal edges before a redundant parent wake is admitted. */\n\tprivate readonly _workerWaitConsumers = new Map<string, number>();\n\tprivate readonly deps: BackgroundLaneControllerDeps;\n\n\t/** Emit a warning without ever throwing — used from disposal-adjacent persistence where a\n\t * listener failure (or a bare test double missing `emit`) must never block or crash cleanup. */\n\tprivate _safeWarn(message: string): void {\n\t\ttry {\n\t\t\tthis.deps.emit({ type: \"warning\", message });\n\t\t} catch {\n\t\t\t// Dispose must never throw.\n\t\t}\n\t}\n\n\tprivate _recordWorkerTerminal(record: LaneRecord, durableNotificationId: string): void {\n\t\tthis._getWorkerNotificationCoordinator().recordTerminal(record, durableNotificationId);\n\t}\n\n\tconstructor(deps: BackgroundLaneControllerDeps) {\n\t\tthis.deps = deps;\n\t\tthis._laneModels = new LaneModelResolver(deps);\n\t\tthis._research = new ResearchLaneController(deps, this._laneTracker, this._laneModels);\n\t\tthis._fitness = new ModelFitnessController(deps, this._laneModels);\n\t\tthis._goalAutoContinue = new GoalAutoContinueController({\n\t\t\tisDisposed: deps.isDisposed,\n\t\t\tisGoalToolActive: deps.isGoalToolActive,\n\t\t\tgetSettingsManager: deps.getSettingsManager,\n\t\t\tgetGoalRuntimeSnapshot: deps.getGoalRuntimeSnapshot,\n\t\t\thasInFlightLaneForGoal: (goalId) => this._hasInFlightLaneForGoal(goalId),\n\t\t\tcontinueGoalLoop: deps.continueGoalLoop,\n\t\t\tisForegroundBusy: deps.isForegroundBusy,\n\t\t\twaitForForegroundIdle: deps.waitForForegroundIdle,\n\t\t\tmarkGoalToolUnavailable: deps.markGoalToolUnavailable,\n\t\t\temit: deps.emit,\n\t\t});\n\t}\n\n\tprivate _getWorkerController(): WorkerDelegationController {\n\t\tthis._workers ??= new WorkerDelegationController(\n\t\t\tthis.deps,\n\t\t\tthis._getWorkerNotificationCoordinator(),\n\t\t\tthis._getWorkerLifecycle(),\n\t\t);\n\t\treturn this._workers;\n\t}\n\n\tprivate _getWorkerLifecycle(): WorkerLifecycle {\n\t\tif (this._workerLifecycle) return this._workerLifecycle;\n\t\tconst lifecycle = new WorkerLifecycle({\n\t\t\tagentDir: this.deps.getAgentDir(),\n\t\t\tsessionId: this.deps.getSessionId(),\n\t\t});\n\t\tthis._workerLifecycle = lifecycle;\n\t\tfor (const notification of lifecycle.getPendingTerminalNotifications()) {\n\t\t\tthis._getWorkerNotificationCoordinator().recordTerminal(notification.record, notification.notificationId);\n\t\t}\n\t\treturn lifecycle;\n\t}\n\n\tprivate _getWorkerNotificationCoordinator(): WorkerNotificationCoordinator {\n\t\tthis._workerNotifications ??= new WorkerNotificationCoordinator({\n\t\t\tgetWorkerRecords: () => this._workerLifecycle?.getAllRecords() ?? [],\n\t\t\temitStatus: (status) => {\n\t\t\t\t// Runs once per flush, with the EXACT batch about to be handed to notify() -- the\n\t\t\t\t// natural checkpoint to backfill durability before that batch can get stuck behind\n\t\t\t\t// an unsettled notify() call with no durable trace. (getOutstandingRecords() is not\n\t\t\t\t// usable here: the coordinator emits status BEFORE moving this same batch from\n\t\t\t\t// `pending` into `inFlight`, so at this exact moment it would report nothing\n\t\t\t\t// outstanding — status.terminalSinceFlush is the batch, directly, no timing gap.)\n\t\t\t\tthis._ensureDurableNotifications(status.terminalSinceFlush);\n\t\t\t\ttry {\n\t\t\t\t\tthis.deps.emit({\n\t\t\t\t\t\ttype: \"delegate_workers\",\n\t\t\t\t\t\t...status,\n\t\t\t\t\t\tterminalSinceFlush: [...status.terminalSinceFlush],\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\t// A partial integration must not crash the event-driven terminal outbox.\n\t\t\t\t}\n\t\t\t},\n\t\t\tnotify: (records) => this.deps.notifyWorkerTerminalHandoff(records),\n\t\t\twarn: (message) => this._safeWarn(message),\n\t\t\tmarkDurableDelivered: (notificationIds) => this._workerLifecycle?.markNotificationsDelivered(notificationIds),\n\t\t\tisObserved: (record) => this._isWorkerTerminalAwaited(record),\n\t\t});\n\t\treturn this._workerNotifications;\n\t}\n\n\tprivate _workerAgentIdForRecord(record: Pick<LaneRecord, \"laneId\">): string {\n\t\tconst attempt =\n\t\t\tthis._workerLifecycle?.getActiveAttempt(record.laneId) ??\n\t\t\tthis._workerLifecycle?.getManagedAttempt(record.laneId);\n\t\treturn attempt?.agentId ?? attempt?.dispatch.logicalLaneId ?? record.laneId;\n\t}\n\n\tprivate _isWorkerTerminalAwaited(record: Pick<LaneRecord, \"laneId\">): boolean {\n\t\treturn (this._workerWaitConsumers.get(this._workerAgentIdForRecord(record)) ?? 0) > 0;\n\t}\n\n\tprivate _retainWorkerWaitConsumers(agentIds: readonly string[]): () => void {\n\t\tconst unique = [...new Set(agentIds)];\n\t\tfor (const agentId of unique) {\n\t\t\tthis._workerWaitConsumers.set(agentId, (this._workerWaitConsumers.get(agentId) ?? 0) + 1);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const agentId of unique) {\n\t\t\t\tconst remaining = (this._workerWaitConsumers.get(agentId) ?? 1) - 1;\n\t\t\t\tif (remaining > 0) this._workerWaitConsumers.set(agentId, remaining);\n\t\t\t\telse this._workerWaitConsumers.delete(agentId);\n\t\t\t}\n\t\t};\n\t}\n\n\t/** Observe only logical-agent terminals explicitly exposed by a bounded model result. */\n\tobserveWorkerAgentTerminals(agentIds: readonly string[]): void {\n\t\tif (!this._workerLifecycle) return;\n\t\tconst targets = new Set(agentIds);\n\t\tthis.observeWorkerTerminalRecords(\n\t\t\tthis.getLaneRecords().filter(\n\t\t\t\t(record) => isLaneTerminalStatus(record.status) && targets.has(this._workerAgentIdForRecord(record)),\n\t\t\t),\n\t\t);\n\t}\n\n\tobserveWorkerTerminalRecords(records: readonly LaneRecord[]): void {\n\t\tconst terminal = records.filter((record) => isLaneTerminalStatus(record.status));\n\t\tif (terminal.length > 0) this._getWorkerNotificationCoordinator().observeTerminals(terminal);\n\t}\n\n\t/**\n\t * Backfills a durable notification for every record about to be flushed, through the SAME\n\t * durable notification store `_getWorkerLifecycle()` already replays from on construction\n\t * (`getPendingTerminalNotifications()` / `markNotificationsDelivered()`) -- not a new\n\t * persistence subsystem. `WorkerLifecycle.getTerminalNotification()` is idempotent (it reuses\n\t * an existing durable entry for the same laneId/attemptId or creates exactly one), so calling\n\t * it for a record that already has a durable notification is a safe no-op. Without this, a\n\t * \"transient:<laneId>:<completedAt>\" record (recorded without a durableNotificationId — e.g.\n\t * because no attempt was resolvable at record time) has no trace in the durable ledger at all:\n\t * if it's still stuck behind an unresolved notify() when the process restarts, the replay on\n\t * the next construction can only find what was durably enqueued, so it would be lost instead of\n\t * replayed.\n\t */\n\tprivate _ensureDurableNotifications(records: readonly Pick<LaneRecord, \"laneId\">[]): void {\n\t\tif (!this._workerLifecycle) return;\n\t\tfor (const record of records) {\n\t\t\ttry {\n\t\t\t\tthis._workerLifecycle.getTerminalNotification(record.laneId);\n\t\t\t} catch (error) {\n\t\t\t\tthis._safeWarn(\n\t\t\t\t\t`Failed to durably back the worker terminal notification for ${record.laneId}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _getManagedLaneController(): ManagedLaneController {\n\t\tthis._managedLanes ??= new ManagedLaneController(\n\t\t\tthis.deps,\n\t\t\tthis._getWorkerLifecycle(),\n\t\t\t(record, notificationId) => this._recordWorkerTerminal(record, notificationId),\n\t\t\t(message) => this._safeWarn(message),\n\t\t);\n\t\treturn this._managedLanes;\n\t}\n\n\tprivate _hydrateManagedLanes(): void {\n\t\tif (this._managedLanes) {\n\t\t\tthis._managedLanes.ensureHydrated();\n\t\t\treturn;\n\t\t}\n\t\tconst hasPersistedActiveManagedLane = getLatestLaneRecordSnapshots(\n\t\t\tgetActiveSessionBranchEntries(this.deps.getSessionManager()),\n\t\t).some((record) => record.type === \"tmux-worker\" && (record.status === \"queued\" || record.status === \"running\"));\n\t\tif (hasPersistedActiveManagedLane) this._getManagedLaneController().ensureHydrated();\n\t}\n\n\t/** Live lane records tracked by this process (running and terminal). */\n\tgetLaneRecords(): LaneRecord[] {\n\t\tthis._hydrateManagedLanes();\n\t\tconst workerRecords =\n\t\t\tthis._workers?.getRecords() ??\n\t\t\t(this.deps.isDelegateToolActive?.() ? this._getWorkerController().getRecords() : []);\n\t\treturn [\n\t\t\t...this._laneTracker.getRecords(),\n\t\t\t...workerRecords,\n\t\t\t...(this._workerLifecycle?.getManagedRecords() ?? []),\n\t\t];\n\t}\n\n\t/** Does not materialize the worker controller when UAC omitted delegation. */\n\tgetTaskRuntimeSnapshot(): TaskRuntimeProjection | undefined {\n\t\treturn this._workerLifecycle?.getTaskRuntimeSnapshot();\n\t}\n\n\tgetWorkerResult(laneId: string): WorkerResultContract | undefined {\n\t\treturn this._workerLifecycle?.getResult(laneId);\n\t}\n\n\t/** Reconcile only when delegation has already been materialized; UAC omission stays zero-load. */\n\tsynchronizeGoalState(goal: GoalState): void {\n\t\tthis._workers?.synchronizeGoalState(goal);\n\t}\n\n\t/**\n\t * Resolve a tracked managed-lane dispatch. The caller's stable id is also the canonical durable\n\t * lane id, so this is an existence check rather than an id translation.\n\t */\n\tresolveManagedLaneId(callerLaneId: string): string | undefined {\n\t\treturn this._getManagedLaneController().resolve(callerLaneId);\n\t}\n\n\t/** Live count of active lanes — the real source for AutonomyStatusSnapshot.activeLaneCount. */\n\tgetActiveLaneCount(): number {\n\t\treturn this.getLaneRecords().filter((record) => record.status === \"queued\" || record.status === \"running\").length;\n\t}\n\n\t/** Belt-and-braces guard: whether ANY queued/running lane is tagged with this goalId. */\n\tprivate _hasInFlightLaneForGoal(goalId: string): boolean {\n\t\treturn this.getLaneRecords().some(\n\t\t\t(record) => record.goalId === goalId && (record.status === \"queued\" || record.status === \"running\"),\n\t\t);\n\t}\n\n\t/** Delegate the out-of-process dispatch/terminal claim to its single lifecycle owner. */\n\trecordManagedLane(event: ManagedLaneEvent): LaneRecord | undefined {\n\t\treturn this._getManagedLaneController().record(event);\n\t}\n\n\t/** Why the last idle research-lane evaluation skipped, for /autonomy diagnostics. */\n\tgetLastResearchLaneSkipReason(): string | undefined {\n\t\treturn this._research.getLastSkipReason();\n\t}\n\n\t/**\n\t * Abort in-flight research and delegate worker disposal to its single owning controller.\n\t *\n\t * This synchronous body is the LAST provably-safe write window for canceled/in-flight work.\n\t * `dispose()` (agent-session.ts) has already set the session's own disposed flag but has not yet\n\t * returned — no successor session (e.g. a `/reload` adoption) can exist yet, so an append here\n\t * cannot interleave with one; a post-await continuation resuming AFTER this method returns must\n\t * not append (see the disposed branch in `runWorkerDelegationOnce`). Persist FIRST, then\n\t * complete-in-memory, so a throw from one lane's persist cannot skip another's; each persist gets\n\t * its own try/catch — dispose must never throw.\n\t */\n\tabortInFlightLanes(): void {\n\t\tthis._goalAutoContinue.clearTimer();\n\t\tthis._research.abort();\n\t\tthis._fitness.abort();\n\t\tfor (const record of this._laneTracker.getRecords()) {\n\t\t\tif (record.status !== \"queued\" && record.status !== \"running\") continue;\n\t\t\tif (record.type === \"tmux-worker\") continue;\n\t\t\tconst canceled = this._laneTracker.complete(record.laneId, {\n\t\t\t\tstatus: \"canceled\",\n\t\t\t\treasonCode: \"session_disposed\",\n\t\t\t});\n\t\t\tif (!canceled) continue;\n\t\t\ttry {\n\t\t\t\tappendLaneRecordSnapshot(this.deps.getSessionManager(), canceled);\n\t\t\t} catch (error) {\n\t\t\t\tthis._safeWarn(\n\t\t\t\t\t`Failed to persist canceled lane record ${canceled.laneId}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthis._managedLanes?.release();\n\n\t\tthis._workers?.abort();\n\t\tthis._workerNotifications?.dispose();\n\t}\n\n\tclearGoalAutoContinueTimer(): void {\n\t\tthis._goalAutoContinue.clearTimer();\n\t}\n\n\tscheduleGoalAutoContinueFromIdle(options?: PromptOptions): void {\n\t\tthis._goalAutoContinue.scheduleFromIdle(options);\n\t}\n\n\t/**\n\t * Single-flight entry point for EVERY goal-continuation loop invocation — idle autosteer\n\t * ({@link _runScheduledGoalAutoContinue}) AND the manual `/goal start` / `/goal-continue`\n\t * commands (reached through `AgentSession.continueGoalLoop`). Both paths ultimately submit\n\t * continuation prompts through the session's single `prompt()` path, so two loops racing throws\n\t * \"Agent is already processing\" from whichever submits second. `_isGoalAutoContinuing` is the\n\t * ONE owner of that mutex; `deps.continueGoalLoop` (the raw {@link GoalLoopController} loop)\n\t * must never be called directly outside this method, or the guard is bypassed.\n\t */\n\tasync continueGoalLoopExclusive(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult> {\n\t\treturn this._goalAutoContinue.continueExclusive(options);\n\t}\n\n\tclearResearchLaneTimer(): void {\n\t\tthis._research.clearTimer();\n\t}\n\n\tscheduleResearchLaneFromIdle(): void {\n\t\tthis._research.scheduleFromIdle();\n\t}\n\n\tresolveLaneModel(configuredPattern: string | undefined): Model<Api> | undefined {\n\t\treturn this._laneModels.resolveModel(configuredPattern);\n\t}\n\n\tgetOrchestrationProfileCatalog(): Array<{ profileId: string; role: string; description: string }> {\n\t\treturn this._getWorkerController().getProfileCatalog();\n\t}\n\n\tinspectTaskProfileOptions(): TaskProfileInspection {\n\t\treturn this._getWorkerController().inspectTaskProfileOptions();\n\t}\n\n\tcreateTaskProfile(input: TaskProfileCreateInput): TaskProfileCreateResult {\n\t\treturn this._getWorkerController().createTaskProfile(input);\n\t}\n\n\t/**\n\t * Run one bounded, read-only research pass and persist its results: evidence bundle snapshot,\n\t * terminal lane record, and spawned-usage cost report (single-hop invariant, idempotent on the\n\t * lane's reportId). Explicit calls (e.g. `/autonomy research`) express user intent and bypass the\n\t * enabled/mode/dedupe gates the idle scheduler enforces; budget and capability gates always apply.\n\t */\n\tasync runResearchLaneOnce(request?: {\n\t\tquery?: string;\n\t\tcontext?: string;\n\t\tgoalId?: string;\n\t}): Promise<ResearchLaneRunOutcome> {\n\t\treturn this._research.runOnce(request);\n\t}\n\t/** Start a durable recursive agent with inherited, preset, or model-selected authority. */\n\tstartWorkerDelegation(\n\t\trequest: WorkerDelegationRequest,\n\t): { started: false; skipReason: string } | { started: true; record: LaneRecord } {\n\t\treturn this._getWorkerController().start(request);\n\t}\n\n\t/** Durable logical-worker controls. Each checks UAC before materializing worker state. */\n\tlistWorkerAgents(scope?: WorkerAgentControlScope): ReturnType<WorkerAgentControlPort[\"listWorkerAgents\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().listWorkerAgents(scope);\n\t}\n\n\tgetWorkerTaskSessionView(): ReturnType<WorkerAgentControlPort[\"getWorkerTaskSessionView\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().getWorkerTaskSessionView();\n\t}\n\n\tgetWorkerAgentActivity(agentId: string, scope?: WorkerAgentControlScope): WorkerAgentActivity {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tconst activity = this._getWorkerController().getAgentControl().getWorkerAgentActivity(agentId, scope);\n\t\tthis.observeWorkerAgentTerminals([agentId]);\n\t\treturn activity;\n\t}\n\n\treadWorkerAgentTranscript(\n\t\tagentId: string,\n\t\toptions?: WorkerAgentTranscriptOptions,\n\t): ReturnType<WorkerAgentControlPort[\"readWorkerAgentTranscript\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tconst page = this._getWorkerController().getAgentControl().readWorkerAgentTranscript(agentId, options);\n\t\tthis.observeWorkerAgentTerminals([agentId]);\n\t\treturn page;\n\t}\n\n\tsendWorkerAgentMessage(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentMessageOptions,\n\t): { messageId: string; queued: true } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().sendWorkerAgentMessage(agentId, message, options);\n\t}\n\n\tfollowUpWorkerAgent(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentMessageOptions,\n\t): { started: boolean; steering: boolean; messageId: string; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().followUpWorkerAgent(agentId, message, options);\n\t}\n\n\tsendSessionRootWorkerAgentMessage(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: SessionRootWorkerAgentMessageOptions,\n\t): { messageId: string; queued: true } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().sendSessionRootWorkerAgentMessage(agentId, message, options);\n\t}\n\n\tfollowUpSessionRootWorkerAgent(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: SessionRootWorkerAgentMessageOptions,\n\t): { started: boolean; steering: boolean; messageId: string; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().followUpSessionRootWorkerAgent(agentId, message, options);\n\t}\n\n\treplyToWorkerAgentMessage(sourceAgentId: string, message: string, replyToMessageId: string): WorkerAgentReplyResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController()\n\t\t\t.getAgentControl()\n\t\t\t.replyToWorkerAgentMessage(sourceAgentId, message, replyToMessageId);\n\t}\n\n\tlistSessionRootReplies(query?: SessionRootReplyQuery): SessionRootReply[] {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().listSessionRootReplies(query);\n\t}\n\n\twaitForSessionRootReplies(options?: SessionRootReplyWaitOptions): Promise<SessionRootReplyWaitResult> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().waitForSessionRootReplies(options);\n\t}\n\n\tacknowledgeSessionRootReply(messageId: string, ackToken: string): boolean {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().acknowledgeSessionRootReply(messageId, ackToken);\n\t}\n\n\treconcileSessionRootReplies(): void {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tthis._getWorkerController().getAgentControl().reconcileSessionRootReplies();\n\t}\n\n\tstartWorkerAgentTask(\n\t\tagentId: string,\n\t\tmessage: string,\n\t\toptions?: WorkerAgentTaskStartOptions,\n\t): ReturnType<WorkerAgentControlPort[\"startWorkerAgentTask\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().startWorkerAgentTask(agentId, message, options);\n\t}\n\n\tinterruptWorkerAgent(agentId: string, scope?: WorkerAgentControlScope): { interrupted: boolean; reason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().interruptWorkerAgent(agentId, scope);\n\t}\n\n\tresumeWorkerAgent(\n\t\tagentId: string,\n\t\tscope?: WorkerAgentControlScope,\n\t): { started: boolean; record?: LaneRecord; skipReason?: string } {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().resumeWorkerAgent(agentId, scope);\n\t}\n\n\tcancelWorkerAgent(agentId: string, reasonCode?: string, scope?: WorkerAgentControlScope): LaneRecord | undefined {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().cancelWorkerAgent(agentId, reasonCode, scope);\n\t}\n\n\tretireWorkerAgent(agentId: string, scope?: WorkerAgentControlScope): WorkerAgentRetireResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().retireWorkerAgent(agentId, scope);\n\t}\n\n\twaitForWorkerAgent(\n\t\tagentId: string,\n\t\ttimeoutMs?: number,\n\t\tscope?: WorkerAgentControlScope,\n\t): ReturnType<WorkerAgentControlPort[\"waitForWorkerAgent\"]> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tconst release = this._retainWorkerWaitConsumers([agentId]);\n\t\tlet wait: ReturnType<WorkerAgentControlPort[\"waitForWorkerAgent\"]>;\n\t\ttry {\n\t\t\twait = this._getWorkerController().getAgentControl().waitForWorkerAgent(agentId, timeoutMs, scope);\n\t\t} catch (error) {\n\t\t\trelease();\n\t\t\tthrow error;\n\t\t}\n\t\treturn wait\n\t\t\t.then((result) => {\n\t\t\t\tthis.observeWorkerAgentTerminals([agentId]);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t\t.finally(release);\n\t}\n\n\twaitForWorkerAgents(\n\t\tagentIds: readonly string[],\n\t\tmode: WorkerAgentWaitMode,\n\t\ttimeoutMs?: number,\n\t\tscope?: WorkerAgentControlScope,\n\t): Promise<WorkerAgentWaitResult> {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\tconst release = this._retainWorkerWaitConsumers(agentIds);\n\t\tlet wait: Promise<WorkerAgentWaitResult>;\n\t\ttry {\n\t\t\twait = this._getWorkerController().getAgentControl().waitForWorkerAgents(agentIds, mode, timeoutMs, scope);\n\t\t} catch (error) {\n\t\t\trelease();\n\t\t\tthrow error;\n\t\t}\n\t\treturn wait\n\t\t\t.then((result) => {\n\t\t\t\tthis.observeWorkerAgentTerminals(agentIds);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t\t.finally(release);\n\t}\n\n\tbroadcastWorkerAgentMessage(\n\t\tagentIds: readonly string[],\n\t\tmessage: string,\n\t\toptions: WorkerAgentBroadcastOptions,\n\t): WorkerAgentBroadcastResult {\n\t\tif (!this.deps.isDelegateToolActive())\n\t\t\tthrow new Error(\"Worker delegation control is unavailable in this UAC surface.\");\n\t\treturn this._getWorkerController().getAgentControl().broadcastWorkerAgentMessage(agentIds, message, options);\n\t}\n\n\t/** Run one worker immediately; used by focused integrations and tests. */\n\tasync runWorkerDelegationOnce(\n\t\trequest: WorkerDelegationRequest,\n\t\tonStarted?: (record: LaneRecord) => void,\n\t\texistingRecord?: LaneRecord,\n\t): Promise<WorkerDelegationRunOutcome> {\n\t\treturn this._getWorkerController().runOnce(request, onStarted, existingRecord);\n\t}\n\t/**\n\t * Probe a candidate model against the subagent contracts (research/worker/judge/search/\n\t * tool-call surfaces) via {@link runModelFitnessProbe}. The model must resolve and\n\t * authenticate; every probe call runs as an isolated completion on that model, and probe\n\t * spend is reported through spawned-usage accounting.\n\t */\n\tasync runModelFitness(args: {\n\t\tmodel: string;\n\t\ttrials?: number;\n\t\t/** LLM tool-call id, present only via the model_fitness tool path — see model-fitness.ts. */\n\t\ttoolCallId?: string;\n\t}): Promise<{ started: true; model: string; report: ModelFitnessReport } | { started: false; skipReason: string }> {\n\t\treturn this._fitness.run(args);\n\t}\n\n\t/** Start every capacity-eligible queued worker at the owner session's foreground-idle boundary. */\n\tdrainQueuedWorkerDelegations(): void {\n\t\tif (this.deps.isDelegateToolActive?.()) this._getWorkerController().drain();\n\t}\n\n\t/** Fitness reports persisted for THIS host (measured evidence for architect/profile decisions). */\n\tgetStoredFitnessReports(): StoredFitnessReport[] {\n\t\treturn this._fitness.getStoredReports();\n\t}\n}\n"]}
@@ -6,6 +6,7 @@ export declare const DEFAULT_BACKGROUND_TOOL_CALL_AFTER_MS = 15000;
6
6
  export declare const DEFAULT_BACKGROUND_TOOL_TASK_WAIT_TIMEOUT_MS = 30000;
7
7
  export declare const BACKGROUND_TOOL_TASK_CUSTOM_TYPE = "background_tool_task";
8
8
  export type BackgroundToolTaskStatus = "running" | "completed" | "failed" | "canceled";
9
+ export type BackgroundToolTerminalDelivery = "pending" | "delivered";
9
10
  export type BackgroundToolTaskRef = Pick<BackgroundToolTaskRecord, "taskId" | "toolCallId" | "status">;
10
11
  /** Match a goal/task_steps evidence uri to a session background tool task by task id or toolCallId. */
11
12
  export declare function findBackgroundToolTask<T extends BackgroundToolTaskRef>(records: readonly T[], uri: string): T | undefined;
@@ -29,6 +30,10 @@ export interface BackgroundToolTaskRecord {
29
30
  artifactId?: string;
30
31
  usage?: Usage;
31
32
  cancellationRequested?: boolean;
33
+ /** Durable terminal handoff state. Undefined on legacy records, which are treated as delivered. */
34
+ terminalDelivery?: BackgroundToolTerminalDelivery;
35
+ /** Runtime-only receipt; never serialized into the durable task record. */
36
+ observedAt?: string;
32
37
  }
33
38
  export interface BackgroundToolTaskLiveView {
34
39
  taskId: string;
@@ -79,13 +84,20 @@ export declare class BackgroundToolTaskController {
79
84
  private readonly tasks;
80
85
  private readonly handoffRequests;
81
86
  private readonly queuedNotifications;
87
+ private readonly activeNotificationRecords;
82
88
  private notificationDrain;
89
+ private notificationRetryTimer;
90
+ private notificationRetryCompletion;
91
+ private resolveNotificationRetry;
92
+ private notificationRetryCount;
83
93
  private readonly waitTimeoutMs;
84
94
  private nextTaskId;
85
95
  private disposed;
86
96
  constructor(deps: BackgroundToolTaskControllerDeps);
87
97
  handoff(context: BackgroundToolCallContext): BackgroundToolCallHandoff | undefined;
88
98
  list(): BackgroundToolTaskRecord[];
99
+ /** Model-facing read that consumes terminal delivery without approving its outcome. */
100
+ observe(taskIds?: string | readonly string[]): BackgroundToolTaskRecord[];
89
101
  wait(taskId: string, signal?: AbortSignal): Promise<BackgroundToolTaskRecord>;
90
102
  cancel(taskId: string): boolean;
91
103
  subscribeHandoffRequest(toolCallId: string, request: () => void): () => void;
@@ -99,7 +111,10 @@ export declare class BackgroundToolTaskController {
99
111
  private finishState;
100
112
  private persist;
101
113
  private notify;
114
+ private markNotificationDelivered;
115
+ private observeState;
102
116
  private scheduleNotificationDrain;
117
+ private scheduleNotificationRetry;
103
118
  private drainNotifications;
104
119
  private emitLiveTasks;
105
120
  private pruneTerminalTasks;
@@ -1 +1 @@
1
- {"version":3,"file":"background-tool-task-controller.d.ts","sourceRoot":"","sources":["../../src/core/background-tool-task-controller.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