attocode 0.2.3 → 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 +122 -1
- package/README.md +65 -5
- package/dist/src/adapters.d.ts +2 -1
- package/dist/src/adapters.d.ts.map +1 -1
- package/dist/src/adapters.js +74 -12
- 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 +52 -213
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +544 -4072
- package/dist/src/agent.js.map +1 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +2 -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 +18 -9
- package/dist/src/commands/handler.js.map +1 -1
- package/dist/src/commands/init-commands.d.ts.map +1 -1
- package/dist/src/commands/init-commands.js +16 -1
- package/dist/src/commands/init-commands.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +31 -0
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/config/base-types.d.ts +45 -0
- package/dist/src/config/base-types.d.ts.map +1 -0
- package/dist/src/config/base-types.js +9 -0
- package/dist/src/config/base-types.js.map +1 -0
- package/dist/src/config/config-manager.d.ts +35 -0
- package/dist/src/config/config-manager.d.ts.map +1 -0
- package/dist/src/config/config-manager.js +108 -0
- package/dist/src/config/config-manager.js.map +1 -0
- package/dist/src/config/index.d.ts +4 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +3 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/schema.d.ts +1546 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +268 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/config.d.ts +4 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +8 -12
- package/dist/src/config.js.map +1 -1
- package/dist/src/core/agent-state-machine.d.ts +131 -0
- package/dist/src/core/agent-state-machine.d.ts.map +1 -0
- package/dist/src/core/agent-state-machine.js +302 -0
- package/dist/src/core/agent-state-machine.js.map +1 -0
- package/dist/src/core/base-manager.d.ts +79 -0
- package/dist/src/core/base-manager.d.ts.map +1 -0
- package/dist/src/core/base-manager.js +170 -0
- package/dist/src/core/base-manager.js.map +1 -0
- package/dist/src/core/completion-analyzer.d.ts +15 -0
- package/dist/src/core/completion-analyzer.d.ts.map +1 -0
- package/dist/src/core/completion-analyzer.js +53 -0
- package/dist/src/core/completion-analyzer.js.map +1 -0
- package/dist/src/core/execution-loop.d.ts +46 -0
- package/dist/src/core/execution-loop.d.ts.map +1 -0
- package/dist/src/core/execution-loop.js +1397 -0
- package/dist/src/core/execution-loop.js.map +1 -0
- package/dist/src/core/index.d.ts +7 -0
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +9 -0
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/process-handlers.d.ts.map +1 -1
- package/dist/src/core/process-handlers.js +14 -0
- package/dist/src/core/process-handlers.js.map +1 -1
- package/dist/src/core/protocol/types.d.ts +12 -12
- package/dist/src/core/response-handler.d.ts +16 -0
- package/dist/src/core/response-handler.d.ts.map +1 -0
- package/dist/src/core/response-handler.js +235 -0
- package/dist/src/core/response-handler.js.map +1 -0
- package/dist/src/core/subagent-spawner.d.ts +43 -0
- package/dist/src/core/subagent-spawner.d.ts.map +1 -0
- package/dist/src/core/subagent-spawner.js +973 -0
- package/dist/src/core/subagent-spawner.js.map +1 -0
- package/dist/src/core/tool-executor.d.ts +59 -0
- package/dist/src/core/tool-executor.d.ts.map +1 -0
- package/dist/src/core/tool-executor.js +682 -0
- package/dist/src/core/tool-executor.js.map +1 -0
- package/dist/src/core/types.d.ts +134 -0
- package/dist/src/core/types.d.ts.map +1 -0
- package/dist/src/core/types.js +12 -0
- package/dist/src/core/types.js.map +1 -0
- package/dist/src/defaults.d.ts +2 -2
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +29 -1
- package/dist/src/defaults.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/auto-compaction.d.ts.map +1 -1
- package/dist/src/integrations/auto-compaction.js +3 -2
- package/dist/src/integrations/auto-compaction.js.map +1 -1
- 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/budget-pool.d.ts +7 -0
- package/dist/src/integrations/budget-pool.d.ts.map +1 -1
- package/dist/src/integrations/budget-pool.js +43 -0
- package/dist/src/integrations/budget-pool.js.map +1 -1
- package/dist/src/integrations/codebase-ast.d.ts +52 -0
- package/dist/src/integrations/codebase-ast.d.ts.map +1 -0
- package/dist/src/integrations/codebase-ast.js +457 -0
- package/dist/src/integrations/codebase-ast.js.map +1 -0
- package/dist/src/integrations/codebase-context.d.ts +18 -0
- package/dist/src/integrations/codebase-context.d.ts.map +1 -1
- package/dist/src/integrations/codebase-context.js +197 -17
- package/dist/src/integrations/codebase-context.js.map +1 -1
- package/dist/src/integrations/compaction.d.ts.map +1 -1
- package/dist/src/integrations/compaction.js +14 -6
- package/dist/src/integrations/compaction.js.map +1 -1
- 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/context-engineering.d.ts +8 -0
- package/dist/src/integrations/context-engineering.d.ts.map +1 -1
- package/dist/src/integrations/context-engineering.js +19 -0
- package/dist/src/integrations/context-engineering.js.map +1 -1
- package/dist/src/integrations/economics.d.ts +25 -1
- package/dist/src/integrations/economics.d.ts.map +1 -1
- package/dist/src/integrations/economics.js +217 -38
- package/dist/src/integrations/economics.js.map +1 -1
- package/dist/src/integrations/edit-validator.d.ts +30 -0
- package/dist/src/integrations/edit-validator.d.ts.map +1 -0
- package/dist/src/integrations/edit-validator.js +85 -0
- package/dist/src/integrations/edit-validator.js.map +1 -0
- package/dist/src/integrations/file-cache.d.ts +7 -0
- package/dist/src/integrations/file-cache.d.ts.map +1 -1
- package/dist/src/integrations/file-cache.js +54 -0
- package/dist/src/integrations/file-cache.js.map +1 -1
- package/dist/src/integrations/health-check.d.ts.map +1 -1
- package/dist/src/integrations/health-check.js +3 -2
- package/dist/src/integrations/health-check.js.map +1 -1
- package/dist/src/integrations/hierarchical-config.d.ts +3 -0
- package/dist/src/integrations/hierarchical-config.d.ts.map +1 -1
- package/dist/src/integrations/hierarchical-config.js +3 -0
- package/dist/src/integrations/hierarchical-config.js.map +1 -1
- package/dist/src/integrations/hooks.d.ts +2 -0
- package/dist/src/integrations/hooks.d.ts.map +1 -1
- package/dist/src/integrations/hooks.js +99 -15
- package/dist/src/integrations/hooks.js.map +1 -1
- package/dist/src/integrations/index.d.ts +77 -66
- package/dist/src/integrations/index.d.ts.map +1 -1
- package/dist/src/integrations/index.js +83 -67
- package/dist/src/integrations/index.js.map +1 -1
- package/dist/src/integrations/logger.d.ts +104 -0
- package/dist/src/integrations/logger.d.ts.map +1 -0
- package/dist/src/integrations/logger.js +219 -0
- package/dist/src/integrations/logger.js.map +1 -0
- 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/lsp.d.ts.map +1 -1
- package/dist/src/integrations/lsp.js +5 -4
- package/dist/src/integrations/lsp.js.map +1 -1
- 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/mcp-client.d.ts.map +1 -1
- package/dist/src/integrations/mcp-client.js +8 -7
- package/dist/src/integrations/mcp-client.js.map +1 -1
- package/dist/src/integrations/observability.d.ts.map +1 -1
- package/dist/src/integrations/observability.js +5 -4
- package/dist/src/integrations/observability.js.map +1 -1
- package/dist/src/integrations/openrouter-pricing.d.ts.map +1 -1
- package/dist/src/integrations/openrouter-pricing.js +4 -3
- package/dist/src/integrations/openrouter-pricing.js.map +1 -1
- 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/persistence.d.ts.map +1 -1
- package/dist/src/integrations/persistence.js +5 -4
- package/dist/src/integrations/persistence.js.map +1 -1
- package/dist/src/integrations/planning.d.ts.map +1 -1
- package/dist/src/integrations/planning.js +5 -4
- package/dist/src/integrations/planning.js.map +1 -1
- 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/retry.d.ts +1 -0
- package/dist/src/integrations/retry.d.ts.map +1 -1
- package/dist/src/integrations/retry.js.map +1 -1
- package/dist/src/integrations/routing.d.ts.map +1 -1
- package/dist/src/integrations/routing.js +2 -1
- package/dist/src/integrations/routing.js.map +1 -1
- 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/safety.d.ts.map +1 -1
- package/dist/src/integrations/safety.js +13 -13
- package/dist/src/integrations/safety.js.map +1 -1
- package/dist/src/integrations/sandbox/docker.d.ts.map +1 -1
- package/dist/src/integrations/sandbox/docker.js +2 -1
- package/dist/src/integrations/sandbox/docker.js.map +1 -1
- package/dist/src/integrations/sandbox/index.d.ts.map +1 -1
- package/dist/src/integrations/sandbox/index.js +5 -4
- package/dist/src/integrations/sandbox/index.js.map +1 -1
- package/dist/src/integrations/session-store.d.ts +1 -0
- package/dist/src/integrations/session-store.d.ts.map +1 -1
- package/dist/src/integrations/session-store.js +1 -0
- package/dist/src/integrations/session-store.js.map +1 -1
- package/dist/src/integrations/shared-blackboard.d.ts +3 -0
- package/dist/src/integrations/shared-blackboard.d.ts.map +1 -1
- package/dist/src/integrations/shared-blackboard.js +47 -0
- package/dist/src/integrations/shared-blackboard.js.map +1 -1
- 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/smart-decomposer.d.ts +27 -0
- package/dist/src/integrations/smart-decomposer.d.ts.map +1 -1
- package/dist/src/integrations/smart-decomposer.js +414 -30
- package/dist/src/integrations/smart-decomposer.js.map +1 -1
- package/dist/src/integrations/sqlite-store.d.ts +2 -0
- package/dist/src/integrations/sqlite-store.d.ts.map +1 -1
- package/dist/src/integrations/sqlite-store.js +18 -6
- package/dist/src/integrations/sqlite-store.js.map +1 -1
- 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/failure-classifier.d.ts +11 -0
- package/dist/src/integrations/swarm/failure-classifier.d.ts.map +1 -0
- package/dist/src/integrations/swarm/failure-classifier.js +95 -0
- package/dist/src/integrations/swarm/failure-classifier.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.d.ts.map +1 -1
- package/dist/src/integrations/swarm/model-selector.js +2 -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 +8 -0
- package/dist/src/integrations/swarm/swarm-config-loader.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-config-loader.js +102 -0
- package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-event-bridge.d.ts +74 -0
- package/dist/src/integrations/swarm/swarm-event-bridge.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-event-bridge.js +37 -0
- package/dist/src/integrations/swarm/swarm-event-bridge.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts +4 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.js +1 -1
- package/dist/src/integrations/swarm/swarm-events.js.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 +96 -192
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-orchestrator.js +384 -2528
- 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 +4 -1
- package/dist/src/integrations/swarm/swarm-state-store.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-state-store.js +14 -1
- package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts +11 -1
- package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
- package/dist/src/integrations/swarm/task-queue.js +64 -2
- package/dist/src/integrations/swarm/task-queue.js.map +1 -1
- package/dist/src/integrations/swarm/types.d.ts +57 -4
- package/dist/src/integrations/swarm/types.d.ts.map +1 -1
- package/dist/src/integrations/swarm/types.js +9 -0
- package/dist/src/integrations/swarm/types.js.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts +13 -3
- package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.js +66 -13
- package/dist/src/integrations/swarm/worker-pool.js.map +1 -1
- package/dist/src/integrations/task-manager.d.ts +33 -1
- package/dist/src/integrations/task-manager.d.ts.map +1 -1
- package/dist/src/integrations/task-manager.js +78 -4
- package/dist/src/integrations/task-manager.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 +92 -35
- package/dist/src/main.js.map +1 -1
- package/dist/src/modes/repl.d.ts.map +1 -1
- package/dist/src/modes/repl.js +60 -11
- 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 +57 -10
- 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.d.ts.map +1 -1
- package/dist/src/observability/tracer.js +2 -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 +42 -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 +101 -16
- 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 +41 -9
- 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 +83 -13
- package/dist/src/providers/adapters/openrouter.js.map +1 -1
- package/dist/src/providers/circuit-breaker.d.ts +1 -0
- package/dist/src/providers/circuit-breaker.d.ts.map +1 -1
- package/dist/src/providers/circuit-breaker.js.map +1 -1
- package/dist/src/providers/provider.d.ts.map +1 -1
- package/dist/src/providers/provider.js +2 -1
- package/dist/src/providers/provider.js.map +1 -1
- package/dist/src/providers/resilient-provider.d.ts.map +1 -1
- package/dist/src/providers/resilient-provider.js +2 -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 +40 -5
- package/dist/src/session-picker.js.map +1 -1
- package/dist/src/shared/budget-tracker.d.ts +65 -0
- package/dist/src/shared/budget-tracker.d.ts.map +1 -0
- package/dist/src/shared/budget-tracker.js +128 -0
- package/dist/src/shared/budget-tracker.js.map +1 -0
- package/dist/src/shared/context-engine.d.ts +64 -0
- package/dist/src/shared/context-engine.d.ts.map +1 -0
- package/dist/src/shared/context-engine.js +117 -0
- package/dist/src/shared/context-engine.js.map +1 -0
- package/dist/src/shared/index.d.ts +12 -0
- package/dist/src/shared/index.d.ts.map +1 -0
- package/dist/src/shared/index.js +12 -0
- package/dist/src/shared/index.js.map +1 -0
- package/dist/src/shared/persistence.d.ts +57 -0
- package/dist/src/shared/persistence.d.ts.map +1 -0
- package/dist/src/shared/persistence.js +168 -0
- package/dist/src/shared/persistence.js.map +1 -0
- package/dist/src/shared/shared-context-state.d.ts +89 -0
- package/dist/src/shared/shared-context-state.d.ts.map +1 -0
- package/dist/src/shared/shared-context-state.js +175 -0
- package/dist/src/shared/shared-context-state.js.map +1 -0
- package/dist/src/shared/shared-economics-state.d.ts +61 -0
- package/dist/src/shared/shared-economics-state.d.ts.map +1 -0
- package/dist/src/shared/shared-economics-state.js +100 -0
- package/dist/src/shared/shared-economics-state.js.map +1 -0
- package/dist/src/tools/agent.d.ts +1 -1
- package/dist/src/tools/agent.d.ts.map +1 -1
- package/dist/src/tools/bash.d.ts +3 -3
- package/dist/src/tools/bash.d.ts.map +1 -1
- package/dist/src/tools/bash.js +2 -1
- package/dist/src/tools/bash.js.map +1 -1
- package/dist/src/tools/file.d.ts +3 -3
- package/dist/src/tools/file.js +1 -1
- package/dist/src/tools/file.js.map +1 -1
- package/dist/src/tools/permission.d.ts.map +1 -1
- package/dist/src/tools/permission.js +7 -6
- 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/types.d.ts +1 -0
- package/dist/src/tools/types.d.ts.map +1 -1
- package/dist/src/tools/types.js.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 +147 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -1
- package/dist/src/tracing/trace-collector.js +138 -7
- package/dist/src/tracing/trace-collector.js.map +1 -1
- package/dist/src/tracing/types.d.ts +112 -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.d.ts.map +1 -1
- package/dist/src/tricks/failure-evidence.js +2 -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 +16 -3
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +211 -25
- 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.d.ts.map +1 -1
- package/dist/src/tui/components/ErrorBoundary.js +3 -2
- 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.d.ts.map +1 -1
- package/dist/src/tui/event-display.js +36 -62
- package/dist/src/tui/event-display.js.map +1 -1
- package/dist/src/tui/index.d.ts +4 -0
- package/dist/src/tui/index.d.ts.map +1 -1
- package/dist/src/tui/index.js +17 -0
- 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 +170 -3
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +18 -3
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Repository
|
|
3
|
+
*
|
|
4
|
+
* Session CRUD operations, entries, checkpoints, cost tracking,
|
|
5
|
+
* session hierarchy, pending plans, remembered permissions, migration,
|
|
6
|
+
* and session manifest export.
|
|
7
|
+
*
|
|
8
|
+
* Extracted from sqlite-store.ts as part of Phase 3c restructuring.
|
|
9
|
+
*/
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
+
import { logger } from '../utilities/logger.js';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// SESSION CRUD
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Create a new session.
|
|
18
|
+
*/
|
|
19
|
+
export function createSession(deps, name) {
|
|
20
|
+
const id = `session-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
21
|
+
const now = new Date().toISOString();
|
|
22
|
+
deps.stmts.insertSession.run({
|
|
23
|
+
id,
|
|
24
|
+
name: name || null,
|
|
25
|
+
workspacePath: process.cwd(),
|
|
26
|
+
workspaceFingerprint: null,
|
|
27
|
+
createdAt: now,
|
|
28
|
+
lastActiveAt: now,
|
|
29
|
+
messageCount: 0,
|
|
30
|
+
tokenCount: 0,
|
|
31
|
+
});
|
|
32
|
+
deps.setCurrentSessionId(id);
|
|
33
|
+
// Prune old sessions
|
|
34
|
+
pruneOldSessions(deps);
|
|
35
|
+
deps.emit({ type: 'session.created', sessionId: id });
|
|
36
|
+
return id;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Append an entry to the current session.
|
|
40
|
+
*/
|
|
41
|
+
export function appendEntry(deps, entry) {
|
|
42
|
+
if (!deps.getCurrentSessionId()) {
|
|
43
|
+
createSession(deps);
|
|
44
|
+
}
|
|
45
|
+
const sessionId = deps.getCurrentSessionId();
|
|
46
|
+
const timestamp = new Date().toISOString();
|
|
47
|
+
deps.stmts.insertEntry.run({
|
|
48
|
+
sessionId,
|
|
49
|
+
timestamp,
|
|
50
|
+
type: entry.type,
|
|
51
|
+
data: JSON.stringify(entry.data),
|
|
52
|
+
});
|
|
53
|
+
// Update session metadata
|
|
54
|
+
if (entry.type === 'message') {
|
|
55
|
+
const msg = entry.data;
|
|
56
|
+
// Set summary from first user message (for session picker display)
|
|
57
|
+
if (msg.role === 'user' && typeof msg.content === 'string') {
|
|
58
|
+
// Only set if no summary yet
|
|
59
|
+
const session = deps.stmts.getSession.get(sessionId);
|
|
60
|
+
if (session && !session.summary) {
|
|
61
|
+
// Extract first line or first ~50 chars as summary
|
|
62
|
+
const firstLine = msg.content.split('\n')[0].trim();
|
|
63
|
+
const summary = firstLine.length > 60 ? firstLine.slice(0, 57) + '...' : firstLine;
|
|
64
|
+
deps.db.prepare(`UPDATE sessions SET summary = ? WHERE id = ?`).run(summary, sessionId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
deps.db.prepare(`
|
|
68
|
+
UPDATE sessions SET
|
|
69
|
+
last_active_at = ?,
|
|
70
|
+
message_count = message_count + 1
|
|
71
|
+
WHERE id = ?
|
|
72
|
+
`).run(timestamp, sessionId);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
deps.db.prepare(`
|
|
76
|
+
UPDATE sessions SET last_active_at = ? WHERE id = ?
|
|
77
|
+
`).run(timestamp, sessionId);
|
|
78
|
+
}
|
|
79
|
+
deps.emit({ type: 'entry.appended', sessionId, entryType: entry.type });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Append a message to the current session.
|
|
83
|
+
*/
|
|
84
|
+
export function appendMessage(deps, message) {
|
|
85
|
+
appendEntry(deps, { type: 'message', data: message });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Append a tool call to the current session.
|
|
89
|
+
*/
|
|
90
|
+
export function appendToolCall(deps, toolCall) {
|
|
91
|
+
appendEntry(deps, { type: 'tool_call', data: toolCall });
|
|
92
|
+
// Also insert into tool_calls table for fast lookup
|
|
93
|
+
if ('id' in toolCall && toolCall.id) {
|
|
94
|
+
deps.stmts.insertToolCall.run({
|
|
95
|
+
id: toolCall.id,
|
|
96
|
+
sessionId: deps.getCurrentSessionId(),
|
|
97
|
+
name: toolCall.name,
|
|
98
|
+
arguments: JSON.stringify(toolCall.arguments),
|
|
99
|
+
status: 'pending',
|
|
100
|
+
createdAt: new Date().toISOString(),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Append a tool result to the current session.
|
|
106
|
+
*/
|
|
107
|
+
export function appendToolResult(deps, callId, result) {
|
|
108
|
+
appendEntry(deps, { type: 'tool_result', data: { callId, result } });
|
|
109
|
+
// Update tool_calls table
|
|
110
|
+
deps.stmts.updateToolCall.run({
|
|
111
|
+
id: callId,
|
|
112
|
+
status: 'success',
|
|
113
|
+
result: JSON.stringify(result),
|
|
114
|
+
error: null,
|
|
115
|
+
durationMs: null,
|
|
116
|
+
completedAt: new Date().toISOString(),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Append a compaction summary.
|
|
121
|
+
*/
|
|
122
|
+
export function appendCompaction(deps, summary, compactedCount) {
|
|
123
|
+
appendEntry(deps, {
|
|
124
|
+
type: 'compaction',
|
|
125
|
+
data: { summary, compactedCount, compactedAt: new Date().toISOString() },
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Load a session by ID.
|
|
130
|
+
*/
|
|
131
|
+
export function loadSession(deps, sessionId) {
|
|
132
|
+
const rows = deps.stmts.getEntries.all(sessionId);
|
|
133
|
+
const entries = rows.map(row => ({
|
|
134
|
+
timestamp: row.timestamp,
|
|
135
|
+
type: row.type,
|
|
136
|
+
data: JSON.parse(row.data),
|
|
137
|
+
}));
|
|
138
|
+
deps.setCurrentSessionId(sessionId);
|
|
139
|
+
deps.emit({ type: 'session.loaded', sessionId, entryCount: entries.length });
|
|
140
|
+
return entries;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Reconstruct messages from session entries.
|
|
144
|
+
*/
|
|
145
|
+
export function loadSessionMessages(deps, sessionId) {
|
|
146
|
+
const entries = loadSession(deps, sessionId);
|
|
147
|
+
const messages = [];
|
|
148
|
+
for (const entry of entries) {
|
|
149
|
+
if (entry.type === 'message') {
|
|
150
|
+
messages.push(entry.data);
|
|
151
|
+
}
|
|
152
|
+
else if (entry.type === 'compaction') {
|
|
153
|
+
const compaction = entry.data;
|
|
154
|
+
messages.push({
|
|
155
|
+
role: 'system',
|
|
156
|
+
content: `[Previous conversation summary]\n${compaction.summary}`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return messages;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Delete a session.
|
|
164
|
+
*/
|
|
165
|
+
export function deleteSession(deps, sessionId) {
|
|
166
|
+
deps.stmts.deleteSession.run(sessionId);
|
|
167
|
+
if (deps.getCurrentSessionId() === sessionId) {
|
|
168
|
+
deps.setCurrentSessionId(null);
|
|
169
|
+
}
|
|
170
|
+
deps.emit({ type: 'session.deleted', sessionId });
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* List all sessions.
|
|
174
|
+
*/
|
|
175
|
+
export function listSessions(deps) {
|
|
176
|
+
const sessions = deps.stmts.listSessions.all();
|
|
177
|
+
// Check checkpoints for sessions with 0 message count
|
|
178
|
+
for (const session of sessions) {
|
|
179
|
+
if (session.messageCount === 0) {
|
|
180
|
+
const checkpoint = loadLatestCheckpoint(deps, session.id);
|
|
181
|
+
if (checkpoint?.state?.messages && Array.isArray(checkpoint.state.messages)) {
|
|
182
|
+
session.messageCount = checkpoint.state.messages.length;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return sessions;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the most recent session.
|
|
190
|
+
*/
|
|
191
|
+
export function getRecentSession(deps) {
|
|
192
|
+
const sessions = listSessions(deps);
|
|
193
|
+
return sessions[0] || null;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get session metadata by ID.
|
|
197
|
+
*/
|
|
198
|
+
export function getSessionMetadata(deps, sessionId) {
|
|
199
|
+
return deps.stmts.getSession.get(sessionId);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Update session metadata.
|
|
203
|
+
*/
|
|
204
|
+
export function updateSessionMetadata(deps, sessionId, updates) {
|
|
205
|
+
deps.stmts.updateSession.run({
|
|
206
|
+
id: sessionId,
|
|
207
|
+
name: updates.name || null,
|
|
208
|
+
lastActiveAt: null,
|
|
209
|
+
messageCount: null,
|
|
210
|
+
tokenCount: updates.tokenCount || null,
|
|
211
|
+
summary: updates.summary || null,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
// =============================================================================
|
|
215
|
+
// CHECKPOINTS
|
|
216
|
+
// =============================================================================
|
|
217
|
+
/**
|
|
218
|
+
* Save a checkpoint for state restoration.
|
|
219
|
+
*/
|
|
220
|
+
export function saveCheckpoint(deps, state, description) {
|
|
221
|
+
if (!deps.getCurrentSessionId()) {
|
|
222
|
+
createSession(deps);
|
|
223
|
+
}
|
|
224
|
+
const id = `ckpt-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
225
|
+
const sessionId = deps.getCurrentSessionId();
|
|
226
|
+
deps.stmts.insertCheckpoint.run({
|
|
227
|
+
id,
|
|
228
|
+
sessionId,
|
|
229
|
+
stateJson: JSON.stringify(state),
|
|
230
|
+
createdAt: new Date().toISOString(),
|
|
231
|
+
description: description || null,
|
|
232
|
+
});
|
|
233
|
+
// Update message_count in sessions table to match checkpoint
|
|
234
|
+
if (state.messages && Array.isArray(state.messages)) {
|
|
235
|
+
deps.db.prepare(`
|
|
236
|
+
UPDATE sessions SET message_count = ? WHERE id = ?
|
|
237
|
+
`).run(state.messages.length, sessionId);
|
|
238
|
+
}
|
|
239
|
+
return id;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Load the latest checkpoint for a session.
|
|
243
|
+
*/
|
|
244
|
+
export function loadLatestCheckpoint(deps, sessionId) {
|
|
245
|
+
const row = deps.stmts.getLatestCheckpoint.get(sessionId);
|
|
246
|
+
if (!row)
|
|
247
|
+
return null;
|
|
248
|
+
return {
|
|
249
|
+
id: row.id,
|
|
250
|
+
state: JSON.parse(row.stateJson),
|
|
251
|
+
createdAt: row.createdAt,
|
|
252
|
+
description: row.description ?? undefined,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Query entries with SQL (advanced usage).
|
|
257
|
+
*/
|
|
258
|
+
export function query(deps, sql, params = []) {
|
|
259
|
+
return deps.db.prepare(sql).all(...params);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get database statistics.
|
|
263
|
+
*/
|
|
264
|
+
export function getStats(deps) {
|
|
265
|
+
const sessionCount = deps.db.prepare('SELECT COUNT(*) as count FROM sessions').get().count;
|
|
266
|
+
const entryCount = deps.db.prepare('SELECT COUNT(*) as count FROM entries').get().count;
|
|
267
|
+
const toolCallCount = deps.db.prepare('SELECT COUNT(*) as count FROM tool_calls').get().count;
|
|
268
|
+
const checkpointCount = deps.db.prepare('SELECT COUNT(*) as count FROM checkpoints').get().count;
|
|
269
|
+
const dbSizeBytes = deps.db.prepare('SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size()').get().size;
|
|
270
|
+
return { sessionCount, entryCount, toolCallCount, checkpointCount, dbSizeBytes };
|
|
271
|
+
}
|
|
272
|
+
// =============================================================================
|
|
273
|
+
// COST TRACKING
|
|
274
|
+
// =============================================================================
|
|
275
|
+
/**
|
|
276
|
+
* Log API usage for cost tracking.
|
|
277
|
+
* Inserts a usage log entry and updates session totals atomically.
|
|
278
|
+
*/
|
|
279
|
+
export function logUsage(deps, usage) {
|
|
280
|
+
// Use transaction to ensure atomicity of insert + update
|
|
281
|
+
deps.db.transaction(() => {
|
|
282
|
+
// Insert into usage_logs table
|
|
283
|
+
deps.stmts.insertUsageLog.run({
|
|
284
|
+
sessionId: usage.sessionId,
|
|
285
|
+
modelId: usage.modelId,
|
|
286
|
+
promptTokens: usage.promptTokens,
|
|
287
|
+
completionTokens: usage.completionTokens,
|
|
288
|
+
costUsd: usage.costUsd,
|
|
289
|
+
timestamp: usage.timestamp,
|
|
290
|
+
});
|
|
291
|
+
// Update session totals
|
|
292
|
+
deps.stmts.updateSessionCosts.run({
|
|
293
|
+
sessionId: usage.sessionId,
|
|
294
|
+
promptTokens: usage.promptTokens,
|
|
295
|
+
completionTokens: usage.completionTokens,
|
|
296
|
+
costUsd: usage.costUsd,
|
|
297
|
+
});
|
|
298
|
+
})();
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get aggregated usage for a session.
|
|
302
|
+
*/
|
|
303
|
+
export function getSessionUsage(deps, sessionId) {
|
|
304
|
+
const result = deps.stmts.getSessionUsage.get(sessionId);
|
|
305
|
+
return result || { promptTokens: 0, completionTokens: 0, costUsd: 0 };
|
|
306
|
+
}
|
|
307
|
+
// =============================================================================
|
|
308
|
+
// SESSION HIERARCHY
|
|
309
|
+
// =============================================================================
|
|
310
|
+
/**
|
|
311
|
+
* Create a child session linked to a parent.
|
|
312
|
+
*/
|
|
313
|
+
export function createChildSession(deps, parentId, name, type = 'subagent') {
|
|
314
|
+
const id = `session-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
315
|
+
const now = new Date().toISOString();
|
|
316
|
+
deps.stmts.insertChildSession.run({
|
|
317
|
+
id,
|
|
318
|
+
name: name || null,
|
|
319
|
+
workspacePath: process.cwd(),
|
|
320
|
+
workspaceFingerprint: null,
|
|
321
|
+
createdAt: now,
|
|
322
|
+
lastActiveAt: now,
|
|
323
|
+
messageCount: 0,
|
|
324
|
+
tokenCount: 0,
|
|
325
|
+
parentSessionId: parentId,
|
|
326
|
+
sessionType: type,
|
|
327
|
+
});
|
|
328
|
+
deps.emit({ type: 'session.created', sessionId: id });
|
|
329
|
+
return id;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Get all direct child sessions of a parent.
|
|
333
|
+
*/
|
|
334
|
+
export function getChildSessions(deps, parentId) {
|
|
335
|
+
return deps.stmts.getChildSessions.all(parentId);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Get the full session tree starting from a root session.
|
|
339
|
+
* Uses a recursive CTE to traverse the hierarchy.
|
|
340
|
+
*/
|
|
341
|
+
export function getSessionTree(deps, rootId) {
|
|
342
|
+
const rows = deps.stmts.getSessionTree.all(rootId);
|
|
343
|
+
// Remove the depth field from results (used only for ordering)
|
|
344
|
+
return rows.map(({ depth, ...session }) => session);
|
|
345
|
+
}
|
|
346
|
+
// =============================================================================
|
|
347
|
+
// PENDING PLANS
|
|
348
|
+
// =============================================================================
|
|
349
|
+
/**
|
|
350
|
+
* Save a pending plan to the database.
|
|
351
|
+
*/
|
|
352
|
+
export function savePendingPlan(deps, plan, sessionId) {
|
|
353
|
+
if (!deps.features.pendingPlans || !deps.stmts.insertPendingPlan) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const sid = sessionId ?? deps.getCurrentSessionId();
|
|
357
|
+
if (!sid)
|
|
358
|
+
return;
|
|
359
|
+
const now = new Date().toISOString();
|
|
360
|
+
// Check if plan already exists
|
|
361
|
+
const existing = getPendingPlan(deps, sid);
|
|
362
|
+
if (existing && existing.id === plan.id) {
|
|
363
|
+
// Update existing plan
|
|
364
|
+
deps.stmts.updatePendingPlan?.run({
|
|
365
|
+
id: plan.id,
|
|
366
|
+
proposedChanges: JSON.stringify(plan.proposedChanges),
|
|
367
|
+
explorationSummary: plan.explorationSummary || null,
|
|
368
|
+
status: plan.status,
|
|
369
|
+
updatedAt: now,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
// Delete any existing pending plan first
|
|
374
|
+
if (existing) {
|
|
375
|
+
deps.stmts.deletePendingPlan?.run(existing.id);
|
|
376
|
+
}
|
|
377
|
+
// Insert new plan
|
|
378
|
+
deps.stmts.insertPendingPlan.run({
|
|
379
|
+
id: plan.id,
|
|
380
|
+
sessionId: sid,
|
|
381
|
+
task: plan.task,
|
|
382
|
+
proposedChanges: JSON.stringify(plan.proposedChanges),
|
|
383
|
+
explorationSummary: plan.explorationSummary || null,
|
|
384
|
+
status: plan.status,
|
|
385
|
+
createdAt: plan.createdAt,
|
|
386
|
+
updatedAt: now,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Get the pending plan for a session.
|
|
392
|
+
* Returns the most recent pending plan, or null if none.
|
|
393
|
+
*/
|
|
394
|
+
export function getPendingPlan(deps, sessionId) {
|
|
395
|
+
if (!deps.features.pendingPlans || !deps.stmts.getPendingPlan) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
const sid = sessionId ?? deps.getCurrentSessionId();
|
|
399
|
+
if (!sid)
|
|
400
|
+
return null;
|
|
401
|
+
const row = deps.stmts.getPendingPlan.get(sid);
|
|
402
|
+
if (!row)
|
|
403
|
+
return null;
|
|
404
|
+
return {
|
|
405
|
+
id: row.id,
|
|
406
|
+
task: row.task,
|
|
407
|
+
createdAt: row.createdAt,
|
|
408
|
+
updatedAt: row.updatedAt,
|
|
409
|
+
proposedChanges: JSON.parse(row.proposedChanges),
|
|
410
|
+
explorationSummary: row.explorationSummary || '',
|
|
411
|
+
status: row.status,
|
|
412
|
+
sessionId: row.sessionId,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Update the status of a pending plan.
|
|
417
|
+
*/
|
|
418
|
+
export function updatePlanStatus(deps, planId, status) {
|
|
419
|
+
if (!deps.features.pendingPlans || !deps.stmts.updatePendingPlan) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const now = new Date().toISOString();
|
|
423
|
+
deps.db.prepare(`
|
|
424
|
+
UPDATE pending_plans SET status = ?, updated_at = ? WHERE id = ?
|
|
425
|
+
`).run(status, now, planId);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Delete a pending plan.
|
|
429
|
+
*/
|
|
430
|
+
export function deletePendingPlan(deps, planId) {
|
|
431
|
+
if (!deps.features.pendingPlans || !deps.stmts.deletePendingPlan) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
deps.stmts.deletePendingPlan.run(planId);
|
|
435
|
+
}
|
|
436
|
+
// =============================================================================
|
|
437
|
+
// REMEMBERED PERMISSIONS
|
|
438
|
+
// =============================================================================
|
|
439
|
+
/**
|
|
440
|
+
* Remember a permission decision.
|
|
441
|
+
*/
|
|
442
|
+
export function rememberPermission(deps, toolName, decision, pattern) {
|
|
443
|
+
if (!deps.features.rememberedPermissions || !deps.stmts.insertRememberedPermission) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
deps.stmts.insertRememberedPermission.run({
|
|
447
|
+
toolName,
|
|
448
|
+
pattern: pattern ?? null,
|
|
449
|
+
decision,
|
|
450
|
+
createdAt: new Date().toISOString(),
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get a remembered permission decision.
|
|
455
|
+
*/
|
|
456
|
+
export function getRememberedPermission(deps, toolName, pattern) {
|
|
457
|
+
if (!deps.features.rememberedPermissions || !deps.stmts.getRememberedPermission) {
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
const row = deps.stmts.getRememberedPermission.get(toolName, pattern ?? null);
|
|
461
|
+
if (!row)
|
|
462
|
+
return undefined;
|
|
463
|
+
return {
|
|
464
|
+
decision: row.decision,
|
|
465
|
+
pattern: row.pattern ?? undefined,
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* List all remembered permission decisions.
|
|
470
|
+
*/
|
|
471
|
+
export function listRememberedPermissions(deps) {
|
|
472
|
+
if (!deps.features.rememberedPermissions || !deps.stmts.listRememberedPermissions) {
|
|
473
|
+
return [];
|
|
474
|
+
}
|
|
475
|
+
const rows = deps.stmts.listRememberedPermissions.all();
|
|
476
|
+
return rows.map(row => ({
|
|
477
|
+
toolName: row.toolName,
|
|
478
|
+
pattern: row.pattern ?? undefined,
|
|
479
|
+
decision: row.decision,
|
|
480
|
+
createdAt: row.createdAt,
|
|
481
|
+
}));
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Remove a remembered permission decision.
|
|
485
|
+
*/
|
|
486
|
+
export function forgetPermission(deps, toolName, pattern) {
|
|
487
|
+
if (!deps.features.rememberedPermissions || !deps.stmts.deleteRememberedPermission) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
deps.stmts.deleteRememberedPermission.run(toolName, pattern ?? null, pattern ?? null);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Clear all remembered permissions for a tool or all tools.
|
|
494
|
+
*/
|
|
495
|
+
export function clearRememberedPermissions(deps, toolName) {
|
|
496
|
+
if (!deps.features.rememberedPermissions) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (toolName) {
|
|
500
|
+
deps.db.prepare('DELETE FROM remembered_permissions WHERE tool_name = ?').run(toolName);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
deps.db.prepare('DELETE FROM remembered_permissions').run();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Export a complete session manifest for handoff.
|
|
508
|
+
* Contains all information needed for another agent/human to pick up the work.
|
|
509
|
+
*/
|
|
510
|
+
export function exportSessionManifest(deps, callbacks, sessionId) {
|
|
511
|
+
const sid = sessionId ?? deps.getCurrentSessionId();
|
|
512
|
+
if (!sid)
|
|
513
|
+
return undefined;
|
|
514
|
+
const session = getSessionMetadata(deps, sid);
|
|
515
|
+
if (!session)
|
|
516
|
+
return undefined;
|
|
517
|
+
// Collect all session state
|
|
518
|
+
const goals = callbacks.listGoals(sid);
|
|
519
|
+
const activeGoals = goals.filter(g => g.status === 'active');
|
|
520
|
+
const completedGoals = goals.filter(g => g.status === 'completed');
|
|
521
|
+
const junctures = callbacks.listJunctures(sid, 20);
|
|
522
|
+
const workerResults = callbacks.listWorkerResults(sid);
|
|
523
|
+
const entries = loadSession(deps, sid);
|
|
524
|
+
// Count message types from entries
|
|
525
|
+
let messageCount = entries.filter(e => e.type === 'message').length;
|
|
526
|
+
const toolCallCount = entries.filter(e => e.type === 'tool_call').length;
|
|
527
|
+
const compactionCount = entries.filter(e => e.type === 'compaction').length;
|
|
528
|
+
// If no messages in entries, check the latest checkpoint
|
|
529
|
+
if (messageCount === 0) {
|
|
530
|
+
const checkpoint = loadLatestCheckpoint(deps, sid);
|
|
531
|
+
if (checkpoint?.state?.messages && Array.isArray(checkpoint.state.messages)) {
|
|
532
|
+
messageCount = checkpoint.state.messages.length;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
version: '1.0',
|
|
537
|
+
exportedAt: new Date().toISOString(),
|
|
538
|
+
session: {
|
|
539
|
+
id: session.id,
|
|
540
|
+
name: session.name,
|
|
541
|
+
createdAt: session.createdAt,
|
|
542
|
+
lastActiveAt: session.lastActiveAt,
|
|
543
|
+
summary: session.summary,
|
|
544
|
+
},
|
|
545
|
+
state: {
|
|
546
|
+
messageCount,
|
|
547
|
+
toolCallCount,
|
|
548
|
+
compactionCount,
|
|
549
|
+
tokenCount: session.tokenCount,
|
|
550
|
+
costUsd: session.costUsd,
|
|
551
|
+
},
|
|
552
|
+
goals: {
|
|
553
|
+
active: activeGoals.map(g => ({
|
|
554
|
+
id: g.id,
|
|
555
|
+
text: g.goalText,
|
|
556
|
+
priority: g.priority,
|
|
557
|
+
progress: g.progressTotal
|
|
558
|
+
? `${g.progressCurrent}/${g.progressTotal}`
|
|
559
|
+
: undefined,
|
|
560
|
+
})),
|
|
561
|
+
completed: completedGoals.map(g => ({
|
|
562
|
+
id: g.id,
|
|
563
|
+
text: g.goalText,
|
|
564
|
+
completedAt: g.completedAt,
|
|
565
|
+
})),
|
|
566
|
+
},
|
|
567
|
+
keyMoments: junctures.map(j => ({
|
|
568
|
+
type: j.type,
|
|
569
|
+
description: j.description,
|
|
570
|
+
outcome: j.outcome,
|
|
571
|
+
createdAt: j.createdAt,
|
|
572
|
+
})),
|
|
573
|
+
workerResults: workerResults.map(r => ({
|
|
574
|
+
id: r.id,
|
|
575
|
+
task: r.taskDescription,
|
|
576
|
+
status: r.status,
|
|
577
|
+
summary: r.summary,
|
|
578
|
+
model: r.modelUsed,
|
|
579
|
+
})),
|
|
580
|
+
resumption: {
|
|
581
|
+
currentSessionId: sid,
|
|
582
|
+
canResume: true,
|
|
583
|
+
hint: 'Load this session with /load ' + sid.slice(-8),
|
|
584
|
+
},
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Export session as human-readable markdown.
|
|
589
|
+
*/
|
|
590
|
+
export function exportSessionMarkdown(deps, callbacks, sessionId) {
|
|
591
|
+
const manifest = exportSessionManifest(deps, callbacks, sessionId);
|
|
592
|
+
if (!manifest)
|
|
593
|
+
return '# Session Not Found\n';
|
|
594
|
+
const lines = [];
|
|
595
|
+
// Header
|
|
596
|
+
lines.push(`# Session Handoff: ${manifest.session.name || manifest.session.id}`);
|
|
597
|
+
lines.push('');
|
|
598
|
+
lines.push(`> Exported: ${manifest.exportedAt}`);
|
|
599
|
+
lines.push(`> Session ID: \`${manifest.session.id}\``);
|
|
600
|
+
lines.push('');
|
|
601
|
+
// Summary
|
|
602
|
+
if (manifest.session.summary) {
|
|
603
|
+
lines.push('## Summary');
|
|
604
|
+
lines.push('');
|
|
605
|
+
lines.push(manifest.session.summary);
|
|
606
|
+
lines.push('');
|
|
607
|
+
}
|
|
608
|
+
// State
|
|
609
|
+
lines.push('## Session State');
|
|
610
|
+
lines.push('');
|
|
611
|
+
lines.push(`- Messages: ${manifest.state.messageCount}`);
|
|
612
|
+
lines.push(`- Tool Calls: ${manifest.state.toolCallCount}`);
|
|
613
|
+
lines.push(`- Compactions: ${manifest.state.compactionCount}`);
|
|
614
|
+
lines.push(`- Tokens: ${manifest.state.tokenCount?.toLocaleString() ?? 'N/A'}`);
|
|
615
|
+
if (manifest.state.costUsd) {
|
|
616
|
+
lines.push(`- Cost: $${manifest.state.costUsd.toFixed(4)}`);
|
|
617
|
+
}
|
|
618
|
+
lines.push('');
|
|
619
|
+
// Active Goals
|
|
620
|
+
if (manifest.goals.active.length > 0) {
|
|
621
|
+
lines.push('## Active Goals');
|
|
622
|
+
lines.push('');
|
|
623
|
+
for (const goal of manifest.goals.active) {
|
|
624
|
+
const priority = goal.priority === 1 ? ' **[HIGH]**' : goal.priority === 3 ? ' [low]' : '';
|
|
625
|
+
const progress = goal.progress ? ` (${goal.progress})` : '';
|
|
626
|
+
lines.push(`- [ ] ${goal.text}${progress}${priority}`);
|
|
627
|
+
}
|
|
628
|
+
lines.push('');
|
|
629
|
+
}
|
|
630
|
+
// Completed Goals
|
|
631
|
+
if (manifest.goals.completed.length > 0) {
|
|
632
|
+
lines.push('## Completed Goals');
|
|
633
|
+
lines.push('');
|
|
634
|
+
for (const goal of manifest.goals.completed) {
|
|
635
|
+
lines.push(`- [x] ${goal.text}`);
|
|
636
|
+
}
|
|
637
|
+
lines.push('');
|
|
638
|
+
}
|
|
639
|
+
// Key Moments
|
|
640
|
+
if (manifest.keyMoments.length > 0) {
|
|
641
|
+
lines.push('## Key Moments');
|
|
642
|
+
lines.push('');
|
|
643
|
+
for (const moment of manifest.keyMoments) {
|
|
644
|
+
const icon = moment.type === 'failure' ? '\u274C' :
|
|
645
|
+
moment.type === 'breakthrough' ? '\u2B50' :
|
|
646
|
+
moment.type === 'decision' ? '\u2192' : '\u21BB';
|
|
647
|
+
lines.push(`### ${icon} ${moment.type.charAt(0).toUpperCase() + moment.type.slice(1)}`);
|
|
648
|
+
lines.push('');
|
|
649
|
+
lines.push(moment.description);
|
|
650
|
+
if (moment.outcome) {
|
|
651
|
+
lines.push('');
|
|
652
|
+
lines.push(`**Outcome:** ${moment.outcome}`);
|
|
653
|
+
}
|
|
654
|
+
lines.push('');
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
// Worker Results
|
|
658
|
+
if (manifest.workerResults.length > 0) {
|
|
659
|
+
lines.push('## Worker Results');
|
|
660
|
+
lines.push('');
|
|
661
|
+
for (const result of manifest.workerResults) {
|
|
662
|
+
const status = result.status === 'success' ? '\u2705' :
|
|
663
|
+
result.status === 'error' ? '\u274C' : '\u23F3';
|
|
664
|
+
lines.push(`- ${status} **${result.task}**`);
|
|
665
|
+
if (result.summary) {
|
|
666
|
+
lines.push(` - ${result.summary}`);
|
|
667
|
+
}
|
|
668
|
+
if (result.model) {
|
|
669
|
+
lines.push(` - Model: ${result.model}`);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
lines.push('');
|
|
673
|
+
}
|
|
674
|
+
// Resumption
|
|
675
|
+
lines.push('## How to Resume');
|
|
676
|
+
lines.push('');
|
|
677
|
+
lines.push('```bash');
|
|
678
|
+
lines.push(`attocode --load ${manifest.resumption.currentSessionId}`);
|
|
679
|
+
lines.push('```');
|
|
680
|
+
lines.push('');
|
|
681
|
+
lines.push('Or within attocode:');
|
|
682
|
+
lines.push('```');
|
|
683
|
+
lines.push(manifest.resumption.hint);
|
|
684
|
+
lines.push('```');
|
|
685
|
+
return lines.join('\n');
|
|
686
|
+
}
|
|
687
|
+
// =============================================================================
|
|
688
|
+
// MIGRATION
|
|
689
|
+
// =============================================================================
|
|
690
|
+
/**
|
|
691
|
+
* Migrate sessions from JSONL format to SQLite.
|
|
692
|
+
*/
|
|
693
|
+
export async function migrateFromJSONL(deps, jsonlDir) {
|
|
694
|
+
const indexPath = join(jsonlDir, 'index.json');
|
|
695
|
+
let migrated = 0;
|
|
696
|
+
let failed = 0;
|
|
697
|
+
if (!existsSync(indexPath)) {
|
|
698
|
+
return { migrated: 0, failed: 0 };
|
|
699
|
+
}
|
|
700
|
+
try {
|
|
701
|
+
const indexContent = readFileSync(indexPath, 'utf-8');
|
|
702
|
+
const index = JSON.parse(indexContent);
|
|
703
|
+
for (const meta of index.sessions) {
|
|
704
|
+
try {
|
|
705
|
+
// Check if already migrated
|
|
706
|
+
const existing = getSessionMetadata(deps, meta.id);
|
|
707
|
+
if (existing) {
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
// Insert session metadata
|
|
711
|
+
deps.stmts.insertSession.run({
|
|
712
|
+
id: meta.id,
|
|
713
|
+
name: meta.name || null,
|
|
714
|
+
workspacePath: meta.workspacePath || null,
|
|
715
|
+
workspaceFingerprint: meta.workspaceFingerprint || null,
|
|
716
|
+
createdAt: meta.createdAt,
|
|
717
|
+
lastActiveAt: meta.lastActiveAt,
|
|
718
|
+
messageCount: meta.messageCount,
|
|
719
|
+
tokenCount: meta.tokenCount,
|
|
720
|
+
});
|
|
721
|
+
// Load and migrate entries
|
|
722
|
+
const sessionPath = join(jsonlDir, `${meta.id}.jsonl`);
|
|
723
|
+
if (existsSync(sessionPath)) {
|
|
724
|
+
const content = readFileSync(sessionPath, 'utf-8');
|
|
725
|
+
for (const line of content.split('\n')) {
|
|
726
|
+
if (line.trim()) {
|
|
727
|
+
try {
|
|
728
|
+
const entry = JSON.parse(line);
|
|
729
|
+
deps.stmts.insertEntry.run({
|
|
730
|
+
sessionId: meta.id,
|
|
731
|
+
timestamp: entry.timestamp,
|
|
732
|
+
type: entry.type,
|
|
733
|
+
data: JSON.stringify(entry.data),
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
catch {
|
|
737
|
+
// Skip corrupted lines
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
migrated++;
|
|
743
|
+
}
|
|
744
|
+
catch (err) {
|
|
745
|
+
logger.error(`Failed to migrate session ${meta.id}:`, { error: err });
|
|
746
|
+
failed++;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
catch (err) {
|
|
751
|
+
logger.error('Failed to read JSONL index:', { error: err });
|
|
752
|
+
}
|
|
753
|
+
return { migrated, failed };
|
|
754
|
+
}
|
|
755
|
+
// =============================================================================
|
|
756
|
+
// LIFECYCLE HELPERS
|
|
757
|
+
// =============================================================================
|
|
758
|
+
/**
|
|
759
|
+
* Prune old sessions if over limit.
|
|
760
|
+
*/
|
|
761
|
+
export function pruneOldSessions(deps) {
|
|
762
|
+
const sessions = listSessions(deps);
|
|
763
|
+
if (sessions.length > deps.config.maxSessions) {
|
|
764
|
+
const toDelete = sessions.slice(deps.config.maxSessions);
|
|
765
|
+
for (const session of toDelete) {
|
|
766
|
+
deps.stmts.deleteSession.run(session.id);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
//# sourceMappingURL=session-repository.js.map
|