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,439 @@
|
|
|
1
|
+
import type { TaskRequest, VerifyRecipe } from "../types/index";
|
|
2
|
+
import type { SandboxSettings } from "../utils/settings";
|
|
3
|
+
import { ensureVerifyCheckpoint, type PreparedVerifyCheckpoint } from "./checkpoint";
|
|
4
|
+
import { loadVerifyEnvironment } from "./environment";
|
|
5
|
+
import { buildBrowserGuidance, buildEvidenceGuidance, buildReadinessGuidance } from "./evidence";
|
|
6
|
+
import {
|
|
7
|
+
defaultShellInit,
|
|
8
|
+
detectPackageManager,
|
|
9
|
+
getNodeWebBootstrapCommands,
|
|
10
|
+
getNodeWebShellInitCommands,
|
|
11
|
+
inferVerifyProjectProfile,
|
|
12
|
+
normalizeVerifyAppKind,
|
|
13
|
+
type VerifyProjectProfile,
|
|
14
|
+
} from "./recipes";
|
|
15
|
+
import { buildRetryGuidance } from "./retry";
|
|
16
|
+
|
|
17
|
+
export const VERIFY_SUBAGENT_ID = "verify";
|
|
18
|
+
export const VERIFY_TASK_DESCRIPTION = "Run local verification";
|
|
19
|
+
|
|
20
|
+
export interface VerifyRuntimeConfig {
|
|
21
|
+
sandboxMode: "shuru";
|
|
22
|
+
sandboxSettings: SandboxSettings;
|
|
23
|
+
taskRequest: TaskRequest;
|
|
24
|
+
profile: VerifyProjectProfile;
|
|
25
|
+
checkpointCreated?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PreparedVerifySandbox {
|
|
29
|
+
profile: VerifyProjectProfile;
|
|
30
|
+
sandboxSettings: SandboxSettings;
|
|
31
|
+
checkpoint?: PreparedVerifyCheckpoint;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function dedupe(values: Array<string | undefined | null>): string[] {
|
|
35
|
+
return [...new Set(values.map((v) => v?.trim()).filter((v): v is string => Boolean(v)))];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function formatRecipeCommands(title: string, commands: string[]): string {
|
|
39
|
+
return commands.length > 0 ? `- ${title}: ${commands.join(" ; ")}` : `- ${title}: (none inferred)`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function buildProjectContextLines(profile: VerifyProjectProfile): string[] {
|
|
43
|
+
const lines = [`- Detected app type: ${profile.appLabel}.`, `- Recipe ecosystem: ${profile.recipe.ecosystem}.`];
|
|
44
|
+
if (profile.packageManager) {
|
|
45
|
+
lines.push(`- Likely package manager: ${profile.packageManager}.`);
|
|
46
|
+
}
|
|
47
|
+
if (profile.availableScripts.length > 0) {
|
|
48
|
+
lines.push(`- Available package.json scripts: ${profile.availableScripts.join(", ")}.`);
|
|
49
|
+
}
|
|
50
|
+
lines.push(...profile.recipe.evidence.map((evidence) => `- Evidence: ${evidence}.`));
|
|
51
|
+
lines.push(formatRecipeCommands("Shell init", profile.recipe.shellInitCommands));
|
|
52
|
+
lines.push(formatRecipeCommands("Bootstrap commands", profile.recipe.bootstrapCommands));
|
|
53
|
+
lines.push(formatRecipeCommands("Install commands", profile.recipe.installCommands));
|
|
54
|
+
lines.push(formatRecipeCommands("Build commands", profile.recipe.buildCommands));
|
|
55
|
+
lines.push(formatRecipeCommands("Test commands", profile.recipe.testCommands));
|
|
56
|
+
lines.push(`- Start command: ${profile.recipe.startCommand ?? "(none inferred)"}.`);
|
|
57
|
+
if (profile.recipe.smokeTarget) {
|
|
58
|
+
lines.push(`- Smoke target: ${profile.recipe.smokeTarget}.`);
|
|
59
|
+
}
|
|
60
|
+
lines.push(...profile.recipe.notes.map((note) => `- Note: ${note}`));
|
|
61
|
+
return lines;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function buildVerifyTaskPrompt(
|
|
65
|
+
cwd: string,
|
|
66
|
+
settings?: SandboxSettings,
|
|
67
|
+
recipeOverride?: VerifyRecipe | null,
|
|
68
|
+
): string {
|
|
69
|
+
const manifest = recipeOverride ? null : loadVerifyEnvironment(cwd, settings);
|
|
70
|
+
const effectiveSettings = manifest?.sandboxSettings ?? settings;
|
|
71
|
+
const profile = inferVerifyProjectProfile(cwd, effectiveSettings, recipeOverride ?? manifest?.recipe ?? null);
|
|
72
|
+
const checkpoint = profile.sandboxSettings.from?.trim();
|
|
73
|
+
const network = profile.sandboxSettings.allowNet
|
|
74
|
+
? profile.sandboxSettings.allowedHosts?.length
|
|
75
|
+
? `enabled but restricted to: ${profile.sandboxSettings.allowedHosts.join(", ")}`
|
|
76
|
+
: "enabled"
|
|
77
|
+
: "disabled";
|
|
78
|
+
|
|
79
|
+
return [
|
|
80
|
+
"Run a local verification pass for the current workspace.",
|
|
81
|
+
"",
|
|
82
|
+
"Goals:",
|
|
83
|
+
"- Prove the current changes work as well as possible in phase 1.",
|
|
84
|
+
"- First derive and sanity-check a runnable verification recipe from the repository.",
|
|
85
|
+
"- Then execute that recipe inside the active Shuru sandbox and report the result.",
|
|
86
|
+
"",
|
|
87
|
+
"Detected project context and inferred recipe:",
|
|
88
|
+
...(manifest ? [`- Verify environment manifest: ${manifest.path}.`] : []),
|
|
89
|
+
...buildProjectContextLines(profile),
|
|
90
|
+
"",
|
|
91
|
+
"Environment:",
|
|
92
|
+
"- Sandbox mode should be Shuru with workspace mounted at /workspace.",
|
|
93
|
+
`- Network is ${network}.`,
|
|
94
|
+
checkpoint
|
|
95
|
+
? `- Start from the configured Shuru checkpoint: ${checkpoint}.`
|
|
96
|
+
: "- No Shuru checkpoint is configured; use the current sandbox settings as-is.",
|
|
97
|
+
"- Shuru runs are ephemeral in this version. Shell-side workspace edits do not persist back to the host.",
|
|
98
|
+
"",
|
|
99
|
+
"MANDATORY workflow (do ALL steps in order, do NOT stop after build/lint):",
|
|
100
|
+
"",
|
|
101
|
+
"Phase 1 — Setup:",
|
|
102
|
+
"- Probe the sandbox for runtimes (`command -v node`, `command -v npm`, etc). Only install what is missing.",
|
|
103
|
+
"- Ephemeral installs are allowed. Chain install + build in the same sandbox command if no checkpoint provides deps.",
|
|
104
|
+
"",
|
|
105
|
+
"Phase 2 — Build and test:",
|
|
106
|
+
"- Run installCommands, buildCommands, and testCommands from the recipe.",
|
|
107
|
+
"",
|
|
108
|
+
"Phase 3 — Start the app (REQUIRED, do not skip):",
|
|
109
|
+
"- Start the app using startCommand from the recipe, running it in the background.",
|
|
110
|
+
"- Wait for the app to be ready: use a curl readiness loop or `agent-browser wait --load networkidle`.",
|
|
111
|
+
"- If the app fails to start, report the error but still attempt to capture evidence (logs, screenshots).",
|
|
112
|
+
"",
|
|
113
|
+
"Phase 4 — Browser QA testing (REQUIRED, do not skip):",
|
|
114
|
+
"- You are a QA tester. Open the app in the browser and test it like a human would.",
|
|
115
|
+
"- agent-browser commands run on the HOST, not the sandbox. They WILL work. Do not skip them.",
|
|
116
|
+
"- Record a video of the entire browser session.",
|
|
117
|
+
"- Navigate the app: click links, buttons, menus. Verify pages load correctly.",
|
|
118
|
+
"- Check for JavaScript console errors.",
|
|
119
|
+
"- Spend 3-5 interactions testing the critical path. Take screenshots after each.",
|
|
120
|
+
"- This is the most important phase. Build/lint passing means nothing if the app doesn't actually work.",
|
|
121
|
+
"",
|
|
122
|
+
"Phase 5 — Teardown:",
|
|
123
|
+
"- Stop recording, close browser, THEN stop the dev server.",
|
|
124
|
+
...buildReadinessGuidance(profile),
|
|
125
|
+
...buildBrowserGuidance(profile),
|
|
126
|
+
...buildRetryGuidance(profile),
|
|
127
|
+
...buildEvidenceGuidance(),
|
|
128
|
+
"",
|
|
129
|
+
"Reporting requirements:",
|
|
130
|
+
"- Return a concise structured report with these sections only:",
|
|
131
|
+
" Summary",
|
|
132
|
+
" Results",
|
|
133
|
+
" Evidence",
|
|
134
|
+
" Blockers",
|
|
135
|
+
" Residual Risk",
|
|
136
|
+
"- Keep the report compact: prefer 1-3 short bullets per section, and do not paste large command logs unless they are essential blockers.",
|
|
137
|
+
"- The Summary must say what recipe/source of truth you used and whether you changed the inferred/default one.",
|
|
138
|
+
"- Evidence is mandatory even on failure. If you captured screenshots, video, or logs, include their exact workspace-relative file paths in the Evidence section.",
|
|
139
|
+
"- Use markdown links for artifact paths when practical, otherwise include the plain relative paths.",
|
|
140
|
+
].join("\n");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function createVerifyTaskRequest(
|
|
144
|
+
cwd: string,
|
|
145
|
+
settings?: SandboxSettings,
|
|
146
|
+
recipeOverride?: VerifyRecipe | null,
|
|
147
|
+
): TaskRequest {
|
|
148
|
+
return {
|
|
149
|
+
agent: VERIFY_SUBAGENT_ID,
|
|
150
|
+
description: VERIFY_TASK_DESCRIPTION,
|
|
151
|
+
prompt: buildVerifyTaskPrompt(cwd, settings, recipeOverride),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function buildVerifyDetectPrompt(cwd: string, settings?: SandboxSettings): string {
|
|
156
|
+
const manifest = loadVerifyEnvironment(cwd, settings);
|
|
157
|
+
const fallbackProfile = inferVerifyProjectProfile(
|
|
158
|
+
cwd,
|
|
159
|
+
manifest?.sandboxSettings ?? settings,
|
|
160
|
+
manifest?.recipe ?? null,
|
|
161
|
+
);
|
|
162
|
+
return [
|
|
163
|
+
"Inspect this repository and produce a structured verification recipe.",
|
|
164
|
+
"",
|
|
165
|
+
"Your job:",
|
|
166
|
+
"- Read the codebase, config files, and any relevant docs or AGENTS guidance.",
|
|
167
|
+
"- If environment.json or .muonroi-cli/environment.json exists, treat it as the highest-priority source of truth and only fill in missing details.",
|
|
168
|
+
"- Infer how the project should be installed, built, tested, and started.",
|
|
169
|
+
"- Infer whether verification should use HTTP/browser smoke checks, CLI checks, or no runtime smoke step.",
|
|
170
|
+
"- Prefer concrete commands that are likely to work in a fresh Debian Linux environment.",
|
|
171
|
+
"- Design the recipe so verification probes for runtimes/tools first and only installs missing dependencies or toolchains when necessary.",
|
|
172
|
+
"- Use the fallback hints below only as clues, not as the final answer.",
|
|
173
|
+
"",
|
|
174
|
+
"IMPORTANT for shellInitCommands and bootstrapCommands:",
|
|
175
|
+
"- The sandbox is a fresh Debian Linux VM with almost nothing pre-installed.",
|
|
176
|
+
'- shellInitCommands run before every bash command. Use them for PATH exports (e.g. export PATH="$HOME/.bun/bin:$PATH").',
|
|
177
|
+
"- bootstrapCommands run once during checkpoint creation to install runtimes and tools.",
|
|
178
|
+
"- You MUST include bootstrap commands to install any runtime the project needs (e.g. bun, node, npm, python3, go, cargo, java).",
|
|
179
|
+
"- Example for a Bun + Next.js project: bootstrapCommands should install both bun AND node/npm, since Next.js calls npm internally.",
|
|
180
|
+
'- Example: ["apt-get update && apt-get install -y curl unzip ca-certificates && curl -fsSL https://bun.sh/install | bash", "apt-get install -y nodejs npm"]',
|
|
181
|
+
"",
|
|
182
|
+
"Fallback hints from static detection:",
|
|
183
|
+
...(manifest ? [`- Detected verify environment manifest: ${manifest.path}.`] : []),
|
|
184
|
+
...buildProjectContextLines(fallbackProfile),
|
|
185
|
+
"",
|
|
186
|
+
"Return ONLY valid JSON with this exact shape:",
|
|
187
|
+
"{",
|
|
188
|
+
' "ecosystem": string,',
|
|
189
|
+
' "appKind": string,',
|
|
190
|
+
' "appLabel": string,',
|
|
191
|
+
' "shellInitCommands": string[],',
|
|
192
|
+
' "bootstrapCommands": string[],',
|
|
193
|
+
' "installCommands": string[],',
|
|
194
|
+
' "buildCommands": string[],',
|
|
195
|
+
' "testCommands": string[],',
|
|
196
|
+
' "startCommand": string | undefined,',
|
|
197
|
+
' "startPort": string | undefined,',
|
|
198
|
+
' "smokeKind": "http" | "cli" | "none",',
|
|
199
|
+
' "smokeTarget": string | undefined,',
|
|
200
|
+
' "evidence": string[],',
|
|
201
|
+
' "notes": string[]',
|
|
202
|
+
"}",
|
|
203
|
+
"",
|
|
204
|
+
"Rules:",
|
|
205
|
+
"- Do not wrap the JSON in markdown.",
|
|
206
|
+
"- Do not include explanatory prose outside the JSON.",
|
|
207
|
+
"- If you are uncertain, put that uncertainty into `notes` and `evidence`.",
|
|
208
|
+
].join("\n");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const NODE_ECOSYSTEMS = new Set(["node", "nodejs", "npm", "bun", "yarn", "pnpm"]);
|
|
212
|
+
const PYTHON_ECOSYSTEMS = new Set(["python", "django", "fastapi"]);
|
|
213
|
+
const GO_ECOSYSTEMS = new Set(["go", "golang"]);
|
|
214
|
+
const RUST_ECOSYSTEMS = new Set(["rust", "cargo"]);
|
|
215
|
+
|
|
216
|
+
function inferBootstrapFromEcosystem(
|
|
217
|
+
ecosystem: string,
|
|
218
|
+
packageManager: string | null,
|
|
219
|
+
): { bootstrap: string[]; shellInit: string[] } {
|
|
220
|
+
const eco = ecosystem.toLowerCase();
|
|
221
|
+
|
|
222
|
+
if (
|
|
223
|
+
NODE_ECOSYSTEMS.has(eco) ||
|
|
224
|
+
eco.includes("node") ||
|
|
225
|
+
eco.includes("next") ||
|
|
226
|
+
eco.includes("react") ||
|
|
227
|
+
eco.includes("vite")
|
|
228
|
+
) {
|
|
229
|
+
const bootstrap = [
|
|
230
|
+
"apt-get update && apt-get install -y curl unzip ca-certificates git python3 make g++ pkg-config nodejs npm",
|
|
231
|
+
];
|
|
232
|
+
const shellInit = [...defaultShellInit()];
|
|
233
|
+
if (packageManager === "bun") {
|
|
234
|
+
bootstrap.push("curl -fsSL https://bun.sh/install | bash");
|
|
235
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: shell variable, not JS template
|
|
236
|
+
shellInit.push('export BUN_INSTALL="${HOME}/.bun"');
|
|
237
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: shell variable, not JS template
|
|
238
|
+
shellInit.push('export PATH="${BUN_INSTALL}/bin:$PATH"');
|
|
239
|
+
}
|
|
240
|
+
return { bootstrap, shellInit };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (PYTHON_ECOSYSTEMS.has(eco) || eco.includes("python") || eco.includes("django") || eco.includes("flask")) {
|
|
244
|
+
return {
|
|
245
|
+
bootstrap: ["apt-get update && apt-get install -y python3 python3-pip python3-venv ca-certificates git"],
|
|
246
|
+
shellInit: defaultShellInit(),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (GO_ECOSYSTEMS.has(eco) || eco.includes("go")) {
|
|
251
|
+
return {
|
|
252
|
+
bootstrap: ["apt-get update && apt-get install -y golang ca-certificates git"],
|
|
253
|
+
shellInit: defaultShellInit(),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (RUST_ECOSYSTEMS.has(eco) || eco.includes("rust")) {
|
|
258
|
+
return {
|
|
259
|
+
bootstrap: [
|
|
260
|
+
"apt-get update && apt-get install -y curl ca-certificates git build-essential && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y",
|
|
261
|
+
],
|
|
262
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: shell variable, not JS template
|
|
263
|
+
shellInit: [...defaultShellInit(), 'export PATH="${HOME}/.cargo/bin:$PATH"'],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return { bootstrap: [], shellInit: [] };
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function ensureBootstrapCommands(cwd: string, recipe: VerifyRecipe): VerifyRecipe {
|
|
271
|
+
if (recipe.bootstrapCommands.length > 0) return recipe;
|
|
272
|
+
if (recipe.installCommands.length === 0) return recipe;
|
|
273
|
+
|
|
274
|
+
const packageManager = detectPackageManager(cwd);
|
|
275
|
+
|
|
276
|
+
const appKind = normalizeVerifyAppKind(recipe.appKind);
|
|
277
|
+
const webBootstrap = getNodeWebBootstrapCommands(packageManager, appKind);
|
|
278
|
+
if (webBootstrap.length > 0) {
|
|
279
|
+
const webShellInit = getNodeWebShellInitCommands(packageManager, appKind);
|
|
280
|
+
return {
|
|
281
|
+
...recipe,
|
|
282
|
+
bootstrapCommands: webBootstrap,
|
|
283
|
+
shellInitCommands: dedupe([...recipe.shellInitCommands, ...webShellInit]),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const { bootstrap, shellInit } = inferBootstrapFromEcosystem(recipe.ecosystem, packageManager);
|
|
288
|
+
if (bootstrap.length === 0) return recipe;
|
|
289
|
+
|
|
290
|
+
return {
|
|
291
|
+
...recipe,
|
|
292
|
+
bootstrapCommands: bootstrap,
|
|
293
|
+
shellInitCommands: dedupe([...recipe.shellInitCommands, ...shellInit]),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function createVerifyRuntimeConfig(
|
|
298
|
+
cwd: string,
|
|
299
|
+
baseSettings: SandboxSettings = {},
|
|
300
|
+
recipeOverride?: VerifyRecipe | null,
|
|
301
|
+
): VerifyRuntimeConfig {
|
|
302
|
+
const manifest = recipeOverride ? null : loadVerifyEnvironment(cwd, baseSettings);
|
|
303
|
+
const profile = inferVerifyProjectProfile(
|
|
304
|
+
cwd,
|
|
305
|
+
manifest?.sandboxSettings ?? baseSettings,
|
|
306
|
+
recipeOverride ?? manifest?.recipe ?? null,
|
|
307
|
+
);
|
|
308
|
+
profile.recipe = ensureBootstrapCommands(cwd, profile.recipe);
|
|
309
|
+
const sandboxSettings = {
|
|
310
|
+
...profile.sandboxSettings,
|
|
311
|
+
allowNet: true,
|
|
312
|
+
allowedHosts: undefined,
|
|
313
|
+
allowEphemeralInstall: true,
|
|
314
|
+
hostBrowserCommandsOnHost: true,
|
|
315
|
+
};
|
|
316
|
+
sandboxSettings.shellInit = dedupe([...(sandboxSettings.shellInit ?? []), ...profile.recipe.shellInitCommands]);
|
|
317
|
+
return {
|
|
318
|
+
sandboxMode: "shuru",
|
|
319
|
+
sandboxSettings,
|
|
320
|
+
taskRequest: createVerifyTaskRequest(cwd, sandboxSettings, profile.recipe),
|
|
321
|
+
profile: { ...profile, sandboxSettings },
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export async function prepareVerifySandbox(
|
|
326
|
+
cwd: string,
|
|
327
|
+
baseSettings: SandboxSettings = {},
|
|
328
|
+
recipeOverride?: VerifyRecipe | null,
|
|
329
|
+
onProgress?: (detail: string) => void,
|
|
330
|
+
): Promise<PreparedVerifySandbox> {
|
|
331
|
+
const runtime = createVerifyRuntimeConfig(cwd, baseSettings, recipeOverride);
|
|
332
|
+
onProgress?.("Preparing verify checkpoint");
|
|
333
|
+
const checkpoint = await ensureVerifyCheckpoint(cwd, runtime.profile, runtime.sandboxSettings, onProgress);
|
|
334
|
+
if (checkpoint.checkpointName) {
|
|
335
|
+
runtime.sandboxSettings.from = checkpoint.checkpointName;
|
|
336
|
+
if (checkpoint.guestWorkdir) {
|
|
337
|
+
runtime.sandboxSettings.guestWorkdir = checkpoint.guestWorkdir;
|
|
338
|
+
runtime.sandboxSettings.syncHostWorkspace = true;
|
|
339
|
+
}
|
|
340
|
+
onProgress?.(
|
|
341
|
+
checkpoint.created
|
|
342
|
+
? `Created verify checkpoint: ${checkpoint.checkpointName}`
|
|
343
|
+
: `Using verify checkpoint: ${checkpoint.checkpointName}`,
|
|
344
|
+
);
|
|
345
|
+
} else {
|
|
346
|
+
onProgress?.("No verify checkpoint needed");
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
profile: runtime.profile,
|
|
350
|
+
sandboxSettings: runtime.sandboxSettings,
|
|
351
|
+
checkpoint,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export function buildVerifyPrompt(cwd: string): string {
|
|
356
|
+
const profile = inferVerifyProjectProfile(cwd);
|
|
357
|
+
const recipe = ensureBootstrapCommands(cwd, profile.recipe);
|
|
358
|
+
const draftJson = JSON.stringify(
|
|
359
|
+
{
|
|
360
|
+
recipe: {
|
|
361
|
+
ecosystem: recipe.ecosystem,
|
|
362
|
+
appKind: recipe.appKind,
|
|
363
|
+
appLabel: recipe.appLabel,
|
|
364
|
+
shellInitCommands: recipe.shellInitCommands,
|
|
365
|
+
bootstrapCommands: recipe.bootstrapCommands,
|
|
366
|
+
installCommands: recipe.installCommands,
|
|
367
|
+
buildCommands: recipe.buildCommands,
|
|
368
|
+
testCommands: recipe.testCommands,
|
|
369
|
+
startCommand: recipe.startCommand,
|
|
370
|
+
startPort: recipe.startPort,
|
|
371
|
+
smokeKind: recipe.smokeKind,
|
|
372
|
+
smokeTarget: recipe.smokeTarget,
|
|
373
|
+
evidence: recipe.evidence,
|
|
374
|
+
notes: recipe.notes,
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
null,
|
|
378
|
+
2,
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
return [
|
|
382
|
+
"Verify this project locally. Follow these steps in order using the `task` tool:",
|
|
383
|
+
"",
|
|
384
|
+
"Step 1: Run the `verify-manifest` sub-agent to create or update `.muonroi-cli/environment.json`.",
|
|
385
|
+
"- agent: verify-manifest",
|
|
386
|
+
'- description: "Create verify manifest"',
|
|
387
|
+
"- Include this draft manifest JSON directly in the prompt so the sub-agent can refine and write it quickly:",
|
|
388
|
+
"",
|
|
389
|
+
"```json",
|
|
390
|
+
draftJson,
|
|
391
|
+
"```",
|
|
392
|
+
"",
|
|
393
|
+
"- Tell the sub-agent: Review this draft recipe against package.json and key config files. Adjust if needed, then write .muonroi-cli/environment.json. If the draft looks correct, write it as-is. Do not over-research.",
|
|
394
|
+
"- IMPORTANT: The Shuru sandbox is Debian 13 trixie on aarch64 (ARM64) with NOTHING pre-installed. bootstrapCommands MUST install every runtime from scratch (e.g. nodejs, npm, python3, go, cargo).",
|
|
395
|
+
"",
|
|
396
|
+
"Step 2: After the manifest is written, run the `verify` sub-agent.",
|
|
397
|
+
"- agent: verify",
|
|
398
|
+
'- description: "Run local verification"',
|
|
399
|
+
"- Tell it to use `.muonroi-cli/environment.json` as the source of truth.",
|
|
400
|
+
"- Include these execution instructions:",
|
|
401
|
+
" - Runs inside a Shuru sandbox (Debian 13 trixie, aarch64/ARM64) with full network access.",
|
|
402
|
+
" - The sandbox has NOTHING pre-installed unless bootstrapCommands in the manifest already ran during checkpoint creation.",
|
|
403
|
+
" - Ephemeral installs allowed.",
|
|
404
|
+
" - Probe for runtimes first (`command -v node`, etc), only install what is missing.",
|
|
405
|
+
" - agent-browser runs on the HOST, not the sandbox. It WILL work.",
|
|
406
|
+
" - If recipe has startCommand + startPort, start app in background and run browser smoke tests.",
|
|
407
|
+
" - Use `agent-browser record start .muonroi-cli/verify-artifacts/verify-smoke.webm` before opening the page.",
|
|
408
|
+
" - Use `agent-browser --screenshot-dir .muonroi-cli/verify-artifacts screenshot` after the page loads.",
|
|
409
|
+
" - CRITICAL: Stop the recording (`agent-browser record stop`) and close the browser (`agent-browser close`) BEFORE stopping the dev server. The server must stay alive until all browser commands finish.",
|
|
410
|
+
" - Return a concise report: Summary, Results, Evidence (mandatory), Blockers, Residual Risk.",
|
|
411
|
+
"",
|
|
412
|
+
"Important:",
|
|
413
|
+
"- Do NOT perform verification work yourself. Delegate each step via `task`.",
|
|
414
|
+
"- Run step 1 first, then step 2.",
|
|
415
|
+
"- After step 2, relay the verification report to the user.",
|
|
416
|
+
].join("\n");
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export const VERIFY_PROMPT = "__DYNAMIC__";
|
|
420
|
+
|
|
421
|
+
export function getVerifyCliError(options: { hasPrompt?: boolean; hasMessageArgs?: boolean }): string | null {
|
|
422
|
+
if (options.hasPrompt) {
|
|
423
|
+
return "Cannot combine --verify with --prompt.";
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (options.hasMessageArgs) {
|
|
427
|
+
return "Cannot combine --verify with an opening message.";
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export {
|
|
434
|
+
defaultShellInit,
|
|
435
|
+
inferVerifyProjectProfile,
|
|
436
|
+
inferVerifySmokeUrl,
|
|
437
|
+
normalizeVerifyRecipe,
|
|
438
|
+
type VerifyProjectProfile,
|
|
439
|
+
} from "./recipes";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
+
import { loadVerifyEnvironment, saveVerifyEnvironment } from "./environment";
|
|
6
|
+
|
|
7
|
+
const tempDirs: string[] = [];
|
|
8
|
+
|
|
9
|
+
function makeTempDir(prefix: string): string {
|
|
10
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
11
|
+
tempDirs.push(dir);
|
|
12
|
+
return dir;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
for (const dir of tempDirs.splice(0)) {
|
|
17
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe("verify environment manifest", () => {
|
|
22
|
+
it("loads a root environment.json manifest and normalizes sandbox settings", () => {
|
|
23
|
+
const dir = makeTempDir("muonroi-verify-env-");
|
|
24
|
+
fs.writeFileSync(
|
|
25
|
+
path.join(dir, "environment.json"),
|
|
26
|
+
JSON.stringify(
|
|
27
|
+
{
|
|
28
|
+
ecosystem: "node",
|
|
29
|
+
appKind: "nextjs",
|
|
30
|
+
appLabel: "Demo app",
|
|
31
|
+
install: ["npm ci"],
|
|
32
|
+
build: ["npm run build"],
|
|
33
|
+
start: "npm run start",
|
|
34
|
+
startPort: "3000",
|
|
35
|
+
smokeKind: "http",
|
|
36
|
+
sandbox: {
|
|
37
|
+
from: "verify-node-web",
|
|
38
|
+
verifyBaseFrom: "verify-node-web-base",
|
|
39
|
+
shellInit: ["export FOO=bar"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
null,
|
|
43
|
+
2,
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const loaded = loadVerifyEnvironment(dir, { allowNet: true });
|
|
48
|
+
expect(loaded?.path).toBe(path.join(dir, "environment.json"));
|
|
49
|
+
expect(loaded?.recipe.installCommands).toEqual(["npm ci"]);
|
|
50
|
+
expect(loaded?.recipe.buildCommands).toEqual(["npm run build"]);
|
|
51
|
+
expect(loaded?.recipe.startCommand).toBe("npm run start");
|
|
52
|
+
expect(loaded?.sandboxSettings.from).toBe("verify-node-web");
|
|
53
|
+
expect(loaded?.sandboxSettings.verifyBaseFrom).toBe("verify-node-web-base");
|
|
54
|
+
expect(loaded?.sandboxSettings.shellInit).toEqual(["export FOO=bar"]);
|
|
55
|
+
expect(loaded?.sandboxSettings.allowNet).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("prefers .muonroi-cli/environment.json over the root manifest", () => {
|
|
59
|
+
const dir = makeTempDir("muonroi-verify-env-precedence-");
|
|
60
|
+
fs.writeFileSync(
|
|
61
|
+
path.join(dir, "environment.json"),
|
|
62
|
+
JSON.stringify({
|
|
63
|
+
ecosystem: "node",
|
|
64
|
+
appKind: "vite",
|
|
65
|
+
appLabel: "Root",
|
|
66
|
+
install: ["npm install"],
|
|
67
|
+
smokeKind: "none",
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
fs.mkdirSync(path.join(dir, ".muonroi-cli"));
|
|
71
|
+
fs.writeFileSync(
|
|
72
|
+
path.join(dir, ".muonroi-cli", "environment.json"),
|
|
73
|
+
JSON.stringify({
|
|
74
|
+
ecosystem: "node",
|
|
75
|
+
appKind: "nextjs",
|
|
76
|
+
appLabel: "Nested",
|
|
77
|
+
install: ["npm ci"],
|
|
78
|
+
smokeKind: "none",
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const loaded = loadVerifyEnvironment(dir);
|
|
83
|
+
expect(loaded?.path).toBe(path.join(dir, ".muonroi-cli", "environment.json"));
|
|
84
|
+
expect(loaded?.recipe.appKind).toBe("nextjs");
|
|
85
|
+
expect(loaded?.recipe.installCommands).toEqual(["npm ci"]);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("writes a generated .muonroi-cli/environment.json manifest", () => {
|
|
89
|
+
const dir = makeTempDir("muonroi-verify-env-write-");
|
|
90
|
+
const written = saveVerifyEnvironment(
|
|
91
|
+
dir,
|
|
92
|
+
{
|
|
93
|
+
ecosystem: "node",
|
|
94
|
+
appKind: "nextjs",
|
|
95
|
+
appLabel: "Generated app",
|
|
96
|
+
shellInitCommands: ["export DEBIAN_FRONTEND=noninteractive"],
|
|
97
|
+
bootstrapCommands: ["apt-get update"],
|
|
98
|
+
installCommands: ["npm ci"],
|
|
99
|
+
buildCommands: ["npm run build"],
|
|
100
|
+
testCommands: ["npm run lint"],
|
|
101
|
+
startCommand: "npm run start",
|
|
102
|
+
startPort: "3000",
|
|
103
|
+
smokeKind: "http",
|
|
104
|
+
smokeTarget: "http://127.0.0.1:3000",
|
|
105
|
+
evidence: ["Detected package.json"],
|
|
106
|
+
notes: ["Generated by verify"],
|
|
107
|
+
},
|
|
108
|
+
{ verifyBaseFrom: "verify-node-web", ports: ["3000:3000"], allowEphemeralInstall: true },
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
expect(written).toBe(path.join(dir, ".muonroi-cli", "environment.json"));
|
|
112
|
+
const loaded = loadVerifyEnvironment(dir);
|
|
113
|
+
expect(loaded?.path).toBe(written);
|
|
114
|
+
expect(loaded?.recipe.installCommands).toEqual(["npm ci"]);
|
|
115
|
+
expect(loaded?.sandboxSettings.verifyBaseFrom).toBe("verify-node-web");
|
|
116
|
+
expect(loaded?.sandboxSettings.ports).toEqual(["3000:3000"]);
|
|
117
|
+
expect(loaded?.sandboxSettings.allowEphemeralInstall).toBeUndefined();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import type { VerifyEnvironmentManifest, VerifyRecipe } from "../types/index";
|
|
4
|
+
import { mergeSandboxSettings, normalizeSandboxSettings, type SandboxSettings } from "../utils/settings";
|
|
5
|
+
import { normalizeVerifyRecipe } from "./recipes";
|
|
6
|
+
|
|
7
|
+
export interface LoadedVerifyEnvironment {
|
|
8
|
+
path: string;
|
|
9
|
+
recipe: VerifyRecipe;
|
|
10
|
+
sandboxSettings: SandboxSettings;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VERIFY_ENVIRONMENT_FILES = [".muonroi-cli/environment.json", "environment.json"];
|
|
14
|
+
const GENERATED_VERIFY_ENVIRONMENT = ".muonroi-cli/environment.json";
|
|
15
|
+
|
|
16
|
+
function readJson(filePath: string): VerifyEnvironmentManifest | null {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8")) as VerifyEnvironmentManifest;
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function asStringArray(value: unknown): string[] {
|
|
25
|
+
if (typeof value === "string" && value.trim()) return [value.trim()];
|
|
26
|
+
if (!Array.isArray(value)) return [];
|
|
27
|
+
return value
|
|
28
|
+
.filter((entry): entry is string => typeof entry === "string" && entry.trim() !== "")
|
|
29
|
+
.map((entry) => entry.trim());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function normalizeManifestRecipe(raw: VerifyEnvironmentManifest): VerifyRecipe | null {
|
|
33
|
+
const base = raw.recipe && typeof raw.recipe === "object" ? raw.recipe : raw;
|
|
34
|
+
return normalizeVerifyRecipe({
|
|
35
|
+
ecosystem: base.ecosystem ?? raw.ecosystem ?? "custom",
|
|
36
|
+
appKind: base.appKind ?? raw.appKind ?? "unknown",
|
|
37
|
+
appLabel: base.appLabel ?? raw.appLabel ?? "Custom verify environment",
|
|
38
|
+
shellInitCommands: base.shellInitCommands ?? base.shellInit ?? raw.shellInitCommands ?? raw.shellInit ?? [],
|
|
39
|
+
bootstrapCommands: base.bootstrapCommands ?? base.bootstrap ?? raw.bootstrapCommands ?? raw.bootstrap ?? [],
|
|
40
|
+
installCommands: base.installCommands ?? base.install ?? raw.installCommands ?? raw.install ?? [],
|
|
41
|
+
buildCommands: base.buildCommands ?? base.build ?? raw.buildCommands ?? raw.build ?? [],
|
|
42
|
+
testCommands: base.testCommands ?? base.test ?? raw.testCommands ?? raw.test ?? [],
|
|
43
|
+
startCommand: base.startCommand ?? base.start ?? raw.startCommand ?? raw.start,
|
|
44
|
+
startPort: base.startPort ?? raw.startPort,
|
|
45
|
+
smokeKind: base.smokeKind ?? raw.smokeKind ?? "none",
|
|
46
|
+
smokeTarget: base.smokeTarget ?? raw.smokeTarget,
|
|
47
|
+
evidence: asStringArray(base.evidence ?? raw.evidence),
|
|
48
|
+
notes: asStringArray(base.notes ?? raw.notes),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function loadVerifyEnvironment(cwd: string, baseSettings: SandboxSettings = {}): LoadedVerifyEnvironment | null {
|
|
53
|
+
for (const candidate of VERIFY_ENVIRONMENT_FILES) {
|
|
54
|
+
const filePath = path.join(cwd, candidate);
|
|
55
|
+
if (!fs.existsSync(filePath)) continue;
|
|
56
|
+
const manifest = readJson(filePath);
|
|
57
|
+
if (!manifest) continue;
|
|
58
|
+
const recipe = normalizeManifestRecipe(manifest);
|
|
59
|
+
if (!recipe) continue;
|
|
60
|
+
const sandboxSettings = mergeSandboxSettings(baseSettings, normalizeSandboxSettings(manifest.sandbox));
|
|
61
|
+
return {
|
|
62
|
+
path: filePath,
|
|
63
|
+
recipe,
|
|
64
|
+
sandboxSettings,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function pickPersistentSandboxSettings(settings: SandboxSettings): SandboxSettings {
|
|
71
|
+
const persistent: SandboxSettings = {};
|
|
72
|
+
if (settings.allowNet !== undefined) persistent.allowNet = settings.allowNet;
|
|
73
|
+
if (settings.allowedHosts?.length) persistent.allowedHosts = settings.allowedHosts;
|
|
74
|
+
if (settings.ports?.length) persistent.ports = settings.ports;
|
|
75
|
+
if (settings.cpus) persistent.cpus = settings.cpus;
|
|
76
|
+
if (settings.memory) persistent.memory = settings.memory;
|
|
77
|
+
if (settings.diskSize) persistent.diskSize = settings.diskSize;
|
|
78
|
+
if (settings.secrets?.length) persistent.secrets = settings.secrets;
|
|
79
|
+
if (settings.from) persistent.from = settings.from;
|
|
80
|
+
if (settings.verifyBaseFrom) persistent.verifyBaseFrom = settings.verifyBaseFrom;
|
|
81
|
+
if (settings.guestWorkdir) persistent.guestWorkdir = settings.guestWorkdir;
|
|
82
|
+
if (settings.syncHostWorkspace !== undefined) persistent.syncHostWorkspace = settings.syncHostWorkspace;
|
|
83
|
+
if (settings.shellInit?.length) persistent.shellInit = settings.shellInit;
|
|
84
|
+
return persistent;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function saveVerifyEnvironment(
|
|
88
|
+
cwd: string,
|
|
89
|
+
recipe: VerifyRecipe,
|
|
90
|
+
sandboxSettings: SandboxSettings = {},
|
|
91
|
+
): string {
|
|
92
|
+
const filePath = path.join(cwd, GENERATED_VERIFY_ENVIRONMENT);
|
|
93
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
94
|
+
const payload: VerifyEnvironmentManifest = {
|
|
95
|
+
recipe: {
|
|
96
|
+
ecosystem: recipe.ecosystem,
|
|
97
|
+
appKind: recipe.appKind,
|
|
98
|
+
appLabel: recipe.appLabel,
|
|
99
|
+
shellInitCommands: recipe.shellInitCommands,
|
|
100
|
+
bootstrapCommands: recipe.bootstrapCommands,
|
|
101
|
+
installCommands: recipe.installCommands,
|
|
102
|
+
buildCommands: recipe.buildCommands,
|
|
103
|
+
testCommands: recipe.testCommands,
|
|
104
|
+
startCommand: recipe.startCommand,
|
|
105
|
+
startPort: recipe.startPort,
|
|
106
|
+
smokeKind: recipe.smokeKind,
|
|
107
|
+
smokeTarget: recipe.smokeTarget,
|
|
108
|
+
evidence: recipe.evidence,
|
|
109
|
+
notes: recipe.notes,
|
|
110
|
+
},
|
|
111
|
+
sandbox: pickPersistentSandboxSettings(sandboxSettings),
|
|
112
|
+
};
|
|
113
|
+
fs.writeFileSync(filePath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
|
|
114
|
+
return filePath;
|
|
115
|
+
}
|