@caupulican/pi-adaptative 0.90.2 → 0.90.4

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 (162) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/core/agent-session-contracts.d.ts +2 -0
  3. package/dist/core/agent-session-contracts.d.ts.map +1 -1
  4. package/dist/core/agent-session-contracts.js.map +1 -1
  5. package/dist/core/autonomy/bounded-completion.d.ts +10 -1
  6. package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
  7. package/dist/core/autonomy/bounded-completion.js +24 -2
  8. package/dist/core/autonomy/bounded-completion.js.map +1 -1
  9. package/dist/core/autonomy/lane-tracker.d.ts +1 -1
  10. package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
  11. package/dist/core/autonomy/lane-tracker.js +9 -1
  12. package/dist/core/autonomy/lane-tracker.js.map +1 -1
  13. package/dist/core/background-lane-controller.d.ts +1 -3
  14. package/dist/core/background-lane-controller.d.ts.map +1 -1
  15. package/dist/core/background-lane-controller.js.map +1 -1
  16. package/dist/core/compaction-controller.d.ts.map +1 -1
  17. package/dist/core/compaction-controller.js +0 -1
  18. package/dist/core/compaction-controller.js.map +1 -1
  19. package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -1
  20. package/dist/core/delegation/managed-lane-controller.js +5 -1
  21. package/dist/core/delegation/managed-lane-controller.js.map +1 -1
  22. package/dist/core/delegation/worker-agent-control-coordinator.d.ts +8 -1
  23. package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
  24. package/dist/core/delegation/worker-agent-control-coordinator.js +94 -36
  25. package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
  26. package/dist/core/delegation/worker-agent-control.d.ts +1 -0
  27. package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
  28. package/dist/core/delegation/worker-agent-control.js.map +1 -1
  29. package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
  30. package/dist/core/delegation/worker-attempt-executor.js +7 -2
  31. package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
  32. package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
  33. package/dist/core/delegation/worker-authority-resolver.js +26 -3
  34. package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
  35. package/dist/core/delegation/worker-delegation-controller.d.ts +7 -4
  36. package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
  37. package/dist/core/delegation/worker-delegation-controller.js +110 -27
  38. package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
  39. package/dist/core/delegation/worker-fleet-limits.d.ts +9 -2
  40. package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -1
  41. package/dist/core/delegation/worker-fleet-limits.js +39 -3
  42. package/dist/core/delegation/worker-fleet-limits.js.map +1 -1
  43. package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -1
  44. package/dist/core/delegation/worker-lane-projection.js +4 -0
  45. package/dist/core/delegation/worker-lane-projection.js.map +1 -1
  46. package/dist/core/delegation/worker-lease-heartbeat.d.ts +16 -0
  47. package/dist/core/delegation/worker-lease-heartbeat.d.ts.map +1 -0
  48. package/dist/core/delegation/worker-lease-heartbeat.js +37 -0
  49. package/dist/core/delegation/worker-lease-heartbeat.js.map +1 -0
  50. package/dist/core/delegation/worker-lifecycle.d.ts +1 -0
  51. package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
  52. package/dist/core/delegation/worker-lifecycle.js +6 -0
  53. package/dist/core/delegation/worker-lifecycle.js.map +1 -1
  54. package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -1
  55. package/dist/core/delegation/worker-notification-coordinator.js +2 -1
  56. package/dist/core/delegation/worker-notification-coordinator.js.map +1 -1
  57. package/dist/core/delegation/worker-runner.js +2 -2
  58. package/dist/core/delegation/worker-runner.js.map +1 -1
  59. package/dist/core/delegation/worker-terminal-handoff-coordinator.d.ts +1 -0
  60. package/dist/core/delegation/worker-terminal-handoff-coordinator.d.ts.map +1 -1
  61. package/dist/core/delegation/worker-terminal-handoff-coordinator.js +1 -0
  62. package/dist/core/delegation/worker-terminal-handoff-coordinator.js.map +1 -1
  63. package/dist/core/delegation/worker-tree-budget-coordinator.d.ts +4 -2
  64. package/dist/core/delegation/worker-tree-budget-coordinator.d.ts.map +1 -1
  65. package/dist/core/delegation/worker-tree-budget-coordinator.js +10 -2
  66. package/dist/core/delegation/worker-tree-budget-coordinator.js.map +1 -1
  67. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +14 -0
  68. package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
  69. package/dist/core/delegation/worker-write-reservation-coordinator.js +121 -33
  70. package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
  71. package/dist/core/foreground-terminal-handoff-controller.d.ts +5 -0
  72. package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
  73. package/dist/core/foreground-terminal-handoff-controller.js +28 -12
  74. package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
  75. package/dist/core/orchestration/capability-gateway.d.ts +2 -1
  76. package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
  77. package/dist/core/orchestration/capability-gateway.js +9 -2
  78. package/dist/core/orchestration/capability-gateway.js.map +1 -1
  79. package/dist/core/orchestration/contracts.d.ts +16 -1
  80. package/dist/core/orchestration/contracts.d.ts.map +1 -1
  81. package/dist/core/orchestration/contracts.js +5 -0
  82. package/dist/core/orchestration/contracts.js.map +1 -1
  83. package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
  84. package/dist/core/orchestration/profile-registry.js +38 -1
  85. package/dist/core/orchestration/profile-registry.js.map +1 -1
  86. package/dist/core/orchestration/risk-budget.d.ts +10 -0
  87. package/dist/core/orchestration/risk-budget.d.ts.map +1 -1
  88. package/dist/core/orchestration/risk-budget.js +14 -0
  89. package/dist/core/orchestration/risk-budget.js.map +1 -1
  90. package/dist/core/orchestration/task-runtime-reducer.d.ts +1 -0
  91. package/dist/core/orchestration/task-runtime-reducer.d.ts.map +1 -1
  92. package/dist/core/orchestration/task-runtime-reducer.js +34 -0
  93. package/dist/core/orchestration/task-runtime-reducer.js.map +1 -1
  94. package/dist/core/orchestration/task-runtime.d.ts +1 -0
  95. package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
  96. package/dist/core/orchestration/task-runtime.js +24 -1
  97. package/dist/core/orchestration/task-runtime.js.map +1 -1
  98. package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
  99. package/dist/core/provider-prompt-contracts.js +2 -1
  100. package/dist/core/provider-prompt-contracts.js.map +1 -1
  101. package/dist/core/reflection-controller.d.ts.map +1 -1
  102. package/dist/core/reflection-controller.js +8 -1
  103. package/dist/core/reflection-controller.js.map +1 -1
  104. package/dist/core/settings-manager.d.ts +2 -2
  105. package/dist/core/settings-manager.d.ts.map +1 -1
  106. package/dist/core/settings-manager.js +2 -2
  107. package/dist/core/settings-manager.js.map +1 -1
  108. package/dist/core/tools/bash.d.ts +3 -0
  109. package/dist/core/tools/bash.d.ts.map +1 -1
  110. package/dist/core/tools/bash.js +13 -2
  111. package/dist/core/tools/bash.js.map +1 -1
  112. package/dist/core/tools/delegate-status.d.ts +1 -0
  113. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  114. package/dist/core/tools/delegate-status.js +19 -1
  115. package/dist/core/tools/delegate-status.js.map +1 -1
  116. package/dist/core/tools/delegate.d.ts +9 -1
  117. package/dist/core/tools/delegate.d.ts.map +1 -1
  118. package/dist/core/tools/delegate.js +198 -64
  119. package/dist/core/tools/delegate.js.map +1 -1
  120. package/dist/core/tools/edit.d.ts.map +1 -1
  121. package/dist/core/tools/edit.js +14 -1
  122. package/dist/core/tools/edit.js.map +1 -1
  123. package/dist/core/tools/file-failure-recovery.d.ts +3 -0
  124. package/dist/core/tools/file-failure-recovery.d.ts.map +1 -1
  125. package/dist/core/tools/file-failure-recovery.js +11 -0
  126. package/dist/core/tools/file-failure-recovery.js.map +1 -1
  127. package/dist/core/tools/orchestration-panel.d.ts +1 -1
  128. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  129. package/dist/core/tools/orchestration-panel.js +1 -0
  130. package/dist/core/tools/orchestration-panel.js.map +1 -1
  131. package/dist/core/tools/profile-writer.d.ts.map +1 -1
  132. package/dist/core/tools/profile-writer.js +2 -8
  133. package/dist/core/tools/profile-writer.js.map +1 -1
  134. package/dist/core/tools/search-command-guard.d.ts.map +1 -1
  135. package/dist/core/tools/search-command-guard.js +10 -3
  136. package/dist/core/tools/search-command-guard.js.map +1 -1
  137. package/dist/core/tools/write.d.ts.map +1 -1
  138. package/dist/core/tools/write.js +10 -1
  139. package/dist/core/tools/write.js.map +1 -1
  140. package/dist/modes/interactive/components/activity-lane.d.ts +1 -1
  141. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -1
  142. package/dist/modes/interactive/components/activity-lane.js +11 -2
  143. package/dist/modes/interactive/components/activity-lane.js.map +1 -1
  144. package/dist/modes/interactive/components/settings-selector.js +1 -1
  145. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  146. package/dist/utils/shell.d.ts +2 -0
  147. package/dist/utils/shell.d.ts.map +1 -1
  148. package/dist/utils/shell.js +3 -1
  149. package/dist/utils/shell.js.map +1 -1
  150. package/docs/harness-architecture.md +6 -3
  151. package/docs/settings.md +8 -6
  152. package/docs/tool-repair.md +1 -1
  153. package/docs/worker-profiles.md +2 -2
  154. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  155. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  156. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  157. package/examples/extensions/sandbox/package-lock.json +2 -2
  158. package/examples/extensions/sandbox/package.json +1 -1
  159. package/examples/extensions/with-deps/package-lock.json +2 -2
  160. package/examples/extensions/with-deps/package.json +1 -1
  161. package/npm-shrinkwrap.json +12 -12
  162. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## [0.90.4] - 2026-08-12
