@telora/daemon 0.19.47 → 0.19.74
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/build-info.json +6 -3
- package/dist/assembly-engine.d.ts +9 -0
- package/dist/assembly-engine.d.ts.map +1 -1
- package/dist/assembly-engine.js.map +1 -1
- package/dist/audit-hooks.js +1 -1
- package/dist/branch-status.js +2 -2
- package/dist/branch-status.js.map +1 -1
- package/dist/ci-sensor-loop.d.ts +47 -0
- package/dist/ci-sensor-loop.d.ts.map +1 -0
- package/dist/ci-sensor-loop.js +116 -0
- package/dist/ci-sensor-loop.js.map +1 -0
- package/dist/ci-status-git.d.ts +52 -0
- package/dist/ci-status-git.d.ts.map +1 -0
- package/dist/ci-status-git.js +86 -0
- package/dist/ci-status-git.js.map +1 -0
- package/dist/ci-status.d.ts +122 -0
- package/dist/ci-status.d.ts.map +1 -0
- package/dist/ci-status.js +114 -0
- package/dist/ci-status.js.map +1 -0
- package/dist/cli/connect/agents.d.ts +24 -0
- package/dist/cli/connect/agents.d.ts.map +1 -0
- package/dist/cli/connect/agents.js +65 -0
- package/dist/cli/connect/agents.js.map +1 -0
- package/dist/cli/connect/claude.d.ts +31 -0
- package/dist/cli/connect/claude.d.ts.map +1 -0
- package/dist/cli/connect/claude.js +104 -0
- package/dist/cli/connect/claude.js.map +1 -0
- package/dist/cli/connect/cline.d.ts +37 -0
- package/dist/cli/connect/cline.d.ts.map +1 -0
- package/dist/cli/connect/cline.js +115 -0
- package/dist/cli/connect/cline.js.map +1 -0
- package/dist/cli/connect/codex.d.ts +44 -0
- package/dist/cli/connect/codex.d.ts.map +1 -0
- package/dist/cli/connect/codex.js +111 -0
- package/dist/cli/connect/codex.js.map +1 -0
- package/dist/cli/connect/ide.d.ts +69 -0
- package/dist/cli/connect/ide.d.ts.map +1 -0
- package/dist/cli/connect/ide.js +134 -0
- package/dist/cli/connect/ide.js.map +1 -0
- package/dist/cli/connect/scaffolding.d.ts +31 -0
- package/dist/cli/connect/scaffolding.d.ts.map +1 -0
- package/dist/cli/connect/scaffolding.js +52 -0
- package/dist/cli/connect/scaffolding.js.map +1 -0
- package/dist/cli/connect/shared.d.ts +30 -0
- package/dist/cli/connect/shared.d.ts.map +1 -0
- package/dist/cli/connect/shared.js +11 -0
- package/dist/cli/connect/shared.js.map +1 -0
- package/dist/cli/connect.d.ts +9 -210
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +10 -526
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/open.js +2 -2
- package/dist/completion/event.d.ts +2 -0
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +19 -2
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/merge-phase.d.ts +3 -0
- package/dist/completion/merge-phase.d.ts.map +1 -1
- package/dist/completion/merge-phase.js +35 -3
- package/dist/completion/merge-phase.js.map +1 -1
- package/dist/completion/read-only-pristine.d.ts +1 -1
- package/dist/completion/read-only-pristine.d.ts.map +1 -1
- package/dist/completion/read-only-pristine.js +1 -1
- package/dist/completion/read-only-pristine.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts +30 -3
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +203 -15
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/status-advance-phase.js +1 -1
- package/dist/completion/status-advance-phase.js.map +1 -1
- package/dist/completion/team-completion.d.ts.map +1 -1
- package/dist/completion/team-completion.js +22 -2
- package/dist/completion/team-completion.js.map +1 -1
- package/dist/completion/team-lifecycle.js +1 -1
- package/dist/completion/terminated-work-reconcile.js +1 -1
- package/dist/completion/terminated-work-reconcile.js.map +1 -1
- package/dist/condition-evaluators.d.ts +41 -2
- package/dist/condition-evaluators.d.ts.map +1 -1
- package/dist/condition-evaluators.js +37 -288
- package/dist/condition-evaluators.js.map +1 -1
- package/dist/context-audit.d.ts +1 -1
- package/dist/context-audit.d.ts.map +1 -1
- package/dist/context-lock.d.ts +1 -1
- package/dist/context-lock.d.ts.map +1 -1
- package/dist/control-state.d.ts +2 -2
- package/dist/control-state.d.ts.map +1 -1
- package/dist/control-state.js +4 -3
- package/dist/control-state.js.map +1 -1
- package/dist/daemon-process.d.ts +1 -1
- package/dist/daemon-process.d.ts.map +1 -1
- package/dist/delivery-advance-block.d.ts +1 -1
- package/dist/delivery-advance-block.d.ts.map +1 -1
- package/dist/delivery-advance-block.js +1 -1
- package/dist/delivery-advance-block.js.map +1 -1
- package/dist/delivery-lifecycle.js +1 -1
- package/dist/delivery-reconciler-shadow.d.ts +1 -1
- package/dist/delivery-reconciler-shadow.d.ts.map +1 -1
- package/dist/delivery-reconciler-shadow.js +1 -1
- package/dist/delivery-reconciler-shadow.js.map +1 -1
- package/dist/directive-executor.js +1 -1
- package/dist/directive-executor.js.map +1 -1
- package/dist/drift-eval-loop.d.ts.map +1 -1
- package/dist/drift-eval-loop.js +6 -14
- package/dist/drift-eval-loop.js.map +1 -1
- package/dist/escalations.d.ts +1 -1
- package/dist/escalations.d.ts.map +1 -1
- package/dist/escalations.js +1 -1
- package/dist/escalations.js.map +1 -1
- package/dist/evaluation-context.d.ts +2 -33
- package/dist/evaluation-context.d.ts.map +1 -1
- package/dist/evaluation-context.js +2 -56
- package/dist/evaluation-context.js.map +1 -1
- package/dist/focus-engine.d.ts +14 -5
- package/dist/focus-engine.d.ts.map +1 -1
- package/dist/focus-engine.js +35 -289
- package/dist/focus-engine.js.map +1 -1
- package/dist/focus-executor.d.ts +10 -791
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +42 -1568
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-lifecycle.js +2 -2
- package/dist/focus-lifecycle.js.map +1 -1
- package/dist/focus-loop-registry.d.ts +52 -0
- package/dist/focus-loop-registry.d.ts.map +1 -0
- package/dist/focus-loop-registry.js +328 -0
- package/dist/focus-loop-registry.js.map +1 -0
- package/dist/focus-merge.d.ts +1 -1
- package/dist/focus-merge.d.ts.map +1 -1
- package/dist/focus-merge.js +3 -3
- package/dist/focus-merge.js.map +1 -1
- package/dist/focus-phase.d.ts +4 -0
- package/dist/focus-phase.d.ts.map +1 -1
- package/dist/focus-phase.js +3 -3
- package/dist/focus-phase.js.map +1 -1
- package/dist/focus-stage-lifecycle/planning-release.d.ts +197 -0
- package/dist/focus-stage-lifecycle/planning-release.d.ts.map +1 -0
- package/dist/focus-stage-lifecycle/planning-release.js +312 -0
- package/dist/focus-stage-lifecycle/planning-release.js.map +1 -0
- package/dist/focus-stage-lifecycle/review-convergence.d.ts +133 -0
- package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +1 -0
- package/dist/focus-stage-lifecycle/review-convergence.js +235 -0
- package/dist/focus-stage-lifecycle/review-convergence.js.map +1 -0
- package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +133 -0
- package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -0
- package/dist/focus-stage-lifecycle/wedge-watchdog.js +365 -0
- package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -0
- package/dist/focus-stage-lifecycle.d.ts +22 -421
- package/dist/focus-stage-lifecycle.d.ts.map +1 -1
- package/dist/focus-stage-lifecycle.js +24 -832
- package/dist/focus-stage-lifecycle.js.map +1 -1
- package/dist/{git-activity.d.ts → git/activity.d.ts} +1 -1
- package/dist/git/activity.d.ts.map +1 -0
- package/dist/{git-activity.js → git/activity.js} +2 -2
- package/dist/git/activity.js.map +1 -0
- package/dist/{git-branch.d.ts → git/branch.d.ts} +2 -2
- package/dist/git/branch.d.ts.map +1 -0
- package/dist/{git-branch.js → git/branch.js} +2 -2
- package/dist/git/branch.js.map +1 -0
- package/dist/{git-fetch.d.ts → git/fetch.d.ts} +2 -2
- package/dist/git/fetch.d.ts.map +1 -0
- package/dist/{git-fetch.js → git/fetch.js} +1 -1
- package/dist/git/fetch.js.map +1 -0
- package/dist/{git-genesis.d.ts → git/genesis.d.ts} +3 -3
- package/dist/git/genesis.d.ts.map +1 -0
- package/dist/{git-genesis.js → git/genesis.js} +5 -5
- package/dist/git/genesis.js.map +1 -0
- package/dist/git/index.d.ts +36 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +36 -0
- package/dist/git/index.js.map +1 -0
- package/dist/{git-integration.d.ts → git/integration.d.ts} +2 -2
- package/dist/git/integration.d.ts.map +1 -0
- package/dist/{git-integration.js → git/integration.js} +4 -4
- package/dist/git/integration.js.map +1 -0
- package/dist/{git-merge-helpers.d.ts → git/merge-helpers.d.ts} +3 -3
- package/dist/git/merge-helpers.d.ts.map +1 -0
- package/dist/{git-merge-helpers.js → git/merge-helpers.js} +3 -3
- package/dist/git/merge-helpers.js.map +1 -0
- package/dist/{git-merge-lock.d.ts → git/merge-lock.d.ts} +1 -1
- package/dist/git/merge-lock.d.ts.map +1 -0
- package/dist/{git-merge-lock.js → git/merge-lock.js} +1 -1
- package/dist/git/merge-lock.js.map +1 -0
- package/dist/{git-merge-strategies.d.ts → git/merge-strategies.d.ts} +2 -2
- package/dist/git/merge-strategies.d.ts.map +1 -0
- package/dist/{git-merge-strategies.js → git/merge-strategies.js} +3 -3
- package/dist/git/merge-strategies.js.map +1 -0
- package/dist/{git-merge.d.ts → git/merge.d.ts} +4 -4
- package/dist/git/merge.d.ts.map +1 -0
- package/dist/{git-merge.js → git/merge.js} +4 -4
- package/dist/git/merge.js.map +1 -0
- package/dist/{git-state-detector.d.ts → git/state-detector.d.ts} +2 -2
- package/dist/git/state-detector.d.ts.map +1 -0
- package/dist/{git-state-detector.js → git/state-detector.js} +7 -7
- package/dist/git/state-detector.js.map +1 -0
- package/dist/{git-types.d.ts → git/types.d.ts} +2 -2
- package/dist/git/types.d.ts.map +1 -0
- package/dist/{git-types.js → git/types.js} +1 -1
- package/dist/git/types.js.map +1 -0
- package/dist/{git-utils.d.ts → git/utils.d.ts} +1 -1
- package/dist/git/utils.d.ts.map +1 -0
- package/dist/{git-utils.js → git/utils.js} +2 -2
- package/dist/git/utils.js.map +1 -0
- package/dist/git.d.ts +5 -5
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +10 -10
- package/dist/git.js.map +1 -1
- package/dist/guard-engine.d.ts +3 -2
- package/dist/guard-engine.d.ts.map +1 -1
- package/dist/guard-engine.js +2 -2
- package/dist/guard-engine.js.map +1 -1
- package/dist/install-probe-tick.d.ts +63 -0
- package/dist/install-probe-tick.d.ts.map +1 -0
- package/dist/install-probe-tick.js +137 -0
- package/dist/install-probe-tick.js.map +1 -0
- package/dist/install-probe.d.ts +115 -0
- package/dist/install-probe.d.ts.map +1 -0
- package/dist/install-probe.js +197 -0
- package/dist/install-probe.js.map +1 -0
- package/dist/listener-auto-advance.d.ts.map +1 -1
- package/dist/listener-auto-advance.js +31 -0
- package/dist/listener-auto-advance.js.map +1 -1
- package/dist/listener.js +5 -5
- package/dist/listener.js.map +1 -1
- package/dist/{loop-context-audit-pass.d.ts → loops/context-audit-pass.d.ts} +4 -4
- package/dist/loops/context-audit-pass.d.ts.map +1 -0
- package/dist/{loop-context-audit-pass.js → loops/context-audit-pass.js} +7 -7
- package/dist/loops/context-audit-pass.js.map +1 -0
- package/dist/{loop-engine-types.d.ts → loops/engine-types.d.ts} +1 -1
- package/dist/loops/engine-types.d.ts.map +1 -0
- package/dist/{loop-engine-types.js → loops/engine-types.js} +1 -1
- package/dist/loops/engine-types.js.map +1 -0
- package/dist/{loop-engine.d.ts → loops/engine.d.ts} +6 -6
- package/dist/loops/engine.d.ts.map +1 -0
- package/dist/{loop-engine.js → loops/engine.js} +13 -13
- package/dist/loops/engine.js.map +1 -0
- package/dist/{loop-event-bus.d.ts → loops/event-bus.d.ts} +1 -1
- package/dist/loops/event-bus.d.ts.map +1 -0
- package/dist/{loop-event-bus.js → loops/event-bus.js} +1 -1
- package/dist/loops/event-bus.js.map +1 -0
- package/dist/loops/index.d.ts +33 -0
- package/dist/loops/index.d.ts.map +1 -0
- package/dist/loops/index.js +32 -0
- package/dist/loops/index.js.map +1 -0
- package/dist/{loop-llm-client.d.ts → loops/llm-client.d.ts} +3 -3
- package/dist/loops/llm-client.d.ts.map +1 -0
- package/dist/{loop-llm-client.js → loops/llm-client.js} +3 -3
- package/dist/loops/llm-client.js.map +1 -0
- package/dist/{loop-llm-flag.d.ts → loops/llm-flag.d.ts} +1 -1
- package/dist/loops/llm-flag.d.ts.map +1 -0
- package/dist/{loop-llm-flag.js → loops/llm-flag.js} +1 -1
- package/dist/loops/llm-flag.js.map +1 -0
- package/dist/{loop-operational-block.d.ts → loops/operational-block.d.ts} +1 -1
- package/dist/loops/operational-block.d.ts.map +1 -0
- package/dist/{loop-operational-block.js → loops/operational-block.js} +1 -1
- package/dist/loops/operational-block.js.map +1 -0
- package/dist/{loop-prompt-builder.d.ts → loops/prompt-builder.d.ts} +2 -2
- package/dist/loops/prompt-builder.d.ts.map +1 -0
- package/dist/{loop-prompt-builder.js → loops/prompt-builder.js} +1 -1
- package/dist/loops/prompt-builder.js.map +1 -0
- package/dist/{loop-variance.d.ts → loops/variance.d.ts} +1 -1
- package/dist/loops/variance.d.ts.map +1 -0
- package/dist/{loop-variance.js → loops/variance.js} +1 -1
- package/dist/loops/variance.js.map +1 -0
- package/dist/merge-back-loop.d.ts.map +1 -1
- package/dist/merge-back-loop.js +4 -3
- package/dist/merge-back-loop.js.map +1 -1
- package/dist/merge-detector.js +2 -2
- package/dist/merge-detector.js.map +1 -1
- package/dist/{nexus-endpoint-clearance.d.ts → nexus/endpoint-clearance.d.ts} +2 -2
- package/dist/nexus/endpoint-clearance.d.ts.map +1 -0
- package/dist/{nexus-endpoint-clearance.js → nexus/endpoint-clearance.js} +2 -2
- package/dist/nexus/endpoint-clearance.js.map +1 -0
- package/dist/{nexus-escalation-bridge.d.ts → nexus/escalation-bridge.d.ts} +1 -1
- package/dist/nexus/escalation-bridge.d.ts.map +1 -0
- package/dist/{nexus-escalation-bridge.js → nexus/escalation-bridge.js} +2 -2
- package/dist/nexus/escalation-bridge.js.map +1 -0
- package/dist/{nexus-incoming.d.ts → nexus/incoming.d.ts} +2 -2
- package/dist/nexus/incoming.d.ts.map +1 -0
- package/dist/{nexus-incoming.js → nexus/incoming.js} +2 -2
- package/dist/nexus/incoming.js.map +1 -0
- package/dist/nexus/index.d.ts +20 -0
- package/dist/nexus/index.d.ts.map +1 -0
- package/dist/nexus/index.js +20 -0
- package/dist/nexus/index.js.map +1 -0
- package/dist/{nexus-intake-spawn.d.ts → nexus/intake-spawn.d.ts} +3 -3
- package/dist/nexus/intake-spawn.d.ts.map +1 -0
- package/dist/{nexus-intake-spawn.js → nexus/intake-spawn.js} +1 -1
- package/dist/nexus/intake-spawn.js.map +1 -0
- package/dist/{nexus-intake.d.ts → nexus/intake.d.ts} +2 -2
- package/dist/nexus/intake.d.ts.map +1 -0
- package/dist/{nexus-intake.js → nexus/intake.js} +4 -4
- package/dist/nexus/intake.js.map +1 -0
- package/dist/{nexus-return.d.ts → nexus/return.d.ts} +3 -3
- package/dist/nexus/return.d.ts.map +1 -0
- package/dist/{nexus-return.js → nexus/return.js} +4 -4
- package/dist/nexus/return.js.map +1 -0
- package/dist/otlp/index.d.ts +19 -0
- package/dist/otlp/index.d.ts.map +1 -0
- package/dist/otlp/index.js +19 -0
- package/dist/otlp/index.js.map +1 -0
- package/dist/{otlp-log-parser.d.ts → otlp/log-parser.d.ts} +2 -2
- package/dist/otlp/log-parser.d.ts.map +1 -0
- package/dist/{otlp-log-parser.js → otlp/log-parser.js} +5 -6
- package/dist/otlp/log-parser.js.map +1 -0
- package/dist/{otlp-metric-parser.d.ts → otlp/metric-parser.d.ts} +2 -2
- package/dist/otlp/metric-parser.d.ts.map +1 -0
- package/dist/{otlp-metric-parser.js → otlp/metric-parser.js} +4 -5
- package/dist/otlp/metric-parser.js.map +1 -0
- package/dist/{otlp-port-manager.d.ts → otlp/port-manager.d.ts} +1 -1
- package/dist/otlp/port-manager.d.ts.map +1 -0
- package/dist/{otlp-port-manager.js → otlp/port-manager.js} +1 -1
- package/dist/otlp/port-manager.js.map +1 -0
- package/dist/{otlp-receiver.d.ts → otlp/receiver.d.ts} +2 -2
- package/dist/otlp/receiver.d.ts.map +1 -0
- package/dist/{otlp-receiver.js → otlp/receiver.js} +5 -33
- package/dist/otlp/receiver.js.map +1 -0
- package/dist/{otlp-types.d.ts → otlp/types.d.ts} +1 -9
- package/dist/otlp/types.d.ts.map +1 -0
- package/dist/{otlp-types.js → otlp/types.js} +1 -27
- package/dist/otlp/types.js.map +1 -0
- package/dist/pipeline-config.d.ts +1 -1
- package/dist/{prd-controller.d.ts → prd/controller.d.ts} +7 -7
- package/dist/prd/controller.d.ts.map +1 -0
- package/dist/{prd-controller.js → prd/controller.js} +11 -11
- package/dist/prd/controller.js.map +1 -0
- package/dist/{prd-divergence.d.ts → prd/divergence.d.ts} +2 -2
- package/dist/prd/divergence.d.ts.map +1 -0
- package/dist/{prd-divergence.js → prd/divergence.js} +1 -1
- package/dist/prd/divergence.js.map +1 -0
- package/dist/{prd-focus-pushdown.d.ts → prd/focus-pushdown.d.ts} +2 -2
- package/dist/prd/focus-pushdown.d.ts.map +1 -0
- package/dist/{prd-focus-pushdown.js → prd/focus-pushdown.js} +3 -3
- package/dist/prd/focus-pushdown.js.map +1 -0
- package/dist/{prd-frontier.d.ts → prd/frontier.d.ts} +2 -2
- package/dist/prd/frontier.d.ts.map +1 -0
- package/dist/{prd-frontier.js → prd/frontier.js} +1 -1
- package/dist/prd/frontier.js.map +1 -0
- package/dist/prd/index.d.ts +26 -0
- package/dist/prd/index.d.ts.map +1 -0
- package/dist/prd/index.js +25 -0
- package/dist/prd/index.js.map +1 -0
- package/dist/{prd-steward.d.ts → prd/steward.d.ts} +4 -4
- package/dist/prd/steward.d.ts.map +1 -0
- package/dist/{prd-steward.js → prd/steward.js} +4 -4
- package/dist/prd/steward.js.map +1 -0
- package/dist/{prd-viability.d.ts → prd/viability.d.ts} +2 -2
- package/dist/prd/viability.d.ts.map +1 -0
- package/dist/{prd-viability.js → prd/viability.js} +1 -1
- package/dist/prd/viability.js.map +1 -0
- package/dist/product-scaffold.js +2 -2
- package/dist/product-scaffold.js.map +1 -1
- package/dist/prompt-sections/persona-sections.d.ts +12 -0
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
- package/dist/prompt-sections/persona-sections.js +29 -2
- package/dist/prompt-sections/persona-sections.js.map +1 -1
- package/dist/queries/context-lock-queries.js +1 -1
- package/dist/queries/context-lock-queries.js.map +1 -1
- package/dist/queries/deliveries.d.ts +15 -0
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +2 -0
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/focuses.d.ts +17 -0
- package/dist/queries/focuses.d.ts.map +1 -1
- package/dist/queries/focuses.js +27 -0
- package/dist/queries/focuses.js.map +1 -1
- package/dist/queries/schemas.d.ts +4 -0
- package/dist/queries/schemas.d.ts.map +1 -1
- package/dist/queries/schemas.js +8 -0
- package/dist/queries/schemas.js.map +1 -1
- package/dist/reality-pole.js +1 -1
- package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
- package/dist/resolvers/git-diff-against-base.js +4 -1
- package/dist/resolvers/git-diff-against-base.js.map +1 -1
- package/dist/resolvers/prd-context.js +1 -1
- package/dist/sensor-sweep.js +1 -1
- package/dist/spawn/model-routing.d.ts +277 -0
- package/dist/spawn/model-routing.d.ts.map +1 -0
- package/dist/spawn/model-routing.js +464 -0
- package/dist/spawn/model-routing.js.map +1 -0
- package/dist/spawn/process-spawn.d.ts +128 -0
- package/dist/spawn/process-spawn.d.ts.map +1 -0
- package/dist/spawn/process-spawn.js +378 -0
- package/dist/spawn/process-spawn.js.map +1 -0
- package/dist/spawn/prompt-assembly.d.ts +143 -0
- package/dist/spawn/prompt-assembly.d.ts.map +1 -0
- package/dist/spawn/prompt-assembly.js +263 -0
- package/dist/spawn/prompt-assembly.js.map +1 -0
- package/dist/spawn/shared.d.ts +72 -0
- package/dist/spawn/shared.d.ts.map +1 -0
- package/dist/spawn/shared.js +14 -0
- package/dist/spawn/shared.js.map +1 -0
- package/dist/spawn/spawn-decision.d.ts +189 -0
- package/dist/spawn/spawn-decision.d.ts.map +1 -0
- package/dist/spawn/spawn-decision.js +361 -0
- package/dist/spawn/spawn-decision.js.map +1 -0
- package/dist/spawn/worktree-session.d.ts +105 -0
- package/dist/spawn/worktree-session.d.ts.map +1 -0
- package/dist/spawn/worktree-session.js +216 -0
- package/dist/spawn/worktree-session.js.map +1 -0
- package/dist/spawner/lifecycle.js +2 -2
- package/dist/spawner/lifecycle.js.map +1 -1
- package/dist/spawner/resolution.js +1 -1
- package/dist/stall-detector-config.d.ts +4 -0
- package/dist/stall-detector-config.d.ts.map +1 -1
- package/dist/stall-detector-config.js +6 -0
- package/dist/stall-detector-config.js.map +1 -1
- package/dist/state-cascade.js +1 -1
- package/dist/state-cascade.js.map +1 -1
- package/dist/trigger-executor.d.ts +5 -9
- package/dist/trigger-executor.d.ts.map +1 -1
- package/dist/trigger-executor.js +14 -36
- package/dist/trigger-executor.js.map +1 -1
- package/dist/types/focus.d.ts +13 -0
- package/dist/types/focus.d.ts.map +1 -1
- package/dist/types/workflow.d.ts +1 -3
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/unified-engine-lifecycle.js +1 -1
- package/dist/unified-init.d.ts +3 -3
- package/dist/unified-init.d.ts.map +1 -1
- package/dist/unified-init.js +9 -25
- package/dist/unified-init.js.map +1 -1
- package/dist/unified-shell.d.ts +3 -3
- package/dist/unified-shell.js +4 -4
- package/dist/unified-shell.js.map +1 -1
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +15 -0
- package/dist/verification-engine.js.map +1 -1
- package/dist/{worktree-focus.d.ts → worktree/focus.d.ts} +2 -2
- package/dist/worktree/focus.d.ts.map +1 -0
- package/dist/{worktree-focus.js → worktree/focus.js} +7 -7
- package/dist/worktree/focus.js.map +1 -0
- package/dist/worktree/index.d.ts +16 -0
- package/dist/worktree/index.d.ts.map +1 -0
- package/dist/worktree/index.js +16 -0
- package/dist/worktree/index.js.map +1 -0
- package/dist/{worktree-safety.d.ts → worktree/safety.d.ts} +1 -1
- package/dist/worktree/safety.d.ts.map +1 -0
- package/dist/{worktree-safety.js → worktree/safety.js} +2 -2
- package/dist/worktree/safety.js.map +1 -0
- package/dist/{worktree-state.d.ts → worktree/state.d.ts} +1 -1
- package/dist/worktree/state.d.ts.map +1 -0
- package/dist/{worktree-state.js → worktree/state.js} +6 -6
- package/dist/worktree/state.js.map +1 -0
- package/dist/worktree.d.ts +1 -1
- package/dist/worktree.js +5 -5
- package/dist/worktree.js.map +1 -1
- package/package.json +5 -4
- package/dist/git-activity.d.ts.map +0 -1
- package/dist/git-activity.js.map +0 -1
- package/dist/git-branch.d.ts.map +0 -1
- package/dist/git-branch.js.map +0 -1
- package/dist/git-fetch.d.ts.map +0 -1
- package/dist/git-fetch.js.map +0 -1
- package/dist/git-genesis.d.ts.map +0 -1
- package/dist/git-genesis.js.map +0 -1
- package/dist/git-integration.d.ts.map +0 -1
- package/dist/git-integration.js.map +0 -1
- package/dist/git-merge-helpers.d.ts.map +0 -1
- package/dist/git-merge-helpers.js.map +0 -1
- package/dist/git-merge-lock.d.ts.map +0 -1
- package/dist/git-merge-lock.js.map +0 -1
- package/dist/git-merge-strategies.d.ts.map +0 -1
- package/dist/git-merge-strategies.js.map +0 -1
- package/dist/git-merge.d.ts.map +0 -1
- package/dist/git-merge.js.map +0 -1
- package/dist/git-state-detector.d.ts.map +0 -1
- package/dist/git-state-detector.js.map +0 -1
- package/dist/git-types.d.ts.map +0 -1
- package/dist/git-types.js.map +0 -1
- package/dist/git-utils.d.ts.map +0 -1
- package/dist/git-utils.js.map +0 -1
- package/dist/loop-context-audit-pass.d.ts.map +0 -1
- package/dist/loop-context-audit-pass.js.map +0 -1
- package/dist/loop-engine-types.d.ts.map +0 -1
- package/dist/loop-engine-types.js.map +0 -1
- package/dist/loop-engine.d.ts.map +0 -1
- package/dist/loop-engine.js.map +0 -1
- package/dist/loop-event-bus.d.ts.map +0 -1
- package/dist/loop-event-bus.js.map +0 -1
- package/dist/loop-llm-client.d.ts.map +0 -1
- package/dist/loop-llm-client.js.map +0 -1
- package/dist/loop-llm-flag.d.ts.map +0 -1
- package/dist/loop-llm-flag.js.map +0 -1
- package/dist/loop-operational-block.d.ts.map +0 -1
- package/dist/loop-operational-block.js.map +0 -1
- package/dist/loop-prompt-builder.d.ts.map +0 -1
- package/dist/loop-prompt-builder.js.map +0 -1
- package/dist/loop-variance.d.ts.map +0 -1
- package/dist/loop-variance.js.map +0 -1
- package/dist/nexus-endpoint-clearance.d.ts.map +0 -1
- package/dist/nexus-endpoint-clearance.js.map +0 -1
- package/dist/nexus-escalation-bridge.d.ts.map +0 -1
- package/dist/nexus-escalation-bridge.js.map +0 -1
- package/dist/nexus-incoming.d.ts.map +0 -1
- package/dist/nexus-incoming.js.map +0 -1
- package/dist/nexus-intake-spawn.d.ts.map +0 -1
- package/dist/nexus-intake-spawn.js.map +0 -1
- package/dist/nexus-intake.d.ts.map +0 -1
- package/dist/nexus-intake.js.map +0 -1
- package/dist/nexus-return.d.ts.map +0 -1
- package/dist/nexus-return.js.map +0 -1
- package/dist/otlp-log-parser.d.ts.map +0 -1
- package/dist/otlp-log-parser.js.map +0 -1
- package/dist/otlp-metric-parser.d.ts.map +0 -1
- package/dist/otlp-metric-parser.js.map +0 -1
- package/dist/otlp-port-manager.d.ts.map +0 -1
- package/dist/otlp-port-manager.js.map +0 -1
- package/dist/otlp-receiver.d.ts.map +0 -1
- package/dist/otlp-receiver.js.map +0 -1
- package/dist/otlp-types.d.ts.map +0 -1
- package/dist/otlp-types.js.map +0 -1
- package/dist/prd-controller.d.ts.map +0 -1
- package/dist/prd-controller.js.map +0 -1
- package/dist/prd-divergence.d.ts.map +0 -1
- package/dist/prd-divergence.js.map +0 -1
- package/dist/prd-focus-pushdown.d.ts.map +0 -1
- package/dist/prd-focus-pushdown.js.map +0 -1
- package/dist/prd-frontier.d.ts.map +0 -1
- package/dist/prd-frontier.js.map +0 -1
- package/dist/prd-steward.d.ts.map +0 -1
- package/dist/prd-steward.js.map +0 -1
- package/dist/prd-viability.d.ts.map +0 -1
- package/dist/prd-viability.js.map +0 -1
- package/dist/worktree-focus.d.ts.map +0 -1
- package/dist/worktree-focus.js.map +0 -1
- package/dist/worktree-safety.d.ts.map +0 -1
- package/dist/worktree-safety.js.map +0 -1
- package/dist/worktree-state.d.ts.map +0 -1
- package/dist/worktree-state.js.map +0 -1
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model routing seam for the focus-team spawn path.
|
|
3
|
+
*
|
|
4
|
+
* Extracted verbatim from focus-executor.ts (behavior-preserving): the pure
|
|
5
|
+
* model/engine selection helpers, the per-pass local-model routing + host-control
|
|
6
|
+
* swap decisioning, the single-host GPU conflict surfacing, and the CLI-arg
|
|
7
|
+
* builder they feed. focus-executor.ts re-exports this surface for backward
|
|
8
|
+
* compatibility, so external importers keep resolving these symbols from
|
|
9
|
+
* '../focus-executor.js'.
|
|
10
|
+
*
|
|
11
|
+
* Cycle rule: this module must NOT import from '../focus-executor.js'.
|
|
12
|
+
*/
|
|
13
|
+
import { loadEnvConfig, ESCALATION_REASONS } from '@telora/daemon-core';
|
|
14
|
+
import { createEscalation } from '../queries/issues.js';
|
|
15
|
+
import { resolveTeamModel, resolveLocalModelRefPrecedence } from '../model-resolution.js';
|
|
16
|
+
import { getLocalModel, getLocalModelSecret } from '../queries/local-models.js';
|
|
17
|
+
import { codexSafeModelAlias, writeLocalModelCodexHome, TELORA_LOCAL_API_KEY_ENV, } from '../cli/codex-provision.js';
|
|
18
|
+
import { startCodexMcpProxy, shouldRouteLocalModelThroughProxy, } from '../backends/codex/codex-mcp-proxy.js';
|
|
19
|
+
import { detectHostCapability, ensureLoaded, resolveSafeLoadOptions, getStatus, decideSwap, hostRootFromBaseUrl, observeHostSwap, claimResidentHost, detectSingleHostModelConflict, shouldSurfaceHostConflictOnce, } from '../host-control/index.js';
|
|
20
|
+
import { hasActiveTeam } from '../focus-team-state.js';
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the isolated CODEX_HOME to set on a spawn, or undefined when none
|
|
23
|
+
* applies. Pure + testable: only a codex-engine spawn against a product that
|
|
24
|
+
* carries a provisioned codexHome gets the override; every other case (claude
|
|
25
|
+
* engine, or a cloud product with no codexHome) returns undefined so the spawn
|
|
26
|
+
* environment is byte-for-byte unchanged.
|
|
27
|
+
*/
|
|
28
|
+
export function codexHomeForSpawn(engineId, config) {
|
|
29
|
+
return engineId === 'codex' && config.codexHome ? config.codexHome : undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Select the per-pass local model ref to resolve for this spawn, or null.
|
|
33
|
+
*
|
|
34
|
+
* Pure + testable. A ref applies ONLY to a codex-engine spawn. The ref resolves
|
|
35
|
+
* under the unified Focus > Workflow > Default precedence (single-sourced in
|
|
36
|
+
* model-resolution.resolveLocalModelRefPrecedence): the focus's per-pass
|
|
37
|
+
* localModelOverride entry wins; absent that, the stage directive's localModel
|
|
38
|
+
* is inherited; absent both, null (the pass runs on the engine's default model).
|
|
39
|
+
* A claude engine or a blank ref returns null so the spawn keeps its
|
|
40
|
+
* per-product / engine-default behavior unchanged.
|
|
41
|
+
*/
|
|
42
|
+
export function selectLocalModelRef(engineId, pass, localModelOverride, stageDirectiveLocalModel) {
|
|
43
|
+
if (engineId !== 'codex')
|
|
44
|
+
return null;
|
|
45
|
+
return resolveLocalModelRefPrecedence(localModelOverride?.[pass], stageDirectiveLocalModel);
|
|
46
|
+
}
|
|
47
|
+
export function decideLocalModelRouting(ref, coords, apiKey) {
|
|
48
|
+
if (!ref)
|
|
49
|
+
return { kind: 'none' };
|
|
50
|
+
if (!coords)
|
|
51
|
+
return { kind: 'fallback' };
|
|
52
|
+
return { kind: 'route', coords, apiKey: apiKey?.trim() ? apiKey : null };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pure gate: should the daemon perform a host-control model swap before this
|
|
56
|
+
* spawn? (Local model host control, D2.) True ONLY when routing resolved a local
|
|
57
|
+
* model for this pass AND the host advertises the optional control capability.
|
|
58
|
+
* A non-controllable host (today's behavior: the operator pre-loads the model in
|
|
59
|
+
* the studio) yields false -> NO swap, spawn proceeds unchanged. A pass with no
|
|
60
|
+
* routed local model (claude, no override) also yields false. Exported so the
|
|
61
|
+
* load-or-skip decision is unit-testable with NO HTTP.
|
|
62
|
+
*/
|
|
63
|
+
export function shouldSwapForPass(input) {
|
|
64
|
+
return input.routing.kind === 'route' && input.capability.controllable;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Resolve the effective model id for a spawn, applying the single team-model
|
|
68
|
+
* precedence (focus override -> stage directive -> CLI default) via
|
|
69
|
+
* resolveTeamModel. This is the SAME helper used at stage respawn, so the two
|
|
70
|
+
* paths can never diverge on ordering.
|
|
71
|
+
*
|
|
72
|
+
* The focus-override slot folds in the selected local-Codex model: when this
|
|
73
|
+
* pass routes to a controllable Codex home, `codexModel` IS the focus's
|
|
74
|
+
* explicit pick and must win exactly like a focus pipeline_config.model would.
|
|
75
|
+
* `directiveModel` has already been filtered through
|
|
76
|
+
* selectDirectiveModelForSpawn() (nulled when the backend cannot run it, or
|
|
77
|
+
* when a focus override is present), so it only ever reaches here as a
|
|
78
|
+
* legitimate stage fallback.
|
|
79
|
+
*
|
|
80
|
+
* Pure + testable. Used by spawnFocusTeam to produce effectivePipelineConfig.model.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveEffectiveModel(directiveModel, spawnCodexHome, codexModel, pipelineModel) {
|
|
83
|
+
const focusOverrideModel = (spawnCodexHome && codexModel ? codexModel : null) ?? pipelineModel ?? null;
|
|
84
|
+
return resolveTeamModel(focusOverrideModel, directiveModel);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A cloud model id the Claude backend can run: the full claude-* ids
|
|
88
|
+
* (claude-opus-4-8, claude-sonnet-4-6, ...) AND the bare aliases Claude Code
|
|
89
|
+
* accepts (opus, sonnet, haiku, fable -- used across the daemon, e.g.
|
|
90
|
+
* audit-phase's AUDIT_DEFAULT_MODEL='opus'). Anything else (gpt-5-codex,
|
|
91
|
+
* gemma-4-12b, ...) is treated as not-Claude so it cannot reach the claude CLI.
|
|
92
|
+
*/
|
|
93
|
+
const CLAUDE_MODEL_PREFIXES = ['claude', 'opus', 'sonnet', 'haiku', 'fable'];
|
|
94
|
+
export function isClaudeModelId(model) {
|
|
95
|
+
if (typeof model !== 'string')
|
|
96
|
+
return false;
|
|
97
|
+
const normalized = model.trim().toLowerCase();
|
|
98
|
+
return CLAUDE_MODEL_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Select the pipeline model fallback to feed into resolveEffectiveModel().
|
|
102
|
+
*
|
|
103
|
+
* Hosted Codex runs through the user's Codex account. Some registry labels
|
|
104
|
+
* exposed in the UI (for example gpt-5-codex) are not valid `codex exec
|
|
105
|
+
* --model` values for every account, and passing them fails the run before the
|
|
106
|
+
* agent starts. Local-model Codex still needs an explicit model, and Claude
|
|
107
|
+
* keeps the existing pipeline model behavior.
|
|
108
|
+
*
|
|
109
|
+
* Engine-compat (the per-pass bleed guard): product_focuses.pipeline_config.model
|
|
110
|
+
* is a SINGLE focus-wide value shared across passes, but each pass resolves its
|
|
111
|
+
* own engine. A pass whose engine resolved to claude can only run a claude-family
|
|
112
|
+
* model -- so a coding-pass codex model (e.g. gpt-5-codex) selected on the focus
|
|
113
|
+
* must NOT bleed into a claude review pass. When it would, null it so the claude
|
|
114
|
+
* backend picks its own default rather than receiving `--model gpt-5-codex` and
|
|
115
|
+
* erroring out. (The symmetric codex case is handled above + by spawnCodexModel
|
|
116
|
+
* routing; local-codex models reach the spawn via spawnCodexModel, not here.)
|
|
117
|
+
*/
|
|
118
|
+
export function selectPipelineModelForSpawn(engineId, spawnCodexHome, pipelineModel) {
|
|
119
|
+
if (engineId === 'codex' && !spawnCodexHome)
|
|
120
|
+
return null;
|
|
121
|
+
if (engineId === 'claude' && !isClaudeModelId(pipelineModel))
|
|
122
|
+
return null;
|
|
123
|
+
return pipelineModel ?? null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Select whether a workflow directive's model may reach the backend.
|
|
127
|
+
*
|
|
128
|
+
* The focus pass selection is the source of truth for team launches. Stage
|
|
129
|
+
* directives contribute prompt/context; their model field is only a legacy
|
|
130
|
+
* fallback when the focus/pass has no selected model and the backend can run
|
|
131
|
+
* that model. In particular, never pass a Claude directive model to Codex.
|
|
132
|
+
*/
|
|
133
|
+
export function selectDirectiveModelForSpawn(engineId, directiveModel, focusSelectedModel) {
|
|
134
|
+
if (!directiveModel)
|
|
135
|
+
return null;
|
|
136
|
+
if (focusSelectedModel)
|
|
137
|
+
return null;
|
|
138
|
+
if (engineId === 'codex')
|
|
139
|
+
return null;
|
|
140
|
+
return directiveModel;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Build CLI args for the team lead via the selected backend.
|
|
144
|
+
*
|
|
145
|
+
* Engine-specific flag construction lives in the backend; resume uses the
|
|
146
|
+
* backend's dedicated resume-arg builder. Exported for the spawner barrel
|
|
147
|
+
* surface (legacy ./team-spawner.js consumers).
|
|
148
|
+
*/
|
|
149
|
+
export function buildAgentArgs(backend, config, worktreePath, pipelineConfig, resumeSessionId, allowedTools, readOnly) {
|
|
150
|
+
// allowedTools comes from the focus role's agent_roles.allowed_tools. The
|
|
151
|
+
// backend applies least-privilege scoping when non-empty; empty/absent =>
|
|
152
|
+
// engine default tool set (documented default policy).
|
|
153
|
+
const base = { config, worktreePath, model: pipelineConfig?.model ?? null, allowedTools, readOnly };
|
|
154
|
+
return resumeSessionId
|
|
155
|
+
? backend.buildResumeArgs({ ...base, resumeSessionId })
|
|
156
|
+
: backend.buildSpawnArgs(base);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Phase: resolve the per-pass local-model routing for a codex spawn.
|
|
160
|
+
*
|
|
161
|
+
* Wraps the fetch (getLocalModel / getLocalModelSecret) + the pure decision
|
|
162
|
+
* (selectLocalModelRef -> decideLocalModelRouting) and, on 'route', provisions
|
|
163
|
+
* the per-model CODEX_HOME (writeLocalModelCodexHome) -- returning the codexHome
|
|
164
|
+
* the caller points the spawn at. The key VALUE comes from Telora (D8), never a
|
|
165
|
+
* host env var. Behavior byte-identical to the original inline block; only the
|
|
166
|
+
* apply-side (session-terminal write on skip, env injection on route) stays in
|
|
167
|
+
* the caller.
|
|
168
|
+
*/
|
|
169
|
+
export async function resolveLocalModelConfig(args, deps = {}) {
|
|
170
|
+
const getModel = deps.getLocalModel ?? getLocalModel;
|
|
171
|
+
const getSecret = deps.getLocalModelSecret ?? getLocalModelSecret;
|
|
172
|
+
const writeCodexHome = deps.writeLocalModelCodexHome ?? writeLocalModelCodexHome;
|
|
173
|
+
const localModelRef = selectLocalModelRef(args.engineId, args.enginePass, args.localModelOverride, args.stageDirectiveLocalModel);
|
|
174
|
+
// getLocalModel + getLocalModelSecret (the DB calls) run only when a ref
|
|
175
|
+
// exists; decideLocalModelRouting is the pure decision over their results.
|
|
176
|
+
const coords = localModelRef ? await getModel(localModelRef) : null;
|
|
177
|
+
const apiKey = localModelRef ? await getSecret(localModelRef) : null;
|
|
178
|
+
const routing = decideLocalModelRouting(localModelRef, coords, apiKey);
|
|
179
|
+
switch (routing.kind) {
|
|
180
|
+
case 'none':
|
|
181
|
+
return { kind: 'none' };
|
|
182
|
+
case 'fallback':
|
|
183
|
+
return { kind: 'fallback', ref: localModelRef };
|
|
184
|
+
case 'route': {
|
|
185
|
+
const { codexHome } = writeCodexHome(routing.coords.id, {
|
|
186
|
+
baseUrl: routing.coords.baseUrl,
|
|
187
|
+
model: routing.coords.model,
|
|
188
|
+
wireApi: routing.coords.wireApi ?? undefined,
|
|
189
|
+
requiresApiKey: routing.apiKey !== null,
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
kind: 'route',
|
|
193
|
+
codexHome,
|
|
194
|
+
codexModel: codexSafeModelAlias(routing.coords.model),
|
|
195
|
+
apiKey: routing.apiKey,
|
|
196
|
+
coords: routing.coords,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Surface (do NOT silently swap) two DIFFERENT local models bound to the coding
|
|
203
|
+
* vs review pass of one focus that share a single GPU host (#9). On a single
|
|
204
|
+
* card the two bindings force an evict+load swap on every pass alternation and
|
|
205
|
+
* fight over the GPU (the live incident: 0/56 routing attempts succeeded). The
|
|
206
|
+
* daemon must make the conflict VISIBLE rather than thrash silently.
|
|
207
|
+
*
|
|
208
|
+
* Cheap early-out: only when the focus pins a local model for BOTH passes and
|
|
209
|
+
* the two refs differ do we resolve coordinates (two getLocalModel reads) and run
|
|
210
|
+
* the pure detector. A conflict (same host root, different served models) is
|
|
211
|
+
* raised ONCE per focus per daemon run (shouldSurfaceHostConflictOnce) as a log
|
|
212
|
+
* line + a single escalation -- never re-raised every poll. Returns whether a new
|
|
213
|
+
* surfacing was raised this call. Best-effort: an escalation-create failure is
|
|
214
|
+
* logged, never fatal to the spawn.
|
|
215
|
+
*/
|
|
216
|
+
export async function surfaceSingleHostModelConflict(args, deps = {}) {
|
|
217
|
+
const getModel = deps.getLocalModel ?? getLocalModel;
|
|
218
|
+
const makeEscalation = deps.createEscalation ?? createEscalation;
|
|
219
|
+
const codingRef = args.localModelOverride?.coding?.trim() || null;
|
|
220
|
+
const reviewRef = args.localModelOverride?.review?.trim() || null;
|
|
221
|
+
// The conflict needs a distinct local model pinned on BOTH passes.
|
|
222
|
+
if (!codingRef || !reviewRef || codingRef === reviewRef)
|
|
223
|
+
return { surfaced: false };
|
|
224
|
+
const [codingCoords, reviewCoords] = await Promise.all([getModel(codingRef), getModel(reviewRef)]);
|
|
225
|
+
if (!codingCoords || !reviewCoords)
|
|
226
|
+
return { surfaced: false };
|
|
227
|
+
const bindings = [
|
|
228
|
+
{ pass: 'coding', modelId: codingCoords.model, baseUrl: codingCoords.baseUrl },
|
|
229
|
+
{ pass: 'review', modelId: reviewCoords.model, baseUrl: reviewCoords.baseUrl },
|
|
230
|
+
];
|
|
231
|
+
const result = detectSingleHostModelConflict(bindings);
|
|
232
|
+
if (!result.conflict)
|
|
233
|
+
return { surfaced: false };
|
|
234
|
+
if (!shouldSurfaceHostConflictOnce(args.focusId))
|
|
235
|
+
return { surfaced: false };
|
|
236
|
+
const detail = `Focus "${args.focusName}" pins two different local models to one GPU host ` +
|
|
237
|
+
`(${result.root}): coding="${codingCoords.name}" (${codingCoords.model}) vs ` +
|
|
238
|
+
`review="${reviewCoords.name}" (${reviewCoords.model}). On a single GPU these force an ` +
|
|
239
|
+
`evict+load swap on every pass alternation and fight over the card. Pin both passes to the ` +
|
|
240
|
+
`same local model, or move one pass to a different host / a cloud engine.`;
|
|
241
|
+
console.warn(`[focus-executor] Host-control: ${detail}`);
|
|
242
|
+
try {
|
|
243
|
+
await makeEscalation({
|
|
244
|
+
organizationId: args.organizationId,
|
|
245
|
+
issueId: null,
|
|
246
|
+
reasonType: ESCALATION_REASONS.BLOCKED_BY_EXTERNAL,
|
|
247
|
+
description: detail,
|
|
248
|
+
whatWasTried: 'Detected at spawn that the coding and review passes resolve to different local models on the same GPU host.',
|
|
249
|
+
helpNeeded: 'Pin both passes to one local model, or route one pass to a separate host or a cloud engine, so the single GPU is not swapped on every pass.',
|
|
250
|
+
escalationKind: 'single_host_model_conflict',
|
|
251
|
+
...(args.productId ? { productId: args.productId } : {}),
|
|
252
|
+
focusId: args.focusId,
|
|
253
|
+
metadata: {
|
|
254
|
+
host_root: result.root,
|
|
255
|
+
coding_model: codingCoords.model,
|
|
256
|
+
review_model: reviewCoords.model,
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
console.warn(`[focus-executor] Failed to file single_host_model_conflict escalation for "${args.focusName}":`, err.message);
|
|
262
|
+
}
|
|
263
|
+
return { surfaced: true };
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Phase: resolve the per-product CODEX_HOME default, apply per-pass local-model
|
|
267
|
+
* routing (fallback / route), select the effective model, and build the CLI
|
|
268
|
+
* args. Returns 'ready' with the args + the model/env bits the spawn needs.
|
|
269
|
+
*/
|
|
270
|
+
export async function resolveSpawnModel(args) {
|
|
271
|
+
const { resolvedEngine, enginePass, localModelOverride, stageDirectiveLocalModel, config, directiveModel, pendingFocusOverrideModel, pipelineConfig, backend, worktreePath, resumeId, role, readOnly, focusName, focusId, } = args;
|
|
272
|
+
// Single source of truth for the focus override at this spawn: a respawn's
|
|
273
|
+
// snapshot wins over the live pipeline_config.model; otherwise the live config
|
|
274
|
+
// carries it. Both initial spawn and respawn funnel through resolveTeamModel
|
|
275
|
+
// below, so the precedence (focus override -> stage -> CLI) is identical.
|
|
276
|
+
const focusOverrideModel = pendingFocusOverrideModel ?? pipelineConfig?.model ?? null;
|
|
277
|
+
// Resolve the per-product isolated CODEX_HOME for this spawn (undefined for
|
|
278
|
+
// claude engines and cloud products with no provisioned codexHome -- those
|
|
279
|
+
// spawns are byte-for-byte unaffected).
|
|
280
|
+
let spawnCodexHome = codexHomeForSpawn(resolvedEngine.engineId, config);
|
|
281
|
+
let spawnCodexModel = config.codexModel;
|
|
282
|
+
let isLocalModelPass = false;
|
|
283
|
+
// Per-pass local model routing: if this codex pass selected a registered local
|
|
284
|
+
// model, resolve it to coordinates, provision a per-model CODEX_HOME, and route
|
|
285
|
+
// the spawn there -- overriding the per-product codexHome/codexModel for this
|
|
286
|
+
// pass only. Absent ref => the per-product default above is kept.
|
|
287
|
+
const localModelConfig = await resolveLocalModelConfig({
|
|
288
|
+
engineId: resolvedEngine.engineId,
|
|
289
|
+
enginePass,
|
|
290
|
+
localModelOverride,
|
|
291
|
+
stageDirectiveLocalModel,
|
|
292
|
+
});
|
|
293
|
+
// The Telora-resolved key VALUE injected into the spawn env (under the fixed
|
|
294
|
+
// TELORA_LOCAL_API_KEY name) for a routed local-model pass; null otherwise.
|
|
295
|
+
let spawnLocalModelKey = null;
|
|
296
|
+
if (localModelConfig.kind === 'fallback') {
|
|
297
|
+
console.warn(`[focus-executor] Focus "${focusName}" ${enginePass} pass selected local model ` +
|
|
298
|
+
`${(localModelConfig.ref ?? '').slice(0, 8)} but it is not in the registry; falling back to the ` +
|
|
299
|
+
`per-product default model.`);
|
|
300
|
+
}
|
|
301
|
+
else if (localModelConfig.kind === 'route') {
|
|
302
|
+
const { codexHome, codexModel, apiKey, coords } = localModelConfig;
|
|
303
|
+
spawnCodexHome = codexHome;
|
|
304
|
+
spawnCodexModel = codexModel;
|
|
305
|
+
spawnLocalModelKey = apiKey;
|
|
306
|
+
isLocalModelPass = true;
|
|
307
|
+
console.log(`[focus-executor] Routing "${focusName}" ${enginePass} pass to local model ` +
|
|
308
|
+
`"${coords.name}" (${coords.model} @ ${coords.baseUrl}); CODEX_HOME=${codexHome}, ` +
|
|
309
|
+
(apiKey
|
|
310
|
+
? `key from Telora (env ${TELORA_LOCAL_API_KEY_ENV}).`
|
|
311
|
+
: 'unauthenticated endpoint.'));
|
|
312
|
+
// Host-control swap (D2): on a CONTROLLABLE host, load/unload the selected
|
|
313
|
+
// per-pass model around this pass -- a sequential single-GPU swap (one model
|
|
314
|
+
// resident at a time) so the coding-vs-review model runs end-to-end with NO
|
|
315
|
+
// manual studio swap. On a non-controllable host this is a no-op (today's
|
|
316
|
+
// behavior: the operator pre-loads the model). A swap FAILURE must NOT spawn
|
|
317
|
+
// against a not-yet-loaded model: skip this tick (the 30s poll re-attempts).
|
|
318
|
+
const capability = await detectHostCapability(coords.baseUrl, apiKey);
|
|
319
|
+
if (shouldSwapForPass({ routing: { kind: 'route', coords, apiKey }, capability })) {
|
|
320
|
+
const root = hostRootFromBaseUrl(coords.baseUrl);
|
|
321
|
+
// Fast inline path (#1): if the target is ALREADY resident + ready, spawn
|
|
322
|
+
// THIS tick -- no detour through the detached swap. A single bounded
|
|
323
|
+
// /v1/status read; org-prefix-tolerant via decideSwap/modelIdsMatch.
|
|
324
|
+
let alreadyResident = false;
|
|
325
|
+
try {
|
|
326
|
+
const status = await getStatus(coords.baseUrl, apiKey);
|
|
327
|
+
alreadyResident =
|
|
328
|
+
decideSwap({
|
|
329
|
+
current: { modelId: status.loadedModelId, ready: status.ready },
|
|
330
|
+
target: coords.model,
|
|
331
|
+
}).action === 'noop';
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
// Transient status-read failure -> fall through to the managed async
|
|
335
|
+
// swap, which retries the load + readiness off the poll-critical path.
|
|
336
|
+
}
|
|
337
|
+
if (alreadyResident) {
|
|
338
|
+
// Claim the per-host residency lock (#4) so a second focus on this host
|
|
339
|
+
// cannot start a swap that evicts our resident model mid-pass.
|
|
340
|
+
const claim = claimResidentHost({
|
|
341
|
+
root,
|
|
342
|
+
targetModel: coords.model,
|
|
343
|
+
focusId,
|
|
344
|
+
isFocusActive: (id) => hasActiveTeam(id),
|
|
345
|
+
});
|
|
346
|
+
if (claim.status === 'busy_other') {
|
|
347
|
+
console.log(`[focus-executor] Host-control: host for "${coords.name}" is held by another ` +
|
|
348
|
+
`focus's running pass; deferring "${focusName}" ${enginePass} pass to avoid eviction.`);
|
|
349
|
+
return { kind: 'still_loading', coords, reason: 'host_busy_other_focus' };
|
|
350
|
+
}
|
|
351
|
+
console.log(`[focus-executor] Host-control: model "${coords.name}" (${coords.model}) already ` +
|
|
352
|
+
`resident + ready for "${focusName}" ${enginePass} pass.`);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
// A load is needed. Run it OFF the serial poll loop via the swap manager
|
|
356
|
+
// (#3) so a cold load (up to the 180s budget) does not stall every other
|
|
357
|
+
// focus/product. The manager also enforces the per-host residency lock
|
|
358
|
+
// (#4): a second focus on this host defers rather than evicting an
|
|
359
|
+
// in-flight model. The load is detached -- never awaited here.
|
|
360
|
+
const loadTimeoutMs = loadEnvConfig().TELORA_HOST_CONTROL_LOAD_TIMEOUT_MS;
|
|
361
|
+
const observation = observeHostSwap({
|
|
362
|
+
root,
|
|
363
|
+
targetModel: coords.model,
|
|
364
|
+
focusId,
|
|
365
|
+
isFocusActive: (id) => hasActiveTeam(id),
|
|
366
|
+
runLoad: async () => {
|
|
367
|
+
// D3 sizing seam: hardware-aware safe context that RESERVES the
|
|
368
|
+
// candidate model's weights before sizing the KV cache. The weights
|
|
369
|
+
// size + native context come from the registry coordinates (the
|
|
370
|
+
// local_models sizing-metadata columns); when unset the sizer
|
|
371
|
+
// degrades safely (no reservation / ceiling clamp). FAIL-SAFE to the
|
|
372
|
+
// fixed DEFAULT_MAX_SEQ_LENGTH when host hardware data is unavailable.
|
|
373
|
+
const sizing = await resolveSafeLoadOptions(coords.baseUrl, coords.model, { modelSizeMb: coords.modelSizeMb, nativeContext: coords.nativeContext }, apiKey);
|
|
374
|
+
if (sizing.source === 'fallback') {
|
|
375
|
+
console.warn(`[focus-executor] Host-control sizing unavailable for "${coords.name}" ` +
|
|
376
|
+
`(${coords.model}); falling back to the fixed default context ` +
|
|
377
|
+
`${sizing.maxSeqLength}. Check the host's /api/system/hardware endpoint.`);
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
console.log(`[focus-executor] Host-control sizing for "${coords.name}" (${coords.model}): ` +
|
|
381
|
+
`max_seq_length=${sizing.maxSeqLength}` +
|
|
382
|
+
(sizing.cacheTypeKv ? `, cache_type_kv=${sizing.cacheTypeKv}` : '') +
|
|
383
|
+
(sizing.quantRequired ? ' (quant-required, marginal headroom)' : '') +
|
|
384
|
+
(sizing.marginal && !sizing.quantRequired ? ' (marginal headroom)' : '') + '.');
|
|
385
|
+
}
|
|
386
|
+
// Load-scoped POST timeout: a host that blocks /v1/load until the cold
|
|
387
|
+
// load completes must not be cut by the generic 5s fetch timeout.
|
|
388
|
+
await ensureLoaded(coords.baseUrl, coords.model, {
|
|
389
|
+
maxSeqLength: sizing.maxSeqLength,
|
|
390
|
+
loadTimeoutMs,
|
|
391
|
+
...(sizing.cacheTypeKv !== undefined ? { cacheTypeKv: sizing.cacheTypeKv } : {}),
|
|
392
|
+
}, apiKey);
|
|
393
|
+
console.log(`[focus-executor] Host-control: local model "${coords.name}" (${coords.model}) ` +
|
|
394
|
+
`loaded + ready (off-loop swap complete).`);
|
|
395
|
+
},
|
|
396
|
+
});
|
|
397
|
+
if (observation.status === 'loading') {
|
|
398
|
+
console.log(`[focus-executor] Host-control: model "${coords.name}" (${coords.model}) is loading ` +
|
|
399
|
+
`for "${focusName}" ${enginePass} pass; deferring spawn (load runs off the poll loop).`);
|
|
400
|
+
return { kind: 'still_loading', coords, reason: 'model_loading' };
|
|
401
|
+
}
|
|
402
|
+
if (observation.status === 'busy_other') {
|
|
403
|
+
console.log(`[focus-executor] Host-control: host for "${coords.name}" is held by another ` +
|
|
404
|
+
`focus's running pass; deferring "${focusName}" ${enginePass} pass to avoid eviction.`);
|
|
405
|
+
return { kind: 'still_loading', coords, reason: 'host_busy_other_focus' };
|
|
406
|
+
}
|
|
407
|
+
if (observation.status === 'failed') {
|
|
408
|
+
console.error(`[focus-executor] Host-control swap to load "${coords.name}" (${coords.model}) for ` +
|
|
409
|
+
`"${focusName}" ${enginePass} pass FAILED: ${observation.error}. Not spawning against ` +
|
|
410
|
+
`an unloaded model; will re-attempt next poll.`);
|
|
411
|
+
return { kind: 'skip_load', coords, dbMessage: observation.error };
|
|
412
|
+
}
|
|
413
|
+
// observation.status === 'ready' -- the detached load completed on a
|
|
414
|
+
// prior tick; the model is resident and residency is held. Proceed.
|
|
415
|
+
console.log(`[focus-executor] Host-control: model "${coords.name}" (${coords.model}) ready for ` +
|
|
416
|
+
`"${focusName}" ${enginePass} pass (off-loop swap complete).`);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// Model selection: ONE precedence (focus override -> stage directive -> CLI),
|
|
421
|
+
// applied identically at initial spawn and at stage respawn. The engine-compat
|
|
422
|
+
// prefilters below null out an input the resolved backend cannot run; the
|
|
423
|
+
// surviving inputs funnel through resolveEffectiveModel -> resolveTeamModel.
|
|
424
|
+
const focusSelectedModel = selectPipelineModelForSpawn(resolvedEngine.engineId, spawnCodexHome, focusOverrideModel);
|
|
425
|
+
const effectiveDirectiveModel = selectDirectiveModelForSpawn(resolvedEngine.engineId, directiveModel, spawnCodexModel ?? focusSelectedModel);
|
|
426
|
+
const effectiveModel = resolveEffectiveModel(effectiveDirectiveModel, spawnCodexHome, spawnCodexModel, focusSelectedModel);
|
|
427
|
+
const effectivePipelineConfig = effectiveModel !== (pipelineConfig?.model ?? null)
|
|
428
|
+
? { ...pipelineConfig, model: effectiveModel }
|
|
429
|
+
: pipelineConfig;
|
|
430
|
+
const args2 = buildAgentArgs(backend, config, worktreePath, effectivePipelineConfig, resumeId, role.allowed_tools, readOnly);
|
|
431
|
+
// Capability-driven (no operator flag): for a registered local-model route
|
|
432
|
+
// whose endpoint drops Codex's namespace tools (backendDropsNamespaceTools),
|
|
433
|
+
// insert a localhost translating proxy between Codex and the inference server
|
|
434
|
+
// so the OSS server still receives the Telora tool schemas. Started LAST --
|
|
435
|
+
// after every host-control early return -- so a deferred spawn never leaks a
|
|
436
|
+
// proxy. Points the provisioned CODEX_HOME's base_url at the proxy; the proxy
|
|
437
|
+
// forwards to the model's real coords.baseUrl. Non-local / native-Responses
|
|
438
|
+
// passes never route => mcpProxy stays null and the spawn is byte-identical.
|
|
439
|
+
let mcpProxy = null;
|
|
440
|
+
if (localModelConfig.kind === 'route' &&
|
|
441
|
+
shouldRouteLocalModelThroughProxy(isLocalModelPass, localModelConfig.coords)) {
|
|
442
|
+
const { coords, apiKey } = localModelConfig;
|
|
443
|
+
try {
|
|
444
|
+
mcpProxy = await startCodexMcpProxy({ upstreamBaseUrl: coords.baseUrl });
|
|
445
|
+
writeLocalModelCodexHome(coords.id, {
|
|
446
|
+
baseUrl: mcpProxy.url,
|
|
447
|
+
model: coords.model,
|
|
448
|
+
wireApi: coords.wireApi ?? undefined,
|
|
449
|
+
requiresApiKey: apiKey !== null,
|
|
450
|
+
});
|
|
451
|
+
console.log(`[focus-executor] Local-model MCP proxy engaged for "${coords.name}": ` +
|
|
452
|
+
`Codex base_url -> ${mcpProxy.url} -> upstream ${coords.baseUrl}.`);
|
|
453
|
+
}
|
|
454
|
+
catch (err) {
|
|
455
|
+
// Best-effort: a proxy that cannot start must not block the spawn; fall
|
|
456
|
+
// back to the direct (namespace-dropping) path. The fail-loud reception
|
|
457
|
+
// check only applies when a proxy is present.
|
|
458
|
+
console.warn(`[focus-executor] Local-model MCP proxy failed to start; spawning direct: ${err.message}`);
|
|
459
|
+
mcpProxy = null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return { kind: 'ready', args: args2, effectiveModel, spawnCodexHome, spawnLocalModelKey, isLocalModelPass, mcpProxy };
|
|
463
|
+
}
|
|
464
|
+
//# sourceMappingURL=model-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-routing.js","sourceRoot":"","sources":["../../src/spawn/model-routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAA8B,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAClB,iCAAiC,GAElC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,6BAA6B,EAC7B,6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I,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-spawn seam for the focus-team spawn path.
|
|
3
|
+
*
|
|
4
|
+
* Extracted verbatim from focus-executor.ts (behavior-preserving): the final
|
|
5
|
+
* phase that takes a fully-resolved spawn (env constituents, args, message,
|
|
6
|
+
* session, backend) and actually launches the team-lead child process, plus its
|
|
7
|
+
* fail-closed backend/sandbox/governor gates, the crash-isolated spawn wrapper,
|
|
8
|
+
* and the terminal session-update payload builders. focus-executor.ts re-exports
|
|
9
|
+
* this surface for backward compatibility, so external importers keep resolving
|
|
10
|
+
* these symbols from '../focus-executor.js'.
|
|
11
|
+
*
|
|
12
|
+
* Cycle rule: this module must NOT import from '../focus-executor.js'. The two
|
|
13
|
+
* symbols this seam would otherwise reach back for -- the resource governor and
|
|
14
|
+
* the orchestrator spawnFocusTeam (staying in focus-executor.ts) -- are threaded
|
|
15
|
+
* in via SpawnTeamProcessArgs instead.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn, type ChildProcessWithoutNullStreams, type SpawnOptionsWithoutStdio } from 'node:child_process';
|
|
18
|
+
import { type ResourceGovernor } from '@telora/daemon-core';
|
|
19
|
+
import type { DaemonConfig, FocusTeamState } from '../types.js';
|
|
20
|
+
import { createSession } from '../supabase.js';
|
|
21
|
+
import { consumePendingSpawnDirective } from '../directive-executor.js';
|
|
22
|
+
import { type AssemblyManifestEntry } from '../assembly-engine.js';
|
|
23
|
+
import { type AgentBackend } from '../backends/index.js';
|
|
24
|
+
import { setupTeamLogStreams } from '../spawner/helpers.js';
|
|
25
|
+
import type { SpawnFocusTeamParams } from './spawn-decision.js';
|
|
26
|
+
/**
|
|
27
|
+
* The terminal session-update payload written when the resource governor denies a
|
|
28
|
+
* slot for this spawn. Pure -- the caller adds `ended_at` and calls updateSession.
|
|
29
|
+
* Exported so the governor-denied exit_category contract is unit-pinned (the
|
|
30
|
+
* apply-side -- updateSession + governor.releaseSlot + activeTeams.delete -- stays
|
|
31
|
+
* in spawnTeamProcess, exercised by spawn-path-unified.test.ts).
|
|
32
|
+
*/
|
|
33
|
+
export declare function governorDeniedSessionUpdate(): {
|
|
34
|
+
status: string;
|
|
35
|
+
exit_reason: string;
|
|
36
|
+
exit_category: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The terminal session-update payload written when a required OS sandbox cannot
|
|
40
|
+
* initialize and the spawn is refused (fail-closed). Pure -- the caller adds
|
|
41
|
+
* `ended_at` and calls updateSession. Exported so the sandbox-unavailable
|
|
42
|
+
* exit_category contract is unit-pinned.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sandboxUnavailableSessionUpdate(message: string): {
|
|
45
|
+
status: string;
|
|
46
|
+
exit_reason: string;
|
|
47
|
+
exit_category: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Inputs to spawnTeamProcess -- the final phase that takes a fully-resolved
|
|
51
|
+
* spawn (env constituents, args, message, session, backend) and actually
|
|
52
|
+
* launches the team-lead child process.
|
|
53
|
+
*/
|
|
54
|
+
export interface SpawnTeamProcessArgs {
|
|
55
|
+
config: DaemonConfig;
|
|
56
|
+
focusId: string;
|
|
57
|
+
focusName: string;
|
|
58
|
+
session: Awaited<ReturnType<typeof createSession>>;
|
|
59
|
+
teamState: FocusTeamState;
|
|
60
|
+
backend: AgentBackend;
|
|
61
|
+
args: string[];
|
|
62
|
+
/** Composed prompt on a fresh spawn, or the resume-delta when resuming. */
|
|
63
|
+
messageToSend: string;
|
|
64
|
+
logs: ReturnType<typeof setupTeamLogStreams>;
|
|
65
|
+
worktreePath: string;
|
|
66
|
+
resumeId: string | null;
|
|
67
|
+
assemblyManifest: AssemblyManifestEntry[];
|
|
68
|
+
spawnCodexHome: string | undefined;
|
|
69
|
+
spawnLocalModelKey: string | null;
|
|
70
|
+
isLocalModelPass: boolean;
|
|
71
|
+
effectiveModel: string | null;
|
|
72
|
+
pendingDirective: ReturnType<typeof consumePendingSpawnDirective>;
|
|
73
|
+
spawnStageName: string | null;
|
|
74
|
+
params: SpawnFocusTeamParams;
|
|
75
|
+
/**
|
|
76
|
+
* The resource governor (or null when none is injected). Threaded in from the
|
|
77
|
+
* orchestrator because the governor state binding lives in focus-executor.ts;
|
|
78
|
+
* this seam must not import it back (cycle rule).
|
|
79
|
+
*/
|
|
80
|
+
governor: ResourceGovernor | null;
|
|
81
|
+
/**
|
|
82
|
+
* The orchestrator spawnFocusTeam, threaded in so the resume-failure respawn
|
|
83
|
+
* (handleTeamProcessClose) can re-enter the spawn path. spawnFocusTeam stays in
|
|
84
|
+
* focus-executor.ts; threading it here avoids a back-edge import (cycle rule).
|
|
85
|
+
*/
|
|
86
|
+
spawnFocusTeam: (params: SpawnFocusTeamParams) => Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export interface BackendSpawnGateResult {
|
|
89
|
+
allowed: boolean;
|
|
90
|
+
reason?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Local-model passes depend on a host CLI, so refuse the process launch when
|
|
94
|
+
* the backend's existing availability probe says it cannot run. Cloud passes
|
|
95
|
+
* retain their existing behavior because their authentication can be supplied
|
|
96
|
+
* by the per-spawn environment after the host-level probe runs.
|
|
97
|
+
*/
|
|
98
|
+
export declare function gateLocalModelBackendSpawn(backend: AgentBackend, config: DaemonConfig, isLocalModelPass: boolean, host?: string): Promise<BackendSpawnGateResult>;
|
|
99
|
+
export declare function backendUnavailableSessionUpdate(reason: string, category?: string): {
|
|
100
|
+
status: string;
|
|
101
|
+
exit_reason: string;
|
|
102
|
+
exit_category: string;
|
|
103
|
+
};
|
|
104
|
+
/** Attach the error listener in the same synchronous stack frame as spawn(). */
|
|
105
|
+
export declare function spawnCrashIsolated(command: string, args: readonly string[], options: SpawnOptionsWithoutStdio, onError: (error: Error) => void, spawnFn?: typeof spawn): ChildProcessWithoutNullStreams;
|
|
106
|
+
/** Ensure a terminal spawn failure is persisted after any in-flight running transition. */
|
|
107
|
+
export declare function persistSpawnFailureAfterRunning(runningTransition: Promise<unknown> | null, persistFailure: () => Promise<unknown>): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Final phase: build the levered spawn environment, persist the assembly
|
|
110
|
+
* manifest, write the session lifecycle (starting -> running), acquire the
|
|
111
|
+
* governor slot, wrap the command in the sandbox (fail-closed), spawn the
|
|
112
|
+
* child, write its stdin, and attach the completion/close/error handlers.
|
|
113
|
+
*
|
|
114
|
+
* Owns ALL of its early-return cleanups so the team-state map and governor slot
|
|
115
|
+
* never leak: governor-denied (exit_category 'governor_denied') and
|
|
116
|
+
* sandbox-unavailable (exit_category 'sandbox_unavailable') both mark the
|
|
117
|
+
* session terminal, release the governor slot where one was held, remove the
|
|
118
|
+
* team from activeTeams, and return without spawning. Behavior byte-identical
|
|
119
|
+
* to the original inline tail of spawnFocusTeam.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Close a team's local-model translating proxy if one is engaged, and null it so
|
|
123
|
+
* the call is idempotent across the multiple teardown paths. No-op for every
|
|
124
|
+
* hosted/Claude/flag-off team (mcpProxy undefined/null).
|
|
125
|
+
*/
|
|
126
|
+
export declare function closeTeamProxyQuietly(teamState: FocusTeamState): void;
|
|
127
|
+
export declare function spawnTeamProcess(spec: SpawnTeamProcessArgs): Promise<void>;
|
|
128
|
+
//# sourceMappingURL=process-spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-spawn.d.ts","sourceRoot":"","sources":["../../src/spawn/process-spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,8BAA8B,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE/G,OAAO,EAAa,KAAK,gBAAgB,E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