muonroi-cli 1.8.4 → 1.9.0
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 +17 -5
- package/dist/packages/agent-harness-core/src/driver.d.ts +27 -1
- package/dist/packages/agent-harness-core/src/driver.js +46 -0
- package/dist/packages/agent-harness-core/src/event-filter.js +11 -0
- package/dist/packages/agent-harness-core/src/event-redact.js +7 -0
- package/dist/packages/agent-harness-core/src/event-tee.d.ts +64 -0
- package/dist/packages/agent-harness-core/src/event-tee.js +104 -0
- package/dist/packages/agent-harness-core/src/mcp-server.d.ts +25 -0
- package/dist/packages/agent-harness-core/src/mcp-server.js +169 -21
- package/dist/packages/agent-harness-core/src/predicate.d.ts +1 -1
- package/dist/packages/agent-harness-core/src/protocol.d.ts +90 -4
- package/dist/packages/agent-harness-core/src/protocol.js +15 -0
- package/dist/packages/agent-harness-core/src/visual-quality.d.ts +58 -0
- package/dist/packages/agent-harness-core/src/visual-quality.js +141 -0
- package/dist/packages/agent-harness-opentui/src/agent-mode.d.ts +6 -0
- package/dist/packages/agent-harness-opentui/src/agent-mode.js +14 -1
- package/dist/packages/agent-harness-opentui/src/input-bridge.d.ts +2 -10
- package/dist/packages/agent-harness-opentui/src/input-bridge.js +103 -16
- package/dist/packages/agent-harness-opentui/src/install.d.ts +8 -0
- package/dist/packages/agent-harness-opentui/src/install.js +10 -0
- package/dist/packages/agent-harness-opentui/src/semantic.js +12 -10
- package/dist/packages/agent-harness-opentui/src/visual-capture.d.ts +56 -0
- package/dist/packages/agent-harness-opentui/src/visual-capture.js +103 -0
- package/dist/src/agent-harness/mock-model.d.ts +38 -0
- package/dist/src/agent-harness/mock-model.js +69 -3
- package/dist/src/agent-harness/test-spawn.js +31 -0
- package/dist/src/chat/chat-keychain.d.ts +7 -12
- package/dist/src/chat/chat-keychain.js +19 -86
- package/dist/src/cli/config/screen-providers.js +1 -1
- package/dist/src/cli/cost-forensics.d.ts +10 -0
- package/dist/src/cli/cost-forensics.js +18 -3
- package/dist/src/cli/keys-bundle.d.ts +1 -1
- package/dist/src/cli/keys-bundle.js +1 -1
- package/dist/src/cli/keys.d.ts +10 -47
- package/dist/src/cli/keys.js +31 -399
- package/dist/src/council/clarifier.d.ts +31 -3
- package/dist/src/council/clarifier.js +220 -32
- package/dist/src/council/context.js +49 -15
- package/dist/src/council/debate-checkpoint.d.ts +129 -0
- package/dist/src/council/debate-checkpoint.js +176 -0
- package/dist/src/council/debate-planner.js +54 -5
- package/dist/src/council/debate-summary.d.ts +25 -0
- package/dist/src/council/debate-summary.js +85 -0
- package/dist/src/council/debate.d.ts +169 -2
- package/dist/src/council/debate.js +1265 -135
- package/dist/src/council/index.d.ts +108 -1
- package/dist/src/council/index.js +670 -197
- package/dist/src/council/leader.d.ts +26 -0
- package/dist/src/council/leader.js +150 -9
- package/dist/src/council/llm.d.ts +94 -0
- package/dist/src/council/llm.js +348 -55
- package/dist/src/council/panel-select.d.ts +30 -0
- package/dist/src/council/panel-select.js +82 -0
- package/dist/src/council/planner.js +40 -0
- package/dist/src/council/preflight.d.ts +17 -0
- package/dist/src/council/preflight.js +50 -2
- package/dist/src/council/prompts.d.ts +39 -4
- package/dist/src/council/prompts.js +256 -69
- package/dist/src/council/stance-recall.d.ts +42 -0
- package/dist/src/council/stance-recall.js +57 -0
- package/dist/src/council/strip-think.d.ts +17 -0
- package/dist/src/council/strip-think.js +33 -0
- package/dist/src/council/types.d.ts +138 -0
- package/dist/src/ee/artifact-cache.d.ts +16 -0
- package/dist/src/ee/artifact-cache.js +32 -0
- package/dist/src/ee/auth.d.ts +20 -0
- package/dist/src/ee/auth.js +54 -2
- package/dist/src/ee/bridge.d.ts +10 -0
- package/dist/src/ee/bridge.js +58 -0
- package/dist/src/ee/client.js +109 -21
- package/dist/src/ee/ee-onboarding.js +6 -26
- package/dist/src/ee/export-transcripts.d.ts +1 -0
- package/dist/src/ee/export-transcripts.js +8 -10
- package/dist/src/ee/extract-session.js +29 -0
- package/dist/src/ee/extract-style.d.ts +58 -0
- package/dist/src/ee/extract-style.js +270 -0
- package/dist/src/ee/recall-ledger.d.ts +9 -0
- package/dist/src/ee/recall-ledger.js +3 -0
- package/dist/src/ee/scope.d.ts +1 -0
- package/dist/src/ee/scope.js +26 -1
- package/dist/src/ee/search.d.ts +7 -0
- package/dist/src/ee/search.js +24 -0
- package/dist/src/ee/transcript-emit.js +2 -0
- package/dist/src/ee/types.d.ts +22 -0
- package/dist/src/ee/who-am-i-brain.d.ts +35 -0
- package/dist/src/ee/who-am-i-brain.js +220 -0
- package/dist/src/ee/who-am-i.d.ts +10 -3
- package/dist/src/ee/who-am-i.js +12 -0
- package/dist/src/ee/workflow-event.d.ts +48 -0
- package/dist/src/ee/workflow-event.js +81 -0
- package/dist/src/flow/compaction/compress.d.ts +3 -3
- package/dist/src/flow/compaction/compress.js +58 -8
- package/dist/src/flow/compaction/extract.d.ts +4 -7
- package/dist/src/flow/compaction/extract.js +50 -10
- package/dist/src/flow/compaction/index.d.ts +14 -1
- package/dist/src/flow/compaction/index.js +96 -3
- package/dist/src/flow/compaction/input-guard.d.ts +24 -0
- package/dist/src/flow/compaction/input-guard.js +43 -0
- package/dist/src/flow/compaction/progress.d.ts +35 -0
- package/dist/src/flow/compaction/progress.js +35 -0
- package/dist/src/flow/fold-planning.d.ts +36 -0
- package/dist/src/flow/fold-planning.js +83 -0
- package/dist/src/flow/hierarchy.d.ts +146 -0
- package/dist/src/flow/hierarchy.js +427 -0
- package/dist/src/flow/index.d.ts +1 -0
- package/dist/src/flow/index.js +2 -0
- package/dist/src/flow/run-artifacts.d.ts +102 -0
- package/dist/src/flow/run-artifacts.js +208 -0
- package/dist/src/generated/version.d.ts +1 -1
- package/dist/src/generated/version.js +1 -1
- package/dist/src/gsd/assessment-schema.d.ts +44 -0
- package/dist/src/gsd/assessment-schema.js +134 -0
- package/dist/src/gsd/capability-registry.d.ts +45 -0
- package/dist/src/gsd/capability-registry.js +337 -0
- package/dist/src/gsd/complexity-assessor.d.ts +39 -0
- package/dist/src/gsd/complexity-assessor.js +152 -0
- package/dist/src/gsd/config-bridge.d.ts +7 -0
- package/dist/src/gsd/config-bridge.js +114 -0
- package/dist/src/gsd/config-loader.d.ts +27 -0
- package/dist/src/gsd/config-loader.js +50 -0
- package/dist/src/gsd/council-context.d.ts +44 -0
- package/dist/src/gsd/council-context.js +114 -0
- package/dist/src/gsd/ee-closure.d.ts +28 -0
- package/dist/src/gsd/ee-closure.js +49 -0
- package/dist/src/gsd/flags.d.ts +66 -0
- package/dist/src/gsd/flags.js +102 -0
- package/dist/src/gsd/gsd-dispatch.d.ts +58 -0
- package/dist/src/gsd/gsd-dispatch.js +131 -0
- package/dist/src/gsd/gsd-runtime.d.ts +22 -0
- package/dist/src/gsd/gsd-runtime.js +37 -0
- package/dist/src/gsd/host-adapter.d.ts +11 -0
- package/dist/src/gsd/host-adapter.js +29 -0
- package/dist/src/gsd/index.d.ts +24 -1
- package/dist/src/gsd/index.js +27 -0
- package/dist/src/gsd/loop-host-contract.d.ts +21 -0
- package/dist/src/gsd/loop-host-contract.js +39 -0
- package/dist/src/gsd/loop-host.d.ts +69 -0
- package/dist/src/gsd/loop-host.js +245 -0
- package/dist/src/gsd/loop-resolver.d.ts +36 -0
- package/dist/src/gsd/loop-resolver.js +79 -0
- package/dist/src/gsd/model-tier.d.ts +13 -0
- package/dist/src/gsd/model-tier.js +45 -0
- package/dist/src/gsd/mutation-gate.d.ts +16 -0
- package/dist/src/gsd/mutation-gate.js +41 -0
- package/dist/src/gsd/native-roadmap.d.ts +89 -0
- package/dist/src/gsd/native-roadmap.js +343 -0
- package/dist/src/gsd/native-state.d.ts +47 -0
- package/dist/src/gsd/native-state.js +220 -0
- package/dist/src/gsd/paths.d.ts +23 -0
- package/dist/src/gsd/paths.js +66 -0
- package/dist/src/gsd/phase-dag.d.ts +12 -0
- package/dist/src/gsd/phase-dag.js +94 -0
- package/dist/src/gsd/phase-sync.d.ts +42 -0
- package/dist/src/gsd/phase-sync.js +321 -0
- package/dist/src/gsd/pil-gate-context.d.ts +13 -0
- package/dist/src/gsd/pil-gate-context.js +64 -0
- package/dist/src/gsd/pil-gate-critic.d.ts +19 -0
- package/dist/src/gsd/pil-gate-critic.js +74 -0
- package/dist/src/gsd/plan-council-prompts.d.ts +25 -0
- package/dist/src/gsd/plan-council-prompts.js +79 -0
- package/dist/src/gsd/plan-council.d.ts +44 -0
- package/dist/src/gsd/plan-council.js +283 -0
- package/dist/src/gsd/plan-gate-vocabulary.d.ts +40 -0
- package/dist/src/gsd/plan-gate-vocabulary.js +64 -0
- package/dist/src/gsd/product-workspace.d.ts +13 -0
- package/dist/src/gsd/product-workspace.js +124 -0
- package/dist/src/gsd/ship-bridge.d.ts +25 -0
- package/dist/src/gsd/ship-bridge.js +65 -0
- package/dist/src/gsd/state-document.d.ts +40 -0
- package/dist/src/gsd/state-document.js +163 -0
- package/dist/src/gsd/verdict-schema.d.ts +39 -0
- package/dist/src/gsd/verdict-schema.js +144 -0
- package/dist/src/gsd/verify-context.d.ts +22 -0
- package/dist/src/gsd/verify-context.js +27 -0
- package/dist/src/gsd/verify-council-prompts.d.ts +19 -0
- package/dist/src/gsd/verify-council-prompts.js +85 -0
- package/dist/src/gsd/verify-council.d.ts +25 -0
- package/dist/src/gsd/verify-council.js +119 -0
- package/dist/src/gsd/verify-gate-vocabulary.d.ts +25 -0
- package/dist/src/gsd/verify-gate-vocabulary.js +46 -0
- package/dist/src/gsd/workflow-engine.d.ts +60 -0
- package/dist/src/gsd/workflow-engine.js +207 -0
- package/dist/src/gsd/workflow-tools.d.ts +13 -0
- package/dist/src/gsd/workflow-tools.js +277 -0
- package/dist/src/headless/council-answers.js +4 -0
- package/dist/src/hooks/index.js +1 -1
- package/dist/src/index.js +172 -270
- package/dist/src/lsp/builtins.js +3 -1
- package/dist/src/lsp/manager.d.ts +5 -1
- package/dist/src/lsp/manager.js +249 -3
- package/dist/src/lsp/npm-cache.d.ts +11 -1
- package/dist/src/lsp/npm-cache.js +17 -1
- package/dist/src/lsp/runtime.d.ts +6 -1
- package/dist/src/lsp/runtime.js +17 -1
- package/dist/src/lsp/types.d.ts +83 -1
- package/dist/src/lsp/types.js +10 -0
- package/dist/src/maintain/pr-builder.js +23 -13
- package/dist/src/mcp/auto-setup.js +57 -32
- package/dist/src/mcp/client-pool.js +44 -16
- package/dist/src/mcp/lsp-tools.d.ts +5 -1
- package/dist/src/mcp/lsp-tools.js +93 -2
- package/dist/src/mcp/mcp-keychain.d.ts +3 -5
- package/dist/src/mcp/mcp-keychain.js +9 -49
- package/dist/src/mcp/research-onboarding.js +8 -7
- package/dist/src/mcp/runtime.js +34 -2
- package/dist/src/mcp/setup-guide-text.d.ts +1 -1
- package/dist/src/mcp/setup-guide-text.js +22 -2
- package/dist/src/mcp/tools-server.d.ts +10 -0
- package/dist/src/mcp/tools-server.js +10 -2
- package/dist/src/models/catalog-client.d.ts +87 -0
- package/dist/src/models/catalog-client.js +105 -38
- package/dist/src/models/catalog.json +528 -265
- package/dist/src/models/registry.d.ts +22 -7
- package/dist/src/models/registry.js +73 -10
- package/dist/src/ops/doctor.js +1 -1
- package/dist/src/orchestrator/ask-user.d.ts +61 -0
- package/dist/src/orchestrator/ask-user.js +65 -0
- package/dist/src/orchestrator/auto-commit.js +1 -1
- package/dist/src/orchestrator/batch-turn-runner.js +2 -2
- package/dist/src/orchestrator/cache-prefix.d.ts +67 -0
- package/dist/src/orchestrator/cache-prefix.js +83 -0
- package/dist/src/orchestrator/compact-request.d.ts +32 -0
- package/dist/src/orchestrator/compact-request.js +41 -0
- package/dist/src/orchestrator/compaction.d.ts +12 -3
- package/dist/src/orchestrator/compaction.js +35 -15
- package/dist/src/orchestrator/council-manager.d.ts +12 -3
- package/dist/src/orchestrator/council-manager.js +74 -32
- package/dist/src/orchestrator/council-request.d.ts +49 -0
- package/dist/src/orchestrator/council-request.js +62 -0
- package/dist/src/orchestrator/cross-turn-dedup.d.ts +6 -0
- package/dist/src/orchestrator/cross-turn-dedup.js +22 -1
- package/dist/src/orchestrator/error-utils.d.ts +29 -0
- package/dist/src/orchestrator/error-utils.js +132 -24
- package/dist/src/orchestrator/grounding-check.js +39 -1
- package/dist/src/orchestrator/interactive-pause.d.ts +26 -0
- package/dist/src/orchestrator/interactive-pause.js +36 -0
- package/dist/src/orchestrator/message-processor.d.ts +4 -0
- package/dist/src/orchestrator/message-processor.js +268 -41
- package/dist/src/orchestrator/orchestrator.d.ts +64 -3
- package/dist/src/orchestrator/orchestrator.js +823 -120
- package/dist/src/orchestrator/preprocessor.js +3 -3
- package/dist/src/orchestrator/proactive-compact-detector.d.ts +26 -0
- package/dist/src/orchestrator/proactive-compact-detector.js +36 -0
- package/dist/src/orchestrator/prompts.js +17 -17
- package/dist/src/orchestrator/reactive-delegation.d.ts +39 -0
- package/dist/src/orchestrator/reactive-delegation.js +59 -0
- package/dist/src/orchestrator/retry-classifier.d.ts +2 -1
- package/dist/src/orchestrator/retry-classifier.js +46 -2
- package/dist/src/orchestrator/safety-askcard.d.ts +1 -1
- package/dist/src/orchestrator/safety-askcard.js +5 -2
- package/dist/src/orchestrator/safety-intercept.d.ts +50 -0
- package/dist/src/orchestrator/safety-intercept.js +62 -0
- package/dist/src/orchestrator/scope-reminder.js +1 -1
- package/dist/src/orchestrator/session-experience.d.ts +2 -1
- package/dist/src/orchestrator/session-experience.js +2 -1
- package/dist/src/orchestrator/should-run-gate.d.ts +5 -0
- package/dist/src/orchestrator/should-run-gate.js +18 -0
- package/dist/src/orchestrator/stall-watchdog.d.ts +31 -3
- package/dist/src/orchestrator/stall-watchdog.js +65 -10
- package/dist/src/orchestrator/stream-runner.d.ts +13 -3
- package/dist/src/orchestrator/stream-runner.js +115 -49
- package/dist/src/orchestrator/sub-agent-cap.d.ts +13 -1
- package/dist/src/orchestrator/sub-agent-cap.js +16 -1
- package/dist/src/orchestrator/sub-agent-model-tier.d.ts +13 -1
- package/dist/src/orchestrator/sub-agent-model-tier.js +16 -2
- package/dist/src/orchestrator/subagent-compactor.d.ts +53 -1
- package/dist/src/orchestrator/subagent-compactor.js +126 -15
- package/dist/src/orchestrator/tool-engine.d.ts +41 -0
- package/dist/src/orchestrator/tool-engine.js +846 -66
- package/dist/src/orchestrator/tool-limit-auto-recover.d.ts +22 -0
- package/dist/src/orchestrator/tool-limit-auto-recover.js +30 -0
- package/dist/src/orchestrator/turn-runner-deps.d.ts +19 -0
- package/dist/src/orchestrator/turn-watchdog.d.ts +44 -0
- package/dist/src/orchestrator/turn-watchdog.js +84 -0
- package/dist/src/pil/agent-operating-contract.d.ts +1 -1
- package/dist/src/pil/agent-operating-contract.js +6 -4
- package/dist/src/pil/cheap-model-playbook.d.ts +1 -1
- package/dist/src/pil/cheap-model-playbook.js +5 -1
- package/dist/src/pil/cheap-model-workbooks.d.ts +1 -1
- package/dist/src/pil/cheap-model-workbooks.js +1 -1
- package/dist/src/pil/discovery-types.d.ts +1 -0
- package/dist/src/pil/discovery.d.ts +1 -1
- package/dist/src/pil/discovery.js +18 -13
- package/dist/src/pil/layer1-intent.d.ts +18 -6
- package/dist/src/pil/layer1-intent.js +66 -757
- package/dist/src/pil/layer15-context-scan.js +15 -1
- package/dist/src/pil/layer1_5-complexity-size.d.ts +7 -0
- package/dist/src/pil/layer1_5-complexity-size.js +31 -5
- package/dist/src/pil/layer3-ee-injection.js +23 -8
- package/dist/src/pil/layer4-gsd.js +69 -16
- package/dist/src/pil/layer5-context.js +7 -3
- package/dist/src/pil/layer6-output.d.ts +23 -0
- package/dist/src/pil/layer6-output.js +5 -1
- package/dist/src/pil/llm-classify.d.ts +111 -5
- package/dist/src/pil/llm-classify.js +421 -189
- package/dist/src/pil/native-capabilities-workbook.d.ts +1 -1
- package/dist/src/pil/native-capabilities-workbook.js +8 -0
- package/dist/src/pil/pipeline.js +36 -2
- package/dist/src/pil/repo-grounding-probe.d.ts +15 -0
- package/dist/src/pil/repo-grounding-probe.js +136 -0
- package/dist/src/pil/repo-structure-hints.d.ts +7 -0
- package/dist/src/pil/repo-structure-hints.js +45 -0
- package/dist/src/pil/response-tools.js +5 -3
- package/dist/src/pil/schema.d.ts +1 -0
- package/dist/src/pil/schema.js +2 -0
- package/dist/src/pil/types.d.ts +18 -0
- package/dist/src/playbook/directives.d.ts +4 -0
- package/dist/src/playbook/directives.js +17 -5
- package/dist/src/product-loop/artifact-io.js +4 -0
- package/dist/src/product-loop/backlog-builder.d.ts +14 -1
- package/dist/src/product-loop/backlog-builder.js +30 -6
- package/dist/src/product-loop/criteria-seed.d.ts +51 -0
- package/dist/src/product-loop/criteria-seed.js +200 -0
- package/dist/src/product-loop/discovery-context-format.js +3 -1
- package/dist/src/product-loop/discovery-ecosystem.js +4 -1
- package/dist/src/product-loop/discovery-interview.d.ts +9 -0
- package/dist/src/product-loop/discovery-interview.js +60 -12
- package/dist/src/product-loop/discovery-recommender.js +2 -1
- package/dist/src/product-loop/discovery-schema.js +19 -2
- package/dist/src/product-loop/discovery-triage.d.ts +23 -0
- package/dist/src/product-loop/discovery-triage.js +109 -0
- package/dist/src/product-loop/gather.js +150 -2
- package/dist/src/product-loop/ideal-trace.d.ts +7 -0
- package/dist/src/product-loop/ideal-trace.js +64 -0
- package/dist/src/product-loop/index.d.ts +13 -1
- package/dist/src/product-loop/index.js +340 -52
- package/dist/src/product-loop/loop-driver.d.ts +7 -0
- package/dist/src/product-loop/loop-driver.js +330 -106
- package/dist/src/product-loop/phase-plan.d.ts +21 -0
- package/dist/src/product-loop/phase-plan.js +81 -6
- package/dist/src/product-loop/phase-rituals.d.ts +3 -0
- package/dist/src/product-loop/phase-rituals.js +8 -3
- package/dist/src/product-loop/phase-runner.js +39 -12
- package/dist/src/product-loop/plan-adherence-review.d.ts +26 -0
- package/dist/src/product-loop/plan-adherence-review.js +144 -0
- package/dist/src/product-loop/sprint-runner.d.ts +173 -0
- package/dist/src/product-loop/sprint-runner.js +863 -19
- package/dist/src/product-loop/types.d.ts +61 -5
- package/dist/src/providers/adapter.d.ts +1 -1
- package/dist/src/providers/adapter.js +3 -4
- package/dist/src/providers/anthropic.d.ts +9 -8
- package/dist/src/providers/anthropic.js +13 -47
- package/dist/src/providers/auth/browser-flow.d.ts +1 -1
- package/dist/src/providers/auth/browser-flow.js +1 -1
- package/dist/src/providers/auth/grok-oauth.d.ts +1 -0
- package/dist/src/providers/auth/grok-oauth.js +30 -5
- package/dist/src/providers/auth/openai-oauth.d.ts +1 -0
- package/dist/src/providers/auth/openai-oauth.js +15 -1
- package/dist/src/providers/auth/registry.js +0 -34
- package/dist/src/providers/auth/token-store.d.ts +9 -9
- package/dist/src/providers/auth/token-store.js +8 -67
- package/dist/src/providers/auth/types.d.ts +9 -1
- package/dist/src/providers/auth/types.js +1 -1
- package/dist/src/providers/capabilities.d.ts +24 -5
- package/dist/src/providers/capabilities.js +42 -24
- package/dist/src/providers/endpoints.d.ts +2 -2
- package/dist/src/providers/endpoints.js +11 -10
- package/dist/src/providers/env-store.d.ts +17 -0
- package/dist/src/providers/env-store.js +228 -0
- package/dist/src/providers/keychain.d.ts +22 -18
- package/dist/src/providers/keychain.js +127 -140
- package/dist/src/providers/mcp-vision-bridge.js +56 -146
- package/dist/src/providers/openai-compatible.js +8 -1
- package/dist/src/providers/pricing.d.ts +2 -2
- package/dist/src/providers/pricing.js +3 -13
- package/dist/src/providers/runtime.d.ts +43 -3
- package/dist/src/providers/runtime.js +88 -14
- package/dist/src/providers/strategies/base.strategy.d.ts +16 -0
- package/dist/src/providers/strategies/base.strategy.js +24 -1
- package/dist/src/providers/strategies/{siliconflow.strategy.d.ts → opencode-go.strategy.d.ts} +3 -3
- package/dist/src/providers/strategies/opencode-go.strategy.js +83 -0
- package/dist/src/providers/strategies/registry.js +4 -4
- package/dist/src/providers/strategies/thinking-mode.d.ts +109 -0
- package/dist/src/providers/strategies/thinking-mode.js +288 -1
- package/dist/src/providers/strategies/xai.strategy.js +27 -0
- package/dist/src/providers/strategies/zai.strategy.d.ts +14 -0
- package/dist/src/providers/strategies/zai.strategy.js +44 -0
- package/dist/src/providers/types.d.ts +5 -6
- package/dist/src/providers/types.js +2 -2
- package/dist/src/providers/vision-backend.d.ts +47 -0
- package/dist/src/providers/vision-backend.js +258 -0
- package/dist/src/providers/vision-proxy.d.ts +22 -9
- package/dist/src/providers/vision-proxy.js +63 -132
- package/dist/src/providers/warm.d.ts +65 -0
- package/dist/src/providers/warm.js +145 -0
- package/dist/src/providers/wire-debug.js +95 -0
- package/dist/src/router/decide.d.ts +13 -0
- package/dist/src/router/decide.js +138 -36
- package/dist/src/router/peak-hour.d.ts +38 -0
- package/dist/src/router/peak-hour.js +107 -0
- package/dist/src/router/step-router.js +3 -2
- package/dist/src/router/warm.js +4 -5
- package/dist/src/scaffold/continuation-prompt.d.ts +11 -0
- package/dist/src/scaffold/continuation-prompt.js +26 -0
- package/dist/src/scaffold/point-to-existing.d.ts +21 -0
- package/dist/src/scaffold/point-to-existing.js +25 -0
- package/dist/src/self-qa/agentic-loop.js +6 -5
- package/dist/src/{ui/state → state}/active-run.d.ts +19 -0
- package/dist/src/{ui/state → state}/active-run.js +21 -0
- package/dist/src/{ui/status-bar/store.d.ts → state/status-bar-store.d.ts} +4 -1
- package/dist/src/{ui/status-bar/store.js → state/status-bar-store.js} +12 -9
- package/dist/src/state/turn-trace.d.ts +43 -0
- package/dist/src/state/turn-trace.js +32 -0
- package/dist/src/storage/db.js +2 -1
- package/dist/src/storage/index.d.ts +1 -1
- package/dist/src/storage/index.js +1 -1
- package/dist/src/storage/interaction-log.d.ts +1 -1
- package/dist/src/storage/migrations.js +71 -1
- package/dist/src/storage/sessions.d.ts +28 -10
- package/dist/src/storage/sessions.js +78 -21
- package/dist/src/storage/transcript-view.js +1 -1
- package/dist/src/storage/transcript.d.ts +51 -0
- package/dist/src/storage/transcript.js +340 -15
- package/dist/src/tools/file.d.ts +15 -0
- package/dist/src/tools/file.js +32 -0
- package/dist/src/tools/git-safety.d.ts +19 -0
- package/dist/src/tools/git-safety.js +168 -0
- package/dist/src/tools/native-tools.d.ts +1 -1
- package/dist/src/tools/native-tools.js +81 -1
- package/dist/src/tools/registry.d.ts +20 -0
- package/dist/src/tools/registry.js +576 -23
- package/dist/src/tools/research.d.ts +29 -0
- package/dist/src/tools/research.js +233 -0
- package/dist/src/types/index.d.ts +147 -4
- package/dist/src/ui/app.js +0 -0
- package/dist/src/ui/cards/product-status-card.js +1 -1
- package/dist/src/ui/components/agent-rail-activities.d.ts +26 -0
- package/dist/src/ui/components/agent-rail-activities.js +47 -0
- package/dist/src/ui/components/bubble-body-guard.d.ts +27 -0
- package/dist/src/ui/components/bubble-body-guard.js +50 -0
- package/dist/src/ui/components/compact-progress-card.d.ts +24 -0
- package/dist/src/ui/components/compact-progress-card.js +42 -0
- package/dist/src/ui/components/context-rail.d.ts +26 -0
- package/dist/src/ui/components/context-rail.js +33 -0
- package/dist/src/ui/components/council-conclusion-card.d.ts +73 -0
- package/dist/src/ui/components/council-conclusion-card.js +420 -0
- package/dist/src/ui/components/council-debate-pill.d.ts +36 -0
- package/dist/src/ui/components/council-debate-pill.js +34 -0
- package/dist/src/ui/components/council-info-card.js +2 -2
- package/dist/src/ui/components/council-leader-bubble.d.ts +10 -3
- package/dist/src/ui/components/council-leader-bubble.js +21 -11
- package/dist/src/ui/components/council-message-bubble.d.ts +15 -2
- package/dist/src/ui/components/council-message-bubble.js +16 -15
- package/dist/src/ui/components/council-phase-timeline.d.ts +9 -1
- package/dist/src/ui/components/council-phase-timeline.js +66 -17
- package/dist/src/ui/components/council-placeholder-bubble.d.ts +16 -9
- package/dist/src/ui/components/council-placeholder-bubble.js +32 -29
- package/dist/src/ui/components/council-question-card.js +13 -12
- package/dist/src/ui/components/council-rail-rounds.d.ts +26 -0
- package/dist/src/ui/components/council-rail-rounds.js +57 -0
- package/dist/src/ui/components/council-round-group.d.ts +38 -0
- package/dist/src/ui/components/council-round-group.js +88 -0
- package/dist/src/ui/components/council-status-list.d.ts +3 -1
- package/dist/src/ui/components/council-status-list.js +36 -24
- package/dist/src/ui/components/council-synthesis-banner.d.ts +7 -2
- package/dist/src/ui/components/council-synthesis-banner.js +20 -5
- package/dist/src/ui/components/halt-recovery-card.js +9 -5
- package/dist/src/ui/components/jump-to-latest-pill.d.ts +11 -0
- package/dist/src/ui/components/jump-to-latest-pill.js +14 -0
- package/dist/src/ui/components/message-view.d.ts +15 -0
- package/dist/src/ui/components/message-view.js +50 -1
- package/dist/src/ui/components/prompt-box.js +18 -16
- package/dist/src/ui/components/session-tree-card.d.ts +14 -0
- package/dist/src/ui/components/session-tree-card.js +46 -0
- package/dist/src/ui/components/slash-inline-menu.d.ts +12 -0
- package/dist/src/ui/components/slash-inline-menu.js +26 -5
- package/dist/src/ui/components/task-list-panel.d.ts +14 -1
- package/dist/src/ui/components/task-list-panel.js +22 -2
- package/dist/src/ui/components/tool-group.d.ts +15 -3
- package/dist/src/ui/components/tool-group.js +69 -11
- package/dist/src/ui/containers/modals-layer.d.ts +4 -2
- package/dist/src/ui/containers/modals-layer.js +2 -2
- package/dist/src/ui/council-harness-event.d.ts +57 -0
- package/dist/src/ui/council-harness-event.js +46 -0
- package/dist/src/ui/heartbeat-debug.d.ts +29 -0
- package/dist/src/ui/heartbeat-debug.js +45 -0
- package/dist/src/ui/hooks/use-session-picker.d.ts +3 -3
- package/dist/src/ui/mcp-modal.js +2 -4
- package/dist/src/ui/modals/api-key-modal.js +1 -1
- package/dist/src/ui/modals/connect-modal.js +4 -3
- package/dist/src/ui/modals/model-picker-modal.d.ts +8 -18
- package/dist/src/ui/modals/model-picker-modal.js +8 -10
- package/dist/src/ui/modals/session-picker-modal.d.ts +2 -2
- package/dist/src/ui/modals/session-picker-modal.js +3 -5
- package/dist/src/ui/picker-providers.d.ts +1 -1
- package/dist/src/ui/picker-providers.js +1 -1
- package/dist/src/ui/primitives/index.d.ts +1 -0
- package/dist/src/ui/primitives/index.js +2 -0
- package/dist/src/ui/primitives/semantic-primitives.d.ts +76 -0
- package/dist/src/ui/primitives/semantic-primitives.js +81 -0
- package/dist/src/ui/slash/compact.js +5 -7
- package/dist/src/ui/slash/cost.js +1 -1
- package/dist/src/ui/slash/council.js +19 -1
- package/dist/src/ui/slash/debug.d.ts +3 -31
- package/dist/src/ui/slash/debug.js +9 -20
- package/dist/src/ui/slash/ee.js +81 -0
- package/dist/src/ui/slash/ideal.d.ts +6 -2
- package/dist/src/ui/slash/ideal.js +97 -7
- package/dist/src/ui/slash/menu-items.d.ts +7 -0
- package/dist/src/ui/slash/menu-items.js +23 -20
- package/dist/src/ui/slash/registry.d.ts +2 -0
- package/dist/src/ui/slash/registry.js +4 -0
- package/dist/src/ui/status-bar/cache-hit.d.ts +6 -0
- package/dist/src/ui/status-bar/cache-hit.js +9 -0
- package/dist/src/ui/status-bar/index.d.ts +1 -1
- package/dist/src/ui/status-bar/index.js +7 -3
- package/dist/src/ui/status-bar/usd-meter.d.ts +5 -4
- package/dist/src/ui/status-bar/usd-meter.js +6 -4
- package/dist/src/ui/theme.d.ts +1 -0
- package/dist/src/ui/theme.js +2 -0
- package/dist/src/ui/types.d.ts +7 -0
- package/dist/src/ui/use-app-logic.js +0 -0
- package/dist/src/ui/utils/agent-activities.d.ts +39 -0
- package/dist/src/ui/utils/agent-activities.js +96 -0
- package/dist/src/ui/utils/format.d.ts +14 -0
- package/dist/src/ui/utils/format.js +23 -3
- package/dist/src/ui/utils/group-tool-entries.d.ts +26 -0
- package/dist/src/ui/utils/group-tool-entries.js +111 -0
- package/dist/src/ui/utils/tool-summary.d.ts +21 -0
- package/dist/src/ui/utils/tool-summary.js +91 -0
- package/dist/src/usage/downgrade.js +2 -2
- package/dist/src/usage/product-ledger.js +2 -2
- package/dist/src/utils/event-loop-monitor.d.ts +85 -0
- package/dist/src/utils/event-loop-monitor.js +107 -0
- package/dist/src/utils/install-manager.js +2 -1
- package/dist/src/utils/llm-deadline.d.ts +14 -0
- package/dist/src/utils/llm-deadline.js +19 -0
- package/dist/src/utils/logger.js +2 -2
- package/dist/src/utils/loop-profiler.d.ts +102 -0
- package/dist/src/utils/loop-profiler.js +202 -0
- package/dist/src/utils/permission-mode.js +5 -3
- package/dist/src/utils/redactor.js +1 -1
- package/dist/src/utils/settings.d.ts +180 -5
- package/dist/src/utils/settings.js +271 -31
- package/dist/src/utils/side-question.d.ts +1 -2
- package/dist/src/utils/side-question.js +2 -2
- package/dist/src/utils/visible-retry.d.ts +11 -0
- package/dist/src/utils/visible-retry.js +10 -1
- package/dist/src/verify/entrypoint.d.ts +1 -1
- package/dist/src/verify/entrypoint.js +52 -17
- package/dist/src/verify/orchestrator.d.ts +1 -1
- package/dist/src/verify/orchestrator.js +20 -3
- package/dist/src/verify/recipes.d.ts +13 -0
- package/dist/src/verify/recipes.js +15 -0
- package/package.json +134 -132
- package/dist/src/cli/bw-vault.d.ts +0 -55
- package/dist/src/cli/bw-vault.js +0 -133
- package/dist/src/mcp/ee-tools.d.ts +0 -46
- package/dist/src/mcp/ee-tools.js +0 -193
- package/dist/src/providers/auth/gcloud.d.ts +0 -28
- package/dist/src/providers/auth/gcloud.js +0 -102
- package/dist/src/providers/auth/gemini-oauth.d.ts +0 -82
- package/dist/src/providers/auth/gemini-oauth.js +0 -472
- package/dist/src/providers/gemini.d.ts +0 -11
- package/dist/src/providers/gemini.js +0 -45
- package/dist/src/providers/siliconflow-sse-repair.d.ts +0 -58
- package/dist/src/providers/siliconflow-sse-repair.js +0 -177
- package/dist/src/providers/strategies/google.strategy.d.ts +0 -22
- package/dist/src/providers/strategies/google.strategy.js +0 -174
- package/dist/src/providers/strategies/siliconflow.strategy.js +0 -29
- package/dist/src/ui/containers/chat-feed.d.ts +0 -40
- package/dist/src/ui/containers/chat-feed.js +0 -66
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/utils/loop-profiler.ts
|
|
3
|
+
*
|
|
4
|
+
* Rolling V8 CPU profiler — the instrument that names the culprit when the
|
|
5
|
+
* event loop blocks (see `event-loop-monitor.ts` for the incident this exists
|
|
6
|
+
* for).
|
|
7
|
+
*
|
|
8
|
+
* Why a CPU profile and not a stack dump: while the JS thread is blocked, NO
|
|
9
|
+
* JS can run — you cannot ask the process what it is doing, because asking is
|
|
10
|
+
* itself JS. V8's sampling profiler runs on its OWN thread and samples the JS
|
|
11
|
+
* thread regardless of whether that thread is stuck, so the profile taken
|
|
12
|
+
* across a block contains the blocking frames. Verified under Bun 1.3.13: a
|
|
13
|
+
* deliberate 400ms synchronous block yielded 54 samples.
|
|
14
|
+
*
|
|
15
|
+
* Rolling segments keep the retained profile small without losing the block:
|
|
16
|
+
* rotation is loop-driven, so it CANNOT run during a block — whichever segment
|
|
17
|
+
* is in flight when the loop freezes stays in flight for the whole freeze, and
|
|
18
|
+
* is still open when the monitor detects the block right after. So `capture()`
|
|
19
|
+
* always writes a profile containing the entire block, however long it ran.
|
|
20
|
+
*
|
|
21
|
+
* Off by default (`MUONROI_LOOP_PROFILE=1` to arm) — continuous profiling has a
|
|
22
|
+
* real, if small, cost and this is a diagnostic, not a feature.
|
|
23
|
+
*/
|
|
24
|
+
import fs from "node:fs";
|
|
25
|
+
import os from "node:os";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import { logger } from "./logger.js";
|
|
28
|
+
/** Frames V8 synthesises; naming one as the culprit tells nobody anything. */
|
|
29
|
+
const SYNTHETIC_FRAMES = new Set(["(root)", "(program)", "(idle)", "(garbage collector)", "(anonymous)", ""]);
|
|
30
|
+
/**
|
|
31
|
+
* Reduce a CPU profile to the single hottest stack, leaf-first.
|
|
32
|
+
*
|
|
33
|
+
* Why not just the top frame: samples land on the LEAF, which for a blocking
|
|
34
|
+
* loop is whatever primitive it calls (`Date.now`, a regex step, a syscall) —
|
|
35
|
+
* true but useless. Verified on a synthetic 3s block: the leaf was `now` with
|
|
36
|
+
* 188 samples while the actual culprit `theGuiltyFunction` had 4. The CALLERS
|
|
37
|
+
* are the answer, so we walk up from the hottest leaf and return the chain.
|
|
38
|
+
*
|
|
39
|
+
* This is what makes the profile readable from debug.log alone, without
|
|
40
|
+
* requiring anyone to open Chrome DevTools.
|
|
41
|
+
*
|
|
42
|
+
* Pure — unit-testable with a hand-built profile.
|
|
43
|
+
*
|
|
44
|
+
* @param maxFrames how many frames of the chain to return, leaf-first
|
|
45
|
+
* @returns frames like `theGuiltyFunction (file.ts:12)`, or [] if unusable
|
|
46
|
+
*/
|
|
47
|
+
export function summarizeHotStack(profile, maxFrames = 8) {
|
|
48
|
+
const samples = profile?.samples;
|
|
49
|
+
const nodes = profile?.nodes;
|
|
50
|
+
if (!Array.isArray(samples) || !Array.isArray(nodes) || samples.length === 0)
|
|
51
|
+
return [];
|
|
52
|
+
const byId = new Map();
|
|
53
|
+
const parentOf = new Map();
|
|
54
|
+
for (const n of nodes) {
|
|
55
|
+
byId.set(n.id, n);
|
|
56
|
+
for (const c of n.children ?? [])
|
|
57
|
+
parentOf.set(c, n.id);
|
|
58
|
+
}
|
|
59
|
+
const selfCounts = new Map();
|
|
60
|
+
for (const s of samples)
|
|
61
|
+
selfCounts.set(s, (selfCounts.get(s) ?? 0) + 1);
|
|
62
|
+
let hottest = -1;
|
|
63
|
+
let best = -1;
|
|
64
|
+
for (const [id, count] of selfCounts) {
|
|
65
|
+
if (count > best) {
|
|
66
|
+
best = count;
|
|
67
|
+
hottest = id;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (hottest < 0)
|
|
71
|
+
return [];
|
|
72
|
+
const frames = [];
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
let cur = hottest;
|
|
75
|
+
while (cur !== undefined && !seen.has(cur) && frames.length < maxFrames) {
|
|
76
|
+
seen.add(cur);
|
|
77
|
+
const node = byId.get(cur);
|
|
78
|
+
if (!node)
|
|
79
|
+
break;
|
|
80
|
+
const name = node.callFrame?.functionName ?? "";
|
|
81
|
+
if (!SYNTHETIC_FRAMES.has(name)) {
|
|
82
|
+
const url = node.callFrame?.url ?? "";
|
|
83
|
+
const short = url ? `${url.split(/[\\/]/).pop()}:${(node.callFrame?.lineNumber ?? 0) + 1}` : "native";
|
|
84
|
+
frames.push(`${name} (${short})`);
|
|
85
|
+
}
|
|
86
|
+
cur = parentOf.get(cur);
|
|
87
|
+
}
|
|
88
|
+
return frames;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create and arm a rolling CPU profiler.
|
|
92
|
+
*
|
|
93
|
+
* Returns null when the inspector is unavailable (some runtimes/builds) — the
|
|
94
|
+
* caller keeps the block detector, just without stacks. Never throws.
|
|
95
|
+
*/
|
|
96
|
+
export async function createLoopProfiler(opts = {}) {
|
|
97
|
+
const samplingIntervalUs = opts.samplingIntervalUs ?? 10_000;
|
|
98
|
+
const dir = opts.dir ?? path.join(os.homedir(), ".muonroi-cli", "profiles");
|
|
99
|
+
let session;
|
|
100
|
+
try {
|
|
101
|
+
const inspector = await import("node:inspector");
|
|
102
|
+
session = new inspector.Session();
|
|
103
|
+
session.connect();
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
logger.warn("cli", `[loop-profiler] inspector unavailable — block reports will have no stacks: ${err?.message}`, { error: err });
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
/** Promise-free post: the profiler is driven from timer callbacks. */
|
|
110
|
+
const post = (method, params) => {
|
|
111
|
+
try {
|
|
112
|
+
session.post(method, params, (err) => {
|
|
113
|
+
if (err) {
|
|
114
|
+
logger.warn("cli", `[loop-profiler] ${method} failed: ${err.message}`, { error: err });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
logger.warn("cli", `[loop-profiler] ${method} threw: ${err?.message}`, { error: err });
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
let disposed = false;
|
|
123
|
+
const start = () => {
|
|
124
|
+
post("Profiler.setSamplingInterval", { interval: samplingIntervalUs });
|
|
125
|
+
post("Profiler.start");
|
|
126
|
+
};
|
|
127
|
+
try {
|
|
128
|
+
post("Profiler.enable");
|
|
129
|
+
start();
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
logger.warn("cli", `[loop-profiler] failed to arm: ${err?.message}`, { error: err });
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Stop the current segment and resolve with its profile (null on failure).
|
|
137
|
+
* Restarts a fresh segment unless disposing.
|
|
138
|
+
*/
|
|
139
|
+
const stopSegment = (restart) => new Promise((resolve) => {
|
|
140
|
+
try {
|
|
141
|
+
session.post("Profiler.stop", (err, res) => {
|
|
142
|
+
if (err) {
|
|
143
|
+
logger.warn("cli", `[loop-profiler] Profiler.stop failed: ${err.message}`, { error: err });
|
|
144
|
+
resolve(null);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
resolve(res?.profile ?? null);
|
|
148
|
+
}
|
|
149
|
+
if (restart && !disposed)
|
|
150
|
+
start();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
logger.warn("cli", `[loop-profiler] Profiler.stop threw: ${err?.message}`, { error: err });
|
|
155
|
+
resolve(null);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
rotate() {
|
|
160
|
+
if (disposed)
|
|
161
|
+
return;
|
|
162
|
+
// Drop the segment on the floor — it contained no block worth keeping.
|
|
163
|
+
void stopSegment(true);
|
|
164
|
+
},
|
|
165
|
+
async capture(reason) {
|
|
166
|
+
if (disposed)
|
|
167
|
+
return null;
|
|
168
|
+
const profile = await stopSegment(true);
|
|
169
|
+
if (!profile)
|
|
170
|
+
return null;
|
|
171
|
+
try {
|
|
172
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
173
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
174
|
+
const safeReason = reason.replace(/[^a-z0-9_-]/gi, "_").slice(0, 40);
|
|
175
|
+
const file = path.join(dir, `loop-block-${stamp}-${safeReason}.cpuprofile`);
|
|
176
|
+
fs.writeFileSync(file, JSON.stringify(profile), "utf8");
|
|
177
|
+
return { file, hotStack: summarizeHotStack(profile) };
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
logger.error("cli", `[loop-profiler] failed to write profile: ${err?.message}`, {
|
|
181
|
+
error: err,
|
|
182
|
+
dir,
|
|
183
|
+
});
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
dispose() {
|
|
188
|
+
if (disposed)
|
|
189
|
+
return;
|
|
190
|
+
disposed = true;
|
|
191
|
+
void stopSegment(false);
|
|
192
|
+
try {
|
|
193
|
+
post("Profiler.disable");
|
|
194
|
+
session.disconnect();
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
logger.warn("cli", `[loop-profiler] disconnect failed: ${err?.message}`, { error: err });
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=loop-profiler.js.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* safe - Every tool call prompts the user for approval.
|
|
5
5
|
* auto-edit - File operation tools (read/write/edit/grep/list) auto-approve;
|
|
6
|
-
* shell execution
|
|
6
|
+
* shell execution auto-approves for non-dangerous commands;
|
|
7
|
+
* computer tools still require confirmation.
|
|
7
8
|
* yolo - All tool calls auto-approve without any prompting.
|
|
8
9
|
*/
|
|
9
10
|
import { appendDecisionLog } from "../usage/decision-log.js";
|
|
@@ -217,8 +218,9 @@ export function toolNeedsApproval(toolName, mode, context) {
|
|
|
217
218
|
return false;
|
|
218
219
|
}
|
|
219
220
|
if (mode === "auto-edit") {
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
// bash auto-approves when non-dangerous; only dangerous bash needs approval
|
|
222
|
+
if (toolName === "bash")
|
|
223
|
+
return dangerous(context?.command);
|
|
222
224
|
return !AUTO_EDIT_ALLOWED.has(toolName);
|
|
223
225
|
}
|
|
224
226
|
// "safe" — always confirm; dangerous patterns explicitly require (no bypass)
|
|
@@ -34,7 +34,7 @@ const STATIC_PATTERNS = [
|
|
|
34
34
|
},
|
|
35
35
|
// Environment variable assignments for common API keys
|
|
36
36
|
{
|
|
37
|
-
pattern: /(ANTHROPIC_API_KEY|OPENAI_API_KEY|
|
|
37
|
+
pattern: /(ANTHROPIC_API_KEY|OPENAI_API_KEY|DEEPSEEK_API_KEY)\s*=\s*\S+/g,
|
|
38
38
|
replacement: "$1=***REDACTED***",
|
|
39
39
|
},
|
|
40
40
|
// Authorization Bearer header
|
|
@@ -4,6 +4,17 @@ import type { ProviderId } from "../providers/types.js";
|
|
|
4
4
|
import type { AgentMode, ReasoningEffort } from "../types/index.js";
|
|
5
5
|
import { type ShellSettings } from "./shell.js";
|
|
6
6
|
export type ModelRole = "leader" | "implement" | "verify" | "research";
|
|
7
|
+
export type PeakHourMode = "downgrade" | "switch";
|
|
8
|
+
export interface PeakHourPolicy {
|
|
9
|
+
/** Default true — peak-hour routing active. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* downgrade: same-provider only (per catalog provider_policies.peak_hour).
|
|
13
|
+
* switch: try catalog switch_fallback_providers first.
|
|
14
|
+
* Default: switch.
|
|
15
|
+
*/
|
|
16
|
+
mode?: PeakHourMode;
|
|
17
|
+
}
|
|
7
18
|
export declare function getCatalogDefaultModel(): string;
|
|
8
19
|
export type TelegramStreamingMode = "off" | "partial";
|
|
9
20
|
export type CouncilExperienceMode = "off" | "advisory" | "enforcing";
|
|
@@ -67,6 +78,12 @@ export interface ProviderKeyConfig {
|
|
|
67
78
|
}
|
|
68
79
|
export interface UserSettings {
|
|
69
80
|
apiKey?: string;
|
|
81
|
+
/**
|
|
82
|
+
* One-time guard: true once legacy keychain/settings API keys have been
|
|
83
|
+
* migrated into the env-store (`~/.muonroi-cli/.env`). See
|
|
84
|
+
* `migrateLegacyKeysToEnv` in src/providers/keychain.ts.
|
|
85
|
+
*/
|
|
86
|
+
keysMigratedToEnv?: boolean;
|
|
70
87
|
defaultModel?: string;
|
|
71
88
|
/**
|
|
72
89
|
* Preferred provider. When set, the splash/config UI hides the model
|
|
@@ -101,6 +118,9 @@ export interface UserSettings {
|
|
|
101
118
|
autoCompactAfterTurn?: boolean;
|
|
102
119
|
/** Minimum % of context window to trigger post-turn auto-compact (default 0.25 = 25%, range 0.05-0.50). */
|
|
103
120
|
autoCompactThresholdPct?: number;
|
|
121
|
+
/** Minimum new tokens accumulated since the last compaction before another
|
|
122
|
+
* post-turn compaction may fire. Prevents cache-reset thrash. Default 20000. */
|
|
123
|
+
autoCompactMinNewTokens?: number;
|
|
104
124
|
roleModels?: Partial<Record<ModelRole, string>>;
|
|
105
125
|
councilRounds?: number;
|
|
106
126
|
autoCouncil?: boolean;
|
|
@@ -118,6 +138,26 @@ export interface UserSettings {
|
|
|
118
138
|
* preserving legacy behavior).
|
|
119
139
|
*/
|
|
120
140
|
autoCouncilMinRoles?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Whether an auto-triggered council/debate runs the pre-debate clarification
|
|
143
|
+
* interview (model-designed askcards) before debating, instead of jumping
|
|
144
|
+
* straight into the debate on the bare prompt. Default true — a broad request
|
|
145
|
+
* like "dùng debate mode thảo luận lên plan" is exactly the kind of ambiguous
|
|
146
|
+
* scope the interview is meant to chốt first (prevents the debate drifting /
|
|
147
|
+
* "lan man"). The clarifier is ROI-gated and returns 0 cards on already-detailed
|
|
148
|
+
* topics, so enabling it is safe. Set false (or env MUONROI_AUTOCOUNCIL_CLARIFY=0)
|
|
149
|
+
* to restore the old skip-clarification behaviour.
|
|
150
|
+
*/
|
|
151
|
+
autoCouncilClarify?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* When true (default), auto-council is skipped if the current session model is
|
|
154
|
+
* a reasoning model (catalog `reasoning: true`). Reasoning models already
|
|
155
|
+
* perform an internal self-debate via extended thinking, so running an
|
|
156
|
+
* explicit multi-role council on the same prompt is usually low-ROI and
|
|
157
|
+
* expensive. Set false (or env MUONROI_AUTOCOUNCIL_SKIP_REASONING=0) to force
|
|
158
|
+
* council even for reasoning models.
|
|
159
|
+
*/
|
|
160
|
+
autoCouncilSkipReasoning?: boolean;
|
|
121
161
|
councilPreferMultiProvider?: boolean;
|
|
122
162
|
/** EE involvement level in council debates. Default: advisory. CQ-19. */
|
|
123
163
|
councilExperienceMode?: CouncilExperienceMode;
|
|
@@ -132,6 +172,20 @@ export interface UserSettings {
|
|
|
132
172
|
* decide structure and quality, not throughput.
|
|
133
173
|
*/
|
|
134
174
|
councilCostAware?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Language the council debate is conducted in (Feature B). The chosen language
|
|
177
|
+
* IS the debate language — no separate translate-back pass, so no extra LLM
|
|
178
|
+
* rounds. Values:
|
|
179
|
+
* - "auto" (default) — debate + conclusion follow the language of the user's
|
|
180
|
+
* prompt/brief (they type Vietnamese → the debate runs in Vietnamese).
|
|
181
|
+
* - "english" — force the historical English-only debate (citation tags,
|
|
182
|
+
* JSON, cross-turn citations stay maximally machine-stable).
|
|
183
|
+
* - any other free-text locale label (e.g. "vietnamese", "日本語") — pin the
|
|
184
|
+
* debate to that language regardless of the prompt's language.
|
|
185
|
+
* Citation tags, JSON keys, the `type` field, code identifiers, and STACK LOCK
|
|
186
|
+
* technology names always stay verbatim English regardless of this setting.
|
|
187
|
+
*/
|
|
188
|
+
councilLanguage?: string;
|
|
135
189
|
/** Set true after the user has been prompted (or skipped) the web-research onboarding. */
|
|
136
190
|
webResearchPrompted?: boolean;
|
|
137
191
|
/** Set true after the user has been prompted (or skipped) the first-run Experience Engine setup. */
|
|
@@ -151,13 +205,13 @@ export interface UserSettings {
|
|
|
151
205
|
providers?: {
|
|
152
206
|
anthropic?: ProviderKeyConfig;
|
|
153
207
|
openai?: ProviderKeyConfig;
|
|
154
|
-
google?: ProviderKeyConfig;
|
|
155
208
|
deepseek?: ProviderKeyConfig;
|
|
156
|
-
siliconflow?: ProviderKeyConfig;
|
|
157
209
|
xai?: ProviderKeyConfig;
|
|
158
210
|
ollama?: {
|
|
159
211
|
baseURL?: string;
|
|
160
212
|
};
|
|
213
|
+
zai?: ProviderKeyConfig;
|
|
214
|
+
"opencode-go"?: ProviderKeyConfig;
|
|
161
215
|
};
|
|
162
216
|
/** Providers the user has explicitly disabled in the model picker (still configured but hidden). */
|
|
163
217
|
disabledProviders?: ProviderId[];
|
|
@@ -187,6 +241,11 @@ export interface UserSettings {
|
|
|
187
241
|
/** Switch back to premium for final synthesis. Default: false. */
|
|
188
242
|
premiumSynthesis?: boolean;
|
|
189
243
|
};
|
|
244
|
+
/**
|
|
245
|
+
* Peak-hour routing for Z.ai (14:00–18:00 UTC+8 per docs) and DeepSeek
|
|
246
|
+
* (pro→flash downgrade in the same window to ease concurrency pressure).
|
|
247
|
+
*/
|
|
248
|
+
peakHourPolicy?: PeakHourPolicy;
|
|
190
249
|
/**
|
|
191
250
|
* Reporter auto-fire settings (B2).
|
|
192
251
|
* Controls whether the reporter posts to Discord automatically on sprint
|
|
@@ -216,6 +275,27 @@ export interface UserSettings {
|
|
|
216
275
|
* Default 400_000 (~100k tokens).
|
|
217
276
|
*/
|
|
218
277
|
topLevelToolBudgetChars?: number;
|
|
278
|
+
/**
|
|
279
|
+
* Router tier-promotion cap. The session's default model is treated as the
|
|
280
|
+
* user's cost ceiling: the EE router may DOWNGRADE per turn (cheaper model)
|
|
281
|
+
* but may not promote to a HIGHER tier than this setting allows without an
|
|
282
|
+
* explicit opt-in.
|
|
283
|
+
*
|
|
284
|
+
* - `"off"`: never promote beyond the default model's own tier.
|
|
285
|
+
* - `"balanced"` (default): allow promotion up to balanced, never premium.
|
|
286
|
+
* Routine tasks the EE brain over-classifies as premium get clamped to
|
|
287
|
+
* balanced (or to the default model when the provider has no balanced
|
|
288
|
+
* option — e.g. DeepSeek native only has fast + premium).
|
|
289
|
+
* - `"any"`: restore legacy behavior (router may promote to any tier).
|
|
290
|
+
*
|
|
291
|
+
* Evidence: session 89b34ce9a4e8 — default deepseek-v4-flash (fast tier),
|
|
292
|
+
* stored session.model=flash, but EE warm path returned premium for a
|
|
293
|
+
* routine "check và commit files" task → 47/47 turns silently ran on
|
|
294
|
+
* deepseek-v4-pro ($0.353) instead of flash (~$0.06). The per-turn routing
|
|
295
|
+
* override never flowed through setModel so the sessions row stayed flash
|
|
296
|
+
* ("session.model lie"). Default cap="balanced" prevents that silent leak.
|
|
297
|
+
*/
|
|
298
|
+
routingPromoteMax?: "off" | "balanced" | "any";
|
|
219
299
|
}
|
|
220
300
|
export interface ProjectSettings {
|
|
221
301
|
model?: string;
|
|
@@ -279,6 +359,7 @@ export declare function loadPaymentSettings(): Required<PaymentSettings>;
|
|
|
279
359
|
export declare function savePaymentSettings(partial: PaymentSettings): void;
|
|
280
360
|
export declare function isAutoCompactAfterTurnEnabled(): boolean;
|
|
281
361
|
export declare function getAutoCompactThresholdPct(): number;
|
|
362
|
+
export declare function getAutoCompactMinNewTokens(): number;
|
|
282
363
|
/**
|
|
283
364
|
* Per-invocation cap on cumulative tool-output chars inside a `task`
|
|
284
365
|
* sub-agent. See orchestrator/sub-agent-cap.ts for the tiered compression
|
|
@@ -294,6 +375,42 @@ export declare function getSubAgentBudgetChars(): number;
|
|
|
294
375
|
* Default 120_000 (2 min). Env override: MUONROI_PROVIDER_STALL_TIMEOUT_MS.
|
|
295
376
|
*/
|
|
296
377
|
export declare function getProviderStallTimeoutMs(): number;
|
|
378
|
+
/**
|
|
379
|
+
* No-forward-progress watchdog timeout (ms) for streaming model calls. Distinct
|
|
380
|
+
* from the stall watchdog: the stall watchdog re-arms on ANY stream chunk —
|
|
381
|
+
* including a reasoning model's `reasoning-delta` chunks — so a model stuck in an
|
|
382
|
+
* endless chain-of-thought keeps petting it and it NEVER fires (observed live
|
|
383
|
+
* 2026-07-10: a deepseek-v4-flash sub-agent churned reasoning for 30+ min, 1.4M
|
|
384
|
+
* input tokens, ZERO text/tool output, and the 2-min stall watchdog never tripped
|
|
385
|
+
* because reasoning chunks kept arriving). This second watchdog is petted ONLY on
|
|
386
|
+
* REAL forward progress (a text-delta or a tool-call), so a runaway-reasoning /
|
|
387
|
+
* no-output loop is aborted while a legitimately long reasoning burst that DOES
|
|
388
|
+
* eventually emit text/tools survives. Set generously above a normal reasoning
|
|
389
|
+
* burst. Range 30_000–1_800_000; 0 disables. Default 300_000 (5 min). Env
|
|
390
|
+
* override: MUONROI_PROVIDER_PROGRESS_TIMEOUT_MS.
|
|
391
|
+
*/
|
|
392
|
+
export declare function getProviderProgressTimeoutMs(): number;
|
|
393
|
+
/**
|
|
394
|
+
* Event-loop block reporting threshold (ms). The monitor
|
|
395
|
+
* (`src/utils/event-loop-monitor.ts`) reports a block when its own tick runs at
|
|
396
|
+
* least this late — evidence that the JS thread was stuck and NO timer could
|
|
397
|
+
* fire, which is why the provider stall watchdogs above cannot see this class
|
|
398
|
+
* of freeze (measured live 2026-07-16: a 304.5s TUI freeze that the 120s stall
|
|
399
|
+
* watchdog only rescued 6.7s AFTER the loop recovered).
|
|
400
|
+
*
|
|
401
|
+
* 2s is well clear of ordinary GC pauses and heavy renders while still catching
|
|
402
|
+
* anything a user would call a freeze. Range 250–60_000; 0 disables.
|
|
403
|
+
* Default 2_000. Env override: MUONROI_LOOP_BLOCK_THRESHOLD_MS.
|
|
404
|
+
*/
|
|
405
|
+
export declare function getLoopBlockThresholdMs(): number;
|
|
406
|
+
/**
|
|
407
|
+
* Whether to run the rolling CPU profiler (`src/utils/loop-profiler.ts`) so a
|
|
408
|
+
* reported event-loop block comes with the culprit's stack rather than just a
|
|
409
|
+
* duration. OFF by default: continuous V8 sampling costs a little on every
|
|
410
|
+
* session, and this is a diagnostic for a sporadic bug, not a feature. Arm it
|
|
411
|
+
* when hunting a freeze. Env: MUONROI_LOOP_PROFILE=1 (0/unset disables).
|
|
412
|
+
*/
|
|
413
|
+
export declare function isLoopProfileEnabled(): boolean;
|
|
297
414
|
/**
|
|
298
415
|
* Number of times to AUTOMATICALLY re-issue a streaming model call after the
|
|
299
416
|
* stall watchdog fires WITHOUT any chunk having arrived (a time-to-first-byte
|
|
@@ -337,21 +454,48 @@ export declare function getSubAgentCompactKeepLast(): number;
|
|
|
337
454
|
* top-level loops typically carry more useful early context.
|
|
338
455
|
* Env override: MUONROI_TOP_LEVEL_COMPACT_THRESHOLD_CHARS.
|
|
339
456
|
*/
|
|
340
|
-
export declare function getTopLevelCompactThresholdChars(): number;
|
|
457
|
+
export declare function getTopLevelCompactThresholdChars(contextWindowTokens?: number): number;
|
|
458
|
+
/**
|
|
459
|
+
* Compaction hysteresis factor for the top-level loop. Once B4 compaction has
|
|
460
|
+
* fired within a turn, the compacted prefix is FROZEN and only new messages are
|
|
461
|
+
* appended (keeping the provider prompt-cache prefix byte-stable) until the
|
|
462
|
+
* cumulative size grows past `lastTriggerChars * factor` — then it re-compacts.
|
|
463
|
+
*
|
|
464
|
+
* Why: measured on session 1afb2728e67a — a 24-step turn re-ran compaction every
|
|
465
|
+
* step, and each step's sliding keepLast boundary flipped one more tool result
|
|
466
|
+
* verbatim→stub, breaking the cache prefix at that position. 63% of that
|
|
467
|
+
* session's FRESH input came from 5 such compaction-induced cache breaks.
|
|
468
|
+
* Holding the boundary between compactions trades a higher peak input for far
|
|
469
|
+
* fewer cache-break re-bills.
|
|
470
|
+
*
|
|
471
|
+
* Range 1.0–3.0. Default 1.15 (re-compact at +15% growth). `1.0` or env `0`
|
|
472
|
+
* disables hysteresis → legacy per-step compaction.
|
|
473
|
+
* Env override: MUONROI_COMPACT_HYSTERESIS.
|
|
474
|
+
*/
|
|
475
|
+
export declare function getTopLevelCompactHysteresis(): number;
|
|
341
476
|
/**
|
|
342
477
|
* Phase B4 — number of trailing tool turns kept verbatim during top-level
|
|
343
478
|
* compaction. Higher than sub-agent default because top-level agents make
|
|
344
479
|
* decisions across longer horizons.
|
|
345
480
|
* Env override: MUONROI_TOP_LEVEL_COMPACT_KEEP_LAST.
|
|
346
481
|
*/
|
|
347
|
-
export declare function getTopLevelCompactKeepLast(): number;
|
|
482
|
+
export declare function getTopLevelCompactKeepLast(contextWindowTokens?: number): number;
|
|
483
|
+
/**
|
|
484
|
+
* O2 — byte budget for the verbatim tail (last keepLast turns) in top-level B4
|
|
485
|
+
* compaction. The keepLast shrink is otherwise fill-ratio based, so on a
|
|
486
|
+
* large-context model a read-heavy tail stays verbatim at ~50% fill, pinning
|
|
487
|
+
* each tool round at 60-80K input (measured on July-8 sessions). This caps the
|
|
488
|
+
* tail's actual chars, shrinking keepLast further (floor 2) when the kept tool
|
|
489
|
+
* results are large. 0 disables. Env: MUONROI_TOP_LEVEL_COMPACT_TAIL_BUDGET_CHARS.
|
|
490
|
+
*/
|
|
491
|
+
export declare function getTopLevelCompactTailBudgetChars(contextWindowTokens?: number): number;
|
|
348
492
|
/**
|
|
349
493
|
* Per-turn cap on cumulative tool-output chars inside the top-level
|
|
350
494
|
* orchestrator agentic loop. Same tiered compression as the sub-agent cap,
|
|
351
495
|
* higher default so single-tool turns are unaffected. Env override:
|
|
352
496
|
* MUONROI_TOP_LEVEL_TOOL_BUDGET_CHARS.
|
|
353
497
|
*/
|
|
354
|
-
export declare function getTopLevelToolBudgetChars(maxRounds?: number): number;
|
|
498
|
+
export declare function getTopLevelToolBudgetChars(maxRounds?: number, contextWindowTokens?: number): number;
|
|
355
499
|
export declare function getRoleModel(role: ModelRole): string | undefined;
|
|
356
500
|
export declare function getRoleModels(): Partial<Record<ModelRole, string>>;
|
|
357
501
|
export declare function getCouncilRounds(): number;
|
|
@@ -361,10 +505,41 @@ export declare function normalizeAutoCouncilConfidence(val: unknown): number;
|
|
|
361
505
|
/** Pure validator extracted for testability; clamps user input to a sane range. */
|
|
362
506
|
export declare function normalizeAutoCouncilMinRoles(val: unknown): number;
|
|
363
507
|
export declare function getAutoCouncilConfidence(): number;
|
|
508
|
+
/**
|
|
509
|
+
* Whether the auto-council path runs the pre-debate clarification interview
|
|
510
|
+
* (model-designed askcards) before debating. Default true so a broadly-scoped
|
|
511
|
+
* "debate mode" request is clarified first. Env override wins over the user
|
|
512
|
+
* setting for quick dev toggling; env "0"/"false" disables, "1"/"true" enables.
|
|
513
|
+
*/
|
|
514
|
+
export declare function isAutoCouncilClarifyEnabled(): boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Whether auto-council should be skipped when the session model is a reasoning
|
|
517
|
+
* model. Default true. Env override wins over the user setting for quick dev
|
|
518
|
+
* toggling; env "0"/"false" disables the skip (forces council), "1"/"true"
|
|
519
|
+
* enables the skip.
|
|
520
|
+
*/
|
|
521
|
+
export declare function isAutoCouncilSkipReasoning(): boolean;
|
|
364
522
|
export declare function getAutoCouncilMinRoles(): number;
|
|
365
523
|
export declare function isCouncilMultiProviderPreferred(): boolean;
|
|
366
524
|
export declare function getCouncilExperienceMode(): CouncilExperienceMode;
|
|
525
|
+
export declare function normalizePeakHourPolicy(raw: unknown): PeakHourPolicy;
|
|
526
|
+
export declare function getPeakHourPolicy(): PeakHourPolicy;
|
|
367
527
|
export declare function isCouncilCostAware(): boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Normalize a raw councilLanguage value (Feature B). Trims + lowercases the two
|
|
530
|
+
* reserved modes ("auto", "english"); any other non-empty string is preserved
|
|
531
|
+
* as-is (trimmed) so locale labels keep the user's exact casing (e.g. "日本語").
|
|
532
|
+
* Empty / non-string → "auto".
|
|
533
|
+
*/
|
|
534
|
+
export declare function normalizeCouncilLanguage(raw: unknown): string;
|
|
535
|
+
export declare function getCouncilLanguage(): string;
|
|
536
|
+
/**
|
|
537
|
+
* Router tier-promotion ceiling. See UserSettings.routingPromoteMax.
|
|
538
|
+
* Default "balanced" — router may promote up to balanced but never silently
|
|
539
|
+
* to premium. Validated to the three allowed values; any unknown value
|
|
540
|
+
* falls back to the default.
|
|
541
|
+
*/
|
|
542
|
+
export declare function getRoutingPromoteMax(): "off" | "balanced" | "any";
|
|
368
543
|
export declare function getDisabledProviders(): ProviderId[];
|
|
369
544
|
export declare function isProviderDisabled(provider: ProviderId): boolean;
|
|
370
545
|
export declare function setProviderDisabled(provider: ProviderId, disabled: boolean): ProviderId[];
|