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
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as os from "os";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import type { HooksConfig } from "../hooks/types";
|
|
5
|
+
import type {
|
|
6
|
+
LspBuiltInServerId,
|
|
7
|
+
LspBuiltInServerSettings,
|
|
8
|
+
LspCustomServerConfig,
|
|
9
|
+
LspSettings,
|
|
10
|
+
NormalizedLspSettings,
|
|
11
|
+
} from "../lsp/types";
|
|
12
|
+
import { getEffectiveReasoningEffort, getModelIds, normalizeModelId } from "../models/registry.js";
|
|
13
|
+
import type { AgentMode, ReasoningEffort } from "../types/index";
|
|
14
|
+
|
|
15
|
+
export type ModelRole = "leader" | "implement" | "verify" | "research";
|
|
16
|
+
|
|
17
|
+
const DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
18
|
+
|
|
19
|
+
export type TelegramStreamingMode = "off" | "partial";
|
|
20
|
+
export type SandboxMode = "off" | "shuru";
|
|
21
|
+
|
|
22
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. Wallet UI only. */
|
|
23
|
+
export type PaymentChain = "base" | "base-sepolia";
|
|
24
|
+
|
|
25
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. Wallet UI only. */
|
|
26
|
+
export interface PaymentApprovalSettings {
|
|
27
|
+
autoApprove?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. Wallet UI only. */
|
|
31
|
+
export interface PaymentSettings {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
chain?: PaymentChain;
|
|
34
|
+
approval?: PaymentApprovalSettings;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const DEFAULT_PAYMENT_SETTINGS: Required<PaymentSettings> = {
|
|
38
|
+
enabled: false,
|
|
39
|
+
chain: "base-sepolia",
|
|
40
|
+
approval: { autoApprove: false },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const DEFAULT_LSP_SETTINGS: NormalizedLspSettings = {
|
|
44
|
+
enabled: true,
|
|
45
|
+
tool: true,
|
|
46
|
+
autoInstall: false,
|
|
47
|
+
startupTimeoutMs: 30_000,
|
|
48
|
+
diagnosticsDebounceMs: 200,
|
|
49
|
+
builtins: {},
|
|
50
|
+
servers: [],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export interface SandboxSecretConfig {
|
|
54
|
+
name: string;
|
|
55
|
+
fromEnv: string;
|
|
56
|
+
hosts: string[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SandboxSettings {
|
|
60
|
+
allowNet?: boolean;
|
|
61
|
+
allowedHosts?: string[];
|
|
62
|
+
ports?: string[];
|
|
63
|
+
cpus?: number;
|
|
64
|
+
memory?: number;
|
|
65
|
+
diskSize?: number;
|
|
66
|
+
secrets?: SandboxSecretConfig[];
|
|
67
|
+
from?: string;
|
|
68
|
+
allowEphemeralInstall?: boolean;
|
|
69
|
+
guestWorkdir?: string;
|
|
70
|
+
syncHostWorkspace?: boolean;
|
|
71
|
+
verifyBaseFrom?: string;
|
|
72
|
+
shellInit?: string[];
|
|
73
|
+
hostBrowserCommandsOnHost?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface TelegramAudioInputSettings {
|
|
77
|
+
/** Enable Telegram voice/audio transcription before sending text to the agent. Default: true. */
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
/** Language code (e.g. `en`, `fr`) forwarded to the STT endpoint. Default: en. */
|
|
80
|
+
language?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface TelegramSettings {
|
|
84
|
+
botToken?: string;
|
|
85
|
+
approvedUserIds?: number[];
|
|
86
|
+
sessionsByUserId?: Record<string, string>;
|
|
87
|
+
/** Live preview while generating. Default: partial (send + edit). Use `off` for buffer-then-send only. */
|
|
88
|
+
streaming?: TelegramStreamingMode;
|
|
89
|
+
/** Send `typing` chat action on an interval while the agent runs. Default: true. */
|
|
90
|
+
typingIndicator?: boolean;
|
|
91
|
+
/** Reserved: Bot API `sendMessageDraft` for private DMs (not implemented yet). */
|
|
92
|
+
nativeDrafts?: boolean;
|
|
93
|
+
audioInput?: TelegramAudioInputSettings;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type McpRemoteTransport = "http" | "sse";
|
|
97
|
+
|
|
98
|
+
export interface McpServerConfig {
|
|
99
|
+
id: string;
|
|
100
|
+
label: string;
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
transport: McpRemoteTransport | "stdio";
|
|
103
|
+
url?: string;
|
|
104
|
+
headers?: Record<string, string>;
|
|
105
|
+
command?: string;
|
|
106
|
+
args?: string[];
|
|
107
|
+
env?: Record<string, string>;
|
|
108
|
+
cwd?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface McpSettings {
|
|
112
|
+
servers?: McpServerConfig[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface CustomSubagentConfig {
|
|
116
|
+
name: string;
|
|
117
|
+
model: string;
|
|
118
|
+
instruction: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const RESERVED_SUBAGENT_NAMES = new Set([
|
|
122
|
+
"general",
|
|
123
|
+
"explore",
|
|
124
|
+
"vision",
|
|
125
|
+
"verify",
|
|
126
|
+
"verify-detect",
|
|
127
|
+
"verify-manifest",
|
|
128
|
+
"computer",
|
|
129
|
+
]);
|
|
130
|
+
|
|
131
|
+
export function isReservedSubagentName(name: string): boolean {
|
|
132
|
+
return RESERVED_SUBAGENT_NAMES.has(name.trim().toLowerCase());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function parseSubAgentsRawList(raw: unknown): CustomSubagentConfig[] {
|
|
136
|
+
if (!Array.isArray(raw)) return [];
|
|
137
|
+
|
|
138
|
+
const validModels = new Set(getModelIds());
|
|
139
|
+
const seen = new Set<string>();
|
|
140
|
+
const agents: CustomSubagentConfig[] = [];
|
|
141
|
+
|
|
142
|
+
for (const item of raw) {
|
|
143
|
+
if (!item || typeof item !== "object") continue;
|
|
144
|
+
|
|
145
|
+
const entry = item as Record<string, unknown>;
|
|
146
|
+
const name = typeof entry.name === "string" ? entry.name.trim() : "";
|
|
147
|
+
const model = typeof entry.model === "string" ? normalizeModelId(entry.model) : "";
|
|
148
|
+
const instruction = typeof entry.instruction === "string" ? entry.instruction : "";
|
|
149
|
+
|
|
150
|
+
if (!name || isReservedSubagentName(name) || !validModels.has(model)) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const dedupeKey = name.toLowerCase();
|
|
155
|
+
if (seen.has(dedupeKey)) continue;
|
|
156
|
+
seen.add(dedupeKey);
|
|
157
|
+
|
|
158
|
+
agents.push({ name, model, instruction });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return agents;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function loadValidSubAgents(): CustomSubagentConfig[] {
|
|
165
|
+
return parseSubAgentsRawList(loadUserSettings().subAgents);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ProviderKeyConfig {
|
|
169
|
+
apiKey: string;
|
|
170
|
+
baseURL?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface UserSettings {
|
|
174
|
+
apiKey?: string;
|
|
175
|
+
defaultModel?: string;
|
|
176
|
+
sandboxMode?: SandboxMode;
|
|
177
|
+
sandbox?: SandboxSettings;
|
|
178
|
+
lsp?: LspSettings;
|
|
179
|
+
reasoningEffortByModel?: Record<string, ReasoningEffort>;
|
|
180
|
+
telegram?: TelegramSettings;
|
|
181
|
+
mcp?: McpSettings;
|
|
182
|
+
subAgents?: CustomSubagentConfig[];
|
|
183
|
+
hooks?: HooksConfig;
|
|
184
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. */
|
|
185
|
+
payments?: PaymentSettings;
|
|
186
|
+
modeModels?: Partial<Record<AgentMode, string>>;
|
|
187
|
+
ecosystem?: { name: string; patterns: string[] };
|
|
188
|
+
autoCompactAfterTurn?: boolean;
|
|
189
|
+
roleModels?: Partial<Record<ModelRole, string>>;
|
|
190
|
+
councilRounds?: number;
|
|
191
|
+
autoCouncil?: boolean;
|
|
192
|
+
providers?: {
|
|
193
|
+
anthropic?: ProviderKeyConfig;
|
|
194
|
+
openai?: ProviderKeyConfig;
|
|
195
|
+
google?: ProviderKeyConfig;
|
|
196
|
+
deepseek?: ProviderKeyConfig;
|
|
197
|
+
siliconflow?: ProviderKeyConfig;
|
|
198
|
+
xai?: ProviderKeyConfig;
|
|
199
|
+
ollama?: { baseURL?: string };
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface ProjectSettings {
|
|
204
|
+
model?: string;
|
|
205
|
+
sandboxMode?: SandboxMode;
|
|
206
|
+
sandbox?: SandboxSettings;
|
|
207
|
+
lsp?: LspSettings;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const USER_DIR = path.join(os.homedir(), ".muonroi-cli");
|
|
211
|
+
const USER_SETTINGS_PATH = path.join(USER_DIR, "user-settings.json");
|
|
212
|
+
|
|
213
|
+
function ensureDir(dir: string): void {
|
|
214
|
+
if (!fs.existsSync(dir)) {
|
|
215
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function readJson<T>(filePath: string): T | null {
|
|
220
|
+
try {
|
|
221
|
+
if (!fs.existsSync(filePath)) return null;
|
|
222
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8")) as T;
|
|
223
|
+
} catch {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function writeJson(filePath: string, data: unknown): void {
|
|
229
|
+
ensureDir(path.dirname(filePath));
|
|
230
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), { mode: 0o600 });
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function loadUserSettings(): UserSettings {
|
|
234
|
+
return readJson<UserSettings>(USER_SETTINGS_PATH) || {};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function saveUserSettings(partial: Partial<UserSettings>): void {
|
|
238
|
+
const current = loadUserSettings();
|
|
239
|
+
const next: UserSettings = {
|
|
240
|
+
...current,
|
|
241
|
+
...partial,
|
|
242
|
+
...(partial.apiKey !== undefined ? { apiKey: partial.apiKey } : {}),
|
|
243
|
+
...(partial.defaultModel !== undefined ? { defaultModel: normalizeModelId(partial.defaultModel) } : {}),
|
|
244
|
+
...(partial.sandboxMode !== undefined ? { sandboxMode: normalizeSandboxMode(partial.sandboxMode) } : {}),
|
|
245
|
+
...(partial.reasoningEffortByModel !== undefined
|
|
246
|
+
? {
|
|
247
|
+
reasoningEffortByModel: Object.fromEntries(
|
|
248
|
+
Object.entries(partial.reasoningEffortByModel).map(([modelId, effort]) => [
|
|
249
|
+
normalizeModelId(modelId),
|
|
250
|
+
effort,
|
|
251
|
+
]),
|
|
252
|
+
),
|
|
253
|
+
}
|
|
254
|
+
: {}),
|
|
255
|
+
...(partial.telegram !== undefined
|
|
256
|
+
? {
|
|
257
|
+
telegram: {
|
|
258
|
+
...current.telegram,
|
|
259
|
+
...partial.telegram,
|
|
260
|
+
audioInput: {
|
|
261
|
+
...current.telegram?.audioInput,
|
|
262
|
+
...partial.telegram?.audioInput,
|
|
263
|
+
},
|
|
264
|
+
sessionsByUserId: {
|
|
265
|
+
...current.telegram?.sessionsByUserId,
|
|
266
|
+
...partial.telegram?.sessionsByUserId,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
: {}),
|
|
271
|
+
...(partial.mcp !== undefined
|
|
272
|
+
? {
|
|
273
|
+
mcp: {
|
|
274
|
+
...current.mcp,
|
|
275
|
+
...partial.mcp,
|
|
276
|
+
servers: partial.mcp.servers ?? current.mcp?.servers ?? [],
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
: {}),
|
|
280
|
+
...(partial.subAgents !== undefined
|
|
281
|
+
? {
|
|
282
|
+
subAgents: partial.subAgents.map((agent) => ({
|
|
283
|
+
...agent,
|
|
284
|
+
model: normalizeModelId(agent.model),
|
|
285
|
+
})),
|
|
286
|
+
}
|
|
287
|
+
: {}),
|
|
288
|
+
...(partial.sandbox !== undefined
|
|
289
|
+
? { sandbox: normalizeSandboxSettings({ ...current.sandbox, ...partial.sandbox }) }
|
|
290
|
+
: {}),
|
|
291
|
+
...(partial.lsp !== undefined
|
|
292
|
+
? {
|
|
293
|
+
lsp: mergeLspSettings(current.lsp, partial.lsp),
|
|
294
|
+
}
|
|
295
|
+
: {}),
|
|
296
|
+
...(partial.payments !== undefined
|
|
297
|
+
? {
|
|
298
|
+
payments: {
|
|
299
|
+
...current.payments,
|
|
300
|
+
...partial.payments,
|
|
301
|
+
approval: {
|
|
302
|
+
...current.payments?.approval,
|
|
303
|
+
...partial.payments?.approval,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
: {}),
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
writeJson(USER_SETTINGS_PATH, next);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function loadProjectSettings(): ProjectSettings {
|
|
314
|
+
const projectPath = path.join(process.cwd(), ".muonroi-cli", "settings.json");
|
|
315
|
+
return readJson<ProjectSettings>(projectPath) || {};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export function saveProjectSettings(partial: Partial<ProjectSettings>): void {
|
|
319
|
+
const projectPath = path.join(process.cwd(), ".muonroi-cli", "settings.json");
|
|
320
|
+
const current = loadProjectSettings();
|
|
321
|
+
writeJson(projectPath, {
|
|
322
|
+
...current,
|
|
323
|
+
...partial,
|
|
324
|
+
...(partial.model !== undefined ? { model: normalizeModelId(partial.model) } : {}),
|
|
325
|
+
...(partial.sandboxMode !== undefined ? { sandboxMode: normalizeSandboxMode(partial.sandboxMode) } : {}),
|
|
326
|
+
...(partial.sandbox !== undefined
|
|
327
|
+
? { sandbox: normalizeSandboxSettings({ ...current.sandbox, ...partial.sandbox }) }
|
|
328
|
+
: {}),
|
|
329
|
+
...(partial.lsp !== undefined
|
|
330
|
+
? {
|
|
331
|
+
lsp: mergeLspSettings(current.lsp, partial.lsp),
|
|
332
|
+
}
|
|
333
|
+
: {}),
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export function getApiKey(): string | undefined {
|
|
338
|
+
return process.env.MUONROI_API_KEY || loadUserSettings().apiKey;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const DEFAULT_BASE_URLS: Record<string, string> = {
|
|
342
|
+
anthropic: "https://api.anthropic.com",
|
|
343
|
+
openai: "https://api.openai.com/v1",
|
|
344
|
+
google: "https://generativelanguage.googleapis.com/v1beta",
|
|
345
|
+
deepseek: "https://api.deepseek.com",
|
|
346
|
+
siliconflow: "https://api.siliconflow.cn/v1",
|
|
347
|
+
xai: "https://api.x.ai/v1",
|
|
348
|
+
ollama: "http://localhost:11434",
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export function getBaseURL(provider?: string): string {
|
|
352
|
+
if (process.env.MUONROI_BASE_URL) return process.env.MUONROI_BASE_URL;
|
|
353
|
+
return DEFAULT_BASE_URLS[provider ?? "anthropic"] ?? "https://api.anthropic.com";
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Build provider configs for adapter creation.
|
|
358
|
+
* Reads env vars + user-settings.json providers section.
|
|
359
|
+
* Anthropic uses the main apiKey; others use providers.* keys.
|
|
360
|
+
*/
|
|
361
|
+
export function getProviderConfigs(mainApiKey?: string): Record<string, { apiKey?: string; baseURL?: string; model?: string }> {
|
|
362
|
+
const settings = loadUserSettings();
|
|
363
|
+
const p = settings.providers ?? {};
|
|
364
|
+
|
|
365
|
+
const configs: Record<string, { apiKey?: string; baseURL?: string; model?: string }> = {};
|
|
366
|
+
|
|
367
|
+
// Anthropic — main API key
|
|
368
|
+
const anthropicKey = mainApiKey ?? getApiKey();
|
|
369
|
+
if (anthropicKey) {
|
|
370
|
+
configs.anthropic = { apiKey: anthropicKey, baseURL: getBaseURL() };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// OpenAI
|
|
374
|
+
const openaiKey = process.env.OPENAI_API_KEY ?? p.openai?.apiKey;
|
|
375
|
+
if (openaiKey) {
|
|
376
|
+
configs.openai = { apiKey: openaiKey, baseURL: p.openai?.baseURL };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Google Gemini
|
|
380
|
+
const googleKey = process.env.GOOGLE_API_KEY ?? p.google?.apiKey;
|
|
381
|
+
if (googleKey) {
|
|
382
|
+
configs.google = { apiKey: googleKey, baseURL: p.google?.baseURL };
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// DeepSeek
|
|
386
|
+
const deepseekKey = process.env.DEEPSEEK_API_KEY ?? p.deepseek?.apiKey;
|
|
387
|
+
if (deepseekKey) {
|
|
388
|
+
configs.deepseek = {
|
|
389
|
+
apiKey: deepseekKey,
|
|
390
|
+
baseURL: p.deepseek?.baseURL ?? "https://api.deepseek.com",
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// SiliconFlow
|
|
395
|
+
const siliconflowKey = process.env.SILICONFLOW_API_KEY ?? p.siliconflow?.apiKey;
|
|
396
|
+
if (siliconflowKey) {
|
|
397
|
+
configs.siliconflow = {
|
|
398
|
+
apiKey: siliconflowKey,
|
|
399
|
+
baseURL: p.siliconflow?.baseURL ?? "https://api.siliconflow.cn/v1",
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// xAI / Grok (OpenAI-compatible)
|
|
404
|
+
const xaiKey = process.env.XAI_API_KEY ?? p.xai?.apiKey;
|
|
405
|
+
if (xaiKey) {
|
|
406
|
+
configs.xai = {
|
|
407
|
+
apiKey: xaiKey,
|
|
408
|
+
baseURL: p.xai?.baseURL ?? "https://api.x.ai/v1",
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Ollama — no key needed, just baseURL
|
|
413
|
+
const ollamaURL = process.env.OLLAMA_URL ?? p.ollama?.baseURL ?? "http://localhost:11434";
|
|
414
|
+
configs.ollama = { baseURL: ollamaURL };
|
|
415
|
+
|
|
416
|
+
return configs;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function getCurrentModel(mode?: AgentMode): string {
|
|
420
|
+
const envModel = process.env.MUONROI_MODEL;
|
|
421
|
+
if (envModel) return normalizeModelId(envModel);
|
|
422
|
+
|
|
423
|
+
const project = loadProjectSettings();
|
|
424
|
+
if (project.model) return normalizeModelId(project.model);
|
|
425
|
+
|
|
426
|
+
if (mode) {
|
|
427
|
+
const user = loadUserSettings();
|
|
428
|
+
const modeModel = user.modeModels?.[mode];
|
|
429
|
+
if (modeModel) {
|
|
430
|
+
return normalizeModelId(modeModel);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const user = loadUserSettings();
|
|
435
|
+
return user.defaultModel ? normalizeModelId(user.defaultModel) : DEFAULT_MODEL;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Returns the explicitly configured model for a mode, or undefined if none is set.
|
|
440
|
+
* Only MUONROI_MODEL env var suppresses this (absolute override). Project-level model
|
|
441
|
+
* does NOT suppress — modeModels is an explicit per-mode config that applies on mode switch.
|
|
442
|
+
*/
|
|
443
|
+
export function getModeSpecificModel(mode: AgentMode): string | undefined {
|
|
444
|
+
if (process.env.MUONROI_MODEL) return undefined;
|
|
445
|
+
|
|
446
|
+
const user = loadUserSettings();
|
|
447
|
+
const modeModel = user.modeModels?.[mode];
|
|
448
|
+
return modeModel ? normalizeModelId(modeModel) : undefined;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export function normalizeSandboxMode(value: unknown): SandboxMode {
|
|
452
|
+
return value === "shuru" ? "shuru" : "off";
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function isNonNullObject(v: unknown): v is Record<string, unknown> {
|
|
456
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function normalizeSecretConfig(raw: unknown): SandboxSecretConfig | null {
|
|
460
|
+
if (!isNonNullObject(raw)) return null;
|
|
461
|
+
const name = typeof raw.name === "string" ? raw.name.trim() : "";
|
|
462
|
+
const fromEnv = typeof raw.fromEnv === "string" ? raw.fromEnv.trim() : "";
|
|
463
|
+
const hosts = Array.isArray(raw.hosts)
|
|
464
|
+
? raw.hosts.filter((h): h is string => typeof h === "string" && h.trim() !== "")
|
|
465
|
+
: [];
|
|
466
|
+
if (!name || !fromEnv) return null;
|
|
467
|
+
return { name, fromEnv, hosts };
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export function normalizeSandboxSettings(raw: unknown): SandboxSettings {
|
|
471
|
+
if (!isNonNullObject(raw)) return {};
|
|
472
|
+
const result: SandboxSettings = {};
|
|
473
|
+
|
|
474
|
+
if (typeof raw.allowNet === "boolean") result.allowNet = raw.allowNet;
|
|
475
|
+
if (Array.isArray(raw.allowedHosts)) {
|
|
476
|
+
const hosts = raw.allowedHosts.filter((h): h is string => typeof h === "string" && h.trim() !== "");
|
|
477
|
+
if (hosts.length > 0) result.allowedHosts = hosts;
|
|
478
|
+
}
|
|
479
|
+
if (Array.isArray(raw.ports)) {
|
|
480
|
+
const ports = raw.ports.filter((p): p is string => typeof p === "string" && /^\d+:\d+$/.test(p.trim()));
|
|
481
|
+
if (ports.length > 0) result.ports = ports;
|
|
482
|
+
}
|
|
483
|
+
if (typeof raw.cpus === "number" && raw.cpus > 0) result.cpus = raw.cpus;
|
|
484
|
+
if (typeof raw.memory === "number" && raw.memory > 0) result.memory = raw.memory;
|
|
485
|
+
if (typeof raw.diskSize === "number" && raw.diskSize > 0) result.diskSize = raw.diskSize;
|
|
486
|
+
if (Array.isArray(raw.secrets)) {
|
|
487
|
+
const secrets = raw.secrets.map(normalizeSecretConfig).filter((s): s is SandboxSecretConfig => s !== null);
|
|
488
|
+
if (secrets.length > 0) result.secrets = secrets;
|
|
489
|
+
}
|
|
490
|
+
if (typeof raw.from === "string" && raw.from.trim()) result.from = raw.from.trim();
|
|
491
|
+
if (typeof raw.verifyBaseFrom === "string" && raw.verifyBaseFrom.trim())
|
|
492
|
+
result.verifyBaseFrom = raw.verifyBaseFrom.trim();
|
|
493
|
+
if (typeof raw.allowEphemeralInstall === "boolean") result.allowEphemeralInstall = raw.allowEphemeralInstall;
|
|
494
|
+
if (typeof raw.syncHostWorkspace === "boolean") result.syncHostWorkspace = raw.syncHostWorkspace;
|
|
495
|
+
if (typeof raw.guestWorkdir === "string" && raw.guestWorkdir.trim()) result.guestWorkdir = raw.guestWorkdir.trim();
|
|
496
|
+
if (Array.isArray(raw.shellInit)) {
|
|
497
|
+
const shellInit = raw.shellInit.filter((line): line is string => typeof line === "string" && line.trim() !== "");
|
|
498
|
+
if (shellInit.length > 0) result.shellInit = shellInit;
|
|
499
|
+
}
|
|
500
|
+
if (typeof raw.hostBrowserCommandsOnHost === "boolean")
|
|
501
|
+
result.hostBrowserCommandsOnHost = raw.hostBrowserCommandsOnHost;
|
|
502
|
+
|
|
503
|
+
return result;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export function mergeSandboxSettings(
|
|
507
|
+
base: SandboxSettings | undefined,
|
|
508
|
+
override: SandboxSettings | undefined,
|
|
509
|
+
): SandboxSettings {
|
|
510
|
+
if (!base && !override) return {};
|
|
511
|
+
if (!base) return { ...override };
|
|
512
|
+
if (!override) return { ...base };
|
|
513
|
+
return {
|
|
514
|
+
allowNet: override.allowNet ?? base.allowNet,
|
|
515
|
+
allowedHosts: override.allowedHosts ?? base.allowedHosts,
|
|
516
|
+
ports: override.ports ?? base.ports,
|
|
517
|
+
cpus: override.cpus ?? base.cpus,
|
|
518
|
+
memory: override.memory ?? base.memory,
|
|
519
|
+
diskSize: override.diskSize ?? base.diskSize,
|
|
520
|
+
secrets: override.secrets ?? base.secrets,
|
|
521
|
+
from: override.from ?? base.from,
|
|
522
|
+
allowEphemeralInstall: override.allowEphemeralInstall ?? base.allowEphemeralInstall,
|
|
523
|
+
guestWorkdir: override.guestWorkdir ?? base.guestWorkdir,
|
|
524
|
+
syncHostWorkspace: override.syncHostWorkspace ?? base.syncHostWorkspace,
|
|
525
|
+
verifyBaseFrom: override.verifyBaseFrom ?? base.verifyBaseFrom,
|
|
526
|
+
shellInit: override.shellInit ?? base.shellInit,
|
|
527
|
+
hostBrowserCommandsOnHost: override.hostBrowserCommandsOnHost ?? base.hostBrowserCommandsOnHost,
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function normalizeLspBuiltInServerSettings(raw: unknown): LspBuiltInServerSettings | undefined {
|
|
532
|
+
if (!isNonNullObject(raw)) return undefined;
|
|
533
|
+
const result: LspBuiltInServerSettings = {};
|
|
534
|
+
|
|
535
|
+
if (typeof raw.enabled === "boolean") result.enabled = raw.enabled;
|
|
536
|
+
if (typeof raw.command === "string" && raw.command.trim()) result.command = raw.command.trim();
|
|
537
|
+
if (Array.isArray(raw.args)) {
|
|
538
|
+
const args = raw.args.filter((value): value is string => typeof value === "string");
|
|
539
|
+
if (args.length > 0) result.args = args;
|
|
540
|
+
}
|
|
541
|
+
if (isNonNullObject(raw.env)) {
|
|
542
|
+
const envEntries = Object.entries(raw.env).filter(
|
|
543
|
+
(entry): entry is [string, string] => typeof entry[1] === "string",
|
|
544
|
+
);
|
|
545
|
+
const env = Object.fromEntries(envEntries);
|
|
546
|
+
if (Object.keys(env).length > 0) result.env = env;
|
|
547
|
+
}
|
|
548
|
+
if (isNonNullObject(raw.initialization)) {
|
|
549
|
+
result.initialization = raw.initialization;
|
|
550
|
+
}
|
|
551
|
+
if (Array.isArray(raw.rootMarkers)) {
|
|
552
|
+
const rootMarkers = raw.rootMarkers.filter(
|
|
553
|
+
(value): value is string => typeof value === "string" && value.trim() !== "",
|
|
554
|
+
);
|
|
555
|
+
if (rootMarkers.length > 0) result.rootMarkers = rootMarkers;
|
|
556
|
+
}
|
|
557
|
+
if (Array.isArray(raw.extensions)) {
|
|
558
|
+
const extensions = raw.extensions.filter(
|
|
559
|
+
(value): value is string => typeof value === "string" && value.trim() !== "",
|
|
560
|
+
);
|
|
561
|
+
if (extensions.length > 0) result.extensions = extensions;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function normalizeLspCustomServerConfig(raw: unknown): LspCustomServerConfig | null {
|
|
568
|
+
if (!isNonNullObject(raw)) return null;
|
|
569
|
+
const id = typeof raw.id === "string" ? raw.id.trim() : "";
|
|
570
|
+
const command = typeof raw.command === "string" ? raw.command.trim() : "";
|
|
571
|
+
const extensions = Array.isArray(raw.extensions)
|
|
572
|
+
? raw.extensions.filter((value): value is string => typeof value === "string" && value.trim() !== "")
|
|
573
|
+
: [];
|
|
574
|
+
if (!id || !command || extensions.length === 0) return null;
|
|
575
|
+
|
|
576
|
+
const result: LspCustomServerConfig = {
|
|
577
|
+
id,
|
|
578
|
+
command,
|
|
579
|
+
extensions,
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
if (typeof raw.enabled === "boolean") result.enabled = raw.enabled;
|
|
583
|
+
if (Array.isArray(raw.args)) {
|
|
584
|
+
result.args = raw.args.filter((value): value is string => typeof value === "string");
|
|
585
|
+
}
|
|
586
|
+
if (isNonNullObject(raw.env)) {
|
|
587
|
+
result.env = Object.fromEntries(
|
|
588
|
+
Object.entries(raw.env).filter((entry): entry is [string, string] => typeof entry[1] === "string"),
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
if (isNonNullObject(raw.initialization)) {
|
|
592
|
+
result.initialization = raw.initialization;
|
|
593
|
+
}
|
|
594
|
+
if (Array.isArray(raw.rootMarkers)) {
|
|
595
|
+
result.rootMarkers = raw.rootMarkers.filter(
|
|
596
|
+
(value): value is string => typeof value === "string" && value.trim() !== "",
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
if (isNonNullObject(raw.languageIds)) {
|
|
600
|
+
result.languageIds = Object.fromEntries(
|
|
601
|
+
Object.entries(raw.languageIds)
|
|
602
|
+
.filter((entry): entry is [string, string] => typeof entry[1] === "string" && entry[0].trim() !== "")
|
|
603
|
+
.map(([key, value]) => [key.trim(), value]),
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return result;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export function normalizeLspSettings(raw: unknown): NormalizedLspSettings {
|
|
611
|
+
if (!isNonNullObject(raw)) return { ...DEFAULT_LSP_SETTINGS };
|
|
612
|
+
|
|
613
|
+
const builtins: Partial<Record<LspBuiltInServerId, LspBuiltInServerSettings>> = {};
|
|
614
|
+
if (isNonNullObject(raw.builtins)) {
|
|
615
|
+
for (const [key, value] of Object.entries(raw.builtins)) {
|
|
616
|
+
const normalized = normalizeLspBuiltInServerSettings(value);
|
|
617
|
+
if (!normalized) continue;
|
|
618
|
+
builtins[key as LspBuiltInServerId] = normalized;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return {
|
|
623
|
+
enabled: typeof raw.enabled === "boolean" ? raw.enabled : DEFAULT_LSP_SETTINGS.enabled,
|
|
624
|
+
tool: typeof raw.tool === "boolean" ? raw.tool : DEFAULT_LSP_SETTINGS.tool,
|
|
625
|
+
autoInstall: typeof raw.autoInstall === "boolean" ? raw.autoInstall : DEFAULT_LSP_SETTINGS.autoInstall,
|
|
626
|
+
startupTimeoutMs:
|
|
627
|
+
typeof raw.startupTimeoutMs === "number" && raw.startupTimeoutMs > 0
|
|
628
|
+
? raw.startupTimeoutMs
|
|
629
|
+
: DEFAULT_LSP_SETTINGS.startupTimeoutMs,
|
|
630
|
+
diagnosticsDebounceMs:
|
|
631
|
+
typeof raw.diagnosticsDebounceMs === "number" && raw.diagnosticsDebounceMs >= 0
|
|
632
|
+
? raw.diagnosticsDebounceMs
|
|
633
|
+
: DEFAULT_LSP_SETTINGS.diagnosticsDebounceMs,
|
|
634
|
+
builtins,
|
|
635
|
+
servers: Array.isArray(raw.servers)
|
|
636
|
+
? raw.servers
|
|
637
|
+
.map(normalizeLspCustomServerConfig)
|
|
638
|
+
.filter((value): value is LspCustomServerConfig => value !== null)
|
|
639
|
+
: [],
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export function mergeLspSettings(
|
|
644
|
+
base: LspSettings | undefined,
|
|
645
|
+
override: LspSettings | undefined,
|
|
646
|
+
): NormalizedLspSettings {
|
|
647
|
+
const baseNormalized = normalizeLspSettings(base);
|
|
648
|
+
const overrideNormalized = normalizeLspSettings(override);
|
|
649
|
+
|
|
650
|
+
return {
|
|
651
|
+
enabled: override?.enabled ?? base?.enabled ?? DEFAULT_LSP_SETTINGS.enabled,
|
|
652
|
+
tool: override?.tool ?? base?.tool ?? DEFAULT_LSP_SETTINGS.tool,
|
|
653
|
+
autoInstall: override?.autoInstall ?? base?.autoInstall ?? DEFAULT_LSP_SETTINGS.autoInstall,
|
|
654
|
+
startupTimeoutMs: override?.startupTimeoutMs ?? base?.startupTimeoutMs ?? DEFAULT_LSP_SETTINGS.startupTimeoutMs,
|
|
655
|
+
diagnosticsDebounceMs:
|
|
656
|
+
override?.diagnosticsDebounceMs ?? base?.diagnosticsDebounceMs ?? DEFAULT_LSP_SETTINGS.diagnosticsDebounceMs,
|
|
657
|
+
builtins: {
|
|
658
|
+
...baseNormalized.builtins,
|
|
659
|
+
...overrideNormalized.builtins,
|
|
660
|
+
},
|
|
661
|
+
servers:
|
|
662
|
+
override?.servers !== undefined
|
|
663
|
+
? overrideNormalized.servers
|
|
664
|
+
: base?.servers !== undefined
|
|
665
|
+
? baseNormalized.servers
|
|
666
|
+
: DEFAULT_LSP_SETTINGS.servers,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export function getCurrentSandboxMode(): SandboxMode {
|
|
671
|
+
const project = loadProjectSettings();
|
|
672
|
+
if (project.sandboxMode) return normalizeSandboxMode(project.sandboxMode);
|
|
673
|
+
const user = loadUserSettings();
|
|
674
|
+
if (user.sandboxMode) return normalizeSandboxMode(user.sandboxMode);
|
|
675
|
+
return "off";
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export function getCurrentSandboxSettings(): SandboxSettings {
|
|
679
|
+
const user = loadUserSettings();
|
|
680
|
+
const project = loadProjectSettings();
|
|
681
|
+
return mergeSandboxSettings(user.sandbox, project.sandbox);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export function getCurrentLspSettings(): NormalizedLspSettings {
|
|
685
|
+
const user = loadUserSettings();
|
|
686
|
+
const project = loadProjectSettings();
|
|
687
|
+
return mergeLspSettings(user.lsp, project.lsp);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
export function getReasoningEffortForModel(modelId: string): ReasoningEffort | undefined {
|
|
691
|
+
const normalizedModelId = normalizeModelId(modelId);
|
|
692
|
+
const savedEfforts = loadUserSettings().reasoningEffortByModel ?? {};
|
|
693
|
+
const effort =
|
|
694
|
+
savedEfforts[normalizedModelId] ??
|
|
695
|
+
Object.entries(savedEfforts).find(([savedModelId]) => normalizeModelId(savedModelId) === normalizedModelId)?.[1];
|
|
696
|
+
return getEffectiveReasoningEffort(normalizedModelId, effort);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export function getTelegramBotToken(): string | undefined {
|
|
700
|
+
const env = process.env.TELEGRAM_BOT_TOKEN?.trim();
|
|
701
|
+
if (env) return env;
|
|
702
|
+
return loadUserSettings().telegram?.botToken?.trim();
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export function saveApprovedTelegramUserId(userId: number): void {
|
|
706
|
+
const settings = loadUserSettings();
|
|
707
|
+
const approvedUserIds = new Set(settings.telegram?.approvedUserIds ?? []);
|
|
708
|
+
approvedUserIds.add(userId);
|
|
709
|
+
saveUserSettings({
|
|
710
|
+
telegram: {
|
|
711
|
+
...settings.telegram,
|
|
712
|
+
approvedUserIds: [...approvedUserIds],
|
|
713
|
+
},
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export function resolveTelegramStreamSettings(t: TelegramSettings | undefined): {
|
|
718
|
+
streaming: TelegramStreamingMode;
|
|
719
|
+
typingIndicator: boolean;
|
|
720
|
+
nativeDrafts: boolean;
|
|
721
|
+
} {
|
|
722
|
+
return {
|
|
723
|
+
streaming: t?.streaming === "off" ? "off" : "partial",
|
|
724
|
+
typingIndicator: t?.typingIndicator !== false,
|
|
725
|
+
nativeDrafts: t?.nativeDrafts === true,
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export function resolveTelegramAudioInputSettings(t: TelegramSettings | undefined): {
|
|
730
|
+
enabled: boolean;
|
|
731
|
+
language: string;
|
|
732
|
+
} {
|
|
733
|
+
return {
|
|
734
|
+
enabled: t?.audioInput?.enabled !== false,
|
|
735
|
+
language: t?.audioInput?.language?.trim() || "en",
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export function loadMcpServers(): McpServerConfig[] {
|
|
740
|
+
return loadUserSettings().mcp?.servers ?? [];
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export function saveMcpServers(servers: McpServerConfig[]): void {
|
|
744
|
+
saveUserSettings({ mcp: { servers } });
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. Wallet UI only. */
|
|
748
|
+
export function loadPaymentSettings(): Required<PaymentSettings> {
|
|
749
|
+
const payments = loadUserSettings().payments;
|
|
750
|
+
return {
|
|
751
|
+
enabled: payments?.enabled ?? DEFAULT_PAYMENT_SETTINGS.enabled,
|
|
752
|
+
chain:
|
|
753
|
+
payments?.chain === "base" || payments?.chain === "base-sepolia"
|
|
754
|
+
? payments.chain
|
|
755
|
+
: DEFAULT_PAYMENT_SETTINGS.chain,
|
|
756
|
+
approval: {
|
|
757
|
+
autoApprove: payments?.approval?.autoApprove ?? DEFAULT_PAYMENT_SETTINGS.approval.autoApprove,
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/** @deprecated Phase 4 will replace with LemonSqueezy billing. Wallet UI only. */
|
|
763
|
+
export function savePaymentSettings(partial: PaymentSettings): void {
|
|
764
|
+
saveUserSettings({ payments: partial });
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export function isAutoCompactAfterTurnEnabled(): boolean {
|
|
768
|
+
return loadUserSettings().autoCompactAfterTurn ?? true;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export function getRoleModel(role: ModelRole): string | undefined {
|
|
772
|
+
return loadUserSettings().roleModels?.[role];
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export function getRoleModels(): Partial<Record<ModelRole, string>> {
|
|
776
|
+
return loadUserSettings().roleModels ?? {};
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
export function getCouncilRounds(): number {
|
|
780
|
+
const r = loadUserSettings().councilRounds;
|
|
781
|
+
return typeof r === "number" && r >= 1 ? Math.min(r, 5) : 3;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export function isAutoCouncilEnabled(): boolean {
|
|
785
|
+
return loadUserSettings().autoCouncil ?? true;
|
|
786
|
+
}
|
|
787
|
+
|