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,538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Change Tracker
|
|
3
|
+
*
|
|
4
|
+
* Tracks file changes for undo capability in agent sessions.
|
|
5
|
+
* Provides before/after content capture, diff generation, and undo functionality.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import Database from 'better-sqlite3';
|
|
10
|
+
* import { FileChangeTracker } from './file-change-tracker.js';
|
|
11
|
+
*
|
|
12
|
+
* const db = new Database('sessions.db');
|
|
13
|
+
* const tracker = new FileChangeTracker(db, 'session-123');
|
|
14
|
+
*
|
|
15
|
+
* // Record a file change
|
|
16
|
+
* const changeId = await tracker.recordChange({
|
|
17
|
+
* filePath: '/path/to/file.ts',
|
|
18
|
+
* operation: 'edit',
|
|
19
|
+
* contentBefore: 'old content',
|
|
20
|
+
* contentAfter: 'new content',
|
|
21
|
+
* turnNumber: 1,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Undo the change
|
|
25
|
+
* const result = await tracker.undoChange(changeId);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
import { writeFile, unlink } from 'node:fs/promises';
|
|
29
|
+
import { existsSync } from 'node:fs';
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// DIFF UTILITIES
|
|
32
|
+
// =============================================================================
|
|
33
|
+
/**
|
|
34
|
+
* Generate a simple unified diff between two strings.
|
|
35
|
+
* This is a basic implementation - for production, consider using a proper diff library.
|
|
36
|
+
*/
|
|
37
|
+
function generateUnifiedDiff(before, after, filePath) {
|
|
38
|
+
const beforeLines = before.split('\n');
|
|
39
|
+
const afterLines = after.split('\n');
|
|
40
|
+
const header = [
|
|
41
|
+
`--- a/${filePath}`,
|
|
42
|
+
`+++ b/${filePath}`,
|
|
43
|
+
];
|
|
44
|
+
// Simple line-by-line diff (not optimal but functional)
|
|
45
|
+
const hunks = [];
|
|
46
|
+
let i = 0;
|
|
47
|
+
let j = 0;
|
|
48
|
+
while (i < beforeLines.length || j < afterLines.length) {
|
|
49
|
+
// Find next difference
|
|
50
|
+
const startI = i;
|
|
51
|
+
const startJ = j;
|
|
52
|
+
// Skip matching lines
|
|
53
|
+
while (i < beforeLines.length && j < afterLines.length && beforeLines[i] === afterLines[j]) {
|
|
54
|
+
i++;
|
|
55
|
+
j++;
|
|
56
|
+
}
|
|
57
|
+
// If we've found a difference or reached the end
|
|
58
|
+
if (i < beforeLines.length || j < afterLines.length) {
|
|
59
|
+
// Determine the hunk boundaries
|
|
60
|
+
const contextBefore = Math.max(0, i - 3);
|
|
61
|
+
const hunkStart = contextBefore + 1;
|
|
62
|
+
// Find the extent of the difference
|
|
63
|
+
const diffStartI = i;
|
|
64
|
+
const diffStartJ = j;
|
|
65
|
+
// Advance through differing lines
|
|
66
|
+
while (i < beforeLines.length || j < afterLines.length) {
|
|
67
|
+
if (i < beforeLines.length && j < afterLines.length && beforeLines[i] === afterLines[j]) {
|
|
68
|
+
// Found a match - check if it's the end of the diff section
|
|
69
|
+
let matchCount = 0;
|
|
70
|
+
let tempI = i;
|
|
71
|
+
let tempJ = j;
|
|
72
|
+
while (tempI < beforeLines.length && tempJ < afterLines.length &&
|
|
73
|
+
beforeLines[tempI] === afterLines[tempJ] && matchCount < 3) {
|
|
74
|
+
matchCount++;
|
|
75
|
+
tempI++;
|
|
76
|
+
tempJ++;
|
|
77
|
+
}
|
|
78
|
+
if (matchCount >= 3) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (i < beforeLines.length)
|
|
83
|
+
i++;
|
|
84
|
+
if (j < afterLines.length)
|
|
85
|
+
j++;
|
|
86
|
+
}
|
|
87
|
+
// Build the hunk
|
|
88
|
+
const hunkLines = [];
|
|
89
|
+
const beforeCount = i - contextBefore;
|
|
90
|
+
const afterCount = j - (startJ + (contextBefore - startI));
|
|
91
|
+
hunkLines.push(`@@ -${hunkStart},${beforeCount} +${hunkStart},${afterCount} @@`);
|
|
92
|
+
// Add context before
|
|
93
|
+
for (let k = contextBefore; k < diffStartI; k++) {
|
|
94
|
+
hunkLines.push(` ${beforeLines[k]}`);
|
|
95
|
+
}
|
|
96
|
+
// Add removed lines
|
|
97
|
+
for (let k = diffStartI; k < i; k++) {
|
|
98
|
+
if (k < beforeLines.length) {
|
|
99
|
+
hunkLines.push(`-${beforeLines[k]}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Add added lines
|
|
103
|
+
for (let k = diffStartJ; k < j; k++) {
|
|
104
|
+
if (k < afterLines.length) {
|
|
105
|
+
hunkLines.push(`+${afterLines[k]}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
hunks.push(hunkLines.join('\n'));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return [...header, ...hunks].join('\n');
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Apply a unified diff to restore original content.
|
|
115
|
+
* Returns the original content before the diff was applied.
|
|
116
|
+
*/
|
|
117
|
+
function applyReverseDiff(currentContent, diff) {
|
|
118
|
+
// Parse diff hunks
|
|
119
|
+
const lines = diff.split('\n');
|
|
120
|
+
const resultLines = currentContent.split('\n');
|
|
121
|
+
let lineIndex = 0;
|
|
122
|
+
let i = 0;
|
|
123
|
+
// Skip header lines
|
|
124
|
+
while (i < lines.length && !lines[i].startsWith('@@')) {
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
while (i < lines.length) {
|
|
128
|
+
const line = lines[i];
|
|
129
|
+
if (line.startsWith('@@')) {
|
|
130
|
+
// Parse hunk header: @@ -start,count +start,count @@
|
|
131
|
+
const match = line.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);
|
|
132
|
+
if (match) {
|
|
133
|
+
lineIndex = parseInt(match[2], 10) - 1;
|
|
134
|
+
}
|
|
135
|
+
i++;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (line.startsWith('+')) {
|
|
139
|
+
// This was an addition - remove it to reverse
|
|
140
|
+
if (lineIndex < resultLines.length && resultLines[lineIndex] === line.slice(1)) {
|
|
141
|
+
resultLines.splice(lineIndex, 1);
|
|
142
|
+
}
|
|
143
|
+
i++;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (line.startsWith('-')) {
|
|
147
|
+
// This was a removal - add it back to reverse
|
|
148
|
+
resultLines.splice(lineIndex, 0, line.slice(1));
|
|
149
|
+
lineIndex++;
|
|
150
|
+
i++;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (line.startsWith(' ')) {
|
|
154
|
+
// Context line
|
|
155
|
+
lineIndex++;
|
|
156
|
+
i++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
i++;
|
|
160
|
+
}
|
|
161
|
+
return resultLines.join('\n');
|
|
162
|
+
}
|
|
163
|
+
// =============================================================================
|
|
164
|
+
// FILE CHANGE TRACKER
|
|
165
|
+
// =============================================================================
|
|
166
|
+
/**
|
|
167
|
+
* Tracks file changes for undo capability.
|
|
168
|
+
*/
|
|
169
|
+
export class FileChangeTracker {
|
|
170
|
+
db;
|
|
171
|
+
sessionId;
|
|
172
|
+
config;
|
|
173
|
+
stmts;
|
|
174
|
+
constructor(db, sessionId, config) {
|
|
175
|
+
this.db = db;
|
|
176
|
+
this.sessionId = sessionId;
|
|
177
|
+
this.config = {
|
|
178
|
+
enabled: config?.enabled ?? true,
|
|
179
|
+
maxFullContentBytes: config?.maxFullContentBytes ?? 50 * 1024, // 50KB
|
|
180
|
+
};
|
|
181
|
+
this.prepareStatements();
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Prepare SQL statements for reuse.
|
|
185
|
+
*/
|
|
186
|
+
prepareStatements() {
|
|
187
|
+
this.stmts = {
|
|
188
|
+
insertChange: this.db.prepare(`
|
|
189
|
+
INSERT INTO file_changes (
|
|
190
|
+
session_id, entry_id, tool_call_id, turn_number, file_path,
|
|
191
|
+
operation, content_before, content_after, diff_unified,
|
|
192
|
+
storage_mode, bytes_before, bytes_after, is_undone,
|
|
193
|
+
undo_change_id, created_at
|
|
194
|
+
)
|
|
195
|
+
VALUES (
|
|
196
|
+
@sessionId, @entryId, @toolCallId, @turnNumber, @filePath,
|
|
197
|
+
@operation, @contentBefore, @contentAfter, @diffUnified,
|
|
198
|
+
@storageMode, @bytesBefore, @bytesAfter, @isUndone,
|
|
199
|
+
@undoChangeId, @createdAt
|
|
200
|
+
)
|
|
201
|
+
`),
|
|
202
|
+
getChange: this.db.prepare(`
|
|
203
|
+
SELECT
|
|
204
|
+
id, session_id as sessionId, turn_number as turnNumber,
|
|
205
|
+
file_path as filePath, operation, content_before as contentBefore,
|
|
206
|
+
content_after as contentAfter, diff_unified as diffUnified,
|
|
207
|
+
storage_mode as storageMode, bytes_before as bytesBefore,
|
|
208
|
+
bytes_after as bytesAfter, is_undone as isUndone,
|
|
209
|
+
undo_change_id as undoChangeId, tool_call_id as toolCallId,
|
|
210
|
+
created_at as createdAt
|
|
211
|
+
FROM file_changes
|
|
212
|
+
WHERE id = ? AND session_id = ?
|
|
213
|
+
`),
|
|
214
|
+
getChanges: this.db.prepare(`
|
|
215
|
+
SELECT
|
|
216
|
+
id, session_id as sessionId, turn_number as turnNumber,
|
|
217
|
+
file_path as filePath, operation, content_before as contentBefore,
|
|
218
|
+
content_after as contentAfter, diff_unified as diffUnified,
|
|
219
|
+
storage_mode as storageMode, bytes_before as bytesBefore,
|
|
220
|
+
bytes_after as bytesAfter, is_undone as isUndone,
|
|
221
|
+
undo_change_id as undoChangeId, tool_call_id as toolCallId,
|
|
222
|
+
created_at as createdAt
|
|
223
|
+
FROM file_changes
|
|
224
|
+
WHERE session_id = ?
|
|
225
|
+
ORDER BY id ASC
|
|
226
|
+
`),
|
|
227
|
+
getFileChanges: this.db.prepare(`
|
|
228
|
+
SELECT
|
|
229
|
+
id, session_id as sessionId, turn_number as turnNumber,
|
|
230
|
+
file_path as filePath, operation, content_before as contentBefore,
|
|
231
|
+
content_after as contentAfter, diff_unified as diffUnified,
|
|
232
|
+
storage_mode as storageMode, bytes_before as bytesBefore,
|
|
233
|
+
bytes_after as bytesAfter, is_undone as isUndone,
|
|
234
|
+
undo_change_id as undoChangeId, tool_call_id as toolCallId,
|
|
235
|
+
created_at as createdAt
|
|
236
|
+
FROM file_changes
|
|
237
|
+
WHERE session_id = ? AND file_path = ?
|
|
238
|
+
ORDER BY id ASC
|
|
239
|
+
`),
|
|
240
|
+
getLastFileChange: this.db.prepare(`
|
|
241
|
+
SELECT
|
|
242
|
+
id, session_id as sessionId, turn_number as turnNumber,
|
|
243
|
+
file_path as filePath, operation, content_before as contentBefore,
|
|
244
|
+
content_after as contentAfter, diff_unified as diffUnified,
|
|
245
|
+
storage_mode as storageMode, bytes_before as bytesBefore,
|
|
246
|
+
bytes_after as bytesAfter, is_undone as isUndone,
|
|
247
|
+
undo_change_id as undoChangeId, tool_call_id as toolCallId,
|
|
248
|
+
created_at as createdAt
|
|
249
|
+
FROM file_changes
|
|
250
|
+
WHERE session_id = ? AND file_path = ? AND is_undone = 0
|
|
251
|
+
ORDER BY id DESC
|
|
252
|
+
LIMIT 1
|
|
253
|
+
`),
|
|
254
|
+
getTurnChanges: this.db.prepare(`
|
|
255
|
+
SELECT
|
|
256
|
+
id, session_id as sessionId, turn_number as turnNumber,
|
|
257
|
+
file_path as filePath, operation, content_before as contentBefore,
|
|
258
|
+
content_after as contentAfter, diff_unified as diffUnified,
|
|
259
|
+
storage_mode as storageMode, bytes_before as bytesBefore,
|
|
260
|
+
bytes_after as bytesAfter, is_undone as isUndone,
|
|
261
|
+
undo_change_id as undoChangeId, tool_call_id as toolCallId,
|
|
262
|
+
created_at as createdAt
|
|
263
|
+
FROM file_changes
|
|
264
|
+
WHERE session_id = ? AND turn_number = ? AND is_undone = 0
|
|
265
|
+
ORDER BY id DESC
|
|
266
|
+
`),
|
|
267
|
+
markUndone: this.db.prepare(`
|
|
268
|
+
UPDATE file_changes
|
|
269
|
+
SET is_undone = 1, undo_change_id = ?
|
|
270
|
+
WHERE id = ? AND session_id = ? AND is_undone = 0
|
|
271
|
+
`),
|
|
272
|
+
clearUndone: this.db.prepare(`
|
|
273
|
+
UPDATE file_changes
|
|
274
|
+
SET is_undone = 0, undo_change_id = NULL
|
|
275
|
+
WHERE id = ? AND session_id = ?
|
|
276
|
+
`),
|
|
277
|
+
getSessionSummary: this.db.prepare(`
|
|
278
|
+
SELECT
|
|
279
|
+
COUNT(*) as totalChanges,
|
|
280
|
+
SUM(CASE WHEN is_undone = 0 THEN 1 ELSE 0 END) as activeChanges,
|
|
281
|
+
SUM(CASE WHEN is_undone = 1 THEN 1 ELSE 0 END) as undoneChanges,
|
|
282
|
+
SUM(CASE WHEN operation = 'create' AND is_undone = 0 THEN 1 ELSE 0 END) as createCount,
|
|
283
|
+
SUM(CASE WHEN operation = 'write' AND is_undone = 0 THEN 1 ELSE 0 END) as writeCount,
|
|
284
|
+
SUM(CASE WHEN operation = 'edit' AND is_undone = 0 THEN 1 ELSE 0 END) as editCount,
|
|
285
|
+
SUM(CASE WHEN operation = 'delete' AND is_undone = 0 THEN 1 ELSE 0 END) as deleteCount
|
|
286
|
+
FROM file_changes
|
|
287
|
+
WHERE session_id = ?
|
|
288
|
+
`),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Record a file change.
|
|
293
|
+
*/
|
|
294
|
+
async recordChange(params) {
|
|
295
|
+
if (!this.config.enabled) {
|
|
296
|
+
return -1;
|
|
297
|
+
}
|
|
298
|
+
const now = new Date().toISOString();
|
|
299
|
+
const contentBefore = params.contentBefore ?? null;
|
|
300
|
+
const contentAfter = params.contentAfter ?? null;
|
|
301
|
+
const bytesBefore = contentBefore ? Buffer.byteLength(contentBefore, 'utf-8') : 0;
|
|
302
|
+
const bytesAfter = contentAfter ? Buffer.byteLength(contentAfter, 'utf-8') : 0;
|
|
303
|
+
// Determine storage mode
|
|
304
|
+
let storageMode = 'full';
|
|
305
|
+
let diffUnified = null;
|
|
306
|
+
let storedBefore = contentBefore;
|
|
307
|
+
let storedAfter = contentAfter;
|
|
308
|
+
// Use diff mode for large files
|
|
309
|
+
const totalBytes = bytesBefore + bytesAfter;
|
|
310
|
+
if (totalBytes > this.config.maxFullContentBytes && contentBefore && contentAfter) {
|
|
311
|
+
storageMode = 'diff';
|
|
312
|
+
diffUnified = generateUnifiedDiff(contentBefore, contentAfter, params.filePath);
|
|
313
|
+
// In diff mode, we only store the after content (current state) and the diff
|
|
314
|
+
// to reconstruct the before content
|
|
315
|
+
storedBefore = null;
|
|
316
|
+
storedAfter = contentAfter;
|
|
317
|
+
}
|
|
318
|
+
const result = this.stmts.insertChange.run({
|
|
319
|
+
sessionId: this.sessionId,
|
|
320
|
+
entryId: null,
|
|
321
|
+
toolCallId: params.toolCallId ?? null,
|
|
322
|
+
turnNumber: params.turnNumber,
|
|
323
|
+
filePath: params.filePath,
|
|
324
|
+
operation: params.operation,
|
|
325
|
+
contentBefore: storedBefore,
|
|
326
|
+
contentAfter: storedAfter,
|
|
327
|
+
diffUnified,
|
|
328
|
+
storageMode,
|
|
329
|
+
bytesBefore,
|
|
330
|
+
bytesAfter,
|
|
331
|
+
isUndone: 0,
|
|
332
|
+
undoChangeId: null,
|
|
333
|
+
createdAt: now,
|
|
334
|
+
});
|
|
335
|
+
return result.lastInsertRowid;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Undo a specific change by ID.
|
|
339
|
+
* Uses a transaction with optimistic locking to prevent TOCTOU race conditions.
|
|
340
|
+
*/
|
|
341
|
+
async undoChange(changeId) {
|
|
342
|
+
// Use database transaction with optimistic locking to prevent race condition
|
|
343
|
+
// The key insight: we mark as undone BEFORE file operations, inside a transaction
|
|
344
|
+
// If two calls race, only one will succeed in updating is_undone from 0 to 1
|
|
345
|
+
const txResult = this.db.transaction(() => {
|
|
346
|
+
const row = this.stmts.getChange.get(changeId, this.sessionId);
|
|
347
|
+
if (!row) {
|
|
348
|
+
return { success: false, error: 'Change not found' };
|
|
349
|
+
}
|
|
350
|
+
if (row.isUndone) {
|
|
351
|
+
return { success: false, error: 'Change already undone' };
|
|
352
|
+
}
|
|
353
|
+
// Optimistic lock: mark as undone BEFORE file operations
|
|
354
|
+
// The WHERE clause includes is_undone = 0, so only one concurrent call succeeds
|
|
355
|
+
const result = this.stmts.markUndone.run(null, changeId, this.sessionId);
|
|
356
|
+
if (result.changes === 0) {
|
|
357
|
+
return { success: false, error: 'Concurrent modification detected' };
|
|
358
|
+
}
|
|
359
|
+
return { success: true, row };
|
|
360
|
+
})();
|
|
361
|
+
if (!txResult.success || !txResult.row) {
|
|
362
|
+
return {
|
|
363
|
+
success: false,
|
|
364
|
+
filePath: '',
|
|
365
|
+
message: txResult.error || 'Transaction failed',
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
const row = txResult.row;
|
|
369
|
+
const filePath = row.filePath;
|
|
370
|
+
try {
|
|
371
|
+
// Determine what content to restore
|
|
372
|
+
let contentToRestore = null;
|
|
373
|
+
if (row.storageMode === 'full') {
|
|
374
|
+
contentToRestore = row.contentBefore;
|
|
375
|
+
}
|
|
376
|
+
else if (row.storageMode === 'diff' && row.diffUnified && row.contentAfter) {
|
|
377
|
+
// Reconstruct the before content from the diff
|
|
378
|
+
contentToRestore = applyReverseDiff(row.contentAfter, row.diffUnified);
|
|
379
|
+
}
|
|
380
|
+
// Perform the undo based on operation type
|
|
381
|
+
switch (row.operation) {
|
|
382
|
+
case 'create':
|
|
383
|
+
// Undo create = delete the file
|
|
384
|
+
if (existsSync(filePath)) {
|
|
385
|
+
await unlink(filePath);
|
|
386
|
+
}
|
|
387
|
+
break;
|
|
388
|
+
case 'write':
|
|
389
|
+
case 'edit':
|
|
390
|
+
// Undo write/edit = restore previous content
|
|
391
|
+
if (contentToRestore !== null) {
|
|
392
|
+
await writeFile(filePath, contentToRestore, 'utf-8');
|
|
393
|
+
}
|
|
394
|
+
else if (row.operation === 'write') {
|
|
395
|
+
// If no previous content for a write, delete the file
|
|
396
|
+
if (existsSync(filePath)) {
|
|
397
|
+
await unlink(filePath);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
break;
|
|
401
|
+
case 'delete':
|
|
402
|
+
// Undo delete = recreate the file with original content
|
|
403
|
+
if (contentToRestore !== null) {
|
|
404
|
+
await writeFile(filePath, contentToRestore, 'utf-8');
|
|
405
|
+
}
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
success: true,
|
|
410
|
+
filePath,
|
|
411
|
+
message: `Successfully undid ${row.operation} on ${filePath}`,
|
|
412
|
+
changeId,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
// File operations failed - rollback the database change
|
|
417
|
+
this.stmts.clearUndone.run(changeId, this.sessionId);
|
|
418
|
+
return {
|
|
419
|
+
success: false,
|
|
420
|
+
filePath,
|
|
421
|
+
message: `Failed to undo change: ${error instanceof Error ? error.message : String(error)}`,
|
|
422
|
+
changeId,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Undo the last change to a specific file.
|
|
428
|
+
*/
|
|
429
|
+
async undoLastChange(filePath) {
|
|
430
|
+
const row = this.stmts.getLastFileChange.get(this.sessionId, filePath);
|
|
431
|
+
if (!row) {
|
|
432
|
+
return {
|
|
433
|
+
success: false,
|
|
434
|
+
filePath,
|
|
435
|
+
message: `No undoable changes found for ${filePath}`,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
return this.undoChange(row.id);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Undo all changes in a turn.
|
|
442
|
+
*/
|
|
443
|
+
async undoTurn(turnNumber) {
|
|
444
|
+
const rows = this.stmts.getTurnChanges.all(this.sessionId, turnNumber);
|
|
445
|
+
const results = [];
|
|
446
|
+
// Undo in reverse order (last change first)
|
|
447
|
+
for (const row of rows) {
|
|
448
|
+
const result = await this.undoChange(row.id);
|
|
449
|
+
results.push(result);
|
|
450
|
+
}
|
|
451
|
+
return results;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get all changes for a file.
|
|
455
|
+
*/
|
|
456
|
+
getFileHistory(filePath) {
|
|
457
|
+
const rows = this.stmts.getFileChanges.all(this.sessionId, filePath);
|
|
458
|
+
return rows.map(row => ({
|
|
459
|
+
id: row.id,
|
|
460
|
+
sessionId: row.sessionId,
|
|
461
|
+
turnNumber: row.turnNumber,
|
|
462
|
+
filePath: row.filePath,
|
|
463
|
+
operation: row.operation,
|
|
464
|
+
contentBefore: row.contentBefore,
|
|
465
|
+
contentAfter: row.contentAfter,
|
|
466
|
+
diffUnified: row.diffUnified,
|
|
467
|
+
storageMode: row.storageMode,
|
|
468
|
+
bytesBefore: row.bytesBefore,
|
|
469
|
+
bytesAfter: row.bytesAfter,
|
|
470
|
+
isUndone: row.isUndone === 1,
|
|
471
|
+
undoChangeId: row.undoChangeId,
|
|
472
|
+
toolCallId: row.toolCallId,
|
|
473
|
+
createdAt: row.createdAt,
|
|
474
|
+
}));
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Get all changes in session.
|
|
478
|
+
*/
|
|
479
|
+
getChanges(options) {
|
|
480
|
+
if (options?.filePath) {
|
|
481
|
+
return this.getFileHistory(options.filePath);
|
|
482
|
+
}
|
|
483
|
+
const rows = this.stmts.getChanges.all(this.sessionId);
|
|
484
|
+
return rows.map(row => ({
|
|
485
|
+
id: row.id,
|
|
486
|
+
sessionId: row.sessionId,
|
|
487
|
+
turnNumber: row.turnNumber,
|
|
488
|
+
filePath: row.filePath,
|
|
489
|
+
operation: row.operation,
|
|
490
|
+
contentBefore: row.contentBefore,
|
|
491
|
+
contentAfter: row.contentAfter,
|
|
492
|
+
diffUnified: row.diffUnified,
|
|
493
|
+
storageMode: row.storageMode,
|
|
494
|
+
bytesBefore: row.bytesBefore,
|
|
495
|
+
bytesAfter: row.bytesAfter,
|
|
496
|
+
isUndone: row.isUndone === 1,
|
|
497
|
+
undoChangeId: row.undoChangeId,
|
|
498
|
+
toolCallId: row.toolCallId,
|
|
499
|
+
createdAt: row.createdAt,
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Get session change summary.
|
|
504
|
+
*/
|
|
505
|
+
getSessionChangeSummary() {
|
|
506
|
+
const row = this.stmts.getSessionSummary.get(this.sessionId);
|
|
507
|
+
// Get unique file paths from active changes
|
|
508
|
+
const changes = this.getChanges();
|
|
509
|
+
const activeFiles = new Set();
|
|
510
|
+
for (const change of changes) {
|
|
511
|
+
if (!change.isUndone) {
|
|
512
|
+
activeFiles.add(change.filePath);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return {
|
|
516
|
+
totalChanges: row.totalChanges || 0,
|
|
517
|
+
activeChanges: row.activeChanges || 0,
|
|
518
|
+
undoneChanges: row.undoneChanges || 0,
|
|
519
|
+
filesModified: Array.from(activeFiles),
|
|
520
|
+
byOperation: {
|
|
521
|
+
create: row.createCount || 0,
|
|
522
|
+
write: row.writeCount || 0,
|
|
523
|
+
edit: row.editCount || 0,
|
|
524
|
+
delete: row.deleteCount || 0,
|
|
525
|
+
},
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
// =============================================================================
|
|
530
|
+
// FACTORY
|
|
531
|
+
// =============================================================================
|
|
532
|
+
/**
|
|
533
|
+
* Create a FileChangeTracker instance.
|
|
534
|
+
*/
|
|
535
|
+
export function createFileChangeTracker(db, sessionId, config) {
|
|
536
|
+
return new FileChangeTracker(db, sessionId, config);
|
|
537
|
+
}
|
|
538
|
+
//# sourceMappingURL=file-change-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-change-tracker.js","sourceRoot":"","sources":["../../../../src/integrations/utilities/file-change-tracker.ts"],"names":[],"mappings":"AAAA;;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|
1
|
+
/**
|
|
2
|
+
* Dependency Graph Visualization
|
|
3
|
+
*
|
|
4
|
+
* Generates visual representations of codebase dependency graphs.
|
|
5
|
+
* Supports multiple output formats:
|
|
6
|
+
* - Mermaid: Markdown-compatible diagrams (renders in GitHub, VS Code, etc.)
|
|
7
|
+
* - DOT: GraphViz format for advanced visualization
|
|
8
|
+
* - ASCII: Terminal-friendly text diagrams
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const repoMap = await codebaseContext.analyze();
|
|
13
|
+
* const diagram = generateDependencyDiagram(repoMap.dependencyGraph, {
|
|
14
|
+
* format: 'mermaid',
|
|
15
|
+
* maxNodes: 20,
|
|
16
|
+
* direction: 'LR',
|
|
17
|
+
* });
|
|
18
|
+
* console.log(diagram);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type FileDependencyGraph = Map<string, Set<string>>;
|
|
22
|
+
export type DiagramFormat = 'mermaid' | 'dot' | 'ascii';
|
|
23
|
+
export type DiagramDirection = 'TD' | 'LR' | 'BT' | 'RL';
|
|
24
|
+
export interface GraphVisualizationOptions {
|
|
25
|
+
/** Output format */
|
|
26
|
+
format: DiagramFormat;
|
|
27
|
+
/** Maximum number of nodes to include (prevents huge diagrams) */
|
|
28
|
+
maxNodes?: number;
|
|
29
|
+
/** Graph direction: TD (top-down), LR (left-right), BT (bottom-top), RL (right-left) */
|
|
30
|
+
direction?: DiagramDirection;
|
|
31
|
+
/** Include external dependencies (node_modules, etc.) */
|
|
32
|
+
includeExternal?: boolean;
|
|
33
|
+
/** Group files by directory */
|
|
34
|
+
groupByDirectory?: boolean;
|
|
35
|
+
/** Only show files matching these patterns */
|
|
36
|
+
filterPatterns?: string[];
|
|
37
|
+
/** Highlight these files (shown with different style) */
|
|
38
|
+
highlightFiles?: string[];
|
|
39
|
+
/** Title for the diagram */
|
|
40
|
+
title?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DiagramResult {
|
|
43
|
+
/** The generated diagram content */
|
|
44
|
+
content: string;
|
|
45
|
+
/** Number of nodes in the diagram */
|
|
46
|
+
nodeCount: number;
|
|
47
|
+
/** Number of edges in the diagram */
|
|
48
|
+
edgeCount: number;
|
|
49
|
+
/** Files that were excluded due to limits */
|
|
50
|
+
excludedFiles: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Generate a visual diagram of a dependency graph.
|
|
54
|
+
*/
|
|
55
|
+
export declare function generateDependencyDiagram(graph: FileDependencyGraph, options?: Partial<GraphVisualizationOptions>): DiagramResult;
|
|
56
|
+
/**
|
|
57
|
+
* Generate a focused diagram showing a file and its immediate dependencies.
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateFocusedDiagram(graph: FileDependencyGraph, centerFile: string, options?: Partial<GraphVisualizationOptions>): DiagramResult;
|
|
60
|
+
/**
|
|
61
|
+
* Generate a diagram showing the reverse dependencies (what depends on this file).
|
|
62
|
+
*/
|
|
63
|
+
export declare function generateReverseDiagram(reverseFileDependencyGraph: FileDependencyGraph, targetFile: string, options?: Partial<GraphVisualizationOptions>): DiagramResult;
|
|
64
|
+
/**
|
|
65
|
+
* Create a configured diagram generator.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createGraphVisualizer(defaultOptions?: Partial<GraphVisualizationOptions>): {
|
|
68
|
+
generate: (graph: FileDependencyGraph, options?: Partial<GraphVisualizationOptions>) => DiagramResult;
|
|
69
|
+
focused: (graph: FileDependencyGraph, centerFile: string, options?: Partial<GraphVisualizationOptions>) => DiagramResult;
|
|
70
|
+
reverse: (graph: FileDependencyGraph, targetFile: string, options?: Partial<GraphVisualizationOptions>) => DiagramResult;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=graph-visualization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization.d.ts","sourceRoot":"","sources":["../../../../src/integrations/utilities/graph-visualization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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