muonroi-cli 1.2.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +30 -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,2173 @@
|
|
|
1
|
+
// Multi-provider wired — runtime dispatch via providers/runtime.ts.
|
|
2
|
+
import { extractSession } from "../ee/extract-session.js";
|
|
3
|
+
import { bootstrapEEClient, getDefaultEEClient, getLastSurfacedState } from "../ee/intercept.js";
|
|
4
|
+
import { getTenantId } from "../ee/tenant.js";
|
|
5
|
+
import { createRun, getActiveRunId, setActiveRunId } from "../flow/run-manager.js";
|
|
6
|
+
import { ensureFlowDir } from "../flow/scaffold.js";
|
|
7
|
+
import { executeEventHooks } from "../hooks/index.js";
|
|
8
|
+
import { shutdownWorkspaceLspManager } from "../lsp/runtime.js";
|
|
9
|
+
import { ensureDefaultMcpServers } from "../mcp/auto-setup.js";
|
|
10
|
+
import { getModelByTier, getModelInfo, normalizeModelId } from "../models/registry.js";
|
|
11
|
+
import { getProviderCapabilities } from "../providers/capabilities.js";
|
|
12
|
+
import { apiBaseFor } from "../providers/endpoints.js";
|
|
13
|
+
import { loadKeyForProvider } from "../providers/keychain.js";
|
|
14
|
+
import { createProviderFactory, createProviderFactoryAsync, detectProviderForModel, resolveModelRuntime as resolveRuntime, } from "../providers/runtime.js";
|
|
15
|
+
import { appendCompaction, appendMessages, appendSystemMessage, buildChatEntries, getNextMessageSequence, getSessionTotalTokens, loadTranscript, loadTranscriptState, logInteraction, markMessageCompleted, recordUsageEvent, SessionStore, } from "../storage/index.js";
|
|
16
|
+
import { BashTool } from "../tools/bash.js";
|
|
17
|
+
import { createBuiltinTools } from "../tools/registry.js";
|
|
18
|
+
import { ScheduleManager } from "../tools/schedule.js";
|
|
19
|
+
import { statusBarStore } from "../ui/status-bar/store.js";
|
|
20
|
+
import { appendCostLog } from "../usage/cost-log.js";
|
|
21
|
+
import { appendDecisionLog } from "../usage/decision-log.js";
|
|
22
|
+
import { projectCostUSD } from "../usage/estimator.js";
|
|
23
|
+
import { getAutoCompactThresholdPct, getCouncilRounds, getCurrentModel, getCurrentShellSettings, getModeSpecificModel, getRoleModel, getRoleModels, isAutoCompactAfterTurnEnabled, isCouncilMultiProviderPreferred, isProviderDisabled, } from "../utils/settings.js";
|
|
24
|
+
import { runSideQuestion } from "../utils/side-question.js";
|
|
25
|
+
import { buildVerifyDetectPrompt, normalizeVerifyRecipe } from "../verify/entrypoint.js";
|
|
26
|
+
import { runVerifyOrchestration } from "../verify/orchestrator.js";
|
|
27
|
+
import { COUNCIL_COLOR_BG, COUNCIL_COLOR_RESET, COUNCIL_ROLE_COLORS, } from "./agent-options.js";
|
|
28
|
+
import { BatchTurnRunner } from "./batch-turn-runner.js";
|
|
29
|
+
import { accumulateUsage, buildAssistantBatchMessage, buildBatchChatCompletionRequest, buildBatchName, buildToolBatchMessage, extractJsonObject, getBatchUsage, hasUsage, parseToolArgumentsOrRaw, toLocalToolCall, } from "./batch-utils.js";
|
|
30
|
+
import { createCompactionSummaryMessage, DEFAULT_KEEP_RECENT_TOKENS, DEFAULT_RESERVE_TOKENS, estimateConversationTokens, extractUserContent, generateCompactionSummary, POST_TURN_MIN_TOKENS, prepareCompaction, shouldCompactContext, } from "./compaction.js";
|
|
31
|
+
import { CouncilManager } from "./council-manager.js";
|
|
32
|
+
import { CrossTurnDedup, isCrossTurnDedupEnabled } from "./cross-turn-dedup.js";
|
|
33
|
+
import { DelegationManager } from "./delegations.js";
|
|
34
|
+
import { loadFlowResumeDigest } from "./flow-resume.js";
|
|
35
|
+
import { MessageProcessor } from "./message-processor.js";
|
|
36
|
+
import { lastPersistedSeq } from "./message-seq.js";
|
|
37
|
+
import { buildSystemPrompt, MAX_TOOL_ROUNDS } from "./prompts.js";
|
|
38
|
+
import { getReadPathBudgetCap, ReadPathBudget } from "./read-path-budget.js";
|
|
39
|
+
import { withStreamRetry } from "./retry-stream.js";
|
|
40
|
+
import { StreamRunner } from "./stream-runner.js";
|
|
41
|
+
import { setProviderHint } from "./token-counter.js";
|
|
42
|
+
import { firstLine, formatSubagentActivity, toToolResult } from "./tool-utils.js";
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Provider implementations
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* Create a provider factory for the given provider ID using the shared runtime module.
|
|
48
|
+
*/
|
|
49
|
+
function createProvider(providerId, apiKey, baseURL) {
|
|
50
|
+
return createProviderFactory(providerId, { apiKey, baseURL }).factory;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Generate a session title using the Anthropic provider.
|
|
54
|
+
* Kept as a lightweight stub for Phase 0 — title generation ships in Phase 1.
|
|
55
|
+
*/
|
|
56
|
+
function genTitle(_provider, userMessage) {
|
|
57
|
+
// Phase 0 stub: return a truncated version of the first user message as title.
|
|
58
|
+
// Phase 1 will replace this with a real LLM-based title generation call.
|
|
59
|
+
const title = userMessage.slice(0, 60).trim() || "New session";
|
|
60
|
+
return Promise.resolve({ title, modelId: DEFAULT_MODEL });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a model ID to a runnable AI SDK LanguageModel.
|
|
64
|
+
* Uses the Anthropic provider factory created by createProvider().
|
|
65
|
+
*/
|
|
66
|
+
function resolveModelRuntime(provider, modelId) {
|
|
67
|
+
return resolveRuntime(provider, modelId);
|
|
68
|
+
}
|
|
69
|
+
const DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
70
|
+
async function toolSetToBatchTools(_tools) {
|
|
71
|
+
// Batch API not supported with Anthropic in Phase 0. Phase 1 may add this.
|
|
72
|
+
throw new Error("Batch API not available in Phase 0. Use standard streaming mode.");
|
|
73
|
+
}
|
|
74
|
+
async function createBatch(_opts) {
|
|
75
|
+
throw new Error("Batch API not available in Phase 0. Use standard streaming mode.");
|
|
76
|
+
}
|
|
77
|
+
async function addBatchRequests(_opts) {
|
|
78
|
+
throw new Error("Batch API not available in Phase 0. Use standard streaming mode.");
|
|
79
|
+
}
|
|
80
|
+
async function pollBatchRequestResult(_opts) {
|
|
81
|
+
throw new Error("Batch API not available in Phase 0. Use standard streaming mode.");
|
|
82
|
+
}
|
|
83
|
+
function getBatchChatCompletion(_result) {
|
|
84
|
+
throw new Error("Batch API not available in Phase 0. Use standard streaming mode.");
|
|
85
|
+
}
|
|
86
|
+
function createTools(_bash, _provider, _mode, _opts) {
|
|
87
|
+
return createBuiltinTools(_bash, (_mode ?? "agent"), {
|
|
88
|
+
runTask: _opts?.runTask,
|
|
89
|
+
runDelegation: _opts?.runDelegation,
|
|
90
|
+
readDelegation: _opts?.readDelegation,
|
|
91
|
+
listDelegations: _opts?.listDelegations,
|
|
92
|
+
modelId: _opts?.modelId,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// END Plan 00-05 provider implementations
|
|
97
|
+
// (Phase 12.3 — `buildVisionUserMessages` was inlined into StreamRunner;
|
|
98
|
+
// vision is an anti-feature per PROJECT.md Out-of-Scope so the helper is gone.)
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// Agent class — fields, constructor, session management, core processing loop
|
|
102
|
+
// ============================================================================
|
|
103
|
+
export class Agent {
|
|
104
|
+
provider = null;
|
|
105
|
+
providerId = "anthropic";
|
|
106
|
+
apiKey = null;
|
|
107
|
+
baseURL = null;
|
|
108
|
+
bash;
|
|
109
|
+
delegations;
|
|
110
|
+
schedules;
|
|
111
|
+
sessionStore = null;
|
|
112
|
+
workspace = null;
|
|
113
|
+
session = null;
|
|
114
|
+
messages = [];
|
|
115
|
+
messageSeqs = [];
|
|
116
|
+
abortController = null;
|
|
117
|
+
maxToolRounds;
|
|
118
|
+
mode = "agent";
|
|
119
|
+
modelId;
|
|
120
|
+
maxTokens;
|
|
121
|
+
planContext = null;
|
|
122
|
+
subagentStatusListeners = new Set();
|
|
123
|
+
sendTelegramFile = null;
|
|
124
|
+
batchApi = false;
|
|
125
|
+
sessionStartHookFired = false;
|
|
126
|
+
/** PIL context for current turn — set after runPipeline, cleared after recordUsage. */
|
|
127
|
+
_pilActive = false;
|
|
128
|
+
_pilEnrichmentDelta = 0;
|
|
129
|
+
/**
|
|
130
|
+
* Breakdown of the system prompt + messages + tools sent on the last call.
|
|
131
|
+
* Captured immediately before streamText and consumed by recordUsage to
|
|
132
|
+
* attach to the cost-log entry. Cleared after recordUsage so subsequent
|
|
133
|
+
* non-message calls don't reuse stale data.
|
|
134
|
+
*/
|
|
135
|
+
_lastPromptBreakdown = null;
|
|
136
|
+
/**
|
|
137
|
+
* Phase O1 — JSON-shape of the providerOptions object on the most
|
|
138
|
+
* recent streamText call. Captured immediately before streamText and
|
|
139
|
+
* consumed by recordUsage; cleared after. Cost-leak forensics surfaces
|
|
140
|
+
* this so we can answer "did this billed call carry store=true?" etc.
|
|
141
|
+
*/
|
|
142
|
+
_lastProviderOptionsShape = null;
|
|
143
|
+
/** External abort context from src/index.ts SIGINT handler (TUI-04). */
|
|
144
|
+
externalAbortContext = null;
|
|
145
|
+
/** Pending calls log for Pitfall 9 staged-write tracking. */
|
|
146
|
+
pendingCalls = null;
|
|
147
|
+
/** Active permission mode — controls which tool calls auto-approve vs require user confirmation. */
|
|
148
|
+
permissionMode = "safe";
|
|
149
|
+
/** Flow run init promise — awaited before first message turn. */
|
|
150
|
+
_flowReady = null;
|
|
151
|
+
/** Active .muonroi-flow/ run ID for this session. */
|
|
152
|
+
_activeRunId = null;
|
|
153
|
+
/** Resume digest loaded from active flow run state.md. */
|
|
154
|
+
_resumeDigest = null;
|
|
155
|
+
/**
|
|
156
|
+
* Phase 12.1-02: All council state (synthesis/continuation flags, resolver
|
|
157
|
+
* + buffer maps, stats) lives inside CouncilManager. Agent holds one ref.
|
|
158
|
+
*/
|
|
159
|
+
councilManager;
|
|
160
|
+
/** Whether compaction already ran during the current turn (prevents double-compact). */
|
|
161
|
+
_compactedThisTurn = false;
|
|
162
|
+
/** Guard: OAuth provider init runs at most once per Agent instance. */
|
|
163
|
+
_oauthInitDone = false;
|
|
164
|
+
/** P0 native observation: warning IDs surfaced earlier in this session — sent as intent_context.priorWarningIdsInSession. */
|
|
165
|
+
_priorWarningIdsInSession = new Set();
|
|
166
|
+
/** EE session guidance: structured warnings accumulated across turns — injected into model context at turn start. Keyed by principle_uuid to deduplicate. */
|
|
167
|
+
_sessionEEGuidance = new Map();
|
|
168
|
+
/** P0 native observation: rolling buffer of assistant reasoning text in current turn — last 200 chars sent as intent_context.assistantReasoningExcerpt. */
|
|
169
|
+
_turnAssistantReasoning = "";
|
|
170
|
+
/** Per-call correlation id for top-level streamText; set in MessageProcessor, consumed by recordUsage / onFinish llm-done. */
|
|
171
|
+
_currentCallId = "";
|
|
172
|
+
/** P0 native observation: first 200 chars of the user's current turn — sent as intent_context.userGoalExcerpt to PreToolUse. */
|
|
173
|
+
_turnUserGoalExcerpt = "";
|
|
174
|
+
/** Compaction statistics tracking count and total tokens saved. */
|
|
175
|
+
_compactionStats = { count: 0, totalSaved: 0 };
|
|
176
|
+
/**
|
|
177
|
+
* Pinned message sequences. A pinned user message is preserved verbatim across
|
|
178
|
+
* compaction — it is re-injected as a system note immediately after the
|
|
179
|
+
* compaction summary, so the model still sees the original wording.
|
|
180
|
+
* V1 only supports user messages (avoids splitting tool-call/result pairs).
|
|
181
|
+
*/
|
|
182
|
+
_pinnedSeqs = new Set();
|
|
183
|
+
/** One-shot cwd note injected at the start of the next processMessage turn after setCwd(). Cleared after injection. */
|
|
184
|
+
_pendingCwdNote = null;
|
|
185
|
+
// Phase C3: cross-turn tool-output dedup. One instance per session; bumped
|
|
186
|
+
// on each user turn. Lazily initialized so disabled-via-env path stays cheap.
|
|
187
|
+
_crossTurnDedup = isCrossTurnDedupEnabled() ? new CrossTurnDedup() : null;
|
|
188
|
+
// Phase C4 — input-keyed read-path budget. Complements C3 (output hash) by
|
|
189
|
+
// catching re-reads of files the agent edited between rounds. Disabled
|
|
190
|
+
// when MUONROI_MAX_READS_PER_PATH=0.
|
|
191
|
+
_readBudget = (() => {
|
|
192
|
+
const cap = getReadPathBudgetCap();
|
|
193
|
+
return cap > 0 ? new ReadPathBudget(cap) : null;
|
|
194
|
+
})();
|
|
195
|
+
constructor(apiKey, baseURL, model, maxToolRounds, options = {}) {
|
|
196
|
+
this.baseURL = baseURL || null;
|
|
197
|
+
this.bash = new BashTool(process.cwd(), {
|
|
198
|
+
sandboxMode: options.sandboxMode ?? "off",
|
|
199
|
+
sandboxSettings: options.sandboxSettings,
|
|
200
|
+
shellSettings: options.shellSettings ?? getCurrentShellSettings(),
|
|
201
|
+
});
|
|
202
|
+
this.delegations = new DelegationManager(() => this.bash.getCwd());
|
|
203
|
+
// Phase 12.1-02: council state + helpers live in CouncilManager. DI via
|
|
204
|
+
// getter callbacks so the manager reads live Agent state without holding
|
|
205
|
+
// a circular reference to the Agent instance.
|
|
206
|
+
this.councilManager = new CouncilManager({
|
|
207
|
+
getModelId: () => this.modelId,
|
|
208
|
+
getSessionId: () => this.session?.id ?? null,
|
|
209
|
+
hasSessionStore: () => this.sessionStore !== null,
|
|
210
|
+
getMessages: () => this.messages,
|
|
211
|
+
getBash: () => this.bash,
|
|
212
|
+
getMode: () => this.mode,
|
|
213
|
+
});
|
|
214
|
+
const initialMode = "agent";
|
|
215
|
+
this.modelId = normalizeModelId(model || getCurrentModel(initialMode));
|
|
216
|
+
this.providerId = detectProviderForModel(this.modelId);
|
|
217
|
+
setProviderHint(this.providerId);
|
|
218
|
+
if (apiKey) {
|
|
219
|
+
this.setApiKey(apiKey, baseURL);
|
|
220
|
+
}
|
|
221
|
+
this.schedules = new ScheduleManager(() => this.bash.getCwd(), () => this.modelId);
|
|
222
|
+
this.maxToolRounds = maxToolRounds || MAX_TOOL_ROUNDS;
|
|
223
|
+
const envMax = Number(process.env.MUONROI_MAX_TOKENS);
|
|
224
|
+
this.maxTokens = Number.isFinite(envMax) && envMax > 0 ? envMax : 16_384;
|
|
225
|
+
this.batchApi = options.batchApi ?? false;
|
|
226
|
+
// TUI-04: wire external abort context and pending calls log if provided.
|
|
227
|
+
this.externalAbortContext = options.abortContext ?? null;
|
|
228
|
+
this.pendingCalls = options.pendingCalls ?? null;
|
|
229
|
+
this.permissionMode = options.permissionMode ?? "safe";
|
|
230
|
+
ensureDefaultMcpServers();
|
|
231
|
+
if (options.persistSession !== false) {
|
|
232
|
+
this.sessionStore = new SessionStore(this.bash.getCwd());
|
|
233
|
+
this.workspace = this.sessionStore.getWorkspace();
|
|
234
|
+
this.session = this.sessionStore.openSession(options.session, this.modelId, this.mode, this.bash.getCwd());
|
|
235
|
+
this.mode = this.session.mode;
|
|
236
|
+
const transcript = loadTranscriptState(this.session.id);
|
|
237
|
+
this.messages = transcript.messages;
|
|
238
|
+
this.messageSeqs = transcript.seqs;
|
|
239
|
+
this.sessionStore.setModel(this.session.id, this.modelId);
|
|
240
|
+
// Flow run setup — fire-and-forget, awaited before first message turn.
|
|
241
|
+
this._flowReady = this._initFlow();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Initialize .muonroi-flow/ run for this session.
|
|
246
|
+
* Fail-open: any error sets _activeRunId = null silently.
|
|
247
|
+
*/
|
|
248
|
+
async _initFlow() {
|
|
249
|
+
await bootstrapEEClient().catch(() => { });
|
|
250
|
+
try {
|
|
251
|
+
const flowDir = await ensureFlowDir(this.bash.getCwd());
|
|
252
|
+
const existing = await getActiveRunId(flowDir);
|
|
253
|
+
if (existing) {
|
|
254
|
+
this._activeRunId = existing;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const run = await createRun(flowDir);
|
|
258
|
+
await setActiveRunId(flowDir, run.id);
|
|
259
|
+
this._activeRunId = run.id;
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
this._activeRunId = null;
|
|
263
|
+
}
|
|
264
|
+
// Load resume digest for PIL context injection (fail-open).
|
|
265
|
+
try {
|
|
266
|
+
this._resumeDigest = await loadFlowResumeDigest(this.bash.getCwd());
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
this._resumeDigest = null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
getModel() {
|
|
273
|
+
return this.modelId;
|
|
274
|
+
}
|
|
275
|
+
getActiveRunId() {
|
|
276
|
+
return this._activeRunId;
|
|
277
|
+
}
|
|
278
|
+
setModel(model) {
|
|
279
|
+
this.modelId = normalizeModelId(model);
|
|
280
|
+
const newProviderId = detectProviderForModel(this.modelId);
|
|
281
|
+
if (newProviderId !== this.providerId && this.apiKey) {
|
|
282
|
+
this.providerId = newProviderId;
|
|
283
|
+
setProviderHint(this.providerId);
|
|
284
|
+
const effectiveBaseURL = this.providerId !== "anthropic" && this.baseURL === apiBaseFor("anthropic")
|
|
285
|
+
? undefined
|
|
286
|
+
: (this.baseURL ?? undefined);
|
|
287
|
+
this.provider = createProvider(this.providerId, this.apiKey, effectiveBaseURL);
|
|
288
|
+
}
|
|
289
|
+
if (this.sessionStore && this.session) {
|
|
290
|
+
this.sessionStore.setModel(this.session.id, this.modelId);
|
|
291
|
+
this.session = this.sessionStore.getRequiredSession(this.session.id);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
getMode() {
|
|
295
|
+
return this.mode;
|
|
296
|
+
}
|
|
297
|
+
getSandboxMode() {
|
|
298
|
+
return this.bash.getSandboxMode();
|
|
299
|
+
}
|
|
300
|
+
setSandboxMode(mode) {
|
|
301
|
+
this.bash.setSandboxMode(mode);
|
|
302
|
+
}
|
|
303
|
+
getSandboxSettings() {
|
|
304
|
+
return this.bash.getSandboxSettings();
|
|
305
|
+
}
|
|
306
|
+
setSandboxSettings(settings) {
|
|
307
|
+
this.bash.setSandboxSettings(settings);
|
|
308
|
+
}
|
|
309
|
+
setMode(mode) {
|
|
310
|
+
if (mode !== this.mode) {
|
|
311
|
+
this.mode = mode;
|
|
312
|
+
const modeModel = getModeSpecificModel(mode);
|
|
313
|
+
if (modeModel) {
|
|
314
|
+
this.modelId = normalizeModelId(modeModel);
|
|
315
|
+
}
|
|
316
|
+
if (this.sessionStore && this.session) {
|
|
317
|
+
this.sessionStore.setMode(this.session.id, mode);
|
|
318
|
+
this.sessionStore.setModel(this.session.id, this.modelId);
|
|
319
|
+
this.session = this.sessionStore.getRequiredSession(this.session.id);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
setPlanContext(ctx) {
|
|
324
|
+
this.planContext = ctx;
|
|
325
|
+
}
|
|
326
|
+
setSendTelegramFile(fn) {
|
|
327
|
+
this.sendTelegramFile = fn;
|
|
328
|
+
}
|
|
329
|
+
hasApiKey() {
|
|
330
|
+
return !!this.apiKey;
|
|
331
|
+
}
|
|
332
|
+
setApiKey(apiKey, baseURL) {
|
|
333
|
+
this.apiKey = apiKey;
|
|
334
|
+
this.baseURL = baseURL || null;
|
|
335
|
+
// Only pass baseURL to provider factory if it's an explicit override,
|
|
336
|
+
// not the default Anthropic URL (which would break non-Anthropic providers).
|
|
337
|
+
const effectiveBaseURL = this.providerId !== "anthropic" && baseURL === apiBaseFor("anthropic") ? undefined : baseURL;
|
|
338
|
+
this.provider = createProvider(this.providerId, apiKey, effectiveBaseURL);
|
|
339
|
+
}
|
|
340
|
+
setProviderAndKey(providerId, apiKey, baseURL) {
|
|
341
|
+
this.providerId = providerId;
|
|
342
|
+
setProviderHint(this.providerId);
|
|
343
|
+
this.setApiKey(apiKey, baseURL);
|
|
344
|
+
}
|
|
345
|
+
getProviderId() {
|
|
346
|
+
return this.providerId;
|
|
347
|
+
}
|
|
348
|
+
getCwd() {
|
|
349
|
+
return this.bash.getCwd();
|
|
350
|
+
}
|
|
351
|
+
setCwd(dir) {
|
|
352
|
+
this.bash.setCwd(dir);
|
|
353
|
+
this._pendingCwdNote = `(system: working directory has been changed to ${dir} — subsequent shell commands run from there; do NOT cd to that path again)`;
|
|
354
|
+
}
|
|
355
|
+
getMessages() {
|
|
356
|
+
return this.messages;
|
|
357
|
+
}
|
|
358
|
+
async listSchedules() {
|
|
359
|
+
return this.schedules.list();
|
|
360
|
+
}
|
|
361
|
+
async removeSchedule(id) {
|
|
362
|
+
const removed = await this.schedules.remove(id);
|
|
363
|
+
return removed ? `Removed schedule "${removed.name}".` : `Schedule "${id}" not found.`;
|
|
364
|
+
}
|
|
365
|
+
async getScheduleDaemonStatus() {
|
|
366
|
+
return this.schedules.getDaemonStatus();
|
|
367
|
+
}
|
|
368
|
+
getContextStats(contextWindow, inFlightText = "") {
|
|
369
|
+
const system = buildSystemPrompt(this.bash.getCwd(), this.mode, this.bash.getSandboxMode(), this.planContext, undefined, this.bash.getSandboxSettings(), this.providerId);
|
|
370
|
+
const usedTokens = Math.min(contextWindow, estimateConversationTokens(system, this.messages, inFlightText));
|
|
371
|
+
const remainingTokens = Math.max(0, contextWindow - usedTokens);
|
|
372
|
+
return {
|
|
373
|
+
contextWindow,
|
|
374
|
+
usedTokens,
|
|
375
|
+
remainingTokens,
|
|
376
|
+
ratioUsed: usedTokens / contextWindow,
|
|
377
|
+
ratioRemaining: remainingTokens / contextWindow,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
async generateTitle(userMessage) {
|
|
381
|
+
const provider = this.provider;
|
|
382
|
+
if (!provider) {
|
|
383
|
+
return "New session";
|
|
384
|
+
}
|
|
385
|
+
const generated = await genTitle(provider, userMessage);
|
|
386
|
+
this.recordUsage(generated.usage, "title", generated.modelId);
|
|
387
|
+
if (this.sessionStore && this.session && !this.session.title && generated.title) {
|
|
388
|
+
this.sessionStore.setTitle(this.session.id, generated.title);
|
|
389
|
+
this.session = this.sessionStore.getRequiredSession(this.session.id);
|
|
390
|
+
}
|
|
391
|
+
return generated.title;
|
|
392
|
+
}
|
|
393
|
+
async askSideQuestion(question, signal) {
|
|
394
|
+
if (!this.provider) {
|
|
395
|
+
return { response: "No API key configured." };
|
|
396
|
+
}
|
|
397
|
+
const contextParts = [];
|
|
398
|
+
let charBudget = 2000;
|
|
399
|
+
for (let i = this.messages.length - 1; i >= 0 && charBudget > 0; i--) {
|
|
400
|
+
const msg = this.messages[i];
|
|
401
|
+
if (msg.role !== "user" && msg.role !== "assistant")
|
|
402
|
+
continue;
|
|
403
|
+
const text = typeof msg.content === "string"
|
|
404
|
+
? msg.content
|
|
405
|
+
: Array.isArray(msg.content)
|
|
406
|
+
? msg.content
|
|
407
|
+
.filter((p) => p.type === "text")
|
|
408
|
+
.map((p) => p.text ?? "")
|
|
409
|
+
.join("")
|
|
410
|
+
: "";
|
|
411
|
+
if (!text)
|
|
412
|
+
continue;
|
|
413
|
+
const snippet = text.length > 400 ? `${text.slice(0, 400)}…` : text;
|
|
414
|
+
contextParts.unshift(`[${msg.role}]: ${snippet}`);
|
|
415
|
+
charBudget -= snippet.length;
|
|
416
|
+
}
|
|
417
|
+
const conversationContext = contextParts.join("\n\n");
|
|
418
|
+
const result = await runSideQuestion(question, this.provider, this.modelId, conversationContext, signal);
|
|
419
|
+
this.recordUsage(result.usage, "other");
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
abort() {
|
|
423
|
+
this.abortController?.abort();
|
|
424
|
+
this.emitSubagentStatus(null);
|
|
425
|
+
}
|
|
426
|
+
async cleanup() {
|
|
427
|
+
await Promise.allSettled([
|
|
428
|
+
this.bash.cleanup(),
|
|
429
|
+
shutdownWorkspaceLspManager(this.bash.getCwd()),
|
|
430
|
+
extractSession(this.messages, this.bash.getCwd(), "cli-exit", this.getSessionId()),
|
|
431
|
+
]);
|
|
432
|
+
}
|
|
433
|
+
respondToToolApproval(approvalId, approved) {
|
|
434
|
+
const toolApprovalResponse = {
|
|
435
|
+
role: "tool",
|
|
436
|
+
content: [
|
|
437
|
+
{
|
|
438
|
+
type: "tool-approval-response",
|
|
439
|
+
approvalId,
|
|
440
|
+
approved,
|
|
441
|
+
},
|
|
442
|
+
],
|
|
443
|
+
};
|
|
444
|
+
this.messages.push(toolApprovalResponse);
|
|
445
|
+
this.messageSeqs.push(null);
|
|
446
|
+
}
|
|
447
|
+
async clearHistory() {
|
|
448
|
+
// D-09: Extract messages accumulated since last clear BEFORE reset
|
|
449
|
+
await extractSession(this.messages, this.bash.getCwd(), "cli-clear", this.getSessionId()).catch(() => { }); // D-05: redundant safety — extractSession already swallows
|
|
450
|
+
this.startNewSession();
|
|
451
|
+
}
|
|
452
|
+
startNewSession() {
|
|
453
|
+
if (this.sessionStartHookFired) {
|
|
454
|
+
const endInput = {
|
|
455
|
+
hook_event_name: "SessionEnd",
|
|
456
|
+
session_id: this.session?.id,
|
|
457
|
+
cwd: this.bash.getCwd(),
|
|
458
|
+
};
|
|
459
|
+
this.fireHook(endInput).catch(() => { });
|
|
460
|
+
this.sessionStartHookFired = false;
|
|
461
|
+
}
|
|
462
|
+
// Reset token counters, cost, and compaction state for the new session
|
|
463
|
+
statusBarStore.setState({
|
|
464
|
+
in_tokens: 0,
|
|
465
|
+
out_tokens: 0,
|
|
466
|
+
cache_read_tokens: 0,
|
|
467
|
+
cache_creation_tokens: 0,
|
|
468
|
+
session_usd: 0,
|
|
469
|
+
ctx_tokens: 0,
|
|
470
|
+
compaction_summary: undefined,
|
|
471
|
+
});
|
|
472
|
+
this._compactionStats = { count: 0, totalSaved: 0 };
|
|
473
|
+
this._pinnedSeqs.clear();
|
|
474
|
+
if (!this.sessionStore) {
|
|
475
|
+
this.messages = [];
|
|
476
|
+
this.messageSeqs = [];
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
this.sessionStore = new SessionStore(this.bash.getCwd());
|
|
480
|
+
this.workspace = this.sessionStore.getWorkspace();
|
|
481
|
+
this.session = this.sessionStore.createSession(this.modelId, this.mode, this.bash.getCwd());
|
|
482
|
+
this.messages = [];
|
|
483
|
+
this.messageSeqs = [];
|
|
484
|
+
return this.getSessionSnapshot();
|
|
485
|
+
}
|
|
486
|
+
getSessionInfo() {
|
|
487
|
+
return this.session;
|
|
488
|
+
}
|
|
489
|
+
getSessionId() {
|
|
490
|
+
return this.session?.id || null;
|
|
491
|
+
}
|
|
492
|
+
getSessionTitle() {
|
|
493
|
+
return this.session?.title || null;
|
|
494
|
+
}
|
|
495
|
+
getCompactionStats() {
|
|
496
|
+
return { ...this._compactionStats };
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Pin a user message by its sequence number. Pinned messages survive
|
|
500
|
+
* compaction verbatim — re-injected as a system note after the summary.
|
|
501
|
+
* Returns true if the message was found, is a user message, and got pinned.
|
|
502
|
+
*/
|
|
503
|
+
pinMessageBySeq(seq) {
|
|
504
|
+
const idx = this.messageSeqs.indexOf(seq);
|
|
505
|
+
if (idx < 0)
|
|
506
|
+
return false;
|
|
507
|
+
if (this.messages[idx]?.role !== "user")
|
|
508
|
+
return false;
|
|
509
|
+
this._pinnedSeqs.add(seq);
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
/** Pin the most recent user message in the live conversation. Returns its seq, or null. */
|
|
513
|
+
pinLastUserMessage() {
|
|
514
|
+
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
515
|
+
if (this.messages[i]?.role !== "user")
|
|
516
|
+
continue;
|
|
517
|
+
const seq = this.messageSeqs[i];
|
|
518
|
+
if (typeof seq === "number") {
|
|
519
|
+
this._pinnedSeqs.add(seq);
|
|
520
|
+
return seq;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
unpinMessageBySeq(seq) {
|
|
526
|
+
return this._pinnedSeqs.delete(seq);
|
|
527
|
+
}
|
|
528
|
+
getPinnedSeqs() {
|
|
529
|
+
return [...this._pinnedSeqs].sort((a, b) => a - b);
|
|
530
|
+
}
|
|
531
|
+
getChatEntries() {
|
|
532
|
+
if (!this.session)
|
|
533
|
+
return [];
|
|
534
|
+
return buildChatEntries(this.session.id);
|
|
535
|
+
}
|
|
536
|
+
getSessionSnapshot() {
|
|
537
|
+
if (!this.session || !this.workspace)
|
|
538
|
+
return null;
|
|
539
|
+
return {
|
|
540
|
+
workspace: this.workspace,
|
|
541
|
+
session: this.session,
|
|
542
|
+
messages: loadTranscript(this.session.id),
|
|
543
|
+
entries: buildChatEntries(this.session.id),
|
|
544
|
+
totalTokens: getSessionTotalTokens(this.session.id),
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
onSubagentStatus(listener) {
|
|
548
|
+
this.subagentStatusListeners.add(listener);
|
|
549
|
+
return () => {
|
|
550
|
+
this.subagentStatusListeners.delete(listener);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
emitSubagentStatus(status) {
|
|
554
|
+
for (const listener of this.subagentStatusListeners) {
|
|
555
|
+
listener(status);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
discardAbortedTurn(userMessage) {
|
|
559
|
+
const idx = this.messages.lastIndexOf(userMessage);
|
|
560
|
+
if (idx >= 0) {
|
|
561
|
+
// Keep the user message but add a stub assistant response so the
|
|
562
|
+
// conversation remains valid for follow-up messages after ESC.
|
|
563
|
+
const alreadyHasResponse = idx < this.messages.length - 1 && this.messages[idx + 1]?.role === "assistant";
|
|
564
|
+
if (!alreadyHasResponse) {
|
|
565
|
+
this.messages.splice(idx + 1, 0, { role: "assistant", content: "[Interrupted]" });
|
|
566
|
+
this.messageSeqs.splice(idx + 1, 0, null);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
recordUsage(usage, source = "message", model = this.modelId) {
|
|
571
|
+
if (!usage)
|
|
572
|
+
return;
|
|
573
|
+
if (this.session) {
|
|
574
|
+
const pilActive = source === "message" ? this._pilActive : false;
|
|
575
|
+
const enrichmentDelta = source === "message" ? this._pilEnrichmentDelta : 0;
|
|
576
|
+
// Attribute usage to the most recent persisted message — this lets
|
|
577
|
+
// per-prompt cost analysis work (was null hardcoded → impossible).
|
|
578
|
+
const lastSeq = lastPersistedSeq(this.messageSeqs);
|
|
579
|
+
// Phase O1 — providerOptions shape (types only, no values) attached
|
|
580
|
+
// to every usage event so post-mortem can answer "what provider
|
|
581
|
+
// options did this billed call carry?". Cleared below for "message"
|
|
582
|
+
// sources so non-message calls don't reuse stale data.
|
|
583
|
+
const providerOptionsShape = this._lastProviderOptionsShape;
|
|
584
|
+
recordUsageEvent(this.session.id, source, model, usage, lastSeq, pilActive, enrichmentDelta, providerOptionsShape);
|
|
585
|
+
if (source === "message") {
|
|
586
|
+
this._pilActive = false;
|
|
587
|
+
this._pilEnrichmentDelta = 0;
|
|
588
|
+
this._lastProviderOptionsShape = null;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
// Phase D — surfaced for harness E2E verification. Mirror the recorded usage
|
|
592
|
+
// event onto the agent-mode sidechannel so spec processes can assert on
|
|
593
|
+
// cacheReadTokens / cacheCreationTokens normalization without poking at the
|
|
594
|
+
// child's sqlite. Best-effort, only fires when agent-mode runtime is set.
|
|
595
|
+
try {
|
|
596
|
+
const rt = globalThis.__muonroiAgentRuntime;
|
|
597
|
+
if (rt?.emitEvent) {
|
|
598
|
+
const lastSeqForEvent = this.session ? lastPersistedSeq(this.messageSeqs) : null;
|
|
599
|
+
rt.emitEvent({
|
|
600
|
+
t: "event",
|
|
601
|
+
kind: "usage",
|
|
602
|
+
source,
|
|
603
|
+
model,
|
|
604
|
+
inputTokens: usage.inputTokens,
|
|
605
|
+
outputTokens: usage.outputTokens,
|
|
606
|
+
cacheReadTokens: usage.cacheReadTokens,
|
|
607
|
+
cacheCreationTokens: usage.cacheCreationTokens,
|
|
608
|
+
messageSeq: lastSeqForEvent,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
catch {
|
|
613
|
+
// best-effort: do not let sidechannel failures interrupt usage recording
|
|
614
|
+
}
|
|
615
|
+
// Update status bar token counters + provider/model + cache metrics + cost
|
|
616
|
+
const prev = statusBarStore.getState();
|
|
617
|
+
const info = getModelInfo(model);
|
|
618
|
+
const totalInput = usage.inputTokens ?? 0;
|
|
619
|
+
const cacheRead = usage.cacheReadTokens ?? 0;
|
|
620
|
+
const cacheCreate = usage.cacheCreationTokens ?? 0;
|
|
621
|
+
const output = usage.outputTokens ?? 0;
|
|
622
|
+
const priceIn = info?.inputPrice ?? 0;
|
|
623
|
+
const priceCached = info?.cachedInputPrice ?? priceIn * 0.1;
|
|
624
|
+
const priceOut = info?.outputPrice ?? 0;
|
|
625
|
+
// API inputTokens includes cacheRead — subtract to get non-cached portion
|
|
626
|
+
const nonCachedInput = Math.max(0, totalInput - cacheRead - cacheCreate);
|
|
627
|
+
const turnCostMicros = nonCachedInput * priceIn + cacheRead * priceCached + cacheCreate * priceIn + output * priceOut;
|
|
628
|
+
statusBarStore.setState({
|
|
629
|
+
in_tokens: prev.in_tokens + totalInput,
|
|
630
|
+
out_tokens: prev.out_tokens + output,
|
|
631
|
+
cache_read_tokens: (prev.cache_read_tokens ?? 0) + cacheRead,
|
|
632
|
+
cache_creation_tokens: (prev.cache_creation_tokens ?? 0) + cacheCreate,
|
|
633
|
+
session_usd: prev.session_usd + turnCostMicros / 1_000_000,
|
|
634
|
+
provider: this.providerId,
|
|
635
|
+
model,
|
|
636
|
+
});
|
|
637
|
+
// Append to cost-log JSONL so `usage report --by callsite` can surface
|
|
638
|
+
// where orchestrator/task/title traffic is actually spending.
|
|
639
|
+
// Best-effort: failures inside appendCostLog are swallowed (see cost-log.ts).
|
|
640
|
+
const breakdown = source === "message" ? (this._lastPromptBreakdown ?? undefined) : undefined;
|
|
641
|
+
appendCostLog({
|
|
642
|
+
ts: Date.now(),
|
|
643
|
+
provider: this.providerId,
|
|
644
|
+
model,
|
|
645
|
+
estimatedUsd: turnCostMicros / 1_000_000,
|
|
646
|
+
callsite: `orchestrator.${source}`,
|
|
647
|
+
phase: source,
|
|
648
|
+
actualInputTokens: totalInput,
|
|
649
|
+
actualOutputTokens: output,
|
|
650
|
+
cachedInputTokens: cacheRead,
|
|
651
|
+
systemChars: breakdown?.systemChars,
|
|
652
|
+
promptChars: breakdown?.messagesChars,
|
|
653
|
+
breakdown,
|
|
654
|
+
}).catch(() => undefined);
|
|
655
|
+
// Don't clear breakdown — onStepFinish fires recordUsage per step within
|
|
656
|
+
// the same streamText call, and they all share the same prompt structure.
|
|
657
|
+
// It is overwritten on the next streamText setup, which is the right scope.
|
|
658
|
+
}
|
|
659
|
+
async consumeBackgroundNotifications() {
|
|
660
|
+
try {
|
|
661
|
+
const notifications = await this.delegations.consumeNotifications();
|
|
662
|
+
for (const notification of notifications) {
|
|
663
|
+
this.messages.push({ role: "system", content: notification.message });
|
|
664
|
+
let seq = null;
|
|
665
|
+
if (this.session) {
|
|
666
|
+
seq = appendSystemMessage(this.session.id, notification.message);
|
|
667
|
+
}
|
|
668
|
+
this.messageSeqs.push(seq);
|
|
669
|
+
const notifInput = {
|
|
670
|
+
hook_event_name: "Notification",
|
|
671
|
+
message: notification.message,
|
|
672
|
+
session_id: this.session?.id,
|
|
673
|
+
cwd: this.bash.getCwd(),
|
|
674
|
+
};
|
|
675
|
+
this.fireHook(notifInput).catch(() => { });
|
|
676
|
+
}
|
|
677
|
+
return notifications.map((notification) => notification.message);
|
|
678
|
+
}
|
|
679
|
+
catch {
|
|
680
|
+
return [];
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
getBatchClientOptions(signal) {
|
|
684
|
+
if (!this.apiKey) {
|
|
685
|
+
throw new Error("API key required. Add an API key to continue.");
|
|
686
|
+
}
|
|
687
|
+
return {
|
|
688
|
+
apiKey: this.apiKey,
|
|
689
|
+
baseURL: this.baseURL ?? undefined,
|
|
690
|
+
signal,
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
async executeBatchToolCall(tools, toolCall, messages, signal) {
|
|
694
|
+
const tool = tools[toolCall.function.name];
|
|
695
|
+
if (!tool || tool.type === "provider" || typeof tool.execute !== "function") {
|
|
696
|
+
return {
|
|
697
|
+
input: parseToolArgumentsOrRaw(toolCall.function.arguments),
|
|
698
|
+
result: {
|
|
699
|
+
success: false,
|
|
700
|
+
output: `Tool "${toolCall.function.name}" is unavailable in batch mode.`,
|
|
701
|
+
},
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
let parsedInput;
|
|
705
|
+
try {
|
|
706
|
+
parsedInput = toolCall.function.arguments.trim() ? JSON.parse(toolCall.function.arguments) : {};
|
|
707
|
+
}
|
|
708
|
+
catch (error) {
|
|
709
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
710
|
+
return {
|
|
711
|
+
input: toolCall.function.arguments,
|
|
712
|
+
result: {
|
|
713
|
+
success: false,
|
|
714
|
+
output: `Tool "${toolCall.function.name}" received invalid JSON arguments: ${message}`,
|
|
715
|
+
},
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
try {
|
|
719
|
+
const output = await tool.execute(parsedInput, {
|
|
720
|
+
toolCallId: toolCall.id,
|
|
721
|
+
messages,
|
|
722
|
+
abortSignal: signal,
|
|
723
|
+
});
|
|
724
|
+
return {
|
|
725
|
+
input: parsedInput,
|
|
726
|
+
result: toToolResult(output),
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
catch (error) {
|
|
730
|
+
if (signal?.aborted) {
|
|
731
|
+
throw error;
|
|
732
|
+
}
|
|
733
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
734
|
+
return {
|
|
735
|
+
input: parsedInput,
|
|
736
|
+
result: {
|
|
737
|
+
success: false,
|
|
738
|
+
output: `Tool "${toolCall.function.name}" failed: ${message}`,
|
|
739
|
+
},
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
async runTaskRequestBatch(args) {
|
|
744
|
+
const { request, childMessages, childSystem, childRuntime, childTools, maxSteps, initialDetail, onActivity, signal, } = args;
|
|
745
|
+
const childCaps = getProviderCapabilities(childRuntime.modelInfo?.provider ?? "anthropic");
|
|
746
|
+
if (childCaps.usesResponsesAPI(childRuntime.modelInfo)) {
|
|
747
|
+
throw new Error("Batch mode currently supports chat-completions models only.");
|
|
748
|
+
}
|
|
749
|
+
const batchTools = !childCaps.supportsClientTools(childRuntime.modelInfo)
|
|
750
|
+
? []
|
|
751
|
+
: await toolSetToBatchTools(childTools);
|
|
752
|
+
const batch = await createBatch({
|
|
753
|
+
...this.getBatchClientOptions(signal),
|
|
754
|
+
name: buildBatchName(`task-${request.agent}`, request.description),
|
|
755
|
+
});
|
|
756
|
+
const turnMessages = [];
|
|
757
|
+
const totalUsage = {};
|
|
758
|
+
let assistantText = "";
|
|
759
|
+
let lastActivity = initialDetail;
|
|
760
|
+
for (let round = 0; round < maxSteps; round++) {
|
|
761
|
+
const batchRequestId = `task-${Date.now()}-${round + 1}`;
|
|
762
|
+
await addBatchRequests({
|
|
763
|
+
...this.getBatchClientOptions(signal),
|
|
764
|
+
batchId: batch.batch_id,
|
|
765
|
+
batchRequests: [
|
|
766
|
+
{
|
|
767
|
+
batch_request_id: batchRequestId,
|
|
768
|
+
batch_request: {
|
|
769
|
+
chat_get_completion: buildBatchChatCompletionRequest({
|
|
770
|
+
modelId: childRuntime.modelId,
|
|
771
|
+
system: childSystem,
|
|
772
|
+
messages: [...childMessages, ...turnMessages],
|
|
773
|
+
temperature: request.agent === "explore" ? 0.2 : 0.5,
|
|
774
|
+
maxOutputTokens: !childCaps.acceptsParam("maxOutputTokens", childRuntime.modelInfo)
|
|
775
|
+
? undefined
|
|
776
|
+
: Math.min(this.maxTokens, 8_192),
|
|
777
|
+
reasoningEffort: childRuntime.providerOptions?.xai.reasoningEffort,
|
|
778
|
+
tools: batchTools,
|
|
779
|
+
}),
|
|
780
|
+
},
|
|
781
|
+
},
|
|
782
|
+
],
|
|
783
|
+
});
|
|
784
|
+
const result = await pollBatchRequestResult({
|
|
785
|
+
...this.getBatchClientOptions(signal),
|
|
786
|
+
batchId: batch.batch_id,
|
|
787
|
+
batchRequestId,
|
|
788
|
+
});
|
|
789
|
+
const response = getBatchChatCompletion(result);
|
|
790
|
+
accumulateUsage(totalUsage, getBatchUsage(response));
|
|
791
|
+
const choice = response.choices[0];
|
|
792
|
+
if (!choice) {
|
|
793
|
+
throw new Error("Batch response did not contain any choices.");
|
|
794
|
+
}
|
|
795
|
+
const content = choice?.message.content ?? "";
|
|
796
|
+
if (content) {
|
|
797
|
+
assistantText += content;
|
|
798
|
+
}
|
|
799
|
+
const requestMessages = [...childMessages, ...turnMessages];
|
|
800
|
+
const toolCalls = (choice?.message.tool_calls ?? []).map(toLocalToolCall);
|
|
801
|
+
const assistantMessage = buildAssistantBatchMessage(content, toolCalls);
|
|
802
|
+
if (assistantMessage) {
|
|
803
|
+
turnMessages.push(assistantMessage);
|
|
804
|
+
}
|
|
805
|
+
if (toolCalls.length === 0) {
|
|
806
|
+
if (hasUsage(totalUsage)) {
|
|
807
|
+
this.recordUsage(totalUsage, "task", childRuntime.modelId);
|
|
808
|
+
}
|
|
809
|
+
const output = assistantText.trim() || `Task completed. Last action: ${lastActivity}`;
|
|
810
|
+
return {
|
|
811
|
+
success: true,
|
|
812
|
+
output,
|
|
813
|
+
task: {
|
|
814
|
+
agent: request.agent,
|
|
815
|
+
description: request.description,
|
|
816
|
+
summary: firstLine(output),
|
|
817
|
+
activity: lastActivity,
|
|
818
|
+
},
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
const toolParts = [];
|
|
822
|
+
for (const toolCall of toolCalls) {
|
|
823
|
+
const nextActivity = formatSubagentActivity(toolCall.function.name, parseToolArgumentsOrRaw(toolCall.function.arguments));
|
|
824
|
+
lastActivity = nextActivity;
|
|
825
|
+
onActivity?.(nextActivity);
|
|
826
|
+
const executed = await this.executeBatchToolCall(childTools, toolCall, requestMessages, signal);
|
|
827
|
+
toolParts.push({
|
|
828
|
+
toolCall,
|
|
829
|
+
input: executed.input,
|
|
830
|
+
toolResult: executed.result,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
const toolMessage = buildToolBatchMessage(toolParts);
|
|
834
|
+
if (toolMessage) {
|
|
835
|
+
turnMessages.push(toolMessage);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (hasUsage(totalUsage)) {
|
|
839
|
+
this.recordUsage(totalUsage, "task", childRuntime.modelId);
|
|
840
|
+
}
|
|
841
|
+
const output = assistantText.trim() || `Task stopped after ${maxSteps} batch rounds. Last action: ${lastActivity}`;
|
|
842
|
+
return {
|
|
843
|
+
success: false,
|
|
844
|
+
output,
|
|
845
|
+
task: {
|
|
846
|
+
agent: request.agent,
|
|
847
|
+
description: request.description,
|
|
848
|
+
summary: output,
|
|
849
|
+
activity: lastActivity,
|
|
850
|
+
},
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Run a sub-agent task by spawning a child `streamText` session.
|
|
855
|
+
*
|
|
856
|
+
* Phase 12.3 — body extracted to `StreamRunner` (`./stream-runner.ts`).
|
|
857
|
+
* This method now builds the DI dep set and delegates to
|
|
858
|
+
* `StreamRunner.run()`. Public signature is unchanged so all callers
|
|
859
|
+
* (`runTask`, `tools/registry`, batch path, council path) work as before.
|
|
860
|
+
*/
|
|
861
|
+
async runTaskRequest(request, onActivity, abortSignal) {
|
|
862
|
+
const provider = this.requireProvider();
|
|
863
|
+
const deps = {
|
|
864
|
+
getProvider: () => provider,
|
|
865
|
+
resolveModelForTask: (task) => this._resolveModelForTask(task),
|
|
866
|
+
getModelId: () => this.modelId,
|
|
867
|
+
getProviderId: () => this.providerId,
|
|
868
|
+
getBash: () => this.bash,
|
|
869
|
+
getMaxToolRounds: () => this.maxToolRounds,
|
|
870
|
+
getMaxTokens: () => this.maxTokens,
|
|
871
|
+
isBatchApiEnabled: () => this.batchApi,
|
|
872
|
+
getCrossTurnDedup: () => this._crossTurnDedup,
|
|
873
|
+
getReadBudget: () => this._readBudget,
|
|
874
|
+
recordUsage: (usage, source, model) => this.recordUsage(usage, source, model),
|
|
875
|
+
setCurrentCallId: (id) => {
|
|
876
|
+
this._currentCallId = id;
|
|
877
|
+
},
|
|
878
|
+
setLastProviderOptionsShape: (shape) => {
|
|
879
|
+
this._lastProviderOptionsShape = shape;
|
|
880
|
+
},
|
|
881
|
+
runTaskRequestBatch: (args) => this.runTaskRequestBatch(args),
|
|
882
|
+
};
|
|
883
|
+
const runner = new StreamRunner(deps);
|
|
884
|
+
return runner.run(request, onActivity, abortSignal);
|
|
885
|
+
}
|
|
886
|
+
async runTask(request, abortSignal) {
|
|
887
|
+
const startInput = {
|
|
888
|
+
hook_event_name: "SubagentStart",
|
|
889
|
+
agent_type: request.agent,
|
|
890
|
+
description: request.description,
|
|
891
|
+
session_id: this.session?.id,
|
|
892
|
+
cwd: this.bash.getCwd(),
|
|
893
|
+
};
|
|
894
|
+
await this.fireHook(startInput, abortSignal).catch(() => { });
|
|
895
|
+
let result;
|
|
896
|
+
try {
|
|
897
|
+
result = await withStreamRetry(() => this.runTaskRequest(request, (detail) => {
|
|
898
|
+
if (abortSignal?.aborted)
|
|
899
|
+
return;
|
|
900
|
+
this.emitSubagentStatus({
|
|
901
|
+
agent: request.agent,
|
|
902
|
+
description: request.description,
|
|
903
|
+
detail,
|
|
904
|
+
});
|
|
905
|
+
}, abortSignal), {
|
|
906
|
+
signal: abortSignal,
|
|
907
|
+
onRetry: (info) => {
|
|
908
|
+
// Emit harness telemetry
|
|
909
|
+
try {
|
|
910
|
+
const _ar = globalThis.__muonroiAgentRuntime;
|
|
911
|
+
_ar?.emitEvent({
|
|
912
|
+
t: "event",
|
|
913
|
+
kind: "stream-retry",
|
|
914
|
+
...info,
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
catch {
|
|
918
|
+
/* best-effort */
|
|
919
|
+
}
|
|
920
|
+
try {
|
|
921
|
+
if (this.session) {
|
|
922
|
+
logInteraction(this.session.id, "stream_retry", {
|
|
923
|
+
data: {
|
|
924
|
+
attempt: info.attempt,
|
|
925
|
+
maxAttempts: info.maxAttempts,
|
|
926
|
+
errorName: info.errorName,
|
|
927
|
+
errorMessage: info.errorMessage.slice(0, 200),
|
|
928
|
+
nextDelayMs: info.nextDelayMs,
|
|
929
|
+
},
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
catch {
|
|
934
|
+
/* fail-open */
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
finally {
|
|
940
|
+
this.emitSubagentStatus(null);
|
|
941
|
+
}
|
|
942
|
+
const stopInput = {
|
|
943
|
+
hook_event_name: "SubagentStop",
|
|
944
|
+
agent_type: request.agent,
|
|
945
|
+
description: request.description,
|
|
946
|
+
success: result.success,
|
|
947
|
+
session_id: this.session?.id,
|
|
948
|
+
cwd: this.bash.getCwd(),
|
|
949
|
+
};
|
|
950
|
+
await this.fireHook(stopInput, abortSignal).catch(() => { });
|
|
951
|
+
return result;
|
|
952
|
+
}
|
|
953
|
+
async runDelegation(request, abortSignal) {
|
|
954
|
+
const taskCreatedInput = {
|
|
955
|
+
hook_event_name: "TaskCreated",
|
|
956
|
+
agent_type: request.agent,
|
|
957
|
+
description: request.description,
|
|
958
|
+
session_id: this.session?.id,
|
|
959
|
+
cwd: this.bash.getCwd(),
|
|
960
|
+
};
|
|
961
|
+
await this.fireHook(taskCreatedInput, abortSignal).catch(() => { });
|
|
962
|
+
let result;
|
|
963
|
+
try {
|
|
964
|
+
if (abortSignal?.aborted) {
|
|
965
|
+
return { success: false, output: "[Cancelled]" };
|
|
966
|
+
}
|
|
967
|
+
result = await this.delegations.start(request, {
|
|
968
|
+
model: this.modelId,
|
|
969
|
+
sandboxMode: this.bash.getSandboxMode(),
|
|
970
|
+
sandboxSettings: this.bash.getSandboxSettings(),
|
|
971
|
+
maxToolRounds: this.maxToolRounds,
|
|
972
|
+
maxTokens: this.maxTokens,
|
|
973
|
+
batchApi: this.batchApi,
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
catch (err) {
|
|
977
|
+
if (abortSignal?.aborted)
|
|
978
|
+
throw err;
|
|
979
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
980
|
+
result = {
|
|
981
|
+
success: false,
|
|
982
|
+
output: `Delegation failed: ${msg}`,
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
const taskCompletedInput = {
|
|
986
|
+
hook_event_name: "TaskCompleted",
|
|
987
|
+
agent_type: request.agent,
|
|
988
|
+
description: request.description,
|
|
989
|
+
success: result.success,
|
|
990
|
+
session_id: this.session?.id,
|
|
991
|
+
cwd: this.bash.getCwd(),
|
|
992
|
+
};
|
|
993
|
+
await this.fireHook(taskCompletedInput, abortSignal).catch(() => { });
|
|
994
|
+
return result;
|
|
995
|
+
}
|
|
996
|
+
async readDelegation(id) {
|
|
997
|
+
try {
|
|
998
|
+
return {
|
|
999
|
+
success: true,
|
|
1000
|
+
output: await this.delegations.read(id),
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
catch (err) {
|
|
1004
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1005
|
+
return {
|
|
1006
|
+
success: false,
|
|
1007
|
+
output: `Failed to read delegation: ${msg}`,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
async listDelegations() {
|
|
1012
|
+
try {
|
|
1013
|
+
const delegations = await this.delegations.list();
|
|
1014
|
+
if (delegations.length === 0) {
|
|
1015
|
+
return {
|
|
1016
|
+
success: true,
|
|
1017
|
+
output: "No delegations found for this project.",
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
const lines = delegations.map((delegation) => {
|
|
1021
|
+
const title = delegation.description || delegation.id;
|
|
1022
|
+
return `- \`${delegation.id}\` [${delegation.status}] ${title}\n ${delegation.summary}`;
|
|
1023
|
+
});
|
|
1024
|
+
return {
|
|
1025
|
+
success: true,
|
|
1026
|
+
output: `## Delegations\n\n${lines.join("\n")}`,
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
catch (err) {
|
|
1030
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1031
|
+
return {
|
|
1032
|
+
success: false,
|
|
1033
|
+
output: `Failed to list delegations: ${msg}`,
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
getCompactionSettings(contextWindow) {
|
|
1038
|
+
let keepRecentTokens = DEFAULT_KEEP_RECENT_TOKENS;
|
|
1039
|
+
// For models with very large context windows, keep more recent tokens
|
|
1040
|
+
if (contextWindow && contextWindow > 200_000) {
|
|
1041
|
+
keepRecentTokens = Math.min(100_000, Math.max(20_000, Math.floor(contextWindow * 0.1)));
|
|
1042
|
+
}
|
|
1043
|
+
// Compact more aggressively for long sessions to prevent runaway token growth
|
|
1044
|
+
if (this._compactionStats.count >= 2) {
|
|
1045
|
+
keepRecentTokens = Math.floor(keepRecentTokens * 0.75);
|
|
1046
|
+
}
|
|
1047
|
+
return {
|
|
1048
|
+
reserveTokens: Math.max(this.maxTokens, DEFAULT_RESERVE_TOKENS),
|
|
1049
|
+
keepRecentTokens,
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
_resolveCompactModel() {
|
|
1053
|
+
return this._resolveModelForTask("compact");
|
|
1054
|
+
}
|
|
1055
|
+
_resolveModelForTask(task) {
|
|
1056
|
+
const tierPrefs = {
|
|
1057
|
+
compact: ["fast", "balanced"],
|
|
1058
|
+
title: ["fast", "balanced"],
|
|
1059
|
+
explore: ["balanced", "fast"],
|
|
1060
|
+
general: ["premium", "balanced"],
|
|
1061
|
+
};
|
|
1062
|
+
for (const tier of tierPrefs[task] ?? ["balanced"]) {
|
|
1063
|
+
const m = getModelByTier(tier, this.providerId);
|
|
1064
|
+
if (m?.provider === this.providerId)
|
|
1065
|
+
return m.id;
|
|
1066
|
+
}
|
|
1067
|
+
return this.modelId;
|
|
1068
|
+
}
|
|
1069
|
+
async compactForContext(provider, system, contextWindow, signal, settings = this.getCompactionSettings(contextWindow), force = false) {
|
|
1070
|
+
if (!this.session)
|
|
1071
|
+
return false;
|
|
1072
|
+
const preparation = prepareCompaction(this.messages, system, settings);
|
|
1073
|
+
if (!preparation)
|
|
1074
|
+
return false;
|
|
1075
|
+
if (!force && !shouldCompactContext(preparation.tokensBefore, contextWindow, settings)) {
|
|
1076
|
+
return false;
|
|
1077
|
+
}
|
|
1078
|
+
const trigger = force ? "manual" : "auto";
|
|
1079
|
+
// Fire-and-forget: notify EE of stale suggestions before compaction
|
|
1080
|
+
const { surfacedIds, timestamp } = getLastSurfacedState();
|
|
1081
|
+
if (surfacedIds.length > 0) {
|
|
1082
|
+
getDefaultEEClient()
|
|
1083
|
+
.promptStale({
|
|
1084
|
+
state: { surfacedIds, timestamp },
|
|
1085
|
+
nextPromptMeta: { trigger: "auto-compact", cwd: this.bash.getCwd(), tenantId: getTenantId() },
|
|
1086
|
+
})
|
|
1087
|
+
.catch(() => { });
|
|
1088
|
+
}
|
|
1089
|
+
const preCompactInput = {
|
|
1090
|
+
hook_event_name: "PreCompact",
|
|
1091
|
+
trigger,
|
|
1092
|
+
session_id: this.session?.id,
|
|
1093
|
+
cwd: this.bash.getCwd(),
|
|
1094
|
+
};
|
|
1095
|
+
await this.fireHook(preCompactInput, signal).catch(() => { });
|
|
1096
|
+
const keptSeqs = this.messageSeqs.slice(preparation.firstKeptIndex);
|
|
1097
|
+
const firstKeptSeq = keptSeqs.find((seq) => seq !== null) ?? getNextMessageSequence(this.session.id);
|
|
1098
|
+
const compactModelId = this._resolveCompactModel();
|
|
1099
|
+
const compactStartedAt = Date.now();
|
|
1100
|
+
const { summary, usage: compactUsage } = await generateCompactionSummary(provider, compactModelId, preparation, undefined, signal);
|
|
1101
|
+
// Record compaction call in cost-log — bypasses recordUsage because
|
|
1102
|
+
// compaction returns usage separately and isn't routed through the
|
|
1103
|
+
// status-bar / usage event pipeline (intentional: it's overhead, not user spend).
|
|
1104
|
+
const compactProvider = detectProviderForModel(compactModelId);
|
|
1105
|
+
appendCostLog({
|
|
1106
|
+
ts: compactStartedAt,
|
|
1107
|
+
provider: compactProvider,
|
|
1108
|
+
model: compactModelId,
|
|
1109
|
+
estimatedUsd: projectCostUSD(compactProvider, compactModelId, compactUsage.promptTokens, compactUsage.completionTokens),
|
|
1110
|
+
callsite: "orchestrator.compaction",
|
|
1111
|
+
phase: "compaction",
|
|
1112
|
+
iteration: this._compactionStats.count + 1,
|
|
1113
|
+
actualInputTokens: compactUsage.promptTokens,
|
|
1114
|
+
actualOutputTokens: compactUsage.completionTokens,
|
|
1115
|
+
durationMs: Date.now() - compactStartedAt,
|
|
1116
|
+
}).catch(() => undefined);
|
|
1117
|
+
appendCompaction(this.session.id, firstKeptSeq, summary, preparation.tokensBefore);
|
|
1118
|
+
// Re-inject pinned user messages that were about to be summarized away.
|
|
1119
|
+
// Pinned seqs that are still inside keptMessages don't need re-injection.
|
|
1120
|
+
const keptSeqSet = new Set(keptSeqs.filter((s) => s !== null));
|
|
1121
|
+
const pinnedReinjections = [];
|
|
1122
|
+
const pinnedReinjectionSeqs = [];
|
|
1123
|
+
for (const seq of [...this._pinnedSeqs].sort((a, b) => a - b)) {
|
|
1124
|
+
if (keptSeqSet.has(seq))
|
|
1125
|
+
continue;
|
|
1126
|
+
const idx = this.messageSeqs.indexOf(seq);
|
|
1127
|
+
if (idx < 0) {
|
|
1128
|
+
// Pinned seq no longer present (shouldn't happen, but stay defensive).
|
|
1129
|
+
this._pinnedSeqs.delete(seq);
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1132
|
+
const original = this.messages[idx];
|
|
1133
|
+
if (!original || original.role !== "user")
|
|
1134
|
+
continue;
|
|
1135
|
+
const text = extractUserContent(original.content).trim();
|
|
1136
|
+
if (!text)
|
|
1137
|
+
continue;
|
|
1138
|
+
pinnedReinjections.push({
|
|
1139
|
+
role: "system",
|
|
1140
|
+
content: `[Pinned user message — kept verbatim across compaction]\n${text}`,
|
|
1141
|
+
});
|
|
1142
|
+
pinnedReinjectionSeqs.push(null);
|
|
1143
|
+
}
|
|
1144
|
+
this.messages = [createCompactionSummaryMessage(summary), ...pinnedReinjections, ...preparation.keptMessages];
|
|
1145
|
+
this.messageSeqs = [null, ...pinnedReinjectionSeqs, ...keptSeqs];
|
|
1146
|
+
// Track compaction stats — net of the tokens spent ON compaction itself.
|
|
1147
|
+
const tokensAfter = estimateConversationTokens(system, this.messages);
|
|
1148
|
+
const grossSaved = Math.max(0, preparation.tokensBefore - tokensAfter);
|
|
1149
|
+
const compactCost = compactUsage.promptTokens + compactUsage.completionTokens;
|
|
1150
|
+
const saved = Math.max(0, grossSaved - compactCost);
|
|
1151
|
+
const pct = preparation.tokensBefore > 0 ? ((saved / preparation.tokensBefore) * 100).toFixed(1) : "0.0";
|
|
1152
|
+
this._compactionStats.count++;
|
|
1153
|
+
this._compactionStats.totalSaved += saved;
|
|
1154
|
+
// Update status bar with current context size and compaction summary
|
|
1155
|
+
const fmtCompact = (n) => (n >= 1000 ? `${(n / 1000).toFixed(1)}K` : String(n));
|
|
1156
|
+
const modelSuffix = compactModelId !== this.modelId ? ` via ${compactModelId}` : "";
|
|
1157
|
+
const userMsgCount = this.messages.filter((m) => m.role === "user").length;
|
|
1158
|
+
const isLongSession = this._compactionStats.count >= 3 || userMsgCount >= 200;
|
|
1159
|
+
const sessionHint = isLongSession ? " ⚠ long session — consider /clear" : "";
|
|
1160
|
+
const compactLabel = `${this._compactionStats.count} cmp, ${fmtCompact(this._compactionStats.totalSaved)} saved${modelSuffix}${sessionHint}`;
|
|
1161
|
+
statusBarStore.setState({ ctx_tokens: tokensAfter, compaction_summary: compactLabel });
|
|
1162
|
+
const postCompactInput = {
|
|
1163
|
+
hook_event_name: "PostCompact",
|
|
1164
|
+
trigger,
|
|
1165
|
+
session_id: this.session?.id,
|
|
1166
|
+
cwd: this.bash.getCwd(),
|
|
1167
|
+
};
|
|
1168
|
+
await this.fireHook(postCompactInput, signal).catch(() => { });
|
|
1169
|
+
// Interaction log: compaction
|
|
1170
|
+
try {
|
|
1171
|
+
if (this.session) {
|
|
1172
|
+
logInteraction(this.session.id, "compaction", {
|
|
1173
|
+
data: {
|
|
1174
|
+
count: this._compactionStats.count,
|
|
1175
|
+
tokensBefore: preparation.tokensBefore,
|
|
1176
|
+
tokensAfter,
|
|
1177
|
+
saved,
|
|
1178
|
+
grossSaved,
|
|
1179
|
+
compactCost,
|
|
1180
|
+
pct,
|
|
1181
|
+
isLongSession,
|
|
1182
|
+
},
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
catch {
|
|
1187
|
+
/* fail-open */
|
|
1188
|
+
}
|
|
1189
|
+
this._compactedThisTurn = true;
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
async postTurnCompact(provider, system, contextWindow, signal) {
|
|
1193
|
+
const log = (taken, reason, extra) => {
|
|
1194
|
+
appendDecisionLog({
|
|
1195
|
+
ts: Date.now(),
|
|
1196
|
+
sessionId: this.session?.id ?? null,
|
|
1197
|
+
kind: "post-turn-compact",
|
|
1198
|
+
taken,
|
|
1199
|
+
reason,
|
|
1200
|
+
meta: { contextWindow, ...extra },
|
|
1201
|
+
}).catch(() => undefined);
|
|
1202
|
+
};
|
|
1203
|
+
if (this._compactedThisTurn)
|
|
1204
|
+
return log(false, "already-compacted-this-turn");
|
|
1205
|
+
if (!isAutoCompactAfterTurnEnabled())
|
|
1206
|
+
return log(false, "feature-disabled");
|
|
1207
|
+
const tokens = estimateConversationTokens(system, this.messages);
|
|
1208
|
+
const thresholdPct = getAutoCompactThresholdPct();
|
|
1209
|
+
const minMeaningfulTokens = Math.max(POST_TURN_MIN_TOKENS, Math.floor(contextWindow * thresholdPct));
|
|
1210
|
+
if (tokens < minMeaningfulTokens) {
|
|
1211
|
+
return log(false, `under-threshold (${tokens} < ${minMeaningfulTokens})`, {
|
|
1212
|
+
tokens,
|
|
1213
|
+
thresholdPct,
|
|
1214
|
+
minMeaningfulTokens,
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
log(true, `over-threshold (${tokens} >= ${minMeaningfulTokens})`, { tokens, thresholdPct, minMeaningfulTokens });
|
|
1218
|
+
await this.compactForContext(provider, system, contextWindow, signal, this.getCompactionSettings(contextWindow), true).catch((err) => console.warn("[compact] failed:", err?.message));
|
|
1219
|
+
}
|
|
1220
|
+
// ========================================================================
|
|
1221
|
+
// Council system — delegated to CouncilManager (Phase 12.1-02)
|
|
1222
|
+
//
|
|
1223
|
+
// All council state + sub-call helpers (generate/research/prompt builders/
|
|
1224
|
+
// outcome parser/executor/candidate resolution) live in CouncilManager.
|
|
1225
|
+
// The thin facade below preserves the public API the UI + tests rely on
|
|
1226
|
+
// (respondToCouncilQuestion/Preflight + the internal _create*Responder
|
|
1227
|
+
// hooks used by orchestrator.agent.test.ts).
|
|
1228
|
+
// ========================================================================
|
|
1229
|
+
respondToCouncilQuestion(questionId, answer) {
|
|
1230
|
+
this.councilManager.respondToQuestion(questionId, answer);
|
|
1231
|
+
}
|
|
1232
|
+
respondToCouncilPreflight(preflightId, approved) {
|
|
1233
|
+
this.councilManager.respondToPreflight(preflightId, approved);
|
|
1234
|
+
}
|
|
1235
|
+
// Internal hooks used by orchestrator.agent.test.ts to exercise buffered
|
|
1236
|
+
// question / preflight delivery through CouncilManager. They are reached
|
|
1237
|
+
// through `as unknown as` casts in the test; keep them private but stable.
|
|
1238
|
+
_createQuestionResponder() {
|
|
1239
|
+
return this.councilManager.createQuestionResponder();
|
|
1240
|
+
}
|
|
1241
|
+
_createPreflightResponder() {
|
|
1242
|
+
return this.councilManager.createPreflightResponder();
|
|
1243
|
+
}
|
|
1244
|
+
// ========================================================================
|
|
1245
|
+
// Council v2 — Clarify → Confirm → Debate → Plan → Execute
|
|
1246
|
+
// ========================================================================
|
|
1247
|
+
async *runCouncilV2(topic, options) {
|
|
1248
|
+
const { runCouncil } = await import("../council/index.js");
|
|
1249
|
+
const { createCouncilLLM } = await import("../council/llm.js");
|
|
1250
|
+
const councilStats = { calls: 0, startMs: Date.now(), phases: [] };
|
|
1251
|
+
const llm = createCouncilLLM(this.bash, this.mode, this.session?.id, councilStats);
|
|
1252
|
+
const processMessageFn = (message) => this.processMessage(message, options?.observer);
|
|
1253
|
+
const gen = runCouncil(topic, this.modelId, this.messages, this.session?.id, llm, this.councilManager.createQuestionResponder(), this.councilManager.createPreflightResponder(), processMessageFn, {
|
|
1254
|
+
skipClarification: options?.skipClarification,
|
|
1255
|
+
userModelMessage: options?.userModelMessage,
|
|
1256
|
+
cwd: this.bash.getCwd(),
|
|
1257
|
+
councilStats, // NEW — share orchestrator's stats object with runCouncil (Phase 14 CQ-01)
|
|
1258
|
+
});
|
|
1259
|
+
let result;
|
|
1260
|
+
do {
|
|
1261
|
+
result = await gen.next();
|
|
1262
|
+
if (!result.done && result.value) {
|
|
1263
|
+
yield result.value;
|
|
1264
|
+
}
|
|
1265
|
+
} while (!result.done);
|
|
1266
|
+
const synthesis = result.value;
|
|
1267
|
+
this.councilManager.setLastSynthesis(synthesis);
|
|
1268
|
+
if (options?.userModelMessage && synthesis) {
|
|
1269
|
+
this.appendCompletedTurn(options.userModelMessage, [{ role: "assistant", content: synthesis }]);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
// ========================================================================
|
|
1273
|
+
// Product Ideal Loop (Phase 13) — mirror of runCouncilV2 wiring.
|
|
1274
|
+
// ========================================================================
|
|
1275
|
+
async *runProductLoopV1(payload, options) {
|
|
1276
|
+
const { runProductLoop } = await import("../product-loop/index.js");
|
|
1277
|
+
const { createCouncilLLM } = await import("../council/llm.js");
|
|
1278
|
+
const nodePath = await import("node:path");
|
|
1279
|
+
const productStats = {
|
|
1280
|
+
calls: 0,
|
|
1281
|
+
startMs: Date.now(),
|
|
1282
|
+
phases: [],
|
|
1283
|
+
};
|
|
1284
|
+
const llm = createCouncilLLM(this.bash, this.mode, this.session?.id, productStats);
|
|
1285
|
+
const processMessageFn = (m) => this.processMessage(m, options?.observer);
|
|
1286
|
+
const flowDir = nodePath.join(this.bash.getCwd(), ".muonroi-flow");
|
|
1287
|
+
// P2.7: compute complexity from the idea using PIL Layer 1 heuristics (cheap,
|
|
1288
|
+
// no LLM calls). Only meaningful for "start"; other subcommands ignore it.
|
|
1289
|
+
let complexity;
|
|
1290
|
+
let sufficiencyMissing;
|
|
1291
|
+
if (payload.subcommand === "start" && payload.idea) {
|
|
1292
|
+
const { scoreComplexity, scoreSufficiency } = await import("../pil/layer1-intent.js");
|
|
1293
|
+
const result = scoreComplexity({
|
|
1294
|
+
rawText: payload.idea,
|
|
1295
|
+
taskType: null,
|
|
1296
|
+
t0HitCount: 0,
|
|
1297
|
+
hasMaxSprintsOne: payload.flags.maxSprints === 1,
|
|
1298
|
+
});
|
|
1299
|
+
complexity = result.complexity;
|
|
1300
|
+
// Sufficiency gate — vague briefs ("todo app") force Council so the
|
|
1301
|
+
// discovery AskCard can fill in persona/MVP/architecture/verify before
|
|
1302
|
+
// any code is scaffolded.
|
|
1303
|
+
const suff = scoreSufficiency({ rawText: payload.idea });
|
|
1304
|
+
sufficiencyMissing = suff.sufficient ? undefined : suff.missing;
|
|
1305
|
+
}
|
|
1306
|
+
const gen = runProductLoop({
|
|
1307
|
+
subcommand: payload.subcommand,
|
|
1308
|
+
idea: payload.idea ?? "",
|
|
1309
|
+
runId: payload.runId,
|
|
1310
|
+
flowDir,
|
|
1311
|
+
sessionModelId: this.modelId,
|
|
1312
|
+
llm,
|
|
1313
|
+
flags: {
|
|
1314
|
+
maxCost: payload.flags.maxCost,
|
|
1315
|
+
maxSprints: payload.flags.maxSprints,
|
|
1316
|
+
doneThreshold: payload.flags.doneThreshold,
|
|
1317
|
+
stack: payload.flags.stack,
|
|
1318
|
+
forceCouncil: payload.flags.forceCouncil,
|
|
1319
|
+
},
|
|
1320
|
+
respondToQuestion: this.councilManager.createQuestionResponder(),
|
|
1321
|
+
respondToPreflight: this.councilManager.createPreflightResponder(),
|
|
1322
|
+
cwd: this.bash.getCwd(),
|
|
1323
|
+
processMessageFn,
|
|
1324
|
+
skipPriorContext: payload.flags.noPriorContext === true,
|
|
1325
|
+
complexity,
|
|
1326
|
+
sufficiencyMissing,
|
|
1327
|
+
// Chat session id — used as the FK key for interaction_logs telemetry.
|
|
1328
|
+
// The /ideal runId is NOT a sessions.id and would silently fail FK insert.
|
|
1329
|
+
sessionId: this.session?.id,
|
|
1330
|
+
});
|
|
1331
|
+
for await (const chunk of gen) {
|
|
1332
|
+
yield chunk;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
// ========================================================================
|
|
1336
|
+
// Legacy council — kept for backward compatibility, will be removed
|
|
1337
|
+
// ========================================================================
|
|
1338
|
+
async *runCouncilRound(topic, _observer, rounds, userModelMessage) {
|
|
1339
|
+
const maxRounds = rounds ?? getCouncilRounds();
|
|
1340
|
+
const ALL_ROLES = ["implement", "verify", "research"];
|
|
1341
|
+
this.councilManager.resetStats(Date.now());
|
|
1342
|
+
// Resolve council participants: same-provider by default, multi-provider only when configured
|
|
1343
|
+
const candidates = [];
|
|
1344
|
+
const configuredRoleModels = getRoleModels();
|
|
1345
|
+
const hasExplicitMultiProvider = this.councilManager.hasMultiProviderConfig(configuredRoleModels);
|
|
1346
|
+
if (hasExplicitMultiProvider && isCouncilMultiProviderPreferred()) {
|
|
1347
|
+
// Multi-provider path: use explicitly configured role models across providers
|
|
1348
|
+
for (const role of ALL_ROLES) {
|
|
1349
|
+
const modelId = getRoleModel(role);
|
|
1350
|
+
if (!modelId)
|
|
1351
|
+
continue;
|
|
1352
|
+
const provider = detectProviderForModel(modelId);
|
|
1353
|
+
if (isProviderDisabled(provider))
|
|
1354
|
+
continue;
|
|
1355
|
+
const canReach = await loadKeyForProvider(provider)
|
|
1356
|
+
.then(() => true)
|
|
1357
|
+
.catch(() => false);
|
|
1358
|
+
if (canReach)
|
|
1359
|
+
candidates.push({ role, model: modelId });
|
|
1360
|
+
}
|
|
1361
|
+
if (candidates.length >= 2) {
|
|
1362
|
+
const providers = new Set(candidates.map((c) => detectProviderForModel(c.model)));
|
|
1363
|
+
yield {
|
|
1364
|
+
type: "content",
|
|
1365
|
+
content: `\n[Multi-provider mode: ${candidates.length} roles across ${providers.size} provider(s)]\n`,
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
// Default: same-provider mode — pick diverse models from the session's provider
|
|
1370
|
+
if (candidates.length < 2) {
|
|
1371
|
+
const mainProviderId = detectProviderForModel(this.modelId);
|
|
1372
|
+
// Skip same-provider resolution if the session's provider is disabled
|
|
1373
|
+
if (!isProviderDisabled(mainProviderId)) {
|
|
1374
|
+
const sameCandidates = await this.councilManager.resolveSameProviderCandidates(mainProviderId, ALL_ROLES);
|
|
1375
|
+
if (sameCandidates.length >= 2) {
|
|
1376
|
+
candidates.length = 0;
|
|
1377
|
+
candidates.push(...sameCandidates);
|
|
1378
|
+
const uniqueModels = new Set(sameCandidates.map((c) => c.model));
|
|
1379
|
+
yield {
|
|
1380
|
+
type: "content",
|
|
1381
|
+
content: `\n[Same-provider mode: ${uniqueModels.size} ${mainProviderId} model(s) for ${sameCandidates.length} roles]\n`,
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
// Final fallback: use main model for all roles
|
|
1387
|
+
if (candidates.length < 2) {
|
|
1388
|
+
const mainProviderId = detectProviderForModel(this.modelId);
|
|
1389
|
+
const mainDisabled = isProviderDisabled(mainProviderId);
|
|
1390
|
+
const mainCanReach = !mainDisabled &&
|
|
1391
|
+
(await loadKeyForProvider(mainProviderId)
|
|
1392
|
+
.then(() => true)
|
|
1393
|
+
.catch(() => false));
|
|
1394
|
+
if (mainCanReach) {
|
|
1395
|
+
candidates.length = 0;
|
|
1396
|
+
for (const role of ALL_ROLES) {
|
|
1397
|
+
candidates.push({ role, model: this.modelId });
|
|
1398
|
+
}
|
|
1399
|
+
yield {
|
|
1400
|
+
type: "content",
|
|
1401
|
+
content: `\n[Fallback: using \x1b[36m${this.modelId}\x1b[0m for all roles]\n`,
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
if (candidates.length < 2) {
|
|
1406
|
+
yield {
|
|
1407
|
+
type: "content",
|
|
1408
|
+
content: "\nNo reachable provider. Check API keys in user-settings.json or environment.\n",
|
|
1409
|
+
};
|
|
1410
|
+
yield { type: "done" };
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
// Build conversation context for all participants
|
|
1414
|
+
const conversationContext = this.councilManager.buildContext();
|
|
1415
|
+
// ── Phase 0: Research — gather facts from codebase before discussion ──
|
|
1416
|
+
const p0Start = Date.now();
|
|
1417
|
+
yield { type: "content", content: `\n## Phase 0 — Codebase Research\n` };
|
|
1418
|
+
// Find the research candidate (prefer configured research role, fallback to first available)
|
|
1419
|
+
const researchCandidate = candidates.find((c) => c.role === "research") ?? candidates[0];
|
|
1420
|
+
yield { type: "content", content: `\n### \x1b[35m[research]\x1b[0m ${researchCandidate.model}\n` };
|
|
1421
|
+
const researchFindings = await this.councilManager.research(researchCandidate.model, topic, conversationContext);
|
|
1422
|
+
yield { type: "content", content: `${researchFindings}\n` };
|
|
1423
|
+
yield { type: "content", content: `\n> Phase 0: ${((Date.now() - p0Start) / 1000).toFixed(1)}s\n` };
|
|
1424
|
+
// Inject research findings into conversation context for subsequent phases
|
|
1425
|
+
const enrichedContext = conversationContext
|
|
1426
|
+
? `${conversationContext}\n\n---\n\n## Research Findings (Phase 0)\n${researchFindings}`
|
|
1427
|
+
: `## Research Findings (Phase 0)\n${researchFindings}`;
|
|
1428
|
+
// ── Phase 1: Parallel opening statements ──
|
|
1429
|
+
const p1Start = Date.now();
|
|
1430
|
+
yield { type: "content", content: "\n## Phase 1 — Opening Analysis\n" };
|
|
1431
|
+
const openingPromises = candidates.map(({ role, model }) => {
|
|
1432
|
+
const { system, prompt } = this.councilManager.buildDiscussPrompt("open", {
|
|
1433
|
+
speakerRole: role,
|
|
1434
|
+
partnerRole: candidates.find((c) => c.role !== role)?.role ?? "colleague",
|
|
1435
|
+
topic,
|
|
1436
|
+
conversationContext: enrichedContext,
|
|
1437
|
+
});
|
|
1438
|
+
return this.councilManager
|
|
1439
|
+
.generate(model, system, prompt)
|
|
1440
|
+
.then((text) => ({ role, model, position: text, error: null }))
|
|
1441
|
+
.catch((err) => ({
|
|
1442
|
+
role,
|
|
1443
|
+
model,
|
|
1444
|
+
position: "",
|
|
1445
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1446
|
+
}));
|
|
1447
|
+
});
|
|
1448
|
+
const openings = await Promise.all(openingPromises);
|
|
1449
|
+
const active = [];
|
|
1450
|
+
for (const o of openings) {
|
|
1451
|
+
const roleColor = COUNCIL_ROLE_COLORS[o.role] ?? "";
|
|
1452
|
+
yield { type: "content", content: `\n### ${roleColor}[${o.role}]${COUNCIL_COLOR_RESET} ${o.model}\n` };
|
|
1453
|
+
if (o.error) {
|
|
1454
|
+
yield { type: "content", content: `[Error: ${o.error}]\n` };
|
|
1455
|
+
}
|
|
1456
|
+
else {
|
|
1457
|
+
active.push({ role: o.role, model: o.model, position: o.position });
|
|
1458
|
+
const bgColor = COUNCIL_COLOR_BG[o.role] ?? "";
|
|
1459
|
+
yield { type: "content", content: `${bgColor} ${o.role.toUpperCase()} ${COUNCIL_COLOR_RESET} ${o.position}\n` };
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
yield {
|
|
1463
|
+
type: "content",
|
|
1464
|
+
content: `\n> Phase 1: ${active.length} participants, ${((Date.now() - p1Start) / 1000).toFixed(1)}s (parallel)\n`,
|
|
1465
|
+
};
|
|
1466
|
+
if (active.length < 2) {
|
|
1467
|
+
yield { type: "content", content: "\nNot enough successful openings for discussion.\n" };
|
|
1468
|
+
yield { type: "done" };
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
// ── Phase 2: Discussion rounds with parallel pair debates ──
|
|
1472
|
+
const exchangeLogs = new Map();
|
|
1473
|
+
const pairConverged = new Map();
|
|
1474
|
+
let runningSummary = "";
|
|
1475
|
+
for (let round = 1; round <= maxRounds; round++) {
|
|
1476
|
+
const p2Start = Date.now();
|
|
1477
|
+
yield { type: "content", content: `\n## Phase 2 — Discussion Round ${round}/${maxRounds}\n` };
|
|
1478
|
+
// Build independent pairs
|
|
1479
|
+
const pairs = [];
|
|
1480
|
+
for (let i = 0; i < active.length; i++) {
|
|
1481
|
+
const a = active[i];
|
|
1482
|
+
const b = active[(i + 1) % active.length];
|
|
1483
|
+
const key = `${a.role}<>${b.role}`;
|
|
1484
|
+
if (pairConverged.get(key))
|
|
1485
|
+
continue;
|
|
1486
|
+
if (!exchangeLogs.has(key))
|
|
1487
|
+
exchangeLogs.set(key, []);
|
|
1488
|
+
pairs.push({ a, b, key });
|
|
1489
|
+
}
|
|
1490
|
+
if (pairs.length === 0)
|
|
1491
|
+
break;
|
|
1492
|
+
// Run pair debates in parallel
|
|
1493
|
+
const pairResults = await Promise.all(pairs.map(async ({ a, b, key }) => {
|
|
1494
|
+
const log = exchangeLogs.get(key);
|
|
1495
|
+
const chunks = [];
|
|
1496
|
+
try {
|
|
1497
|
+
let aResponse;
|
|
1498
|
+
let bResponse;
|
|
1499
|
+
if (round === 1) {
|
|
1500
|
+
const aPrompt = this.councilManager.buildDiscussPrompt("respond", {
|
|
1501
|
+
speakerRole: a.role,
|
|
1502
|
+
partnerRole: b.role,
|
|
1503
|
+
topic,
|
|
1504
|
+
speakerPosition: a.position,
|
|
1505
|
+
partnerPosition: b.position,
|
|
1506
|
+
conversationContext: enrichedContext,
|
|
1507
|
+
});
|
|
1508
|
+
aResponse = await this.councilManager.generate(a.model, aPrompt.system, aPrompt.prompt);
|
|
1509
|
+
log.push(`[${a.role}]: ${aResponse}`);
|
|
1510
|
+
chunks.push({ label: `[${a.role}] → [${b.role}]`, text: aResponse });
|
|
1511
|
+
const bPrompt = this.councilManager.buildDiscussPrompt("respond", {
|
|
1512
|
+
speakerRole: b.role,
|
|
1513
|
+
partnerRole: a.role,
|
|
1514
|
+
topic,
|
|
1515
|
+
speakerPosition: b.position,
|
|
1516
|
+
partnerPosition: aResponse,
|
|
1517
|
+
conversationContext: enrichedContext,
|
|
1518
|
+
});
|
|
1519
|
+
bResponse = await this.councilManager.generate(b.model, bPrompt.system, bPrompt.prompt);
|
|
1520
|
+
log.push(`[${b.role}]: ${bResponse}`);
|
|
1521
|
+
chunks.push({ label: `[${b.role}] → [${a.role}]`, text: bResponse });
|
|
1522
|
+
}
|
|
1523
|
+
else {
|
|
1524
|
+
const historyText = log.join("\n\n");
|
|
1525
|
+
const aPrompt = this.councilManager.buildDiscussPrompt("followup", {
|
|
1526
|
+
speakerRole: a.role,
|
|
1527
|
+
partnerRole: b.role,
|
|
1528
|
+
topic,
|
|
1529
|
+
partnerPosition: b.position,
|
|
1530
|
+
exchangeHistory: historyText,
|
|
1531
|
+
round,
|
|
1532
|
+
conversationContext: enrichedContext,
|
|
1533
|
+
runningSummary,
|
|
1534
|
+
});
|
|
1535
|
+
aResponse = await this.councilManager.generate(a.model, aPrompt.system, aPrompt.prompt, 1024);
|
|
1536
|
+
log.push(`[${a.role}] (round ${round}): ${aResponse}`);
|
|
1537
|
+
chunks.push({ label: `[${a.role}] → [${b.role}]`, text: aResponse });
|
|
1538
|
+
const bPrompt = this.councilManager.buildDiscussPrompt("followup", {
|
|
1539
|
+
speakerRole: b.role,
|
|
1540
|
+
partnerRole: a.role,
|
|
1541
|
+
topic,
|
|
1542
|
+
partnerPosition: aResponse,
|
|
1543
|
+
exchangeHistory: historyText,
|
|
1544
|
+
round,
|
|
1545
|
+
conversationContext: enrichedContext,
|
|
1546
|
+
runningSummary,
|
|
1547
|
+
});
|
|
1548
|
+
bResponse = await this.councilManager.generate(b.model, bPrompt.system, bPrompt.prompt, 1024);
|
|
1549
|
+
log.push(`[${b.role}] (round ${round}): ${bResponse}`);
|
|
1550
|
+
chunks.push({ label: `[${b.role}] → [${a.role}]`, text: bResponse });
|
|
1551
|
+
}
|
|
1552
|
+
b.position = bResponse;
|
|
1553
|
+
a.position = aResponse;
|
|
1554
|
+
// Convergence check
|
|
1555
|
+
const convPrompt = this.councilManager.buildDiscussPrompt("convergence-check", {
|
|
1556
|
+
speakerRole: a.role,
|
|
1557
|
+
partnerRole: b.role,
|
|
1558
|
+
topic,
|
|
1559
|
+
exchangeHistory: log.slice(-4).join("\n\n"),
|
|
1560
|
+
conversationContext: enrichedContext,
|
|
1561
|
+
});
|
|
1562
|
+
let converged = false;
|
|
1563
|
+
let convReason = "";
|
|
1564
|
+
try {
|
|
1565
|
+
const raw = await this.councilManager.generate(a.model, convPrompt.system, convPrompt.prompt, 256);
|
|
1566
|
+
const match = raw.match(/\{[\s\S]*\}/);
|
|
1567
|
+
if (match) {
|
|
1568
|
+
const parsed = JSON.parse(match[0]);
|
|
1569
|
+
converged = parsed.converged === true;
|
|
1570
|
+
convReason = parsed.reason ?? "";
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
catch {
|
|
1574
|
+
/* not converged */
|
|
1575
|
+
}
|
|
1576
|
+
return { key, chunks, converged, convReason, error: null };
|
|
1577
|
+
}
|
|
1578
|
+
catch (err) {
|
|
1579
|
+
return {
|
|
1580
|
+
key,
|
|
1581
|
+
chunks,
|
|
1582
|
+
converged: false,
|
|
1583
|
+
convReason: "",
|
|
1584
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
}));
|
|
1588
|
+
// Emit results (sequential yield — maintains readable order)
|
|
1589
|
+
let allConverged = true;
|
|
1590
|
+
for (const pr of pairResults) {
|
|
1591
|
+
for (const chunk of pr.chunks) {
|
|
1592
|
+
const labelParts = chunk.label.match(/\[(\w+)\] → \[(\w+)\]/);
|
|
1593
|
+
let coloredLabel = chunk.label;
|
|
1594
|
+
if (labelParts) {
|
|
1595
|
+
const fromColor = COUNCIL_ROLE_COLORS[labelParts[1]] ?? "";
|
|
1596
|
+
const toColor = COUNCIL_ROLE_COLORS[labelParts[2]] ?? "";
|
|
1597
|
+
coloredLabel = `${fromColor}[${labelParts[1]}]${COUNCIL_COLOR_RESET} → ${toColor}[${labelParts[2]}]${COUNCIL_COLOR_RESET}`;
|
|
1598
|
+
}
|
|
1599
|
+
yield { type: "content", content: `\n### ${coloredLabel}\n${chunk.text}\n` };
|
|
1600
|
+
}
|
|
1601
|
+
if (pr.error) {
|
|
1602
|
+
yield { type: "content", content: `[Discussion error: ${pr.error}]\n` };
|
|
1603
|
+
allConverged = false;
|
|
1604
|
+
}
|
|
1605
|
+
else if (pr.converged) {
|
|
1606
|
+
pairConverged.set(pr.key, true);
|
|
1607
|
+
yield { type: "content", content: `\n> ✓ ${pr.key.replace("<>", " ↔ ")} converged: ${pr.convReason}\n` };
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
allConverged = false;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
yield {
|
|
1614
|
+
type: "content",
|
|
1615
|
+
content: `\n> Round ${round}: ${((Date.now() - p2Start) / 1000).toFixed(1)}s (${pairs.length} pairs parallel)\n`,
|
|
1616
|
+
};
|
|
1617
|
+
if (allConverged) {
|
|
1618
|
+
yield { type: "content", content: `\n> All pairs converged at round ${round}. Moving to synthesis.\n` };
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
// Generate inter-round summary for next round's focus
|
|
1622
|
+
if (round < maxRounds) {
|
|
1623
|
+
try {
|
|
1624
|
+
runningSummary = await this.councilManager.generateRoundSummary(exchangeLogs, topic, round, active[0].model);
|
|
1625
|
+
yield {
|
|
1626
|
+
type: "content",
|
|
1627
|
+
content: `\n> **Discussion state:** ${runningSummary
|
|
1628
|
+
.split("\n")
|
|
1629
|
+
.filter((l) => l.trim())
|
|
1630
|
+
.slice(0, 3)
|
|
1631
|
+
.join(" | ")}\n`,
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
catch {
|
|
1635
|
+
// Non-critical — continue without summary
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
// ── Phase 3: Leader synthesis ──
|
|
1640
|
+
const p3Start = Date.now();
|
|
1641
|
+
yield { type: "content", content: "\n## Phase 3 — Leader Synthesis\n" };
|
|
1642
|
+
const leaderModelId = getRoleModel("leader") ?? this.modelId;
|
|
1643
|
+
yield { type: "content", content: `\n### \x1b[32m[leader]\x1b[0m ${leaderModelId}\n` };
|
|
1644
|
+
const allExchanges = [...exchangeLogs.entries()]
|
|
1645
|
+
.map(([pair, log]) => `### Discussion: ${pair}\n${log.join("\n\n")}`)
|
|
1646
|
+
.join("\n\n---\n\n");
|
|
1647
|
+
const finalPositions = active.map((p) => `**${p.role}** (${p.model}): ${p.position.slice(0, 500)}...`).join("\n\n");
|
|
1648
|
+
let synthesisText = "";
|
|
1649
|
+
try {
|
|
1650
|
+
synthesisText = await this.councilManager.generate(leaderModelId, "You are the team lead. Multiple specialists just had a structured discussion about a topic.\n\n" +
|
|
1651
|
+
"Output TWO parts separated by the exact line `---READABLE---`:\n\n" +
|
|
1652
|
+
"**Part 1: JSON** — a single JSON object:\n" +
|
|
1653
|
+
"```\n" +
|
|
1654
|
+
'{ "type": "decision"|"action_items"|"plan_update"|"resolve_question",\n' +
|
|
1655
|
+
' "summary": "1-2 sentence executive summary",\n' +
|
|
1656
|
+
' "agreed": ["point 1", "point 2"],\n' +
|
|
1657
|
+
' "tradeoffs": ["trade-off 1"],\n' +
|
|
1658
|
+
' "recommendation": "Your decisive recommendation",\n' +
|
|
1659
|
+
' "actionItems": ["step 1", "step 2"],\n' +
|
|
1660
|
+
' "planUpdate": "paragraph for plan update (only if type=plan_update)",\n' +
|
|
1661
|
+
' "resolvedQuestion": {"question": "...", "answer": "..."} }\n' +
|
|
1662
|
+
"```\n" +
|
|
1663
|
+
"Choose type: decision (general), action_items (concrete steps), plan_update (modify active plan), resolve_question (answer a specific question).\n\n" +
|
|
1664
|
+
"**Part 2: Human-readable** — after `---READABLE---`, write the synthesis in markdown:\n" +
|
|
1665
|
+
"## AGREED\n## TRADE-OFFS\n## RECOMMENDATION\n## NEXT STEPS\n\n" +
|
|
1666
|
+
"Be decisive. Output Part 1 JSON first, then ---READABLE---, then Part 2.", `Topic: ${topic}\n\nFinal positions:\n${finalPositions}\n\nFull discussion:\n${allExchanges}`, 4096);
|
|
1667
|
+
// Display human-readable part
|
|
1668
|
+
const readablePart = synthesisText.includes("---READABLE---")
|
|
1669
|
+
? synthesisText.split("---READABLE---")[1]?.trim()
|
|
1670
|
+
: synthesisText;
|
|
1671
|
+
yield { type: "content", content: `${readablePart || synthesisText}\n` };
|
|
1672
|
+
// Parse structured outcome and execute actions
|
|
1673
|
+
const structuredOutcome = this.councilManager.parseOutcome(synthesisText, topic);
|
|
1674
|
+
if (structuredOutcome) {
|
|
1675
|
+
yield* this.councilManager.executeOutcome(structuredOutcome, topic);
|
|
1676
|
+
if (this.session) {
|
|
1677
|
+
try {
|
|
1678
|
+
appendSystemMessage(this.session.id, `[Council Outcome]\n${JSON.stringify(structuredOutcome)}`);
|
|
1679
|
+
}
|
|
1680
|
+
catch {
|
|
1681
|
+
/* non-critical */
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
else {
|
|
1686
|
+
// Fallback: store text-only outcome (backward compatible)
|
|
1687
|
+
if (this.session) {
|
|
1688
|
+
try {
|
|
1689
|
+
appendSystemMessage(this.session.id, `[Council Outcome]\nTopic: ${topic}\n${synthesisText.slice(0, 2000)}`);
|
|
1690
|
+
}
|
|
1691
|
+
catch {
|
|
1692
|
+
/* non-critical */
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
catch (err) {
|
|
1698
|
+
yield { type: "content", content: `[Synthesis error: ${err instanceof Error ? err.message : err}]\n` };
|
|
1699
|
+
}
|
|
1700
|
+
// ── Stats + Memory ──
|
|
1701
|
+
const councilStats = this.councilManager.stats;
|
|
1702
|
+
const totalMs = Date.now() - councilStats.startMs;
|
|
1703
|
+
yield {
|
|
1704
|
+
type: "content",
|
|
1705
|
+
content: `\n---\n` +
|
|
1706
|
+
`> Council stats: ${councilStats.calls} API calls, ${(totalMs / 1000).toFixed(1)}s total, ` +
|
|
1707
|
+
`${active.length} participants, synthesis ${((Date.now() - p3Start) / 1000).toFixed(1)}s\n`,
|
|
1708
|
+
};
|
|
1709
|
+
// Save council result to session for memory across conversations
|
|
1710
|
+
if (this.session && this.sessionStore) {
|
|
1711
|
+
const councilRecord = {
|
|
1712
|
+
topic,
|
|
1713
|
+
participants: active.map((a) => ({ role: a.role, model: a.model })),
|
|
1714
|
+
finalPositions: active.map((a) => ({ role: a.role, position: a.position.slice(0, 1000) })),
|
|
1715
|
+
synthesis: synthesisText.slice(0, 2000),
|
|
1716
|
+
convergedPairs: [...pairConverged.entries()].filter(([, v]) => v).map(([k]) => k),
|
|
1717
|
+
stats: { calls: councilStats.calls, durationMs: totalMs },
|
|
1718
|
+
timestamp: new Date().toISOString(),
|
|
1719
|
+
};
|
|
1720
|
+
try {
|
|
1721
|
+
appendSystemMessage(this.session.id, `[Council Memory] ${JSON.stringify(councilRecord)}`);
|
|
1722
|
+
}
|
|
1723
|
+
catch {
|
|
1724
|
+
/* non-critical */
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
// Store council output as assistant message so the conversation history
|
|
1728
|
+
// stays valid (user→assistant alternation required by most APIs).
|
|
1729
|
+
const councilResponse = synthesisText || "[Council completed — see discussion above]";
|
|
1730
|
+
if (userModelMessage) {
|
|
1731
|
+
this.appendCompletedTurn(userModelMessage, [{ role: "assistant", content: councilResponse }]);
|
|
1732
|
+
}
|
|
1733
|
+
this.councilManager.setLastSynthesis(councilResponse);
|
|
1734
|
+
yield { type: "done" };
|
|
1735
|
+
}
|
|
1736
|
+
// ========================================================================
|
|
1737
|
+
// processMessageBatchTurn — batch API message processing loop.
|
|
1738
|
+
// Body extracted into BatchTurnRunner (Phase 12.5). Thin wrapper preserved
|
|
1739
|
+
// so MessageProcessorDeps' `processMessageBatchTurn` callback continues to
|
|
1740
|
+
// dispatch through `Agent.processMessageBatchTurn` unchanged.
|
|
1741
|
+
// ========================================================================
|
|
1742
|
+
async *processMessageBatchTurn(args) {
|
|
1743
|
+
const runner = new BatchTurnRunner(this._buildBatchTurnRunnerDeps());
|
|
1744
|
+
yield* runner.run(args);
|
|
1745
|
+
}
|
|
1746
|
+
/**
|
|
1747
|
+
* Build the DI surface BatchTurnRunner (Phase 12.5) needs to reach back
|
|
1748
|
+
* into Agent state without holding a circular reference. Callback names
|
|
1749
|
+
* align with `MessageProcessorDeps` where the signature matches so a
|
|
1750
|
+
* future `TurnRunnerDepsBase` hoist is mechanical. Built per call —
|
|
1751
|
+
* allocation cost is negligible against the batch polling spend.
|
|
1752
|
+
*/
|
|
1753
|
+
_buildBatchTurnRunnerDeps() {
|
|
1754
|
+
const self = this;
|
|
1755
|
+
return {
|
|
1756
|
+
get messages() {
|
|
1757
|
+
return self.messages;
|
|
1758
|
+
},
|
|
1759
|
+
get bash() {
|
|
1760
|
+
return self.bash;
|
|
1761
|
+
},
|
|
1762
|
+
get mode() {
|
|
1763
|
+
return self.mode;
|
|
1764
|
+
},
|
|
1765
|
+
get maxToolRounds() {
|
|
1766
|
+
return self.maxToolRounds;
|
|
1767
|
+
},
|
|
1768
|
+
get maxTokens() {
|
|
1769
|
+
return self.maxTokens;
|
|
1770
|
+
},
|
|
1771
|
+
get schedules() {
|
|
1772
|
+
return self.schedules;
|
|
1773
|
+
},
|
|
1774
|
+
get sendTelegramFile() {
|
|
1775
|
+
return self.sendTelegramFile;
|
|
1776
|
+
},
|
|
1777
|
+
getSessionId: () => self.session?.id ?? null,
|
|
1778
|
+
getCompactedThisTurn: () => self._compactedThisTurn,
|
|
1779
|
+
setCompactedThisTurn: (v) => {
|
|
1780
|
+
self._compactedThisTurn = v;
|
|
1781
|
+
},
|
|
1782
|
+
setLastProviderOptionsShape: (shape) => {
|
|
1783
|
+
self._lastProviderOptionsShape = shape;
|
|
1784
|
+
},
|
|
1785
|
+
getBatchClientOptions: (signal) => self.getBatchClientOptions(signal),
|
|
1786
|
+
getCompactionSettings: (cw) => self.getCompactionSettings(cw),
|
|
1787
|
+
compactForContext: (provider, system, cw, signal, settings, overflow) => self.compactForContext(provider, system, cw, signal, settings, overflow),
|
|
1788
|
+
postTurnCompact: (provider, system, cw, signal) => self.postTurnCompact(provider, system, cw, signal),
|
|
1789
|
+
createTools: (bash, provider, mode, opts) => createTools(bash, provider, mode, opts),
|
|
1790
|
+
runTask: (request, signal) => self.runTask(request, signal),
|
|
1791
|
+
runDelegation: (request, signal) => self.runDelegation(request, signal),
|
|
1792
|
+
readDelegation: (id) => self.readDelegation(id),
|
|
1793
|
+
listDelegations: () => self.listDelegations(),
|
|
1794
|
+
executeBatchToolCall: (tools, toolCall, messages, signal) => self.executeBatchToolCall(tools, toolCall, messages, signal),
|
|
1795
|
+
appendCompletedTurn: (user, asst) => self.appendCompletedTurn(user, asst),
|
|
1796
|
+
discardAbortedTurn: (user) => self.discardAbortedTurn(user),
|
|
1797
|
+
recordUsage: (usage, source, model) => self.recordUsage(usage, source, model),
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
appendCompletedTurn(userMessage, newMessages) {
|
|
1801
|
+
if (newMessages.length === 0)
|
|
1802
|
+
return;
|
|
1803
|
+
const userIndex = this.messages.lastIndexOf(userMessage);
|
|
1804
|
+
if (!this.sessionStore || !this.session) {
|
|
1805
|
+
if (userIndex >= 0 && this.messageSeqs[userIndex] == null) {
|
|
1806
|
+
this.messageSeqs[userIndex] = null;
|
|
1807
|
+
}
|
|
1808
|
+
this.messages.push(...newMessages);
|
|
1809
|
+
this.messageSeqs.push(...newMessages.map(() => null));
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
// Phase A5 — if the user message already has a persisted seq (set by
|
|
1813
|
+
// the write-ahead path), skip re-inserting it. The write-ahead row
|
|
1814
|
+
// will be upserted to status='completed' on the next `appendMessages`
|
|
1815
|
+
// call that sees it via ON CONFLICT, but here we only need to insert
|
|
1816
|
+
// the *new* assistant/tool messages so they get fresh sequence
|
|
1817
|
+
// numbers contiguous with the user row.
|
|
1818
|
+
const existingUserSeq = userIndex >= 0 ? this.messageSeqs[userIndex] : null;
|
|
1819
|
+
if (typeof existingUserSeq === "number") {
|
|
1820
|
+
// User row is already persisted (write-ahead). Insert only the new
|
|
1821
|
+
// assistant/tool messages so they get fresh sequence numbers
|
|
1822
|
+
// contiguous with the user row. Then flip the user row's status
|
|
1823
|
+
// from 'pending' to 'completed' so forensics + replay tooling can
|
|
1824
|
+
// tell the turn settled cleanly.
|
|
1825
|
+
const insertedSeqs = appendMessages(this.session.id, newMessages);
|
|
1826
|
+
markMessageCompleted(this.session.id, existingUserSeq);
|
|
1827
|
+
this.messages.push(...newMessages);
|
|
1828
|
+
this.messageSeqs.push(...insertedSeqs);
|
|
1829
|
+
this.sessionStore.touchSession(this.session.id, this.bash.getCwd());
|
|
1830
|
+
this.session = this.sessionStore.getRequiredSession(this.session.id);
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
const insertedSeqs = appendMessages(this.session.id, [userMessage, ...newMessages]);
|
|
1834
|
+
if (userIndex >= 0) {
|
|
1835
|
+
this.messageSeqs[userIndex] = insertedSeqs[0] ?? this.messageSeqs[userIndex];
|
|
1836
|
+
}
|
|
1837
|
+
this.messages.push(...newMessages);
|
|
1838
|
+
this.messageSeqs.push(...insertedSeqs.slice(1));
|
|
1839
|
+
this.sessionStore.touchSession(this.session.id, this.bash.getCwd());
|
|
1840
|
+
this.session = this.sessionStore.getRequiredSession(this.session.id);
|
|
1841
|
+
}
|
|
1842
|
+
fireHook(input, signal) {
|
|
1843
|
+
return executeEventHooks(input, this.bash.getCwd(), signal);
|
|
1844
|
+
}
|
|
1845
|
+
// ========================================================================
|
|
1846
|
+
// processMessage — main streaming turn loop (PIL enrichment, routing, LLM
|
|
1847
|
+
// stream, tool execution, compaction, hooks, observer notifications)
|
|
1848
|
+
// ========================================================================
|
|
1849
|
+
async *processMessage(userMessage, observer, images) {
|
|
1850
|
+
const processor = new MessageProcessor(this._buildMessageProcessorDeps());
|
|
1851
|
+
yield* processor.run(userMessage, observer, images);
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Build the DI surface MessageProcessor (Phase 12.4) needs to reach back
|
|
1855
|
+
* into Agent state without holding a circular reference. Exposes array
|
|
1856
|
+
* references for in-place mutation (messages/messageSeqs) and bound
|
|
1857
|
+
* callbacks for behavior. Built per call — allocation cost is negligible
|
|
1858
|
+
* against the streamText spend.
|
|
1859
|
+
*/
|
|
1860
|
+
_buildMessageProcessorDeps() {
|
|
1861
|
+
const self = this;
|
|
1862
|
+
return {
|
|
1863
|
+
get messages() {
|
|
1864
|
+
return self.messages;
|
|
1865
|
+
},
|
|
1866
|
+
get messageSeqs() {
|
|
1867
|
+
return self.messageSeqs;
|
|
1868
|
+
},
|
|
1869
|
+
get session() {
|
|
1870
|
+
return self.session;
|
|
1871
|
+
},
|
|
1872
|
+
get sessionStore() {
|
|
1873
|
+
return self.sessionStore;
|
|
1874
|
+
},
|
|
1875
|
+
get bash() {
|
|
1876
|
+
return self.bash;
|
|
1877
|
+
},
|
|
1878
|
+
get mode() {
|
|
1879
|
+
return self.mode;
|
|
1880
|
+
},
|
|
1881
|
+
get modelId() {
|
|
1882
|
+
return self.modelId;
|
|
1883
|
+
},
|
|
1884
|
+
get providerId() {
|
|
1885
|
+
return self.providerId;
|
|
1886
|
+
},
|
|
1887
|
+
get maxToolRounds() {
|
|
1888
|
+
return self.maxToolRounds;
|
|
1889
|
+
},
|
|
1890
|
+
get batchApi() {
|
|
1891
|
+
return self.batchApi;
|
|
1892
|
+
},
|
|
1893
|
+
get permissionMode() {
|
|
1894
|
+
return self.permissionMode;
|
|
1895
|
+
},
|
|
1896
|
+
get schedules() {
|
|
1897
|
+
return self.schedules;
|
|
1898
|
+
},
|
|
1899
|
+
get sendTelegramFile() {
|
|
1900
|
+
return self.sendTelegramFile;
|
|
1901
|
+
},
|
|
1902
|
+
get externalAbortContext() {
|
|
1903
|
+
return self.externalAbortContext;
|
|
1904
|
+
},
|
|
1905
|
+
get pendingCalls() {
|
|
1906
|
+
return self.pendingCalls;
|
|
1907
|
+
},
|
|
1908
|
+
get councilManager() {
|
|
1909
|
+
return self.councilManager;
|
|
1910
|
+
},
|
|
1911
|
+
get crossTurnDedup() {
|
|
1912
|
+
return self._crossTurnDedup;
|
|
1913
|
+
},
|
|
1914
|
+
get readBudget() {
|
|
1915
|
+
return self._readBudget;
|
|
1916
|
+
},
|
|
1917
|
+
get priorWarningIdsInSession() {
|
|
1918
|
+
return self._priorWarningIdsInSession;
|
|
1919
|
+
},
|
|
1920
|
+
get sessionEEGuidance() {
|
|
1921
|
+
return self._sessionEEGuidance;
|
|
1922
|
+
},
|
|
1923
|
+
get flowReady() {
|
|
1924
|
+
return self._flowReady;
|
|
1925
|
+
},
|
|
1926
|
+
getAbortController: () => self.abortController,
|
|
1927
|
+
setAbortController: (c) => {
|
|
1928
|
+
self.abortController = c;
|
|
1929
|
+
},
|
|
1930
|
+
getSessionStartHookFired: () => self.sessionStartHookFired,
|
|
1931
|
+
setSessionStartHookFired: (v) => {
|
|
1932
|
+
self.sessionStartHookFired = v;
|
|
1933
|
+
},
|
|
1934
|
+
getPlanContext: () => self.planContext,
|
|
1935
|
+
setPlanContext: (v) => {
|
|
1936
|
+
self.planContext = v;
|
|
1937
|
+
},
|
|
1938
|
+
getResumeDigest: () => self._resumeDigest,
|
|
1939
|
+
setResumeDigest: (v) => {
|
|
1940
|
+
self._resumeDigest = v;
|
|
1941
|
+
},
|
|
1942
|
+
getActiveRunId: () => self._activeRunId,
|
|
1943
|
+
getPendingCwdNote: () => self._pendingCwdNote,
|
|
1944
|
+
setPendingCwdNote: (v) => {
|
|
1945
|
+
self._pendingCwdNote = v;
|
|
1946
|
+
},
|
|
1947
|
+
setPilActive: (v) => {
|
|
1948
|
+
self._pilActive = v;
|
|
1949
|
+
},
|
|
1950
|
+
setPilEnrichmentDelta: (n) => {
|
|
1951
|
+
self._pilEnrichmentDelta = n;
|
|
1952
|
+
},
|
|
1953
|
+
setCurrentCallId: (id) => {
|
|
1954
|
+
self._currentCallId = id;
|
|
1955
|
+
},
|
|
1956
|
+
setLastProviderOptionsShape: (shape) => {
|
|
1957
|
+
self._lastProviderOptionsShape = shape;
|
|
1958
|
+
},
|
|
1959
|
+
setLastPromptBreakdown: (b) => {
|
|
1960
|
+
self._lastPromptBreakdown = b;
|
|
1961
|
+
},
|
|
1962
|
+
setCompactedThisTurn: (v) => {
|
|
1963
|
+
self._compactedThisTurn = v;
|
|
1964
|
+
},
|
|
1965
|
+
getCompactedThisTurn: () => self._compactedThisTurn,
|
|
1966
|
+
setTurnUserGoalExcerpt: (v) => {
|
|
1967
|
+
self._turnUserGoalExcerpt = v;
|
|
1968
|
+
},
|
|
1969
|
+
setTurnAssistantReasoning: (v) => {
|
|
1970
|
+
self._turnAssistantReasoning = v;
|
|
1971
|
+
},
|
|
1972
|
+
appendTurnAssistantReasoning: (delta) => {
|
|
1973
|
+
self._turnAssistantReasoning = (self._turnAssistantReasoning + delta).slice(-400);
|
|
1974
|
+
},
|
|
1975
|
+
getTurnAssistantReasoning: () => self._turnAssistantReasoning,
|
|
1976
|
+
setPriorWarningIdsInSession: (s) => {
|
|
1977
|
+
self._priorWarningIdsInSession = s;
|
|
1978
|
+
},
|
|
1979
|
+
setMessages: (m) => {
|
|
1980
|
+
self.messages = m;
|
|
1981
|
+
},
|
|
1982
|
+
requireProvider: () => self.requireProvider(),
|
|
1983
|
+
emitSubagentStatus: (s) => self.emitSubagentStatus(s),
|
|
1984
|
+
fireHook: (input, signal) => self.fireHook(input, signal),
|
|
1985
|
+
consumeBackgroundNotifications: () => self.consumeBackgroundNotifications(),
|
|
1986
|
+
initOAuthProvider: () => self._initOAuthProvider(),
|
|
1987
|
+
buildRecentTurnsSummary: () => self._buildRecentTurnsSummary(),
|
|
1988
|
+
estimateProjectSize: () => self._estimateProjectSize(),
|
|
1989
|
+
countFilesTouched: () => self._countFilesTouched(),
|
|
1990
|
+
getCompactionSettings: (cw) => self.getCompactionSettings(cw),
|
|
1991
|
+
compactForContext: (provider, system, cw, signal, settings, overflow) => self.compactForContext(provider, system, cw, signal, settings, overflow),
|
|
1992
|
+
postTurnCompact: (provider, system, cw, signal) => self.postTurnCompact(provider, system, cw, signal),
|
|
1993
|
+
runTask: (request, signal) => self.runTask(request, signal),
|
|
1994
|
+
runDelegation: (request, signal) => self.runDelegation(request, signal),
|
|
1995
|
+
readDelegation: (id) => self.readDelegation(id),
|
|
1996
|
+
listDelegations: () => self.listDelegations(),
|
|
1997
|
+
appendCompletedTurn: (user, asst) => self.appendCompletedTurn(user, asst),
|
|
1998
|
+
discardAbortedTurn: (user) => self.discardAbortedTurn(user),
|
|
1999
|
+
recordUsage: (usage, source, model) => self.recordUsage(usage, source, model),
|
|
2000
|
+
respondToToolApproval: (id, ok) => self.respondToToolApproval(id, ok),
|
|
2001
|
+
runCouncilV2: (msg, opts) => self.runCouncilV2(msg, opts),
|
|
2002
|
+
processMessage: (msg, obs, imgs) => self.processMessage(msg, obs, imgs),
|
|
2003
|
+
processMessageBatchTurn: (args) => self.processMessageBatchTurn(args),
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
// ========================================================================
|
|
2007
|
+
// processMessage body extracted into MessageProcessor (Phase 12.4).
|
|
2008
|
+
// The single original implementation now lives in
|
|
2009
|
+
// `src/orchestrator/message-processor.ts`. The thin wrapper above is the
|
|
2010
|
+
// only entry point.
|
|
2011
|
+
// ========================================================================
|
|
2012
|
+
// ========================================================================
|
|
2013
|
+
// Private helper methods — summary, estimation, verify
|
|
2014
|
+
// ========================================================================
|
|
2015
|
+
_buildRecentTurnsSummary() {
|
|
2016
|
+
if (this.messages.length < 2)
|
|
2017
|
+
return null;
|
|
2018
|
+
const recent = this.messages.slice(-6);
|
|
2019
|
+
const parts = [];
|
|
2020
|
+
for (const msg of recent) {
|
|
2021
|
+
if (msg.role !== "user" && msg.role !== "assistant")
|
|
2022
|
+
continue;
|
|
2023
|
+
const text = typeof msg.content === "string"
|
|
2024
|
+
? msg.content
|
|
2025
|
+
: Array.isArray(msg.content)
|
|
2026
|
+
? msg.content
|
|
2027
|
+
.filter((p) => p.type === "text")
|
|
2028
|
+
.map((p) => p.text ?? "")
|
|
2029
|
+
.join("")
|
|
2030
|
+
: "";
|
|
2031
|
+
if (!text)
|
|
2032
|
+
continue;
|
|
2033
|
+
const snippet = text.length > 80 ? `${text.slice(0, 77)}...` : text;
|
|
2034
|
+
parts.push(`[${msg.role}]: ${snippet}`);
|
|
2035
|
+
}
|
|
2036
|
+
return parts.length > 0 ? parts.join(" | ") : null;
|
|
2037
|
+
}
|
|
2038
|
+
_estimateProjectSize() {
|
|
2039
|
+
try {
|
|
2040
|
+
const fs = require("fs");
|
|
2041
|
+
const path = require("path");
|
|
2042
|
+
const cwd = this.bash.getCwd();
|
|
2043
|
+
const srcDir = path.join(cwd, "src");
|
|
2044
|
+
if (!fs.existsSync(srcDir))
|
|
2045
|
+
return null;
|
|
2046
|
+
let count = 0;
|
|
2047
|
+
const walk = (dir) => {
|
|
2048
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
2049
|
+
if (entry.name === "node_modules" || entry.name === ".git")
|
|
2050
|
+
continue;
|
|
2051
|
+
if (entry.isDirectory())
|
|
2052
|
+
walk(path.join(dir, entry.name));
|
|
2053
|
+
else if (/\.(ts|tsx|js|jsx|py|go|rs)$/.test(entry.name))
|
|
2054
|
+
count++;
|
|
2055
|
+
if (count > 200)
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
walk(srcDir);
|
|
2060
|
+
if (count <= 20)
|
|
2061
|
+
return "small";
|
|
2062
|
+
if (count <= 100)
|
|
2063
|
+
return "medium";
|
|
2064
|
+
return "large";
|
|
2065
|
+
}
|
|
2066
|
+
catch {
|
|
2067
|
+
return null;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
_countFilesTouched() {
|
|
2071
|
+
let count = 0;
|
|
2072
|
+
for (const msg of this.messages) {
|
|
2073
|
+
if (msg.role !== "assistant" || !Array.isArray(msg.content))
|
|
2074
|
+
continue;
|
|
2075
|
+
for (const part of msg.content) {
|
|
2076
|
+
if (part.type === "tool-call") {
|
|
2077
|
+
const tc = part;
|
|
2078
|
+
if (tc.toolName === "write_file" || tc.toolName === "edit_file" || tc.toolName === "bash")
|
|
2079
|
+
count++;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
return count;
|
|
2084
|
+
}
|
|
2085
|
+
requireProvider() {
|
|
2086
|
+
if (!this.provider) {
|
|
2087
|
+
throw new Error("API key required. Add an API key to continue.");
|
|
2088
|
+
}
|
|
2089
|
+
return this.provider;
|
|
2090
|
+
}
|
|
2091
|
+
/**
|
|
2092
|
+
* One-shot async init: upgrades the OpenAI provider to use OAuth tokens when
|
|
2093
|
+
* stored tokens are available and no explicit API key was supplied by the user.
|
|
2094
|
+
* Called at the start of processMessage so the first real LLM call benefits
|
|
2095
|
+
* from OAuth without requiring a sync constructor change.
|
|
2096
|
+
*
|
|
2097
|
+
* Idempotent: skips on second call and for non-OpenAI providers.
|
|
2098
|
+
* Fail-open: any error leaves the existing provider untouched.
|
|
2099
|
+
*/
|
|
2100
|
+
async _initOAuthProvider() {
|
|
2101
|
+
if (this._oauthInitDone)
|
|
2102
|
+
return;
|
|
2103
|
+
this._oauthInitDone = true;
|
|
2104
|
+
// Only upgrade when there is no explicit API key — OAuth is an alternative
|
|
2105
|
+
// auth path, not an override when the user deliberately passed a key.
|
|
2106
|
+
// The boot wizard in src/index.ts uses the literal "oauth" as a sentinel
|
|
2107
|
+
// to signal "no API key but OAuth tokens exist", so treat that as "no
|
|
2108
|
+
// key" here.
|
|
2109
|
+
if (this.apiKey && this.apiKey !== "oauth")
|
|
2110
|
+
return;
|
|
2111
|
+
try {
|
|
2112
|
+
const { listOAuthProviderIds } = await import("../providers/auth/registry.js");
|
|
2113
|
+
const ids = await listOAuthProviderIds();
|
|
2114
|
+
if (!ids.includes(this.providerId))
|
|
2115
|
+
return;
|
|
2116
|
+
const effectiveBaseURL = this.baseURL &&
|
|
2117
|
+
this.baseURL !== (await import("../providers/endpoints.js").then((m) => m.apiBaseFor("anthropic")))
|
|
2118
|
+
? this.baseURL
|
|
2119
|
+
: undefined;
|
|
2120
|
+
const result = await createProviderFactoryAsync(this.providerId, {
|
|
2121
|
+
baseURL: effectiveBaseURL ?? undefined,
|
|
2122
|
+
});
|
|
2123
|
+
this.provider = result.factory;
|
|
2124
|
+
}
|
|
2125
|
+
catch {
|
|
2126
|
+
// Fail-open — provider remains null; requireProvider() will surface the error
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
async detectVerifyRecipe(settings, abortSignal) {
|
|
2130
|
+
try {
|
|
2131
|
+
const result = await this.runTaskRequest({
|
|
2132
|
+
agent: "verify-detect",
|
|
2133
|
+
description: "Detect verification recipe",
|
|
2134
|
+
prompt: buildVerifyDetectPrompt(this.bash.getCwd(), settings ?? this.bash.getSandboxSettings()),
|
|
2135
|
+
}, undefined, abortSignal);
|
|
2136
|
+
if (!result.success || !result.output)
|
|
2137
|
+
return null;
|
|
2138
|
+
const maybeJson = extractJsonObject(result.output);
|
|
2139
|
+
if (!maybeJson)
|
|
2140
|
+
return null;
|
|
2141
|
+
return normalizeVerifyRecipe(JSON.parse(maybeJson));
|
|
2142
|
+
}
|
|
2143
|
+
catch {
|
|
2144
|
+
return null;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
async runVerify(onProgress, abortSignal) {
|
|
2148
|
+
this.abortController = new AbortController();
|
|
2149
|
+
const signal = abortSignal ?? this.abortController.signal;
|
|
2150
|
+
const userModelMessage = { role: "user", content: "/verify" };
|
|
2151
|
+
this.messages.push(userModelMessage);
|
|
2152
|
+
this.messageSeqs.push(null);
|
|
2153
|
+
try {
|
|
2154
|
+
await this.consumeBackgroundNotifications();
|
|
2155
|
+
const result = await runVerifyOrchestration(this, { onProgress, abortSignal: signal });
|
|
2156
|
+
const assistantText = result.output || result.error || "Verification completed.";
|
|
2157
|
+
this.appendCompletedTurn(userModelMessage, [{ role: "assistant", content: assistantText }]);
|
|
2158
|
+
return result;
|
|
2159
|
+
}
|
|
2160
|
+
catch (err) {
|
|
2161
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2162
|
+
const failureText = signal.aborted ? "Verification aborted." : `Verification failed: ${msg}`;
|
|
2163
|
+
this.appendCompletedTurn(userModelMessage, [{ role: "assistant", content: failureText }]);
|
|
2164
|
+
return { success: false, output: failureText };
|
|
2165
|
+
}
|
|
2166
|
+
finally {
|
|
2167
|
+
if (this.abortController?.signal === signal) {
|
|
2168
|
+
this.abortController = null;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
//# sourceMappingURL=orchestrator.js.map
|