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,818 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codebase AST Module
|
|
3
|
+
*
|
|
4
|
+
* Provides accurate symbol and dependency extraction using tree-sitter AST parsing.
|
|
5
|
+
* Supports TypeScript/TSX, JavaScript/JSX, Python, and polyglot languages via
|
|
6
|
+
* pluggable language profiles.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - ASTCache: Parse once per file, extract symbols + dependencies from single tree
|
|
10
|
+
* - Content-hash invalidation: Detects when file content changes
|
|
11
|
+
* - Incremental reparse: Leverages tree-sitter's tree.edit() for fast updates
|
|
12
|
+
* - Polyglot support: Unified LanguageProfile system for adding new languages
|
|
13
|
+
*/
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
let tsParser = null;
|
|
16
|
+
let tsxParser = null;
|
|
17
|
+
let pyParser = null;
|
|
18
|
+
let parserInitAttempted = false;
|
|
19
|
+
const parserInitFailed = new Set();
|
|
20
|
+
const parsers = new Map();
|
|
21
|
+
export function getParser(ext) {
|
|
22
|
+
// Check polyglot parser cache first
|
|
23
|
+
if (parsers.has(ext))
|
|
24
|
+
return parsers.get(ext);
|
|
25
|
+
if (parserInitFailed.has(ext))
|
|
26
|
+
return null;
|
|
27
|
+
if (!parserInitAttempted) {
|
|
28
|
+
parserInitAttempted = true;
|
|
29
|
+
try {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
31
|
+
const Parser = require('tree-sitter');
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
33
|
+
const tsLangs = require('tree-sitter-typescript');
|
|
34
|
+
tsParser = new Parser();
|
|
35
|
+
tsParser.setLanguage(tsLangs.typescript);
|
|
36
|
+
tsxParser = new Parser();
|
|
37
|
+
tsxParser.setLanguage(tsLangs.tsx);
|
|
38
|
+
try {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
40
|
+
const pyLang = require('tree-sitter-python');
|
|
41
|
+
pyParser = new Parser();
|
|
42
|
+
pyParser.setLanguage(pyLang);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Python grammar not available — not fatal
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// tree-sitter not available at all
|
|
50
|
+
tsParser = null;
|
|
51
|
+
tsxParser = null;
|
|
52
|
+
pyParser = null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
switch (ext) {
|
|
56
|
+
case '.ts': return tsParser;
|
|
57
|
+
case '.tsx': return tsxParser;
|
|
58
|
+
case '.js': return tsParser; // TS parser handles JS fine
|
|
59
|
+
case '.jsx': return tsxParser;
|
|
60
|
+
case '.py': return pyParser;
|
|
61
|
+
default: {
|
|
62
|
+
// Try polyglot language profiles (LANGUAGE_PROFILES defined below, accessed lazily at call time)
|
|
63
|
+
const profile = getLanguageProfile(ext);
|
|
64
|
+
if (!profile)
|
|
65
|
+
return null;
|
|
66
|
+
return initPolyglotParser(ext, profile);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// AST CACHE
|
|
72
|
+
// =============================================================================
|
|
73
|
+
/** Module-level cache: filePath (absolute) -> ParsedFile */
|
|
74
|
+
const astCache = new Map();
|
|
75
|
+
/** Module-level parse counters for diagnostics visibility. */
|
|
76
|
+
let totalParses = 0;
|
|
77
|
+
let cacheHits = 0;
|
|
78
|
+
/** Normalize cache key to absolute path to prevent absolute/relative mismatch. */
|
|
79
|
+
function cacheKey(filePath) {
|
|
80
|
+
return path.resolve(filePath);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* djb2 string hash — fast, non-cryptographic hash for content invalidation.
|
|
84
|
+
*/
|
|
85
|
+
export function djb2Hash(str) {
|
|
86
|
+
let hash = 5381;
|
|
87
|
+
for (let i = 0; i < str.length; i++) {
|
|
88
|
+
hash = ((hash << 5) + hash + str.charCodeAt(i)) | 0;
|
|
89
|
+
}
|
|
90
|
+
return hash >>> 0; // Ensure unsigned
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parse a file once and extract symbols + dependencies from the same tree.
|
|
94
|
+
* Results are cached by filePath + contentHash.
|
|
95
|
+
*/
|
|
96
|
+
export function parseFile(content, filePath) {
|
|
97
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
98
|
+
const parser = getParser(ext);
|
|
99
|
+
if (!parser)
|
|
100
|
+
return null;
|
|
101
|
+
const hash = djb2Hash(content);
|
|
102
|
+
const key = cacheKey(filePath);
|
|
103
|
+
// Check cache
|
|
104
|
+
const cached = astCache.get(key);
|
|
105
|
+
if (cached && cached.contentHash === hash) {
|
|
106
|
+
cacheHits++;
|
|
107
|
+
return cached;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
totalParses++;
|
|
111
|
+
const tree = parser.parse(content);
|
|
112
|
+
const symbols = extractSymbolsFromRoot(tree.rootNode, ext);
|
|
113
|
+
const dependencies = extractDependenciesFromRoot(tree.rootNode, ext);
|
|
114
|
+
const result = { tree, symbols, dependencies, contentHash: hash, parsedAt: Date.now() };
|
|
115
|
+
astCache.set(key, result);
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Full reparse for write_file (no edit ranges available).
|
|
124
|
+
* Parses from scratch and caches the result.
|
|
125
|
+
*/
|
|
126
|
+
export function fullReparse(filePath, newContent) {
|
|
127
|
+
return parseFile(newContent, filePath);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Incremental reparse using tree-sitter's tree.edit() + old tree reference.
|
|
131
|
+
* Falls back to full reparse if no cached tree is available.
|
|
132
|
+
*/
|
|
133
|
+
export function incrementalReparse(filePath, newContent, edit) {
|
|
134
|
+
const key = cacheKey(filePath);
|
|
135
|
+
const cached = astCache.get(key);
|
|
136
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
137
|
+
const parser = getParser(ext);
|
|
138
|
+
if (!parser)
|
|
139
|
+
return null;
|
|
140
|
+
try {
|
|
141
|
+
let newTree;
|
|
142
|
+
if (cached?.tree?.edit) {
|
|
143
|
+
// Incremental: edit old tree, reparse with old tree reference
|
|
144
|
+
cached.tree.edit(edit);
|
|
145
|
+
newTree = parser.parse(newContent, cached.tree);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// No cached tree — full parse
|
|
149
|
+
newTree = parser.parse(newContent);
|
|
150
|
+
}
|
|
151
|
+
const symbols = extractSymbolsFromRoot(newTree.rootNode, ext);
|
|
152
|
+
const dependencies = extractDependenciesFromRoot(newTree.rootNode, ext);
|
|
153
|
+
const hash = djb2Hash(newContent);
|
|
154
|
+
const result = { tree: newTree, symbols, dependencies, contentHash: hash, parsedAt: Date.now() };
|
|
155
|
+
astCache.set(key, result);
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
// Fall back to full reparse
|
|
160
|
+
return parseFile(newContent, filePath);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** Remove a single file from the cache. */
|
|
164
|
+
export function invalidateAST(filePath) { astCache.delete(cacheKey(filePath)); }
|
|
165
|
+
/** Clear all cached parse results. */
|
|
166
|
+
export function clearASTCache() { astCache.clear(); }
|
|
167
|
+
/** Get number of cached files. */
|
|
168
|
+
export function getASTCacheSize() { return astCache.size; }
|
|
169
|
+
/** Get cached parse result without re-parsing. */
|
|
170
|
+
export function getCachedParse(filePath) { return astCache.get(cacheKey(filePath)) ?? null; }
|
|
171
|
+
/** Get AST cache diagnostics stats. */
|
|
172
|
+
export function getASTCacheStats() {
|
|
173
|
+
const languages = {};
|
|
174
|
+
for (const [key] of astCache) {
|
|
175
|
+
const ext = key.slice(key.lastIndexOf('.')).toLowerCase();
|
|
176
|
+
const lang = ext === '.ts' || ext === '.tsx' ? 'typescript'
|
|
177
|
+
: ext === '.js' || ext === '.jsx' ? 'javascript'
|
|
178
|
+
: ext === '.py' ? 'python'
|
|
179
|
+
: ext;
|
|
180
|
+
languages[lang] = (languages[lang] || 0) + 1;
|
|
181
|
+
}
|
|
182
|
+
return { fileCount: astCache.size, languages, totalParses, cacheHits };
|
|
183
|
+
}
|
|
184
|
+
/** Reset parse counters (for testing). */
|
|
185
|
+
export function resetASTCacheStats() {
|
|
186
|
+
totalParses = 0;
|
|
187
|
+
cacheHits = 0;
|
|
188
|
+
}
|
|
189
|
+
// =============================================================================
|
|
190
|
+
// PUBLIC API
|
|
191
|
+
// =============================================================================
|
|
192
|
+
/**
|
|
193
|
+
* Check if AST parsing is available for a file extension.
|
|
194
|
+
*/
|
|
195
|
+
export function isASTSupported(filePath) {
|
|
196
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
197
|
+
return getParser(ext) !== null;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Extract symbols from source code using tree-sitter AST.
|
|
201
|
+
* Uses ASTCache — parses once, reuses cached result.
|
|
202
|
+
*/
|
|
203
|
+
export function extractSymbolsAST(content, filePath) {
|
|
204
|
+
return parseFile(content, filePath)?.symbols ?? [];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Extract dependencies from source code using tree-sitter AST.
|
|
208
|
+
* Uses ASTCache — parses once, reuses cached result.
|
|
209
|
+
*/
|
|
210
|
+
export function extractDependenciesAST(content, filePath) {
|
|
211
|
+
return parseFile(content, filePath)?.dependencies ?? [];
|
|
212
|
+
}
|
|
213
|
+
// =============================================================================
|
|
214
|
+
// INTERNAL: Root-level extraction dispatchers
|
|
215
|
+
// =============================================================================
|
|
216
|
+
/** Lookup a polyglot language profile by extension. */
|
|
217
|
+
function getLanguageProfile(ext) {
|
|
218
|
+
return LANGUAGE_PROFILES.find(p => p.extensions.includes(ext));
|
|
219
|
+
}
|
|
220
|
+
function extractSymbolsFromRoot(root, ext) {
|
|
221
|
+
if (ext === '.py')
|
|
222
|
+
return extractPythonSymbols(root);
|
|
223
|
+
const profile = getLanguageProfile(ext);
|
|
224
|
+
if (profile)
|
|
225
|
+
return extractSymbolsGeneric(root, profile);
|
|
226
|
+
return extractTSSymbols(root);
|
|
227
|
+
}
|
|
228
|
+
function extractDependenciesFromRoot(root, ext) {
|
|
229
|
+
if (ext === '.py')
|
|
230
|
+
return extractPythonDependencies(root);
|
|
231
|
+
const profile = getLanguageProfile(ext);
|
|
232
|
+
if (profile)
|
|
233
|
+
return extractDependenciesGeneric(root, profile);
|
|
234
|
+
return extractTSDependencies(root);
|
|
235
|
+
}
|
|
236
|
+
// =============================================================================
|
|
237
|
+
// TYPESCRIPT / JAVASCRIPT EXTRACTION
|
|
238
|
+
// =============================================================================
|
|
239
|
+
function extractTSSymbols(root) {
|
|
240
|
+
const symbols = [];
|
|
241
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
242
|
+
const node = root.child(i);
|
|
243
|
+
if (!node)
|
|
244
|
+
continue;
|
|
245
|
+
if (node.type === 'export_statement') {
|
|
246
|
+
extractFromExportStatement(node, symbols);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
// Non-exported top-level declarations
|
|
250
|
+
const kind = declarationKind(node.type);
|
|
251
|
+
if (kind) {
|
|
252
|
+
const name = getDeclarationName(node);
|
|
253
|
+
if (name) {
|
|
254
|
+
symbols.push({
|
|
255
|
+
name,
|
|
256
|
+
kind,
|
|
257
|
+
exported: false,
|
|
258
|
+
line: node.startPosition.row + 1,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return symbols;
|
|
265
|
+
}
|
|
266
|
+
function extractFromExportStatement(exportNode, symbols) {
|
|
267
|
+
const decl = exportNode.childForFieldName('declaration');
|
|
268
|
+
if (decl) {
|
|
269
|
+
const kind = declarationKind(decl.type);
|
|
270
|
+
if (kind) {
|
|
271
|
+
const name = getDeclarationName(decl);
|
|
272
|
+
if (name) {
|
|
273
|
+
symbols.push({
|
|
274
|
+
name,
|
|
275
|
+
kind,
|
|
276
|
+
exported: true,
|
|
277
|
+
line: decl.startPosition.row + 1,
|
|
278
|
+
});
|
|
279
|
+
// Extract class methods
|
|
280
|
+
if (kind === 'class') {
|
|
281
|
+
extractClassMembers(decl, symbols);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else if (decl.type === 'lexical_declaration') {
|
|
286
|
+
// export const x = 1; export let y = 2;
|
|
287
|
+
for (const child of decl.namedChildren) {
|
|
288
|
+
if (child.type === 'variable_declarator') {
|
|
289
|
+
const nameNode = child.childForFieldName('name');
|
|
290
|
+
if (nameNode) {
|
|
291
|
+
symbols.push({
|
|
292
|
+
name: nameNode.text,
|
|
293
|
+
kind: 'variable',
|
|
294
|
+
exported: true,
|
|
295
|
+
line: child.startPosition.row + 1,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
// export { A, B } or export { A, B } from './other'
|
|
304
|
+
for (let i = 0; i < exportNode.childCount; i++) {
|
|
305
|
+
const child = exportNode.child(i);
|
|
306
|
+
if (!child)
|
|
307
|
+
continue;
|
|
308
|
+
if (child.type === 'export_clause') {
|
|
309
|
+
for (const specifier of child.namedChildren) {
|
|
310
|
+
if (specifier.type === 'export_specifier') {
|
|
311
|
+
const nameNode = specifier.childForFieldName('name');
|
|
312
|
+
if (nameNode) {
|
|
313
|
+
symbols.push({
|
|
314
|
+
name: nameNode.text,
|
|
315
|
+
kind: 'variable', // We don't know the kind from re-exports
|
|
316
|
+
exported: true,
|
|
317
|
+
line: specifier.startPosition.row + 1,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// export default class/function (without declaration field — fallback)
|
|
325
|
+
let hasDefault = false;
|
|
326
|
+
for (let i = 0; i < exportNode.childCount; i++) {
|
|
327
|
+
const child = exportNode.child(i);
|
|
328
|
+
if (child?.type === 'default')
|
|
329
|
+
hasDefault = true;
|
|
330
|
+
}
|
|
331
|
+
if (hasDefault && !decl) {
|
|
332
|
+
// Check for inline class/function after 'default'
|
|
333
|
+
for (let i = 0; i < exportNode.childCount; i++) {
|
|
334
|
+
const child = exportNode.child(i);
|
|
335
|
+
if (!child)
|
|
336
|
+
continue;
|
|
337
|
+
const kind = declarationKind(child.type);
|
|
338
|
+
if (kind) {
|
|
339
|
+
const name = getDeclarationName(child);
|
|
340
|
+
symbols.push({
|
|
341
|
+
name: name || 'default',
|
|
342
|
+
kind,
|
|
343
|
+
exported: true,
|
|
344
|
+
line: child.startPosition.row + 1,
|
|
345
|
+
});
|
|
346
|
+
if (kind === 'class') {
|
|
347
|
+
extractClassMembers(child, symbols);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function extractClassMembers(classNode, symbols) {
|
|
354
|
+
const body = classNode.childForFieldName('body');
|
|
355
|
+
if (!body)
|
|
356
|
+
return;
|
|
357
|
+
for (const member of body.namedChildren) {
|
|
358
|
+
if (member.type === 'method_definition' || member.type === 'public_field_definition') {
|
|
359
|
+
const nameNode = member.childForFieldName('name');
|
|
360
|
+
if (nameNode) {
|
|
361
|
+
symbols.push({
|
|
362
|
+
name: nameNode.text,
|
|
363
|
+
kind: 'method',
|
|
364
|
+
exported: true,
|
|
365
|
+
line: member.startPosition.row + 1,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function extractTSDependencies(root) {
|
|
372
|
+
const deps = [];
|
|
373
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
374
|
+
const node = root.child(i);
|
|
375
|
+
if (!node)
|
|
376
|
+
continue;
|
|
377
|
+
if (node.type === 'import_statement') {
|
|
378
|
+
const dep = extractImportDependency(node);
|
|
379
|
+
if (dep)
|
|
380
|
+
deps.push(dep);
|
|
381
|
+
}
|
|
382
|
+
// Also handle export ... from '...'
|
|
383
|
+
if (node.type === 'export_statement') {
|
|
384
|
+
const source = findSourceString(node);
|
|
385
|
+
if (source) {
|
|
386
|
+
const names = extractExportNames(node);
|
|
387
|
+
deps.push({
|
|
388
|
+
source,
|
|
389
|
+
names,
|
|
390
|
+
isRelative: source.startsWith('.'),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return deps;
|
|
396
|
+
}
|
|
397
|
+
function extractImportDependency(importNode) {
|
|
398
|
+
const sourceNode = importNode.childForFieldName('source');
|
|
399
|
+
if (!sourceNode) {
|
|
400
|
+
// Side-effect import: import './init' — source is a direct string child
|
|
401
|
+
for (let i = 0; i < importNode.childCount; i++) {
|
|
402
|
+
const child = importNode.child(i);
|
|
403
|
+
if (child?.type === 'string') {
|
|
404
|
+
const source = stripQuotes(child.text);
|
|
405
|
+
return { source, names: [], isRelative: source.startsWith('.') };
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
const source = stripQuotes(sourceNode.text);
|
|
411
|
+
const names = [];
|
|
412
|
+
// Find the import_clause
|
|
413
|
+
for (let i = 0; i < importNode.childCount; i++) {
|
|
414
|
+
const child = importNode.child(i);
|
|
415
|
+
if (child?.type === 'import_clause') {
|
|
416
|
+
extractImportClauseNames(child, names);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return { source, names, isRelative: source.startsWith('.') };
|
|
420
|
+
}
|
|
421
|
+
function extractImportClauseNames(clause, names) {
|
|
422
|
+
for (let i = 0; i < clause.childCount; i++) {
|
|
423
|
+
const child = clause.child(i);
|
|
424
|
+
if (!child)
|
|
425
|
+
continue;
|
|
426
|
+
if (child.type === 'identifier') {
|
|
427
|
+
// Default import
|
|
428
|
+
names.push(child.text);
|
|
429
|
+
}
|
|
430
|
+
else if (child.type === 'named_imports') {
|
|
431
|
+
for (const specifier of child.namedChildren) {
|
|
432
|
+
if (specifier.type === 'import_specifier') {
|
|
433
|
+
const nameNode = specifier.childForFieldName('name');
|
|
434
|
+
if (nameNode)
|
|
435
|
+
names.push(nameNode.text);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
else if (child.type === 'namespace_import') {
|
|
440
|
+
// import * as NS
|
|
441
|
+
const nameNode = child.childForFieldName('name') ?? child.namedChildren.find(c => c.type === 'identifier');
|
|
442
|
+
if (nameNode)
|
|
443
|
+
names.push(`* as ${nameNode.text}`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function extractExportNames(exportNode) {
|
|
448
|
+
const names = [];
|
|
449
|
+
for (let i = 0; i < exportNode.childCount; i++) {
|
|
450
|
+
const child = exportNode.child(i);
|
|
451
|
+
if (child?.type === 'export_clause') {
|
|
452
|
+
for (const specifier of child.namedChildren) {
|
|
453
|
+
if (specifier.type === 'export_specifier') {
|
|
454
|
+
const nameNode = specifier.childForFieldName('name');
|
|
455
|
+
if (nameNode)
|
|
456
|
+
names.push(nameNode.text);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return names;
|
|
462
|
+
}
|
|
463
|
+
function findSourceString(node) {
|
|
464
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
465
|
+
const child = node.child(i);
|
|
466
|
+
if (child?.type === 'string' || child?.type === 'string_fragment') {
|
|
467
|
+
return stripQuotes(child.text);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
// Check if the 'source' field exists
|
|
471
|
+
const source = node.childForFieldName('source');
|
|
472
|
+
if (source)
|
|
473
|
+
return stripQuotes(source.text);
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
// =============================================================================
|
|
477
|
+
// PYTHON EXTRACTION
|
|
478
|
+
// =============================================================================
|
|
479
|
+
function extractPythonSymbols(root) {
|
|
480
|
+
const symbols = [];
|
|
481
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
482
|
+
const node = root.child(i);
|
|
483
|
+
if (!node)
|
|
484
|
+
continue;
|
|
485
|
+
if (node.type === 'function_definition') {
|
|
486
|
+
const name = node.childForFieldName('name');
|
|
487
|
+
if (name) {
|
|
488
|
+
symbols.push({
|
|
489
|
+
name: name.text,
|
|
490
|
+
kind: 'function',
|
|
491
|
+
exported: !name.text.startsWith('_'),
|
|
492
|
+
line: node.startPosition.row + 1,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
else if (node.type === 'class_definition') {
|
|
497
|
+
const name = node.childForFieldName('name');
|
|
498
|
+
if (name) {
|
|
499
|
+
symbols.push({
|
|
500
|
+
name: name.text,
|
|
501
|
+
kind: 'class',
|
|
502
|
+
exported: !name.text.startsWith('_'),
|
|
503
|
+
line: node.startPosition.row + 1,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return symbols;
|
|
509
|
+
}
|
|
510
|
+
function extractPythonDependencies(root) {
|
|
511
|
+
const deps = [];
|
|
512
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
513
|
+
const node = root.child(i);
|
|
514
|
+
if (!node)
|
|
515
|
+
continue;
|
|
516
|
+
if (node.type === 'import_statement') {
|
|
517
|
+
// import module
|
|
518
|
+
for (const child of node.namedChildren) {
|
|
519
|
+
if (child.type === 'dotted_name') {
|
|
520
|
+
deps.push({
|
|
521
|
+
source: child.text,
|
|
522
|
+
names: [child.text],
|
|
523
|
+
isRelative: false,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
else if (child.type === 'aliased_import') {
|
|
527
|
+
const nameNode = child.childForFieldName('name');
|
|
528
|
+
if (nameNode) {
|
|
529
|
+
deps.push({
|
|
530
|
+
source: nameNode.text,
|
|
531
|
+
names: [nameNode.text],
|
|
532
|
+
isRelative: false,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
else if (node.type === 'import_from_statement') {
|
|
539
|
+
// from module import name
|
|
540
|
+
let source = '';
|
|
541
|
+
let isRelative = false;
|
|
542
|
+
const names = [];
|
|
543
|
+
for (let j = 0; j < node.childCount; j++) {
|
|
544
|
+
const child = node.child(j);
|
|
545
|
+
if (!child)
|
|
546
|
+
continue;
|
|
547
|
+
if (child.type === 'dotted_name' && source === '') {
|
|
548
|
+
source = child.text;
|
|
549
|
+
}
|
|
550
|
+
else if (child.type === 'relative_import') {
|
|
551
|
+
source = child.text;
|
|
552
|
+
isRelative = true;
|
|
553
|
+
}
|
|
554
|
+
else if (child.type === 'dotted_name' && source !== '') {
|
|
555
|
+
names.push(child.text);
|
|
556
|
+
}
|
|
557
|
+
else if (child.type === 'aliased_import') {
|
|
558
|
+
const nameNode = child.childForFieldName('name');
|
|
559
|
+
if (nameNode)
|
|
560
|
+
names.push(nameNode.text);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (source) {
|
|
564
|
+
deps.push({ source, names, isRelative });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return deps;
|
|
569
|
+
}
|
|
570
|
+
// =============================================================================
|
|
571
|
+
// HELPERS
|
|
572
|
+
// =============================================================================
|
|
573
|
+
function declarationKind(nodeType) {
|
|
574
|
+
switch (nodeType) {
|
|
575
|
+
case 'function_declaration': return 'function';
|
|
576
|
+
case 'class_declaration': return 'class';
|
|
577
|
+
case 'interface_declaration': return 'interface';
|
|
578
|
+
case 'type_alias_declaration': return 'type';
|
|
579
|
+
case 'enum_declaration': return 'enum';
|
|
580
|
+
default: return null;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function getDeclarationName(node) {
|
|
584
|
+
const nameNode = node.childForFieldName('name');
|
|
585
|
+
return nameNode?.text ?? null;
|
|
586
|
+
}
|
|
587
|
+
function stripQuotes(str) {
|
|
588
|
+
if ((str.startsWith("'") && str.endsWith("'")) ||
|
|
589
|
+
(str.startsWith('"') && str.endsWith('"'))) {
|
|
590
|
+
return str.slice(1, -1);
|
|
591
|
+
}
|
|
592
|
+
return str;
|
|
593
|
+
}
|
|
594
|
+
export const LANGUAGE_PROFILES = [
|
|
595
|
+
{
|
|
596
|
+
extensions: ['.go'],
|
|
597
|
+
grammar: 'tree-sitter-go',
|
|
598
|
+
symbolNodes: {
|
|
599
|
+
'function_declaration': 'function',
|
|
600
|
+
'method_declaration': 'method',
|
|
601
|
+
'type_declaration': 'class',
|
|
602
|
+
},
|
|
603
|
+
importNodes: ['import_declaration'],
|
|
604
|
+
exportDetection: 'convention',
|
|
605
|
+
extractImport: (node) => {
|
|
606
|
+
// Go: import "pkg" or import ( "pkg1"; "pkg2" )
|
|
607
|
+
const deps = [];
|
|
608
|
+
const walkImport = (n) => {
|
|
609
|
+
if (n.type === 'import_spec' || n.type === 'interpreted_string_literal') {
|
|
610
|
+
const source = stripQuotes(n.text);
|
|
611
|
+
if (source && !source.startsWith('(')) {
|
|
612
|
+
deps.push({ source, names: [path.basename(source)], isRelative: source.startsWith('.') });
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
for (const child of n.namedChildren)
|
|
616
|
+
walkImport(child);
|
|
617
|
+
};
|
|
618
|
+
walkImport(node);
|
|
619
|
+
return deps;
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
extensions: ['.rs'],
|
|
624
|
+
grammar: 'tree-sitter-rust',
|
|
625
|
+
symbolNodes: {
|
|
626
|
+
'function_item': 'function',
|
|
627
|
+
'impl_item': 'class',
|
|
628
|
+
'struct_item': 'class',
|
|
629
|
+
'enum_item': 'enum',
|
|
630
|
+
'trait_item': 'interface',
|
|
631
|
+
'type_item': 'type',
|
|
632
|
+
},
|
|
633
|
+
importNodes: ['use_declaration'],
|
|
634
|
+
exportDetection: 'keyword',
|
|
635
|
+
extractImport: (node) => {
|
|
636
|
+
const text = node.text;
|
|
637
|
+
const match = /use\s+(.+?)(?:\s+as\s+\w+)?;/.exec(text);
|
|
638
|
+
if (match) {
|
|
639
|
+
const source = match[1].replace(/::/g, '/');
|
|
640
|
+
return [{ source, names: [path.basename(source)], isRelative: source.startsWith('self') || source.startsWith('super') }];
|
|
641
|
+
}
|
|
642
|
+
return [];
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
extensions: ['.java'],
|
|
647
|
+
grammar: 'tree-sitter-java',
|
|
648
|
+
symbolNodes: {
|
|
649
|
+
'class_declaration': 'class',
|
|
650
|
+
'interface_declaration': 'interface',
|
|
651
|
+
'method_declaration': 'method',
|
|
652
|
+
'enum_declaration': 'enum',
|
|
653
|
+
},
|
|
654
|
+
importNodes: ['import_declaration'],
|
|
655
|
+
exportDetection: 'visibility',
|
|
656
|
+
extractImport: (node) => {
|
|
657
|
+
const text = node.text;
|
|
658
|
+
const match = /import\s+(?:static\s+)?(.+?);/.exec(text);
|
|
659
|
+
if (match) {
|
|
660
|
+
const source = match[1];
|
|
661
|
+
const parts = source.split('.');
|
|
662
|
+
return [{ source, names: [parts[parts.length - 1]], isRelative: false }];
|
|
663
|
+
}
|
|
664
|
+
return [];
|
|
665
|
+
},
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
extensions: ['.c', '.h'],
|
|
669
|
+
grammar: 'tree-sitter-c',
|
|
670
|
+
symbolNodes: {
|
|
671
|
+
'function_definition': 'function',
|
|
672
|
+
'struct_specifier': 'class',
|
|
673
|
+
'enum_specifier': 'enum',
|
|
674
|
+
'type_definition': 'type',
|
|
675
|
+
},
|
|
676
|
+
importNodes: ['preproc_include'],
|
|
677
|
+
exportDetection: 'convention',
|
|
678
|
+
extractImport: (node) => {
|
|
679
|
+
const text = node.text;
|
|
680
|
+
const match = /#include\s+[<"](.+?)[>"]/.exec(text);
|
|
681
|
+
if (match) {
|
|
682
|
+
const source = match[1];
|
|
683
|
+
return [{ source, names: [path.basename(source)], isRelative: source.includes('/') || text.includes('"') }];
|
|
684
|
+
}
|
|
685
|
+
return [];
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
extensions: ['.cpp', '.cc', '.cxx', '.hpp'],
|
|
690
|
+
grammar: 'tree-sitter-cpp',
|
|
691
|
+
symbolNodes: {
|
|
692
|
+
'function_definition': 'function',
|
|
693
|
+
'class_specifier': 'class',
|
|
694
|
+
'struct_specifier': 'class',
|
|
695
|
+
'enum_specifier': 'enum',
|
|
696
|
+
'namespace_definition': 'variable',
|
|
697
|
+
},
|
|
698
|
+
importNodes: ['preproc_include'],
|
|
699
|
+
exportDetection: 'convention',
|
|
700
|
+
extractImport: (node) => {
|
|
701
|
+
const text = node.text;
|
|
702
|
+
const match = /#include\s+[<"](.+?)[>"]/.exec(text);
|
|
703
|
+
if (match) {
|
|
704
|
+
const source = match[1];
|
|
705
|
+
return [{ source, names: [path.basename(source)], isRelative: source.includes('/') || text.includes('"') }];
|
|
706
|
+
}
|
|
707
|
+
return [];
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
extensions: ['.rb'],
|
|
712
|
+
grammar: 'tree-sitter-ruby',
|
|
713
|
+
symbolNodes: {
|
|
714
|
+
'method': 'function',
|
|
715
|
+
'singleton_method': 'function',
|
|
716
|
+
'class': 'class',
|
|
717
|
+
'module': 'class',
|
|
718
|
+
},
|
|
719
|
+
importNodes: ['call'],
|
|
720
|
+
exportDetection: 'convention',
|
|
721
|
+
extractImport: (node) => {
|
|
722
|
+
const text = node.text;
|
|
723
|
+
const match = /(?:require|require_relative)\s+['"](.+?)['"]/.exec(text);
|
|
724
|
+
if (match) {
|
|
725
|
+
const source = match[1];
|
|
726
|
+
return [{ source, names: [path.basename(source)], isRelative: text.includes('require_relative') }];
|
|
727
|
+
}
|
|
728
|
+
return [];
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
extensions: ['.sh', '.bash'],
|
|
733
|
+
grammar: 'tree-sitter-bash',
|
|
734
|
+
symbolNodes: {
|
|
735
|
+
'function_definition': 'function',
|
|
736
|
+
},
|
|
737
|
+
importNodes: ['command'],
|
|
738
|
+
exportDetection: 'convention',
|
|
739
|
+
extractImport: (node) => {
|
|
740
|
+
const text = node.text;
|
|
741
|
+
const match = /(?:source|\.)\s+['"]?(.+?)['"]?(?:\s|$)/.exec(text);
|
|
742
|
+
if (match) {
|
|
743
|
+
const source = match[1];
|
|
744
|
+
return [{ source, names: [path.basename(source)], isRelative: source.startsWith('.') || source.startsWith('/') }];
|
|
745
|
+
}
|
|
746
|
+
return [];
|
|
747
|
+
},
|
|
748
|
+
},
|
|
749
|
+
];
|
|
750
|
+
// =============================================================================
|
|
751
|
+
// POLYGLOT: GENERIC EXTRACTORS
|
|
752
|
+
// =============================================================================
|
|
753
|
+
function initPolyglotParser(ext, profile) {
|
|
754
|
+
try {
|
|
755
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
756
|
+
const Parser = require('tree-sitter');
|
|
757
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
758
|
+
const lang = require(profile.grammar);
|
|
759
|
+
const parser = new Parser();
|
|
760
|
+
parser.setLanguage(lang.default ?? lang);
|
|
761
|
+
parsers.set(ext, parser);
|
|
762
|
+
return parser;
|
|
763
|
+
}
|
|
764
|
+
catch {
|
|
765
|
+
parserInitFailed.add(ext);
|
|
766
|
+
return null;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
function extractSymbolsGeneric(root, profile) {
|
|
770
|
+
const symbols = [];
|
|
771
|
+
walkTopLevel(root, (node) => {
|
|
772
|
+
const kind = profile.symbolNodes[node.type];
|
|
773
|
+
if (kind) {
|
|
774
|
+
const name = getDeclarationName(node);
|
|
775
|
+
if (name) {
|
|
776
|
+
const exported = detectExport(node, name, profile.exportDetection);
|
|
777
|
+
symbols.push({ name, kind, exported, line: node.startPosition.row + 1 });
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
return symbols;
|
|
782
|
+
}
|
|
783
|
+
function extractDependenciesGeneric(root, profile) {
|
|
784
|
+
const deps = [];
|
|
785
|
+
walkTopLevel(root, (node) => {
|
|
786
|
+
if (profile.importNodes.includes(node.type)) {
|
|
787
|
+
deps.push(...profile.extractImport(node));
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
return deps;
|
|
791
|
+
}
|
|
792
|
+
function walkTopLevel(root, callback) {
|
|
793
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
794
|
+
const node = root.child(i);
|
|
795
|
+
if (node)
|
|
796
|
+
callback(node);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function detectExport(node, name, detection) {
|
|
800
|
+
switch (detection) {
|
|
801
|
+
case 'convention':
|
|
802
|
+
// Go: uppercase first letter = exported; C/C++/Ruby/Bash: treat all as exported
|
|
803
|
+
return name.length > 0 && name[0] === name[0].toUpperCase() && name[0] !== name[0].toLowerCase();
|
|
804
|
+
case 'keyword': {
|
|
805
|
+
// Rust: check for 'pub' keyword
|
|
806
|
+
const nodeText = node.text;
|
|
807
|
+
return nodeText.startsWith('pub ') || nodeText.startsWith('pub(');
|
|
808
|
+
}
|
|
809
|
+
case 'visibility': {
|
|
810
|
+
// Java: check for 'public' modifier
|
|
811
|
+
const nodeText = node.text;
|
|
812
|
+
return nodeText.includes('public ');
|
|
813
|
+
}
|
|
814
|
+
default:
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
//# sourceMappingURL=codebase-ast.js.map
|