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,121 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { AUTO_EDIT_ALLOWED, toolNeedsApproval } from "./permission-mode.js";
|
|
3
|
+
|
|
4
|
+
describe("toolNeedsApproval", () => {
|
|
5
|
+
// safe mode: always requires approval for every tool
|
|
6
|
+
describe("safe mode", () => {
|
|
7
|
+
it("requires approval for read_file in safe mode", () => {
|
|
8
|
+
expect(toolNeedsApproval("read_file", "safe")).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("requires approval for write_file in safe mode", () => {
|
|
12
|
+
expect(toolNeedsApproval("write_file", "safe")).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("requires approval for edit_file in safe mode", () => {
|
|
16
|
+
expect(toolNeedsApproval("edit_file", "safe")).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("requires approval for grep in safe mode", () => {
|
|
20
|
+
expect(toolNeedsApproval("grep", "safe")).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("requires approval for list_directory in safe mode", () => {
|
|
24
|
+
expect(toolNeedsApproval("list_directory", "safe")).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("requires approval for bash in safe mode", () => {
|
|
28
|
+
expect(toolNeedsApproval("bash", "safe")).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("requires approval for task in safe mode", () => {
|
|
32
|
+
expect(toolNeedsApproval("task", "safe")).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("requires approval for computer_click in safe mode", () => {
|
|
36
|
+
expect(toolNeedsApproval("computer_click", "safe")).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("requires approval for an arbitrary MCP tool in safe mode", () => {
|
|
40
|
+
expect(toolNeedsApproval("mcp_some_tool", "safe")).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// auto-edit mode: file ops auto-approved, bash/task/computer_* require approval
|
|
45
|
+
describe("auto-edit mode", () => {
|
|
46
|
+
it("auto-approves read_file in auto-edit mode", () => {
|
|
47
|
+
expect(toolNeedsApproval("read_file", "auto-edit")).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("auto-approves write_file in auto-edit mode", () => {
|
|
51
|
+
expect(toolNeedsApproval("write_file", "auto-edit")).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("auto-approves edit_file in auto-edit mode", () => {
|
|
55
|
+
expect(toolNeedsApproval("edit_file", "auto-edit")).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("auto-approves grep in auto-edit mode", () => {
|
|
59
|
+
expect(toolNeedsApproval("grep", "auto-edit")).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("auto-approves list_directory in auto-edit mode", () => {
|
|
63
|
+
expect(toolNeedsApproval("list_directory", "auto-edit")).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("requires approval for bash in auto-edit mode", () => {
|
|
67
|
+
expect(toolNeedsApproval("bash", "auto-edit")).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("requires approval for task in auto-edit mode", () => {
|
|
71
|
+
expect(toolNeedsApproval("task", "auto-edit")).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("requires approval for computer_click in auto-edit mode", () => {
|
|
75
|
+
expect(toolNeedsApproval("computer_click", "auto-edit")).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("requires approval for an arbitrary MCP tool in auto-edit mode", () => {
|
|
79
|
+
expect(toolNeedsApproval("mcp_some_tool", "auto-edit")).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// yolo mode: auto-approves everything
|
|
84
|
+
describe("yolo mode", () => {
|
|
85
|
+
it("auto-approves bash in yolo mode", () => {
|
|
86
|
+
expect(toolNeedsApproval("bash", "yolo")).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("auto-approves read_file in yolo mode", () => {
|
|
90
|
+
expect(toolNeedsApproval("read_file", "yolo")).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("auto-approves computer_click in yolo mode", () => {
|
|
94
|
+
expect(toolNeedsApproval("computer_click", "yolo")).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("auto-approves task in yolo mode", () => {
|
|
98
|
+
expect(toolNeedsApproval("task", "yolo")).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("auto-approves any arbitrary tool name in yolo mode", () => {
|
|
102
|
+
expect(toolNeedsApproval("anything_at_all", "yolo")).toBe(false);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("AUTO_EDIT_ALLOWED", () => {
|
|
108
|
+
it("contains the expected auto-approved tools", () => {
|
|
109
|
+
expect(AUTO_EDIT_ALLOWED.has("read_file")).toBe(true);
|
|
110
|
+
expect(AUTO_EDIT_ALLOWED.has("write_file")).toBe(true);
|
|
111
|
+
expect(AUTO_EDIT_ALLOWED.has("edit_file")).toBe(true);
|
|
112
|
+
expect(AUTO_EDIT_ALLOWED.has("grep")).toBe(true);
|
|
113
|
+
expect(AUTO_EDIT_ALLOWED.has("list_directory")).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("does NOT contain bash, task, or computer tools", () => {
|
|
117
|
+
expect(AUTO_EDIT_ALLOWED.has("bash")).toBe(false);
|
|
118
|
+
expect(AUTO_EDIT_ALLOWED.has("task")).toBe(false);
|
|
119
|
+
expect(AUTO_EDIT_ALLOWED.has("computer_click")).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission mode controls which tool calls require manual approval before execution.
|
|
3
|
+
*
|
|
4
|
+
* safe - Every tool call prompts the user for approval.
|
|
5
|
+
* auto-edit - File operation tools (read/write/edit/grep/list) auto-approve;
|
|
6
|
+
* shell execution and computer tools still require confirmation.
|
|
7
|
+
* yolo - All tool calls auto-approve without any prompting.
|
|
8
|
+
*/
|
|
9
|
+
export type PermissionMode = "safe" | "auto-edit" | "yolo";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Set of tool names that are auto-approved in auto-edit mode.
|
|
13
|
+
* These are read/write file operations that are considered safe to run
|
|
14
|
+
* without manual confirmation when the user has opted into auto-edit mode.
|
|
15
|
+
*/
|
|
16
|
+
export const AUTO_EDIT_ALLOWED: ReadonlySet<string> = new Set([
|
|
17
|
+
"read_file",
|
|
18
|
+
"write_file",
|
|
19
|
+
"edit_file",
|
|
20
|
+
"grep",
|
|
21
|
+
"list_directory",
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if the given tool call requires manual user approval
|
|
26
|
+
* under the specified permission mode.
|
|
27
|
+
*
|
|
28
|
+
* @param toolName - The name of the tool being invoked.
|
|
29
|
+
* @param mode - The active PermissionMode.
|
|
30
|
+
* @returns true if the tool needs user approval, false if it should auto-approve.
|
|
31
|
+
*/
|
|
32
|
+
export function toolNeedsApproval(toolName: string, mode: PermissionMode): boolean {
|
|
33
|
+
if (mode === "yolo") return false;
|
|
34
|
+
if (mode === "auto-edit") return !AUTO_EDIT_ALLOWED.has(toolName);
|
|
35
|
+
// "safe" — always confirm
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
// Import the module under test — will fail until src/utils/redactor.ts is created
|
|
4
|
+
import { redactor } from "./redactor";
|
|
5
|
+
|
|
6
|
+
describe("Redactor — Layer 1: static regex scrubbing", () => {
|
|
7
|
+
it("Test 1: redacts sk-ant-* bearer token from string", () => {
|
|
8
|
+
const input = "Bearer sk-ant-1234567890abcdefghij";
|
|
9
|
+
const result = redactor.redact(input);
|
|
10
|
+
expect(result).not.toContain("sk-ant-1234567890abcdefghij");
|
|
11
|
+
expect(result).toContain("***REDACTED***");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("Test 2: redacts JWT triple-segment shape from Authorization header", () => {
|
|
15
|
+
const input = "Authorization: Bearer eyJabc.def.ghi";
|
|
16
|
+
const result = redactor.redact(input);
|
|
17
|
+
expect(result).not.toContain("eyJabc.def.ghi");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("Test 3: redacts ANTHROPIC_API_KEY env var pattern", () => {
|
|
21
|
+
const input = "ANTHROPIC_API_KEY=sk-ant-real-key-here-1234567890";
|
|
22
|
+
const result = redactor.redact(input);
|
|
23
|
+
expect(result).toContain("***REDACTED***");
|
|
24
|
+
// Value should be gone; variable name may remain
|
|
25
|
+
expect(result).not.toContain("sk-ant-real-key-here-1234567890");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe("Redactor — Layer 2: enrolled live values", () => {
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
// Clear enrolled secrets between tests by creating a fresh state
|
|
32
|
+
// The redactor is a singleton — we test idempotency elsewhere
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("Test 4: redacts enrolled live secret value", () => {
|
|
36
|
+
redactor.enrollSecret("sk-customformat-abcdefghij");
|
|
37
|
+
const result = redactor.redact("...sk-customformat-abcdefghij...");
|
|
38
|
+
expect(result).not.toContain("sk-customformat-abcdefghij");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("Test 5: does NOT redact short enrolled values (< 8 chars)", () => {
|
|
42
|
+
redactor.enrollSecret("ab");
|
|
43
|
+
const result = redactor.redact("absolute");
|
|
44
|
+
// Short secret 'ab' must NOT cause 'absolute' to be redacted
|
|
45
|
+
expect(result).toBe("absolute");
|
|
46
|
+
expect(result).toContain("absolute");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("Redactor — error redaction", () => {
|
|
51
|
+
it("Test 6: redactError removes secrets from Error message and stack", () => {
|
|
52
|
+
const err = new Error("Failed with key sk-ant-shouldredact1234567890");
|
|
53
|
+
const result = redactor.redactError(err);
|
|
54
|
+
expect(result).not.toContain("sk-ant-shouldredact1234567890");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("Redactor — global patches", () => {
|
|
59
|
+
it("Test 7: installGlobalPatches patches console.log to redact secrets", () => {
|
|
60
|
+
const captured: string[] = [];
|
|
61
|
+
|
|
62
|
+
// Intercept the original console.log BEFORE installGlobalPatches wraps it
|
|
63
|
+
// so we capture what the PATCHED version actually forwards.
|
|
64
|
+
const originalLog = console.log;
|
|
65
|
+
console.log = (...args: unknown[]) => {
|
|
66
|
+
captured.push(args.map(String).join(" "));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Now install global patches — they will wrap the spy above
|
|
70
|
+
redactor.installGlobalPatches();
|
|
71
|
+
|
|
72
|
+
// Call through the patched console.log
|
|
73
|
+
console.log("test sk-ant-1234567890abcdefghij");
|
|
74
|
+
|
|
75
|
+
// Restore
|
|
76
|
+
redactor.uninstallGlobalPatches();
|
|
77
|
+
console.log = originalLog;
|
|
78
|
+
|
|
79
|
+
// The captured string should have been redacted by the patch
|
|
80
|
+
const output = captured.join(" ");
|
|
81
|
+
expect(output).not.toContain("sk-ant-1234567890abcdefghij");
|
|
82
|
+
expect(output).toContain("***REDACTED***");
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe("Redactor — idempotency", () => {
|
|
87
|
+
it("Test 8: enrolling the same secret twice produces identical redacted output", () => {
|
|
88
|
+
const secret = "sk-ant-idempotent-test-abcdefghijklm";
|
|
89
|
+
redactor.enrollSecret(secret);
|
|
90
|
+
redactor.enrollSecret(secret); // enroll same value again
|
|
91
|
+
|
|
92
|
+
const result1 = redactor.redact(`key is ${secret}`);
|
|
93
|
+
// Enroll again for safety
|
|
94
|
+
redactor.enrollSecret(secret);
|
|
95
|
+
const result2 = redactor.redact(`key is ${secret}`);
|
|
96
|
+
|
|
97
|
+
expect(result1).toBe(result2);
|
|
98
|
+
expect(result1).not.toContain(secret);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/utils/redactor.ts
|
|
3
|
+
*
|
|
4
|
+
* Process-wide log redactor singleton.
|
|
5
|
+
* Mitigates Pitfall 2 (HIGH severity API key leakage).
|
|
6
|
+
*
|
|
7
|
+
* Two-layer scrubbing strategy:
|
|
8
|
+
* Layer 1 — Static regex patterns for known secret shapes (sk-*, JWT, Bearer, env vars)
|
|
9
|
+
* Layer 2 — Enrolled live values registered at runtime (>=8 chars) via enrollSecret()
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* import { redactor } from "./utils/redactor.js";
|
|
13
|
+
* redactor.installGlobalPatches(); // call FIRST at process boot
|
|
14
|
+
* redactor.enrollSecret(loadedApiKey); // call immediately after key load
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Static regex patterns for Layer 1 scrubbing
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
const STATIC_PATTERNS: Array<{ pattern: RegExp; replacement: string }> = [
|
|
22
|
+
// Anthropic sk-ant-* keys (most specific — checked first)
|
|
23
|
+
{
|
|
24
|
+
pattern: /sk-ant-[A-Za-z0-9_-]{20,}/g,
|
|
25
|
+
replacement: "sk-ant-***REDACTED***",
|
|
26
|
+
},
|
|
27
|
+
// General sk-* keys (OpenAI and other providers)
|
|
28
|
+
{
|
|
29
|
+
pattern: /sk-[A-Za-z0-9_-]{20,}/g,
|
|
30
|
+
replacement: "sk-***REDACTED***",
|
|
31
|
+
},
|
|
32
|
+
// JWT triple-segment shape eyJ<base64url>.<base64url>.<base64url>
|
|
33
|
+
{
|
|
34
|
+
pattern: /eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
|
|
35
|
+
replacement: "***REDACTED-JWT***",
|
|
36
|
+
},
|
|
37
|
+
// Environment variable assignments for common API keys
|
|
38
|
+
{
|
|
39
|
+
pattern: /(ANTHROPIC_API_KEY|OPENAI_API_KEY|GOOGLE_API_KEY|DEEPSEEK_API_KEY)\s*=\s*\S+/g,
|
|
40
|
+
replacement: "$1=***REDACTED***",
|
|
41
|
+
},
|
|
42
|
+
// Authorization Bearer header
|
|
43
|
+
{
|
|
44
|
+
pattern: /Authorization:\s*Bearer\s+\S+/gi,
|
|
45
|
+
replacement: "Authorization: Bearer ***REDACTED***",
|
|
46
|
+
},
|
|
47
|
+
// x-api-key header (case-insensitive)
|
|
48
|
+
{
|
|
49
|
+
pattern: /[Xx]-[Aa]pi-[Kk]ey:\s*\S+/g,
|
|
50
|
+
replacement: "x-api-key: ***REDACTED***",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Redactor class
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
class Redactor {
|
|
59
|
+
/** Set of enrolled live secret values (length >= 8). */
|
|
60
|
+
private enrolled = new Set<string>();
|
|
61
|
+
|
|
62
|
+
/** Original console method references, saved before patching. */
|
|
63
|
+
private originals: {
|
|
64
|
+
log: typeof console.log;
|
|
65
|
+
error: typeof console.error;
|
|
66
|
+
warn: typeof console.warn;
|
|
67
|
+
info: typeof console.info;
|
|
68
|
+
debug: typeof console.debug;
|
|
69
|
+
} | null = null;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Enroll a live secret value for Layer 2 scrubbing.
|
|
73
|
+
* Values shorter than 8 characters are silently ignored to prevent
|
|
74
|
+
* accidentally redacting common short strings (Test 5 guard).
|
|
75
|
+
*/
|
|
76
|
+
enrollSecret(value: string): void {
|
|
77
|
+
if (!value || value.length < 8) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.enrolled.add(value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Scrub a string through both layers.
|
|
85
|
+
*
|
|
86
|
+
* Layer 1: apply all static regex patterns.
|
|
87
|
+
* Layer 2: replace all enrolled secret values.
|
|
88
|
+
*/
|
|
89
|
+
redact(input: string): string {
|
|
90
|
+
if (!input) return input;
|
|
91
|
+
|
|
92
|
+
let result = input;
|
|
93
|
+
|
|
94
|
+
// Layer 1 — static regex
|
|
95
|
+
for (const { pattern, replacement } of STATIC_PATTERNS) {
|
|
96
|
+
// Reset lastIndex for global regexes before each call
|
|
97
|
+
pattern.lastIndex = 0;
|
|
98
|
+
result = result.replace(pattern, replacement);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Layer 2 — enrolled live values
|
|
102
|
+
for (const secret of this.enrolled) {
|
|
103
|
+
// Only replace secrets that are still >= 8 chars (defensive)
|
|
104
|
+
if (secret.length >= 8) {
|
|
105
|
+
// Use a plain string replacement (not regex) to avoid regex special chars
|
|
106
|
+
// Replace ALL occurrences via split/join
|
|
107
|
+
result = result.split(secret).join("***REDACTED-ENROLLED***");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Scrub an Error (or unknown thrown value) to a safe string.
|
|
116
|
+
* Runs redact() on both the stringified error and the stack trace.
|
|
117
|
+
*/
|
|
118
|
+
redactError(err: unknown): string {
|
|
119
|
+
const errStr = String(err);
|
|
120
|
+
let result = this.redact(errStr);
|
|
121
|
+
|
|
122
|
+
if (err instanceof Error && err.stack) {
|
|
123
|
+
const redactedStack = this.redact(err.stack);
|
|
124
|
+
// If the stack contains more info than just the message, append it
|
|
125
|
+
if (redactedStack !== errStr) {
|
|
126
|
+
result = redactedStack;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Stringify an argument for redaction.
|
|
135
|
+
* Returns the redacted string representation of any value.
|
|
136
|
+
*/
|
|
137
|
+
private stringifyArg(arg: unknown): string {
|
|
138
|
+
if (typeof arg === "string") {
|
|
139
|
+
return this.redact(arg);
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
return this.redact(JSON.stringify(arg) ?? String(arg));
|
|
143
|
+
} catch {
|
|
144
|
+
return this.redact(String(arg));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Install global patches on console.log/error/warn/info/debug.
|
|
150
|
+
* MUST be called exactly once at process start, before any other logging.
|
|
151
|
+
* Each patched method passes args through redact() before forwarding.
|
|
152
|
+
*/
|
|
153
|
+
installGlobalPatches(): void {
|
|
154
|
+
if (this.originals) {
|
|
155
|
+
// Already patched — idempotent: no-op
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.originals = {
|
|
160
|
+
log: console.log,
|
|
161
|
+
error: console.error,
|
|
162
|
+
warn: console.warn,
|
|
163
|
+
info: console.info,
|
|
164
|
+
debug: console.debug,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const { log: origLog, error: origError, warn: origWarn, info: origInfo, debug: origDebug } = this.originals;
|
|
168
|
+
|
|
169
|
+
console.log = (...args: unknown[]) => {
|
|
170
|
+
origLog.apply(
|
|
171
|
+
console,
|
|
172
|
+
args.map((a) => this.stringifyArg(a)),
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
console.error = (...args: unknown[]) => {
|
|
177
|
+
origError.apply(
|
|
178
|
+
console,
|
|
179
|
+
args.map((a) => this.stringifyArg(a)),
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
console.warn = (...args: unknown[]) => {
|
|
184
|
+
origWarn.apply(
|
|
185
|
+
console,
|
|
186
|
+
args.map((a) => this.stringifyArg(a)),
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
console.info = (...args: unknown[]) => {
|
|
191
|
+
origInfo.apply(
|
|
192
|
+
console,
|
|
193
|
+
args.map((a) => this.stringifyArg(a)),
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
console.debug = (...args: unknown[]) => {
|
|
198
|
+
origDebug.apply(
|
|
199
|
+
console,
|
|
200
|
+
args.map((a) => this.stringifyArg(a)),
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Restore original console methods.
|
|
207
|
+
* Useful in tests to avoid cross-test contamination.
|
|
208
|
+
*/
|
|
209
|
+
uninstallGlobalPatches(): void {
|
|
210
|
+
if (!this.originals) return;
|
|
211
|
+
|
|
212
|
+
console.log = this.originals.log;
|
|
213
|
+
console.error = this.originals.error;
|
|
214
|
+
console.warn = this.originals.warn;
|
|
215
|
+
console.info = this.originals.info;
|
|
216
|
+
console.debug = this.originals.debug;
|
|
217
|
+
|
|
218
|
+
this.originals = null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Export singleton instance
|
|
223
|
+
export const redactor = new Redactor();
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { loadCatalog } from "../models/registry.js";
|
|
3
|
+
|
|
4
|
+
beforeAll(async () => {
|
|
5
|
+
await loadCatalog();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
vi.restoreAllMocks();
|
|
10
|
+
vi.unstubAllEnvs();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
vi.restoreAllMocks();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe("normalizeSandboxMode", () => {
|
|
18
|
+
it("returns shuru for shuru input", async () => {
|
|
19
|
+
const { normalizeSandboxMode } = await import("./settings");
|
|
20
|
+
expect(normalizeSandboxMode("shuru")).toBe("shuru");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("returns off for any other input", async () => {
|
|
24
|
+
const { normalizeSandboxMode } = await import("./settings");
|
|
25
|
+
expect(normalizeSandboxMode("invalid")).toBe("off");
|
|
26
|
+
expect(normalizeSandboxMode(undefined)).toBe("off");
|
|
27
|
+
expect(normalizeSandboxMode(null)).toBe("off");
|
|
28
|
+
expect(normalizeSandboxMode(42)).toBe("off");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe("normalizeSandboxSettings", () => {
|
|
33
|
+
it("returns empty object for non-object input", async () => {
|
|
34
|
+
const { normalizeSandboxSettings } = await import("./settings");
|
|
35
|
+
expect(normalizeSandboxSettings(null)).toEqual({});
|
|
36
|
+
expect(normalizeSandboxSettings("string")).toEqual({});
|
|
37
|
+
expect(normalizeSandboxSettings(undefined)).toEqual({});
|
|
38
|
+
expect(normalizeSandboxSettings([])).toEqual({});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("normalizes valid fields", async () => {
|
|
42
|
+
const { normalizeSandboxSettings } = await import("./settings");
|
|
43
|
+
const result = normalizeSandboxSettings({
|
|
44
|
+
allowNet: true,
|
|
45
|
+
allowedHosts: ["api.openai.com", ""],
|
|
46
|
+
cpus: 4,
|
|
47
|
+
memory: 2048,
|
|
48
|
+
ports: ["3000:3000", "bad", "8080:8080"],
|
|
49
|
+
});
|
|
50
|
+
expect(result.allowNet).toBe(true);
|
|
51
|
+
expect(result.allowedHosts).toEqual(["api.openai.com"]);
|
|
52
|
+
expect(result.cpus).toBe(4);
|
|
53
|
+
expect(result.memory).toBe(2048);
|
|
54
|
+
expect(result.ports).toEqual(["3000:3000", "8080:8080"]);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("ignores non-positive numbers for cpus and memory", async () => {
|
|
58
|
+
const { normalizeSandboxSettings } = await import("./settings");
|
|
59
|
+
const result = normalizeSandboxSettings({ cpus: 0, memory: -1 });
|
|
60
|
+
expect(result.cpus).toBeUndefined();
|
|
61
|
+
expect(result.memory).toBeUndefined();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("normalizes secrets", async () => {
|
|
65
|
+
const { normalizeSandboxSettings } = await import("./settings");
|
|
66
|
+
const result = normalizeSandboxSettings({
|
|
67
|
+
secrets: [{ name: "API_KEY", fromEnv: "MY_KEY", hosts: ["api.example.com"] }, { name: "", fromEnv: "BAD" }, null],
|
|
68
|
+
});
|
|
69
|
+
expect(result.secrets).toHaveLength(1);
|
|
70
|
+
expect(result.secrets![0].name).toBe("API_KEY");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("mergeSandboxSettings", () => {
|
|
75
|
+
it("returns empty when both undefined", async () => {
|
|
76
|
+
const { mergeSandboxSettings } = await import("./settings");
|
|
77
|
+
expect(mergeSandboxSettings(undefined, undefined)).toEqual({});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("returns base when override is undefined", async () => {
|
|
81
|
+
const { mergeSandboxSettings } = await import("./settings");
|
|
82
|
+
const result = mergeSandboxSettings({ allowNet: true, cpus: 2 }, undefined);
|
|
83
|
+
expect(result.allowNet).toBe(true);
|
|
84
|
+
expect(result.cpus).toBe(2);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("override takes precedence", async () => {
|
|
88
|
+
const { mergeSandboxSettings } = await import("./settings");
|
|
89
|
+
const result = mergeSandboxSettings({ allowNet: true, cpus: 2 }, { allowNet: false, memory: 1024 });
|
|
90
|
+
expect(result.allowNet).toBe(false);
|
|
91
|
+
expect(result.cpus).toBe(2);
|
|
92
|
+
expect(result.memory).toBe(1024);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("isReservedSubagentName", () => {
|
|
97
|
+
it("identifies reserved names", async () => {
|
|
98
|
+
const { isReservedSubagentName } = await import("./settings");
|
|
99
|
+
expect(isReservedSubagentName("general")).toBe(true);
|
|
100
|
+
expect(isReservedSubagentName("explore")).toBe(true);
|
|
101
|
+
expect(isReservedSubagentName("vision")).toBe(true);
|
|
102
|
+
expect(isReservedSubagentName("verify")).toBe(true);
|
|
103
|
+
expect(isReservedSubagentName("computer")).toBe(true);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("trims and lowercases input", async () => {
|
|
107
|
+
const { isReservedSubagentName } = await import("./settings");
|
|
108
|
+
expect(isReservedSubagentName(" General ")).toBe(true);
|
|
109
|
+
expect(isReservedSubagentName("EXPLORE")).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("rejects non-reserved names", async () => {
|
|
113
|
+
const { isReservedSubagentName } = await import("./settings");
|
|
114
|
+
expect(isReservedSubagentName("my-agent")).toBe(false);
|
|
115
|
+
expect(isReservedSubagentName("custom")).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe("parseSubAgentsRawList", () => {
|
|
120
|
+
it("returns empty for non-array input", async () => {
|
|
121
|
+
const { parseSubAgentsRawList } = await import("./settings");
|
|
122
|
+
expect(parseSubAgentsRawList(null)).toEqual([]);
|
|
123
|
+
expect(parseSubAgentsRawList("string")).toEqual([]);
|
|
124
|
+
expect(parseSubAgentsRawList(42)).toEqual([]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("filters invalid entries", async () => {
|
|
128
|
+
const { parseSubAgentsRawList } = await import("./settings");
|
|
129
|
+
const result = parseSubAgentsRawList([
|
|
130
|
+
null,
|
|
131
|
+
{ name: "", model: "claude-sonnet-4-6", instruction: "test" },
|
|
132
|
+
{ name: "explore", model: "claude-sonnet-4-6", instruction: "reserved" },
|
|
133
|
+
]);
|
|
134
|
+
expect(result).toEqual([]);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("deduplicates by lowercase name", async () => {
|
|
138
|
+
const { parseSubAgentsRawList } = await import("./settings");
|
|
139
|
+
const result = parseSubAgentsRawList([
|
|
140
|
+
{ name: "MyAgent", model: "claude-sonnet-4-6", instruction: "first" },
|
|
141
|
+
{ name: "myagent", model: "claude-sonnet-4-6", instruction: "dupe" },
|
|
142
|
+
]);
|
|
143
|
+
expect(result).toHaveLength(1);
|
|
144
|
+
expect(result[0].name).toBe("MyAgent");
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
describe("resolveTelegramStreamSettings", () => {
|
|
149
|
+
it("returns defaults when settings undefined", async () => {
|
|
150
|
+
const { resolveTelegramStreamSettings } = await import("./settings");
|
|
151
|
+
const result = resolveTelegramStreamSettings(undefined);
|
|
152
|
+
expect(result.streaming).toBe("partial");
|
|
153
|
+
expect(result.typingIndicator).toBe(true);
|
|
154
|
+
expect(result.nativeDrafts).toBe(false);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("respects explicit off", async () => {
|
|
158
|
+
const { resolveTelegramStreamSettings } = await import("./settings");
|
|
159
|
+
const result = resolveTelegramStreamSettings({ streaming: "off", typingIndicator: false });
|
|
160
|
+
expect(result.streaming).toBe("off");
|
|
161
|
+
expect(result.typingIndicator).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe("resolveTelegramAudioInputSettings", () => {
|
|
166
|
+
it("returns defaults when settings undefined", async () => {
|
|
167
|
+
const { resolveTelegramAudioInputSettings } = await import("./settings");
|
|
168
|
+
const result = resolveTelegramAudioInputSettings(undefined);
|
|
169
|
+
expect(result.enabled).toBe(true);
|
|
170
|
+
expect(result.language).toBe("en");
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("respects explicit values", async () => {
|
|
174
|
+
const { resolveTelegramAudioInputSettings } = await import("./settings");
|
|
175
|
+
const result = resolveTelegramAudioInputSettings({
|
|
176
|
+
audioInput: { enabled: false, language: "vi" },
|
|
177
|
+
});
|
|
178
|
+
expect(result.enabled).toBe(false);
|
|
179
|
+
expect(result.language).toBe("vi");
|
|
180
|
+
});
|
|
181
|
+
});
|