muonroi-cli 1.3.4 → 1.4.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/LICENSE +21 -21
- package/README.md +122 -122
- package/dist/packages/agent-harness-core/src/predicate.d.ts +2 -2
- package/dist/packages/agent-harness-core/src/protocol.d.ts +8 -0
- package/dist/src/__test-helpers__/catalog-fixtures.d.ts +22 -0
- package/dist/src/__test-helpers__/catalog-fixtures.js +55 -0
- package/dist/src/agent-harness/index.js +1 -1
- package/dist/src/agent-harness/mock-model.d.ts +5 -0
- package/dist/src/agent-harness/mock-model.js +68 -23
- package/dist/src/agent-harness/test-spawn.d.ts +7 -1
- package/dist/src/agent-harness/test-spawn.js +19 -4
- package/dist/src/chat/__tests__/broadcast-bus.test.js +2 -2
- package/dist/src/chat/__tests__/client.test.js +1 -1
- package/dist/src/chat/broadcast-bus.js +2 -2
- package/dist/src/chat/chat-keychain.js +11 -2
- package/dist/src/chat/providers/discord/client.d.ts +1 -1
- package/dist/src/chat/providers/discord/client.js +1 -1
- package/dist/src/cli/config/screen-council.js +1 -1
- package/dist/src/cli/config/screen-models.js +2 -2
- package/dist/src/cli/config/screen-providers.js +2 -2
- package/dist/src/cli/config/tui.js +1 -1
- package/dist/src/cli/cost-forensics.d.ts +31 -0
- package/dist/src/cli/cost-forensics.js +58 -12
- package/dist/src/cli/cost-forensics.test.js +125 -2
- package/dist/src/cli/keys.d.ts +5 -1
- package/dist/src/cli/keys.js +48 -20
- package/dist/src/cli/keys.test.js +1 -1
- package/dist/src/cli/reporter-cmd.d.ts +15 -0
- package/dist/src/cli/reporter-cmd.js +120 -0
- package/dist/src/cli/usage-report.d.ts +38 -1
- package/dist/src/cli/usage-report.js +133 -0
- package/dist/src/council/__tests__/audit-replay.test.js +1 -1
- package/dist/src/council/__tests__/clarifier-max-rounds.test.js +5 -5
- package/dist/src/council/__tests__/clarifier-ready-gate.test.js +233 -0
- package/dist/src/council/__tests__/debate-planner-structured.test.js +2 -2
- package/dist/src/council/__tests__/decisions-lock.test.d.ts +6 -0
- package/dist/src/council/__tests__/decisions-lock.test.js +336 -0
- package/dist/src/council/__tests__/tool-trace.test.js +2 -2
- package/dist/src/council/clarifier.d.ts +19 -2
- package/dist/src/council/clarifier.js +84 -6
- package/dist/src/council/context.js +3 -3
- package/dist/src/council/debate-planner.d.ts +1 -1
- package/dist/src/council/debate-planner.js +40 -7
- package/dist/src/council/debate.js +1 -1
- package/dist/src/council/decisions-lock.d.ts +76 -0
- package/dist/src/council/decisions-lock.js +239 -0
- package/dist/src/council/index.d.ts +5 -0
- package/dist/src/council/index.js +50 -18
- package/dist/src/council/leader.d.ts +1 -1
- package/dist/src/council/leader.js +14 -1
- package/dist/src/council/llm.js +33 -61
- package/dist/src/council/phase-events.d.ts +5 -0
- package/dist/src/council/phase-events.js +1 -0
- package/dist/src/council/planner.js +1 -1
- package/dist/src/council/prompts.d.ts +24 -0
- package/dist/src/council/prompts.js +112 -22
- package/dist/src/council/types.d.ts +18 -0
- package/dist/src/ee/__tests__/export-transcripts.test.d.ts +11 -0
- package/dist/src/ee/__tests__/export-transcripts.test.js +200 -0
- package/dist/src/ee/__tests__/recall-format.test.d.ts +10 -0
- package/dist/src/ee/__tests__/recall-format.test.js +57 -0
- package/dist/src/ee/__tests__/recall-ledger.test.d.ts +1 -0
- package/dist/src/ee/__tests__/recall-ledger.test.js +45 -0
- package/dist/src/ee/auth.test.js +2 -2
- package/dist/src/ee/client.js +59 -0
- package/dist/src/ee/client.test.js +30 -0
- package/dist/src/ee/council-bridge.js +3 -3
- package/dist/src/ee/export-transcripts.d.ts +26 -0
- package/dist/src/ee/export-transcripts.js +115 -0
- package/dist/src/ee/intercept.d.ts +9 -0
- package/dist/src/ee/intercept.js +19 -0
- package/dist/src/ee/offline-queue.test.js +3 -3
- package/dist/src/ee/phase-tracker.js +1 -1
- package/dist/src/ee/recall-ledger.d.ts +32 -0
- package/dist/src/ee/recall-ledger.js +52 -0
- package/dist/src/ee/recall-mirror.test.d.ts +1 -0
- package/dist/src/ee/recall-mirror.test.js +65 -0
- package/dist/src/ee/scope.js +1 -1
- package/dist/src/ee/scope.test.js +1 -1
- package/dist/src/ee/search.d.ts +99 -0
- package/dist/src/ee/search.js +220 -0
- package/dist/src/ee/session-trajectory.js +1 -1
- package/dist/src/ee/session-trajectory.test.js +1 -1
- package/dist/src/ee/transcript-emit.d.ts +51 -0
- package/dist/src/ee/transcript-emit.js +140 -0
- package/dist/src/ee/types.d.ts +37 -1
- package/dist/src/flow/__tests__/migration.test.js +1 -1
- package/dist/src/flow/__tests__/run-manager-product.test.js +1 -1
- package/dist/src/flow/__tests__/run-manager.test.js +1 -1
- package/dist/src/flow/__tests__/scaffold-checkpoint.test.js +2 -2
- package/dist/src/flow/__tests__/scaffold.test.js +1 -1
- package/dist/src/flow/__tests__/warning-persist.test.js +1 -1
- package/dist/src/generated/version.d.ts +1 -1
- package/dist/src/generated/version.js +1 -1
- package/dist/src/gsd/__tests__/directives.test.js +35 -0
- package/dist/src/gsd/__tests__/types.test.js +14 -1
- package/dist/src/gsd/directives.d.ts +10 -0
- package/dist/src/gsd/directives.js +38 -2
- package/dist/src/gsd/gray-areas.js +1 -1
- package/dist/src/gsd/types.d.ts +1 -1
- package/dist/src/gsd/types.js +20 -6
- package/dist/src/headless/__tests__/council-answers.test.js +26 -1
- package/dist/src/headless/council-answers.d.ts +17 -2
- package/dist/src/headless/council-answers.js +21 -0
- package/dist/src/hooks/index.js +74 -49
- package/dist/src/index.js +180 -16
- package/dist/src/lsp/builtins.js +44 -0
- package/dist/src/lsp/builtins.test.js +22 -1
- package/dist/src/lsp/manager.js +40 -9
- package/dist/src/lsp/manager.test.js +23 -1
- package/dist/src/lsp/npm-cache.js +2 -1
- package/dist/src/lsp/npm-cache.test.js +1 -1
- package/dist/src/lsp/smoke.test.js +1 -1
- package/dist/src/lsp/types.d.ts +3 -1
- package/dist/src/maintain/__tests__/codebase-intel.test.d.ts +5 -0
- package/dist/src/maintain/__tests__/codebase-intel.test.js +237 -0
- package/dist/src/maintain/__tests__/gh-create-pr.test.d.ts +11 -0
- package/dist/src/maintain/__tests__/gh-create-pr.test.js +156 -0
- package/dist/src/maintain/__tests__/pr-builder.test.d.ts +10 -0
- package/dist/src/maintain/__tests__/pr-builder.test.js +225 -0
- package/dist/src/maintain/__tests__/repo-map.test.d.ts +5 -0
- package/dist/src/maintain/__tests__/repo-map.test.js +90 -0
- package/dist/src/maintain/__tests__/task-runner.test.d.ts +11 -0
- package/dist/src/maintain/__tests__/task-runner.test.js +281 -0
- package/dist/src/maintain/codebase-intel.d.ts +22 -0
- package/dist/src/maintain/codebase-intel.js +548 -0
- package/dist/src/maintain/gh-create-pr.d.ts +24 -0
- package/dist/src/maintain/gh-create-pr.js +111 -0
- package/dist/src/maintain/index.d.ts +12 -0
- package/dist/src/maintain/index.js +10 -0
- package/dist/src/maintain/pr-builder.d.ts +35 -0
- package/dist/src/maintain/pr-builder.js +305 -0
- package/dist/src/maintain/repo-map.d.ts +25 -0
- package/dist/src/maintain/repo-map.js +189 -0
- package/dist/src/maintain/task-runner.d.ts +45 -0
- package/dist/src/maintain/task-runner.js +401 -0
- package/dist/src/maintain/types.d.ts +45 -0
- package/dist/src/maintain/types.js +7 -0
- package/dist/src/mcp/__tests__/auto-setup.test.js +1 -1
- package/dist/src/mcp/__tests__/cap-tool-result.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/cap-tool-result.test.js +58 -0
- package/dist/src/mcp/__tests__/ee-tools.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/ee-tools.test.js +198 -0
- package/dist/src/mcp/__tests__/forensics-tools.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/forensics-tools.test.js +53 -0
- package/dist/src/mcp/__tests__/harness-driver-action-tools.spec.js +3 -1
- package/dist/src/mcp/__tests__/harness-driver-async-tools.spec.js +3 -1
- package/dist/src/mcp/__tests__/lsp-tools.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/lsp-tools.test.js +56 -0
- package/dist/src/mcp/__tests__/runtime-output-cap.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/runtime-output-cap.test.js +42 -0
- package/dist/src/mcp/__tests__/self-verify-jobs.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/self-verify-jobs.test.js +92 -0
- package/dist/src/mcp/__tests__/smart-filter.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/smart-filter.test.js +121 -0
- package/dist/src/mcp/__tests__/tools-server.smoke.test.d.ts +1 -0
- package/dist/src/mcp/__tests__/tools-server.smoke.test.js +42 -0
- package/dist/src/mcp/cap-tool-result.d.ts +1 -0
- package/dist/src/mcp/cap-tool-result.js +35 -0
- package/dist/src/mcp/ee-tools.d.ts +36 -0
- package/dist/src/mcp/ee-tools.js +159 -0
- package/dist/src/mcp/forensics-tools.d.ts +13 -0
- package/dist/src/mcp/forensics-tools.js +52 -0
- package/dist/src/mcp/lsp-tools.d.ts +16 -0
- package/dist/src/mcp/lsp-tools.js +65 -0
- package/dist/src/mcp/mcp-keychain.js +11 -2
- package/dist/src/mcp/oauth-callback.js +2 -2
- package/dist/src/mcp/opentui-spawn.js +1 -1
- package/dist/src/mcp/parse-headers.test.js +14 -14
- package/dist/src/mcp/runtime.js +11 -0
- package/dist/src/mcp/self-verify-jobs.d.ts +55 -0
- package/dist/src/mcp/self-verify-jobs.js +86 -0
- package/dist/src/mcp/smart-filter.d.ts +48 -0
- package/dist/src/mcp/smart-filter.js +115 -0
- package/dist/src/mcp/smoke.test.js +44 -44
- package/dist/src/mcp/tools-server.d.ts +14 -0
- package/dist/src/mcp/tools-server.js +147 -0
- package/dist/src/models/catalog-client.d.ts +22 -0
- package/dist/src/models/catalog-client.js +95 -9
- package/dist/src/models/catalog-gemini.test.d.ts +1 -0
- package/dist/src/models/catalog-gemini.test.js +46 -0
- package/dist/src/models/catalog-url.test.d.ts +1 -0
- package/dist/src/models/catalog-url.test.js +26 -0
- package/dist/src/models/catalog-validation.test.d.ts +1 -0
- package/dist/src/models/catalog-validation.test.js +63 -0
- package/dist/src/models/catalog.json +349 -177
- package/dist/src/models/classify-tier.d.ts +1 -1
- package/dist/src/models/classify-tier.js +1 -1
- package/dist/src/models/registry.d.ts +2 -0
- package/dist/src/models/registry.js +9 -0
- package/dist/src/ops/__tests__/doctor-ee-health.test.js +1 -1
- package/dist/src/ops/doctor.js +7 -7
- package/dist/src/orchestrator/__tests__/agent-base-url-switch.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/agent-base-url-switch.test.js +77 -0
- package/dist/src/orchestrator/__tests__/batch-turn-runner.test.js +10 -3
- package/dist/src/orchestrator/__tests__/cross-turn-dedup.test.js +38 -16
- package/dist/src/orchestrator/__tests__/error-forensics.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/error-forensics.test.js +93 -0
- package/dist/src/orchestrator/__tests__/flow-resume.test.js +1 -1
- package/dist/src/orchestrator/__tests__/humanize-api-error.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/humanize-api-error.test.js +68 -0
- package/dist/src/orchestrator/__tests__/message-processor.test.js +6 -1
- package/dist/src/orchestrator/__tests__/read-path-budget.test.js +62 -4
- package/dist/src/orchestrator/__tests__/retry-classifier.test.js +10 -0
- package/dist/src/orchestrator/__tests__/stream-runner.test.js +77 -4
- package/dist/src/orchestrator/__tests__/sub-agent-model-tier.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/sub-agent-model-tier.test.js +45 -0
- package/dist/src/orchestrator/__tests__/usage-shape-threading.test.d.ts +1 -0
- package/dist/src/orchestrator/__tests__/usage-shape-threading.test.js +98 -0
- package/dist/src/orchestrator/agent.test.js +33 -18
- package/dist/src/orchestrator/batch-turn-runner.d.ts +1 -1
- package/dist/src/orchestrator/batch-turn-runner.js +3 -2
- package/dist/src/orchestrator/compaction.js +99 -87
- package/dist/src/orchestrator/compaction.test.js +17 -0
- package/dist/src/orchestrator/council-manager.d.ts +1 -1
- package/dist/src/orchestrator/council-manager.js +3 -10
- package/dist/src/orchestrator/cross-turn-dedup.js +21 -1
- package/dist/src/orchestrator/delegations.js +7 -1
- package/dist/src/orchestrator/delegations.test.js +1 -1
- package/dist/src/orchestrator/error-utils.d.ts +27 -1
- package/dist/src/orchestrator/error-utils.js +63 -1
- package/dist/src/orchestrator/grounding-check.d.ts +50 -0
- package/dist/src/orchestrator/grounding-check.js +123 -0
- package/dist/src/orchestrator/grounding-check.test.d.ts +1 -0
- package/dist/src/orchestrator/grounding-check.test.js +94 -0
- package/dist/src/orchestrator/interrupted-turn.d.ts +19 -0
- package/dist/src/orchestrator/interrupted-turn.js +28 -0
- package/dist/src/orchestrator/interrupted-turn.test.d.ts +1 -0
- package/dist/src/orchestrator/interrupted-turn.test.js +34 -0
- package/dist/src/orchestrator/message-processor.d.ts +11 -10
- package/dist/src/orchestrator/message-processor.js +1367 -93
- package/dist/src/orchestrator/orchestrator.d.ts +7 -3
- package/dist/src/orchestrator/orchestrator.js +158 -43
- package/dist/src/orchestrator/pending-calls.test.js +1 -1
- package/dist/src/orchestrator/prompts.d.ts +1 -1
- package/dist/src/orchestrator/prompts.js +237 -154
- package/dist/src/orchestrator/read-path-budget.d.ts +22 -2
- package/dist/src/orchestrator/read-path-budget.js +96 -18
- package/dist/src/orchestrator/reasoning.js +43 -1
- package/dist/src/orchestrator/reasoning.test.js +75 -0
- package/dist/src/orchestrator/repair-tool-call.d.ts +32 -0
- package/dist/src/orchestrator/repair-tool-call.js +50 -0
- package/dist/src/orchestrator/repetition-detector.d.ts +58 -0
- package/dist/src/orchestrator/repetition-detector.js +126 -0
- package/dist/src/orchestrator/repetition-detector.test.d.ts +1 -0
- package/dist/src/orchestrator/repetition-detector.test.js +103 -0
- package/dist/src/orchestrator/retry-classifier.js +8 -0
- package/dist/src/orchestrator/sandbox.test.js +3 -1
- package/dist/src/orchestrator/scope-ceiling.d.ts +86 -0
- package/dist/src/orchestrator/scope-ceiling.js +161 -0
- package/dist/src/orchestrator/scope-ceiling.test.d.ts +13 -0
- package/dist/src/orchestrator/scope-ceiling.test.js +181 -0
- package/dist/src/orchestrator/scope-reminder.d.ts +102 -0
- package/dist/src/orchestrator/scope-reminder.js +221 -0
- package/dist/src/orchestrator/scope-reminder.test.d.ts +15 -0
- package/dist/src/orchestrator/scope-reminder.test.js +204 -0
- package/dist/src/orchestrator/stall-rescue.d.ts +67 -0
- package/dist/src/orchestrator/stall-rescue.js +72 -0
- package/dist/src/orchestrator/stall-rescue.test.d.ts +1 -0
- package/dist/src/orchestrator/stall-rescue.test.js +88 -0
- package/dist/src/orchestrator/stall-watchdog.d.ts +34 -0
- package/dist/src/orchestrator/stall-watchdog.js +72 -0
- package/dist/src/orchestrator/stall-watchdog.test.d.ts +1 -0
- package/dist/src/orchestrator/stall-watchdog.test.js +73 -0
- package/dist/src/orchestrator/stream-runner.d.ts +18 -2
- package/dist/src/orchestrator/stream-runner.js +248 -77
- package/dist/src/orchestrator/sub-agent-cap.js +21 -1
- package/dist/src/orchestrator/sub-agent-cap.test.js +41 -3
- package/dist/src/orchestrator/sub-agent-model-tier.d.ts +13 -0
- package/dist/src/orchestrator/sub-agent-model-tier.js +45 -0
- package/dist/src/orchestrator/subagent-compactor.d.ts +49 -0
- package/dist/src/orchestrator/subagent-compactor.js +184 -11
- package/dist/src/orchestrator/subagent-compactor.spec.js +187 -2
- package/dist/src/orchestrator/text-tool-call-detector.d.ts +61 -0
- package/dist/src/orchestrator/text-tool-call-detector.js +163 -0
- package/dist/src/orchestrator/text-tool-call-detector.test.d.ts +1 -0
- package/dist/src/orchestrator/text-tool-call-detector.test.js +89 -0
- package/dist/src/orchestrator/tool-args-hash.d.ts +51 -0
- package/dist/src/orchestrator/tool-args-hash.js +219 -0
- package/dist/src/orchestrator/tool-args-hash.test.d.ts +1 -0
- package/dist/src/orchestrator/tool-args-hash.test.js +105 -0
- package/dist/src/orchestrator/tool-args-repair.d.ts +93 -0
- package/dist/src/orchestrator/tool-args-repair.js +219 -0
- package/dist/src/orchestrator/tool-args-repair.test.d.ts +1 -0
- package/dist/src/orchestrator/tool-args-repair.test.js +136 -0
- package/dist/src/orchestrator/tool-loop-cap.d.ts +66 -0
- package/dist/src/orchestrator/tool-loop-cap.js +138 -0
- package/dist/src/orchestrator/tool-loop-cap.test.d.ts +1 -0
- package/dist/src/orchestrator/tool-loop-cap.test.js +176 -0
- package/dist/src/orchestrator/tool-repetition-detector.d.ts +64 -0
- package/dist/src/orchestrator/tool-repetition-detector.js +0 -0
- package/dist/src/orchestrator/tool-repetition-detector.test.d.ts +1 -0
- package/dist/src/orchestrator/tool-repetition-detector.test.js +101 -0
- package/dist/src/orchestrator/turn-runner-deps.d.ts +3 -1
- package/dist/src/pil/__tests__/clarity-gate.test.d.ts +1 -0
- package/dist/src/pil/__tests__/clarity-gate.test.js +228 -0
- package/dist/src/pil/__tests__/config.test.js +44 -1
- package/dist/src/pil/__tests__/discovery-cache.test.d.ts +1 -0
- package/dist/src/pil/__tests__/discovery-cache.test.js +38 -0
- package/dist/src/pil/__tests__/discovery-types.test.d.ts +1 -0
- package/dist/src/pil/__tests__/discovery-types.test.js +54 -0
- package/dist/src/pil/__tests__/discovery.test.d.ts +1 -0
- package/dist/src/pil/__tests__/discovery.test.js +101 -0
- package/dist/src/pil/__tests__/layer1-intent-trace.test.js +5 -3
- package/dist/src/pil/__tests__/layer1-intent.test.js +25 -7
- package/dist/src/pil/__tests__/layer15-context-scan.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer15-context-scan.test.js +64 -0
- package/dist/src/pil/__tests__/layer16-clarity.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer16-clarity.test.js +153 -0
- package/dist/src/pil/__tests__/layer17-feasibility.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer17-feasibility.test.js +36 -0
- package/dist/src/pil/__tests__/layer18-acceptance.test.d.ts +1 -0
- package/dist/src/pil/__tests__/layer18-acceptance.test.js +95 -0
- package/dist/src/pil/__tests__/layer3-ee-injection.test.js +4 -1
- package/dist/src/pil/__tests__/layer3-injected-chunk.test.js +3 -3
- package/dist/src/pil/__tests__/layer6-output.test.js +69 -9
- package/dist/src/pil/__tests__/llm-classify.test.d.ts +1 -0
- package/dist/src/pil/__tests__/llm-classify.test.js +113 -0
- package/dist/src/pil/__tests__/native-capabilities-workbook.test.d.ts +1 -0
- package/dist/src/pil/__tests__/native-capabilities-workbook.test.js +40 -0
- package/dist/src/pil/__tests__/pipeline.test.js +3 -2
- package/dist/src/pil/__tests__/renderer-coverage.test.js +1 -1
- package/dist/src/pil/__tests__/response-tools.test.js +49 -1
- package/dist/src/pil/__tests__/scoreComplexity.test.js +2 -2
- package/dist/src/pil/agent-operating-contract.d.ts +51 -0
- package/dist/src/pil/agent-operating-contract.js +66 -0
- package/dist/src/pil/agent-operating-contract.test.d.ts +1 -0
- package/dist/src/pil/agent-operating-contract.test.js +75 -0
- package/dist/src/pil/budget-log.js +1 -1
- package/dist/src/pil/cheap-model-playbook.d.ts +80 -0
- package/dist/src/pil/cheap-model-playbook.js +147 -0
- package/dist/src/pil/cheap-model-playbook.test.d.ts +1 -0
- package/dist/src/pil/cheap-model-playbook.test.js +160 -0
- package/dist/src/pil/cheap-model-workbooks.d.ts +55 -0
- package/dist/src/pil/cheap-model-workbooks.js +102 -0
- package/dist/src/pil/cheap-model-workbooks.test.d.ts +1 -0
- package/dist/src/pil/cheap-model-workbooks.test.js +129 -0
- package/dist/src/pil/clarity-gate.d.ts +22 -0
- package/dist/src/pil/clarity-gate.js +162 -0
- package/dist/src/pil/config.d.ts +3 -0
- package/dist/src/pil/config.js +11 -0
- package/dist/src/pil/discovery-cache.d.ts +4 -0
- package/dist/src/pil/discovery-cache.js +18 -0
- package/dist/src/pil/discovery-types.d.ts +94 -0
- package/dist/src/pil/discovery-types.js +2 -0
- package/dist/src/pil/discovery.d.ts +18 -0
- package/dist/src/pil/discovery.js +341 -0
- package/dist/src/pil/index.d.ts +3 -1
- package/dist/src/pil/index.js +2 -1
- package/dist/src/pil/layer1-intent.d.ts +37 -1
- package/dist/src/pil/layer1-intent.js +675 -39
- package/dist/src/pil/layer1-intent.test.js +333 -1
- package/dist/src/pil/layer15-context-scan.d.ts +9 -0
- package/dist/src/pil/layer15-context-scan.js +164 -0
- package/dist/src/pil/layer16-clarity.d.ts +19 -0
- package/dist/src/pil/layer16-clarity.js +394 -0
- package/dist/src/pil/layer16-clarity.test.d.ts +1 -0
- package/dist/src/pil/layer16-clarity.test.js +31 -0
- package/dist/src/pil/layer17-feasibility.d.ts +4 -0
- package/dist/src/pil/layer17-feasibility.js +30 -0
- package/dist/src/pil/layer18-acceptance.d.ts +4 -0
- package/dist/src/pil/layer18-acceptance.js +84 -0
- package/dist/src/pil/layer1_5-complexity-size.d.ts +23 -0
- package/dist/src/pil/layer1_5-complexity-size.js +152 -0
- package/dist/src/pil/layer1_5-complexity-size.test.d.ts +10 -0
- package/dist/src/pil/layer1_5-complexity-size.test.js +248 -0
- package/dist/src/pil/layer3-ee-injection.js +63 -6
- package/dist/src/pil/layer4-gsd.js +7 -1
- package/dist/src/pil/layer5-context.js +15 -5
- package/dist/src/pil/layer6-output.d.ts +2 -0
- package/dist/src/pil/layer6-output.js +110 -18
- package/dist/src/pil/llm-classify.d.ts +16 -0
- package/dist/src/pil/llm-classify.js +179 -0
- package/dist/src/pil/native-capabilities-workbook.d.ts +39 -0
- package/dist/src/pil/native-capabilities-workbook.js +112 -0
- package/dist/src/pil/pipeline.d.ts +21 -0
- package/dist/src/pil/pipeline.js +89 -13
- package/dist/src/pil/response-tools.d.ts +56 -0
- package/dist/src/pil/response-tools.js +76 -2
- package/dist/src/pil/schema.d.ts +10 -1
- package/dist/src/pil/schema.js +8 -0
- package/dist/src/pil/session-state.d.ts +44 -0
- package/dist/src/pil/session-state.js +143 -0
- package/dist/src/pil/session-state.test.d.ts +1 -0
- package/dist/src/pil/session-state.test.js +73 -0
- package/dist/src/pil/task-tier-map.d.ts +6 -1
- package/dist/src/pil/task-tier-map.js +13 -6
- package/dist/src/pil/types.d.ts +18 -0
- package/dist/src/product-loop/__tests__/artifact-io.test.js +1 -1
- package/dist/src/product-loop/__tests__/assumption-ledger.test.js +1 -1
- package/dist/src/product-loop/__tests__/backlog-builder.test.d.ts +10 -0
- package/dist/src/product-loop/__tests__/backlog-builder.test.js +175 -0
- package/dist/src/product-loop/__tests__/backlog-store.test.d.ts +4 -0
- package/dist/src/product-loop/__tests__/backlog-store.test.js +96 -0
- package/dist/src/product-loop/__tests__/cb2-retry-bonus.test.js +1 -1
- package/dist/src/product-loop/__tests__/complexity-routing.spec.js +113 -7
- package/dist/src/product-loop/__tests__/context-policy.test.js +3 -3
- package/dist/src/product-loop/__tests__/cost-scoper.test.js +1 -1
- package/dist/src/product-loop/__tests__/discovery-context-format.test.d.ts +13 -0
- package/dist/src/product-loop/__tests__/discovery-context-format.test.js +100 -0
- package/dist/src/product-loop/__tests__/discovery-ecosystem.test.js +100 -1
- package/dist/src/product-loop/__tests__/discovery-prompt-specificity.test.d.ts +1 -0
- package/dist/src/product-loop/__tests__/discovery-prompt-specificity.test.js +55 -0
- package/dist/src/product-loop/__tests__/discovery-recommender-ecosystem.test.js +92 -0
- package/dist/src/product-loop/__tests__/ee-extract-wiring.test.js +8 -3
- package/dist/src/product-loop/__tests__/extract-to-ee.test.js +2 -2
- package/dist/src/product-loop/__tests__/gather-selectable-alts.test.d.ts +15 -0
- package/dist/src/product-loop/__tests__/gather-selectable-alts.test.js +109 -0
- package/dist/src/product-loop/__tests__/integration.test.js +7 -2
- package/dist/src/product-loop/__tests__/loop-driver-audit.test.js +7 -2
- package/dist/src/product-loop/__tests__/loop-driver.test.js +7 -2
- package/dist/src/product-loop/__tests__/maintenance-task-synthesis.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/maintenance-task-synthesis.test.js +67 -0
- package/dist/src/product-loop/__tests__/phase-a1-a3-sprint-runner.test.d.ts +13 -0
- package/dist/src/product-loop/__tests__/phase-a1-a3-sprint-runner.test.js +268 -0
- package/dist/src/product-loop/__tests__/phase-a2-backlog-build.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/phase-a2-backlog-build.test.js +162 -0
- package/dist/src/product-loop/__tests__/phase-rituals.test.js +1 -1
- package/dist/src/product-loop/__tests__/pick-backend-stack.test.d.ts +11 -0
- package/dist/src/product-loop/__tests__/pick-backend-stack.test.js +95 -0
- package/dist/src/product-loop/__tests__/progress-snapshot.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/progress-snapshot.test.js +152 -0
- package/dist/src/product-loop/__tests__/repo-audit.test.js +1 -1
- package/dist/src/product-loop/__tests__/repo-brief.test.d.ts +9 -0
- package/dist/src/product-loop/__tests__/repo-brief.test.js +132 -0
- package/dist/src/product-loop/__tests__/route-decision-emit.test.js +51 -2
- package/dist/src/product-loop/__tests__/ship-polish.test.js +1 -1
- package/dist/src/product-loop/__tests__/sprint-planner.test.d.ts +6 -0
- package/dist/src/product-loop/__tests__/sprint-planner.test.js +140 -0
- package/dist/src/product-loop/__tests__/sprint-runner-backlog.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/sprint-runner-backlog.test.js +221 -0
- package/dist/src/product-loop/__tests__/sprint-runner-phase-chunks.test.d.ts +14 -0
- package/dist/src/product-loop/__tests__/sprint-runner-phase-chunks.test.js +193 -0
- package/dist/src/product-loop/__tests__/sprint-self-verify.test.d.ts +8 -0
- package/dist/src/product-loop/__tests__/sprint-self-verify.test.js +73 -0
- package/dist/src/product-loop/__tests__/sprint-store.test.d.ts +7 -0
- package/dist/src/product-loop/__tests__/sprint-store.test.js +84 -0
- package/dist/src/product-loop/__tests__/sufficiency-routing.spec.js +6 -0
- package/dist/src/product-loop/__tests__/types.test.js +7 -7
- package/dist/src/product-loop/__tests__/verify-failure-threshold.test.js +3 -2
- package/dist/src/product-loop/__tests__/verify-failure-tracking.test.js +2 -2
- package/dist/src/product-loop/assumption-ledger.js +6 -6
- package/dist/src/product-loop/backlog-builder.d.ts +32 -0
- package/dist/src/product-loop/backlog-builder.js +198 -0
- package/dist/src/product-loop/backlog-store.d.ts +22 -0
- package/dist/src/product-loop/backlog-store.js +49 -0
- package/dist/src/product-loop/context-policy.js +1 -1
- package/dist/src/product-loop/cost-preview.js +17 -1
- package/dist/src/product-loop/cross-run-memory.js +11 -11
- package/dist/src/product-loop/discover.js +6 -6
- package/dist/src/product-loop/discovery-context-format.d.ts +16 -0
- package/dist/src/product-loop/discovery-context-format.js +45 -13
- package/dist/src/product-loop/discovery-council-runner.js +5 -10
- package/dist/src/product-loop/discovery-detection.js +3 -3
- package/dist/src/product-loop/discovery-ecosystem.d.ts +23 -0
- package/dist/src/product-loop/discovery-ecosystem.js +104 -0
- package/dist/src/product-loop/discovery-interview.d.ts +6 -0
- package/dist/src/product-loop/discovery-interview.js +38 -2
- package/dist/src/product-loop/discovery-recommender.d.ts +29 -0
- package/dist/src/product-loop/discovery-recommender.js +126 -7
- package/dist/src/product-loop/done-gate.js +5 -5
- package/dist/src/product-loop/gather.d.ts +12 -1
- package/dist/src/product-loop/gather.js +93 -12
- package/dist/src/product-loop/index.d.ts +23 -0
- package/dist/src/product-loop/index.js +502 -9
- package/dist/src/product-loop/loop-driver.js +27 -28
- package/dist/src/product-loop/phase-budget.js +2 -2
- package/dist/src/product-loop/progress-snapshot.d.ts +25 -0
- package/dist/src/product-loop/progress-snapshot.js +180 -0
- package/dist/src/product-loop/repo-brief.d.ts +40 -0
- package/dist/src/product-loop/repo-brief.js +212 -0
- package/dist/src/product-loop/role-registry.js +1 -1
- package/dist/src/product-loop/sprint-planner.d.ts +39 -0
- package/dist/src/product-loop/sprint-planner.js +189 -0
- package/dist/src/product-loop/sprint-runner.js +201 -9
- package/dist/src/product-loop/sprint-self-verify.d.ts +54 -0
- package/dist/src/product-loop/sprint-self-verify.js +145 -0
- package/dist/src/product-loop/sprint-store.d.ts +27 -0
- package/dist/src/product-loop/sprint-store.js +81 -0
- package/dist/src/product-loop/typed-artifacts.js +5 -5
- package/dist/src/product-loop/types.d.ts +113 -2
- package/dist/src/product-loop/verify-failure-tracking.js +1 -1
- package/dist/src/providers/__tests__/adapter-oauth-wiring.test.js +18 -2
- package/dist/src/providers/__tests__/capabilities-provider-options.test.js +23 -1
- package/dist/src/providers/__tests__/capabilities-sanitize.test.js +46 -61
- package/dist/src/providers/__tests__/reasoning-roundtrip.test.d.ts +1 -0
- package/dist/src/providers/__tests__/reasoning-roundtrip.test.js +135 -0
- package/dist/src/providers/__tests__/runtime-integration.test.js +19 -12
- package/dist/src/providers/__tests__/runtime.test.js +3 -6
- package/dist/src/providers/__tests__/siliconflow-sse-repair.test.d.ts +1 -0
- package/dist/src/providers/__tests__/siliconflow-sse-repair.test.js +267 -0
- package/dist/src/providers/auth/__tests__/browser-flow.test.js +1 -1
- package/dist/src/providers/auth/__tests__/gemini-oauth.test.js +1 -1
- package/dist/src/providers/auth/__tests__/grok-oauth.test.d.ts +8 -0
- package/dist/src/providers/auth/__tests__/grok-oauth.test.js +236 -0
- package/dist/src/providers/auth/__tests__/token-store.test.js +7 -7
- package/dist/src/providers/auth/gemini-oauth.js +2 -2
- package/dist/src/providers/auth/grok-oauth.d.ts +63 -0
- package/dist/src/providers/auth/grok-oauth.js +341 -0
- package/dist/src/providers/auth/registry.js +17 -0
- package/dist/src/providers/auth/token-store.js +1 -1
- package/dist/src/providers/capabilities.js +9 -15
- package/dist/src/providers/keychain.js +14 -2
- package/dist/src/providers/mcp-vision-bridge.js +49 -49
- package/dist/src/providers/mcp-vision-bridge.test.js +12 -12
- package/dist/src/providers/openai-compatible.js +5 -1
- package/dist/src/providers/pricing.d.ts +7 -4
- package/dist/src/providers/pricing.js +21 -5
- package/dist/src/providers/pricing.test.js +35 -9
- package/dist/src/providers/runtime.d.ts +1 -0
- package/dist/src/providers/runtime.js +39 -13
- package/dist/src/providers/siliconflow-sse-repair.d.ts +58 -0
- package/dist/src/providers/siliconflow-sse-repair.js +177 -0
- package/dist/src/providers/strategies/deepseek.strategy.js +28 -0
- package/dist/src/providers/strategies/siliconflow.strategy.js +2 -0
- package/dist/src/providers/strategies/xai.strategy.js +8 -1
- package/dist/src/providers/wire-debug.js +2 -2
- package/dist/src/reporter/__tests__/acl-check.test.d.ts +6 -0
- package/dist/src/reporter/__tests__/acl-check.test.js +59 -0
- package/dist/src/reporter/__tests__/auto-fire.test.d.ts +10 -0
- package/dist/src/reporter/__tests__/auto-fire.test.js +140 -0
- package/dist/src/reporter/__tests__/budget.test.d.ts +7 -0
- package/dist/src/reporter/__tests__/budget.test.js +60 -0
- package/dist/src/reporter/__tests__/handlers.test.d.ts +7 -0
- package/dist/src/reporter/__tests__/handlers.test.js +163 -0
- package/dist/src/reporter/__tests__/query-router.test.d.ts +6 -0
- package/dist/src/reporter/__tests__/query-router.test.js +90 -0
- package/dist/src/reporter/acl-check.d.ts +23 -0
- package/dist/src/reporter/acl-check.js +43 -0
- package/dist/src/reporter/auto-fire.d.ts +59 -0
- package/dist/src/reporter/auto-fire.js +126 -0
- package/dist/src/reporter/budget.d.ts +17 -0
- package/dist/src/reporter/budget.js +52 -0
- package/dist/src/reporter/handlers.d.ts +32 -0
- package/dist/src/reporter/handlers.js +180 -0
- package/dist/src/reporter/index.d.ts +44 -0
- package/dist/src/reporter/index.js +167 -0
- package/dist/src/reporter/query-router.d.ts +21 -0
- package/dist/src/reporter/query-router.js +32 -0
- package/dist/src/router/__tests__/step-router.test.js +3 -3
- package/dist/src/router/classifier/regex.js +49 -2
- package/dist/src/router/classifier/regex.test.js +3 -1
- package/dist/src/router/decide.d.ts +18 -0
- package/dist/src/router/decide.js +39 -7
- package/dist/src/router/decide.test.js +58 -8
- package/dist/src/router/role-override.test.d.ts +1 -0
- package/dist/src/router/role-override.test.js +26 -0
- package/dist/src/router/step-router.js +1 -1
- package/dist/src/router/warm.d.ts +2 -0
- package/dist/src/router/warm.js +42 -12
- package/dist/src/router/warm.test.js +59 -1
- package/dist/src/scaffold/__tests__/init-new.spec.js +3 -3
- package/dist/src/scaffold/bb-ecosystem-apply.js +51 -49
- package/dist/src/scaffold/bb-quality-gate.js +5 -5
- package/dist/src/scaffold/continuation-prompt.js +60 -60
- package/dist/src/scaffold/init-new.js +454 -454
- package/dist/src/self-qa/__tests__/agentic-context.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/agentic-context.test.js +98 -0
- package/dist/src/self-qa/__tests__/agentic-loop.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/agentic-loop.test.js +62 -0
- package/dist/src/self-qa/__tests__/delta-encoder.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/delta-encoder.test.js +97 -0
- package/dist/src/self-qa/__tests__/judge.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/judge.test.js +131 -0
- package/dist/src/self-qa/__tests__/scenario-planner.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/scenario-planner.test.js +79 -0
- package/dist/src/self-qa/__tests__/spec-emitter.test.d.ts +1 -0
- package/dist/src/self-qa/__tests__/spec-emitter.test.js +62 -0
- package/dist/src/self-qa/agentic-context.d.ts +29 -0
- package/dist/src/self-qa/agentic-context.js +189 -0
- package/dist/src/self-qa/agentic-loop.d.ts +96 -0
- package/dist/src/self-qa/agentic-loop.js +516 -0
- package/dist/src/self-qa/delta-encoder.d.ts +35 -0
- package/dist/src/self-qa/delta-encoder.js +138 -0
- package/dist/src/self-qa/index.d.ts +43 -0
- package/dist/src/self-qa/index.js +65 -0
- package/dist/src/self-qa/judge.d.ts +25 -0
- package/dist/src/self-qa/judge.js +233 -0
- package/dist/src/self-qa/orchestrator.d.ts +31 -0
- package/dist/src/self-qa/orchestrator.js +236 -0
- package/dist/src/self-qa/scenario-planner.d.ts +39 -0
- package/dist/src/self-qa/scenario-planner.js +262 -0
- package/dist/src/self-qa/spec-emitter.d.ts +25 -0
- package/dist/src/self-qa/spec-emitter.js +138 -0
- package/dist/src/self-qa/types.d.ts +113 -0
- package/dist/src/self-qa/types.js +11 -0
- package/dist/src/storage/__tests__/migrations.test.js +2 -2
- package/dist/src/storage/__tests__/sweep-stale-pending.test.d.ts +10 -0
- package/dist/src/storage/__tests__/sweep-stale-pending.test.js +97 -0
- package/dist/src/storage/__tests__/ui-interaction-log.test.js +30 -0
- package/dist/src/storage/atomic-io.test.js +2 -2
- package/dist/src/storage/config.test.js +1 -1
- package/dist/src/storage/interaction-log.d.ts +1 -1
- package/dist/src/storage/interaction-log.js +5 -5
- package/dist/src/storage/migrations.js +122 -122
- package/dist/src/storage/sessions.js +57 -42
- package/dist/src/storage/transcript-response-entry.test.d.ts +1 -0
- package/dist/src/storage/transcript-response-entry.test.js +98 -0
- package/dist/src/storage/transcript.d.ts +22 -0
- package/dist/src/storage/transcript.js +149 -74
- package/dist/src/storage/ui-interaction-log.d.ts +11 -1
- package/dist/src/storage/usage-cap.test.js +1 -1
- package/dist/src/storage/usage.js +14 -14
- package/dist/src/storage/workspaces.js +12 -12
- package/dist/src/tools/__tests__/vision-gate.test.d.ts +1 -0
- package/dist/src/tools/__tests__/vision-gate.test.js +56 -0
- package/dist/src/tools/bash-output-cache.d.ts +59 -0
- package/dist/src/tools/bash-output-cache.js +108 -0
- package/dist/src/tools/bash-output-cache.test.d.ts +1 -0
- package/dist/src/tools/bash-output-cache.test.js +89 -0
- package/dist/src/tools/bash-output-integration.test.d.ts +10 -0
- package/dist/src/tools/bash-output-integration.test.js +30 -0
- package/dist/src/tools/bash.d.ts +12 -0
- package/dist/src/tools/bash.js +114 -21
- package/dist/src/tools/bash.test.js +80 -3
- package/dist/src/tools/computer.test.js +1 -1
- package/dist/src/tools/file-tracker.test.js +1 -1
- package/dist/src/tools/file.js +23 -2
- package/dist/src/tools/file.test.js +49 -1
- package/dist/src/tools/registry-bash-empty-command.test.d.ts +13 -0
- package/dist/src/tools/registry-bash-empty-command.test.js +56 -0
- package/dist/src/tools/registry-bash-footer.test.d.ts +7 -0
- package/dist/src/tools/registry-bash-footer.test.js +82 -0
- package/dist/src/tools/registry-ee-query.test.d.ts +11 -0
- package/dist/src/tools/registry-ee-query.test.js +48 -0
- package/dist/src/tools/registry-session-repeat.test.d.ts +12 -0
- package/dist/src/tools/registry-session-repeat.test.js +87 -0
- package/dist/src/tools/registry.d.ts +38 -0
- package/dist/src/tools/registry.js +262 -4
- package/dist/src/tools/schedule.test.js +1 -1
- package/dist/src/tools/todo-write-snapshot.d.ts +18 -0
- package/dist/src/tools/todo-write-snapshot.js +66 -0
- package/dist/src/tools/todo-write-snapshot.test.d.ts +1 -0
- package/dist/src/tools/todo-write-snapshot.test.js +43 -0
- package/dist/src/tools/vision-gate.d.ts +41 -0
- package/dist/src/tools/vision-gate.js +67 -0
- package/dist/src/types/index.d.ts +65 -4
- package/dist/src/ui/__tests__/picker-providers.test.d.ts +1 -0
- package/dist/src/ui/__tests__/picker-providers.test.js +31 -0
- package/dist/src/ui/agents-modal.js +2 -0
- package/dist/src/ui/app.d.ts +1 -0
- package/dist/src/ui/app.js +0 -0
- package/dist/src/ui/components/__tests__/task-list-panel.test.d.ts +1 -0
- package/dist/src/ui/components/__tests__/task-list-panel.test.js +31 -0
- package/dist/src/ui/components/council-info-card.d.ts +1 -2
- package/dist/src/ui/components/council-leader-bubble.d.ts +1 -2
- package/dist/src/ui/components/council-message-bubble.d.ts +1 -2
- package/dist/src/ui/components/council-phase-timeline.js +20 -1
- package/dist/src/ui/components/council-placeholder-bubble.d.ts +1 -2
- package/dist/src/ui/components/council-question-card.js +3 -0
- package/dist/src/ui/components/council-synthesis-banner.d.ts +1 -2
- package/dist/src/ui/components/halt-recovery-card.js +1 -0
- package/dist/src/ui/components/message-view.d.ts +11 -1
- package/dist/src/ui/components/message-view.js +65 -3
- package/dist/src/ui/components/point-to-existing-form-card.js +5 -1
- package/dist/src/ui/components/task-list-panel.d.ts +32 -0
- package/dist/src/ui/components/task-list-panel.js +84 -0
- package/dist/src/ui/components/tool-group.d.ts +22 -0
- package/dist/src/ui/components/tool-group.js +85 -0
- package/dist/src/ui/hooks/use-agent-editor.js +2 -3
- package/dist/src/ui/hooks/use-model-picker.d.ts +2 -2
- package/dist/src/ui/modals/model-picker-modal.d.ts +2 -0
- package/dist/src/ui/modals/model-picker-modal.js +2 -4
- package/dist/src/ui/picker-providers.d.ts +21 -0
- package/dist/src/ui/picker-providers.js +39 -0
- package/dist/src/ui/slash/__tests__/clear.test.js +1 -1
- package/dist/src/ui/slash/__tests__/compact.test.js +1 -1
- package/dist/src/ui/slash/__tests__/discuss.test.js +1 -1
- package/dist/src/ui/slash/__tests__/execute.test.js +1 -1
- package/dist/src/ui/slash/__tests__/expand.test.js +1 -1
- package/dist/src/ui/slash/__tests__/ideal.test.js +41 -0
- package/dist/src/ui/slash/__tests__/menu-parity.test.d.ts +1 -0
- package/dist/src/ui/slash/__tests__/menu-parity.test.js +1 -0
- package/dist/src/ui/slash/__tests__/plan.test.js +4 -1
- package/dist/src/ui/slash/__tests__/status-render.test.d.ts +7 -0
- package/dist/src/ui/slash/__tests__/status-render.test.js +77 -0
- package/dist/src/ui/slash/council-inspect.js +4 -4
- package/dist/src/ui/slash/export.js +32 -5
- package/dist/src/ui/slash/ideal.d.ts +9 -0
- package/dist/src/ui/slash/ideal.js +27 -1
- package/dist/src/ui/slash/menu-items.js +1 -0
- package/dist/src/ui/slash/status.d.ts +12 -0
- package/dist/src/ui/slash/status.js +32 -0
- package/dist/src/ui/state/active-run.d.ts +26 -0
- package/dist/src/ui/state/active-run.js +44 -0
- package/dist/src/ui/status-bar/index.d.ts +6 -1
- package/dist/src/ui/status-bar/index.js +21 -2
- package/dist/src/ui/status-bar/index.test.js +60 -1
- package/dist/src/ui/status-bar/store.d.ts +16 -0
- package/dist/src/ui/status-bar/store.js +120 -1
- package/dist/src/ui/utils/__tests__/format.test.d.ts +1 -0
- package/dist/src/ui/utils/__tests__/format.test.js +50 -0
- package/dist/src/ui/utils/__tests__/tools.test.d.ts +1 -0
- package/dist/src/ui/utils/__tests__/tools.test.js +48 -0
- package/dist/src/ui/utils/format.d.ts +17 -0
- package/dist/src/ui/utils/format.js +45 -2
- package/dist/src/ui/utils/text.js +2 -1
- package/dist/src/ui/utils/tools.d.ts +2 -0
- package/dist/src/ui/utils/tools.js +58 -9
- package/dist/src/usage/__tests__/product-ledger.test.js +5 -4
- package/dist/src/usage/decision-log.d.ts +1 -1
- package/dist/src/usage/downgrade.d.ts +3 -2
- package/dist/src/usage/downgrade.js +25 -9
- package/dist/src/usage/downgrade.test.js +40 -37
- package/dist/src/usage/product-ledger.d.ts +4 -0
- package/dist/src/usage/product-ledger.js +8 -1
- package/dist/src/utils/__tests__/llm-deadline.test.d.ts +1 -0
- package/dist/src/utils/__tests__/llm-deadline.test.js +56 -0
- package/dist/src/utils/__tests__/settings-disabled-models.test.js +1 -1
- package/dist/src/utils/__tests__/settings-web-research.test.js +1 -1
- package/dist/src/utils/__tests__/visible-retry.test.js +1 -1
- package/dist/src/utils/clipboard-image.js +23 -23
- package/dist/src/utils/install-manager.test.js +1 -1
- package/dist/src/utils/llm-deadline.d.ts +44 -0
- package/dist/src/utils/llm-deadline.js +80 -0
- package/dist/src/utils/permission-mode.d.ts +16 -9
- package/dist/src/utils/permission-mode.js +55 -4
- package/dist/src/utils/settings.d.ts +22 -0
- package/dist/src/utils/settings.js +47 -6
- package/dist/src/utils/shell.d.ts +12 -0
- package/dist/src/utils/shell.js +23 -12
- package/dist/src/utils/shell.test.js +27 -1
- package/dist/src/utils/side-question.js +2 -2
- package/dist/src/utils/skills.js +3 -3
- package/dist/src/utils/skills.test.js +1 -1
- package/dist/src/utils/subagents-settings.test.js +9 -3
- package/dist/src/verify/__tests__/coverage-parsers.test.js +30 -30
- package/dist/src/verify/__tests__/dotnet-recipe.test.js +1 -1
- package/dist/src/verify/checkpoint.test.js +1 -1
- package/dist/src/verify/entrypoint.d.ts +8 -8
- package/dist/src/verify/entrypoint.js +69 -32
- package/dist/src/verify/entrypoint.test.js +1 -1
- package/dist/src/verify/environment.test.js +1 -1
- package/dist/src/verify/orchestrator.test.js +1 -1
- package/dist/src/verify/runtime-prep.test.js +1 -1
- package/package.json +125 -122
- package/scripts/postinstall.cjs +76 -73
- package/dist/packages/agent-harness-core/src/driver.js.map +0 -1
- package/dist/packages/agent-harness-core/src/event-filter.js.map +0 -1
- package/dist/packages/agent-harness-core/src/event-redact.js.map +0 -1
- package/dist/packages/agent-harness-core/src/idle.js.map +0 -1
- package/dist/packages/agent-harness-core/src/index.js.map +0 -1
- package/dist/packages/agent-harness-core/src/mcp-server.js.map +0 -1
- package/dist/packages/agent-harness-core/src/mock-llm.js.map +0 -1
- package/dist/packages/agent-harness-core/src/predicate.js.map +0 -1
- package/dist/packages/agent-harness-core/src/protocol.js.map +0 -1
- package/dist/packages/agent-harness-core/src/registry.js.map +0 -1
- package/dist/packages/agent-harness-core/src/selector.js.map +0 -1
- package/dist/packages/agent-harness-core/src/spec-helpers.js.map +0 -1
- package/dist/packages/agent-harness-core/src/transports/sidechannel.js.map +0 -1
- package/dist/packages/agent-harness-core/src/transports/ws.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/agent-mode.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/index.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/input-bridge.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/install.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/reconciler-hook.js.map +0 -1
- package/dist/packages/agent-harness-opentui/src/semantic.js.map +0 -1
- package/dist/src/__test-stubs__/ee-server.js.map +0 -1
- package/dist/src/__test-stubs__/vitest-setup.js.map +0 -1
- package/dist/src/__tests__/council/bubble-layout.test.js.map +0 -1
- package/dist/src/__tests__/council/code-block-truncate.test.js.map +0 -1
- package/dist/src/__tests__/council/role-palette.test.js.map +0 -1
- package/dist/src/__tests__/first-run-wizard.test.js.map +0 -1
- package/dist/src/agent-harness/__tests__/cli-flags.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/driver.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/idle.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/mock-llm.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/mock-model.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/predicate.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/protocol.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/schema.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/selector.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/sidechannel.spec.js.map +0 -1
- package/dist/src/agent-harness/__tests__/spec-helpers.spec.js.map +0 -1
- package/dist/src/agent-harness/index.js.map +0 -1
- package/dist/src/agent-harness/mock-model.js.map +0 -1
- package/dist/src/agent-harness/test-spawn.js.map +0 -1
- package/dist/src/billing/index.js.map +0 -1
- package/dist/src/chat/__tests__/broadcast-bus.test.js.map +0 -1
- package/dist/src/chat/__tests__/channel-manager.test.js.map +0 -1
- package/dist/src/chat/__tests__/client.test.js.map +0 -1
- package/dist/src/chat/__tests__/discord-integration.test.js.map +0 -1
- package/dist/src/chat/__tests__/intent-prompt.test.js.map +0 -1
- package/dist/src/chat/__tests__/verdict-resolver.test.js.map +0 -1
- package/dist/src/chat/broadcast-bus.js.map +0 -1
- package/dist/src/chat/channel-manager.js.map +0 -1
- package/dist/src/chat/chat-keychain.js.map +0 -1
- package/dist/src/chat/factory.js.map +0 -1
- package/dist/src/chat/intent-prompt.js.map +0 -1
- package/dist/src/chat/providers/discord/client.js.map +0 -1
- package/dist/src/chat/types.js.map +0 -1
- package/dist/src/chat/verdict-constants.js.map +0 -1
- package/dist/src/chat/verdict-resolver.js.map +0 -1
- package/dist/src/cli/__tests__/bw-vault.test.js.map +0 -1
- package/dist/src/cli/__tests__/keys-bundle.test.js.map +0 -1
- package/dist/src/cli/__tests__/share-cmd.test.js.map +0 -1
- package/dist/src/cli/bw-vault.js.map +0 -1
- package/dist/src/cli/config/__tests__/model-picker.test.js.map +0 -1
- package/dist/src/cli/config/__tests__/provider-fetch.test.js.map +0 -1
- package/dist/src/cli/config/index.js.map +0 -1
- package/dist/src/cli/config/model-picker.js.map +0 -1
- package/dist/src/cli/config/provider-fetch.js.map +0 -1
- package/dist/src/cli/config/screen-council.js.map +0 -1
- package/dist/src/cli/config/screen-models.js.map +0 -1
- package/dist/src/cli/config/screen-providers.js.map +0 -1
- package/dist/src/cli/config/tui.js.map +0 -1
- package/dist/src/cli/cost-forensics.js.map +0 -1
- package/dist/src/cli/cost-forensics.test.js.map +0 -1
- package/dist/src/cli/keys-bundle.js.map +0 -1
- package/dist/src/cli/keys.js.map +0 -1
- package/dist/src/cli/keys.test.js.map +0 -1
- package/dist/src/cli/pil-report.js.map +0 -1
- package/dist/src/cli/share-cmd.js.map +0 -1
- package/dist/src/cli/usage-report.js.map +0 -1
- package/dist/src/cloud/index.js.map +0 -1
- package/dist/src/council/__tests__/accounting.test.js.map +0 -1
- package/dist/src/council/__tests__/audit-replay.test.js.map +0 -1
- package/dist/src/council/__tests__/clarifier-max-rounds.test.js.map +0 -1
- package/dist/src/council/__tests__/clarifier-options.test.js.map +0 -1
- package/dist/src/council/__tests__/cost-aware.test.js.map +0 -1
- package/dist/src/council/__tests__/debate-planner-structured.test.js.map +0 -1
- package/dist/src/council/__tests__/evaluator-metrics.test.js.map +0 -1
- package/dist/src/council/__tests__/parse-outcome-fallback.test.js.map +0 -1
- package/dist/src/council/__tests__/research-tools.test.js.map +0 -1
- package/dist/src/council/__tests__/round-tools.test.js.map +0 -1
- package/dist/src/council/__tests__/tool-trace.test.js.map +0 -1
- package/dist/src/council/__tests__/types-contract.test.js.map +0 -1
- package/dist/src/council/clarifier.js.map +0 -1
- package/dist/src/council/context.js.map +0 -1
- package/dist/src/council/debate-planner.js.map +0 -1
- package/dist/src/council/debate.js.map +0 -1
- package/dist/src/council/executor.js.map +0 -1
- package/dist/src/council/index.js.map +0 -1
- package/dist/src/council/leader.js.map +0 -1
- package/dist/src/council/llm.js.map +0 -1
- package/dist/src/council/phase-events.js.map +0 -1
- package/dist/src/council/planner.js.map +0 -1
- package/dist/src/council/preflight.js.map +0 -1
- package/dist/src/council/prompts.js.map +0 -1
- package/dist/src/council/types.js.map +0 -1
- package/dist/src/daemon/scheduler.js.map +0 -1
- package/dist/src/daemon/scheduler.test.js.map +0 -1
- package/dist/src/ee/__tests__/bb-design.test.js.map +0 -1
- package/dist/src/ee/__tests__/pil-context-bridge.test.js.map +0 -1
- package/dist/src/ee/__tests__/pipeline.integration.test.js.map +0 -1
- package/dist/src/ee/__tests__/render-sink-wiring.test.js.map +0 -1
- package/dist/src/ee/auth.js.map +0 -1
- package/dist/src/ee/auth.test.js.map +0 -1
- package/dist/src/ee/bb-design.js.map +0 -1
- package/dist/src/ee/bb-retrieval.js.map +0 -1
- package/dist/src/ee/bridge.js.map +0 -1
- package/dist/src/ee/bridge.test.js.map +0 -1
- package/dist/src/ee/client-mode.js.map +0 -1
- package/dist/src/ee/client.js.map +0 -1
- package/dist/src/ee/client.test.js.map +0 -1
- package/dist/src/ee/council-bridge.js.map +0 -1
- package/dist/src/ee/embedding-cache.js.map +0 -1
- package/dist/src/ee/extract-session.js.map +0 -1
- package/dist/src/ee/extract-session.test.js.map +0 -1
- package/dist/src/ee/health.js.map +0 -1
- package/dist/src/ee/index.js.map +0 -1
- package/dist/src/ee/intercept.js.map +0 -1
- package/dist/src/ee/intercept.test.js.map +0 -1
- package/dist/src/ee/judge.js.map +0 -1
- package/dist/src/ee/judge.test.js.map +0 -1
- package/dist/src/ee/mistake-detector.js.map +0 -1
- package/dist/src/ee/mistake-detector.test.js.map +0 -1
- package/dist/src/ee/offline-queue.js.map +0 -1
- package/dist/src/ee/offline-queue.test.js.map +0 -1
- package/dist/src/ee/phase-outcome.js.map +0 -1
- package/dist/src/ee/phase-outcome.test.js.map +0 -1
- package/dist/src/ee/phase-tracker.js.map +0 -1
- package/dist/src/ee/phase-tracker.test.js.map +0 -1
- package/dist/src/ee/posttool.js.map +0 -1
- package/dist/src/ee/posttool.test.js.map +0 -1
- package/dist/src/ee/prompt-stale.js.map +0 -1
- package/dist/src/ee/prompt-stale.test.js.map +0 -1
- package/dist/src/ee/render.js.map +0 -1
- package/dist/src/ee/render.test.js.map +0 -1
- package/dist/src/ee/scope.js.map +0 -1
- package/dist/src/ee/scope.test.js.map +0 -1
- package/dist/src/ee/session-trajectory.js.map +0 -1
- package/dist/src/ee/session-trajectory.test.js.map +0 -1
- package/dist/src/ee/tenant.js.map +0 -1
- package/dist/src/ee/touch.test.js.map +0 -1
- package/dist/src/ee/types.js.map +0 -1
- package/dist/src/flow/__tests__/migration.test.js.map +0 -1
- package/dist/src/flow/__tests__/parser.test.js.map +0 -1
- package/dist/src/flow/__tests__/run-manager-product.test.js.map +0 -1
- package/dist/src/flow/__tests__/run-manager.test.js.map +0 -1
- package/dist/src/flow/__tests__/scaffold-checkpoint.test.js.map +0 -1
- package/dist/src/flow/__tests__/scaffold.test.js.map +0 -1
- package/dist/src/flow/__tests__/warning-persist.test.js.map +0 -1
- package/dist/src/flow/artifact-io.js.map +0 -1
- package/dist/src/flow/compaction/__tests__/compress.test.js.map +0 -1
- package/dist/src/flow/compaction/__tests__/extract.test.js.map +0 -1
- package/dist/src/flow/compaction/__tests__/preserve.test.js.map +0 -1
- package/dist/src/flow/compaction/compress.js.map +0 -1
- package/dist/src/flow/compaction/extract.js.map +0 -1
- package/dist/src/flow/compaction/index.js.map +0 -1
- package/dist/src/flow/compaction/preserve.js.map +0 -1
- package/dist/src/flow/index.js.map +0 -1
- package/dist/src/flow/migration.js.map +0 -1
- package/dist/src/flow/parser.js.map +0 -1
- package/dist/src/flow/run-manager.js.map +0 -1
- package/dist/src/flow/scaffold-checkpoint.js.map +0 -1
- package/dist/src/flow/scaffold.js.map +0 -1
- package/dist/src/flow/warning-persist.js.map +0 -1
- package/dist/src/generated/version.js.map +0 -1
- package/dist/src/gsd/__tests__/complexity.test.js.map +0 -1
- package/dist/src/gsd/__tests__/directives.test.js.map +0 -1
- package/dist/src/gsd/__tests__/gray-areas.test.js.map +0 -1
- package/dist/src/gsd/__tests__/types.test.js.map +0 -1
- package/dist/src/gsd/complexity.js.map +0 -1
- package/dist/src/gsd/directives.js.map +0 -1
- package/dist/src/gsd/gray-areas.js.map +0 -1
- package/dist/src/gsd/index.js.map +0 -1
- package/dist/src/gsd/types.js.map +0 -1
- package/dist/src/headless/__tests__/council-answers.test.js.map +0 -1
- package/dist/src/headless/council-answers.js.map +0 -1
- package/dist/src/headless/output.js.map +0 -1
- package/dist/src/headless/output.test.js.map +0 -1
- package/dist/src/hooks/config.js.map +0 -1
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/hooks/types.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/lsp/builtins.js.map +0 -1
- package/dist/src/lsp/builtins.test.js.map +0 -1
- package/dist/src/lsp/client.js.map +0 -1
- package/dist/src/lsp/manager.js.map +0 -1
- package/dist/src/lsp/manager.test.js.map +0 -1
- package/dist/src/lsp/npm-cache.js.map +0 -1
- package/dist/src/lsp/npm-cache.test.js.map +0 -1
- package/dist/src/lsp/runtime.js.map +0 -1
- package/dist/src/lsp/smoke.test.js.map +0 -1
- package/dist/src/lsp/types.js.map +0 -1
- package/dist/src/mcp/__tests__/auto-setup.test.js.map +0 -1
- package/dist/src/mcp/__tests__/harness-driver-action-tools.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/harness-driver-async-tools.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/harness-driver-read-tools.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/harness-driver-security.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/harness-driver.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/lazy-schema.spec.js.map +0 -1
- package/dist/src/mcp/__tests__/mcp-keychain.test.js.map +0 -1
- package/dist/src/mcp/__tests__/research-onboarding.test.js.map +0 -1
- package/dist/src/mcp/__tests__/runtime-hydration.test.js.map +0 -1
- package/dist/src/mcp/__tests__/runtime-sanitize.test.js.map +0 -1
- package/dist/src/mcp/auto-setup.js.map +0 -1
- package/dist/src/mcp/catalog.js.map +0 -1
- package/dist/src/mcp/mcp-keychain.js.map +0 -1
- package/dist/src/mcp/oauth-callback.js.map +0 -1
- package/dist/src/mcp/oauth-provider.js.map +0 -1
- package/dist/src/mcp/opentui-spawn.js.map +0 -1
- package/dist/src/mcp/parse-headers.js.map +0 -1
- package/dist/src/mcp/parse-headers.test.js.map +0 -1
- package/dist/src/mcp/research-onboarding.js.map +0 -1
- package/dist/src/mcp/runtime.js.map +0 -1
- package/dist/src/mcp/smoke.test.js.map +0 -1
- package/dist/src/mcp/validate.js.map +0 -1
- package/dist/src/models/__tests__/registry.test.js.map +0 -1
- package/dist/src/models/catalog-client.js.map +0 -1
- package/dist/src/models/classify-tier.js.map +0 -1
- package/dist/src/models/index.js.map +0 -1
- package/dist/src/models/registry.js.map +0 -1
- package/dist/src/ops/__tests__/doctor-council-mcp.test.js.map +0 -1
- package/dist/src/ops/__tests__/doctor-ee-health.test.js.map +0 -1
- package/dist/src/ops/bug-report.js.map +0 -1
- package/dist/src/ops/bug-report.test.js.map +0 -1
- package/dist/src/ops/doctor.js.map +0 -1
- package/dist/src/ops/doctor.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/batch-turn-runner.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/council-manager.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/cross-turn-dedup.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/current-call-id.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/flow-resume.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/message-processor.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/message-write-ahead.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/read-path-budget.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/retry-classifier.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/retry-stream.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/route-feedback.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/stream-runner.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/usage-events-shape.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/usage-normalizer-c1.test.js.map +0 -1
- package/dist/src/orchestrator/__tests__/write-ahead.test.js.map +0 -1
- package/dist/src/orchestrator/abort.js.map +0 -1
- package/dist/src/orchestrator/abort.test.js.map +0 -1
- package/dist/src/orchestrator/agent-options.js.map +0 -1
- package/dist/src/orchestrator/agent.test.js.map +0 -1
- package/dist/src/orchestrator/batch-turn-runner.js.map +0 -1
- package/dist/src/orchestrator/batch-utils.js.map +0 -1
- package/dist/src/orchestrator/cleanup.test.js.map +0 -1
- package/dist/src/orchestrator/compaction.js.map +0 -1
- package/dist/src/orchestrator/compaction.test.js.map +0 -1
- package/dist/src/orchestrator/council-manager.js.map +0 -1
- package/dist/src/orchestrator/cross-turn-dedup.js.map +0 -1
- package/dist/src/orchestrator/delegations.js.map +0 -1
- package/dist/src/orchestrator/delegations.test.js.map +0 -1
- package/dist/src/orchestrator/error-utils.js.map +0 -1
- package/dist/src/orchestrator/flow-resume.js.map +0 -1
- package/dist/src/orchestrator/message-processor.js.map +0 -1
- package/dist/src/orchestrator/message-seq.js.map +0 -1
- package/dist/src/orchestrator/message-seq.test.js.map +0 -1
- package/dist/src/orchestrator/orchestrator.js.map +0 -1
- package/dist/src/orchestrator/pending-calls.js.map +0 -1
- package/dist/src/orchestrator/pending-calls.test.js.map +0 -1
- package/dist/src/orchestrator/prompts.js.map +0 -1
- package/dist/src/orchestrator/provider-options-shape.js.map +0 -1
- package/dist/src/orchestrator/provider-options-shape.spec.js.map +0 -1
- package/dist/src/orchestrator/read-path-budget.js.map +0 -1
- package/dist/src/orchestrator/reasoning.js.map +0 -1
- package/dist/src/orchestrator/reasoning.test.js.map +0 -1
- package/dist/src/orchestrator/retry-classifier.js.map +0 -1
- package/dist/src/orchestrator/retry-stream.js.map +0 -1
- package/dist/src/orchestrator/sandbox.test.js.map +0 -1
- package/dist/src/orchestrator/stream-runner.js.map +0 -1
- package/dist/src/orchestrator/sub-agent-cap.js.map +0 -1
- package/dist/src/orchestrator/sub-agent-cap.test.js.map +0 -1
- package/dist/src/orchestrator/subagent-compactor.js.map +0 -1
- package/dist/src/orchestrator/subagent-compactor.spec.js.map +0 -1
- package/dist/src/orchestrator/token-counter.js.map +0 -1
- package/dist/src/orchestrator/token-counter.test.js.map +0 -1
- package/dist/src/orchestrator/tool-utils.js.map +0 -1
- package/dist/src/orchestrator/turn-runner-deps.js.map +0 -1
- package/dist/src/pil/__tests__/budget.test.js.map +0 -1
- package/dist/src/pil/__tests__/config.test.js.map +0 -1
- package/dist/src/pil/__tests__/dual-run.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer1-intent-trace.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer1-intent.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer2-personality.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer3-ee-injection.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer3-injected-chunk.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer4-gsd.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer5-context.test.js.map +0 -1
- package/dist/src/pil/__tests__/layer6-output.test.js.map +0 -1
- package/dist/src/pil/__tests__/ollama-classify.test.js.map +0 -1
- package/dist/src/pil/__tests__/orchestrator-integration.test.js.map +0 -1
- package/dist/src/pil/__tests__/pipeline.test.js.map +0 -1
- package/dist/src/pil/__tests__/renderer-coverage.test.js.map +0 -1
- package/dist/src/pil/__tests__/response-tools.test.js.map +0 -1
- package/dist/src/pil/__tests__/schema.test.js.map +0 -1
- package/dist/src/pil/__tests__/scoreComplexity.test.js.map +0 -1
- package/dist/src/pil/__tests__/scoreSufficiency.test.js.map +0 -1
- package/dist/src/pil/__tests__/store.test.js.map +0 -1
- package/dist/src/pil/__tests__/task-tier-map.test.js.map +0 -1
- package/dist/src/pil/budget-log.js.map +0 -1
- package/dist/src/pil/budget.js.map +0 -1
- package/dist/src/pil/config.js.map +0 -1
- package/dist/src/pil/index.js.map +0 -1
- package/dist/src/pil/layer1-intent.js.map +0 -1
- package/dist/src/pil/layer1-intent.test.js.map +0 -1
- package/dist/src/pil/layer2-personality.js.map +0 -1
- package/dist/src/pil/layer3-ee-injection.js.map +0 -1
- package/dist/src/pil/layer4-gsd.js.map +0 -1
- package/dist/src/pil/layer5-context.js.map +0 -1
- package/dist/src/pil/layer6-output.js.map +0 -1
- package/dist/src/pil/ollama-classify.js.map +0 -1
- package/dist/src/pil/pipeline.js.map +0 -1
- package/dist/src/pil/response-tools.js.map +0 -1
- package/dist/src/pil/schema.js.map +0 -1
- package/dist/src/pil/store.js.map +0 -1
- package/dist/src/pil/task-tier-map.js.map +0 -1
- package/dist/src/pil/timeout.js.map +0 -1
- package/dist/src/pil/types.js.map +0 -1
- package/dist/src/product-loop/__tests__/artifact-io.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/assumption-ledger.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/cb2-retry-bonus.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/circuit-breakers-coverage.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/circuit-breakers.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/complexity-routing.spec.js.map +0 -1
- package/dist/src/product-loop/__tests__/context-policy.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/cost-preview.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/cost-scoper.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/cross-run-memory.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/design-output.spec.js.map +0 -1
- package/dist/src/product-loop/__tests__/discover.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-council-runner.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-detection.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-ecosystem.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-integration.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-interview.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-migrations.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-persistence.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-prompt-parser.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-recommender-ecosystem.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-recommender.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/discovery-schema.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/done-gate-coverage.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/done-gate.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/ee-extract-wiring.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/extract-to-ee.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/feedback-routing.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/hot-path.spec.js.map +0 -1
- package/dist/src/product-loop/__tests__/integration.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/loop-driver-audit.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/loop-driver.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-budget.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-orchestrator-integration.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-plan.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-rituals.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-runner.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/phase-tracker-bridge.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/product-identity.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/reality-anchor.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/repo-audit.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/role-memory.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/role-registry.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/role-routing-ee.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/route-decision-emit.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/seed-questions.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/ship-polish.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/sprint-runner-emit.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/sprint-runner.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/stakeholder-acl.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/state-md-ee-injections.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/sufficiency-routing.spec.js.map +0 -1
- package/dist/src/product-loop/__tests__/typed-artifacts.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/types.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/verify-failure-threshold.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/verify-failure-tracking.test.js.map +0 -1
- package/dist/src/product-loop/__tests__/verify-result.test.js.map +0 -1
- package/dist/src/product-loop/artifact-io.js.map +0 -1
- package/dist/src/product-loop/assumption-ledger.js.map +0 -1
- package/dist/src/product-loop/circuit-breakers.js.map +0 -1
- package/dist/src/product-loop/context-policy.js.map +0 -1
- package/dist/src/product-loop/cost-preview.js.map +0 -1
- package/dist/src/product-loop/cost-scoper.js.map +0 -1
- package/dist/src/product-loop/cross-run-memory.js.map +0 -1
- package/dist/src/product-loop/design-output.js.map +0 -1
- package/dist/src/product-loop/discover.js.map +0 -1
- package/dist/src/product-loop/discovery-context-format.js.map +0 -1
- package/dist/src/product-loop/discovery-council-runner.js.map +0 -1
- package/dist/src/product-loop/discovery-detection.js.map +0 -1
- package/dist/src/product-loop/discovery-ecosystem.js.map +0 -1
- package/dist/src/product-loop/discovery-interview.js.map +0 -1
- package/dist/src/product-loop/discovery-migrations.js.map +0 -1
- package/dist/src/product-loop/discovery-persistence.js.map +0 -1
- package/dist/src/product-loop/discovery-prompt-parser.js.map +0 -1
- package/dist/src/product-loop/discovery-recommender.js.map +0 -1
- package/dist/src/product-loop/discovery-schema.js.map +0 -1
- package/dist/src/product-loop/done-gate.js.map +0 -1
- package/dist/src/product-loop/feedback-routing.js.map +0 -1
- package/dist/src/product-loop/gather.js.map +0 -1
- package/dist/src/product-loop/index.js.map +0 -1
- package/dist/src/product-loop/loop-driver.js.map +0 -1
- package/dist/src/product-loop/phase-budget.js.map +0 -1
- package/dist/src/product-loop/phase-plan.js.map +0 -1
- package/dist/src/product-loop/phase-rituals.js.map +0 -1
- package/dist/src/product-loop/phase-runner.js.map +0 -1
- package/dist/src/product-loop/phase-tracker-bridge.js.map +0 -1
- package/dist/src/product-loop/product-identity.js.map +0 -1
- package/dist/src/product-loop/reality-anchor.js.map +0 -1
- package/dist/src/product-loop/repo-audit.js.map +0 -1
- package/dist/src/product-loop/role-memory.js.map +0 -1
- package/dist/src/product-loop/role-registry.js.map +0 -1
- package/dist/src/product-loop/seed-questions.js.map +0 -1
- package/dist/src/product-loop/ship-polish.js.map +0 -1
- package/dist/src/product-loop/sprint-runner.js.map +0 -1
- package/dist/src/product-loop/stakeholder-acl.js.map +0 -1
- package/dist/src/product-loop/typed-artifacts.js.map +0 -1
- package/dist/src/product-loop/types.js.map +0 -1
- package/dist/src/product-loop/verify-failure-tracking.js.map +0 -1
- package/dist/src/product-loop/verify-result.js.map +0 -1
- package/dist/src/providers/__test-utils__/load-fixture.js.map +0 -1
- package/dist/src/providers/__tests__/adapter-oauth-wiring.test.js.map +0 -1
- package/dist/src/providers/__tests__/capabilities-cosmetic.test.js.map +0 -1
- package/dist/src/providers/__tests__/capabilities-flags.test.js.map +0 -1
- package/dist/src/providers/__tests__/capabilities-provider-options.test.js.map +0 -1
- package/dist/src/providers/__tests__/capabilities-sanitize.test.js.map +0 -1
- package/dist/src/providers/__tests__/capabilities.test.js.map +0 -1
- package/dist/src/providers/__tests__/provider-coverage.test.js.map +0 -1
- package/dist/src/providers/__tests__/runtime-integration.test.js.map +0 -1
- package/dist/src/providers/__tests__/runtime.test.js.map +0 -1
- package/dist/src/providers/__tests__/siliconflow-history.test.js +0 -76
- package/dist/src/providers/__tests__/siliconflow-history.test.js.map +0 -1
- package/dist/src/providers/__tests__/strategies-registry.test.js.map +0 -1
- package/dist/src/providers/__tests__/strategies-resolve.test.js.map +0 -1
- package/dist/src/providers/__tests__/wire-debug.test.js.map +0 -1
- package/dist/src/providers/adapter.js.map +0 -1
- package/dist/src/providers/adapter.test.js.map +0 -1
- package/dist/src/providers/anthropic.js.map +0 -1
- package/dist/src/providers/auth/__tests__/browser-flow.test.js.map +0 -1
- package/dist/src/providers/auth/__tests__/device-flow.test.js.map +0 -1
- package/dist/src/providers/auth/__tests__/gemini-oauth.test.js.map +0 -1
- package/dist/src/providers/auth/__tests__/openai-oauth.test.js.map +0 -1
- package/dist/src/providers/auth/__tests__/token-store.test.js.map +0 -1
- package/dist/src/providers/auth/browser-flow.js.map +0 -1
- package/dist/src/providers/auth/device-flow.js.map +0 -1
- package/dist/src/providers/auth/gemini-oauth.js.map +0 -1
- package/dist/src/providers/auth/openai-oauth.js.map +0 -1
- package/dist/src/providers/auth/registry.js.map +0 -1
- package/dist/src/providers/auth/token-store.js.map +0 -1
- package/dist/src/providers/auth/types.js.map +0 -1
- package/dist/src/providers/capabilities.js.map +0 -1
- package/dist/src/providers/endpoints.js.map +0 -1
- package/dist/src/providers/errors.js.map +0 -1
- package/dist/src/providers/errors.test.js.map +0 -1
- package/dist/src/providers/gemini.js.map +0 -1
- package/dist/src/providers/gemini.test.js.map +0 -1
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/providers/keychain.js.map +0 -1
- package/dist/src/providers/keychain.test.js.map +0 -1
- package/dist/src/providers/mcp-vision-bridge.js.map +0 -1
- package/dist/src/providers/mcp-vision-bridge.test.js.map +0 -1
- package/dist/src/providers/ollama.js.map +0 -1
- package/dist/src/providers/ollama.test.js.map +0 -1
- package/dist/src/providers/openai-compatible.js.map +0 -1
- package/dist/src/providers/openai-compatible.test.js.map +0 -1
- package/dist/src/providers/openai.js.map +0 -1
- package/dist/src/providers/openai.test.js.map +0 -1
- package/dist/src/providers/patch-zod-schema.js.map +0 -1
- package/dist/src/providers/pricing.js.map +0 -1
- package/dist/src/providers/pricing.test.js.map +0 -1
- package/dist/src/providers/prompt-cache-key.spec.js.map +0 -1
- package/dist/src/providers/runtime-mock.spec.js.map +0 -1
- package/dist/src/providers/runtime.js.map +0 -1
- package/dist/src/providers/siliconflow-history.d.ts +0 -50
- package/dist/src/providers/siliconflow-history.js +0 -64
- package/dist/src/providers/siliconflow-history.js.map +0 -1
- package/dist/src/providers/strategies/anthropic.strategy.js.map +0 -1
- package/dist/src/providers/strategies/base.strategy.js.map +0 -1
- package/dist/src/providers/strategies/deepseek.strategy.js.map +0 -1
- package/dist/src/providers/strategies/google.strategy.js.map +0 -1
- package/dist/src/providers/strategies/ollama.strategy.js.map +0 -1
- package/dist/src/providers/strategies/openai.strategy.js.map +0 -1
- package/dist/src/providers/strategies/registry.js.map +0 -1
- package/dist/src/providers/strategies/siliconflow.strategy.js.map +0 -1
- package/dist/src/providers/strategies/xai.strategy.js.map +0 -1
- package/dist/src/providers/stream-loop.js.map +0 -1
- package/dist/src/providers/types.js.map +0 -1
- package/dist/src/providers/vision-proxy.js.map +0 -1
- package/dist/src/providers/vision-proxy.test.js.map +0 -1
- package/dist/src/providers/wire-debug.js.map +0 -1
- package/dist/src/router/__tests__/step-router.test.js.map +0 -1
- package/dist/src/router/classifier/grammars.js.map +0 -1
- package/dist/src/router/classifier/index.js.map +0 -1
- package/dist/src/router/classifier/index.test.js.map +0 -1
- package/dist/src/router/classifier/regex.js.map +0 -1
- package/dist/src/router/classifier/regex.test.js.map +0 -1
- package/dist/src/router/classifier/tree-sitter.js.map +0 -1
- package/dist/src/router/classifier/tree-sitter.test.js.map +0 -1
- package/dist/src/router/cold.js.map +0 -1
- package/dist/src/router/cold.test.js.map +0 -1
- package/dist/src/router/decide.js.map +0 -1
- package/dist/src/router/decide.test.js.map +0 -1
- package/dist/src/router/health.js.map +0 -1
- package/dist/src/router/health.test.js.map +0 -1
- package/dist/src/router/provider-sentinel.js.map +0 -1
- package/dist/src/router/provider-sentinel.test.js.map +0 -1
- package/dist/src/router/step-router.js.map +0 -1
- package/dist/src/router/store.js.map +0 -1
- package/dist/src/router/types.js.map +0 -1
- package/dist/src/router/warm.js.map +0 -1
- package/dist/src/router/warm.test.js.map +0 -1
- package/dist/src/scaffold/__tests__/continuation-prompt.test.js.map +0 -1
- package/dist/src/scaffold/__tests__/continue-as-council.spec.js.map +0 -1
- package/dist/src/scaffold/__tests__/dotnet-assembly-name.test.js.map +0 -1
- package/dist/src/scaffold/__tests__/fe-scaffold-contents.test.js.map +0 -1
- package/dist/src/scaffold/__tests__/init-new.smoke.spec.js.map +0 -1
- package/dist/src/scaffold/__tests__/init-new.spec.js.map +0 -1
- package/dist/src/scaffold/__tests__/install-bb-templates.spec.js.map +0 -1
- package/dist/src/scaffold/__tests__/point-to-existing.spec.js.map +0 -1
- package/dist/src/scaffold/bb-ecosystem-apply.js.map +0 -1
- package/dist/src/scaffold/bb-quality-gate.js.map +0 -1
- package/dist/src/scaffold/continuation-prompt.js.map +0 -1
- package/dist/src/scaffold/continue-as-council.js.map +0 -1
- package/dist/src/scaffold/init-new.js.map +0 -1
- package/dist/src/scaffold/point-to-existing.js.map +0 -1
- package/dist/src/scaffold/resume-from-gate-failures.js.map +0 -1
- package/dist/src/storage/__tests__/migrations.test.js.map +0 -1
- package/dist/src/storage/__tests__/ui-interaction-log.test.js.map +0 -1
- package/dist/src/storage/atomic-io.js.map +0 -1
- package/dist/src/storage/atomic-io.test.js.map +0 -1
- package/dist/src/storage/config.js.map +0 -1
- package/dist/src/storage/config.test.js.map +0 -1
- package/dist/src/storage/db.js.map +0 -1
- package/dist/src/storage/index.js.map +0 -1
- package/dist/src/storage/interaction-log.js.map +0 -1
- package/dist/src/storage/migrations.js.map +0 -1
- package/dist/src/storage/session-dir.js.map +0 -1
- package/dist/src/storage/sessions.js.map +0 -1
- package/dist/src/storage/tool-results.js.map +0 -1
- package/dist/src/storage/transcript-view.js.map +0 -1
- package/dist/src/storage/transcript.js.map +0 -1
- package/dist/src/storage/transcript.test.js.map +0 -1
- package/dist/src/storage/ui-interaction-log.js.map +0 -1
- package/dist/src/storage/usage-cap.js.map +0 -1
- package/dist/src/storage/usage-cap.test.js.map +0 -1
- package/dist/src/storage/usage.js.map +0 -1
- package/dist/src/storage/workspaces.js.map +0 -1
- package/dist/src/tools/bash.js.map +0 -1
- package/dist/src/tools/bash.test.js.map +0 -1
- package/dist/src/tools/computer.js.map +0 -1
- package/dist/src/tools/computer.test.js.map +0 -1
- package/dist/src/tools/file-tracker.js.map +0 -1
- package/dist/src/tools/file-tracker.test.js.map +0 -1
- package/dist/src/tools/file.js.map +0 -1
- package/dist/src/tools/file.test.js.map +0 -1
- package/dist/src/tools/grep.js.map +0 -1
- package/dist/src/tools/registry.js.map +0 -1
- package/dist/src/tools/registry.test.js.map +0 -1
- package/dist/src/tools/schedule.js.map +0 -1
- package/dist/src/tools/schedule.test.js.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/ui/agents-modal.js.map +0 -1
- package/dist/src/ui/app.js.map +0 -1
- package/dist/src/ui/cards/__tests__/product-status-card.test.js.map +0 -1
- package/dist/src/ui/cards/product-status-card.js.map +0 -1
- package/dist/src/ui/components/SuggestionOverlay.js.map +0 -1
- package/dist/src/ui/components/Toast.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-leader-bubble.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-message-bubble.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-phase-timeline.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-placeholder-bubble.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-question-card.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/council-synthesis-banner.test.js.map +0 -1
- package/dist/src/ui/components/__tests__/use-pair-quote-buffer.test.js.map +0 -1
- package/dist/src/ui/components/btw-overlay.js.map +0 -1
- package/dist/src/ui/components/bubble-layout.js.map +0 -1
- package/dist/src/ui/components/code-block-truncate.js.map +0 -1
- package/dist/src/ui/components/copy-flash-banner.js.map +0 -1
- package/dist/src/ui/components/council-info-card.js.map +0 -1
- package/dist/src/ui/components/council-leader-bubble.js.map +0 -1
- package/dist/src/ui/components/council-message-bubble.js.map +0 -1
- package/dist/src/ui/components/council-phase-timeline.js.map +0 -1
- package/dist/src/ui/components/council-placeholder-bubble.js.map +0 -1
- package/dist/src/ui/components/council-question-card.js.map +0 -1
- package/dist/src/ui/components/council-status-list.js.map +0 -1
- package/dist/src/ui/components/council-synthesis-banner.js.map +0 -1
- package/dist/src/ui/components/diff-view.js.map +0 -1
- package/dist/src/ui/components/halt-recovery-card.js.map +0 -1
- package/dist/src/ui/components/hero-logo.js.map +0 -1
- package/dist/src/ui/components/init-new-form-card.js.map +0 -1
- package/dist/src/ui/components/lsp-views.js.map +0 -1
- package/dist/src/ui/components/media-views.js.map +0 -1
- package/dist/src/ui/components/message-view.js.map +0 -1
- package/dist/src/ui/components/point-to-existing-form-card.js.map +0 -1
- package/dist/src/ui/components/prompt-box.js.map +0 -1
- package/dist/src/ui/components/role-palette.js.map +0 -1
- package/dist/src/ui/components/session-header.js.map +0 -1
- package/dist/src/ui/components/slash-inline-menu.js.map +0 -1
- package/dist/src/ui/components/structured-response-view.js.map +0 -1
- package/dist/src/ui/components/tool-result-views.js.map +0 -1
- package/dist/src/ui/components/use-pair-quote-buffer.js.map +0 -1
- package/dist/src/ui/constants.js.map +0 -1
- package/dist/src/ui/hooks/use-agent-editor.js.map +0 -1
- package/dist/src/ui/hooks/use-mcp-editor.js.map +0 -1
- package/dist/src/ui/hooks/use-model-picker.js.map +0 -1
- package/dist/src/ui/hooks/useTypeahead.js.map +0 -1
- package/dist/src/ui/markdown.js.map +0 -1
- package/dist/src/ui/mcp-modal-types.js.map +0 -1
- package/dist/src/ui/mcp-modal.js.map +0 -1
- package/dist/src/ui/modals/api-key-modal.js.map +0 -1
- package/dist/src/ui/modals/connect-modal.js.map +0 -1
- package/dist/src/ui/modals/model-picker-modal.js.map +0 -1
- package/dist/src/ui/modals/sandbox-picker-modal.js.map +0 -1
- package/dist/src/ui/modals/update-modal.js.map +0 -1
- package/dist/src/ui/modals/wallet-picker-modal.js.map +0 -1
- package/dist/src/ui/plan.js.map +0 -1
- package/dist/src/ui/schedule-modal.js.map +0 -1
- package/dist/src/ui/slash/__tests__/clear.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/compact.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/cost.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/discuss.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/execute.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/expand.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/ideal.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/menu-parity.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/optimize.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/pin.test.js.map +0 -1
- package/dist/src/ui/slash/__tests__/plan.test.js.map +0 -1
- package/dist/src/ui/slash/clear.js.map +0 -1
- package/dist/src/ui/slash/compact.js.map +0 -1
- package/dist/src/ui/slash/cost.js.map +0 -1
- package/dist/src/ui/slash/council-inspect.js.map +0 -1
- package/dist/src/ui/slash/council.js.map +0 -1
- package/dist/src/ui/slash/debug.js.map +0 -1
- package/dist/src/ui/slash/discuss.js.map +0 -1
- package/dist/src/ui/slash/ee.js.map +0 -1
- package/dist/src/ui/slash/execute.js.map +0 -1
- package/dist/src/ui/slash/expand.js.map +0 -1
- package/dist/src/ui/slash/export.js.map +0 -1
- package/dist/src/ui/slash/ideal.js.map +0 -1
- package/dist/src/ui/slash/menu-items.js.map +0 -1
- package/dist/src/ui/slash/optimize.js.map +0 -1
- package/dist/src/ui/slash/pin.js.map +0 -1
- package/dist/src/ui/slash/plan.js.map +0 -1
- package/dist/src/ui/slash/registry.js.map +0 -1
- package/dist/src/ui/slash/route.js.map +0 -1
- package/dist/src/ui/slash/route.test.js.map +0 -1
- package/dist/src/ui/status-bar/index.js.map +0 -1
- package/dist/src/ui/status-bar/index.test.js.map +0 -1
- package/dist/src/ui/status-bar/store.js.map +0 -1
- package/dist/src/ui/status-bar/store.test.js.map +0 -1
- package/dist/src/ui/status-bar/tier-badge.js.map +0 -1
- package/dist/src/ui/status-bar/tier-badge.test.js.map +0 -1
- package/dist/src/ui/status-bar/usd-meter.js.map +0 -1
- package/dist/src/ui/status-bar/usd-meter.test.js.map +0 -1
- package/dist/src/ui/syntax-highlight.js.map +0 -1
- package/dist/src/ui/terminal-selection-text.js.map +0 -1
- package/dist/src/ui/theme.js.map +0 -1
- package/dist/src/ui/types.js.map +0 -1
- package/dist/src/ui/utils/color.js.map +0 -1
- package/dist/src/ui/utils/format.js.map +0 -1
- package/dist/src/ui/utils/modal.js.map +0 -1
- package/dist/src/ui/utils/text.js.map +0 -1
- package/dist/src/ui/utils/tools.js.map +0 -1
- package/dist/src/usage/__tests__/product-ledger.test.js.map +0 -1
- package/dist/src/usage/cost-log.js.map +0 -1
- package/dist/src/usage/decision-log.js.map +0 -1
- package/dist/src/usage/downgrade.js.map +0 -1
- package/dist/src/usage/downgrade.test.js.map +0 -1
- package/dist/src/usage/estimator.js.map +0 -1
- package/dist/src/usage/estimator.test.js.map +0 -1
- package/dist/src/usage/ledger.js.map +0 -1
- package/dist/src/usage/ledger.test.js.map +0 -1
- package/dist/src/usage/midstream.js.map +0 -1
- package/dist/src/usage/midstream.test.js.map +0 -1
- package/dist/src/usage/product-ledger.js.map +0 -1
- package/dist/src/usage/thresholds.js.map +0 -1
- package/dist/src/usage/thresholds.test.js.map +0 -1
- package/dist/src/usage/types.js.map +0 -1
- package/dist/src/utils/__tests__/auto-council-settings.test.js.map +0 -1
- package/dist/src/utils/__tests__/ee-logger.test.js.map +0 -1
- package/dist/src/utils/__tests__/file-lock.test.js.map +0 -1
- package/dist/src/utils/__tests__/rate-limit.test.js.map +0 -1
- package/dist/src/utils/__tests__/settings-disabled-models.test.js.map +0 -1
- package/dist/src/utils/__tests__/settings-web-research.test.js.map +0 -1
- package/dist/src/utils/__tests__/slugify.test.js.map +0 -1
- package/dist/src/utils/__tests__/visible-retry.test.js.map +0 -1
- package/dist/src/utils/at-mentions.js.map +0 -1
- package/dist/src/utils/clipboard-image.js.map +0 -1
- package/dist/src/utils/ee-logger.js.map +0 -1
- package/dist/src/utils/file-index.js.map +0 -1
- package/dist/src/utils/file-lock.js.map +0 -1
- package/dist/src/utils/git-root.js.map +0 -1
- package/dist/src/utils/host-clipboard.js.map +0 -1
- package/dist/src/utils/install-manager.js.map +0 -1
- package/dist/src/utils/install-manager.test.js.map +0 -1
- package/dist/src/utils/instructions.js.map +0 -1
- package/dist/src/utils/instructions.test.js.map +0 -1
- package/dist/src/utils/permission-mode.js.map +0 -1
- package/dist/src/utils/permission-mode.test.js.map +0 -1
- package/dist/src/utils/rate-limit.js.map +0 -1
- package/dist/src/utils/redactor.js.map +0 -1
- package/dist/src/utils/redactor.test.js.map +0 -1
- package/dist/src/utils/settings.js.map +0 -1
- package/dist/src/utils/settings.test.js.map +0 -1
- package/dist/src/utils/shell.js.map +0 -1
- package/dist/src/utils/shell.test.js.map +0 -1
- package/dist/src/utils/side-question.js.map +0 -1
- package/dist/src/utils/skills.js.map +0 -1
- package/dist/src/utils/skills.test.js.map +0 -1
- package/dist/src/utils/slugify.js.map +0 -1
- package/dist/src/utils/subagent-display.js.map +0 -1
- package/dist/src/utils/subagent-display.test.js.map +0 -1
- package/dist/src/utils/subagents-settings.test.js.map +0 -1
- package/dist/src/utils/telegram-audio-settings.test.js.map +0 -1
- package/dist/src/utils/update-checker.js.map +0 -1
- package/dist/src/utils/update-checker.test.js.map +0 -1
- package/dist/src/utils/visible-retry.js.map +0 -1
- package/dist/src/verify/__tests__/coverage-parsers.test.js.map +0 -1
- package/dist/src/verify/__tests__/dotnet-recipe.test.js.map +0 -1
- package/dist/src/verify/checkpoint.js.map +0 -1
- package/dist/src/verify/checkpoint.test.js.map +0 -1
- package/dist/src/verify/coverage-parsers.js.map +0 -1
- package/dist/src/verify/entrypoint.js.map +0 -1
- package/dist/src/verify/entrypoint.test.js.map +0 -1
- package/dist/src/verify/environment.js.map +0 -1
- package/dist/src/verify/environment.test.js.map +0 -1
- package/dist/src/verify/evidence.js.map +0 -1
- package/dist/src/verify/orchestrator.js.map +0 -1
- package/dist/src/verify/orchestrator.test.js.map +0 -1
- package/dist/src/verify/recipes.js.map +0 -1
- package/dist/src/verify/retry.js.map +0 -1
- package/dist/src/verify/runtime-prep.test.js.map +0 -1
- package/src/__test-stubs__/ee-server.ts +0 -173
- package/src/__test-stubs__/vitest-setup.ts +0 -36
- package/src/__tests__/council/bubble-layout.test.ts +0 -45
- package/src/__tests__/council/code-block-truncate.test.ts +0 -50
- package/src/__tests__/council/role-palette.test.ts +0 -66
- package/src/__tests__/first-run-wizard.test.ts +0 -9
- package/src/agent-harness/__tests__/cli-flags.spec.ts +0 -35
- package/src/agent-harness/__tests__/driver.spec.ts +0 -154
- package/src/agent-harness/__tests__/idle.spec.ts +0 -90
- package/src/agent-harness/__tests__/mock-llm.spec.ts +0 -126
- package/src/agent-harness/__tests__/mock-model.spec.ts +0 -195
- package/src/agent-harness/__tests__/predicate.spec.ts +0 -33
- package/src/agent-harness/__tests__/protocol.spec.ts +0 -62
- package/src/agent-harness/__tests__/schema.spec.ts +0 -81
- package/src/agent-harness/__tests__/selector.spec.ts +0 -82
- package/src/agent-harness/__tests__/sidechannel.spec.ts +0 -40
- package/src/agent-harness/__tests__/spec-helpers.spec.ts +0 -76
- package/src/agent-harness/index.ts +0 -24
- package/src/agent-harness/mock-model.ts +0 -394
- package/src/agent-harness/test-spawn.ts +0 -200
- package/src/billing/index.ts +0 -5
- package/src/bun-sqlite.d.ts +0 -15
- package/src/chat/__tests__/broadcast-bus.test.ts +0 -90
- package/src/chat/__tests__/channel-manager.test.ts +0 -149
- package/src/chat/__tests__/client.test.ts +0 -118
- package/src/chat/__tests__/discord-integration.test.ts +0 -162
- package/src/chat/__tests__/intent-prompt.test.ts +0 -92
- package/src/chat/__tests__/verdict-resolver.test.ts +0 -336
- package/src/chat/broadcast-bus.ts +0 -53
- package/src/chat/channel-manager.ts +0 -146
- package/src/chat/chat-keychain.ts +0 -129
- package/src/chat/factory.ts +0 -37
- package/src/chat/intent-prompt.ts +0 -72
- package/src/chat/providers/discord/client.ts +0 -91
- package/src/chat/types.ts +0 -42
- package/src/chat/verdict-constants.ts +0 -26
- package/src/chat/verdict-resolver.ts +0 -231
- package/src/cli/__tests__/bw-vault.test.ts +0 -97
- package/src/cli/__tests__/keys-bundle.test.ts +0 -46
- package/src/cli/__tests__/share-cmd.test.ts +0 -197
- package/src/cli/bw-vault.ts +0 -184
- package/src/cli/config/__tests__/model-picker.test.ts +0 -59
- package/src/cli/config/__tests__/provider-fetch.test.ts +0 -38
- package/src/cli/config/index.ts +0 -112
- package/src/cli/config/model-picker.ts +0 -193
- package/src/cli/config/provider-fetch.ts +0 -75
- package/src/cli/config/screen-council.ts +0 -245
- package/src/cli/config/screen-models.ts +0 -104
- package/src/cli/config/screen-providers.ts +0 -197
- package/src/cli/config/tui.ts +0 -153
- package/src/cli/cost-forensics.test.ts +0 -128
- package/src/cli/cost-forensics.ts +0 -264
- package/src/cli/keys-bundle.ts +0 -91
- package/src/cli/keys.test.ts +0 -104
- package/src/cli/keys.ts +0 -787
- package/src/cli/pil-report.ts +0 -202
- package/src/cli/share-cmd.ts +0 -132
- package/src/cli/usage-report.ts +0 -266
- package/src/cloud/index.ts +0 -5
- package/src/council/__tests__/accounting.test.ts +0 -72
- package/src/council/__tests__/audit-replay.test.ts +0 -344
- package/src/council/__tests__/clarifier-max-rounds.test.ts +0 -91
- package/src/council/__tests__/clarifier-options.test.ts +0 -63
- package/src/council/__tests__/cost-aware.test.ts +0 -60
- package/src/council/__tests__/debate-planner-structured.test.ts +0 -236
- package/src/council/__tests__/evaluator-metrics.test.ts +0 -513
- package/src/council/__tests__/parse-outcome-fallback.test.ts +0 -125
- package/src/council/__tests__/research-tools.test.ts +0 -239
- package/src/council/__tests__/round-tools.test.ts +0 -334
- package/src/council/__tests__/tool-trace.test.ts +0 -152
- package/src/council/__tests__/types-contract.test.ts +0 -88
- package/src/council/clarifier.ts +0 -409
- package/src/council/context.ts +0 -250
- package/src/council/debate-planner.ts +0 -264
- package/src/council/debate.ts +0 -1179
- package/src/council/executor.ts +0 -27
- package/src/council/index.ts +0 -916
- package/src/council/leader.ts +0 -262
- package/src/council/llm.ts +0 -967
- package/src/council/phase-events.ts +0 -58
- package/src/council/planner.ts +0 -303
- package/src/council/preflight.ts +0 -86
- package/src/council/prompts.ts +0 -600
- package/src/council/types.ts +0 -286
- package/src/daemon/scheduler.test.ts +0 -128
- package/src/daemon/scheduler.ts +0 -152
- package/src/ee/.gitkeep +0 -0
- package/src/ee/__tests__/bb-design.test.ts +0 -223
- package/src/ee/__tests__/pil-context-bridge.test.ts +0 -59
- package/src/ee/__tests__/pipeline.integration.test.ts +0 -193
- package/src/ee/__tests__/render-sink-wiring.test.ts +0 -89
- package/src/ee/auth.test.ts +0 -76
- package/src/ee/auth.ts +0 -80
- package/src/ee/bb-design.ts +0 -284
- package/src/ee/bb-retrieval.ts +0 -467
- package/src/ee/bridge.test.ts +0 -283
- package/src/ee/bridge.ts +0 -443
- package/src/ee/client-mode.ts +0 -161
- package/src/ee/client.test.ts +0 -171
- package/src/ee/client.ts +0 -620
- package/src/ee/council-bridge.ts +0 -89
- package/src/ee/embedding-cache.ts +0 -42
- package/src/ee/extract-session.test.ts +0 -231
- package/src/ee/extract-session.ts +0 -71
- package/src/ee/health.ts +0 -83
- package/src/ee/index.ts +0 -33
- package/src/ee/intercept.test.ts +0 -197
- package/src/ee/intercept.ts +0 -143
- package/src/ee/judge.test.ts +0 -213
- package/src/ee/judge.ts +0 -126
- package/src/ee/mistake-detector.test.ts +0 -252
- package/src/ee/mistake-detector.ts +0 -297
- package/src/ee/offline-queue.test.ts +0 -302
- package/src/ee/offline-queue.ts +0 -205
- package/src/ee/phase-outcome.test.ts +0 -107
- package/src/ee/phase-outcome.ts +0 -165
- package/src/ee/phase-tracker.test.ts +0 -175
- package/src/ee/phase-tracker.ts +0 -180
- package/src/ee/posttool.test.ts +0 -81
- package/src/ee/posttool.ts +0 -16
- package/src/ee/prompt-stale.test.ts +0 -92
- package/src/ee/prompt-stale.ts +0 -39
- package/src/ee/render.test.ts +0 -74
- package/src/ee/render.ts +0 -68
- package/src/ee/scope.test.ts +0 -112
- package/src/ee/scope.ts +0 -93
- package/src/ee/session-trajectory.test.ts +0 -139
- package/src/ee/session-trajectory.ts +0 -226
- package/src/ee/tenant.ts +0 -14
- package/src/ee/touch.test.ts +0 -73
- package/src/ee/types.ts +0 -387
- package/src/flow/.gitkeep +0 -0
- package/src/flow/__tests__/migration.test.ts +0 -133
- package/src/flow/__tests__/parser.test.ts +0 -77
- package/src/flow/__tests__/run-manager-product.test.ts +0 -59
- package/src/flow/__tests__/run-manager.test.ts +0 -95
- package/src/flow/__tests__/scaffold-checkpoint.test.ts +0 -113
- package/src/flow/__tests__/scaffold.test.ts +0 -57
- package/src/flow/__tests__/warning-persist.test.ts +0 -112
- package/src/flow/artifact-io.ts +0 -41
- package/src/flow/compaction/__tests__/compress.test.ts +0 -69
- package/src/flow/compaction/__tests__/extract.test.ts +0 -74
- package/src/flow/compaction/__tests__/preserve.test.ts +0 -69
- package/src/flow/compaction/compress.ts +0 -67
- package/src/flow/compaction/extract.ts +0 -60
- package/src/flow/compaction/index.ts +0 -86
- package/src/flow/compaction/preserve.ts +0 -48
- package/src/flow/index.ts +0 -18
- package/src/flow/migration.ts +0 -139
- package/src/flow/parser.ts +0 -78
- package/src/flow/run-manager.ts +0 -162
- package/src/flow/scaffold-checkpoint.ts +0 -132
- package/src/flow/scaffold.ts +0 -52
- package/src/flow/warning-persist.ts +0 -84
- package/src/generated/version.ts +0 -4
- package/src/gsd/.gitkeep +0 -0
- package/src/gsd/__tests__/complexity.test.ts +0 -0
- package/src/gsd/__tests__/directives.test.ts +0 -49
- package/src/gsd/__tests__/gray-areas.test.ts +0 -33
- package/src/gsd/__tests__/types.test.ts +0 -77
- package/src/gsd/complexity.ts +0 -124
- package/src/gsd/directives.ts +0 -94
- package/src/gsd/gray-areas.ts +0 -144
- package/src/gsd/index.ts +0 -1
- package/src/gsd/types.ts +0 -49
- package/src/headless/__tests__/council-answers.test.ts +0 -266
- package/src/headless/council-answers.ts +0 -130
- package/src/headless/output.test.ts +0 -201
- package/src/headless/output.ts +0 -312
- package/src/hooks/config.ts +0 -41
- package/src/hooks/index.ts +0 -547
- package/src/hooks/types.ts +0 -263
- package/src/index.ts +0 -1570
- package/src/lsp/builtins.test.ts +0 -104
- package/src/lsp/builtins.ts +0 -409
- package/src/lsp/client.ts +0 -342
- package/src/lsp/manager.test.ts +0 -164
- package/src/lsp/manager.ts +0 -293
- package/src/lsp/npm-cache.test.ts +0 -68
- package/src/lsp/npm-cache.ts +0 -108
- package/src/lsp/runtime.ts +0 -70
- package/src/lsp/smoke.test.ts +0 -74
- package/src/lsp/types.ts +0 -116
- package/src/mcp/__tests__/auto-setup.test.ts +0 -88
- package/src/mcp/__tests__/harness-driver-action-tools.spec.ts +0 -114
- package/src/mcp/__tests__/harness-driver-async-tools.spec.ts +0 -127
- package/src/mcp/__tests__/harness-driver-read-tools.spec.ts +0 -140
- package/src/mcp/__tests__/harness-driver-security.spec.ts +0 -71
- package/src/mcp/__tests__/harness-driver.spec.ts +0 -21
- package/src/mcp/__tests__/lazy-schema.spec.ts +0 -173
- package/src/mcp/__tests__/mcp-keychain.test.ts +0 -46
- package/src/mcp/__tests__/research-onboarding.test.ts +0 -163
- package/src/mcp/__tests__/runtime-hydration.test.ts +0 -86
- package/src/mcp/__tests__/runtime-sanitize.test.ts +0 -44
- package/src/mcp/auto-setup.ts +0 -99
- package/src/mcp/catalog.ts +0 -155
- package/src/mcp/mcp-keychain.ts +0 -77
- package/src/mcp/oauth-callback.ts +0 -75
- package/src/mcp/oauth-provider.ts +0 -128
- package/src/mcp/opentui-spawn.ts +0 -64
- package/src/mcp/parse-headers.test.ts +0 -54
- package/src/mcp/parse-headers.ts +0 -35
- package/src/mcp/research-onboarding.ts +0 -143
- package/src/mcp/runtime.ts +0 -171
- package/src/mcp/smoke.test.ts +0 -170
- package/src/mcp/validate.ts +0 -48
- package/src/models/__tests__/registry.test.ts +0 -95
- package/src/models/catalog-client.ts +0 -140
- package/src/models/catalog.README.md +0 -136
- package/src/models/catalog.json +0 -177
- package/src/models/classify-tier.ts +0 -48
- package/src/models/index.ts +0 -9
- package/src/models/registry.ts +0 -77
- package/src/ops/__tests__/doctor-council-mcp.test.ts +0 -161
- package/src/ops/__tests__/doctor-ee-health.test.ts +0 -129
- package/src/ops/bug-report.test.ts +0 -172
- package/src/ops/bug-report.ts +0 -80
- package/src/ops/doctor.test.ts +0 -108
- package/src/ops/doctor.ts +0 -366
- package/src/orchestrator/__tests__/batch-turn-runner.test.ts +0 -178
- package/src/orchestrator/__tests__/council-manager.test.ts +0 -171
- package/src/orchestrator/__tests__/cross-turn-dedup.test.ts +0 -174
- package/src/orchestrator/__tests__/current-call-id.test.ts +0 -160
- package/src/orchestrator/__tests__/flow-resume.test.ts +0 -71
- package/src/orchestrator/__tests__/message-processor.test.ts +0 -196
- package/src/orchestrator/__tests__/message-write-ahead.test.ts +0 -170
- package/src/orchestrator/__tests__/read-path-budget.test.ts +0 -107
- package/src/orchestrator/__tests__/retry-classifier.test.ts +0 -120
- package/src/orchestrator/__tests__/retry-stream.test.ts +0 -186
- package/src/orchestrator/__tests__/route-feedback.test.ts +0 -55
- package/src/orchestrator/__tests__/stream-runner.test.ts +0 -123
- package/src/orchestrator/__tests__/usage-events-shape.test.ts +0 -80
- package/src/orchestrator/__tests__/usage-normalizer-c1.test.ts +0 -172
- package/src/orchestrator/__tests__/write-ahead.test.ts +0 -162
- package/src/orchestrator/abort.test.ts +0 -37
- package/src/orchestrator/abort.ts +0 -51
- package/src/orchestrator/agent-options.ts +0 -168
- package/src/orchestrator/agent.test.ts +0 -184
- package/src/orchestrator/batch-turn-runner.ts +0 -425
- package/src/orchestrator/batch-utils.ts +0 -340
- package/src/orchestrator/cleanup.test.ts +0 -86
- package/src/orchestrator/compaction.test.ts +0 -181
- package/src/orchestrator/compaction.ts +0 -613
- package/src/orchestrator/council-manager.ts +0 -580
- package/src/orchestrator/cross-turn-dedup.ts +0 -187
- package/src/orchestrator/delegations.test.ts +0 -145
- package/src/orchestrator/delegations.ts +0 -364
- package/src/orchestrator/error-utils.ts +0 -72
- package/src/orchestrator/flow-resume.ts +0 -54
- package/src/orchestrator/message-processor.ts +0 -1985
- package/src/orchestrator/message-seq.test.ts +0 -29
- package/src/orchestrator/message-seq.ts +0 -19
- package/src/orchestrator/orchestrator.ts +0 -2641
- package/src/orchestrator/pending-calls.test.ts +0 -226
- package/src/orchestrator/pending-calls.ts +0 -240
- package/src/orchestrator/prompts.ts +0 -482
- package/src/orchestrator/provider-options-shape.spec.ts +0 -67
- package/src/orchestrator/provider-options-shape.ts +0 -70
- package/src/orchestrator/read-path-budget.ts +0 -128
- package/src/orchestrator/reasoning.test.ts +0 -29
- package/src/orchestrator/reasoning.ts +0 -69
- package/src/orchestrator/retry-classifier.ts +0 -131
- package/src/orchestrator/retry-stream.ts +0 -159
- package/src/orchestrator/sandbox.test.ts +0 -115
- package/src/orchestrator/stream-runner.ts +0 -729
- package/src/orchestrator/sub-agent-cap.test.ts +0 -186
- package/src/orchestrator/sub-agent-cap.ts +0 -218
- package/src/orchestrator/subagent-compactor.spec.ts +0 -144
- package/src/orchestrator/subagent-compactor.ts +0 -242
- package/src/orchestrator/token-counter.test.ts +0 -69
- package/src/orchestrator/token-counter.ts +0 -81
- package/src/orchestrator/tool-utils.ts +0 -214
- package/src/orchestrator/turn-runner-deps.ts +0 -83
- package/src/pil/__tests__/budget.test.ts +0 -39
- package/src/pil/__tests__/config.test.ts +0 -32
- package/src/pil/__tests__/dual-run.test.ts +0 -53
- package/src/pil/__tests__/layer1-intent-trace.test.ts +0 -140
- package/src/pil/__tests__/layer1-intent.test.ts +0 -346
- package/src/pil/__tests__/layer2-personality.test.ts +0 -63
- package/src/pil/__tests__/layer3-ee-injection.test.ts +0 -181
- package/src/pil/__tests__/layer3-injected-chunk.test.ts +0 -122
- package/src/pil/__tests__/layer4-gsd.test.ts +0 -109
- package/src/pil/__tests__/layer5-context.test.ts +0 -157
- package/src/pil/__tests__/layer6-output.test.ts +0 -284
- package/src/pil/__tests__/ollama-classify.test.ts +0 -81
- package/src/pil/__tests__/orchestrator-integration.test.ts +0 -107
- package/src/pil/__tests__/pipeline.test.ts +0 -190
- package/src/pil/__tests__/renderer-coverage.test.ts +0 -46
- package/src/pil/__tests__/response-tools.test.ts +0 -174
- package/src/pil/__tests__/schema.test.ts +0 -233
- package/src/pil/__tests__/scoreComplexity.test.ts +0 -134
- package/src/pil/__tests__/scoreSufficiency.test.ts +0 -104
- package/src/pil/__tests__/store.test.ts +0 -49
- package/src/pil/__tests__/task-tier-map.test.ts +0 -41
- package/src/pil/budget-log.ts +0 -86
- package/src/pil/budget.ts +0 -18
- package/src/pil/config.ts +0 -11
- package/src/pil/index.ts +0 -12
- package/src/pil/layer1-intent.test.ts +0 -127
- package/src/pil/layer1-intent.ts +0 -580
- package/src/pil/layer2-personality.ts +0 -46
- package/src/pil/layer3-ee-injection.ts +0 -345
- package/src/pil/layer4-gsd.ts +0 -118
- package/src/pil/layer5-context.ts +0 -160
- package/src/pil/layer6-output.ts +0 -260
- package/src/pil/ollama-classify.ts +0 -49
- package/src/pil/pipeline.ts +0 -207
- package/src/pil/response-tools.ts +0 -110
- package/src/pil/schema.ts +0 -103
- package/src/pil/store.ts +0 -29
- package/src/pil/task-tier-map.ts +0 -90
- package/src/pil/timeout.ts +0 -10
- package/src/pil/types.ts +0 -150
- package/src/product-loop/__tests__/artifact-io.test.ts +0 -97
- package/src/product-loop/__tests__/assumption-ledger.test.ts +0 -292
- package/src/product-loop/__tests__/cb2-retry-bonus.test.ts +0 -182
- package/src/product-loop/__tests__/circuit-breakers-coverage.test.ts +0 -82
- package/src/product-loop/__tests__/circuit-breakers.test.ts +0 -90
- package/src/product-loop/__tests__/complexity-routing.spec.ts +0 -169
- package/src/product-loop/__tests__/context-policy.test.ts +0 -280
- package/src/product-loop/__tests__/cost-preview.test.ts +0 -118
- package/src/product-loop/__tests__/cost-scoper.test.ts +0 -76
- package/src/product-loop/__tests__/cross-run-memory.test.ts +0 -195
- package/src/product-loop/__tests__/design-output.spec.ts +0 -39
- package/src/product-loop/__tests__/discover.test.ts +0 -98
- package/src/product-loop/__tests__/discovery-council-runner.test.ts +0 -13
- package/src/product-loop/__tests__/discovery-detection.test.ts +0 -180
- package/src/product-loop/__tests__/discovery-ecosystem.test.ts +0 -132
- package/src/product-loop/__tests__/discovery-integration.test.ts +0 -133
- package/src/product-loop/__tests__/discovery-interview.test.ts +0 -305
- package/src/product-loop/__tests__/discovery-migrations.test.ts +0 -75
- package/src/product-loop/__tests__/discovery-persistence.test.ts +0 -171
- package/src/product-loop/__tests__/discovery-prompt-parser.test.ts +0 -77
- package/src/product-loop/__tests__/discovery-recommender-ecosystem.test.ts +0 -94
- package/src/product-loop/__tests__/discovery-recommender.test.ts +0 -382
- package/src/product-loop/__tests__/discovery-schema.test.ts +0 -102
- package/src/product-loop/__tests__/done-gate-coverage.test.ts +0 -151
- package/src/product-loop/__tests__/done-gate.test.ts +0 -140
- package/src/product-loop/__tests__/ee-extract-wiring.test.ts +0 -216
- package/src/product-loop/__tests__/extract-to-ee.test.ts +0 -205
- package/src/product-loop/__tests__/feedback-routing.test.ts +0 -93
- package/src/product-loop/__tests__/hot-path.spec.ts +0 -177
- package/src/product-loop/__tests__/integration.test.ts +0 -344
- package/src/product-loop/__tests__/loop-driver-audit.test.ts +0 -321
- package/src/product-loop/__tests__/loop-driver.test.ts +0 -247
- package/src/product-loop/__tests__/phase-budget.test.ts +0 -172
- package/src/product-loop/__tests__/phase-orchestrator-integration.test.ts +0 -143
- package/src/product-loop/__tests__/phase-plan.test.ts +0 -241
- package/src/product-loop/__tests__/phase-rituals.test.ts +0 -211
- package/src/product-loop/__tests__/phase-runner.test.ts +0 -454
- package/src/product-loop/__tests__/phase-tracker-bridge.test.ts +0 -85
- package/src/product-loop/__tests__/product-identity.test.ts +0 -47
- package/src/product-loop/__tests__/reality-anchor.test.ts +0 -58
- package/src/product-loop/__tests__/repo-audit.test.ts +0 -103
- package/src/product-loop/__tests__/role-memory.test.ts +0 -70
- package/src/product-loop/__tests__/role-registry.test.ts +0 -235
- package/src/product-loop/__tests__/role-routing-ee.test.ts +0 -90
- package/src/product-loop/__tests__/route-decision-emit.test.ts +0 -207
- package/src/product-loop/__tests__/seed-questions.test.ts +0 -33
- package/src/product-loop/__tests__/ship-polish.test.ts +0 -109
- package/src/product-loop/__tests__/sprint-runner-emit.test.ts +0 -324
- package/src/product-loop/__tests__/sprint-runner.test.ts +0 -501
- package/src/product-loop/__tests__/stakeholder-acl.test.ts +0 -94
- package/src/product-loop/__tests__/state-md-ee-injections.test.ts +0 -229
- package/src/product-loop/__tests__/sufficiency-routing.spec.ts +0 -177
- package/src/product-loop/__tests__/typed-artifacts.test.ts +0 -261
- package/src/product-loop/__tests__/types.test.ts +0 -103
- package/src/product-loop/__tests__/verify-failure-threshold.test.ts +0 -177
- package/src/product-loop/__tests__/verify-failure-tracking.test.ts +0 -154
- package/src/product-loop/__tests__/verify-result.test.ts +0 -60
- package/src/product-loop/artifact-io.ts +0 -239
- package/src/product-loop/assumption-ledger.ts +0 -270
- package/src/product-loop/circuit-breakers.ts +0 -76
- package/src/product-loop/context-policy.ts +0 -180
- package/src/product-loop/cost-preview.ts +0 -124
- package/src/product-loop/cost-scoper.ts +0 -49
- package/src/product-loop/cross-run-memory.ts +0 -450
- package/src/product-loop/design-output.ts +0 -24
- package/src/product-loop/discover.ts +0 -159
- package/src/product-loop/discovery-context-format.ts +0 -32
- package/src/product-loop/discovery-council-runner.ts +0 -82
- package/src/product-loop/discovery-detection.ts +0 -161
- package/src/product-loop/discovery-ecosystem.ts +0 -124
- package/src/product-loop/discovery-interview.ts +0 -237
- package/src/product-loop/discovery-migrations.ts +0 -40
- package/src/product-loop/discovery-persistence.ts +0 -219
- package/src/product-loop/discovery-prompt-parser.ts +0 -80
- package/src/product-loop/discovery-recommender.ts +0 -366
- package/src/product-loop/discovery-schema.ts +0 -143
- package/src/product-loop/done-gate.ts +0 -224
- package/src/product-loop/feedback-routing.ts +0 -82
- package/src/product-loop/gather.ts +0 -304
- package/src/product-loop/index.ts +0 -1305
- package/src/product-loop/loop-driver.ts +0 -901
- package/src/product-loop/phase-budget.ts +0 -182
- package/src/product-loop/phase-plan.ts +0 -158
- package/src/product-loop/phase-rituals.ts +0 -158
- package/src/product-loop/phase-runner.ts +0 -455
- package/src/product-loop/phase-tracker-bridge.ts +0 -60
- package/src/product-loop/product-identity.ts +0 -11
- package/src/product-loop/reality-anchor.ts +0 -45
- package/src/product-loop/repo-audit.ts +0 -314
- package/src/product-loop/role-memory.ts +0 -72
- package/src/product-loop/role-registry.ts +0 -175
- package/src/product-loop/seed-questions.ts +0 -51
- package/src/product-loop/ship-polish.ts +0 -164
- package/src/product-loop/sprint-runner.ts +0 -610
- package/src/product-loop/stakeholder-acl.ts +0 -82
- package/src/product-loop/typed-artifacts.ts +0 -332
- package/src/product-loop/types.ts +0 -443
- package/src/product-loop/verify-failure-tracking.ts +0 -225
- package/src/product-loop/verify-result.ts +0 -39
- package/src/providers/.gitkeep +0 -0
- package/src/providers/__test-utils__/load-fixture.ts +0 -36
- package/src/providers/__tests__/adapter-oauth-wiring.test.ts +0 -129
- package/src/providers/__tests__/capabilities-cosmetic.test.ts +0 -119
- package/src/providers/__tests__/capabilities-flags.test.ts +0 -166
- package/src/providers/__tests__/capabilities-provider-options.test.ts +0 -203
- package/src/providers/__tests__/capabilities-sanitize.test.ts +0 -82
- package/src/providers/__tests__/capabilities.test.ts +0 -44
- package/src/providers/__tests__/provider-coverage.test.ts +0 -48
- package/src/providers/__tests__/runtime-integration.test.ts +0 -97
- package/src/providers/__tests__/runtime.test.ts +0 -96
- package/src/providers/__tests__/siliconflow-history.test.ts +0 -82
- package/src/providers/__tests__/strategies-registry.test.ts +0 -55
- package/src/providers/__tests__/strategies-resolve.test.ts +0 -137
- package/src/providers/__tests__/wire-debug.test.ts +0 -42
- package/src/providers/adapter.test.ts +0 -21
- package/src/providers/adapter.ts +0 -156
- package/src/providers/anthropic.ts +0 -174
- package/src/providers/auth/__tests__/browser-flow.test.ts +0 -235
- package/src/providers/auth/__tests__/device-flow.test.ts +0 -263
- package/src/providers/auth/__tests__/gemini-oauth.test.ts +0 -387
- package/src/providers/auth/__tests__/openai-oauth.test.ts +0 -378
- package/src/providers/auth/__tests__/token-store.test.ts +0 -152
- package/src/providers/auth/browser-flow.ts +0 -140
- package/src/providers/auth/device-flow.ts +0 -221
- package/src/providers/auth/gemini-oauth.ts +0 -351
- package/src/providers/auth/openai-oauth.ts +0 -455
- package/src/providers/auth/registry.ts +0 -121
- package/src/providers/auth/token-store.ts +0 -154
- package/src/providers/auth/types.ts +0 -111
- package/src/providers/capabilities.ts +0 -351
- package/src/providers/endpoints.ts +0 -68
- package/src/providers/errors.test.ts +0 -76
- package/src/providers/errors.ts +0 -46
- package/src/providers/gemini.test.ts +0 -46
- package/src/providers/gemini.ts +0 -42
- package/src/providers/index.ts +0 -28
- package/src/providers/keychain.test.ts +0 -100
- package/src/providers/keychain.ts +0 -267
- package/src/providers/mcp-vision-bridge.test.ts +0 -513
- package/src/providers/mcp-vision-bridge.ts +0 -1020
- package/src/providers/ollama.test.ts +0 -46
- package/src/providers/ollama.ts +0 -36
- package/src/providers/openai-compatible.test.ts +0 -63
- package/src/providers/openai-compatible.ts +0 -58
- package/src/providers/openai.test.ts +0 -65
- package/src/providers/openai.ts +0 -56
- package/src/providers/patch-zod-schema.ts +0 -126
- package/src/providers/pricing.test.ts +0 -65
- package/src/providers/pricing.ts +0 -111
- package/src/providers/prompt-cache-key.spec.ts +0 -28
- package/src/providers/runtime-mock.spec.ts +0 -86
- package/src/providers/runtime.ts +0 -283
- package/src/providers/siliconflow-history.ts +0 -74
- package/src/providers/strategies/anthropic.strategy.ts +0 -25
- package/src/providers/strategies/base.strategy.ts +0 -76
- package/src/providers/strategies/deepseek.strategy.ts +0 -26
- package/src/providers/strategies/google.strategy.ts +0 -28
- package/src/providers/strategies/ollama.strategy.ts +0 -22
- package/src/providers/strategies/openai.strategy.ts +0 -55
- package/src/providers/strategies/registry.ts +0 -43
- package/src/providers/strategies/siliconflow.strategy.ts +0 -26
- package/src/providers/strategies/xai.strategy.ts +0 -26
- package/src/providers/stream-loop.ts +0 -83
- package/src/providers/types.ts +0 -145
- package/src/providers/vision-proxy.test.ts +0 -252
- package/src/providers/vision-proxy.ts +0 -317
- package/src/providers/wire-debug.ts +0 -163
- package/src/router/.gitkeep +0 -0
- package/src/router/__tests__/step-router.test.ts +0 -150
- package/src/router/classifier/grammars.ts +0 -17
- package/src/router/classifier/index.test.ts +0 -33
- package/src/router/classifier/index.ts +0 -21
- package/src/router/classifier/regex.test.ts +0 -49
- package/src/router/classifier/regex.ts +0 -113
- package/src/router/classifier/tree-sitter.test.ts +0 -26
- package/src/router/classifier/tree-sitter.ts +0 -87
- package/src/router/cold.test.ts +0 -62
- package/src/router/cold.ts +0 -27
- package/src/router/decide.test.ts +0 -147
- package/src/router/decide.ts +0 -472
- package/src/router/health.test.ts +0 -59
- package/src/router/health.ts +0 -49
- package/src/router/provider-sentinel.test.ts +0 -22
- package/src/router/provider-sentinel.ts +0 -20
- package/src/router/step-router.ts +0 -194
- package/src/router/store.ts +0 -47
- package/src/router/types.ts +0 -20
- package/src/router/warm.test.ts +0 -168
- package/src/router/warm.ts +0 -53
- package/src/scaffold/__tests__/continuation-prompt.test.ts +0 -93
- package/src/scaffold/__tests__/continue-as-council.spec.ts +0 -124
- package/src/scaffold/__tests__/dotnet-assembly-name.test.ts +0 -28
- package/src/scaffold/__tests__/fe-scaffold-contents.test.ts +0 -127
- package/src/scaffold/__tests__/init-new.smoke.spec.ts +0 -99
- package/src/scaffold/__tests__/init-new.spec.ts +0 -450
- package/src/scaffold/__tests__/install-bb-templates.spec.ts +0 -86
- package/src/scaffold/__tests__/point-to-existing.spec.ts +0 -114
- package/src/scaffold/bb-ecosystem-apply.ts +0 -454
- package/src/scaffold/bb-quality-gate.ts +0 -287
- package/src/scaffold/continuation-prompt.ts +0 -80
- package/src/scaffold/continue-as-council.ts +0 -99
- package/src/scaffold/init-new.ts +0 -1691
- package/src/scaffold/point-to-existing.ts +0 -83
- package/src/scaffold/resume-from-gate-failures.ts +0 -167
- package/src/storage/__tests__/migrations.test.ts +0 -395
- package/src/storage/__tests__/ui-interaction-log.test.ts +0 -105
- package/src/storage/atomic-io.test.ts +0 -92
- package/src/storage/atomic-io.ts +0 -160
- package/src/storage/config.test.ts +0 -33
- package/src/storage/config.ts +0 -53
- package/src/storage/db.ts +0 -184
- package/src/storage/index.ts +0 -26
- package/src/storage/interaction-log.ts +0 -121
- package/src/storage/migrations.ts +0 -205
- package/src/storage/session-dir.ts +0 -37
- package/src/storage/sessions.ts +0 -206
- package/src/storage/tool-results.ts +0 -56
- package/src/storage/transcript-view.ts +0 -45
- package/src/storage/transcript.test.ts +0 -24
- package/src/storage/transcript.ts +0 -561
- package/src/storage/ui-interaction-log.ts +0 -160
- package/src/storage/usage-cap.test.ts +0 -59
- package/src/storage/usage-cap.ts +0 -81
- package/src/storage/usage.ts +0 -117
- package/src/storage/workspaces.ts +0 -84
- package/src/tools/bash.test.ts +0 -363
- package/src/tools/bash.ts +0 -668
- package/src/tools/computer.test.ts +0 -187
- package/src/tools/computer.ts +0 -632
- package/src/tools/file-tracker.test.ts +0 -99
- package/src/tools/file-tracker.ts +0 -70
- package/src/tools/file.test.ts +0 -95
- package/src/tools/file.ts +0 -182
- package/src/tools/grep.ts +0 -187
- package/src/tools/registry.test.ts +0 -38
- package/src/tools/registry.ts +0 -388
- package/src/tools/schedule.test.ts +0 -143
- package/src/tools/schedule.ts +0 -610
- package/src/types/index.ts +0 -474
- package/src/ui/agents-modal.tsx +0 -292
- package/src/ui/app.tsx +0 -6464
- package/src/ui/cards/__tests__/product-status-card.test.ts +0 -30
- package/src/ui/cards/product-status-card.tsx +0 -117
- package/src/ui/components/SuggestionOverlay.tsx +0 -38
- package/src/ui/components/Toast.tsx +0 -100
- package/src/ui/components/__tests__/council-leader-bubble.test.ts +0 -16
- package/src/ui/components/__tests__/council-message-bubble.test.ts +0 -85
- package/src/ui/components/__tests__/council-phase-timeline.test.ts +0 -57
- package/src/ui/components/__tests__/council-placeholder-bubble.test.ts +0 -16
- package/src/ui/components/__tests__/council-question-card.test.ts +0 -133
- package/src/ui/components/__tests__/council-synthesis-banner.test.ts +0 -12
- package/src/ui/components/__tests__/use-pair-quote-buffer.test.ts +0 -41
- package/src/ui/components/btw-overlay.tsx +0 -66
- package/src/ui/components/bubble-layout.ts +0 -66
- package/src/ui/components/code-block-truncate.ts +0 -24
- package/src/ui/components/copy-flash-banner.tsx +0 -31
- package/src/ui/components/council-info-card.tsx +0 -45
- package/src/ui/components/council-leader-bubble.tsx +0 -41
- package/src/ui/components/council-message-bubble.tsx +0 -111
- package/src/ui/components/council-phase-timeline.tsx +0 -91
- package/src/ui/components/council-placeholder-bubble.tsx +0 -65
- package/src/ui/components/council-question-card.tsx +0 -253
- package/src/ui/components/council-status-list.tsx +0 -111
- package/src/ui/components/council-synthesis-banner.tsx +0 -37
- package/src/ui/components/diff-view.tsx +0 -225
- package/src/ui/components/halt-recovery-card.tsx +0 -83
- package/src/ui/components/hero-logo.tsx +0 -62
- package/src/ui/components/init-new-form-card.tsx +0 -470
- package/src/ui/components/lsp-views.tsx +0 -104
- package/src/ui/components/media-views.tsx +0 -66
- package/src/ui/components/message-view.tsx +0 -343
- package/src/ui/components/point-to-existing-form-card.tsx +0 -136
- package/src/ui/components/prompt-box.tsx +0 -306
- package/src/ui/components/role-palette.ts +0 -62
- package/src/ui/components/session-header.tsx +0 -68
- package/src/ui/components/slash-inline-menu.tsx +0 -63
- package/src/ui/components/structured-response-view.tsx +0 -191
- package/src/ui/components/tool-result-views.tsx +0 -258
- package/src/ui/components/use-pair-quote-buffer.ts +0 -23
- package/src/ui/constants.ts +0 -242
- package/src/ui/hooks/use-agent-editor.ts +0 -64
- package/src/ui/hooks/use-mcp-editor.ts +0 -39
- package/src/ui/hooks/use-model-picker.ts +0 -50
- package/src/ui/hooks/useTypeahead.ts +0 -160
- package/src/ui/markdown.tsx +0 -49
- package/src/ui/mcp-modal-types.ts +0 -33
- package/src/ui/mcp-modal.tsx +0 -484
- package/src/ui/modals/api-key-modal.tsx +0 -99
- package/src/ui/modals/connect-modal.tsx +0 -259
- package/src/ui/modals/model-picker-modal.tsx +0 -323
- package/src/ui/modals/sandbox-picker-modal.tsx +0 -99
- package/src/ui/modals/update-modal.tsx +0 -67
- package/src/ui/modals/wallet-picker-modal.tsx +0 -186
- package/src/ui/plan.tsx +0 -346
- package/src/ui/schedule-modal.tsx +0 -138
- package/src/ui/slash/__tests__/clear.test.ts +0 -86
- package/src/ui/slash/__tests__/compact.test.ts +0 -56
- package/src/ui/slash/__tests__/cost.test.ts +0 -62
- package/src/ui/slash/__tests__/discuss.test.ts +0 -101
- package/src/ui/slash/__tests__/execute.test.ts +0 -86
- package/src/ui/slash/__tests__/expand.test.ts +0 -86
- package/src/ui/slash/__tests__/ideal.test.ts +0 -134
- package/src/ui/slash/__tests__/menu-parity.test.ts +0 -43
- package/src/ui/slash/__tests__/optimize.test.ts +0 -155
- package/src/ui/slash/__tests__/pin.test.ts +0 -47
- package/src/ui/slash/__tests__/plan.test.ts +0 -95
- package/src/ui/slash/clear.ts +0 -89
- package/src/ui/slash/compact.ts +0 -46
- package/src/ui/slash/cost.ts +0 -63
- package/src/ui/slash/council-inspect.ts +0 -188
- package/src/ui/slash/council.ts +0 -30
- package/src/ui/slash/debug.ts +0 -153
- package/src/ui/slash/discuss.ts +0 -71
- package/src/ui/slash/ee.ts +0 -304
- package/src/ui/slash/execute.ts +0 -44
- package/src/ui/slash/expand.ts +0 -51
- package/src/ui/slash/export.ts +0 -281
- package/src/ui/slash/ideal.ts +0 -254
- package/src/ui/slash/menu-items.ts +0 -106
- package/src/ui/slash/optimize.ts +0 -47
- package/src/ui/slash/pin.ts +0 -41
- package/src/ui/slash/plan.ts +0 -62
- package/src/ui/slash/registry.ts +0 -47
- package/src/ui/slash/route.test.ts +0 -82
- package/src/ui/slash/route.ts +0 -43
- package/src/ui/status-bar/index.test.tsx +0 -90
- package/src/ui/status-bar/index.tsx +0 -98
- package/src/ui/status-bar/store.test.ts +0 -131
- package/src/ui/status-bar/store.ts +0 -186
- package/src/ui/status-bar/tier-badge.test.tsx +0 -38
- package/src/ui/status-bar/tier-badge.tsx +0 -29
- package/src/ui/status-bar/usd-meter.test.tsx +0 -37
- package/src/ui/status-bar/usd-meter.tsx +0 -22
- package/src/ui/syntax-highlight.ts +0 -627
- package/src/ui/terminal-selection-text.ts +0 -72
- package/src/ui/theme.ts +0 -95
- package/src/ui/types.ts +0 -83
- package/src/ui/utils/color.ts +0 -19
- package/src/ui/utils/format.ts +0 -86
- package/src/ui/utils/modal.ts +0 -9
- package/src/ui/utils/text.ts +0 -31
- package/src/ui/utils/tools.ts +0 -95
- package/src/usage/.gitkeep +0 -0
- package/src/usage/__tests__/product-ledger.test.ts +0 -85
- package/src/usage/cost-log.ts +0 -158
- package/src/usage/decision-log.ts +0 -86
- package/src/usage/downgrade.test.ts +0 -82
- package/src/usage/downgrade.ts +0 -70
- package/src/usage/estimator.test.ts +0 -43
- package/src/usage/estimator.ts +0 -58
- package/src/usage/ledger.test.ts +0 -200
- package/src/usage/ledger.ts +0 -253
- package/src/usage/midstream.test.ts +0 -55
- package/src/usage/midstream.ts +0 -51
- package/src/usage/product-ledger.ts +0 -111
- package/src/usage/thresholds.test.ts +0 -83
- package/src/usage/thresholds.ts +0 -74
- package/src/usage/types.ts +0 -41
- package/src/utils/__tests__/auto-council-settings.test.ts +0 -46
- package/src/utils/__tests__/ee-logger.test.ts +0 -197
- package/src/utils/__tests__/file-lock.test.ts +0 -74
- package/src/utils/__tests__/rate-limit.test.ts +0 -42
- package/src/utils/__tests__/settings-disabled-models.test.ts +0 -113
- package/src/utils/__tests__/settings-web-research.test.ts +0 -45
- package/src/utils/__tests__/slugify.test.ts +0 -45
- package/src/utils/__tests__/visible-retry.test.ts +0 -195
- package/src/utils/at-mentions.ts +0 -120
- package/src/utils/clipboard-image.ts +0 -139
- package/src/utils/ee-logger.ts +0 -163
- package/src/utils/file-index.ts +0 -152
- package/src/utils/file-lock.ts +0 -66
- package/src/utils/git-root.ts +0 -17
- package/src/utils/host-clipboard.ts +0 -68
- package/src/utils/install-manager.test.ts +0 -167
- package/src/utils/install-manager.ts +0 -429
- package/src/utils/instructions.test.ts +0 -112
- package/src/utils/instructions.ts +0 -149
- package/src/utils/permission-mode.test.ts +0 -121
- package/src/utils/permission-mode.ts +0 -37
- package/src/utils/rate-limit.ts +0 -21
- package/src/utils/redactor.test.ts +0 -100
- package/src/utils/redactor.ts +0 -223
- package/src/utils/settings.test.ts +0 -181
- package/src/utils/settings.ts +0 -1108
- package/src/utils/shell.test.ts +0 -72
- package/src/utils/shell.ts +0 -193
- package/src/utils/side-question.ts +0 -39
- package/src/utils/skills.test.ts +0 -58
- package/src/utils/skills.ts +0 -207
- package/src/utils/slugify.ts +0 -9
- package/src/utils/subagent-display.test.ts +0 -23
- package/src/utils/subagent-display.ts +0 -11
- package/src/utils/subagents-settings.test.ts +0 -77
- package/src/utils/telegram-audio-settings.test.ts +0 -44
- package/src/utils/update-checker.test.ts +0 -182
- package/src/utils/update-checker.ts +0 -33
- package/src/utils/visible-retry.ts +0 -56
- package/src/verify/__tests__/coverage-parsers.test.ts +0 -86
- package/src/verify/__tests__/dotnet-recipe.test.ts +0 -88
- package/src/verify/checkpoint.test.ts +0 -186
- package/src/verify/checkpoint.ts +0 -239
- package/src/verify/coverage-parsers.ts +0 -76
- package/src/verify/entrypoint.test.ts +0 -293
- package/src/verify/entrypoint.ts +0 -439
- package/src/verify/environment.test.ts +0 -119
- package/src/verify/environment.ts +0 -115
- package/src/verify/evidence.ts +0 -104
- package/src/verify/orchestrator.test.ts +0 -159
- package/src/verify/orchestrator.ts +0 -129
- package/src/verify/recipes.ts +0 -592
- package/src/verify/retry.ts +0 -62
- package/src/verify/runtime-prep.test.ts +0 -47
- /package/dist/src/{providers/__tests__/siliconflow-history.test.d.ts → council/__tests__/clarifier-ready-gate.test.d.ts} +0 -0
package/src/index.ts
DELETED
|
@@ -1,1570 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
// SECURITY: Redactor must be the FIRST import. installGlobalPatches() wraps
|
|
3
|
-
// console.* before any subsequent import side-effect or log can emit an API key.
|
|
4
|
-
// See: PROV-07, Pitfall 2 (HIGH severity API key leakage).
|
|
5
|
-
import { redactor } from "./utils/redactor.js";
|
|
6
|
-
|
|
7
|
-
redactor.installGlobalPatches();
|
|
8
|
-
|
|
9
|
-
import { readFileSync } from "node:fs";
|
|
10
|
-
import { InvalidArgumentError, program } from "commander";
|
|
11
|
-
import { createInterface } from "readline";
|
|
12
|
-
|
|
13
|
-
// Version is generated at build time by scripts/sync-version.cjs from
|
|
14
|
-
// package.json. Inlining as a constant avoids three failure modes:
|
|
15
|
-
// - Node ESM rejecting `import pkg from "../package.json"` without assertion
|
|
16
|
-
// - bun --compile virtual fs not resolving readFileSync paths
|
|
17
|
-
// - Stripping package.json from published files list
|
|
18
|
-
import { PACKAGE_DESCRIPTION, PACKAGE_VERSION } from "./generated/version.js";
|
|
19
|
-
|
|
20
|
-
const packageJson = { version: PACKAGE_VERSION, description: PACKAGE_DESCRIPTION };
|
|
21
|
-
|
|
22
|
-
import { hydrateChatEnvFromKeychain } from "./chat/chat-keychain.js";
|
|
23
|
-
import { setRenderSink } from "./ee/render.js";
|
|
24
|
-
import {
|
|
25
|
-
type CouncilAnswersFile,
|
|
26
|
-
type CouncilAutoAnswerer,
|
|
27
|
-
createCouncilAutoAnswerer,
|
|
28
|
-
handleCouncilChunk,
|
|
29
|
-
parseCouncilAnswersFile,
|
|
30
|
-
} from "./headless/council-answers";
|
|
31
|
-
import {
|
|
32
|
-
createHeadlessJsonlEmitter,
|
|
33
|
-
type HeadlessOutputFormat,
|
|
34
|
-
isHeadlessOutputFormat,
|
|
35
|
-
renderHeadlessChunk,
|
|
36
|
-
renderHeadlessPrelude,
|
|
37
|
-
} from "./headless/output";
|
|
38
|
-
import { loadCatalog, normalizeModelId } from "./models/registry.js";
|
|
39
|
-
// Plan 00-07: boot-order modules — AbortContext + PendingCallsLog (TUI-01, TUI-03, TUI-04).
|
|
40
|
-
import { createAbortContext } from "./orchestrator/abort.js";
|
|
41
|
-
import { completeDelegation, failDelegation, loadDelegation } from "./orchestrator/delegations";
|
|
42
|
-
import { Agent } from "./orchestrator/orchestrator";
|
|
43
|
-
import { createPendingCallsLog } from "./orchestrator/pending-calls.js";
|
|
44
|
-
import { getProviderCapabilities } from "./providers/capabilities.js";
|
|
45
|
-
import {
|
|
46
|
-
KEYCHAIN_PROVIDER_IDS,
|
|
47
|
-
listStoredProviders,
|
|
48
|
-
loadKeyForProvider,
|
|
49
|
-
setKeyForProvider,
|
|
50
|
-
} from "./providers/keychain.js";
|
|
51
|
-
import { detectProviderForModel } from "./providers/runtime.js";
|
|
52
|
-
import type { ProviderId } from "./providers/types.js";
|
|
53
|
-
import { loadConfig } from "./storage/config.js";
|
|
54
|
-
import { loadUsage } from "./storage/usage-cap.js";
|
|
55
|
-
import { startScheduleDaemon } from "./tools/schedule";
|
|
56
|
-
import type { StreamChunk } from "./types/index.js";
|
|
57
|
-
import { processAtMentions } from "./utils/at-mentions.js";
|
|
58
|
-
import { runScriptManagedUninstall } from "./utils/install-manager";
|
|
59
|
-
import type { PermissionMode } from "./utils/permission-mode.js";
|
|
60
|
-
import {
|
|
61
|
-
getApiKey,
|
|
62
|
-
getBaseURL,
|
|
63
|
-
getCurrentModel,
|
|
64
|
-
getCurrentSandboxMode,
|
|
65
|
-
getCurrentSandboxSettings,
|
|
66
|
-
mergeSandboxSettings,
|
|
67
|
-
type SandboxMode,
|
|
68
|
-
type SandboxSettings,
|
|
69
|
-
saveUserSettings,
|
|
70
|
-
} from "./utils/settings";
|
|
71
|
-
import { runUpdate } from "./utils/update-checker";
|
|
72
|
-
import { buildVerifyPrompt, getVerifyCliError } from "./verify/entrypoint";
|
|
73
|
-
|
|
74
|
-
// Hydrate chat secrets from OS keychain before CLI bootstrap
|
|
75
|
-
await hydrateChatEnvFromKeychain();
|
|
76
|
-
|
|
77
|
-
const exitCleanlyOnSigterm = () => {
|
|
78
|
-
process.exit(0);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
process.on("SIGTERM", exitCleanlyOnSigterm);
|
|
82
|
-
|
|
83
|
-
process.on("uncaughtException", (err) => {
|
|
84
|
-
try {
|
|
85
|
-
require("fs").appendFileSync(
|
|
86
|
-
require("path").join(require("os").homedir(), ".muonroi-cli", "crash.log"),
|
|
87
|
-
`[${new Date().toISOString()}] UNCAUGHT: ${err.stack || err.message}\n`,
|
|
88
|
-
);
|
|
89
|
-
} catch {}
|
|
90
|
-
console.error("Fatal:", err.message);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
process.on("unhandledRejection", (reason) => {
|
|
95
|
-
const msg = reason instanceof Error ? reason.stack || reason.message : String(reason);
|
|
96
|
-
try {
|
|
97
|
-
require("fs").appendFileSync(
|
|
98
|
-
require("path").join(require("os").homedir(), ".muonroi-cli", "crash.log"),
|
|
99
|
-
`[${new Date().toISOString()}] REJECTION: ${msg}\n`,
|
|
100
|
-
);
|
|
101
|
-
} catch {}
|
|
102
|
-
if (reason instanceof Error) {
|
|
103
|
-
console.error("Unhandled rejection:", reason.stack || reason.message);
|
|
104
|
-
} else if (reason && typeof reason === "object") {
|
|
105
|
-
console.error("Unhandled rejection:", JSON.stringify(reason, Object.getOwnPropertyNames(reason)));
|
|
106
|
-
} else {
|
|
107
|
-
console.error("Unhandled rejection:", String(reason));
|
|
108
|
-
}
|
|
109
|
-
process.exit(1);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// ── EE render sink wiring (CQ-16a) ─────────────────────────────────────────
|
|
113
|
-
// Single-orchestrator-at-a-time invariant holds (no multi-session concurrency in v1.6).
|
|
114
|
-
// Sink routes experience_warning chunks into the active orchestrator's chat stream.
|
|
115
|
-
// When no active stream (headless / idle): drop silently — never leak to stderr in TUI.
|
|
116
|
-
let _activeEeYield: ((chunk: StreamChunk) => void) | null = null;
|
|
117
|
-
|
|
118
|
-
export function setActiveEeYield(fn: ((chunk: StreamChunk) => void) | null): void {
|
|
119
|
-
_activeEeYield = fn;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
setRenderSink((lineOrChunk) => {
|
|
123
|
-
if (!_activeEeYield) return; // drop silently when no TUI active
|
|
124
|
-
const chunk: StreamChunk =
|
|
125
|
-
typeof lineOrChunk === "string"
|
|
126
|
-
? { type: "experience_warning" as StreamChunk["type"], content: lineOrChunk }
|
|
127
|
-
: lineOrChunk;
|
|
128
|
-
_activeEeYield(chunk);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* First-run wizard: prompts for API key interactively when none is configured.
|
|
133
|
-
* Output goes to stderr so it doesn't pollute piped stdout.
|
|
134
|
-
* Returns the trimmed key or null if user cancels / stdin is not a TTY.
|
|
135
|
-
*/
|
|
136
|
-
// Provider console URLs are sourced from providers/capabilities.ts via ProviderCapabilities.consoleSignupURL().
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Try to find an API key for the model the CLI is about to run with.
|
|
140
|
-
* Resolution: env (legacy MUONROI_API_KEY) → OS keychain → settings.json.
|
|
141
|
-
* Returns null if nothing usable is configured anywhere.
|
|
142
|
-
*/
|
|
143
|
-
async function resolveKeyForModel(modelId: string): Promise<string | null> {
|
|
144
|
-
// Test escape hatch: harness specs that need to assert the API-key modal
|
|
145
|
-
// appearance (api-key.spec.ts) set MUONROI_TEST_NO_KEYCHAIN=1 to suppress
|
|
146
|
-
// the dev machine's real keychain entry from masking the unauthenticated
|
|
147
|
-
// boot path. Honoured ONLY in tests — never read in production flows.
|
|
148
|
-
if (process.env["MUONROI_TEST_NO_KEYCHAIN"] === "1") return null;
|
|
149
|
-
const provider = detectProviderForModel(modelId);
|
|
150
|
-
try {
|
|
151
|
-
const k = await loadKeyForProvider(provider);
|
|
152
|
-
if (k) return k;
|
|
153
|
-
} catch {
|
|
154
|
-
/* fall through to wizard */
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* True when the active model's provider is authenticated via OAuth tokens
|
|
161
|
-
* (subscription login) instead of an API key. Lets the boot flow skip the
|
|
162
|
-
* first-run wizard for OAuth-only setups like a freshly logged-in ChatGPT
|
|
163
|
-
* subscription.
|
|
164
|
-
*/
|
|
165
|
-
async function hasOAuthForModel(modelId: string): Promise<boolean> {
|
|
166
|
-
if (process.env["MUONROI_TEST_NO_KEYCHAIN"] === "1") return false;
|
|
167
|
-
const provider = detectProviderForModel(modelId);
|
|
168
|
-
try {
|
|
169
|
-
const { getOAuthProviderConfig } = await import("./providers/auth/registry.js");
|
|
170
|
-
const cfg = await getOAuthProviderConfig(provider);
|
|
171
|
-
if (!cfg) return false;
|
|
172
|
-
const tokens = await cfg.loadTokensWithRefresh();
|
|
173
|
-
return !!tokens?.accessToken;
|
|
174
|
-
} catch {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* First-run wizard. If the keychain already has keys, prints a hint
|
|
181
|
-
* (model probably doesn't match any stored provider). Otherwise prompts
|
|
182
|
-
* for provider + key and persists to the OS keychain.
|
|
183
|
-
*/
|
|
184
|
-
/**
|
|
185
|
-
* Supported splash providers — mirrors SPLASH_PROVIDERS in ui/app.tsx.
|
|
186
|
-
* The wizard only surfaces these; other providers still work programmatically.
|
|
187
|
-
*/
|
|
188
|
-
const WIZARD_PROVIDERS: readonly ProviderId[] = ["deepseek", "siliconflow"];
|
|
189
|
-
|
|
190
|
-
async function firstRunWizard(currentModel?: string): Promise<string | null> {
|
|
191
|
-
let rl: ReturnType<typeof createInterface> | undefined;
|
|
192
|
-
try {
|
|
193
|
-
rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
194
|
-
const ask = (q: string): Promise<string> => new Promise((resolve) => rl!.question(q, (answer) => resolve(answer)));
|
|
195
|
-
|
|
196
|
-
process.stderr.write("\nWelcome to muonroi-cli!\n\n");
|
|
197
|
-
|
|
198
|
-
const stored = await listStoredProviders();
|
|
199
|
-
if (stored.length > 0) {
|
|
200
|
-
process.stderr.write(`Keys already in keychain for: ${stored.join(", ")}\n`);
|
|
201
|
-
if (currentModel) {
|
|
202
|
-
const provider = detectProviderForModel(currentModel);
|
|
203
|
-
process.stderr.write(`Current model '${currentModel}' uses provider '${provider}', which has no stored key.\n`);
|
|
204
|
-
}
|
|
205
|
-
process.stderr.write(
|
|
206
|
-
"\nOptions:\n" +
|
|
207
|
-
" 1. Run with a model that matches a stored provider:\n" +
|
|
208
|
-
" muonroi-cli --model <model-id>\n" +
|
|
209
|
-
" 2. Open /providers inside the TUI to add another key.\n" +
|
|
210
|
-
" 3. muonroi-cli keys set <provider>\n\n",
|
|
211
|
-
);
|
|
212
|
-
rl.close();
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
process.stderr.write("Pick how you want to add credentials:\n\n");
|
|
217
|
-
process.stderr.write(" 1. Paste an API key (most common)\n");
|
|
218
|
-
process.stderr.write(" 2. Import an encrypted bundle file (from another device)\n");
|
|
219
|
-
process.stderr.write(" 3. Sync from a Bitwarden vault\n");
|
|
220
|
-
process.stderr.write(" 4. Skip — set up later via /providers inside the TUI\n\n");
|
|
221
|
-
const actionChoice = (await ask("Choice [1-4, default 1]: ")).trim() || "1";
|
|
222
|
-
|
|
223
|
-
if (actionChoice === "4") {
|
|
224
|
-
process.stderr.write("\nSkipped. Open /providers inside the TUI to add a key any time.\n");
|
|
225
|
-
rl.close();
|
|
226
|
-
return null;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (actionChoice === "2") {
|
|
230
|
-
const file = (await ask("Path to bundle file: ")).trim();
|
|
231
|
-
if (!file) {
|
|
232
|
-
process.stderr.write("No file provided. Aborted.\n");
|
|
233
|
-
rl.close();
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
const passphrase = await ask("Bundle passphrase: ");
|
|
237
|
-
try {
|
|
238
|
-
const { readFileSync: readFile } = await import("node:fs");
|
|
239
|
-
const { decryptBundle } = await import("./cli/keys-bundle.js");
|
|
240
|
-
const raw = readFile(file, "utf8");
|
|
241
|
-
const bundle = JSON.parse(raw);
|
|
242
|
-
const payload = decryptBundle(bundle, passphrase);
|
|
243
|
-
let imported = 0;
|
|
244
|
-
for (const [prov, key] of Object.entries(payload.providers)) {
|
|
245
|
-
if (!(WIZARD_PROVIDERS as readonly string[]).includes(prov)) continue;
|
|
246
|
-
if (typeof key !== "string" || key.length < 20) continue;
|
|
247
|
-
const ok = await setKeyForProvider(prov as ProviderId, key);
|
|
248
|
-
if (ok) {
|
|
249
|
-
imported++;
|
|
250
|
-
process.stderr.write(` ✓ ${prov} → keychain\n`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
process.stderr.write(`\nImported ${imported} key(s). Launch the TUI to start.\n`);
|
|
254
|
-
rl.close();
|
|
255
|
-
// Return any imported key just so caller treats setup as done.
|
|
256
|
-
return imported > 0 ? "imported" : null;
|
|
257
|
-
} catch (err) {
|
|
258
|
-
process.stderr.write(`\nImport failed: ${(err as Error).message}\n`);
|
|
259
|
-
rl.close();
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (actionChoice === "3") {
|
|
265
|
-
const password = await ask("Bitwarden master password: ");
|
|
266
|
-
try {
|
|
267
|
-
const { unlockWithPassword, listSecureNotesByPrefix } = await import("./cli/bw-vault.js");
|
|
268
|
-
const unlock = await unlockWithPassword(password);
|
|
269
|
-
if (!unlock.ok || !unlock.session) {
|
|
270
|
-
process.stderr.write(`\nBitwarden unlock failed: ${unlock.error ?? "unknown error"}\n`);
|
|
271
|
-
rl.close();
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
const list = await listSecureNotesByPrefix(unlock.session, "muonroi-cli/");
|
|
275
|
-
if (!list.ok) {
|
|
276
|
-
process.stderr.write(`\nBitwarden list failed: ${list.error}\n`);
|
|
277
|
-
rl.close();
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
let imported = 0;
|
|
281
|
-
for (const item of list.items) {
|
|
282
|
-
const prov = item.name.slice("muonroi-cli/".length);
|
|
283
|
-
if (!(WIZARD_PROVIDERS as readonly string[]).includes(prov)) continue;
|
|
284
|
-
if (item.notes.length < 20) continue;
|
|
285
|
-
const ok = await setKeyForProvider(prov as ProviderId, item.notes);
|
|
286
|
-
if (ok) {
|
|
287
|
-
imported++;
|
|
288
|
-
process.stderr.write(` ✓ ${prov} → keychain\n`);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
process.stderr.write(`\nImported ${imported} key(s) from Bitwarden. Launch the TUI to start.\n`);
|
|
292
|
-
rl.close();
|
|
293
|
-
return imported > 0 ? "imported" : null;
|
|
294
|
-
} catch (err) {
|
|
295
|
-
process.stderr.write(`\nBitwarden sync failed: ${(err as Error).message}\n`);
|
|
296
|
-
rl.close();
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Default path: paste an API key for one of WIZARD_PROVIDERS.
|
|
302
|
-
process.stderr.write("\nSupported providers:\n\n");
|
|
303
|
-
WIZARD_PROVIDERS.forEach((p, i) => {
|
|
304
|
-
process.stderr.write(` ${i + 1}. ${p.padEnd(12)} ${getProviderCapabilities(p).consoleSignupURL()}\n`);
|
|
305
|
-
});
|
|
306
|
-
process.stderr.write("\n");
|
|
307
|
-
|
|
308
|
-
const choice = (await ask(`Provider [1-${WIZARD_PROVIDERS.length}, default 1]: `)).trim();
|
|
309
|
-
const idx = choice ? Number.parseInt(choice, 10) - 1 : 0;
|
|
310
|
-
if (!Number.isFinite(idx) || idx < 0 || idx >= WIZARD_PROVIDERS.length) {
|
|
311
|
-
process.stderr.write("Invalid choice — aborted.\n");
|
|
312
|
-
rl.close();
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
const provider = WIZARD_PROVIDERS[idx];
|
|
316
|
-
if (!provider) {
|
|
317
|
-
process.stderr.write("Invalid choice — aborted.\n");
|
|
318
|
-
rl.close();
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
process.stderr.write(`\nGet a key here: ${getProviderCapabilities(provider).consoleSignupURL()}\n`);
|
|
323
|
-
const raw = await ask(`Paste your ${provider} API key: `);
|
|
324
|
-
|
|
325
|
-
const trimmed = raw.trim();
|
|
326
|
-
if (!trimmed) {
|
|
327
|
-
process.stderr.write("No key provided. Aborted.\n");
|
|
328
|
-
rl.close();
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
if (trimmed.length < 20) {
|
|
332
|
-
process.stderr.write("Key looks too short (< 20 chars). Aborted.\n");
|
|
333
|
-
rl.close();
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
try {
|
|
338
|
-
const ok = await setKeyForProvider(provider, trimmed);
|
|
339
|
-
if (ok) {
|
|
340
|
-
process.stderr.write(`\nStored ${provider} key in OS keychain.\n`);
|
|
341
|
-
process.stderr.write("Tip: run 'muonroi-cli keys export ~/keys.json' to back up + move to other devices.\n");
|
|
342
|
-
if (currentModel) {
|
|
343
|
-
const currentProvider = detectProviderForModel(currentModel);
|
|
344
|
-
if (currentProvider !== provider) {
|
|
345
|
-
process.stderr.write(
|
|
346
|
-
`\nNote: defaultModel '${currentModel}' is on '${currentProvider}'. ` +
|
|
347
|
-
`Edit ~/.muonroi-cli/user-settings.json or rerun with --model to use ${provider}.\n`,
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
} else {
|
|
352
|
-
process.stderr.write(
|
|
353
|
-
"\nOS keychain unavailable on this platform. Key will be used for this session only.\n" +
|
|
354
|
-
`For persistence, set env var: ${provider.toUpperCase()}_API_KEY\n`,
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
} catch (err) {
|
|
358
|
-
process.stderr.write(`\nWarning: failed to store key in keychain: ${(err as Error).message}\n`);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
rl.close();
|
|
362
|
-
return trimmed;
|
|
363
|
-
} catch {
|
|
364
|
-
rl?.close();
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
async function startInteractive(
|
|
370
|
-
apiKey: string | undefined,
|
|
371
|
-
baseURL: string,
|
|
372
|
-
model: string | undefined,
|
|
373
|
-
maxToolRounds: number,
|
|
374
|
-
batchApi: boolean,
|
|
375
|
-
sandboxMode: SandboxMode,
|
|
376
|
-
sandboxSettings: SandboxSettings,
|
|
377
|
-
session?: string,
|
|
378
|
-
initialMessage?: string,
|
|
379
|
-
permissionMode: PermissionMode = "safe",
|
|
380
|
-
injectHalt = false,
|
|
381
|
-
) {
|
|
382
|
-
// ── Plan 00-07 boot order ──────────────────────────────────────────────────
|
|
383
|
-
// 1. redactor.installGlobalPatches() — already at top of file (line 6).
|
|
384
|
-
// 2. loadConfig + loadUsage (validates storage paths, logs usage cap state).
|
|
385
|
-
const [config, usage] = await Promise.all([loadConfig(), loadUsage()]);
|
|
386
|
-
void config; // Phase 0: plumbed but not yet surfaced in TUI status bar (TUI-05, Phase 1).
|
|
387
|
-
void usage; // Phase 0: same — cap guard will gate on this in plan 00-06+ / Phase 1.
|
|
388
|
-
|
|
389
|
-
// 3. Load API key for the active provider — enrolls into redactor.
|
|
390
|
-
const activeModel = getCurrentModel();
|
|
391
|
-
const activeProvider = detectProviderForModel(activeModel);
|
|
392
|
-
const providerKey = await loadKeyForProvider(activeProvider).catch(() => undefined);
|
|
393
|
-
void providerKey; // Agent also loads key internally; this run is for early redactor enrollment.
|
|
394
|
-
|
|
395
|
-
// Web-research migration prompt — runs once per install for existing users
|
|
396
|
-
// who never saw the first-run wizard's research step. Skip in non-interactive
|
|
397
|
-
// mode (--prompt, --verify, headless harnesses).
|
|
398
|
-
if (process.stdin.isTTY) {
|
|
399
|
-
try {
|
|
400
|
-
const { loadUserSettings } = await import("./utils/settings.js");
|
|
401
|
-
if (loadUserSettings().webResearchPrompted !== true) {
|
|
402
|
-
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
403
|
-
const ask = (q: string): Promise<string> => new Promise((resolve) => rl.question(q, (a) => resolve(a)));
|
|
404
|
-
try {
|
|
405
|
-
const { runResearchMigrationPrompt } = await import("./mcp/research-onboarding.js");
|
|
406
|
-
await runResearchMigrationPrompt({
|
|
407
|
-
askChoice: ask,
|
|
408
|
-
askText: ask,
|
|
409
|
-
log: (m) => process.stderr.write(m),
|
|
410
|
-
});
|
|
411
|
-
} finally {
|
|
412
|
-
rl.close();
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
} catch (err) {
|
|
416
|
-
process.stderr.write(`\nWarning: research migration prompt failed: ${(err as Error).message}\n`);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// 5-6. createPendingCallsLog + createAbortContext — wired before Agent so
|
|
421
|
-
// the Agent receives them via AgentOptions (Pitfall 9, TUI-04).
|
|
422
|
-
// Session ID is not available until Agent opens SQLite; use a stable
|
|
423
|
-
// pre-session sentinel "pre-session" for the pending-calls log.
|
|
424
|
-
// After Agent is constructed we promote to the real session ID.
|
|
425
|
-
const orchestratorAbort = createAbortContext();
|
|
426
|
-
|
|
427
|
-
// 7. SIGINT handler — must be registered BEFORE mountTUI so Ctrl+C fires
|
|
428
|
-
// abort before OpenTUI's own handler chains. The handler is non-blocking:
|
|
429
|
-
// it only sets the abort signal; OpenTUI's teardown flushes terminal state
|
|
430
|
-
// on its own reconciler path.
|
|
431
|
-
process.on("SIGINT", () => {
|
|
432
|
-
orchestratorAbort.abort("SIGINT");
|
|
433
|
-
// OpenTUI will receive its own SIGINT / Ctrl+C via exitOnCtrlC:false;
|
|
434
|
-
// onExit below handles the cleanup sequence.
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
// ── Construct Agent (opens SQLite, loads transcript, wires abort + pending) ─
|
|
438
|
-
// PendingCallsLog: use session selector as provisional ID; Agent will have
|
|
439
|
-
// the real session ID after construction.
|
|
440
|
-
const provisionalSessionId = session ?? "latest";
|
|
441
|
-
const pendingCalls = createPendingCallsLog(provisionalSessionId);
|
|
442
|
-
// Reconcile any orphaned .tmp files from a prior crash (Pitfall 9).
|
|
443
|
-
const reconciled = await pendingCalls.reconcile();
|
|
444
|
-
if (reconciled.abandoned > 0) {
|
|
445
|
-
console.warn(`[muonroi-cli] reconciled ${reconciled.abandoned} abandoned tool calls from prior session`);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
449
|
-
session,
|
|
450
|
-
sandboxMode,
|
|
451
|
-
sandboxSettings,
|
|
452
|
-
batchApi,
|
|
453
|
-
abortContext: orchestratorAbort,
|
|
454
|
-
pendingCalls,
|
|
455
|
-
permissionMode,
|
|
456
|
-
});
|
|
457
|
-
// ── /Plan 00-07 boot order ────────────────────────────────────────────────
|
|
458
|
-
|
|
459
|
-
const { createCliRenderer } = await import("@opentui/core");
|
|
460
|
-
const { createRoot } = await import("@opentui/react");
|
|
461
|
-
const { createElement } = await import("react");
|
|
462
|
-
const { App } = await import("./ui/app");
|
|
463
|
-
|
|
464
|
-
const renderer = await createCliRenderer({
|
|
465
|
-
exitOnCtrlC: false,
|
|
466
|
-
// We manage SIGINT ourselves (orchestrator abort → agent cleanup → renderer destroy).
|
|
467
|
-
// Prevent OpenTUI from registering its own SIGINT/SIGTERM handler which would
|
|
468
|
-
// call renderer.destroy() prematurely and race with our orderly shutdown.
|
|
469
|
-
exitSignals: [],
|
|
470
|
-
// Lets terminals (Kitty, iTerm2, WezTerm, …) report Command as `super` on KeyEvent — needed for ⌘C in the TUI.
|
|
471
|
-
useKittyKeyboard: {
|
|
472
|
-
disambiguate: true,
|
|
473
|
-
alternateKeys: true,
|
|
474
|
-
},
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Restore terminal to main-screen mode before the process exits.
|
|
479
|
-
*
|
|
480
|
-
* On some terminals (WezTerm, especially under MINGW64/Git Bash), the native
|
|
481
|
-
* destroyRenderer() call inside renderer.destroy() does not reliably flush
|
|
482
|
-
* the Kitty-keyboard-disable and alternate-screen-exit escape sequences
|
|
483
|
-
* before process.exit() kills the runtime. This leaves the terminal in a
|
|
484
|
-
* half-restored state where subsequent shell output is interpreted as raw
|
|
485
|
-
* escape codes, producing the "jumping numbers" effect.
|
|
486
|
-
*
|
|
487
|
-
* The fix explicitly writes the restore sequences from JS and adds a brief
|
|
488
|
-
* flush delay before process.exit().
|
|
489
|
-
*/
|
|
490
|
-
function restoreTerminalSync(): void {
|
|
491
|
-
try {
|
|
492
|
-
// 1. Disable Kitty keyboard protocol if enabled.
|
|
493
|
-
if (typeof (renderer as any).disableKittyKeyboard === "function") {
|
|
494
|
-
(renderer as any).disableKittyKeyboard();
|
|
495
|
-
}
|
|
496
|
-
// 2. Restore terminal modes (bracketed paste, cursor, etc.).
|
|
497
|
-
if (typeof (renderer as any).lib?.restoreTerminalModes === "function") {
|
|
498
|
-
(renderer as any).lib.restoreTerminalModes((renderer as any).rendererPtr);
|
|
499
|
-
}
|
|
500
|
-
} catch {
|
|
501
|
-
// best-effort — terminal restore must never throw
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// WezTerm closes the pane/window when the foreground process exits.
|
|
506
|
-
// Detect WezTerm via env vars and hold the process open briefly so the
|
|
507
|
-
// user can see the terminal before the window disappears.
|
|
508
|
-
const isWezTerm =
|
|
509
|
-
!!process.env.WEZTERM_PANE ||
|
|
510
|
-
!!process.env.WEZTERM_EXECUTABLE ||
|
|
511
|
-
!!process.env.WEZTERM_CONFIG_FILE ||
|
|
512
|
-
!!process.env.WEZTERM_UNIX_SOCKET ||
|
|
513
|
-
process.env.TERM_PROGRAM === "WezTerm" ||
|
|
514
|
-
process.env.TERM_PROGRAM === "wezterm" ||
|
|
515
|
-
process.env.MUONROI_FORCE_SHELL_HOLD === "1";
|
|
516
|
-
|
|
517
|
-
const onExit = () => {
|
|
518
|
-
void agent.cleanup().finally(() => {
|
|
519
|
-
// Restore terminal state from JS before the native destroyRenderer runs
|
|
520
|
-
restoreTerminalSync();
|
|
521
|
-
|
|
522
|
-
renderer.destroy();
|
|
523
|
-
|
|
524
|
-
// Restore terminal modes BEFORE spawning child shell. Use synchronous
|
|
525
|
-
// writes to stdout's underlying fd so escape codes flush before the
|
|
526
|
-
// child inherits stdin — async process.stdout.write() can buffer past
|
|
527
|
-
// the spawn() boundary, leaving the terminal in mouse-tracking mode.
|
|
528
|
-
const writeSync = (seq: string) => {
|
|
529
|
-
try {
|
|
530
|
-
const fs = require("node:fs") as typeof import("node:fs");
|
|
531
|
-
fs.writeSync(1, seq);
|
|
532
|
-
} catch {
|
|
533
|
-
/* fall back to async */
|
|
534
|
-
try {
|
|
535
|
-
process.stdout.write(seq);
|
|
536
|
-
} catch {
|
|
537
|
-
/* noop */
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
try {
|
|
542
|
-
// 1. Take stdin out of raw mode + pause it so no buffered keystrokes
|
|
543
|
-
// (or in-flight mouse-event bytes) hit the child shell.
|
|
544
|
-
if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
|
|
545
|
-
try {
|
|
546
|
-
process.stdin.setRawMode(false);
|
|
547
|
-
} catch {
|
|
548
|
-
/* noop */
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
try {
|
|
552
|
-
process.stdin.pause();
|
|
553
|
-
} catch {
|
|
554
|
-
/* noop */
|
|
555
|
-
}
|
|
556
|
-
try {
|
|
557
|
-
(process.stdin as unknown as { unref?: () => void }).unref?.();
|
|
558
|
-
} catch {
|
|
559
|
-
/* noop */
|
|
560
|
-
}
|
|
561
|
-
// 2. Disable extended-coords first (1006/1015/1005), then the basic
|
|
562
|
-
// tracking modes (1003→1002→1000). Wrong order leaves the terminal
|
|
563
|
-
// emitting SGR-formatted events after the base modes are off.
|
|
564
|
-
writeSync("\x1B[?1006l\x1B[?1015l\x1B[?1005l");
|
|
565
|
-
writeSync("\x1B[?1003l\x1B[?1002l\x1B[?1000l");
|
|
566
|
-
writeSync("\x1B[?2004l\x1B[?25h"); // bracketed paste off, cursor on
|
|
567
|
-
writeSync("\x1B[?1049l\x1B[0m\x1B[!p"); // exit alt-screen, reset SGR, soft reset
|
|
568
|
-
} catch {
|
|
569
|
-
// best-effort
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
// WezTerm (and similar single-pane terminals) closes the window when
|
|
573
|
-
// the foreground process exits. To keep the pane usable after `/exit`,
|
|
574
|
-
// we hand control over to an interactive shell instead of exiting.
|
|
575
|
-
// Disable with MUONROI_NO_SHELL_HOLD=1.
|
|
576
|
-
const holdMode = process.env.MUONROI_NO_SHELL_HOLD === "1" ? "exit" : isWezTerm ? "shell" : "exit";
|
|
577
|
-
if (holdMode === "shell") {
|
|
578
|
-
// Defer spawn so the disable sequences are processed by the terminal
|
|
579
|
-
// BEFORE the child shell takes over stdin. Without this, the child
|
|
580
|
-
// can race with the in-flight disable codes and inherit a still-
|
|
581
|
-
// mouse-tracking terminal (visible as "35;145;26M" garbage at the
|
|
582
|
-
// shell prompt when the user moves the mouse).
|
|
583
|
-
setTimeout(() => {
|
|
584
|
-
try {
|
|
585
|
-
const { spawn } = require("node:child_process") as typeof import("node:child_process");
|
|
586
|
-
const isWin = process.platform === "win32";
|
|
587
|
-
const shellCmd =
|
|
588
|
-
process.env.MUONROI_EXIT_SHELL ||
|
|
589
|
-
process.env.SHELL ||
|
|
590
|
-
(isWin ? process.env.COMSPEC || "cmd.exe" : "/bin/bash");
|
|
591
|
-
writeSync("\nSession ended. Returning to shell — type `exit` to close this pane.\n\n");
|
|
592
|
-
const child = spawn(shellCmd, [], { stdio: "inherit", shell: false });
|
|
593
|
-
child.on("exit", (code) => process.exit(code ?? 0));
|
|
594
|
-
child.on("error", () => process.exit(0));
|
|
595
|
-
} catch {
|
|
596
|
-
setTimeout(() => process.exit(0), 16);
|
|
597
|
-
}
|
|
598
|
-
}, 80);
|
|
599
|
-
} else {
|
|
600
|
-
// Give the OS a tick to flush stdout before we exit.
|
|
601
|
-
setTimeout(() => process.exit(0), 16);
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
createRoot(renderer).render(
|
|
607
|
-
createElement(App, {
|
|
608
|
-
agent,
|
|
609
|
-
startupConfig: {
|
|
610
|
-
apiKey,
|
|
611
|
-
baseURL,
|
|
612
|
-
model: agent.getModel(),
|
|
613
|
-
maxToolRounds,
|
|
614
|
-
sandboxMode,
|
|
615
|
-
sandboxSettings,
|
|
616
|
-
version: packageJson.version,
|
|
617
|
-
injectHalt,
|
|
618
|
-
},
|
|
619
|
-
initialMessage,
|
|
620
|
-
onExit,
|
|
621
|
-
}),
|
|
622
|
-
);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
async function runHeadless(
|
|
626
|
-
prompt: string,
|
|
627
|
-
apiKey: string,
|
|
628
|
-
baseURL: string,
|
|
629
|
-
model: string | undefined,
|
|
630
|
-
maxToolRounds: number,
|
|
631
|
-
batchApi: boolean,
|
|
632
|
-
sandboxMode: SandboxMode,
|
|
633
|
-
sandboxSettings: SandboxSettings,
|
|
634
|
-
format: HeadlessOutputFormat,
|
|
635
|
-
session?: string,
|
|
636
|
-
permissionMode: PermissionMode = "safe",
|
|
637
|
-
councilAutoAnswer?: CouncilAutoAnswerer | null,
|
|
638
|
-
) {
|
|
639
|
-
const agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
640
|
-
session,
|
|
641
|
-
sandboxMode,
|
|
642
|
-
sandboxSettings,
|
|
643
|
-
batchApi,
|
|
644
|
-
permissionMode,
|
|
645
|
-
});
|
|
646
|
-
const prelude = renderHeadlessPrelude(format, agent.getSessionId() || undefined);
|
|
647
|
-
if (prelude.stdout) process.stdout.write(prelude.stdout);
|
|
648
|
-
if (prelude.stderr) process.stderr.write(prelude.stderr);
|
|
649
|
-
|
|
650
|
-
function writeSafe(stream: NodeJS.WriteStream, data: string): void {
|
|
651
|
-
try {
|
|
652
|
-
stream.write(data);
|
|
653
|
-
} catch (e: unknown) {
|
|
654
|
-
if ((e as NodeJS.ErrnoException).code === "EPIPE") process.exit(0);
|
|
655
|
-
throw e;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
// Council askcards have no TUI to render them in headless mode. When
|
|
660
|
-
// auto-answer is enabled, resolve the responder promises with either the
|
|
661
|
-
// scripted answer or `defaultIndex` — otherwise the process hangs forever.
|
|
662
|
-
const councilSink = {
|
|
663
|
-
respondToQuestion: (id: string, a: string) => agent.respondToCouncilQuestion(id, a),
|
|
664
|
-
respondToPreflight: (id: string, ok: boolean) => agent.respondToCouncilPreflight(id, ok),
|
|
665
|
-
};
|
|
666
|
-
function maybeAutoAnswer(chunk: {
|
|
667
|
-
type: string;
|
|
668
|
-
councilQuestion?: import("./types/index.js").CouncilQuestionData;
|
|
669
|
-
councilPreflight?: { preflightId: string };
|
|
670
|
-
}): void {
|
|
671
|
-
const auditLine = handleCouncilChunk(chunk, councilAutoAnswer ?? null, councilSink);
|
|
672
|
-
if (auditLine) writeSafe(process.stderr, `${auditLine}\n`);
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
try {
|
|
676
|
-
const { enhancedMessage } = processAtMentions(prompt, process.cwd());
|
|
677
|
-
|
|
678
|
-
if (format === "json") {
|
|
679
|
-
const { observer, consumeChunk, flush } = createHeadlessJsonlEmitter(agent.getSessionId() || undefined);
|
|
680
|
-
for await (const chunk of agent.processMessage(enhancedMessage, observer)) {
|
|
681
|
-
maybeAutoAnswer(chunk);
|
|
682
|
-
const writes = consumeChunk(chunk);
|
|
683
|
-
if (writes.stdout) writeSafe(process.stdout, writes.stdout);
|
|
684
|
-
if (writes.stderr) writeSafe(process.stderr, writes.stderr ?? "");
|
|
685
|
-
}
|
|
686
|
-
const tail = flush();
|
|
687
|
-
if (tail.stdout) writeSafe(process.stdout, tail.stdout);
|
|
688
|
-
if (tail.stderr) writeSafe(process.stderr, tail.stderr ?? "");
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
for await (const chunk of agent.processMessage(enhancedMessage)) {
|
|
693
|
-
maybeAutoAnswer(chunk);
|
|
694
|
-
const writes = renderHeadlessChunk(chunk);
|
|
695
|
-
if (writes.stdout) writeSafe(process.stdout, writes.stdout);
|
|
696
|
-
if (writes.stderr) writeSafe(process.stderr, writes.stderr);
|
|
697
|
-
}
|
|
698
|
-
} finally {
|
|
699
|
-
await agent.cleanup();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
function loadCouncilAnswersOrExit(filePath: string): CouncilAnswersFile {
|
|
704
|
-
try {
|
|
705
|
-
const raw = readFileSync(filePath, "utf8");
|
|
706
|
-
return parseCouncilAnswersFile(raw);
|
|
707
|
-
} catch (err: unknown) {
|
|
708
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
709
|
-
console.error(`Cannot load --council-answers file "${filePath}": ${msg}`);
|
|
710
|
-
process.exit(1);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
function changeDirectoryOrExit(directory: string | undefined) {
|
|
715
|
-
if (!directory) {
|
|
716
|
-
return;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
try {
|
|
720
|
-
process.chdir(directory);
|
|
721
|
-
} catch (err: unknown) {
|
|
722
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
723
|
-
console.error(`Cannot change to directory ${directory}: ${msg}`);
|
|
724
|
-
process.exit(1);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
type CliOptions = Record<string, string | boolean | undefined>;
|
|
729
|
-
|
|
730
|
-
function stringOption(value: string | boolean | undefined): string | undefined {
|
|
731
|
-
return typeof value === "string" ? value : undefined;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
function collect(value: string, prev: string[]): string[] {
|
|
735
|
-
return [...prev, value];
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
function resolveCliSandboxMode(value: string | boolean | undefined): SandboxMode | undefined {
|
|
739
|
-
if (value === true) return "shuru";
|
|
740
|
-
if (value === false) return "off";
|
|
741
|
-
return undefined;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
async function runBackgroundDelegation(jobPath: string, options: CliOptions) {
|
|
745
|
-
let output = "";
|
|
746
|
-
let agent: Agent | undefined;
|
|
747
|
-
|
|
748
|
-
try {
|
|
749
|
-
const delegation = await loadDelegation(jobPath);
|
|
750
|
-
|
|
751
|
-
const baseURL = stringOption(options.baseUrl) || getBaseURL();
|
|
752
|
-
const explicitModel = stringOption(options.model) || delegation.model;
|
|
753
|
-
const model = explicitModel ? normalizeModelId(explicitModel) : undefined;
|
|
754
|
-
|
|
755
|
-
// Resolve API key: explicit flag > legacy env/settings.apiKey > per-provider keychain
|
|
756
|
-
// (matches the foreground flow — delegations were previously broken when the user
|
|
757
|
-
// only had a per-provider key in the OS keychain, e.g. deepseek.)
|
|
758
|
-
let apiKey = stringOption(options.apiKey) || getApiKey();
|
|
759
|
-
if (!apiKey) {
|
|
760
|
-
const modelForResolve = model ?? delegation.model ?? getCurrentModel("agent");
|
|
761
|
-
const keychainKey = await resolveKeyForModel(modelForResolve);
|
|
762
|
-
if (keychainKey) {
|
|
763
|
-
apiKey = keychainKey;
|
|
764
|
-
} else if (await hasOAuthForModel(modelForResolve)) {
|
|
765
|
-
apiKey = "oauth";
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
if (!apiKey) {
|
|
769
|
-
throw new Error(
|
|
770
|
-
"API key required. Set MUONROI_API_KEY, use --api-key, save it to ~/.muonroi-cli/user-settings.json, " +
|
|
771
|
-
"or run 'muonroi-cli keys login <provider>' for subscription OAuth.",
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
const maxToolRounds =
|
|
775
|
-
parseInt(stringOption(options.maxToolRounds) || String(delegation.maxToolRounds), 10) || delegation.maxToolRounds;
|
|
776
|
-
const sandboxMode = resolveCliSandboxMode(options.sandbox) || delegation.sandboxMode || getCurrentSandboxMode();
|
|
777
|
-
const sandboxSettings = mergeSandboxSettings(getCurrentSandboxSettings(), delegation.sandboxSettings);
|
|
778
|
-
agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
779
|
-
persistSession: false,
|
|
780
|
-
sandboxMode,
|
|
781
|
-
sandboxSettings,
|
|
782
|
-
batchApi: Boolean(delegation.batchApi ?? options.batchApi === true),
|
|
783
|
-
});
|
|
784
|
-
const result = await agent.runTaskRequest({
|
|
785
|
-
agent: delegation.agent,
|
|
786
|
-
description: delegation.description,
|
|
787
|
-
prompt: delegation.prompt,
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
output = (result.output || "").trim();
|
|
791
|
-
|
|
792
|
-
if (!result.success) {
|
|
793
|
-
await failDelegation(jobPath, result.output || result.error || "Background delegation failed.", output);
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
await completeDelegation(jobPath, output, result.task?.summary);
|
|
798
|
-
} catch (err: unknown) {
|
|
799
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
800
|
-
try {
|
|
801
|
-
await failDelegation(jobPath, msg, output);
|
|
802
|
-
} catch {
|
|
803
|
-
// Best effort — background tasks should fail silently if persistence is unavailable.
|
|
804
|
-
}
|
|
805
|
-
process.exit(1);
|
|
806
|
-
} finally {
|
|
807
|
-
await agent?.cleanup();
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
async function persistApiKeyToKeychain(rawKey: string, modelHint?: string): Promise<boolean> {
|
|
812
|
-
const provider = detectProviderForModel(modelHint ?? getCurrentModel("agent"));
|
|
813
|
-
try {
|
|
814
|
-
return await setKeyForProvider(provider, rawKey);
|
|
815
|
-
} catch {
|
|
816
|
-
return false;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
function resolveConfig(options: CliOptions) {
|
|
821
|
-
const apiKey = stringOption(options.apiKey) || getApiKey();
|
|
822
|
-
const baseURL = stringOption(options.baseUrl) || getBaseURL();
|
|
823
|
-
const explicitModel = stringOption(options.model);
|
|
824
|
-
const model = explicitModel ? normalizeModelId(explicitModel) : undefined;
|
|
825
|
-
const maxToolRounds = parseInt(stringOption(options.maxToolRounds) || "400", 10) || 400;
|
|
826
|
-
const sandboxMode = resolveCliSandboxMode(options.sandbox) || getCurrentSandboxMode();
|
|
827
|
-
|
|
828
|
-
const cliOverrides: SandboxSettings = {};
|
|
829
|
-
if (options.allowNet === true) cliOverrides.allowNet = true;
|
|
830
|
-
const allowHostValue = options.allowHost;
|
|
831
|
-
if (Array.isArray(allowHostValue) && allowHostValue.length > 0) {
|
|
832
|
-
cliOverrides.allowedHosts = allowHostValue as string[];
|
|
833
|
-
if (!cliOverrides.allowNet) cliOverrides.allowNet = true;
|
|
834
|
-
}
|
|
835
|
-
const portValue = options.port;
|
|
836
|
-
if (Array.isArray(portValue) && portValue.length > 0) {
|
|
837
|
-
cliOverrides.ports = portValue as string[];
|
|
838
|
-
}
|
|
839
|
-
const sandboxSettings = mergeSandboxSettings(getCurrentSandboxSettings(), cliOverrides);
|
|
840
|
-
|
|
841
|
-
if (typeof options.apiKey === "string" && process.env["MUONROI_TEST_NO_PERSIST"] !== "1") {
|
|
842
|
-
// Persist to OS keychain (per-provider) instead of plaintext settings.json.
|
|
843
|
-
// Fire-and-forget: keychain write is async; if it fails (no keytar), the key still
|
|
844
|
-
// works for this run via `apiKey` above and the user can re-supply it next invocation.
|
|
845
|
-
void persistApiKeyToKeychain(options.apiKey, stringOption(options.model)).catch(() => {});
|
|
846
|
-
}
|
|
847
|
-
if (typeof options.model === "string") saveUserSettings({ defaultModel: normalizeModelId(options.model) });
|
|
848
|
-
|
|
849
|
-
return { apiKey, baseURL, model, maxToolRounds, sandboxMode, sandboxSettings };
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
function requireApiKey(apiKey: string | undefined): string {
|
|
853
|
-
if (!apiKey) {
|
|
854
|
-
console.error(
|
|
855
|
-
"Error: API key required. Set MUONROI_API_KEY env var, use --api-key, or save to ~/.muonroi-cli/user-settings.json",
|
|
856
|
-
);
|
|
857
|
-
process.exit(1);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
return apiKey;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
function parseHeadlessOutputFormat(value: string): HeadlessOutputFormat {
|
|
864
|
-
if (isHeadlessOutputFormat(value)) {
|
|
865
|
-
return value;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
throw new InvalidArgumentError(`Invalid headless format "${value}". Expected "text" or "json".`);
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
program
|
|
872
|
-
.name("muonroi-cli")
|
|
873
|
-
.description("AI coding agent — built with Bun and OpenTUI")
|
|
874
|
-
.version(packageJson.version)
|
|
875
|
-
.argument("[message...]", "Initial message to send")
|
|
876
|
-
.option("-k, --api-key <key>", "API key")
|
|
877
|
-
.option("-u, --base-url <url>", "API base URL")
|
|
878
|
-
.option("-m, --model <model>", "Model to use")
|
|
879
|
-
.option("-d, --directory <dir>", "Working directory", process.cwd())
|
|
880
|
-
.option("-p, --prompt <prompt>", "Run a single prompt headlessly")
|
|
881
|
-
.option("--verify", "Run the built-in verify flow headlessly")
|
|
882
|
-
.option("--format <format>", "Headless output format: text or json", parseHeadlessOutputFormat, "text")
|
|
883
|
-
.option("--sandbox", "Run agent shell commands inside a Shuru sandbox")
|
|
884
|
-
.option("--no-sandbox", "Run agent shell commands directly on the host")
|
|
885
|
-
.option("--allow-net", "Enable network access inside the Shuru sandbox")
|
|
886
|
-
.option("--allow-host <pattern>", "Restrict sandbox network to specific hosts (repeatable)", collect, [])
|
|
887
|
-
.option("--port <mapping>", "Forward a host port to sandbox guest (HOST:GUEST, repeatable)", collect, [])
|
|
888
|
-
.option("-s, --session <id>", "Continue a saved session by id, or use 'latest'")
|
|
889
|
-
.option("--background-task-file <path>", "Run a persisted background delegation")
|
|
890
|
-
.option("--max-tool-rounds <n>", "Max tool execution rounds", "400")
|
|
891
|
-
.option("--batch-api", "Use xAI Batch API for model calls (async, lower cost)")
|
|
892
|
-
.option(
|
|
893
|
-
"--permission <mode>",
|
|
894
|
-
"Permission mode: safe (confirm all), auto-edit (auto-approve file ops), yolo (auto-approve all)",
|
|
895
|
-
"safe",
|
|
896
|
-
)
|
|
897
|
-
.option("-y, --yes", "Headless: auto-answer council askcards with their default option and approve preflights")
|
|
898
|
-
.option("--council-answers <file>", "Headless: JSON file with scripted council answers per phase (FIFO)")
|
|
899
|
-
.option("--update", "Update muonroi-cli to the latest version and exit")
|
|
900
|
-
.option("--smoke-boot-only", "CI smoke: validate loadConfig + loadUsage and exit 0 — no keychain access")
|
|
901
|
-
.option("--agent-mode", "Enable agent harness mode (JSONL sidechannel)")
|
|
902
|
-
.option("--agent-cols <n>", "Terminal columns in agent-mode", (v) => parseInt(v, 10), 120)
|
|
903
|
-
.option("--agent-rows <n>", "Terminal rows in agent-mode", (v) => parseInt(v, 10), 40)
|
|
904
|
-
.option("--agent-idle-ms <n>", "Idle quiescence window (ms)", (v) => parseInt(v, 10), 50)
|
|
905
|
-
.option("--agent-fake-clock", "Use deterministic frame-counter clock")
|
|
906
|
-
.option("--mock-llm <dir>", "Use fixture-based mock LLM from <dir> instead of real provider (E2E testing)")
|
|
907
|
-
.option("--inject-halt", "TEST SEAM: render a synthetic halt recovery card after boot (harness E2E only)")
|
|
908
|
-
.action(async (message: string[], options) => {
|
|
909
|
-
// Agent-mode: start the sidechannel runtime BEFORE any TUI or model work.
|
|
910
|
-
// The runtime is exposed on globalThis so the renderer wiring (Task 1.6c)
|
|
911
|
-
// can pick it up without a direct import dependency.
|
|
912
|
-
if (options.agentMode) {
|
|
913
|
-
const { startAgentMode } = await import("@muonroi/agent-harness-opentui");
|
|
914
|
-
const runtime = await startAgentMode({
|
|
915
|
-
cols: options.agentCols as number,
|
|
916
|
-
rows: options.agentRows as number,
|
|
917
|
-
idleMs: options.agentIdleMs as number,
|
|
918
|
-
fakeClock: !!options.agentFakeClock,
|
|
919
|
-
});
|
|
920
|
-
(globalThis as Record<string, unknown>).__muonroiAgentRuntime = runtime;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
// Mock-LLM: load fixture directory and inject into globalThis BEFORE any
|
|
924
|
-
// provider call. Dynamic import keeps startup lean when flag is absent.
|
|
925
|
-
if (typeof options.mockLlm === "string") {
|
|
926
|
-
const { createMockLlm } = await import("@muonroi/agent-harness-core/mock-llm");
|
|
927
|
-
(globalThis as Record<string, unknown>).__muonroiMockLlm = createMockLlm({ dir: options.mockLlm });
|
|
928
|
-
|
|
929
|
-
// Phase H1: AI-SDK-level mock. If any fixture declares a `model` block
|
|
930
|
-
// it is installed so `resolveModelRuntime` returns it instead of the
|
|
931
|
-
// real provider model. This enables cost-leak verification (G1, F1,
|
|
932
|
-
// B3/B4, C1) through the orchestrator's streamText path.
|
|
933
|
-
const { loadMockModelFromDir } = await import("./agent-harness/mock-model.js");
|
|
934
|
-
const modelHandle = await loadMockModelFromDir(options.mockLlm).catch(() => null);
|
|
935
|
-
if (modelHandle) {
|
|
936
|
-
// Install all three globals atomically so the runtime sees a
|
|
937
|
-
// consistent picture: model + the OAuth-registry-equivalent
|
|
938
|
-
// unsupportedParams / defaultProviderOptions parsed from the fixture.
|
|
939
|
-
const g = globalThis as Record<string, unknown>;
|
|
940
|
-
g.__muonroiMockModel = modelHandle.model;
|
|
941
|
-
g.__muonroiMockUnsupportedParams = modelHandle.unsupportedParams;
|
|
942
|
-
g.__muonroiMockDefaultProviderOptions = modelHandle.defaultProviderOptions;
|
|
943
|
-
|
|
944
|
-
// Phase H3 — exfiltrate recordings to a file at exit so the parent
|
|
945
|
-
// vitest spec can assert across the child-process boundary. Activated
|
|
946
|
-
// only when MUONROI_MOCK_MODEL_DUMP is set; otherwise no-op.
|
|
947
|
-
const dumpPath = process.env.MUONROI_MOCK_MODEL_DUMP;
|
|
948
|
-
if (typeof dumpPath === "string" && dumpPath.length > 0) {
|
|
949
|
-
const { dumpRecordings } = await import("./agent-harness/mock-model.js");
|
|
950
|
-
let dumped = false;
|
|
951
|
-
const doDump = (): void => {
|
|
952
|
-
if (dumped) return;
|
|
953
|
-
dumped = true;
|
|
954
|
-
try {
|
|
955
|
-
dumpRecordings(dumpPath, modelHandle.model);
|
|
956
|
-
} catch (err) {
|
|
957
|
-
// Last-ditch: surface on stderr so the parent test can see why.
|
|
958
|
-
process.stderr.write(`[muonroi-cli] dumpRecordings failed: ${String(err)}\n`);
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
// Continuous dump: write after every streamText completes so tests
|
|
962
|
-
// can read the dump without relying on a graceful exit handler. On
|
|
963
|
-
// Windows + Bun + named pipes, `process.on("exit")` handlers may
|
|
964
|
-
// not fire when process.exit() is called from deep async chains
|
|
965
|
-
// (observed empirically — exit event reaches the parent, but the
|
|
966
|
-
// exit-handler callbacks in the child never run). Patching
|
|
967
|
-
// doStream guarantees the dump exists after at least one call.
|
|
968
|
-
const writeDumpAlways = (): void => {
|
|
969
|
-
try {
|
|
970
|
-
dumpRecordings(dumpPath, modelHandle.model);
|
|
971
|
-
} catch {
|
|
972
|
-
// ignore — best-effort
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
const origDoStream = modelHandle.model.doStream.bind(modelHandle.model);
|
|
976
|
-
modelHandle.model.doStream = async (options: unknown) => {
|
|
977
|
-
// biome-ignore lint/suspicious/noExplicitAny: AI SDK call options
|
|
978
|
-
const r = await origDoStream(options as any);
|
|
979
|
-
writeDumpAlways();
|
|
980
|
-
return r;
|
|
981
|
-
};
|
|
982
|
-
process.on("exit", doDump);
|
|
983
|
-
process.on("SIGINT", () => {
|
|
984
|
-
doDump();
|
|
985
|
-
process.exit(130);
|
|
986
|
-
});
|
|
987
|
-
process.on("SIGTERM", () => {
|
|
988
|
-
doDump();
|
|
989
|
-
process.exit(143);
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
// CI smoke affordance — exit cleanly WITHOUT invoking the provider.
|
|
996
|
-
// Deliberately exits BEFORE provider key loading — CI runners have no keychain configured.
|
|
997
|
-
if (options.smokeBootOnly) {
|
|
998
|
-
const [_cfg, _usg] = await Promise.all([loadConfig(), loadUsage()]);
|
|
999
|
-
console.log("[muonroi-cli] smoke-boot-only — config + usage loaded; exiting 0.");
|
|
1000
|
-
process.exit(0);
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
if (options.update) {
|
|
1004
|
-
console.log("Checking for updates...");
|
|
1005
|
-
const result = await runUpdate(packageJson.version);
|
|
1006
|
-
console.log(result.output);
|
|
1007
|
-
process.exit(result.success ? 0 : 1);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
changeDirectoryOrExit(options.directory);
|
|
1011
|
-
|
|
1012
|
-
// Boot model registry BEFORE any key resolution path runs —
|
|
1013
|
-
// detectProviderForModel consults the catalog's alias map to route e.g.
|
|
1014
|
-
// "deepseek-v4-flash" to provider "siliconflow". With an empty registry
|
|
1015
|
-
// it falls back to a prefix match ("deepseek") and the CLI loads the
|
|
1016
|
-
// wrong provider's key. Affects both runBackgroundDelegation and the
|
|
1017
|
-
// main interactive/headless path below.
|
|
1018
|
-
let catalogLoadFailed = false;
|
|
1019
|
-
await loadCatalog().catch(() => {
|
|
1020
|
-
catalogLoadFailed = true;
|
|
1021
|
-
});
|
|
1022
|
-
|
|
1023
|
-
if (options.backgroundTaskFile) {
|
|
1024
|
-
await runBackgroundDelegation(options.backgroundTaskFile, options);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
const config = resolveConfig(options);
|
|
1029
|
-
|
|
1030
|
-
// No legacy key in env / settings — try the OS keychain for the resolved
|
|
1031
|
-
// model's provider before falling back to the wizard.
|
|
1032
|
-
if (!config.apiKey) {
|
|
1033
|
-
const modelForResolve = config.model ?? getCurrentModel("agent");
|
|
1034
|
-
const keychainKey = await resolveKeyForModel(modelForResolve);
|
|
1035
|
-
if (keychainKey) {
|
|
1036
|
-
config.apiKey = keychainKey;
|
|
1037
|
-
} else if (await hasOAuthForModel(modelForResolve)) {
|
|
1038
|
-
// OAuth-authenticated provider — runtime will inject Bearer headers.
|
|
1039
|
-
// Set placeholder so downstream gating code (which only checks for
|
|
1040
|
-
// a truthy apiKey) is satisfied.
|
|
1041
|
-
config.apiKey = "oauth";
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
// First-run wizard (interactive only, before any TUI code)
|
|
1046
|
-
const isInteractive = !options.prompt && !options.verify && process.stdin.isTTY;
|
|
1047
|
-
if (!config.apiKey && isInteractive) {
|
|
1048
|
-
const modelForWizard = config.model ?? getCurrentModel("agent");
|
|
1049
|
-
const wizardKey = await firstRunWizard(modelForWizard);
|
|
1050
|
-
if (wizardKey) {
|
|
1051
|
-
// Key is already persisted to the OS keychain by the wizard. We DO NOT
|
|
1052
|
-
// write it back to settings.json (avoids resurrecting plaintext that
|
|
1053
|
-
// 'keys cleanup-settings' just removed).
|
|
1054
|
-
config.apiKey = wizardKey;
|
|
1055
|
-
} else {
|
|
1056
|
-
process.exit(1);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
// Bootstrap EE auth (loads serverBaseUrl + token from ~/.experience/config.json)
|
|
1061
|
-
const { loadEEAuthToken } = await import("./ee/auth.js");
|
|
1062
|
-
await loadEEAuthToken().catch(() => {});
|
|
1063
|
-
|
|
1064
|
-
// Auto-detect EE client mode (thin / thin-degraded / fat / disabled).
|
|
1065
|
-
// Result is cached for downstream callsites (PIL layers, bridge.searchByText)
|
|
1066
|
-
// so each request doesn't re-probe.
|
|
1067
|
-
const { detectEEClientMode, describeMode } = await import("./ee/client-mode.js");
|
|
1068
|
-
detectEEClientMode()
|
|
1069
|
-
.then((info) => {
|
|
1070
|
-
if (process.env.MUONROI_EE_DEBUG === "1") {
|
|
1071
|
-
console.error(`[muonroi-cli] ${describeMode(info)}`);
|
|
1072
|
-
}
|
|
1073
|
-
})
|
|
1074
|
-
.catch(() => {});
|
|
1075
|
-
|
|
1076
|
-
// Patch zod-to-json-schema for Zod v4 compat (fixes tool calls for DeepSeek etc.)
|
|
1077
|
-
const { patchZodToJsonSchema } = await import("./providers/patch-zod-schema.js");
|
|
1078
|
-
patchZodToJsonSchema();
|
|
1079
|
-
|
|
1080
|
-
// Catalog already loaded above (before key resolution). Read the
|
|
1081
|
-
// populated registry now to surface any load failure to the user.
|
|
1082
|
-
const { MODELS: loadedModels, getModelInfo: lookupModel } = await import("./models/registry.js");
|
|
1083
|
-
|
|
1084
|
-
// No models loaded — check root cause
|
|
1085
|
-
if (loadedModels.length === 0) {
|
|
1086
|
-
if (catalogLoadFailed) {
|
|
1087
|
-
console.error(
|
|
1088
|
-
"\x1b[31mCould not load the model catalog. The installation may be corrupted.\x1b[0m\n" +
|
|
1089
|
-
" The file \x1b[33mdist/models/catalog.json\x1b[0m was not found.\n" +
|
|
1090
|
-
"\nTry reinstalling:\n" +
|
|
1091
|
-
" \x1b[33mnpm install -g muonroi-cli\x1b[0m\n" +
|
|
1092
|
-
" # or: \x1b[33mbun install -g muonroi-cli\x1b[0m\n" +
|
|
1093
|
-
"\nIf building from source:\n" +
|
|
1094
|
-
" \x1b[33mbun run build\x1b[0m\n",
|
|
1095
|
-
);
|
|
1096
|
-
} else if (config.apiKey) {
|
|
1097
|
-
console.error(
|
|
1098
|
-
"\x1b[31mAPI key is invalid or expired. No models could be loaded.\x1b[0m\n" +
|
|
1099
|
-
"Update your key:\n" +
|
|
1100
|
-
" muonroi-cli -k YOUR_NEW_KEY\n" +
|
|
1101
|
-
" # or: export MUONROI_API_KEY=YOUR_NEW_KEY\n" +
|
|
1102
|
-
`\nGet a key at: ${getProviderCapabilities("anthropic").consoleSignupURL()}`,
|
|
1103
|
-
);
|
|
1104
|
-
} else {
|
|
1105
|
-
console.error(
|
|
1106
|
-
"\x1b[31mNo API key configured and no models could be loaded.\x1b[0m\n" +
|
|
1107
|
-
"Set your key:\n" +
|
|
1108
|
-
" muonroi-cli -k YOUR_API_KEY\n" +
|
|
1109
|
-
" # or: export MUONROI_API_KEY=YOUR_API_KEY\n" +
|
|
1110
|
-
`\nGet a key at: ${getProviderCapabilities("anthropic").consoleSignupURL()}`,
|
|
1111
|
-
);
|
|
1112
|
-
}
|
|
1113
|
-
process.exit(1);
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
// Validate configured model exists in loaded registry — fallback to first available
|
|
1117
|
-
if (loadedModels.length > 0) {
|
|
1118
|
-
const { getCurrentModel } = await import("./utils/settings.js");
|
|
1119
|
-
const effectiveModel = config.model || getCurrentModel();
|
|
1120
|
-
if (effectiveModel && !lookupModel(effectiveModel)) {
|
|
1121
|
-
console.error(
|
|
1122
|
-
`\x1b[31mModel "${effectiveModel}" is not available (may be retired or not in your plan).\x1b[0m\n`,
|
|
1123
|
-
);
|
|
1124
|
-
console.error("Available models:\n");
|
|
1125
|
-
for (const m of loadedModels.slice(0, 15)) {
|
|
1126
|
-
console.error(` \x1b[36m${m.id}\x1b[0m — ${m.name}`);
|
|
1127
|
-
}
|
|
1128
|
-
if (loadedModels.length > 15) {
|
|
1129
|
-
console.error(` ... and ${loadedModels.length - 15} more (run \`muonroi-cli models\` to see all)`);
|
|
1130
|
-
}
|
|
1131
|
-
console.error(
|
|
1132
|
-
"\n\x1b[33mSet your model:\x1b[0m\n" +
|
|
1133
|
-
" muonroi-cli -m MODEL_ID\n" +
|
|
1134
|
-
" # or add to ~/.muonroi-cli/user-settings.json:\n" +
|
|
1135
|
-
' # { "defaultModel": "MODEL_ID" }\n',
|
|
1136
|
-
);
|
|
1137
|
-
process.exit(1);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
const councilAnswersFile =
|
|
1142
|
-
typeof options.councilAnswers === "string" ? loadCouncilAnswersOrExit(options.councilAnswers) : undefined;
|
|
1143
|
-
const councilAutoAnswer = createCouncilAutoAnswerer({
|
|
1144
|
-
enabled: options.yes === true,
|
|
1145
|
-
file: councilAnswersFile,
|
|
1146
|
-
});
|
|
1147
|
-
|
|
1148
|
-
if (options.verify) {
|
|
1149
|
-
const verifyError = getVerifyCliError({ hasPrompt: Boolean(options.prompt), hasMessageArgs: message.length > 0 });
|
|
1150
|
-
if (verifyError) {
|
|
1151
|
-
console.error(verifyError);
|
|
1152
|
-
process.exit(1);
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
await runHeadless(
|
|
1156
|
-
buildVerifyPrompt(process.cwd()),
|
|
1157
|
-
requireApiKey(config.apiKey),
|
|
1158
|
-
config.baseURL,
|
|
1159
|
-
config.model,
|
|
1160
|
-
config.maxToolRounds,
|
|
1161
|
-
options.batchApi === true,
|
|
1162
|
-
config.sandboxMode,
|
|
1163
|
-
config.sandboxSettings,
|
|
1164
|
-
options.format,
|
|
1165
|
-
options.session,
|
|
1166
|
-
options.permission as PermissionMode,
|
|
1167
|
-
councilAutoAnswer,
|
|
1168
|
-
);
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
if (options.prompt) {
|
|
1173
|
-
await runHeadless(
|
|
1174
|
-
options.prompt,
|
|
1175
|
-
requireApiKey(config.apiKey),
|
|
1176
|
-
config.baseURL,
|
|
1177
|
-
config.model,
|
|
1178
|
-
config.maxToolRounds,
|
|
1179
|
-
options.batchApi === true,
|
|
1180
|
-
config.sandboxMode,
|
|
1181
|
-
config.sandboxSettings,
|
|
1182
|
-
options.format,
|
|
1183
|
-
options.session,
|
|
1184
|
-
options.permission as PermissionMode,
|
|
1185
|
-
councilAutoAnswer,
|
|
1186
|
-
);
|
|
1187
|
-
return;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
const initialMessage = message.length > 0 ? message.join(" ") : undefined;
|
|
1191
|
-
await startInteractive(
|
|
1192
|
-
config.apiKey,
|
|
1193
|
-
config.baseURL,
|
|
1194
|
-
config.model,
|
|
1195
|
-
config.maxToolRounds,
|
|
1196
|
-
options.batchApi === true,
|
|
1197
|
-
config.sandboxMode,
|
|
1198
|
-
config.sandboxSettings,
|
|
1199
|
-
options.session,
|
|
1200
|
-
initialMessage,
|
|
1201
|
-
options.permission as PermissionMode,
|
|
1202
|
-
options.injectHalt === true,
|
|
1203
|
-
);
|
|
1204
|
-
});
|
|
1205
|
-
|
|
1206
|
-
program
|
|
1207
|
-
.command("models")
|
|
1208
|
-
.description("List available models")
|
|
1209
|
-
.action(async () => {
|
|
1210
|
-
console.log("\nLoading model catalog...\n");
|
|
1211
|
-
await loadCatalog();
|
|
1212
|
-
const { MODELS } = await import("./models/registry.js");
|
|
1213
|
-
for (const m of MODELS) {
|
|
1214
|
-
const tags = [
|
|
1215
|
-
m.reasoning ? "reasoning" : "non-reasoning",
|
|
1216
|
-
m.multiAgent ? "multi-agent" : null,
|
|
1217
|
-
m.responsesOnly ? "responses-only" : null,
|
|
1218
|
-
].filter(Boolean);
|
|
1219
|
-
const suffix = tags.length > 0 ? ` (${tags.join(", ")})` : "";
|
|
1220
|
-
console.log(` \x1b[36m${m.id}\x1b[0m — ${m.name}${suffix}`);
|
|
1221
|
-
console.log(
|
|
1222
|
-
` ${m.description} | ${formatContext(m.contextWindow)} context | $${m.inputPrice}/$${m.outputPrice} per 1M tokens`,
|
|
1223
|
-
);
|
|
1224
|
-
if ((m.aliases?.length ?? 0) > 0) {
|
|
1225
|
-
console.log(` aliases: ${(m.aliases ?? []).join(", ")}`);
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
console.log();
|
|
1229
|
-
});
|
|
1230
|
-
|
|
1231
|
-
program
|
|
1232
|
-
.command("update")
|
|
1233
|
-
.description("Update muonroi-cli to the latest release")
|
|
1234
|
-
.action(async () => {
|
|
1235
|
-
console.log("Checking for updates...");
|
|
1236
|
-
const result = await runUpdate(packageJson.version);
|
|
1237
|
-
console.log(result.output);
|
|
1238
|
-
process.exit(result.success ? 0 : 1);
|
|
1239
|
-
});
|
|
1240
|
-
|
|
1241
|
-
program
|
|
1242
|
-
.command("uninstall")
|
|
1243
|
-
.description("Remove a script-installed muonroi-cli binary and optional data")
|
|
1244
|
-
.option("--dry-run", "Show what would be removed without removing it")
|
|
1245
|
-
.option("--force", "Skip the confirmation prompt")
|
|
1246
|
-
.option("--keep-config", "Keep ~/.muonroi-cli config files")
|
|
1247
|
-
.option("--keep-data", "Keep ~/.muonroi-cli data files")
|
|
1248
|
-
.action(async (options) => {
|
|
1249
|
-
const result = await runScriptManagedUninstall({
|
|
1250
|
-
dryRun: options.dryRun === true,
|
|
1251
|
-
force: options.force === true,
|
|
1252
|
-
keepConfig: options.keepConfig === true,
|
|
1253
|
-
keepData: options.keepData === true,
|
|
1254
|
-
});
|
|
1255
|
-
console.log(result.output);
|
|
1256
|
-
process.exit(result.success ? 0 : 1);
|
|
1257
|
-
});
|
|
1258
|
-
|
|
1259
|
-
program
|
|
1260
|
-
.command("daemon")
|
|
1261
|
-
.description("Start the schedule daemon to run scheduled tasks")
|
|
1262
|
-
.option("--background", "Detach and run in the background")
|
|
1263
|
-
.action(async (options) => {
|
|
1264
|
-
if (options.background) {
|
|
1265
|
-
const result = await startScheduleDaemon(process.cwd());
|
|
1266
|
-
console.log(
|
|
1267
|
-
result.alreadyRunning
|
|
1268
|
-
? `Schedule daemon already running (pid: ${result.status.pid ?? "unknown"}).`
|
|
1269
|
-
: `Schedule daemon started in the background (pid: ${result.pid ?? "unknown"}).`,
|
|
1270
|
-
);
|
|
1271
|
-
return;
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
process.off("SIGTERM", exitCleanlyOnSigterm);
|
|
1275
|
-
const { SchedulerDaemon } = await import("./daemon/scheduler");
|
|
1276
|
-
const daemon = new SchedulerDaemon();
|
|
1277
|
-
await daemon.start();
|
|
1278
|
-
});
|
|
1279
|
-
|
|
1280
|
-
program
|
|
1281
|
-
.command("doctor")
|
|
1282
|
-
.description("Run health checks for muonroi-cli dependencies and services")
|
|
1283
|
-
.action(async () => {
|
|
1284
|
-
const { loadEEAuthToken } = await import("./ee/auth.js");
|
|
1285
|
-
await loadEEAuthToken().catch(() => {});
|
|
1286
|
-
const { runDoctor, formatDoctorReport } = await import("./ops/doctor.js");
|
|
1287
|
-
const results = await runDoctor();
|
|
1288
|
-
console.log("\nmuonroi-cli doctor\n");
|
|
1289
|
-
console.log(formatDoctorReport(results, packageJson.version));
|
|
1290
|
-
const hasFail = results.some((r) => r.status === "fail");
|
|
1291
|
-
process.exit(hasFail ? 1 : 0);
|
|
1292
|
-
});
|
|
1293
|
-
|
|
1294
|
-
program
|
|
1295
|
-
.command("bug-report")
|
|
1296
|
-
.description("Generate anonymized diagnostic bundle for issue submission")
|
|
1297
|
-
.action(async () => {
|
|
1298
|
-
const { buildBugReport, formatBugReport } = await import("./ops/bug-report.js");
|
|
1299
|
-
const bundle = await buildBugReport();
|
|
1300
|
-
console.log(formatBugReport(bundle));
|
|
1301
|
-
});
|
|
1302
|
-
|
|
1303
|
-
const keys = program
|
|
1304
|
-
.command("keys")
|
|
1305
|
-
.description("Manage provider API keys via the OS keychain (set, list, delete, import-bw)");
|
|
1306
|
-
|
|
1307
|
-
keys
|
|
1308
|
-
.command("set <provider>")
|
|
1309
|
-
.description("Prompt for a provider API key and store it in the OS keychain")
|
|
1310
|
-
.option("--bw", "Also write the key to a Bitwarden vault Secure Note (requires bw CLI + BW_SESSION)")
|
|
1311
|
-
.option("--prefix <prefix>", "Bitwarden item name prefix when --bw is set (default: 'muonroi-cli/')", "muonroi-cli/")
|
|
1312
|
-
.action(async (provider: string, opts: { bw?: boolean; prefix: string }) => {
|
|
1313
|
-
const { runKeysSet } = await import("./cli/keys.js");
|
|
1314
|
-
await runKeysSet(provider, { bw: opts.bw, itemPrefix: opts.prefix });
|
|
1315
|
-
});
|
|
1316
|
-
|
|
1317
|
-
keys
|
|
1318
|
-
.command("list")
|
|
1319
|
-
.description("Show provider keys currently stored in the OS keychain (masked)")
|
|
1320
|
-
.action(async () => {
|
|
1321
|
-
const { runKeysList } = await import("./cli/keys.js");
|
|
1322
|
-
await runKeysList();
|
|
1323
|
-
});
|
|
1324
|
-
|
|
1325
|
-
keys
|
|
1326
|
-
.command("delete <provider>")
|
|
1327
|
-
.description("Delete a stored provider key from the OS keychain")
|
|
1328
|
-
.action(async (provider: string) => {
|
|
1329
|
-
const { runKeysDelete } = await import("./cli/keys.js");
|
|
1330
|
-
await runKeysDelete(provider);
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
|
-
keys
|
|
1334
|
-
.command("import-bw [providers...]")
|
|
1335
|
-
.description("Import keys from a Bitwarden vault into the OS keychain (requires bw CLI + BW_SESSION)")
|
|
1336
|
-
.option("--prefix <prefix>", "Vault item name prefix (default: 'muonroi-cli/')", "muonroi-cli/")
|
|
1337
|
-
.action(async (providers: string[], opts: { prefix: string }) => {
|
|
1338
|
-
const { runKeysImportBw } = await import("./cli/keys.js");
|
|
1339
|
-
await runKeysImportBw({ providers, itemPrefix: opts.prefix });
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
|
-
keys
|
|
1343
|
-
.command("login <provider>")
|
|
1344
|
-
.description("Log in to a provider via OAuth subscription (currently supports: openai)")
|
|
1345
|
-
.action(async (provider: string) => {
|
|
1346
|
-
const { runKeysLogin } = await import("./cli/keys.js");
|
|
1347
|
-
await runKeysLogin(provider);
|
|
1348
|
-
});
|
|
1349
|
-
|
|
1350
|
-
keys
|
|
1351
|
-
.command("logout <provider>")
|
|
1352
|
-
.description("Log out of an OAuth provider and revoke stored tokens")
|
|
1353
|
-
.action(async (provider: string) => {
|
|
1354
|
-
const { runKeysLogout } = await import("./cli/keys.js");
|
|
1355
|
-
await runKeysLogout(provider);
|
|
1356
|
-
});
|
|
1357
|
-
|
|
1358
|
-
keys
|
|
1359
|
-
.command("export <file>")
|
|
1360
|
-
.description("Export all keychain keys to an encrypted portable bundle (move between devices)")
|
|
1361
|
-
.action(async (file: string) => {
|
|
1362
|
-
const { runKeysExport } = await import("./cli/keys.js");
|
|
1363
|
-
await runKeysExport(file);
|
|
1364
|
-
});
|
|
1365
|
-
|
|
1366
|
-
keys
|
|
1367
|
-
.command("import <file>")
|
|
1368
|
-
.description("Import an encrypted bundle into the OS keychain (created by 'keys export')")
|
|
1369
|
-
.action(async (file: string) => {
|
|
1370
|
-
const { runKeysImport } = await import("./cli/keys.js");
|
|
1371
|
-
await runKeysImport(file);
|
|
1372
|
-
});
|
|
1373
|
-
|
|
1374
|
-
keys
|
|
1375
|
-
.command("cleanup-settings")
|
|
1376
|
-
.description("Strip plaintext API keys out of ~/.muonroi-cli/user-settings.json after migrating to keychain")
|
|
1377
|
-
.action(async () => {
|
|
1378
|
-
const { runKeysCleanupSettings } = await import("./cli/keys.js");
|
|
1379
|
-
await runKeysCleanupSettings();
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
keys
|
|
1383
|
-
.command("set-chat <id>")
|
|
1384
|
-
.description(
|
|
1385
|
-
"Set a chat-service secret (discord-token, discord-guild-id, slack-token, slack-team-id) in the OS keychain",
|
|
1386
|
-
)
|
|
1387
|
-
.action(async (id: string) => {
|
|
1388
|
-
const { runChatKeySet } = await import("./cli/keys.js");
|
|
1389
|
-
if (!["discord-token", "discord-guild-id", "slack-token", "slack-team-id"].includes(id)) {
|
|
1390
|
-
console.error(`Unknown chat secret '${id}'. Valid: discord-token, discord-guild-id, slack-token, slack-team-id`);
|
|
1391
|
-
process.exit(1);
|
|
1392
|
-
}
|
|
1393
|
-
const value = (
|
|
1394
|
-
await new Promise<string>((resolve) => {
|
|
1395
|
-
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
1396
|
-
rl.question(`Paste ${id} value (hidden): `, (answer) => {
|
|
1397
|
-
rl.close();
|
|
1398
|
-
resolve(answer);
|
|
1399
|
-
});
|
|
1400
|
-
})
|
|
1401
|
-
).trim();
|
|
1402
|
-
if (!value) {
|
|
1403
|
-
console.error("Aborted (empty value).");
|
|
1404
|
-
process.exit(1);
|
|
1405
|
-
}
|
|
1406
|
-
await runChatKeySet(id as any, value);
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
|
-
keys
|
|
1410
|
-
.command("import-bw-chat [ids...]")
|
|
1411
|
-
.option("--prefix <prefix>", "BW item name prefix", "muonroi-cli/chat-")
|
|
1412
|
-
.description("Import chat-service secrets from Bitwarden vault into OS keychain")
|
|
1413
|
-
.action(async (ids: string[], opts: { prefix?: string }) => {
|
|
1414
|
-
const { runChatImportBw } = await import("./cli/keys.js");
|
|
1415
|
-
await runChatImportBw({ ids: ids.length > 0 ? (ids as any) : undefined, itemPrefix: opts.prefix });
|
|
1416
|
-
});
|
|
1417
|
-
|
|
1418
|
-
const usage = program.command("usage").description("Inspect cost ledger and find spend bloat");
|
|
1419
|
-
|
|
1420
|
-
usage
|
|
1421
|
-
.command("report")
|
|
1422
|
-
.description("Aggregate per-call cost log + product ledger to find where spend grew")
|
|
1423
|
-
.option("--by <dim>", "Group by: callsite | role | phase | model | provider", "callsite")
|
|
1424
|
-
.option("--date <yyyy-mm-dd>", "Restrict cost-log to a single UTC date")
|
|
1425
|
-
.option("--run <productRunId>", "Restrict product ledger to one runId")
|
|
1426
|
-
.option("--source <src>", "cost-log | product | both", "both")
|
|
1427
|
-
.option("--breakdown", "Show orchestrator system-prompt / tools / messages breakdown")
|
|
1428
|
-
.option("--json", "Emit aggregated rows as JSON")
|
|
1429
|
-
.action(
|
|
1430
|
-
async (opts: { by: string; date?: string; run?: string; source: string; breakdown?: boolean; json?: boolean }) => {
|
|
1431
|
-
const { runUsageReport } = await import("./cli/usage-report.js");
|
|
1432
|
-
await runUsageReport({
|
|
1433
|
-
by: opts.by as "callsite" | "role" | "phase" | "model" | "provider",
|
|
1434
|
-
date: opts.date,
|
|
1435
|
-
runId: opts.run,
|
|
1436
|
-
source: opts.source as "cost-log" | "product" | "both",
|
|
1437
|
-
breakdown: opts.breakdown,
|
|
1438
|
-
json: opts.json,
|
|
1439
|
-
});
|
|
1440
|
-
},
|
|
1441
|
-
);
|
|
1442
|
-
|
|
1443
|
-
usage
|
|
1444
|
-
.command("pil")
|
|
1445
|
-
.description("Attribute system-prompt size growth to PIL layers (intent/personality/EE/GSD/context)")
|
|
1446
|
-
.option("--date <yyyy-mm-dd>", "Restrict to a single UTC date")
|
|
1447
|
-
.option("--top <n>", "Show top N largest prompts", "5")
|
|
1448
|
-
.option("--json", "Emit aggregated rows as JSON")
|
|
1449
|
-
.action(async (opts: { date?: string; top: string; json?: boolean }) => {
|
|
1450
|
-
const { runPilReport } = await import("./cli/pil-report.js");
|
|
1451
|
-
await runPilReport({
|
|
1452
|
-
date: opts.date,
|
|
1453
|
-
top: parseInt(opts.top, 10) || 5,
|
|
1454
|
-
json: opts.json,
|
|
1455
|
-
});
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
usage
|
|
1459
|
-
.command("forensics <sessionPrefix>")
|
|
1460
|
-
.description(
|
|
1461
|
-
"Per-event token + cache breakdown for a session (joins usage_events ∪ interaction_logs). Use to verify Phase A/B/C cost-optimization caps.",
|
|
1462
|
-
)
|
|
1463
|
-
.option("--json", "Emit summary as JSON")
|
|
1464
|
-
.action(async (sessionPrefix: string, opts: { json?: boolean }) => {
|
|
1465
|
-
const { runCostForensics } = await import("./cli/cost-forensics.js");
|
|
1466
|
-
await runCostForensics({ prefix: sessionPrefix, json: opts.json });
|
|
1467
|
-
});
|
|
1468
|
-
|
|
1469
|
-
const mcp = program.command("mcp").description("Manage MCP server configuration");
|
|
1470
|
-
|
|
1471
|
-
mcp
|
|
1472
|
-
.command("setup-research")
|
|
1473
|
-
.description("Configure web research MCP servers (context7, fetch, tavily)")
|
|
1474
|
-
.action(async () => {
|
|
1475
|
-
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
1476
|
-
const ask = (q: string): Promise<string> => new Promise((resolve) => rl.question(q, (a) => resolve(a)));
|
|
1477
|
-
try {
|
|
1478
|
-
const { runResearchOnboarding } = await import("./mcp/research-onboarding.js");
|
|
1479
|
-
const result = await runResearchOnboarding({
|
|
1480
|
-
askYesNo: ask,
|
|
1481
|
-
askText: ask,
|
|
1482
|
-
log: (m) => process.stderr.write(m),
|
|
1483
|
-
});
|
|
1484
|
-
process.stderr.write(`\nDone. Tavily ${result.tavilyEnabled ? "enabled" : "skipped"}.\n`);
|
|
1485
|
-
} finally {
|
|
1486
|
-
rl.close();
|
|
1487
|
-
}
|
|
1488
|
-
});
|
|
1489
|
-
|
|
1490
|
-
mcp
|
|
1491
|
-
.command("set <id>")
|
|
1492
|
-
.description("Prompt for an MCP API key (e.g. tavily) and store it in the OS keychain")
|
|
1493
|
-
.option("--bw", "Also write the key to a Bitwarden vault Secure Note (requires bw CLI + BW_SESSION)")
|
|
1494
|
-
.option("--prefix <prefix>", "Bitwarden item name prefix when --bw is set (default: 'muonroi-cli/')", "muonroi-cli/")
|
|
1495
|
-
.action(async (id: string, opts: { bw?: boolean; prefix: string }) => {
|
|
1496
|
-
const { runMcpKeysSet } = await import("./cli/keys.js");
|
|
1497
|
-
await runMcpKeysSet(id, { bw: opts.bw, itemPrefix: opts.prefix });
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
mcp
|
|
1501
|
-
.command("import-bw [keys...]")
|
|
1502
|
-
.description(
|
|
1503
|
-
"Import MCP secrets (e.g. tavily) from a Bitwarden vault into the OS keychain (requires bw CLI + BW_SESSION)",
|
|
1504
|
-
)
|
|
1505
|
-
.option("--prefix <prefix>", "Vault item name prefix (default: 'muonroi-cli/')", "muonroi-cli/")
|
|
1506
|
-
.action(async (keys: string[], opts: { prefix: string }) => {
|
|
1507
|
-
const { runMcpImportBw } = await import("./cli/keys.js");
|
|
1508
|
-
await runMcpImportBw({ keys, itemPrefix: opts.prefix });
|
|
1509
|
-
});
|
|
1510
|
-
|
|
1511
|
-
program
|
|
1512
|
-
.command("mcp-driver")
|
|
1513
|
-
.description("Run the agent-harness MCP driver over stdio")
|
|
1514
|
-
.action(async () => {
|
|
1515
|
-
const { runHarnessDriver } = await import("@muonroi/agent-harness-core/mcp-server");
|
|
1516
|
-
const { opentuiSpawn } = await import("./mcp/opentui-spawn.js");
|
|
1517
|
-
await runHarnessDriver(opentuiSpawn);
|
|
1518
|
-
});
|
|
1519
|
-
|
|
1520
|
-
program
|
|
1521
|
-
.command("share <user>")
|
|
1522
|
-
.description("Add a stakeholder to the current product's Discord channel")
|
|
1523
|
-
.option("--product <slug>", "Override product slug (default: most recent run)")
|
|
1524
|
-
.option("--display <name>", "Display name for the stakeholder")
|
|
1525
|
-
.action(async (user: string, opts: { product?: string; display?: string }) => {
|
|
1526
|
-
const token = process.env.MUONROI_DISCORD_TOKEN;
|
|
1527
|
-
const guildId = process.env.MUONROI_DISCORD_GUILD_ID;
|
|
1528
|
-
if (!token || !guildId) {
|
|
1529
|
-
console.error("muonroi share: MUONROI_DISCORD_TOKEN and MUONROI_DISCORD_GUILD_ID must both be set.");
|
|
1530
|
-
process.exit(1);
|
|
1531
|
-
}
|
|
1532
|
-
const { DiscordChatProvider } = await import("./chat/providers/discord/client.js");
|
|
1533
|
-
const { runShareCommand } = await import("./cli/share-cmd.js");
|
|
1534
|
-
const client = new DiscordChatProvider(token);
|
|
1535
|
-
const result = await runShareCommand({
|
|
1536
|
-
cwd: process.cwd(),
|
|
1537
|
-
user,
|
|
1538
|
-
product: opts.product,
|
|
1539
|
-
display: opts.display,
|
|
1540
|
-
client,
|
|
1541
|
-
});
|
|
1542
|
-
switch (result.kind) {
|
|
1543
|
-
case "granted":
|
|
1544
|
-
console.log(`Granted channel access to <@${result.userId}> in product ${result.slug}.`);
|
|
1545
|
-
break;
|
|
1546
|
-
case "acl-only":
|
|
1547
|
-
console.log(`Added <@${result.userId}> to product ${result.slug}. Channel will be granted access on creation.`);
|
|
1548
|
-
break;
|
|
1549
|
-
case "already-stakeholder":
|
|
1550
|
-
console.log(`User <@${result.userId}> is already a stakeholder of ${result.slug}.`);
|
|
1551
|
-
break;
|
|
1552
|
-
case "perm-error":
|
|
1553
|
-
console.error(
|
|
1554
|
-
`Failed to grant Discord permission (status=${result.status}). ACL was still updated; user can join when bot has permission.`,
|
|
1555
|
-
);
|
|
1556
|
-
process.exit(1);
|
|
1557
|
-
break;
|
|
1558
|
-
case "error":
|
|
1559
|
-
console.error(`muonroi share: ${result.message}`);
|
|
1560
|
-
process.exit(1);
|
|
1561
|
-
break;
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
|
|
1565
|
-
program.parse();
|
|
1566
|
-
|
|
1567
|
-
function formatContext(tokens: number): string {
|
|
1568
|
-
if (tokens >= 1_000_000) return `${tokens / 1_000_000}M`;
|
|
1569
|
-
return `${tokens / 1_000}K`;
|
|
1570
|
-
}
|