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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Improvement Protocol
|
|
3
|
+
*
|
|
4
|
+
* Diagnoses tool call failures, proposes description improvements,
|
|
5
|
+
* and connects to the existing FailureTracker and LearningStore
|
|
6
|
+
* for cross-session persistence.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Tool failure diagnosis (why did this fail?)
|
|
10
|
+
* - Improved arguments suggestion (how to fix the call)
|
|
11
|
+
* - Tool description improvements (better docs for the LLM)
|
|
12
|
+
* - Success pattern tracking
|
|
13
|
+
*/
|
|
14
|
+
import type { LearningStore } from './learning-store.js';
|
|
15
|
+
export interface ToolCallDiagnosis {
|
|
16
|
+
/** Tool that was called */
|
|
17
|
+
toolName: string;
|
|
18
|
+
/** Original arguments that failed */
|
|
19
|
+
originalArgs: Record<string, unknown>;
|
|
20
|
+
/** The error message */
|
|
21
|
+
error: string;
|
|
22
|
+
/** Why it failed */
|
|
23
|
+
diagnosis: string;
|
|
24
|
+
/** How to fix the call */
|
|
25
|
+
suggestedFix: string;
|
|
26
|
+
/** Fixed arguments (if determinable) */
|
|
27
|
+
improvedArgs?: Record<string, unknown>;
|
|
28
|
+
/** Better tool description (if applicable) */
|
|
29
|
+
descriptionImprovement?: string;
|
|
30
|
+
/** Error category */
|
|
31
|
+
category: FailureCategory;
|
|
32
|
+
}
|
|
33
|
+
export type FailureCategory = 'wrong_args' | 'missing_args' | 'file_not_found' | 'permission' | 'timeout' | 'syntax_error' | 'state_error' | 'unknown';
|
|
34
|
+
export interface SelfImprovementConfig {
|
|
35
|
+
/** Enable tool call diagnosis (default: true) */
|
|
36
|
+
enableDiagnosis: boolean;
|
|
37
|
+
/** Enable description improvement proposals (default: false) */
|
|
38
|
+
enableDescriptionImprovement: boolean;
|
|
39
|
+
/** Maximum diagnoses to cache (default: 50) */
|
|
40
|
+
maxDiagnosisCache: number;
|
|
41
|
+
}
|
|
42
|
+
export interface SuccessPattern {
|
|
43
|
+
toolName: string;
|
|
44
|
+
argPattern: Record<string, string>;
|
|
45
|
+
context: string;
|
|
46
|
+
count: number;
|
|
47
|
+
}
|
|
48
|
+
export declare class SelfImprovementProtocol {
|
|
49
|
+
private config;
|
|
50
|
+
private learningStore;
|
|
51
|
+
private diagnosisCache;
|
|
52
|
+
private successPatterns;
|
|
53
|
+
private failureCounts;
|
|
54
|
+
constructor(config?: Partial<SelfImprovementConfig>, learningStore?: LearningStore | null);
|
|
55
|
+
/**
|
|
56
|
+
* Diagnose why a tool call failed.
|
|
57
|
+
* Uses error pattern matching for fast diagnosis.
|
|
58
|
+
*/
|
|
59
|
+
diagnoseToolFailure(toolName: string, args: Record<string, unknown>, error: string, _toolDescription?: string): ToolCallDiagnosis;
|
|
60
|
+
/**
|
|
61
|
+
* Record a successful tool call pattern.
|
|
62
|
+
*/
|
|
63
|
+
recordSuccess(toolName: string, args: Record<string, unknown>, context: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get failure count for a tool.
|
|
66
|
+
*/
|
|
67
|
+
getFailureCount(toolName: string): number;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a tool has been failing repeatedly (3+ times).
|
|
70
|
+
*/
|
|
71
|
+
isRepeatedlyFailing(toolName: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Get a diagnosis-enhanced error message for the LLM.
|
|
74
|
+
* Includes the diagnosis and suggested fix alongside the error.
|
|
75
|
+
*/
|
|
76
|
+
enhanceErrorMessage(toolName: string, error: string, args: Record<string, unknown>): string;
|
|
77
|
+
/**
|
|
78
|
+
* Get success patterns for a tool (useful for prompt context).
|
|
79
|
+
*/
|
|
80
|
+
getSuccessPatterns(toolName: string): SuccessPattern[];
|
|
81
|
+
/**
|
|
82
|
+
* Persist a failure learning to the learning store.
|
|
83
|
+
*/
|
|
84
|
+
private persistFailureLearning;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a self-improvement protocol.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createSelfImprovementProtocol(config?: Partial<SelfImprovementConfig>, learningStore?: LearningStore | null): SelfImprovementProtocol;
|
|
90
|
+
//# sourceMappingURL=self-improvement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-improvement.d.ts","sourceRoot":"","sources":["../../../../src/integrations/quality/self-improvement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,8CAA8C;IAC9C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,qBAAqB;IACrB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,SAAS,GACT,cAAc,GACd,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,eAAe,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,4BAA4B,EAAE,OAAO,CAAC;IACtC,+CAA+C;IAC/C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM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 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Improvement Protocol
|
|
3
|
+
*
|
|
4
|
+
* Diagnoses tool call failures, proposes description improvements,
|
|
5
|
+
* and connects to the existing FailureTracker and LearningStore
|
|
6
|
+
* for cross-session persistence.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Tool failure diagnosis (why did this fail?)
|
|
10
|
+
* - Improved arguments suggestion (how to fix the call)
|
|
11
|
+
* - Tool description improvements (better docs for the LLM)
|
|
12
|
+
* - Success pattern tracking
|
|
13
|
+
*/
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// CONSTANTS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
const DEFAULT_CONFIG = {
|
|
18
|
+
enableDiagnosis: true,
|
|
19
|
+
enableDescriptionImprovement: false,
|
|
20
|
+
maxDiagnosisCache: 50,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Common error patterns and their diagnoses.
|
|
24
|
+
*/
|
|
25
|
+
const ERROR_PATTERNS = [
|
|
26
|
+
{
|
|
27
|
+
pattern: /ENOENT|no such file|file not found|does not exist/i,
|
|
28
|
+
category: 'file_not_found',
|
|
29
|
+
diagnosis: 'The target file or directory does not exist',
|
|
30
|
+
fix: 'Use glob or list_files to verify the path before accessing it',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
pattern: /EACCES|permission denied|not permitted/i,
|
|
34
|
+
category: 'permission',
|
|
35
|
+
diagnosis: 'Insufficient permissions to perform this operation',
|
|
36
|
+
fix: 'Check file permissions or try a different approach',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
pattern: /timeout|timed out|ETIMEDOUT/i,
|
|
40
|
+
category: 'timeout',
|
|
41
|
+
diagnosis: 'The operation timed out',
|
|
42
|
+
fix: 'Try with a shorter command or increase timeout',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pattern: /syntax error|unexpected token|parse error/i,
|
|
46
|
+
category: 'syntax_error',
|
|
47
|
+
diagnosis: 'The command or arguments contain a syntax error',
|
|
48
|
+
fix: 'Check command syntax and argument formatting',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
pattern: /required|missing|undefined is not/i,
|
|
52
|
+
category: 'missing_args',
|
|
53
|
+
diagnosis: 'One or more required arguments were not provided',
|
|
54
|
+
fix: 'Review the tool schema and provide all required arguments',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
pattern: /invalid|not a valid|type error|expected.*got/i,
|
|
58
|
+
category: 'wrong_args',
|
|
59
|
+
diagnosis: 'The arguments were of the wrong type or format',
|
|
60
|
+
fix: 'Check the argument types against the tool schema',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
pattern: /not found in file|no match|unique match/i,
|
|
64
|
+
category: 'state_error',
|
|
65
|
+
diagnosis: 'The expected content was not found (file may have changed)',
|
|
66
|
+
fix: 'Re-read the file to get current content before editing',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
pattern: /not in.*allowlist|Command.*blocked/i,
|
|
70
|
+
category: 'permission',
|
|
71
|
+
diagnosis: 'The command is not in the sandbox allowlist',
|
|
72
|
+
fix: 'Use built-in tools instead: read_file, write_file, edit_file, glob, grep. These bypass the sandbox allowlist.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
pattern: /Expected string, received (array|object)/i,
|
|
76
|
+
category: 'wrong_args',
|
|
77
|
+
diagnosis: 'The content argument must be a single string, not an array or object',
|
|
78
|
+
fix: 'content must be a single string. Join lines with newlines (\\n), not an array of strings.',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// PROTOCOL
|
|
83
|
+
// =============================================================================
|
|
84
|
+
export class SelfImprovementProtocol {
|
|
85
|
+
config;
|
|
86
|
+
learningStore;
|
|
87
|
+
diagnosisCache = new Map();
|
|
88
|
+
successPatterns = new Map();
|
|
89
|
+
failureCounts = new Map();
|
|
90
|
+
constructor(config, learningStore) {
|
|
91
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
92
|
+
this.learningStore = learningStore ?? null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Diagnose why a tool call failed.
|
|
96
|
+
* Uses error pattern matching for fast diagnosis.
|
|
97
|
+
*/
|
|
98
|
+
diagnoseToolFailure(toolName, args, error, _toolDescription) {
|
|
99
|
+
// Track failure count
|
|
100
|
+
const failKey = toolName;
|
|
101
|
+
const count = (this.failureCounts.get(failKey) ?? 0) + 1;
|
|
102
|
+
this.failureCounts.set(failKey, count);
|
|
103
|
+
// Match against known patterns
|
|
104
|
+
let category = 'unknown';
|
|
105
|
+
let diagnosis = 'Unable to determine the exact cause of failure';
|
|
106
|
+
let suggestedFix = 'Try a different approach or tool';
|
|
107
|
+
for (const pattern of ERROR_PATTERNS) {
|
|
108
|
+
if (pattern.pattern.test(error)) {
|
|
109
|
+
category = pattern.category;
|
|
110
|
+
diagnosis = pattern.diagnosis;
|
|
111
|
+
suggestedFix = pattern.fix;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Build improved args for specific categories
|
|
116
|
+
let improvedArgs;
|
|
117
|
+
if (category === 'file_not_found' && args.path) {
|
|
118
|
+
// Suggest using glob to find the file
|
|
119
|
+
suggestedFix = `File "${args.path}" not found. Use glob to search for similar files.`;
|
|
120
|
+
}
|
|
121
|
+
if (category === 'state_error' && toolName === 'edit_file') {
|
|
122
|
+
suggestedFix = 'Re-read the file to get current content, then retry the edit.';
|
|
123
|
+
}
|
|
124
|
+
const result = {
|
|
125
|
+
toolName,
|
|
126
|
+
originalArgs: args,
|
|
127
|
+
error,
|
|
128
|
+
diagnosis,
|
|
129
|
+
suggestedFix,
|
|
130
|
+
improvedArgs,
|
|
131
|
+
category,
|
|
132
|
+
};
|
|
133
|
+
// Cache the diagnosis
|
|
134
|
+
const cacheKey = `${toolName}:${error.slice(0, 100)}`;
|
|
135
|
+
this.diagnosisCache.set(cacheKey, result);
|
|
136
|
+
if (this.diagnosisCache.size > this.config.maxDiagnosisCache) {
|
|
137
|
+
// Remove oldest entries
|
|
138
|
+
const keys = [...this.diagnosisCache.keys()];
|
|
139
|
+
for (let i = 0; i < 10; i++) {
|
|
140
|
+
this.diagnosisCache.delete(keys[i]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Persist to learning store for cross-session learning
|
|
144
|
+
if (this.learningStore && count >= 3) {
|
|
145
|
+
this.persistFailureLearning(toolName, diagnosis, suggestedFix);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Record a successful tool call pattern.
|
|
151
|
+
*/
|
|
152
|
+
recordSuccess(toolName, args, context) {
|
|
153
|
+
const key = `${toolName}:${Object.keys(args).sort().join(',')}`;
|
|
154
|
+
const existing = this.successPatterns.get(key);
|
|
155
|
+
if (existing) {
|
|
156
|
+
existing.count++;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.successPatterns.set(key, {
|
|
160
|
+
toolName,
|
|
161
|
+
argPattern: Object.fromEntries(Object.entries(args).map(([k, v]) => [k, typeof v])),
|
|
162
|
+
context,
|
|
163
|
+
count: 1,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Reset failure count on success
|
|
167
|
+
this.failureCounts.set(toolName, 0);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get failure count for a tool.
|
|
171
|
+
*/
|
|
172
|
+
getFailureCount(toolName) {
|
|
173
|
+
return this.failureCounts.get(toolName) ?? 0;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check if a tool has been failing repeatedly (3+ times).
|
|
177
|
+
*/
|
|
178
|
+
isRepeatedlyFailing(toolName) {
|
|
179
|
+
return (this.failureCounts.get(toolName) ?? 0) >= 3;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get a diagnosis-enhanced error message for the LLM.
|
|
183
|
+
* Includes the diagnosis and suggested fix alongside the error.
|
|
184
|
+
*/
|
|
185
|
+
enhanceErrorMessage(toolName, error, args) {
|
|
186
|
+
if (!this.config.enableDiagnosis)
|
|
187
|
+
return error;
|
|
188
|
+
const diagnosis = this.diagnoseToolFailure(toolName, args, error);
|
|
189
|
+
const parts = [error];
|
|
190
|
+
if (diagnosis.diagnosis !== 'Unable to determine the exact cause of failure') {
|
|
191
|
+
parts.push(`\n[Diagnosis: ${diagnosis.diagnosis}]`);
|
|
192
|
+
parts.push(`[Suggested fix: ${diagnosis.suggestedFix}]`);
|
|
193
|
+
}
|
|
194
|
+
if (this.isRepeatedlyFailing(toolName)) {
|
|
195
|
+
parts.push(`\n[Warning: "${toolName}" has failed ${this.getFailureCount(toolName)} times. Consider using a different tool or approach.]`);
|
|
196
|
+
}
|
|
197
|
+
return parts.join('');
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get success patterns for a tool (useful for prompt context).
|
|
201
|
+
*/
|
|
202
|
+
getSuccessPatterns(toolName) {
|
|
203
|
+
return [...this.successPatterns.values()].filter(p => p.toolName === toolName);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Persist a failure learning to the learning store.
|
|
207
|
+
*/
|
|
208
|
+
persistFailureLearning(toolName, diagnosis, fix) {
|
|
209
|
+
try {
|
|
210
|
+
this.learningStore?.proposeLearning({
|
|
211
|
+
type: 'best_practice',
|
|
212
|
+
description: `Tool "${toolName}" failure pattern: ${diagnosis}`,
|
|
213
|
+
details: `Fix: ${fix}`,
|
|
214
|
+
categories: ['runtime'],
|
|
215
|
+
actions: [toolName],
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// Learning store errors are not critical
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Create a self-improvement protocol.
|
|
225
|
+
*/
|
|
226
|
+
export function createSelfImprovementProtocol(config, learningStore) {
|
|
227
|
+
return new SelfImprovementProtocol(config, learningStore);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=self-improvement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-improvement.js","sourceRoot":"","sources":["../../../../src/integrations/quality/self-improvement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsDH,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,cAAc,GAA0B;IAC5C,eAAe,EAAE,IAAI;IACrB,4BAA4B,EAAE,KAAK;IACnC,iBAAiB,EAAE,EAAE;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAKf;IACH;QACE,OAAO,EAAE,oDAAoD;QAC7D,QAAQ,EAAE,gBAAgB;QAC1B,SAAS,EAAE,6CAA6C;QACxD,GAAG,EAAE,+DAA+D;KACrE;IACD;QACE,OAAO,EAAE,yCAAyC;QAClD,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,oDAAoD;QAC/D,GAAG,EAAE,oDAAoD;KAC1D;IACD;QACE,OAAO,EAAE,8BAA8B;QACvC,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,yBAAyB;QACpC,GAAG,EAAE,gDAAgD;KACtD;IACD;QACE,OAAO,EAAE,4CAA4C;QACrD,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,iDAAiD;QAC5D,GAAG,EAAE,8CAA8C;KACpD;IACD;QACE,OAAO,EAAE,oCAAoC;QAC7C,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,kDAAkD;QAC7D,GAAG,EAAE,2DAA2D;KACjE;IACD;QACE,OAAO,EAAE,+CAA+C;QACxD,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,gDAAgD;QAC3D,GAAG,EAAE,kDAAkD;KACxD;IACD;QACE,OAAO,EAAE,0CAA0C;QACnD,QAAQ,EAAE,aAAa;QACvB,SAAS,EAAE,4DAA4D;QACvE,GAAG,EAAE,wDAAwD;KAC9D;I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E,CAAC,SAAoC,CAAC;gBAClD,OAAO,EAAE,CAAC,QAAQ,CAAC;aACpB,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;QAC3C,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAuC,EACvC,aAAoC;IAEpC,OAAO,IAAI,uBAAuB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Recommendation Engine
|
|
3
|
+
*
|
|
4
|
+
* Heuristic-based tool recommendation for subagents and swarm workers.
|
|
5
|
+
* Maps task types to tool categories and analyzes task descriptions
|
|
6
|
+
* for tool-relevant keywords.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Static task-type → tool-category mappings (no LLM call needed)
|
|
10
|
+
* - Keyword analysis for MCP tool preloading
|
|
11
|
+
* - Tool filtering for subagent specialization
|
|
12
|
+
* - Custom task types fall back to a known type's tools based on capability
|
|
13
|
+
*/
|
|
14
|
+
import type { WorkerCapability } from '../swarm/types.js';
|
|
15
|
+
export interface ToolRecommendation {
|
|
16
|
+
toolName: string;
|
|
17
|
+
relevanceScore: number;
|
|
18
|
+
reason: string;
|
|
19
|
+
source: 'builtin' | 'mcp';
|
|
20
|
+
}
|
|
21
|
+
export interface ToolRecommendationConfig {
|
|
22
|
+
/** Maximum tools to recommend per agent (default: 15) */
|
|
23
|
+
maxToolsPerAgent?: number;
|
|
24
|
+
/** Enable MCP tool preloading for known patterns (default: true) */
|
|
25
|
+
enablePreloading?: boolean;
|
|
26
|
+
/** Task-type to tool mapping overrides */
|
|
27
|
+
taskToolOverrides?: Record<string, string[]>;
|
|
28
|
+
}
|
|
29
|
+
export interface ToolCategory {
|
|
30
|
+
name: string;
|
|
31
|
+
tools: string[];
|
|
32
|
+
relevance: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class ToolRecommendationEngine {
|
|
35
|
+
private config;
|
|
36
|
+
constructor(config?: ToolRecommendationConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Recommend tools for a task based on type and description.
|
|
39
|
+
* Custom task types not in TASK_TYPE_TOOL_MAP fall back to a known type
|
|
40
|
+
* based on the custom type's capability (via TaskTypeConfig).
|
|
41
|
+
*/
|
|
42
|
+
recommendTools(taskDescription: string, taskType: string, availableToolNames: string[], capability?: WorkerCapability): ToolRecommendation[];
|
|
43
|
+
/**
|
|
44
|
+
* Get MCP tool prefixes that should be preloaded for a task type.
|
|
45
|
+
*/
|
|
46
|
+
getMCPPreloadPrefixes(taskDescription: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Filter tools for an agent based on task type.
|
|
49
|
+
* Returns tool names that should be available to the agent.
|
|
50
|
+
*/
|
|
51
|
+
getToolFilterForTaskType(taskType: string, availableToolNames: string[]): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Infer a SubtaskType from an agent name.
|
|
54
|
+
*/
|
|
55
|
+
static inferTaskType(agentName: string): string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a tool recommendation engine with optional config.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createToolRecommendationEngine(config?: ToolRecommendationConfig): ToolRecommendationEngine;
|
|
61
|
+
//# sourceMappingURL=tool-recommendation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-recommendation.d.ts","sourceRoot":"","sources":["../../../../src/integrations/quality/tool-recommendation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,KAAK,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AA0HD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAqC;gBAEvC,MAAM,CAAC,EAAE,wBAAwB;IAQ7C;;;;OAIG;IACH,cAAc,CACZ,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,MAAM,EAAE,EAC5B,UAAU,CAAC,EAAE,gBAAgB,GAC5B,kBAAkB,EAAE;IAoEvB;;OAEG;IACH,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE;IAgBxD;;;OAGG;IACH,wBAAwB,CACtB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,MAAM,EAAE,GAC3B,MAAM,EAAE;IAKX;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAmChD;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,CAAC,EAAE,wBAAwB,GAChC,wBAAwB,CAE1B"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Recommendation Engine
|
|
3
|
+
*
|
|
4
|
+
* Heuristic-based tool recommendation for subagents and swarm workers.
|
|
5
|
+
* Maps task types to tool categories and analyzes task descriptions
|
|
6
|
+
* for tool-relevant keywords.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Static task-type → tool-category mappings (no LLM call needed)
|
|
10
|
+
* - Keyword analysis for MCP tool preloading
|
|
11
|
+
* - Tool filtering for subagent specialization
|
|
12
|
+
* - Custom task types fall back to a known type's tools based on capability
|
|
13
|
+
*/
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// CONSTANTS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Static mapping from subtask types to tool categories.
|
|
19
|
+
* Core heuristic: task type determines which tools are most useful.
|
|
20
|
+
*/
|
|
21
|
+
const TASK_TYPE_TOOL_MAP = {
|
|
22
|
+
research: [
|
|
23
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files', 'search_files', 'search_code', 'get_file_info'], relevance: 1.0 },
|
|
24
|
+
{ name: 'web', tools: ['web_search'], relevance: 0.8 },
|
|
25
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 0.6 },
|
|
26
|
+
{ name: 'bash_readonly', tools: ['bash'], relevance: 0.5 },
|
|
27
|
+
{ name: 'task_coordination', tools: ['task_get', 'task_list'], relevance: 0.3 },
|
|
28
|
+
],
|
|
29
|
+
analysis: [
|
|
30
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files', 'search_files', 'search_code'], relevance: 1.0 },
|
|
31
|
+
{ name: 'bash_readonly', tools: ['bash'], relevance: 0.6 },
|
|
32
|
+
{ name: 'web', tools: ['web_search'], relevance: 0.5 },
|
|
33
|
+
],
|
|
34
|
+
design: [
|
|
35
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files'], relevance: 0.9 },
|
|
36
|
+
{ name: 'file_writing', tools: ['write_file'], relevance: 0.4 },
|
|
37
|
+
],
|
|
38
|
+
implement: [
|
|
39
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files'], relevance: 0.8 },
|
|
40
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 1.0 },
|
|
41
|
+
{ name: 'execution', tools: ['bash'], relevance: 0.7 },
|
|
42
|
+
{ name: 'task_coordination', tools: ['task_create', 'task_update', 'task_get', 'task_list'], relevance: 0.3 },
|
|
43
|
+
],
|
|
44
|
+
test: [
|
|
45
|
+
{ name: 'execution', tools: ['bash'], relevance: 1.0 },
|
|
46
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep'], relevance: 0.7 },
|
|
47
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 0.5 },
|
|
48
|
+
],
|
|
49
|
+
refactor: [
|
|
50
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files', 'search_code'], relevance: 0.9 },
|
|
51
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 1.0 },
|
|
52
|
+
{ name: 'execution', tools: ['bash'], relevance: 0.5 },
|
|
53
|
+
],
|
|
54
|
+
review: [
|
|
55
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep', 'list_files', 'search_files'], relevance: 1.0 },
|
|
56
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 0.4 },
|
|
57
|
+
{ name: 'bash_readonly', tools: ['bash'], relevance: 0.3 },
|
|
58
|
+
],
|
|
59
|
+
document: [
|
|
60
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep'], relevance: 0.8 },
|
|
61
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 1.0 },
|
|
62
|
+
],
|
|
63
|
+
integrate: [
|
|
64
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep'], relevance: 0.8 },
|
|
65
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 0.9 },
|
|
66
|
+
{ name: 'execution', tools: ['bash'], relevance: 0.8 },
|
|
67
|
+
],
|
|
68
|
+
deploy: [
|
|
69
|
+
{ name: 'execution', tools: ['bash'], relevance: 1.0 },
|
|
70
|
+
{ name: 'file_reading', tools: ['read_file', 'glob'], relevance: 0.5 },
|
|
71
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 0.4 },
|
|
72
|
+
],
|
|
73
|
+
merge: [
|
|
74
|
+
{ name: 'file_reading', tools: ['read_file', 'glob', 'grep'], relevance: 0.9 },
|
|
75
|
+
{ name: 'file_writing', tools: ['write_file', 'edit_file'], relevance: 1.0 },
|
|
76
|
+
{ name: 'execution', tools: ['bash'], relevance: 0.5 },
|
|
77
|
+
{ name: 'task_coordination', tools: ['task_get', 'task_list'], relevance: 0.3 },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Map a WorkerCapability to the closest built-in task type for tool recommendations.
|
|
82
|
+
* Used as a fallback when a custom task type isn't in TASK_TYPE_TOOL_MAP.
|
|
83
|
+
*/
|
|
84
|
+
const CAPABILITY_TO_TOOL_MAP_KEY = {
|
|
85
|
+
code: 'implement',
|
|
86
|
+
research: 'research',
|
|
87
|
+
review: 'review',
|
|
88
|
+
test: 'test',
|
|
89
|
+
document: 'document',
|
|
90
|
+
write: 'merge',
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Keyword patterns that suggest specific MCP tools.
|
|
94
|
+
*/
|
|
95
|
+
const MCP_KEYWORD_PATTERNS = [
|
|
96
|
+
{
|
|
97
|
+
keywords: ['browser', 'screenshot', 'click', 'navigate', 'page', 'web page', 'UI test'],
|
|
98
|
+
mcpPrefix: 'mcp_playwright',
|
|
99
|
+
description: 'Playwright browser automation',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
keywords: ['database', 'sql', 'query', 'table', 'schema'],
|
|
103
|
+
mcpPrefix: 'mcp_sqlite',
|
|
104
|
+
description: 'SQLite database operations',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
keywords: ['documentation', 'library docs', 'api docs', 'npm package'],
|
|
108
|
+
mcpPrefix: 'mcp_context7',
|
|
109
|
+
description: 'Context7 documentation lookup',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
keywords: ['web search', 'google', 'search online', 'look up'],
|
|
113
|
+
mcpPrefix: 'mcp_serper',
|
|
114
|
+
description: 'Web search via Serper',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
keywords: ['github', 'pull request', 'issue', 'repository'],
|
|
118
|
+
mcpPrefix: 'mcp_github',
|
|
119
|
+
description: 'GitHub API operations',
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
// =============================================================================
|
|
123
|
+
// ENGINE
|
|
124
|
+
// =============================================================================
|
|
125
|
+
export class ToolRecommendationEngine {
|
|
126
|
+
config;
|
|
127
|
+
constructor(config) {
|
|
128
|
+
this.config = {
|
|
129
|
+
maxToolsPerAgent: config?.maxToolsPerAgent ?? 15,
|
|
130
|
+
enablePreloading: config?.enablePreloading ?? true,
|
|
131
|
+
taskToolOverrides: config?.taskToolOverrides ?? {},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Recommend tools for a task based on type and description.
|
|
136
|
+
* Custom task types not in TASK_TYPE_TOOL_MAP fall back to a known type
|
|
137
|
+
* based on the custom type's capability (via TaskTypeConfig).
|
|
138
|
+
*/
|
|
139
|
+
recommendTools(taskDescription, taskType, availableToolNames, capability) {
|
|
140
|
+
const recommendations = new Map();
|
|
141
|
+
const availableSet = new Set(availableToolNames);
|
|
142
|
+
// Phase 1: Task-type based recommendations
|
|
143
|
+
// For custom types not in the map, fall back to a known type via capability
|
|
144
|
+
let categories;
|
|
145
|
+
if (this.config.taskToolOverrides[taskType]) {
|
|
146
|
+
categories = [{ name: 'override', tools: this.config.taskToolOverrides[taskType], relevance: 1.0 }];
|
|
147
|
+
}
|
|
148
|
+
else if (TASK_TYPE_TOOL_MAP[taskType]) {
|
|
149
|
+
categories = TASK_TYPE_TOOL_MAP[taskType];
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Custom type fallback: use capability to find closest built-in tool map
|
|
153
|
+
const fallbackType = capability
|
|
154
|
+
? CAPABILITY_TO_TOOL_MAP_KEY[capability] ?? 'implement'
|
|
155
|
+
: 'implement';
|
|
156
|
+
categories = TASK_TYPE_TOOL_MAP[fallbackType] ?? [];
|
|
157
|
+
}
|
|
158
|
+
for (const category of categories) {
|
|
159
|
+
for (const toolName of category.tools) {
|
|
160
|
+
if (availableSet.has(toolName) && !recommendations.has(toolName)) {
|
|
161
|
+
recommendations.set(toolName, {
|
|
162
|
+
toolName,
|
|
163
|
+
relevanceScore: category.relevance,
|
|
164
|
+
reason: `${category.name} tool for ${taskType} tasks`,
|
|
165
|
+
source: 'builtin',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Phase 2: Keyword-based MCP tool recommendations
|
|
171
|
+
const taskLower = taskDescription.toLowerCase();
|
|
172
|
+
for (const pattern of MCP_KEYWORD_PATTERNS) {
|
|
173
|
+
const matchCount = pattern.keywords.filter(kw => taskLower.includes(kw)).length;
|
|
174
|
+
if (matchCount > 0) {
|
|
175
|
+
// Find available MCP tools matching the prefix
|
|
176
|
+
for (const toolName of availableToolNames) {
|
|
177
|
+
if (toolName.startsWith(pattern.mcpPrefix) && !recommendations.has(toolName)) {
|
|
178
|
+
const relevance = Math.min(0.5 + matchCount * 0.15, 1.0);
|
|
179
|
+
recommendations.set(toolName, {
|
|
180
|
+
toolName,
|
|
181
|
+
relevanceScore: relevance,
|
|
182
|
+
reason: `${pattern.description} (matched: ${matchCount} keywords)`,
|
|
183
|
+
source: 'mcp',
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Phase 3: Always include spawn_agent for complex tasks
|
|
190
|
+
if (availableSet.has('spawn_agent') && !recommendations.has('spawn_agent')) {
|
|
191
|
+
recommendations.set('spawn_agent', {
|
|
192
|
+
toolName: 'spawn_agent',
|
|
193
|
+
relevanceScore: 0.3,
|
|
194
|
+
reason: 'Available for delegation',
|
|
195
|
+
source: 'builtin',
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// Sort by relevance and limit
|
|
199
|
+
return [...recommendations.values()]
|
|
200
|
+
.sort((a, b) => b.relevanceScore - a.relevanceScore)
|
|
201
|
+
.slice(0, this.config.maxToolsPerAgent);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get MCP tool prefixes that should be preloaded for a task type.
|
|
205
|
+
*/
|
|
206
|
+
getMCPPreloadPrefixes(taskDescription) {
|
|
207
|
+
if (!this.config.enablePreloading)
|
|
208
|
+
return [];
|
|
209
|
+
const taskLower = taskDescription.toLowerCase();
|
|
210
|
+
const prefixes = [];
|
|
211
|
+
for (const pattern of MCP_KEYWORD_PATTERNS) {
|
|
212
|
+
const matches = pattern.keywords.filter(kw => taskLower.includes(kw));
|
|
213
|
+
if (matches.length > 0) {
|
|
214
|
+
prefixes.push(pattern.mcpPrefix);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return prefixes;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Filter tools for an agent based on task type.
|
|
221
|
+
* Returns tool names that should be available to the agent.
|
|
222
|
+
*/
|
|
223
|
+
getToolFilterForTaskType(taskType, availableToolNames) {
|
|
224
|
+
const recommendations = this.recommendTools('', taskType, availableToolNames);
|
|
225
|
+
return recommendations.map(r => r.toolName);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Infer a SubtaskType from an agent name.
|
|
229
|
+
*/
|
|
230
|
+
static inferTaskType(agentName) {
|
|
231
|
+
const nameToType = {
|
|
232
|
+
researcher: 'research',
|
|
233
|
+
coder: 'implement',
|
|
234
|
+
reviewer: 'review',
|
|
235
|
+
architect: 'design',
|
|
236
|
+
debugger: 'analysis',
|
|
237
|
+
tester: 'test',
|
|
238
|
+
documenter: 'document',
|
|
239
|
+
synthesizer: 'merge',
|
|
240
|
+
writer: 'document',
|
|
241
|
+
merger: 'merge',
|
|
242
|
+
};
|
|
243
|
+
const lower = agentName.toLowerCase();
|
|
244
|
+
if (nameToType[lower]) {
|
|
245
|
+
return nameToType[lower];
|
|
246
|
+
}
|
|
247
|
+
// Dynamic swarm names like "swarm-coder-task-1" should resolve by role token.
|
|
248
|
+
const tokens = lower.split(/[^a-z0-9]+/).filter(Boolean);
|
|
249
|
+
for (const token of tokens) {
|
|
250
|
+
if (nameToType[token]) {
|
|
251
|
+
return nameToType[token];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// For swarm workers, default to implementation rather than research so
|
|
255
|
+
// write-capable profiles are selected unless explicitly constrained.
|
|
256
|
+
if (lower.startsWith('swarm-')) {
|
|
257
|
+
return 'implement';
|
|
258
|
+
}
|
|
259
|
+
return 'research';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Create a tool recommendation engine with optional config.
|
|
264
|
+
*/
|
|
265
|
+
export function createToolRecommendationEngine(config) {
|
|
266
|
+
return new ToolRecommendationEngine(config);
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=tool-recommendation.js.map
|