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,685 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codebase Context Integration
|
|
3
|
+
*
|
|
4
|
+
* Provides intelligent code selection for context management.
|
|
5
|
+
* Analyzes repository structure and selects relevant code based on:
|
|
6
|
+
* - Task relevance (semantic matching)
|
|
7
|
+
* - Architectural importance (entry points, core modules)
|
|
8
|
+
* - Token budget constraints
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Budget-aware context building (select code that fits)
|
|
12
|
+
* - Importance scoring (imports, exports, modification frequency)
|
|
13
|
+
* - Incremental expansion (start minimal, expand as needed)
|
|
14
|
+
* - Semantic relevance matching (keyword + structure analysis)
|
|
15
|
+
*
|
|
16
|
+
* Implementation split (Phase 3d):
|
|
17
|
+
* - code-analyzer.ts — AST + dependency analysis helpers
|
|
18
|
+
* - code-selector.ts — Token-budget selection + ranking
|
|
19
|
+
* - codebase-context.ts — Main manager class + types + factory functions (this file)
|
|
20
|
+
*/
|
|
21
|
+
import * as path from 'path';
|
|
22
|
+
// Analyzer functions (file discovery, processing, dependency analysis)
|
|
23
|
+
import { discoverFiles, processFile, extractDependencies, adjustImportanceByConnectivity, matchesPatterns, } from './code-analyzer.js';
|
|
24
|
+
import { clearASTCache, fullReparse, djb2Hash } from './codebase-ast.js';
|
|
25
|
+
// Selector functions (selection, search, ranking, LSP-enhanced context)
|
|
26
|
+
import { selectRelevantCode as selectRelevantCodeImpl, getEnhancedContext as getEnhancedContextImpl, expandContext as expandContextImpl, searchChunks, searchRanked as searchRankedImpl, } from './code-selector.js';
|
|
27
|
+
// Re-export extracted modules for direct consumer access
|
|
28
|
+
export { discoverFiles, processFile, extractDependencies, adjustImportanceByConnectivity, matchesPatterns, matchesGlob, normalizePath, determineChunkType, calculateBaseImportance, extractSymbols, extractSymbolDetails, extractDependencyNames, } from './code-analyzer.js';
|
|
29
|
+
export { selectRelevantCode as selectRelevantCodeFn, getEnhancedContext as getEnhancedContextFn, expandContext as expandContextFn, searchChunks, searchRanked as searchRankedFn, calculateRelevance, calculateSearchScore, sortByStrategy, tokenizeQuery, fuzzyMatch, levenshteinDistance, } from './code-selector.js';
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// CONSTANTS
|
|
32
|
+
// =============================================================================
|
|
33
|
+
const DEFAULT_CONFIG = {
|
|
34
|
+
root: process.cwd(),
|
|
35
|
+
includePatterns: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.go', '**/*.rs'],
|
|
36
|
+
excludePatterns: [
|
|
37
|
+
'**/node_modules/**',
|
|
38
|
+
'**/dist/**',
|
|
39
|
+
'**/build/**',
|
|
40
|
+
'**/.git/**',
|
|
41
|
+
'**/coverage/**',
|
|
42
|
+
'**/__pycache__/**',
|
|
43
|
+
'**/target/**',
|
|
44
|
+
'**/vendor/**',
|
|
45
|
+
],
|
|
46
|
+
maxFileSize: 100 * 1024, // 100KB
|
|
47
|
+
tokensPerChar: 0.25, // Approximate: 4 chars per token
|
|
48
|
+
entryPointPatterns: [
|
|
49
|
+
'**/index.ts', '**/index.tsx', '**/index.js',
|
|
50
|
+
'**/main.ts', '**/main.py', '**/main.go',
|
|
51
|
+
'**/app.ts', '**/app.tsx', '**/app.py',
|
|
52
|
+
'**/server.ts', '**/server.js',
|
|
53
|
+
'**/cli.ts', '**/cli.js',
|
|
54
|
+
],
|
|
55
|
+
coreModulePatterns: [
|
|
56
|
+
'**/src/**', '**/lib/**', '**/core/**',
|
|
57
|
+
'**/services/**', '**/modules/**',
|
|
58
|
+
],
|
|
59
|
+
analyzeDependencies: true,
|
|
60
|
+
cacheResults: true,
|
|
61
|
+
cacheTTL: 5 * 60 * 1000, // 5 minutes
|
|
62
|
+
};
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// CODEBASE CONTEXT MANAGER
|
|
65
|
+
// =============================================================================
|
|
66
|
+
/**
|
|
67
|
+
* Manages intelligent code selection for context building.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const codebase = createCodebaseContext({ root: './my-project' });
|
|
72
|
+
*
|
|
73
|
+
* // Analyze the repository
|
|
74
|
+
* const repoMap = await codebase.analyze();
|
|
75
|
+
*
|
|
76
|
+
* // Select relevant code for a task within budget
|
|
77
|
+
* const selection = await codebase.selectRelevantCode({
|
|
78
|
+
* task: 'implement user authentication',
|
|
79
|
+
* maxTokens: 8000,
|
|
80
|
+
* strategy: 'relevance_first',
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // Use selected code in context
|
|
84
|
+
* const context = selection.chunks.map(c => c.content).join('\n\n');
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export class CodebaseContextManager {
|
|
88
|
+
config;
|
|
89
|
+
repoMap = null;
|
|
90
|
+
cache = new Map();
|
|
91
|
+
listeners = [];
|
|
92
|
+
lspManager = null;
|
|
93
|
+
/** Optional trace collector for emitting codebase analysis events. */
|
|
94
|
+
traceCollector;
|
|
95
|
+
/** Optional store for persisting codebase analysis across sessions. */
|
|
96
|
+
persistenceStore = null;
|
|
97
|
+
constructor(config = {}) {
|
|
98
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Set the persistence store for warm startup across sessions.
|
|
102
|
+
* Accepts any object implementing saveCodebaseAnalysis/loadCodebaseAnalysis (e.g. SQLiteStore).
|
|
103
|
+
*/
|
|
104
|
+
setPersistenceStore(store) {
|
|
105
|
+
this.persistenceStore = store;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Set the LSP manager for enhanced context selection.
|
|
109
|
+
* When set, context selection can use LSP for more accurate relevance scoring.
|
|
110
|
+
*/
|
|
111
|
+
setLSPManager(lsp) {
|
|
112
|
+
this.lspManager = lsp;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the current LSP manager, if any.
|
|
116
|
+
*/
|
|
117
|
+
getLSPManager() {
|
|
118
|
+
return this.lspManager;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Check if LSP is available and active.
|
|
122
|
+
*/
|
|
123
|
+
hasActiveLSP() {
|
|
124
|
+
if (!this.lspManager)
|
|
125
|
+
return false;
|
|
126
|
+
const servers = this.lspManager.getActiveServers();
|
|
127
|
+
return servers.length > 0;
|
|
128
|
+
}
|
|
129
|
+
// ===========================================================================
|
|
130
|
+
// ANALYSIS
|
|
131
|
+
// ===========================================================================
|
|
132
|
+
/**
|
|
133
|
+
* Analyze a repository and build its structure map.
|
|
134
|
+
*/
|
|
135
|
+
async analyze(root) {
|
|
136
|
+
const repoRoot = root ?? this.config.root;
|
|
137
|
+
this.emit({ type: 'analysis.started', root: repoRoot });
|
|
138
|
+
// Check cache
|
|
139
|
+
if (this.config.cacheResults) {
|
|
140
|
+
const cached = this.cache.get(repoRoot);
|
|
141
|
+
if (cached && cached.expires > Date.now()) {
|
|
142
|
+
this.emit({ type: 'cache.hit', root: repoRoot });
|
|
143
|
+
this.repoMap = cached.map;
|
|
144
|
+
return cached.map;
|
|
145
|
+
}
|
|
146
|
+
this.emit({ type: 'cache.miss', root: repoRoot });
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
const chunks = new Map();
|
|
150
|
+
const entryPoints = [];
|
|
151
|
+
const coreModules = [];
|
|
152
|
+
const dependencyGraph = new Map();
|
|
153
|
+
const reverseDependencyGraph = new Map();
|
|
154
|
+
const analyzerDeps = this;
|
|
155
|
+
// Discover files
|
|
156
|
+
const files = await discoverFiles(analyzerDeps, repoRoot);
|
|
157
|
+
// Warm startup: try loading persisted analysis and only reprocess changed files
|
|
158
|
+
const savedAnalysis = this.persistenceStore
|
|
159
|
+
? this.persistenceStore.loadCodebaseAnalysis(repoRoot)
|
|
160
|
+
: null;
|
|
161
|
+
const filesToProcess = savedAnalysis
|
|
162
|
+
? await this.diffAgainstSaved(repoRoot, files, savedAnalysis, chunks)
|
|
163
|
+
: files;
|
|
164
|
+
// Process each file (only changed/new files when warm-starting)
|
|
165
|
+
for (const filePath of filesToProcess) {
|
|
166
|
+
const chunk = await processFile(analyzerDeps, repoRoot, filePath);
|
|
167
|
+
if (chunk) {
|
|
168
|
+
chunks.set(chunk.id, chunk);
|
|
169
|
+
// Track entry points
|
|
170
|
+
if (chunk.type === 'entry_point') {
|
|
171
|
+
entryPoints.push(filePath);
|
|
172
|
+
}
|
|
173
|
+
// Build dependency graph
|
|
174
|
+
if (this.config.analyzeDependencies) {
|
|
175
|
+
const fullPath = path.join(repoRoot, filePath);
|
|
176
|
+
const deps = extractDependencies(chunk.content, fullPath);
|
|
177
|
+
dependencyGraph.set(filePath, deps);
|
|
178
|
+
// Build reverse graph
|
|
179
|
+
for (const dep of deps) {
|
|
180
|
+
if (!reverseDependencyGraph.has(dep)) {
|
|
181
|
+
reverseDependencyGraph.set(dep, new Set());
|
|
182
|
+
}
|
|
183
|
+
reverseDependencyGraph.get(dep).add(filePath);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Restore dependency graph edges for unchanged files from saved analysis
|
|
189
|
+
if (savedAnalysis && this.config.analyzeDependencies) {
|
|
190
|
+
for (const [source, targets] of savedAnalysis.deps) {
|
|
191
|
+
if (!filesToProcess.includes(source) && chunks.has(source)) {
|
|
192
|
+
dependencyGraph.set(source, targets);
|
|
193
|
+
for (const dep of targets) {
|
|
194
|
+
if (!reverseDependencyGraph.has(dep)) {
|
|
195
|
+
reverseDependencyGraph.set(dep, new Set());
|
|
196
|
+
}
|
|
197
|
+
reverseDependencyGraph.get(dep).add(source);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Ensure entry points include restored unchanged files
|
|
203
|
+
if (savedAnalysis) {
|
|
204
|
+
for (const [filePath, chunk] of chunks) {
|
|
205
|
+
if (chunk.type === 'entry_point' && !entryPoints.includes(filePath)) {
|
|
206
|
+
entryPoints.push(filePath);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Calculate total tokens
|
|
211
|
+
let totalTokens = 0;
|
|
212
|
+
for (const chunk of chunks.values()) {
|
|
213
|
+
totalTokens += chunk.tokenCount;
|
|
214
|
+
}
|
|
215
|
+
// Adjust importance based on dependency graph
|
|
216
|
+
adjustImportanceByConnectivity(chunks, reverseDependencyGraph);
|
|
217
|
+
// Identify core modules
|
|
218
|
+
const moduleDirs = new Set();
|
|
219
|
+
for (const filePath of files) {
|
|
220
|
+
const dir = path.dirname(filePath);
|
|
221
|
+
if (matchesPatterns(analyzerDeps, dir, this.config.coreModulePatterns)) {
|
|
222
|
+
moduleDirs.add(dir);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
coreModules.push(...moduleDirs);
|
|
226
|
+
const repoMap = {
|
|
227
|
+
root: repoRoot,
|
|
228
|
+
chunks,
|
|
229
|
+
entryPoints,
|
|
230
|
+
coreModules,
|
|
231
|
+
dependencyGraph,
|
|
232
|
+
reverseDependencyGraph,
|
|
233
|
+
totalTokens,
|
|
234
|
+
analyzedAt: new Date(),
|
|
235
|
+
};
|
|
236
|
+
// Cache result
|
|
237
|
+
if (this.config.cacheResults) {
|
|
238
|
+
this.cache.set(repoRoot, {
|
|
239
|
+
map: repoMap,
|
|
240
|
+
expires: Date.now() + this.config.cacheTTL,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
this.repoMap = repoMap;
|
|
244
|
+
// Persist analysis to SQLite for warm startup next session
|
|
245
|
+
if (this.persistenceStore) {
|
|
246
|
+
try {
|
|
247
|
+
this.persistenceStore.saveCodebaseAnalysis(repoRoot, chunks.values(), dependencyGraph);
|
|
248
|
+
}
|
|
249
|
+
catch { /* persistence is non-blocking */ }
|
|
250
|
+
}
|
|
251
|
+
this.emit({
|
|
252
|
+
type: 'analysis.completed',
|
|
253
|
+
totalFiles: chunks.size,
|
|
254
|
+
totalTokens,
|
|
255
|
+
});
|
|
256
|
+
// Emit trace event with full codebase map data
|
|
257
|
+
this.traceCollector?.record({
|
|
258
|
+
type: 'codebase.map',
|
|
259
|
+
data: {
|
|
260
|
+
totalFiles: chunks.size,
|
|
261
|
+
totalTokens,
|
|
262
|
+
entryPoints,
|
|
263
|
+
coreModules,
|
|
264
|
+
dependencyEdges: Array.from(dependencyGraph.entries()).map(([file, imports]) => ({
|
|
265
|
+
file,
|
|
266
|
+
imports: Array.from(imports),
|
|
267
|
+
})),
|
|
268
|
+
topChunks: Array.from(chunks.values())
|
|
269
|
+
.sort((a, b) => b.importance - a.importance)
|
|
270
|
+
.slice(0, 50)
|
|
271
|
+
.map(chunk => ({
|
|
272
|
+
filePath: chunk.filePath,
|
|
273
|
+
tokenCount: chunk.tokenCount,
|
|
274
|
+
importance: chunk.importance,
|
|
275
|
+
type: chunk.type,
|
|
276
|
+
symbols: chunk.symbolDetails,
|
|
277
|
+
dependencies: chunk.dependencies,
|
|
278
|
+
})),
|
|
279
|
+
files: Array.from(chunks.values()).map((chunk) => ({
|
|
280
|
+
filePath: chunk.filePath,
|
|
281
|
+
directory: path.dirname(chunk.filePath) === '.' ? '' : path.dirname(chunk.filePath),
|
|
282
|
+
fileName: path.basename(chunk.filePath),
|
|
283
|
+
tokenCount: chunk.tokenCount,
|
|
284
|
+
importance: chunk.importance,
|
|
285
|
+
type: chunk.type,
|
|
286
|
+
symbols: chunk.symbolDetails,
|
|
287
|
+
inDegree: reverseDependencyGraph.get(chunk.filePath)?.size ?? 0,
|
|
288
|
+
outDegree: dependencyGraph.get(chunk.filePath)?.size ?? 0,
|
|
289
|
+
})),
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
return repoMap;
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
this.emit({ type: 'analysis.error', error: error });
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// ===========================================================================
|
|
300
|
+
// SELECTION (delegates to code-selector.ts)
|
|
301
|
+
// ===========================================================================
|
|
302
|
+
/**
|
|
303
|
+
* Select relevant code chunks for a task within a token budget.
|
|
304
|
+
*/
|
|
305
|
+
async selectRelevantCode(options) {
|
|
306
|
+
return selectRelevantCodeImpl(this.asSelectorDeps(), options);
|
|
307
|
+
}
|
|
308
|
+
// ===========================================================================
|
|
309
|
+
// LSP-ENHANCED CONTEXT SELECTION (delegates to code-selector.ts)
|
|
310
|
+
// ===========================================================================
|
|
311
|
+
/**
|
|
312
|
+
* Select relevant code with LSP-enhanced relevance scoring.
|
|
313
|
+
*
|
|
314
|
+
* When an LSP manager is set and active, this method uses LSP to:
|
|
315
|
+
* - Find files that reference the editing file (who uses this code?)
|
|
316
|
+
* - Find files that the editing file references (what does this depend on?)
|
|
317
|
+
* - Boost priority of related files in the selection
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* const codebase = createCodebaseContext({ root: './project' });
|
|
322
|
+
* codebase.setLSPManager(lspManager);
|
|
323
|
+
*
|
|
324
|
+
* const result = await codebase.getEnhancedContext({
|
|
325
|
+
* task: 'fix bug in authentication',
|
|
326
|
+
* maxTokens: 10000,
|
|
327
|
+
* editingFile: 'src/auth/login.ts',
|
|
328
|
+
* editingPosition: { line: 25, character: 10 },
|
|
329
|
+
* });
|
|
330
|
+
*
|
|
331
|
+
* // Result includes LSP-boosted files
|
|
332
|
+
* console.log('LSP boosted:', result.lspBoostedFiles);
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
async getEnhancedContext(options) {
|
|
336
|
+
return getEnhancedContextImpl(this.asSelectorDeps(), options);
|
|
337
|
+
}
|
|
338
|
+
// ===========================================================================
|
|
339
|
+
// INCREMENTAL EXPANSION (delegates to code-selector.ts)
|
|
340
|
+
// ===========================================================================
|
|
341
|
+
/**
|
|
342
|
+
* Expand context by adding related files to current selection.
|
|
343
|
+
*/
|
|
344
|
+
async expandContext(currentChunks, options) {
|
|
345
|
+
return expandContextImpl(this.asSelectorDeps(), currentChunks, options);
|
|
346
|
+
}
|
|
347
|
+
// ===========================================================================
|
|
348
|
+
// UTILITIES
|
|
349
|
+
// ===========================================================================
|
|
350
|
+
/**
|
|
351
|
+
* Get a chunk by file path.
|
|
352
|
+
*/
|
|
353
|
+
getChunk(filePath) {
|
|
354
|
+
return this.repoMap?.chunks.get(filePath);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get all chunks.
|
|
358
|
+
*/
|
|
359
|
+
getAllChunks() {
|
|
360
|
+
return this.repoMap ? Array.from(this.repoMap.chunks.values()) : [];
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Get entry points.
|
|
364
|
+
*/
|
|
365
|
+
getEntryPoints() {
|
|
366
|
+
if (!this.repoMap)
|
|
367
|
+
return [];
|
|
368
|
+
return this.repoMap.entryPoints
|
|
369
|
+
.map((ep) => this.repoMap.chunks.get(ep))
|
|
370
|
+
.filter((c) => c !== undefined);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Estimate tokens for a string.
|
|
374
|
+
*/
|
|
375
|
+
estimateTokens(content) {
|
|
376
|
+
return Math.ceil(content.length * this.config.tokensPerChar);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get the current repo map.
|
|
380
|
+
*/
|
|
381
|
+
getRepoMap() {
|
|
382
|
+
return this.repoMap;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Clear cached data (including AST parse cache).
|
|
386
|
+
*/
|
|
387
|
+
clearCache() {
|
|
388
|
+
this.cache.clear();
|
|
389
|
+
this.repoMap = null;
|
|
390
|
+
clearASTCache();
|
|
391
|
+
}
|
|
392
|
+
// ===========================================================================
|
|
393
|
+
// WARM STARTUP HELPERS (Phase 3)
|
|
394
|
+
// ===========================================================================
|
|
395
|
+
/**
|
|
396
|
+
* Diff discovered files against saved analysis.
|
|
397
|
+
* Reuses saved chunks for unchanged files, returns only files that need reprocessing.
|
|
398
|
+
*/
|
|
399
|
+
async diffAgainstSaved(repoRoot, files, saved, chunks) {
|
|
400
|
+
const { default: fs } = await import('fs/promises');
|
|
401
|
+
const changedFiles = [];
|
|
402
|
+
for (const relativePath of files) {
|
|
403
|
+
const savedChunk = saved.chunks.get(relativePath);
|
|
404
|
+
if (savedChunk) {
|
|
405
|
+
// Check if file content has changed by reading + hashing
|
|
406
|
+
try {
|
|
407
|
+
const fullPath = path.join(repoRoot, relativePath);
|
|
408
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
409
|
+
const currentHash = djb2Hash(content).toString(36);
|
|
410
|
+
if (currentHash === savedChunk.contentHash) {
|
|
411
|
+
// Unchanged — restore chunk from saved data
|
|
412
|
+
const symbolDetails = JSON.parse(savedChunk.symbolsJson || '[]');
|
|
413
|
+
const dependencies = JSON.parse(savedChunk.dependenciesJson || '[]');
|
|
414
|
+
chunks.set(relativePath, {
|
|
415
|
+
id: relativePath,
|
|
416
|
+
filePath: relativePath,
|
|
417
|
+
content,
|
|
418
|
+
tokenCount: savedChunk.tokenCount,
|
|
419
|
+
importance: savedChunk.importance,
|
|
420
|
+
type: savedChunk.chunkType,
|
|
421
|
+
symbols: symbolDetails.map((s) => s.name),
|
|
422
|
+
symbolDetails,
|
|
423
|
+
dependencies,
|
|
424
|
+
lastModified: new Date(savedChunk.analyzedAt),
|
|
425
|
+
});
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
// File read failed — treat as changed
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
changedFiles.push(relativePath);
|
|
434
|
+
}
|
|
435
|
+
return changedFiles;
|
|
436
|
+
}
|
|
437
|
+
// ===========================================================================
|
|
438
|
+
// INCREMENTAL FILE UPDATES (Phase 2)
|
|
439
|
+
// ===========================================================================
|
|
440
|
+
/**
|
|
441
|
+
* Update a single file's chunk in-place after an edit.
|
|
442
|
+
* Reparses the file, patches the chunk's symbols/deps, and updates dependency graph edges.
|
|
443
|
+
* Avoids full re-analyze for single-file edits.
|
|
444
|
+
*/
|
|
445
|
+
async updateFile(filePath, newContent) {
|
|
446
|
+
if (!this.repoMap)
|
|
447
|
+
return;
|
|
448
|
+
const relativePath = path.relative(this.config.root, filePath);
|
|
449
|
+
const parsed = fullReparse(filePath, newContent);
|
|
450
|
+
const existingChunk = this.repoMap.chunks.get(relativePath);
|
|
451
|
+
if (existingChunk) {
|
|
452
|
+
// Patch in-place
|
|
453
|
+
existingChunk.content = newContent;
|
|
454
|
+
existingChunk.tokenCount = Math.ceil(newContent.length * this.config.tokensPerChar);
|
|
455
|
+
existingChunk.lastModified = new Date();
|
|
456
|
+
if (parsed) {
|
|
457
|
+
existingChunk.symbols = parsed.symbols.map(s => s.name);
|
|
458
|
+
existingChunk.symbolDetails = parsed.symbols.map(s => ({
|
|
459
|
+
name: s.name, kind: s.kind, exported: s.exported, line: s.line,
|
|
460
|
+
}));
|
|
461
|
+
existingChunk.dependencies = parsed.dependencies
|
|
462
|
+
.flatMap(d => d.names.filter(n => !n.startsWith('* as ')));
|
|
463
|
+
}
|
|
464
|
+
// Update dependency graph edges for this file
|
|
465
|
+
this.updateDependencyEdges(relativePath, newContent);
|
|
466
|
+
// Recalculate total tokens
|
|
467
|
+
let totalTokens = 0;
|
|
468
|
+
for (const chunk of this.repoMap.chunks.values()) {
|
|
469
|
+
totalTokens += chunk.tokenCount;
|
|
470
|
+
}
|
|
471
|
+
this.repoMap.totalTokens = totalTokens;
|
|
472
|
+
}
|
|
473
|
+
// New files (not in chunks) require a full re-analyze
|
|
474
|
+
}
|
|
475
|
+
updateDependencyEdges(filePath, content) {
|
|
476
|
+
if (!this.repoMap)
|
|
477
|
+
return;
|
|
478
|
+
const { dependencyGraph, reverseDependencyGraph } = this.repoMap;
|
|
479
|
+
// Remove old forward edges
|
|
480
|
+
const oldDeps = dependencyGraph.get(filePath);
|
|
481
|
+
if (oldDeps) {
|
|
482
|
+
for (const dep of oldDeps) {
|
|
483
|
+
reverseDependencyGraph.get(dep)?.delete(filePath);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// Build new forward edges (use absolute path for AST cache lookup)
|
|
487
|
+
const fullPath = path.join(this.config.root, filePath);
|
|
488
|
+
const newDeps = extractDependencies(content, fullPath);
|
|
489
|
+
dependencyGraph.set(filePath, newDeps);
|
|
490
|
+
// Build new reverse edges
|
|
491
|
+
for (const dep of newDeps) {
|
|
492
|
+
if (!reverseDependencyGraph.has(dep)) {
|
|
493
|
+
reverseDependencyGraph.set(dep, new Set());
|
|
494
|
+
}
|
|
495
|
+
reverseDependencyGraph.get(dep).add(filePath);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Subscribe to events.
|
|
500
|
+
*/
|
|
501
|
+
on(listener) {
|
|
502
|
+
this.listeners.push(listener);
|
|
503
|
+
return () => {
|
|
504
|
+
const idx = this.listeners.indexOf(listener);
|
|
505
|
+
if (idx >= 0)
|
|
506
|
+
this.listeners.splice(idx, 1);
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
emit(event) {
|
|
510
|
+
for (const listener of this.listeners) {
|
|
511
|
+
try {
|
|
512
|
+
listener(event);
|
|
513
|
+
}
|
|
514
|
+
catch {
|
|
515
|
+
// Ignore listener errors
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
// ===========================================================================
|
|
520
|
+
// ENHANCED SEARCH (delegates to code-selector.ts)
|
|
521
|
+
// ===========================================================================
|
|
522
|
+
/**
|
|
523
|
+
* Search for code chunks matching a query.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* const results = codebase.search('authentication', {
|
|
528
|
+
* includeSymbols: true,
|
|
529
|
+
* includePaths: true,
|
|
530
|
+
* });
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
search(query, options = {}) {
|
|
534
|
+
return searchChunks(this.repoMap, query, options);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Search and rank results by relevance.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```typescript
|
|
541
|
+
* const ranked = codebase.searchRanked('user auth', { limit: 10 });
|
|
542
|
+
* ranked.forEach(r => console.log(`${r.chunk.filePath}: ${r.score}`));
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
searchRanked(query, options = {}) {
|
|
546
|
+
return searchRankedImpl(this.repoMap, query, options);
|
|
547
|
+
}
|
|
548
|
+
// ===========================================================================
|
|
549
|
+
// INTERNAL HELPERS
|
|
550
|
+
// ===========================================================================
|
|
551
|
+
/**
|
|
552
|
+
* Build the CodeSelectorDeps facade for delegating to code-selector functions.
|
|
553
|
+
*/
|
|
554
|
+
asSelectorDeps() {
|
|
555
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
556
|
+
const self = this;
|
|
557
|
+
return {
|
|
558
|
+
get repoMap() {
|
|
559
|
+
return self.repoMap;
|
|
560
|
+
},
|
|
561
|
+
get lspManager() {
|
|
562
|
+
return self.lspManager;
|
|
563
|
+
},
|
|
564
|
+
hasActiveLSP: () => self.hasActiveLSP(),
|
|
565
|
+
analyze: () => self.analyze(),
|
|
566
|
+
emit: (event) => self.emit(event),
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
// =============================================================================
|
|
571
|
+
// FACTORY FUNCTIONS
|
|
572
|
+
// =============================================================================
|
|
573
|
+
/**
|
|
574
|
+
* Create a codebase context manager.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* ```typescript
|
|
578
|
+
* const codebase = createCodebaseContext({
|
|
579
|
+
* root: './my-project',
|
|
580
|
+
* includePatterns: ['src/**\/*.ts'],
|
|
581
|
+
* excludePatterns: ['node_modules/**'],
|
|
582
|
+
* });
|
|
583
|
+
*
|
|
584
|
+
* // Analyze repo
|
|
585
|
+
* await codebase.analyze();
|
|
586
|
+
*
|
|
587
|
+
* // Select code for task
|
|
588
|
+
* const selection = await codebase.selectRelevantCode({
|
|
589
|
+
* task: 'fix authentication bug',
|
|
590
|
+
* maxTokens: 10000,
|
|
591
|
+
* strategy: 'relevance_first',
|
|
592
|
+
* });
|
|
593
|
+
*
|
|
594
|
+
* console.log(`Selected ${selection.chunks.length} files`);
|
|
595
|
+
* console.log(`Using ${selection.totalTokens} tokens`);
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
export function createCodebaseContext(config = {}) {
|
|
599
|
+
return new CodebaseContextManager(config);
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Build context string from selected chunks.
|
|
603
|
+
*/
|
|
604
|
+
export function buildContextFromChunks(chunks, options = {}) {
|
|
605
|
+
const { includeFilePaths = true, includeSeparators = true, maxTotalTokens, } = options;
|
|
606
|
+
const parts = [];
|
|
607
|
+
let totalTokens = 0;
|
|
608
|
+
for (const chunk of chunks) {
|
|
609
|
+
if (maxTotalTokens && totalTokens + chunk.tokenCount > maxTotalTokens) {
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
if (includeSeparators && parts.length > 0) {
|
|
613
|
+
parts.push('\n---\n');
|
|
614
|
+
}
|
|
615
|
+
if (includeFilePaths) {
|
|
616
|
+
parts.push(`// File: ${chunk.filePath}\n`);
|
|
617
|
+
}
|
|
618
|
+
parts.push(chunk.content);
|
|
619
|
+
totalTokens += chunk.tokenCount;
|
|
620
|
+
}
|
|
621
|
+
return parts.join('');
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Create a summary of the repo structure.
|
|
625
|
+
*/
|
|
626
|
+
export function summarizeRepoStructure(repoMap) {
|
|
627
|
+
const lines = [
|
|
628
|
+
`Repository: ${repoMap.root}`,
|
|
629
|
+
`Total files: ${repoMap.chunks.size}`,
|
|
630
|
+
`Total tokens: ${repoMap.totalTokens.toLocaleString()}`,
|
|
631
|
+
``,
|
|
632
|
+
`Entry points:`,
|
|
633
|
+
];
|
|
634
|
+
for (const ep of repoMap.entryPoints.slice(0, 5)) {
|
|
635
|
+
lines.push(` - ${ep}`);
|
|
636
|
+
}
|
|
637
|
+
lines.push(``, `Core modules:`);
|
|
638
|
+
for (const mod of repoMap.coreModules.slice(0, 5)) {
|
|
639
|
+
lines.push(` - ${mod}`);
|
|
640
|
+
}
|
|
641
|
+
// Type breakdown
|
|
642
|
+
const byType = new Map();
|
|
643
|
+
for (const chunk of repoMap.chunks.values()) {
|
|
644
|
+
byType.set(chunk.type, (byType.get(chunk.type) ?? 0) + 1);
|
|
645
|
+
}
|
|
646
|
+
lines.push(``, `File types:`);
|
|
647
|
+
for (const [type, count] of byType) {
|
|
648
|
+
lines.push(` - ${type}: ${count}`);
|
|
649
|
+
}
|
|
650
|
+
return lines.join('\n');
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Generate an aider-style lightweight repo map: file tree with key symbols.
|
|
654
|
+
* Used as fallback when task-specific selection returns nothing.
|
|
655
|
+
*/
|
|
656
|
+
export function generateLightweightRepoMap(repoMap, maxTokens = 10000) {
|
|
657
|
+
const lines = ['## Repository Map\n'];
|
|
658
|
+
const byDir = new Map();
|
|
659
|
+
for (const chunk of repoMap.chunks.values()) {
|
|
660
|
+
const dir = path.dirname(chunk.filePath);
|
|
661
|
+
if (!byDir.has(dir))
|
|
662
|
+
byDir.set(dir, []);
|
|
663
|
+
byDir.get(dir).push(chunk);
|
|
664
|
+
}
|
|
665
|
+
let tokenEstimate = 0;
|
|
666
|
+
for (const [dir, chunks] of [...byDir].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
667
|
+
const dirLine = `${dir}/`;
|
|
668
|
+
lines.push(dirLine);
|
|
669
|
+
tokenEstimate += dirLine.length * 0.25;
|
|
670
|
+
for (const chunk of chunks.sort((a, b) => b.importance - a.importance)) {
|
|
671
|
+
const symbols = chunk.symbols.slice(0, 5).join(', ');
|
|
672
|
+
const fileLine = ` ${path.basename(chunk.filePath)}${symbols ? ` (${symbols})` : ''}`;
|
|
673
|
+
lines.push(fileLine);
|
|
674
|
+
tokenEstimate += fileLine.length * 0.25;
|
|
675
|
+
if (tokenEstimate > maxTokens)
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
if (tokenEstimate > maxTokens) {
|
|
679
|
+
lines.push(' ... (truncated)');
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return lines.join('\n');
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=codebase-context.js.map
|