muonroi-cli 1.2.3 → 1.3.2
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/README.md +77 -316
- package/dist/packages/agent-harness-core/src/driver.d.ts +77 -0
- package/dist/packages/agent-harness-core/src/driver.js +311 -0
- package/dist/packages/agent-harness-core/src/driver.js.map +1 -0
- package/dist/packages/agent-harness-core/src/event-filter.d.ts +34 -0
- package/dist/packages/agent-harness-core/src/event-filter.js +70 -0
- package/dist/packages/agent-harness-core/src/event-filter.js.map +1 -0
- package/dist/packages/agent-harness-core/src/event-redact.d.ts +24 -0
- package/dist/packages/agent-harness-core/src/event-redact.js +150 -0
- package/dist/packages/agent-harness-core/src/event-redact.js.map +1 -0
- package/dist/packages/agent-harness-core/src/idle.d.ts +18 -0
- package/dist/packages/agent-harness-core/src/idle.js +57 -0
- package/dist/packages/agent-harness-core/src/idle.js.map +1 -0
- package/dist/packages/agent-harness-core/src/index.d.ts +10 -0
- package/dist/packages/agent-harness-core/src/index.js +12 -0
- package/dist/packages/agent-harness-core/src/index.js.map +1 -0
- package/dist/packages/agent-harness-core/src/mcp-server.d.ts +89 -0
- package/dist/packages/agent-harness-core/src/mcp-server.js +427 -0
- package/dist/packages/agent-harness-core/src/mcp-server.js.map +1 -0
- package/dist/packages/agent-harness-core/src/mock-llm.d.ts +75 -0
- package/dist/packages/agent-harness-core/src/mock-llm.js +116 -0
- package/dist/packages/agent-harness-core/src/mock-llm.js.map +1 -0
- package/dist/packages/agent-harness-core/src/predicate.d.ts +34 -0
- package/dist/packages/agent-harness-core/src/predicate.js +46 -0
- package/dist/packages/agent-harness-core/src/predicate.js.map +1 -0
- package/dist/packages/agent-harness-core/src/protocol.d.ts +198 -0
- package/dist/packages/agent-harness-core/src/protocol.js +2 -0
- package/dist/packages/agent-harness-core/src/protocol.js.map +1 -0
- package/dist/packages/agent-harness-core/src/registry.d.ts +30 -0
- package/dist/packages/agent-harness-core/src/registry.js +86 -0
- package/dist/packages/agent-harness-core/src/registry.js.map +1 -0
- package/dist/packages/agent-harness-core/src/selector.d.ts +14 -0
- package/dist/packages/agent-harness-core/src/selector.js +199 -0
- package/dist/packages/agent-harness-core/src/selector.js.map +1 -0
- package/dist/packages/agent-harness-core/src/spec-helpers.d.ts +24 -0
- package/dist/packages/agent-harness-core/src/spec-helpers.js +61 -0
- package/dist/packages/agent-harness-core/src/spec-helpers.js.map +1 -0
- package/dist/packages/agent-harness-core/src/transports/sidechannel.d.ts +11 -0
- package/dist/packages/agent-harness-core/src/transports/sidechannel.js +34 -0
- package/dist/packages/agent-harness-core/src/transports/sidechannel.js.map +1 -0
- package/dist/packages/agent-harness-core/src/transports/ws.d.ts +150 -0
- package/dist/packages/agent-harness-core/src/transports/ws.js +222 -0
- package/dist/packages/agent-harness-core/src/transports/ws.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/agent-mode.d.ts +46 -0
- package/dist/packages/agent-harness-opentui/src/agent-mode.js +178 -0
- package/dist/packages/agent-harness-opentui/src/agent-mode.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/index.d.ts +5 -0
- package/dist/packages/agent-harness-opentui/src/index.js +6 -0
- package/dist/packages/agent-harness-opentui/src/index.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/input-bridge.d.ts +27 -0
- package/dist/packages/agent-harness-opentui/src/input-bridge.js +126 -0
- package/dist/packages/agent-harness-opentui/src/input-bridge.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/install.d.ts +65 -0
- package/dist/packages/agent-harness-opentui/src/install.js +62 -0
- package/dist/packages/agent-harness-opentui/src/install.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/reconciler-hook.d.ts +15 -0
- package/dist/packages/agent-harness-opentui/src/reconciler-hook.js +52 -0
- package/dist/packages/agent-harness-opentui/src/reconciler-hook.js.map +1 -0
- package/dist/packages/agent-harness-opentui/src/semantic.d.ts +12 -0
- package/dist/packages/agent-harness-opentui/src/semantic.js +58 -0
- package/dist/packages/agent-harness-opentui/src/semantic.js.map +1 -0
- package/dist/src/__test-stubs__/ee-server.js.map +1 -0
- package/dist/src/__test-stubs__/vitest-setup.js +34 -0
- package/dist/src/__test-stubs__/vitest-setup.js.map +1 -0
- package/dist/src/__tests__/council/bubble-layout.test.js +39 -0
- package/dist/src/__tests__/council/bubble-layout.test.js.map +1 -0
- package/dist/src/__tests__/council/code-block-truncate.test.js +45 -0
- package/dist/src/__tests__/council/code-block-truncate.test.js.map +1 -0
- package/dist/src/__tests__/council/role-palette.test.js +59 -0
- package/dist/src/__tests__/council/role-palette.test.js.map +1 -0
- package/dist/src/__tests__/first-run-wizard.test.js +9 -0
- package/dist/src/__tests__/first-run-wizard.test.js.map +1 -0
- package/dist/src/agent-harness/__tests__/cli-flags.spec.js +33 -0
- package/dist/src/agent-harness/__tests__/cli-flags.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/driver.spec.js +141 -0
- package/dist/src/agent-harness/__tests__/driver.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/idle.spec.js +84 -0
- package/dist/src/agent-harness/__tests__/idle.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/mock-llm.spec.js +91 -0
- package/dist/src/agent-harness/__tests__/mock-llm.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/mock-model.spec.d.ts +5 -0
- package/dist/src/agent-harness/__tests__/mock-model.spec.js +169 -0
- package/dist/src/agent-harness/__tests__/mock-model.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/predicate.spec.js +27 -0
- package/dist/src/agent-harness/__tests__/predicate.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/protocol.spec.js +56 -0
- package/dist/src/agent-harness/__tests__/protocol.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/schema.spec.js +76 -0
- package/dist/src/agent-harness/__tests__/schema.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/selector.spec.js +70 -0
- package/dist/src/agent-harness/__tests__/selector.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/sidechannel.spec.js +29 -0
- package/dist/src/agent-harness/__tests__/sidechannel.spec.js.map +1 -0
- package/dist/src/agent-harness/__tests__/spec-helpers.spec.js +68 -0
- package/dist/src/agent-harness/__tests__/spec-helpers.spec.js.map +1 -0
- package/dist/src/agent-harness/index.d.ts +2 -0
- package/dist/src/agent-harness/index.js +20 -0
- package/dist/src/agent-harness/index.js.map +1 -0
- package/dist/src/agent-harness/mock-model.d.ts +149 -0
- package/dist/src/agent-harness/mock-model.js +291 -0
- package/dist/src/agent-harness/mock-model.js.map +1 -0
- package/dist/src/agent-harness/test-spawn.d.ts +42 -0
- package/dist/src/agent-harness/test-spawn.js +165 -0
- package/dist/src/agent-harness/test-spawn.js.map +1 -0
- package/dist/src/billing/index.js.map +1 -0
- package/dist/src/chat/__tests__/broadcast-bus.test.js +81 -0
- package/dist/src/chat/__tests__/broadcast-bus.test.js.map +1 -0
- package/dist/src/chat/__tests__/channel-manager.test.js +133 -0
- package/dist/src/chat/__tests__/channel-manager.test.js.map +1 -0
- package/dist/src/chat/__tests__/client.test.js +109 -0
- package/dist/src/chat/__tests__/client.test.js.map +1 -0
- package/dist/src/chat/__tests__/discord-integration.test.js +153 -0
- package/dist/src/chat/__tests__/discord-integration.test.js.map +1 -0
- package/dist/src/chat/__tests__/intent-prompt.test.js +80 -0
- package/dist/src/chat/__tests__/intent-prompt.test.js.map +1 -0
- package/dist/src/chat/__tests__/verdict-resolver.test.js +308 -0
- package/dist/src/chat/__tests__/verdict-resolver.test.js.map +1 -0
- package/dist/src/chat/broadcast-bus.d.ts +10 -0
- package/dist/src/chat/broadcast-bus.js +52 -0
- package/dist/src/chat/broadcast-bus.js.map +1 -0
- package/dist/src/chat/channel-manager.d.ts +16 -0
- package/dist/src/chat/channel-manager.js +121 -0
- package/dist/src/chat/channel-manager.js.map +1 -0
- package/dist/src/chat/chat-keychain.d.ts +26 -0
- package/dist/src/chat/chat-keychain.js +113 -0
- package/dist/src/chat/chat-keychain.js.map +1 -0
- package/dist/src/chat/factory.d.ts +3 -0
- package/dist/src/chat/factory.js +29 -0
- package/dist/src/chat/factory.js.map +1 -0
- package/dist/src/chat/intent-prompt.d.ts +17 -0
- package/dist/src/chat/intent-prompt.js +52 -0
- package/dist/src/chat/intent-prompt.js.map +1 -0
- package/dist/src/chat/providers/discord/client.d.ts +28 -0
- package/dist/src/chat/providers/discord/client.js +77 -0
- package/dist/src/chat/providers/discord/client.js.map +1 -0
- package/dist/src/chat/types.d.ts +51 -0
- package/dist/src/chat/types.js +8 -0
- package/dist/src/chat/types.js.map +1 -0
- package/dist/src/chat/verdict-constants.d.ts +13 -0
- package/dist/src/chat/verdict-constants.js +18 -0
- package/dist/src/chat/verdict-constants.js.map +1 -0
- package/dist/src/chat/verdict-resolver.d.ts +28 -0
- package/dist/src/chat/verdict-resolver.js +181 -0
- package/dist/src/chat/verdict-resolver.js.map +1 -0
- package/dist/src/cli/__tests__/bw-vault.test.js +87 -0
- package/dist/src/cli/__tests__/bw-vault.test.js.map +1 -0
- package/dist/src/cli/__tests__/keys-bundle.test.js +40 -0
- package/dist/src/cli/__tests__/keys-bundle.test.js.map +1 -0
- package/dist/src/cli/__tests__/share-cmd.test.js +175 -0
- package/dist/src/cli/__tests__/share-cmd.test.js.map +1 -0
- package/dist/src/cli/bw-vault.d.ts +55 -0
- package/dist/src/cli/bw-vault.js +133 -0
- package/dist/src/cli/bw-vault.js.map +1 -0
- package/dist/src/cli/config/__tests__/model-picker.test.js +56 -0
- package/dist/src/cli/config/__tests__/model-picker.test.js.map +1 -0
- package/dist/src/cli/config/__tests__/provider-fetch.test.js +38 -0
- package/dist/src/cli/config/__tests__/provider-fetch.test.js.map +1 -0
- package/dist/src/cli/config/index.d.ts +2 -0
- package/dist/src/cli/config/index.js +106 -0
- package/dist/src/cli/config/index.js.map +1 -0
- package/dist/src/cli/config/model-picker.d.ts +17 -0
- package/dist/src/cli/config/model-picker.js +149 -0
- package/dist/src/cli/config/model-picker.js.map +1 -0
- package/dist/src/cli/config/provider-fetch.d.ts +8 -0
- package/dist/src/cli/config/provider-fetch.js +59 -0
- package/dist/src/cli/config/provider-fetch.js.map +1 -0
- package/dist/src/cli/config/screen-council.d.ts +1 -0
- package/dist/src/cli/config/screen-council.js +196 -0
- package/dist/src/cli/config/screen-council.js.map +1 -0
- package/dist/src/cli/config/screen-models.d.ts +1 -0
- package/dist/src/cli/config/screen-models.js +86 -0
- package/dist/src/cli/config/screen-models.js.map +1 -0
- package/dist/src/cli/config/screen-providers.d.ts +1 -0
- package/dist/src/cli/config/screen-providers.js +167 -0
- package/dist/src/cli/config/screen-providers.js.map +1 -0
- package/dist/src/cli/config/tui.d.ts +34 -0
- package/dist/src/cli/config/tui.js +145 -0
- package/dist/src/cli/config/tui.js.map +1 -0
- package/dist/src/cli/cost-forensics.d.ts +46 -0
- package/dist/src/cli/cost-forensics.js +188 -0
- package/dist/src/cli/cost-forensics.js.map +1 -0
- package/dist/src/cli/cost-forensics.test.js +99 -0
- package/dist/src/cli/cost-forensics.test.js.map +1 -0
- package/dist/src/cli/keys-bundle.d.ts +28 -0
- package/dist/src/cli/keys-bundle.js +77 -0
- package/dist/src/cli/keys-bundle.js.map +1 -0
- package/dist/src/cli/keys.d.ts +74 -0
- package/dist/src/cli/keys.js +709 -0
- package/dist/src/cli/keys.js.map +1 -0
- package/dist/src/cli/keys.test.js +86 -0
- package/dist/src/cli/keys.test.js.map +1 -0
- package/dist/src/cli/pil-report.d.ts +17 -0
- package/dist/src/cli/pil-report.js +163 -0
- package/dist/src/cli/pil-report.js.map +1 -0
- package/dist/src/cli/share-cmd.d.ts +31 -0
- package/dist/src/cli/share-cmd.js +110 -0
- package/dist/src/cli/share-cmd.js.map +1 -0
- package/dist/src/cli/usage-report.d.ts +17 -0
- package/dist/src/cli/usage-report.js +226 -0
- package/dist/src/cli/usage-report.js.map +1 -0
- package/dist/src/cloud/index.js.map +1 -0
- package/dist/src/council/__tests__/accounting.test.js +66 -0
- package/dist/src/council/__tests__/accounting.test.js.map +1 -0
- package/dist/src/council/__tests__/audit-replay.test.js +241 -0
- package/dist/src/council/__tests__/audit-replay.test.js.map +1 -0
- package/dist/src/council/__tests__/clarifier-max-rounds.test.js +46 -0
- package/dist/src/council/__tests__/clarifier-max-rounds.test.js.map +1 -0
- package/dist/src/council/__tests__/clarifier-options.test.js +54 -0
- package/dist/src/council/__tests__/clarifier-options.test.js.map +1 -0
- package/dist/src/council/__tests__/cost-aware.test.js +49 -0
- package/dist/src/council/__tests__/cost-aware.test.js.map +1 -0
- package/dist/src/council/__tests__/debate-planner-structured.test.js +209 -0
- package/dist/src/council/__tests__/debate-planner-structured.test.js.map +1 -0
- package/dist/src/council/__tests__/evaluator-metrics.test.js +460 -0
- package/dist/src/council/__tests__/evaluator-metrics.test.js.map +1 -0
- package/dist/src/council/__tests__/parse-outcome-fallback.test.js +103 -0
- package/dist/src/council/__tests__/parse-outcome-fallback.test.js.map +1 -0
- package/dist/src/council/__tests__/research-tools.test.js +210 -0
- package/dist/src/council/__tests__/research-tools.test.js.map +1 -0
- package/dist/src/council/__tests__/round-tools.test.js +300 -0
- package/dist/src/council/__tests__/round-tools.test.js.map +1 -0
- package/dist/src/council/__tests__/tool-trace.test.js +131 -0
- package/dist/src/council/__tests__/tool-trace.test.js.map +1 -0
- package/dist/src/council/__tests__/types-contract.test.d.ts +9 -0
- package/dist/src/council/__tests__/types-contract.test.js +82 -0
- package/dist/src/council/__tests__/types-contract.test.js.map +1 -0
- package/dist/src/council/clarifier.d.ts +42 -0
- package/dist/src/council/clarifier.js +332 -0
- package/dist/src/council/clarifier.js.map +1 -0
- package/dist/src/council/context.d.ts +18 -0
- package/dist/src/council/context.js +221 -0
- package/dist/src/council/context.js.map +1 -0
- package/dist/src/council/debate-planner.d.ts +8 -0
- package/dist/src/council/debate-planner.js +243 -0
- package/dist/src/council/debate-planner.js.map +1 -0
- package/dist/src/council/debate.d.ts +4 -0
- package/dist/src/council/debate.js +1014 -0
- package/dist/src/council/debate.js.map +1 -0
- package/dist/src/council/executor.d.ts +3 -0
- package/dist/src/council/executor.js +15 -0
- package/dist/src/council/executor.js.map +1 -0
- package/dist/src/council/index.d.ts +17 -0
- package/dist/src/council/index.js +747 -0
- package/dist/src/council/index.js.map +1 -0
- package/dist/src/council/leader.d.ts +60 -0
- package/dist/src/council/leader.js +216 -0
- package/dist/src/council/leader.js.map +1 -0
- package/dist/src/council/llm.d.ts +39 -0
- package/dist/src/council/llm.js +784 -0
- package/dist/src/council/llm.js.map +1 -0
- package/dist/src/council/phase-events.d.ts +26 -0
- package/dist/src/council/phase-events.js +37 -0
- package/dist/src/council/phase-events.js.map +1 -0
- package/dist/src/council/planner.d.ts +9 -0
- package/dist/src/council/planner.js +262 -0
- package/dist/src/council/planner.js.map +1 -0
- package/dist/src/council/preflight.d.ts +10 -0
- package/dist/src/council/preflight.js +66 -0
- package/dist/src/council/preflight.js.map +1 -0
- package/dist/src/council/prompts.d.ts +97 -0
- package/dist/src/council/prompts.js +491 -0
- package/dist/src/council/prompts.js.map +1 -0
- package/dist/src/council/types.d.ts +263 -0
- package/dist/src/council/types.js.map +1 -0
- package/dist/src/daemon/scheduler.d.ts +15 -0
- package/dist/src/daemon/scheduler.js +126 -0
- package/dist/src/daemon/scheduler.js.map +1 -0
- package/dist/src/daemon/scheduler.test.js +103 -0
- package/dist/src/daemon/scheduler.test.js.map +1 -0
- package/dist/src/ee/__tests__/bb-design.test.d.ts +14 -0
- package/dist/src/ee/__tests__/bb-design.test.js +180 -0
- package/dist/src/ee/__tests__/bb-design.test.js.map +1 -0
- package/dist/src/ee/__tests__/pil-context-bridge.test.js +54 -0
- package/dist/src/ee/__tests__/pil-context-bridge.test.js.map +1 -0
- package/dist/src/ee/__tests__/pipeline.integration.test.js +151 -0
- package/dist/src/ee/__tests__/pipeline.integration.test.js.map +1 -0
- package/dist/src/ee/__tests__/render-sink-wiring.test.js +74 -0
- package/dist/src/ee/__tests__/render-sink-wiring.test.js.map +1 -0
- package/dist/src/ee/auth.d.ts +21 -0
- package/dist/src/ee/auth.js +69 -0
- package/dist/src/ee/auth.js.map +1 -0
- package/dist/src/ee/auth.test.js.map +1 -0
- package/dist/src/ee/bb-design.d.ts +54 -0
- package/dist/src/ee/bb-design.js +213 -0
- package/dist/src/ee/bb-design.js.map +1 -0
- package/dist/src/ee/bb-retrieval.d.ts +107 -0
- package/dist/src/ee/bb-retrieval.js +341 -0
- package/dist/src/ee/bb-retrieval.js.map +1 -0
- package/dist/src/ee/bridge.d.ts +102 -0
- package/dist/src/ee/bridge.js +338 -0
- package/dist/src/ee/bridge.js.map +1 -0
- package/dist/src/ee/bridge.test.js.map +1 -0
- package/dist/src/ee/client-mode.d.ts +57 -0
- package/dist/src/ee/client-mode.js +140 -0
- package/dist/src/ee/client-mode.js.map +1 -0
- package/dist/src/ee/client.js +564 -0
- package/dist/src/ee/client.js.map +1 -0
- package/dist/src/ee/client.test.js.map +1 -0
- package/dist/src/ee/council-bridge.d.ts +27 -0
- package/dist/src/ee/council-bridge.js +60 -0
- package/dist/src/ee/council-bridge.js.map +1 -0
- package/dist/src/ee/embedding-cache.js.map +1 -0
- package/dist/src/ee/extract-session.js +55 -0
- package/dist/src/ee/extract-session.js.map +1 -0
- package/dist/src/ee/extract-session.test.js +192 -0
- package/dist/src/ee/extract-session.test.js.map +1 -0
- package/dist/src/ee/health.js +64 -0
- package/dist/src/ee/health.js.map +1 -0
- package/dist/src/ee/index.d.ts +10 -0
- package/dist/src/ee/index.js +9 -0
- package/dist/src/ee/index.js.map +1 -0
- package/dist/src/ee/intercept.js +122 -0
- package/dist/src/ee/intercept.js.map +1 -0
- package/dist/src/ee/intercept.test.js +171 -0
- package/dist/src/ee/intercept.test.js.map +1 -0
- package/dist/src/ee/judge.d.ts +55 -0
- package/dist/src/ee/judge.js +111 -0
- package/dist/src/ee/judge.js.map +1 -0
- package/dist/src/ee/judge.test.js +190 -0
- package/dist/src/ee/judge.test.js.map +1 -0
- package/dist/src/ee/mistake-detector.d.ts +129 -0
- package/dist/src/ee/mistake-detector.js +272 -0
- package/dist/src/ee/mistake-detector.js.map +1 -0
- package/dist/src/ee/mistake-detector.test.js +221 -0
- package/dist/src/ee/mistake-detector.test.js.map +1 -0
- package/dist/src/ee/offline-queue.js.map +1 -0
- package/dist/src/ee/offline-queue.test.js +246 -0
- package/dist/src/ee/offline-queue.test.js.map +1 -0
- package/dist/src/ee/phase-outcome.d.ts +83 -0
- package/dist/src/ee/phase-outcome.js +98 -0
- package/dist/src/ee/phase-outcome.js.map +1 -0
- package/dist/src/ee/phase-outcome.test.js +94 -0
- package/dist/src/ee/phase-outcome.test.js.map +1 -0
- package/dist/src/ee/phase-tracker.d.ts +91 -0
- package/dist/src/ee/phase-tracker.js +154 -0
- package/dist/src/ee/phase-tracker.js.map +1 -0
- package/dist/src/ee/phase-tracker.test.js +142 -0
- package/dist/src/ee/phase-tracker.test.js.map +1 -0
- package/dist/src/ee/posttool.js.map +1 -0
- package/dist/src/ee/posttool.test.js.map +1 -0
- package/dist/src/ee/prompt-stale.js.map +1 -0
- package/dist/src/ee/prompt-stale.test.js +76 -0
- package/dist/src/ee/prompt-stale.test.js.map +1 -0
- package/dist/src/ee/render.d.ts +25 -0
- package/dist/src/ee/render.js +62 -0
- package/dist/src/ee/render.js.map +1 -0
- package/dist/src/ee/render.test.js +63 -0
- package/dist/src/ee/render.test.js.map +1 -0
- package/dist/src/ee/scope.js.map +1 -0
- package/dist/src/ee/scope.test.js.map +1 -0
- package/dist/src/ee/session-trajectory.d.ts +81 -0
- package/dist/src/ee/session-trajectory.js +168 -0
- package/dist/src/ee/session-trajectory.js.map +1 -0
- package/dist/src/ee/session-trajectory.test.js +120 -0
- package/dist/src/ee/session-trajectory.test.js.map +1 -0
- package/dist/src/ee/tenant.js.map +1 -0
- package/dist/src/ee/touch.test.js +62 -0
- package/dist/src/ee/touch.test.js.map +1 -0
- package/dist/src/ee/types.d.ts +366 -0
- package/dist/src/ee/types.js.map +1 -0
- package/dist/src/flow/__tests__/migration.test.js.map +1 -0
- package/dist/src/flow/__tests__/parser.test.js.map +1 -0
- package/dist/src/flow/__tests__/run-manager-product.test.js +49 -0
- package/dist/src/flow/__tests__/run-manager-product.test.js.map +1 -0
- package/dist/src/flow/__tests__/run-manager.test.js.map +1 -0
- package/dist/src/flow/__tests__/scaffold-checkpoint.test.js +93 -0
- package/dist/src/flow/__tests__/scaffold-checkpoint.test.js.map +1 -0
- package/dist/src/flow/__tests__/scaffold.test.js.map +1 -0
- package/dist/src/flow/__tests__/warning-persist.test.js.map +1 -0
- package/dist/src/flow/artifact-io.js.map +1 -0
- package/dist/src/flow/compaction/__tests__/compress.test.js.map +1 -0
- package/dist/src/flow/compaction/__tests__/extract.test.js.map +1 -0
- package/dist/src/flow/compaction/__tests__/preserve.test.js.map +1 -0
- package/dist/src/flow/compaction/compress.js.map +1 -0
- package/dist/src/flow/compaction/extract.js.map +1 -0
- package/dist/src/flow/compaction/index.js.map +1 -0
- package/dist/src/flow/compaction/preserve.js.map +1 -0
- package/dist/src/flow/index.js.map +1 -0
- package/dist/src/flow/migration.js.map +1 -0
- package/dist/src/flow/parser.js.map +1 -0
- package/dist/src/flow/run-manager.d.ts +38 -0
- package/dist/src/flow/run-manager.js +139 -0
- package/dist/src/flow/run-manager.js.map +1 -0
- package/dist/src/flow/scaffold-checkpoint.d.ts +63 -0
- package/dist/src/flow/scaffold-checkpoint.js +101 -0
- package/dist/src/flow/scaffold-checkpoint.js.map +1 -0
- package/dist/src/flow/scaffold.js.map +1 -0
- package/dist/src/flow/warning-persist.js.map +1 -0
- package/dist/src/generated/version.d.ts +2 -0
- package/dist/src/generated/version.js +5 -0
- package/dist/src/generated/version.js.map +1 -0
- package/dist/src/gsd/__tests__/complexity.test.js +0 -0
- package/dist/src/gsd/__tests__/complexity.test.js.map +1 -0
- package/dist/src/gsd/__tests__/directives.test.js +44 -0
- package/dist/src/gsd/__tests__/directives.test.js.map +1 -0
- package/dist/src/gsd/__tests__/gray-areas.test.js +29 -0
- package/dist/src/gsd/__tests__/gray-areas.test.js.map +1 -0
- package/dist/src/gsd/__tests__/types.test.js +65 -0
- package/dist/src/gsd/__tests__/types.test.js.map +1 -0
- package/dist/src/gsd/complexity.d.ts +28 -0
- package/dist/src/gsd/complexity.js +103 -0
- package/dist/src/gsd/complexity.js.map +1 -0
- package/dist/src/gsd/directives.d.ts +31 -0
- package/dist/src/gsd/directives.js +73 -0
- package/dist/src/gsd/directives.js.map +1 -0
- package/dist/src/gsd/gray-areas.d.ts +30 -0
- package/dist/src/gsd/gray-areas.js +97 -0
- package/dist/src/gsd/gray-areas.js.map +1 -0
- package/dist/src/gsd/index.js.map +1 -0
- package/dist/src/gsd/types.d.ts +5 -0
- package/dist/src/gsd/types.js.map +1 -0
- package/dist/src/headless/__tests__/council-answers.test.js +226 -0
- package/dist/src/headless/__tests__/council-answers.test.js.map +1 -0
- package/dist/src/headless/council-answers.d.ts +53 -0
- package/dist/src/headless/council-answers.js +77 -0
- package/dist/src/headless/council-answers.js.map +1 -0
- package/dist/src/headless/output.d.ts +68 -0
- package/dist/src/headless/output.js.map +1 -0
- package/dist/src/headless/output.test.js +178 -0
- package/dist/src/headless/output.test.js.map +1 -0
- package/dist/src/hooks/config.js.map +1 -0
- package/dist/src/hooks/index.d.ts +44 -0
- package/dist/src/hooks/index.js +471 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/types.d.ts +175 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +1347 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lsp/builtins.d.ts +9 -0
- package/dist/src/lsp/builtins.js +351 -0
- package/dist/src/lsp/builtins.js.map +1 -0
- package/dist/src/lsp/builtins.test.js +91 -0
- package/dist/src/lsp/builtins.test.js.map +1 -0
- package/dist/src/lsp/client.d.ts +20 -0
- package/dist/src/lsp/client.js +290 -0
- package/dist/src/lsp/client.js.map +1 -0
- package/dist/src/lsp/manager.d.ts +20 -0
- package/dist/src/lsp/manager.js +235 -0
- package/dist/src/lsp/manager.js.map +1 -0
- package/dist/src/lsp/manager.test.js +133 -0
- package/dist/src/lsp/manager.test.js.map +1 -0
- package/dist/src/lsp/npm-cache.js.map +1 -0
- package/dist/src/lsp/npm-cache.test.js +53 -0
- package/dist/src/lsp/npm-cache.test.js.map +1 -0
- package/dist/src/lsp/runtime.d.ts +6 -0
- package/dist/src/lsp/runtime.js +53 -0
- package/dist/src/lsp/runtime.js.map +1 -0
- package/dist/src/lsp/smoke.test.js.map +1 -0
- package/dist/src/lsp/types.js.map +1 -0
- package/dist/src/mcp/__tests__/auto-setup.test.js +81 -0
- package/dist/src/mcp/__tests__/auto-setup.test.js.map +1 -0
- package/dist/src/mcp/__tests__/harness-driver-action-tools.spec.js +101 -0
- package/dist/src/mcp/__tests__/harness-driver-action-tools.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/harness-driver-async-tools.spec.js +110 -0
- package/dist/src/mcp/__tests__/harness-driver-async-tools.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/harness-driver-read-tools.spec.js +124 -0
- package/dist/src/mcp/__tests__/harness-driver-read-tools.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/harness-driver-security.spec.js +61 -0
- package/dist/src/mcp/__tests__/harness-driver-security.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/harness-driver.spec.js +20 -0
- package/dist/src/mcp/__tests__/harness-driver.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/lazy-schema.spec.js +152 -0
- package/dist/src/mcp/__tests__/lazy-schema.spec.js.map +1 -0
- package/dist/src/mcp/__tests__/mcp-keychain.test.js +40 -0
- package/dist/src/mcp/__tests__/mcp-keychain.test.js.map +1 -0
- package/dist/src/mcp/__tests__/research-onboarding.test.js +148 -0
- package/dist/src/mcp/__tests__/research-onboarding.test.js.map +1 -0
- package/dist/src/mcp/__tests__/runtime-hydration.test.js +78 -0
- package/dist/src/mcp/__tests__/runtime-hydration.test.js.map +1 -0
- package/dist/src/mcp/__tests__/runtime-sanitize.test.js +40 -0
- package/dist/src/mcp/__tests__/runtime-sanitize.test.js.map +1 -0
- package/dist/src/mcp/auto-setup.js +98 -0
- package/dist/src/mcp/auto-setup.js.map +1 -0
- package/dist/src/mcp/catalog.js +145 -0
- package/dist/src/mcp/catalog.js.map +1 -0
- package/dist/src/mcp/mcp-keychain.d.ts +13 -0
- package/dist/src/mcp/mcp-keychain.js +65 -0
- package/dist/src/mcp/mcp-keychain.js.map +1 -0
- package/dist/src/mcp/oauth-callback.d.ts +16 -0
- package/dist/src/mcp/oauth-callback.js +52 -0
- package/dist/src/mcp/oauth-callback.js.map +1 -0
- package/dist/src/mcp/oauth-provider.js.map +1 -0
- package/dist/src/mcp/opentui-spawn.d.ts +11 -0
- package/dist/src/mcp/opentui-spawn.js +58 -0
- package/dist/src/mcp/opentui-spawn.js.map +1 -0
- package/dist/src/mcp/parse-headers.js.map +1 -0
- package/dist/src/mcp/parse-headers.test.js +43 -0
- package/dist/src/mcp/parse-headers.test.js.map +1 -0
- package/dist/src/mcp/research-onboarding.d.ts +20 -0
- package/dist/src/mcp/research-onboarding.js +123 -0
- package/dist/src/mcp/research-onboarding.js.map +1 -0
- package/dist/src/mcp/runtime.js +148 -0
- package/dist/src/mcp/runtime.js.map +1 -0
- package/dist/src/mcp/smoke.test.js.map +1 -0
- package/dist/src/mcp/validate.d.ts +9 -0
- package/dist/src/mcp/validate.js.map +1 -0
- package/dist/src/models/__tests__/registry.test.js +74 -0
- package/dist/src/models/__tests__/registry.test.js.map +1 -0
- package/dist/src/models/catalog-client.js +104 -0
- package/dist/src/models/catalog-client.js.map +1 -0
- package/dist/src/models/catalog.json +177 -0
- package/dist/src/models/classify-tier.js +45 -0
- package/dist/src/models/classify-tier.js.map +1 -0
- package/dist/src/models/index.d.ts +1 -0
- package/dist/src/models/index.js +2 -0
- package/dist/src/models/index.js.map +1 -0
- package/dist/src/models/registry.d.ts +20 -0
- package/dist/src/models/registry.js +68 -0
- package/dist/src/models/registry.js.map +1 -0
- package/dist/src/ops/__tests__/doctor-council-mcp.test.js +139 -0
- package/dist/src/ops/__tests__/doctor-council-mcp.test.js.map +1 -0
- package/dist/src/ops/__tests__/doctor-ee-health.test.js +113 -0
- package/dist/src/ops/__tests__/doctor-ee-health.test.js.map +1 -0
- package/dist/src/ops/bug-report.js.map +1 -0
- package/dist/src/ops/bug-report.test.js.map +1 -0
- package/dist/src/ops/doctor.js +333 -0
- package/dist/src/ops/doctor.js.map +1 -0
- package/dist/src/ops/doctor.test.js +96 -0
- package/dist/src/ops/doctor.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/batch-turn-runner.test.js +154 -0
- package/dist/src/orchestrator/__tests__/batch-turn-runner.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/council-manager.test.js +148 -0
- package/dist/src/orchestrator/__tests__/council-manager.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/cross-turn-dedup.test.js +153 -0
- package/dist/src/orchestrator/__tests__/cross-turn-dedup.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/current-call-id.test.d.ts +16 -0
- package/dist/src/orchestrator/__tests__/current-call-id.test.js +138 -0
- package/dist/src/orchestrator/__tests__/current-call-id.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/flow-resume.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/message-processor.test.js +182 -0
- package/dist/src/orchestrator/__tests__/message-processor.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/message-write-ahead.test.d.ts +22 -0
- package/dist/src/orchestrator/__tests__/message-write-ahead.test.js +149 -0
- package/dist/src/orchestrator/__tests__/message-write-ahead.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/read-path-budget.test.js +98 -0
- package/dist/src/orchestrator/__tests__/read-path-budget.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/retry-classifier.test.js +102 -0
- package/dist/src/orchestrator/__tests__/retry-classifier.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/retry-stream.test.js +151 -0
- package/dist/src/orchestrator/__tests__/retry-stream.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/route-feedback.test.js +47 -0
- package/dist/src/orchestrator/__tests__/route-feedback.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/stream-runner.test.js +100 -0
- package/dist/src/orchestrator/__tests__/stream-runner.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/usage-events-shape.test.d.ts +8 -0
- package/dist/src/orchestrator/__tests__/usage-events-shape.test.js +58 -0
- package/dist/src/orchestrator/__tests__/usage-events-shape.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/usage-normalizer-c1.test.d.ts +21 -0
- package/dist/src/orchestrator/__tests__/usage-normalizer-c1.test.js +155 -0
- package/dist/src/orchestrator/__tests__/usage-normalizer-c1.test.js.map +1 -0
- package/dist/src/orchestrator/__tests__/write-ahead.test.d.ts +20 -0
- package/dist/src/orchestrator/__tests__/write-ahead.test.js +134 -0
- package/dist/src/orchestrator/__tests__/write-ahead.test.js.map +1 -0
- package/dist/src/orchestrator/abort.js.map +1 -0
- package/dist/src/orchestrator/abort.test.js.map +1 -0
- package/dist/src/orchestrator/agent-options.d.ts +144 -0
- package/dist/src/orchestrator/agent-options.js +15 -0
- package/dist/src/orchestrator/agent-options.js.map +1 -0
- package/dist/src/orchestrator/agent.test.js +160 -0
- package/dist/src/orchestrator/agent.test.js.map +1 -0
- package/dist/src/orchestrator/batch-turn-runner.d.ts +57 -0
- package/dist/src/orchestrator/batch-turn-runner.js +312 -0
- package/dist/src/orchestrator/batch-turn-runner.js.map +1 -0
- package/dist/src/orchestrator/batch-utils.d.ts +41 -0
- package/dist/src/orchestrator/batch-utils.js +268 -0
- package/dist/src/orchestrator/batch-utils.js.map +1 -0
- package/dist/src/orchestrator/cleanup.test.d.ts +1 -0
- package/dist/src/orchestrator/cleanup.test.js +67 -0
- package/dist/src/orchestrator/cleanup.test.js.map +1 -0
- package/dist/src/orchestrator/compaction.d.ts +47 -0
- package/dist/src/orchestrator/compaction.js +491 -0
- package/dist/src/orchestrator/compaction.js.map +1 -0
- package/dist/src/orchestrator/compaction.test.d.ts +1 -0
- package/dist/src/orchestrator/compaction.test.js +146 -0
- package/dist/src/orchestrator/compaction.test.js.map +1 -0
- package/dist/src/orchestrator/council-manager.d.ts +109 -0
- package/dist/src/orchestrator/council-manager.js +480 -0
- package/dist/src/orchestrator/council-manager.js.map +1 -0
- package/dist/src/orchestrator/cross-turn-dedup.d.ts +87 -0
- package/dist/src/orchestrator/cross-turn-dedup.js +153 -0
- package/dist/src/orchestrator/cross-turn-dedup.js.map +1 -0
- package/dist/src/orchestrator/delegations.d.ts +49 -0
- package/dist/src/orchestrator/delegations.js.map +1 -0
- package/dist/src/orchestrator/delegations.test.d.ts +1 -0
- package/dist/src/orchestrator/delegations.test.js +107 -0
- package/dist/src/orchestrator/delegations.test.js.map +1 -0
- package/dist/src/orchestrator/error-utils.d.ts +7 -0
- package/dist/src/orchestrator/error-utils.js +66 -0
- package/dist/src/orchestrator/error-utils.js.map +1 -0
- package/dist/src/orchestrator/flow-resume.d.ts +24 -0
- package/dist/src/orchestrator/flow-resume.js +52 -0
- package/dist/src/orchestrator/flow-resume.js.map +1 -0
- package/dist/src/orchestrator/message-processor.d.ts +132 -0
- package/dist/src/orchestrator/message-processor.js +1675 -0
- package/dist/src/orchestrator/message-processor.js.map +1 -0
- package/dist/src/orchestrator/message-seq.d.ts +13 -0
- package/dist/src/orchestrator/message-seq.js +21 -0
- package/dist/src/orchestrator/message-seq.js.map +1 -0
- package/dist/src/orchestrator/message-seq.test.d.ts +1 -0
- package/dist/src/orchestrator/message-seq.test.js +24 -0
- package/dist/src/orchestrator/message-seq.test.js.map +1 -0
- package/dist/src/orchestrator/orchestrator.d.ts +245 -0
- package/dist/src/orchestrator/orchestrator.js +2173 -0
- package/dist/src/orchestrator/orchestrator.js.map +1 -0
- package/dist/src/orchestrator/pending-calls.js.map +1 -0
- package/dist/src/orchestrator/pending-calls.test.d.ts +1 -0
- package/dist/src/orchestrator/pending-calls.test.js.map +1 -0
- package/dist/src/orchestrator/prompts.d.ts +31 -0
- package/dist/src/orchestrator/prompts.js +387 -0
- package/dist/src/orchestrator/prompts.js.map +1 -0
- package/dist/src/orchestrator/provider-options-shape.d.ts +23 -0
- package/dist/src/orchestrator/provider-options-shape.js +68 -0
- package/dist/src/orchestrator/provider-options-shape.js.map +1 -0
- package/dist/src/orchestrator/provider-options-shape.spec.d.ts +1 -0
- package/dist/src/orchestrator/provider-options-shape.spec.js +63 -0
- package/dist/src/orchestrator/provider-options-shape.spec.js.map +1 -0
- package/dist/src/orchestrator/read-path-budget.d.ts +57 -0
- package/dist/src/orchestrator/read-path-budget.js +103 -0
- package/dist/src/orchestrator/read-path-budget.js.map +1 -0
- package/dist/src/orchestrator/reasoning.js +57 -0
- package/dist/src/orchestrator/reasoning.js.map +1 -0
- package/dist/src/orchestrator/reasoning.test.d.ts +1 -0
- package/dist/src/orchestrator/reasoning.test.js +26 -0
- package/dist/src/orchestrator/reasoning.test.js.map +1 -0
- package/dist/src/orchestrator/retry-classifier.d.ts +26 -0
- package/dist/src/orchestrator/retry-classifier.js +103 -0
- package/dist/src/orchestrator/retry-classifier.js.map +1 -0
- package/dist/src/orchestrator/retry-stream.d.ts +43 -0
- package/dist/src/orchestrator/retry-stream.js +110 -0
- package/dist/src/orchestrator/retry-stream.js.map +1 -0
- package/dist/src/orchestrator/sandbox.test.d.ts +1 -0
- package/dist/src/orchestrator/sandbox.test.js +94 -0
- package/dist/src/orchestrator/sandbox.test.js.map +1 -0
- package/dist/src/orchestrator/stream-runner.d.ts +131 -0
- package/dist/src/orchestrator/stream-runner.js +549 -0
- package/dist/src/orchestrator/stream-runner.js.map +1 -0
- package/dist/src/orchestrator/sub-agent-cap.d.ts +98 -0
- package/dist/src/orchestrator/sub-agent-cap.js +146 -0
- package/dist/src/orchestrator/sub-agent-cap.js.map +1 -0
- package/dist/src/orchestrator/sub-agent-cap.test.d.ts +1 -0
- package/dist/src/orchestrator/sub-agent-cap.test.js +170 -0
- package/dist/src/orchestrator/sub-agent-cap.test.js.map +1 -0
- package/dist/src/orchestrator/subagent-compactor.d.ts +74 -0
- package/dist/src/orchestrator/subagent-compactor.js +218 -0
- package/dist/src/orchestrator/subagent-compactor.js.map +1 -0
- package/dist/src/orchestrator/subagent-compactor.spec.d.ts +1 -0
- package/dist/src/orchestrator/subagent-compactor.spec.js +131 -0
- package/dist/src/orchestrator/subagent-compactor.spec.js.map +1 -0
- package/dist/src/orchestrator/token-counter.d.ts +27 -0
- package/dist/src/orchestrator/token-counter.js +76 -0
- package/dist/src/orchestrator/token-counter.js.map +1 -0
- package/dist/src/orchestrator/token-counter.test.d.ts +1 -0
- package/dist/src/orchestrator/token-counter.test.js +57 -0
- package/dist/src/orchestrator/token-counter.test.js.map +1 -0
- package/dist/src/orchestrator/tool-utils.d.ts +38 -0
- package/dist/src/orchestrator/tool-utils.js +201 -0
- package/dist/src/orchestrator/tool-utils.js.map +1 -0
- package/dist/src/orchestrator/turn-runner-deps.d.ts +47 -0
- package/dist/src/orchestrator/turn-runner-deps.js +14 -0
- package/dist/src/orchestrator/turn-runner-deps.js.map +1 -0
- package/dist/src/pil/__tests__/budget.test.d.ts +1 -0
- package/dist/src/pil/__tests__/budget.test.js +33 -0
- package/dist/src/pil/__tests__/budget.test.js.map +1 -0
- package/dist/src/pil/__tests__/config.test.d.ts +1 -0
- package/dist/src/pil/__tests__/config.test.js +30 -0
- package/dist/src/pil/__tests__/config.test.js.map +1 -0
- package/dist/src/pil/__tests__/dual-run.test.d.ts +1 -0
- package/dist/src/pil/__tests__/dual-run.test.js +49 -0
- package/dist/src/pil/__tests__/dual-run.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer1-intent-trace.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer1-intent-trace.test.js +128 -0
- package/dist/src/pil/__tests__/layer1-intent-trace.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer1-intent.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer1-intent.test.js +305 -0
- package/dist/src/pil/__tests__/layer1-intent.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer2-personality.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer2-personality.test.js +57 -0
- package/dist/src/pil/__tests__/layer2-personality.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer3-ee-injection.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer3-ee-injection.test.js +153 -0
- package/dist/src/pil/__tests__/layer3-ee-injection.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer3-injected-chunk.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer3-injected-chunk.test.js +91 -0
- package/dist/src/pil/__tests__/layer3-injected-chunk.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer4-gsd.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer4-gsd.test.js +97 -0
- package/dist/src/pil/__tests__/layer4-gsd.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer5-context.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer5-context.test.js +137 -0
- package/dist/src/pil/__tests__/layer5-context.test.js.map +1 -0
- package/dist/src/pil/__tests__/layer6-output.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer6-output.test.js +237 -0
- package/dist/src/pil/__tests__/layer6-output.test.js.map +1 -0
- package/dist/src/pil/__tests__/ollama-classify.test.d.ts +1 -0
- package/dist/src/pil/__tests__/ollama-classify.test.js.map +1 -0
- package/dist/src/pil/__tests__/orchestrator-integration.test.js.map +1 -0
- package/dist/src/pil/__tests__/pipeline.test.d.ts +1 -0
- package/dist/src/pil/__tests__/pipeline.test.js +167 -0
- package/dist/src/pil/__tests__/pipeline.test.js.map +1 -0
- package/dist/src/pil/__tests__/renderer-coverage.test.d.ts +7 -0
- package/dist/src/pil/__tests__/renderer-coverage.test.js +42 -0
- package/dist/src/pil/__tests__/renderer-coverage.test.js.map +1 -0
- package/dist/src/pil/__tests__/response-tools.test.d.ts +1 -0
- package/dist/src/pil/__tests__/response-tools.test.js +142 -0
- package/dist/src/pil/__tests__/response-tools.test.js.map +1 -0
- package/dist/src/pil/__tests__/schema.test.d.ts +1 -0
- package/dist/src/pil/__tests__/schema.test.js +202 -0
- package/dist/src/pil/__tests__/schema.test.js.map +1 -0
- package/dist/src/pil/__tests__/scoreComplexity.test.d.ts +1 -0
- package/dist/src/pil/__tests__/scoreComplexity.test.js +119 -0
- package/dist/src/pil/__tests__/scoreComplexity.test.js.map +1 -0
- package/dist/src/pil/__tests__/scoreSufficiency.test.d.ts +8 -0
- package/dist/src/pil/__tests__/scoreSufficiency.test.js +89 -0
- package/dist/src/pil/__tests__/scoreSufficiency.test.js.map +1 -0
- package/dist/src/pil/__tests__/store.test.d.ts +1 -0
- package/dist/src/pil/__tests__/store.test.js.map +1 -0
- package/dist/src/pil/__tests__/task-tier-map.test.d.ts +1 -0
- package/dist/src/pil/__tests__/task-tier-map.test.js.map +1 -0
- package/dist/src/pil/budget-log.d.ts +26 -0
- package/dist/src/pil/budget-log.js +59 -0
- package/dist/src/pil/budget-log.js.map +1 -0
- package/dist/src/pil/budget.js.map +1 -0
- package/dist/src/pil/config.d.ts +7 -0
- package/dist/src/pil/config.js +14 -0
- package/dist/src/pil/config.js.map +1 -0
- package/dist/src/pil/index.d.ts +11 -0
- package/dist/src/pil/index.js +11 -0
- package/dist/src/pil/index.js.map +1 -0
- package/dist/src/pil/layer1-intent.d.ts +49 -0
- package/dist/src/pil/layer1-intent.js +514 -0
- package/dist/src/pil/layer1-intent.js.map +1 -0
- package/dist/src/pil/layer1-intent.test.d.ts +1 -0
- package/dist/src/pil/layer1-intent.test.js +98 -0
- package/dist/src/pil/layer1-intent.test.js.map +1 -0
- package/dist/src/pil/layer2-personality.js +37 -0
- package/dist/src/pil/layer2-personality.js.map +1 -0
- package/dist/src/pil/layer3-ee-injection.d.ts +18 -0
- package/dist/src/pil/layer3-ee-injection.js +305 -0
- package/dist/src/pil/layer3-ee-injection.js.map +1 -0
- package/dist/src/pil/layer4-gsd.d.ts +20 -0
- package/dist/src/pil/layer4-gsd.js +108 -0
- package/dist/src/pil/layer4-gsd.js.map +1 -0
- package/dist/src/pil/layer5-context.js +151 -0
- package/dist/src/pil/layer5-context.js.map +1 -0
- package/dist/src/pil/layer6-output.d.ts +20 -0
- package/dist/src/pil/layer6-output.js +237 -0
- package/dist/src/pil/layer6-output.js.map +1 -0
- package/dist/src/pil/ollama-classify.js.map +1 -0
- package/dist/src/pil/pipeline.d.ts +23 -0
- package/dist/src/pil/pipeline.js +182 -0
- package/dist/src/pil/pipeline.js.map +1 -0
- package/dist/src/pil/response-tools.d.ts +63 -0
- package/dist/src/pil/response-tools.js +87 -0
- package/dist/src/pil/response-tools.js.map +1 -0
- package/dist/src/pil/schema.d.ts +160 -0
- package/dist/src/pil/schema.js +88 -0
- package/dist/src/pil/schema.js.map +1 -0
- package/dist/src/pil/store.js.map +1 -0
- package/dist/src/pil/task-tier-map.js.map +1 -0
- package/dist/src/pil/timeout.js.map +1 -0
- package/dist/src/pil/types.d.ts +149 -0
- package/dist/src/pil/types.js.map +1 -0
- package/dist/src/product-loop/__tests__/artifact-io.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/artifact-io.test.js +83 -0
- package/dist/src/product-loop/__tests__/artifact-io.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/assumption-ledger.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/assumption-ledger.test.js +261 -0
- package/dist/src/product-loop/__tests__/assumption-ledger.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/cb2-retry-bonus.test.d.ts +13 -0
- package/dist/src/product-loop/__tests__/cb2-retry-bonus.test.js +158 -0
- package/dist/src/product-loop/__tests__/cb2-retry-bonus.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/circuit-breakers-coverage.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/circuit-breakers-coverage.test.js +67 -0
- package/dist/src/product-loop/__tests__/circuit-breakers-coverage.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/circuit-breakers.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/circuit-breakers.test.js +79 -0
- package/dist/src/product-loop/__tests__/circuit-breakers.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/complexity-routing.spec.d.ts +11 -0
- package/dist/src/product-loop/__tests__/complexity-routing.spec.js +134 -0
- package/dist/src/product-loop/__tests__/complexity-routing.spec.js.map +1 -0
- package/dist/src/product-loop/__tests__/context-policy.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/context-policy.test.js +266 -0
- package/dist/src/product-loop/__tests__/context-policy.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/cost-preview.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/cost-preview.test.js +111 -0
- package/dist/src/product-loop/__tests__/cost-preview.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/cost-scoper.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/cost-scoper.test.js +50 -0
- package/dist/src/product-loop/__tests__/cost-scoper.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/cross-run-memory.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/cross-run-memory.test.js +168 -0
- package/dist/src/product-loop/__tests__/cross-run-memory.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/design-output.spec.d.ts +1 -0
- package/dist/src/product-loop/__tests__/design-output.spec.js +36 -0
- package/dist/src/product-loop/__tests__/design-output.spec.js.map +1 -0
- package/dist/src/product-loop/__tests__/discover.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discover.test.js +83 -0
- package/dist/src/product-loop/__tests__/discover.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-council-runner.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-council-runner.test.js +13 -0
- package/dist/src/product-loop/__tests__/discovery-council-runner.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-detection.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-detection.test.js +151 -0
- package/dist/src/product-loop/__tests__/discovery-detection.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-ecosystem.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/discovery-ecosystem.test.js +110 -0
- package/dist/src/product-loop/__tests__/discovery-ecosystem.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-integration.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-integration.test.js +126 -0
- package/dist/src/product-loop/__tests__/discovery-integration.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-interview.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-interview.test.js +292 -0
- package/dist/src/product-loop/__tests__/discovery-interview.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-migrations.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-migrations.test.js +69 -0
- package/dist/src/product-loop/__tests__/discovery-migrations.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-persistence.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-persistence.test.js +146 -0
- package/dist/src/product-loop/__tests__/discovery-persistence.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-prompt-parser.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-prompt-parser.test.js +65 -0
- package/dist/src/product-loop/__tests__/discovery-prompt-parser.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-recommender-ecosystem.test.d.ts +9 -0
- package/dist/src/product-loop/__tests__/discovery-recommender-ecosystem.test.js +86 -0
- package/dist/src/product-loop/__tests__/discovery-recommender-ecosystem.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-recommender.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-recommender.test.js +316 -0
- package/dist/src/product-loop/__tests__/discovery-recommender.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/discovery-schema.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-schema.test.js +77 -0
- package/dist/src/product-loop/__tests__/discovery-schema.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/done-gate-coverage.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/done-gate-coverage.test.js +135 -0
- package/dist/src/product-loop/__tests__/done-gate-coverage.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/done-gate.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/done-gate.test.js +122 -0
- package/dist/src/product-loop/__tests__/done-gate.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/ee-extract-wiring.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/ee-extract-wiring.test.js +181 -0
- package/dist/src/product-loop/__tests__/ee-extract-wiring.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/extract-to-ee.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/extract-to-ee.test.js +161 -0
- package/dist/src/product-loop/__tests__/extract-to-ee.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/feedback-routing.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/feedback-routing.test.js +83 -0
- package/dist/src/product-loop/__tests__/feedback-routing.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/hot-path.spec.d.ts +11 -0
- package/dist/src/product-loop/__tests__/hot-path.spec.js +146 -0
- package/dist/src/product-loop/__tests__/hot-path.spec.js.map +1 -0
- package/dist/src/product-loop/__tests__/integration.test.d.ts +7 -0
- package/dist/src/product-loop/__tests__/integration.test.js +296 -0
- package/dist/src/product-loop/__tests__/integration.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/loop-driver-audit.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/loop-driver-audit.test.js +264 -0
- package/dist/src/product-loop/__tests__/loop-driver-audit.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/loop-driver.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/loop-driver.test.js +220 -0
- package/dist/src/product-loop/__tests__/loop-driver.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-budget.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-budget.test.js +149 -0
- package/dist/src/product-loop/__tests__/phase-budget.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-orchestrator-integration.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-orchestrator-integration.test.js +138 -0
- package/dist/src/product-loop/__tests__/phase-orchestrator-integration.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-plan.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-plan.test.js +208 -0
- package/dist/src/product-loop/__tests__/phase-plan.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-rituals.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-rituals.test.js +174 -0
- package/dist/src/product-loop/__tests__/phase-rituals.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-runner.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-runner.test.js +414 -0
- package/dist/src/product-loop/__tests__/phase-runner.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/phase-tracker-bridge.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/phase-tracker-bridge.test.js +67 -0
- package/dist/src/product-loop/__tests__/phase-tracker-bridge.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/product-identity.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/product-identity.test.js +40 -0
- package/dist/src/product-loop/__tests__/product-identity.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/reality-anchor.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/reality-anchor.test.js +49 -0
- package/dist/src/product-loop/__tests__/reality-anchor.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/repo-audit.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/repo-audit.test.js +97 -0
- package/dist/src/product-loop/__tests__/repo-audit.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/role-memory.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/role-memory.test.js +56 -0
- package/dist/src/product-loop/__tests__/role-memory.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/role-registry.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/role-registry.test.js +222 -0
- package/dist/src/product-loop/__tests__/role-registry.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/role-routing-ee.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/role-routing-ee.test.js +79 -0
- package/dist/src/product-loop/__tests__/role-routing-ee.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/route-decision-emit.test.d.ts +10 -0
- package/dist/src/product-loop/__tests__/route-decision-emit.test.js +173 -0
- package/dist/src/product-loop/__tests__/route-decision-emit.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/seed-questions.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/seed-questions.test.js +30 -0
- package/dist/src/product-loop/__tests__/seed-questions.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/ship-polish.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/ship-polish.test.js +96 -0
- package/dist/src/product-loop/__tests__/ship-polish.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/sprint-runner-emit.test.d.ts +14 -0
- package/dist/src/product-loop/__tests__/sprint-runner-emit.test.js +279 -0
- package/dist/src/product-loop/__tests__/sprint-runner-emit.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/sprint-runner.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/sprint-runner.test.js +432 -0
- package/dist/src/product-loop/__tests__/sprint-runner.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/stakeholder-acl.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/stakeholder-acl.test.js +83 -0
- package/dist/src/product-loop/__tests__/stakeholder-acl.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/state-md-ee-injections.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/state-md-ee-injections.test.js +182 -0
- package/dist/src/product-loop/__tests__/state-md-ee-injections.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/sufficiency-routing.spec.d.ts +12 -0
- package/dist/src/product-loop/__tests__/sufficiency-routing.spec.js +134 -0
- package/dist/src/product-loop/__tests__/sufficiency-routing.spec.js.map +1 -0
- package/dist/src/product-loop/__tests__/typed-artifacts.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/typed-artifacts.test.js +222 -0
- package/dist/src/product-loop/__tests__/typed-artifacts.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/types.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/types.test.js +79 -0
- package/dist/src/product-loop/__tests__/types.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/verify-failure-threshold.test.d.ts +9 -0
- package/dist/src/product-loop/__tests__/verify-failure-threshold.test.js +145 -0
- package/dist/src/product-loop/__tests__/verify-failure-threshold.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/verify-failure-tracking.test.d.ts +4 -0
- package/dist/src/product-loop/__tests__/verify-failure-tracking.test.js +122 -0
- package/dist/src/product-loop/__tests__/verify-failure-tracking.test.js.map +1 -0
- package/dist/src/product-loop/__tests__/verify-result.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/verify-result.test.js +53 -0
- package/dist/src/product-loop/__tests__/verify-result.test.js.map +1 -0
- package/dist/src/product-loop/artifact-io.d.ts +41 -0
- package/dist/src/product-loop/artifact-io.js +223 -0
- package/dist/src/product-loop/artifact-io.js.map +1 -0
- package/dist/src/product-loop/assumption-ledger.d.ts +101 -0
- package/dist/src/product-loop/assumption-ledger.js +190 -0
- package/dist/src/product-loop/assumption-ledger.js.map +1 -0
- package/dist/src/product-loop/circuit-breakers.d.ts +34 -0
- package/dist/src/product-loop/circuit-breakers.js +54 -0
- package/dist/src/product-loop/circuit-breakers.js.map +1 -0
- package/dist/src/product-loop/context-policy.d.ts +29 -0
- package/dist/src/product-loop/context-policy.js +141 -0
- package/dist/src/product-loop/context-policy.js.map +1 -0
- package/dist/src/product-loop/cost-preview.d.ts +46 -0
- package/dist/src/product-loop/cost-preview.js +75 -0
- package/dist/src/product-loop/cost-preview.js.map +1 -0
- package/dist/src/product-loop/cost-scoper.d.ts +21 -0
- package/dist/src/product-loop/cost-scoper.js +33 -0
- package/dist/src/product-loop/cost-scoper.js.map +1 -0
- package/dist/src/product-loop/cross-run-memory.d.ts +73 -0
- package/dist/src/product-loop/cross-run-memory.js +390 -0
- package/dist/src/product-loop/cross-run-memory.js.map +1 -0
- package/dist/src/product-loop/design-output.d.ts +4 -0
- package/dist/src/product-loop/design-output.js +21 -0
- package/dist/src/product-loop/design-output.js.map +1 -0
- package/dist/src/product-loop/discover.d.ts +25 -0
- package/dist/src/product-loop/discover.js +113 -0
- package/dist/src/product-loop/discover.js.map +1 -0
- package/dist/src/product-loop/discovery-context-format.d.ts +2 -0
- package/dist/src/product-loop/discovery-context-format.js +22 -0
- package/dist/src/product-loop/discovery-context-format.js.map +1 -0
- package/dist/src/product-loop/discovery-council-runner.d.ts +25 -0
- package/dist/src/product-loop/discovery-council-runner.js +66 -0
- package/dist/src/product-loop/discovery-council-runner.js.map +1 -0
- package/dist/src/product-loop/discovery-detection.d.ts +2 -0
- package/dist/src/product-loop/discovery-detection.js +163 -0
- package/dist/src/product-loop/discovery-detection.js.map +1 -0
- package/dist/src/product-loop/discovery-ecosystem.d.ts +57 -0
- package/dist/src/product-loop/discovery-ecosystem.js +106 -0
- package/dist/src/product-loop/discovery-ecosystem.js.map +1 -0
- package/dist/src/product-loop/discovery-interview.d.ts +40 -0
- package/dist/src/product-loop/discovery-interview.js +176 -0
- package/dist/src/product-loop/discovery-interview.js.map +1 -0
- package/dist/src/product-loop/discovery-migrations.d.ts +5 -0
- package/dist/src/product-loop/discovery-migrations.js +39 -0
- package/dist/src/product-loop/discovery-migrations.js.map +1 -0
- package/dist/src/product-loop/discovery-persistence.d.ts +19 -0
- package/dist/src/product-loop/discovery-persistence.js +182 -0
- package/dist/src/product-loop/discovery-persistence.js.map +1 -0
- package/dist/src/product-loop/discovery-prompt-parser.d.ts +15 -0
- package/dist/src/product-loop/discovery-prompt-parser.js +64 -0
- package/dist/src/product-loop/discovery-prompt-parser.js.map +1 -0
- package/dist/src/product-loop/discovery-recommender.d.ts +50 -0
- package/dist/src/product-loop/discovery-recommender.js +288 -0
- package/dist/src/product-loop/discovery-recommender.js.map +1 -0
- package/dist/src/product-loop/discovery-schema.d.ts +33 -0
- package/dist/src/product-loop/discovery-schema.js +120 -0
- package/dist/src/product-loop/discovery-schema.js.map +1 -0
- package/dist/src/product-loop/done-gate.d.ts +6 -0
- package/dist/src/product-loop/done-gate.js +196 -0
- package/dist/src/product-loop/done-gate.js.map +1 -0
- package/dist/src/product-loop/feedback-routing.d.ts +27 -0
- package/dist/src/product-loop/feedback-routing.js +64 -0
- package/dist/src/product-loop/feedback-routing.js.map +1 -0
- package/dist/src/product-loop/gather.d.ts +17 -0
- package/dist/src/product-loop/gather.js +253 -0
- package/dist/src/product-loop/gather.js.map +1 -0
- package/dist/src/product-loop/index.d.ts +74 -0
- package/dist/src/product-loop/index.js +1154 -0
- package/dist/src/product-loop/index.js.map +1 -0
- package/dist/src/product-loop/loop-driver.d.ts +4 -0
- package/dist/src/product-loop/loop-driver.js +824 -0
- package/dist/src/product-loop/loop-driver.js.map +1 -0
- package/dist/src/product-loop/phase-budget.d.ts +65 -0
- package/dist/src/product-loop/phase-budget.js +114 -0
- package/dist/src/product-loop/phase-budget.js.map +1 -0
- package/dist/src/product-loop/phase-plan.d.ts +21 -0
- package/dist/src/product-loop/phase-plan.js +140 -0
- package/dist/src/product-loop/phase-plan.js.map +1 -0
- package/dist/src/product-loop/phase-rituals.d.ts +38 -0
- package/dist/src/product-loop/phase-rituals.js +106 -0
- package/dist/src/product-loop/phase-rituals.js.map +1 -0
- package/dist/src/product-loop/phase-runner.d.ts +28 -0
- package/dist/src/product-loop/phase-runner.js +383 -0
- package/dist/src/product-loop/phase-runner.js.map +1 -0
- package/dist/src/product-loop/phase-tracker-bridge.d.ts +27 -0
- package/dist/src/product-loop/phase-tracker-bridge.js +37 -0
- package/dist/src/product-loop/phase-tracker-bridge.js.map +1 -0
- package/dist/src/product-loop/product-identity.d.ts +1 -0
- package/dist/src/product-loop/product-identity.js +10 -0
- package/dist/src/product-loop/product-identity.js.map +1 -0
- package/dist/src/product-loop/reality-anchor.d.ts +19 -0
- package/dist/src/product-loop/reality-anchor.js +39 -0
- package/dist/src/product-loop/reality-anchor.js.map +1 -0
- package/dist/src/product-loop/repo-audit.d.ts +46 -0
- package/dist/src/product-loop/repo-audit.js +300 -0
- package/dist/src/product-loop/repo-audit.js.map +1 -0
- package/dist/src/product-loop/role-memory.d.ts +13 -0
- package/dist/src/product-loop/role-memory.js +63 -0
- package/dist/src/product-loop/role-memory.js.map +1 -0
- package/dist/src/product-loop/role-registry.d.ts +22 -0
- package/dist/src/product-loop/role-registry.js +146 -0
- package/dist/src/product-loop/role-registry.js.map +1 -0
- package/dist/src/product-loop/seed-questions.d.ts +7 -0
- package/dist/src/product-loop/seed-questions.js +50 -0
- package/dist/src/product-loop/seed-questions.js.map +1 -0
- package/dist/src/product-loop/ship-polish.d.ts +29 -0
- package/dist/src/product-loop/ship-polish.js +134 -0
- package/dist/src/product-loop/ship-polish.js.map +1 -0
- package/dist/src/product-loop/sprint-runner.d.ts +63 -0
- package/dist/src/product-loop/sprint-runner.js +515 -0
- package/dist/src/product-loop/sprint-runner.js.map +1 -0
- package/dist/src/product-loop/stakeholder-acl.d.ts +16 -0
- package/dist/src/product-loop/stakeholder-acl.js +66 -0
- package/dist/src/product-loop/stakeholder-acl.js.map +1 -0
- package/dist/src/product-loop/typed-artifacts.d.ts +77 -0
- package/dist/src/product-loop/typed-artifacts.js +262 -0
- package/dist/src/product-loop/typed-artifacts.js.map +1 -0
- package/dist/src/product-loop/types.d.ts +395 -0
- package/dist/src/product-loop/types.js +2 -0
- package/dist/src/product-loop/types.js.map +1 -0
- package/dist/src/product-loop/verify-failure-tracking.d.ts +76 -0
- package/dist/src/product-loop/verify-failure-tracking.js +172 -0
- package/dist/src/product-loop/verify-failure-tracking.js.map +1 -0
- package/dist/src/product-loop/verify-result.d.ts +18 -0
- package/dist/src/product-loop/verify-result.js +31 -0
- package/dist/src/product-loop/verify-result.js.map +1 -0
- package/dist/src/providers/__test-utils__/load-fixture.js.map +1 -0
- package/dist/src/providers/__tests__/adapter-oauth-wiring.test.d.ts +8 -0
- package/dist/src/providers/__tests__/adapter-oauth-wiring.test.js +109 -0
- package/dist/src/providers/__tests__/adapter-oauth-wiring.test.js.map +1 -0
- package/dist/src/providers/__tests__/capabilities-cosmetic.test.d.ts +1 -0
- package/dist/src/providers/__tests__/capabilities-cosmetic.test.js +109 -0
- package/dist/src/providers/__tests__/capabilities-cosmetic.test.js.map +1 -0
- package/dist/src/providers/__tests__/capabilities-flags.test.d.ts +1 -0
- package/dist/src/providers/__tests__/capabilities-flags.test.js +145 -0
- package/dist/src/providers/__tests__/capabilities-flags.test.js.map +1 -0
- package/dist/src/providers/__tests__/capabilities-provider-options.test.d.ts +1 -0
- package/dist/src/providers/__tests__/capabilities-provider-options.test.js +179 -0
- package/dist/src/providers/__tests__/capabilities-provider-options.test.js.map +1 -0
- package/dist/src/providers/__tests__/capabilities-sanitize.test.d.ts +1 -0
- package/dist/src/providers/__tests__/capabilities-sanitize.test.js +75 -0
- package/dist/src/providers/__tests__/capabilities-sanitize.test.js.map +1 -0
- package/dist/src/providers/__tests__/capabilities.test.d.ts +1 -0
- package/dist/src/providers/__tests__/capabilities.test.js +41 -0
- package/dist/src/providers/__tests__/capabilities.test.js.map +1 -0
- package/dist/src/providers/__tests__/provider-coverage.test.d.ts +1 -0
- package/dist/src/providers/__tests__/provider-coverage.test.js +45 -0
- package/dist/src/providers/__tests__/provider-coverage.test.js.map +1 -0
- package/dist/src/providers/__tests__/runtime-integration.test.d.ts +1 -0
- package/dist/src/providers/__tests__/runtime-integration.test.js +86 -0
- package/dist/src/providers/__tests__/runtime-integration.test.js.map +1 -0
- package/dist/src/providers/__tests__/runtime.test.d.ts +1 -0
- package/dist/src/providers/__tests__/runtime.test.js +83 -0
- package/dist/src/providers/__tests__/runtime.test.js.map +1 -0
- package/dist/src/providers/__tests__/siliconflow-history.test.d.ts +1 -0
- package/dist/src/providers/__tests__/siliconflow-history.test.js +76 -0
- package/dist/src/providers/__tests__/siliconflow-history.test.js.map +1 -0
- package/dist/src/providers/__tests__/strategies-registry.test.d.ts +8 -0
- package/dist/src/providers/__tests__/strategies-registry.test.js +49 -0
- package/dist/src/providers/__tests__/strategies-registry.test.js.map +1 -0
- package/dist/src/providers/__tests__/strategies-resolve.test.d.ts +12 -0
- package/dist/src/providers/__tests__/strategies-resolve.test.js +128 -0
- package/dist/src/providers/__tests__/strategies-resolve.test.js.map +1 -0
- package/dist/src/providers/__tests__/wire-debug.test.d.ts +1 -0
- package/dist/src/providers/__tests__/wire-debug.test.js +39 -0
- package/dist/src/providers/__tests__/wire-debug.test.js.map +1 -0
- package/dist/src/providers/adapter.d.ts +61 -0
- package/dist/src/providers/adapter.js +127 -0
- package/dist/src/providers/adapter.js.map +1 -0
- package/dist/src/providers/adapter.test.d.ts +1 -0
- package/dist/src/providers/adapter.test.js.map +1 -0
- package/dist/src/providers/anthropic.js +146 -0
- package/dist/src/providers/anthropic.js.map +1 -0
- package/dist/src/providers/auth/__tests__/browser-flow.test.d.ts +8 -0
- package/dist/src/providers/auth/__tests__/browser-flow.test.js +186 -0
- package/dist/src/providers/auth/__tests__/browser-flow.test.js.map +1 -0
- package/dist/src/providers/auth/__tests__/device-flow.test.d.ts +6 -0
- package/dist/src/providers/auth/__tests__/device-flow.test.js +219 -0
- package/dist/src/providers/auth/__tests__/device-flow.test.js.map +1 -0
- package/dist/src/providers/auth/__tests__/gemini-oauth.test.d.ts +8 -0
- package/dist/src/providers/auth/__tests__/gemini-oauth.test.js +310 -0
- package/dist/src/providers/auth/__tests__/gemini-oauth.test.js.map +1 -0
- package/dist/src/providers/auth/__tests__/openai-oauth.test.d.ts +7 -0
- package/dist/src/providers/auth/__tests__/openai-oauth.test.js +309 -0
- package/dist/src/providers/auth/__tests__/openai-oauth.test.js.map +1 -0
- package/dist/src/providers/auth/__tests__/token-store.test.d.ts +7 -0
- package/dist/src/providers/auth/__tests__/token-store.test.js +125 -0
- package/dist/src/providers/auth/__tests__/token-store.test.js.map +1 -0
- package/dist/src/providers/auth/browser-flow.d.ts +60 -0
- package/dist/src/providers/auth/browser-flow.js +78 -0
- package/dist/src/providers/auth/browser-flow.js.map +1 -0
- package/dist/src/providers/auth/device-flow.d.ts +66 -0
- package/dist/src/providers/auth/device-flow.js +147 -0
- package/dist/src/providers/auth/device-flow.js.map +1 -0
- package/dist/src/providers/auth/gemini-oauth.d.ts +55 -0
- package/dist/src/providers/auth/gemini-oauth.js +294 -0
- package/dist/src/providers/auth/gemini-oauth.js.map +1 -0
- package/dist/src/providers/auth/openai-oauth.d.ts +60 -0
- package/dist/src/providers/auth/openai-oauth.js +373 -0
- package/dist/src/providers/auth/openai-oauth.js.map +1 -0
- package/dist/src/providers/auth/registry.d.ts +65 -0
- package/dist/src/providers/auth/registry.js +82 -0
- package/dist/src/providers/auth/registry.js.map +1 -0
- package/dist/src/providers/auth/token-store.d.ts +28 -0
- package/dist/src/providers/auth/token-store.js +134 -0
- package/dist/src/providers/auth/token-store.js.map +1 -0
- package/dist/src/providers/auth/types.d.ts +77 -0
- package/dist/src/providers/auth/types.js +30 -0
- package/dist/src/providers/auth/types.js.map +1 -0
- package/dist/src/providers/capabilities.d.ts +135 -0
- package/dist/src/providers/capabilities.js +241 -0
- package/dist/src/providers/capabilities.js.map +1 -0
- package/dist/src/providers/endpoints.d.ts +25 -0
- package/dist/src/providers/endpoints.js +58 -0
- package/dist/src/providers/endpoints.js.map +1 -0
- package/dist/src/providers/errors.js.map +1 -0
- package/dist/src/providers/errors.test.d.ts +1 -0
- package/dist/src/providers/errors.test.js.map +1 -0
- package/dist/src/providers/gemini.js +38 -0
- package/dist/src/providers/gemini.js.map +1 -0
- package/dist/src/providers/gemini.test.d.ts +1 -0
- package/dist/src/providers/gemini.test.js.map +1 -0
- package/dist/src/providers/index.d.ts +11 -0
- package/dist/src/providers/index.js +15 -0
- package/dist/src/providers/index.js.map +1 -0
- package/dist/src/providers/keychain.d.ts +66 -0
- package/dist/src/providers/keychain.js +250 -0
- package/dist/src/providers/keychain.js.map +1 -0
- package/dist/src/providers/keychain.test.d.ts +1 -0
- package/dist/src/providers/keychain.test.js +84 -0
- package/dist/src/providers/keychain.test.js.map +1 -0
- package/dist/src/providers/mcp-vision-bridge.d.ts +60 -0
- package/dist/src/providers/mcp-vision-bridge.js +861 -0
- package/dist/src/providers/mcp-vision-bridge.js.map +1 -0
- package/dist/src/providers/mcp-vision-bridge.test.d.ts +1 -0
- package/dist/src/providers/mcp-vision-bridge.test.js +381 -0
- package/dist/src/providers/mcp-vision-bridge.test.js.map +1 -0
- package/dist/src/providers/ollama.js.map +1 -0
- package/dist/src/providers/ollama.test.d.ts +1 -0
- package/dist/src/providers/ollama.test.js.map +1 -0
- package/dist/src/providers/openai-compatible.js +54 -0
- package/dist/src/providers/openai-compatible.js.map +1 -0
- package/dist/src/providers/openai-compatible.test.d.ts +1 -0
- package/dist/src/providers/openai-compatible.test.js +53 -0
- package/dist/src/providers/openai-compatible.test.js.map +1 -0
- package/dist/src/providers/openai.d.ts +22 -0
- package/dist/src/providers/openai.js +46 -0
- package/dist/src/providers/openai.js.map +1 -0
- package/dist/src/providers/openai.test.d.ts +1 -0
- package/dist/src/providers/openai.test.js.map +1 -0
- package/dist/src/providers/patch-zod-schema.js +120 -0
- package/dist/src/providers/patch-zod-schema.js.map +1 -0
- package/dist/src/providers/pricing.d.ts +35 -0
- package/dist/src/providers/pricing.js +92 -0
- package/dist/src/providers/pricing.js.map +1 -0
- package/dist/src/providers/pricing.test.d.ts +1 -0
- package/dist/src/providers/pricing.test.js +55 -0
- package/dist/src/providers/pricing.test.js.map +1 -0
- package/dist/src/providers/prompt-cache-key.spec.d.ts +5 -0
- package/dist/src/providers/prompt-cache-key.spec.js +24 -0
- package/dist/src/providers/prompt-cache-key.spec.js.map +1 -0
- package/dist/src/providers/runtime-mock.spec.d.ts +8 -0
- package/dist/src/providers/runtime-mock.spec.js +69 -0
- package/dist/src/providers/runtime-mock.spec.js.map +1 -0
- package/dist/src/providers/runtime.d.ts +90 -0
- package/dist/src/providers/runtime.js +226 -0
- package/dist/src/providers/runtime.js.map +1 -0
- package/dist/src/providers/siliconflow-history.d.ts +50 -0
- package/dist/src/providers/siliconflow-history.js +64 -0
- package/dist/src/providers/siliconflow-history.js.map +1 -0
- package/dist/src/providers/strategies/anthropic.strategy.d.ts +15 -0
- package/dist/src/providers/strategies/anthropic.strategy.js +21 -0
- package/dist/src/providers/strategies/anthropic.strategy.js.map +1 -0
- package/dist/src/providers/strategies/base.strategy.d.ts +52 -0
- package/dist/src/providers/strategies/base.strategy.js +38 -0
- package/dist/src/providers/strategies/base.strategy.js.map +1 -0
- package/dist/src/providers/strategies/deepseek.strategy.d.ts +14 -0
- package/dist/src/providers/strategies/deepseek.strategy.js +22 -0
- package/dist/src/providers/strategies/deepseek.strategy.js.map +1 -0
- package/dist/src/providers/strategies/google.strategy.d.ts +15 -0
- package/dist/src/providers/strategies/google.strategy.js +24 -0
- package/dist/src/providers/strategies/google.strategy.js.map +1 -0
- package/dist/src/providers/strategies/ollama.strategy.d.ts +15 -0
- package/dist/src/providers/strategies/ollama.strategy.js +18 -0
- package/dist/src/providers/strategies/ollama.strategy.js.map +1 -0
- package/dist/src/providers/strategies/openai.strategy.d.ts +23 -0
- package/dist/src/providers/strategies/openai.strategy.js +48 -0
- package/dist/src/providers/strategies/openai.strategy.js.map +1 -0
- package/dist/src/providers/strategies/registry.d.ts +14 -0
- package/dist/src/providers/strategies/registry.js +37 -0
- package/dist/src/providers/strategies/registry.js.map +1 -0
- package/dist/src/providers/strategies/siliconflow.strategy.d.ts +14 -0
- package/dist/src/providers/strategies/siliconflow.strategy.js +22 -0
- package/dist/src/providers/strategies/siliconflow.strategy.js.map +1 -0
- package/dist/src/providers/strategies/xai.strategy.d.ts +14 -0
- package/dist/src/providers/strategies/xai.strategy.js +22 -0
- package/dist/src/providers/strategies/xai.strategy.js.map +1 -0
- package/dist/src/providers/stream-loop.d.ts +20 -0
- package/dist/src/providers/stream-loop.js +79 -0
- package/dist/src/providers/stream-loop.js.map +1 -0
- package/dist/src/providers/types.d.ts +128 -0
- package/dist/src/providers/types.js +31 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/providers/vision-proxy.js +256 -0
- package/dist/src/providers/vision-proxy.js.map +1 -0
- package/dist/src/providers/vision-proxy.test.d.ts +1 -0
- package/dist/src/providers/vision-proxy.test.js +212 -0
- package/dist/src/providers/vision-proxy.test.js.map +1 -0
- package/dist/src/providers/wire-debug.d.ts +28 -0
- package/dist/src/providers/wire-debug.js +146 -0
- package/dist/src/providers/wire-debug.js.map +1 -0
- package/dist/src/router/__tests__/step-router.test.d.ts +4 -0
- package/dist/src/router/__tests__/step-router.test.js +131 -0
- package/dist/src/router/__tests__/step-router.test.js.map +1 -0
- package/dist/src/router/classifier/grammars.js.map +1 -0
- package/dist/src/router/classifier/index.js.map +1 -0
- package/dist/src/router/classifier/index.test.d.ts +1 -0
- package/dist/src/router/classifier/index.test.js.map +1 -0
- package/dist/src/router/classifier/regex.js +104 -0
- package/dist/src/router/classifier/regex.js.map +1 -0
- package/dist/src/router/classifier/regex.test.d.ts +1 -0
- package/dist/src/router/classifier/regex.test.js.map +1 -0
- package/dist/src/router/classifier/tree-sitter.js.map +1 -0
- package/dist/src/router/classifier/tree-sitter.test.d.ts +1 -0
- package/dist/src/router/classifier/tree-sitter.test.js.map +1 -0
- package/dist/src/router/cold.js.map +1 -0
- package/dist/src/router/cold.test.d.ts +1 -0
- package/dist/src/router/cold.test.js +56 -0
- package/dist/src/router/cold.test.js.map +1 -0
- package/dist/src/router/decide.js +410 -0
- package/dist/src/router/decide.js.map +1 -0
- package/dist/src/router/decide.test.d.ts +1 -0
- package/dist/src/router/decide.test.js +116 -0
- package/dist/src/router/decide.test.js.map +1 -0
- package/dist/src/router/health.js.map +1 -0
- package/dist/src/router/health.test.d.ts +1 -0
- package/dist/src/router/health.test.js.map +1 -0
- package/dist/src/router/provider-sentinel.d.ts +16 -0
- package/dist/src/router/provider-sentinel.js +18 -0
- package/dist/src/router/provider-sentinel.js.map +1 -0
- package/dist/src/router/provider-sentinel.test.d.ts +1 -0
- package/dist/src/router/provider-sentinel.test.js +20 -0
- package/dist/src/router/provider-sentinel.test.js.map +1 -0
- package/dist/src/router/step-router.d.ts +57 -0
- package/dist/src/router/step-router.js +143 -0
- package/dist/src/router/step-router.js.map +1 -0
- package/dist/src/router/store.js.map +1 -0
- package/dist/src/router/types.js +2 -0
- package/dist/src/router/types.js.map +1 -0
- package/dist/src/router/warm.js +46 -0
- package/dist/src/router/warm.js.map +1 -0
- package/dist/src/router/warm.test.d.ts +1 -0
- package/dist/src/router/warm.test.js +144 -0
- package/dist/src/router/warm.test.js.map +1 -0
- package/dist/src/scaffold/__tests__/continuation-prompt.test.d.ts +4 -0
- package/dist/src/scaffold/__tests__/continuation-prompt.test.js +79 -0
- package/dist/src/scaffold/__tests__/continuation-prompt.test.js.map +1 -0
- package/dist/src/scaffold/__tests__/continue-as-council.spec.d.ts +10 -0
- package/dist/src/scaffold/__tests__/continue-as-council.spec.js +102 -0
- package/dist/src/scaffold/__tests__/continue-as-council.spec.js.map +1 -0
- package/dist/src/scaffold/__tests__/dotnet-assembly-name.test.d.ts +1 -0
- package/dist/src/scaffold/__tests__/dotnet-assembly-name.test.js +27 -0
- package/dist/src/scaffold/__tests__/dotnet-assembly-name.test.js.map +1 -0
- package/dist/src/scaffold/__tests__/fe-scaffold-contents.test.d.ts +1 -0
- package/dist/src/scaffold/__tests__/fe-scaffold-contents.test.js +106 -0
- package/dist/src/scaffold/__tests__/fe-scaffold-contents.test.js.map +1 -0
- package/dist/src/scaffold/__tests__/init-new.smoke.spec.d.ts +15 -0
- package/dist/src/scaffold/__tests__/init-new.smoke.spec.js +81 -0
- package/dist/src/scaffold/__tests__/init-new.smoke.spec.js.map +1 -0
- package/dist/src/scaffold/__tests__/init-new.spec.d.ts +5 -0
- package/dist/src/scaffold/__tests__/init-new.spec.js +378 -0
- package/dist/src/scaffold/__tests__/init-new.spec.js.map +1 -0
- package/dist/src/scaffold/__tests__/install-bb-templates.spec.d.ts +1 -0
- package/dist/src/scaffold/__tests__/install-bb-templates.spec.js +77 -0
- package/dist/src/scaffold/__tests__/install-bb-templates.spec.js.map +1 -0
- package/dist/src/scaffold/__tests__/point-to-existing.spec.d.ts +7 -0
- package/dist/src/scaffold/__tests__/point-to-existing.spec.js +94 -0
- package/dist/src/scaffold/__tests__/point-to-existing.spec.js.map +1 -0
- package/dist/src/scaffold/bb-ecosystem-apply.d.ts +80 -0
- package/dist/src/scaffold/bb-ecosystem-apply.js +315 -0
- package/dist/src/scaffold/bb-ecosystem-apply.js.map +1 -0
- package/dist/src/scaffold/bb-quality-gate.d.ts +59 -0
- package/dist/src/scaffold/bb-quality-gate.js +185 -0
- package/dist/src/scaffold/bb-quality-gate.js.map +1 -0
- package/dist/src/scaffold/continuation-prompt.d.ts +12 -0
- package/dist/src/scaffold/continuation-prompt.js +66 -0
- package/dist/src/scaffold/continuation-prompt.js.map +1 -0
- package/dist/src/scaffold/continue-as-council.d.ts +47 -0
- package/dist/src/scaffold/continue-as-council.js +60 -0
- package/dist/src/scaffold/continue-as-council.js.map +1 -0
- package/dist/src/scaffold/init-new.d.ts +239 -0
- package/dist/src/scaffold/init-new.js +1414 -0
- package/dist/src/scaffold/init-new.js.map +1 -0
- package/dist/src/scaffold/point-to-existing.d.ts +38 -0
- package/dist/src/scaffold/point-to-existing.js +51 -0
- package/dist/src/scaffold/point-to-existing.js.map +1 -0
- package/dist/src/scaffold/resume-from-gate-failures.d.ts +48 -0
- package/dist/src/scaffold/resume-from-gate-failures.js +113 -0
- package/dist/src/scaffold/resume-from-gate-failures.js.map +1 -0
- package/dist/src/storage/__tests__/migrations.test.js.map +1 -0
- package/dist/src/storage/__tests__/ui-interaction-log.test.d.ts +7 -0
- package/dist/src/storage/__tests__/ui-interaction-log.test.js +97 -0
- package/dist/src/storage/__tests__/ui-interaction-log.test.js.map +1 -0
- package/dist/src/storage/atomic-io.d.ts +30 -0
- package/dist/src/storage/atomic-io.js +163 -0
- package/dist/src/storage/atomic-io.js.map +1 -0
- package/dist/src/storage/atomic-io.test.d.ts +1 -0
- package/dist/src/storage/atomic-io.test.js +74 -0
- package/dist/src/storage/atomic-io.test.js.map +1 -0
- package/dist/src/storage/config.js +39 -0
- package/dist/src/storage/config.js.map +1 -0
- package/dist/src/storage/config.test.d.ts +1 -0
- package/dist/src/storage/config.test.js.map +1 -0
- package/dist/src/storage/db.js +143 -0
- package/dist/src/storage/db.js.map +1 -0
- package/dist/src/storage/index.d.ts +10 -0
- package/dist/src/storage/index.js +12 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/interaction-log.d.ts +33 -0
- package/dist/src/storage/interaction-log.js +73 -0
- package/dist/src/storage/interaction-log.js.map +1 -0
- package/dist/src/storage/migrations.d.ts +2 -0
- package/dist/src/storage/migrations.js +200 -0
- package/dist/src/storage/migrations.js.map +1 -0
- package/dist/src/storage/session-dir.js.map +1 -0
- package/dist/src/storage/sessions.d.ts +22 -0
- package/dist/src/storage/sessions.js +168 -0
- package/dist/src/storage/sessions.js.map +1 -0
- package/dist/src/storage/tool-results.d.ts +4 -0
- package/dist/src/storage/tool-results.js.map +1 -0
- package/dist/src/storage/transcript-view.js +23 -0
- package/dist/src/storage/transcript-view.js.map +1 -0
- package/dist/src/storage/transcript.d.ts +85 -0
- package/dist/src/storage/transcript.js +461 -0
- package/dist/src/storage/transcript.js.map +1 -0
- package/dist/src/storage/transcript.test.d.ts +1 -0
- package/dist/src/storage/transcript.test.js +22 -0
- package/dist/src/storage/transcript.test.js.map +1 -0
- package/dist/src/storage/ui-interaction-log.d.ts +146 -0
- package/dist/src/storage/ui-interaction-log.js +34 -0
- package/dist/src/storage/ui-interaction-log.js.map +1 -0
- package/dist/src/storage/usage-cap.js.map +1 -0
- package/dist/src/storage/usage-cap.test.d.ts +1 -0
- package/dist/src/storage/usage-cap.test.js.map +1 -0
- package/dist/src/storage/usage.d.ts +11 -0
- package/dist/src/storage/usage.js +65 -0
- package/dist/src/storage/usage.js.map +1 -0
- package/dist/src/storage/workspaces.d.ts +9 -0
- package/dist/src/storage/workspaces.js +60 -0
- package/dist/src/storage/workspaces.js.map +1 -0
- package/dist/src/tools/bash.d.ts +53 -0
- package/dist/src/tools/bash.js +593 -0
- package/dist/src/tools/bash.js.map +1 -0
- package/dist/src/tools/bash.test.d.ts +1 -0
- package/dist/src/tools/bash.test.js +268 -0
- package/dist/src/tools/bash.test.js.map +1 -0
- package/dist/src/tools/computer.d.ts +88 -0
- package/dist/src/tools/computer.js.map +1 -0
- package/dist/src/tools/computer.test.d.ts +1 -0
- package/dist/src/tools/computer.test.js +142 -0
- package/dist/src/tools/computer.test.js.map +1 -0
- package/dist/src/tools/file-tracker.d.ts +35 -0
- package/dist/src/tools/file-tracker.js +40 -0
- package/dist/src/tools/file-tracker.js.map +1 -0
- package/dist/src/tools/file-tracker.test.d.ts +1 -0
- package/dist/src/tools/file-tracker.test.js +77 -0
- package/dist/src/tools/file-tracker.test.js.map +1 -0
- package/dist/src/tools/file.d.ts +18 -0
- package/dist/src/tools/file.js +135 -0
- package/dist/src/tools/file.js.map +1 -0
- package/dist/src/tools/file.test.d.ts +1 -0
- package/dist/src/tools/file.test.js +58 -0
- package/dist/src/tools/file.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +8 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/registry.d.ts +21 -0
- package/dist/src/tools/registry.js +346 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/registry.test.d.ts +1 -0
- package/dist/src/tools/registry.test.js +34 -0
- package/dist/src/tools/registry.test.js.map +1 -0
- package/dist/src/tools/schedule.js +498 -0
- package/dist/src/tools/schedule.js.map +1 -0
- package/dist/src/tools/schedule.test.d.ts +1 -0
- package/dist/src/tools/schedule.test.js +118 -0
- package/dist/src/tools/schedule.test.js.map +1 -0
- package/dist/src/types/index.d.ts +396 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/ui/agents-modal.d.ts +36 -0
- package/dist/src/ui/agents-modal.js +55 -0
- package/dist/src/ui/agents-modal.js.map +1 -0
- package/dist/src/ui/app.d.ts +20 -0
- package/dist/src/ui/app.js +5423 -0
- package/dist/src/ui/app.js.map +1 -0
- package/dist/src/ui/cards/__tests__/product-status-card.test.d.ts +1 -0
- package/dist/src/ui/cards/__tests__/product-status-card.test.js +27 -0
- package/dist/src/ui/cards/__tests__/product-status-card.test.js.map +1 -0
- package/dist/src/ui/cards/product-status-card.d.ts +25 -0
- package/dist/src/ui/cards/product-status-card.js +55 -0
- package/dist/src/ui/cards/product-status-card.js.map +1 -0
- package/dist/src/ui/components/SuggestionOverlay.js.map +1 -0
- package/dist/src/ui/components/Toast.d.ts +23 -0
- package/dist/src/ui/components/Toast.js +70 -0
- package/dist/src/ui/components/Toast.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-leader-bubble.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-leader-bubble.test.js +14 -0
- package/dist/src/ui/components/__tests__/council-leader-bubble.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-message-bubble.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-message-bubble.test.js +74 -0
- package/dist/src/ui/components/__tests__/council-message-bubble.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-phase-timeline.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-phase-timeline.test.js +51 -0
- package/dist/src/ui/components/__tests__/council-phase-timeline.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-placeholder-bubble.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-placeholder-bubble.test.js +14 -0
- package/dist/src/ui/components/__tests__/council-placeholder-bubble.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-question-card.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-question-card.test.js +121 -0
- package/dist/src/ui/components/__tests__/council-question-card.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/council-synthesis-banner.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/council-synthesis-banner.test.js +11 -0
- package/dist/src/ui/components/__tests__/council-synthesis-banner.test.js.map +1 -0
- package/dist/src/ui/components/__tests__/use-pair-quote-buffer.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/use-pair-quote-buffer.test.js +37 -0
- package/dist/src/ui/components/__tests__/use-pair-quote-buffer.test.js.map +1 -0
- package/dist/src/ui/components/btw-overlay.js.map +1 -0
- package/dist/src/ui/components/bubble-layout.d.ts +36 -0
- package/dist/src/ui/components/bubble-layout.js +43 -0
- package/dist/src/ui/components/bubble-layout.js.map +1 -0
- package/dist/src/ui/components/code-block-truncate.d.ts +8 -0
- package/dist/src/ui/components/code-block-truncate.js +22 -0
- package/dist/src/ui/components/code-block-truncate.js.map +1 -0
- package/dist/src/ui/components/copy-flash-banner.d.ts +5 -0
- package/dist/src/ui/components/copy-flash-banner.js +5 -0
- package/dist/src/ui/components/copy-flash-banner.js.map +1 -0
- package/dist/src/ui/components/council-info-card.d.ts +9 -0
- package/dist/src/ui/components/council-info-card.js +10 -0
- package/dist/src/ui/components/council-info-card.js.map +1 -0
- package/dist/src/ui/components/council-leader-bubble.d.ts +11 -0
- package/dist/src/ui/components/council-leader-bubble.js +17 -0
- package/dist/src/ui/components/council-leader-bubble.js.map +1 -0
- package/dist/src/ui/components/council-message-bubble.d.ts +21 -0
- package/dist/src/ui/components/council-message-bubble.js +47 -0
- package/dist/src/ui/components/council-message-bubble.js.map +1 -0
- package/dist/src/ui/components/council-phase-timeline.d.ts +14 -0
- package/dist/src/ui/components/council-phase-timeline.js +64 -0
- package/dist/src/ui/components/council-phase-timeline.js.map +1 -0
- package/dist/src/ui/components/council-placeholder-bubble.d.ts +22 -0
- package/dist/src/ui/components/council-placeholder-bubble.js +37 -0
- package/dist/src/ui/components/council-placeholder-bubble.js.map +1 -0
- package/dist/src/ui/components/council-question-card.d.ts +64 -0
- package/dist/src/ui/components/council-question-card.js +135 -0
- package/dist/src/ui/components/council-question-card.js.map +1 -0
- package/dist/src/ui/components/council-status-list.d.ts +15 -0
- package/dist/src/ui/components/council-status-list.js +83 -0
- package/dist/src/ui/components/council-status-list.js.map +1 -0
- package/dist/src/ui/components/council-synthesis-banner.d.ts +10 -0
- package/dist/src/ui/components/council-synthesis-banner.js +15 -0
- package/dist/src/ui/components/council-synthesis-banner.js.map +1 -0
- package/dist/src/ui/components/diff-view.d.ts +31 -0
- package/dist/src/ui/components/diff-view.js +109 -0
- package/dist/src/ui/components/diff-view.js.map +1 -0
- package/dist/src/ui/components/halt-recovery-card.d.ts +9 -0
- package/dist/src/ui/components/halt-recovery-card.js +26 -0
- package/dist/src/ui/components/halt-recovery-card.js.map +1 -0
- package/dist/src/ui/components/hero-logo.d.ts +4 -0
- package/dist/src/ui/components/hero-logo.js +41 -0
- package/dist/src/ui/components/hero-logo.js.map +1 -0
- package/dist/src/ui/components/init-new-form-card.d.ts +109 -0
- package/dist/src/ui/components/init-new-form-card.js +106 -0
- package/dist/src/ui/components/init-new-form-card.js.map +1 -0
- package/dist/src/ui/components/lsp-views.d.ts +14 -0
- package/dist/src/ui/components/lsp-views.js +34 -0
- package/dist/src/ui/components/lsp-views.js.map +1 -0
- package/dist/src/ui/components/media-views.d.ts +13 -0
- package/dist/src/ui/components/media-views.js +29 -0
- package/dist/src/ui/components/media-views.js.map +1 -0
- package/dist/src/ui/components/message-view.d.ts +31 -0
- package/dist/src/ui/components/message-view.js +174 -0
- package/dist/src/ui/components/message-view.js.map +1 -0
- package/dist/src/ui/components/point-to-existing-form-card.d.ts +33 -0
- package/dist/src/ui/components/point-to-existing-form-card.js +34 -0
- package/dist/src/ui/components/point-to-existing-form-card.js.map +1 -0
- package/dist/src/ui/components/prompt-box.d.ts +50 -0
- package/dist/src/ui/components/prompt-box.js +66 -0
- package/dist/src/ui/components/prompt-box.js.map +1 -0
- package/dist/src/ui/components/role-palette.d.ts +22 -0
- package/dist/src/ui/components/role-palette.js +50 -0
- package/dist/src/ui/components/role-palette.js.map +1 -0
- package/dist/src/ui/components/session-header.d.ts +14 -0
- package/dist/src/ui/components/session-header.js +24 -0
- package/dist/src/ui/components/session-header.js.map +1 -0
- package/dist/src/ui/components/slash-inline-menu.d.ts +7 -0
- package/dist/src/ui/components/slash-inline-menu.js +14 -0
- package/dist/src/ui/components/slash-inline-menu.js.map +1 -0
- package/dist/src/ui/components/structured-response-view.d.ts +7 -0
- package/dist/src/ui/components/structured-response-view.js +59 -0
- package/dist/src/ui/components/structured-response-view.js.map +1 -0
- package/dist/src/ui/components/tool-result-views.d.ts +60 -0
- package/dist/src/ui/components/tool-result-views.js +83 -0
- package/dist/src/ui/components/tool-result-views.js.map +1 -0
- package/dist/src/ui/components/use-pair-quote-buffer.d.ts +11 -0
- package/dist/src/ui/components/use-pair-quote-buffer.js +17 -0
- package/dist/src/ui/components/use-pair-quote-buffer.js.map +1 -0
- package/dist/src/ui/constants.d.ts +37 -0
- package/dist/src/ui/constants.js +221 -0
- package/dist/src/ui/constants.js.map +1 -0
- package/dist/src/ui/hooks/use-agent-editor.d.ts +40 -0
- package/dist/src/ui/hooks/use-agent-editor.js +54 -0
- package/dist/src/ui/hooks/use-agent-editor.js.map +1 -0
- package/dist/src/ui/hooks/use-mcp-editor.d.ts +24 -0
- package/dist/src/ui/hooks/use-mcp-editor.js +38 -0
- package/dist/src/ui/hooks/use-mcp-editor.js.map +1 -0
- package/dist/src/ui/hooks/use-model-picker.d.ts +26 -0
- package/dist/src/ui/hooks/use-model-picker.js +44 -0
- package/dist/src/ui/hooks/use-model-picker.js.map +1 -0
- package/dist/src/ui/hooks/useTypeahead.js +127 -0
- package/dist/src/ui/hooks/useTypeahead.js.map +1 -0
- package/dist/src/ui/markdown.d.ts +5 -0
- package/dist/src/ui/markdown.js.map +1 -0
- package/dist/src/ui/mcp-modal-types.d.ts +24 -0
- package/dist/src/ui/mcp-modal-types.js.map +1 -0
- package/dist/src/ui/mcp-modal.d.ts +33 -0
- package/dist/src/ui/mcp-modal.js +95 -0
- package/dist/src/ui/mcp-modal.js.map +1 -0
- package/dist/src/ui/modals/api-key-modal.d.ts +11 -0
- package/dist/src/ui/modals/api-key-modal.js +15 -0
- package/dist/src/ui/modals/api-key-modal.js.map +1 -0
- package/dist/src/ui/modals/connect-modal.d.ts +30 -0
- package/dist/src/ui/modals/connect-modal.js +34 -0
- package/dist/src/ui/modals/connect-modal.js.map +1 -0
- package/dist/src/ui/modals/model-picker-modal.d.ts +50 -0
- package/dist/src/ui/modals/model-picker-modal.js +57 -0
- package/dist/src/ui/modals/model-picker-modal.js.map +1 -0
- package/dist/src/ui/modals/sandbox-picker-modal.d.ts +12 -0
- package/dist/src/ui/modals/sandbox-picker-modal.js +18 -0
- package/dist/src/ui/modals/sandbox-picker-modal.js.map +1 -0
- package/dist/src/ui/modals/update-modal.d.ts +8 -0
- package/dist/src/ui/modals/update-modal.js +10 -0
- package/dist/src/ui/modals/update-modal.js.map +1 -0
- package/dist/src/ui/modals/wallet-picker-modal.d.ts +26 -0
- package/dist/src/ui/modals/wallet-picker-modal.js +33 -0
- package/dist/src/ui/modals/wallet-picker-modal.js.map +1 -0
- package/dist/src/ui/plan.d.ts +24 -0
- package/dist/src/ui/plan.js.map +1 -0
- package/dist/src/ui/schedule-modal.d.ts +15 -0
- package/dist/src/ui/schedule-modal.js +37 -0
- package/dist/src/ui/schedule-modal.js.map +1 -0
- package/dist/src/ui/slash/__tests__/clear.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/compact.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/cost.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/discuss.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/discuss.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/execute.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/execute.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/expand.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/ideal.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/ideal.test.js +117 -0
- package/dist/src/ui/slash/__tests__/ideal.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/menu-parity.test.d.ts +15 -0
- package/dist/src/ui/slash/__tests__/menu-parity.test.js +41 -0
- package/dist/src/ui/slash/__tests__/menu-parity.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/optimize.test.js +130 -0
- package/dist/src/ui/slash/__tests__/optimize.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/pin.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/pin.test.js +38 -0
- package/dist/src/ui/slash/__tests__/pin.test.js.map +1 -0
- package/dist/src/ui/slash/__tests__/plan.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/plan.test.js.map +1 -0
- package/dist/src/ui/slash/clear.js.map +1 -0
- package/dist/src/ui/slash/compact.js.map +1 -0
- package/dist/src/ui/slash/cost.js +55 -0
- package/dist/src/ui/slash/cost.js.map +1 -0
- package/dist/src/ui/slash/council-inspect.d.ts +9 -0
- package/dist/src/ui/slash/council-inspect.js +146 -0
- package/dist/src/ui/slash/council-inspect.js.map +1 -0
- package/dist/src/ui/slash/council.js +23 -0
- package/dist/src/ui/slash/council.js.map +1 -0
- package/dist/src/ui/slash/debug.js +109 -0
- package/dist/src/ui/slash/debug.js.map +1 -0
- package/dist/src/ui/slash/discuss.js.map +1 -0
- package/dist/src/ui/slash/ee.js +271 -0
- package/dist/src/ui/slash/ee.js.map +1 -0
- package/dist/src/ui/slash/execute.js.map +1 -0
- package/dist/src/ui/slash/expand.js.map +1 -0
- package/dist/src/ui/slash/export.d.ts +20 -0
- package/dist/src/ui/slash/export.js +253 -0
- package/dist/src/ui/slash/export.js.map +1 -0
- package/dist/src/ui/slash/ideal.d.ts +60 -0
- package/dist/src/ui/slash/ideal.js +198 -0
- package/dist/src/ui/slash/ideal.js.map +1 -0
- package/dist/src/ui/slash/menu-items.d.ts +42 -0
- package/dist/src/ui/slash/menu-items.js +92 -0
- package/dist/src/ui/slash/menu-items.js.map +1 -0
- package/dist/src/ui/slash/optimize.js +37 -0
- package/dist/src/ui/slash/optimize.js.map +1 -0
- package/dist/src/ui/slash/pin.d.ts +15 -0
- package/dist/src/ui/slash/pin.js +36 -0
- package/dist/src/ui/slash/pin.js.map +1 -0
- package/dist/src/ui/slash/plan.js.map +1 -0
- package/dist/src/ui/slash/registry.d.ts +32 -0
- package/dist/src/ui/slash/registry.js.map +1 -0
- package/dist/src/ui/slash/route.js.map +1 -0
- package/dist/src/ui/slash/route.test.js.map +1 -0
- package/dist/src/ui/status-bar/index.d.ts +14 -0
- package/dist/src/ui/status-bar/index.js +79 -0
- package/dist/src/ui/status-bar/index.js.map +1 -0
- package/dist/src/ui/status-bar/index.test.d.ts +1 -0
- package/dist/src/ui/status-bar/index.test.js.map +1 -0
- package/dist/src/ui/status-bar/store.js +161 -0
- package/dist/src/ui/status-bar/store.js.map +1 -0
- package/dist/src/ui/status-bar/store.test.d.ts +1 -0
- package/dist/src/ui/status-bar/store.test.js.map +1 -0
- package/dist/src/ui/status-bar/tier-badge.js.map +1 -0
- package/dist/src/ui/status-bar/tier-badge.test.d.ts +1 -0
- package/dist/src/ui/status-bar/tier-badge.test.js.map +1 -0
- package/dist/src/ui/status-bar/usd-meter.js.map +1 -0
- package/dist/src/ui/status-bar/usd-meter.test.d.ts +1 -0
- package/dist/src/ui/status-bar/usd-meter.test.js.map +1 -0
- package/dist/src/ui/syntax-highlight.d.ts +8 -0
- package/dist/src/ui/syntax-highlight.js +623 -0
- package/dist/src/ui/syntax-highlight.js.map +1 -0
- package/dist/src/ui/terminal-selection-text.js.map +1 -0
- package/dist/src/ui/theme.d.ts +91 -0
- package/dist/src/ui/theme.js +94 -0
- package/dist/src/ui/theme.js.map +1 -0
- package/dist/src/ui/types.d.ts +82 -0
- package/dist/src/ui/types.js +2 -0
- package/dist/src/ui/types.js.map +1 -0
- package/dist/src/ui/utils/color.d.ts +1 -0
- package/dist/src/ui/utils/color.js +18 -0
- package/dist/src/ui/utils/color.js.map +1 -0
- package/dist/src/ui/utils/format.d.ts +21 -0
- package/dist/src/ui/utils/format.js +75 -0
- package/dist/src/ui/utils/format.js.map +1 -0
- package/dist/src/ui/utils/modal.d.ts +3 -0
- package/dist/src/ui/utils/modal.js +7 -0
- package/dist/src/ui/utils/modal.js.map +1 -0
- package/dist/src/ui/utils/text.d.ts +6 -0
- package/dist/src/ui/utils/text.js +31 -0
- package/dist/src/ui/utils/text.js.map +1 -0
- package/dist/src/ui/utils/tools.d.ts +8 -0
- package/dist/src/ui/utils/tools.js +123 -0
- package/dist/src/ui/utils/tools.js.map +1 -0
- package/dist/src/usage/__tests__/product-ledger.test.d.ts +1 -0
- package/dist/src/usage/__tests__/product-ledger.test.js +59 -0
- package/dist/src/usage/__tests__/product-ledger.test.js.map +1 -0
- package/dist/src/usage/cost-log.d.ts +65 -0
- package/dist/src/usage/cost-log.js +117 -0
- package/dist/src/usage/cost-log.js.map +1 -0
- package/dist/src/usage/decision-log.d.ts +32 -0
- package/dist/src/usage/decision-log.js +70 -0
- package/dist/src/usage/decision-log.js.map +1 -0
- package/dist/src/usage/downgrade.js.map +1 -0
- package/dist/src/usage/downgrade.test.d.ts +1 -0
- package/dist/src/usage/downgrade.test.js.map +1 -0
- package/dist/src/usage/estimator.d.ts +26 -0
- package/dist/src/usage/estimator.js +46 -0
- package/dist/src/usage/estimator.js.map +1 -0
- package/dist/src/usage/estimator.test.d.ts +1 -0
- package/dist/src/usage/estimator.test.js.map +1 -0
- package/dist/src/usage/ledger.d.ts +48 -0
- package/dist/src/usage/ledger.js +208 -0
- package/dist/src/usage/ledger.js.map +1 -0
- package/dist/src/usage/ledger.test.d.ts +1 -0
- package/dist/src/usage/ledger.test.js.map +1 -0
- package/dist/src/usage/midstream.js.map +1 -0
- package/dist/src/usage/midstream.test.d.ts +1 -0
- package/dist/src/usage/midstream.test.js.map +1 -0
- package/dist/src/usage/product-ledger.d.ts +47 -0
- package/dist/src/usage/product-ledger.js +73 -0
- package/dist/src/usage/product-ledger.js.map +1 -0
- package/dist/src/usage/thresholds.js.map +1 -0
- package/dist/src/usage/thresholds.test.d.ts +1 -0
- package/dist/src/usage/thresholds.test.js.map +1 -0
- package/dist/src/usage/types.d.ts +31 -0
- package/dist/src/usage/types.js.map +1 -0
- package/dist/src/utils/__tests__/auto-council-settings.test.d.ts +1 -0
- package/dist/src/utils/__tests__/auto-council-settings.test.js +41 -0
- package/dist/src/utils/__tests__/auto-council-settings.test.js.map +1 -0
- package/dist/src/utils/__tests__/ee-logger.test.d.ts +11 -0
- package/dist/src/utils/__tests__/ee-logger.test.js +165 -0
- package/dist/src/utils/__tests__/ee-logger.test.js.map +1 -0
- package/dist/src/utils/__tests__/file-lock.test.d.ts +1 -0
- package/dist/src/utils/__tests__/file-lock.test.js +66 -0
- package/dist/src/utils/__tests__/file-lock.test.js.map +1 -0
- package/dist/src/utils/__tests__/rate-limit.test.d.ts +1 -0
- package/dist/src/utils/__tests__/rate-limit.test.js +38 -0
- package/dist/src/utils/__tests__/rate-limit.test.js.map +1 -0
- package/dist/src/utils/__tests__/settings-disabled-models.test.d.ts +7 -0
- package/dist/src/utils/__tests__/settings-disabled-models.test.js +99 -0
- package/dist/src/utils/__tests__/settings-disabled-models.test.js.map +1 -0
- package/dist/src/utils/__tests__/settings-web-research.test.d.ts +1 -0
- package/dist/src/utils/__tests__/settings-web-research.test.js +46 -0
- package/dist/src/utils/__tests__/settings-web-research.test.js.map +1 -0
- package/dist/src/utils/__tests__/slugify.test.d.ts +1 -0
- package/dist/src/utils/__tests__/slugify.test.js +37 -0
- package/dist/src/utils/__tests__/slugify.test.js.map +1 -0
- package/dist/src/utils/__tests__/visible-retry.test.d.ts +1 -0
- package/dist/src/utils/__tests__/visible-retry.test.js +143 -0
- package/dist/src/utils/__tests__/visible-retry.test.js.map +1 -0
- package/dist/src/utils/at-mentions.js.map +1 -0
- package/dist/src/utils/clipboard-image.js +146 -0
- package/dist/src/utils/clipboard-image.js.map +1 -0
- package/dist/src/utils/ee-logger.d.ts +65 -0
- package/dist/src/utils/ee-logger.js +150 -0
- package/dist/src/utils/ee-logger.js.map +1 -0
- package/dist/src/utils/file-index.js.map +1 -0
- package/dist/src/utils/file-lock.d.ts +5 -0
- package/dist/src/utils/file-lock.js +58 -0
- package/dist/src/utils/file-lock.js.map +1 -0
- package/dist/src/utils/git-root.js.map +1 -0
- package/dist/src/utils/host-clipboard.d.ts +10 -0
- package/dist/src/utils/host-clipboard.js +69 -0
- package/dist/src/utils/host-clipboard.js.map +1 -0
- package/dist/src/utils/install-manager.js.map +1 -0
- package/dist/src/utils/install-manager.test.d.ts +1 -0
- package/dist/src/utils/install-manager.test.js +127 -0
- package/dist/src/utils/install-manager.test.js.map +1 -0
- package/dist/src/utils/instructions.js +140 -0
- package/dist/src/utils/instructions.js.map +1 -0
- package/dist/src/utils/instructions.test.d.ts +1 -0
- package/dist/src/utils/instructions.test.js +93 -0
- package/dist/src/utils/instructions.test.js.map +1 -0
- package/dist/src/utils/permission-mode.js.map +1 -0
- package/dist/src/utils/permission-mode.test.d.ts +1 -0
- package/dist/src/utils/permission-mode.test.js.map +1 -0
- package/dist/src/utils/rate-limit.d.ts +4 -0
- package/dist/src/utils/rate-limit.js +21 -0
- package/dist/src/utils/rate-limit.js.map +1 -0
- package/dist/src/utils/redactor.js.map +1 -0
- package/dist/src/utils/redactor.test.d.ts +1 -0
- package/dist/src/utils/redactor.test.js +84 -0
- package/dist/src/utils/redactor.test.js.map +1 -0
- package/dist/src/utils/settings.d.ts +346 -0
- package/dist/src/utils/settings.js +791 -0
- package/dist/src/utils/settings.js.map +1 -0
- package/dist/src/utils/settings.test.d.ts +1 -0
- package/dist/src/utils/settings.test.js +160 -0
- package/dist/src/utils/settings.test.js.map +1 -0
- package/dist/src/utils/shell.d.ts +34 -0
- package/dist/src/utils/shell.js +171 -0
- package/dist/src/utils/shell.js.map +1 -0
- package/dist/src/utils/shell.test.d.ts +1 -0
- package/dist/src/utils/shell.test.js +71 -0
- package/dist/src/utils/shell.test.js.map +1 -0
- package/dist/src/utils/side-question.js.map +1 -0
- package/dist/src/utils/skills.js +194 -0
- package/dist/src/utils/skills.js.map +1 -0
- package/dist/src/utils/skills.test.d.ts +1 -0
- package/dist/src/utils/skills.test.js +45 -0
- package/dist/src/utils/skills.test.js.map +1 -0
- package/dist/src/utils/slugify.d.ts +1 -0
- package/dist/src/utils/slugify.js +10 -0
- package/dist/src/utils/slugify.js.map +1 -0
- package/dist/src/utils/subagent-display.js.map +1 -0
- package/dist/src/utils/subagent-display.test.d.ts +1 -0
- package/dist/src/utils/subagent-display.test.js +21 -0
- package/dist/src/utils/subagent-display.test.js.map +1 -0
- package/dist/src/utils/subagents-settings.test.d.ts +1 -0
- package/dist/src/utils/subagents-settings.test.js +58 -0
- package/dist/src/utils/subagents-settings.test.js.map +1 -0
- package/dist/src/utils/telegram-audio-settings.test.d.ts +1 -0
- package/dist/src/utils/telegram-audio-settings.test.js +39 -0
- package/dist/src/utils/telegram-audio-settings.test.js.map +1 -0
- package/dist/src/utils/update-checker.js +22 -0
- package/dist/src/utils/update-checker.js.map +1 -0
- package/dist/src/utils/update-checker.test.d.ts +1 -0
- package/dist/src/utils/update-checker.test.js +125 -0
- package/dist/src/utils/update-checker.test.js.map +1 -0
- package/dist/src/utils/visible-retry.d.ts +20 -0
- package/dist/src/utils/visible-retry.js +34 -0
- package/dist/src/utils/visible-retry.js.map +1 -0
- package/dist/src/verify/__tests__/coverage-parsers.test.d.ts +1 -0
- package/dist/src/verify/__tests__/coverage-parsers.test.js +69 -0
- package/dist/src/verify/__tests__/coverage-parsers.test.js.map +1 -0
- package/dist/src/verify/__tests__/dotnet-recipe.test.d.ts +10 -0
- package/dist/src/verify/__tests__/dotnet-recipe.test.js +70 -0
- package/dist/src/verify/__tests__/dotnet-recipe.test.js.map +1 -0
- package/dist/src/verify/checkpoint.d.ts +11 -0
- package/dist/src/verify/checkpoint.js.map +1 -0
- package/dist/src/verify/checkpoint.test.d.ts +1 -0
- package/dist/src/verify/checkpoint.test.js +160 -0
- package/dist/src/verify/checkpoint.test.js.map +1 -0
- package/dist/src/verify/coverage-parsers.d.ts +29 -0
- package/dist/src/verify/coverage-parsers.js +72 -0
- package/dist/src/verify/coverage-parsers.js.map +1 -0
- package/dist/src/verify/entrypoint.d.ts +30 -0
- package/dist/src/verify/entrypoint.js +349 -0
- package/dist/src/verify/entrypoint.js.map +1 -0
- package/dist/src/verify/entrypoint.test.d.ts +1 -0
- package/dist/src/verify/entrypoint.test.js +233 -0
- package/dist/src/verify/entrypoint.test.js.map +1 -0
- package/dist/src/verify/environment.d.ts +9 -0
- package/dist/src/verify/environment.js +116 -0
- package/dist/src/verify/environment.js.map +1 -0
- package/dist/src/verify/environment.test.d.ts +1 -0
- package/dist/src/verify/environment.test.js +94 -0
- package/dist/src/verify/environment.test.js.map +1 -0
- package/dist/src/verify/evidence.d.ts +10 -0
- package/dist/src/verify/evidence.js.map +1 -0
- package/dist/src/verify/orchestrator.d.ts +25 -0
- package/dist/src/verify/orchestrator.js +87 -0
- package/dist/src/verify/orchestrator.js.map +1 -0
- package/dist/src/verify/orchestrator.test.d.ts +1 -0
- package/dist/src/verify/orchestrator.test.js +126 -0
- package/dist/src/verify/orchestrator.test.js.map +1 -0
- package/dist/src/verify/recipes.d.ts +22 -0
- package/dist/src/verify/recipes.js +528 -0
- package/dist/src/verify/recipes.js.map +1 -0
- package/dist/src/verify/retry.d.ts +4 -0
- package/dist/src/verify/retry.js.map +1 -0
- package/dist/src/verify/runtime-prep.test.d.ts +1 -0
- package/dist/src/verify/runtime-prep.test.js +38 -0
- package/dist/src/verify/runtime-prep.test.js.map +1 -0
- package/package.json +38 -10
- package/src/__test-stubs__/vitest-setup.ts +36 -0
- package/src/__tests__/council/bubble-layout.test.ts +45 -0
- package/src/__tests__/council/code-block-truncate.test.ts +50 -0
- package/src/__tests__/council/role-palette.test.ts +66 -0
- package/src/__tests__/first-run-wizard.test.ts +9 -0
- package/src/agent-harness/__tests__/cli-flags.spec.ts +35 -0
- package/src/agent-harness/__tests__/driver.spec.ts +154 -0
- package/src/agent-harness/__tests__/idle.spec.ts +90 -0
- package/src/agent-harness/__tests__/mock-llm.spec.ts +126 -0
- package/src/agent-harness/__tests__/mock-model.spec.ts +195 -0
- package/src/agent-harness/__tests__/predicate.spec.ts +33 -0
- package/src/agent-harness/__tests__/protocol.spec.ts +62 -0
- package/src/agent-harness/__tests__/schema.spec.ts +81 -0
- package/src/agent-harness/__tests__/selector.spec.ts +82 -0
- package/src/agent-harness/__tests__/sidechannel.spec.ts +40 -0
- package/src/agent-harness/__tests__/spec-helpers.spec.ts +76 -0
- package/src/agent-harness/index.ts +24 -0
- package/src/agent-harness/mock-model.ts +394 -0
- package/src/agent-harness/test-spawn.ts +200 -0
- package/src/chat/__tests__/broadcast-bus.test.ts +90 -0
- package/src/chat/__tests__/channel-manager.test.ts +149 -0
- package/src/chat/__tests__/client.test.ts +118 -0
- package/src/chat/__tests__/discord-integration.test.ts +162 -0
- package/src/chat/__tests__/intent-prompt.test.ts +92 -0
- package/src/chat/__tests__/verdict-resolver.test.ts +336 -0
- package/src/chat/broadcast-bus.ts +53 -0
- package/src/chat/channel-manager.ts +146 -0
- package/src/chat/chat-keychain.ts +129 -0
- package/src/chat/factory.ts +37 -0
- package/src/chat/intent-prompt.ts +72 -0
- package/src/chat/providers/discord/client.ts +91 -0
- package/src/chat/types.ts +42 -0
- package/src/chat/verdict-constants.ts +26 -0
- package/src/chat/verdict-resolver.ts +231 -0
- package/src/cli/__tests__/bw-vault.test.ts +97 -0
- package/src/cli/__tests__/keys-bundle.test.ts +46 -0
- package/src/cli/__tests__/share-cmd.test.ts +197 -0
- package/src/cli/bw-vault.ts +184 -0
- package/src/cli/config/__tests__/model-picker.test.ts +59 -0
- package/src/cli/config/__tests__/provider-fetch.test.ts +38 -0
- package/src/cli/config/index.ts +112 -0
- package/src/cli/config/model-picker.ts +193 -0
- package/src/cli/config/provider-fetch.ts +75 -0
- package/src/cli/config/screen-council.ts +245 -0
- package/src/cli/config/screen-models.ts +104 -0
- package/src/cli/config/screen-providers.ts +197 -0
- package/src/cli/config/tui.ts +153 -0
- package/src/cli/cost-forensics.test.ts +128 -0
- package/src/cli/cost-forensics.ts +264 -0
- package/src/cli/keys-bundle.ts +91 -0
- package/src/cli/keys.test.ts +104 -0
- package/src/cli/keys.ts +787 -0
- package/src/cli/pil-report.ts +202 -0
- package/src/cli/share-cmd.ts +132 -0
- package/src/cli/usage-report.ts +266 -0
- package/src/council/__tests__/accounting.test.ts +72 -0
- package/src/council/__tests__/audit-replay.test.ts +344 -0
- package/src/council/__tests__/clarifier-max-rounds.test.ts +91 -0
- package/src/council/__tests__/clarifier-options.test.ts +63 -0
- package/src/council/__tests__/cost-aware.test.ts +60 -0
- package/src/council/__tests__/debate-planner-structured.test.ts +236 -0
- package/src/council/__tests__/evaluator-metrics.test.ts +513 -0
- package/src/council/__tests__/parse-outcome-fallback.test.ts +125 -0
- package/src/council/__tests__/research-tools.test.ts +239 -0
- package/src/council/__tests__/round-tools.test.ts +334 -0
- package/src/council/__tests__/tool-trace.test.ts +152 -0
- package/src/council/__tests__/types-contract.test.ts +88 -0
- package/src/council/clarifier.ts +409 -0
- package/src/council/context.ts +250 -0
- package/src/council/debate-planner.ts +264 -0
- package/src/council/debate.ts +1179 -0
- package/src/council/executor.ts +27 -0
- package/src/council/index.ts +916 -0
- package/src/council/leader.ts +262 -0
- package/src/council/llm.ts +967 -0
- package/src/council/phase-events.ts +58 -0
- package/src/council/planner.ts +303 -0
- package/src/council/preflight.ts +86 -0
- package/src/council/prompts.ts +600 -0
- package/src/council/types.ts +286 -0
- package/src/daemon/scheduler.ts +1 -1
- package/src/ee/__tests__/bb-design.test.ts +223 -0
- package/src/ee/__tests__/pil-context-bridge.test.ts +59 -0
- package/src/ee/__tests__/pipeline.integration.test.ts +6 -6
- package/src/ee/__tests__/render-sink-wiring.test.ts +89 -0
- package/src/ee/auth.ts +21 -0
- package/src/ee/bb-design.ts +284 -0
- package/src/ee/bb-retrieval.ts +467 -0
- package/src/ee/bridge.test.ts +1 -8
- package/src/ee/bridge.ts +201 -12
- package/src/ee/client-mode.ts +161 -0
- package/src/ee/client.test.ts +171 -171
- package/src/ee/client.ts +127 -19
- package/src/ee/council-bridge.ts +89 -0
- package/src/ee/extract-session.test.ts +3 -8
- package/src/ee/extract-session.ts +4 -2
- package/src/ee/health.ts +1 -1
- package/src/ee/index.ts +11 -10
- package/src/ee/intercept.test.ts +197 -191
- package/src/ee/intercept.ts +13 -2
- package/src/ee/judge.test.ts +56 -0
- package/src/ee/judge.ts +59 -1
- package/src/ee/mistake-detector.test.ts +252 -0
- package/src/ee/mistake-detector.ts +297 -0
- package/src/ee/offline-queue.test.ts +14 -63
- package/src/ee/offline-queue.ts +2 -9
- package/src/ee/phase-outcome.test.ts +107 -0
- package/src/ee/phase-outcome.ts +165 -0
- package/src/ee/phase-tracker.test.ts +175 -0
- package/src/ee/phase-tracker.ts +180 -0
- package/src/ee/prompt-stale.test.ts +6 -1
- package/src/ee/render.test.ts +7 -4
- package/src/ee/render.ts +25 -4
- package/src/ee/session-trajectory.test.ts +139 -0
- package/src/ee/session-trajectory.ts +226 -0
- package/src/ee/touch.test.ts +73 -71
- package/src/ee/types.ts +72 -7
- package/src/flow/__tests__/run-manager-product.test.ts +59 -0
- package/src/flow/__tests__/scaffold-checkpoint.test.ts +113 -0
- package/src/flow/run-manager.ts +35 -2
- package/src/flow/scaffold-checkpoint.ts +132 -0
- package/src/generated/version.ts +4 -0
- package/src/gsd/__tests__/complexity.test.ts +0 -0
- package/src/gsd/__tests__/directives.test.ts +49 -0
- package/src/gsd/__tests__/gray-areas.test.ts +33 -0
- package/src/gsd/complexity.ts +124 -0
- package/src/gsd/directives.ts +94 -0
- package/src/gsd/gray-areas.ts +144 -0
- package/src/gsd/types.ts +2 -0
- package/src/headless/__tests__/council-answers.test.ts +266 -0
- package/src/headless/council-answers.ts +130 -0
- package/src/headless/output.ts +1 -1
- package/src/hooks/index.ts +316 -19
- package/src/hooks/types.ts +42 -0
- package/src/index.ts +1564 -677
- package/src/lsp/client.ts +1 -1
- package/src/lsp/smoke.test.ts +15 -13
- package/src/mcp/__tests__/auto-setup.test.ts +88 -0
- package/src/mcp/__tests__/harness-driver-action-tools.spec.ts +114 -0
- package/src/mcp/__tests__/harness-driver-async-tools.spec.ts +127 -0
- package/src/mcp/__tests__/harness-driver-read-tools.spec.ts +140 -0
- package/src/mcp/__tests__/harness-driver-security.spec.ts +71 -0
- package/src/mcp/__tests__/harness-driver.spec.ts +21 -0
- package/src/mcp/__tests__/lazy-schema.spec.ts +173 -0
- package/src/mcp/__tests__/mcp-keychain.test.ts +46 -0
- package/src/mcp/__tests__/research-onboarding.test.ts +163 -0
- package/src/mcp/__tests__/runtime-hydration.test.ts +86 -0
- package/src/mcp/__tests__/runtime-sanitize.test.ts +44 -0
- package/src/mcp/auto-setup.ts +26 -7
- package/src/mcp/catalog.ts +31 -14
- package/src/mcp/mcp-keychain.ts +77 -0
- package/src/mcp/oauth-callback.ts +18 -6
- package/src/mcp/oauth-provider.ts +1 -3
- package/src/mcp/opentui-spawn.ts +64 -0
- package/src/mcp/research-onboarding.ts +143 -0
- package/src/mcp/runtime.ts +85 -27
- package/src/models/__tests__/registry.test.ts +11 -11
- package/src/models/catalog-client.ts +2 -2
- package/src/models/catalog.README.md +136 -0
- package/src/models/catalog.json +108 -245
- package/src/models/classify-tier.ts +20 -9
- package/src/models/registry.ts +5 -1
- package/src/ops/__tests__/doctor-council-mcp.test.ts +161 -0
- package/src/ops/__tests__/doctor-ee-health.test.ts +129 -0
- package/src/ops/doctor.test.ts +6 -5
- package/src/ops/doctor.ts +207 -13
- package/src/orchestrator/__tests__/batch-turn-runner.test.ts +178 -0
- package/src/orchestrator/__tests__/council-manager.test.ts +171 -0
- package/src/orchestrator/__tests__/cross-turn-dedup.test.ts +174 -0
- package/src/orchestrator/__tests__/current-call-id.test.ts +160 -0
- package/src/orchestrator/__tests__/message-processor.test.ts +196 -0
- package/src/orchestrator/__tests__/message-write-ahead.test.ts +170 -0
- package/src/orchestrator/__tests__/read-path-budget.test.ts +107 -0
- package/src/orchestrator/__tests__/retry-classifier.test.ts +120 -0
- package/src/orchestrator/__tests__/retry-stream.test.ts +186 -0
- package/src/orchestrator/__tests__/route-feedback.test.ts +1 -1
- package/src/orchestrator/__tests__/stream-runner.test.ts +123 -0
- package/src/orchestrator/__tests__/usage-events-shape.test.ts +80 -0
- package/src/orchestrator/__tests__/usage-normalizer-c1.test.ts +172 -0
- package/src/orchestrator/__tests__/write-ahead.test.ts +162 -0
- package/src/orchestrator/agent-options.ts +168 -0
- package/src/orchestrator/agent.test.ts +47 -1
- package/src/orchestrator/batch-turn-runner.ts +425 -0
- package/src/orchestrator/batch-utils.ts +340 -0
- package/src/orchestrator/cleanup.test.ts +3 -5
- package/src/orchestrator/compaction.test.ts +50 -3
- package/src/orchestrator/compaction.ts +178 -52
- package/src/orchestrator/council-manager.ts +580 -0
- package/src/orchestrator/cross-turn-dedup.ts +187 -0
- package/src/orchestrator/error-utils.ts +72 -0
- package/src/orchestrator/flow-resume.ts +0 -1
- package/src/orchestrator/message-processor.ts +1985 -0
- package/src/orchestrator/message-seq.test.ts +29 -0
- package/src/orchestrator/message-seq.ts +19 -0
- package/src/orchestrator/orchestrator.ts +1244 -2593
- package/src/orchestrator/prompts.ts +482 -0
- package/src/orchestrator/provider-options-shape.spec.ts +67 -0
- package/src/orchestrator/provider-options-shape.ts +70 -0
- package/src/orchestrator/read-path-budget.ts +128 -0
- package/src/orchestrator/reasoning.ts +5 -0
- package/src/orchestrator/retry-classifier.ts +131 -0
- package/src/orchestrator/retry-stream.ts +159 -0
- package/src/orchestrator/sandbox.test.ts +1 -1
- package/src/orchestrator/stream-runner.ts +729 -0
- package/src/orchestrator/sub-agent-cap.test.ts +186 -0
- package/src/orchestrator/sub-agent-cap.ts +218 -0
- package/src/orchestrator/subagent-compactor.spec.ts +144 -0
- package/src/orchestrator/subagent-compactor.ts +242 -0
- package/src/orchestrator/token-counter.test.ts +69 -0
- package/src/orchestrator/token-counter.ts +81 -0
- package/src/orchestrator/tool-utils.ts +214 -0
- package/src/orchestrator/turn-runner-deps.ts +83 -0
- package/src/pil/__tests__/config.test.ts +32 -0
- package/src/pil/__tests__/dual-run.test.ts +53 -0
- package/src/pil/__tests__/layer1-intent-trace.test.ts +140 -0
- package/src/pil/__tests__/layer1-intent.test.ts +130 -27
- package/src/pil/__tests__/layer3-ee-injection.test.ts +94 -30
- package/src/pil/__tests__/layer3-injected-chunk.test.ts +122 -0
- package/src/pil/__tests__/layer4-gsd.test.ts +56 -23
- package/src/pil/__tests__/layer5-context.test.ts +41 -0
- package/src/pil/__tests__/layer6-output.test.ts +154 -9
- package/src/pil/__tests__/ollama-classify.test.ts +81 -81
- package/src/pil/__tests__/pipeline.test.ts +19 -2
- package/src/pil/__tests__/renderer-coverage.test.ts +46 -0
- package/src/pil/__tests__/response-tools.test.ts +12 -3
- package/src/pil/__tests__/schema.test.ts +109 -4
- package/src/pil/__tests__/scoreComplexity.test.ts +134 -0
- package/src/pil/__tests__/scoreSufficiency.test.ts +104 -0
- package/src/pil/budget-log.ts +86 -0
- package/src/pil/config.ts +11 -0
- package/src/pil/index.ts +1 -1
- package/src/pil/layer1-intent.test.ts +127 -0
- package/src/pil/layer1-intent.ts +468 -43
- package/src/pil/layer2-personality.ts +9 -0
- package/src/pil/layer3-ee-injection.ts +298 -32
- package/src/pil/layer4-gsd.ts +73 -32
- package/src/pil/layer5-context.ts +53 -18
- package/src/pil/layer6-output.ts +157 -10
- package/src/pil/pipeline.ts +114 -19
- package/src/pil/response-tools.ts +2 -2
- package/src/pil/schema.ts +56 -2
- package/src/pil/types.ts +110 -2
- package/src/product-loop/__tests__/artifact-io.test.ts +97 -0
- package/src/product-loop/__tests__/assumption-ledger.test.ts +292 -0
- package/src/product-loop/__tests__/cb2-retry-bonus.test.ts +182 -0
- package/src/product-loop/__tests__/circuit-breakers-coverage.test.ts +82 -0
- package/src/product-loop/__tests__/circuit-breakers.test.ts +90 -0
- package/src/product-loop/__tests__/complexity-routing.spec.ts +169 -0
- package/src/product-loop/__tests__/context-policy.test.ts +280 -0
- package/src/product-loop/__tests__/cost-preview.test.ts +118 -0
- package/src/product-loop/__tests__/cost-scoper.test.ts +76 -0
- package/src/product-loop/__tests__/cross-run-memory.test.ts +195 -0
- package/src/product-loop/__tests__/design-output.spec.ts +39 -0
- package/src/product-loop/__tests__/discover.test.ts +98 -0
- package/src/product-loop/__tests__/discovery-council-runner.test.ts +13 -0
- package/src/product-loop/__tests__/discovery-detection.test.ts +180 -0
- package/src/product-loop/__tests__/discovery-ecosystem.test.ts +132 -0
- package/src/product-loop/__tests__/discovery-integration.test.ts +133 -0
- package/src/product-loop/__tests__/discovery-interview.test.ts +305 -0
- package/src/product-loop/__tests__/discovery-migrations.test.ts +75 -0
- package/src/product-loop/__tests__/discovery-persistence.test.ts +171 -0
- package/src/product-loop/__tests__/discovery-prompt-parser.test.ts +77 -0
- package/src/product-loop/__tests__/discovery-recommender-ecosystem.test.ts +94 -0
- package/src/product-loop/__tests__/discovery-recommender.test.ts +382 -0
- package/src/product-loop/__tests__/discovery-schema.test.ts +102 -0
- package/src/product-loop/__tests__/done-gate-coverage.test.ts +151 -0
- package/src/product-loop/__tests__/done-gate.test.ts +140 -0
- package/src/product-loop/__tests__/ee-extract-wiring.test.ts +216 -0
- package/src/product-loop/__tests__/extract-to-ee.test.ts +205 -0
- package/src/product-loop/__tests__/feedback-routing.test.ts +93 -0
- package/src/product-loop/__tests__/hot-path.spec.ts +177 -0
- package/src/product-loop/__tests__/integration.test.ts +344 -0
- package/src/product-loop/__tests__/loop-driver-audit.test.ts +321 -0
- package/src/product-loop/__tests__/loop-driver.test.ts +247 -0
- package/src/product-loop/__tests__/phase-budget.test.ts +172 -0
- package/src/product-loop/__tests__/phase-orchestrator-integration.test.ts +143 -0
- package/src/product-loop/__tests__/phase-plan.test.ts +241 -0
- package/src/product-loop/__tests__/phase-rituals.test.ts +211 -0
- package/src/product-loop/__tests__/phase-runner.test.ts +454 -0
- package/src/product-loop/__tests__/phase-tracker-bridge.test.ts +85 -0
- package/src/product-loop/__tests__/product-identity.test.ts +47 -0
- package/src/product-loop/__tests__/reality-anchor.test.ts +58 -0
- package/src/product-loop/__tests__/repo-audit.test.ts +103 -0
- package/src/product-loop/__tests__/role-memory.test.ts +70 -0
- package/src/product-loop/__tests__/role-registry.test.ts +235 -0
- package/src/product-loop/__tests__/role-routing-ee.test.ts +90 -0
- package/src/product-loop/__tests__/route-decision-emit.test.ts +207 -0
- package/src/product-loop/__tests__/seed-questions.test.ts +33 -0
- package/src/product-loop/__tests__/ship-polish.test.ts +109 -0
- package/src/product-loop/__tests__/sprint-runner-emit.test.ts +324 -0
- package/src/product-loop/__tests__/sprint-runner.test.ts +501 -0
- package/src/product-loop/__tests__/stakeholder-acl.test.ts +94 -0
- package/src/product-loop/__tests__/state-md-ee-injections.test.ts +229 -0
- package/src/product-loop/__tests__/sufficiency-routing.spec.ts +177 -0
- package/src/product-loop/__tests__/typed-artifacts.test.ts +261 -0
- package/src/product-loop/__tests__/types.test.ts +103 -0
- package/src/product-loop/__tests__/verify-failure-threshold.test.ts +177 -0
- package/src/product-loop/__tests__/verify-failure-tracking.test.ts +154 -0
- package/src/product-loop/__tests__/verify-result.test.ts +60 -0
- package/src/product-loop/artifact-io.ts +239 -0
- package/src/product-loop/assumption-ledger.ts +270 -0
- package/src/product-loop/circuit-breakers.ts +76 -0
- package/src/product-loop/context-policy.ts +180 -0
- package/src/product-loop/cost-preview.ts +124 -0
- package/src/product-loop/cost-scoper.ts +49 -0
- package/src/product-loop/cross-run-memory.ts +450 -0
- package/src/product-loop/design-output.ts +24 -0
- package/src/product-loop/discover.ts +159 -0
- package/src/product-loop/discovery-context-format.ts +32 -0
- package/src/product-loop/discovery-council-runner.ts +82 -0
- package/src/product-loop/discovery-detection.ts +161 -0
- package/src/product-loop/discovery-ecosystem.ts +124 -0
- package/src/product-loop/discovery-interview.ts +237 -0
- package/src/product-loop/discovery-migrations.ts +40 -0
- package/src/product-loop/discovery-persistence.ts +219 -0
- package/src/product-loop/discovery-prompt-parser.ts +80 -0
- package/src/product-loop/discovery-recommender.ts +366 -0
- package/src/product-loop/discovery-schema.ts +143 -0
- package/src/product-loop/done-gate.ts +224 -0
- package/src/product-loop/feedback-routing.ts +82 -0
- package/src/product-loop/gather.ts +304 -0
- package/src/product-loop/index.ts +1305 -0
- package/src/product-loop/loop-driver.ts +901 -0
- package/src/product-loop/phase-budget.ts +182 -0
- package/src/product-loop/phase-plan.ts +158 -0
- package/src/product-loop/phase-rituals.ts +158 -0
- package/src/product-loop/phase-runner.ts +455 -0
- package/src/product-loop/phase-tracker-bridge.ts +60 -0
- package/src/product-loop/product-identity.ts +11 -0
- package/src/product-loop/reality-anchor.ts +45 -0
- package/src/product-loop/repo-audit.ts +314 -0
- package/src/product-loop/role-memory.ts +72 -0
- package/src/product-loop/role-registry.ts +175 -0
- package/src/product-loop/seed-questions.ts +51 -0
- package/src/product-loop/ship-polish.ts +164 -0
- package/src/product-loop/sprint-runner.ts +610 -0
- package/src/product-loop/stakeholder-acl.ts +82 -0
- package/src/product-loop/typed-artifacts.ts +332 -0
- package/src/product-loop/types.ts +443 -0
- package/src/product-loop/verify-failure-tracking.ts +225 -0
- package/src/product-loop/verify-result.ts +39 -0
- package/src/providers/__tests__/adapter-oauth-wiring.test.ts +129 -0
- package/src/providers/__tests__/capabilities-cosmetic.test.ts +119 -0
- package/src/providers/__tests__/capabilities-flags.test.ts +166 -0
- package/src/providers/__tests__/capabilities-provider-options.test.ts +203 -0
- package/src/providers/__tests__/capabilities-sanitize.test.ts +82 -0
- package/src/providers/__tests__/capabilities.test.ts +44 -0
- package/src/providers/__tests__/provider-coverage.test.ts +48 -0
- package/src/providers/__tests__/runtime-integration.test.ts +41 -24
- package/src/providers/__tests__/runtime.test.ts +23 -13
- package/src/providers/__tests__/siliconflow-history.test.ts +82 -0
- package/src/providers/__tests__/strategies-registry.test.ts +55 -0
- package/src/providers/__tests__/strategies-resolve.test.ts +137 -0
- package/src/providers/__tests__/wire-debug.test.ts +42 -0
- package/src/providers/adapter.ts +135 -27
- package/src/providers/anthropic.ts +7 -2
- package/src/providers/auth/__tests__/browser-flow.test.ts +235 -0
- package/src/providers/auth/__tests__/device-flow.test.ts +263 -0
- package/src/providers/auth/__tests__/gemini-oauth.test.ts +387 -0
- package/src/providers/auth/__tests__/openai-oauth.test.ts +378 -0
- package/src/providers/auth/__tests__/token-store.test.ts +152 -0
- package/src/providers/auth/browser-flow.ts +140 -0
- package/src/providers/auth/device-flow.ts +221 -0
- package/src/providers/auth/gemini-oauth.ts +351 -0
- package/src/providers/auth/openai-oauth.ts +455 -0
- package/src/providers/auth/registry.ts +121 -0
- package/src/providers/auth/token-store.ts +154 -0
- package/src/providers/auth/types.ts +111 -0
- package/src/providers/capabilities.ts +351 -0
- package/src/providers/endpoints.ts +68 -0
- package/src/providers/gemini.ts +7 -2
- package/src/providers/index.ts +5 -9
- package/src/providers/keychain.test.ts +5 -0
- package/src/providers/keychain.ts +137 -3
- package/src/providers/mcp-vision-bridge.test.ts +513 -0
- package/src/providers/mcp-vision-bridge.ts +1020 -0
- package/src/providers/openai-compatible.test.ts +2 -2
- package/src/providers/openai-compatible.ts +16 -8
- package/src/providers/openai.ts +21 -2
- package/src/providers/patch-zod-schema.ts +10 -13
- package/src/providers/pricing.test.ts +11 -2
- package/src/providers/pricing.ts +66 -10
- package/src/providers/prompt-cache-key.spec.ts +28 -0
- package/src/providers/runtime-mock.spec.ts +86 -0
- package/src/providers/runtime.ts +227 -55
- package/src/providers/siliconflow-history.ts +74 -0
- package/src/providers/strategies/anthropic.strategy.ts +25 -0
- package/src/providers/strategies/base.strategy.ts +76 -0
- package/src/providers/strategies/deepseek.strategy.ts +26 -0
- package/src/providers/strategies/google.strategy.ts +28 -0
- package/src/providers/strategies/ollama.strategy.ts +22 -0
- package/src/providers/strategies/openai.strategy.ts +55 -0
- package/src/providers/strategies/registry.ts +43 -0
- package/src/providers/strategies/siliconflow.strategy.ts +26 -0
- package/src/providers/strategies/xai.strategy.ts +26 -0
- package/src/providers/stream-loop.ts +15 -1
- package/src/providers/types.ts +34 -0
- package/src/providers/vision-proxy.test.ts +96 -11
- package/src/providers/vision-proxy.ts +153 -45
- package/src/providers/wire-debug.ts +163 -0
- package/src/router/__tests__/step-router.test.ts +150 -0
- package/src/router/classifier/regex.test.ts +3 -1
- package/src/router/classifier/regex.ts +71 -12
- package/src/router/cold.test.ts +5 -5
- package/src/router/decide.test.ts +17 -5
- package/src/router/decide.ts +144 -26
- package/src/router/provider-sentinel.test.ts +22 -0
- package/src/router/provider-sentinel.ts +20 -0
- package/src/router/step-router.ts +194 -0
- package/src/router/warm.test.ts +3 -2
- package/src/router/warm.ts +7 -1
- package/src/scaffold/__tests__/continuation-prompt.test.ts +93 -0
- package/src/scaffold/__tests__/continue-as-council.spec.ts +124 -0
- package/src/scaffold/__tests__/dotnet-assembly-name.test.ts +28 -0
- package/src/scaffold/__tests__/fe-scaffold-contents.test.ts +127 -0
- package/src/scaffold/__tests__/init-new.smoke.spec.ts +99 -0
- package/src/scaffold/__tests__/init-new.spec.ts +450 -0
- package/src/scaffold/__tests__/install-bb-templates.spec.ts +86 -0
- package/src/scaffold/__tests__/point-to-existing.spec.ts +114 -0
- package/src/scaffold/bb-ecosystem-apply.ts +454 -0
- package/src/scaffold/bb-quality-gate.ts +287 -0
- package/src/scaffold/continuation-prompt.ts +80 -0
- package/src/scaffold/continue-as-council.ts +99 -0
- package/src/scaffold/init-new.ts +1691 -0
- package/src/scaffold/point-to-existing.ts +83 -0
- package/src/scaffold/resume-from-gate-failures.ts +167 -0
- package/src/storage/__tests__/ui-interaction-log.test.ts +105 -0
- package/src/storage/atomic-io.test.ts +32 -1
- package/src/storage/atomic-io.ts +107 -9
- package/src/storage/config.ts +5 -1
- package/src/storage/db.ts +93 -4
- package/src/storage/index.ts +8 -1
- package/src/storage/interaction-log.ts +121 -0
- package/src/storage/migrations.ts +66 -4
- package/src/storage/sessions.ts +28 -0
- package/src/storage/transcript.ts +207 -4
- package/src/storage/ui-interaction-log.ts +160 -0
- package/src/storage/usage.ts +4 -2
- package/src/tools/bash.test.ts +27 -0
- package/src/tools/bash.ts +60 -4
- package/src/tools/file-tracker.test.ts +99 -0
- package/src/tools/file-tracker.ts +70 -0
- package/src/tools/file.ts +59 -5
- package/src/tools/registry.test.ts +38 -0
- package/src/tools/registry.ts +133 -27
- package/src/types/index.ts +166 -3
- package/src/ui/agents-modal.tsx +164 -144
- package/src/ui/app.tsx +6464 -6277
- package/src/ui/cards/__tests__/product-status-card.test.ts +30 -0
- package/src/ui/cards/product-status-card.tsx +117 -0
- package/src/ui/components/Toast.tsx +100 -0
- package/src/ui/components/__tests__/council-leader-bubble.test.ts +16 -0
- package/src/ui/components/__tests__/council-message-bubble.test.ts +85 -0
- package/src/ui/components/__tests__/council-phase-timeline.test.ts +57 -0
- package/src/ui/components/__tests__/council-placeholder-bubble.test.ts +16 -0
- package/src/ui/components/__tests__/council-question-card.test.ts +133 -0
- package/src/ui/components/__tests__/council-synthesis-banner.test.ts +12 -0
- package/src/ui/components/__tests__/use-pair-quote-buffer.test.ts +41 -0
- package/src/ui/components/bubble-layout.ts +66 -0
- package/src/ui/components/code-block-truncate.ts +24 -0
- package/src/ui/components/copy-flash-banner.tsx +31 -0
- package/src/ui/components/council-info-card.tsx +45 -0
- package/src/ui/components/council-leader-bubble.tsx +41 -0
- package/src/ui/components/council-message-bubble.tsx +111 -0
- package/src/ui/components/council-phase-timeline.tsx +91 -0
- package/src/ui/components/council-placeholder-bubble.tsx +65 -0
- package/src/ui/components/council-question-card.tsx +253 -0
- package/src/ui/components/council-status-list.tsx +111 -0
- package/src/ui/components/council-synthesis-banner.tsx +37 -0
- package/src/ui/components/diff-view.tsx +225 -0
- package/src/ui/components/halt-recovery-card.tsx +83 -0
- package/src/ui/components/hero-logo.tsx +62 -0
- package/src/ui/components/init-new-form-card.tsx +470 -0
- package/src/ui/components/lsp-views.tsx +104 -0
- package/src/ui/components/media-views.tsx +66 -0
- package/src/ui/components/message-view.tsx +343 -0
- package/src/ui/components/point-to-existing-form-card.tsx +136 -0
- package/src/ui/components/prompt-box.tsx +306 -0
- package/src/ui/components/role-palette.ts +62 -0
- package/src/ui/components/session-header.tsx +68 -0
- package/src/ui/components/slash-inline-menu.tsx +63 -0
- package/src/ui/components/structured-response-view.tsx +191 -0
- package/src/ui/components/tool-result-views.tsx +258 -0
- package/src/ui/components/use-pair-quote-buffer.ts +23 -0
- package/src/ui/constants.ts +242 -0
- package/src/ui/hooks/use-agent-editor.ts +64 -0
- package/src/ui/hooks/use-mcp-editor.ts +39 -0
- package/src/ui/hooks/use-model-picker.ts +50 -0
- package/src/ui/hooks/useTypeahead.ts +17 -3
- package/src/ui/mcp-modal.tsx +306 -278
- package/src/ui/modals/api-key-modal.tsx +99 -0
- package/src/ui/modals/connect-modal.tsx +259 -0
- package/src/ui/modals/model-picker-modal.tsx +323 -0
- package/src/ui/modals/sandbox-picker-modal.tsx +99 -0
- package/src/ui/modals/update-modal.tsx +67 -0
- package/src/ui/modals/wallet-picker-modal.tsx +186 -0
- package/src/ui/schedule-modal.tsx +75 -63
- package/src/ui/slash/__tests__/ideal.test.ts +134 -0
- package/src/ui/slash/__tests__/menu-parity.test.ts +43 -0
- package/src/ui/slash/__tests__/optimize.test.ts +2 -2
- package/src/ui/slash/__tests__/pin.test.ts +47 -0
- package/src/ui/slash/cost.ts +7 -3
- package/src/ui/slash/council-inspect.ts +188 -0
- package/src/ui/slash/council.ts +11 -8
- package/src/ui/slash/debug.ts +5 -5
- package/src/ui/slash/ee.ts +43 -10
- package/src/ui/slash/export.ts +281 -0
- package/src/ui/slash/ideal.ts +254 -0
- package/src/ui/slash/menu-items.ts +106 -0
- package/src/ui/slash/optimize.ts +1 -1
- package/src/ui/slash/pin.ts +41 -0
- package/src/ui/slash/registry.ts +9 -0
- package/src/ui/status-bar/index.tsx +22 -18
- package/src/ui/status-bar/store.ts +19 -3
- package/src/ui/syntax-highlight.ts +627 -0
- package/src/ui/theme.ts +41 -0
- package/src/ui/types.ts +83 -0
- package/src/ui/utils/color.ts +19 -0
- package/src/ui/utils/format.ts +86 -0
- package/src/ui/utils/modal.ts +9 -0
- package/src/ui/utils/text.ts +31 -0
- package/src/ui/utils/tools.ts +95 -0
- package/src/usage/__tests__/product-ledger.test.ts +85 -0
- package/src/usage/cost-log.ts +158 -0
- package/src/usage/decision-log.ts +86 -0
- package/src/usage/estimator.ts +24 -0
- package/src/usage/ledger.ts +40 -0
- package/src/usage/product-ledger.ts +111 -0
- package/src/usage/types.ts +1 -0
- package/src/utils/__tests__/auto-council-settings.test.ts +46 -0
- package/src/utils/__tests__/ee-logger.test.ts +197 -0
- package/src/utils/__tests__/file-lock.test.ts +74 -0
- package/src/utils/__tests__/rate-limit.test.ts +42 -0
- package/src/utils/__tests__/settings-disabled-models.test.ts +113 -0
- package/src/utils/__tests__/settings-web-research.test.ts +45 -0
- package/src/utils/__tests__/slugify.test.ts +45 -0
- package/src/utils/__tests__/visible-retry.test.ts +195 -0
- package/src/utils/clipboard-image.ts +31 -11
- package/src/utils/ee-logger.ts +163 -0
- package/src/utils/file-lock.ts +66 -0
- package/src/utils/host-clipboard.ts +38 -0
- package/src/utils/instructions.test.ts +28 -0
- package/src/utils/instructions.ts +37 -4
- package/src/utils/rate-limit.ts +21 -0
- package/src/utils/settings.test.ts +4 -4
- package/src/utils/settings.ts +1108 -795
- package/src/utils/shell.test.ts +72 -0
- package/src/utils/shell.ts +193 -0
- package/src/utils/slugify.ts +9 -0
- package/src/utils/visible-retry.ts +56 -0
- package/src/verify/__tests__/coverage-parsers.test.ts +86 -0
- package/src/verify/__tests__/dotnet-recipe.test.ts +88 -0
- package/src/verify/coverage-parsers.ts +76 -0
- package/src/verify/recipes.ts +76 -0
- package/dist/__test-stubs__/ee-server.js.map +0 -1
- package/dist/billing/index.js.map +0 -1
- package/dist/cloud/index.js.map +0 -1
- package/dist/daemon/scheduler.d.ts +0 -15
- package/dist/daemon/scheduler.js +0 -126
- package/dist/daemon/scheduler.js.map +0 -1
- package/dist/daemon/scheduler.test.js +0 -103
- package/dist/daemon/scheduler.test.js.map +0 -1
- package/dist/ee/__tests__/pipeline.integration.test.js +0 -151
- package/dist/ee/__tests__/pipeline.integration.test.js.map +0 -1
- package/dist/ee/auth.d.ts +0 -19
- package/dist/ee/auth.js +0 -48
- package/dist/ee/auth.js.map +0 -1
- package/dist/ee/auth.test.js.map +0 -1
- package/dist/ee/bridge.d.ts +0 -68
- package/dist/ee/bridge.js +0 -177
- package/dist/ee/bridge.js.map +0 -1
- package/dist/ee/bridge.test.js.map +0 -1
- package/dist/ee/client.js +0 -464
- package/dist/ee/client.js.map +0 -1
- package/dist/ee/client.test.js.map +0 -1
- package/dist/ee/embedding-cache.js.map +0 -1
- package/dist/ee/extract-session.js +0 -53
- package/dist/ee/extract-session.js.map +0 -1
- package/dist/ee/extract-session.test.js +0 -197
- package/dist/ee/extract-session.test.js.map +0 -1
- package/dist/ee/health.js +0 -64
- package/dist/ee/health.js.map +0 -1
- package/dist/ee/index.d.ts +0 -10
- package/dist/ee/index.js +0 -9
- package/dist/ee/index.js.map +0 -1
- package/dist/ee/intercept.js +0 -117
- package/dist/ee/intercept.js.map +0 -1
- package/dist/ee/intercept.test.js +0 -170
- package/dist/ee/intercept.test.js.map +0 -1
- package/dist/ee/judge.d.ts +0 -36
- package/dist/ee/judge.js +0 -56
- package/dist/ee/judge.js.map +0 -1
- package/dist/ee/judge.test.js +0 -139
- package/dist/ee/judge.test.js.map +0 -1
- package/dist/ee/offline-queue.js.map +0 -1
- package/dist/ee/offline-queue.test.js +0 -246
- package/dist/ee/offline-queue.test.js.map +0 -1
- package/dist/ee/posttool.js.map +0 -1
- package/dist/ee/posttool.test.js.map +0 -1
- package/dist/ee/prompt-stale.js.map +0 -1
- package/dist/ee/prompt-stale.test.js +0 -76
- package/dist/ee/prompt-stale.test.js.map +0 -1
- package/dist/ee/render.d.ts +0 -20
- package/dist/ee/render.js +0 -30
- package/dist/ee/render.js.map +0 -1
- package/dist/ee/render.test.js +0 -61
- package/dist/ee/render.test.js.map +0 -1
- package/dist/ee/scope.js.map +0 -1
- package/dist/ee/scope.test.js.map +0 -1
- package/dist/ee/tenant.js.map +0 -1
- package/dist/ee/touch.test.js +0 -60
- package/dist/ee/touch.test.js.map +0 -1
- package/dist/ee/types.d.ts +0 -300
- package/dist/ee/types.js.map +0 -1
- package/dist/flow/__tests__/migration.test.js.map +0 -1
- package/dist/flow/__tests__/parser.test.js.map +0 -1
- package/dist/flow/__tests__/run-manager.test.js.map +0 -1
- package/dist/flow/__tests__/scaffold.test.js.map +0 -1
- package/dist/flow/__tests__/warning-persist.test.js.map +0 -1
- package/dist/flow/artifact-io.js.map +0 -1
- package/dist/flow/compaction/__tests__/compress.test.js.map +0 -1
- package/dist/flow/compaction/__tests__/extract.test.js.map +0 -1
- package/dist/flow/compaction/__tests__/preserve.test.js.map +0 -1
- package/dist/flow/compaction/compress.js.map +0 -1
- package/dist/flow/compaction/extract.js.map +0 -1
- package/dist/flow/compaction/index.js.map +0 -1
- package/dist/flow/compaction/preserve.js.map +0 -1
- package/dist/flow/index.js.map +0 -1
- package/dist/flow/migration.js.map +0 -1
- package/dist/flow/parser.js.map +0 -1
- package/dist/flow/run-manager.d.ts +0 -36
- package/dist/flow/run-manager.js +0 -110
- package/dist/flow/run-manager.js.map +0 -1
- package/dist/flow/scaffold.js.map +0 -1
- package/dist/flow/warning-persist.js.map +0 -1
- package/dist/gsd/__tests__/types.test.js +0 -65
- package/dist/gsd/__tests__/types.test.js.map +0 -1
- package/dist/gsd/index.js.map +0 -1
- package/dist/gsd/types.d.ts +0 -4
- package/dist/gsd/types.js.map +0 -1
- package/dist/headless/output.d.ts +0 -68
- package/dist/headless/output.js.map +0 -1
- package/dist/headless/output.test.js +0 -178
- package/dist/headless/output.test.js.map +0 -1
- package/dist/hooks/config.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -44
- package/dist/hooks/index.js +0 -187
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/types.d.ts +0 -130
- package/dist/hooks/types.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -531
- package/dist/index.js.map +0 -1
- package/dist/lsp/builtins.d.ts +0 -9
- package/dist/lsp/builtins.js +0 -351
- package/dist/lsp/builtins.js.map +0 -1
- package/dist/lsp/builtins.test.js +0 -91
- package/dist/lsp/builtins.test.js.map +0 -1
- package/dist/lsp/client.d.ts +0 -20
- package/dist/lsp/client.js +0 -290
- package/dist/lsp/client.js.map +0 -1
- package/dist/lsp/manager.d.ts +0 -20
- package/dist/lsp/manager.js +0 -235
- package/dist/lsp/manager.js.map +0 -1
- package/dist/lsp/manager.test.js +0 -133
- package/dist/lsp/manager.test.js.map +0 -1
- package/dist/lsp/npm-cache.js.map +0 -1
- package/dist/lsp/npm-cache.test.js +0 -53
- package/dist/lsp/npm-cache.test.js.map +0 -1
- package/dist/lsp/runtime.d.ts +0 -6
- package/dist/lsp/runtime.js +0 -53
- package/dist/lsp/runtime.js.map +0 -1
- package/dist/lsp/smoke.test.js.map +0 -1
- package/dist/lsp/types.js.map +0 -1
- package/dist/mcp/auto-setup.js +0 -76
- package/dist/mcp/auto-setup.js.map +0 -1
- package/dist/mcp/catalog.js +0 -121
- package/dist/mcp/catalog.js.map +0 -1
- package/dist/mcp/oauth-callback.d.ts +0 -9
- package/dist/mcp/oauth-callback.js +0 -49
- package/dist/mcp/oauth-callback.js.map +0 -1
- package/dist/mcp/oauth-provider.js.map +0 -1
- package/dist/mcp/parse-headers.js.map +0 -1
- package/dist/mcp/parse-headers.test.js +0 -43
- package/dist/mcp/parse-headers.test.js.map +0 -1
- package/dist/mcp/runtime.js +0 -81
- package/dist/mcp/runtime.js.map +0 -1
- package/dist/mcp/smoke.test.js.map +0 -1
- package/dist/mcp/validate.d.ts +0 -9
- package/dist/mcp/validate.js.map +0 -1
- package/dist/models/__tests__/registry.test.js +0 -74
- package/dist/models/__tests__/registry.test.js.map +0 -1
- package/dist/models/catalog-client.js +0 -104
- package/dist/models/catalog-client.js.map +0 -1
- package/dist/models/catalog.json +0 -314
- package/dist/models/classify-tier.js +0 -34
- package/dist/models/classify-tier.js.map +0 -1
- package/dist/models/index.d.ts +0 -1
- package/dist/models/index.js +0 -2
- package/dist/models/index.js.map +0 -1
- package/dist/models/registry.d.ts +0 -19
- package/dist/models/registry.js +0 -65
- package/dist/models/registry.js.map +0 -1
- package/dist/ops/bug-report.js.map +0 -1
- package/dist/ops/bug-report.test.js.map +0 -1
- package/dist/ops/doctor.js +0 -162
- package/dist/ops/doctor.js.map +0 -1
- package/dist/ops/doctor.test.js +0 -95
- package/dist/ops/doctor.test.js.map +0 -1
- package/dist/orchestrator/__tests__/flow-resume.test.js.map +0 -1
- package/dist/orchestrator/__tests__/route-feedback.test.js +0 -47
- package/dist/orchestrator/__tests__/route-feedback.test.js.map +0 -1
- package/dist/orchestrator/abort.js.map +0 -1
- package/dist/orchestrator/abort.test.js.map +0 -1
- package/dist/orchestrator/agent.test.js +0 -126
- package/dist/orchestrator/agent.test.js.map +0 -1
- package/dist/orchestrator/cleanup.test.js +0 -67
- package/dist/orchestrator/cleanup.test.js.map +0 -1
- package/dist/orchestrator/compaction.d.ts +0 -36
- package/dist/orchestrator/compaction.js +0 -375
- package/dist/orchestrator/compaction.js.map +0 -1
- package/dist/orchestrator/compaction.test.js +0 -105
- package/dist/orchestrator/compaction.test.js.map +0 -1
- package/dist/orchestrator/delegations.d.ts +0 -49
- package/dist/orchestrator/delegations.js.map +0 -1
- package/dist/orchestrator/delegations.test.js +0 -107
- package/dist/orchestrator/delegations.test.js.map +0 -1
- package/dist/orchestrator/flow-resume.d.ts +0 -25
- package/dist/orchestrator/flow-resume.js +0 -53
- package/dist/orchestrator/flow-resume.js.map +0 -1
- package/dist/orchestrator/orchestrator.d.ts +0 -245
- package/dist/orchestrator/orchestrator.js +0 -3229
- package/dist/orchestrator/orchestrator.js.map +0 -1
- package/dist/orchestrator/pending-calls.js.map +0 -1
- package/dist/orchestrator/pending-calls.test.js.map +0 -1
- package/dist/orchestrator/reasoning.js +0 -53
- package/dist/orchestrator/reasoning.js.map +0 -1
- package/dist/orchestrator/reasoning.test.js +0 -26
- package/dist/orchestrator/reasoning.test.js.map +0 -1
- package/dist/orchestrator/sandbox.test.js +0 -94
- package/dist/orchestrator/sandbox.test.js.map +0 -1
- package/dist/pil/__tests__/budget.test.js +0 -33
- package/dist/pil/__tests__/budget.test.js.map +0 -1
- package/dist/pil/__tests__/layer1-intent.test.js +0 -199
- package/dist/pil/__tests__/layer1-intent.test.js.map +0 -1
- package/dist/pil/__tests__/layer2-personality.test.js +0 -57
- package/dist/pil/__tests__/layer2-personality.test.js.map +0 -1
- package/dist/pil/__tests__/layer3-ee-injection.test.js +0 -96
- package/dist/pil/__tests__/layer3-ee-injection.test.js.map +0 -1
- package/dist/pil/__tests__/layer4-gsd.test.js +0 -68
- package/dist/pil/__tests__/layer4-gsd.test.js.map +0 -1
- package/dist/pil/__tests__/layer5-context.test.js +0 -100
- package/dist/pil/__tests__/layer5-context.test.js.map +0 -1
- package/dist/pil/__tests__/layer6-output.test.js +0 -115
- package/dist/pil/__tests__/layer6-output.test.js.map +0 -1
- package/dist/pil/__tests__/ollama-classify.test.js.map +0 -1
- package/dist/pil/__tests__/orchestrator-integration.test.js.map +0 -1
- package/dist/pil/__tests__/pipeline.test.js +0 -150
- package/dist/pil/__tests__/pipeline.test.js.map +0 -1
- package/dist/pil/__tests__/response-tools.test.js +0 -133
- package/dist/pil/__tests__/response-tools.test.js.map +0 -1
- package/dist/pil/__tests__/schema.test.js +0 -112
- package/dist/pil/__tests__/schema.test.js.map +0 -1
- package/dist/pil/__tests__/store.test.js.map +0 -1
- package/dist/pil/__tests__/task-tier-map.test.js.map +0 -1
- package/dist/pil/budget.js.map +0 -1
- package/dist/pil/index.d.ts +0 -11
- package/dist/pil/index.js +0 -11
- package/dist/pil/index.js.map +0 -1
- package/dist/pil/layer1-intent.d.ts +0 -13
- package/dist/pil/layer1-intent.js +0 -142
- package/dist/pil/layer1-intent.js.map +0 -1
- package/dist/pil/layer2-personality.js +0 -29
- package/dist/pil/layer2-personality.js.map +0 -1
- package/dist/pil/layer3-ee-injection.d.ts +0 -10
- package/dist/pil/layer3-ee-injection.js +0 -72
- package/dist/pil/layer3-ee-injection.js.map +0 -1
- package/dist/pil/layer4-gsd.d.ts +0 -2
- package/dist/pil/layer4-gsd.js +0 -64
- package/dist/pil/layer4-gsd.js.map +0 -1
- package/dist/pil/layer5-context.js +0 -124
- package/dist/pil/layer5-context.js.map +0 -1
- package/dist/pil/layer6-output.d.ts +0 -18
- package/dist/pil/layer6-output.js +0 -105
- package/dist/pil/layer6-output.js.map +0 -1
- package/dist/pil/ollama-classify.js.map +0 -1
- package/dist/pil/pipeline.d.ts +0 -16
- package/dist/pil/pipeline.js +0 -96
- package/dist/pil/pipeline.js.map +0 -1
- package/dist/pil/response-tools.d.ts +0 -63
- package/dist/pil/response-tools.js +0 -87
- package/dist/pil/response-tools.js.map +0 -1
- package/dist/pil/schema.d.ts +0 -80
- package/dist/pil/schema.js +0 -43
- package/dist/pil/schema.js.map +0 -1
- package/dist/pil/store.js.map +0 -1
- package/dist/pil/task-tier-map.js.map +0 -1
- package/dist/pil/timeout.js.map +0 -1
- package/dist/pil/types.d.ts +0 -39
- package/dist/pil/types.js.map +0 -1
- package/dist/providers/__test-utils__/load-fixture.js.map +0 -1
- package/dist/providers/__tests__/runtime-integration.test.js +0 -71
- package/dist/providers/__tests__/runtime-integration.test.js.map +0 -1
- package/dist/providers/__tests__/runtime.test.js +0 -76
- package/dist/providers/__tests__/runtime.test.js.map +0 -1
- package/dist/providers/adapter.d.ts +0 -15
- package/dist/providers/adapter.js +0 -45
- package/dist/providers/adapter.js.map +0 -1
- package/dist/providers/adapter.test.js.map +0 -1
- package/dist/providers/anthropic.js +0 -141
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/errors.js.map +0 -1
- package/dist/providers/errors.test.js.map +0 -1
- package/dist/providers/gemini.js +0 -33
- package/dist/providers/gemini.js.map +0 -1
- package/dist/providers/gemini.test.js.map +0 -1
- package/dist/providers/index.d.ts +0 -11
- package/dist/providers/index.js +0 -15
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/keychain.d.ts +0 -32
- package/dist/providers/keychain.js +0 -127
- package/dist/providers/keychain.js.map +0 -1
- package/dist/providers/keychain.test.js +0 -80
- package/dist/providers/keychain.test.js.map +0 -1
- package/dist/providers/ollama.js.map +0 -1
- package/dist/providers/ollama.test.js.map +0 -1
- package/dist/providers/openai-compatible.js +0 -45
- package/dist/providers/openai-compatible.js.map +0 -1
- package/dist/providers/openai-compatible.test.js +0 -53
- package/dist/providers/openai-compatible.test.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -11
- package/dist/providers/openai.js +0 -33
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/openai.test.js.map +0 -1
- package/dist/providers/patch-zod-schema.js +0 -121
- package/dist/providers/patch-zod-schema.js.map +0 -1
- package/dist/providers/pricing.d.ts +0 -21
- package/dist/providers/pricing.js +0 -50
- package/dist/providers/pricing.js.map +0 -1
- package/dist/providers/pricing.test.js +0 -47
- package/dist/providers/pricing.test.js.map +0 -1
- package/dist/providers/runtime.d.ts +0 -21
- package/dist/providers/runtime.js +0 -83
- package/dist/providers/runtime.js.map +0 -1
- package/dist/providers/stream-loop.d.ts +0 -16
- package/dist/providers/stream-loop.js +0 -63
- package/dist/providers/stream-loop.js.map +0 -1
- package/dist/providers/types.d.ts +0 -106
- package/dist/providers/types.js +0 -12
- package/dist/providers/types.js.map +0 -1
- package/dist/providers/vision-proxy.js +0 -152
- package/dist/providers/vision-proxy.js.map +0 -1
- package/dist/providers/vision-proxy.test.js +0 -136
- package/dist/providers/vision-proxy.test.js.map +0 -1
- package/dist/router/classifier/grammars.js.map +0 -1
- package/dist/router/classifier/index.js.map +0 -1
- package/dist/router/classifier/index.test.js.map +0 -1
- package/dist/router/classifier/regex.js +0 -45
- package/dist/router/classifier/regex.js.map +0 -1
- package/dist/router/classifier/regex.test.js.map +0 -1
- package/dist/router/classifier/tree-sitter.js.map +0 -1
- package/dist/router/classifier/tree-sitter.test.js.map +0 -1
- package/dist/router/cold.js.map +0 -1
- package/dist/router/cold.test.js +0 -56
- package/dist/router/cold.test.js.map +0 -1
- package/dist/router/decide.js +0 -300
- package/dist/router/decide.js.map +0 -1
- package/dist/router/decide.test.js +0 -116
- package/dist/router/decide.test.js.map +0 -1
- package/dist/router/health.js.map +0 -1
- package/dist/router/health.test.js.map +0 -1
- package/dist/router/store.js.map +0 -1
- package/dist/router/types.js.map +0 -1
- package/dist/router/warm.js +0 -40
- package/dist/router/warm.js.map +0 -1
- package/dist/router/warm.test.js +0 -144
- package/dist/router/warm.test.js.map +0 -1
- package/dist/storage/__tests__/migrations.test.js.map +0 -1
- package/dist/storage/atomic-io.d.ts +0 -18
- package/dist/storage/atomic-io.js +0 -65
- package/dist/storage/atomic-io.js.map +0 -1
- package/dist/storage/atomic-io.test.js +0 -49
- package/dist/storage/atomic-io.test.js.map +0 -1
- package/dist/storage/config.js +0 -35
- package/dist/storage/config.js.map +0 -1
- package/dist/storage/config.test.js.map +0 -1
- package/dist/storage/db.js +0 -71
- package/dist/storage/db.js.map +0 -1
- package/dist/storage/index.d.ts +0 -8
- package/dist/storage/index.js +0 -10
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/migrations.d.ts +0 -2
- package/dist/storage/migrations.js +0 -138
- package/dist/storage/migrations.js.map +0 -1
- package/dist/storage/session-dir.js.map +0 -1
- package/dist/storage/sessions.d.ts +0 -16
- package/dist/storage/sessions.js +0 -142
- package/dist/storage/sessions.js.map +0 -1
- package/dist/storage/tool-results.d.ts +0 -4
- package/dist/storage/tool-results.js.map +0 -1
- package/dist/storage/transcript-view.js +0 -23
- package/dist/storage/transcript-view.js.map +0 -1
- package/dist/storage/transcript.d.ts +0 -12
- package/dist/storage/transcript.js +0 -269
- package/dist/storage/transcript.js.map +0 -1
- package/dist/storage/transcript.test.js +0 -22
- package/dist/storage/transcript.test.js.map +0 -1
- package/dist/storage/usage-cap.js.map +0 -1
- package/dist/storage/usage-cap.test.js.map +0 -1
- package/dist/storage/usage.d.ts +0 -11
- package/dist/storage/usage.js +0 -65
- package/dist/storage/usage.js.map +0 -1
- package/dist/storage/workspaces.d.ts +0 -9
- package/dist/storage/workspaces.js +0 -60
- package/dist/storage/workspaces.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -46
- package/dist/tools/bash.js +0 -541
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/bash.test.js +0 -240
- package/dist/tools/bash.test.js.map +0 -1
- package/dist/tools/computer.d.ts +0 -88
- package/dist/tools/computer.js.map +0 -1
- package/dist/tools/computer.test.js +0 -142
- package/dist/tools/computer.test.js.map +0 -1
- package/dist/tools/file.d.ts +0 -17
- package/dist/tools/file.js +0 -101
- package/dist/tools/file.js.map +0 -1
- package/dist/tools/file.test.js +0 -58
- package/dist/tools/file.test.js.map +0 -1
- package/dist/tools/grep.d.ts +0 -8
- package/dist/tools/grep.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -19
- package/dist/tools/registry.js +0 -245
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/schedule.js +0 -498
- package/dist/tools/schedule.js.map +0 -1
- package/dist/tools/schedule.test.js +0 -118
- package/dist/tools/schedule.test.js.map +0 -1
- package/dist/types/index.d.ts +0 -279
- package/dist/types/index.js.map +0 -1
- package/dist/ui/agents-modal.d.ts +0 -36
- package/dist/ui/agents-modal.js +0 -54
- package/dist/ui/agents-modal.js.map +0 -1
- package/dist/ui/app.d.ts +0 -31
- package/dist/ui/app.js +0 -3957
- package/dist/ui/app.js.map +0 -1
- package/dist/ui/components/SuggestionOverlay.js.map +0 -1
- package/dist/ui/components/btw-overlay.js.map +0 -1
- package/dist/ui/hooks/useTypeahead.js +0 -111
- package/dist/ui/hooks/useTypeahead.js.map +0 -1
- package/dist/ui/markdown.d.ts +0 -5
- package/dist/ui/markdown.js.map +0 -1
- package/dist/ui/mcp-modal-types.d.ts +0 -24
- package/dist/ui/mcp-modal-types.js.map +0 -1
- package/dist/ui/mcp-modal.d.ts +0 -33
- package/dist/ui/mcp-modal.js +0 -94
- package/dist/ui/mcp-modal.js.map +0 -1
- package/dist/ui/plan.d.ts +0 -24
- package/dist/ui/plan.js.map +0 -1
- package/dist/ui/schedule-modal.d.ts +0 -15
- package/dist/ui/schedule-modal.js +0 -36
- package/dist/ui/schedule-modal.js.map +0 -1
- package/dist/ui/slash/__tests__/clear.test.js.map +0 -1
- package/dist/ui/slash/__tests__/compact.test.js.map +0 -1
- package/dist/ui/slash/__tests__/cost.test.js.map +0 -1
- package/dist/ui/slash/__tests__/discuss.test.js.map +0 -1
- package/dist/ui/slash/__tests__/execute.test.js.map +0 -1
- package/dist/ui/slash/__tests__/expand.test.js.map +0 -1
- package/dist/ui/slash/__tests__/optimize.test.js +0 -130
- package/dist/ui/slash/__tests__/optimize.test.js.map +0 -1
- package/dist/ui/slash/__tests__/plan.test.js.map +0 -1
- package/dist/ui/slash/clear.js.map +0 -1
- package/dist/ui/slash/compact.js.map +0 -1
- package/dist/ui/slash/cost.js +0 -55
- package/dist/ui/slash/cost.js.map +0 -1
- package/dist/ui/slash/council.js +0 -22
- package/dist/ui/slash/council.js.map +0 -1
- package/dist/ui/slash/debug.js +0 -111
- package/dist/ui/slash/debug.js.map +0 -1
- package/dist/ui/slash/discuss.js.map +0 -1
- package/dist/ui/slash/ee.js +0 -247
- package/dist/ui/slash/ee.js.map +0 -1
- package/dist/ui/slash/execute.js.map +0 -1
- package/dist/ui/slash/expand.js.map +0 -1
- package/dist/ui/slash/optimize.js +0 -37
- package/dist/ui/slash/optimize.js.map +0 -1
- package/dist/ui/slash/plan.js.map +0 -1
- package/dist/ui/slash/registry.d.ts +0 -23
- package/dist/ui/slash/registry.js.map +0 -1
- package/dist/ui/slash/route.js.map +0 -1
- package/dist/ui/slash/route.test.js.map +0 -1
- package/dist/ui/status-bar/index.d.ts +0 -14
- package/dist/ui/status-bar/index.js +0 -74
- package/dist/ui/status-bar/index.js.map +0 -1
- package/dist/ui/status-bar/index.test.js.map +0 -1
- package/dist/ui/status-bar/store.js +0 -146
- package/dist/ui/status-bar/store.js.map +0 -1
- package/dist/ui/status-bar/store.test.js.map +0 -1
- package/dist/ui/status-bar/tier-badge.js.map +0 -1
- package/dist/ui/status-bar/tier-badge.test.js.map +0 -1
- package/dist/ui/status-bar/usd-meter.js.map +0 -1
- package/dist/ui/status-bar/usd-meter.test.js.map +0 -1
- package/dist/ui/terminal-selection-text.js.map +0 -1
- package/dist/ui/theme.d.ts +0 -53
- package/dist/ui/theme.js +0 -53
- package/dist/ui/theme.js.map +0 -1
- package/dist/usage/downgrade.js.map +0 -1
- package/dist/usage/downgrade.test.js.map +0 -1
- package/dist/usage/estimator.d.ts +0 -17
- package/dist/usage/estimator.js +0 -28
- package/dist/usage/estimator.js.map +0 -1
- package/dist/usage/estimator.test.js.map +0 -1
- package/dist/usage/ledger.d.ts +0 -42
- package/dist/usage/ledger.js +0 -181
- package/dist/usage/ledger.js.map +0 -1
- package/dist/usage/ledger.test.js.map +0 -1
- package/dist/usage/midstream.js.map +0 -1
- package/dist/usage/midstream.test.js.map +0 -1
- package/dist/usage/thresholds.js.map +0 -1
- package/dist/usage/thresholds.test.js.map +0 -1
- package/dist/usage/types.d.ts +0 -30
- package/dist/usage/types.js.map +0 -1
- package/dist/utils/at-mentions.js.map +0 -1
- package/dist/utils/clipboard-image.js +0 -127
- package/dist/utils/clipboard-image.js.map +0 -1
- package/dist/utils/file-index.js.map +0 -1
- package/dist/utils/git-root.js.map +0 -1
- package/dist/utils/host-clipboard.d.ts +0 -4
- package/dist/utils/host-clipboard.js +0 -32
- package/dist/utils/host-clipboard.js.map +0 -1
- package/dist/utils/install-manager.js.map +0 -1
- package/dist/utils/install-manager.test.js +0 -127
- package/dist/utils/install-manager.test.js.map +0 -1
- package/dist/utils/instructions.js +0 -107
- package/dist/utils/instructions.js.map +0 -1
- package/dist/utils/instructions.test.js +0 -68
- package/dist/utils/instructions.test.js.map +0 -1
- package/dist/utils/permission-mode.js.map +0 -1
- package/dist/utils/permission-mode.test.js.map +0 -1
- package/dist/utils/redactor.js.map +0 -1
- package/dist/utils/redactor.test.js +0 -84
- package/dist/utils/redactor.test.js.map +0 -1
- package/dist/utils/settings.d.ts +0 -182
- package/dist/utils/settings.js +0 -585
- package/dist/utils/settings.js.map +0 -1
- package/dist/utils/settings.test.js +0 -160
- package/dist/utils/settings.test.js.map +0 -1
- package/dist/utils/side-question.js.map +0 -1
- package/dist/utils/skills.js +0 -194
- package/dist/utils/skills.js.map +0 -1
- package/dist/utils/skills.test.js +0 -45
- package/dist/utils/skills.test.js.map +0 -1
- package/dist/utils/subagent-display.js.map +0 -1
- package/dist/utils/subagent-display.test.js +0 -21
- package/dist/utils/subagent-display.test.js.map +0 -1
- package/dist/utils/subagents-settings.test.js +0 -58
- package/dist/utils/subagents-settings.test.js.map +0 -1
- package/dist/utils/telegram-audio-settings.test.js +0 -39
- package/dist/utils/telegram-audio-settings.test.js.map +0 -1
- package/dist/utils/update-checker.js +0 -22
- package/dist/utils/update-checker.js.map +0 -1
- package/dist/utils/update-checker.test.js +0 -125
- package/dist/utils/update-checker.test.js.map +0 -1
- package/dist/verify/checkpoint.d.ts +0 -11
- package/dist/verify/checkpoint.js.map +0 -1
- package/dist/verify/checkpoint.test.js +0 -160
- package/dist/verify/checkpoint.test.js.map +0 -1
- package/dist/verify/entrypoint.d.ts +0 -30
- package/dist/verify/entrypoint.js +0 -349
- package/dist/verify/entrypoint.js.map +0 -1
- package/dist/verify/entrypoint.test.js +0 -233
- package/dist/verify/entrypoint.test.js.map +0 -1
- package/dist/verify/environment.d.ts +0 -9
- package/dist/verify/environment.js +0 -116
- package/dist/verify/environment.js.map +0 -1
- package/dist/verify/environment.test.js +0 -94
- package/dist/verify/environment.test.js.map +0 -1
- package/dist/verify/evidence.d.ts +0 -10
- package/dist/verify/evidence.js.map +0 -1
- package/dist/verify/orchestrator.d.ts +0 -25
- package/dist/verify/orchestrator.js +0 -87
- package/dist/verify/orchestrator.js.map +0 -1
- package/dist/verify/orchestrator.test.js +0 -126
- package/dist/verify/orchestrator.test.js.map +0 -1
- package/dist/verify/recipes.d.ts +0 -20
- package/dist/verify/recipes.js +0 -451
- package/dist/verify/recipes.js.map +0 -1
- package/dist/verify/retry.d.ts +0 -4
- package/dist/verify/retry.js.map +0 -1
- package/dist/verify/runtime-prep.test.js +0 -38
- package/dist/verify/runtime-prep.test.js.map +0 -1
- /package/dist/{__test-stubs__ → src/__test-stubs__}/ee-server.d.ts +0 -0
- /package/dist/{__test-stubs__ → src/__test-stubs__}/ee-server.js +0 -0
- /package/dist/{daemon/scheduler.test.d.ts → src/__test-stubs__/vitest-setup.d.ts} +0 -0
- /package/dist/{ee/auth.test.d.ts → src/__tests__/council/bubble-layout.test.d.ts} +0 -0
- /package/dist/{ee/bridge.test.d.ts → src/__tests__/council/code-block-truncate.test.d.ts} +0 -0
- /package/dist/{ee/client.test.d.ts → src/__tests__/council/role-palette.test.d.ts} +0 -0
- /package/dist/{ee/extract-session.test.d.ts → src/__tests__/first-run-wizard.test.d.ts} +0 -0
- /package/dist/{ee/intercept.test.d.ts → src/agent-harness/__tests__/cli-flags.spec.d.ts} +0 -0
- /package/dist/{ee/judge.test.d.ts → src/agent-harness/__tests__/driver.spec.d.ts} +0 -0
- /package/dist/{ee/offline-queue.test.d.ts → src/agent-harness/__tests__/idle.spec.d.ts} +0 -0
- /package/dist/{ee/posttool.test.d.ts → src/agent-harness/__tests__/mock-llm.spec.d.ts} +0 -0
- /package/dist/{ee/render.test.d.ts → src/agent-harness/__tests__/predicate.spec.d.ts} +0 -0
- /package/dist/{ee/scope.test.d.ts → src/agent-harness/__tests__/protocol.spec.d.ts} +0 -0
- /package/dist/{ee/touch.test.d.ts → src/agent-harness/__tests__/schema.spec.d.ts} +0 -0
- /package/dist/{flow/__tests__/migration.test.d.ts → src/agent-harness/__tests__/selector.spec.d.ts} +0 -0
- /package/dist/{flow/__tests__/parser.test.d.ts → src/agent-harness/__tests__/sidechannel.spec.d.ts} +0 -0
- /package/dist/{flow/__tests__/run-manager.test.d.ts → src/agent-harness/__tests__/spec-helpers.spec.d.ts} +0 -0
- /package/dist/{billing → src/billing}/index.d.ts +0 -0
- /package/dist/{billing → src/billing}/index.js +0 -0
- /package/dist/{flow/__tests__/scaffold.test.d.ts → src/chat/__tests__/broadcast-bus.test.d.ts} +0 -0
- /package/dist/{flow/compaction/__tests__/compress.test.d.ts → src/chat/__tests__/channel-manager.test.d.ts} +0 -0
- /package/dist/{flow/compaction/__tests__/extract.test.d.ts → src/chat/__tests__/client.test.d.ts} +0 -0
- /package/dist/{flow/compaction/__tests__/preserve.test.d.ts → src/chat/__tests__/discord-integration.test.d.ts} +0 -0
- /package/dist/{gsd/__tests__/types.test.d.ts → src/chat/__tests__/intent-prompt.test.d.ts} +0 -0
- /package/dist/{headless/output.test.d.ts → src/chat/__tests__/verdict-resolver.test.d.ts} +0 -0
- /package/dist/{lsp/builtins.test.d.ts → src/cli/__tests__/bw-vault.test.d.ts} +0 -0
- /package/dist/{lsp/manager.test.d.ts → src/cli/__tests__/keys-bundle.test.d.ts} +0 -0
- /package/dist/{lsp/npm-cache.test.d.ts → src/cli/__tests__/share-cmd.test.d.ts} +0 -0
- /package/dist/{lsp/smoke.test.d.ts → src/cli/config/__tests__/model-picker.test.d.ts} +0 -0
- /package/dist/{mcp/parse-headers.test.d.ts → src/cli/config/__tests__/provider-fetch.test.d.ts} +0 -0
- /package/dist/{mcp/smoke.test.d.ts → src/cli/cost-forensics.test.d.ts} +0 -0
- /package/dist/{models/__tests__/registry.test.d.ts → src/cli/keys.test.d.ts} +0 -0
- /package/dist/{cloud → src/cloud}/index.d.ts +0 -0
- /package/dist/{cloud → src/cloud}/index.js +0 -0
- /package/dist/{ops/bug-report.test.d.ts → src/council/__tests__/accounting.test.d.ts} +0 -0
- /package/dist/{ops/doctor.test.d.ts → src/council/__tests__/audit-replay.test.d.ts} +0 -0
- /package/dist/{orchestrator/__tests__/route-feedback.test.d.ts → src/council/__tests__/clarifier-max-rounds.test.d.ts} +0 -0
- /package/dist/{orchestrator/abort.test.d.ts → src/council/__tests__/clarifier-options.test.d.ts} +0 -0
- /package/dist/{orchestrator/agent.test.d.ts → src/council/__tests__/cost-aware.test.d.ts} +0 -0
- /package/dist/{orchestrator/cleanup.test.d.ts → src/council/__tests__/debate-planner-structured.test.d.ts} +0 -0
- /package/dist/{orchestrator/compaction.test.d.ts → src/council/__tests__/evaluator-metrics.test.d.ts} +0 -0
- /package/dist/{orchestrator/delegations.test.d.ts → src/council/__tests__/parse-outcome-fallback.test.d.ts} +0 -0
- /package/dist/{orchestrator/pending-calls.test.d.ts → src/council/__tests__/research-tools.test.d.ts} +0 -0
- /package/dist/{orchestrator/reasoning.test.d.ts → src/council/__tests__/round-tools.test.d.ts} +0 -0
- /package/dist/{orchestrator/sandbox.test.d.ts → src/council/__tests__/tool-trace.test.d.ts} +0 -0
- /package/dist/{router → src/council}/types.js +0 -0
- /package/dist/{pil/__tests__/budget.test.d.ts → src/daemon/scheduler.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/layer1-intent.test.d.ts → src/ee/__tests__/pil-context-bridge.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/__tests__/pipeline.integration.test.d.ts +0 -0
- /package/dist/{pil/__tests__/layer2-personality.test.d.ts → src/ee/__tests__/render-sink-wiring.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/layer3-ee-injection.test.d.ts → src/ee/auth.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/auth.test.js +0 -0
- /package/dist/{pil/__tests__/layer4-gsd.test.d.ts → src/ee/bridge.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/bridge.test.js +0 -0
- /package/dist/{ee → src/ee}/client.d.ts +0 -0
- /package/dist/{pil/__tests__/layer5-context.test.d.ts → src/ee/client.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/client.test.js +0 -0
- /package/dist/{ee → src/ee}/embedding-cache.d.ts +0 -0
- /package/dist/{ee → src/ee}/embedding-cache.js +0 -0
- /package/dist/{ee → src/ee}/extract-session.d.ts +0 -0
- /package/dist/{pil/__tests__/layer6-output.test.d.ts → src/ee/extract-session.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/health.d.ts +0 -0
- /package/dist/{ee → src/ee}/intercept.d.ts +0 -0
- /package/dist/{pil/__tests__/ollama-classify.test.d.ts → src/ee/intercept.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/pipeline.test.d.ts → src/ee/judge.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/response-tools.test.d.ts → src/ee/mistake-detector.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/offline-queue.d.ts +0 -0
- /package/dist/{ee → src/ee}/offline-queue.js +0 -0
- /package/dist/{pil/__tests__/schema.test.d.ts → src/ee/offline-queue.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/store.test.d.ts → src/ee/phase-outcome.test.d.ts} +0 -0
- /package/dist/{pil/__tests__/task-tier-map.test.d.ts → src/ee/phase-tracker.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/posttool.d.ts +0 -0
- /package/dist/{ee → src/ee}/posttool.js +0 -0
- /package/dist/{providers/__tests__/runtime-integration.test.d.ts → src/ee/posttool.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/posttool.test.js +0 -0
- /package/dist/{ee → src/ee}/prompt-stale.d.ts +0 -0
- /package/dist/{ee → src/ee}/prompt-stale.js +0 -0
- /package/dist/{ee → src/ee}/prompt-stale.test.d.ts +0 -0
- /package/dist/{providers/__tests__/runtime.test.d.ts → src/ee/render.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/scope.d.ts +0 -0
- /package/dist/{ee → src/ee}/scope.js +0 -0
- /package/dist/{providers/adapter.test.d.ts → src/ee/scope.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/scope.test.js +0 -0
- /package/dist/{providers/errors.test.d.ts → src/ee/session-trajectory.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/tenant.d.ts +0 -0
- /package/dist/{ee → src/ee}/tenant.js +0 -0
- /package/dist/{providers/gemini.test.d.ts → src/ee/touch.test.d.ts} +0 -0
- /package/dist/{ee → src/ee}/types.js +0 -0
- /package/dist/{providers/keychain.test.d.ts → src/flow/__tests__/migration.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/__tests__/migration.test.js +0 -0
- /package/dist/{providers/ollama.test.d.ts → src/flow/__tests__/parser.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/__tests__/parser.test.js +0 -0
- /package/dist/{providers/openai-compatible.test.d.ts → src/flow/__tests__/run-manager-product.test.d.ts} +0 -0
- /package/dist/{providers/openai.test.d.ts → src/flow/__tests__/run-manager.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/__tests__/run-manager.test.js +0 -0
- /package/dist/{providers/pricing.test.d.ts → src/flow/__tests__/scaffold-checkpoint.test.d.ts} +0 -0
- /package/dist/{providers/vision-proxy.test.d.ts → src/flow/__tests__/scaffold.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/__tests__/scaffold.test.js +0 -0
- /package/dist/{flow → src/flow}/__tests__/warning-persist.test.d.ts +0 -0
- /package/dist/{flow → src/flow}/__tests__/warning-persist.test.js +0 -0
- /package/dist/{flow → src/flow}/artifact-io.d.ts +0 -0
- /package/dist/{flow → src/flow}/artifact-io.js +0 -0
- /package/dist/{router/classifier/index.test.d.ts → src/flow/compaction/__tests__/compress.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/compaction/__tests__/compress.test.js +0 -0
- /package/dist/{router/classifier/regex.test.d.ts → src/flow/compaction/__tests__/extract.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/compaction/__tests__/extract.test.js +0 -0
- /package/dist/{router/classifier/tree-sitter.test.d.ts → src/flow/compaction/__tests__/preserve.test.d.ts} +0 -0
- /package/dist/{flow → src/flow}/compaction/__tests__/preserve.test.js +0 -0
- /package/dist/{flow → src/flow}/compaction/compress.d.ts +0 -0
- /package/dist/{flow → src/flow}/compaction/compress.js +0 -0
- /package/dist/{flow → src/flow}/compaction/extract.d.ts +0 -0
- /package/dist/{flow → src/flow}/compaction/extract.js +0 -0
- /package/dist/{flow → src/flow}/compaction/index.d.ts +0 -0
- /package/dist/{flow → src/flow}/compaction/index.js +0 -0
- /package/dist/{flow → src/flow}/compaction/preserve.d.ts +0 -0
- /package/dist/{flow → src/flow}/compaction/preserve.js +0 -0
- /package/dist/{flow → src/flow}/index.d.ts +0 -0
- /package/dist/{flow → src/flow}/index.js +0 -0
- /package/dist/{flow → src/flow}/migration.d.ts +0 -0
- /package/dist/{flow → src/flow}/migration.js +0 -0
- /package/dist/{flow → src/flow}/parser.d.ts +0 -0
- /package/dist/{flow → src/flow}/parser.js +0 -0
- /package/dist/{flow → src/flow}/scaffold.d.ts +0 -0
- /package/dist/{flow → src/flow}/scaffold.js +0 -0
- /package/dist/{flow → src/flow}/warning-persist.d.ts +0 -0
- /package/dist/{flow → src/flow}/warning-persist.js +0 -0
- /package/dist/{router/cold.test.d.ts → src/gsd/__tests__/complexity.test.d.ts} +0 -0
- /package/dist/{router/decide.test.d.ts → src/gsd/__tests__/directives.test.d.ts} +0 -0
- /package/dist/{router/health.test.d.ts → src/gsd/__tests__/gray-areas.test.d.ts} +0 -0
- /package/dist/{router/warm.test.d.ts → src/gsd/__tests__/types.test.d.ts} +0 -0
- /package/dist/{gsd → src/gsd}/index.d.ts +0 -0
- /package/dist/{gsd → src/gsd}/index.js +0 -0
- /package/dist/{gsd → src/gsd}/types.js +0 -0
- /package/dist/{storage/atomic-io.test.d.ts → src/headless/__tests__/council-answers.test.d.ts} +0 -0
- /package/dist/{headless → src/headless}/output.js +0 -0
- /package/dist/{storage/config.test.d.ts → src/headless/output.test.d.ts} +0 -0
- /package/dist/{hooks → src/hooks}/config.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/config.js +0 -0
- /package/dist/{hooks → src/hooks}/types.js +0 -0
- /package/dist/{storage/transcript.test.d.ts → src/lsp/builtins.test.d.ts} +0 -0
- /package/dist/{storage/usage-cap.test.d.ts → src/lsp/manager.test.d.ts} +0 -0
- /package/dist/{lsp → src/lsp}/npm-cache.d.ts +0 -0
- /package/dist/{lsp → src/lsp}/npm-cache.js +0 -0
- /package/dist/{tools/bash.test.d.ts → src/lsp/npm-cache.test.d.ts} +0 -0
- /package/dist/{tools/computer.test.d.ts → src/lsp/smoke.test.d.ts} +0 -0
- /package/dist/{lsp → src/lsp}/smoke.test.js +0 -0
- /package/dist/{lsp → src/lsp}/types.d.ts +0 -0
- /package/dist/{lsp → src/lsp}/types.js +0 -0
- /package/dist/{tools/file.test.d.ts → src/mcp/__tests__/auto-setup.test.d.ts} +0 -0
- /package/dist/{tools/schedule.test.d.ts → src/mcp/__tests__/harness-driver-action-tools.spec.d.ts} +0 -0
- /package/dist/{ui/slash/__tests__/discuss.test.d.ts → src/mcp/__tests__/harness-driver-async-tools.spec.d.ts} +0 -0
- /package/dist/{ui/slash/__tests__/execute.test.d.ts → src/mcp/__tests__/harness-driver-read-tools.spec.d.ts} +0 -0
- /package/dist/{ui/slash/__tests__/plan.test.d.ts → src/mcp/__tests__/harness-driver-security.spec.d.ts} +0 -0
- /package/dist/{ui/status-bar/index.test.d.ts → src/mcp/__tests__/harness-driver.spec.d.ts} +0 -0
- /package/dist/{ui/status-bar/store.test.d.ts → src/mcp/__tests__/lazy-schema.spec.d.ts} +0 -0
- /package/dist/{ui/status-bar/tier-badge.test.d.ts → src/mcp/__tests__/mcp-keychain.test.d.ts} +0 -0
- /package/dist/{ui/status-bar/usd-meter.test.d.ts → src/mcp/__tests__/research-onboarding.test.d.ts} +0 -0
- /package/dist/{usage/downgrade.test.d.ts → src/mcp/__tests__/runtime-hydration.test.d.ts} +0 -0
- /package/dist/{usage/estimator.test.d.ts → src/mcp/__tests__/runtime-sanitize.test.d.ts} +0 -0
- /package/dist/{mcp → src/mcp}/auto-setup.d.ts +0 -0
- /package/dist/{mcp → src/mcp}/catalog.d.ts +0 -0
- /package/dist/{mcp → src/mcp}/oauth-provider.d.ts +0 -0
- /package/dist/{mcp → src/mcp}/oauth-provider.js +0 -0
- /package/dist/{mcp → src/mcp}/parse-headers.d.ts +0 -0
- /package/dist/{mcp → src/mcp}/parse-headers.js +0 -0
- /package/dist/{usage/ledger.test.d.ts → src/mcp/parse-headers.test.d.ts} +0 -0
- /package/dist/{mcp → src/mcp}/runtime.d.ts +0 -0
- /package/dist/{usage/midstream.test.d.ts → src/mcp/smoke.test.d.ts} +0 -0
- /package/dist/{mcp → src/mcp}/smoke.test.js +0 -0
- /package/dist/{mcp → src/mcp}/validate.js +0 -0
- /package/dist/{usage/thresholds.test.d.ts → src/models/__tests__/registry.test.d.ts} +0 -0
- /package/dist/{models → src/models}/catalog-client.d.ts +0 -0
- /package/dist/{models → src/models}/classify-tier.d.ts +0 -0
- /package/dist/{utils/install-manager.test.d.ts → src/ops/__tests__/doctor-council-mcp.test.d.ts} +0 -0
- /package/dist/{utils/instructions.test.d.ts → src/ops/__tests__/doctor-ee-health.test.d.ts} +0 -0
- /package/dist/{ops → src/ops}/bug-report.d.ts +0 -0
- /package/dist/{ops → src/ops}/bug-report.js +0 -0
- /package/dist/{utils/permission-mode.test.d.ts → src/ops/bug-report.test.d.ts} +0 -0
- /package/dist/{ops → src/ops}/bug-report.test.js +0 -0
- /package/dist/{ops → src/ops}/doctor.d.ts +0 -0
- /package/dist/{utils/redactor.test.d.ts → src/ops/doctor.test.d.ts} +0 -0
- /package/dist/{utils/settings.test.d.ts → src/orchestrator/__tests__/batch-turn-runner.test.d.ts} +0 -0
- /package/dist/{utils/skills.test.d.ts → src/orchestrator/__tests__/council-manager.test.d.ts} +0 -0
- /package/dist/{utils/subagent-display.test.d.ts → src/orchestrator/__tests__/cross-turn-dedup.test.d.ts} +0 -0
- /package/dist/{orchestrator → src/orchestrator}/__tests__/flow-resume.test.d.ts +0 -0
- /package/dist/{orchestrator → src/orchestrator}/__tests__/flow-resume.test.js +0 -0
- /package/dist/{utils/subagents-settings.test.d.ts → src/orchestrator/__tests__/message-processor.test.d.ts} +0 -0
- /package/dist/{utils/telegram-audio-settings.test.d.ts → src/orchestrator/__tests__/read-path-budget.test.d.ts} +0 -0
- /package/dist/{utils/update-checker.test.d.ts → src/orchestrator/__tests__/retry-classifier.test.d.ts} +0 -0
- /package/dist/{verify/checkpoint.test.d.ts → src/orchestrator/__tests__/retry-stream.test.d.ts} +0 -0
- /package/dist/{verify/entrypoint.test.d.ts → src/orchestrator/__tests__/route-feedback.test.d.ts} +0 -0
- /package/dist/{verify/environment.test.d.ts → src/orchestrator/__tests__/stream-runner.test.d.ts} +0 -0
- /package/dist/{orchestrator → src/orchestrator}/abort.d.ts +0 -0
- /package/dist/{orchestrator → src/orchestrator}/abort.js +0 -0
- /package/dist/{verify/orchestrator.test.d.ts → src/orchestrator/abort.test.d.ts} +0 -0
- /package/dist/{orchestrator → src/orchestrator}/abort.test.js +0 -0
- /package/dist/{verify/runtime-prep.test.d.ts → src/orchestrator/agent.test.d.ts} +0 -0
- /package/dist/{orchestrator → src/orchestrator}/delegations.js +0 -0
- /package/dist/{orchestrator → src/orchestrator}/pending-calls.d.ts +0 -0
- /package/dist/{orchestrator → src/orchestrator}/pending-calls.js +0 -0
- /package/dist/{orchestrator → src/orchestrator}/pending-calls.test.js +0 -0
- /package/dist/{orchestrator → src/orchestrator}/reasoning.d.ts +0 -0
- /package/dist/{pil → src/pil}/__tests__/ollama-classify.test.js +0 -0
- /package/dist/{pil → src/pil}/__tests__/orchestrator-integration.test.d.ts +0 -0
- /package/dist/{pil → src/pil}/__tests__/orchestrator-integration.test.js +0 -0
- /package/dist/{pil → src/pil}/__tests__/store.test.js +0 -0
- /package/dist/{pil → src/pil}/__tests__/task-tier-map.test.js +0 -0
- /package/dist/{pil → src/pil}/budget.d.ts +0 -0
- /package/dist/{pil → src/pil}/budget.js +0 -0
- /package/dist/{pil → src/pil}/layer2-personality.d.ts +0 -0
- /package/dist/{pil → src/pil}/layer5-context.d.ts +0 -0
- /package/dist/{pil → src/pil}/ollama-classify.d.ts +0 -0
- /package/dist/{pil → src/pil}/ollama-classify.js +0 -0
- /package/dist/{pil → src/pil}/store.d.ts +0 -0
- /package/dist/{pil → src/pil}/store.js +0 -0
- /package/dist/{pil → src/pil}/task-tier-map.d.ts +0 -0
- /package/dist/{pil → src/pil}/task-tier-map.js +0 -0
- /package/dist/{pil → src/pil}/timeout.d.ts +0 -0
- /package/dist/{pil → src/pil}/timeout.js +0 -0
- /package/dist/{pil → src/pil}/types.js +0 -0
- /package/dist/{providers → src/providers}/__test-utils__/load-fixture.d.ts +0 -0
- /package/dist/{providers → src/providers}/__test-utils__/load-fixture.js +0 -0
- /package/dist/{providers → src/providers}/adapter.test.js +0 -0
- /package/dist/{providers → src/providers}/anthropic.d.ts +0 -0
- /package/dist/{providers → src/providers}/errors.d.ts +0 -0
- /package/dist/{providers → src/providers}/errors.js +0 -0
- /package/dist/{providers → src/providers}/errors.test.js +0 -0
- /package/dist/{providers → src/providers}/gemini.d.ts +0 -0
- /package/dist/{providers → src/providers}/gemini.test.js +0 -0
- /package/dist/{providers → src/providers}/ollama.d.ts +0 -0
- /package/dist/{providers → src/providers}/ollama.js +0 -0
- /package/dist/{providers → src/providers}/ollama.test.js +0 -0
- /package/dist/{providers → src/providers}/openai-compatible.d.ts +0 -0
- /package/dist/{providers → src/providers}/openai.test.js +0 -0
- /package/dist/{providers → src/providers}/patch-zod-schema.d.ts +0 -0
- /package/dist/{providers → src/providers}/vision-proxy.d.ts +0 -0
- /package/dist/{router → src/router}/classifier/grammars.d.ts +0 -0
- /package/dist/{router → src/router}/classifier/grammars.js +0 -0
- /package/dist/{router → src/router}/classifier/index.d.ts +0 -0
- /package/dist/{router → src/router}/classifier/index.js +0 -0
- /package/dist/{router → src/router}/classifier/index.test.js +0 -0
- /package/dist/{router → src/router}/classifier/regex.d.ts +0 -0
- /package/dist/{router → src/router}/classifier/regex.test.js +0 -0
- /package/dist/{router → src/router}/classifier/tree-sitter.d.ts +0 -0
- /package/dist/{router → src/router}/classifier/tree-sitter.js +0 -0
- /package/dist/{router → src/router}/classifier/tree-sitter.test.js +0 -0
- /package/dist/{router → src/router}/cold.d.ts +0 -0
- /package/dist/{router → src/router}/cold.js +0 -0
- /package/dist/{router → src/router}/decide.d.ts +0 -0
- /package/dist/{router → src/router}/health.d.ts +0 -0
- /package/dist/{router → src/router}/health.js +0 -0
- /package/dist/{router → src/router}/health.test.js +0 -0
- /package/dist/{router → src/router}/store.d.ts +0 -0
- /package/dist/{router → src/router}/store.js +0 -0
- /package/dist/{router → src/router}/types.d.ts +0 -0
- /package/dist/{router → src/router}/warm.d.ts +0 -0
- /package/dist/{storage → src/storage}/__tests__/migrations.test.d.ts +0 -0
- /package/dist/{storage → src/storage}/__tests__/migrations.test.js +0 -0
- /package/dist/{storage → src/storage}/config.d.ts +0 -0
- /package/dist/{storage → src/storage}/config.test.js +0 -0
- /package/dist/{storage → src/storage}/db.d.ts +0 -0
- /package/dist/{storage → src/storage}/session-dir.d.ts +0 -0
- /package/dist/{storage → src/storage}/session-dir.js +0 -0
- /package/dist/{storage → src/storage}/tool-results.js +0 -0
- /package/dist/{storage → src/storage}/transcript-view.d.ts +0 -0
- /package/dist/{storage → src/storage}/usage-cap.d.ts +0 -0
- /package/dist/{storage → src/storage}/usage-cap.js +0 -0
- /package/dist/{storage → src/storage}/usage-cap.test.js +0 -0
- /package/dist/{tools → src/tools}/computer.js +0 -0
- /package/dist/{tools → src/tools}/grep.js +0 -0
- /package/dist/{tools → src/tools}/schedule.d.ts +0 -0
- /package/dist/{types → src/types}/index.js +0 -0
- /package/dist/{ui → src/ui}/components/SuggestionOverlay.d.ts +0 -0
- /package/dist/{ui → src/ui}/components/SuggestionOverlay.js +0 -0
- /package/dist/{ui → src/ui}/components/btw-overlay.d.ts +0 -0
- /package/dist/{ui → src/ui}/components/btw-overlay.js +0 -0
- /package/dist/{ui → src/ui}/hooks/useTypeahead.d.ts +0 -0
- /package/dist/{ui → src/ui}/markdown.js +0 -0
- /package/dist/{ui → src/ui}/mcp-modal-types.js +0 -0
- /package/dist/{ui → src/ui}/plan.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/clear.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/clear.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/compact.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/compact.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/cost.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/cost.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/discuss.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/execute.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/expand.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/expand.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/optimize.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/__tests__/plan.test.js +0 -0
- /package/dist/{ui → src/ui}/slash/clear.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/clear.js +0 -0
- /package/dist/{ui → src/ui}/slash/compact.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/compact.js +0 -0
- /package/dist/{ui → src/ui}/slash/cost.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/council.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/debug.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/discuss.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/discuss.js +0 -0
- /package/dist/{ui → src/ui}/slash/ee.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/execute.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/execute.js +0 -0
- /package/dist/{ui → src/ui}/slash/expand.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/expand.js +0 -0
- /package/dist/{ui → src/ui}/slash/optimize.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/plan.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/plan.js +0 -0
- /package/dist/{ui → src/ui}/slash/registry.js +0 -0
- /package/dist/{ui → src/ui}/slash/route.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/route.js +0 -0
- /package/dist/{ui → src/ui}/slash/route.test.d.ts +0 -0
- /package/dist/{ui → src/ui}/slash/route.test.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/index.test.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/store.d.ts +0 -0
- /package/dist/{ui → src/ui}/status-bar/store.test.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/tier-badge.d.ts +0 -0
- /package/dist/{ui → src/ui}/status-bar/tier-badge.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/tier-badge.test.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/usd-meter.d.ts +0 -0
- /package/dist/{ui → src/ui}/status-bar/usd-meter.js +0 -0
- /package/dist/{ui → src/ui}/status-bar/usd-meter.test.js +0 -0
- /package/dist/{ui → src/ui}/terminal-selection-text.d.ts +0 -0
- /package/dist/{ui → src/ui}/terminal-selection-text.js +0 -0
- /package/dist/{usage → src/usage}/downgrade.d.ts +0 -0
- /package/dist/{usage → src/usage}/downgrade.js +0 -0
- /package/dist/{usage → src/usage}/downgrade.test.js +0 -0
- /package/dist/{usage → src/usage}/estimator.test.js +0 -0
- /package/dist/{usage → src/usage}/ledger.test.js +0 -0
- /package/dist/{usage → src/usage}/midstream.d.ts +0 -0
- /package/dist/{usage → src/usage}/midstream.js +0 -0
- /package/dist/{usage → src/usage}/midstream.test.js +0 -0
- /package/dist/{usage → src/usage}/thresholds.d.ts +0 -0
- /package/dist/{usage → src/usage}/thresholds.js +0 -0
- /package/dist/{usage → src/usage}/thresholds.test.js +0 -0
- /package/dist/{usage → src/usage}/types.js +0 -0
- /package/dist/{utils → src/utils}/at-mentions.d.ts +0 -0
- /package/dist/{utils → src/utils}/at-mentions.js +0 -0
- /package/dist/{utils → src/utils}/clipboard-image.d.ts +0 -0
- /package/dist/{utils → src/utils}/file-index.d.ts +0 -0
- /package/dist/{utils → src/utils}/file-index.js +0 -0
- /package/dist/{utils → src/utils}/git-root.d.ts +0 -0
- /package/dist/{utils → src/utils}/git-root.js +0 -0
- /package/dist/{utils → src/utils}/install-manager.d.ts +0 -0
- /package/dist/{utils → src/utils}/install-manager.js +0 -0
- /package/dist/{utils → src/utils}/instructions.d.ts +0 -0
- /package/dist/{utils → src/utils}/permission-mode.d.ts +0 -0
- /package/dist/{utils → src/utils}/permission-mode.js +0 -0
- /package/dist/{utils → src/utils}/permission-mode.test.js +0 -0
- /package/dist/{utils → src/utils}/redactor.d.ts +0 -0
- /package/dist/{utils → src/utils}/redactor.js +0 -0
- /package/dist/{utils → src/utils}/side-question.d.ts +0 -0
- /package/dist/{utils → src/utils}/side-question.js +0 -0
- /package/dist/{utils → src/utils}/skills.d.ts +0 -0
- /package/dist/{utils → src/utils}/subagent-display.d.ts +0 -0
- /package/dist/{utils → src/utils}/subagent-display.js +0 -0
- /package/dist/{utils → src/utils}/update-checker.d.ts +0 -0
- /package/dist/{verify → src/verify}/checkpoint.js +0 -0
- /package/dist/{verify → src/verify}/evidence.js +0 -0
- /package/dist/{verify → src/verify}/retry.js +0 -0
|
@@ -0,0 +1,1985 @@
|
|
|
1
|
+
// MessageProcessor — extracted from orchestrator.ts as part of Phase 12.4.
|
|
2
|
+
//
|
|
3
|
+
// Owns the main streaming turn loop that lives in `Agent.processMessage`:
|
|
4
|
+
// - Abort wiring (external AbortContext + per-turn AbortController)
|
|
5
|
+
// - Trajectory + phase tracker observations on user_turn / abort
|
|
6
|
+
// - PIL enrichment pipeline (layers 1/3/6 — fail-open with logging)
|
|
7
|
+
// - ROUTE-11 per-turn model routing (decide + fallback to non-disabled
|
|
8
|
+
// provider via CouncilManager)
|
|
9
|
+
// - Vision proxy (history + current turn)
|
|
10
|
+
// - Auto-council gate (PIL taskType + heavy tier + role count) — routes
|
|
11
|
+
// into runCouncilV2 and re-enters processMessage with synthesis
|
|
12
|
+
// - System prompt assembly (chitchat / playwright gating + PIL suffix +
|
|
13
|
+
// model constraints)
|
|
14
|
+
// - SAMR step-aware routing (phase1 reasoning → phase2 execution)
|
|
15
|
+
// - Tool roundtrip loop:
|
|
16
|
+
// - Compaction (relax on overflow recovery, B4 top-level prepareStep)
|
|
17
|
+
// - Tool set assembly: builtin + MCP (smart filter for chitchat /
|
|
18
|
+
// browser-vocab) + PIL response tools, all wrapped with top-level
|
|
19
|
+
// cumulative cap (F1), cross-turn dedup (C3), read-path budget
|
|
20
|
+
// - ProviderOptions composition (buildTurnProviderOptions +
|
|
21
|
+
// taskTypeToReasoningEffort budget + thinkingType adaptive override
|
|
22
|
+
// + O1 shape capture)
|
|
23
|
+
// - streamText({...}) with prepareStep (top-level compactor +
|
|
24
|
+
// capability sanitizeHistory), onStepStart/Finish, onFinish
|
|
25
|
+
// (correlation cleanup)
|
|
26
|
+
// - fullStream consumer (text-delta / reasoning-delta / tool-call
|
|
27
|
+
// with EE PreToolUse intercept / tool-result with EE PostToolUse
|
|
28
|
+
// and vision-bridge / tool-error / tool-approval-request /
|
|
29
|
+
// error / abort)
|
|
30
|
+
// - Write-ahead persistence (Phase A4 tool_calls, A5 message_seq)
|
|
31
|
+
// - Context-overflow recovery + transient retry with exponential backoff
|
|
32
|
+
// - Post-turn compact + Stop / StopFailure hooks
|
|
33
|
+
// - Debug pipeline trace
|
|
34
|
+
//
|
|
35
|
+
// Zero behavioral changes — every method body mirrors the original
|
|
36
|
+
// `processMessage` (see commit history). The DI surface (`MessageProcessorDeps`)
|
|
37
|
+
// is the minimum proxy onto Agent state needed to reach back into Agent
|
|
38
|
+
// without holding a circular reference. Public `Agent.processMessage`
|
|
39
|
+
// signature is unchanged and continues to be the entrypoint; internally it
|
|
40
|
+
// constructs a `MessageProcessor` per call.
|
|
41
|
+
//
|
|
42
|
+
// Cost-leak code paths preserved here:
|
|
43
|
+
// - F1 (top-level cumulative cap) — wrapToolSetWithCap (top-level)
|
|
44
|
+
// - F1 (openai.promptCacheKey) — buildTurnProviderOptions
|
|
45
|
+
// - G1 (OAuth `maxOutputTokens` drop) — shouldDropParam(runtime, ...)
|
|
46
|
+
// - B4 (top-level prepareStep compaction) — compactSubAgentMessages
|
|
47
|
+
// - C3 (cross-turn dedup wrap) — wrapToolSetWithDedup
|
|
48
|
+
// - A4 (tool_call write-ahead) — persistToolCallWriteAhead
|
|
49
|
+
// - A5 (message_seq write-ahead) — persistMessageWriteAhead
|
|
50
|
+
// - O1 (providerOptions shape forensics) — extractProviderOptionsShape
|
|
51
|
+
// - siliconflow reasoning-strip — turnCaps.sanitizeHistory
|
|
52
|
+
|
|
53
|
+
import { type ModelMessage, stepCountIs, streamText, type ToolSet } from "ai";
|
|
54
|
+
import { getCachedAuthToken, getCachedServerBaseUrl } from "../ee/auth.js";
|
|
55
|
+
import { routeFeedback, routeModel } from "../ee/bridge.js";
|
|
56
|
+
import { getMistakeDetector } from "../ee/mistake-detector.js";
|
|
57
|
+
import { fireAndForgetPhaseOutcome } from "../ee/phase-outcome.js";
|
|
58
|
+
import * as phaseTracker from "../ee/phase-tracker.js";
|
|
59
|
+
import { buildScope as buildScopeForVeto } from "../ee/scope.js";
|
|
60
|
+
import { fireTrajectoryEvent } from "../ee/session-trajectory.js";
|
|
61
|
+
import { getTenantId as getTenantIdForVeto } from "../ee/tenant.js";
|
|
62
|
+
import type {
|
|
63
|
+
PostToolUseFailureHookInput,
|
|
64
|
+
PostToolUseHookInput,
|
|
65
|
+
PreToolUseHookInput,
|
|
66
|
+
SessionStartHookInput,
|
|
67
|
+
StopFailureHookInput,
|
|
68
|
+
StopHookInput,
|
|
69
|
+
UserPromptSubmitHookInput,
|
|
70
|
+
} from "../hooks/types";
|
|
71
|
+
import { buildMcpToolSet } from "../mcp/runtime";
|
|
72
|
+
import { getModelInfo } from "../models/registry.js";
|
|
73
|
+
import { applyPilSuffix, getResponseTaskType, getResponseToolSet, isResponseTool, runPipeline } from "../pil/index.js";
|
|
74
|
+
import { taskTypeToMaxTokens, taskTypeToReasoningEffort, taskTypeToTier } from "../pil/task-tier-map.js";
|
|
75
|
+
import { getProviderCapabilities } from "../providers/capabilities.js";
|
|
76
|
+
import { loadKeyForProvider } from "../providers/keychain.js";
|
|
77
|
+
import {
|
|
78
|
+
bridgeMcpToolResult,
|
|
79
|
+
getVisionGuidanceForTextOnly,
|
|
80
|
+
scrubImagePayloadsInMessages,
|
|
81
|
+
} from "../providers/mcp-vision-bridge.js";
|
|
82
|
+
import { captureToolSchemas } from "../providers/patch-zod-schema.js";
|
|
83
|
+
import {
|
|
84
|
+
buildTurnProviderOptions,
|
|
85
|
+
detectProviderForModel,
|
|
86
|
+
type ResolvedModelRuntime,
|
|
87
|
+
resolveModelRuntime,
|
|
88
|
+
shouldDropParam,
|
|
89
|
+
} from "../providers/runtime.js";
|
|
90
|
+
import type { ProviderId } from "../providers/types.js";
|
|
91
|
+
import { needsVisionProxy, proxyVision } from "../providers/vision-proxy.js";
|
|
92
|
+
import { wireDebug } from "../providers/wire-debug.js";
|
|
93
|
+
import { reportRouteOutcome } from "../router/decide.js";
|
|
94
|
+
import { decideStepRouting, getStepRouterConfig } from "../router/step-router.js";
|
|
95
|
+
import { routerStore } from "../router/store.js";
|
|
96
|
+
import {
|
|
97
|
+
getNextMessageSequence,
|
|
98
|
+
logInteraction,
|
|
99
|
+
markMessageErrored,
|
|
100
|
+
markToolCallErrored,
|
|
101
|
+
persistMessageWriteAhead,
|
|
102
|
+
persistToolCallWriteAhead,
|
|
103
|
+
type SessionStore,
|
|
104
|
+
} from "../storage/index";
|
|
105
|
+
import type { BashTool } from "../tools/bash";
|
|
106
|
+
import { createBuiltinTools } from "../tools/registry.js";
|
|
107
|
+
import type { AgentMode, SessionInfo, StreamChunk, SubagentStatus, ToolCall, ToolResult } from "../types/index";
|
|
108
|
+
import { isDebugEnabled, type PipelineStep, recordTurnTrace, type TurnTrace } from "../ui/slash/debug.js";
|
|
109
|
+
import { statusBarStore } from "../ui/status-bar/store.js";
|
|
110
|
+
import { appendDecisionLog } from "../usage/decision-log.js";
|
|
111
|
+
import { type PermissionMode, toolNeedsApproval } from "../utils/permission-mode.js";
|
|
112
|
+
import {
|
|
113
|
+
getAutoCouncilConfidence,
|
|
114
|
+
getAutoCouncilMinRoles,
|
|
115
|
+
getRoleModels,
|
|
116
|
+
getTopLevelCompactKeepLast,
|
|
117
|
+
getTopLevelCompactThresholdChars,
|
|
118
|
+
getTopLevelToolBudgetChars,
|
|
119
|
+
isAutoCouncilEnabled,
|
|
120
|
+
isProviderDisabled,
|
|
121
|
+
loadMcpServers,
|
|
122
|
+
loadValidSubAgents,
|
|
123
|
+
} from "../utils/settings";
|
|
124
|
+
import type { AbortContext } from "./abort.js";
|
|
125
|
+
import type { LegacyProvider, ProcessMessageObserver } from "./agent-options";
|
|
126
|
+
import { relaxCompactionSettings } from "./compaction";
|
|
127
|
+
import type { CouncilManager } from "./council-manager.js";
|
|
128
|
+
import type { CrossTurnDedup } from "./cross-turn-dedup.js";
|
|
129
|
+
import { wrapToolSetWithDedup } from "./cross-turn-dedup.js";
|
|
130
|
+
import { humanizeApiError, isAuthenticationError, isContextLimitError } from "./error-utils";
|
|
131
|
+
import { lastPersistedSeq } from "./message-seq.js";
|
|
132
|
+
import type { PendingCallsLog } from "./pending-calls.js";
|
|
133
|
+
import { stableCallId } from "./pending-calls.js";
|
|
134
|
+
import { applyModelConstraints, buildSystemPromptParts } from "./prompts";
|
|
135
|
+
import { extractProviderOptionsShape } from "./provider-options-shape.js";
|
|
136
|
+
import type { ReadPathBudget } from "./read-path-budget.js";
|
|
137
|
+
import { wrapToolSetWithReadBudget } from "./read-path-budget.js";
|
|
138
|
+
import { containsEncryptedReasoning, sanitizeModelMessages } from "./reasoning";
|
|
139
|
+
import { classifyStreamError } from "./retry-classifier.js";
|
|
140
|
+
import { wrapToolSetWithCap } from "./sub-agent-cap.js";
|
|
141
|
+
import { compactSubAgentMessages } from "./subagent-compactor.js";
|
|
142
|
+
import {
|
|
143
|
+
combineAbortSignals,
|
|
144
|
+
getFinishReason,
|
|
145
|
+
getStepNumber,
|
|
146
|
+
getUsage,
|
|
147
|
+
notifyObserver,
|
|
148
|
+
toToolCall,
|
|
149
|
+
toToolResult,
|
|
150
|
+
} from "./tool-utils";
|
|
151
|
+
import type { TurnRunnerDepsBase } from "./turn-runner-deps.js";
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Dependency surface the MessageProcessor needs to reach back into Agent
|
|
155
|
+
* state without holding a circular reference. Properties expose array
|
|
156
|
+
* references (mutating push() must affect the same array the Agent reads on
|
|
157
|
+
* subsequent turns). Method callbacks delegate to Agent private methods.
|
|
158
|
+
*/
|
|
159
|
+
export interface MessageProcessorDeps extends TurnRunnerDepsBase {
|
|
160
|
+
// ---- Read/write state references --------------------------------------
|
|
161
|
+
// (messages, bash, mode, maxToolRounds, schedules, sendTelegramFile inherited)
|
|
162
|
+
/** Live messageSeqs array (mutated by push; parallel to messages). */
|
|
163
|
+
readonly messageSeqs: Array<number | null>;
|
|
164
|
+
/** Session bookkeeping. */
|
|
165
|
+
readonly session: SessionInfo | null;
|
|
166
|
+
readonly sessionStore: SessionStore | null;
|
|
167
|
+
readonly modelId: string;
|
|
168
|
+
readonly providerId: ProviderId;
|
|
169
|
+
readonly batchApi: boolean;
|
|
170
|
+
readonly permissionMode: PermissionMode;
|
|
171
|
+
readonly externalAbortContext: AbortContext | null;
|
|
172
|
+
readonly pendingCalls: PendingCallsLog | null;
|
|
173
|
+
readonly councilManager: CouncilManager;
|
|
174
|
+
readonly crossTurnDedup: CrossTurnDedup | null;
|
|
175
|
+
readonly readBudget: ReadPathBudget | null;
|
|
176
|
+
readonly priorWarningIdsInSession: Set<string>;
|
|
177
|
+
readonly sessionEEGuidance: Map<string, { toolName: string; message: string; why: string; confidence: number }>;
|
|
178
|
+
readonly flowReady: Promise<void> | null;
|
|
179
|
+
|
|
180
|
+
// ---- Scalar getters / setters -----------------------------------------
|
|
181
|
+
getAbortController(): AbortController | null;
|
|
182
|
+
setAbortController(ctrl: AbortController | null): void;
|
|
183
|
+
getSessionStartHookFired(): boolean;
|
|
184
|
+
setSessionStartHookFired(v: boolean): void;
|
|
185
|
+
getPlanContext(): string | null;
|
|
186
|
+
setPlanContext(v: string | null): void;
|
|
187
|
+
getResumeDigest(): string | null;
|
|
188
|
+
setResumeDigest(v: string | null): void;
|
|
189
|
+
getActiveRunId(): string | null;
|
|
190
|
+
getPendingCwdNote(): string | null;
|
|
191
|
+
setPendingCwdNote(v: string | null): void;
|
|
192
|
+
setPilActive(v: boolean): void;
|
|
193
|
+
setPilEnrichmentDelta(n: number): void;
|
|
194
|
+
setCurrentCallId(id: string): void;
|
|
195
|
+
setLastPromptBreakdown(
|
|
196
|
+
b: {
|
|
197
|
+
systemChars: number;
|
|
198
|
+
staticPrefixChars: number;
|
|
199
|
+
dynamicSuffixChars: number;
|
|
200
|
+
playwrightGuidanceChars: number;
|
|
201
|
+
messagesChars: number;
|
|
202
|
+
messagesCount: number;
|
|
203
|
+
toolsChars: number;
|
|
204
|
+
toolsCount: number;
|
|
205
|
+
} | null,
|
|
206
|
+
): void;
|
|
207
|
+
setTurnUserGoalExcerpt(v: string): void;
|
|
208
|
+
setTurnAssistantReasoning(v: string): void;
|
|
209
|
+
appendTurnAssistantReasoning(delta: string): void;
|
|
210
|
+
getTurnAssistantReasoning(): string;
|
|
211
|
+
setPriorWarningIdsInSession(s: Set<string>): void;
|
|
212
|
+
setMessages(messages: ModelMessage[]): void;
|
|
213
|
+
|
|
214
|
+
// ---- Behavior delegators ----------------------------------------------
|
|
215
|
+
requireProvider(): LegacyProvider;
|
|
216
|
+
emitSubagentStatus(status: SubagentStatus | null): void;
|
|
217
|
+
fireHook(
|
|
218
|
+
input: unknown,
|
|
219
|
+
signal?: AbortSignal,
|
|
220
|
+
): Promise<{
|
|
221
|
+
blocked: boolean;
|
|
222
|
+
blockingErrors: Array<{ command: string; stderr: string }>;
|
|
223
|
+
preventContinuation: boolean;
|
|
224
|
+
additionalContexts: string[];
|
|
225
|
+
results: import("../hooks/types.js").HookResult[];
|
|
226
|
+
eeMatches: import("../hooks/types.js").EEMatchEntry[];
|
|
227
|
+
}>;
|
|
228
|
+
consumeBackgroundNotifications(): Promise<string[]>;
|
|
229
|
+
initOAuthProvider(): Promise<void>;
|
|
230
|
+
buildRecentTurnsSummary(): string | null;
|
|
231
|
+
estimateProjectSize(): "small" | "medium" | "large" | null;
|
|
232
|
+
countFilesTouched(): number;
|
|
233
|
+
respondToToolApproval(approvalId: string, approved: boolean): void;
|
|
234
|
+
runCouncilV2(
|
|
235
|
+
userMessage: string,
|
|
236
|
+
opts: { skipClarification: boolean; observer?: ProcessMessageObserver; userModelMessage: ModelMessage },
|
|
237
|
+
): AsyncGenerator<StreamChunk, void, unknown>;
|
|
238
|
+
processMessage(
|
|
239
|
+
userMessage: string,
|
|
240
|
+
observer?: ProcessMessageObserver,
|
|
241
|
+
images?: Array<{ path: string; mediaType: string; base64: string }>,
|
|
242
|
+
): AsyncGenerator<StreamChunk, void, unknown>;
|
|
243
|
+
processMessageBatchTurn(args: {
|
|
244
|
+
userModelMessage: ModelMessage;
|
|
245
|
+
observer?: ProcessMessageObserver;
|
|
246
|
+
provider: LegacyProvider;
|
|
247
|
+
subagents: ReturnType<typeof loadValidSubAgents>;
|
|
248
|
+
system: string;
|
|
249
|
+
runtime: ResolvedModelRuntime;
|
|
250
|
+
modelInfo: ResolvedModelRuntime["modelInfo"];
|
|
251
|
+
signal: AbortSignal;
|
|
252
|
+
}): AsyncGenerator<StreamChunk, void, unknown>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* MessageProcessor — extracted streaming turn loop.
|
|
257
|
+
*
|
|
258
|
+
* Lifecycle:
|
|
259
|
+
* const processor = new MessageProcessor(deps);
|
|
260
|
+
* yield* processor.run(userMessage, observer, images);
|
|
261
|
+
*
|
|
262
|
+
* Constructed per call (heap allocation is negligible against the streamText
|
|
263
|
+
* cost), matching the StreamRunner / CouncilManager pattern.
|
|
264
|
+
*/
|
|
265
|
+
export class MessageProcessor {
|
|
266
|
+
constructor(private deps: MessageProcessorDeps) {}
|
|
267
|
+
|
|
268
|
+
async *run(
|
|
269
|
+
userMessage: string,
|
|
270
|
+
observer?: ProcessMessageObserver,
|
|
271
|
+
images?: Array<{ path: string; mediaType: string; base64: string }>,
|
|
272
|
+
): AsyncGenerator<StreamChunk, void, unknown> {
|
|
273
|
+
const deps = this.deps;
|
|
274
|
+
// TUI-04: prefer the external AbortContext (from SIGINT handler) so that
|
|
275
|
+
// Ctrl+C mid-tool-call triggers a single, unified abort across all I/O.
|
|
276
|
+
// If no external context, fall back to creating a local AbortController.
|
|
277
|
+
if (deps.externalAbortContext) {
|
|
278
|
+
// Wrap the external signal in a local controller so existing cleanup
|
|
279
|
+
// paths (setAbortController(null)) still work without side-effects.
|
|
280
|
+
const ctrl = new AbortController();
|
|
281
|
+
deps.setAbortController(ctrl);
|
|
282
|
+
// Forward external abort to the local controller.
|
|
283
|
+
deps.externalAbortContext.signal.addEventListener(
|
|
284
|
+
"abort",
|
|
285
|
+
() => {
|
|
286
|
+
deps.getAbortController()?.abort(deps.externalAbortContext?.reason());
|
|
287
|
+
},
|
|
288
|
+
{ once: true },
|
|
289
|
+
);
|
|
290
|
+
} else {
|
|
291
|
+
deps.setAbortController(new AbortController());
|
|
292
|
+
}
|
|
293
|
+
const signal = deps.getAbortController()!.signal;
|
|
294
|
+
deps.emitSubagentStatus(null);
|
|
295
|
+
|
|
296
|
+
// Phase C3: advance the cross-turn dedup turn counter so stubs can point
|
|
297
|
+
// back to the correct prior turn.
|
|
298
|
+
deps.crossTurnDedup?.beginTurn();
|
|
299
|
+
|
|
300
|
+
// P0 native observation: turn boundary. Capture the prior batch via
|
|
301
|
+
// resetBatch — file-revert detection (in the hook layer) reads it on
|
|
302
|
+
// the first edit of the new turn. No language-based veto matching.
|
|
303
|
+
try {
|
|
304
|
+
getMistakeDetector().resetBatch();
|
|
305
|
+
if (deps.session?.id) {
|
|
306
|
+
fireTrajectoryEvent({
|
|
307
|
+
ts: new Date().toISOString(),
|
|
308
|
+
sessionId: deps.session.id,
|
|
309
|
+
kind: "user_turn",
|
|
310
|
+
excerpt: userMessage.slice(0, 200),
|
|
311
|
+
vetoDetected: false,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
/* fail-open: detector state must never block the turn */
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// P0 native observation: AbortSignal → fire user-veto for any in-flight
|
|
319
|
+
// batch tools that had warnings. Listener attaches here and self-removes
|
|
320
|
+
// after fire so it can't double-fire on later aborts in the same turn.
|
|
321
|
+
{
|
|
322
|
+
const aborter = () => {
|
|
323
|
+
try {
|
|
324
|
+
// P1 Item 3 wiring: mark current phase aborted so the next setPhase
|
|
325
|
+
// call drains an "abandoned" outcome.
|
|
326
|
+
phaseTracker.markAborted(
|
|
327
|
+
deps.getAbortController()?.signal.reason ? String(deps.getAbortController()!.signal.reason) : undefined,
|
|
328
|
+
);
|
|
329
|
+
} catch {
|
|
330
|
+
/* fail-open */
|
|
331
|
+
}
|
|
332
|
+
try {
|
|
333
|
+
const det = getMistakeDetector();
|
|
334
|
+
const events = det.detectAbort(
|
|
335
|
+
deps.getAbortController()?.signal.reason ? String(deps.getAbortController()!.signal.reason) : undefined,
|
|
336
|
+
);
|
|
337
|
+
if (events.length === 0) return;
|
|
338
|
+
const cwd = deps.bash.getCwd();
|
|
339
|
+
const tenantId = getTenantIdForVeto();
|
|
340
|
+
void buildScopeForVeto({ cwd })
|
|
341
|
+
.then(async (scope) => {
|
|
342
|
+
const { getDefaultEEClient } = await import("../ee/intercept.js");
|
|
343
|
+
for (const ev of events) {
|
|
344
|
+
void getDefaultEEClient()
|
|
345
|
+
.posttool({
|
|
346
|
+
toolName: ev.toolName,
|
|
347
|
+
toolInput: ev.toolInput,
|
|
348
|
+
outcome: { success: false, mistakeKind: ev.kind, evidence: ev.evidence },
|
|
349
|
+
cwd,
|
|
350
|
+
tenantId,
|
|
351
|
+
scope,
|
|
352
|
+
})
|
|
353
|
+
.catch(() => {
|
|
354
|
+
/* fire-and-forget */
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
.catch(() => {
|
|
359
|
+
/* fire-and-forget */
|
|
360
|
+
});
|
|
361
|
+
} catch {
|
|
362
|
+
/* fail-open */
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
signal.addEventListener("abort", aborter, { once: true });
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// P0 native observation: cache turn-level intent fields for PreToolUse.
|
|
369
|
+
deps.setTurnUserGoalExcerpt(userMessage.slice(0, 200));
|
|
370
|
+
deps.setTurnAssistantReasoning("");
|
|
371
|
+
|
|
372
|
+
// Ensure flow run is ready before processing (fail-open).
|
|
373
|
+
await deps.flowReady?.catch(() => {});
|
|
374
|
+
|
|
375
|
+
// Upgrade to OAuth-backed provider on first turn if tokens are available.
|
|
376
|
+
await deps.initOAuthProvider().catch(() => {});
|
|
377
|
+
|
|
378
|
+
if (!deps.getSessionStartHookFired()) {
|
|
379
|
+
deps.setSessionStartHookFired(true);
|
|
380
|
+
const isResume = deps.messages.length > 0;
|
|
381
|
+
const sessionStartInput: SessionStartHookInput = {
|
|
382
|
+
hook_event_name: "SessionStart",
|
|
383
|
+
source: isResume ? "resume" : "startup",
|
|
384
|
+
session_id: deps.session?.id,
|
|
385
|
+
cwd: deps.bash.getCwd(),
|
|
386
|
+
};
|
|
387
|
+
await deps.fireHook(sessionStartInput, signal).catch(() => {});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const promptInput: UserPromptSubmitHookInput = {
|
|
391
|
+
hook_event_name: "UserPromptSubmit",
|
|
392
|
+
user_prompt: userMessage,
|
|
393
|
+
session_id: deps.session?.id,
|
|
394
|
+
cwd: deps.bash.getCwd(),
|
|
395
|
+
};
|
|
396
|
+
await deps.fireHook(promptInput, signal).catch(() => {});
|
|
397
|
+
|
|
398
|
+
await deps.consumeBackgroundNotifications();
|
|
399
|
+
|
|
400
|
+
const _debugOn = isDebugEnabled();
|
|
401
|
+
const _debugSteps: PipelineStep[] = [];
|
|
402
|
+
const _debugTurnId = deps.messages.filter((m) => m.role === "user").length + 1;
|
|
403
|
+
|
|
404
|
+
// PIL: enrich prompt before pushing to messages (D-01, D-03, D-04)
|
|
405
|
+
// Promise.race timeout of 200ms is inside runPipeline — fail-open guaranteed
|
|
406
|
+
const _pilStart = Date.now();
|
|
407
|
+
const pilCtx = await runPipeline(userMessage, {
|
|
408
|
+
resumeDigest: deps.getResumeDigest(),
|
|
409
|
+
activeRunId: deps.getActiveRunId(),
|
|
410
|
+
sessionId: deps.session?.id ?? null,
|
|
411
|
+
}).catch((err) => ({
|
|
412
|
+
raw: userMessage,
|
|
413
|
+
enriched: userMessage,
|
|
414
|
+
taskType: null,
|
|
415
|
+
domain: null,
|
|
416
|
+
confidence: 0,
|
|
417
|
+
outputStyle: null,
|
|
418
|
+
tokenBudget: 500,
|
|
419
|
+
metrics: null,
|
|
420
|
+
layers: [],
|
|
421
|
+
gsdPhase: null,
|
|
422
|
+
activeRunId: null,
|
|
423
|
+
intentKind: null as "task" | "chitchat" | null,
|
|
424
|
+
fallbackReason: err instanceof Error ? `orchestrator-catch:${err.name}` : "orchestrator-catch:unknown",
|
|
425
|
+
}));
|
|
426
|
+
// Cheap signal forwarded from PIL Layer 1 — true when input is greeting /
|
|
427
|
+
// small-talk (≤10 chars + ≤2 words OR brain-classified "none"). Used to
|
|
428
|
+
// skip the MCP tool catalog, which dominates input tokens (~20K) and is
|
|
429
|
+
// useless for "hi" / "ok" / "thanks".
|
|
430
|
+
const isChitchat = pilCtx.intentKind === "chitchat";
|
|
431
|
+
const enrichedMessage = pilCtx.enriched;
|
|
432
|
+
deps.setPilActive(pilCtx.taskType !== null);
|
|
433
|
+
deps.setPilEnrichmentDelta(
|
|
434
|
+
pilCtx.metrics?.suffixInstructionTokens ?? Math.round((enrichedMessage.length - userMessage.length) / 4),
|
|
435
|
+
);
|
|
436
|
+
const _pilEnrichmentDeltaSnapshot =
|
|
437
|
+
pilCtx.metrics?.suffixInstructionTokens ?? Math.round((enrichedMessage.length - userMessage.length) / 4);
|
|
438
|
+
|
|
439
|
+
// P1 Item 3 wiring: phase-boundary detection. setPhase returns a snapshot
|
|
440
|
+
// of the prior phase iff the phase NAME just changed. We classify the
|
|
441
|
+
// outcome (pass/fail/abandoned/null) and fire phase-outcome to the EE
|
|
442
|
+
// server when there is a high-SNR verdict. Endpoint is feature-flagged
|
|
443
|
+
// server-side; 404 is silently swallowed by the client wrapper.
|
|
444
|
+
try {
|
|
445
|
+
const drained = phaseTracker.setPhase(pilCtx.gsdPhase ?? null);
|
|
446
|
+
if (drained && drained.principleRefs.length > 0 && deps.session?.id) {
|
|
447
|
+
const outcome = phaseTracker.classifyOutcome(drained);
|
|
448
|
+
if (outcome) {
|
|
449
|
+
fireAndForgetPhaseOutcome(
|
|
450
|
+
{
|
|
451
|
+
sessionId: deps.session.id,
|
|
452
|
+
phaseName: drained.phaseName,
|
|
453
|
+
outcome,
|
|
454
|
+
toolEventIds: drained.principleRefs,
|
|
455
|
+
evidence: {
|
|
456
|
+
durationMs: drained.endedAt - drained.startedAt,
|
|
457
|
+
toolCount: drained.toolCount,
|
|
458
|
+
cwd: deps.bash.getCwd(),
|
|
459
|
+
...(drained.verifyResult ? { verifyResult: drained.verifyResult } : {}),
|
|
460
|
+
...(drained.aborted ? { aborted: true } : {}),
|
|
461
|
+
...(drained.abortReason ? { abortReason: drained.abortReason } : {}),
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
...(getCachedServerBaseUrl() ? { baseUrl: getCachedServerBaseUrl()! } : {}),
|
|
466
|
+
...(getCachedAuthToken() ? { authToken: getCachedAuthToken()! } : {}),
|
|
467
|
+
},
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
} catch {
|
|
472
|
+
/* fail-open: phase-outcome must never block a turn */
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (_debugOn) {
|
|
476
|
+
const appliedLayers = pilCtx.layers?.filter((l) => l.applied).map((l) => l.name) ?? [];
|
|
477
|
+
_debugSteps.push({
|
|
478
|
+
name: "PIL Pipeline",
|
|
479
|
+
duration_ms: Date.now() - _pilStart,
|
|
480
|
+
input_summary: `"${userMessage.slice(0, 60)}${userMessage.length > 60 ? "..." : ""}"`,
|
|
481
|
+
output_summary: `task=${pilCtx.taskType ?? "none"} domain=${pilCtx.domain ?? "none"} layers=[${appliedLayers.join(",")}]`,
|
|
482
|
+
tokens_saved: _pilEnrichmentDeltaSnapshot > 0 ? _pilEnrichmentDeltaSnapshot : undefined,
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// Interaction log: PIL classification
|
|
487
|
+
try {
|
|
488
|
+
if (deps.session) {
|
|
489
|
+
const pilDurationMs = Date.now() - _pilStart;
|
|
490
|
+
logInteraction(deps.session.id, "pil", {
|
|
491
|
+
eventSubtype: pilCtx.taskType ?? "none",
|
|
492
|
+
durationMs: pilDurationMs,
|
|
493
|
+
data: {
|
|
494
|
+
layers: pilCtx.layers?.filter((l) => l.applied).map((l) => l.name) ?? [],
|
|
495
|
+
fullLayers: pilCtx.layers?.map((l) => ({ name: l.name, applied: l.applied, delta: l.delta })) ?? [],
|
|
496
|
+
layerCount: pilCtx.layers?.length ?? 0,
|
|
497
|
+
layerTimings: pilCtx.metrics?.layerTimings ?? null,
|
|
498
|
+
domain: pilCtx.domain,
|
|
499
|
+
confidence: pilCtx.confidence,
|
|
500
|
+
outputStyle: pilCtx.outputStyle,
|
|
501
|
+
intentKind: pilCtx.intentKind ?? null,
|
|
502
|
+
mcpSkipped: isChitchat,
|
|
503
|
+
fallbackReason: pilCtx.fallbackReason ?? null,
|
|
504
|
+
eeMode: (await import("../ee/client-mode.js")).getCachedEEClientMode()?.mode ?? "unknown",
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
logInteraction(deps.session.id, "user_message", {
|
|
508
|
+
data: {
|
|
509
|
+
raw_length: userMessage.length,
|
|
510
|
+
enriched_length: enrichedMessage.length,
|
|
511
|
+
taskType: pilCtx.taskType,
|
|
512
|
+
intentKind: pilCtx.intentKind ?? null,
|
|
513
|
+
confidence: pilCtx.confidence,
|
|
514
|
+
pilActive: pilCtx.taskType !== null,
|
|
515
|
+
},
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
} catch {
|
|
519
|
+
/* fail-open */
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// ROUTE-11: Per-turn model routing via decide() — picks cheapest capable model
|
|
523
|
+
const turnStartMs = Date.now();
|
|
524
|
+
let turnModelId = deps.modelId;
|
|
525
|
+
let taskHash: string | null = null;
|
|
526
|
+
const _routeStart = Date.now();
|
|
527
|
+
try {
|
|
528
|
+
const { decide } = await import("../router/decide.js");
|
|
529
|
+
const routeDecision = await decide(userMessage, {
|
|
530
|
+
tenantId: "local",
|
|
531
|
+
cwd: deps.bash.getCwd(),
|
|
532
|
+
defaultModel: deps.modelId,
|
|
533
|
+
defaultProvider: deps.providerId,
|
|
534
|
+
pil: {
|
|
535
|
+
domain: pilCtx.domain,
|
|
536
|
+
taskType: pilCtx.taskType,
|
|
537
|
+
confidence: pilCtx.confidence,
|
|
538
|
+
gsdPhase: pilCtx.gsdPhase ?? null,
|
|
539
|
+
activeRunId: pilCtx.activeRunId ?? null,
|
|
540
|
+
recentTurnsSummary: deps.buildRecentTurnsSummary(),
|
|
541
|
+
projectSize: deps.estimateProjectSize(),
|
|
542
|
+
filesTouched: deps.countFilesTouched(),
|
|
543
|
+
mode: deps.mode,
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
if (routeDecision.model && routeDecision.model !== "HALT") {
|
|
547
|
+
// Respect user's default model when it has a vision proxy and the
|
|
548
|
+
// current turn (or history) has images — the proxy will convert
|
|
549
|
+
// images to text, so there's no need to switch to a vision-capable
|
|
550
|
+
// (and usually pricier / rate-limited) model.
|
|
551
|
+
const defaultHasVisionProxy = needsVisionProxy(deps.modelId);
|
|
552
|
+
const historyHasImages = deps.messages.some(
|
|
553
|
+
(m) => Array.isArray(m.content) && (m.content as Array<{ type: string }>).some((p) => p.type === "image"),
|
|
554
|
+
);
|
|
555
|
+
const turnHasImages = (images?.length ?? 0) > 0;
|
|
556
|
+
const skipVisionRoute = defaultHasVisionProxy && (turnHasImages || historyHasImages);
|
|
557
|
+
if (!skipVisionRoute) {
|
|
558
|
+
turnModelId = routeDecision.model;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
taskHash = routeDecision.taskHash ?? null;
|
|
562
|
+
// Update status bar with router switch info. Also reset back to the
|
|
563
|
+
// session default when the router does NOT switch on this turn —
|
|
564
|
+
// otherwise the bar stays "stuck" showing the previously-routed model
|
|
565
|
+
// (e.g. claude-sonnet-4-6) on later turns that actually run on the
|
|
566
|
+
// user's chosen default (e.g. deepseek-v4-flash).
|
|
567
|
+
if (turnModelId !== deps.modelId) {
|
|
568
|
+
statusBarStore.setState({ routed_from: deps.modelId, model: turnModelId });
|
|
569
|
+
} else {
|
|
570
|
+
const prev = statusBarStore.getState();
|
|
571
|
+
if (prev.routed_from || prev.model !== deps.modelId) {
|
|
572
|
+
statusBarStore.setState({ routed_from: null, model: deps.modelId });
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (_debugOn) {
|
|
576
|
+
_debugSteps.push({
|
|
577
|
+
name: "Router",
|
|
578
|
+
duration_ms: Date.now() - _routeStart,
|
|
579
|
+
input_summary: `default=${deps.modelId}`,
|
|
580
|
+
output_summary: turnModelId !== deps.modelId ? `routed→${turnModelId}` : `kept ${turnModelId}`,
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
} catch {
|
|
584
|
+
// Router unavailable — use session default model (skip if provider is disabled)
|
|
585
|
+
if (!isProviderDisabled(deps.providerId as ProviderId)) {
|
|
586
|
+
const eeRoute = await routeModel(userMessage, {}, deps.providerId).catch(() => null);
|
|
587
|
+
taskHash = eeRoute?.taskHash ?? null;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// Interaction log: model routing
|
|
592
|
+
try {
|
|
593
|
+
if (deps.session) {
|
|
594
|
+
logInteraction(deps.session.id, "routing", {
|
|
595
|
+
model: turnModelId,
|
|
596
|
+
data: { defaultModel: deps.modelId, routedModel: turnModelId, taskHash },
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
} catch {
|
|
600
|
+
/* fail-open */
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// Re-detect provider if router picked a model from a different provider
|
|
604
|
+
const turnProviderId = detectProviderForModel(turnModelId);
|
|
605
|
+
let turnProvider: LegacyProvider;
|
|
606
|
+
if (turnProviderId !== deps.providerId) {
|
|
607
|
+
// Even if the key is reachable, skip disabled providers
|
|
608
|
+
const turnKey = !isProviderDisabled(turnProviderId as ProviderId)
|
|
609
|
+
? await loadKeyForProvider(turnProviderId).catch(() => null)
|
|
610
|
+
: null;
|
|
611
|
+
if (turnKey) {
|
|
612
|
+
const { createProviderFactory } = await import("../providers/runtime.js");
|
|
613
|
+
turnProvider = createProviderFactory(turnProviderId, { apiKey: turnKey }).factory;
|
|
614
|
+
} else {
|
|
615
|
+
// Router's provider unreachable or disabled — fall back to a non-disabled provider
|
|
616
|
+
const fallback = await deps.councilManager.resolveNonDisabledFallback();
|
|
617
|
+
turnModelId = fallback.modelId;
|
|
618
|
+
turnProvider = deps.requireProvider();
|
|
619
|
+
}
|
|
620
|
+
} else if (isProviderDisabled(deps.providerId as ProviderId)) {
|
|
621
|
+
// Session provider is disabled — find a non-disabled alternative
|
|
622
|
+
const fallback = await deps.councilManager.resolveNonDisabledFallback();
|
|
623
|
+
turnModelId = fallback.modelId;
|
|
624
|
+
turnProvider = deps.requireProvider();
|
|
625
|
+
} else {
|
|
626
|
+
turnProvider = deps.requireProvider();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// E4: prepend one-shot cwd note when setCwd() changed the working directory
|
|
630
|
+
// mid-session. Clears after injection so only the first subsequent turn sees it.
|
|
631
|
+
const cwdNote = deps.getPendingCwdNote();
|
|
632
|
+
deps.setPendingCwdNote(null);
|
|
633
|
+
const messageForModel = cwdNote ? `${cwdNote}\n\n${enrichedMessage}` : enrichedMessage;
|
|
634
|
+
|
|
635
|
+
let userModelMessage: ModelMessage;
|
|
636
|
+
if (images?.length) {
|
|
637
|
+
const parts: Array<{ type: "text"; text: string } | { type: "image"; image: string; mediaType: string }> = [
|
|
638
|
+
{ type: "text", text: messageForModel },
|
|
639
|
+
];
|
|
640
|
+
for (const img of images) {
|
|
641
|
+
parts.push({ type: "image", image: img.base64, mediaType: img.mediaType });
|
|
642
|
+
}
|
|
643
|
+
userModelMessage = { role: "user", content: parts };
|
|
644
|
+
} else {
|
|
645
|
+
userModelMessage = { role: "user", content: messageForModel };
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Vision proxy: convert images to text for models that don't support vision.
|
|
649
|
+
// Process BOTH the current user message and any historical messages that
|
|
650
|
+
// still carry image parts — otherwise sending the conversation back to a
|
|
651
|
+
// text-only provider (e.g. DeepSeek) fails with "unknown variant
|
|
652
|
+
// `image_url`" once history contains an image from a prior turn.
|
|
653
|
+
if (needsVisionProxy(turnModelId)) {
|
|
654
|
+
const historyHasImages = deps.messages.some(
|
|
655
|
+
(m) => Array.isArray(m.content) && (m.content as Array<{ type: string }>).some((p) => p.type === "image"),
|
|
656
|
+
);
|
|
657
|
+
const turnHasImages = (images?.length ?? 0) > 0;
|
|
658
|
+
if (turnHasImages || historyHasImages) {
|
|
659
|
+
try {
|
|
660
|
+
if (historyHasImages) {
|
|
661
|
+
const historyResult = await proxyVision(deps.messages, turnModelId, signal);
|
|
662
|
+
if (historyResult.proxied) {
|
|
663
|
+
deps.setMessages(historyResult.messages);
|
|
664
|
+
yield {
|
|
665
|
+
type: "content",
|
|
666
|
+
content: `[Vision proxy: ${historyResult.imageCount} historical image(s) → text]\n`,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (turnHasImages) {
|
|
671
|
+
const proxyResult = await proxyVision([userModelMessage], turnModelId, signal);
|
|
672
|
+
if (proxyResult.proxied) {
|
|
673
|
+
userModelMessage = proxyResult.messages[0];
|
|
674
|
+
yield {
|
|
675
|
+
type: "content",
|
|
676
|
+
content: `[Vision proxy: ${proxyResult.imageCount} image(s) → ${turnModelId} via SiliconFlow]\n`,
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
} catch {
|
|
681
|
+
yield { type: "content", content: "[Vision proxy: failed, images dropped]\n" };
|
|
682
|
+
if (turnHasImages) {
|
|
683
|
+
userModelMessage = { role: "user", content: enrichedMessage };
|
|
684
|
+
}
|
|
685
|
+
// Strip image parts from history as a last-resort fallback so the
|
|
686
|
+
// request doesn't blow up at the provider serialization layer.
|
|
687
|
+
deps.setMessages(
|
|
688
|
+
deps.messages.map((m) => {
|
|
689
|
+
if (!Array.isArray(m.content)) return m;
|
|
690
|
+
const filtered = (m.content as Array<{ type: string }>).filter((p) => p.type !== "image");
|
|
691
|
+
return { ...m, content: filtered } as typeof m;
|
|
692
|
+
}),
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
deps.messages.push(userModelMessage);
|
|
699
|
+
// Phase A5 — write-ahead the user row so `recordUsage` mid-stream can
|
|
700
|
+
// attribute usage to a real `message_seq` instead of falling back to
|
|
701
|
+
// NULL (or to the previous turn's assistant seq for a session that has
|
|
702
|
+
// multi-turn history). The post-stream `appendCompletedTurn(...)` path
|
|
703
|
+
// upserts the same row to `status='completed'` via the
|
|
704
|
+
// `ON CONFLICT(session_id, seq) DO UPDATE` clause in `appendMessages`.
|
|
705
|
+
let userWriteAheadSeq: number | null = null;
|
|
706
|
+
if (deps.session) {
|
|
707
|
+
try {
|
|
708
|
+
userWriteAheadSeq = getNextMessageSequence(deps.session.id);
|
|
709
|
+
persistMessageWriteAhead(deps.session.id, userWriteAheadSeq, "user", JSON.stringify(userModelMessage));
|
|
710
|
+
} catch {
|
|
711
|
+
// Fail-open: if seq lookup throws, fall back to the legacy NULL
|
|
712
|
+
// path. The forensics anomaly returns but the turn proceeds.
|
|
713
|
+
userWriteAheadSeq = null;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
deps.messageSeqs.push(userWriteAheadSeq);
|
|
717
|
+
|
|
718
|
+
// Inject accumulated EE session guidance as a system message so the model
|
|
719
|
+
// is informed of past warnings before making tool decisions this turn.
|
|
720
|
+
if (deps.sessionEEGuidance.size > 0) {
|
|
721
|
+
const lines = Array.from(deps.sessionEEGuidance.entries()).map(([, g]) => {
|
|
722
|
+
const pct = Math.round(g.confidence * 100);
|
|
723
|
+
return `- [${g.toolName}] ${g.message} (Why: ${g.why}) [${pct}%]`;
|
|
724
|
+
});
|
|
725
|
+
deps.messages.push({
|
|
726
|
+
role: "system",
|
|
727
|
+
content: `[EE Session Guidance — avoid these patterns when using tools]\n${lines.join("\n")}`,
|
|
728
|
+
});
|
|
729
|
+
deps.messageSeqs.push(null);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
const provider = turnProvider;
|
|
733
|
+
const subagents = loadValidSubAgents();
|
|
734
|
+
const _pilResponseTools = getResponseToolSet(pilCtx, deps.providerId);
|
|
735
|
+
const _hasResponseTools = Object.keys(_pilResponseTools).length > 0;
|
|
736
|
+
const systemParts = buildSystemPromptParts(
|
|
737
|
+
deps.bash.getCwd(),
|
|
738
|
+
deps.mode,
|
|
739
|
+
deps.bash.getSandboxMode(),
|
|
740
|
+
deps.getPlanContext(),
|
|
741
|
+
subagents,
|
|
742
|
+
deps.bash.getSandboxSettings(),
|
|
743
|
+
deps.providerId,
|
|
744
|
+
deps.getResumeDigest(),
|
|
745
|
+
{ chitchat: isChitchat },
|
|
746
|
+
);
|
|
747
|
+
if (deps.getResumeDigest()) deps.setResumeDigest(null);
|
|
748
|
+
// Skip vision/playwright guidance unless the user's message has a URL
|
|
749
|
+
// or browser/screenshot vocabulary. ~400 tokens of routing hints
|
|
750
|
+
// the model only needs when it might call a browser MCP.
|
|
751
|
+
const _browserGuidanceNeeded =
|
|
752
|
+
/https?:\/\/\S+|\b(screenshot|browser|playwright|chrome|figma|canva|render|webpage|website|url|hyperlink|navigate|click|scrape)\b/i.test(
|
|
753
|
+
userMessage,
|
|
754
|
+
);
|
|
755
|
+
const playwrightGuidance = isChitchat || !_browserGuidanceNeeded ? "" : getVisionGuidanceForTextOnly(turnModelId);
|
|
756
|
+
const system = applyModelConstraints(
|
|
757
|
+
applyPilSuffix(
|
|
758
|
+
`${systemParts.staticPrefix}${playwrightGuidance}${systemParts.dynamicSuffix}`,
|
|
759
|
+
pilCtx,
|
|
760
|
+
_hasResponseTools,
|
|
761
|
+
),
|
|
762
|
+
turnModelId,
|
|
763
|
+
);
|
|
764
|
+
let runtime = resolveModelRuntime(provider, turnModelId);
|
|
765
|
+
let modelInfo = runtime.modelInfo;
|
|
766
|
+
|
|
767
|
+
// SAMR: Step-Aware Model Routing — downgrade to fast model for tool-execution
|
|
768
|
+
// steps after the initial reasoning step. The premium model decides WHAT to do;
|
|
769
|
+
// a cheaper model handles the mechanical "read results, call more tools" loop.
|
|
770
|
+
const stepRouterCfg = getStepRouterConfig();
|
|
771
|
+
const stepRouterDecision = decideStepRouting(turnModelId, deps.providerId, stepRouterCfg);
|
|
772
|
+
let stepRouterPhase: "phase1" | "phase2" | "done" = stepRouterDecision.phase2ModelId ? "phase1" : "done";
|
|
773
|
+
const phase2Runtime = stepRouterDecision.phase2ModelId
|
|
774
|
+
? resolveModelRuntime(provider, stepRouterDecision.phase2ModelId)
|
|
775
|
+
: null;
|
|
776
|
+
if (stepRouterDecision.phase2ModelId && _debugOn) {
|
|
777
|
+
_debugSteps.push({
|
|
778
|
+
name: "StepRouter",
|
|
779
|
+
duration_ms: 0,
|
|
780
|
+
input_summary: `phase1=${turnModelId}`,
|
|
781
|
+
output_summary: stepRouterDecision.reason,
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
deps.setPlanContext(null);
|
|
786
|
+
let attemptedOverflowRecovery = false;
|
|
787
|
+
// Stream-retry state: track how many transient retries have been attempted
|
|
788
|
+
// for the current turn. Reset to 0 on each new user turn (we're in processMessage).
|
|
789
|
+
let streamRetryCount = 0;
|
|
790
|
+
const MAX_STREAM_RETRIES = 2; // 3 total attempts = 1 first try + 2 retries
|
|
791
|
+
|
|
792
|
+
// Auto-council: route to multi-model debate when EITHER
|
|
793
|
+
// (a) PIL classified taskType=plan|analyze with high confidence, OR
|
|
794
|
+
// (b) GSD-native tier === "heavy" (wholesale / multi-step / cross-repo work).
|
|
795
|
+
// After the debate finishes, runCouncilV2 records synthesis on
|
|
796
|
+
// councilManager.lastSynthesis; we then re-enter processMessage with the synthesis
|
|
797
|
+
// as the next user turn so the main loop continues with full debate context.
|
|
798
|
+
// Skip if this is already a council continuation turn (prevent infinite recursion).
|
|
799
|
+
const autoCouncilTypes = new Set(["plan", "analyze"]);
|
|
800
|
+
const councilRoles = getRoleModels();
|
|
801
|
+
const configuredRoleCount = Object.values(councilRoles).filter(Boolean).length;
|
|
802
|
+
const heavyTier = (pilCtx as { complexityTier?: string | null }).complexityTier === "heavy";
|
|
803
|
+
const autoCouncilConfidence = getAutoCouncilConfidence();
|
|
804
|
+
const autoCouncilMinRoles = getAutoCouncilMinRoles();
|
|
805
|
+
const taskTypeMatch =
|
|
806
|
+
pilCtx.taskType && autoCouncilTypes.has(pilCtx.taskType) && pilCtx.confidence >= autoCouncilConfidence;
|
|
807
|
+
const shouldAutoCouncil =
|
|
808
|
+
!deps.councilManager.isContinuation &&
|
|
809
|
+
isAutoCouncilEnabled() &&
|
|
810
|
+
configuredRoleCount >= autoCouncilMinRoles &&
|
|
811
|
+
(taskTypeMatch || heavyTier);
|
|
812
|
+
|
|
813
|
+
// Always log the auto-council decision (taken or skipped) with the gate
|
|
814
|
+
// values that decided it. Lets reports answer "why did this turn cost
|
|
815
|
+
// $0.30?" and "is the confidence floor tuned wrong for my prompts?".
|
|
816
|
+
const autoCouncilSkipReason = (() => {
|
|
817
|
+
if (deps.councilManager.isContinuation) return "continuation-turn";
|
|
818
|
+
if (!isAutoCouncilEnabled()) return "feature-disabled";
|
|
819
|
+
if (configuredRoleCount < autoCouncilMinRoles)
|
|
820
|
+
return `role-count<${autoCouncilMinRoles} (have ${configuredRoleCount})`;
|
|
821
|
+
if (!taskTypeMatch && !heavyTier) {
|
|
822
|
+
if (!pilCtx.taskType || !autoCouncilTypes.has(pilCtx.taskType))
|
|
823
|
+
return `taskType=${pilCtx.taskType ?? "null"} not in plan|analyze`;
|
|
824
|
+
if (pilCtx.confidence < autoCouncilConfidence)
|
|
825
|
+
return `confidence<${autoCouncilConfidence} (got ${pilCtx.confidence.toFixed(2)})`;
|
|
826
|
+
return "no-trigger";
|
|
827
|
+
}
|
|
828
|
+
return "taken";
|
|
829
|
+
})();
|
|
830
|
+
appendDecisionLog({
|
|
831
|
+
ts: Date.now(),
|
|
832
|
+
sessionId: deps.session?.id ?? null,
|
|
833
|
+
kind: "auto-council",
|
|
834
|
+
taken: shouldAutoCouncil,
|
|
835
|
+
reason: autoCouncilSkipReason,
|
|
836
|
+
meta: {
|
|
837
|
+
taskType: pilCtx.taskType ?? null,
|
|
838
|
+
confidence: pilCtx.confidence,
|
|
839
|
+
complexityTier: (pilCtx as { complexityTier?: string | null }).complexityTier ?? null,
|
|
840
|
+
configuredRoleCount,
|
|
841
|
+
autoCouncilConfidence,
|
|
842
|
+
autoCouncilMinRoles,
|
|
843
|
+
heavyTier,
|
|
844
|
+
isContinuation: deps.councilManager.isContinuation,
|
|
845
|
+
},
|
|
846
|
+
}).catch(() => undefined);
|
|
847
|
+
|
|
848
|
+
if (shouldAutoCouncil) {
|
|
849
|
+
const reason = heavyTier
|
|
850
|
+
? `complexity=heavy${pilCtx.taskType ? ` task=${pilCtx.taskType}` : ""}`
|
|
851
|
+
: `${pilCtx.taskType} task detected with ${(pilCtx.confidence * 100).toFixed(0)}% confidence`;
|
|
852
|
+
yield { type: "content", content: `\n[Auto-council triggered: ${reason}]\n` };
|
|
853
|
+
yield* deps.runCouncilV2(userMessage, { skipClarification: true, observer, userModelMessage });
|
|
854
|
+
const synthesis = deps.councilManager.lastSynthesis;
|
|
855
|
+
deps.councilManager.setLastSynthesis(null);
|
|
856
|
+
if (synthesis) {
|
|
857
|
+
yield { type: "content", content: "\n[Auto-continuing with council recommendations...]\n" };
|
|
858
|
+
deps.councilManager.setContinuation(true);
|
|
859
|
+
try {
|
|
860
|
+
yield* deps.processMessage(
|
|
861
|
+
`Council debate completed. Synthesis:\n\n${synthesis}\n\nProceed with the recommended action items.`,
|
|
862
|
+
observer,
|
|
863
|
+
);
|
|
864
|
+
} finally {
|
|
865
|
+
deps.councilManager.setContinuation(false);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
if (deps.batchApi) {
|
|
872
|
+
try {
|
|
873
|
+
yield* deps.processMessageBatchTurn({
|
|
874
|
+
userModelMessage,
|
|
875
|
+
observer,
|
|
876
|
+
provider,
|
|
877
|
+
subagents,
|
|
878
|
+
system,
|
|
879
|
+
runtime,
|
|
880
|
+
modelInfo,
|
|
881
|
+
signal,
|
|
882
|
+
});
|
|
883
|
+
} finally {
|
|
884
|
+
if (deps.getAbortController()?.signal === signal) {
|
|
885
|
+
deps.setAbortController(null);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
try {
|
|
892
|
+
while (true) {
|
|
893
|
+
// SAMR Phase 2: switch to fast model for tool-execution steps
|
|
894
|
+
if (stepRouterPhase === "phase2" && phase2Runtime) {
|
|
895
|
+
runtime = phase2Runtime;
|
|
896
|
+
modelInfo = runtime.modelInfo;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
deps.setCompactedThisTurn(false);
|
|
900
|
+
let assistantText = "";
|
|
901
|
+
let reasoningPreview = "";
|
|
902
|
+
let encryptedReasoningHidden = false;
|
|
903
|
+
let streamOk = false;
|
|
904
|
+
let closeMcp: (() => Promise<void>) | undefined;
|
|
905
|
+
let stepNumber = -1;
|
|
906
|
+
const activeToolCalls: ToolCall[] = [];
|
|
907
|
+
// SAMR: track whether Phase 1 produced tool calls
|
|
908
|
+
let phase1HadToolCalls = false;
|
|
909
|
+
|
|
910
|
+
try {
|
|
911
|
+
const settings = attemptedOverflowRecovery
|
|
912
|
+
? relaxCompactionSettings(deps.getCompactionSettings(modelInfo?.contextWindow))
|
|
913
|
+
: deps.getCompactionSettings(modelInfo?.contextWindow);
|
|
914
|
+
if (modelInfo?.contextWindow) {
|
|
915
|
+
await deps.compactForContext(
|
|
916
|
+
provider,
|
|
917
|
+
system,
|
|
918
|
+
modelInfo.contextWindow,
|
|
919
|
+
signal,
|
|
920
|
+
settings,
|
|
921
|
+
attemptedOverflowRecovery,
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const baseToolsRaw = createBuiltinTools(deps.bash, deps.mode, {
|
|
926
|
+
runTask: (request, abortSignal) => deps.runTask(request, combineAbortSignals(signal, abortSignal)),
|
|
927
|
+
runDelegation: (request, abortSignal) =>
|
|
928
|
+
deps.runDelegation(request, combineAbortSignals(signal, abortSignal)),
|
|
929
|
+
readDelegation: (id) => deps.readDelegation(id),
|
|
930
|
+
listDelegations: () => deps.listDelegations(),
|
|
931
|
+
modelId: turnModelId,
|
|
932
|
+
});
|
|
933
|
+
// Top-level cumulative cap state. We accumulate the raw tool set
|
|
934
|
+
// (base + MCP + PIL response tools) across the assembly below,
|
|
935
|
+
// then apply the cap once. Tier ratios are looser than the
|
|
936
|
+
// sub-agent cap (50%/80%) so casual single-tool turns are not
|
|
937
|
+
// trimmed. See sub-agent-cap.ts.
|
|
938
|
+
// Chitchat: drop builtin tools too (not just MCP). A 1-word greeting
|
|
939
|
+
// never needs bash/read_file/edit_file/grep — those schemas alone
|
|
940
|
+
// cost ~1.5K input tokens on this CLI. Falls back to baseTools for
|
|
941
|
+
// every non-chitchat turn (PIL gates conservatively).
|
|
942
|
+
const turnCaps = getProviderCapabilities(runtime.modelInfo?.provider ?? "anthropic");
|
|
943
|
+
let rawToolSet: ToolSet = !turnCaps.supportsClientTools(runtime.modelInfo)
|
|
944
|
+
? {}
|
|
945
|
+
: isChitchat
|
|
946
|
+
? {}
|
|
947
|
+
: baseToolsRaw;
|
|
948
|
+
// MCP skip: chitchat / greeting inputs don't need 7 MCP servers'
|
|
949
|
+
// worth of tool schemas (~20K input tokens). PIL Layer 1 already
|
|
950
|
+
// gates this conservatively (≤10 chars + ≤2 words OR brain "none").
|
|
951
|
+
if (deps.mode === "agent" && !isChitchat && turnCaps.supportsClientTools(runtime.modelInfo)) {
|
|
952
|
+
// Smart MCP filter: skip browser/vision MCP servers unless the
|
|
953
|
+
// user's current message has a URL or explicitly invokes the
|
|
954
|
+
// browser/screenshot/design vocabulary. Local code work — which
|
|
955
|
+
// is the majority of turns — does not need Playwright/Figma/Canva
|
|
956
|
+
// tool schemas (each MCP contributes 8-15 tools at ~150 tok each).
|
|
957
|
+
// Override with MUONROI_DISABLE_SMART_MCP=1.
|
|
958
|
+
const smartMcp = process.env.MUONROI_DISABLE_SMART_MCP !== "1";
|
|
959
|
+
const browserSignal =
|
|
960
|
+
/https?:\/\/\S+|\b(screenshot|browser|playwright|chrome|figma|canva|render|webpage|website|url|hyperlink|navigate|click|scrape)\b/i.test(
|
|
961
|
+
userMessage,
|
|
962
|
+
);
|
|
963
|
+
const SKIP_WHEN_NO_BROWSER = /playwright|chrome|browser|devtools|vision|figma|canva/i;
|
|
964
|
+
const allServers = loadMcpServers();
|
|
965
|
+
const filteredServers =
|
|
966
|
+
smartMcp && !browserSignal ? allServers.filter((s) => !SKIP_WHEN_NO_BROWSER.test(s.id)) : allServers;
|
|
967
|
+
const mcpBundle = await buildMcpToolSet(filteredServers, {
|
|
968
|
+
onOAuthRequired: (_serverId, url) => {
|
|
969
|
+
const urlStr = url.toString();
|
|
970
|
+
import("child_process").then(({ exec }) => {
|
|
971
|
+
const cmd =
|
|
972
|
+
process.platform === "win32"
|
|
973
|
+
? `start "" "${urlStr}"`
|
|
974
|
+
: process.platform === "darwin"
|
|
975
|
+
? `open "${urlStr}"`
|
|
976
|
+
: `xdg-open "${urlStr}"`;
|
|
977
|
+
exec(cmd);
|
|
978
|
+
});
|
|
979
|
+
},
|
|
980
|
+
});
|
|
981
|
+
closeMcp = mcpBundle.close;
|
|
982
|
+
rawToolSet = { ...rawToolSet, ...mcpBundle.tools };
|
|
983
|
+
if (mcpBundle.errors.length > 0) {
|
|
984
|
+
yield { type: "content", content: `MCP unavailable: ${mcpBundle.errors.join(" | ")}\n\n` };
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// PIL response tools: inject structured output tool when taskType detected
|
|
989
|
+
if (_hasResponseTools && turnCaps.supportsClientTools(runtime.modelInfo)) {
|
|
990
|
+
rawToolSet = { ...rawToolSet, ..._pilResponseTools };
|
|
991
|
+
captureToolSchemas(_pilResponseTools);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
// Apply the top-level cumulative cap once over the fully-assembled
|
|
995
|
+
// raw tool set. State is per-turn; each turn gets a fresh budget.
|
|
996
|
+
const topLevelCap = wrapToolSetWithCap(rawToolSet, {
|
|
997
|
+
maxCumulativeChars: getTopLevelToolBudgetChars(),
|
|
998
|
+
midTierRatio: 0.5,
|
|
999
|
+
highTierRatio: 0.8,
|
|
1000
|
+
label: "top-level",
|
|
1001
|
+
});
|
|
1002
|
+
// Phase C3: layer cross-turn dedup on top of the top-level cap.
|
|
1003
|
+
const tools: ToolSet = wrapToolSetWithReadBudget(
|
|
1004
|
+
wrapToolSetWithDedup(topLevelCap.tools, deps.crossTurnDedup),
|
|
1005
|
+
deps.readBudget,
|
|
1006
|
+
);
|
|
1007
|
+
captureToolSchemas(tools);
|
|
1008
|
+
let responseToolCalled = false;
|
|
1009
|
+
|
|
1010
|
+
// G3: providerOptions assembly is owned by the capability layer
|
|
1011
|
+
// (src/providers/capabilities.ts). buildTurnProviderOptions feeds
|
|
1012
|
+
// sessionId in so openai.promptCacheKey is derived per turn.
|
|
1013
|
+
// The task-type-driven anthropic.thinking budget override stays
|
|
1014
|
+
// here because it depends on PIL task context, not provider quirks.
|
|
1015
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches RuntimeResult.providerOptions shape (any) used downstream
|
|
1016
|
+
const baseProviderOpts: any = buildTurnProviderOptions(runtime, { sessionId: deps.session?.id }) ?? {};
|
|
1017
|
+
const providerOpts = runtime.modelInfo?.reasoning
|
|
1018
|
+
? {
|
|
1019
|
+
...baseProviderOpts,
|
|
1020
|
+
anthropic: {
|
|
1021
|
+
...(baseProviderOpts.anthropic ?? {}),
|
|
1022
|
+
thinking: {
|
|
1023
|
+
type: "enabled" as const,
|
|
1024
|
+
budgetTokens:
|
|
1025
|
+
taskTypeToReasoningEffort(pilCtx.taskType) === "high"
|
|
1026
|
+
? 32_768
|
|
1027
|
+
: taskTypeToReasoningEffort(pilCtx.taskType) === "medium"
|
|
1028
|
+
? 8_192
|
|
1029
|
+
: 2_048,
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
}
|
|
1033
|
+
: baseProviderOpts;
|
|
1034
|
+
// Use catalog's thinkingType field instead of regex matching.
|
|
1035
|
+
// providerOpts is loosely typed (Record<string, unknown>) after the
|
|
1036
|
+
// g1 capability refactor — narrow with a local typed view.
|
|
1037
|
+
const thinkingModelInfo = getModelInfo(runtime.modelId);
|
|
1038
|
+
const providerOptsAnyView = providerOpts as {
|
|
1039
|
+
anthropic?: { thinking?: { type?: string } };
|
|
1040
|
+
};
|
|
1041
|
+
if (
|
|
1042
|
+
providerOptsAnyView.anthropic?.thinking?.type === "enabled" &&
|
|
1043
|
+
thinkingModelInfo?.thinkingType === "adaptive"
|
|
1044
|
+
) {
|
|
1045
|
+
providerOptsAnyView.anthropic.thinking = { type: "adaptive" as unknown as "enabled" };
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// OpenAI api-key path: `store: true` is seeded by OpenAIStrategy
|
|
1049
|
+
// via factory.defaultProviderOptions (Phase 12.2-G4 migration).
|
|
1050
|
+
// OAuth backend (ChatGPT Codex) overrides with `store: false` via
|
|
1051
|
+
// the auth registry. Both flow through resolveModelRuntime →
|
|
1052
|
+
// runtime.providerOptions → buildTurnProviderOptions and arrive
|
|
1053
|
+
// here merged into providerOpts.openai.
|
|
1054
|
+
// Top-level dropParam — shared with sub-agent path via shouldDropParam.
|
|
1055
|
+
// See src/providers/runtime.ts for the central rule.
|
|
1056
|
+
const dropParam = (p: "maxOutputTokens" | "temperature" | "topP"): boolean => shouldDropParam(runtime, p);
|
|
1057
|
+
|
|
1058
|
+
const systemForModel = runtime.modelId.startsWith("claude")
|
|
1059
|
+
? [
|
|
1060
|
+
{
|
|
1061
|
+
role: "system" as const,
|
|
1062
|
+
content: systemParts.staticPrefix,
|
|
1063
|
+
providerOptions: { anthropic: { cacheControl: { type: "ephemeral" as const } } },
|
|
1064
|
+
},
|
|
1065
|
+
{ role: "system" as const, content: system.slice(systemParts.staticPrefix.length) },
|
|
1066
|
+
]
|
|
1067
|
+
: system;
|
|
1068
|
+
|
|
1069
|
+
// Capture prompt-size breakdown so recordUsage can attach it to the
|
|
1070
|
+
// cost-log entry. Without this, "system prompt is huge" is unfalsifiable.
|
|
1071
|
+
// chars/4 ≈ tokens for English; reported as chars to keep math obvious.
|
|
1072
|
+
const messagesChars = deps.messages.reduce((s, m) => {
|
|
1073
|
+
const c = m.content;
|
|
1074
|
+
if (typeof c === "string") return s + c.length;
|
|
1075
|
+
if (Array.isArray(c)) {
|
|
1076
|
+
for (const part of c) {
|
|
1077
|
+
if (typeof (part as { text?: unknown }).text === "string") {
|
|
1078
|
+
s += (part as { text: string }).text.length;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return s;
|
|
1083
|
+
}, 0);
|
|
1084
|
+
let toolsChars = 0;
|
|
1085
|
+
let toolsCount = 0;
|
|
1086
|
+
for (const [name, t] of Object.entries(tools)) {
|
|
1087
|
+
toolsCount += 1;
|
|
1088
|
+
toolsChars += name.length;
|
|
1089
|
+
const desc = (t as { description?: string }).description;
|
|
1090
|
+
if (typeof desc === "string") toolsChars += desc.length;
|
|
1091
|
+
try {
|
|
1092
|
+
// Schemas often dominate tool size on non-Anthropic providers
|
|
1093
|
+
// (Zod-derived JSON schemas can be 2-5K chars per tool).
|
|
1094
|
+
const params =
|
|
1095
|
+
(t as { parameters?: unknown; inputSchema?: unknown }).parameters ??
|
|
1096
|
+
(t as { inputSchema?: unknown }).inputSchema;
|
|
1097
|
+
if (params) toolsChars += JSON.stringify(params).length;
|
|
1098
|
+
} catch {
|
|
1099
|
+
/* best-effort */
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
deps.setLastPromptBreakdown({
|
|
1103
|
+
systemChars: system.length,
|
|
1104
|
+
staticPrefixChars: systemParts.staticPrefix.length,
|
|
1105
|
+
dynamicSuffixChars: systemParts.dynamicSuffix.length,
|
|
1106
|
+
playwrightGuidanceChars: playwrightGuidance.length,
|
|
1107
|
+
messagesChars,
|
|
1108
|
+
messagesCount: deps.messages.length,
|
|
1109
|
+
toolsChars,
|
|
1110
|
+
toolsCount,
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
// Task 2.6a — assign a fresh correlation ID for this top-level streamText call.
|
|
1114
|
+
const _topCallId = crypto.randomUUID();
|
|
1115
|
+
deps.setCurrentCallId(_topCallId);
|
|
1116
|
+
// Phase B4: compact older tool_result parts before each top-level
|
|
1117
|
+
// step once cumulative message chars exceed the configured threshold.
|
|
1118
|
+
// The compactor preserves system + first user verbatim and keeps the
|
|
1119
|
+
// last N tool turns intact; older results are rewritten into short
|
|
1120
|
+
// stubs. Symmetric to the B3 sub-agent path; reuses the same module
|
|
1121
|
+
// with `label: "top-level"` so the stub text reflects which loop
|
|
1122
|
+
// elided the content.
|
|
1123
|
+
const topLevelCompactThreshold = getTopLevelCompactThresholdChars();
|
|
1124
|
+
const topLevelCompactKeepLast = getTopLevelCompactKeepLast();
|
|
1125
|
+
// Phase O1 — capture providerOptions SHAPE (types only) for forensics.
|
|
1126
|
+
deps.setLastProviderOptionsShape(
|
|
1127
|
+
Object.keys(providerOpts).length > 0 ? extractProviderOptionsShape(providerOpts) : null,
|
|
1128
|
+
);
|
|
1129
|
+
if (wireDebug.enabled) {
|
|
1130
|
+
wireDebug.logRequest({
|
|
1131
|
+
providerId: runtime.modelInfo?.provider ?? "unknown",
|
|
1132
|
+
modelId: runtime.modelId,
|
|
1133
|
+
messages: deps.messages as readonly unknown[],
|
|
1134
|
+
systemChars: (systemForModel as unknown as { length?: number })?.length ?? 0,
|
|
1135
|
+
toolNames: tools ? Object.keys(tools as Record<string, unknown>) : undefined,
|
|
1136
|
+
providerOptions: providerOpts,
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
// SiliconFlow DeepSeek thinking-mode reasoning_content workaround
|
|
1140
|
+
// (see siliconflow-history.ts). Sub-agent path applies the same strip
|
|
1141
|
+
// via the capability hook; identity for every other provider.
|
|
1142
|
+
const _topMessagesForCall = turnCaps.sanitizeHistory(deps.messages) as typeof deps.messages;
|
|
1143
|
+
const result = streamText({
|
|
1144
|
+
model: runtime.model,
|
|
1145
|
+
system: systemForModel,
|
|
1146
|
+
messages: _topMessagesForCall,
|
|
1147
|
+
tools,
|
|
1148
|
+
toolChoice: _hasResponseTools && turnCaps.supportsClientTools(runtime.modelInfo) ? "auto" : undefined,
|
|
1149
|
+
stopWhen:
|
|
1150
|
+
stepRouterPhase === "phase1"
|
|
1151
|
+
? stepCountIs(1) // SAMR Phase 1: stop after reasoning step
|
|
1152
|
+
: stepCountIs(deps.maxToolRounds),
|
|
1153
|
+
maxRetries: 0,
|
|
1154
|
+
abortSignal: signal,
|
|
1155
|
+
prepareStep: ({ stepNumber: sn, messages: stepMessages }) => {
|
|
1156
|
+
if (sn < 1) return {};
|
|
1157
|
+
const stripped = turnCaps.sanitizeHistory(stepMessages) as typeof stepMessages;
|
|
1158
|
+
const compacted = compactSubAgentMessages(stripped, {
|
|
1159
|
+
thresholdChars: topLevelCompactThreshold,
|
|
1160
|
+
keepLastTurns: topLevelCompactKeepLast,
|
|
1161
|
+
label: "top-level",
|
|
1162
|
+
});
|
|
1163
|
+
if (compacted === stripped && stripped === stepMessages) return {};
|
|
1164
|
+
return { messages: compacted };
|
|
1165
|
+
},
|
|
1166
|
+
...(dropParam("temperature") ? {} : { temperature: 0.7 }),
|
|
1167
|
+
...(dropParam("maxOutputTokens") ? {} : { maxOutputTokens: taskTypeToMaxTokens(pilCtx.taskType) }),
|
|
1168
|
+
...(Object.keys(providerOpts).length > 0 ? { providerOptions: providerOpts } : {}),
|
|
1169
|
+
experimental_onStepStart: (event: unknown) => {
|
|
1170
|
+
stepNumber = getStepNumber(event, stepNumber + 1);
|
|
1171
|
+
notifyObserver(observer?.onStepStart, {
|
|
1172
|
+
stepNumber,
|
|
1173
|
+
timestamp: Date.now(),
|
|
1174
|
+
});
|
|
1175
|
+
},
|
|
1176
|
+
onStepFinish: (event: unknown) => {
|
|
1177
|
+
const currentStep = getStepNumber(event, Math.max(stepNumber, 0));
|
|
1178
|
+
stepNumber = Math.max(stepNumber, currentStep);
|
|
1179
|
+
const stepUsage = getUsage(event);
|
|
1180
|
+
notifyObserver(observer?.onStepFinish, {
|
|
1181
|
+
stepNumber: currentStep,
|
|
1182
|
+
timestamp: Date.now(),
|
|
1183
|
+
finishReason: getFinishReason(event),
|
|
1184
|
+
usage: stepUsage,
|
|
1185
|
+
});
|
|
1186
|
+
// Realtime status bar update per step
|
|
1187
|
+
if (stepUsage.inputTokens || stepUsage.outputTokens) {
|
|
1188
|
+
deps.recordUsage(stepUsage, "message", runtime.modelId);
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
onFinish: ({ finishReason }) => {
|
|
1192
|
+
// Task 2.6b — emit llm-done (agent-mode only).
|
|
1193
|
+
try {
|
|
1194
|
+
const _ar = (globalThis as Record<string, unknown>).__muonroiAgentRuntime as
|
|
1195
|
+
| { emitEvent: (e: unknown) => void }
|
|
1196
|
+
| undefined;
|
|
1197
|
+
_ar?.emitEvent({
|
|
1198
|
+
t: "event",
|
|
1199
|
+
kind: "llm-done",
|
|
1200
|
+
correlationId: _topCallId,
|
|
1201
|
+
totalChars: assistantText.length,
|
|
1202
|
+
finishReason: finishReason ?? "stop",
|
|
1203
|
+
});
|
|
1204
|
+
} catch {
|
|
1205
|
+
/* best-effort */
|
|
1206
|
+
}
|
|
1207
|
+
deps.setCurrentCallId("");
|
|
1208
|
+
},
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
let _topTokenIndex = 0;
|
|
1212
|
+
const _wireProviderIdTop = runtime.modelInfo?.provider ?? "unknown";
|
|
1213
|
+
for await (const part of result.fullStream) {
|
|
1214
|
+
if (signal.aborted) {
|
|
1215
|
+
yield { type: "content", content: "\n\n[Cancelled]" };
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
if (wireDebug.enabled) {
|
|
1220
|
+
wireDebug.logChunk(_wireProviderIdTop, String(part.type ?? "unknown"), {
|
|
1221
|
+
hasText:
|
|
1222
|
+
typeof (part as { text?: string }).text === "string"
|
|
1223
|
+
? (part as { text: string }).text.length
|
|
1224
|
+
: undefined,
|
|
1225
|
+
hasReasoning:
|
|
1226
|
+
typeof (part as unknown as { reasoning?: string }).reasoning === "string"
|
|
1227
|
+
? (part as unknown as { reasoning: string }).reasoning.length
|
|
1228
|
+
: undefined,
|
|
1229
|
+
});
|
|
1230
|
+
if (part.type === "error") {
|
|
1231
|
+
wireDebug.logError(_wireProviderIdTop, (part as { error?: unknown }).error);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
switch (part.type) {
|
|
1236
|
+
case "text-delta":
|
|
1237
|
+
assistantText += part.text;
|
|
1238
|
+
// Task 2.6b — emit llm-token (agent-mode only; high-volume, default-off per Phase 4).
|
|
1239
|
+
try {
|
|
1240
|
+
const _ar = (globalThis as Record<string, unknown>).__muonroiAgentRuntime as
|
|
1241
|
+
| { emitEvent: (e: unknown) => void }
|
|
1242
|
+
| undefined;
|
|
1243
|
+
_ar?.emitEvent({
|
|
1244
|
+
t: "event",
|
|
1245
|
+
kind: "llm-token",
|
|
1246
|
+
correlationId: _topCallId,
|
|
1247
|
+
delta: part.text,
|
|
1248
|
+
tokenIndex: _topTokenIndex++,
|
|
1249
|
+
});
|
|
1250
|
+
} catch {
|
|
1251
|
+
/* best-effort */
|
|
1252
|
+
}
|
|
1253
|
+
yield { type: "content", content: part.text };
|
|
1254
|
+
break;
|
|
1255
|
+
|
|
1256
|
+
case "reasoning-delta":
|
|
1257
|
+
reasoningPreview = `${reasoningPreview}${part.text}`.slice(-256);
|
|
1258
|
+
if (containsEncryptedReasoning(reasoningPreview)) {
|
|
1259
|
+
if (!encryptedReasoningHidden) {
|
|
1260
|
+
encryptedReasoningHidden = true;
|
|
1261
|
+
yield { type: "reasoning", content: "[Encrypted reasoning hidden]" };
|
|
1262
|
+
}
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
// P0 native observation: accumulate reasoning for intent context.
|
|
1266
|
+
deps.appendTurnAssistantReasoning(part.text);
|
|
1267
|
+
yield { type: "reasoning", content: part.text };
|
|
1268
|
+
break;
|
|
1269
|
+
|
|
1270
|
+
case "tool-call": {
|
|
1271
|
+
const tc = toToolCall(part);
|
|
1272
|
+
activeToolCalls.push(tc);
|
|
1273
|
+
// SAMR: track that Phase 1 produced tool calls → transition to Phase 2
|
|
1274
|
+
if (stepRouterPhase === "phase1") phase1HadToolCalls = true;
|
|
1275
|
+
|
|
1276
|
+
// EE PreToolUse hook: fire intercept before tool execution.
|
|
1277
|
+
{
|
|
1278
|
+
const turnAssistantReasoning = deps.getTurnAssistantReasoning();
|
|
1279
|
+
const intentContext: import("../hooks/types.js").PreToolIntentContext = {
|
|
1280
|
+
...(turnAssistantReasoning
|
|
1281
|
+
? { assistantReasoningExcerpt: turnAssistantReasoning.slice(-200) }
|
|
1282
|
+
: {}),
|
|
1283
|
+
...(deps.priorWarningIdsInSession.size > 0
|
|
1284
|
+
? {
|
|
1285
|
+
priorWarningIdsInSession: Array.from(deps.priorWarningIdsInSession).slice(-20),
|
|
1286
|
+
}
|
|
1287
|
+
: {}),
|
|
1288
|
+
...(pilCtx.gsdPhase ? { gsdPhase: pilCtx.gsdPhase } : {}),
|
|
1289
|
+
...(userMessage.slice(0, 200) ? { userGoalExcerpt: userMessage.slice(0, 200) } : {}),
|
|
1290
|
+
};
|
|
1291
|
+
const preInput: PreToolUseHookInput = {
|
|
1292
|
+
hook_event_name: "PreToolUse",
|
|
1293
|
+
tool_name: tc.function.name,
|
|
1294
|
+
tool_input: JSON.parse(tc.function.arguments || "{}"),
|
|
1295
|
+
session_id: deps.session?.id,
|
|
1296
|
+
cwd: deps.bash.getCwd(),
|
|
1297
|
+
...(Object.keys(intentContext).length > 0 ? { intent_context: intentContext } : {}),
|
|
1298
|
+
};
|
|
1299
|
+
const preResult = await deps.fireHook(preInput, signal).catch(() => ({
|
|
1300
|
+
blocked: false,
|
|
1301
|
+
blockingErrors: [] as Array<{ command: string; stderr: string }>,
|
|
1302
|
+
preventContinuation: false,
|
|
1303
|
+
additionalContexts: [] as string[],
|
|
1304
|
+
results: [] as import("../hooks/types.js").HookResult[],
|
|
1305
|
+
eeMatches: [] as import("../hooks/types.js").EEMatchEntry[],
|
|
1306
|
+
}));
|
|
1307
|
+
for (const ctx of preResult.additionalContexts ?? []) {
|
|
1308
|
+
yield { type: "content", content: `${ctx}\n` };
|
|
1309
|
+
}
|
|
1310
|
+
// Store structured EE matches for session guidance injection on next turn.
|
|
1311
|
+
for (const m of preResult.eeMatches ?? []) {
|
|
1312
|
+
deps.sessionEEGuidance.set(m.id, {
|
|
1313
|
+
toolName: m.toolName,
|
|
1314
|
+
message: m.message,
|
|
1315
|
+
why: m.why,
|
|
1316
|
+
confidence: m.confidence,
|
|
1317
|
+
});
|
|
1318
|
+
// Cap at 30 entries — oldest first, trim when exceeded.
|
|
1319
|
+
if (deps.sessionEEGuidance.size > 30) {
|
|
1320
|
+
const firstKey = deps.sessionEEGuidance.keys().next().value;
|
|
1321
|
+
if (firstKey !== undefined) deps.sessionEEGuidance.delete(firstKey);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
// P0 native observation: track which principle IDs surfaced
|
|
1325
|
+
// this turn so the next intercept can dedup server-side.
|
|
1326
|
+
try {
|
|
1327
|
+
const { getLastSurfacedState } = await import("../ee/intercept.js");
|
|
1328
|
+
const { surfacedIds } = getLastSurfacedState();
|
|
1329
|
+
for (const id of surfacedIds) deps.priorWarningIdsInSession.add(id);
|
|
1330
|
+
// Cap memory: keep only most-recent 100 IDs.
|
|
1331
|
+
if (deps.priorWarningIdsInSession.size > 100) {
|
|
1332
|
+
const arr = Array.from(deps.priorWarningIdsInSession);
|
|
1333
|
+
deps.setPriorWarningIdsInSession(new Set(arr.slice(-100)));
|
|
1334
|
+
}
|
|
1335
|
+
} catch {
|
|
1336
|
+
/* fail-open */
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
// Pitfall 9: log the pending call so reconcile() can recover any
|
|
1341
|
+
// staged .tmp files if the process is killed before tool-result.
|
|
1342
|
+
if (deps.pendingCalls) {
|
|
1343
|
+
const turnId = deps.session?.id ?? "anon";
|
|
1344
|
+
const callId = stableCallId(turnId, tc.function.name, tc.function.arguments);
|
|
1345
|
+
// Phase 0: predictStagedPaths = [] for all tools (refined in Phase 1).
|
|
1346
|
+
void deps.pendingCalls.begin({ call_id: callId, tool_name: tc.function.name }).catch(() => {});
|
|
1347
|
+
// Attach callId to the ToolCall so tool-result can end it.
|
|
1348
|
+
(tc as ToolCall & { _pendingCallId?: string })._pendingCallId = callId;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// Phase A4: write-ahead persistence — insert a pending row into
|
|
1352
|
+
// tool_calls BEFORE executing the tool. If the stream throws
|
|
1353
|
+
// mid-call (e.g. provider 5xx, abort, network drop), this row
|
|
1354
|
+
// remains as `pending` so `usage forensics` can show the args
|
|
1355
|
+
// the model passed. The post-stream appendMessages() path
|
|
1356
|
+
// (INSERT OR IGNORE + UPDATE) will finalize this row to
|
|
1357
|
+
// `completed` once the turn settles normally.
|
|
1358
|
+
if (deps.sessionStore && deps.session) {
|
|
1359
|
+
// Predicted assistant seq: user message + assistant message
|
|
1360
|
+
// are appended atomically by appendCompletedTurn().
|
|
1361
|
+
// getNextMessageSequence() returns the seq the user message
|
|
1362
|
+
// will get; the assistant message is the next one after.
|
|
1363
|
+
let predictedSeq = -1;
|
|
1364
|
+
try {
|
|
1365
|
+
predictedSeq = getNextMessageSequence(deps.session.id) + 1;
|
|
1366
|
+
} catch {
|
|
1367
|
+
/* fail-open — leave predictedSeq=-1; post-stream UPDATE corrects it */
|
|
1368
|
+
}
|
|
1369
|
+
persistToolCallWriteAhead(
|
|
1370
|
+
deps.session.id,
|
|
1371
|
+
predictedSeq,
|
|
1372
|
+
tc.id,
|
|
1373
|
+
tc.function.name,
|
|
1374
|
+
tc.function.arguments || "{}",
|
|
1375
|
+
);
|
|
1376
|
+
}
|
|
1377
|
+
notifyObserver(observer?.onToolStart, {
|
|
1378
|
+
toolCall: tc,
|
|
1379
|
+
timestamp: Date.now(),
|
|
1380
|
+
});
|
|
1381
|
+
// Interaction log: tool call start
|
|
1382
|
+
try {
|
|
1383
|
+
if (deps.session) {
|
|
1384
|
+
logInteraction(deps.session.id, "tool_call", {
|
|
1385
|
+
eventSubtype: tc.function.name,
|
|
1386
|
+
data: {
|
|
1387
|
+
toolCallId: tc.id,
|
|
1388
|
+
argsPreview: tc.function.arguments.slice(0, 200),
|
|
1389
|
+
},
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
} catch {
|
|
1393
|
+
/* fail-open */
|
|
1394
|
+
}
|
|
1395
|
+
yield { type: "tool_calls", toolCalls: [tc] };
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
case "tool-result": {
|
|
1400
|
+
const tc: ToolCall = {
|
|
1401
|
+
id: part.toolCallId,
|
|
1402
|
+
type: "function",
|
|
1403
|
+
function: { name: part.toolName, arguments: JSON.stringify(part.input ?? {}) },
|
|
1404
|
+
};
|
|
1405
|
+
let tr = toToolResult(part.output);
|
|
1406
|
+
|
|
1407
|
+
// Vision Bridge: proxy image-bearing tool results for text-only models (any tool, not just MCP)
|
|
1408
|
+
try {
|
|
1409
|
+
const bridgeResult = await bridgeMcpToolResult(
|
|
1410
|
+
part.toolName,
|
|
1411
|
+
tr.output,
|
|
1412
|
+
turnModelId,
|
|
1413
|
+
signal,
|
|
1414
|
+
part.toolCallId,
|
|
1415
|
+
);
|
|
1416
|
+
if (bridgeResult.proxied) {
|
|
1417
|
+
tr = {
|
|
1418
|
+
...tr,
|
|
1419
|
+
output:
|
|
1420
|
+
typeof bridgeResult.output === "string"
|
|
1421
|
+
? bridgeResult.output
|
|
1422
|
+
: JSON.stringify(bridgeResult.output),
|
|
1423
|
+
};
|
|
1424
|
+
yield { type: "content", content: `[Vision Bridge: image → text for ${turnModelId}]\n` };
|
|
1425
|
+
}
|
|
1426
|
+
} catch {
|
|
1427
|
+
/* fail-open */
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// Pitfall 9: settle the pending call log entry.
|
|
1431
|
+
if (deps.pendingCalls) {
|
|
1432
|
+
const pending = activeToolCalls.find((t) => t.id === part.toolCallId);
|
|
1433
|
+
const callId = (pending as ToolCall & { _pendingCallId?: string })?._pendingCallId;
|
|
1434
|
+
if (callId) {
|
|
1435
|
+
const endStatus = signal.aborted ? "aborted" : "settled";
|
|
1436
|
+
void deps.pendingCalls.end(callId, endStatus).catch(() => {});
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
// EE PostToolUse hook: fire-and-forget after tool execution.
|
|
1440
|
+
{
|
|
1441
|
+
const postInput: PostToolUseHookInput = {
|
|
1442
|
+
hook_event_name: "PostToolUse",
|
|
1443
|
+
tool_name: part.toolName,
|
|
1444
|
+
tool_input: (part.input as Record<string, unknown>) ?? {},
|
|
1445
|
+
tool_output:
|
|
1446
|
+
typeof tr.output === "string"
|
|
1447
|
+
? { text: tr.output }
|
|
1448
|
+
: ((tr.output as unknown as Record<string, unknown>) ?? {}),
|
|
1449
|
+
session_id: deps.session?.id,
|
|
1450
|
+
cwd: deps.bash.getCwd(),
|
|
1451
|
+
};
|
|
1452
|
+
await deps.fireHook(postInput, signal).catch(() => {});
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Response tool: yield as structured_response instead of tool_result.
|
|
1456
|
+
// AI SDK v5 wraps tool outputs as `{type:"json", value:{...}}`; unwrap
|
|
1457
|
+
// to expose the schema-shaped payload to the UI renderer.
|
|
1458
|
+
if (isResponseTool(part.toolName)) {
|
|
1459
|
+
responseToolCalled = true;
|
|
1460
|
+
const taskType = getResponseTaskType(part.toolName);
|
|
1461
|
+
const rawOutput = part.output as unknown;
|
|
1462
|
+
const unwrapped =
|
|
1463
|
+
rawOutput && typeof rawOutput === "object" && (rawOutput as { type?: string }).type === "json"
|
|
1464
|
+
? ((rawOutput as { value?: unknown }).value ?? {})
|
|
1465
|
+
: (rawOutput ?? {});
|
|
1466
|
+
yield {
|
|
1467
|
+
type: "structured_response" as StreamChunk["type"],
|
|
1468
|
+
structuredResponse: {
|
|
1469
|
+
taskType: taskType ?? part.toolName,
|
|
1470
|
+
data: unwrapped as Record<string, unknown>,
|
|
1471
|
+
},
|
|
1472
|
+
};
|
|
1473
|
+
notifyObserver(observer?.onToolFinish, { toolCall: tc, toolResult: tr, timestamp: Date.now() });
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
notifyObserver(observer?.onToolFinish, {
|
|
1478
|
+
toolCall: tc,
|
|
1479
|
+
toolResult: tr,
|
|
1480
|
+
timestamp: Date.now(),
|
|
1481
|
+
});
|
|
1482
|
+
// Interaction log: tool result
|
|
1483
|
+
try {
|
|
1484
|
+
if (deps.session) {
|
|
1485
|
+
const outputPreview =
|
|
1486
|
+
typeof tr.output === "string" ? tr.output.slice(0, 200) : JSON.stringify(tr.output).slice(0, 200);
|
|
1487
|
+
logInteraction(deps.session.id, "tool_result", {
|
|
1488
|
+
eventSubtype: tc.function.name,
|
|
1489
|
+
data: { success: tr.success, outputPreview },
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
} catch {
|
|
1493
|
+
/* fail-open */
|
|
1494
|
+
}
|
|
1495
|
+
yield { type: "tool_result", toolCall: tc, toolResult: tr };
|
|
1496
|
+
break;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
case "tool-error": {
|
|
1500
|
+
// AI SDK emits this when tool execution throws/aborts before
|
|
1501
|
+
// producing a tool-result. Without this branch, the tool_call
|
|
1502
|
+
// log row has no matching tool_result and the EE judge never
|
|
1503
|
+
// sees the failure → silent ~1.6% pairing leak in prod DB.
|
|
1504
|
+
const errPart = part as {
|
|
1505
|
+
type: "tool-error";
|
|
1506
|
+
toolCallId: string;
|
|
1507
|
+
toolName: string;
|
|
1508
|
+
input?: unknown;
|
|
1509
|
+
error: unknown;
|
|
1510
|
+
};
|
|
1511
|
+
const tc: ToolCall = {
|
|
1512
|
+
id: errPart.toolCallId,
|
|
1513
|
+
type: "function",
|
|
1514
|
+
function: { name: errPart.toolName, arguments: JSON.stringify(errPart.input ?? {}) },
|
|
1515
|
+
};
|
|
1516
|
+
const errMsg =
|
|
1517
|
+
errPart.error instanceof Error
|
|
1518
|
+
? errPart.error.message
|
|
1519
|
+
: typeof errPart.error === "string"
|
|
1520
|
+
? errPart.error
|
|
1521
|
+
: JSON.stringify(errPart.error);
|
|
1522
|
+
const tr = { success: false, output: `[tool-error] ${errMsg}` };
|
|
1523
|
+
|
|
1524
|
+
// Settle pending-call ledger so we don't leak stale .tmp files.
|
|
1525
|
+
if (deps.pendingCalls) {
|
|
1526
|
+
const pending = activeToolCalls.find((t) => t.id === errPart.toolCallId);
|
|
1527
|
+
const callId = (pending as ToolCall & { _pendingCallId?: string })?._pendingCallId;
|
|
1528
|
+
if (callId) void deps.pendingCalls.end(callId, "settled").catch(() => {});
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// Phase A4: mark the write-ahead tool_calls row as `errored`.
|
|
1532
|
+
// The post-stream appendMessages() path does NOT see tool-error
|
|
1533
|
+
// parts in the assistant message content (the SDK doesn't emit
|
|
1534
|
+
// them there), so without this explicit update the row would
|
|
1535
|
+
// remain `pending` after a clean tool failure.
|
|
1536
|
+
if (deps.session) {
|
|
1537
|
+
markToolCallErrored(deps.session.id, errPart.toolCallId, errMsg);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// Fire PostToolUseFailure so EE judge can record IGNORED outcome.
|
|
1541
|
+
{
|
|
1542
|
+
const failInput: PostToolUseFailureHookInput = {
|
|
1543
|
+
hook_event_name: "PostToolUseFailure",
|
|
1544
|
+
tool_name: errPart.toolName,
|
|
1545
|
+
tool_input: (errPart.input as Record<string, unknown>) ?? {},
|
|
1546
|
+
error: errMsg,
|
|
1547
|
+
session_id: deps.session?.id,
|
|
1548
|
+
cwd: deps.bash.getCwd(),
|
|
1549
|
+
};
|
|
1550
|
+
await deps.fireHook(failInput, signal).catch(() => {});
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
try {
|
|
1554
|
+
if (deps.session) {
|
|
1555
|
+
logInteraction(deps.session.id, "tool_result", {
|
|
1556
|
+
eventSubtype: errPart.toolName,
|
|
1557
|
+
data: { success: false, error: errMsg.slice(0, 500), reason: "tool-error" },
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
} catch {
|
|
1561
|
+
/* fail-open */
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
notifyObserver(observer?.onToolFinish, { toolCall: tc, toolResult: tr, timestamp: Date.now() });
|
|
1565
|
+
yield { type: "tool_result", toolCall: tc, toolResult: tr };
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
case "tool-approval-request": {
|
|
1570
|
+
const approvalPart = part as unknown as {
|
|
1571
|
+
approvalId: string;
|
|
1572
|
+
toolCall: { toolCallId: string; toolName: string; input: unknown };
|
|
1573
|
+
};
|
|
1574
|
+
const toolCallId = approvalPart.toolCall?.toolCallId ?? "";
|
|
1575
|
+
const pendingTc = activeToolCalls.find((tc) => tc.id === toolCallId);
|
|
1576
|
+
const tcForChunk = pendingTc ?? {
|
|
1577
|
+
id: toolCallId,
|
|
1578
|
+
type: "function" as const,
|
|
1579
|
+
function: {
|
|
1580
|
+
name: approvalPart.toolCall?.toolName ?? "paid_request",
|
|
1581
|
+
arguments: JSON.stringify(approvalPart.toolCall?.input ?? {}),
|
|
1582
|
+
},
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
// Payment pre-check disabled — Stripe billing pending.
|
|
1586
|
+
const paymentPrecheck: import("../types/index").PaymentPrecheck | undefined = undefined;
|
|
1587
|
+
|
|
1588
|
+
// Plan 03-01: check permission mode before yielding approval request to UI.
|
|
1589
|
+
// auto-edit auto-approves file ops; yolo auto-approves everything.
|
|
1590
|
+
const toolName = approvalPart.toolCall?.toolName ?? "";
|
|
1591
|
+
if (!toolNeedsApproval(toolName, deps.permissionMode)) {
|
|
1592
|
+
// Auto-approve: respond directly without surfacing to UI.
|
|
1593
|
+
deps.respondToToolApproval(approvalPart.approvalId, true);
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
yield {
|
|
1598
|
+
type: "tool_approval_request",
|
|
1599
|
+
approvalId: approvalPart.approvalId,
|
|
1600
|
+
toolCall: tcForChunk,
|
|
1601
|
+
paymentPrecheck,
|
|
1602
|
+
};
|
|
1603
|
+
break;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
case "error": {
|
|
1607
|
+
const authError = isAuthenticationError(part.error);
|
|
1608
|
+
const friendly = humanizeApiError(part.error);
|
|
1609
|
+
notifyObserver(observer?.onError, {
|
|
1610
|
+
message: friendly,
|
|
1611
|
+
timestamp: Date.now(),
|
|
1612
|
+
});
|
|
1613
|
+
// Interaction log: error
|
|
1614
|
+
try {
|
|
1615
|
+
if (deps.session) {
|
|
1616
|
+
logInteraction(deps.session.id, "error", {
|
|
1617
|
+
eventSubtype: authError ? "auth" : "api",
|
|
1618
|
+
data: { message: friendly.slice(0, 200) },
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
} catch {
|
|
1622
|
+
/* fail-open */
|
|
1623
|
+
}
|
|
1624
|
+
yield {
|
|
1625
|
+
type: "error",
|
|
1626
|
+
content: friendly,
|
|
1627
|
+
isAuthError: authError,
|
|
1628
|
+
};
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
case "abort":
|
|
1633
|
+
yield { type: "content", content: "\n\n[Cancelled]" };
|
|
1634
|
+
break;
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
// ─── SAMR Phase 1 → Phase 2 transition ─────────────────────────
|
|
1639
|
+
// Phase 1 (premium model) produced tool calls but the SDK stopped
|
|
1640
|
+
// before executing them (stopWhen: stepCountIs(1)). Append the
|
|
1641
|
+
// assistant message to deps.messages and restart the loop with
|
|
1642
|
+
// the fast execution model. Phase 2's streamText call will see
|
|
1643
|
+
// the pending tool calls and execute them automatically.
|
|
1644
|
+
if (stepRouterPhase === "phase1" && phase1HadToolCalls) {
|
|
1645
|
+
try {
|
|
1646
|
+
const phase1Response = await result.response;
|
|
1647
|
+
// Append only new messages (assistant message with tool calls)
|
|
1648
|
+
const newMsgs = phase1Response.messages.slice(deps.messages.length);
|
|
1649
|
+
for (const msg of newMsgs) {
|
|
1650
|
+
if (msg.role === "assistant") {
|
|
1651
|
+
deps.messages.push(msg);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
} catch {
|
|
1655
|
+
// If response extraction fails, fall through to normal completion
|
|
1656
|
+
}
|
|
1657
|
+
stepRouterPhase = "phase2";
|
|
1658
|
+
continue; // Re-enter while loop with Phase 2 (fast) model
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
if (signal.aborted) {
|
|
1662
|
+
deps.discardAbortedTurn(userModelMessage);
|
|
1663
|
+
yield { type: "done" };
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
try {
|
|
1668
|
+
const response = await result.response;
|
|
1669
|
+
if (!signal.aborted) {
|
|
1670
|
+
// Scrub oversized base64 image payloads from tool-result parts
|
|
1671
|
+
// BEFORE persisting. The vision bridge above only modified the
|
|
1672
|
+
// transient `tr` shown to the user — `response.messages` from
|
|
1673
|
+
// the AI SDK still carries the full base64 (e.g. Playwright
|
|
1674
|
+
// screenshot, ~1.5MB). Persisting that lets it accumulate and
|
|
1675
|
+
// overflow the model's context on subsequent turns.
|
|
1676
|
+
const scrubbed = scrubImagePayloadsInMessages(response.messages);
|
|
1677
|
+
deps.appendCompletedTurn(userModelMessage, sanitizeModelMessages(scrubbed));
|
|
1678
|
+
streamOk = true;
|
|
1679
|
+
}
|
|
1680
|
+
} catch (responseError: unknown) {
|
|
1681
|
+
if (
|
|
1682
|
+
!attemptedOverflowRecovery &&
|
|
1683
|
+
!assistantText.trim() &&
|
|
1684
|
+
modelInfo &&
|
|
1685
|
+
isContextLimitError(responseError)
|
|
1686
|
+
) {
|
|
1687
|
+
attemptedOverflowRecovery = true;
|
|
1688
|
+
continue;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
if (signal.aborted) {
|
|
1693
|
+
deps.discardAbortedTurn(userModelMessage);
|
|
1694
|
+
yield { type: "done" };
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
if (!streamOk && assistantText.trim()) {
|
|
1699
|
+
deps.appendCompletedTurn(userModelMessage, [{ role: "assistant", content: assistantText }]);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// Fallback: model responded in text despite tool_choice=required
|
|
1703
|
+
// Attempt JSON extraction from assistant text → yield as structured_response
|
|
1704
|
+
if (_hasResponseTools && !responseToolCalled && pilCtx.taskType && assistantText.trim()) {
|
|
1705
|
+
try {
|
|
1706
|
+
const jsonMatch = assistantText.match(/\{[\s\S]*\}/);
|
|
1707
|
+
if (jsonMatch) {
|
|
1708
|
+
const parsed = JSON.parse(jsonMatch[0]) as Record<string, unknown>;
|
|
1709
|
+
if (Object.keys(parsed).length > 0) {
|
|
1710
|
+
responseToolCalled = true;
|
|
1711
|
+
yield {
|
|
1712
|
+
type: "structured_response" as StreamChunk["type"],
|
|
1713
|
+
structuredResponse: {
|
|
1714
|
+
taskType: pilCtx.taskType,
|
|
1715
|
+
data: parsed,
|
|
1716
|
+
},
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
} catch {
|
|
1721
|
+
// JSON parse failed — leave as text-fallback
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// Track PIL output mode for /optimize metrics
|
|
1726
|
+
{
|
|
1727
|
+
const { setLastOutputMode } = await import("../pil/store.js");
|
|
1728
|
+
if (!_hasResponseTools) setLastOutputMode("conversational");
|
|
1729
|
+
else if (responseToolCalled) setLastOutputMode("structured");
|
|
1730
|
+
else setLastOutputMode("text-fallback");
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
// ROUTE-11: Fire routeFeedback after turn completes (success path).
|
|
1734
|
+
// Must come AFTER posttool calls (posttool fires during tool-result processing above).
|
|
1735
|
+
// Fire-and-forget — no await. Skipped when taskHash is null (bridge absent).
|
|
1736
|
+
{
|
|
1737
|
+
const turnDuration = Date.now() - turnStartMs;
|
|
1738
|
+
if (taskHash) {
|
|
1739
|
+
const tier = taskTypeToTier(pilCtx.taskType);
|
|
1740
|
+
void routeFeedback(
|
|
1741
|
+
taskHash,
|
|
1742
|
+
tier,
|
|
1743
|
+
runtime.modelId,
|
|
1744
|
+
"success", // Phase 6: all normal completions = 'success'
|
|
1745
|
+
0, // retryCount: 0 for first attempt
|
|
1746
|
+
turnDuration,
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
// HTTP path: also report via router store taskHash (covers warm/cold EE routes)
|
|
1750
|
+
const storeHash = routerStore.getState().taskHash;
|
|
1751
|
+
if (storeHash) {
|
|
1752
|
+
reportRouteOutcome(storeHash, "success", turnDuration);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
// Interaction log: agent response complete
|
|
1757
|
+
try {
|
|
1758
|
+
if (deps.session) {
|
|
1759
|
+
const sb = statusBarStore.getState();
|
|
1760
|
+
const turnDurationMs = Date.now() - turnStartMs;
|
|
1761
|
+
logInteraction(deps.session.id, "agent_response", {
|
|
1762
|
+
model: turnModelId,
|
|
1763
|
+
inputTokens: sb.in_tokens,
|
|
1764
|
+
outputTokens: sb.out_tokens,
|
|
1765
|
+
durationMs: turnDurationMs,
|
|
1766
|
+
data: {
|
|
1767
|
+
textLength: assistantText.length,
|
|
1768
|
+
toolCallCount: activeToolCalls.length,
|
|
1769
|
+
compacted: deps.getCompactedThisTurn(),
|
|
1770
|
+
},
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
} catch {
|
|
1774
|
+
/* fail-open */
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
const stopInput: StopHookInput = {
|
|
1778
|
+
hook_event_name: "Stop",
|
|
1779
|
+
session_id: deps.session?.id,
|
|
1780
|
+
cwd: deps.bash.getCwd(),
|
|
1781
|
+
};
|
|
1782
|
+
await deps.fireHook(stopInput, signal).catch(() => {});
|
|
1783
|
+
|
|
1784
|
+
// Debug trace: emit pipeline summary
|
|
1785
|
+
if (_debugOn) {
|
|
1786
|
+
const sb = statusBarStore.getState();
|
|
1787
|
+
const defaultInfo = getModelInfo(deps.modelId);
|
|
1788
|
+
const usedInfo = getModelInfo(turnModelId);
|
|
1789
|
+
const routerSaved =
|
|
1790
|
+
defaultInfo && usedInfo && defaultInfo.outputPrice > usedInfo.outputPrice
|
|
1791
|
+
? (sb.out_tokens * (defaultInfo.outputPrice - usedInfo.outputPrice)) / 1_000_000
|
|
1792
|
+
: 0;
|
|
1793
|
+
const cacheSaved =
|
|
1794
|
+
sb.cache_read_tokens > 0 && defaultInfo
|
|
1795
|
+
? (sb.cache_read_tokens *
|
|
1796
|
+
(defaultInfo.inputPrice - (defaultInfo.cachedInputPrice ?? defaultInfo.inputPrice * 0.1))) /
|
|
1797
|
+
1_000_000
|
|
1798
|
+
: 0;
|
|
1799
|
+
const trace: TurnTrace = {
|
|
1800
|
+
turn_id: _debugTurnId,
|
|
1801
|
+
timestamp: turnStartMs,
|
|
1802
|
+
raw_prompt: userMessage,
|
|
1803
|
+
steps: _debugSteps,
|
|
1804
|
+
model_requested: deps.modelId,
|
|
1805
|
+
model_used: turnModelId,
|
|
1806
|
+
routed: turnModelId !== deps.modelId,
|
|
1807
|
+
input_tokens: sb.in_tokens,
|
|
1808
|
+
output_tokens: sb.out_tokens,
|
|
1809
|
+
cache_read_tokens: sb.cache_read_tokens,
|
|
1810
|
+
cost_usd: sb.session_usd,
|
|
1811
|
+
estimated_savings: {
|
|
1812
|
+
pil_tokens_saved: _pilEnrichmentDeltaSnapshot > 0 ? _pilEnrichmentDeltaSnapshot : 0,
|
|
1813
|
+
cache_tokens_saved: sb.cache_read_tokens,
|
|
1814
|
+
router_cost_saved_usd: routerSaved,
|
|
1815
|
+
total_tokens_saved:
|
|
1816
|
+
(_pilEnrichmentDeltaSnapshot > 0 ? _pilEnrichmentDeltaSnapshot : 0) + sb.cache_read_tokens,
|
|
1817
|
+
total_cost_saved_usd: routerSaved + cacheSaved,
|
|
1818
|
+
},
|
|
1819
|
+
};
|
|
1820
|
+
recordTurnTrace(trace);
|
|
1821
|
+
|
|
1822
|
+
const traceLines: string[] = [];
|
|
1823
|
+
traceLines.push("\n┌─ Pipeline Trace ─────────────────────────");
|
|
1824
|
+
for (const step of _debugSteps) {
|
|
1825
|
+
const dur = step.duration_ms < 1 ? "<1ms" : `${step.duration_ms}ms`;
|
|
1826
|
+
const saved = step.tokens_saved ? ` (saved ~${step.tokens_saved} tok)` : "";
|
|
1827
|
+
traceLines.push(`│ ▸ ${step.name} [${dur}]${saved}`);
|
|
1828
|
+
traceLines.push(`│ ${step.output_summary}`);
|
|
1829
|
+
}
|
|
1830
|
+
const routeLabel = trace.routed ? `${trace.model_requested}→${trace.model_used}` : trace.model_used;
|
|
1831
|
+
traceLines.push(
|
|
1832
|
+
`│ Model: ${routeLabel} | ↑${sb.in_tokens} ↓${sb.out_tokens} | $${sb.session_usd.toFixed(4)}`,
|
|
1833
|
+
);
|
|
1834
|
+
if (trace.estimated_savings.total_cost_saved_usd > 0) {
|
|
1835
|
+
traceLines.push(
|
|
1836
|
+
`│ Savings: ~${trace.estimated_savings.total_tokens_saved} tok, ~$${trace.estimated_savings.total_cost_saved_usd.toFixed(4)}`,
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
traceLines.push("└──────────────────────────────────────────\n");
|
|
1840
|
+
yield { type: "content", content: traceLines.join("\n") };
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
if (modelInfo?.contextWindow) {
|
|
1844
|
+
await deps.postTurnCompact(provider, system, modelInfo.contextWindow, signal);
|
|
1845
|
+
}
|
|
1846
|
+
yield { type: "done" };
|
|
1847
|
+
return;
|
|
1848
|
+
} catch (err: unknown) {
|
|
1849
|
+
if (signal.aborted) {
|
|
1850
|
+
deps.discardAbortedTurn(userModelMessage);
|
|
1851
|
+
// ROUTE-11: Fire routeFeedback for cancelled turns (abort path).
|
|
1852
|
+
// Fire-and-forget — no await. Skipped when taskHash is null.
|
|
1853
|
+
{
|
|
1854
|
+
const turnDuration = Date.now() - turnStartMs;
|
|
1855
|
+
if (taskHash) {
|
|
1856
|
+
const tier = taskTypeToTier(pilCtx.taskType);
|
|
1857
|
+
void routeFeedback(taskHash, tier, runtime.modelId, "cancelled", 0, turnDuration);
|
|
1858
|
+
}
|
|
1859
|
+
const storeHash = routerStore.getState().taskHash;
|
|
1860
|
+
if (storeHash) {
|
|
1861
|
+
reportRouteOutcome(storeHash, "cancelled", turnDuration);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
yield { type: "content", content: "\n\n[Cancelled]" };
|
|
1865
|
+
yield { type: "done" };
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
if (!attemptedOverflowRecovery && !assistantText.trim() && modelInfo && isContextLimitError(err)) {
|
|
1870
|
+
attemptedOverflowRecovery = true;
|
|
1871
|
+
continue;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// Transient network/server error retry — up to MAX_STREAM_RETRIES extra attempts.
|
|
1875
|
+
// Only retry when no content has flowed yet (assistantText empty) to avoid
|
|
1876
|
+
// partial-output corruption. Honour the abort signal between retries.
|
|
1877
|
+
if (!assistantText.trim() && streamRetryCount < MAX_STREAM_RETRIES && !signal.aborted) {
|
|
1878
|
+
const { transient } = classifyStreamError(err);
|
|
1879
|
+
if (transient) {
|
|
1880
|
+
streamRetryCount++;
|
|
1881
|
+
// Exponential backoff: 500 → 2000 ms with ±25% jitter
|
|
1882
|
+
const baseMs = 500;
|
|
1883
|
+
const expMs = Math.min(baseMs * 4 ** (streamRetryCount - 1), 8_000);
|
|
1884
|
+
const spread = expMs * 0.25;
|
|
1885
|
+
const nextDelayMs = Math.round(expMs + (Math.random() * 2 - 1) * spread);
|
|
1886
|
+
const errorName = err instanceof Error ? err.name : "Error";
|
|
1887
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1888
|
+
// Emit harness telemetry event
|
|
1889
|
+
try {
|
|
1890
|
+
const _ar = (globalThis as Record<string, unknown>).__muonroiAgentRuntime as
|
|
1891
|
+
| { emitEvent: (e: unknown) => void }
|
|
1892
|
+
| undefined;
|
|
1893
|
+
_ar?.emitEvent({
|
|
1894
|
+
t: "event",
|
|
1895
|
+
kind: "stream-retry",
|
|
1896
|
+
attempt: streamRetryCount,
|
|
1897
|
+
maxAttempts: MAX_STREAM_RETRIES + 1,
|
|
1898
|
+
errorName,
|
|
1899
|
+
errorMessage,
|
|
1900
|
+
nextDelayMs,
|
|
1901
|
+
});
|
|
1902
|
+
} catch {
|
|
1903
|
+
/* best-effort */
|
|
1904
|
+
}
|
|
1905
|
+
try {
|
|
1906
|
+
if (deps.session) {
|
|
1907
|
+
logInteraction(deps.session.id, "stream_retry", {
|
|
1908
|
+
data: {
|
|
1909
|
+
attempt: streamRetryCount,
|
|
1910
|
+
maxAttempts: MAX_STREAM_RETRIES + 1,
|
|
1911
|
+
errorName,
|
|
1912
|
+
errorMessage: errorMessage.slice(0, 200),
|
|
1913
|
+
nextDelayMs,
|
|
1914
|
+
},
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
} catch {
|
|
1918
|
+
/* fail-open */
|
|
1919
|
+
}
|
|
1920
|
+
await new Promise<void>((resolve) => setTimeout(resolve, nextDelayMs));
|
|
1921
|
+
if (!signal.aborted) {
|
|
1922
|
+
continue;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
const authError = isAuthenticationError(err);
|
|
1928
|
+
const friendly = humanizeApiError(err);
|
|
1929
|
+
notifyObserver(observer?.onError, {
|
|
1930
|
+
message: friendly,
|
|
1931
|
+
timestamp: Date.now(),
|
|
1932
|
+
});
|
|
1933
|
+
yield {
|
|
1934
|
+
type: "error",
|
|
1935
|
+
content: friendly,
|
|
1936
|
+
isAuthError: authError,
|
|
1937
|
+
};
|
|
1938
|
+
if (assistantText.trim()) {
|
|
1939
|
+
deps.appendCompletedTurn(userModelMessage, [{ role: "assistant", content: assistantText }]);
|
|
1940
|
+
} else if (deps.session && userWriteAheadSeq != null) {
|
|
1941
|
+
// Phase A5 — Stream threw before producing assistant text. The
|
|
1942
|
+
// write-ahead user row is stuck at `status='pending'`. Mark it
|
|
1943
|
+
// errored so forensics + recovery can distinguish "in-flight"
|
|
1944
|
+
// from "crashed mid-flight".
|
|
1945
|
+
markMessageErrored(deps.session.id, userWriteAheadSeq);
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
// ROUTE-11: Fire routeFeedback for failed turns (error path).
|
|
1949
|
+
// Must come AFTER posttool calls. Fire-and-forget — no await.
|
|
1950
|
+
{
|
|
1951
|
+
const turnDuration = Date.now() - turnStartMs;
|
|
1952
|
+
if (taskHash) {
|
|
1953
|
+
const tier = taskTypeToTier(pilCtx.taskType);
|
|
1954
|
+
void routeFeedback(taskHash, tier, runtime.modelId, "fail", 0, turnDuration);
|
|
1955
|
+
}
|
|
1956
|
+
const storeHash = routerStore.getState().taskHash;
|
|
1957
|
+
if (storeHash) {
|
|
1958
|
+
reportRouteOutcome(storeHash, "fail", turnDuration);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
const stopFailureInput: StopFailureHookInput = {
|
|
1963
|
+
hook_event_name: "StopFailure",
|
|
1964
|
+
error: friendly,
|
|
1965
|
+
session_id: deps.session?.id,
|
|
1966
|
+
cwd: deps.bash.getCwd(),
|
|
1967
|
+
};
|
|
1968
|
+
await deps.fireHook(stopFailureInput, signal).catch(() => {});
|
|
1969
|
+
|
|
1970
|
+
if (modelInfo?.contextWindow) {
|
|
1971
|
+
await deps.postTurnCompact(provider, system, modelInfo.contextWindow, signal);
|
|
1972
|
+
}
|
|
1973
|
+
yield { type: "done" };
|
|
1974
|
+
return;
|
|
1975
|
+
} finally {
|
|
1976
|
+
await closeMcp?.().catch(() => {});
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
} finally {
|
|
1980
|
+
if (deps.getAbortController()?.signal === signal) {
|
|
1981
|
+
deps.setAbortController(null);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|