2
+
3
+ ## [0.90.3] - 2026-08-12
4
+
5
+ ### Fixed
6
+
7
+ - Removed the implicit `$0.50` and two-minute worker-tree ceilings while preserving explicitly configured global, profile, and inherited budgets.
8
+ - Renewed durable worker leases during long provider and tool waits so active workers can checkpoint and publish terminal handoffs after the original lease expiry, with host-safe intervals for explicitly unbounded leases.
9
+ - Rejected `laneId` on `delegate start` instead of silently discarding it and creating an unexpectedly anonymous worker.
10
+ - Preserved provider-authored `delegate` arguments while sanitizing action-specific dispatch copies so durable worker transcripts cannot diverge after tool execution.
11
+ - Retried provider-neutral isolated worker error completions and retained bounded failure detail for durable recovery instead of flattening them to `model_error`.
12
+ - Suppressed ineffective auto-compaction retries when the next context estimate drifts downward without material growth.
13
+ - Classified recursive ancestor-directory shell searches as broad and exposed the existing bash timeout ceiling in the tool schema so model-generated calls cannot silently request millisecond-style hour-long commands.
14
+ - Kept ordinary fresh delegation lean when budget authority is omitted, exposed explicit per-worker authority ceilings alongside inherited and profile budgets, removed the runtime-only verifier role from the model-facing start contract, restored bounded recursion to the profile-free baseline, and kept that recursion when ordinary worker tools are narrowed unless an explicit capability restriction makes the worker a leaf.
15
+ - Limited profile-free workers to one direct child at depth one through immutable admission state, while preserving broader owner-authored profile limits and preventing descendants from widening an ancestor's limit.
16
+ - Limited the lean profile-free session to one retained nested identity across all root workers so parallel roots cannot each create a duplicate child tree; authored profiles can explicitly raise the session-wide nested limit.
17
+ - Aligned PowerShell discovery with its cold-start availability probe and bounded the native incident-collector test around both PowerShell subprocesses under loaded Windows/WSL hosts.
18
+ - Marked broad-search guard rejections as pre-execution operation feedback so compaction cannot promote a corrected search call into a harness failure.
19
+ - Defaulted nested workers to self-contained birth context so foreground orchestration instructions cannot make a scoped read-only leaf report missing parent authority as a harness failure; explicit same-model inheritance remains available.
20
+ - Marked inherited foreground history as context-only in the mandatory worker system contract so parent-owned orchestration cannot override the latest task envelope or consume nested capacity.
21
+ - Classified queued workers as admitted event-driven work across start, status, and task projections, forbade interrupting healthy workers to force a queue, taught read-only authority narrowing for genuine parallel review, and required cancellation of a superseded queued task after its replacement starts so safety serialization cannot become duplicate execution.
22
+ - Preserved review-pending results as `partial`, project-level blockers as `blocked`, and evidence-classified retries as nonterminal so foreground orchestration does not mistake them for harness failures.
23
+ - Rejected worker self-waits and made child waits yield then reacquire the caller's exact fenced write reservation so queued recursive orchestration can run without concurrent mutation or a parent-created deadlock.
24
+ - Identified depth, direct-child, nested-session, and session identity capacity denials as expected policy outcomes and directed workers to reuse an eligible idle worker instead of misreporting the denial as harness instability.
25
+ - Required parents to drain every paginated child transcript before judging a terminal handoff and added mandatory literal guidance that delivered `worker_blocked` claims are task blockers, not lost worker state or harness failures.
26
+ - Allowed one exact failed shell probe to run again after a successful `edit` or `write` mutation in the same canonical workspace, while keeping policy failures, unrelated workspaces, and untrusted custom adapters isolated.
27
+ - Distinguished explicit-reply inbox waits from worker-completion waits, preserved pre-deadline completion through delayed caller-resource restoration, reported late idle results as completed-after-timeout, required non-timeout idle waits to retrieve durable claims through status or every transcript page, classified suspended workers as durable nonterminal state with host-owned retry guidance, and added mandatory literal timeout and follow-up guidance so waits cannot become false worker stalls or missed-completion diagnoses.
28
+ - Rejected profile-only `task` and top-level `budget` fields on `delegate start` instead of silently dropping a child objective or turning explicitly bounded work into an unbudgeted dispatch; mandatory guidance classifies both as expected API corrections and requires one immediate retry with the value unchanged in `instructions` or `authority.budget`.
29
+ - Preserved attempt-local and worker-tree budget exhaustion as authoritative `budget_exhausted` terminal outcomes instead of flattening bounded denials to generic `completion_error` failures, with mandatory handoff guidance that earlier transient transcript errors cannot replace the terminal cause.
30
+ - Classified an unknown optional worker profile as correctable routing policy, with mandatory guidance to omit `profileId` for adaptive authority or use an exact listed preset instead of reporting harness failure.
31
+ - Classified unavailable optional worker models and presets as correctable routing policy, with mandatory guidance to omit the model/profile selection and inherit adaptive authority instead of reporting harness failure.
32
+ - Classified `agentId` as reuse-only in mandatory guidance and treated an unknown reuse identifier as a side-effect-free API correction rather than lost worker state or harness failure, preserving the instructions and intended authority for one fresh retry.
33
+ - Kept the fully wired root delegate schema and guideline surfaces below the provider startup ceilings while retaining explicit budgets and mandatory caveman task, budget, timeout, reuse, and profile rules.
34
+ - Kept terminal worker execution errors separate from harness health and added mandatory caveman handoff/status guidance that tool timeouts and provider, API, network, WebSocket, fetch, overload, or exhausted-retry failures must not stop healthy siblings unless orchestration state, delivery, or control evidence actually fails.
35
+
1
36
  ## [0.90.2] - 2026-08-11
2
37
 
3
38
  ## [0.90.1] - 2026-08-11
