attocode 0.1.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/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/src/adapters.d.ts +83 -0
- package/dist/src/adapters.d.ts.map +1 -0
- package/dist/src/adapters.js +221 -0
- package/dist/src/adapters.js.map +1 -0
- package/dist/src/agent-tools/index.d.ts +7 -0
- package/dist/src/agent-tools/index.d.ts.map +1 -0
- package/dist/src/agent-tools/index.js +8 -0
- package/dist/src/agent-tools/index.js.map +1 -0
- package/dist/src/agent-tools/lsp-file-tools.d.ts +33 -0
- package/dist/src/agent-tools/lsp-file-tools.d.ts.map +1 -0
- package/dist/src/agent-tools/lsp-file-tools.js +200 -0
- package/dist/src/agent-tools/lsp-file-tools.js.map +1 -0
- package/dist/src/agent.d.ts +667 -0
- package/dist/src/agent.d.ts.map +1 -0
- package/dist/src/agent.js +2824 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/cli.d.ts +36 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +176 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/handler.d.ts +22 -0
- package/dist/src/commands/handler.d.ts.map +1 -0
- package/dist/src/commands/handler.js +1320 -0
- package/dist/src/commands/handler.js.map +1 -0
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +153 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/types.d.ts +70 -0
- package/dist/src/commands/types.d.ts.map +1 -0
- package/dist/src/commands/types.js +8 -0
- package/dist/src/commands/types.js.map +1 -0
- package/dist/src/config.d.ts +22 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +25 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/core/index.d.ts +32 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +35 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/process-handlers.d.ts +43 -0
- package/dist/src/core/process-handlers.d.ts.map +1 -0
- package/dist/src/core/process-handlers.js +117 -0
- package/dist/src/core/process-handlers.js.map +1 -0
- package/dist/src/core/protocol/bridge.d.ts +117 -0
- package/dist/src/core/protocol/bridge.d.ts.map +1 -0
- package/dist/src/core/protocol/bridge.js +149 -0
- package/dist/src/core/protocol/bridge.js.map +1 -0
- package/dist/src/core/protocol/index.d.ts +8 -0
- package/dist/src/core/protocol/index.d.ts.map +1 -0
- package/dist/src/core/protocol/index.js +8 -0
- package/dist/src/core/protocol/index.js.map +1 -0
- package/dist/src/core/protocol/types.d.ts +539 -0
- package/dist/src/core/protocol/types.d.ts.map +1 -0
- package/dist/src/core/protocol/types.js +149 -0
- package/dist/src/core/protocol/types.js.map +1 -0
- package/dist/src/core/queues/atomic-counter.d.ts +36 -0
- package/dist/src/core/queues/atomic-counter.d.ts.map +1 -0
- package/dist/src/core/queues/atomic-counter.js +46 -0
- package/dist/src/core/queues/atomic-counter.js.map +1 -0
- package/dist/src/core/queues/event-queue.d.ts +126 -0
- package/dist/src/core/queues/event-queue.d.ts.map +1 -0
- package/dist/src/core/queues/event-queue.js +208 -0
- package/dist/src/core/queues/event-queue.js.map +1 -0
- package/dist/src/core/queues/index.d.ts +12 -0
- package/dist/src/core/queues/index.d.ts.map +1 -0
- package/dist/src/core/queues/index.js +15 -0
- package/dist/src/core/queues/index.js.map +1 -0
- package/dist/src/core/queues/submission-queue.d.ts +116 -0
- package/dist/src/core/queues/submission-queue.d.ts.map +1 -0
- package/dist/src/core/queues/submission-queue.js +236 -0
- package/dist/src/core/queues/submission-queue.js.map +1 -0
- package/dist/src/costs/index.d.ts +22 -0
- package/dist/src/costs/index.d.ts.map +1 -0
- package/dist/src/costs/index.js +22 -0
- package/dist/src/costs/index.js.map +1 -0
- package/dist/src/costs/model-registry.d.ts +80 -0
- package/dist/src/costs/model-registry.d.ts.map +1 -0
- package/dist/src/costs/model-registry.js +237 -0
- package/dist/src/costs/model-registry.js.map +1 -0
- package/dist/src/costs/types.d.ts +50 -0
- package/dist/src/costs/types.d.ts.map +1 -0
- package/dist/src/costs/types.js +2 -0
- package/dist/src/costs/types.js.map +1 -0
- package/dist/src/defaults.d.ts +114 -0
- package/dist/src/defaults.d.ts.map +1 -0
- package/dist/src/defaults.js +457 -0
- package/dist/src/defaults.js.map +1 -0
- package/dist/src/first-run.d.ts +35 -0
- package/dist/src/first-run.d.ts.map +1 -0
- package/dist/src/first-run.js +94 -0
- package/dist/src/first-run.js.map +1 -0
- package/dist/src/hello.d.ts +2 -0
- package/dist/src/hello.d.ts.map +1 -0
- package/dist/src/hello.js +4 -0
- package/dist/src/hello.js.map +1 -0
- package/dist/src/integrations/agent-registry.d.ts +160 -0
- package/dist/src/integrations/agent-registry.d.ts.map +1 -0
- package/dist/src/integrations/agent-registry.js +446 -0
- package/dist/src/integrations/agent-registry.js.map +1 -0
- package/dist/src/integrations/auto-compaction.d.ts +177 -0
- package/dist/src/integrations/auto-compaction.d.ts.map +1 -0
- package/dist/src/integrations/auto-compaction.js +428 -0
- package/dist/src/integrations/auto-compaction.js.map +1 -0
- package/dist/src/integrations/cancellation.d.ts +162 -0
- package/dist/src/integrations/cancellation.d.ts.map +1 -0
- package/dist/src/integrations/cancellation.js +339 -0
- package/dist/src/integrations/cancellation.js.map +1 -0
- package/dist/src/integrations/codebase-context.d.ts +319 -0
- package/dist/src/integrations/codebase-context.d.ts.map +1 -0
- package/dist/src/integrations/codebase-context.js +816 -0
- package/dist/src/integrations/codebase-context.js.map +1 -0
- package/dist/src/integrations/compaction.d.ts +192 -0
- package/dist/src/integrations/compaction.d.ts.map +1 -0
- package/dist/src/integrations/compaction.js +376 -0
- package/dist/src/integrations/compaction.js.map +1 -0
- package/dist/src/integrations/context-engineering.d.ts +246 -0
- package/dist/src/integrations/context-engineering.d.ts.map +1 -0
- package/dist/src/integrations/context-engineering.js +394 -0
- package/dist/src/integrations/context-engineering.js.map +1 -0
- package/dist/src/integrations/diff-utils.d.ts +105 -0
- package/dist/src/integrations/diff-utils.d.ts.map +1 -0
- package/dist/src/integrations/diff-utils.js +497 -0
- package/dist/src/integrations/diff-utils.js.map +1 -0
- package/dist/src/integrations/economics.d.ts +192 -0
- package/dist/src/integrations/economics.d.ts.map +1 -0
- package/dist/src/integrations/economics.js +431 -0
- package/dist/src/integrations/economics.js.map +1 -0
- package/dist/src/integrations/execution-policy.d.ts +189 -0
- package/dist/src/integrations/execution-policy.d.ts.map +1 -0
- package/dist/src/integrations/execution-policy.js +352 -0
- package/dist/src/integrations/execution-policy.js.map +1 -0
- package/dist/src/integrations/file-change-tracker.d.ts +161 -0
- package/dist/src/integrations/file-change-tracker.d.ts.map +1 -0
- package/dist/src/integrations/file-change-tracker.js +520 -0
- package/dist/src/integrations/file-change-tracker.js.map +1 -0
- package/dist/src/integrations/hierarchical-config.d.ts +212 -0
- package/dist/src/integrations/hierarchical-config.d.ts.map +1 -0
- package/dist/src/integrations/hierarchical-config.js +484 -0
- package/dist/src/integrations/hierarchical-config.js.map +1 -0
- package/dist/src/integrations/hooks.d.ts +114 -0
- package/dist/src/integrations/hooks.d.ts.map +1 -0
- package/dist/src/integrations/hooks.js +326 -0
- package/dist/src/integrations/hooks.js.map +1 -0
- package/dist/src/integrations/ignore.d.ts +143 -0
- package/dist/src/integrations/ignore.d.ts.map +1 -0
- package/dist/src/integrations/ignore.js +417 -0
- package/dist/src/integrations/ignore.js.map +1 -0
- package/dist/src/integrations/image-renderer.d.ts +119 -0
- package/dist/src/integrations/image-renderer.d.ts.map +1 -0
- package/dist/src/integrations/image-renderer.js +306 -0
- package/dist/src/integrations/image-renderer.js.map +1 -0
- package/dist/src/integrations/index.d.ts +42 -0
- package/dist/src/integrations/index.d.ts.map +1 -0
- package/dist/src/integrations/index.js +73 -0
- package/dist/src/integrations/index.js.map +1 -0
- package/dist/src/integrations/lsp.d.ts +196 -0
- package/dist/src/integrations/lsp.d.ts.map +1 -0
- package/dist/src/integrations/lsp.js +582 -0
- package/dist/src/integrations/lsp.js.map +1 -0
- package/dist/src/integrations/mcp-client.d.ts +270 -0
- package/dist/src/integrations/mcp-client.d.ts.map +1 -0
- package/dist/src/integrations/mcp-client.js +698 -0
- package/dist/src/integrations/mcp-client.js.map +1 -0
- package/dist/src/integrations/mcp-tool-search.d.ts +77 -0
- package/dist/src/integrations/mcp-tool-search.d.ts.map +1 -0
- package/dist/src/integrations/mcp-tool-search.js +220 -0
- package/dist/src/integrations/mcp-tool-search.js.map +1 -0
- package/dist/src/integrations/memory.d.ts +108 -0
- package/dist/src/integrations/memory.d.ts.map +1 -0
- package/dist/src/integrations/memory.js +288 -0
- package/dist/src/integrations/memory.js.map +1 -0
- package/dist/src/integrations/multi-agent.d.ts +150 -0
- package/dist/src/integrations/multi-agent.d.ts.map +1 -0
- package/dist/src/integrations/multi-agent.js +306 -0
- package/dist/src/integrations/multi-agent.js.map +1 -0
- package/dist/src/integrations/observability.d.ts +162 -0
- package/dist/src/integrations/observability.d.ts.map +1 -0
- package/dist/src/integrations/observability.js +406 -0
- package/dist/src/integrations/observability.js.map +1 -0
- package/dist/src/integrations/openrouter-pricing.d.ts +42 -0
- package/dist/src/integrations/openrouter-pricing.d.ts.map +1 -0
- package/dist/src/integrations/openrouter-pricing.js +124 -0
- package/dist/src/integrations/openrouter-pricing.js.map +1 -0
- package/dist/src/integrations/pending-plan.d.ts +171 -0
- package/dist/src/integrations/pending-plan.d.ts.map +1 -0
- package/dist/src/integrations/pending-plan.js +244 -0
- package/dist/src/integrations/pending-plan.js.map +1 -0
- package/dist/src/integrations/persistence.d.ts +48 -0
- package/dist/src/integrations/persistence.d.ts.map +1 -0
- package/dist/src/integrations/persistence.js +196 -0
- package/dist/src/integrations/persistence.js.map +1 -0
- package/dist/src/integrations/planning.d.ts +96 -0
- package/dist/src/integrations/planning.d.ts.map +1 -0
- package/dist/src/integrations/planning.js +338 -0
- package/dist/src/integrations/planning.js.map +1 -0
- package/dist/src/integrations/pty-shell.d.ts +169 -0
- package/dist/src/integrations/pty-shell.d.ts.map +1 -0
- package/dist/src/integrations/pty-shell.js +367 -0
- package/dist/src/integrations/pty-shell.js.map +1 -0
- package/dist/src/integrations/react.d.ts +139 -0
- package/dist/src/integrations/react.d.ts.map +1 -0
- package/dist/src/integrations/react.js +273 -0
- package/dist/src/integrations/react.js.map +1 -0
- package/dist/src/integrations/resources.d.ts +177 -0
- package/dist/src/integrations/resources.d.ts.map +1 -0
- package/dist/src/integrations/resources.js +311 -0
- package/dist/src/integrations/resources.js.map +1 -0
- package/dist/src/integrations/result-synthesizer.d.ts +389 -0
- package/dist/src/integrations/result-synthesizer.d.ts.map +1 -0
- package/dist/src/integrations/result-synthesizer.js +951 -0
- package/dist/src/integrations/result-synthesizer.js.map +1 -0
- package/dist/src/integrations/routing.d.ts +117 -0
- package/dist/src/integrations/routing.d.ts.map +1 -0
- package/dist/src/integrations/routing.js +347 -0
- package/dist/src/integrations/routing.js.map +1 -0
- package/dist/src/integrations/rules.d.ts +131 -0
- package/dist/src/integrations/rules.d.ts.map +1 -0
- package/dist/src/integrations/rules.js +284 -0
- package/dist/src/integrations/rules.js.map +1 -0
- package/dist/src/integrations/safety.d.ts +142 -0
- package/dist/src/integrations/safety.d.ts.map +1 -0
- package/dist/src/integrations/safety.js +342 -0
- package/dist/src/integrations/safety.js.map +1 -0
- package/dist/src/integrations/sandbox/basic.d.ts +74 -0
- package/dist/src/integrations/sandbox/basic.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/basic.js +310 -0
- package/dist/src/integrations/sandbox/basic.js.map +1 -0
- package/dist/src/integrations/sandbox/docker.d.ts +94 -0
- package/dist/src/integrations/sandbox/docker.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/docker.js +293 -0
- package/dist/src/integrations/sandbox/docker.js.map +1 -0
- package/dist/src/integrations/sandbox/index.d.ts +182 -0
- package/dist/src/integrations/sandbox/index.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/index.js +382 -0
- package/dist/src/integrations/sandbox/index.js.map +1 -0
- package/dist/src/integrations/sandbox/landlock.d.ts +59 -0
- package/dist/src/integrations/sandbox/landlock.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/landlock.js +326 -0
- package/dist/src/integrations/sandbox/landlock.js.map +1 -0
- package/dist/src/integrations/sandbox/seatbelt.d.ts +68 -0
- package/dist/src/integrations/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/seatbelt.js +298 -0
- package/dist/src/integrations/sandbox/seatbelt.js.map +1 -0
- package/dist/src/integrations/semantic-cache.d.ts +178 -0
- package/dist/src/integrations/semantic-cache.d.ts.map +1 -0
- package/dist/src/integrations/semantic-cache.js +372 -0
- package/dist/src/integrations/semantic-cache.js.map +1 -0
- package/dist/src/integrations/session-store.d.ts +183 -0
- package/dist/src/integrations/session-store.d.ts.map +1 -0
- package/dist/src/integrations/session-store.js +345 -0
- package/dist/src/integrations/session-store.js.map +1 -0
- package/dist/src/integrations/shared-blackboard.d.ts +403 -0
- package/dist/src/integrations/shared-blackboard.d.ts.map +1 -0
- package/dist/src/integrations/shared-blackboard.js +710 -0
- package/dist/src/integrations/shared-blackboard.js.map +1 -0
- package/dist/src/integrations/skills.d.ts +171 -0
- package/dist/src/integrations/skills.d.ts.map +1 -0
- package/dist/src/integrations/skills.js +403 -0
- package/dist/src/integrations/skills.js.map +1 -0
- package/dist/src/integrations/smart-decomposer.d.ts +322 -0
- package/dist/src/integrations/smart-decomposer.d.ts.map +1 -0
- package/dist/src/integrations/smart-decomposer.js +856 -0
- package/dist/src/integrations/smart-decomposer.js.map +1 -0
- package/dist/src/integrations/sourcegraph.d.ts +169 -0
- package/dist/src/integrations/sourcegraph.d.ts.map +1 -0
- package/dist/src/integrations/sourcegraph.js +379 -0
- package/dist/src/integrations/sourcegraph.js.map +1 -0
- package/dist/src/integrations/sqlite-store.d.ts +518 -0
- package/dist/src/integrations/sqlite-store.d.ts.map +1 -0
- package/dist/src/integrations/sqlite-store.js +1423 -0
- package/dist/src/integrations/sqlite-store.js.map +1 -0
- package/dist/src/integrations/streaming.d.ts +102 -0
- package/dist/src/integrations/streaming.d.ts.map +1 -0
- package/dist/src/integrations/streaming.js +362 -0
- package/dist/src/integrations/streaming.js.map +1 -0
- package/dist/src/integrations/thread-manager.d.ts +199 -0
- package/dist/src/integrations/thread-manager.d.ts.map +1 -0
- package/dist/src/integrations/thread-manager.js +357 -0
- package/dist/src/integrations/thread-manager.js.map +1 -0
- package/dist/src/main.d.ts +26 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +170 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/modes/index.d.ts +10 -0
- package/dist/src/modes/index.d.ts.map +1 -0
- package/dist/src/modes/index.js +10 -0
- package/dist/src/modes/index.js.map +1 -0
- package/dist/src/modes/repl.d.ts +19 -0
- package/dist/src/modes/repl.d.ts.map +1 -0
- package/dist/src/modes/repl.js +393 -0
- package/dist/src/modes/repl.js.map +1 -0
- package/dist/src/modes/tui.d.ts +29 -0
- package/dist/src/modes/tui.d.ts.map +1 -0
- package/dist/src/modes/tui.js +272 -0
- package/dist/src/modes/tui.js.map +1 -0
- package/dist/src/modes.d.ts +179 -0
- package/dist/src/modes.d.ts.map +1 -0
- package/dist/src/modes.js +385 -0
- package/dist/src/modes.js.map +1 -0
- package/dist/src/observability/tracer.d.ts +111 -0
- package/dist/src/observability/tracer.d.ts.map +1 -0
- package/dist/src/observability/tracer.js +300 -0
- package/dist/src/observability/tracer.js.map +1 -0
- package/dist/src/observability/types.d.ts +271 -0
- package/dist/src/observability/types.d.ts.map +1 -0
- package/dist/src/observability/types.js +24 -0
- package/dist/src/observability/types.js.map +1 -0
- package/dist/src/paths.d.ts +101 -0
- package/dist/src/paths.d.ts.map +1 -0
- package/dist/src/paths.js +148 -0
- package/dist/src/paths.js.map +1 -0
- package/dist/src/persistence/index.d.ts +38 -0
- package/dist/src/persistence/index.d.ts.map +1 -0
- package/dist/src/persistence/index.js +48 -0
- package/dist/src/persistence/index.js.map +1 -0
- package/dist/src/persistence/migrator.d.ts +135 -0
- package/dist/src/persistence/migrator.d.ts.map +1 -0
- package/dist/src/persistence/migrator.js +303 -0
- package/dist/src/persistence/migrator.js.map +1 -0
- package/dist/src/persistence/schema.d.ts +101 -0
- package/dist/src/persistence/schema.d.ts.map +1 -0
- package/dist/src/persistence/schema.js +395 -0
- package/dist/src/persistence/schema.js.map +1 -0
- package/dist/src/providers/adapters/anthropic.d.ts +20 -0
- package/dist/src/providers/adapters/anthropic.d.ts.map +1 -0
- package/dist/src/providers/adapters/anthropic.js +124 -0
- package/dist/src/providers/adapters/anthropic.js.map +1 -0
- package/dist/src/providers/adapters/mock.d.ts +25 -0
- package/dist/src/providers/adapters/mock.d.ts.map +1 -0
- package/dist/src/providers/adapters/mock.js +133 -0
- package/dist/src/providers/adapters/mock.js.map +1 -0
- package/dist/src/providers/adapters/openai.d.ts +21 -0
- package/dist/src/providers/adapters/openai.d.ts.map +1 -0
- package/dist/src/providers/adapters/openai.js +126 -0
- package/dist/src/providers/adapters/openai.js.map +1 -0
- package/dist/src/providers/adapters/openrouter.d.ts +49 -0
- package/dist/src/providers/adapters/openrouter.d.ts.map +1 -0
- package/dist/src/providers/adapters/openrouter.js +363 -0
- package/dist/src/providers/adapters/openrouter.js.map +1 -0
- package/dist/src/providers/provider.d.ts +54 -0
- package/dist/src/providers/provider.d.ts.map +1 -0
- package/dist/src/providers/provider.js +111 -0
- package/dist/src/providers/provider.js.map +1 -0
- package/dist/src/providers/resilient-fetch.d.ts +99 -0
- package/dist/src/providers/resilient-fetch.d.ts.map +1 -0
- package/dist/src/providers/resilient-fetch.js +208 -0
- package/dist/src/providers/resilient-fetch.js.map +1 -0
- package/dist/src/providers/types.d.ts +227 -0
- package/dist/src/providers/types.d.ts.map +1 -0
- package/dist/src/providers/types.js +24 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/session-picker.d.ts +28 -0
- package/dist/src/session-picker.d.ts.map +1 -0
- package/dist/src/session-picker.js +256 -0
- package/dist/src/session-picker.js.map +1 -0
- package/dist/src/test-sqlite.d.ts +2 -0
- package/dist/src/test-sqlite.d.ts.map +1 -0
- package/dist/src/test-sqlite.js +114 -0
- package/dist/src/test-sqlite.js.map +1 -0
- package/dist/src/tools/agent.d.ts +44 -0
- package/dist/src/tools/agent.d.ts.map +1 -0
- package/dist/src/tools/agent.js +110 -0
- package/dist/src/tools/agent.js.map +1 -0
- package/dist/src/tools/bash.d.ts +52 -0
- package/dist/src/tools/bash.d.ts.map +1 -0
- package/dist/src/tools/bash.js +141 -0
- package/dist/src/tools/bash.js.map +1 -0
- package/dist/src/tools/file.d.ts +47 -0
- package/dist/src/tools/file.d.ts.map +1 -0
- package/dist/src/tools/file.js +263 -0
- package/dist/src/tools/file.js.map +1 -0
- package/dist/src/tools/permission.d.ts +43 -0
- package/dist/src/tools/permission.d.ts.map +1 -0
- package/dist/src/tools/permission.js +216 -0
- package/dist/src/tools/permission.js.map +1 -0
- package/dist/src/tools/registry.d.ts +63 -0
- package/dist/src/tools/registry.d.ts.map +1 -0
- package/dist/src/tools/registry.js +250 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/standard.d.ts +57 -0
- package/dist/src/tools/standard.d.ts.map +1 -0
- package/dist/src/tools/standard.js +113 -0
- package/dist/src/tools/standard.js.map +1 -0
- package/dist/src/tools/types.d.ts +146 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +28 -0
- package/dist/src/tools/types.js.map +1 -0
- package/dist/src/tools/undo.d.ts +71 -0
- package/dist/src/tools/undo.d.ts.map +1 -0
- package/dist/src/tools/undo.js +123 -0
- package/dist/src/tools/undo.js.map +1 -0
- package/dist/src/tracing/cache-boundary-tracker.d.ts +189 -0
- package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -0
- package/dist/src/tracing/cache-boundary-tracker.js +411 -0
- package/dist/src/tracing/cache-boundary-tracker.js.map +1 -0
- package/dist/src/tracing/trace-collector.d.ts +274 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -0
- package/dist/src/tracing/trace-collector.js +727 -0
- package/dist/src/tracing/trace-collector.js.map +1 -0
- package/dist/src/tracing/types.d.ts +657 -0
- package/dist/src/tracing/types.d.ts.map +1 -0
- package/dist/src/tracing/types.js +39 -0
- package/dist/src/tracing/types.js.map +1 -0
- package/dist/src/tricks/failure-evidence.d.ts +268 -0
- package/dist/src/tricks/failure-evidence.d.ts.map +1 -0
- package/dist/src/tricks/failure-evidence.js +544 -0
- package/dist/src/tricks/failure-evidence.js.map +1 -0
- package/dist/src/tricks/json-utils.d.ts +77 -0
- package/dist/src/tricks/json-utils.d.ts.map +1 -0
- package/dist/src/tricks/json-utils.js +247 -0
- package/dist/src/tricks/json-utils.js.map +1 -0
- package/dist/src/tricks/kv-cache-context.d.ts +227 -0
- package/dist/src/tricks/kv-cache-context.d.ts.map +1 -0
- package/dist/src/tricks/kv-cache-context.js +377 -0
- package/dist/src/tricks/kv-cache-context.js.map +1 -0
- package/dist/src/tricks/recitation.d.ts +208 -0
- package/dist/src/tricks/recitation.d.ts.map +1 -0
- package/dist/src/tricks/recitation.js +374 -0
- package/dist/src/tricks/recitation.js.map +1 -0
- package/dist/src/tricks/reversible-compaction.d.ts +251 -0
- package/dist/src/tricks/reversible-compaction.d.ts.map +1 -0
- package/dist/src/tricks/reversible-compaction.js +555 -0
- package/dist/src/tricks/reversible-compaction.js.map +1 -0
- package/dist/src/tricks/serialization-diversity.d.ts +197 -0
- package/dist/src/tricks/serialization-diversity.d.ts.map +1 -0
- package/dist/src/tricks/serialization-diversity.js +460 -0
- package/dist/src/tricks/serialization-diversity.js.map +1 -0
- package/dist/src/tui/app.d.ts +42 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +1076 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/components/ApprovalDialog.d.ts +28 -0
- package/dist/src/tui/components/ApprovalDialog.d.ts.map +1 -0
- package/dist/src/tui/components/ApprovalDialog.js +59 -0
- package/dist/src/tui/components/ApprovalDialog.js.map +1 -0
- package/dist/src/tui/components/InputArea.d.ts +35 -0
- package/dist/src/tui/components/InputArea.d.ts.map +1 -0
- package/dist/src/tui/components/InputArea.js +144 -0
- package/dist/src/tui/components/InputArea.js.map +1 -0
- package/dist/src/tui/components/MessageItem.d.ts +28 -0
- package/dist/src/tui/components/MessageItem.d.ts.map +1 -0
- package/dist/src/tui/components/MessageItem.js +27 -0
- package/dist/src/tui/components/MessageItem.js.map +1 -0
- package/dist/src/tui/components/ScrollableBox.d.ts +41 -0
- package/dist/src/tui/components/ScrollableBox.d.ts.map +1 -0
- package/dist/src/tui/components/ScrollableBox.js +101 -0
- package/dist/src/tui/components/ScrollableBox.js.map +1 -0
- package/dist/src/tui/components/ToolCallItem.d.ts +33 -0
- package/dist/src/tui/components/ToolCallItem.d.ts.map +1 -0
- package/dist/src/tui/components/ToolCallItem.js +91 -0
- package/dist/src/tui/components/ToolCallItem.js.map +1 -0
- package/dist/src/tui/components/index.d.ts +13 -0
- package/dist/src/tui/components/index.d.ts.map +1 -0
- package/dist/src/tui/components/index.js +15 -0
- package/dist/src/tui/components/index.js.map +1 -0
- package/dist/src/tui/event-display.d.ts +19 -0
- package/dist/src/tui/event-display.d.ts.map +1 -0
- package/dist/src/tui/event-display.js +178 -0
- package/dist/src/tui/event-display.js.map +1 -0
- package/dist/src/tui/index.d.ts +105 -0
- package/dist/src/tui/index.d.ts.map +1 -0
- package/dist/src/tui/index.js +214 -0
- package/dist/src/tui/index.js.map +1 -0
- package/dist/src/tui/input/CommandPalette.d.ts +55 -0
- package/dist/src/tui/input/CommandPalette.d.ts.map +1 -0
- package/dist/src/tui/input/CommandPalette.js +135 -0
- package/dist/src/tui/input/CommandPalette.js.map +1 -0
- package/dist/src/tui/input/index.d.ts +7 -0
- package/dist/src/tui/input/index.d.ts.map +1 -0
- package/dist/src/tui/input/index.js +7 -0
- package/dist/src/tui/input/index.js.map +1 -0
- package/dist/src/tui/theme/index.d.ts +45 -0
- package/dist/src/tui/theme/index.d.ts.map +1 -0
- package/dist/src/tui/theme/index.js +215 -0
- package/dist/src/tui/theme/index.js.map +1 -0
- package/dist/src/tui/types.d.ts +214 -0
- package/dist/src/tui/types.d.ts.map +1 -0
- package/dist/src/tui/types.js +27 -0
- package/dist/src/tui/types.js.map +1 -0
- package/dist/src/types.d.ts +905 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +9 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic Sandbox (Fallback)
|
|
3
|
+
*
|
|
4
|
+
* A simple allowlist/blocklist-based sandbox that works everywhere.
|
|
5
|
+
* Does not provide true isolation but validates commands before execution.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Command allowlist validation
|
|
9
|
+
* - Dangerous pattern blocking
|
|
10
|
+
* - Path validation
|
|
11
|
+
* - Timeout enforcement
|
|
12
|
+
*
|
|
13
|
+
* Note: This is NOT a security sandbox - it's a best-effort validation
|
|
14
|
+
* layer for environments where proper sandboxing isn't available.
|
|
15
|
+
*/
|
|
16
|
+
import { spawn } from 'child_process';
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// DANGEROUS PATTERNS
|
|
19
|
+
// =============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Patterns that should always be blocked.
|
|
22
|
+
*/
|
|
23
|
+
const DANGEROUS_PATTERNS = [
|
|
24
|
+
// Recursive deletion of root or home
|
|
25
|
+
/rm\s+(-[rf]+\s+)*\//,
|
|
26
|
+
/rm\s+(-[rf]+\s+)*~/,
|
|
27
|
+
// Fork bomb
|
|
28
|
+
/:\(\)\{.*\};:/,
|
|
29
|
+
// Writing to block devices
|
|
30
|
+
/>\s*\/dev\/sd[a-z]/,
|
|
31
|
+
/dd\s+.*of=\/dev/,
|
|
32
|
+
// Filesystem formatting
|
|
33
|
+
/mkfs/,
|
|
34
|
+
// Download and execute
|
|
35
|
+
/curl\s+.*\|\s*(ba)?sh/,
|
|
36
|
+
/wget\s+.*\|\s*(ba)?sh/,
|
|
37
|
+
// Privilege escalation
|
|
38
|
+
/sudo\s/,
|
|
39
|
+
/su\s+-/,
|
|
40
|
+
/doas\s/,
|
|
41
|
+
// Dangerous chmod
|
|
42
|
+
/chmod\s+777\s+\//,
|
|
43
|
+
/chmod\s+-R\s+777/,
|
|
44
|
+
// Network data exfiltration patterns
|
|
45
|
+
/curl\s+.*-d\s+.*\$\(/,
|
|
46
|
+
/nc\s+-e/,
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Commands that are always blocked.
|
|
50
|
+
*/
|
|
51
|
+
const BLOCKED_COMMANDS = [
|
|
52
|
+
'shutdown',
|
|
53
|
+
'reboot',
|
|
54
|
+
'halt',
|
|
55
|
+
'poweroff',
|
|
56
|
+
'init',
|
|
57
|
+
'systemctl stop',
|
|
58
|
+
'systemctl disable',
|
|
59
|
+
'mkfs',
|
|
60
|
+
'fdisk',
|
|
61
|
+
'parted',
|
|
62
|
+
'mount',
|
|
63
|
+
'umount',
|
|
64
|
+
'iptables',
|
|
65
|
+
'firewall-cmd',
|
|
66
|
+
];
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// BASIC SANDBOX
|
|
69
|
+
// =============================================================================
|
|
70
|
+
/**
|
|
71
|
+
* Basic allowlist-based sandbox.
|
|
72
|
+
*/
|
|
73
|
+
export class BasicSandbox {
|
|
74
|
+
options;
|
|
75
|
+
constructor(options) {
|
|
76
|
+
this.options = options;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Execute a command with validation.
|
|
80
|
+
*/
|
|
81
|
+
async execute(command, options) {
|
|
82
|
+
const mergedOptions = { ...this.options, ...options };
|
|
83
|
+
// Validate command
|
|
84
|
+
const validation = this.validateCommand(command, mergedOptions);
|
|
85
|
+
if (!validation.allowed) {
|
|
86
|
+
return {
|
|
87
|
+
stdout: '',
|
|
88
|
+
stderr: `Command blocked: ${validation.reason}`,
|
|
89
|
+
exitCode: 1,
|
|
90
|
+
killed: false,
|
|
91
|
+
timedOut: false,
|
|
92
|
+
error: validation.reason,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const timeout = mergedOptions.timeout ?? 60000;
|
|
96
|
+
const workDir = mergedOptions.workingDir ?? process.cwd();
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
const proc = spawn('bash', ['-c', command], {
|
|
99
|
+
cwd: workDir,
|
|
100
|
+
env: {
|
|
101
|
+
...process.env,
|
|
102
|
+
...mergedOptions.env,
|
|
103
|
+
},
|
|
104
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
105
|
+
});
|
|
106
|
+
let stdout = '';
|
|
107
|
+
let stderr = '';
|
|
108
|
+
let killed = false;
|
|
109
|
+
let timedOut = false;
|
|
110
|
+
const timer = setTimeout(() => {
|
|
111
|
+
timedOut = true;
|
|
112
|
+
killed = true;
|
|
113
|
+
proc.kill('SIGKILL');
|
|
114
|
+
}, timeout);
|
|
115
|
+
proc.stdout?.on('data', (data) => {
|
|
116
|
+
stdout += data.toString();
|
|
117
|
+
});
|
|
118
|
+
proc.stderr?.on('data', (data) => {
|
|
119
|
+
stderr += data.toString();
|
|
120
|
+
});
|
|
121
|
+
proc.on('close', (code) => {
|
|
122
|
+
clearTimeout(timer);
|
|
123
|
+
resolve({
|
|
124
|
+
stdout,
|
|
125
|
+
stderr,
|
|
126
|
+
exitCode: code ?? 1,
|
|
127
|
+
killed,
|
|
128
|
+
timedOut,
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
proc.on('error', (err) => {
|
|
132
|
+
clearTimeout(timer);
|
|
133
|
+
resolve({
|
|
134
|
+
stdout,
|
|
135
|
+
stderr,
|
|
136
|
+
exitCode: 1,
|
|
137
|
+
killed: false,
|
|
138
|
+
timedOut: false,
|
|
139
|
+
error: err.message,
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validate a command against allowlist and blocklist.
|
|
146
|
+
*/
|
|
147
|
+
validateCommand(command, options) {
|
|
148
|
+
// Check for dangerous patterns
|
|
149
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
150
|
+
if (pattern.test(command)) {
|
|
151
|
+
return { allowed: false, reason: 'Command matches dangerous pattern' };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Check for blocked commands
|
|
155
|
+
for (const blocked of BLOCKED_COMMANDS) {
|
|
156
|
+
if (command.includes(blocked)) {
|
|
157
|
+
return { allowed: false, reason: `Blocked command: ${blocked}` };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Check user-specified blocked commands
|
|
161
|
+
for (const blocked of options.blockedCommands ?? []) {
|
|
162
|
+
if (command.includes(blocked)) {
|
|
163
|
+
return { allowed: false, reason: `Blocked by configuration: ${blocked}` };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Extract the base command
|
|
167
|
+
const baseCommand = this.extractBaseCommand(command);
|
|
168
|
+
// Check against allowlist if provided
|
|
169
|
+
const allowedCommands = options.allowedCommands;
|
|
170
|
+
if (allowedCommands && allowedCommands.length > 0) {
|
|
171
|
+
if (!allowedCommands.includes(baseCommand)) {
|
|
172
|
+
return {
|
|
173
|
+
allowed: false,
|
|
174
|
+
reason: `Command '${baseCommand}' not in allowlist`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Check path access
|
|
179
|
+
const pathValidation = this.validatePaths(command, options);
|
|
180
|
+
if (!pathValidation.allowed) {
|
|
181
|
+
return pathValidation;
|
|
182
|
+
}
|
|
183
|
+
return { allowed: true };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Extract the base command from a command string.
|
|
187
|
+
*/
|
|
188
|
+
extractBaseCommand(command) {
|
|
189
|
+
// Handle pipes and redirects
|
|
190
|
+
const firstPart = command.split(/[|;&]/)[0].trim();
|
|
191
|
+
// Handle env vars and other prefixes
|
|
192
|
+
const parts = firstPart.split(/\s+/);
|
|
193
|
+
// Skip env var assignments
|
|
194
|
+
for (const part of parts) {
|
|
195
|
+
if (!part.includes('=') && !part.startsWith('-')) {
|
|
196
|
+
// Get just the command name without path
|
|
197
|
+
return part.split('/').pop() || part;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return parts[0] || '';
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Validate path access in command.
|
|
204
|
+
*/
|
|
205
|
+
validatePaths(command, options) {
|
|
206
|
+
const writablePaths = options.writablePaths ?? ['.'];
|
|
207
|
+
const workDir = options.workingDir ?? process.cwd();
|
|
208
|
+
// Check for writes to paths outside writable areas
|
|
209
|
+
const writePatterns = [
|
|
210
|
+
/>>\?\s*["']?([^"'\s]+)/g, // Append redirect
|
|
211
|
+
/>\s*["']?([^"'\s]+)/g, // Write redirect
|
|
212
|
+
/\btee\s+["']?([^"'\s]+)/g, // tee command
|
|
213
|
+
];
|
|
214
|
+
for (const pattern of writePatterns) {
|
|
215
|
+
let match;
|
|
216
|
+
while ((match = pattern.exec(command)) !== null) {
|
|
217
|
+
const path = match[1];
|
|
218
|
+
if (path && !this.isPathWritable(path, writablePaths, workDir)) {
|
|
219
|
+
return { allowed: false, reason: `Write to path not allowed: ${path}` };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return { allowed: true };
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Check if a path is in the writable list.
|
|
227
|
+
*/
|
|
228
|
+
isPathWritable(path, writablePaths, workDir) {
|
|
229
|
+
// Resolve the path
|
|
230
|
+
const resolvedPath = path.startsWith('/')
|
|
231
|
+
? path
|
|
232
|
+
: `${workDir}/${path}`;
|
|
233
|
+
// Check against writable paths
|
|
234
|
+
for (const writable of writablePaths) {
|
|
235
|
+
const resolvedWritable = writable.startsWith('/')
|
|
236
|
+
? writable
|
|
237
|
+
: writable === '.'
|
|
238
|
+
? workDir
|
|
239
|
+
: `${workDir}/${writable}`;
|
|
240
|
+
if (resolvedPath.startsWith(resolvedWritable)) {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Allow /tmp and /dev/null
|
|
245
|
+
if (resolvedPath.startsWith('/tmp') || resolvedPath === '/dev/null') {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Always available.
|
|
252
|
+
*/
|
|
253
|
+
async isAvailable() {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get sandbox type.
|
|
258
|
+
*/
|
|
259
|
+
getType() {
|
|
260
|
+
return 'basic';
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Cleanup resources.
|
|
264
|
+
*/
|
|
265
|
+
async cleanup() {
|
|
266
|
+
// No cleanup needed
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// =============================================================================
|
|
270
|
+
// UTILITY FUNCTIONS
|
|
271
|
+
// =============================================================================
|
|
272
|
+
/**
|
|
273
|
+
* Check if a command is safe to execute (static validation).
|
|
274
|
+
*/
|
|
275
|
+
export function isCommandSafe(command) {
|
|
276
|
+
// Check dangerous patterns
|
|
277
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
278
|
+
if (pattern.test(command)) {
|
|
279
|
+
return { safe: false, reason: 'Matches dangerous pattern' };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// Check blocked commands
|
|
283
|
+
for (const blocked of BLOCKED_COMMANDS) {
|
|
284
|
+
if (command.includes(blocked)) {
|
|
285
|
+
return { safe: false, reason: `Contains blocked command: ${blocked}` };
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return { safe: true };
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Sanitize a command argument for safe shell use.
|
|
292
|
+
*/
|
|
293
|
+
export function sanitizeArgument(arg) {
|
|
294
|
+
// Escape special shell characters
|
|
295
|
+
return arg.replace(/([\\$`"!])/g, '\\$1');
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Build a safe command string from parts.
|
|
299
|
+
*/
|
|
300
|
+
export function buildSafeCommand(command, args) {
|
|
301
|
+
const sanitizedArgs = args.map((arg) => {
|
|
302
|
+
// Quote arguments with spaces or special chars
|
|
303
|
+
if (/[\s\\$`"'!*?<>|;&]/.test(arg)) {
|
|
304
|
+
return `"${sanitizeArgument(arg)}"`;
|
|
305
|
+
}
|
|
306
|
+
return arg;
|
|
307
|
+
});
|
|
308
|
+
return `${command} ${sanitizedArgs.join(' ')}`;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=basic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../../src/integrations/sandbox/basic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,qCAAqC;IACrC,qBAAqB;IACrB,oBAAoB;IAEpB,YAAY;IACZ,eAAe;IAEf,2BAA2B;IAC3B,oBAAoB;IACpB,iBAAiB;IAEjB,wBAAwB;IACxB,MAAM;IAEN,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IAEvB,uBAAuB;IACvB,QAAQ;IACR,QAAQ;IACR,QAAQ;IAER,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAElB,qCAAqC;IACrC,sBAAsB;IACtB,SAAS;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,UAAU;IACV,QAAQ;IACR,MAAM;IACN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GAAG,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker Sandbox (Linux/Cross-platform)
|
|
3
|
+
*
|
|
4
|
+
* Uses Docker containers for process isolation and resource limiting.
|
|
5
|
+
* Works on any platform with Docker installed.
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Complete filesystem isolation
|
|
9
|
+
* - Network namespace separation
|
|
10
|
+
* - CPU and memory limits via cgroups
|
|
11
|
+
* - Capability dropping
|
|
12
|
+
*
|
|
13
|
+
* Note: Uses spawn() to invoke docker CLI commands with proper argument
|
|
14
|
+
* arrays - the sandbox provides security via containerization.
|
|
15
|
+
*/
|
|
16
|
+
import type { Sandbox, SandboxMode, SandboxOptions, ExecResult } from './index.js';
|
|
17
|
+
/**
|
|
18
|
+
* Docker-based sandbox implementation.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DockerSandbox implements Sandbox {
|
|
21
|
+
private options;
|
|
22
|
+
private image;
|
|
23
|
+
private available;
|
|
24
|
+
private containerId;
|
|
25
|
+
constructor(options: SandboxOptions, image?: string);
|
|
26
|
+
/**
|
|
27
|
+
* Execute a command inside a Docker container.
|
|
28
|
+
*
|
|
29
|
+
* Uses spawn with explicit argument arrays for security.
|
|
30
|
+
*/
|
|
31
|
+
execute(command: string, options?: Partial<SandboxOptions>): Promise<ExecResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Build docker run arguments.
|
|
34
|
+
*/
|
|
35
|
+
private buildDockerArgs;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a path relative to working directory.
|
|
38
|
+
*/
|
|
39
|
+
private resolvePath;
|
|
40
|
+
/**
|
|
41
|
+
* Check if Docker is available.
|
|
42
|
+
*/
|
|
43
|
+
isAvailable(): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Get sandbox type.
|
|
46
|
+
*/
|
|
47
|
+
getType(): SandboxMode;
|
|
48
|
+
/**
|
|
49
|
+
* Cleanup resources.
|
|
50
|
+
*/
|
|
51
|
+
cleanup(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Pull the Docker image if not present.
|
|
54
|
+
*/
|
|
55
|
+
ensureImage(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Set the Docker image to use.
|
|
58
|
+
*/
|
|
59
|
+
setImage(image: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get the current Docker image.
|
|
62
|
+
*/
|
|
63
|
+
getImage(): string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Recommended Docker images for different use cases.
|
|
67
|
+
*/
|
|
68
|
+
export declare const DOCKER_IMAGES: {
|
|
69
|
+
/** Minimal Node.js for JavaScript/TypeScript */
|
|
70
|
+
readonly node: "node:20-slim";
|
|
71
|
+
/** Python for Python scripts */
|
|
72
|
+
readonly python: "python:3.12-slim";
|
|
73
|
+
/** Alpine for general shell commands */
|
|
74
|
+
readonly alpine: "alpine:latest";
|
|
75
|
+
/** Ubuntu for full Linux environment */
|
|
76
|
+
readonly ubuntu: "ubuntu:22.04";
|
|
77
|
+
/** Deno for Deno scripts */
|
|
78
|
+
readonly deno: "denoland/deno:latest";
|
|
79
|
+
/** Bun for Bun scripts */
|
|
80
|
+
readonly bun: "oven/bun:latest";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Strict Docker profile - minimal access.
|
|
84
|
+
*/
|
|
85
|
+
export declare const DOCKER_STRICT_PROFILE: SandboxOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Development Docker profile.
|
|
88
|
+
*/
|
|
89
|
+
export declare const DOCKER_DEV_PROFILE: SandboxOptions;
|
|
90
|
+
/**
|
|
91
|
+
* CI/CD Docker profile.
|
|
92
|
+
*/
|
|
93
|
+
export declare const DOCKER_CI_PROFILE: SandboxOptions;
|
|
94
|
+
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../../src/integrations/sandbox/docker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMnF;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,WAAW,CAAuB;gBAE9B,OAAO,EAAE,cAAc,EAAE,KAAK,GAAE,MAAuB;IAKnE;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAuEtF;;OAEG;IACH,OAAO,CAAC,eAAe;IA+EvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;OAEG;IACH,OAAO,IAAI,WAAW;IAItB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGnB;AAMD;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB,gDAAgD;;IAGhD,gCAAgC;;IAGhC,wCAAwC;;IAGxC,wCAAwC;;IAGxC,4BAA4B;;IAG5B,0BAA0B;;CAElB,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAOnC,CAAC;AAEF;;GAEG;AACH,e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