muonroi-cli 1.2.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 +21 -0
- package/README.md +380 -0
- package/dist/__test-stubs__/ee-server.d.ts +27 -0
- package/dist/__test-stubs__/ee-server.js +138 -0
- package/dist/__test-stubs__/ee-server.js.map +1 -0
- package/dist/billing/index.d.ts +5 -0
- package/dist/billing/index.js +2 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/cloud/index.d.ts +5 -0
- package/dist/cloud/index.js +2 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/daemon/scheduler.d.ts +15 -0
- package/dist/daemon/scheduler.js +126 -0
- package/dist/daemon/scheduler.js.map +1 -0
- package/dist/daemon/scheduler.test.d.ts +1 -0
- package/dist/daemon/scheduler.test.js +103 -0
- package/dist/daemon/scheduler.test.js.map +1 -0
- package/dist/ee/__tests__/pipeline.integration.test.d.ts +14 -0
- package/dist/ee/__tests__/pipeline.integration.test.js +151 -0
- package/dist/ee/__tests__/pipeline.integration.test.js.map +1 -0
- package/dist/ee/auth.d.ts +19 -0
- package/dist/ee/auth.js +48 -0
- package/dist/ee/auth.js.map +1 -0
- package/dist/ee/auth.test.d.ts +1 -0
- package/dist/ee/auth.test.js +59 -0
- package/dist/ee/auth.test.js.map +1 -0
- package/dist/ee/bridge.d.ts +68 -0
- package/dist/ee/bridge.js +177 -0
- package/dist/ee/bridge.js.map +1 -0
- package/dist/ee/bridge.test.d.ts +1 -0
- package/dist/ee/bridge.test.js +231 -0
- package/dist/ee/bridge.test.js.map +1 -0
- package/dist/ee/client.d.ts +22 -0
- package/dist/ee/client.js +464 -0
- package/dist/ee/client.js.map +1 -0
- package/dist/ee/client.test.d.ts +1 -0
- package/dist/ee/client.test.js +151 -0
- package/dist/ee/client.test.js.map +1 -0
- package/dist/ee/embedding-cache.d.ts +7 -0
- package/dist/ee/embedding-cache.js +33 -0
- package/dist/ee/embedding-cache.js.map +1 -0
- package/dist/ee/extract-session.d.ts +17 -0
- package/dist/ee/extract-session.js +53 -0
- package/dist/ee/extract-session.js.map +1 -0
- package/dist/ee/extract-session.test.d.ts +1 -0
- package/dist/ee/extract-session.test.js +197 -0
- package/dist/ee/extract-session.test.js.map +1 -0
- package/dist/ee/health.d.ts +29 -0
- package/dist/ee/health.js +64 -0
- package/dist/ee/health.js.map +1 -0
- package/dist/ee/index.d.ts +10 -0
- package/dist/ee/index.js +9 -0
- package/dist/ee/index.js.map +1 -0
- package/dist/ee/intercept.d.ts +46 -0
- package/dist/ee/intercept.js +117 -0
- package/dist/ee/intercept.js.map +1 -0
- package/dist/ee/intercept.test.d.ts +1 -0
- package/dist/ee/intercept.test.js +170 -0
- package/dist/ee/intercept.test.js.map +1 -0
- package/dist/ee/judge.d.ts +36 -0
- package/dist/ee/judge.js +56 -0
- package/dist/ee/judge.js.map +1 -0
- package/dist/ee/judge.test.d.ts +1 -0
- package/dist/ee/judge.test.js +139 -0
- package/dist/ee/judge.test.js.map +1 -0
- package/dist/ee/offline-queue.d.ts +37 -0
- package/dist/ee/offline-queue.js +163 -0
- package/dist/ee/offline-queue.js.map +1 -0
- package/dist/ee/offline-queue.test.d.ts +1 -0
- package/dist/ee/offline-queue.test.js +246 -0
- package/dist/ee/offline-queue.test.js.map +1 -0
- package/dist/ee/posttool.d.ts +11 -0
- package/dist/ee/posttool.js +16 -0
- package/dist/ee/posttool.js.map +1 -0
- package/dist/ee/posttool.test.d.ts +1 -0
- package/dist/ee/posttool.test.js +70 -0
- package/dist/ee/posttool.test.js.map +1 -0
- package/dist/ee/prompt-stale.d.ts +20 -0
- package/dist/ee/prompt-stale.js +37 -0
- package/dist/ee/prompt-stale.js.map +1 -0
- package/dist/ee/prompt-stale.test.d.ts +8 -0
- package/dist/ee/prompt-stale.test.js +76 -0
- package/dist/ee/prompt-stale.test.js.map +1 -0
- package/dist/ee/render.d.ts +20 -0
- package/dist/ee/render.js +30 -0
- package/dist/ee/render.js.map +1 -0
- package/dist/ee/render.test.d.ts +1 -0
- package/dist/ee/render.test.js +61 -0
- package/dist/ee/render.test.js.map +1 -0
- package/dist/ee/scope.d.ts +6 -0
- package/dist/ee/scope.js +92 -0
- package/dist/ee/scope.js.map +1 -0
- package/dist/ee/scope.test.d.ts +1 -0
- package/dist/ee/scope.test.js +97 -0
- package/dist/ee/scope.test.js.map +1 -0
- package/dist/ee/tenant.d.ts +2 -0
- package/dist/ee/tenant.js +13 -0
- package/dist/ee/tenant.js.map +1 -0
- package/dist/ee/touch.test.d.ts +1 -0
- package/dist/ee/touch.test.js +60 -0
- package/dist/ee/touch.test.js.map +1 -0
- package/dist/ee/types.d.ts +300 -0
- package/dist/ee/types.js +14 -0
- package/dist/ee/types.js.map +1 -0
- package/dist/flow/__tests__/migration.test.d.ts +1 -0
- package/dist/flow/__tests__/migration.test.js +105 -0
- package/dist/flow/__tests__/migration.test.js.map +1 -0
- package/dist/flow/__tests__/parser.test.d.ts +1 -0
- package/dist/flow/__tests__/parser.test.js +68 -0
- package/dist/flow/__tests__/parser.test.js.map +1 -0
- package/dist/flow/__tests__/run-manager.test.d.ts +1 -0
- package/dist/flow/__tests__/run-manager.test.js +83 -0
- package/dist/flow/__tests__/run-manager.test.js.map +1 -0
- package/dist/flow/__tests__/scaffold.test.d.ts +1 -0
- package/dist/flow/__tests__/scaffold.test.js +47 -0
- package/dist/flow/__tests__/scaffold.test.js.map +1 -0
- package/dist/flow/__tests__/warning-persist.test.d.ts +5 -0
- package/dist/flow/__tests__/warning-persist.test.js +96 -0
- package/dist/flow/__tests__/warning-persist.test.js.map +1 -0
- package/dist/flow/artifact-io.d.ts +16 -0
- package/dist/flow/artifact-io.js +35 -0
- package/dist/flow/artifact-io.js.map +1 -0
- package/dist/flow/compaction/__tests__/compress.test.d.ts +1 -0
- package/dist/flow/compaction/__tests__/compress.test.js +63 -0
- package/dist/flow/compaction/__tests__/compress.test.js.map +1 -0
- package/dist/flow/compaction/__tests__/extract.test.d.ts +1 -0
- package/dist/flow/compaction/__tests__/extract.test.js +66 -0
- package/dist/flow/compaction/__tests__/extract.test.js.map +1 -0
- package/dist/flow/compaction/__tests__/preserve.test.d.ts +1 -0
- package/dist/flow/compaction/__tests__/preserve.test.js +62 -0
- package/dist/flow/compaction/__tests__/preserve.test.js.map +1 -0
- package/dist/flow/compaction/compress.d.ts +22 -0
- package/dist/flow/compaction/compress.js +47 -0
- package/dist/flow/compaction/compress.js.map +1 -0
- package/dist/flow/compaction/extract.d.ts +23 -0
- package/dist/flow/compaction/extract.js +46 -0
- package/dist/flow/compaction/extract.js.map +1 -0
- package/dist/flow/compaction/index.d.ts +23 -0
- package/dist/flow/compaction/index.js +63 -0
- package/dist/flow/compaction/index.js.map +1 -0
- package/dist/flow/compaction/preserve.d.ts +24 -0
- package/dist/flow/compaction/preserve.js +35 -0
- package/dist/flow/compaction/preserve.js.map +1 -0
- package/dist/flow/index.d.ts +12 -0
- package/dist/flow/index.js +16 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/flow/migration.d.ts +23 -0
- package/dist/flow/migration.js +126 -0
- package/dist/flow/migration.js.map +1 -0
- package/dist/flow/parser.d.ts +27 -0
- package/dist/flow/parser.js +68 -0
- package/dist/flow/parser.js.map +1 -0
- package/dist/flow/run-manager.d.ts +36 -0
- package/dist/flow/run-manager.js +110 -0
- package/dist/flow/run-manager.js.map +1 -0
- package/dist/flow/scaffold.d.ts +22 -0
- package/dist/flow/scaffold.js +47 -0
- package/dist/flow/scaffold.js.map +1 -0
- package/dist/flow/warning-persist.d.ts +9 -0
- package/dist/flow/warning-persist.js +75 -0
- package/dist/flow/warning-persist.js.map +1 -0
- package/dist/gsd/__tests__/types.test.d.ts +1 -0
- package/dist/gsd/__tests__/types.test.js +65 -0
- package/dist/gsd/__tests__/types.test.js.map +1 -0
- package/dist/gsd/index.d.ts +1 -0
- package/dist/gsd/index.js +2 -0
- package/dist/gsd/index.js.map +1 -0
- package/dist/gsd/types.d.ts +4 -0
- package/dist/gsd/types.js +39 -0
- package/dist/gsd/types.js.map +1 -0
- package/dist/headless/output.d.ts +68 -0
- package/dist/headless/output.js +206 -0
- package/dist/headless/output.js.map +1 -0
- package/dist/headless/output.test.d.ts +1 -0
- package/dist/headless/output.test.js +178 -0
- package/dist/headless/output.test.js.map +1 -0
- package/dist/hooks/config.d.ts +18 -0
- package/dist/hooks/config.js +39 -0
- package/dist/hooks/config.js.map +1 -0
- package/dist/hooks/index.d.ts +44 -0
- package/dist/hooks/index.js +187 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +130 -0
- package/dist/hooks/types.js +47 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +512 -0
- package/dist/index.js.map +1 -0
- package/dist/lsp/builtins.d.ts +9 -0
- package/dist/lsp/builtins.js +351 -0
- package/dist/lsp/builtins.js.map +1 -0
- package/dist/lsp/builtins.test.d.ts +1 -0
- package/dist/lsp/builtins.test.js +91 -0
- package/dist/lsp/builtins.test.js.map +1 -0
- package/dist/lsp/client.d.ts +20 -0
- package/dist/lsp/client.js +290 -0
- package/dist/lsp/client.js.map +1 -0
- package/dist/lsp/manager.d.ts +20 -0
- package/dist/lsp/manager.js +235 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/manager.test.d.ts +1 -0
- package/dist/lsp/manager.test.js +133 -0
- package/dist/lsp/manager.test.js.map +1 -0
- package/dist/lsp/npm-cache.d.ts +2 -0
- package/dist/lsp/npm-cache.js +105 -0
- package/dist/lsp/npm-cache.js.map +1 -0
- package/dist/lsp/npm-cache.test.d.ts +1 -0
- package/dist/lsp/npm-cache.test.js +53 -0
- package/dist/lsp/npm-cache.test.js.map +1 -0
- package/dist/lsp/runtime.d.ts +6 -0
- package/dist/lsp/runtime.js +53 -0
- package/dist/lsp/runtime.js.map +1 -0
- package/dist/lsp/smoke.test.d.ts +1 -0
- package/dist/lsp/smoke.test.js +56 -0
- package/dist/lsp/smoke.test.js.map +1 -0
- package/dist/lsp/types.d.ts +83 -0
- package/dist/lsp/types.js +12 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/mcp/auto-setup.d.ts +2 -0
- package/dist/mcp/auto-setup.js +76 -0
- package/dist/mcp/auto-setup.js.map +1 -0
- package/dist/mcp/catalog.d.ts +10 -0
- package/dist/mcp/catalog.js +121 -0
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/mcp/oauth-callback.d.ts +9 -0
- package/dist/mcp/oauth-callback.js +49 -0
- package/dist/mcp/oauth-callback.js.map +1 -0
- package/dist/mcp/oauth-provider.d.ts +33 -0
- package/dist/mcp/oauth-provider.js +94 -0
- package/dist/mcp/oauth-provider.js.map +1 -0
- package/dist/mcp/parse-headers.d.ts +2 -0
- package/dist/mcp/parse-headers.js +33 -0
- package/dist/mcp/parse-headers.js.map +1 -0
- package/dist/mcp/parse-headers.test.d.ts +1 -0
- package/dist/mcp/parse-headers.test.js +43 -0
- package/dist/mcp/parse-headers.test.js.map +1 -0
- package/dist/mcp/runtime.d.ts +11 -0
- package/dist/mcp/runtime.js +81 -0
- package/dist/mcp/runtime.js.map +1 -0
- package/dist/mcp/smoke.test.d.ts +1 -0
- package/dist/mcp/smoke.test.js +159 -0
- package/dist/mcp/smoke.test.js.map +1 -0
- package/dist/mcp/validate.d.ts +9 -0
- package/dist/mcp/validate.js +39 -0
- package/dist/mcp/validate.js.map +1 -0
- package/dist/models/__tests__/registry.test.d.ts +1 -0
- package/dist/models/__tests__/registry.test.js +74 -0
- package/dist/models/__tests__/registry.test.js.map +1 -0
- package/dist/models/catalog-client.d.ts +21 -0
- package/dist/models/catalog-client.js +53 -0
- package/dist/models/catalog-client.js.map +1 -0
- package/dist/models/classify-tier.d.ts +2 -0
- package/dist/models/classify-tier.js +34 -0
- package/dist/models/classify-tier.js.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/registry.d.ts +19 -0
- package/dist/models/registry.js +65 -0
- package/dist/models/registry.js.map +1 -0
- package/dist/ops/bug-report.d.ts +28 -0
- package/dist/ops/bug-report.js +67 -0
- package/dist/ops/bug-report.js.map +1 -0
- package/dist/ops/bug-report.test.d.ts +1 -0
- package/dist/ops/bug-report.test.js +148 -0
- package/dist/ops/bug-report.test.js.map +1 -0
- package/dist/ops/doctor.d.ts +16 -0
- package/dist/ops/doctor.js +162 -0
- package/dist/ops/doctor.js.map +1 -0
- package/dist/ops/doctor.test.d.ts +1 -0
- package/dist/ops/doctor.test.js +95 -0
- package/dist/ops/doctor.test.js.map +1 -0
- package/dist/orchestrator/__tests__/flow-resume.test.d.ts +5 -0
- package/dist/orchestrator/__tests__/flow-resume.test.js +61 -0
- package/dist/orchestrator/__tests__/flow-resume.test.js.map +1 -0
- package/dist/orchestrator/__tests__/route-feedback.test.d.ts +1 -0
- package/dist/orchestrator/__tests__/route-feedback.test.js +47 -0
- package/dist/orchestrator/__tests__/route-feedback.test.js.map +1 -0
- package/dist/orchestrator/abort.d.ts +29 -0
- package/dist/orchestrator/abort.js +31 -0
- package/dist/orchestrator/abort.js.map +1 -0
- package/dist/orchestrator/abort.test.d.ts +1 -0
- package/dist/orchestrator/abort.test.js +34 -0
- package/dist/orchestrator/abort.test.js.map +1 -0
- package/dist/orchestrator/agent.test.d.ts +1 -0
- package/dist/orchestrator/agent.test.js +126 -0
- package/dist/orchestrator/agent.test.js.map +1 -0
- package/dist/orchestrator/cleanup.test.d.ts +1 -0
- package/dist/orchestrator/cleanup.test.js +67 -0
- package/dist/orchestrator/cleanup.test.js.map +1 -0
- package/dist/orchestrator/compaction.d.ts +36 -0
- package/dist/orchestrator/compaction.js +375 -0
- package/dist/orchestrator/compaction.js.map +1 -0
- package/dist/orchestrator/compaction.test.d.ts +1 -0
- package/dist/orchestrator/compaction.test.js +105 -0
- package/dist/orchestrator/compaction.test.js.map +1 -0
- package/dist/orchestrator/delegations.d.ts +49 -0
- package/dist/orchestrator/delegations.js +283 -0
- package/dist/orchestrator/delegations.js.map +1 -0
- package/dist/orchestrator/delegations.test.d.ts +1 -0
- package/dist/orchestrator/delegations.test.js +107 -0
- package/dist/orchestrator/delegations.test.js.map +1 -0
- package/dist/orchestrator/flow-resume.d.ts +25 -0
- package/dist/orchestrator/flow-resume.js +53 -0
- package/dist/orchestrator/flow-resume.js.map +1 -0
- package/dist/orchestrator/orchestrator.d.ts +239 -0
- package/dist/orchestrator/orchestrator.js +3209 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/pending-calls.d.ts +75 -0
- package/dist/orchestrator/pending-calls.js +178 -0
- package/dist/orchestrator/pending-calls.js.map +1 -0
- package/dist/orchestrator/pending-calls.test.d.ts +1 -0
- package/dist/orchestrator/pending-calls.test.js +188 -0
- package/dist/orchestrator/pending-calls.test.js.map +1 -0
- package/dist/orchestrator/reasoning.d.ts +3 -0
- package/dist/orchestrator/reasoning.js +53 -0
- package/dist/orchestrator/reasoning.js.map +1 -0
- package/dist/orchestrator/reasoning.test.d.ts +1 -0
- package/dist/orchestrator/reasoning.test.js +26 -0
- package/dist/orchestrator/reasoning.test.js.map +1 -0
- package/dist/orchestrator/sandbox.test.d.ts +1 -0
- package/dist/orchestrator/sandbox.test.js +94 -0
- package/dist/orchestrator/sandbox.test.js.map +1 -0
- package/dist/pil/__tests__/budget.test.d.ts +1 -0
- package/dist/pil/__tests__/budget.test.js +33 -0
- package/dist/pil/__tests__/budget.test.js.map +1 -0
- package/dist/pil/__tests__/layer1-intent.test.d.ts +1 -0
- package/dist/pil/__tests__/layer1-intent.test.js +199 -0
- package/dist/pil/__tests__/layer1-intent.test.js.map +1 -0
- package/dist/pil/__tests__/layer2-personality.test.d.ts +1 -0
- package/dist/pil/__tests__/layer2-personality.test.js +57 -0
- package/dist/pil/__tests__/layer2-personality.test.js.map +1 -0
- package/dist/pil/__tests__/layer3-ee-injection.test.d.ts +1 -0
- package/dist/pil/__tests__/layer3-ee-injection.test.js +96 -0
- package/dist/pil/__tests__/layer3-ee-injection.test.js.map +1 -0
- package/dist/pil/__tests__/layer4-gsd.test.d.ts +1 -0
- package/dist/pil/__tests__/layer4-gsd.test.js +68 -0
- package/dist/pil/__tests__/layer4-gsd.test.js.map +1 -0
- package/dist/pil/__tests__/layer5-context.test.d.ts +1 -0
- package/dist/pil/__tests__/layer5-context.test.js +100 -0
- package/dist/pil/__tests__/layer5-context.test.js.map +1 -0
- package/dist/pil/__tests__/layer6-output.test.d.ts +1 -0
- package/dist/pil/__tests__/layer6-output.test.js +115 -0
- package/dist/pil/__tests__/layer6-output.test.js.map +1 -0
- package/dist/pil/__tests__/ollama-classify.test.d.ts +1 -0
- package/dist/pil/__tests__/ollama-classify.test.js +68 -0
- package/dist/pil/__tests__/ollama-classify.test.js.map +1 -0
- package/dist/pil/__tests__/orchestrator-integration.test.d.ts +10 -0
- package/dist/pil/__tests__/orchestrator-integration.test.js +98 -0
- package/dist/pil/__tests__/orchestrator-integration.test.js.map +1 -0
- package/dist/pil/__tests__/pipeline.test.d.ts +1 -0
- package/dist/pil/__tests__/pipeline.test.js +150 -0
- package/dist/pil/__tests__/pipeline.test.js.map +1 -0
- package/dist/pil/__tests__/response-tools.test.d.ts +1 -0
- package/dist/pil/__tests__/response-tools.test.js +133 -0
- package/dist/pil/__tests__/response-tools.test.js.map +1 -0
- package/dist/pil/__tests__/schema.test.d.ts +1 -0
- package/dist/pil/__tests__/schema.test.js +112 -0
- package/dist/pil/__tests__/schema.test.js.map +1 -0
- package/dist/pil/__tests__/store.test.d.ts +1 -0
- package/dist/pil/__tests__/store.test.js +44 -0
- package/dist/pil/__tests__/store.test.js.map +1 -0
- package/dist/pil/__tests__/task-tier-map.test.d.ts +1 -0
- package/dist/pil/__tests__/task-tier-map.test.js +33 -0
- package/dist/pil/__tests__/task-tier-map.test.js.map +1 -0
- package/dist/pil/budget.d.ts +8 -0
- package/dist/pil/budget.js +17 -0
- package/dist/pil/budget.js.map +1 -0
- package/dist/pil/index.d.ts +11 -0
- package/dist/pil/index.js +11 -0
- package/dist/pil/index.js.map +1 -0
- package/dist/pil/layer1-intent.d.ts +13 -0
- package/dist/pil/layer1-intent.js +142 -0
- package/dist/pil/layer1-intent.js.map +1 -0
- package/dist/pil/layer2-personality.d.ts +2 -0
- package/dist/pil/layer2-personality.js +29 -0
- package/dist/pil/layer2-personality.js.map +1 -0
- package/dist/pil/layer3-ee-injection.d.ts +10 -0
- package/dist/pil/layer3-ee-injection.js +72 -0
- package/dist/pil/layer3-ee-injection.js.map +1 -0
- package/dist/pil/layer4-gsd.d.ts +2 -0
- package/dist/pil/layer4-gsd.js +64 -0
- package/dist/pil/layer4-gsd.js.map +1 -0
- package/dist/pil/layer5-context.d.ts +2 -0
- package/dist/pil/layer5-context.js +124 -0
- package/dist/pil/layer5-context.js.map +1 -0
- package/dist/pil/layer6-output.d.ts +18 -0
- package/dist/pil/layer6-output.js +105 -0
- package/dist/pil/layer6-output.js.map +1 -0
- package/dist/pil/ollama-classify.d.ts +13 -0
- package/dist/pil/ollama-classify.js +38 -0
- package/dist/pil/ollama-classify.js.map +1 -0
- package/dist/pil/pipeline.d.ts +16 -0
- package/dist/pil/pipeline.js +96 -0
- package/dist/pil/pipeline.js.map +1 -0
- package/dist/pil/response-tools.d.ts +63 -0
- package/dist/pil/response-tools.js +87 -0
- package/dist/pil/response-tools.js.map +1 -0
- package/dist/pil/schema.d.ts +80 -0
- package/dist/pil/schema.js +43 -0
- package/dist/pil/schema.js.map +1 -0
- package/dist/pil/store.d.ts +12 -0
- package/dist/pil/store.js +21 -0
- package/dist/pil/store.js.map +1 -0
- package/dist/pil/task-tier-map.d.ts +30 -0
- package/dist/pil/task-tier-map.js +83 -0
- package/dist/pil/task-tier-map.js.map +1 -0
- package/dist/pil/timeout.d.ts +7 -0
- package/dist/pil/timeout.js +10 -0
- package/dist/pil/timeout.js.map +1 -0
- package/dist/pil/types.d.ts +39 -0
- package/dist/pil/types.js +7 -0
- package/dist/pil/types.js.map +1 -0
- package/dist/providers/__test-utils__/load-fixture.d.ts +9 -0
- package/dist/providers/__test-utils__/load-fixture.js +34 -0
- package/dist/providers/__test-utils__/load-fixture.js.map +1 -0
- package/dist/providers/__tests__/runtime-integration.test.d.ts +1 -0
- package/dist/providers/__tests__/runtime-integration.test.js +71 -0
- package/dist/providers/__tests__/runtime-integration.test.js.map +1 -0
- package/dist/providers/__tests__/runtime.test.d.ts +1 -0
- package/dist/providers/__tests__/runtime.test.js +76 -0
- package/dist/providers/__tests__/runtime.test.js.map +1 -0
- package/dist/providers/adapter.d.ts +15 -0
- package/dist/providers/adapter.js +45 -0
- package/dist/providers/adapter.js.map +1 -0
- package/dist/providers/adapter.test.d.ts +1 -0
- package/dist/providers/adapter.test.js +19 -0
- package/dist/providers/adapter.test.js.map +1 -0
- package/dist/providers/anthropic.d.ts +53 -0
- package/dist/providers/anthropic.js +141 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/errors.d.ts +18 -0
- package/dist/providers/errors.js +36 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/errors.test.d.ts +1 -0
- package/dist/providers/errors.test.js +66 -0
- package/dist/providers/errors.test.js.map +1 -0
- package/dist/providers/gemini.d.ts +11 -0
- package/dist/providers/gemini.js +33 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/gemini.test.d.ts +1 -0
- package/dist/providers/gemini.test.js +37 -0
- package/dist/providers/gemini.test.js.map +1 -0
- package/dist/providers/index.d.ts +11 -0
- package/dist/providers/index.js +15 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/keychain.d.ts +32 -0
- package/dist/providers/keychain.js +127 -0
- package/dist/providers/keychain.js.map +1 -0
- package/dist/providers/keychain.test.d.ts +1 -0
- package/dist/providers/keychain.test.js +80 -0
- package/dist/providers/keychain.test.js.map +1 -0
- package/dist/providers/ollama.d.ts +13 -0
- package/dist/providers/ollama.js +33 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/ollama.test.d.ts +1 -0
- package/dist/providers/ollama.test.js +37 -0
- package/dist/providers/ollama.test.js.map +1 -0
- package/dist/providers/openai-compatible.d.ts +15 -0
- package/dist/providers/openai-compatible.js +45 -0
- package/dist/providers/openai-compatible.js.map +1 -0
- package/dist/providers/openai-compatible.test.d.ts +1 -0
- package/dist/providers/openai-compatible.test.js +53 -0
- package/dist/providers/openai-compatible.test.js.map +1 -0
- package/dist/providers/openai.d.ts +11 -0
- package/dist/providers/openai.js +33 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/openai.test.d.ts +1 -0
- package/dist/providers/openai.test.js +53 -0
- package/dist/providers/openai.test.js.map +1 -0
- package/dist/providers/patch-zod-schema.d.ts +24 -0
- package/dist/providers/patch-zod-schema.js +121 -0
- package/dist/providers/patch-zod-schema.js.map +1 -0
- package/dist/providers/pricing.d.ts +21 -0
- package/dist/providers/pricing.js +50 -0
- package/dist/providers/pricing.js.map +1 -0
- package/dist/providers/pricing.test.d.ts +1 -0
- package/dist/providers/pricing.test.js +47 -0
- package/dist/providers/pricing.test.js.map +1 -0
- package/dist/providers/runtime.d.ts +21 -0
- package/dist/providers/runtime.js +83 -0
- package/dist/providers/runtime.js.map +1 -0
- package/dist/providers/stream-loop.d.ts +16 -0
- package/dist/providers/stream-loop.js +63 -0
- package/dist/providers/stream-loop.js.map +1 -0
- package/dist/providers/types.d.ts +106 -0
- package/dist/providers/types.js +12 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/vision-proxy.d.ts +23 -0
- package/dist/providers/vision-proxy.js +152 -0
- package/dist/providers/vision-proxy.js.map +1 -0
- package/dist/providers/vision-proxy.test.d.ts +1 -0
- package/dist/providers/vision-proxy.test.js +136 -0
- package/dist/providers/vision-proxy.test.js.map +1 -0
- package/dist/router/classifier/grammars.d.ts +3 -0
- package/dist/router/classifier/grammars.js +14 -0
- package/dist/router/classifier/grammars.js.map +1 -0
- package/dist/router/classifier/index.d.ts +3 -0
- package/dist/router/classifier/index.js +19 -0
- package/dist/router/classifier/index.js.map +1 -0
- package/dist/router/classifier/index.test.d.ts +1 -0
- package/dist/router/classifier/index.test.js +29 -0
- package/dist/router/classifier/index.test.js.map +1 -0
- package/dist/router/classifier/regex.d.ts +2 -0
- package/dist/router/classifier/regex.js +45 -0
- package/dist/router/classifier/regex.js.map +1 -0
- package/dist/router/classifier/regex.test.d.ts +1 -0
- package/dist/router/classifier/regex.test.js +42 -0
- package/dist/router/classifier/regex.test.js.map +1 -0
- package/dist/router/classifier/tree-sitter.d.ts +5 -0
- package/dist/router/classifier/tree-sitter.js +84 -0
- package/dist/router/classifier/tree-sitter.js.map +1 -0
- package/dist/router/classifier/tree-sitter.test.d.ts +1 -0
- package/dist/router/classifier/tree-sitter.test.js +23 -0
- package/dist/router/classifier/tree-sitter.test.js.map +1 -0
- package/dist/router/cold.d.ts +7 -0
- package/dist/router/cold.js +21 -0
- package/dist/router/cold.js.map +1 -0
- package/dist/router/cold.test.d.ts +1 -0
- package/dist/router/cold.test.js +56 -0
- package/dist/router/cold.test.js.map +1 -0
- package/dist/router/decide.d.ts +42 -0
- package/dist/router/decide.js +300 -0
- package/dist/router/decide.js.map +1 -0
- package/dist/router/decide.test.d.ts +1 -0
- package/dist/router/decide.test.js +116 -0
- package/dist/router/decide.test.js.map +1 -0
- package/dist/router/health.d.ts +10 -0
- package/dist/router/health.js +44 -0
- package/dist/router/health.js.map +1 -0
- package/dist/router/health.test.d.ts +1 -0
- package/dist/router/health.test.js +52 -0
- package/dist/router/health.test.js.map +1 -0
- package/dist/router/store.d.ts +24 -0
- package/dist/router/store.js +27 -0
- package/dist/router/store.js.map +1 -0
- package/dist/router/types.d.ts +18 -0
- package/dist/router/types.js +2 -0
- package/dist/router/types.js.map +1 -0
- package/dist/router/warm.d.ts +7 -0
- package/dist/router/warm.js +40 -0
- package/dist/router/warm.js.map +1 -0
- package/dist/router/warm.test.d.ts +1 -0
- package/dist/router/warm.test.js +144 -0
- package/dist/router/warm.test.js.map +1 -0
- package/dist/storage/__tests__/migrations.test.d.ts +12 -0
- package/dist/storage/__tests__/migrations.test.js +357 -0
- package/dist/storage/__tests__/migrations.test.js.map +1 -0
- package/dist/storage/atomic-io.d.ts +18 -0
- package/dist/storage/atomic-io.js +65 -0
- package/dist/storage/atomic-io.js.map +1 -0
- package/dist/storage/atomic-io.test.d.ts +1 -0
- package/dist/storage/atomic-io.test.js +49 -0
- package/dist/storage/atomic-io.test.js.map +1 -0
- package/dist/storage/config.d.ts +22 -0
- package/dist/storage/config.js +35 -0
- package/dist/storage/config.js.map +1 -0
- package/dist/storage/config.test.d.ts +1 -0
- package/dist/storage/config.test.js +29 -0
- package/dist/storage/config.test.js.map +1 -0
- package/dist/storage/db.d.ts +18 -0
- package/dist/storage/db.js +71 -0
- package/dist/storage/db.js.map +1 -0
- package/dist/storage/index.d.ts +8 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/migrations.d.ts +2 -0
- package/dist/storage/migrations.js +138 -0
- package/dist/storage/migrations.js.map +1 -0
- package/dist/storage/session-dir.d.ts +27 -0
- package/dist/storage/session-dir.js +36 -0
- package/dist/storage/session-dir.js.map +1 -0
- package/dist/storage/sessions.d.ts +16 -0
- package/dist/storage/sessions.js +142 -0
- package/dist/storage/sessions.js.map +1 -0
- package/dist/storage/tool-results.d.ts +4 -0
- package/dist/storage/tool-results.js +50 -0
- package/dist/storage/tool-results.js.map +1 -0
- package/dist/storage/transcript-view.d.ts +14 -0
- package/dist/storage/transcript-view.js +23 -0
- package/dist/storage/transcript-view.js.map +1 -0
- package/dist/storage/transcript.d.ts +12 -0
- package/dist/storage/transcript.js +269 -0
- package/dist/storage/transcript.js.map +1 -0
- package/dist/storage/transcript.test.d.ts +1 -0
- package/dist/storage/transcript.test.js +22 -0
- package/dist/storage/transcript.test.js.map +1 -0
- package/dist/storage/usage-cap.d.ts +34 -0
- package/dist/storage/usage-cap.js +54 -0
- package/dist/storage/usage-cap.js.map +1 -0
- package/dist/storage/usage-cap.test.d.ts +1 -0
- package/dist/storage/usage-cap.test.js +51 -0
- package/dist/storage/usage-cap.test.js.map +1 -0
- package/dist/storage/usage.d.ts +11 -0
- package/dist/storage/usage.js +65 -0
- package/dist/storage/usage.js.map +1 -0
- package/dist/storage/workspaces.d.ts +9 -0
- package/dist/storage/workspaces.js +60 -0
- package/dist/storage/workspaces.js.map +1 -0
- package/dist/tools/bash.d.ts +46 -0
- package/dist/tools/bash.js +541 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/bash.test.d.ts +1 -0
- package/dist/tools/bash.test.js +240 -0
- package/dist/tools/bash.test.js.map +1 -0
- package/dist/tools/computer.d.ts +88 -0
- package/dist/tools/computer.js +443 -0
- package/dist/tools/computer.js.map +1 -0
- package/dist/tools/computer.test.d.ts +1 -0
- package/dist/tools/computer.test.js +142 -0
- package/dist/tools/computer.test.js.map +1 -0
- package/dist/tools/file.d.ts +17 -0
- package/dist/tools/file.js +101 -0
- package/dist/tools/file.js.map +1 -0
- package/dist/tools/file.test.d.ts +1 -0
- package/dist/tools/file.test.js +58 -0
- package/dist/tools/file.test.js.map +1 -0
- package/dist/tools/grep.d.ts +8 -0
- package/dist/tools/grep.js +144 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/registry.d.ts +19 -0
- package/dist/tools/registry.js +245 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/schedule.d.ts +85 -0
- package/dist/tools/schedule.js +498 -0
- package/dist/tools/schedule.js.map +1 -0
- package/dist/tools/schedule.test.d.ts +1 -0
- package/dist/tools/schedule.test.js +118 -0
- package/dist/tools/schedule.test.js.map +1 -0
- package/dist/types/index.d.ts +279 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/agents-modal.d.ts +36 -0
- package/dist/ui/agents-modal.js +54 -0
- package/dist/ui/agents-modal.js.map +1 -0
- package/dist/ui/app.d.ts +31 -0
- package/dist/ui/app.js +3957 -0
- package/dist/ui/app.js.map +1 -0
- package/dist/ui/components/SuggestionOverlay.d.ts +6 -0
- package/dist/ui/components/SuggestionOverlay.js +12 -0
- package/dist/ui/components/SuggestionOverlay.js.map +1 -0
- package/dist/ui/components/btw-overlay.d.ts +11 -0
- package/dist/ui/components/btw-overlay.js +16 -0
- package/dist/ui/components/btw-overlay.js.map +1 -0
- package/dist/ui/hooks/useTypeahead.d.ts +18 -0
- package/dist/ui/hooks/useTypeahead.js +111 -0
- package/dist/ui/hooks/useTypeahead.js.map +1 -0
- package/dist/ui/markdown.d.ts +5 -0
- package/dist/ui/markdown.js +38 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/mcp-modal-types.d.ts +24 -0
- package/dist/ui/mcp-modal-types.js +13 -0
- package/dist/ui/mcp-modal-types.js.map +1 -0
- package/dist/ui/mcp-modal.d.ts +33 -0
- package/dist/ui/mcp-modal.js +94 -0
- package/dist/ui/mcp-modal.js.map +1 -0
- package/dist/ui/plan.d.ts +24 -0
- package/dist/ui/plan.js +122 -0
- package/dist/ui/plan.js.map +1 -0
- package/dist/ui/schedule-modal.d.ts +15 -0
- package/dist/ui/schedule-modal.js +36 -0
- package/dist/ui/schedule-modal.js.map +1 -0
- package/dist/ui/slash/__tests__/clear.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/clear.test.js +58 -0
- package/dist/ui/slash/__tests__/clear.test.js.map +1 -0
- package/dist/ui/slash/__tests__/compact.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/compact.test.js +43 -0
- package/dist/ui/slash/__tests__/compact.test.js.map +1 -0
- package/dist/ui/slash/__tests__/cost.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/cost.test.js +54 -0
- package/dist/ui/slash/__tests__/cost.test.js.map +1 -0
- package/dist/ui/slash/__tests__/discuss.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/discuss.test.js +83 -0
- package/dist/ui/slash/__tests__/discuss.test.js.map +1 -0
- package/dist/ui/slash/__tests__/execute.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/execute.test.js +71 -0
- package/dist/ui/slash/__tests__/execute.test.js.map +1 -0
- package/dist/ui/slash/__tests__/expand.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/expand.test.js +67 -0
- package/dist/ui/slash/__tests__/expand.test.js.map +1 -0
- package/dist/ui/slash/__tests__/optimize.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/optimize.test.js +130 -0
- package/dist/ui/slash/__tests__/optimize.test.js.map +1 -0
- package/dist/ui/slash/__tests__/plan.test.d.ts +1 -0
- package/dist/ui/slash/__tests__/plan.test.js +79 -0
- package/dist/ui/slash/__tests__/plan.test.js.map +1 -0
- package/dist/ui/slash/clear.d.ts +11 -0
- package/dist/ui/slash/clear.js +77 -0
- package/dist/ui/slash/clear.js.map +1 -0
- package/dist/ui/slash/compact.d.ts +11 -0
- package/dist/ui/slash/compact.js +40 -0
- package/dist/ui/slash/compact.js.map +1 -0
- package/dist/ui/slash/cost.d.ts +11 -0
- package/dist/ui/slash/cost.js +55 -0
- package/dist/ui/slash/cost.js.map +1 -0
- package/dist/ui/slash/council.d.ts +2 -0
- package/dist/ui/slash/council.js +22 -0
- package/dist/ui/slash/council.js.map +1 -0
- package/dist/ui/slash/debug.d.ts +45 -0
- package/dist/ui/slash/debug.js +111 -0
- package/dist/ui/slash/debug.js.map +1 -0
- package/dist/ui/slash/discuss.d.ts +11 -0
- package/dist/ui/slash/discuss.js +59 -0
- package/dist/ui/slash/discuss.js.map +1 -0
- package/dist/ui/slash/ee.d.ts +10 -0
- package/dist/ui/slash/ee.js +247 -0
- package/dist/ui/slash/ee.js.map +1 -0
- package/dist/ui/slash/execute.d.ts +12 -0
- package/dist/ui/slash/execute.js +36 -0
- package/dist/ui/slash/execute.js.map +1 -0
- package/dist/ui/slash/expand.d.ts +11 -0
- package/dist/ui/slash/expand.js +42 -0
- package/dist/ui/slash/expand.js.map +1 -0
- package/dist/ui/slash/optimize.d.ts +12 -0
- package/dist/ui/slash/optimize.js +37 -0
- package/dist/ui/slash/optimize.js.map +1 -0
- package/dist/ui/slash/plan.d.ts +11 -0
- package/dist/ui/slash/plan.js +48 -0
- package/dist/ui/slash/plan.js.map +1 -0
- package/dist/ui/slash/registry.d.ts +23 -0
- package/dist/ui/slash/registry.js +26 -0
- package/dist/ui/slash/registry.js.map +1 -0
- package/dist/ui/slash/route.d.ts +12 -0
- package/dist/ui/slash/route.js +35 -0
- package/dist/ui/slash/route.js.map +1 -0
- package/dist/ui/slash/route.test.d.ts +1 -0
- package/dist/ui/slash/route.test.js +70 -0
- package/dist/ui/slash/route.test.js.map +1 -0
- package/dist/ui/status-bar/index.d.ts +14 -0
- package/dist/ui/status-bar/index.js +74 -0
- package/dist/ui/status-bar/index.js.map +1 -0
- package/dist/ui/status-bar/index.test.d.ts +1 -0
- package/dist/ui/status-bar/index.test.js +80 -0
- package/dist/ui/status-bar/index.test.js.map +1 -0
- package/dist/ui/status-bar/store.d.ts +38 -0
- package/dist/ui/status-bar/store.js +144 -0
- package/dist/ui/status-bar/store.js.map +1 -0
- package/dist/ui/status-bar/store.test.d.ts +1 -0
- package/dist/ui/status-bar/store.test.js +116 -0
- package/dist/ui/status-bar/store.test.js.map +1 -0
- package/dist/ui/status-bar/tier-badge.d.ts +11 -0
- package/dist/ui/status-bar/tier-badge.js +19 -0
- package/dist/ui/status-bar/tier-badge.js.map +1 -0
- package/dist/ui/status-bar/tier-badge.test.d.ts +1 -0
- package/dist/ui/status-bar/tier-badge.test.js +34 -0
- package/dist/ui/status-bar/tier-badge.test.js.map +1 -0
- package/dist/ui/status-bar/usd-meter.d.ts +13 -0
- package/dist/ui/status-bar/usd-meter.js +13 -0
- package/dist/ui/status-bar/usd-meter.js.map +1 -0
- package/dist/ui/status-bar/usd-meter.test.d.ts +1 -0
- package/dist/ui/status-bar/usd-meter.test.js +32 -0
- package/dist/ui/status-bar/usd-meter.test.js.map +1 -0
- package/dist/ui/terminal-selection-text.d.ts +23 -0
- package/dist/ui/terminal-selection-text.js +59 -0
- package/dist/ui/terminal-selection-text.js.map +1 -0
- package/dist/ui/theme.d.ts +53 -0
- package/dist/ui/theme.js +53 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/usage/downgrade.d.ts +37 -0
- package/dist/usage/downgrade.js +49 -0
- package/dist/usage/downgrade.js.map +1 -0
- package/dist/usage/downgrade.test.d.ts +1 -0
- package/dist/usage/downgrade.test.js +67 -0
- package/dist/usage/downgrade.test.js.map +1 -0
- package/dist/usage/estimator.d.ts +17 -0
- package/dist/usage/estimator.js +28 -0
- package/dist/usage/estimator.js.map +1 -0
- package/dist/usage/estimator.test.d.ts +1 -0
- package/dist/usage/estimator.test.js +38 -0
- package/dist/usage/estimator.test.js.map +1 -0
- package/dist/usage/ledger.d.ts +42 -0
- package/dist/usage/ledger.js +181 -0
- package/dist/usage/ledger.js.map +1 -0
- package/dist/usage/ledger.test.d.ts +1 -0
- package/dist/usage/ledger.test.js +171 -0
- package/dist/usage/ledger.test.js.map +1 -0
- package/dist/usage/midstream.d.ts +24 -0
- package/dist/usage/midstream.js +45 -0
- package/dist/usage/midstream.js.map +1 -0
- package/dist/usage/midstream.test.d.ts +1 -0
- package/dist/usage/midstream.test.js +47 -0
- package/dist/usage/midstream.test.js.map +1 -0
- package/dist/usage/thresholds.d.ts +38 -0
- package/dist/usage/thresholds.js +54 -0
- package/dist/usage/thresholds.js.map +1 -0
- package/dist/usage/thresholds.test.d.ts +1 -0
- package/dist/usage/thresholds.test.js +77 -0
- package/dist/usage/thresholds.test.js.map +1 -0
- package/dist/usage/types.d.ts +30 -0
- package/dist/usage/types.js +21 -0
- package/dist/usage/types.js.map +1 -0
- package/dist/utils/at-mentions.d.ts +12 -0
- package/dist/utils/at-mentions.js +92 -0
- package/dist/utils/at-mentions.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +13 -0
- package/dist/utils/clipboard-image.js +121 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/file-index.d.ts +13 -0
- package/dist/utils/file-index.js +143 -0
- package/dist/utils/file-index.js.map +1 -0
- package/dist/utils/git-root.d.ts +1 -0
- package/dist/utils/git-root.js +16 -0
- package/dist/utils/git-root.js.map +1 -0
- package/dist/utils/host-clipboard.d.ts +4 -0
- package/dist/utils/host-clipboard.js +32 -0
- package/dist/utils/host-clipboard.js.map +1 -0
- package/dist/utils/install-manager.d.ts +56 -0
- package/dist/utils/install-manager.js +340 -0
- package/dist/utils/install-manager.js.map +1 -0
- package/dist/utils/install-manager.test.d.ts +1 -0
- package/dist/utils/install-manager.test.js +127 -0
- package/dist/utils/install-manager.test.js.map +1 -0
- package/dist/utils/instructions.d.ts +3 -0
- package/dist/utils/instructions.js +107 -0
- package/dist/utils/instructions.js.map +1 -0
- package/dist/utils/instructions.test.d.ts +1 -0
- package/dist/utils/instructions.test.js +68 -0
- package/dist/utils/instructions.test.js.map +1 -0
- package/dist/utils/permission-mode.d.ts +24 -0
- package/dist/utils/permission-mode.js +29 -0
- package/dist/utils/permission-mode.js.map +1 -0
- package/dist/utils/permission-mode.test.d.ts +1 -0
- package/dist/utils/permission-mode.test.js +97 -0
- package/dist/utils/permission-mode.test.js.map +1 -0
- package/dist/utils/redactor.d.ts +57 -0
- package/dist/utils/redactor.js +179 -0
- package/dist/utils/redactor.js.map +1 -0
- package/dist/utils/redactor.test.d.ts +1 -0
- package/dist/utils/redactor.test.js +84 -0
- package/dist/utils/redactor.test.js.map +1 -0
- package/dist/utils/settings.d.ts +179 -0
- package/dist/utils/settings.js +579 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/settings.test.d.ts +1 -0
- package/dist/utils/settings.test.js +160 -0
- package/dist/utils/settings.test.js.map +1 -0
- package/dist/utils/side-question.d.ts +10 -0
- package/dist/utils/side-question.js +24 -0
- package/dist/utils/side-question.js.map +1 -0
- package/dist/utils/skills.d.ts +20 -0
- package/dist/utils/skills.js +194 -0
- package/dist/utils/skills.js.map +1 -0
- package/dist/utils/skills.test.d.ts +1 -0
- package/dist/utils/skills.test.js +45 -0
- package/dist/utils/skills.test.js.map +1 -0
- package/dist/utils/subagent-display.d.ts +1 -0
- package/dist/utils/subagent-display.js +20 -0
- package/dist/utils/subagent-display.js.map +1 -0
- package/dist/utils/subagent-display.test.d.ts +1 -0
- package/dist/utils/subagent-display.test.js +21 -0
- package/dist/utils/subagent-display.test.js.map +1 -0
- package/dist/utils/subagents-settings.test.d.ts +1 -0
- package/dist/utils/subagents-settings.test.js +58 -0
- package/dist/utils/subagents-settings.test.js.map +1 -0
- package/dist/utils/telegram-audio-settings.test.d.ts +1 -0
- package/dist/utils/telegram-audio-settings.test.js +39 -0
- package/dist/utils/telegram-audio-settings.test.js.map +1 -0
- package/dist/utils/update-checker.d.ts +11 -0
- package/dist/utils/update-checker.js +22 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/dist/utils/update-checker.test.d.ts +1 -0
- package/dist/utils/update-checker.test.js +125 -0
- package/dist/utils/update-checker.test.js.map +1 -0
- package/dist/verify/checkpoint.d.ts +11 -0
- package/dist/verify/checkpoint.js +202 -0
- package/dist/verify/checkpoint.js.map +1 -0
- package/dist/verify/checkpoint.test.d.ts +1 -0
- package/dist/verify/checkpoint.test.js +160 -0
- package/dist/verify/checkpoint.test.js.map +1 -0
- package/dist/verify/entrypoint.d.ts +30 -0
- package/dist/verify/entrypoint.js +349 -0
- package/dist/verify/entrypoint.js.map +1 -0
- package/dist/verify/entrypoint.test.d.ts +1 -0
- package/dist/verify/entrypoint.test.js +233 -0
- package/dist/verify/entrypoint.test.js.map +1 -0
- package/dist/verify/environment.d.ts +9 -0
- package/dist/verify/environment.js +116 -0
- package/dist/verify/environment.js.map +1 -0
- package/dist/verify/environment.test.d.ts +1 -0
- package/dist/verify/environment.test.js +94 -0
- package/dist/verify/environment.test.js.map +1 -0
- package/dist/verify/evidence.d.ts +10 -0
- package/dist/verify/evidence.js +94 -0
- package/dist/verify/evidence.js.map +1 -0
- package/dist/verify/orchestrator.d.ts +25 -0
- package/dist/verify/orchestrator.js +87 -0
- package/dist/verify/orchestrator.js.map +1 -0
- package/dist/verify/orchestrator.test.d.ts +1 -0
- package/dist/verify/orchestrator.test.js +126 -0
- package/dist/verify/orchestrator.test.js.map +1 -0
- package/dist/verify/recipes.d.ts +20 -0
- package/dist/verify/recipes.js +451 -0
- package/dist/verify/recipes.js.map +1 -0
- package/dist/verify/retry.d.ts +4 -0
- package/dist/verify/retry.js +50 -0
- package/dist/verify/retry.js.map +1 -0
- package/dist/verify/runtime-prep.test.d.ts +1 -0
- package/dist/verify/runtime-prep.test.js +38 -0
- package/dist/verify/runtime-prep.test.js.map +1 -0
- package/package.json +93 -0
- package/src/__test-stubs__/ee-server.ts +173 -0
- package/src/billing/index.ts +5 -0
- package/src/bun-sqlite.d.ts +15 -0
- package/src/cloud/index.ts +5 -0
- package/src/daemon/scheduler.test.ts +128 -0
- package/src/daemon/scheduler.ts +152 -0
- package/src/ee/.gitkeep +0 -0
- package/src/ee/__tests__/pipeline.integration.test.ts +193 -0
- package/src/ee/auth.test.ts +76 -0
- package/src/ee/auth.ts +59 -0
- package/src/ee/bridge.test.ts +290 -0
- package/src/ee/bridge.ts +254 -0
- package/src/ee/client.test.ts +171 -0
- package/src/ee/client.ts +512 -0
- package/src/ee/embedding-cache.ts +42 -0
- package/src/ee/extract-session.test.ts +236 -0
- package/src/ee/extract-session.ts +69 -0
- package/src/ee/health.ts +83 -0
- package/src/ee/index.ts +32 -0
- package/src/ee/intercept.test.ts +191 -0
- package/src/ee/intercept.ts +132 -0
- package/src/ee/judge.test.ts +157 -0
- package/src/ee/judge.ts +68 -0
- package/src/ee/offline-queue.test.ts +351 -0
- package/src/ee/offline-queue.ts +212 -0
- package/src/ee/posttool.test.ts +81 -0
- package/src/ee/posttool.ts +16 -0
- package/src/ee/prompt-stale.test.ts +87 -0
- package/src/ee/prompt-stale.ts +39 -0
- package/src/ee/render.test.ts +71 -0
- package/src/ee/render.ts +47 -0
- package/src/ee/scope.test.ts +112 -0
- package/src/ee/scope.ts +93 -0
- package/src/ee/tenant.ts +14 -0
- package/src/ee/touch.test.ts +71 -0
- package/src/ee/types.ts +322 -0
- package/src/flow/.gitkeep +0 -0
- package/src/flow/__tests__/migration.test.ts +133 -0
- package/src/flow/__tests__/parser.test.ts +77 -0
- package/src/flow/__tests__/run-manager.test.ts +95 -0
- package/src/flow/__tests__/scaffold.test.ts +57 -0
- package/src/flow/__tests__/warning-persist.test.ts +112 -0
- package/src/flow/artifact-io.ts +41 -0
- package/src/flow/compaction/__tests__/compress.test.ts +69 -0
- package/src/flow/compaction/__tests__/extract.test.ts +74 -0
- package/src/flow/compaction/__tests__/preserve.test.ts +69 -0
- package/src/flow/compaction/compress.ts +67 -0
- package/src/flow/compaction/extract.ts +60 -0
- package/src/flow/compaction/index.ts +86 -0
- package/src/flow/compaction/preserve.ts +48 -0
- package/src/flow/index.ts +18 -0
- package/src/flow/migration.ts +139 -0
- package/src/flow/parser.ts +78 -0
- package/src/flow/run-manager.ts +129 -0
- package/src/flow/scaffold.ts +52 -0
- package/src/flow/warning-persist.ts +84 -0
- package/src/gsd/.gitkeep +0 -0
- package/src/gsd/__tests__/types.test.ts +77 -0
- package/src/gsd/index.ts +1 -0
- package/src/gsd/types.ts +47 -0
- package/src/headless/output.test.ts +201 -0
- package/src/headless/output.ts +312 -0
- package/src/hooks/config.ts +41 -0
- package/src/hooks/index.ts +250 -0
- package/src/hooks/types.ts +221 -0
- package/src/index.ts +655 -0
- package/src/lsp/builtins.test.ts +104 -0
- package/src/lsp/builtins.ts +409 -0
- package/src/lsp/client.ts +342 -0
- package/src/lsp/manager.test.ts +164 -0
- package/src/lsp/manager.ts +293 -0
- package/src/lsp/npm-cache.test.ts +68 -0
- package/src/lsp/npm-cache.ts +108 -0
- package/src/lsp/runtime.ts +70 -0
- package/src/lsp/smoke.test.ts +72 -0
- package/src/lsp/types.ts +116 -0
- package/src/mcp/auto-setup.ts +80 -0
- package/src/mcp/catalog.ts +138 -0
- package/src/mcp/oauth-callback.ts +63 -0
- package/src/mcp/oauth-provider.ts +130 -0
- package/src/mcp/parse-headers.test.ts +54 -0
- package/src/mcp/parse-headers.ts +35 -0
- package/src/mcp/runtime.ts +113 -0
- package/src/mcp/smoke.test.ts +170 -0
- package/src/mcp/validate.ts +48 -0
- package/src/models/__tests__/registry.test.ts +95 -0
- package/src/models/catalog-client.ts +83 -0
- package/src/models/catalog.json +314 -0
- package/src/models/classify-tier.ts +37 -0
- package/src/models/index.ts +9 -0
- package/src/models/registry.ts +73 -0
- package/src/ops/bug-report.test.ts +172 -0
- package/src/ops/bug-report.ts +80 -0
- package/src/ops/doctor.test.ts +107 -0
- package/src/ops/doctor.ts +172 -0
- package/src/orchestrator/__tests__/flow-resume.test.ts +71 -0
- package/src/orchestrator/__tests__/route-feedback.test.ts +55 -0
- package/src/orchestrator/abort.test.ts +37 -0
- package/src/orchestrator/abort.ts +51 -0
- package/src/orchestrator/agent.test.ts +138 -0
- package/src/orchestrator/cleanup.test.ts +88 -0
- package/src/orchestrator/compaction.test.ts +134 -0
- package/src/orchestrator/compaction.ts +487 -0
- package/src/orchestrator/delegations.test.ts +145 -0
- package/src/orchestrator/delegations.ts +364 -0
- package/src/orchestrator/flow-resume.ts +55 -0
- package/src/orchestrator/orchestrator.ts +3965 -0
- package/src/orchestrator/pending-calls.test.ts +226 -0
- package/src/orchestrator/pending-calls.ts +240 -0
- package/src/orchestrator/reasoning.test.ts +29 -0
- package/src/orchestrator/reasoning.ts +64 -0
- package/src/orchestrator/sandbox.test.ts +115 -0
- package/src/pil/__tests__/budget.test.ts +39 -0
- package/src/pil/__tests__/layer1-intent.test.ts +243 -0
- package/src/pil/__tests__/layer2-personality.test.ts +63 -0
- package/src/pil/__tests__/layer3-ee-injection.test.ts +117 -0
- package/src/pil/__tests__/layer4-gsd.test.ts +76 -0
- package/src/pil/__tests__/layer5-context.test.ts +116 -0
- package/src/pil/__tests__/layer6-output.test.ts +139 -0
- package/src/pil/__tests__/ollama-classify.test.ts +81 -0
- package/src/pil/__tests__/orchestrator-integration.test.ts +107 -0
- package/src/pil/__tests__/pipeline.test.ts +173 -0
- package/src/pil/__tests__/response-tools.test.ts +165 -0
- package/src/pil/__tests__/schema.test.ts +128 -0
- package/src/pil/__tests__/store.test.ts +49 -0
- package/src/pil/__tests__/task-tier-map.test.ts +41 -0
- package/src/pil/budget.ts +18 -0
- package/src/pil/index.ts +12 -0
- package/src/pil/layer1-intent.ts +155 -0
- package/src/pil/layer2-personality.ts +37 -0
- package/src/pil/layer3-ee-injection.ts +79 -0
- package/src/pil/layer4-gsd.ts +77 -0
- package/src/pil/layer5-context.ts +125 -0
- package/src/pil/layer6-output.ts +113 -0
- package/src/pil/ollama-classify.ts +49 -0
- package/src/pil/pipeline.ts +112 -0
- package/src/pil/response-tools.ts +110 -0
- package/src/pil/schema.ts +49 -0
- package/src/pil/store.ts +29 -0
- package/src/pil/task-tier-map.ts +90 -0
- package/src/pil/timeout.ts +10 -0
- package/src/pil/types.ts +42 -0
- package/src/providers/.gitkeep +0 -0
- package/src/providers/__test-utils__/load-fixture.ts +36 -0
- package/src/providers/__tests__/runtime-integration.test.ts +80 -0
- package/src/providers/__tests__/runtime.test.ts +86 -0
- package/src/providers/adapter.test.ts +21 -0
- package/src/providers/adapter.ts +48 -0
- package/src/providers/anthropic.ts +169 -0
- package/src/providers/errors.test.ts +76 -0
- package/src/providers/errors.ts +46 -0
- package/src/providers/gemini.test.ts +46 -0
- package/src/providers/gemini.ts +37 -0
- package/src/providers/index.ts +32 -0
- package/src/providers/keychain.test.ts +95 -0
- package/src/providers/keychain.ts +133 -0
- package/src/providers/ollama.test.ts +46 -0
- package/src/providers/ollama.ts +36 -0
- package/src/providers/openai-compatible.test.ts +63 -0
- package/src/providers/openai-compatible.ts +50 -0
- package/src/providers/openai.test.ts +65 -0
- package/src/providers/openai.ts +37 -0
- package/src/providers/patch-zod-schema.ts +129 -0
- package/src/providers/pricing.test.ts +56 -0
- package/src/providers/pricing.ts +55 -0
- package/src/providers/runtime.ts +111 -0
- package/src/providers/stream-loop.ts +69 -0
- package/src/providers/types.ts +111 -0
- package/src/providers/vision-proxy.test.ts +167 -0
- package/src/providers/vision-proxy.ts +209 -0
- package/src/router/.gitkeep +0 -0
- package/src/router/classifier/grammars.ts +17 -0
- package/src/router/classifier/index.test.ts +33 -0
- package/src/router/classifier/index.ts +21 -0
- package/src/router/classifier/regex.test.ts +47 -0
- package/src/router/classifier/regex.ts +54 -0
- package/src/router/classifier/tree-sitter.test.ts +26 -0
- package/src/router/classifier/tree-sitter.ts +87 -0
- package/src/router/cold.test.ts +62 -0
- package/src/router/cold.ts +27 -0
- package/src/router/decide.test.ts +135 -0
- package/src/router/decide.ts +354 -0
- package/src/router/health.test.ts +59 -0
- package/src/router/health.ts +49 -0
- package/src/router/store.ts +47 -0
- package/src/router/types.ts +20 -0
- package/src/router/warm.test.ts +167 -0
- package/src/router/warm.ts +47 -0
- package/src/storage/__tests__/migrations.test.ts +395 -0
- package/src/storage/atomic-io.test.ts +61 -0
- package/src/storage/atomic-io.ts +62 -0
- package/src/storage/config.test.ts +33 -0
- package/src/storage/config.ts +49 -0
- package/src/storage/db.ts +95 -0
- package/src/storage/index.ts +19 -0
- package/src/storage/migrations.ts +143 -0
- package/src/storage/session-dir.ts +37 -0
- package/src/storage/sessions.ts +178 -0
- package/src/storage/tool-results.ts +56 -0
- package/src/storage/transcript-view.ts +45 -0
- package/src/storage/transcript.test.ts +24 -0
- package/src/storage/transcript.ts +358 -0
- package/src/storage/usage-cap.test.ts +59 -0
- package/src/storage/usage-cap.ts +81 -0
- package/src/storage/usage.ts +115 -0
- package/src/storage/workspaces.ts +84 -0
- package/src/tools/bash.test.ts +336 -0
- package/src/tools/bash.ts +612 -0
- package/src/tools/computer.test.ts +187 -0
- package/src/tools/computer.ts +632 -0
- package/src/tools/file.test.ts +95 -0
- package/src/tools/file.ts +128 -0
- package/src/tools/grep.ts +187 -0
- package/src/tools/registry.ts +282 -0
- package/src/tools/schedule.test.ts +143 -0
- package/src/tools/schedule.ts +610 -0
- package/src/types/index.ts +311 -0
- package/src/ui/agents-modal.tsx +272 -0
- package/src/ui/app.tsx +6277 -0
- package/src/ui/components/SuggestionOverlay.tsx +38 -0
- package/src/ui/components/btw-overlay.tsx +66 -0
- package/src/ui/hooks/useTypeahead.ts +146 -0
- package/src/ui/markdown.tsx +49 -0
- package/src/ui/mcp-modal-types.ts +33 -0
- package/src/ui/mcp-modal.tsx +456 -0
- package/src/ui/plan.tsx +346 -0
- package/src/ui/schedule-modal.tsx +126 -0
- package/src/ui/slash/__tests__/clear.test.ts +86 -0
- package/src/ui/slash/__tests__/compact.test.ts +56 -0
- package/src/ui/slash/__tests__/cost.test.ts +62 -0
- package/src/ui/slash/__tests__/discuss.test.ts +101 -0
- package/src/ui/slash/__tests__/execute.test.ts +86 -0
- package/src/ui/slash/__tests__/expand.test.ts +86 -0
- package/src/ui/slash/__tests__/optimize.test.ts +155 -0
- package/src/ui/slash/__tests__/plan.test.ts +95 -0
- package/src/ui/slash/clear.ts +89 -0
- package/src/ui/slash/compact.ts +46 -0
- package/src/ui/slash/cost.ts +59 -0
- package/src/ui/slash/council.ts +27 -0
- package/src/ui/slash/debug.ts +153 -0
- package/src/ui/slash/discuss.ts +71 -0
- package/src/ui/slash/ee.ts +271 -0
- package/src/ui/slash/execute.ts +44 -0
- package/src/ui/slash/expand.ts +51 -0
- package/src/ui/slash/optimize.ts +47 -0
- package/src/ui/slash/plan.ts +62 -0
- package/src/ui/slash/registry.ts +38 -0
- package/src/ui/slash/route.test.ts +82 -0
- package/src/ui/slash/route.ts +43 -0
- package/src/ui/status-bar/index.test.tsx +90 -0
- package/src/ui/status-bar/index.tsx +94 -0
- package/src/ui/status-bar/store.test.ts +131 -0
- package/src/ui/status-bar/store.ts +166 -0
- package/src/ui/status-bar/tier-badge.test.tsx +38 -0
- package/src/ui/status-bar/tier-badge.tsx +29 -0
- package/src/ui/status-bar/usd-meter.test.tsx +37 -0
- package/src/ui/status-bar/usd-meter.tsx +22 -0
- package/src/ui/terminal-selection-text.ts +72 -0
- package/src/ui/theme.ts +54 -0
- package/src/usage/.gitkeep +0 -0
- package/src/usage/downgrade.test.ts +82 -0
- package/src/usage/downgrade.ts +70 -0
- package/src/usage/estimator.test.ts +43 -0
- package/src/usage/estimator.ts +34 -0
- package/src/usage/ledger.test.ts +200 -0
- package/src/usage/ledger.ts +213 -0
- package/src/usage/midstream.test.ts +55 -0
- package/src/usage/midstream.ts +51 -0
- package/src/usage/thresholds.test.ts +83 -0
- package/src/usage/thresholds.ts +74 -0
- package/src/usage/types.ts +40 -0
- package/src/utils/at-mentions.ts +120 -0
- package/src/utils/clipboard-image.ts +114 -0
- package/src/utils/file-index.ts +152 -0
- package/src/utils/git-root.ts +17 -0
- package/src/utils/host-clipboard.ts +30 -0
- package/src/utils/install-manager.test.ts +167 -0
- package/src/utils/install-manager.ts +429 -0
- package/src/utils/instructions.test.ts +84 -0
- package/src/utils/instructions.ts +116 -0
- package/src/utils/permission-mode.test.ts +121 -0
- package/src/utils/permission-mode.ts +37 -0
- package/src/utils/redactor.test.ts +100 -0
- package/src/utils/redactor.ts +223 -0
- package/src/utils/settings.test.ts +181 -0
- package/src/utils/settings.ts +787 -0
- package/src/utils/side-question.ts +39 -0
- package/src/utils/skills.test.ts +58 -0
- package/src/utils/skills.ts +207 -0
- package/src/utils/subagent-display.test.ts +23 -0
- package/src/utils/subagent-display.ts +11 -0
- package/src/utils/subagents-settings.test.ts +77 -0
- package/src/utils/telegram-audio-settings.test.ts +44 -0
- package/src/utils/update-checker.test.ts +182 -0
- package/src/utils/update-checker.ts +33 -0
- package/src/verify/checkpoint.test.ts +186 -0
- package/src/verify/checkpoint.ts +239 -0
- package/src/verify/entrypoint.test.ts +293 -0
- package/src/verify/entrypoint.ts +439 -0
- package/src/verify/environment.test.ts +119 -0
- package/src/verify/environment.ts +115 -0
- package/src/verify/evidence.ts +104 -0
- package/src/verify/orchestrator.test.ts +159 -0
- package/src/verify/orchestrator.ts +129 -0
- package/src/verify/recipes.ts +516 -0
- package/src/verify/retry.ts +62 -0
- package/src/verify/runtime-prep.test.ts +47 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,655 @@
|
|
|
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 { createInterface } from "readline";
|
|
10
|
+
import { InvalidArgumentError, program } from "commander";
|
|
11
|
+
|
|
12
|
+
import packageJson from "../package.json";
|
|
13
|
+
import {
|
|
14
|
+
createHeadlessJsonlEmitter,
|
|
15
|
+
type HeadlessOutputFormat,
|
|
16
|
+
isHeadlessOutputFormat,
|
|
17
|
+
renderHeadlessChunk,
|
|
18
|
+
renderHeadlessPrelude,
|
|
19
|
+
} from "./headless/output";
|
|
20
|
+
import {
|
|
21
|
+
loadCatalog,
|
|
22
|
+
normalizeModelId,
|
|
23
|
+
} from "./models/registry.js";
|
|
24
|
+
// Plan 00-07: boot-order modules — AbortContext + PendingCallsLog (TUI-01, TUI-03, TUI-04).
|
|
25
|
+
import { createAbortContext } from "./orchestrator/abort.js";
|
|
26
|
+
import { completeDelegation, failDelegation, loadDelegation } from "./orchestrator/delegations";
|
|
27
|
+
import { Agent } from "./orchestrator/orchestrator";
|
|
28
|
+
import { createPendingCallsLog } from "./orchestrator/pending-calls.js";
|
|
29
|
+
import { loadKeyForProvider } from "./providers/keychain.js";
|
|
30
|
+
import { detectProviderForModel } from "./providers/runtime.js";
|
|
31
|
+
import { loadConfig } from "./storage/config.js";
|
|
32
|
+
import { loadUsage } from "./storage/usage-cap.js";
|
|
33
|
+
import { startScheduleDaemon } from "./tools/schedule";
|
|
34
|
+
import { processAtMentions } from "./utils/at-mentions.js";
|
|
35
|
+
import { runScriptManagedUninstall } from "./utils/install-manager";
|
|
36
|
+
import type { PermissionMode } from "./utils/permission-mode.js";
|
|
37
|
+
import {
|
|
38
|
+
getApiKey,
|
|
39
|
+
getBaseURL,
|
|
40
|
+
getCurrentModel,
|
|
41
|
+
getCurrentSandboxMode,
|
|
42
|
+
getCurrentSandboxSettings,
|
|
43
|
+
mergeSandboxSettings,
|
|
44
|
+
type SandboxMode,
|
|
45
|
+
type SandboxSettings,
|
|
46
|
+
saveUserSettings,
|
|
47
|
+
} from "./utils/settings";
|
|
48
|
+
import { runUpdate } from "./utils/update-checker";
|
|
49
|
+
import { buildVerifyPrompt, getVerifyCliError } from "./verify/entrypoint";
|
|
50
|
+
|
|
51
|
+
const exitCleanlyOnSigterm = () => {
|
|
52
|
+
process.exit(0);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
process.on("SIGTERM", exitCleanlyOnSigterm);
|
|
56
|
+
|
|
57
|
+
process.on("uncaughtException", (err) => {
|
|
58
|
+
try { require("fs").appendFileSync(require("path").join(require("os").homedir(), ".muonroi-cli", "crash.log"), `[${new Date().toISOString()}] UNCAUGHT: ${err.stack || err.message}\n`); } catch {}
|
|
59
|
+
console.error("Fatal:", err.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
process.on("unhandledRejection", (reason) => {
|
|
64
|
+
const msg = reason instanceof Error ? (reason.stack || reason.message) : String(reason);
|
|
65
|
+
try { require("fs").appendFileSync(require("path").join(require("os").homedir(), ".muonroi-cli", "crash.log"), `[${new Date().toISOString()}] REJECTION: ${msg}\n`); } catch {}
|
|
66
|
+
console.error("Unhandled rejection:", reason);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* First-run wizard: prompts for API key interactively when none is configured.
|
|
72
|
+
* Output goes to stderr so it doesn't pollute piped stdout.
|
|
73
|
+
* Returns the trimmed key or null if user cancels / stdin is not a TTY.
|
|
74
|
+
*/
|
|
75
|
+
async function firstRunWizard(): Promise<string | null> {
|
|
76
|
+
try {
|
|
77
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
78
|
+
const ask = (q: string): Promise<string> =>
|
|
79
|
+
new Promise((resolve) => rl.question(q, (answer) => resolve(answer)));
|
|
80
|
+
|
|
81
|
+
process.stderr.write("\nWelcome to muonroi-cli!\n\n");
|
|
82
|
+
process.stderr.write("To get started, you need an API key from Anthropic.\n");
|
|
83
|
+
process.stderr.write("Get one at: https://console.anthropic.com/settings/keys\n\n");
|
|
84
|
+
|
|
85
|
+
const raw = await ask("Enter your API key: ");
|
|
86
|
+
rl.close();
|
|
87
|
+
|
|
88
|
+
const trimmed = raw.trim();
|
|
89
|
+
if (!trimmed) {
|
|
90
|
+
process.stderr.write(
|
|
91
|
+
"No key provided. Set MUONROI_API_KEY env var or run again to enter key.\n",
|
|
92
|
+
);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return trimmed;
|
|
96
|
+
} catch {
|
|
97
|
+
// stdin is not a TTY or readline errors — fail silently
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function startInteractive(
|
|
103
|
+
apiKey: string | undefined,
|
|
104
|
+
baseURL: string,
|
|
105
|
+
model: string | undefined,
|
|
106
|
+
maxToolRounds: number,
|
|
107
|
+
batchApi: boolean,
|
|
108
|
+
sandboxMode: SandboxMode,
|
|
109
|
+
sandboxSettings: SandboxSettings,
|
|
110
|
+
session?: string,
|
|
111
|
+
initialMessage?: string,
|
|
112
|
+
permissionMode: PermissionMode = "safe",
|
|
113
|
+
) {
|
|
114
|
+
// ── Plan 00-07 boot order ──────────────────────────────────────────────────
|
|
115
|
+
// 1. redactor.installGlobalPatches() — already at top of file (line 6).
|
|
116
|
+
// 2. loadConfig + loadUsage (validates storage paths, logs usage cap state).
|
|
117
|
+
const [config, usage] = await Promise.all([loadConfig(), loadUsage()]);
|
|
118
|
+
void config; // Phase 0: plumbed but not yet surfaced in TUI status bar (TUI-05, Phase 1).
|
|
119
|
+
void usage; // Phase 0: same — cap guard will gate on this in plan 00-06+ / Phase 1.
|
|
120
|
+
|
|
121
|
+
// 3. Load API key for the active provider — enrolls into redactor.
|
|
122
|
+
const activeModel = getCurrentModel();
|
|
123
|
+
const activeProvider = detectProviderForModel(activeModel);
|
|
124
|
+
const providerKey = await loadKeyForProvider(activeProvider).catch(() => undefined);
|
|
125
|
+
void providerKey; // Agent also loads key internally; this run is for early redactor enrollment.
|
|
126
|
+
|
|
127
|
+
// 5-6. createPendingCallsLog + createAbortContext — wired before Agent so
|
|
128
|
+
// the Agent receives them via AgentOptions (Pitfall 9, TUI-04).
|
|
129
|
+
// Session ID is not available until Agent opens SQLite; use a stable
|
|
130
|
+
// pre-session sentinel "pre-session" for the pending-calls log.
|
|
131
|
+
// After Agent is constructed we promote to the real session ID.
|
|
132
|
+
const orchestratorAbort = createAbortContext();
|
|
133
|
+
|
|
134
|
+
// 7. SIGINT handler — must be registered BEFORE mountTUI so Ctrl+C fires
|
|
135
|
+
// abort before OpenTUI's own handler chains. The handler is non-blocking:
|
|
136
|
+
// it only sets the abort signal; OpenTUI's teardown flushes terminal state
|
|
137
|
+
// on its own reconciler path.
|
|
138
|
+
process.on("SIGINT", () => {
|
|
139
|
+
orchestratorAbort.abort("SIGINT");
|
|
140
|
+
// OpenTUI will receive its own SIGINT / Ctrl+C via exitOnCtrlC:false;
|
|
141
|
+
// onExit below handles the cleanup sequence.
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// ── Construct Agent (opens SQLite, loads transcript, wires abort + pending) ─
|
|
145
|
+
// PendingCallsLog: use session selector as provisional ID; Agent will have
|
|
146
|
+
// the real session ID after construction.
|
|
147
|
+
const provisionalSessionId = session ?? "latest";
|
|
148
|
+
const pendingCalls = createPendingCallsLog(provisionalSessionId);
|
|
149
|
+
// Reconcile any orphaned .tmp files from a prior crash (Pitfall 9).
|
|
150
|
+
const reconciled = await pendingCalls.reconcile();
|
|
151
|
+
if (reconciled.abandoned > 0) {
|
|
152
|
+
console.warn(`[muonroi-cli] reconciled ${reconciled.abandoned} abandoned tool calls from prior session`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
156
|
+
session,
|
|
157
|
+
sandboxMode,
|
|
158
|
+
sandboxSettings,
|
|
159
|
+
batchApi,
|
|
160
|
+
abortContext: orchestratorAbort,
|
|
161
|
+
pendingCalls,
|
|
162
|
+
permissionMode,
|
|
163
|
+
});
|
|
164
|
+
// ── /Plan 00-07 boot order ────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
const { createCliRenderer } = await import("@opentui/core");
|
|
167
|
+
const { createRoot } = await import("@opentui/react");
|
|
168
|
+
const { createElement } = await import("react");
|
|
169
|
+
const { App } = await import("./ui/app");
|
|
170
|
+
|
|
171
|
+
const renderer = await createCliRenderer({
|
|
172
|
+
exitOnCtrlC: false,
|
|
173
|
+
// Lets terminals (Kitty, iTerm2, WezTerm, …) report Command as `super` on KeyEvent — needed for ⌘C in the TUI.
|
|
174
|
+
useKittyKeyboard: {
|
|
175
|
+
disambiguate: true,
|
|
176
|
+
alternateKeys: true,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const onExit = () => {
|
|
181
|
+
void agent.cleanup().finally(() => {
|
|
182
|
+
renderer.destroy();
|
|
183
|
+
process.exit(0);
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
createRoot(renderer).render(
|
|
188
|
+
createElement(App, {
|
|
189
|
+
agent,
|
|
190
|
+
startupConfig: {
|
|
191
|
+
apiKey,
|
|
192
|
+
baseURL,
|
|
193
|
+
model: agent.getModel(),
|
|
194
|
+
maxToolRounds,
|
|
195
|
+
sandboxMode,
|
|
196
|
+
sandboxSettings,
|
|
197
|
+
version: packageJson.version,
|
|
198
|
+
},
|
|
199
|
+
initialMessage,
|
|
200
|
+
onExit,
|
|
201
|
+
}),
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async function runHeadless(
|
|
206
|
+
prompt: string,
|
|
207
|
+
apiKey: string,
|
|
208
|
+
baseURL: string,
|
|
209
|
+
model: string | undefined,
|
|
210
|
+
maxToolRounds: number,
|
|
211
|
+
batchApi: boolean,
|
|
212
|
+
sandboxMode: SandboxMode,
|
|
213
|
+
sandboxSettings: SandboxSettings,
|
|
214
|
+
format: HeadlessOutputFormat,
|
|
215
|
+
session?: string,
|
|
216
|
+
permissionMode: PermissionMode = "safe",
|
|
217
|
+
) {
|
|
218
|
+
const agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
219
|
+
session,
|
|
220
|
+
sandboxMode,
|
|
221
|
+
sandboxSettings,
|
|
222
|
+
batchApi,
|
|
223
|
+
permissionMode,
|
|
224
|
+
});
|
|
225
|
+
const prelude = renderHeadlessPrelude(format, agent.getSessionId() || undefined);
|
|
226
|
+
if (prelude.stdout) process.stdout.write(prelude.stdout);
|
|
227
|
+
if (prelude.stderr) process.stderr.write(prelude.stderr);
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
const { enhancedMessage } = processAtMentions(prompt, process.cwd());
|
|
231
|
+
|
|
232
|
+
if (format === "json") {
|
|
233
|
+
const { observer, consumeChunk, flush } = createHeadlessJsonlEmitter(agent.getSessionId() || undefined);
|
|
234
|
+
for await (const chunk of agent.processMessage(enhancedMessage, observer)) {
|
|
235
|
+
const writes = consumeChunk(chunk);
|
|
236
|
+
if (writes.stdout) process.stdout.write(writes.stdout);
|
|
237
|
+
if (writes.stderr) process.stderr.write(writes.stderr ?? "");
|
|
238
|
+
}
|
|
239
|
+
const tail = flush();
|
|
240
|
+
if (tail.stdout) process.stdout.write(tail.stdout);
|
|
241
|
+
if (tail.stderr) process.stderr.write(tail.stderr ?? "");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
for await (const chunk of agent.processMessage(enhancedMessage)) {
|
|
246
|
+
const writes = renderHeadlessChunk(chunk);
|
|
247
|
+
if (writes.stdout) process.stdout.write(writes.stdout);
|
|
248
|
+
if (writes.stderr) process.stderr.write(writes.stderr);
|
|
249
|
+
}
|
|
250
|
+
} finally {
|
|
251
|
+
await agent.cleanup();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function changeDirectoryOrExit(directory: string | undefined) {
|
|
256
|
+
if (!directory) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
try {
|
|
261
|
+
process.chdir(directory);
|
|
262
|
+
} catch (err: unknown) {
|
|
263
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
264
|
+
console.error(`Cannot change to directory ${directory}: ${msg}`);
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
type CliOptions = Record<string, string | boolean | undefined>;
|
|
270
|
+
|
|
271
|
+
function stringOption(value: string | boolean | undefined): string | undefined {
|
|
272
|
+
return typeof value === "string" ? value : undefined;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function collect(value: string, prev: string[]): string[] {
|
|
276
|
+
return [...prev, value];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function resolveCliSandboxMode(value: string | boolean | undefined): SandboxMode | undefined {
|
|
280
|
+
if (value === true) return "shuru";
|
|
281
|
+
if (value === false) return "off";
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async function runBackgroundDelegation(jobPath: string, options: CliOptions) {
|
|
286
|
+
let output = "";
|
|
287
|
+
let agent: Agent | undefined;
|
|
288
|
+
|
|
289
|
+
try {
|
|
290
|
+
const delegation = await loadDelegation(jobPath);
|
|
291
|
+
const apiKey = stringOption(options.apiKey) || getApiKey();
|
|
292
|
+
if (!apiKey) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
"API key required. Set MUONROI_API_KEY, use --api-key, or save it to ~/.muonroi-cli/user-settings.json.",
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const baseURL = stringOption(options.baseUrl) || getBaseURL();
|
|
299
|
+
const explicitModel = stringOption(options.model) || delegation.model;
|
|
300
|
+
const model = explicitModel ? normalizeModelId(explicitModel) : undefined;
|
|
301
|
+
const maxToolRounds =
|
|
302
|
+
parseInt(stringOption(options.maxToolRounds) || String(delegation.maxToolRounds), 10) || delegation.maxToolRounds;
|
|
303
|
+
const sandboxMode = resolveCliSandboxMode(options.sandbox) || delegation.sandboxMode || getCurrentSandboxMode();
|
|
304
|
+
const sandboxSettings = mergeSandboxSettings(getCurrentSandboxSettings(), delegation.sandboxSettings);
|
|
305
|
+
agent = new Agent(apiKey, baseURL, model, maxToolRounds, {
|
|
306
|
+
persistSession: false,
|
|
307
|
+
sandboxMode,
|
|
308
|
+
sandboxSettings,
|
|
309
|
+
batchApi: Boolean(delegation.batchApi ?? options.batchApi === true),
|
|
310
|
+
});
|
|
311
|
+
const result = await agent.runTaskRequest({
|
|
312
|
+
agent: delegation.agent,
|
|
313
|
+
description: delegation.description,
|
|
314
|
+
prompt: delegation.prompt,
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
output = (result.output || "").trim();
|
|
318
|
+
|
|
319
|
+
if (!result.success) {
|
|
320
|
+
await failDelegation(jobPath, result.output || result.error || "Background delegation failed.", output);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
await completeDelegation(jobPath, output, result.task?.summary);
|
|
325
|
+
} catch (err: unknown) {
|
|
326
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
327
|
+
try {
|
|
328
|
+
await failDelegation(jobPath, msg, output);
|
|
329
|
+
} catch {
|
|
330
|
+
// Best effort — background tasks should fail silently if persistence is unavailable.
|
|
331
|
+
}
|
|
332
|
+
process.exit(1);
|
|
333
|
+
} finally {
|
|
334
|
+
await agent?.cleanup();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function resolveConfig(options: CliOptions) {
|
|
339
|
+
const apiKey = stringOption(options.apiKey) || getApiKey();
|
|
340
|
+
const baseURL = stringOption(options.baseUrl) || getBaseURL();
|
|
341
|
+
const explicitModel = stringOption(options.model);
|
|
342
|
+
const model = explicitModel ? normalizeModelId(explicitModel) : undefined;
|
|
343
|
+
const maxToolRounds = parseInt(stringOption(options.maxToolRounds) || "400", 10) || 400;
|
|
344
|
+
const sandboxMode = resolveCliSandboxMode(options.sandbox) || getCurrentSandboxMode();
|
|
345
|
+
|
|
346
|
+
const cliOverrides: SandboxSettings = {};
|
|
347
|
+
if (options.allowNet === true) cliOverrides.allowNet = true;
|
|
348
|
+
const allowHostValue = options.allowHost;
|
|
349
|
+
if (Array.isArray(allowHostValue) && allowHostValue.length > 0) {
|
|
350
|
+
cliOverrides.allowedHosts = allowHostValue as string[];
|
|
351
|
+
if (!cliOverrides.allowNet) cliOverrides.allowNet = true;
|
|
352
|
+
}
|
|
353
|
+
const portValue = options.port;
|
|
354
|
+
if (Array.isArray(portValue) && portValue.length > 0) {
|
|
355
|
+
cliOverrides.ports = portValue as string[];
|
|
356
|
+
}
|
|
357
|
+
const sandboxSettings = mergeSandboxSettings(getCurrentSandboxSettings(), cliOverrides);
|
|
358
|
+
|
|
359
|
+
if (typeof options.apiKey === "string") saveUserSettings({ apiKey: options.apiKey });
|
|
360
|
+
if (typeof options.model === "string") saveUserSettings({ defaultModel: normalizeModelId(options.model) });
|
|
361
|
+
|
|
362
|
+
return { apiKey, baseURL, model, maxToolRounds, sandboxMode, sandboxSettings };
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function requireApiKey(apiKey: string | undefined): string {
|
|
366
|
+
if (!apiKey) {
|
|
367
|
+
console.error(
|
|
368
|
+
"Error: API key required. Set MUONROI_API_KEY env var, use --api-key, or save to ~/.muonroi-cli/user-settings.json",
|
|
369
|
+
);
|
|
370
|
+
process.exit(1);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return apiKey;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function parseHeadlessOutputFormat(value: string): HeadlessOutputFormat {
|
|
377
|
+
if (isHeadlessOutputFormat(value)) {
|
|
378
|
+
return value;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
throw new InvalidArgumentError(`Invalid headless format "${value}". Expected "text" or "json".`);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
program
|
|
385
|
+
.name("muonroi-cli")
|
|
386
|
+
.description("AI coding agent — built with Bun and OpenTUI")
|
|
387
|
+
.version(packageJson.version)
|
|
388
|
+
.argument("[message...]", "Initial message to send")
|
|
389
|
+
.option("-k, --api-key <key>", "API key")
|
|
390
|
+
.option("-u, --base-url <url>", "API base URL")
|
|
391
|
+
.option("-m, --model <model>", "Model to use")
|
|
392
|
+
.option("-d, --directory <dir>", "Working directory", process.cwd())
|
|
393
|
+
.option("-p, --prompt <prompt>", "Run a single prompt headlessly")
|
|
394
|
+
.option("--verify", "Run the built-in verify flow headlessly")
|
|
395
|
+
.option("--format <format>", "Headless output format: text or json", parseHeadlessOutputFormat, "text")
|
|
396
|
+
.option("--sandbox", "Run agent shell commands inside a Shuru sandbox")
|
|
397
|
+
.option("--no-sandbox", "Run agent shell commands directly on the host")
|
|
398
|
+
.option("--allow-net", "Enable network access inside the Shuru sandbox")
|
|
399
|
+
.option("--allow-host <pattern>", "Restrict sandbox network to specific hosts (repeatable)", collect, [])
|
|
400
|
+
.option("--port <mapping>", "Forward a host port to sandbox guest (HOST:GUEST, repeatable)", collect, [])
|
|
401
|
+
.option("-s, --session <id>", "Continue a saved session by id, or use 'latest'")
|
|
402
|
+
.option("--background-task-file <path>", "Run a persisted background delegation")
|
|
403
|
+
.option("--max-tool-rounds <n>", "Max tool execution rounds", "400")
|
|
404
|
+
.option("--batch-api", "Use xAI Batch API for model calls (async, lower cost)")
|
|
405
|
+
.option(
|
|
406
|
+
"--permission <mode>",
|
|
407
|
+
"Permission mode: safe (confirm all), auto-edit (auto-approve file ops), yolo (auto-approve all)",
|
|
408
|
+
"safe",
|
|
409
|
+
)
|
|
410
|
+
.option("--update", "Update muonroi-cli to the latest version and exit")
|
|
411
|
+
.option("--smoke-boot-only", "CI smoke: validate loadConfig + loadUsage and exit 0 — no keychain access")
|
|
412
|
+
.action(async (message: string[], options) => {
|
|
413
|
+
// CI smoke affordance — exit cleanly WITHOUT invoking the provider.
|
|
414
|
+
// Deliberately exits BEFORE provider key loading — CI runners have no keychain configured.
|
|
415
|
+
if (options.smokeBootOnly) {
|
|
416
|
+
const [_cfg, _usg] = await Promise.all([loadConfig(), loadUsage()]);
|
|
417
|
+
console.log("[muonroi-cli] smoke-boot-only — config + usage loaded; exiting 0.");
|
|
418
|
+
process.exit(0);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (options.update) {
|
|
422
|
+
console.log("Checking for updates...");
|
|
423
|
+
const result = await runUpdate(packageJson.version);
|
|
424
|
+
console.log(result.output);
|
|
425
|
+
process.exit(result.success ? 0 : 1);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
changeDirectoryOrExit(options.directory);
|
|
429
|
+
|
|
430
|
+
if (options.backgroundTaskFile) {
|
|
431
|
+
await runBackgroundDelegation(options.backgroundTaskFile, options);
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const config = resolveConfig(options);
|
|
436
|
+
|
|
437
|
+
// First-run wizard (interactive only, before any TUI code)
|
|
438
|
+
const isInteractive = !options.prompt && !options.verify && process.stdin.isTTY;
|
|
439
|
+
if (!config.apiKey && isInteractive) {
|
|
440
|
+
const wizardKey = await firstRunWizard();
|
|
441
|
+
if (wizardKey) {
|
|
442
|
+
saveUserSettings({ apiKey: wizardKey });
|
|
443
|
+
config.apiKey = wizardKey;
|
|
444
|
+
} else {
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Bootstrap EE auth (loads serverBaseUrl + token from ~/.experience/config.json)
|
|
450
|
+
const { loadEEAuthToken } = await import("./ee/auth.js");
|
|
451
|
+
await loadEEAuthToken().catch(() => {});
|
|
452
|
+
|
|
453
|
+
// Patch zod-to-json-schema for Zod v4 compat (fixes tool calls for DeepSeek etc.)
|
|
454
|
+
const { patchZodToJsonSchema } = await import("./providers/patch-zod-schema.js");
|
|
455
|
+
patchZodToJsonSchema();
|
|
456
|
+
|
|
457
|
+
// Boot model registry — load from centralized catalog (no provider API calls)
|
|
458
|
+
await loadCatalog().catch(() => {});
|
|
459
|
+
|
|
460
|
+
// If key exists but no models loaded → key is likely invalid
|
|
461
|
+
const { MODELS: loadedModels, getModelInfo: lookupModel } = await import("./models/registry.js");
|
|
462
|
+
if (config.apiKey && loadedModels.length === 0) {
|
|
463
|
+
console.error(
|
|
464
|
+
"\x1b[31mAPI key is invalid or expired. No models could be loaded.\x1b[0m\n" +
|
|
465
|
+
"Update your key:\n" +
|
|
466
|
+
" muonroi-cli -k YOUR_NEW_KEY\n" +
|
|
467
|
+
" # or: export MUONROI_API_KEY=YOUR_NEW_KEY\n" +
|
|
468
|
+
"\nGet a key at: https://console.anthropic.com/settings/keys",
|
|
469
|
+
);
|
|
470
|
+
process.exit(1);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// Validate configured model exists in loaded registry — fallback to first available
|
|
474
|
+
if (loadedModels.length > 0) {
|
|
475
|
+
const { getCurrentModel } = await import("./utils/settings.js");
|
|
476
|
+
const effectiveModel = config.model || getCurrentModel();
|
|
477
|
+
if (effectiveModel && !lookupModel(effectiveModel)) {
|
|
478
|
+
console.error(
|
|
479
|
+
`\x1b[31mModel "${effectiveModel}" is not available (may be retired or not in your plan).\x1b[0m\n`,
|
|
480
|
+
);
|
|
481
|
+
console.error("Available models:\n");
|
|
482
|
+
for (const m of loadedModels.slice(0, 15)) {
|
|
483
|
+
console.error(` \x1b[36m${m.id}\x1b[0m — ${m.name}`);
|
|
484
|
+
}
|
|
485
|
+
if (loadedModels.length > 15) {
|
|
486
|
+
console.error(` ... and ${loadedModels.length - 15} more (run \`muonroi-cli models\` to see all)`);
|
|
487
|
+
}
|
|
488
|
+
console.error(
|
|
489
|
+
"\n\x1b[33mSet your model:\x1b[0m\n" +
|
|
490
|
+
" muonroi-cli -m MODEL_ID\n" +
|
|
491
|
+
" # or add to ~/.muonroi-cli/user-settings.json:\n" +
|
|
492
|
+
' # { "defaultModel": "MODEL_ID" }\n',
|
|
493
|
+
);
|
|
494
|
+
process.exit(1);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (options.verify) {
|
|
499
|
+
const verifyError = getVerifyCliError({ hasPrompt: Boolean(options.prompt), hasMessageArgs: message.length > 0 });
|
|
500
|
+
if (verifyError) {
|
|
501
|
+
console.error(verifyError);
|
|
502
|
+
process.exit(1);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
await runHeadless(
|
|
506
|
+
buildVerifyPrompt(process.cwd()),
|
|
507
|
+
requireApiKey(config.apiKey),
|
|
508
|
+
config.baseURL,
|
|
509
|
+
config.model,
|
|
510
|
+
config.maxToolRounds,
|
|
511
|
+
options.batchApi === true,
|
|
512
|
+
config.sandboxMode,
|
|
513
|
+
config.sandboxSettings,
|
|
514
|
+
options.format,
|
|
515
|
+
options.session,
|
|
516
|
+
options.permission as PermissionMode,
|
|
517
|
+
);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (options.prompt) {
|
|
522
|
+
await runHeadless(
|
|
523
|
+
options.prompt,
|
|
524
|
+
requireApiKey(config.apiKey),
|
|
525
|
+
config.baseURL,
|
|
526
|
+
config.model,
|
|
527
|
+
config.maxToolRounds,
|
|
528
|
+
options.batchApi === true,
|
|
529
|
+
config.sandboxMode,
|
|
530
|
+
config.sandboxSettings,
|
|
531
|
+
options.format,
|
|
532
|
+
options.session,
|
|
533
|
+
options.permission as PermissionMode,
|
|
534
|
+
);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const initialMessage = message.length > 0 ? message.join(" ") : undefined;
|
|
539
|
+
await startInteractive(
|
|
540
|
+
config.apiKey,
|
|
541
|
+
config.baseURL,
|
|
542
|
+
config.model,
|
|
543
|
+
config.maxToolRounds,
|
|
544
|
+
options.batchApi === true,
|
|
545
|
+
config.sandboxMode,
|
|
546
|
+
config.sandboxSettings,
|
|
547
|
+
options.session,
|
|
548
|
+
initialMessage,
|
|
549
|
+
options.permission as PermissionMode,
|
|
550
|
+
);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
program
|
|
554
|
+
.command("models")
|
|
555
|
+
.description("List available models")
|
|
556
|
+
.action(async () => {
|
|
557
|
+
console.log("\nLoading model catalog...\n");
|
|
558
|
+
await loadCatalog();
|
|
559
|
+
const { MODELS } = await import("./models/registry.js");
|
|
560
|
+
for (const m of MODELS) {
|
|
561
|
+
const tags = [
|
|
562
|
+
m.reasoning ? "reasoning" : "non-reasoning",
|
|
563
|
+
m.multiAgent ? "multi-agent" : null,
|
|
564
|
+
m.responsesOnly ? "responses-only" : null,
|
|
565
|
+
].filter(Boolean);
|
|
566
|
+
const suffix = tags.length > 0 ? ` (${tags.join(", ")})` : "";
|
|
567
|
+
console.log(` \x1b[36m${m.id}\x1b[0m — ${m.name}${suffix}`);
|
|
568
|
+
console.log(
|
|
569
|
+
` ${m.description} | ${formatContext(m.contextWindow)} context | $${m.inputPrice}/$${m.outputPrice} per 1M tokens`,
|
|
570
|
+
);
|
|
571
|
+
if ((m.aliases?.length ?? 0) > 0) {
|
|
572
|
+
console.log(` aliases: ${(m.aliases ?? []).join(", ")}`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
console.log();
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
program
|
|
579
|
+
.command("update")
|
|
580
|
+
.description("Update muonroi-cli to the latest release")
|
|
581
|
+
.action(async () => {
|
|
582
|
+
console.log("Checking for updates...");
|
|
583
|
+
const result = await runUpdate(packageJson.version);
|
|
584
|
+
console.log(result.output);
|
|
585
|
+
process.exit(result.success ? 0 : 1);
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
program
|
|
589
|
+
.command("uninstall")
|
|
590
|
+
.description("Remove a script-installed muonroi-cli binary and optional data")
|
|
591
|
+
.option("--dry-run", "Show what would be removed without removing it")
|
|
592
|
+
.option("--force", "Skip the confirmation prompt")
|
|
593
|
+
.option("--keep-config", "Keep ~/.muonroi-cli config files")
|
|
594
|
+
.option("--keep-data", "Keep ~/.muonroi-cli data files")
|
|
595
|
+
.action(async (options) => {
|
|
596
|
+
const result = await runScriptManagedUninstall({
|
|
597
|
+
dryRun: options.dryRun === true,
|
|
598
|
+
force: options.force === true,
|
|
599
|
+
keepConfig: options.keepConfig === true,
|
|
600
|
+
keepData: options.keepData === true,
|
|
601
|
+
});
|
|
602
|
+
console.log(result.output);
|
|
603
|
+
process.exit(result.success ? 0 : 1);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
program
|
|
607
|
+
.command("daemon")
|
|
608
|
+
.description("Start the schedule daemon to run scheduled tasks")
|
|
609
|
+
.option("--background", "Detach and run in the background")
|
|
610
|
+
.action(async (options) => {
|
|
611
|
+
if (options.background) {
|
|
612
|
+
const result = await startScheduleDaemon(process.cwd());
|
|
613
|
+
console.log(
|
|
614
|
+
result.alreadyRunning
|
|
615
|
+
? `Schedule daemon already running (pid: ${result.status.pid ?? "unknown"}).`
|
|
616
|
+
: `Schedule daemon started in the background (pid: ${result.pid ?? "unknown"}).`,
|
|
617
|
+
);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
process.off("SIGTERM", exitCleanlyOnSigterm);
|
|
622
|
+
const { SchedulerDaemon } = await import("./daemon/scheduler");
|
|
623
|
+
const daemon = new SchedulerDaemon();
|
|
624
|
+
await daemon.start();
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
program
|
|
628
|
+
.command("doctor")
|
|
629
|
+
.description("Run health checks for muonroi-cli dependencies and services")
|
|
630
|
+
.action(async () => {
|
|
631
|
+
const { loadEEAuthToken } = await import("./ee/auth.js");
|
|
632
|
+
await loadEEAuthToken().catch(() => {});
|
|
633
|
+
const { runDoctor, formatDoctorReport } = await import("./ops/doctor.js");
|
|
634
|
+
const results = await runDoctor();
|
|
635
|
+
console.log("\nmuonroi-cli doctor\n");
|
|
636
|
+
console.log(formatDoctorReport(results, packageJson.version));
|
|
637
|
+
const hasFail = results.some((r) => r.status === "fail");
|
|
638
|
+
process.exit(hasFail ? 1 : 0);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
program
|
|
642
|
+
.command("bug-report")
|
|
643
|
+
.description("Generate anonymized diagnostic bundle for issue submission")
|
|
644
|
+
.action(async () => {
|
|
645
|
+
const { buildBugReport, formatBugReport } = await import("./ops/bug-report.js");
|
|
646
|
+
const bundle = await buildBugReport();
|
|
647
|
+
console.log(formatBugReport(bundle));
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
program.parse();
|
|
651
|
+
|
|
652
|
+
function formatContext(tokens: number): string {
|
|
653
|
+
if (tokens >= 1_000_000) return `${tokens / 1_000_000}M`;
|
|
654
|
+
return `${tokens / 1_000}K`;
|
|
655
|
+
}
|