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,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XDG Base Directory compliant paths for attocode.
|
|
3
|
+
*
|
|
4
|
+
* This module follows the XDG Base Directory Specification for storing
|
|
5
|
+
* application files in appropriate locations:
|
|
6
|
+
*
|
|
7
|
+
* - Config: ~/.config/attocode/ (or $XDG_CONFIG_HOME/attocode/)
|
|
8
|
+
* User-specific configuration files
|
|
9
|
+
*
|
|
10
|
+
* - Data: ~/.local/share/attocode/ (or $XDG_DATA_HOME/attocode/)
|
|
11
|
+
* User-specific data files (databases, persistent storage)
|
|
12
|
+
*
|
|
13
|
+
* - State: ~/.local/state/attocode/ (or $XDG_STATE_HOME/attocode/)
|
|
14
|
+
* User-specific state files (history, logs, runtime state)
|
|
15
|
+
*
|
|
16
|
+
* - Cache: ~/.cache/attocode/ (or $XDG_CACHE_HOME/attocode/)
|
|
17
|
+
* User-specific non-essential cached data
|
|
18
|
+
*
|
|
19
|
+
* - Project: .attocode/
|
|
20
|
+
* Project-specific files in the current working directory
|
|
21
|
+
*
|
|
22
|
+
* @see https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Get the configuration directory path.
|
|
26
|
+
* Uses $XDG_CONFIG_HOME if set, otherwise defaults to ~/.config/attocode/
|
|
27
|
+
*
|
|
28
|
+
* @returns Absolute path to the configuration directory
|
|
29
|
+
*/
|
|
30
|
+
export declare function getConfigDir(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the data directory path.
|
|
33
|
+
* Uses $XDG_DATA_HOME if set, otherwise defaults to ~/.local/share/attocode/
|
|
34
|
+
*
|
|
35
|
+
* @returns Absolute path to the data directory
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDataDir(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get the state directory path.
|
|
40
|
+
* Uses $XDG_STATE_HOME if set, otherwise defaults to ~/.local/state/attocode/
|
|
41
|
+
*
|
|
42
|
+
* @returns Absolute path to the state directory
|
|
43
|
+
*/
|
|
44
|
+
export declare function getStateDir(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get the cache directory path.
|
|
47
|
+
* Uses $XDG_CACHE_HOME if set, otherwise defaults to ~/.cache/attocode/
|
|
48
|
+
*
|
|
49
|
+
* @returns Absolute path to the cache directory
|
|
50
|
+
*/
|
|
51
|
+
export declare function getCacheDir(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Get the project-specific directory path.
|
|
54
|
+
* This is always .attocode/ within the specified working directory.
|
|
55
|
+
*
|
|
56
|
+
* @param cwd - The working directory (defaults to process.cwd())
|
|
57
|
+
* @returns Absolute path to the project directory
|
|
58
|
+
*/
|
|
59
|
+
export declare function getProjectDir(cwd?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get the path to the main configuration file.
|
|
62
|
+
*
|
|
63
|
+
* @returns Absolute path to config.json
|
|
64
|
+
*/
|
|
65
|
+
export declare function getConfigPath(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Get the path to the sessions database.
|
|
68
|
+
*
|
|
69
|
+
* @returns Absolute path to sessions.db
|
|
70
|
+
*/
|
|
71
|
+
export declare function getSessionsDbPath(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get the path to the command history file.
|
|
74
|
+
*
|
|
75
|
+
* @returns Absolute path to history file
|
|
76
|
+
*/
|
|
77
|
+
export declare function getHistoryPath(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Get the path to the global rules file.
|
|
80
|
+
*
|
|
81
|
+
* @returns Absolute path to rules.md
|
|
82
|
+
*/
|
|
83
|
+
export declare function getGlobalRulesPath(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Get the hierarchical MCP config paths.
|
|
86
|
+
* Returns paths in order of precedence (later overrides earlier):
|
|
87
|
+
* 1. Global user config: ~/.config/attocode/mcp.json
|
|
88
|
+
* 2. Workspace config: ./.mcp.json
|
|
89
|
+
*
|
|
90
|
+
* @param cwd - The working directory (defaults to process.cwd())
|
|
91
|
+
* @returns Array of config paths to check (in order of precedence)
|
|
92
|
+
*/
|
|
93
|
+
export declare function getMCPConfigPaths(cwd?: string): string[];
|
|
94
|
+
/**
|
|
95
|
+
* Ensure all XDG directories exist.
|
|
96
|
+
* Creates config, data, state, and cache directories if they don't exist.
|
|
97
|
+
*
|
|
98
|
+
* @returns Promise that resolves when all directories are created
|
|
99
|
+
*/
|
|
100
|
+
export declare function ensureDirectories(): Promise<void>;
|
|
101
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAKnC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAKpC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAGpC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAEjE;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CAKvE;AAMD;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XDG Base Directory compliant paths for attocode.
|
|
3
|
+
*
|
|
4
|
+
* This module follows the XDG Base Directory Specification for storing
|
|
5
|
+
* application files in appropriate locations:
|
|
6
|
+
*
|
|
7
|
+
* - Config: ~/.config/attocode/ (or $XDG_CONFIG_HOME/attocode/)
|
|
8
|
+
* User-specific configuration files
|
|
9
|
+
*
|
|
10
|
+
* - Data: ~/.local/share/attocode/ (or $XDG_DATA_HOME/attocode/)
|
|
11
|
+
* User-specific data files (databases, persistent storage)
|
|
12
|
+
*
|
|
13
|
+
* - State: ~/.local/state/attocode/ (or $XDG_STATE_HOME/attocode/)
|
|
14
|
+
* User-specific state files (history, logs, runtime state)
|
|
15
|
+
*
|
|
16
|
+
* - Cache: ~/.cache/attocode/ (or $XDG_CACHE_HOME/attocode/)
|
|
17
|
+
* User-specific non-essential cached data
|
|
18
|
+
*
|
|
19
|
+
* - Project: .attocode/
|
|
20
|
+
* Project-specific files in the current working directory
|
|
21
|
+
*
|
|
22
|
+
* @see https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
23
|
+
*/
|
|
24
|
+
import { homedir } from 'os';
|
|
25
|
+
import { join } from 'path';
|
|
26
|
+
/**
|
|
27
|
+
* Get the configuration directory path.
|
|
28
|
+
* Uses $XDG_CONFIG_HOME if set, otherwise defaults to ~/.config/attocode/
|
|
29
|
+
*
|
|
30
|
+
* @returns Absolute path to the configuration directory
|
|
31
|
+
*/
|
|
32
|
+
export function getConfigDir() {
|
|
33
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
34
|
+
return xdg ? join(xdg, 'attocode') : join(homedir(), '.config', 'attocode');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the data directory path.
|
|
38
|
+
* Uses $XDG_DATA_HOME if set, otherwise defaults to ~/.local/share/attocode/
|
|
39
|
+
*
|
|
40
|
+
* @returns Absolute path to the data directory
|
|
41
|
+
*/
|
|
42
|
+
export function getDataDir() {
|
|
43
|
+
const xdg = process.env.XDG_DATA_HOME;
|
|
44
|
+
return xdg
|
|
45
|
+
? join(xdg, 'attocode')
|
|
46
|
+
: join(homedir(), '.local', 'share', 'attocode');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the state directory path.
|
|
50
|
+
* Uses $XDG_STATE_HOME if set, otherwise defaults to ~/.local/state/attocode/
|
|
51
|
+
*
|
|
52
|
+
* @returns Absolute path to the state directory
|
|
53
|
+
*/
|
|
54
|
+
export function getStateDir() {
|
|
55
|
+
const xdg = process.env.XDG_STATE_HOME;
|
|
56
|
+
return xdg
|
|
57
|
+
? join(xdg, 'attocode')
|
|
58
|
+
: join(homedir(), '.local', 'state', 'attocode');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the cache directory path.
|
|
62
|
+
* Uses $XDG_CACHE_HOME if set, otherwise defaults to ~/.cache/attocode/
|
|
63
|
+
*
|
|
64
|
+
* @returns Absolute path to the cache directory
|
|
65
|
+
*/
|
|
66
|
+
export function getCacheDir() {
|
|
67
|
+
const xdg = process.env.XDG_CACHE_HOME;
|
|
68
|
+
return xdg ? join(xdg, 'attocode') : join(homedir(), '.cache', 'attocode');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get the project-specific directory path.
|
|
72
|
+
* This is always .attocode/ within the specified working directory.
|
|
73
|
+
*
|
|
74
|
+
* @param cwd - The working directory (defaults to process.cwd())
|
|
75
|
+
* @returns Absolute path to the project directory
|
|
76
|
+
*/
|
|
77
|
+
export function getProjectDir(cwd = process.cwd()) {
|
|
78
|
+
return join(cwd, '.attocode');
|
|
79
|
+
}
|
|
80
|
+
// ============================================================================
|
|
81
|
+
// Specific file paths
|
|
82
|
+
// ============================================================================
|
|
83
|
+
/**
|
|
84
|
+
* Get the path to the main configuration file.
|
|
85
|
+
*
|
|
86
|
+
* @returns Absolute path to config.json
|
|
87
|
+
*/
|
|
88
|
+
export function getConfigPath() {
|
|
89
|
+
return join(getConfigDir(), 'config.json');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the path to the sessions database.
|
|
93
|
+
*
|
|
94
|
+
* @returns Absolute path to sessions.db
|
|
95
|
+
*/
|
|
96
|
+
export function getSessionsDbPath() {
|
|
97
|
+
return join(getDataDir(), 'sessions.db');
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get the path to the command history file.
|
|
101
|
+
*
|
|
102
|
+
* @returns Absolute path to history file
|
|
103
|
+
*/
|
|
104
|
+
export function getHistoryPath() {
|
|
105
|
+
return join(getStateDir(), 'history');
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get the path to the global rules file.
|
|
109
|
+
*
|
|
110
|
+
* @returns Absolute path to rules.md
|
|
111
|
+
*/
|
|
112
|
+
export function getGlobalRulesPath() {
|
|
113
|
+
return join(getConfigDir(), 'rules.md');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get the hierarchical MCP config paths.
|
|
117
|
+
* Returns paths in order of precedence (later overrides earlier):
|
|
118
|
+
* 1. Global user config: ~/.config/attocode/mcp.json
|
|
119
|
+
* 2. Workspace config: ./.mcp.json
|
|
120
|
+
*
|
|
121
|
+
* @param cwd - The working directory (defaults to process.cwd())
|
|
122
|
+
* @returns Array of config paths to check (in order of precedence)
|
|
123
|
+
*/
|
|
124
|
+
export function getMCPConfigPaths(cwd = process.cwd()) {
|
|
125
|
+
return [
|
|
126
|
+
join(getConfigDir(), 'mcp.json'), // Global user config
|
|
127
|
+
join(cwd, '.mcp.json'), // Workspace-specific
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
// ============================================================================
|
|
131
|
+
// Directory management
|
|
132
|
+
// ============================================================================
|
|
133
|
+
/**
|
|
134
|
+
* Ensure all XDG directories exist.
|
|
135
|
+
* Creates config, data, state, and cache directories if they don't exist.
|
|
136
|
+
*
|
|
137
|
+
* @returns Promise that resolves when all directories are created
|
|
138
|
+
*/
|
|
139
|
+
export async function ensureDirectories() {
|
|
140
|
+
const { mkdir } = await import('fs/promises');
|
|
141
|
+
await Promise.all([
|
|
142
|
+
mkdir(getConfigDir(), { recursive: true }),
|
|
143
|
+
mkdir(getDataDir(), { recursive: true }),
|
|
144
|
+
mkdir(getStateDir(), { recursive: true }),
|
|
145
|
+
mkdir(getCacheDir(), { recursive: true }),
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence Module
|
|
3
|
+
*
|
|
4
|
+
* Provides schema migration and database management utilities
|
|
5
|
+
* for SQLite-based session storage.
|
|
6
|
+
*
|
|
7
|
+
* ## New Embedded Migration System
|
|
8
|
+
*
|
|
9
|
+
* Migrations are now embedded directly in TypeScript code, eliminating
|
|
10
|
+
* the need for external SQL files and file path resolution issues.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import Database from 'better-sqlite3';
|
|
15
|
+
* import { applyMigrations, needsMigration, getMigrationStatus } from './persistence/index.js';
|
|
16
|
+
*
|
|
17
|
+
* const db = new Database('sessions.db');
|
|
18
|
+
*
|
|
19
|
+
* // Check and apply pending migrations (no path needed!)
|
|
20
|
+
* if (needsMigration(db)) {
|
|
21
|
+
* const result = applyMigrations(db);
|
|
22
|
+
* console.log(`Applied ${result.applied} migrations, now at version ${result.currentVersion}`);
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Get detailed status
|
|
26
|
+
* const status = getMigrationStatus(db);
|
|
27
|
+
* console.log(`Current: v${status.currentVersion}, Latest: v${status.latestVersion}`);
|
|
28
|
+
*
|
|
29
|
+
* // Check which features are available
|
|
30
|
+
* const features = detectFeatures(db);
|
|
31
|
+
* if (features.goals) {
|
|
32
|
+
* console.log('Goal tracking is available!');
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export { type Migration, type MigrationResult, type SchemaFeatures, MIGRATIONS, getSchemaVersion, setSchemaVersion, needsMigration, applyMigrations, getMigrationStatus, detectFeatures, } from './schema.js';
|
|
37
|
+
export { type MigrationFile, loadMigrations, getPendingMigrations, applyMigrationsTo, applyMigrations as applyFileMigrations, getMigrationStatus as getFileMigrationStatus, needsMigration as fileNeedsMigration, } from './migrator.js';
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/persistence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,UAAU,EAEV,gBAAgB,EAChB,gBAAgB,EAEhB,cAAc,EACd,eAAe,EACf,kBAAkB,EAElB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,aAAa,EAClB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,IAAI,mBAAmB,EACtC,kBAAkB,IAAI,sBAAsB,EAC5C,cAAc,IAAI,kBAAkB,GACrC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence Module
|
|
3
|
+
*
|
|
4
|
+
* Provides schema migration and database management utilities
|
|
5
|
+
* for SQLite-based session storage.
|
|
6
|
+
*
|
|
7
|
+
* ## New Embedded Migration System
|
|
8
|
+
*
|
|
9
|
+
* Migrations are now embedded directly in TypeScript code, eliminating
|
|
10
|
+
* the need for external SQL files and file path resolution issues.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import Database from 'better-sqlite3';
|
|
15
|
+
* import { applyMigrations, needsMigration, getMigrationStatus } from './persistence/index.js';
|
|
16
|
+
*
|
|
17
|
+
* const db = new Database('sessions.db');
|
|
18
|
+
*
|
|
19
|
+
* // Check and apply pending migrations (no path needed!)
|
|
20
|
+
* if (needsMigration(db)) {
|
|
21
|
+
* const result = applyMigrations(db);
|
|
22
|
+
* console.log(`Applied ${result.applied} migrations, now at version ${result.currentVersion}`);
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Get detailed status
|
|
26
|
+
* const status = getMigrationStatus(db);
|
|
27
|
+
* console.log(`Current: v${status.currentVersion}, Latest: v${status.latestVersion}`);
|
|
28
|
+
*
|
|
29
|
+
* // Check which features are available
|
|
30
|
+
* const features = detectFeatures(db);
|
|
31
|
+
* if (features.goals) {
|
|
32
|
+
* console.log('Goal tracking is available!');
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
// New embedded migration system
|
|
37
|
+
export {
|
|
38
|
+
// Embedded migrations
|
|
39
|
+
MIGRATIONS,
|
|
40
|
+
// Version management
|
|
41
|
+
getSchemaVersion, setSchemaVersion,
|
|
42
|
+
// Migration execution
|
|
43
|
+
needsMigration, applyMigrations, getMigrationStatus,
|
|
44
|
+
// Feature detection
|
|
45
|
+
detectFeatures, } from './schema.js';
|
|
46
|
+
// Legacy file-based migrator (for backwards compatibility with external migrations)
|
|
47
|
+
export { loadMigrations, getPendingMigrations, applyMigrationsTo, applyMigrations as applyFileMigrations, getMigrationStatus as getFileMigrationStatus, needsMigration as fileNeedsMigration, } from './migrator.js';
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,gCAAgC;AAChC,OAAO;AAKL,sBAAsB;AACtB,UAAU;AACV,qBAAqB;AACrB,gBAAgB,EAChB,gBAAgB;AAChB,sBAAsB;AACtB,cAAc,EACd,eAAe,EACf,kBAAkB;AAClB,oBAAoB;AACpB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,oFAAoF;AACpF,OAAO,EAEL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,IAAI,mBAAmB,EACtC,kBAAkB,IAAI,sBAAsB,EAC5C,cAAc,IAAI,kBAAkB,GACrC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema Migrator for SQLite Database
|
|
3
|
+
*
|
|
4
|
+
* Handles versioned SQL migrations using PRAGMA user_version.
|
|
5
|
+
* Migrations are applied sequentially and tracked in the database.
|
|
6
|
+
*
|
|
7
|
+
* ## Concurrency Warning
|
|
8
|
+
*
|
|
9
|
+
* This migrator is NOT safe for concurrent access. If multiple processes
|
|
10
|
+
* attempt to run migrations simultaneously, race conditions may occur.
|
|
11
|
+
* **Recommendation:** Run migrations from a single process at startup
|
|
12
|
+
* before spawning worker processes or subagents.
|
|
13
|
+
*
|
|
14
|
+
* ## Partial Failure Recovery
|
|
15
|
+
*
|
|
16
|
+
* SQLite requires autocommit mode for ALTER TABLE statements, so each
|
|
17
|
+
* migration runs outside a transaction. If a migration fails partway:
|
|
18
|
+
* - The schema version reflects the last successful migration
|
|
19
|
+
* - The database may have partial changes from the failed migration
|
|
20
|
+
*
|
|
21
|
+
* **Recommendation:** Design migrations to be idempotent (re-runnable).
|
|
22
|
+
* Column additions already handle "duplicate column name" errors gracefully.
|
|
23
|
+
* After fixing an issue, re-run applyMigrations() to continue.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import Database from 'better-sqlite3';
|
|
28
|
+
* import { applyMigrations, needsMigration } from './migrator.js';
|
|
29
|
+
*
|
|
30
|
+
* const db = new Database('sessions.db');
|
|
31
|
+
* if (needsMigration(db, './migrations')) {
|
|
32
|
+
* const result = applyMigrations(db, './migrations');
|
|
33
|
+
* console.log(`Applied ${result.applied} migrations`);
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import Database from 'better-sqlite3';
|
|
38
|
+
/**
|
|
39
|
+
* Represents a parsed migration file.
|
|
40
|
+
*/
|
|
41
|
+
export interface MigrationFile {
|
|
42
|
+
/** Migration version number (extracted from filename) */
|
|
43
|
+
version: number;
|
|
44
|
+
/** Human-readable migration name */
|
|
45
|
+
name: string;
|
|
46
|
+
/** SQL content to execute */
|
|
47
|
+
sql: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Result of applying migrations.
|
|
51
|
+
*/
|
|
52
|
+
export interface MigrationResult {
|
|
53
|
+
/** Number of migrations applied */
|
|
54
|
+
applied: number;
|
|
55
|
+
/** Current schema version after migration */
|
|
56
|
+
currentVersion: number;
|
|
57
|
+
/** List of applied migration names */
|
|
58
|
+
appliedMigrations: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the current schema version from the database.
|
|
62
|
+
* Uses SQLite's PRAGMA user_version.
|
|
63
|
+
*
|
|
64
|
+
* @param db - Database instance
|
|
65
|
+
* @returns Current schema version (0 if never migrated)
|
|
66
|
+
*/
|
|
67
|
+
export declare function getSchemaVersion(db: Database.Database): number;
|
|
68
|
+
/**
|
|
69
|
+
* Set the schema version in the database.
|
|
70
|
+
* Uses SQLite's PRAGMA user_version.
|
|
71
|
+
*
|
|
72
|
+
* @param db - Database instance
|
|
73
|
+
* @param version - Version number to set
|
|
74
|
+
*/
|
|
75
|
+
export declare function setSchemaVersion(db: Database.Database, version: number): void;
|
|
76
|
+
/**
|
|
77
|
+
* Load all migration files from a directory.
|
|
78
|
+
* Sorts migrations by version number.
|
|
79
|
+
*
|
|
80
|
+
* @param dir - Directory containing SQL migration files
|
|
81
|
+
* @returns Array of migration files sorted by version
|
|
82
|
+
*/
|
|
83
|
+
export declare function loadMigrations(dir: string): MigrationFile[];
|
|
84
|
+
/**
|
|
85
|
+
* Check if the database needs migration.
|
|
86
|
+
*
|
|
87
|
+
* @param db - Database instance
|
|
88
|
+
* @param migrationsDir - Directory containing SQL migration files
|
|
89
|
+
* @returns True if there are pending migrations
|
|
90
|
+
*/
|
|
91
|
+
export declare function needsMigration(db: Database.Database, migrationsDir: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get the list of pending migrations.
|
|
94
|
+
*
|
|
95
|
+
* @param db - Database instance
|
|
96
|
+
* @param migrationsDir - Directory containing SQL migration files
|
|
97
|
+
* @returns Array of migrations that need to be applied
|
|
98
|
+
*/
|
|
99
|
+
export declare function getPendingMigrations(db: Database.Database, migrationsDir: string): MigrationFile[];
|
|
100
|
+
/**
|
|
101
|
+
* Apply all pending migrations to the database.
|
|
102
|
+
* Migrations are applied in a transaction for atomicity.
|
|
103
|
+
*
|
|
104
|
+
* @param db - Database instance
|
|
105
|
+
* @param migrationsDir - Directory containing SQL migration files
|
|
106
|
+
* @returns Result containing number of applied migrations and current version
|
|
107
|
+
* @throws Error if any migration fails (transaction is rolled back)
|
|
108
|
+
*/
|
|
109
|
+
export declare function applyMigrations(db: Database.Database, migrationsDir: string): MigrationResult;
|
|
110
|
+
/**
|
|
111
|
+
* Apply migrations up to a specific version.
|
|
112
|
+
*
|
|
113
|
+
* @param db - Database instance
|
|
114
|
+
* @param migrationsDir - Directory containing SQL migration files
|
|
115
|
+
* @param targetVersion - Maximum version to apply
|
|
116
|
+
* @returns Result containing number of applied migrations and current version
|
|
117
|
+
*/
|
|
118
|
+
export declare function applyMigrationsTo(db: Database.Database, migrationsDir: string, targetVersion: number): MigrationResult;
|
|
119
|
+
/**
|
|
120
|
+
* Get migration status for the database.
|
|
121
|
+
*
|
|
122
|
+
* @param db - Database instance
|
|
123
|
+
* @param migrationsDir - Directory containing SQL migration files
|
|
124
|
+
* @returns Object containing version info and pending migrations
|
|
125
|
+
*/
|
|
126
|
+
export declare function getMigrationStatus(db: Database.Database, migrationsDir: string): {
|
|
127
|
+
currentVersion: number;
|
|
128
|
+
latestVersion: number;
|
|
129
|
+
pendingCount: number;
|
|
130
|
+
pendingMigrations: Array<{
|
|
131
|
+
version: number;
|
|
132
|
+
name: string;
|
|
133
|
+
}>;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=migrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../../src/persistence/migrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAQtC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAMD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7E;AAuBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,EAAE,CA6B3D;AAMD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAQpF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG,aAAa,EAAE,CAKlG;AA+DD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG,eAAe,CAyC7F;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,eAAe,CAuCjB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG;IAChF,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D,CAWA"}
|