@@ -264,6 +264,8 @@ export interface IsolatedCompletionResult {
264
264
  text: string;
265
265
  usage: Usage;
266
266
  stopReason: StopReason;
267
+ /** Provider diagnostic for an error stop; lane owners classify it without parsing transcript history. */
268
+ errorMessage?: string;
267
269
  /** Complete child-owned conversation; isolated calls never expose foreground history. */
268
270
  messages?: Message[];
269
271
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session-contracts.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,KAAK,EACL,UAAU,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,sBAAsB,EACtB,eAAe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A0B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,MAAM,8BAA8B,GACvC,0BAA0B,GAC1B,mBAAmB,GACnB,2BAA2B,GAC3B,uBAAuB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,uBAAuB,GACvB,kBAAkB,CAAC;AAEtB,MAAM,WAAW,2BAA4B,SAAQ,2BAA2B;IAC/E,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,8BAA8B,CAAC;IAC3C,aAAa,EAAE,mBAAmB,CAAC;CACnC;AAED,yFAAyF;AACzF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"agent-session-contracts.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,KAAK,EACL,UAAU,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAA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4BAA4B,CAAC;AAyEnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,KAA6B,EAAE,YAAoB;IAC3G,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;IAC3E,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC;SACjC,MAAM,CAAC,CAAC,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChF,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACf,OAAO,QAAQ,QAAQ,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport type {\n\tAgent,\n\tAgentEvent,\n\tAgentLoopConfig,\n\tAgentMessage,\n\tAgentTool,\n\tStreamIdleOptions,\n\tThinkingLevel,\n} from \"@caupulican/pi-agent-core\";\nimport type { CompactionResult, SessionManager } from \"@caupulican/pi-agent-core/node\";\nimport type { Api, CacheRetention, ImageContent, Message, Model, StopReason, Usage } from \"@caupulican/pi-ai\";\nimport type { LaneRecord, LaneTerminalStatus } from \"./autonomy/lane-tracker.ts\";\nimport type { BackgroundToolTaskLiveView } from \"./background-tool-task-controller.ts\";\nimport type { WorkerRunOutcome } from \"./delegation/worker-runner.ts\";\nimport type {\n\tContextUsage,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionErrorListener,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tInputSource,\n\tSessionStartEvent,\n\tShutdownHandler,\n\tToolDefinition,\n} from \"./extensions/index.ts\";\nimport type { GoalContinuationPrompt } from \"./goals/goal-continuation-prompt.ts\";\nimport type { GoalRuntimeSnapshot } from \"./goals/goal-runtime-snapshot.ts\";\nimport type { ModelRegistry } from \"./model-registry.ts\";\nimport type { LocalRuntimeDeps } from \"./models/local-runtime.ts\";\nimport type { OrchestrationProfile } from \"./orchestration/contracts.ts\";\nimport type { ResearchRunResult } from \"./research/research-runner.ts\";\nimport type { collectWorkspaceSources } from \"./research/workspace-collector.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { ResourceProfileFilterSettings, SettingsManager } from \"./settings-manager.ts\";\nimport type { ToolArgumentValidationStats } from \"./tool-recovery-stats.ts\";\n\nexport { type ParsedSkillBlock, parseSkillBlock } from \"./skill-block.mjs\";\n\n/** Session-specific events that extend the core AgentEvent. */\nexport type AgentSessionEvent =\n\t| Exclude<AgentEvent, { type: \"agent_end\" }>\n\t| { type: \"agent_end\"; messages: AgentMessage[]; willRetry: boolean }\n\t| {\n\t\t\ttype: \"queue_update\";\n\t\t\tsteering: readonly string[];\n\t\t\tfollowUp: readonly string[];\n\t\t\tcommands: readonly string[];\n\t }\n\t| { type: \"compaction_start\"; reason: \"manual\" | \"threshold\" | \"overflow\" }\n\t| { type: \"session_info_changed\"; name: string | undefined }\n\t| { type: \"thinking_level_changed\"; level: ThinkingLevel }\n\t| { type: \"warning\"; message: string }\n\t| { type: \"background_tools\"; tasks: readonly BackgroundToolTaskLiveView[] }\n\t| {\n\t\t\ttype: \"compaction_end\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tresult: CompactionResult | undefined;\n\t\t\taborted: boolean;\n\t\t\twillRetry: boolean;\n\t\t\terrorMessage?: string;\n\t\t\t/** Benign no-op explanation when compaction did not produce a result. */\n\t\t\tskipReason?: string;\n\t }\n\t| { type: \"auto_retry_start\"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n\t/** UI-only bracket around foreground routing/preparation. Always paired with `routing_end`. */\n\t| { type: \"routing_start\" }\n\t| { type: \"routing_end\" }\n\t| {\n\t\t\ttype: \"delegate_workers\";\n\t\t\tactive: number;\n\t\t\tqueued: number;\n\t\t\trunning: number;\n\t\t\tcompletedSinceFlush: number;\n\t\t\tfailedSinceFlush: number;\n\t\t\tterminalSinceFlush: Array<{ laneId: string; status: LaneTerminalStatus; reasonCode?: string }>;\n\t };\n\nexport type AgentSessionEventListener = (event: AgentSessionEvent) => void;\n\nexport interface AgentSessionConfig {\n\tagent: Agent;\n\tsessionManager: SessionManager;\n\tsettingsManager: SettingsManager;\n\tcwd: string;\n\t/** User-level agent state directory for generated runtime artifacts. */\n\tagentDir?: string;\n\t/** Models available to the interactive model-cycle action. */\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tresourceLoader: ResourceLoader;\n\t/** SDK tools registered outside extensions. */\n\tcustomTools?: ToolDefinition[];\n\tmodelRegistry: ModelRegistry;\n\t/** Initial active tool names before profile and UAC filtering. */\n\tinitialActiveToolNames?: string[];\n\t/** Optional tool allowlist. */\n\tallowedToolNames?: string[];\n\t/** Optional tool denylist. */\n\texcludedToolNames?: string[];\n\ttoolProfileFilter?: ResourceProfileFilterSettings;\n\t/** Preserve an explicit launch-time model across profile reloads. */\n\tisExplicitModel?: boolean;\n\t/** Preserve an explicit launch-time thinking level across profile reloads. */\n\tisExplicitThinking?: boolean;\n\t/** Child sessions receive the worker UAC and write ceilings. */\n\tisChildSession?: boolean;\n\t/** Alternate base tool instances for embedded/custom runtimes. */\n\tbaseToolsOverride?: Record<string, AgentTool>;\n\t/** Mutable bridge used by the agent loop to reach the current extension generation. */\n\textensionRunnerRef?: { current?: ExtensionRunner };\n\tsessionStartEvent?: SessionStartEvent;\n\t/** Injectable pointer-first workspace collector; tests use this to avoid process execution. */\n\tcollectWorkspaceSources?: typeof collectWorkspaceSources;\n\t/** Immutable owner-authored orchestration policy. */\n\torchestrationProfile?: OrchestrationProfile;\n\t/** Injectable local-runtime I/O dependencies. */\n\tlocalRuntimeDeps?: LocalRuntimeDeps;\n}\n\nexport interface ExtensionBindings {\n\tuiContext?: ExtensionUIContext;\n\tmode?: ExtensionContext[\"mode\"];\n\tcommandContextActions?: ExtensionCommandContextActions;\n\tabortHandler?: () => void;\n\tshutdownHandler?: ShutdownHandler;\n\tonError?: ExtensionErrorListener;\n}\n\nexport interface PromptOptions {\n\t/** Expand file prompt templates and skills. Defaults to true. */\n\texpandPromptTemplates?: boolean;\n\t/** Process slash commands before model submission. Defaults to `expandPromptTemplates`. */\n\tprocessSlashCommands?: boolean;\n\timages?: ImageContent[];\n\t/** Required queue behavior when a foreground turn is already streaming. */\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tsource?: InputSource;\n\t/** Observe whether prompt preflight accepted the request. */\n\tpreflightResult?: (success: boolean) => void;\n\t/** Permit idle goal continuation after this prompt settles. Defaults to true. */\n\tautoContinueGoal?: boolean;\n\t/** Hidden internal turn persisted as a typed context marker. */\n\tinternalContextType?: string;\n}\n\nexport interface ModelCycleResult {\n\tmodel: Model<Api>;\n\tthinkingLevel: ThinkingLevel;\n\t/** Whether cycling was constrained to launch-scoped models. */\n\tisScoped: boolean;\n}\n\nexport interface CompactionGateCheckStats {\n\tfailures: number;\n\tminScore?: number;\n\tmaxScore?: number;\n\tthreshold?: number;\n\tcomparator?: \"minimum\" | \"maximum\";\n}\n\nexport interface CompactionGateStats {\n\tgateFailures: number;\n\tdeterministicGapFills: number;\n\tcompactionsWithGateFailures: number;\n\tchecks: Record<string, CompactionGateCheckStats>;\n}\n\nexport interface SessionStats {\n\tsessionFile: string | undefined;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: { input: number; output: number; cacheRead: number; cacheWrite: number; total: number };\n\tcost: number;\n\tcontextUsage?: ContextUsage;\n\ttoolArgumentValidation: ToolArgumentValidationStats;\n\tcompactionGates: CompactionGateStats;\n}\n\nexport const SPAWNED_USAGE_CUSTOM_TYPE = \"spawned_usage\";\nexport const RUNAWAY_STOP_CUSTOM_TYPE = \"runaway_stop\";\nexport const TOOL_VALIDATION_ESCALATION_CUSTOM_TYPE = \"tool_validation_escalation\";\n\nexport interface RunawayStopRecord {\n\tsignature: string;\n\trepeats: number;\n\tmodel?: string;\n\tprovider?: string;\n\tat: string;\n}\n\nexport interface ToolValidationEscalationRecord {\n\ttool: string;\n\tsignature: string;\n\trepeats: number;\n\tmodel: string;\n\tprovider: string;\n\tat: string;\n}\n\nexport interface SpawnedUsageReport {\n\t/** Cumulative child usage, including that child's already-rolled-up descendants. */\n\tusage: Usage;\n\tlabel?: string;\n\tsourceSessionId?: string;\n\t/** Stable idempotency identity for retry-safe ingestion. */\n\treportId?: string;\n}\n\nexport interface SpawnedUsageTotals {\n\tcost: number;\n\treports: number;\n}\n\nexport interface IsolatedCompletionOptions {\n\tsystemPrompt: string;\n\t/** New child-owned prompt messages for this call; foreground session history is never inherited. */\n\tmessages: Message[];\n\t/** Previously persisted child history. Omission preserves fresh one-shot behavior. */\n\thistory?: Message[];\n\tmodel?: Model<Api>;\n\tthinkingLevel?: ThinkingLevel;\n\tmaxTokens?: number;\n\t/** Fresh child-owned tool instances. Omission preserves one-shot behavior. */\n\ttools?: AgentTool[];\n\t/** Explicit child-loop turn cap. */\n\tmaxTurns?: number;\n\t/** Optional tool-free finalization prompt after the bounded tool loop. */\n\tfinalTextPrompt?: string;\n\t/** Child-only capability/path gate. */\n\tbeforeToolCall?: AgentLoopConfig[\"beforeToolCall\"];\n\t/** Child-only result observer. */\n\tafterToolCall?: AgentLoopConfig[\"afterToolCall\"];\n\t/**\n\t * Durable child transcript sink. Message-end ordering means an assistant tool request is recorded\n\t * before execution starts and each tool result is recorded before the next provider request.\n\t * Throwing aborts the child loop; continuing without durable history would make replay unsafe.\n\t */\n\tonMessage?: (message: Message) => Promise<void> | void;\n\t/** Durable mid-run steering inbox owned by the child conversation. */\n\tgetSteeringMessages?: AgentLoopConfig[\"getSteeringMessages\"];\n\t/** Durable post-turn follow-up inbox owned by the child conversation. */\n\tgetFollowUpMessages?: AgentLoopConfig[\"getFollowUpMessages\"];\n\t/** Child-owned provider projection, invoked before every request without mutating raw history. */\n\ttransformContext?: AgentLoopConfig[\"transformContext\"];\n\t/** Request-local budget/authority check, invoked immediately before every child provider transport. */\n\trequestPreflight?: AgentLoopConfig[\"requestPreflight\"];\n\tsignal?: AbortSignal;\n\t/** Required cache policy; isolated calls never inherit a provider default implicitly. */\n\tcacheRetention: CacheRetention;\n\t/** Stable namespace used to derive provider cache affinity. */\n\tlaneKind?: string;\n}\n\nexport const DEFAULT_ISOLATED_LANE_KIND = \"isolated\";\n\nexport function computeLaneAffinityKey(laneKind: string, model: Model<Api> | undefined, systemPrompt: string): string {\n\tconst modelKey = model ? `${model.provider}/${model.id}` : \"unknown-model\";\n\tconst digest = createHash(\"sha256\")\n\t\t.update([\"pi-lane-affinity-v1\", laneKind, modelKey, systemPrompt].join(\"\\u0000\"))\n\t\t.digest(\"hex\")\n\t\t.slice(0, 32);\n\treturn `lane:${laneKind}:${digest}`;\n}\n\nexport interface IsolatedCompletionResult {\n\ttext: string;\n\tusage: Usage;\n\tstopReason: StopReason;\n\t/** Complete child-owned conversation; isolated calls never expose foreground history. */\n\tmessages?: Message[];\n}\n\nexport interface ResearchLaneRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\tresult?: ResearchRunResult;\n}\n\nexport interface WorkerDelegationRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\toutcome?: WorkerRunOutcome;\n}\n\nexport interface GoalContinuationOnceOptions {\n\t/** Consecutive non-progress passes allowed before deterministic escalation; 0 disables the gate. */\n\tmaxStallTurns: number;\n}\n\nexport interface GoalContinuationOnceResult {\n\tsubmitted: boolean;\n\tsnapshot: GoalRuntimeSnapshot;\n\tprompt?: GoalContinuationPrompt;\n}\n\nexport type GoalContinuationLoopStopReason =\n\t| \"continuation_not_allowed\"\n\t| \"max_turns_reached\"\n\t| \"wall_clock_budget_reached\"\n\t| \"goal_budget_exhausted\"\n\t| \"already_continuing\"\n\t| \"session_disposed\"\n\t| \"goal_tool_unavailable\"\n\t| \"worker_in_flight\";\n\nexport interface GoalContinuationLoopOptions extends GoalContinuationOnceOptions {\n\t/** Explicit per-invocation turn limit; 0 means unbounded. */\n\tmaxTurns: number;\n\t/** Explicit per-invocation active-time limit; 0/undefined means unbounded. */\n\tmaxWallClockMinutes?: number;\n\t/** Injectable monotonic-enough clock for deterministic tests. */\n\tnow?: () => number;\n}\n\nexport interface GoalContinuationLoopResult {\n\tturnsSubmitted: number;\n\tstopReason: GoalContinuationLoopStopReason;\n\tfinalSnapshot: GoalRuntimeSnapshot;\n}\n\n/** Test-only stream watchdog override contract retained in the public session module. */\nexport type StreamIdleOptionsOverride = Partial<StreamIdleOptions> | undefined;\n"]}
1
+ {"version":3,"file":"agent-session-contracts.js","sourceRoot":"","sources":["../../src/core/agent-session-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsCzC,OAAO,EAAyB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAkJ3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AACzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AACvD,MAAM,CAAC,MAAM,sCAAsC,GAAG,4BAA4B,CAAC;AAyEnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,KAA6B,EAAE,YAAoB;IAC3G,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;IAC3E,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC;SACjC,MAAM,CAAC,CAAC,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChF,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACf,OAAO,QAAQ,QAAQ,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport type {\n\tAgent,\n\tAgentEvent,\n\tAgentLoopConfig,\n\tAgentMessage,\n\tAgentTool,\n\tStreamIdleOptions,\n\tThinkingLevel,\n} from \"@caupulican/pi-agent-core\";\nimport type { CompactionResult, SessionManager } from \"@caupulican/pi-agent-core/node\";\nimport type { Api, CacheRetention, ImageContent, Message, Model, StopReason, Usage } from \"@caupulican/pi-ai\";\nimport type { LaneRecord, LaneTerminalStatus } from \"./autonomy/lane-tracker.ts\";\nimport type { BackgroundToolTaskLiveView } from \"./background-tool-task-controller.ts\";\nimport type { WorkerRunOutcome } from \"./delegation/worker-runner.ts\";\nimport type {\n\tContextUsage,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionErrorListener,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tInputSource,\n\tSessionStartEvent,\n\tShutdownHandler,\n\tToolDefinition,\n} from \"./extensions/index.ts\";\nimport type { GoalContinuationPrompt } from \"./goals/goal-continuation-prompt.ts\";\nimport type { GoalRuntimeSnapshot } from \"./goals/goal-runtime-snapshot.ts\";\nimport type { ModelRegistry } from \"./model-registry.ts\";\nimport type { LocalRuntimeDeps } from \"./models/local-runtime.ts\";\nimport type { OrchestrationProfile } from \"./orchestration/contracts.ts\";\nimport type { ResearchRunResult } from \"./research/research-runner.ts\";\nimport type { collectWorkspaceSources } from \"./research/workspace-collector.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { ResourceProfileFilterSettings, SettingsManager } from \"./settings-manager.ts\";\nimport type { ToolArgumentValidationStats } from \"./tool-recovery-stats.ts\";\n\nexport { type ParsedSkillBlock, parseSkillBlock } from \"./skill-block.mjs\";\n\n/** Session-specific events that extend the core AgentEvent. */\nexport type AgentSessionEvent =\n\t| Exclude<AgentEvent, { type: \"agent_end\" }>\n\t| { type: \"agent_end\"; messages: AgentMessage[]; willRetry: boolean }\n\t| {\n\t\t\ttype: \"queue_update\";\n\t\t\tsteering: readonly string[];\n\t\t\tfollowUp: readonly string[];\n\t\t\tcommands: readonly string[];\n\t }\n\t| { type: \"compaction_start\"; reason: \"manual\" | \"threshold\" | \"overflow\" }\n\t| { type: \"session_info_changed\"; name: string | undefined }\n\t| { type: \"thinking_level_changed\"; level: ThinkingLevel }\n\t| { type: \"warning\"; message: string }\n\t| { type: \"background_tools\"; tasks: readonly BackgroundToolTaskLiveView[] }\n\t| {\n\t\t\ttype: \"compaction_end\";\n\t\t\treason: \"manual\" | \"threshold\" | \"overflow\";\n\t\t\tresult: CompactionResult | undefined;\n\t\t\taborted: boolean;\n\t\t\twillRetry: boolean;\n\t\t\terrorMessage?: string;\n\t\t\t/** Benign no-op explanation when compaction did not produce a result. */\n\t\t\tskipReason?: string;\n\t }\n\t| { type: \"auto_retry_start\"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; success: boolean; attempt: number; finalError?: string }\n\t/** UI-only bracket around foreground routing/preparation. Always paired with `routing_end`. */\n\t| { type: \"routing_start\" }\n\t| { type: \"routing_end\" }\n\t| {\n\t\t\ttype: \"delegate_workers\";\n\t\t\tactive: number;\n\t\t\tqueued: number;\n\t\t\trunning: number;\n\t\t\tcompletedSinceFlush: number;\n\t\t\tfailedSinceFlush: number;\n\t\t\tterminalSinceFlush: Array<{ laneId: string; status: LaneTerminalStatus; reasonCode?: string }>;\n\t };\n\nexport type AgentSessionEventListener = (event: AgentSessionEvent) => void;\n\nexport interface AgentSessionConfig {\n\tagent: Agent;\n\tsessionManager: SessionManager;\n\tsettingsManager: SettingsManager;\n\tcwd: string;\n\t/** User-level agent state directory for generated runtime artifacts. */\n\tagentDir?: string;\n\t/** Models available to the interactive model-cycle action. */\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\tresourceLoader: ResourceLoader;\n\t/** SDK tools registered outside extensions. */\n\tcustomTools?: ToolDefinition[];\n\tmodelRegistry: ModelRegistry;\n\t/** Initial active tool names before profile and UAC filtering. */\n\tinitialActiveToolNames?: string[];\n\t/** Optional tool allowlist. */\n\tallowedToolNames?: string[];\n\t/** Optional tool denylist. */\n\texcludedToolNames?: string[];\n\ttoolProfileFilter?: ResourceProfileFilterSettings;\n\t/** Preserve an explicit launch-time model across profile reloads. */\n\tisExplicitModel?: boolean;\n\t/** Preserve an explicit launch-time thinking level across profile reloads. */\n\tisExplicitThinking?: boolean;\n\t/** Child sessions receive the worker UAC and write ceilings. */\n\tisChildSession?: boolean;\n\t/** Alternate base tool instances for embedded/custom runtimes. */\n\tbaseToolsOverride?: Record<string, AgentTool>;\n\t/** Mutable bridge used by the agent loop to reach the current extension generation. */\n\textensionRunnerRef?: { current?: ExtensionRunner };\n\tsessionStartEvent?: SessionStartEvent;\n\t/** Injectable pointer-first workspace collector; tests use this to avoid process execution. */\n\tcollectWorkspaceSources?: typeof collectWorkspaceSources;\n\t/** Immutable owner-authored orchestration policy. */\n\torchestrationProfile?: OrchestrationProfile;\n\t/** Injectable local-runtime I/O dependencies. */\n\tlocalRuntimeDeps?: LocalRuntimeDeps;\n}\n\nexport interface ExtensionBindings {\n\tuiContext?: ExtensionUIContext;\n\tmode?: ExtensionContext[\"mode\"];\n\tcommandContextActions?: ExtensionCommandContextActions;\n\tabortHandler?: () => void;\n\tshutdownHandler?: ShutdownHandler;\n\tonError?: ExtensionErrorListener;\n}\n\nexport interface PromptOptions {\n\t/** Expand file prompt templates and skills. Defaults to true. */\n\texpandPromptTemplates?: boolean;\n\t/** Process slash commands before model submission. Defaults to `expandPromptTemplates`. */\n\tprocessSlashCommands?: boolean;\n\timages?: ImageContent[];\n\t/** Required queue behavior when a foreground turn is already streaming. */\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tsource?: InputSource;\n\t/** Observe whether prompt preflight accepted the request. */\n\tpreflightResult?: (success: boolean) => void;\n\t/** Permit idle goal continuation after this prompt settles. Defaults to true. */\n\tautoContinueGoal?: boolean;\n\t/** Hidden internal turn persisted as a typed context marker. */\n\tinternalContextType?: string;\n}\n\nexport interface ModelCycleResult {\n\tmodel: Model<Api>;\n\tthinkingLevel: ThinkingLevel;\n\t/** Whether cycling was constrained to launch-scoped models. */\n\tisScoped: boolean;\n}\n\nexport interface CompactionGateCheckStats {\n\tfailures: number;\n\tminScore?: number;\n\tmaxScore?: number;\n\tthreshold?: number;\n\tcomparator?: \"minimum\" | \"maximum\";\n}\n\nexport interface CompactionGateStats {\n\tgateFailures: number;\n\tdeterministicGapFills: number;\n\tcompactionsWithGateFailures: number;\n\tchecks: Record<string, CompactionGateCheckStats>;\n}\n\nexport interface SessionStats {\n\tsessionFile: string | undefined;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: { input: number; output: number; cacheRead: number; cacheWrite: number; total: number };\n\tcost: number;\n\tcontextUsage?: ContextUsage;\n\ttoolArgumentValidation: ToolArgumentValidationStats;\n\tcompactionGates: CompactionGateStats;\n}\n\nexport const SPAWNED_USAGE_CUSTOM_TYPE = \"spawned_usage\";\nexport const RUNAWAY_STOP_CUSTOM_TYPE = \"runaway_stop\";\nexport const TOOL_VALIDATION_ESCALATION_CUSTOM_TYPE = \"tool_validation_escalation\";\n\nexport interface RunawayStopRecord {\n\tsignature: string;\n\trepeats: number;\n\tmodel?: string;\n\tprovider?: string;\n\tat: string;\n}\n\nexport interface ToolValidationEscalationRecord {\n\ttool: string;\n\tsignature: string;\n\trepeats: number;\n\tmodel: string;\n\tprovider: string;\n\tat: string;\n}\n\nexport interface SpawnedUsageReport {\n\t/** Cumulative child usage, including that child's already-rolled-up descendants. */\n\tusage: Usage;\n\tlabel?: string;\n\tsourceSessionId?: string;\n\t/** Stable idempotency identity for retry-safe ingestion. */\n\treportId?: string;\n}\n\nexport interface SpawnedUsageTotals {\n\tcost: number;\n\treports: number;\n}\n\nexport interface IsolatedCompletionOptions {\n\tsystemPrompt: string;\n\t/** New child-owned prompt messages for this call; foreground session history is never inherited. */\n\tmessages: Message[];\n\t/** Previously persisted child history. Omission preserves fresh one-shot behavior. */\n\thistory?: Message[];\n\tmodel?: Model<Api>;\n\tthinkingLevel?: ThinkingLevel;\n\tmaxTokens?: number;\n\t/** Fresh child-owned tool instances. Omission preserves one-shot behavior. */\n\ttools?: AgentTool[];\n\t/** Explicit child-loop turn cap. */\n\tmaxTurns?: number;\n\t/** Optional tool-free finalization prompt after the bounded tool loop. */\n\tfinalTextPrompt?: string;\n\t/** Child-only capability/path gate. */\n\tbeforeToolCall?: AgentLoopConfig[\"beforeToolCall\"];\n\t/** Child-only result observer. */\n\tafterToolCall?: AgentLoopConfig[\"afterToolCall\"];\n\t/**\n\t * Durable child transcript sink. Message-end ordering means an assistant tool request is recorded\n\t * before execution starts and each tool result is recorded before the next provider request.\n\t * Throwing aborts the child loop; continuing without durable history would make replay unsafe.\n\t */\n\tonMessage?: (message: Message) => Promise<void> | void;\n\t/** Durable mid-run steering inbox owned by the child conversation. */\n\tgetSteeringMessages?: AgentLoopConfig[\"getSteeringMessages\"];\n\t/** Durable post-turn follow-up inbox owned by the child conversation. */\n\tgetFollowUpMessages?: AgentLoopConfig[\"getFollowUpMessages\"];\n\t/** Child-owned provider projection, invoked before every request without mutating raw history. */\n\ttransformContext?: AgentLoopConfig[\"transformContext\"];\n\t/** Request-local budget/authority check, invoked immediately before every child provider transport. */\n\trequestPreflight?: AgentLoopConfig[\"requestPreflight\"];\n\tsignal?: AbortSignal;\n\t/** Required cache policy; isolated calls never inherit a provider default implicitly. */\n\tcacheRetention: CacheRetention;\n\t/** Stable namespace used to derive provider cache affinity. */\n\tlaneKind?: string;\n}\n\nexport const DEFAULT_ISOLATED_LANE_KIND = \"isolated\";\n\nexport function computeLaneAffinityKey(laneKind: string, model: Model<Api> | undefined, systemPrompt: string): string {\n\tconst modelKey = model ? `${model.provider}/${model.id}` : \"unknown-model\";\n\tconst digest = createHash(\"sha256\")\n\t\t.update([\"pi-lane-affinity-v1\", laneKind, modelKey, systemPrompt].join(\"\\u0000\"))\n\t\t.digest(\"hex\")\n\t\t.slice(0, 32);\n\treturn `lane:${laneKind}:${digest}`;\n}\n\nexport interface IsolatedCompletionResult {\n\ttext: string;\n\tusage: Usage;\n\tstopReason: StopReason;\n\t/** Provider diagnostic for an error stop; lane owners classify it without parsing transcript history. */\n\terrorMessage?: string;\n\t/** Complete child-owned conversation; isolated calls never expose foreground history. */\n\tmessages?: Message[];\n}\n\nexport interface ResearchLaneRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\tresult?: ResearchRunResult;\n}\n\nexport interface WorkerDelegationRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\toutcome?: WorkerRunOutcome;\n}\n\nexport interface GoalContinuationOnceOptions {\n\t/** Consecutive non-progress passes allowed before deterministic escalation; 0 disables the gate. */\n\tmaxStallTurns: number;\n}\n\nexport interface GoalContinuationOnceResult {\n\tsubmitted: boolean;\n\tsnapshot: GoalRuntimeSnapshot;\n\tprompt?: GoalContinuationPrompt;\n}\n\nexport type GoalContinuationLoopStopReason =\n\t| \"continuation_not_allowed\"\n\t| \"max_turns_reached\"\n\t| \"wall_clock_budget_reached\"\n\t| \"goal_budget_exhausted\"\n\t| \"already_continuing\"\n\t| \"session_disposed\"\n\t| \"goal_tool_unavailable\"\n\t| \"worker_in_flight\";\n\nexport interface GoalContinuationLoopOptions extends GoalContinuationOnceOptions {\n\t/** Explicit per-invocation turn limit; 0 means unbounded. */\n\tmaxTurns: number;\n\t/** Explicit per-invocation active-time limit; 0/undefined means unbounded. */\n\tmaxWallClockMinutes?: number;\n\t/** Injectable monotonic-enough clock for deterministic tests. */\n\tnow?: () => number;\n}\n\nexport interface GoalContinuationLoopResult {\n\tturnsSubmitted: number;\n\tstopReason: GoalContinuationLoopStopReason;\n\tfinalSnapshot: GoalRuntimeSnapshot;\n}\n\n/** Test-only stream watchdog override contract retained in the public session module. */\nexport type StreamIdleOptionsOverride = Partial<StreamIdleOptions> | undefined;\n"]}
@@ -8,7 +8,16 @@ export interface BoundedCompletion {
8
8
  costUsd: number;
9
9
  stopReason: string;
10
10
  }
