@caupulican/pi-adaptative 0.81.39 → 0.81.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +3 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +9 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +290 -107
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +357 -122
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +2 -2
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +9 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-directory-layout.d.ts +15 -0
- package/dist/core/agent-directory-layout.d.ts.map +1 -0
- package/dist/core/agent-directory-layout.js +72 -0
- package/dist/core/agent-directory-layout.js.map +1 -0
- package/dist/core/agent-paths.d.ts +19 -2
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +67 -4
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +52 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +397 -79
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +71 -136
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +477 -1318
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +3 -2
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js +6 -28
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js +1 -1
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +20 -12
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/foreground-envelope.d.ts +8 -2
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
- package/dist/core/autonomy/foreground-envelope.js +8 -25
- package/dist/core/autonomy/foreground-envelope.js.map +1 -1
- package/dist/core/autonomy/gates.d.ts.map +1 -1
- package/dist/core/autonomy/gates.js +8 -10
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts +2 -0
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -0
- package/dist/core/autonomy/lane-private-paths.js +16 -0
- package/dist/core/autonomy/lane-private-paths.js.map +1 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts +10 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +46 -8
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +14 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +38 -0
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/autonomy/risk-assessment.d.ts +1 -2
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
- package/dist/core/autonomy/risk-assessment.js +1 -123
- package/dist/core/autonomy/risk-assessment.js.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts +4 -4
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js +16 -29
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
- package/dist/core/autonomy/telemetry-events.js +1 -1
- package/dist/core/autonomy/telemetry-events.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts +7 -7
- package/dist/core/autonomy-telemetry.d.ts.map +1 -1
- package/dist/core/autonomy-telemetry.js +9 -9
- package/dist/core/autonomy-telemetry.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +54 -236
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +140 -1273
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/capability-contract.d.ts +4 -0
- package/dist/core/capability-contract.d.ts.map +1 -0
- package/dist/core/capability-contract.js +28 -0
- package/dist/core/capability-contract.js.map +1 -0
- package/dist/core/compaction-controller.d.ts +90 -0
- package/dist/core/compaction-controller.d.ts.map +1 -0
- package/dist/core/compaction-controller.js +452 -0
- package/dist/core/compaction-controller.js.map +1 -0
- package/dist/core/compaction-support.d.ts +12 -11
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -2
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +34 -2
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts +8 -2
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +158 -35
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js +9 -11
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +6 -8
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts +3 -0
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +10 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +9 -4
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +1 -0
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/delegation/managed-lane-controller.d.ts +34 -0
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -0
- package/dist/core/delegation/managed-lane-controller.js +217 -0
- package/dist/core/delegation/managed-lane-controller.js.map +1 -0
- package/dist/core/delegation/session-worker-claim.d.ts +44 -0
- package/dist/core/delegation/session-worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-claim.js +98 -0
- package/dist/core/delegation/session-worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-actions.d.ts +7 -5
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +20 -4
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/{worker-result.d.ts → worker-claim.d.ts} +13 -13
- package/dist/core/delegation/worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/{worker-result.js → worker-claim.js} +61 -51
- package/dist/core/delegation/worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts +110 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.js +861 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -0
- package/dist/core/delegation/worker-delegation-request.d.ts +11 -0
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-request.js +2 -0
- package/dist/core/delegation/worker-delegation-request.js.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts +40 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js +93 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -0
- package/dist/core/delegation/worker-execution-policy.d.ts +62 -0
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -0
- package/dist/core/delegation/worker-execution-policy.js +160 -0
- package/dist/core/delegation/worker-execution-policy.js.map +1 -0
- package/dist/core/delegation/worker-lane-projection.d.ts +14 -0
- package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -0
- package/dist/core/delegation/worker-lane-projection.js +100 -0
- package/dist/core/delegation/worker-lane-projection.js.map +1 -0
- package/dist/core/delegation/worker-lifecycle.d.ts +97 -0
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -0
- package/dist/core/delegation/worker-lifecycle.js +339 -0
- package/dist/core/delegation/worker-lifecycle.js.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts +36 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.js +90 -0
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts +55 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.js +113 -0
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +25 -14
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +122 -53
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-task-label.d.ts +3 -0
- package/dist/core/delegation/worker-task-label.d.ts.map +1 -0
- package/dist/core/delegation/worker-task-label.js +11 -0
- package/dist/core/delegation/worker-task-label.js.map +1 -0
- package/dist/core/doctor.d.ts +8 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +32 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +5 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +50 -15
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +6 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/storage.d.ts +8 -0
- package/dist/core/extensions/storage.d.ts.map +1 -0
- package/dist/core/extensions/storage.js +28 -0
- package/dist/core/extensions/storage.js.map +1 -0
- package/dist/core/extensions/types.d.ts +70 -21
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/failure-corpus.d.ts +1 -15
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +9 -37
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +52 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -0
- package/dist/core/foreground-recovery-controller.js +111 -0
- package/dist/core/foreground-recovery-controller.js.map +1 -0
- package/dist/core/gateways/channel-provider.d.ts +3 -0
- package/dist/core/gateways/channel-provider.d.ts.map +1 -1
- package/dist/core/gateways/channel-provider.js +31 -6
- package/dist/core/gateways/channel-provider.js.map +1 -1
- package/dist/core/goals/goal-acceptance.d.ts +11 -0
- package/dist/core/goals/goal-acceptance.d.ts.map +1 -0
- package/dist/core/goals/goal-acceptance.js +25 -0
- package/dist/core/goals/goal-acceptance.js.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts +27 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.js +93 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-controller.d.ts +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +10 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +6 -6
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +20 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -0
- package/dist/core/goals/goal-lifecycle.js +17 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +11 -9
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +10 -8
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts +1 -0
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +7 -10
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +8 -6
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +11 -41
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +2 -4
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +10 -33
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/human-input.d.ts +100 -0
- package/dist/core/human-input.d.ts.map +1 -0
- package/dist/core/human-input.js +362 -0
- package/dist/core/human-input.js.map +1 -0
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/{telemetry.d.ts → install-telemetry.d.ts} +1 -1
- package/dist/core/install-telemetry.d.ts.map +1 -0
- package/dist/core/{telemetry.js → install-telemetry.js} +1 -1
- package/dist/core/install-telemetry.js.map +1 -0
- package/dist/core/keybindings.d.ts +17 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +24 -6
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts +2 -4
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js +9 -29
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/learning-gate.d.ts.map +1 -1
- package/dist/core/learning/learning-gate.js +1 -6
- package/dist/core/learning/learning-gate.js.map +1 -1
- package/dist/core/learning/session-learning-decision.d.ts +2 -4
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js +9 -29
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +4 -4
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +1 -0
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +6 -9
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +1 -4
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +1 -156
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +2 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +4 -4
- package/dist/core/model-selection-controller.d.ts.map +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +23 -0
- package/dist/core/model-tool-protocol.d.ts.map +1 -0
- package/dist/core/model-tool-protocol.js +43 -0
- package/dist/core/model-tool-protocol.js.map +1 -0
- package/dist/core/models/adaptation-store.d.ts +4 -6
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +95 -83
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +2 -12
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +84 -57
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/host-state-store.d.ts +34 -0
- package/dist/core/models/host-state-store.d.ts.map +1 -0
- package/dist/core/models/host-state-store.js +86 -0
- package/dist/core/models/host-state-store.js.map +1 -0
- package/dist/core/orchestration/agent-resume.d.ts +24 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -0
- package/dist/core/orchestration/agent-resume.js +90 -0
- package/dist/core/orchestration/agent-resume.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +61 -0
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -0
- package/dist/core/orchestration/capability-gateway.js +152 -0
- package/dist/core/orchestration/capability-gateway.js.map +1 -0
- package/dist/core/orchestration/contracts.d.ts +343 -0
- package/dist/core/orchestration/contracts.d.ts.map +1 -0
- package/dist/core/orchestration/contracts.js +135 -0
- package/dist/core/orchestration/contracts.js.map +1 -0
- package/dist/core/orchestration/delegation-ledger.d.ts +56 -0
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/delegation-ledger.js +197 -0
- package/dist/core/orchestration/delegation-ledger.js.map +1 -0
- package/dist/core/orchestration/event-store.d.ts +83 -0
- package/dist/core/orchestration/event-store.d.ts.map +1 -0
- package/dist/core/orchestration/event-store.js +560 -0
- package/dist/core/orchestration/event-store.js.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts +9 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.js +37 -0
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -0
- package/dist/core/orchestration/model-binding.d.ts +15 -0
- package/dist/core/orchestration/model-binding.d.ts.map +1 -0
- package/dist/core/orchestration/model-binding.js +29 -0
- package/dist/core/orchestration/model-binding.js.map +1 -0
- package/dist/core/orchestration/policy-compiler.d.ts +49 -0
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -0
- package/dist/core/orchestration/policy-compiler.js +191 -0
- package/dist/core/orchestration/policy-compiler.js.map +1 -0
- package/dist/core/orchestration/policy-gate.d.ts +18 -0
- package/dist/core/orchestration/policy-gate.d.ts.map +1 -0
- package/dist/core/orchestration/policy-gate.js +24 -0
- package/dist/core/orchestration/policy-gate.js.map +1 -0
- package/dist/core/orchestration/profile-registry.d.ts +51 -0
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -0
- package/dist/core/orchestration/profile-registry.js +393 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -0
- package/dist/core/orchestration/profile-store.d.ts +31 -0
- package/dist/core/orchestration/profile-store.d.ts.map +1 -0
- package/dist/core/orchestration/profile-store.js +136 -0
- package/dist/core/orchestration/profile-store.js.map +1 -0
- package/dist/core/orchestration/risk-budget.d.ts +9 -0
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -0
- package/dist/core/orchestration/risk-budget.js +48 -0
- package/dist/core/orchestration/risk-budget.js.map +1 -0
- package/dist/core/orchestration/task-runtime.d.ts +168 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -0
- package/dist/core/orchestration/task-runtime.js +1600 -0
- package/dist/core/orchestration/task-runtime.js.map +1 -0
- package/dist/core/orchestration/work-state-projection.d.ts +32 -0
- package/dist/core/orchestration/work-state-projection.d.ts.map +1 -0
- package/dist/core/orchestration/work-state-projection.js +116 -0
- package/dist/core/orchestration/work-state-projection.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts +21 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.js +179 -0
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts +21 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.js +109 -0
- package/dist/core/orchestration/worker-result-adapter.js.map +1 -0
- package/dist/core/process-identity.d.ts +11 -0
- package/dist/core/process-identity.d.ts.map +1 -0
- package/dist/core/process-identity.js +26 -0
- package/dist/core/process-identity.js.map +1 -0
- package/dist/core/process-matrix/codes.d.ts +14 -3
- package/dist/core/process-matrix/codes.d.ts.map +1 -1
- package/dist/core/process-matrix/codes.js.map +1 -1
- package/dist/core/process-matrix/resume-launcher.d.ts +26 -0
- package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -0
- package/dist/core/process-matrix/resume-launcher.js +62 -0
- package/dist/core/process-matrix/resume-launcher.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +37 -22
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +399 -76
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/process-matrix/store.d.ts +5 -2
- package/dist/core/process-matrix/store.d.ts.map +1 -1
- package/dist/core/process-matrix/store.js +123 -14
- package/dist/core/process-matrix/store.js.map +1 -1
- package/dist/core/process-matrix/supervisor.d.ts +10 -7
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
- package/dist/core/process-matrix/supervisor.js +45 -14
- package/dist/core/process-matrix/supervisor.js.map +1 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +6 -8
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +4 -4
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +2 -1
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +6 -8
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js +1 -6
- package/dist/core/research/evidence-bundle.js.map +1 -1
- package/dist/core/research/lane-model-resolver.d.ts +33 -0
- package/dist/core/research/lane-model-resolver.d.ts.map +1 -0
- package/dist/core/research/lane-model-resolver.js +65 -0
- package/dist/core/research/lane-model-resolver.js.map +1 -0
- package/dist/core/research/model-fitness-controller.d.ts +38 -0
- package/dist/core/research/model-fitness-controller.d.ts.map +1 -0
- package/dist/core/research/model-fitness-controller.js +106 -0
- package/dist/core/research/model-fitness-controller.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +1 -1
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +4 -4
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/research/research-gate.d.ts.map +1 -1
- package/dist/core/research/research-gate.js +7 -7
- package/dist/core/research/research-gate.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +62 -0
- package/dist/core/research/research-lane-controller.d.ts.map +1 -0
- package/dist/core/research/research-lane-controller.js +292 -0
- package/dist/core/research/research-lane-controller.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +2 -4
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js +10 -46
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.d.ts +6 -0
- package/dist/core/risk-classifier.d.ts.map +1 -0
- package/dist/core/risk-classifier.js +225 -0
- package/dist/core/risk-classifier.js.map +1 -0
- package/dist/core/runtime-builder.d.ts +26 -20
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +237 -178
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/sdk.d.ts +6 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +61 -24
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +28 -1
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-image-store.d.ts +33 -0
- package/dist/core/session-image-store.d.ts.map +1 -0
- package/dist/core/session-image-store.js +283 -0
- package/dist/core/session-image-store.js.map +1 -0
- package/dist/core/session-role.d.ts +6 -4
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +10 -4
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/session-snapshot.d.ts +34 -0
- package/dist/core/session-snapshot.d.ts.map +1 -0
- package/dist/core/session-snapshot.js +68 -0
- package/dist/core/session-snapshot.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +31 -0
- package/dist/core/session-supervision-runtime.d.ts.map +1 -0
- package/dist/core/session-supervision-runtime.js +97 -0
- package/dist/core/session-supervision-runtime.js.map +1 -0
- package/dist/core/settings-manager.d.ts +9 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +80 -28
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +2 -4
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +10 -28
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-projection.d.ts +20 -0
- package/dist/core/tasks/task-projection.d.ts.map +1 -0
- package/dist/core/tasks/task-projection.js +47 -0
- package/dist/core/tasks/task-projection.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +4 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -11
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +13 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -0
- package/dist/core/tool-capability-policy.js +85 -0
- package/dist/core/tool-capability-policy.js.map +1 -0
- package/dist/core/tool-protocol-controller.d.ts +91 -0
- package/dist/core/tool-protocol-controller.d.ts.map +1 -0
- package/dist/core/tool-protocol-controller.js +512 -0
- package/dist/core/tool-protocol-controller.js.map +1 -0
- package/dist/core/tool-recovery-log-records.d.ts +2 -3
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +9 -35
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.d.ts +3 -7
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +97 -138
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tools/ask-question.d.ts +124 -0
- package/dist/core/tools/ask-question.d.ts.map +1 -0
- package/dist/core/tools/ask-question.js +693 -0
- package/dist/core/tools/ask-question.js.map +1 -0
- package/dist/core/tools/delegate-status.d.ts +31 -3
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +149 -29
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +15 -13
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +108 -23
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +1 -0
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/goal.d.ts +5 -5
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +10 -10
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +43 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -0
- package/dist/core/tools/orchestration-panel.js +168 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -0
- package/dist/core/tools/run-process.d.ts +26 -0
- package/dist/core/tools/run-process.d.ts.map +1 -0
- package/dist/core/tools/run-process.js +138 -0
- package/dist/core/tools/run-process.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +2 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +102 -0
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +3 -5
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +4 -4
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +4 -6
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/util/bounded-jsonl.d.ts +10 -0
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -0
- package/dist/core/util/bounded-jsonl.js +75 -0
- package/dist/core/util/bounded-jsonl.js.map +1 -0
- package/dist/core/util/value-guards.d.ts +5 -0
- package/dist/core/util/value-guards.d.ts.map +1 -0
- package/dist/core/util/value-guards.js +12 -0
- package/dist/core/util/value-guards.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +3 -3
- package/dist/core/worktree-sync/store.d.ts.map +1 -1
- package/dist/core/worktree-sync/store.js +10 -5
- package/dist/core/worktree-sync/store.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +128 -44
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +4 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +186 -28
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/clipboard-input.d.ts +7 -1
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
- package/dist/modes/interactive/clipboard-input.js +44 -6
- package/dist/modes/interactive/clipboard-input.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +2 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/config-backup.d.ts.map +1 -1
- package/dist/modes/interactive/config-backup.js +5 -4
- package/dist/modes/interactive/config-backup.js.map +1 -1
- package/dist/modes/interactive/extension-ui-host.d.ts +14 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
- package/dist/modes/interactive/extension-ui-host.js +76 -15
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +63 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/key-handlers.js +1 -1
- package/dist/modes/interactive/key-handlers.js.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.js +7 -7
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +21 -0
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts +17 -2
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +50 -17
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-io-commands.js +16 -6
- package/dist/modes/interactive/session-io-commands.js.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.d.ts +7 -0
- package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -0
- package/dist/modes/interactive/session-replacement-errors.js +15 -0
- package/dist/modes/interactive/session-replacement-errors.js.map +1 -0
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
- package/dist/modes/interactive/startup-checks.js +1 -1
- package/dist/modes/interactive/startup-checks.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +82 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +15 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +138 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -13
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +52 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +8 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/work-directory.d.ts +11 -0
- package/dist/utils/work-directory.d.ts.map +1 -1
- package/dist/utils/work-directory.js +30 -9
- package/dist/utils/work-directory.js.map +1 -1
- package/docs/UI_POLISH_ORCHESTRATION.md +44 -0
- package/docs/UI_QUALITY_ORCHESTRATION.md +30 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +62 -2
- package/docs/harness-architecture.md +156 -0
- package/docs/keybindings.md +11 -1
- package/docs/process-matrix.md +59 -26
- package/docs/rpc.md +45 -2
- package/docs/sessions.md +15 -0
- package/docs/settings.md +125 -11
- package/docs/task-steps.md +8 -0
- package/docs/telemetry.md +19 -0
- package/docs/tmux-agent-manager.md +10 -3
- package/docs/ui-reference/README.md +9 -0
- package/docs/ui-reference/orchestration-after.txt +7 -0
- package/docs/ui-reference/orchestration-before.txt +7 -0
- package/docs/ui-reference/orchestration-reference.txt +6 -0
- package/docs/usage.md +14 -2
- package/docs/work-directory.md +19 -8
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/question.ts +34 -245
- package/examples/extensions/questionnaire.ts +41 -407
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
- package/dist/core/delegation/session-worker-result.d.ts +0 -46
- package/dist/core/delegation/session-worker-result.d.ts.map +0 -1
- package/dist/core/delegation/session-worker-result.js +0 -113
- package/dist/core/delegation/session-worker-result.js.map +0 -1
- package/dist/core/delegation/worker-result.d.ts.map +0 -1
- package/dist/core/delegation/worker-result.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { getPrivateLaneDeniedPaths } from "../autonomy/lane-private-paths.js";
|
|
3
|
+
import { createLaneToolSurface } from "../autonomy/lane-tool-surface.js";
|
|
4
|
+
import { safeRealpathSync } from "../autonomy/path-scope.js";
|
|
5
|
+
import { appendLaneRecordSnapshot } from "../autonomy/session-lane-record.js";
|
|
6
|
+
import { composeSubagentSystemPrompt } from "../autonomy/subagent-prompt.js";
|
|
7
|
+
import { AUTONOMY_TELEMETRY_EVENT_TYPES } from "../autonomy/telemetry-events.js";
|
|
8
|
+
import { deriveModelCapabilityProfile } from "../model-capability.js";
|
|
9
|
+
import { createWorkerExecutionContract, verifierWorkerExecutionContract, } from "../orchestration/worker-execution-contract.js";
|
|
10
|
+
import { createWorkerResultContract } from "../orchestration/worker-result-adapter.js";
|
|
11
|
+
import { registerInFlightWork } from "../reload-blockers.js";
|
|
12
|
+
import { applyWorkerActions } from "./worker-actions.js";
|
|
13
|
+
import { WorkerDispatchScheduler } from "./worker-dispatch-scheduler.js";
|
|
14
|
+
import { buildWorkerExecutionPlan, compileWorkerExecutionGrant, narrowWorkerExecutionPlan, workerExecutionAuthorityFromPlan, } from "./worker-execution-policy.js";
|
|
15
|
+
import { WorkerProfileResolver } from "./worker-profile-resolver.js";
|
|
16
|
+
import { runWorker } from "./worker-runner.js";
|
|
17
|
+
export function isLocalExecutionModel(model) {
|
|
18
|
+
if (model.provider === "ollama" || model.provider === "transformers" || model.provider === "llama-cpp") {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const hostname = new URL(model.baseUrl).hostname.toLowerCase();
|
|
23
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class WorkerDelegationController {
|
|
30
|
+
deps;
|
|
31
|
+
workerAbort = new AbortController();
|
|
32
|
+
lifecycle;
|
|
33
|
+
profileResolver;
|
|
34
|
+
queueRecovered = false;
|
|
35
|
+
recoveringDurableState = false;
|
|
36
|
+
verificationRecoveryFailures = new Map();
|
|
37
|
+
notifications;
|
|
38
|
+
scheduler;
|
|
39
|
+
laneAbortControllers = new Map();
|
|
40
|
+
publishedTerminalAttemptIds = new Set();
|
|
41
|
+
inFlightLedgers = new Map();
|
|
42
|
+
constructor(deps, notifications, lifecycle) {
|
|
43
|
+
this.deps = deps;
|
|
44
|
+
this.notifications = notifications;
|
|
45
|
+
this.lifecycle = lifecycle;
|
|
46
|
+
this.scheduler = new WorkerDispatchScheduler({
|
|
47
|
+
agentDir: this.deps.getAgentDir?.() ?? "",
|
|
48
|
+
isDisposed: () => this.deps.isDisposed(),
|
|
49
|
+
admit: (request, record) => this.workerDispatchAdmission(request, record),
|
|
50
|
+
getRecord: (laneId) => this.getWorkerLifecycle().getRecord(laneId),
|
|
51
|
+
run: (request, record) => this.runOnce(request, undefined, record),
|
|
52
|
+
cancel: (laneId, reasonCode) => {
|
|
53
|
+
try {
|
|
54
|
+
const terminal = this.getWorkerLifecycle().cancel(laneId, reasonCode);
|
|
55
|
+
if (terminal)
|
|
56
|
+
this.publishTerminalRecord(terminal);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
this.safeWarn(`Failed to cancel durable worker ${laneId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
warn: (message) => this.safeWarn(message),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
safeWarn(message) {
|
|
66
|
+
try {
|
|
67
|
+
this.deps.emit({ type: "warning", message });
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Disposal and recovery diagnostics must never throw.
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
recordTerminal(record) {
|
|
74
|
+
if (record.status === "queued" || record.status === "running")
|
|
75
|
+
return;
|
|
76
|
+
if (record.type === "worker") {
|
|
77
|
+
const notification = this.lifecycle.getTerminalNotification(record.laneId);
|
|
78
|
+
if (notification?.status === "delivered")
|
|
79
|
+
return;
|
|
80
|
+
if (notification) {
|
|
81
|
+
this.notifications.recordTerminal(record, notification.notificationId);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.notifications.recordTerminal(record);
|
|
86
|
+
}
|
|
87
|
+
getRecords() {
|
|
88
|
+
if (this.deps.isDelegateToolActive?.())
|
|
89
|
+
this.recoverDurableQueue();
|
|
90
|
+
return this.lifecycle.getRecords();
|
|
91
|
+
}
|
|
92
|
+
/** Process-local worker records for the shared terminal notifier; never triggers durable recovery. */
|
|
93
|
+
getLoadedRecords() {
|
|
94
|
+
return this.lifecycle.getRecords();
|
|
95
|
+
}
|
|
96
|
+
markNotificationsDelivered(notificationIds) {
|
|
97
|
+
this.lifecycle.markNotificationsDelivered(notificationIds);
|
|
98
|
+
}
|
|
99
|
+
abort() {
|
|
100
|
+
this.workerAbort.abort();
|
|
101
|
+
for (const record of this.lifecycle.getRecords()) {
|
|
102
|
+
if (record.status !== "queued" && record.status !== "running")
|
|
103
|
+
continue;
|
|
104
|
+
const ledger = this.inFlightLedgers.get(record.laneId);
|
|
105
|
+
if (!ledger) {
|
|
106
|
+
try {
|
|
107
|
+
const canceled = this.lifecycle.cancel(record.laneId, "session_disposed");
|
|
108
|
+
if (canceled) {
|
|
109
|
+
this.publishTerminalRecord(canceled);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.safeWarn(`Failed to cancel durable queued worker ${record.laneId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
114
|
+
}
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
this.inFlightLedgers.delete(record.laneId);
|
|
118
|
+
try {
|
|
119
|
+
const spend = ledger.getSpend();
|
|
120
|
+
const reportId = `worker:${this.deps.getSessionId()}:${record.laneId}`;
|
|
121
|
+
const claim = {
|
|
122
|
+
requestId: ledger.request.id,
|
|
123
|
+
status: "cancelled",
|
|
124
|
+
summary: "canceled on session dispose",
|
|
125
|
+
changedFiles: [...ledger.changedFiles],
|
|
126
|
+
usageReportId: reportId,
|
|
127
|
+
createdAt: new Date().toISOString(),
|
|
128
|
+
};
|
|
129
|
+
const canceled = this.getWorkerLifecycle().finish(createWorkerResultContract({
|
|
130
|
+
handle: ledger.handle,
|
|
131
|
+
claim,
|
|
132
|
+
accepted: false,
|
|
133
|
+
costUsd: spend?.cost.total ?? 0,
|
|
134
|
+
cwd: this.deps.getCwd(),
|
|
135
|
+
...(spend
|
|
136
|
+
? {
|
|
137
|
+
inputTokens: spend.input,
|
|
138
|
+
outputTokens: spend.output,
|
|
139
|
+
totalTokens: spend.totalTokens,
|
|
140
|
+
}
|
|
141
|
+
: {}),
|
|
142
|
+
wallClockMs: Date.now() - ledger.startedAt,
|
|
143
|
+
toolCalls: ledger.getToolCalls(),
|
|
144
|
+
reasonCode: "session_disposed",
|
|
145
|
+
}));
|
|
146
|
+
this.publishTerminalRecord(canceled);
|
|
147
|
+
// Bounded honesty: spend may be incomplete (it lands only when the isolated completion
|
|
148
|
+
// returns, which a mid-flight abort preempts) — record what `getSpend()` knows. Same
|
|
149
|
+
// deterministic reportId scheme as the normal path, so a later duplicate report (there
|
|
150
|
+
// is none in practice here, since the lane is now terminal) stays idempotent.
|
|
151
|
+
this.deps.saveWorkerClaimSnapshot(claim, ledger.request);
|
|
152
|
+
if (spend && (spend.cost.total > 0 || spend.totalTokens > 0)) {
|
|
153
|
+
this.deps.addSpawnedUsage(spend, { label: "worker-delegation", reportId });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
this.safeWarn(`Failed to persist canceled worker claim ${record.laneId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
this.scheduler.cancelQueued();
|
|
161
|
+
}
|
|
162
|
+
getWorkerLifecycle() {
|
|
163
|
+
return this.lifecycle;
|
|
164
|
+
}
|
|
165
|
+
getWorkerProfileResolver() {
|
|
166
|
+
if (this.profileResolver)
|
|
167
|
+
return this.profileResolver;
|
|
168
|
+
this.profileResolver = new WorkerProfileResolver({
|
|
169
|
+
agentDir: this.deps.getAgentDir(),
|
|
170
|
+
cwd: this.deps.getCwd(),
|
|
171
|
+
getSettingsManager: () => this.deps.getSettingsManager(),
|
|
172
|
+
getModelRegistry: () => this.deps.getModelRegistry(),
|
|
173
|
+
isModelExhausted: (model) => this.deps.isModelExhausted(model),
|
|
174
|
+
getActiveOrchestrationProfile: () => this.deps.getActiveOrchestrationProfile?.(),
|
|
175
|
+
onDiagnostic: (message) => this.safeWarn(message),
|
|
176
|
+
});
|
|
177
|
+
return this.profileResolver;
|
|
178
|
+
}
|
|
179
|
+
/** Read-only durable worker projection. Undefined means the delegate capability never loaded. */
|
|
180
|
+
getTaskRuntimeSnapshot() {
|
|
181
|
+
return this.lifecycle.getTaskRuntimeSnapshot();
|
|
182
|
+
}
|
|
183
|
+
/** Reconcile the session goal into an already-loaded worker runtime without defeating lazy UAC. */
|
|
184
|
+
synchronizeGoalState(goal) {
|
|
185
|
+
this.publishGoalTerminalRecords(this.lifecycle.synchronizeGoalState(goal));
|
|
186
|
+
}
|
|
187
|
+
publishGoalTerminalRecords(records) {
|
|
188
|
+
for (const record of records) {
|
|
189
|
+
this.scheduler.dropQueued(record.laneId);
|
|
190
|
+
this.laneAbortControllers.get(record.laneId)?.abort("goal_terminal");
|
|
191
|
+
this.publishTerminalRecord(record);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
recoverDurableQueue() {
|
|
195
|
+
if (this.recoveringDurableState)
|
|
196
|
+
return;
|
|
197
|
+
this.recoveringDurableState = true;
|
|
198
|
+
const lifecycle = this.getWorkerLifecycle();
|
|
199
|
+
try {
|
|
200
|
+
if (!this.queueRecovered) {
|
|
201
|
+
for (const { attempt, record, verificationOfTaskId } of lifecycle.recoverQueued()) {
|
|
202
|
+
const request = {
|
|
203
|
+
instructions: attempt.dispatch.instructions,
|
|
204
|
+
profileId: attempt.dispatch.profileId,
|
|
205
|
+
...(verificationOfTaskId ? { verificationOfTaskId } : {}),
|
|
206
|
+
};
|
|
207
|
+
this.scheduler.enqueue(record, request, true, verificationOfTaskId !== undefined);
|
|
208
|
+
}
|
|
209
|
+
this.queueRecovered = true;
|
|
210
|
+
}
|
|
211
|
+
for (const recovery of lifecycle.getPendingVerificationRecoveries()) {
|
|
212
|
+
if (recovery.action === "reconcile") {
|
|
213
|
+
try {
|
|
214
|
+
this.publishTerminalRecord(lifecycle.reconcileVerification(recovery));
|
|
215
|
+
this.verificationRecoveryFailures.delete(recovery.subjectTaskId);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
this.safeWarn(`Failed to reconcile recovered verification for ${recovery.subjectTaskId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
219
|
+
}
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const legacyImplementation = recovery.verifierExecutionContract
|
|
223
|
+
? undefined
|
|
224
|
+
: this.resolveWorkerAdmission({
|
|
225
|
+
instructions: recovery.summary,
|
|
226
|
+
profileId: recovery.implementationProfileId,
|
|
227
|
+
});
|
|
228
|
+
const verifierProfileId = recovery.verifierExecutionContract?.worker.profile.profileId ??
|
|
229
|
+
(legacyImplementation?.ok ? legacyImplementation.verifierShipment?.profile.profileId : undefined);
|
|
230
|
+
const started = verifierProfileId
|
|
231
|
+
? this.startInternal(this.buildVerifierRequest({
|
|
232
|
+
subjectTaskId: recovery.subjectTaskId,
|
|
233
|
+
verifierProfileId,
|
|
234
|
+
summary: recovery.summary,
|
|
235
|
+
artifactUris: recovery.artifactUris,
|
|
236
|
+
}), recovery.verifierExecutionContract)
|
|
237
|
+
: { started: false, skipReason: "independent_verifier_unavailable" };
|
|
238
|
+
if (started.started) {
|
|
239
|
+
this.verificationRecoveryFailures.delete(recovery.subjectTaskId);
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (this.verificationRecoveryFailures.get(recovery.subjectTaskId) !== started.skipReason) {
|
|
243
|
+
this.verificationRecoveryFailures.set(recovery.subjectTaskId, started.skipReason);
|
|
244
|
+
this.safeWarn(`Recovered verification for ${recovery.subjectTaskId} did not start: ${started.skipReason}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
for (const notification of lifecycle.getPendingTerminalNotifications()) {
|
|
248
|
+
this.notifications.recordTerminal(notification.record, notification.notificationId);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
this.recoveringDurableState = false;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
laneCapabilityProfile(model) {
|
|
256
|
+
return deriveModelCapabilityProfile({
|
|
257
|
+
contextWindow: model.contextWindow,
|
|
258
|
+
mode: this.deps.getSettingsManager().getModelCapabilitySettings().mode,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
getProfileCatalog() {
|
|
262
|
+
return this.getWorkerProfileResolver().catalog();
|
|
263
|
+
}
|
|
264
|
+
resolveWorkerShipment(request, settings) {
|
|
265
|
+
const resolved = this.getWorkerProfileResolver().resolve(request, settings.orchestrationProfile);
|
|
266
|
+
return resolved.ok ? { ok: true, shipment: resolved.resolved } : { ok: false, skipReason: resolved.reason };
|
|
267
|
+
}
|
|
268
|
+
resolveRequiredVerifier(profile) {
|
|
269
|
+
if (!profile.requireIndependentVerification)
|
|
270
|
+
return { ok: true };
|
|
271
|
+
const resolved = this.getWorkerProfileResolver().resolveVerifier(profile);
|
|
272
|
+
return resolved.ok
|
|
273
|
+
? { ok: true, shipment: resolved.resolved }
|
|
274
|
+
: { ok: false, skipReason: `independent_verifier_unavailable:${resolved.reason}` };
|
|
275
|
+
}
|
|
276
|
+
/** Single admission contract shared by enqueue, scheduler revalidation, and execution. */
|
|
277
|
+
resolveWorkerAdmission(request, pinnedContract) {
|
|
278
|
+
if (this.deps.isDisposed())
|
|
279
|
+
return { ok: false, skipReason: "session_disposed" };
|
|
280
|
+
const instructions = request.instructions.trim();
|
|
281
|
+
if (!instructions)
|
|
282
|
+
return { ok: false, skipReason: "missing_instructions" };
|
|
283
|
+
if (!this.deps.isDelegateToolActive())
|
|
284
|
+
return { ok: false, skipReason: "delegate_tool_inactive" };
|
|
285
|
+
const settings = this.deps.getSettingsManager().getWorkerDelegationSettings();
|
|
286
|
+
if (!settings.enabled)
|
|
287
|
+
return { ok: false, skipReason: "worker_delegation_disabled" };
|
|
288
|
+
if (pinnedContract && request.profileId && request.profileId !== pinnedContract.worker.profile.profileId) {
|
|
289
|
+
return { ok: false, skipReason: "orchestration_execution_contract_mismatch" };
|
|
290
|
+
}
|
|
291
|
+
const resolved = pinnedContract
|
|
292
|
+
? this.getWorkerProfileResolver().resolveContract(pinnedContract.worker)
|
|
293
|
+
: this.resolveWorkerShipment(request, settings);
|
|
294
|
+
if (!resolved.ok) {
|
|
295
|
+
return { ok: false, skipReason: "skipReason" in resolved ? resolved.skipReason : resolved.reason };
|
|
296
|
+
}
|
|
297
|
+
const shipment = "shipment" in resolved ? resolved.shipment : resolved.resolved;
|
|
298
|
+
if (request.verificationOfTaskId && shipment.profile.role !== "verifier") {
|
|
299
|
+
return { ok: false, skipReason: "verification_profile_role_mismatch" };
|
|
300
|
+
}
|
|
301
|
+
if (!request.verificationOfTaskId && shipment.profile.role === "verifier") {
|
|
302
|
+
return { ok: false, skipReason: "verifier_profile_requires_runtime_dispatch" };
|
|
303
|
+
}
|
|
304
|
+
let verifierShipment;
|
|
305
|
+
if (pinnedContract?.verifier) {
|
|
306
|
+
const verifier = this.getWorkerProfileResolver().resolveContract(pinnedContract.verifier);
|
|
307
|
+
if (!verifier.ok) {
|
|
308
|
+
return { ok: false, skipReason: `independent_verifier_unavailable:${verifier.reason}` };
|
|
309
|
+
}
|
|
310
|
+
verifierShipment = verifier.resolved;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const verifier = this.resolveRequiredVerifier(shipment.profile);
|
|
314
|
+
if (!verifier.ok)
|
|
315
|
+
return verifier;
|
|
316
|
+
verifierShipment = verifier.shipment;
|
|
317
|
+
}
|
|
318
|
+
if (!this.laneCapabilityProfile(shipment.model).backgroundLanesEnabled) {
|
|
319
|
+
return { ok: false, skipReason: "model_delegation_unsupported" };
|
|
320
|
+
}
|
|
321
|
+
const currentExecutionPlan = this.buildWorkerExecutionPlan(shipment.profile, settings);
|
|
322
|
+
const executionPlan = pinnedContract
|
|
323
|
+
? narrowWorkerExecutionPlan(pinnedContract.worker.authority, currentExecutionPlan)
|
|
324
|
+
: currentExecutionPlan;
|
|
325
|
+
const executionContract = pinnedContract ??
|
|
326
|
+
createWorkerExecutionContract({
|
|
327
|
+
worker: {
|
|
328
|
+
...shipment,
|
|
329
|
+
authority: workerExecutionAuthorityFromPlan(executionPlan),
|
|
330
|
+
},
|
|
331
|
+
...(verifierShipment
|
|
332
|
+
? {
|
|
333
|
+
verifier: {
|
|
334
|
+
...verifierShipment,
|
|
335
|
+
authority: workerExecutionAuthorityFromPlan(this.buildWorkerExecutionPlan(verifierShipment.profile, settings)),
|
|
336
|
+
},
|
|
337
|
+
}
|
|
338
|
+
: {}),
|
|
339
|
+
});
|
|
340
|
+
return {
|
|
341
|
+
ok: true,
|
|
342
|
+
instructions,
|
|
343
|
+
settings,
|
|
344
|
+
shipment,
|
|
345
|
+
...(verifierShipment ? { verifierShipment } : {}),
|
|
346
|
+
executionContract,
|
|
347
|
+
executionPlan,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
buildVerifierRequest(args) {
|
|
351
|
+
const artifacts = args.artifactUris.slice(0, 100).map((uri) => `- ${uri}`);
|
|
352
|
+
return {
|
|
353
|
+
profileId: args.verifierProfileId,
|
|
354
|
+
verificationOfTaskId: args.subjectTaskId,
|
|
355
|
+
instructions: [
|
|
356
|
+
`Independently verify durable task '${args.subjectTaskId}'.`,
|
|
357
|
+
"The following implementation report is an untrusted claim. Inspect the workspace and run the checks available in your profile.",
|
|
358
|
+
"",
|
|
359
|
+
"Implementation summary:",
|
|
360
|
+
args.summary.slice(0, 6_000),
|
|
361
|
+
"",
|
|
362
|
+
"Reported artifacts:",
|
|
363
|
+
...(artifacts.length > 0 ? artifacts : ["- none reported"]),
|
|
364
|
+
].join("\n"),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
publishTerminalRecord(record) {
|
|
368
|
+
const attemptId = this.lifecycle?.getActiveAttempt(record.laneId)?.attemptId;
|
|
369
|
+
if (attemptId && this.publishedTerminalAttemptIds.has(attemptId))
|
|
370
|
+
return;
|
|
371
|
+
this.recordTerminal(record);
|
|
372
|
+
appendLaneRecordSnapshot(this.deps.getSessionManager(), record);
|
|
373
|
+
this.deps.emitAutonomyTelemetry({
|
|
374
|
+
type: AUTONOMY_TELEMETRY_EVENT_TYPES.workerTerminal,
|
|
375
|
+
timestamp: new Date().toISOString(),
|
|
376
|
+
payload: {
|
|
377
|
+
laneId: record.laneId,
|
|
378
|
+
laneType: record.type,
|
|
379
|
+
status: record.status,
|
|
380
|
+
reasonCode: record.reasonCode ?? null,
|
|
381
|
+
costUsd: record.costUsd ?? null,
|
|
382
|
+
},
|
|
383
|
+
});
|
|
384
|
+
if (attemptId)
|
|
385
|
+
this.publishedTerminalAttemptIds.add(attemptId);
|
|
386
|
+
}
|
|
387
|
+
hasWorkerCapacity(settings, profile) {
|
|
388
|
+
const lifecycle = this.getWorkerLifecycle();
|
|
389
|
+
if (lifecycle.getRunningCount() >= settings.maxConcurrent)
|
|
390
|
+
return false;
|
|
391
|
+
return lifecycle.getRunningCount(profile.profileId) < profile.maxConcurrent;
|
|
392
|
+
}
|
|
393
|
+
workerDispatchAdmission(request, record) {
|
|
394
|
+
const contract = this.getWorkerLifecycle().getActiveAttempt(record.laneId)?.dispatch.executionContract;
|
|
395
|
+
const admission = this.resolveWorkerAdmission(request, contract);
|
|
396
|
+
if (!admission.ok)
|
|
397
|
+
return { action: "cancel", reasonCode: admission.skipReason };
|
|
398
|
+
return this.hasWorkerCapacity(admission.settings, admission.shipment.profile)
|
|
399
|
+
? { action: "start" }
|
|
400
|
+
: { action: "wait" };
|
|
401
|
+
}
|
|
402
|
+
buildWorkerExecutionPlan(profile, settings) {
|
|
403
|
+
return buildWorkerExecutionPlan({
|
|
404
|
+
profile,
|
|
405
|
+
settings,
|
|
406
|
+
cwd: this.deps.getCwd(),
|
|
407
|
+
deniedPaths: getPrivateLaneDeniedPaths(this.deps.getCwd(), this.deps.getAgentDir()),
|
|
408
|
+
foregroundMaxCostUsd: this.deps.getCapabilityEnvelope()?.maxEstimatedUsd,
|
|
409
|
+
memoryEnabled: this.deps.getSettingsManager().getMemoryRetrievalSettings().enabled,
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
/** One durable preparation path for queued, immediate, and recovered execution. */
|
|
413
|
+
prepareWorkerAttempt(request, admission, existingRecord) {
|
|
414
|
+
const lifecycle = this.getWorkerLifecycle();
|
|
415
|
+
if (existingRecord) {
|
|
416
|
+
return {
|
|
417
|
+
executionPlan: admission.executionPlan,
|
|
418
|
+
lifecycle,
|
|
419
|
+
record: existingRecord,
|
|
420
|
+
attempt: lifecycle.getActiveAttempt(existingRecord.laneId),
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const goal = this.deps.getGoalStateSnapshot();
|
|
424
|
+
const prepared = lifecycle.prepare({
|
|
425
|
+
instructions: admission.instructions,
|
|
426
|
+
executionContract: admission.executionContract,
|
|
427
|
+
requiredCapabilities: admission.executionPlan.requiredCapabilities,
|
|
428
|
+
...(request.verificationOfTaskId ? { verificationOfTaskId: request.verificationOfTaskId } : {}),
|
|
429
|
+
...(goal ? { goal } : {}),
|
|
430
|
+
});
|
|
431
|
+
return { executionPlan: admission.executionPlan, lifecycle, ...prepared };
|
|
432
|
+
}
|
|
433
|
+
start(request) {
|
|
434
|
+
return this.startInternal(request);
|
|
435
|
+
}
|
|
436
|
+
startInternal(request, pinnedContract) {
|
|
437
|
+
const admission = this.resolveWorkerAdmission(request, pinnedContract);
|
|
438
|
+
if (!admission.ok)
|
|
439
|
+
return { started: false, skipReason: admission.skipReason };
|
|
440
|
+
if (!request.verificationOfTaskId)
|
|
441
|
+
this.recoverDurableQueue();
|
|
442
|
+
const { settings, shipment } = admission;
|
|
443
|
+
const foreground = this.deps.getModel();
|
|
444
|
+
const contendsWithLocalForeground = foreground !== undefined && isLocalExecutionModel(foreground) && isLocalExecutionModel(shipment.model);
|
|
445
|
+
if (contendsWithLocalForeground || !this.hasWorkerCapacity(settings, shipment.profile)) {
|
|
446
|
+
// A mandatory verifier is the continuation of an already admitted implementation, not a
|
|
447
|
+
// new owner request. Reserve its queue admission so a burst of ordinary work cannot strand
|
|
448
|
+
// the subject behind `independent_verification_required` with no terminal handoff.
|
|
449
|
+
if (this.scheduler.queuedCount >= 8 && !request.verificationOfTaskId) {
|
|
450
|
+
return { started: false, skipReason: "worker_delegation_queue_full" };
|
|
451
|
+
}
|
|
452
|
+
let record;
|
|
453
|
+
try {
|
|
454
|
+
record = this.prepareWorkerAttempt(request, admission).record;
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
this.safeWarn(`Worker dispatch was not persisted: ${error instanceof Error ? error.message : String(error)}`);
|
|
458
|
+
return { started: false, skipReason: "orchestration_ledger_error" };
|
|
459
|
+
}
|
|
460
|
+
this.scheduler.enqueue(record, { ...request, profileId: shipment.profile.profileId }, false, request.verificationOfTaskId !== undefined);
|
|
461
|
+
this.notifications.statusChanged();
|
|
462
|
+
return { started: true, record };
|
|
463
|
+
}
|
|
464
|
+
let startedRecord;
|
|
465
|
+
const promise = this.runOnceWithAdmission(request, (record) => {
|
|
466
|
+
startedRecord = record;
|
|
467
|
+
}, undefined, admission);
|
|
468
|
+
if (!startedRecord) {
|
|
469
|
+
// Preparation is synchronous up to the first isolated completion await. A promise that
|
|
470
|
+
// rejected before producing a lane is still observed below, so it cannot become unhandled.
|
|
471
|
+
void promise.catch(() => undefined);
|
|
472
|
+
return { started: false, skipReason: "worker_not_started" };
|
|
473
|
+
}
|
|
474
|
+
this.scheduler.track(startedRecord.laneId, promise);
|
|
475
|
+
return { started: true, record: startedRecord };
|
|
476
|
+
}
|
|
477
|
+
async runOnce(request, onStarted, existingRecord) {
|
|
478
|
+
return this.runOnceWithAdmission(request, onStarted, existingRecord);
|
|
479
|
+
}
|
|
480
|
+
async runOnceWithAdmission(request, onStarted, existingRecord, preparedAdmission) {
|
|
481
|
+
const pinnedContract = existingRecord
|
|
482
|
+
? this.getWorkerLifecycle().getActiveAttempt(existingRecord.laneId)?.dispatch.executionContract
|
|
483
|
+
: undefined;
|
|
484
|
+
const admission = preparedAdmission ?? this.resolveWorkerAdmission(request, pinnedContract);
|
|
485
|
+
if (!admission.ok)
|
|
486
|
+
return { started: false, skipReason: admission.skipReason };
|
|
487
|
+
if (!request.verificationOfTaskId)
|
|
488
|
+
this.recoverDurableQueue();
|
|
489
|
+
const { instructions, settings, verifierShipment } = admission;
|
|
490
|
+
const { model, modelBinding, profile: orchestrationProfile, soul } = admission.shipment;
|
|
491
|
+
if (!this.hasWorkerCapacity(settings, orchestrationProfile)) {
|
|
492
|
+
return { started: false, skipReason: "worker_delegation_already_running" };
|
|
493
|
+
}
|
|
494
|
+
const laneCapability = this.laneCapabilityProfile(model);
|
|
495
|
+
const prepared = this.prepareWorkerAttempt(request, admission, existingRecord);
|
|
496
|
+
const { executionPlan, lifecycle } = prepared;
|
|
497
|
+
if (!prepared.attempt)
|
|
498
|
+
return { started: false, skipReason: "orchestration_attempt_missing" };
|
|
499
|
+
const durableTask = lifecycle.getTask(prepared.record.laneId);
|
|
500
|
+
if (!durableTask)
|
|
501
|
+
return { started: false, skipReason: "orchestration_task_missing" };
|
|
502
|
+
const compiled = compileWorkerExecutionGrant({
|
|
503
|
+
target: {
|
|
504
|
+
objectiveId: durableTask.task.objectiveId,
|
|
505
|
+
taskId: prepared.attempt.taskId,
|
|
506
|
+
attemptId: prepared.attempt.attemptId,
|
|
507
|
+
},
|
|
508
|
+
profile: orchestrationProfile,
|
|
509
|
+
plan: executionPlan,
|
|
510
|
+
});
|
|
511
|
+
if (!compiled.ok) {
|
|
512
|
+
lifecycle.cancel(prepared.record.laneId, compiled.reasonCodes.join(","));
|
|
513
|
+
return { started: false, skipReason: `execution_policy_denied:${compiled.reasonCodes.join(",")}` };
|
|
514
|
+
}
|
|
515
|
+
lifecycle.bindGrant(prepared.attempt.attemptId, compiled.grant);
|
|
516
|
+
const durableHandle = lifecycle.start(prepared.record.laneId, orchestrationProfile.leaseTtlMs);
|
|
517
|
+
const startedRecord = lifecycle.getRecord(prepared.record.laneId);
|
|
518
|
+
if (!startedRecord)
|
|
519
|
+
return { started: false, skipReason: "orchestration_projection_missing" };
|
|
520
|
+
onStarted?.(startedRecord);
|
|
521
|
+
const maxUsd = compiled.grant.budget.maxCostUsd;
|
|
522
|
+
const executionPolicy = orchestrationProfile.executionPolicy;
|
|
523
|
+
const toolSurface = createLaneToolSurface({
|
|
524
|
+
cwd: this.deps.getCwd(),
|
|
525
|
+
readMemory: executionPlan.readMemory ? (query) => this.deps.readMemoryForLane(query) : undefined,
|
|
526
|
+
writeEnabled: executionPlan.writeEnabled,
|
|
527
|
+
writePaths: executionPlan.writePaths,
|
|
528
|
+
...(executionPlan.processEnabled && executionPolicy ? { executionPolicy } : {}),
|
|
529
|
+
processMaxWallClockMs: compiled.grant.budget.maxWallClockMs ?? 0,
|
|
530
|
+
grant: compiled.grant,
|
|
531
|
+
toolManifests: executionPlan.toolManifests,
|
|
532
|
+
});
|
|
533
|
+
const writeGranted = executionPlan.writeEnabled &&
|
|
534
|
+
toolSurface.gateway !== undefined &&
|
|
535
|
+
toolSurface.allowedTools.some((name) => name === "write" || name === "edit");
|
|
536
|
+
const workerRequest = {
|
|
537
|
+
id: startedRecord.laneId,
|
|
538
|
+
instructions,
|
|
539
|
+
route: {
|
|
540
|
+
tier: "cheap",
|
|
541
|
+
risk: writeGranted ? "scoped-write" : "read-only",
|
|
542
|
+
confidence: 1,
|
|
543
|
+
reasonCode: "profile_worker",
|
|
544
|
+
reasons: [writeGranted ? "Path-scoped worker delegation" : "Read-only worker delegation"],
|
|
545
|
+
},
|
|
546
|
+
envelope: {
|
|
547
|
+
id: `worker-${this.deps.getSessionId()}-${startedRecord.laneId}`,
|
|
548
|
+
profileId: orchestrationProfile.profileId,
|
|
549
|
+
// filesystem.write requires BOTH the opt-in AND an explicit non-empty path scope —
|
|
550
|
+
// an unscoped write grant is refused here, not discovered at validation time.
|
|
551
|
+
capabilities: [...compiled.grant.capabilities],
|
|
552
|
+
...(writeGranted ? { allowedPaths: [...compiled.grant.writePaths] } : {}),
|
|
553
|
+
deniedPaths: [...compiled.grant.deniedPaths],
|
|
554
|
+
allowedTools: [...toolSurface.allowedTools],
|
|
555
|
+
deniedTools: [...toolSurface.deniedTools],
|
|
556
|
+
...(maxUsd !== undefined ? { maxEstimatedUsd: maxUsd } : {}),
|
|
557
|
+
createdAt: new Date().toISOString(),
|
|
558
|
+
},
|
|
559
|
+
...(maxUsd !== undefined ? { maxEstimatedUsd: maxUsd } : {}),
|
|
560
|
+
createdAt: new Date().toISOString(),
|
|
561
|
+
};
|
|
562
|
+
// Worker delegation START. Routing/scope codes + budget only — never the instructions text.
|
|
563
|
+
this.deps.emitAutonomyTelemetry({
|
|
564
|
+
type: AUTONOMY_TELEMETRY_EVENT_TYPES.workerRequest,
|
|
565
|
+
timestamp: new Date().toISOString(),
|
|
566
|
+
payload: {
|
|
567
|
+
id: workerRequest.id,
|
|
568
|
+
tier: workerRequest.route.tier,
|
|
569
|
+
capabilities: [...workerRequest.envelope.capabilities],
|
|
570
|
+
maxEstimatedUsd: workerRequest.maxEstimatedUsd ?? null,
|
|
571
|
+
},
|
|
572
|
+
});
|
|
573
|
+
const usageReportId = `worker:${this.deps.getSessionId()}:${startedRecord.laneId}`;
|
|
574
|
+
const laneAbortController = new AbortController();
|
|
575
|
+
this.laneAbortControllers.set(startedRecord.laneId, laneAbortController);
|
|
576
|
+
const workerSignal = AbortSignal.any([this.workerAbort.signal, laneAbortController.signal]);
|
|
577
|
+
// Registered for the lane's full run so the reload gate waits it out; deregistered in the
|
|
578
|
+
// finally below no matter how this lane terminates (success, disposal, or a thrown error).
|
|
579
|
+
// registerInFlightWork is a pure sync map op (cannot throw), so placing it as the last
|
|
580
|
+
// statement before `try` still guarantees the matching finally always runs.
|
|
581
|
+
const deregisterInFlight = registerInFlightWork(this.deps.getAgentDir(), "lane", `worker:${startedRecord.laneId}`);
|
|
582
|
+
const durableStartedAt = Date.now();
|
|
583
|
+
try {
|
|
584
|
+
let spentUsage;
|
|
585
|
+
const toolChangedFiles = new Set();
|
|
586
|
+
const toolIssues = new Set();
|
|
587
|
+
// Register the live mutation ledger BEFORE the suspend point below so a synchronous
|
|
588
|
+
// disposal cutoff (`abortInFlightLanes`) can read a race-free snapshot of whatever this
|
|
589
|
+
// worker has already applied — the worker is suspended at the `await runWorker(...)` below
|
|
590
|
+
// whenever abort runs, and the abort signal stops further tool calls. Deleted in the
|
|
591
|
+
// `finally` on every exit path (normal completion, throw, or already consumed by abort).
|
|
592
|
+
this.inFlightLedgers.set(startedRecord.laneId, {
|
|
593
|
+
changedFiles: toolChangedFiles,
|
|
594
|
+
getSpend: () => spentUsage,
|
|
595
|
+
getToolCalls: () => toolSurface.gateway?.getUsage().toolCalls ?? 0,
|
|
596
|
+
request: workerRequest,
|
|
597
|
+
handle: durableHandle,
|
|
598
|
+
startedAt: durableStartedAt,
|
|
599
|
+
});
|
|
600
|
+
const maxToolCalls = compiled.grant.budget.maxToolCalls ?? 0;
|
|
601
|
+
const rawOutcome = await runWorker({
|
|
602
|
+
request: workerRequest,
|
|
603
|
+
maxUsd,
|
|
604
|
+
maxWallClockMs: compiled.grant.budget.maxWallClockMs ?? 0,
|
|
605
|
+
usageReportId,
|
|
606
|
+
getChangedFiles: () => [...toolChangedFiles],
|
|
607
|
+
signal: workerSignal,
|
|
608
|
+
// Parent validation must use the same relative-path baseline the runner reports in.
|
|
609
|
+
cwd: this.deps.getCwd(),
|
|
610
|
+
processCapable: executionPlan.processEnabled,
|
|
611
|
+
...(request.verificationOfTaskId ? { verificationSubjectTaskId: request.verificationOfTaskId } : {}),
|
|
612
|
+
// Write lane: runner-side action application through the envelope path scope.
|
|
613
|
+
applyActions: workerRequest.envelope.capabilities.includes("filesystem.write")
|
|
614
|
+
? (actions) => {
|
|
615
|
+
return applyWorkerActions({
|
|
616
|
+
actions,
|
|
617
|
+
gateway: toolSurface.gateway,
|
|
618
|
+
toolManifests: executionPlan.toolManifests,
|
|
619
|
+
cwd: this.deps.getCwd(),
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
: undefined,
|
|
623
|
+
complete: async ({ systemPrompt, userPrompt, signal }) => {
|
|
624
|
+
const completion = await this.deps.runIsolatedCompletion({
|
|
625
|
+
// Level-0 core and owner-authored profile remain authoritative. The delegating
|
|
626
|
+
// model supplies task instructions only; it cannot replace the worker role prompt.
|
|
627
|
+
systemPrompt: composeSubagentSystemPrompt({
|
|
628
|
+
soul,
|
|
629
|
+
rolePrompt: systemPrompt,
|
|
630
|
+
}),
|
|
631
|
+
messages: [{ role: "user", content: [{ type: "text", text: userPrompt }], timestamp: Date.now() }],
|
|
632
|
+
model,
|
|
633
|
+
thinkingLevel: modelBinding.thinkingLevel,
|
|
634
|
+
maxTokens: Math.min(laneCapability.laneMaxOutputTokens, compiled.grant.budget.maxTokens ?? Number.POSITIVE_INFINITY),
|
|
635
|
+
tools: toolSurface.tools,
|
|
636
|
+
maxTurns: Math.max(1, Math.min(6, maxToolCalls + 1)),
|
|
637
|
+
finalTextPrompt: "The tool-turn budget is exhausted. Do not call more tools. Return the required worker-claim JSON envelope now using only evidence already gathered. If the investigation is incomplete, say so in the summary or blockers instead of omitting the envelope.",
|
|
638
|
+
beforeToolCall: async (context, toolSignal) => {
|
|
639
|
+
const decision = await toolSurface.beforeToolCall(context, toolSignal);
|
|
640
|
+
if (decision?.block) {
|
|
641
|
+
toolIssues.add(`${context.toolCall.name} blocked: ${decision.reason ?? "capability denied"}`);
|
|
642
|
+
}
|
|
643
|
+
return decision;
|
|
644
|
+
},
|
|
645
|
+
afterToolCall: async ({ toolCall, args, isError }) => {
|
|
646
|
+
// This hook runs only for a validated, gate-approved tool that actually entered
|
|
647
|
+
// execution. Record a direct mutation target before inspecting `isError`: write/edit
|
|
648
|
+
// may have changed disk and then observed cancellation, timeout, or a late I/O error.
|
|
649
|
+
// Pre-gate/profile/path refusals never reach afterToolCall, so they remain unreported.
|
|
650
|
+
if (toolCall.name === "write" || toolCall.name === "edit") {
|
|
651
|
+
if (args && typeof args === "object" && !Array.isArray(args)) {
|
|
652
|
+
const rawPath = args.path;
|
|
653
|
+
if (typeof rawPath === "string" && rawPath.length > 0) {
|
|
654
|
+
const absolutePath = path.isAbsolute(rawPath)
|
|
655
|
+
? path.resolve(rawPath)
|
|
656
|
+
: path.resolve(this.deps.getCwd(), rawPath);
|
|
657
|
+
let canonicalPath = absolutePath;
|
|
658
|
+
try {
|
|
659
|
+
canonicalPath = safeRealpathSync(absolutePath);
|
|
660
|
+
}
|
|
661
|
+
catch {
|
|
662
|
+
// Execution was attempted; preserve conservative accounting with the lexical path.
|
|
663
|
+
}
|
|
664
|
+
toolChangedFiles.add(path.relative(this.deps.getCwd(), canonicalPath).split(path.sep).join("/"));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
if (isError) {
|
|
669
|
+
toolIssues.add(`${toolCall.name} failed during isolated execution`);
|
|
670
|
+
return undefined;
|
|
671
|
+
}
|
|
672
|
+
return undefined;
|
|
673
|
+
},
|
|
674
|
+
signal,
|
|
675
|
+
// Core/soul/role are all static per configuration — the provider can cache the prefix.
|
|
676
|
+
cacheRetention: "short",
|
|
677
|
+
// Stable per-lane synthetic affinity key so repeat worker-delegation calls route to
|
|
678
|
+
// the same cache-warm backend without carrying the real session id.
|
|
679
|
+
laneKind: "worker",
|
|
680
|
+
});
|
|
681
|
+
spentUsage = completion.usage;
|
|
682
|
+
toolSurface.gateway?.recordUsage({
|
|
683
|
+
inputTokens: completion.usage.input,
|
|
684
|
+
outputTokens: completion.usage.output,
|
|
685
|
+
costUsd: completion.usage.cost.total,
|
|
686
|
+
});
|
|
687
|
+
return {
|
|
688
|
+
text: completion.text,
|
|
689
|
+
costUsd: completion.usage.cost.total,
|
|
690
|
+
stopReason: String(completion.stopReason),
|
|
691
|
+
changedFiles: [...toolChangedFiles],
|
|
692
|
+
blockers: [...toolIssues],
|
|
693
|
+
};
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
const verificationRequired = orchestrationProfile.requireIndependentVerification &&
|
|
697
|
+
orchestrationProfile.role !== "verifier" &&
|
|
698
|
+
rawOutcome.claim.status === "completed";
|
|
699
|
+
const outcome = verificationRequired
|
|
700
|
+
? {
|
|
701
|
+
...rawOutcome,
|
|
702
|
+
accepted: false,
|
|
703
|
+
reasonCode: "independent_verification_required",
|
|
704
|
+
acceptance: {
|
|
705
|
+
outcome: "ask-user",
|
|
706
|
+
gate: "independent_verification",
|
|
707
|
+
reasonCode: "independent_verification_required",
|
|
708
|
+
message: "The owner-authored profile requires an independent verifier before acceptance.",
|
|
709
|
+
},
|
|
710
|
+
claim: {
|
|
711
|
+
...rawOutcome.claim,
|
|
712
|
+
parentReviewRequired: true,
|
|
713
|
+
blockers: [
|
|
714
|
+
...(rawOutcome.claim.blockers ?? []),
|
|
715
|
+
"independent verification is required before acceptance",
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
}
|
|
719
|
+
: rawOutcome;
|
|
720
|
+
// Never persist against a disposed session. When disposal raced this
|
|
721
|
+
// await, `abortInFlightLanes()`'s synchronous cutoff already completed this lane, persisted
|
|
722
|
+
// its durable lane record + bounded WorkerClaim, and consumed (deleted) the ledger —
|
|
723
|
+
// `.complete()` below is then a no-op (the lane is already terminal, so it returns
|
|
724
|
+
// undefined) and no double persistence or duplicate terminal notification can happen here.
|
|
725
|
+
if (this.deps.isDisposed()) {
|
|
726
|
+
const record = lifecycle.getRecord(startedRecord.laneId);
|
|
727
|
+
return { started: true, record, outcome };
|
|
728
|
+
}
|
|
729
|
+
const verificationSubject = request.verificationOfTaskId
|
|
730
|
+
? lifecycle.getTask(request.verificationOfTaskId)
|
|
731
|
+
: undefined;
|
|
732
|
+
let record = lifecycle.finish(createWorkerResultContract({
|
|
733
|
+
handle: durableHandle,
|
|
734
|
+
claim: outcome.claim,
|
|
735
|
+
accepted: outcome.accepted,
|
|
736
|
+
costUsd: outcome.costUsd,
|
|
737
|
+
reasonCode: outcome.reasonCode,
|
|
738
|
+
cwd: this.deps.getCwd(),
|
|
739
|
+
...(spentUsage
|
|
740
|
+
? {
|
|
741
|
+
inputTokens: spentUsage.input,
|
|
742
|
+
outputTokens: spentUsage.output,
|
|
743
|
+
totalTokens: spentUsage.totalTokens,
|
|
744
|
+
}
|
|
745
|
+
: {}),
|
|
746
|
+
wallClockMs: Date.now() - durableStartedAt,
|
|
747
|
+
toolCalls: toolSurface.gateway?.getUsage().toolCalls ?? 0,
|
|
748
|
+
verificationRequired,
|
|
749
|
+
verificationCriterionIds: verificationSubject?.task.acceptanceCriterionIds,
|
|
750
|
+
}), { notify: !verificationRequired });
|
|
751
|
+
try {
|
|
752
|
+
this.deps.saveWorkerClaimSnapshot(outcome.claim, workerRequest);
|
|
753
|
+
}
|
|
754
|
+
catch (error) {
|
|
755
|
+
this.safeWarn(`Failed to persist worker claim ${startedRecord.laneId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
756
|
+
}
|
|
757
|
+
if (spentUsage && (spentUsage.cost.total > 0 || spentUsage.totalTokens > 0)) {
|
|
758
|
+
this.deps.addSpawnedUsage(spentUsage, { label: "worker-delegation", reportId: usageReportId });
|
|
759
|
+
}
|
|
760
|
+
const terminalRecords = [record];
|
|
761
|
+
if (request.verificationOfTaskId) {
|
|
762
|
+
const decision = outcome.accepted ? outcome.claim.verification : undefined;
|
|
763
|
+
const subject = lifecycle.reconcileVerification({
|
|
764
|
+
subjectTaskId: request.verificationOfTaskId,
|
|
765
|
+
verifierTaskId: startedRecord.laneId,
|
|
766
|
+
verifierAttemptId: durableHandle.attemptId,
|
|
767
|
+
verdict: decision?.verdict ?? "inconclusive",
|
|
768
|
+
reasonCode: decision
|
|
769
|
+
? decision.verdict === "accepted"
|
|
770
|
+
? "independent_verification_accepted"
|
|
771
|
+
: `independent_verification_rejected:${decision.reasonCodes.join(",")}`
|
|
772
|
+
: `independent_verification_inconclusive:${outcome.reasonCode}`,
|
|
773
|
+
});
|
|
774
|
+
terminalRecords.push(subject);
|
|
775
|
+
}
|
|
776
|
+
else if (verificationRequired) {
|
|
777
|
+
const verifierStart = verifierShipment
|
|
778
|
+
? this.startInternal(this.buildVerifierRequest({
|
|
779
|
+
subjectTaskId: startedRecord.laneId,
|
|
780
|
+
verifierProfileId: verifierShipment.profile.profileId,
|
|
781
|
+
summary: rawOutcome.claim.summary,
|
|
782
|
+
artifactUris: rawOutcome.claim.changedFiles,
|
|
783
|
+
}), verifierWorkerExecutionContract(admission.executionContract))
|
|
784
|
+
: { started: false, skipReason: "independent_verifier_unavailable" };
|
|
785
|
+
if (verifierStart.started) {
|
|
786
|
+
// The durable verifier dispatch is now the terminal-work owner. The subject remains
|
|
787
|
+
// blocked and emits no compatibility terminal snapshot until reconciliation.
|
|
788
|
+
terminalRecords.length = 0;
|
|
789
|
+
this.scheduler.drain();
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
this.safeWarn(`Independent verifier for ${startedRecord.laneId} did not start: ${verifierStart.skipReason}`);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
if (outcome.acceptance.outcome === "ask-user" && terminalRecords.length > 0) {
|
|
796
|
+
this.deps.queueWorkerHumanInput({
|
|
797
|
+
workerRequestId: startedRecord.laneId,
|
|
798
|
+
message: outcome.acceptance.message ?? "Worker output requires owner review.",
|
|
799
|
+
blockers: outcome.claim.blockers ?? [],
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
for (const terminalRecord of terminalRecords) {
|
|
803
|
+
this.publishTerminalRecord(terminalRecord);
|
|
804
|
+
}
|
|
805
|
+
if (request.verificationOfTaskId) {
|
|
806
|
+
record = lifecycle.getRecord(startedRecord.laneId) ?? record;
|
|
807
|
+
}
|
|
808
|
+
return { started: true, record, outcome };
|
|
809
|
+
}
|
|
810
|
+
catch (error) {
|
|
811
|
+
const durableState = lifecycle.ledger.runtime.getSnapshot().attempts[durableHandle.attemptId];
|
|
812
|
+
if (durableState?.status === "cancelled" && (laneAbortController.signal.aborted || this.deps.isDisposed())) {
|
|
813
|
+
return { started: true, record: lifecycle.getRecord(startedRecord.laneId) };
|
|
814
|
+
}
|
|
815
|
+
if (durableState?.status === "running" || durableState?.status === "leased") {
|
|
816
|
+
const failureClaim = {
|
|
817
|
+
requestId: startedRecord.laneId,
|
|
818
|
+
status: "failed",
|
|
819
|
+
summary: `Worker delegation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
820
|
+
changedFiles: [],
|
|
821
|
+
createdAt: new Date().toISOString(),
|
|
822
|
+
};
|
|
823
|
+
try {
|
|
824
|
+
lifecycle.finish(createWorkerResultContract({
|
|
825
|
+
handle: durableHandle,
|
|
826
|
+
claim: failureClaim,
|
|
827
|
+
accepted: false,
|
|
828
|
+
costUsd: 0,
|
|
829
|
+
cwd: this.deps.getCwd(),
|
|
830
|
+
wallClockMs: Date.now() - durableStartedAt,
|
|
831
|
+
toolCalls: toolSurface.gateway?.getUsage().toolCalls ?? 0,
|
|
832
|
+
reasonCode: "worker_delegation_error",
|
|
833
|
+
}));
|
|
834
|
+
}
|
|
835
|
+
catch (persistError) {
|
|
836
|
+
this.safeWarn(`Failed to persist durable worker failure ${startedRecord.laneId}: ${persistError instanceof Error ? persistError.message : String(persistError)}`);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
let record = lifecycle.getRecord(startedRecord.laneId);
|
|
840
|
+
if (record?.status === "queued" || record?.status === "running") {
|
|
841
|
+
record = lifecycle.cancel(startedRecord.laneId, "worker_delegation_error");
|
|
842
|
+
}
|
|
843
|
+
if (record && !this.deps.isDisposed())
|
|
844
|
+
this.publishTerminalRecord(record);
|
|
845
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
846
|
+
this.deps.emit({ type: "warning", message: `Worker delegation failed: ${message}` });
|
|
847
|
+
return { started: true, record };
|
|
848
|
+
}
|
|
849
|
+
finally {
|
|
850
|
+
this.inFlightLedgers.delete(startedRecord.laneId);
|
|
851
|
+
this.laneAbortControllers.delete(startedRecord.laneId);
|
|
852
|
+
deregisterInFlight();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
/** Start every capacity-eligible queued worker at the owner session's foreground-idle boundary. */
|
|
856
|
+
drain() {
|
|
857
|
+
this.recoverDurableQueue();
|
|
858
|
+
this.scheduler.drain();
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
//# sourceMappingURL=worker-delegation-controller.js.map
|