attocode 0.2.4 → 0.2.5
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 +56 -1
- package/dist/src/adapters.d.ts +2 -1
- package/dist/src/adapters.d.ts.map +1 -1
- package/dist/src/adapters.js +60 -2
- package/dist/src/adapters.js.map +1 -1
- package/dist/src/agent/agent-builder.d.ts +117 -0
- package/dist/src/agent/agent-builder.d.ts.map +1 -0
- package/dist/src/agent/agent-builder.js +204 -0
- package/dist/src/agent/agent-builder.js.map +1 -0
- package/dist/src/agent/feature-initializer.d.ts +80 -0
- package/dist/src/agent/feature-initializer.d.ts.map +1 -0
- package/dist/src/agent/feature-initializer.js +677 -0
- package/dist/src/agent/feature-initializer.js.map +1 -0
- package/dist/src/agent/index.d.ts +13 -0
- package/dist/src/agent/index.d.ts.map +1 -0
- package/dist/src/agent/index.js +13 -0
- package/dist/src/agent/index.js.map +1 -0
- package/dist/src/agent/message-builder.d.ts +50 -0
- package/dist/src/agent/message-builder.d.ts.map +1 -0
- package/dist/src/agent/message-builder.js +173 -0
- package/dist/src/agent/message-builder.js.map +1 -0
- package/dist/src/agent/session-api.d.ts +94 -0
- package/dist/src/agent/session-api.d.ts.map +1 -0
- package/dist/src/agent/session-api.js +262 -0
- package/dist/src/agent/session-api.js.map +1 -0
- package/dist/src/agent-tools/lsp-file-tools.d.ts +1 -1
- package/dist/src/agent-tools/lsp-file-tools.d.ts.map +1 -1
- package/dist/src/agent.d.ts +14 -115
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +36 -1177
- package/dist/src/agent.js.map +1 -1
- package/dist/src/cli.js +1 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/handler.d.ts.map +1 -1
- package/dist/src/commands/handler.js +8 -7
- package/dist/src/commands/handler.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/config/schema.d.ts +6 -6
- package/dist/src/core/execution-loop.d.ts.map +1 -1
- package/dist/src/core/execution-loop.js +155 -16
- package/dist/src/core/execution-loop.js.map +1 -1
- package/dist/src/core/response-handler.d.ts.map +1 -1
- package/dist/src/core/response-handler.js +3 -2
- package/dist/src/core/response-handler.js.map +1 -1
- package/dist/src/core/subagent-spawner.d.ts.map +1 -1
- package/dist/src/core/subagent-spawner.js +13 -6
- package/dist/src/core/subagent-spawner.js.map +1 -1
- package/dist/src/core/tool-executor.d.ts.map +1 -1
- package/dist/src/core/tool-executor.js +7 -2
- package/dist/src/core/tool-executor.js.map +1 -1
- package/dist/src/core/types.d.ts +1 -0
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/types.js.map +1 -1
- package/dist/src/integrations/agents/agent-registry.d.ts +262 -0
- package/dist/src/integrations/agents/agent-registry.d.ts.map +1 -0
- package/dist/src/integrations/agents/agent-registry.js +686 -0
- package/dist/src/integrations/agents/agent-registry.js.map +1 -0
- package/dist/src/integrations/agents/async-subagent.d.ts +135 -0
- package/dist/src/integrations/agents/async-subagent.d.ts.map +1 -0
- package/dist/src/integrations/agents/async-subagent.js +213 -0
- package/dist/src/integrations/agents/async-subagent.js.map +1 -0
- package/dist/src/integrations/agents/complexity-classifier.d.ts +86 -0
- package/dist/src/integrations/agents/complexity-classifier.d.ts.map +1 -0
- package/dist/src/integrations/agents/complexity-classifier.js +233 -0
- package/dist/src/integrations/agents/complexity-classifier.js.map +1 -0
- package/dist/src/integrations/agents/delegation-protocol.d.ts +86 -0
- package/dist/src/integrations/agents/delegation-protocol.d.ts.map +1 -0
- package/dist/src/integrations/agents/delegation-protocol.js +127 -0
- package/dist/src/integrations/agents/delegation-protocol.js.map +1 -0
- package/dist/src/integrations/agents/multi-agent.d.ts +150 -0
- package/dist/src/integrations/agents/multi-agent.d.ts.map +1 -0
- package/dist/src/integrations/agents/multi-agent.js +306 -0
- package/dist/src/integrations/agents/multi-agent.js.map +1 -0
- package/dist/src/integrations/agents/result-synthesizer.d.ts +389 -0
- package/dist/src/integrations/agents/result-synthesizer.d.ts.map +1 -0
- package/dist/src/integrations/agents/result-synthesizer.js +951 -0
- package/dist/src/integrations/agents/result-synthesizer.js.map +1 -0
- package/dist/src/integrations/agents/shared-blackboard.d.ts +406 -0
- package/dist/src/integrations/agents/shared-blackboard.d.ts.map +1 -0
- package/dist/src/integrations/agents/shared-blackboard.js +757 -0
- package/dist/src/integrations/agents/shared-blackboard.js.map +1 -0
- package/dist/src/integrations/agents/subagent-output-store.d.ts +91 -0
- package/dist/src/integrations/agents/subagent-output-store.d.ts.map +1 -0
- package/dist/src/integrations/agents/subagent-output-store.js +257 -0
- package/dist/src/integrations/agents/subagent-output-store.js.map +1 -0
- package/dist/src/integrations/budget/budget-pool.d.ts +115 -0
- package/dist/src/integrations/budget/budget-pool.d.ts.map +1 -0
- package/dist/src/integrations/budget/budget-pool.js +205 -0
- package/dist/src/integrations/budget/budget-pool.js.map +1 -0
- package/dist/src/integrations/budget/cancellation.d.ts +229 -0
- package/dist/src/integrations/budget/cancellation.d.ts.map +1 -0
- package/dist/src/integrations/budget/cancellation.js +520 -0
- package/dist/src/integrations/budget/cancellation.js.map +1 -0
- package/dist/src/integrations/budget/dynamic-budget.d.ts +81 -0
- package/dist/src/integrations/budget/dynamic-budget.d.ts.map +1 -0
- package/dist/src/integrations/budget/dynamic-budget.js +151 -0
- package/dist/src/integrations/budget/dynamic-budget.js.map +1 -0
- package/dist/src/integrations/budget/economics.d.ts +435 -0
- package/dist/src/integrations/budget/economics.d.ts.map +1 -0
- package/dist/src/integrations/budget/economics.js +1007 -0
- package/dist/src/integrations/budget/economics.js.map +1 -0
- package/dist/src/integrations/budget/injection-budget.d.ts +71 -0
- package/dist/src/integrations/budget/injection-budget.d.ts.map +1 -0
- package/dist/src/integrations/budget/injection-budget.js +137 -0
- package/dist/src/integrations/budget/injection-budget.js.map +1 -0
- package/dist/src/integrations/budget/loop-detector.d.ts +105 -0
- package/dist/src/integrations/budget/loop-detector.d.ts.map +1 -0
- package/dist/src/integrations/budget/loop-detector.js +287 -0
- package/dist/src/integrations/budget/loop-detector.js.map +1 -0
- package/dist/src/integrations/budget/phase-tracker.d.ts +114 -0
- package/dist/src/integrations/budget/phase-tracker.d.ts.map +1 -0
- package/dist/src/integrations/budget/phase-tracker.js +262 -0
- package/dist/src/integrations/budget/phase-tracker.js.map +1 -0
- package/dist/src/integrations/budget/resources.d.ts +182 -0
- package/dist/src/integrations/budget/resources.d.ts.map +1 -0
- package/dist/src/integrations/budget/resources.js +318 -0
- package/dist/src/integrations/budget/resources.js.map +1 -0
- package/dist/src/integrations/context/auto-compaction.d.ts +210 -0
- package/dist/src/integrations/context/auto-compaction.d.ts.map +1 -0
- package/dist/src/integrations/context/auto-compaction.js +477 -0
- package/dist/src/integrations/context/auto-compaction.js.map +1 -0
- package/dist/src/integrations/context/code-analyzer.d.ts +71 -0
- package/dist/src/integrations/context/code-analyzer.d.ts.map +1 -0
- package/dist/src/integrations/context/code-analyzer.js +448 -0
- package/dist/src/integrations/context/code-analyzer.js.map +1 -0
- package/dist/src/integrations/context/code-selector.d.ts +78 -0
- package/dist/src/integrations/context/code-selector.d.ts.map +1 -0
- package/dist/src/integrations/context/code-selector.js +649 -0
- package/dist/src/integrations/context/code-selector.js.map +1 -0
- package/dist/src/integrations/context/codebase-ast.d.ts +138 -0
- package/dist/src/integrations/context/codebase-ast.d.ts.map +1 -0
- package/dist/src/integrations/context/codebase-ast.js +818 -0
- package/dist/src/integrations/context/codebase-ast.js.map +1 -0
- package/dist/src/integrations/context/codebase-context.d.ts +473 -0
- package/dist/src/integrations/context/codebase-context.d.ts.map +1 -0
- package/dist/src/integrations/context/codebase-context.js +685 -0
- package/dist/src/integrations/context/codebase-context.js.map +1 -0
- package/dist/src/integrations/context/compaction.d.ts +191 -0
- package/dist/src/integrations/context/compaction.d.ts.map +1 -0
- package/dist/src/integrations/context/compaction.js +384 -0
- package/dist/src/integrations/context/compaction.js.map +1 -0
- package/dist/src/integrations/context/context-engineering.d.ts +274 -0
- package/dist/src/integrations/context/context-engineering.d.ts.map +1 -0
- package/dist/src/integrations/context/context-engineering.js +437 -0
- package/dist/src/integrations/context/context-engineering.js.map +1 -0
- package/dist/src/integrations/context/file-cache.d.ts +97 -0
- package/dist/src/integrations/context/file-cache.d.ts.map +1 -0
- package/dist/src/integrations/context/file-cache.js +218 -0
- package/dist/src/integrations/context/file-cache.js.map +1 -0
- package/dist/src/integrations/context/semantic-cache.d.ts +178 -0
- package/dist/src/integrations/context/semantic-cache.d.ts.map +1 -0
- package/dist/src/integrations/context/semantic-cache.js +372 -0
- package/dist/src/integrations/context/semantic-cache.js.map +1 -0
- package/dist/src/integrations/index.d.ts +72 -68
- package/dist/src/integrations/index.d.ts.map +1 -1
- package/dist/src/integrations/index.js +76 -68
- package/dist/src/integrations/index.js.map +1 -1
- package/dist/src/integrations/lsp/lsp.d.ts +196 -0
- package/dist/src/integrations/lsp/lsp.d.ts.map +1 -0
- package/dist/src/integrations/lsp/lsp.js +583 -0
- package/dist/src/integrations/lsp/lsp.js.map +1 -0
- package/dist/src/integrations/mcp/mcp-client.d.ts +279 -0
- package/dist/src/integrations/mcp/mcp-client.d.ts.map +1 -0
- package/dist/src/integrations/mcp/mcp-client.js +755 -0
- package/dist/src/integrations/mcp/mcp-client.js.map +1 -0
- package/dist/src/integrations/mcp/mcp-custom-tools.d.ts +102 -0
- package/dist/src/integrations/mcp/mcp-custom-tools.d.ts.map +1 -0
- package/dist/src/integrations/mcp/mcp-custom-tools.js +232 -0
- package/dist/src/integrations/mcp/mcp-custom-tools.js.map +1 -0
- package/dist/src/integrations/mcp/mcp-tool-search.d.ts +77 -0
- package/dist/src/integrations/mcp/mcp-tool-search.d.ts.map +1 -0
- package/dist/src/integrations/mcp/mcp-tool-search.js +220 -0
- package/dist/src/integrations/mcp/mcp-tool-search.js.map +1 -0
- package/dist/src/integrations/mcp/mcp-tool-validator.d.ts +60 -0
- package/dist/src/integrations/mcp/mcp-tool-validator.d.ts.map +1 -0
- package/dist/src/integrations/mcp/mcp-tool-validator.js +141 -0
- package/dist/src/integrations/mcp/mcp-tool-validator.js.map +1 -0
- package/dist/src/integrations/persistence/codebase-repository.d.ts +45 -0
- package/dist/src/integrations/persistence/codebase-repository.d.ts.map +1 -0
- package/dist/src/integrations/persistence/codebase-repository.js +81 -0
- package/dist/src/integrations/persistence/codebase-repository.js.map +1 -0
- package/dist/src/integrations/persistence/goal-repository.d.ts +71 -0
- package/dist/src/integrations/persistence/goal-repository.d.ts.map +1 -0
- package/dist/src/integrations/persistence/goal-repository.js +184 -0
- package/dist/src/integrations/persistence/goal-repository.js.map +1 -0
- package/dist/src/integrations/persistence/history.d.ts +72 -0
- package/dist/src/integrations/persistence/history.d.ts.map +1 -0
- package/dist/src/integrations/persistence/history.js +165 -0
- package/dist/src/integrations/persistence/history.js.map +1 -0
- package/dist/src/integrations/persistence/persistence.d.ts +49 -0
- package/dist/src/integrations/persistence/persistence.d.ts.map +1 -0
- package/dist/src/integrations/persistence/persistence.js +197 -0
- package/dist/src/integrations/persistence/persistence.js.map +1 -0
- package/dist/src/integrations/persistence/session-repository.d.ts +212 -0
- package/dist/src/integrations/persistence/session-repository.d.ts.map +1 -0
- package/dist/src/integrations/persistence/session-repository.js +770 -0
- package/dist/src/integrations/persistence/session-repository.js.map +1 -0
- package/dist/src/integrations/persistence/session-store.d.ts +184 -0
- package/dist/src/integrations/persistence/session-store.d.ts.map +1 -0
- package/dist/src/integrations/persistence/session-store.js +346 -0
- package/dist/src/integrations/persistence/session-store.js.map +1 -0
- package/dist/src/integrations/persistence/sqlite-store.d.ts +453 -0
- package/dist/src/integrations/persistence/sqlite-store.d.ts.map +1 -0
- package/dist/src/integrations/persistence/sqlite-store.js +676 -0
- package/dist/src/integrations/persistence/sqlite-store.js.map +1 -0
- package/dist/src/integrations/persistence/worker-repository.d.ts +65 -0
- package/dist/src/integrations/persistence/worker-repository.d.ts.map +1 -0
- package/dist/src/integrations/persistence/worker-repository.js +183 -0
- package/dist/src/integrations/persistence/worker-repository.js.map +1 -0
- package/dist/src/integrations/quality/auto-checkpoint.d.ts +98 -0
- package/dist/src/integrations/quality/auto-checkpoint.d.ts.map +1 -0
- package/dist/src/integrations/quality/auto-checkpoint.js +252 -0
- package/dist/src/integrations/quality/auto-checkpoint.js.map +1 -0
- package/dist/src/integrations/quality/dead-letter-queue.d.ts +233 -0
- package/dist/src/integrations/quality/dead-letter-queue.d.ts.map +1 -0
- package/dist/src/integrations/quality/dead-letter-queue.js +543 -0
- package/dist/src/integrations/quality/dead-letter-queue.js.map +1 -0
- package/dist/src/integrations/quality/health-check.d.ts +218 -0
- package/dist/src/integrations/quality/health-check.d.ts.map +1 -0
- package/dist/src/integrations/quality/health-check.js +415 -0
- package/dist/src/integrations/quality/health-check.js.map +1 -0
- package/dist/src/integrations/quality/learning-store.d.ts +291 -0
- package/dist/src/integrations/quality/learning-store.d.ts.map +1 -0
- package/dist/src/integrations/quality/learning-store.js +646 -0
- package/dist/src/integrations/quality/learning-store.js.map +1 -0
- package/dist/src/integrations/quality/self-improvement.d.ts +90 -0
- package/dist/src/integrations/quality/self-improvement.d.ts.map +1 -0
- package/dist/src/integrations/quality/self-improvement.js +229 -0
- package/dist/src/integrations/quality/self-improvement.js.map +1 -0
- package/dist/src/integrations/quality/tool-recommendation.d.ts +61 -0
- package/dist/src/integrations/quality/tool-recommendation.d.ts.map +1 -0
- package/dist/src/integrations/quality/tool-recommendation.js +268 -0
- package/dist/src/integrations/quality/tool-recommendation.js.map +1 -0
- package/dist/src/integrations/safety/bash-policy.d.ts +33 -0
- package/dist/src/integrations/safety/bash-policy.d.ts.map +1 -0
- package/dist/src/integrations/safety/bash-policy.js +144 -0
- package/dist/src/integrations/safety/bash-policy.js.map +1 -0
- package/dist/src/integrations/safety/edit-validator.d.ts +30 -0
- package/dist/src/integrations/safety/edit-validator.d.ts.map +1 -0
- package/dist/src/integrations/safety/edit-validator.js +87 -0
- package/dist/src/integrations/safety/edit-validator.js.map +1 -0
- package/dist/src/integrations/safety/execution-policy.d.ts +189 -0
- package/dist/src/integrations/safety/execution-policy.d.ts.map +1 -0
- package/dist/src/integrations/safety/execution-policy.js +352 -0
- package/dist/src/integrations/safety/execution-policy.js.map +1 -0
- package/dist/src/integrations/safety/policy-engine.d.ts +55 -0
- package/dist/src/integrations/safety/policy-engine.d.ts.map +1 -0
- package/dist/src/integrations/safety/policy-engine.js +247 -0
- package/dist/src/integrations/safety/policy-engine.js.map +1 -0
- package/dist/src/integrations/safety/safety.d.ts +174 -0
- package/dist/src/integrations/safety/safety.d.ts.map +1 -0
- package/dist/src/integrations/safety/safety.js +470 -0
- package/dist/src/integrations/safety/safety.js.map +1 -0
- package/dist/src/integrations/safety/sandbox/basic.d.ts +81 -0
- package/dist/src/integrations/safety/sandbox/basic.d.ts.map +1 -0
- package/dist/src/integrations/safety/sandbox/basic.js +335 -0
- package/dist/src/integrations/safety/sandbox/basic.js.map +1 -0
- package/dist/src/integrations/safety/sandbox/docker.d.ts +94 -0
- package/dist/src/integrations/safety/sandbox/docker.d.ts.map +1 -0
- package/dist/src/integrations/safety/sandbox/docker.js +294 -0
- package/dist/src/integrations/safety/sandbox/docker.js.map +1 -0
- package/dist/src/integrations/safety/sandbox/index.d.ts +188 -0
- package/dist/src/integrations/safety/sandbox/index.d.ts.map +1 -0
- package/dist/src/integrations/safety/sandbox/index.js +386 -0
- package/dist/src/integrations/safety/sandbox/index.js.map +1 -0
- package/dist/src/integrations/safety/sandbox/landlock.d.ts +59 -0
- package/dist/src/integrations/safety/sandbox/landlock.d.ts.map +1 -0
- package/dist/src/integrations/safety/sandbox/landlock.js +329 -0
- package/dist/src/integrations/safety/sandbox/landlock.js.map +1 -0
- package/dist/src/integrations/safety/sandbox/seatbelt.d.ts +68 -0
- package/dist/src/integrations/safety/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/src/integrations/safety/sandbox/seatbelt.js +298 -0
- package/dist/src/integrations/safety/sandbox/seatbelt.js.map +1 -0
- package/dist/src/integrations/safety/type-checker.d.ts +53 -0
- package/dist/src/integrations/safety/type-checker.d.ts.map +1 -0
- package/dist/src/integrations/safety/type-checker.js +142 -0
- package/dist/src/integrations/safety/type-checker.js.map +1 -0
- package/dist/src/integrations/skills/skill-executor.d.ts +113 -0
- package/dist/src/integrations/skills/skill-executor.d.ts.map +1 -0
- package/dist/src/integrations/skills/skill-executor.js +270 -0
- package/dist/src/integrations/skills/skill-executor.js.map +1 -0
- package/dist/src/integrations/skills/skills.d.ts +262 -0
- package/dist/src/integrations/skills/skills.d.ts.map +1 -0
- package/dist/src/integrations/skills/skills.js +602 -0
- package/dist/src/integrations/skills/skills.js.map +1 -0
- package/dist/src/integrations/streaming/pty-shell.d.ts +169 -0
- package/dist/src/integrations/streaming/pty-shell.d.ts.map +1 -0
- package/dist/src/integrations/streaming/pty-shell.js +367 -0
- package/dist/src/integrations/streaming/pty-shell.js.map +1 -0
- package/dist/src/integrations/streaming/streaming.d.ts +102 -0
- package/dist/src/integrations/streaming/streaming.d.ts.map +1 -0
- package/dist/src/integrations/streaming/streaming.js +362 -0
- package/dist/src/integrations/streaming/streaming.js.map +1 -0
- package/dist/src/integrations/swarm/index.d.ts +2 -1
- package/dist/src/integrations/swarm/index.d.ts.map +1 -1
- package/dist/src/integrations/swarm/index.js +2 -0
- package/dist/src/integrations/swarm/index.js.map +1 -1
- package/dist/src/integrations/swarm/model-selector.js +1 -1
- package/dist/src/integrations/swarm/model-selector.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-budget.d.ts +1 -1
- package/dist/src/integrations/swarm/swarm-budget.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-budget.js +1 -1
- package/dist/src/integrations/swarm/swarm-budget.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-config-loader.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-config-loader.js +7 -0
- package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-execution.d.ts +27 -0
- package/dist/src/integrations/swarm/swarm-execution.d.ts.map +1 -0
- package/dist/src/integrations/swarm/swarm-execution.js +1021 -0
- package/dist/src/integrations/swarm/swarm-execution.js.map +1 -0
- package/dist/src/integrations/swarm/swarm-helpers.d.ts +26 -0
- package/dist/src/integrations/swarm/swarm-helpers.d.ts.map +1 -0
- package/dist/src/integrations/swarm/swarm-helpers.js +95 -0
- package/dist/src/integrations/swarm/swarm-helpers.js.map +1 -0
- package/dist/src/integrations/swarm/swarm-lifecycle.d.ts +100 -0
- package/dist/src/integrations/swarm/swarm-lifecycle.d.ts.map +1 -0
- package/dist/src/integrations/swarm/swarm-lifecycle.js +922 -0
- package/dist/src/integrations/swarm/swarm-lifecycle.js.map +1 -0
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts +84 -203
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-orchestrator.js +251 -2870
- package/dist/src/integrations/swarm/swarm-orchestrator.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-quality-gate.js +1 -1
- package/dist/src/integrations/swarm/swarm-quality-gate.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-recovery.d.ts +75 -0
- package/dist/src/integrations/swarm/swarm-recovery.d.ts.map +1 -0
- package/dist/src/integrations/swarm/swarm-recovery.js +550 -0
- package/dist/src/integrations/swarm/swarm-recovery.js.map +1 -0
- package/dist/src/integrations/swarm/swarm-state-store.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-state-store.js +6 -0
- package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
- package/dist/src/integrations/swarm/task-queue.js +28 -1
- package/dist/src/integrations/swarm/task-queue.js.map +1 -1
- package/dist/src/integrations/swarm/types.d.ts +17 -5
- package/dist/src/integrations/swarm/types.d.ts.map +1 -1
- package/dist/src/integrations/swarm/types.js.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.js +13 -9
- package/dist/src/integrations/swarm/worker-pool.js.map +1 -1
- package/dist/src/integrations/tasks/dependency-analyzer.d.ts +34 -0
- package/dist/src/integrations/tasks/dependency-analyzer.d.ts.map +1 -0
- package/dist/src/integrations/tasks/dependency-analyzer.js +232 -0
- package/dist/src/integrations/tasks/dependency-analyzer.js.map +1 -0
- package/dist/src/integrations/tasks/interactive-planning.d.ts +322 -0
- package/dist/src/integrations/tasks/interactive-planning.d.ts.map +1 -0
- package/dist/src/integrations/tasks/interactive-planning.js +655 -0
- package/dist/src/integrations/tasks/interactive-planning.js.map +1 -0
- package/dist/src/integrations/tasks/pending-plan.d.ts +196 -0
- package/dist/src/integrations/tasks/pending-plan.d.ts.map +1 -0
- package/dist/src/integrations/tasks/pending-plan.js +431 -0
- package/dist/src/integrations/tasks/pending-plan.js.map +1 -0
- package/dist/src/integrations/tasks/planning.d.ts +115 -0
- package/dist/src/integrations/tasks/planning.d.ts.map +1 -0
- package/dist/src/integrations/tasks/planning.js +413 -0
- package/dist/src/integrations/tasks/planning.js.map +1 -0
- package/dist/src/integrations/tasks/smart-decomposer.d.ts +316 -0
- package/dist/src/integrations/tasks/smart-decomposer.d.ts.map +1 -0
- package/dist/src/integrations/tasks/smart-decomposer.js +661 -0
- package/dist/src/integrations/tasks/smart-decomposer.js.map +1 -0
- package/dist/src/integrations/tasks/task-manager.d.ts +164 -0
- package/dist/src/integrations/tasks/task-manager.d.ts.map +1 -0
- package/dist/src/integrations/tasks/task-manager.js +383 -0
- package/dist/src/integrations/tasks/task-manager.js.map +1 -0
- package/dist/src/integrations/tasks/task-splitter.d.ts +56 -0
- package/dist/src/integrations/tasks/task-splitter.d.ts.map +1 -0
- package/dist/src/integrations/tasks/task-splitter.js +537 -0
- package/dist/src/integrations/tasks/task-splitter.js.map +1 -0
- package/dist/src/integrations/tasks/verification-gate.d.ts +103 -0
- package/dist/src/integrations/tasks/verification-gate.d.ts.map +1 -0
- package/dist/src/integrations/tasks/verification-gate.js +193 -0
- package/dist/src/integrations/tasks/verification-gate.js.map +1 -0
- package/dist/src/integrations/tasks/work-log.d.ts +87 -0
- package/dist/src/integrations/tasks/work-log.d.ts.map +1 -0
- package/dist/src/integrations/tasks/work-log.js +275 -0
- package/dist/src/integrations/tasks/work-log.js.map +1 -0
- package/dist/src/integrations/utilities/capabilities.d.ts +160 -0
- package/dist/src/integrations/utilities/capabilities.d.ts.map +1 -0
- package/dist/src/integrations/utilities/capabilities.js +426 -0
- package/dist/src/integrations/utilities/capabilities.js.map +1 -0
- package/dist/src/integrations/utilities/diff-utils.d.ts +105 -0
- package/dist/src/integrations/utilities/diff-utils.d.ts.map +1 -0
- package/dist/src/integrations/utilities/diff-utils.js +497 -0
- package/dist/src/integrations/utilities/diff-utils.js.map +1 -0
- package/dist/src/integrations/utilities/environment-facts.d.ts +52 -0
- package/dist/src/integrations/utilities/environment-facts.d.ts.map +1 -0
- package/dist/src/integrations/utilities/environment-facts.js +84 -0
- package/dist/src/integrations/utilities/environment-facts.js.map +1 -0
- package/dist/src/integrations/utilities/file-change-tracker.d.ts +162 -0
- package/dist/src/integrations/utilities/file-change-tracker.d.ts.map +1 -0
- package/dist/src/integrations/utilities/file-change-tracker.js +538 -0
- package/dist/src/integrations/utilities/file-change-tracker.js.map +1 -0
- package/dist/src/integrations/utilities/graph-visualization.d.ts +72 -0
- package/dist/src/integrations/utilities/graph-visualization.d.ts.map +1 -0
- package/dist/src/integrations/utilities/graph-visualization.js +383 -0
- package/dist/src/integrations/utilities/graph-visualization.js.map +1 -0
- package/dist/src/integrations/utilities/hierarchical-config.d.ts +215 -0
- package/dist/src/integrations/utilities/hierarchical-config.d.ts.map +1 -0
- package/dist/src/integrations/utilities/hierarchical-config.js +504 -0
- package/dist/src/integrations/utilities/hierarchical-config.js.map +1 -0
- package/dist/src/integrations/utilities/hooks.d.ts +116 -0
- package/dist/src/integrations/utilities/hooks.d.ts.map +1 -0
- package/dist/src/integrations/utilities/hooks.js +410 -0
- package/dist/src/integrations/utilities/hooks.js.map +1 -0
- package/dist/src/integrations/utilities/ignore.d.ts +143 -0
- package/dist/src/integrations/utilities/ignore.d.ts.map +1 -0
- package/dist/src/integrations/utilities/ignore.js +417 -0
- package/dist/src/integrations/utilities/ignore.js.map +1 -0
- package/dist/src/integrations/utilities/image-renderer.d.ts +119 -0
- package/dist/src/integrations/utilities/image-renderer.d.ts.map +1 -0
- package/dist/src/integrations/utilities/image-renderer.js +306 -0
- package/dist/src/integrations/utilities/image-renderer.js.map +1 -0
- package/dist/src/integrations/utilities/logger.d.ts +104 -0
- package/dist/src/integrations/utilities/logger.d.ts.map +1 -0
- package/dist/src/integrations/utilities/logger.js +219 -0
- package/dist/src/integrations/utilities/logger.js.map +1 -0
- package/dist/src/integrations/utilities/memory.d.ts +116 -0
- package/dist/src/integrations/utilities/memory.d.ts.map +1 -0
- package/dist/src/integrations/utilities/memory.js +311 -0
- package/dist/src/integrations/utilities/memory.js.map +1 -0
- package/dist/src/integrations/utilities/observability.d.ts +162 -0
- package/dist/src/integrations/utilities/observability.d.ts.map +1 -0
- package/dist/src/integrations/utilities/observability.js +407 -0
- package/dist/src/integrations/utilities/observability.js.map +1 -0
- package/dist/src/integrations/utilities/openrouter-pricing.d.ts +67 -0
- package/dist/src/integrations/utilities/openrouter-pricing.d.ts.map +1 -0
- package/dist/src/integrations/utilities/openrouter-pricing.js +166 -0
- package/dist/src/integrations/utilities/openrouter-pricing.js.map +1 -0
- package/dist/src/integrations/utilities/react.d.ts +139 -0
- package/dist/src/integrations/utilities/react.d.ts.map +1 -0
- package/dist/src/integrations/utilities/react.js +273 -0
- package/dist/src/integrations/utilities/react.js.map +1 -0
- package/dist/src/integrations/utilities/retry.d.ts +132 -0
- package/dist/src/integrations/utilities/retry.d.ts.map +1 -0
- package/dist/src/integrations/utilities/retry.js +233 -0
- package/dist/src/integrations/utilities/retry.js.map +1 -0
- package/dist/src/integrations/utilities/routing.d.ts +118 -0
- package/dist/src/integrations/utilities/routing.d.ts.map +1 -0
- package/dist/src/integrations/utilities/routing.js +348 -0
- package/dist/src/integrations/utilities/routing.js.map +1 -0
- package/dist/src/integrations/utilities/rules.d.ts +131 -0
- package/dist/src/integrations/utilities/rules.d.ts.map +1 -0
- package/dist/src/integrations/utilities/rules.js +284 -0
- package/dist/src/integrations/utilities/rules.js.map +1 -0
- package/dist/src/integrations/utilities/sourcegraph.d.ts +169 -0
- package/dist/src/integrations/utilities/sourcegraph.d.ts.map +1 -0
- package/dist/src/integrations/utilities/sourcegraph.js +379 -0
- package/dist/src/integrations/utilities/sourcegraph.js.map +1 -0
- package/dist/src/integrations/utilities/thinking-strategy.d.ts +52 -0
- package/dist/src/integrations/utilities/thinking-strategy.d.ts.map +1 -0
- package/dist/src/integrations/utilities/thinking-strategy.js +129 -0
- package/dist/src/integrations/utilities/thinking-strategy.js.map +1 -0
- package/dist/src/integrations/utilities/thread-manager.d.ts +199 -0
- package/dist/src/integrations/utilities/thread-manager.d.ts.map +1 -0
- package/dist/src/integrations/utilities/thread-manager.js +357 -0
- package/dist/src/integrations/utilities/thread-manager.js.map +1 -0
- package/dist/src/integrations/utilities/token-estimate.d.ts +11 -0
- package/dist/src/integrations/utilities/token-estimate.d.ts.map +1 -0
- package/dist/src/integrations/utilities/token-estimate.js +14 -0
- package/dist/src/integrations/utilities/token-estimate.js.map +1 -0
- package/dist/src/main.js +10 -4
- package/dist/src/main.js.map +1 -1
- package/dist/src/modes/repl.d.ts.map +1 -1
- package/dist/src/modes/repl.js +22 -5
- package/dist/src/modes/repl.js.map +1 -1
- package/dist/src/modes/tui.d.ts.map +1 -1
- package/dist/src/modes/tui.js +23 -6
- package/dist/src/modes/tui.js.map +1 -1
- package/dist/src/modes.js +1 -1
- package/dist/src/modes.js.map +1 -1
- package/dist/src/observability/tracer.js +1 -1
- package/dist/src/observability/tracer.js.map +1 -1
- package/dist/src/persistence/schema.d.ts +2 -0
- package/dist/src/persistence/schema.d.ts.map +1 -1
- package/dist/src/persistence/schema.js +31 -0
- package/dist/src/persistence/schema.js.map +1 -1
- package/dist/src/providers/adapters/anthropic.d.ts +6 -0
- package/dist/src/providers/adapters/anthropic.d.ts.map +1 -1
- package/dist/src/providers/adapters/anthropic.js +99 -15
- package/dist/src/providers/adapters/anthropic.js.map +1 -1
- package/dist/src/providers/adapters/azure.d.ts +74 -0
- package/dist/src/providers/adapters/azure.d.ts.map +1 -0
- package/dist/src/providers/adapters/azure.js +354 -0
- package/dist/src/providers/adapters/azure.js.map +1 -0
- package/dist/src/providers/adapters/mock.d.ts +16 -2
- package/dist/src/providers/adapters/mock.d.ts.map +1 -1
- package/dist/src/providers/adapters/mock.js +44 -3
- package/dist/src/providers/adapters/mock.js.map +1 -1
- package/dist/src/providers/adapters/openai.d.ts +6 -1
- package/dist/src/providers/adapters/openai.d.ts.map +1 -1
- package/dist/src/providers/adapters/openai.js +39 -8
- package/dist/src/providers/adapters/openai.js.map +1 -1
- package/dist/src/providers/adapters/openrouter.d.ts +6 -0
- package/dist/src/providers/adapters/openrouter.d.ts.map +1 -1
- package/dist/src/providers/adapters/openrouter.js +73 -3
- package/dist/src/providers/adapters/openrouter.js.map +1 -1
- package/dist/src/providers/provider.js +1 -1
- package/dist/src/providers/provider.js.map +1 -1
- package/dist/src/providers/resilient-provider.js +1 -1
- package/dist/src/providers/resilient-provider.js.map +1 -1
- package/dist/src/providers/types.d.ts +23 -2
- package/dist/src/providers/types.d.ts.map +1 -1
- package/dist/src/session-picker.d.ts +1 -1
- package/dist/src/session-picker.d.ts.map +1 -1
- package/dist/src/session-picker.js +1 -1
- package/dist/src/session-picker.js.map +1 -1
- package/dist/src/shared/budget-tracker.js +1 -1
- package/dist/src/shared/budget-tracker.js.map +1 -1
- package/dist/src/tools/agent.d.ts +1 -1
- package/dist/src/tools/agent.d.ts.map +1 -1
- package/dist/src/tools/bash.js +1 -1
- package/dist/src/tools/bash.js.map +1 -1
- package/dist/src/tools/file.js +1 -1
- package/dist/src/tools/file.js.map +1 -1
- package/dist/src/tools/permission.js +2 -2
- package/dist/src/tools/permission.js.map +1 -1
- package/dist/src/tools/registry.d.ts +1 -1
- package/dist/src/tools/registry.d.ts.map +1 -1
- package/dist/src/tools/registry.js +1 -1
- package/dist/src/tools/registry.js.map +1 -1
- package/dist/src/tools/tasks.d.ts +1 -1
- package/dist/src/tools/tasks.d.ts.map +1 -1
- package/dist/src/tools/undo.d.ts +1 -1
- package/dist/src/tools/undo.d.ts.map +1 -1
- package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -1
- package/dist/src/tracing/cache-boundary-tracker.js +2 -2
- package/dist/src/tracing/cache-boundary-tracker.js.map +1 -1
- package/dist/src/tracing/trace-collector.d.ts +22 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -1
- package/dist/src/tracing/trace-collector.js +27 -3
- package/dist/src/tracing/trace-collector.js.map +1 -1
- package/dist/src/tracing/types.d.ts +17 -1
- package/dist/src/tracing/types.d.ts.map +1 -1
- package/dist/src/tracing/types.js.map +1 -1
- package/dist/src/tricks/failure-evidence.js +1 -1
- package/dist/src/tricks/failure-evidence.js.map +1 -1
- package/dist/src/tricks/recitation.d.ts.map +1 -1
- package/dist/src/tricks/recitation.js +2 -1
- package/dist/src/tricks/recitation.js.map +1 -1
- package/dist/src/tricks/recursive-context.d.ts.map +1 -1
- package/dist/src/tricks/recursive-context.js +2 -2
- package/dist/src/tricks/recursive-context.js.map +1 -1
- package/dist/src/tricks/reversible-compaction.d.ts.map +1 -1
- package/dist/src/tricks/reversible-compaction.js +6 -2
- package/dist/src/tricks/reversible-compaction.js.map +1 -1
- package/dist/src/tui/app.d.ts +3 -3
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +86 -14
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/components/CollapsibleDiffView.d.ts +1 -1
- package/dist/src/tui/components/CollapsibleDiffView.d.ts.map +1 -1
- package/dist/src/tui/components/DiagnosticsPanel.d.ts +24 -0
- package/dist/src/tui/components/DiagnosticsPanel.d.ts.map +1 -0
- package/dist/src/tui/components/DiagnosticsPanel.js +47 -0
- package/dist/src/tui/components/DiagnosticsPanel.js.map +1 -0
- package/dist/src/tui/components/DiffView.d.ts +1 -1
- package/dist/src/tui/components/DiffView.d.ts.map +1 -1
- package/dist/src/tui/components/ErrorBoundary.js +1 -1
- package/dist/src/tui/components/ErrorBoundary.js.map +1 -1
- package/dist/src/tui/components/TasksPanel.d.ts +1 -1
- package/dist/src/tui/components/TasksPanel.d.ts.map +1 -1
- package/dist/src/tui/event-display.js +1 -1
- package/dist/src/tui/event-display.js.map +1 -1
- package/dist/src/tui/index.js +1 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/transparency-aggregator.d.ts +13 -0
- package/dist/src/tui/transparency-aggregator.d.ts.map +1 -1
- package/dist/src/tui/transparency-aggregator.js +21 -0
- package/dist/src/tui/transparency-aggregator.js.map +1 -1
- package/dist/src/types.d.ts +27 -2
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite Session Store
|
|
3
|
+
*
|
|
4
|
+
* Alternative backend for session persistence using SQLite.
|
|
5
|
+
* Provides better query performance and ACID guarantees.
|
|
6
|
+
*
|
|
7
|
+
* Implementation is split across repository modules:
|
|
8
|
+
* - session-repository.ts: Session CRUD, checkpoints, costs, hierarchy, plans, permissions, manifest
|
|
9
|
+
* - goal-repository.ts: Goals + junctures
|
|
10
|
+
* - worker-repository.ts: Worker results + artifacts
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const store = await createSQLiteStore({ dbPath: '.agent/sessions.db' });
|
|
15
|
+
* await store.createSession('My Session');
|
|
16
|
+
* await store.appendMessage({ role: 'user', content: 'Hello' });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import Database from 'better-sqlite3';
|
|
20
|
+
import { join, dirname } from 'node:path';
|
|
21
|
+
import { mkdir } from 'node:fs/promises';
|
|
22
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
23
|
+
import { applyMigrations, getMigrationStatus, detectFeatures, } from '../../persistence/schema.js';
|
|
24
|
+
// Repository modules (extracted implementation)
|
|
25
|
+
import * as sessionRepo from './session-repository.js';
|
|
26
|
+
import * as goalRepo from './goal-repository.js';
|
|
27
|
+
import * as workerRepo from './worker-repository.js';
|
|
28
|
+
import * as codebaseRepo from './codebase-repository.js';
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// SQLITE STORE
|
|
31
|
+
// =============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* SQLite-backed session store.
|
|
34
|
+
*/
|
|
35
|
+
export class SQLiteStore {
|
|
36
|
+
db;
|
|
37
|
+
config;
|
|
38
|
+
currentSessionId = null;
|
|
39
|
+
listeners = [];
|
|
40
|
+
/** Available schema features (detected after migration) */
|
|
41
|
+
features = {
|
|
42
|
+
core: false,
|
|
43
|
+
costs: false,
|
|
44
|
+
hierarchy: false,
|
|
45
|
+
compaction: false,
|
|
46
|
+
fileChanges: false,
|
|
47
|
+
goals: false,
|
|
48
|
+
workerResults: false,
|
|
49
|
+
pendingPlans: false,
|
|
50
|
+
deadLetterQueue: false,
|
|
51
|
+
rememberedPermissions: false,
|
|
52
|
+
codebaseAnalysis: false,
|
|
53
|
+
};
|
|
54
|
+
// Prepared statements for performance
|
|
55
|
+
stmts;
|
|
56
|
+
constructor(config = {}) {
|
|
57
|
+
this.config = {
|
|
58
|
+
baseDir: config.baseDir || '.agent/sessions',
|
|
59
|
+
dbPath: config.dbPath || join(config.baseDir || '.agent/sessions', 'sessions.db'),
|
|
60
|
+
autoSave: config.autoSave ?? true,
|
|
61
|
+
maxSessions: config.maxSessions || 50,
|
|
62
|
+
walMode: config.walMode ?? true,
|
|
63
|
+
};
|
|
64
|
+
// Ensure directory exists BEFORE opening database
|
|
65
|
+
// (better-sqlite3 requires the parent directory to exist)
|
|
66
|
+
const dbDir = dirname(this.config.dbPath);
|
|
67
|
+
if (!existsSync(dbDir)) {
|
|
68
|
+
mkdirSync(dbDir, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
// Initialize database
|
|
71
|
+
this.db = new Database(this.config.dbPath);
|
|
72
|
+
// Enable WAL mode for better concurrent access
|
|
73
|
+
if (this.config.walMode) {
|
|
74
|
+
this.db.pragma('journal_mode = WAL');
|
|
75
|
+
}
|
|
76
|
+
// Enable foreign keys
|
|
77
|
+
this.db.pragma('foreign_keys = ON');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the deps object for repository modules.
|
|
81
|
+
*/
|
|
82
|
+
get deps() {
|
|
83
|
+
return {
|
|
84
|
+
db: this.db,
|
|
85
|
+
stmts: this.stmts,
|
|
86
|
+
features: this.features,
|
|
87
|
+
config: this.config,
|
|
88
|
+
getCurrentSessionId: () => this.currentSessionId,
|
|
89
|
+
setCurrentSessionId: (id) => { this.currentSessionId = id; },
|
|
90
|
+
emit: (event) => this.emit(event),
|
|
91
|
+
ensureSession: () => { this.createSession(); },
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Initialize the store (create tables, prepare statements).
|
|
96
|
+
*/
|
|
97
|
+
async initialize() {
|
|
98
|
+
// Ensure directory exists
|
|
99
|
+
const dbDir = dirname(this.config.dbPath);
|
|
100
|
+
if (!existsSync(dbDir)) {
|
|
101
|
+
await mkdir(dbDir, { recursive: true });
|
|
102
|
+
}
|
|
103
|
+
// Apply embedded migrations (no file I/O needed)
|
|
104
|
+
const isDebug = process.env.DEBUG || process.argv.includes('--debug');
|
|
105
|
+
if (isDebug) {
|
|
106
|
+
const status = getMigrationStatus(this.db);
|
|
107
|
+
process.stderr.write(`[DEBUG] [SQLite] DB version: ${status.currentVersion}, latest: ${status.latestVersion}, pending: ${status.pendingCount}\n`);
|
|
108
|
+
}
|
|
109
|
+
const result = applyMigrations(this.db);
|
|
110
|
+
if (isDebug && result.applied > 0) {
|
|
111
|
+
process.stderr.write(`[DEBUG] [SQLite] Applied ${result.applied} migrations: ${result.appliedMigrations.join(', ')}\n`);
|
|
112
|
+
}
|
|
113
|
+
// Detect available features after migrations
|
|
114
|
+
this.features = detectFeatures(this.db);
|
|
115
|
+
if (isDebug) {
|
|
116
|
+
const enabled = Object.entries(this.features)
|
|
117
|
+
.filter(([, v]) => v)
|
|
118
|
+
.map(([k]) => k);
|
|
119
|
+
process.stderr.write(`[DEBUG] [SQLite] Features: ${enabled.join(', ')}\n`);
|
|
120
|
+
}
|
|
121
|
+
// Prepare statements for available features
|
|
122
|
+
this.prepareStatements();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Prepare SQL statements for reuse.
|
|
126
|
+
*/
|
|
127
|
+
prepareStatements() {
|
|
128
|
+
this.stmts = {
|
|
129
|
+
insertSession: this.db.prepare(`
|
|
130
|
+
INSERT INTO sessions (id, name, workspace_path, workspace_fingerprint, created_at, last_active_at, message_count, token_count)
|
|
131
|
+
VALUES (@id, @name, @workspacePath, @workspaceFingerprint, @createdAt, @lastActiveAt, @messageCount, @tokenCount)
|
|
132
|
+
`),
|
|
133
|
+
updateSession: this.db.prepare(`
|
|
134
|
+
UPDATE sessions SET
|
|
135
|
+
name = COALESCE(@name, name),
|
|
136
|
+
last_active_at = COALESCE(@lastActiveAt, last_active_at),
|
|
137
|
+
message_count = COALESCE(@messageCount, message_count),
|
|
138
|
+
token_count = COALESCE(@tokenCount, token_count),
|
|
139
|
+
summary = COALESCE(@summary, summary)
|
|
140
|
+
WHERE id = @id
|
|
141
|
+
`),
|
|
142
|
+
deleteSession: this.db.prepare(`DELETE FROM sessions WHERE id = ?`),
|
|
143
|
+
getSession: this.db.prepare(`
|
|
144
|
+
SELECT id, name, created_at as createdAt,
|
|
145
|
+
workspace_path as workspacePath, workspace_fingerprint as workspaceFingerprint,
|
|
146
|
+
COALESCE(last_active_at, created_at) as lastActiveAt,
|
|
147
|
+
message_count as messageCount, token_count as tokenCount, summary,
|
|
148
|
+
parent_session_id as parentSessionId, session_type as sessionType,
|
|
149
|
+
prompt_tokens as promptTokens, completion_tokens as completionTokens,
|
|
150
|
+
cost_usd as costUsd
|
|
151
|
+
FROM sessions WHERE id = ?
|
|
152
|
+
`),
|
|
153
|
+
listSessions: this.db.prepare(`
|
|
154
|
+
SELECT id, name, created_at as createdAt,
|
|
155
|
+
workspace_path as workspacePath, workspace_fingerprint as workspaceFingerprint,
|
|
156
|
+
COALESCE(last_active_at, created_at) as lastActiveAt,
|
|
157
|
+
message_count as messageCount, token_count as tokenCount, summary,
|
|
158
|
+
parent_session_id as parentSessionId, session_type as sessionType,
|
|
159
|
+
prompt_tokens as promptTokens, completion_tokens as completionTokens,
|
|
160
|
+
cost_usd as costUsd
|
|
161
|
+
FROM sessions ORDER BY COALESCE(last_active_at, created_at) DESC
|
|
162
|
+
`),
|
|
163
|
+
insertEntry: this.db.prepare(`
|
|
164
|
+
INSERT INTO entries (session_id, timestamp, type, data)
|
|
165
|
+
VALUES (@sessionId, @timestamp, @type, @data)
|
|
166
|
+
`),
|
|
167
|
+
getEntries: this.db.prepare(`
|
|
168
|
+
SELECT timestamp, type, data FROM entries
|
|
169
|
+
WHERE session_id = ? ORDER BY id ASC
|
|
170
|
+
`),
|
|
171
|
+
insertToolCall: this.db.prepare(`
|
|
172
|
+
INSERT INTO tool_calls (id, session_id, name, arguments, status, created_at)
|
|
173
|
+
VALUES (@id, @sessionId, @name, @arguments, @status, @createdAt)
|
|
174
|
+
`),
|
|
175
|
+
updateToolCall: this.db.prepare(`
|
|
176
|
+
UPDATE tool_calls SET
|
|
177
|
+
status = @status,
|
|
178
|
+
result = @result,
|
|
179
|
+
error = @error,
|
|
180
|
+
duration_ms = @durationMs,
|
|
181
|
+
completed_at = @completedAt
|
|
182
|
+
WHERE id = @id
|
|
183
|
+
`),
|
|
184
|
+
insertCheckpoint: this.db.prepare(`
|
|
185
|
+
INSERT INTO checkpoints (id, session_id, state_json, created_at, description)
|
|
186
|
+
VALUES (@id, @sessionId, @stateJson, @createdAt, @description)
|
|
187
|
+
`),
|
|
188
|
+
getLatestCheckpoint: this.db.prepare(`
|
|
189
|
+
SELECT id, session_id as sessionId, state_json as stateJson,
|
|
190
|
+
created_at as createdAt, description
|
|
191
|
+
FROM checkpoints WHERE session_id = ?
|
|
192
|
+
ORDER BY created_at DESC, rowid DESC LIMIT 1
|
|
193
|
+
`),
|
|
194
|
+
// Cost tracking statements
|
|
195
|
+
insertUsageLog: this.db.prepare(`
|
|
196
|
+
INSERT INTO usage_logs (session_id, model_id, prompt_tokens, completion_tokens, cost_usd, timestamp)
|
|
197
|
+
VALUES (@sessionId, @modelId, @promptTokens, @completionTokens, @costUsd, @timestamp)
|
|
198
|
+
`),
|
|
199
|
+
updateSessionCosts: this.db.prepare(`
|
|
200
|
+
UPDATE sessions SET
|
|
201
|
+
prompt_tokens = COALESCE(prompt_tokens, 0) + @promptTokens,
|
|
202
|
+
completion_tokens = COALESCE(completion_tokens, 0) + @completionTokens,
|
|
203
|
+
cost_usd = COALESCE(cost_usd, 0) + @costUsd
|
|
204
|
+
WHERE id = @sessionId
|
|
205
|
+
`),
|
|
206
|
+
getSessionUsage: this.db.prepare(`
|
|
207
|
+
SELECT
|
|
208
|
+
COALESCE(SUM(prompt_tokens), 0) as promptTokens,
|
|
209
|
+
COALESCE(SUM(completion_tokens), 0) as completionTokens,
|
|
210
|
+
COALESCE(SUM(cost_usd), 0) as costUsd
|
|
211
|
+
FROM usage_logs WHERE session_id = ?
|
|
212
|
+
`),
|
|
213
|
+
// Session hierarchy statements
|
|
214
|
+
insertChildSession: this.db.prepare(`
|
|
215
|
+
INSERT INTO sessions (id, name, workspace_path, workspace_fingerprint, created_at, last_active_at, message_count, token_count, parent_session_id, session_type)
|
|
216
|
+
VALUES (@id, @name, @workspacePath, @workspaceFingerprint, @createdAt, @lastActiveAt, @messageCount, @tokenCount, @parentSessionId, @sessionType)
|
|
217
|
+
`),
|
|
218
|
+
getChildSessions: this.db.prepare(`
|
|
219
|
+
SELECT id, name, created_at as createdAt, last_active_at as lastActiveAt,
|
|
220
|
+
workspace_path as workspacePath, workspace_fingerprint as workspaceFingerprint,
|
|
221
|
+
message_count as messageCount, token_count as tokenCount, summary,
|
|
222
|
+
parent_session_id as parentSessionId, session_type as sessionType,
|
|
223
|
+
prompt_tokens as promptTokens, completion_tokens as completionTokens,
|
|
224
|
+
cost_usd as costUsd
|
|
225
|
+
FROM sessions WHERE parent_session_id = ?
|
|
226
|
+
ORDER BY created_at ASC
|
|
227
|
+
`),
|
|
228
|
+
getSessionTree: this.db.prepare(`
|
|
229
|
+
WITH RECURSIVE session_tree AS (
|
|
230
|
+
SELECT id, name, created_at as createdAt, last_active_at as lastActiveAt,
|
|
231
|
+
workspace_path as workspacePath, workspace_fingerprint as workspaceFingerprint,
|
|
232
|
+
message_count as messageCount, token_count as tokenCount, summary,
|
|
233
|
+
parent_session_id as parentSessionId, session_type as sessionType,
|
|
234
|
+
prompt_tokens as promptTokens, completion_tokens as completionTokens,
|
|
235
|
+
cost_usd as costUsd, 0 as depth
|
|
236
|
+
FROM sessions WHERE id = ?
|
|
237
|
+
UNION ALL
|
|
238
|
+
SELECT s.id, s.name, s.created_at, s.last_active_at,
|
|
239
|
+
s.workspace_path, s.workspace_fingerprint,
|
|
240
|
+
s.message_count, s.token_count, s.summary,
|
|
241
|
+
s.parent_session_id, s.session_type,
|
|
242
|
+
s.prompt_tokens, s.completion_tokens,
|
|
243
|
+
s.cost_usd, st.depth + 1
|
|
244
|
+
FROM sessions s
|
|
245
|
+
INNER JOIN session_tree st ON s.parent_session_id = st.id
|
|
246
|
+
)
|
|
247
|
+
SELECT * FROM session_tree ORDER BY depth, createdAt ASC
|
|
248
|
+
`),
|
|
249
|
+
};
|
|
250
|
+
// Goal integrity statements - only prepare if feature is available
|
|
251
|
+
if (this.features.goals) {
|
|
252
|
+
this.stmts.insertGoal = this.db.prepare(`
|
|
253
|
+
INSERT INTO goals (id, session_id, goal_text, status, priority, parent_goal_id,
|
|
254
|
+
progress_current, progress_total, created_at, updated_at, metadata)
|
|
255
|
+
VALUES (@id, @sessionId, @goalText, @status, @priority, @parentGoalId,
|
|
256
|
+
@progressCurrent, @progressTotal, @createdAt, @updatedAt, @metadata)
|
|
257
|
+
`);
|
|
258
|
+
this.stmts.updateGoal = this.db.prepare(`
|
|
259
|
+
UPDATE goals SET
|
|
260
|
+
goal_text = COALESCE(@goalText, goal_text),
|
|
261
|
+
status = COALESCE(@status, status),
|
|
262
|
+
priority = COALESCE(@priority, priority),
|
|
263
|
+
progress_current = COALESCE(@progressCurrent, progress_current),
|
|
264
|
+
progress_total = COALESCE(@progressTotal, progress_total),
|
|
265
|
+
updated_at = @updatedAt,
|
|
266
|
+
completed_at = @completedAt,
|
|
267
|
+
metadata = COALESCE(@metadata, metadata)
|
|
268
|
+
WHERE id = @id
|
|
269
|
+
`);
|
|
270
|
+
this.stmts.getGoal = this.db.prepare(`
|
|
271
|
+
SELECT id, session_id as sessionId, goal_text as goalText, status, priority,
|
|
272
|
+
parent_goal_id as parentGoalId, progress_current as progressCurrent,
|
|
273
|
+
progress_total as progressTotal, created_at as createdAt,
|
|
274
|
+
updated_at as updatedAt, completed_at as completedAt, metadata
|
|
275
|
+
FROM goals WHERE id = ?
|
|
276
|
+
`);
|
|
277
|
+
this.stmts.listGoals = this.db.prepare(`
|
|
278
|
+
SELECT id, session_id as sessionId, goal_text as goalText, status, priority,
|
|
279
|
+
parent_goal_id as parentGoalId, progress_current as progressCurrent,
|
|
280
|
+
progress_total as progressTotal, created_at as createdAt,
|
|
281
|
+
updated_at as updatedAt, completed_at as completedAt, metadata
|
|
282
|
+
FROM goals WHERE session_id = ? ORDER BY priority ASC, created_at ASC
|
|
283
|
+
`);
|
|
284
|
+
this.stmts.listActiveGoals = this.db.prepare(`
|
|
285
|
+
SELECT id, session_id as sessionId, goal_text as goalText, status, priority,
|
|
286
|
+
parent_goal_id as parentGoalId, progress_current as progressCurrent,
|
|
287
|
+
progress_total as progressTotal, created_at as createdAt,
|
|
288
|
+
updated_at as updatedAt, completed_at as completedAt, metadata
|
|
289
|
+
FROM goals WHERE session_id = ? AND status = 'active'
|
|
290
|
+
ORDER BY priority ASC, created_at ASC
|
|
291
|
+
`);
|
|
292
|
+
this.stmts.insertJuncture = this.db.prepare(`
|
|
293
|
+
INSERT INTO junctures (session_id, goal_id, type, description, outcome,
|
|
294
|
+
importance, context, created_at)
|
|
295
|
+
VALUES (@sessionId, @goalId, @type, @description, @outcome,
|
|
296
|
+
@importance, @context, @createdAt)
|
|
297
|
+
`);
|
|
298
|
+
this.stmts.listJunctures = this.db.prepare(`
|
|
299
|
+
SELECT id, session_id as sessionId, goal_id as goalId, type, description,
|
|
300
|
+
outcome, importance, context, created_at as createdAt
|
|
301
|
+
FROM junctures WHERE session_id = ? ORDER BY created_at DESC
|
|
302
|
+
`);
|
|
303
|
+
}
|
|
304
|
+
// Worker result statements - only prepare if feature is available
|
|
305
|
+
if (this.features.workerResults) {
|
|
306
|
+
this.stmts.insertWorkerResult = this.db.prepare(`
|
|
307
|
+
INSERT INTO worker_results (id, session_id, worker_id, task_description, model_used,
|
|
308
|
+
status, summary, full_output, artifacts, metrics, error,
|
|
309
|
+
created_at, completed_at)
|
|
310
|
+
VALUES (@id, @sessionId, @workerId, @taskDescription, @modelUsed,
|
|
311
|
+
@status, @summary, @fullOutput, @artifacts, @metrics, @error,
|
|
312
|
+
@createdAt, @completedAt)
|
|
313
|
+
`);
|
|
314
|
+
this.stmts.updateWorkerResult = this.db.prepare(`
|
|
315
|
+
UPDATE worker_results SET
|
|
316
|
+
status = COALESCE(@status, status),
|
|
317
|
+
summary = COALESCE(@summary, summary),
|
|
318
|
+
full_output = COALESCE(@fullOutput, full_output),
|
|
319
|
+
artifacts = COALESCE(@artifacts, artifacts),
|
|
320
|
+
metrics = COALESCE(@metrics, metrics),
|
|
321
|
+
error = @error,
|
|
322
|
+
completed_at = @completedAt
|
|
323
|
+
WHERE id = @id
|
|
324
|
+
`);
|
|
325
|
+
this.stmts.getWorkerResult = this.db.prepare(`
|
|
326
|
+
SELECT id, session_id as sessionId, worker_id as workerId,
|
|
327
|
+
task_description as taskDescription, model_used as modelUsed,
|
|
328
|
+
status, summary, full_output as fullOutput, artifacts, metrics,
|
|
329
|
+
error, created_at as createdAt, completed_at as completedAt
|
|
330
|
+
FROM worker_results WHERE id = ?
|
|
331
|
+
`);
|
|
332
|
+
this.stmts.listWorkerResults = this.db.prepare(`
|
|
333
|
+
SELECT id, session_id as sessionId, worker_id as workerId,
|
|
334
|
+
task_description as taskDescription, model_used as modelUsed,
|
|
335
|
+
status, summary, full_output as fullOutput, artifacts, metrics,
|
|
336
|
+
error, created_at as createdAt, completed_at as completedAt
|
|
337
|
+
FROM worker_results WHERE session_id = ?
|
|
338
|
+
ORDER BY created_at DESC
|
|
339
|
+
`);
|
|
340
|
+
this.stmts.listPendingWorkerResults = this.db.prepare(`
|
|
341
|
+
SELECT id, session_id as sessionId, worker_id as workerId,
|
|
342
|
+
task_description as taskDescription, model_used as modelUsed,
|
|
343
|
+
status, summary, created_at as createdAt
|
|
344
|
+
FROM worker_results WHERE session_id = ? AND status = 'pending'
|
|
345
|
+
ORDER BY created_at ASC
|
|
346
|
+
`);
|
|
347
|
+
}
|
|
348
|
+
// Pending plan statements (optional - only if pendingPlans feature available)
|
|
349
|
+
if (this.features.pendingPlans) {
|
|
350
|
+
this.stmts.insertPendingPlan = this.db.prepare(`
|
|
351
|
+
INSERT INTO pending_plans (id, session_id, task, proposed_changes, exploration_summary, status, created_at, updated_at)
|
|
352
|
+
VALUES (@id, @sessionId, @task, @proposedChanges, @explorationSummary, @status, @createdAt, @updatedAt)
|
|
353
|
+
`);
|
|
354
|
+
this.stmts.updatePendingPlan = this.db.prepare(`
|
|
355
|
+
UPDATE pending_plans SET
|
|
356
|
+
proposed_changes = @proposedChanges,
|
|
357
|
+
exploration_summary = @explorationSummary,
|
|
358
|
+
status = @status,
|
|
359
|
+
updated_at = @updatedAt
|
|
360
|
+
WHERE id = @id
|
|
361
|
+
`);
|
|
362
|
+
this.stmts.getPendingPlan = this.db.prepare(`
|
|
363
|
+
SELECT id, session_id as sessionId, task, proposed_changes as proposedChanges,
|
|
364
|
+
exploration_summary as explorationSummary, status, created_at as createdAt, updated_at as updatedAt
|
|
365
|
+
FROM pending_plans WHERE session_id = ? AND status = 'pending'
|
|
366
|
+
ORDER BY created_at DESC LIMIT 1
|
|
367
|
+
`);
|
|
368
|
+
this.stmts.deletePendingPlan = this.db.prepare(`
|
|
369
|
+
DELETE FROM pending_plans WHERE id = ?
|
|
370
|
+
`);
|
|
371
|
+
}
|
|
372
|
+
// Remembered permissions statements (optional - only if feature available)
|
|
373
|
+
if (this.features.rememberedPermissions) {
|
|
374
|
+
this.stmts.insertRememberedPermission = this.db.prepare(`
|
|
375
|
+
INSERT OR REPLACE INTO remembered_permissions (tool_name, pattern, decision, created_at)
|
|
376
|
+
VALUES (@toolName, @pattern, @decision, @createdAt)
|
|
377
|
+
`);
|
|
378
|
+
this.stmts.getRememberedPermission = this.db.prepare(`
|
|
379
|
+
SELECT tool_name as toolName, pattern, decision, created_at as createdAt
|
|
380
|
+
FROM remembered_permissions
|
|
381
|
+
WHERE tool_name = ? AND (pattern = ? OR pattern IS NULL)
|
|
382
|
+
ORDER BY pattern IS NULL ASC
|
|
383
|
+
LIMIT 1
|
|
384
|
+
`);
|
|
385
|
+
this.stmts.listRememberedPermissions = this.db.prepare(`
|
|
386
|
+
SELECT tool_name as toolName, pattern, decision, created_at as createdAt
|
|
387
|
+
FROM remembered_permissions
|
|
388
|
+
ORDER BY tool_name, pattern
|
|
389
|
+
`);
|
|
390
|
+
this.stmts.deleteRememberedPermission = this.db.prepare(`
|
|
391
|
+
DELETE FROM remembered_permissions WHERE tool_name = ? AND (pattern = ? OR (? IS NULL AND pattern IS NULL))
|
|
392
|
+
`);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// ===========================================================================
|
|
396
|
+
// SESSION MANAGEMENT (delegates to session-repository.ts)
|
|
397
|
+
// ===========================================================================
|
|
398
|
+
createSession(name) {
|
|
399
|
+
return sessionRepo.createSession(this.deps, name);
|
|
400
|
+
}
|
|
401
|
+
getCurrentSessionId() {
|
|
402
|
+
return this.currentSessionId;
|
|
403
|
+
}
|
|
404
|
+
setCurrentSessionId(sessionId) {
|
|
405
|
+
this.currentSessionId = sessionId;
|
|
406
|
+
}
|
|
407
|
+
appendEntry(entry) {
|
|
408
|
+
sessionRepo.appendEntry(this.deps, entry);
|
|
409
|
+
}
|
|
410
|
+
appendMessage(message) {
|
|
411
|
+
sessionRepo.appendMessage(this.deps, message);
|
|
412
|
+
}
|
|
413
|
+
appendToolCall(toolCall) {
|
|
414
|
+
sessionRepo.appendToolCall(this.deps, toolCall);
|
|
415
|
+
}
|
|
416
|
+
appendToolResult(callId, result) {
|
|
417
|
+
sessionRepo.appendToolResult(this.deps, callId, result);
|
|
418
|
+
}
|
|
419
|
+
appendCompaction(summary, compactedCount) {
|
|
420
|
+
sessionRepo.appendCompaction(this.deps, summary, compactedCount);
|
|
421
|
+
}
|
|
422
|
+
loadSession(sessionId) {
|
|
423
|
+
return sessionRepo.loadSession(this.deps, sessionId);
|
|
424
|
+
}
|
|
425
|
+
loadSessionMessages(sessionId) {
|
|
426
|
+
return sessionRepo.loadSessionMessages(this.deps, sessionId);
|
|
427
|
+
}
|
|
428
|
+
deleteSession(sessionId) {
|
|
429
|
+
sessionRepo.deleteSession(this.deps, sessionId);
|
|
430
|
+
}
|
|
431
|
+
listSessions() {
|
|
432
|
+
return sessionRepo.listSessions(this.deps);
|
|
433
|
+
}
|
|
434
|
+
getRecentSession() {
|
|
435
|
+
return sessionRepo.getRecentSession(this.deps);
|
|
436
|
+
}
|
|
437
|
+
getSessionMetadata(sessionId) {
|
|
438
|
+
return sessionRepo.getSessionMetadata(this.deps, sessionId);
|
|
439
|
+
}
|
|
440
|
+
updateSessionMetadata(sessionId, updates) {
|
|
441
|
+
sessionRepo.updateSessionMetadata(this.deps, sessionId, updates);
|
|
442
|
+
}
|
|
443
|
+
// ===========================================================================
|
|
444
|
+
// SQLITE-SPECIFIC FEATURES (delegates to session-repository.ts)
|
|
445
|
+
// ===========================================================================
|
|
446
|
+
saveCheckpoint(state, description) {
|
|
447
|
+
return sessionRepo.saveCheckpoint(this.deps, state, description);
|
|
448
|
+
}
|
|
449
|
+
loadLatestCheckpoint(sessionId) {
|
|
450
|
+
return sessionRepo.loadLatestCheckpoint(this.deps, sessionId);
|
|
451
|
+
}
|
|
452
|
+
query(sql, params = []) {
|
|
453
|
+
return sessionRepo.query(this.deps, sql, params);
|
|
454
|
+
}
|
|
455
|
+
getStats() {
|
|
456
|
+
return sessionRepo.getStats(this.deps);
|
|
457
|
+
}
|
|
458
|
+
getDatabase() {
|
|
459
|
+
return this.db;
|
|
460
|
+
}
|
|
461
|
+
// ===========================================================================
|
|
462
|
+
// COST TRACKING (delegates to session-repository.ts)
|
|
463
|
+
// ===========================================================================
|
|
464
|
+
logUsage(usage) {
|
|
465
|
+
sessionRepo.logUsage(this.deps, usage);
|
|
466
|
+
}
|
|
467
|
+
getSessionUsage(sessionId) {
|
|
468
|
+
return sessionRepo.getSessionUsage(this.deps, sessionId);
|
|
469
|
+
}
|
|
470
|
+
// ===========================================================================
|
|
471
|
+
// SESSION HIERARCHY (delegates to session-repository.ts)
|
|
472
|
+
// ===========================================================================
|
|
473
|
+
createChildSession(parentId, name, type = 'subagent') {
|
|
474
|
+
return sessionRepo.createChildSession(this.deps, parentId, name, type);
|
|
475
|
+
}
|
|
476
|
+
getChildSessions(parentId) {
|
|
477
|
+
return sessionRepo.getChildSessions(this.deps, parentId);
|
|
478
|
+
}
|
|
479
|
+
getSessionTree(rootId) {
|
|
480
|
+
return sessionRepo.getSessionTree(this.deps, rootId);
|
|
481
|
+
}
|
|
482
|
+
// ===========================================================================
|
|
483
|
+
// GOAL INTEGRITY (delegates to goal-repository.ts)
|
|
484
|
+
// ===========================================================================
|
|
485
|
+
hasGoalsFeature() {
|
|
486
|
+
return this.features.goals;
|
|
487
|
+
}
|
|
488
|
+
createGoal(goalText, options = {}) {
|
|
489
|
+
return goalRepo.createGoal(this.deps, goalText, options);
|
|
490
|
+
}
|
|
491
|
+
updateGoal(goalId, updates) {
|
|
492
|
+
goalRepo.updateGoal(this.deps, goalId, updates);
|
|
493
|
+
}
|
|
494
|
+
completeGoal(goalId) {
|
|
495
|
+
goalRepo.completeGoal(this.deps, goalId);
|
|
496
|
+
}
|
|
497
|
+
getGoal(goalId) {
|
|
498
|
+
return goalRepo.getGoal(this.deps, goalId);
|
|
499
|
+
}
|
|
500
|
+
listGoals(sessionId) {
|
|
501
|
+
return goalRepo.listGoals(this.deps, sessionId);
|
|
502
|
+
}
|
|
503
|
+
listActiveGoals(sessionId) {
|
|
504
|
+
return goalRepo.listActiveGoals(this.deps, sessionId);
|
|
505
|
+
}
|
|
506
|
+
getGoalsSummary(sessionId) {
|
|
507
|
+
return goalRepo.getGoalsSummary(this.deps, sessionId);
|
|
508
|
+
}
|
|
509
|
+
logJuncture(type, description, options = {}) {
|
|
510
|
+
return goalRepo.logJuncture(this.deps, type, description, options);
|
|
511
|
+
}
|
|
512
|
+
listJunctures(sessionId, limit) {
|
|
513
|
+
return goalRepo.listJunctures(this.deps, sessionId, limit);
|
|
514
|
+
}
|
|
515
|
+
getJuncturesSummary(sessionId, limit = 5) {
|
|
516
|
+
return goalRepo.getJuncturesSummary(this.deps, sessionId, limit);
|
|
517
|
+
}
|
|
518
|
+
// ===========================================================================
|
|
519
|
+
// WORKER RESULTS (delegates to worker-repository.ts)
|
|
520
|
+
// ===========================================================================
|
|
521
|
+
hasWorkerResultsFeature() {
|
|
522
|
+
return this.features.workerResults;
|
|
523
|
+
}
|
|
524
|
+
createWorkerResult(workerId, taskDescription, modelUsed) {
|
|
525
|
+
return workerRepo.createWorkerResult(this.deps, workerId, taskDescription, modelUsed);
|
|
526
|
+
}
|
|
527
|
+
completeWorkerResult(resultId, output) {
|
|
528
|
+
return workerRepo.completeWorkerResult(this.deps, resultId, output);
|
|
529
|
+
}
|
|
530
|
+
failWorkerResult(resultId, error) {
|
|
531
|
+
workerRepo.failWorkerResult(this.deps, resultId, error);
|
|
532
|
+
}
|
|
533
|
+
getWorkerResult(resultId) {
|
|
534
|
+
return workerRepo.getWorkerResult(this.deps, resultId);
|
|
535
|
+
}
|
|
536
|
+
getWorkerResultRef(resultId) {
|
|
537
|
+
return workerRepo.getWorkerResultRef(this.deps, resultId);
|
|
538
|
+
}
|
|
539
|
+
listWorkerResults(sessionId) {
|
|
540
|
+
return workerRepo.listWorkerResults(this.deps, sessionId);
|
|
541
|
+
}
|
|
542
|
+
listPendingWorkerResults(sessionId) {
|
|
543
|
+
return workerRepo.listPendingWorkerResults(this.deps, sessionId);
|
|
544
|
+
}
|
|
545
|
+
getWorkerResultsSummary(sessionId) {
|
|
546
|
+
return workerRepo.getWorkerResultsSummary(this.deps, sessionId);
|
|
547
|
+
}
|
|
548
|
+
// ===========================================================================
|
|
549
|
+
// PENDING PLANS (delegates to session-repository.ts)
|
|
550
|
+
// ===========================================================================
|
|
551
|
+
hasPendingPlansFeature() {
|
|
552
|
+
return this.features.pendingPlans;
|
|
553
|
+
}
|
|
554
|
+
savePendingPlan(plan, sessionId) {
|
|
555
|
+
sessionRepo.savePendingPlan(this.deps, plan, sessionId);
|
|
556
|
+
}
|
|
557
|
+
getPendingPlan(sessionId) {
|
|
558
|
+
return sessionRepo.getPendingPlan(this.deps, sessionId);
|
|
559
|
+
}
|
|
560
|
+
updatePlanStatus(planId, status) {
|
|
561
|
+
sessionRepo.updatePlanStatus(this.deps, planId, status);
|
|
562
|
+
}
|
|
563
|
+
deletePendingPlan(planId) {
|
|
564
|
+
sessionRepo.deletePendingPlan(this.deps, planId);
|
|
565
|
+
}
|
|
566
|
+
// ===========================================================================
|
|
567
|
+
// SESSION MANIFEST (delegates to session-repository.ts)
|
|
568
|
+
// ===========================================================================
|
|
569
|
+
exportSessionManifest(sessionId) {
|
|
570
|
+
return sessionRepo.exportSessionManifest(this.deps, this.manifestCallbacks, sessionId);
|
|
571
|
+
}
|
|
572
|
+
exportSessionMarkdown(sessionId) {
|
|
573
|
+
return sessionRepo.exportSessionMarkdown(this.deps, this.manifestCallbacks, sessionId);
|
|
574
|
+
}
|
|
575
|
+
/** Callbacks for manifest export (bridges to goal/worker repositories). */
|
|
576
|
+
get manifestCallbacks() {
|
|
577
|
+
return {
|
|
578
|
+
listGoals: (sid) => this.listGoals(sid),
|
|
579
|
+
listJunctures: (sid, limit) => this.listJunctures(sid, limit),
|
|
580
|
+
listWorkerResults: (sid) => this.listWorkerResults(sid),
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
// ===========================================================================
|
|
584
|
+
// MIGRATION (delegates to session-repository.ts)
|
|
585
|
+
// ===========================================================================
|
|
586
|
+
async migrateFromJSONL(jsonlDir) {
|
|
587
|
+
return sessionRepo.migrateFromJSONL(this.deps, jsonlDir);
|
|
588
|
+
}
|
|
589
|
+
// ===========================================================================
|
|
590
|
+
// REMEMBERED PERMISSIONS (delegates to session-repository.ts)
|
|
591
|
+
// ===========================================================================
|
|
592
|
+
hasRememberedPermissionsFeature() {
|
|
593
|
+
return this.features.rememberedPermissions;
|
|
594
|
+
}
|
|
595
|
+
rememberPermission(toolName, decision, pattern) {
|
|
596
|
+
sessionRepo.rememberPermission(this.deps, toolName, decision, pattern);
|
|
597
|
+
}
|
|
598
|
+
getRememberedPermission(toolName, pattern) {
|
|
599
|
+
return sessionRepo.getRememberedPermission(this.deps, toolName, pattern);
|
|
600
|
+
}
|
|
601
|
+
listRememberedPermissions() {
|
|
602
|
+
return sessionRepo.listRememberedPermissions(this.deps);
|
|
603
|
+
}
|
|
604
|
+
forgetPermission(toolName, pattern) {
|
|
605
|
+
sessionRepo.forgetPermission(this.deps, toolName, pattern);
|
|
606
|
+
}
|
|
607
|
+
clearRememberedPermissions(toolName) {
|
|
608
|
+
sessionRepo.clearRememberedPermissions(this.deps, toolName);
|
|
609
|
+
}
|
|
610
|
+
// ===========================================================================
|
|
611
|
+
// LIFECYCLE
|
|
612
|
+
// ===========================================================================
|
|
613
|
+
/**
|
|
614
|
+
* Subscribe to events.
|
|
615
|
+
*/
|
|
616
|
+
on(listener) {
|
|
617
|
+
this.listeners.push(listener);
|
|
618
|
+
return () => {
|
|
619
|
+
const idx = this.listeners.indexOf(listener);
|
|
620
|
+
if (idx >= 0)
|
|
621
|
+
this.listeners.splice(idx, 1);
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Emit an event.
|
|
626
|
+
*/
|
|
627
|
+
emit(event) {
|
|
628
|
+
for (const listener of this.listeners) {
|
|
629
|
+
try {
|
|
630
|
+
listener(event);
|
|
631
|
+
}
|
|
632
|
+
catch {
|
|
633
|
+
// Ignore listener errors
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Close the database connection.
|
|
639
|
+
*/
|
|
640
|
+
close() {
|
|
641
|
+
this.db.close();
|
|
642
|
+
}
|
|
643
|
+
// ===========================================================================
|
|
644
|
+
// CODEBASE ANALYSIS PERSISTENCE
|
|
645
|
+
// ===========================================================================
|
|
646
|
+
/**
|
|
647
|
+
* Save codebase analysis to SQLite for warm startup next session.
|
|
648
|
+
*/
|
|
649
|
+
saveCodebaseAnalysis(root, chunks, dependencyGraph) {
|
|
650
|
+
codebaseRepo.saveCodebaseAnalysis(this.deps, root, chunks, dependencyGraph);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Load persisted codebase analysis from SQLite.
|
|
654
|
+
*/
|
|
655
|
+
loadCodebaseAnalysis(root) {
|
|
656
|
+
return codebaseRepo.loadCodebaseAnalysis(this.deps, root);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Cleanup - same as close for compatibility.
|
|
660
|
+
*/
|
|
661
|
+
async cleanup() {
|
|
662
|
+
this.close();
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
// =============================================================================
|
|
666
|
+
// FACTORY
|
|
667
|
+
// =============================================================================
|
|
668
|
+
/**
|
|
669
|
+
* Create and initialize a SQLite session store.
|
|
670
|
+
*/
|
|
671
|
+
export async function createSQLiteStore(config) {
|
|
672
|
+
const store = new SQLiteStore(config);
|
|
673
|
+
await store.initialize();
|
|
674
|
+
return store;
|
|
675
|
+
}
|
|
676
|
+
//# sourceMappingURL=sqlite-store.js.map
|