11
- export type BoundedCompletionFailureStatus = "canceled" | "timeout" | "failed";
11
+ export type BoundedCompletionFailureStatus = "canceled" | "timeout" | "failed" | "budget_exhausted";
12
+ /**
13
+ * Typed failure crossing the executor boundary. Policy owners use this instead of forcing the
14
+ * completion envelope to infer a bounded denial from human-readable error text.
15
+ */
16
+ export declare class BoundedCompletionFailureError extends Error {
17
+ readonly status: BoundedCompletionFailureStatus;
18
+ readonly reasonCode: string;
19
+ constructor(status: BoundedCompletionFailureStatus, reasonCode: string, message: string);
20
+ }
12
21
  export interface BoundedCompletionOutcome {
13
22
  /** Present when the executor settled; may coexist with `failure` when an abort raced the result. */
14
23
  completion?: BoundedCompletion;
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-completion.d.ts","sourceRoot":"","sources":["../../../src/core/autonomy/bounded-completion.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/E,MAAM,WAAW,wBAAwB;IACxC,oGAAoG;IACpG,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,8BAA8B,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAA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MAAM,GAAG,SAAS,CAIvE;AA2BD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAChD,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC7D,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAmFpC"}
@@ -1,4 +1,16 @@
1
1
  import { boundedRedactedDiagnosticText } from "../security/secret-text.js";
2
+ /**
3
+ * Typed failure crossing the executor boundary. Policy owners use this instead of forcing the
4
+ * completion envelope to infer a bounded denial from human-readable error text.
5
+ */
6
+ export class BoundedCompletionFailureError extends Error {
7
+ constructor(status, reasonCode, message) {
8
+ super(message);
9
+ this.name = "BoundedCompletionFailureError";
10
+ this.status = status;
11
+ this.reasonCode = reasonCode;
12
+ }
13
+ }
2
14
  /**
3
15
  * Preserve the executor's actual error alongside the stable reason code. A bare
4
16
  * `completion_error` is undiagnosable from lane records alone (field lesson: workers dying
@@ -18,6 +30,17 @@ function abortFailure(args) {
18
30
  return { status: "timeout", reasonCode: "wall_clock_exceeded" };
19
31
  return { status: "failed", reasonCode: "completion_error" };
20
32
  }
33
+ function executorFailure(error) {
34
+ const detail = boundedFailureDetail(error);
35
+ if (error instanceof BoundedCompletionFailureError) {
36
+ return {
37
+ status: error.status,
38
+ reasonCode: error.reasonCode,
39
+ ...(detail ? { detail } : {}),
40
+ };
41
+ }
42
+ return { status: "failed", reasonCode: "completion_error", ...(detail ? { detail } : {}) };
43
+ }
21
44
  export async function runBoundedCompletion(args) {
22
45
  const timeoutController = new AbortController();
23
46
  let resolveAbort;
@@ -78,11 +101,10 @@ export async function runBoundedCompletion(args) {
78
101
  };
79
102
  }
80
103
  if (winner.kind === "error") {
81
- const detail = boundedFailureDetail(winner.error);
82
104
  return {
83
105
  failure: args.signal?.aborted || timeoutController.signal.aborted
84
106
  ? abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal })
85
- : { status: "failed", reasonCode: "completion_error", ...(detail ? { detail } : {}) },
107
+ : executorFailure(winner.error),
86
108
  };
87
109
  }
88
110
  const completion = winner.completion;
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-completion.js","sourceRoot":"","sources":["../../../src/core/autonomy/bounded-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAsB3E;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAClD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,6BAA6B,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAID,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,SAAS,YAAY,CAAC,IAGrB;IACA,IAAI,IAAI,CAAC,cAAc,EAAE,OAAO;QAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC9F,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,CAAC;IAChG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAM1C;IACA,MAAM,iBAAiB,GAAG,IAAI,eAAe,EAAE,CAAC;IAChD,IAAI,YAAyB,CAAC;IAC9B,MAAM,YAAY,GAAG,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,EAAE;QAC/D,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K,OAAO,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO;gBACN,OAAO,EACN,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO;oBACvD,CAAC,CAAC,YAAY,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC;oBACxF,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;aACvF,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9D,OAAO;gBACN,UAAU;gBACV,OAAO,EAAE,YAAY,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC;aAC/F,CAAC;QACH,CAAC;QACD,OAAO,EAAE,UAAU,EAAE,CAAC;IACvB,CAAC;YAAS,CAAC;QACV,IAAI,YAAY,KAAK,SAAS;YAAE,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC;AACF,CAAC","sourcesContent":["import { boundedRedactedDiagnosticText } from \"../security/secret-text.ts\";\n\n/**\n * Shared wall-clock/cancellation envelope for one-shot lane completions (research and delegated workers).\n * Composes an optional external abort signal with an internal wall-clock timeout, executes the\n * injected completion, and maps every failure to a stable status/reasonCode pair. Never throws.\n */\n\nexport interface BoundedCompletion {\n\ttext: string;\n\tcostUsd: number;\n\tstopReason: string;\n}\n\nexport type BoundedCompletionFailureStatus = \"canceled\" | \"timeout\" | \"failed\";\n\nexport interface BoundedCompletionOutcome {\n\t/** Present when the executor settled; may coexist with `failure` when an abort raced the result. */\n\tcompletion?: BoundedCompletion;\n\tfailure?: { status: BoundedCompletionFailureStatus; reasonCode: string; detail?: string };\n}\n\n/**\n * Preserve the executor's actual error alongside the stable reason code. A bare\n * `completion_error` is undiagnosable from lane records alone (field lesson: workers dying\n * on provider socket drops and budget denials all flattened to the same code).\n */\nexport function boundedFailureDetail(error: unknown): string | undefined {\n\tconst message = error instanceof Error ? error.message : typeof error === \"string\" ? error : undefined;\n\tif (!message) return undefined;\n\treturn boundedRedactedDiagnosticText(message);\n}\n\ntype ExecutorSettlement = { kind: \"completion\"; completion: BoundedCompletion } | { kind: \"error\"; error: unknown };\n\nconst MAX_HOST_TIMER_DELAY_MS = 2_147_483_647;\n\nfunction abortFailure(args: {\n\texternalSignal?: AbortSignal;\n\ttimeoutSignal: AbortSignal;\n}): BoundedCompletionOutcome[\"failure\"] {\n\tif (args.externalSignal?.aborted) return { status: \"canceled\", reasonCode: \"external_abort\" };\n\tif (args.timeoutSignal.aborted) return { status: \"timeout\", reasonCode: \"wall_clock_exceeded\" };\n\treturn { status: \"failed\", reasonCode: \"completion_error\" };\n}\n\nexport async function runBoundedCompletion(args: {\n\t/** Wall-clock budget in milliseconds; 0 disables. */\n\tmaxWallClockMs: number;\n\t/** External cancellation (e.g. session disposal). */\n\tsignal?: AbortSignal;\n\texecute: (signal: AbortSignal) => Promise<BoundedCompletion>;\n}): Promise<BoundedCompletionOutcome> {\n\tconst timeoutController = new AbortController();\n\tlet resolveAbort!: () => void;\n\tconst abortPromise = new Promise<{ kind: \"abort\" }>((resolve) => {\n\t\tresolveAbort = () => resolve({ kind: \"abort\" });\n\t});\n\tconst onExternalAbort = (): void => resolveAbort();\n\targs.signal?.addEventListener(\"abort\", onExternalAbort, { once: true });\n\tlet timeoutTimer: ReturnType<typeof setTimeout> | undefined;\n\tlet remainingWallClockMs = args.maxWallClockMs;\n\tconst armTimeout = (): void => {\n\t\tconst delayMs = Math.min(remainingWallClockMs, MAX_HOST_TIMER_DELAY_MS);\n\t\ttimeoutTimer = setTimeout(() => {\n\t\t\tremainingWallClockMs -= delayMs;\n\t\t\tif (remainingWallClockMs > 0) {\n\t\t\t\tarmTimeout();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttimeoutController.abort();\n\t\t\tresolveAbort();\n\t\t}, delayMs);\n\t\tif (typeof timeoutTimer === \"object\" && \"unref\" in timeoutTimer) {\n\t\t\tconst { unref } = timeoutTimer as { unref?: () => void };\n\t\t\tunref?.call(timeoutTimer);\n\t\t}\n\t};\n\tif (args.maxWallClockMs > 0) armTimeout();\n\tconst signals: AbortSignal[] = [timeoutController.signal];\n\tif (args.signal) signals.push(args.signal);\n\tconst signal = AbortSignal.any(signals);\n\n\tlet settled: ExecutorSettlement | undefined;\n\tconst execution = Promise.resolve()\n\t\t.then(() => args.execute(signal))\n\t\t.then<ExecutorSettlement, ExecutorSettlement>(\n\t\t\t(completion) => {\n\t\t\t\tsettled = { kind: \"completion\", completion };\n\t\t\t\treturn settled;\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tsettled = { kind: \"error\", error };\n\t\t\t\treturn settled;\n\t\t\t},\n\t\t);\n\tif (args.signal?.aborted) resolveAbort();\n\n\ttry {\n\t\tconst winner = await Promise.race([execution, abortPromise]);\n\t\tif (winner.kind === \"abort\") {\n\t\t\t// An abort and a completion can settle in the same microtask turn. Give the already-queued\n\t\t\t// executor handlers one chance to retain that completion (and its visible spend) without\n\t\t\t// ever waiting for a non-cooperative executor. Later settlement remains observed by\n\t\t\t// `execution`'s rejection handler, preventing an unhandled rejection after this returns.\n\t\t\tfor (let flush = 0; flush < 4 && settled === undefined; flush++) {\n\t\t\t\tawait Promise.resolve();\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...(settled?.kind === \"completion\" ? { completion: settled.completion } : {}),\n\t\t\t\tfailure: abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal }),\n\t\t\t};\n\t\t}\n\n\t\tif (winner.kind === \"error\") {\n\t\t\tconst detail = boundedFailureDetail(winner.error);\n\t\t\treturn {\n\t\t\t\tfailure:\n\t\t\t\t\targs.signal?.aborted || timeoutController.signal.aborted\n\t\t\t\t\t\t? abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal })\n\t\t\t\t\t\t: { status: \"failed\", reasonCode: \"completion_error\", ...(detail ? { detail } : {}) },\n\t\t\t};\n\t\t}\n\n\t\tconst completion = winner.completion;\n\t\tif (args.signal?.aborted || timeoutController.signal.aborted) {\n\t\t\treturn {\n\t\t\t\tcompletion,\n\t\t\t\tfailure: abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal }),\n\t\t\t};\n\t\t}\n\t\treturn { completion };\n\t} finally {\n\t\tif (timeoutTimer !== undefined) clearTimeout(timeoutTimer);\n\t\targs.signal?.removeEventListener(\"abort\", onExternalAbort);\n\t}\n}\n"]}
1
+ {"version":3,"file":"bounded-completion.js","sourceRoot":"","sources":["../../../src/core/autonomy/bounded-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAgB3E;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAIvD,YAAY,MAAsC,EAAE,UAAkB,EAAE,OAAe;QACtF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;CACD;AAQD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAClD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CA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M,EAAE,CAAC;aAC/F,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,OAAO;gBACN,OAAO,EACN,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO;oBACvD,CAAC,CAAC,YAAY,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC;oBACxF,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;aACjC,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9D,OAAO;gBACN,UAAU;gBACV,OAAO,EAAE,YAAY,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC;aAC/F,CAAC;QACH,CAAC;QACD,OAAO,EAAE,UAAU,EAAE,CAAC;IACvB,CAAC;YAAS,CAAC;QACV,IAAI,YAAY,KAAK,SAAS;YAAE,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC;AACF,CAAC","sourcesContent":["import { boundedRedactedDiagnosticText } from \"../security/secret-text.ts\";\n\n/**\n * Shared wall-clock/cancellation envelope for one-shot lane completions (research and delegated workers).\n * Composes an optional external abort signal with an internal wall-clock timeout, executes the\n * injected completion, and maps every failure to a stable status/reasonCode pair. Never throws.\n */\n\nexport interface BoundedCompletion {\n\ttext: string;\n\tcostUsd: number;\n\tstopReason: string;\n}\n\nexport type BoundedCompletionFailureStatus = \"canceled\" | \"timeout\" | \"failed\" | \"budget_exhausted\";\n\n/**\n * Typed failure crossing the executor boundary. Policy owners use this instead of forcing the\n * completion envelope to infer a bounded denial from human-readable error text.\n */\nexport class BoundedCompletionFailureError extends Error {\n\treadonly status: BoundedCompletionFailureStatus;\n\treadonly reasonCode: string;\n\n\tconstructor(status: BoundedCompletionFailureStatus, reasonCode: string, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"BoundedCompletionFailureError\";\n\t\tthis.status = status;\n\t\tthis.reasonCode = reasonCode;\n\t}\n}\n\nexport interface BoundedCompletionOutcome {\n\t/** Present when the executor settled; may coexist with `failure` when an abort raced the result. */\n\tcompletion?: BoundedCompletion;\n\tfailure?: { status: BoundedCompletionFailureStatus; reasonCode: string; detail?: string };\n}\n\n/**\n * Preserve the executor's actual error alongside the stable reason code. A bare\n * `completion_error` is undiagnosable from lane records alone (field lesson: workers dying\n * on provider socket drops and budget denials all flattened to the same code).\n */\nexport function boundedFailureDetail(error: unknown): string | undefined {\n\tconst message = error instanceof Error ? error.message : typeof error === \"string\" ? error : undefined;\n\tif (!message) return undefined;\n\treturn boundedRedactedDiagnosticText(message);\n}\n\ntype ExecutorSettlement = { kind: \"completion\"; completion: BoundedCompletion } | { kind: \"error\"; error: unknown };\n\nconst MAX_HOST_TIMER_DELAY_MS = 2_147_483_647;\n\nfunction abortFailure(args: {\n\texternalSignal?: AbortSignal;\n\ttimeoutSignal: AbortSignal;\n}): BoundedCompletionOutcome[\"failure\"] {\n\tif (args.externalSignal?.aborted) return { status: \"canceled\", reasonCode: \"external_abort\" };\n\tif (args.timeoutSignal.aborted) return { status: \"timeout\", reasonCode: \"wall_clock_exceeded\" };\n\treturn { status: \"failed\", reasonCode: \"completion_error\" };\n}\n\nfunction executorFailure(error: unknown): BoundedCompletionOutcome[\"failure\"] {\n\tconst detail = boundedFailureDetail(error);\n\tif (error instanceof BoundedCompletionFailureError) {\n\t\treturn {\n\t\t\tstatus: error.status,\n\t\t\treasonCode: error.reasonCode,\n\t\t\t...(detail ? { detail } : {}),\n\t\t};\n\t}\n\treturn { status: \"failed\", reasonCode: \"completion_error\", ...(detail ? { detail } : {}) };\n}\n\nexport async function runBoundedCompletion(args: {\n\t/** Wall-clock budget in milliseconds; 0 disables. */\n\tmaxWallClockMs: number;\n\t/** External cancellation (e.g. session disposal). */\n\tsignal?: AbortSignal;\n\texecute: (signal: AbortSignal) => Promise<BoundedCompletion>;\n}): Promise<BoundedCompletionOutcome> {\n\tconst timeoutController = new AbortController();\n\tlet resolveAbort!: () => void;\n\tconst abortPromise = new Promise<{ kind: \"abort\" }>((resolve) => {\n\t\tresolveAbort = () => resolve({ kind: \"abort\" });\n\t});\n\tconst onExternalAbort = (): void => resolveAbort();\n\targs.signal?.addEventListener(\"abort\", onExternalAbort, { once: true });\n\tlet timeoutTimer: ReturnType<typeof setTimeout> | undefined;\n\tlet remainingWallClockMs = args.maxWallClockMs;\n\tconst armTimeout = (): void => {\n\t\tconst delayMs = Math.min(remainingWallClockMs, MAX_HOST_TIMER_DELAY_MS);\n\t\ttimeoutTimer = setTimeout(() => {\n\t\t\tremainingWallClockMs -= delayMs;\n\t\t\tif (remainingWallClockMs > 0) {\n\t\t\t\tarmTimeout();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttimeoutController.abort();\n\t\t\tresolveAbort();\n\t\t}, delayMs);\n\t\tif (typeof timeoutTimer === \"object\" && \"unref\" in timeoutTimer) {\n\t\t\tconst { unref } = timeoutTimer as { unref?: () => void };\n\t\t\tunref?.call(timeoutTimer);\n\t\t}\n\t};\n\tif (args.maxWallClockMs > 0) armTimeout();\n\tconst signals: AbortSignal[] = [timeoutController.signal];\n\tif (args.signal) signals.push(args.signal);\n\tconst signal = AbortSignal.any(signals);\n\n\tlet settled: ExecutorSettlement | undefined;\n\tconst execution = Promise.resolve()\n\t\t.then(() => args.execute(signal))\n\t\t.then<ExecutorSettlement, ExecutorSettlement>(\n\t\t\t(completion) => {\n\t\t\t\tsettled = { kind: \"completion\", completion };\n\t\t\t\treturn settled;\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tsettled = { kind: \"error\", error };\n\t\t\t\treturn settled;\n\t\t\t},\n\t\t);\n\tif (args.signal?.aborted) resolveAbort();\n\n\ttry {\n\t\tconst winner = await Promise.race([execution, abortPromise]);\n\t\tif (winner.kind === \"abort\") {\n\t\t\t// An abort and a completion can settle in the same microtask turn. Give the already-queued\n\t\t\t// executor handlers one chance to retain that completion (and its visible spend) without\n\t\t\t// ever waiting for a non-cooperative executor. Later settlement remains observed by\n\t\t\t// `execution`'s rejection handler, preventing an unhandled rejection after this returns.\n\t\t\tfor (let flush = 0; flush < 4 && settled === undefined; flush++) {\n\t\t\t\tawait Promise.resolve();\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...(settled?.kind === \"completion\" ? { completion: settled.completion } : {}),\n\t\t\t\tfailure: abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal }),\n\t\t\t};\n\t\t}\n\n\t\tif (winner.kind === \"error\") {\n\t\t\treturn {\n\t\t\t\tfailure:\n\t\t\t\t\targs.signal?.aborted || timeoutController.signal.aborted\n\t\t\t\t\t\t? abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal })\n\t\t\t\t\t\t: executorFailure(winner.error),\n\t\t\t};\n\t\t}\n\n\t\tconst completion = winner.completion;\n\t\tif (args.signal?.aborted || timeoutController.signal.aborted) {\n\t\t\treturn {\n\t\t\t\tcompletion,\n\t\t\t\tfailure: abortFailure({ externalSignal: args.signal, timeoutSignal: timeoutController.signal }),\n\t\t\t};\n\t\t}\n\t\treturn { completion };\n\t} finally {\n\t\tif (timeoutTimer !== undefined) clearTimeout(timeoutTimer);\n\t\targs.signal?.removeEventListener(\"abort\", onExternalAbort);\n\t}\n}\n"]}
@@ -6,7 +6,7 @@
6
6
  * snapshots. Terminal lane records are persisted separately via `session-lane-record.ts`.
7
7
  */
8
8
  export type LaneType = "research" | "worker" | "learning" | "tmux-worker";
9
- export type LaneTerminalStatus = "succeeded" | "failed" | "canceled" | "timeout" | "budget_exhausted";
9
+ export type LaneTerminalStatus = "succeeded" | "partial" | "blocked" | "failed" | "canceled" | "timeout" | "budget_exhausted";
10
10
  export type LaneStatus = "queued" | "running" | LaneTerminalStatus;
11
11
  export interface LaneRecord {
12
12
  laneId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"lane-tracker.d.ts","sourceRoot":"","sources":["../../../src/core/autonomy/lane-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAEtG,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAEnE,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAMD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAkBhE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,GAAG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MAAM,CAAA;KAAE,GACnG,UAAU,GAAG,SAAS,CAcxB;IAED,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAQtC;IAED,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAQvC;IAED,UAAU,IAAI,UAAU,EAAE,CAEzB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAGhD;CACD"}
@@ -6,7 +6,15 @@
6
6
  * snapshots. Terminal lane records are persisted separately via `session-lane-record.ts`.
7
7
  */
8
8
  const LANE_TYPES = ["research", "worker", "learning", "tmux-worker"];
9
- const TERMINAL_STATUSES = ["succeeded", "failed", "canceled", "timeout", "budget_exhausted"];
9
+ const TERMINAL_STATUSES = [
10
+ "succeeded",
11
+ "partial",
12
+ "blocked",
13
+ "failed",
14
+ "canceled",
15
+ "timeout",
16
+ "budget_exhausted",
17
+ ];
10
18
  const LANE_STATUSES = ["queued", "running", ...TERMINAL_STATUSES];
11
19
  export function isLaneTerminalStatus(value) {
12
20
  return typeof value === "string" && TERMINAL_STATUSES.includes(value);
@@ -1 +1 @@
1
- {"version":3,"file":"lane-tracker.js","sourceRoot":"","sources":["../../../src/core/autonomy/lane-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,MAAM,UAAU,GAAsB,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AACxF,MAAM,iBAAiB,GAAsB,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAChH,MAAM,aAAa,GAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,iBAAiB,CAAC,CAAC;AAErF,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,SA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IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC;gBAAE,SAAS;YAClD,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI;gBAAE,SAAS;YACzD,KAAK,EAAE,CAAC;QACT,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,eAAe,CAAC,IAAe;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;gBAAE,SAAS;YAC1C,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI;gBAAE,SAAS;YACzD,KAAK,EAAE,CAAC;QACT,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,UAAU;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,SAAS,CAAC,MAAc;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3C,CAAC;CACD","sourcesContent":["/**\n * Live lane registry for autonomous background work (research/worker/learning lanes).\n *\n * This is the first real concurrency tracker behind `AutonomyStatusSnapshot.activeLaneCount`:\n * counts reflect lanes actually running in THIS process, never inferred/faked from historical\n * snapshots. Terminal lane records are persisted separately via `session-lane-record.ts`.\n */\n\nexport type LaneType = \"research\" | \"worker\" | \"learning\" | \"tmux-worker\";\n\nexport type LaneTerminalStatus = \"succeeded\" | \"failed\" | \"canceled\" | \"timeout\" | \"budget_exhausted\";\n\nexport type LaneStatus = \"queued\" | \"running\" | LaneTerminalStatus;\n\nexport interface LaneRecord {\n\tlaneId: string;\n\ttype: LaneType;\n\tstatus: LaneStatus;\n\t/** Bounded human-readable work label retained across session resume. */\n\tlabel?: string;\n\t/** Owner-authored profile that fixed the worker's model, thinking, tools, and budget. */\n\tprofileId?: string;\n\treasonCode?: string;\n\tstartedAt?: string;\n\tcompletedAt?: string;\n\tcostUsd?: number;\n\tgoalId?: string;\n\tevidenceEntryId?: string;\n\t/**\n\t * Worktree-sync lane key this lane record was correlated to at dispatch (set only for a\n\t * tmux-worker lane whose fire_task carried a `worktreeLane` -- see `tmux-dispatch.ts`'s\n\t * `createLaneWorktree`). Optional so every pre-existing record/caller keeps compiling and\n\t * behaving unchanged; `undefined` for a lane never bound to a worktree-sync lane.\n\t */\n\tworktreeLaneKey?: string;\n}\n\nconst LANE_TYPES: readonly string[] = [\"research\", \"worker\", \"learning\", \"tmux-worker\"];\nconst TERMINAL_STATUSES: readonly string[] = [\"succeeded\", \"failed\", \"canceled\", \"timeout\", \"budget_exhausted\"];\nconst LANE_STATUSES: readonly string[] = [\"queued\", \"running\", ...TERMINAL_STATUSES];\n\nexport function isLaneTerminalStatus(value: unknown): value is LaneTerminalStatus {\n\treturn typeof value === \"string\" && TERMINAL_STATUSES.includes(value);\n}\n\nfunction isOptionalString(value: unknown): boolean {\n\treturn value === undefined || typeof value === \"string\";\n}\n\nexport function isLaneRecord(value: unknown): value is LaneRecord {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst record = value as Record<string, unknown>;\n\tif (typeof record.laneId !== \"string\" || record.laneId.length === 0) return false;\n\tif (typeof record.type !== \"string\" || !LANE_TYPES.includes(record.type)) return false;\n\tif (typeof record.status !== \"string\" || !LANE_STATUSES.includes(record.status)) return false;\n\tif (!isOptionalString(record.label)) return false;\n\tif (!isOptionalString(record.profileId)) return false;\n\tif (!isOptionalString(record.reasonCode)) return false;\n\tif (!isOptionalString(record.startedAt)) return false;\n\tif (!isOptionalString(record.completedAt)) return false;\n\tif (record.costUsd !== undefined && (typeof record.costUsd !== \"number\" || !Number.isFinite(record.costUsd))) {\n\t\treturn false;\n\t}\n\tif (!isOptionalString(record.goalId)) return false;\n\tif (!isOptionalString(record.evidenceEntryId)) return false;\n\tif (!isOptionalString(record.worktreeLaneKey)) return false;\n\treturn true;\n}\n\nexport function cloneLaneRecordForStorage(record: LaneRecord): LaneRecord {\n\treturn { ...record };\n}\n\n/** Terminal records kept in memory for diagnostics; older ones are evicted (the session log holds history). */\nconst MAX_TERMINAL_LANES_IN_MEMORY = 100;\n\nexport class LaneTracker {\n\tprivate readonly _lanes = new Map<string, LaneRecord>();\n\tprivate _nextLaneNumber = 1;\n\tprivate readonly _now: () => string;\n\n\tconstructor(options?: { now?: () => string }) {\n\t\tthis._now = options?.now ?? (() => new Date().toISOString());\n\t}\n\n\t/** Seed the id counter (e.g. from persisted lane records) so resumed sessions don't reuse ids. */\n\tensureCounterAtLeast(next: number): void {\n\t\tif (Number.isFinite(next) && next > this._nextLaneNumber) {\n\t\t\tthis._nextLaneNumber = Math.floor(next);\n\t\t}\n\t}\n\n\tprivate _evictOldTerminal(): void {\n\t\tlet terminal = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (isLaneTerminalStatus(record.status)) terminal++;\n\t\t}\n\t\tif (terminal <= MAX_TERMINAL_LANES_IN_MEMORY) return;\n\t\t// Map iteration is insertion-ordered: drop oldest terminal records first.\n\t\tfor (const [laneId, record] of this._lanes) {\n\t\t\tif (terminal <= MAX_TERMINAL_LANES_IN_MEMORY) break;\n\t\t\tif (isLaneTerminalStatus(record.status)) {\n\t\t\t\tthis._lanes.delete(laneId);\n\t\t\t\tterminal--;\n\t\t\t}\n\t\t}\n\t}\n\n\tenqueue(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tconst laneId = `${args.type}-${this._nextLaneNumber++}`;\n\t\tconst record: LaneRecord = {\n\t\t\tlaneId,\n\t\t\ttype: args.type,\n\t\t\tstatus: \"queued\",\n\t\t};\n\t\tif (args.goalId !== undefined) record.goalId = args.goalId;\n\t\tif (args.worktreeLaneKey !== undefined) record.worktreeLaneKey = args.worktreeLaneKey;\n\t\tthis._lanes.set(laneId, record);\n\t\treturn { ...record };\n\t}\n\n\t/** Restore an exact durable projection without minting a replacement logical id or timestamp. */\n\trestore(record: LaneRecord): LaneRecord {\n\t\tconst restored = { ...record };\n\t\tthis._lanes.set(restored.laneId, restored);\n\t\tconst suffix = /-(\\d+)$/.exec(restored.laneId)?.[1];\n\t\tif (suffix) this.ensureCounterAtLeast(Number(suffix) + 1);\n\t\tthis._evictOldTerminal();\n\t\treturn { ...restored };\n\t}\n\n\t/** Start or restart a caller-named lane. The supplied id is its durable logical identity. */\n\tstartNamed(args: { laneId: string; type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tif (!args.laneId) throw new TypeError(\"A named lane requires a non-empty laneId.\");\n\t\tconst record: LaneRecord = {\n\t\t\tlaneId: args.laneId,\n\t\t\ttype: args.type,\n\t\t\tstatus: \"running\",\n\t\t\tstartedAt: this._now(),\n\t\t};\n\t\tif (args.goalId !== undefined) record.goalId = args.goalId;\n\t\tif (args.worktreeLaneKey !== undefined) record.worktreeLaneKey = args.worktreeLaneKey;\n\t\tthis._lanes.set(record.laneId, record);\n\t\tconst suffix = /-(\\d+)$/.exec(record.laneId)?.[1];\n\t\tif (suffix) this.ensureCounterAtLeast(Number(suffix) + 1);\n\t\treturn { ...record };\n\t}\n\n\tmarkRunning(laneId: string): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\tif (!record || record.status !== \"queued\") return undefined;\n\t\tconst next = { ...record, status: \"running\" as const, startedAt: this._now() };\n\t\tthis._lanes.set(laneId, next);\n\t\treturn { ...next };\n\t}\n\n\tstart(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tconst record = this.enqueue(args);\n\t\treturn this.markRunning(record.laneId) as LaneRecord;\n\t}\n\n\tcomplete(\n\t\tlaneId: string,\n\t\targs: { status: LaneTerminalStatus; reasonCode?: string; costUsd?: number; evidenceEntryId?: string },\n\t): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\tif (!record || isLaneTerminalStatus(record.status)) return undefined;\n\t\tconst next: LaneRecord = {\n\t\t\t...record,\n\t\t\tstatus: args.status,\n\t\t\tcompletedAt: this._now(),\n\t\t};\n\t\tif (args.reasonCode !== undefined) next.reasonCode = args.reasonCode;\n\t\tif (args.costUsd !== undefined) next.costUsd = args.costUsd;\n\t\tif (args.evidenceEntryId !== undefined) next.evidenceEntryId = args.evidenceEntryId;\n\t\tthis._lanes.set(laneId, next);\n\t\tthis._evictOldTerminal();\n\t\treturn { ...next };\n\t}\n\n\tgetActiveCount(type?: LaneType): number {\n\t\tlet count = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (isLaneTerminalStatus(record.status)) continue;\n\t\t\tif (type !== undefined && record.type !== type) continue;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tgetRunningCount(type?: LaneType): number {\n\t\tlet count = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (record.status !== \"running\") continue;\n\t\t\tif (type !== undefined && record.type !== type) continue;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tgetRecords(): LaneRecord[] {\n\t\treturn [...this._lanes.values()].map((record) => ({ ...record }));\n\t}\n\n\tgetRecord(laneId: string): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\treturn record ? { ...record } : undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"lane-tracker.js","sourceRoot":"","sources":["../../../src/core/autonomy/lane-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsCH,MAAM,UAAU,GAAsB,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B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3C,CAAC;CACD","sourcesContent":["/**\n * Live lane registry for autonomous background work (research/worker/learning lanes).\n *\n * This is the first real concurrency tracker behind `AutonomyStatusSnapshot.activeLaneCount`:\n * counts reflect lanes actually running in THIS process, never inferred/faked from historical\n * snapshots. Terminal lane records are persisted separately via `session-lane-record.ts`.\n */\n\nexport type LaneType = \"research\" | \"worker\" | \"learning\" | \"tmux-worker\";\n\nexport type LaneTerminalStatus =\n\t| \"succeeded\"\n\t| \"partial\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"canceled\"\n\t| \"timeout\"\n\t| \"budget_exhausted\";\n\nexport type LaneStatus = \"queued\" | \"running\" | LaneTerminalStatus;\n\nexport interface LaneRecord {\n\tlaneId: string;\n\ttype: LaneType;\n\tstatus: LaneStatus;\n\t/** Bounded human-readable work label retained across session resume. */\n\tlabel?: string;\n\t/** Owner-authored profile that fixed the worker's model, thinking, tools, and budget. */\n\tprofileId?: string;\n\treasonCode?: string;\n\tstartedAt?: string;\n\tcompletedAt?: string;\n\tcostUsd?: number;\n\tgoalId?: string;\n\tevidenceEntryId?: string;\n\t/**\n\t * Worktree-sync lane key this lane record was correlated to at dispatch (set only for a\n\t * tmux-worker lane whose fire_task carried a `worktreeLane` -- see `tmux-dispatch.ts`'s\n\t * `createLaneWorktree`). Optional so every pre-existing record/caller keeps compiling and\n\t * behaving unchanged; `undefined` for a lane never bound to a worktree-sync lane.\n\t */\n\tworktreeLaneKey?: string;\n}\n\nconst LANE_TYPES: readonly string[] = [\"research\", \"worker\", \"learning\", \"tmux-worker\"];\nconst TERMINAL_STATUSES: readonly string[] = [\n\t\"succeeded\",\n\t\"partial\",\n\t\"blocked\",\n\t\"failed\",\n\t\"canceled\",\n\t\"timeout\",\n\t\"budget_exhausted\",\n];\nconst LANE_STATUSES: readonly string[] = [\"queued\", \"running\", ...TERMINAL_STATUSES];\n\nexport function isLaneTerminalStatus(value: unknown): value is LaneTerminalStatus {\n\treturn typeof value === \"string\" && TERMINAL_STATUSES.includes(value);\n}\n\nfunction isOptionalString(value: unknown): boolean {\n\treturn value === undefined || typeof value === \"string\";\n}\n\nexport function isLaneRecord(value: unknown): value is LaneRecord {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst record = value as Record<string, unknown>;\n\tif (typeof record.laneId !== \"string\" || record.laneId.length === 0) return false;\n\tif (typeof record.type !== \"string\" || !LANE_TYPES.includes(record.type)) return false;\n\tif (typeof record.status !== \"string\" || !LANE_STATUSES.includes(record.status)) return false;\n\tif (!isOptionalString(record.label)) return false;\n\tif (!isOptionalString(record.profileId)) return false;\n\tif (!isOptionalString(record.reasonCode)) return false;\n\tif (!isOptionalString(record.startedAt)) return false;\n\tif (!isOptionalString(record.completedAt)) return false;\n\tif (record.costUsd !== undefined && (typeof record.costUsd !== \"number\" || !Number.isFinite(record.costUsd))) {\n\t\treturn false;\n\t}\n\tif (!isOptionalString(record.goalId)) return false;\n\tif (!isOptionalString(record.evidenceEntryId)) return false;\n\tif (!isOptionalString(record.worktreeLaneKey)) return false;\n\treturn true;\n}\n\nexport function cloneLaneRecordForStorage(record: LaneRecord): LaneRecord {\n\treturn { ...record };\n}\n\n/** Terminal records kept in memory for diagnostics; older ones are evicted (the session log holds history). */\nconst MAX_TERMINAL_LANES_IN_MEMORY = 100;\n\nexport class LaneTracker {\n\tprivate readonly _lanes = new Map<string, LaneRecord>();\n\tprivate _nextLaneNumber = 1;\n\tprivate readonly _now: () => string;\n\n\tconstructor(options?: { now?: () => string }) {\n\t\tthis._now = options?.now ?? (() => new Date().toISOString());\n\t}\n\n\t/** Seed the id counter (e.g. from persisted lane records) so resumed sessions don't reuse ids. */\n\tensureCounterAtLeast(next: number): void {\n\t\tif (Number.isFinite(next) && next > this._nextLaneNumber) {\n\t\t\tthis._nextLaneNumber = Math.floor(next);\n\t\t}\n\t}\n\n\tprivate _evictOldTerminal(): void {\n\t\tlet terminal = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (isLaneTerminalStatus(record.status)) terminal++;\n\t\t}\n\t\tif (terminal <= MAX_TERMINAL_LANES_IN_MEMORY) return;\n\t\t// Map iteration is insertion-ordered: drop oldest terminal records first.\n\t\tfor (const [laneId, record] of this._lanes) {\n\t\t\tif (terminal <= MAX_TERMINAL_LANES_IN_MEMORY) break;\n\t\t\tif (isLaneTerminalStatus(record.status)) {\n\t\t\t\tthis._lanes.delete(laneId);\n\t\t\t\tterminal--;\n\t\t\t}\n\t\t}\n\t}\n\n\tenqueue(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tconst laneId = `${args.type}-${this._nextLaneNumber++}`;\n\t\tconst record: LaneRecord = {\n\t\t\tlaneId,\n\t\t\ttype: args.type,\n\t\t\tstatus: \"queued\",\n\t\t};\n\t\tif (args.goalId !== undefined) record.goalId = args.goalId;\n\t\tif (args.worktreeLaneKey !== undefined) record.worktreeLaneKey = args.worktreeLaneKey;\n\t\tthis._lanes.set(laneId, record);\n\t\treturn { ...record };\n\t}\n\n\t/** Restore an exact durable projection without minting a replacement logical id or timestamp. */\n\trestore(record: LaneRecord): LaneRecord {\n\t\tconst restored = { ...record };\n\t\tthis._lanes.set(restored.laneId, restored);\n\t\tconst suffix = /-(\\d+)$/.exec(restored.laneId)?.[1];\n\t\tif (suffix) this.ensureCounterAtLeast(Number(suffix) + 1);\n\t\tthis._evictOldTerminal();\n\t\treturn { ...restored };\n\t}\n\n\t/** Start or restart a caller-named lane. The supplied id is its durable logical identity. */\n\tstartNamed(args: { laneId: string; type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tif (!args.laneId) throw new TypeError(\"A named lane requires a non-empty laneId.\");\n\t\tconst record: LaneRecord = {\n\t\t\tlaneId: args.laneId,\n\t\t\ttype: args.type,\n\t\t\tstatus: \"running\",\n\t\t\tstartedAt: this._now(),\n\t\t};\n\t\tif (args.goalId !== undefined) record.goalId = args.goalId;\n\t\tif (args.worktreeLaneKey !== undefined) record.worktreeLaneKey = args.worktreeLaneKey;\n\t\tthis._lanes.set(record.laneId, record);\n\t\tconst suffix = /-(\\d+)$/.exec(record.laneId)?.[1];\n\t\tif (suffix) this.ensureCounterAtLeast(Number(suffix) + 1);\n\t\treturn { ...record };\n\t}\n\n\tmarkRunning(laneId: string): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\tif (!record || record.status !== \"queued\") return undefined;\n\t\tconst next = { ...record, status: \"running\" as const, startedAt: this._now() };\n\t\tthis._lanes.set(laneId, next);\n\t\treturn { ...next };\n\t}\n\n\tstart(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string }): LaneRecord {\n\t\tconst record = this.enqueue(args);\n\t\treturn this.markRunning(record.laneId) as LaneRecord;\n\t}\n\n\tcomplete(\n\t\tlaneId: string,\n\t\targs: { status: LaneTerminalStatus; reasonCode?: string; costUsd?: number; evidenceEntryId?: string },\n\t): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\tif (!record || isLaneTerminalStatus(record.status)) return undefined;\n\t\tconst next: LaneRecord = {\n\t\t\t...record,\n\t\t\tstatus: args.status,\n\t\t\tcompletedAt: this._now(),\n\t\t};\n\t\tif (args.reasonCode !== undefined) next.reasonCode = args.reasonCode;\n\t\tif (args.costUsd !== undefined) next.costUsd = args.costUsd;\n\t\tif (args.evidenceEntryId !== undefined) next.evidenceEntryId = args.evidenceEntryId;\n\t\tthis._lanes.set(laneId, next);\n\t\tthis._evictOldTerminal();\n\t\treturn { ...next };\n\t}\n\n\tgetActiveCount(type?: LaneType): number {\n\t\tlet count = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (isLaneTerminalStatus(record.status)) continue;\n\t\t\tif (type !== undefined && record.type !== type) continue;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tgetRunningCount(type?: LaneType): number {\n\t\tlet count = 0;\n\t\tfor (const record of this._lanes.values()) {\n\t\t\tif (record.status !== \"running\") continue;\n\t\t\tif (type !== undefined && record.type !== type) continue;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tgetRecords(): LaneRecord[] {\n\t\treturn [...this._lanes.values()].map((record) => ({ ...record }));\n\t}\n\n\tgetRecord(laneId: string): LaneRecord | undefined {\n\t\tconst record = this._lanes.get(laneId);\n\t\treturn record ? { ...record } : undefined;\n\t}\n}\n"]}
@@ -194,9 +194,7 @@ export declare class BackgroundLaneController implements WorkerAgentControlPort
194
194
  };
195
195
  cancelWorkerAgent(agentId: string, reasonCode?: string, scope?: WorkerAgentControlScope): LaneRecord | undefined;
196
196
  retireWorkerAgent(agentId: string, scope?: WorkerAgentControlScope): WorkerAgentRetireResult;
197
- waitForWorkerAgent(agentId: string, timeoutMs?: number, scope?: WorkerAgentControlScope): Promise<{
198
- status: WorkerAgentActivity;
199
- }>;
197
+ waitForWorkerAgent(agentId: string, timeoutMs?: number, scope?: WorkerAgentControlScope): ReturnType<WorkerAgentControlPort["waitForWorkerAgent"]>;
200
198
  waitForWorkerAgents(agentIds: readonly string[], mode: WorkerAgentWaitMode, timeoutMs?: number, scope?: WorkerAgentControlScope): Promise<WorkerAgentWaitResult>;
201
199
  broadcastWorkerAgentMessage(agentIds: readonly string[], message: string, options: WorkerAgentBroadcastOptions): WorkerAgentBroadcastResult;
202
200
  /** Run one worker immediately; used by focused integrations and tests. */
@@ -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,E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CAAC,EAAE,MAAM,CAAC;QAChB,6FAA6F;QAC7F,UAAU,CAAC,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,EAAE,KAAK,UAAU,EAAe,MAAM,4BAA4B,CAAC;AAG1E,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,g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