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,951 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Synthesizer Integration
|
|
3
|
+
*
|
|
4
|
+
* Structured merging of results from multiple agents.
|
|
5
|
+
* Goes beyond simple consensus to intelligently combine outputs.
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Code merging: Intelligent merge of code changes from multiple agents
|
|
9
|
+
* - Finding synthesis: Combine research findings, deduplicate insights
|
|
10
|
+
* - Conflict detection: Identify contradictions between results
|
|
11
|
+
* - Conflict resolution: Strategies for resolving disagreements
|
|
12
|
+
* - Confidence weighting: Weight results by agent confidence and authority
|
|
13
|
+
*/
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// CONSTANTS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
const DEFAULT_CONFIG = {
|
|
18
|
+
defaultMethod: 'deduplicate',
|
|
19
|
+
conflictResolution: 'choose_highest_confidence',
|
|
20
|
+
deduplicationThreshold: 0.8,
|
|
21
|
+
useLLM: false,
|
|
22
|
+
llmSynthesizer: undefined,
|
|
23
|
+
preferHigherConfidence: true,
|
|
24
|
+
preferHigherAuthority: true,
|
|
25
|
+
};
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// RESULT SYNTHESIZER
|
|
28
|
+
// =============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Synthesizes results from multiple agents into a coherent output.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const synthesizer = createResultSynthesizer();
|
|
35
|
+
*
|
|
36
|
+
* const result = await synthesizer.synthesize([
|
|
37
|
+
* {
|
|
38
|
+
* agentId: 'agent-a',
|
|
39
|
+
* content: 'Found auth logic in src/auth.ts',
|
|
40
|
+
* type: 'research',
|
|
41
|
+
* confidence: 0.9,
|
|
42
|
+
* findings: ['JWT tokens used', 'Session stored in Redis'],
|
|
43
|
+
* },
|
|
44
|
+
* {
|
|
45
|
+
* agentId: 'agent-b',
|
|
46
|
+
* content: 'Auth implemented in src/auth.ts using JWT',
|
|
47
|
+
* type: 'research',
|
|
48
|
+
* confidence: 0.85,
|
|
49
|
+
* findings: ['JWT tokens used', 'Password hashing with bcrypt'],
|
|
50
|
+
* },
|
|
51
|
+
* ]);
|
|
52
|
+
*
|
|
53
|
+
* console.log(result.findings); // Deduplicated findings
|
|
54
|
+
* console.log(result.conflicts); // Any disagreements
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export class ResultSynthesizer {
|
|
58
|
+
config;
|
|
59
|
+
listeners = [];
|
|
60
|
+
conflictCounter = 0;
|
|
61
|
+
constructor(config = {}) {
|
|
62
|
+
this.config = {
|
|
63
|
+
...DEFAULT_CONFIG,
|
|
64
|
+
...config,
|
|
65
|
+
llmSynthesizer: config.llmSynthesizer ?? DEFAULT_CONFIG.llmSynthesizer,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// ===========================================================================
|
|
69
|
+
// SYNTHESIS
|
|
70
|
+
// ===========================================================================
|
|
71
|
+
/**
|
|
72
|
+
* Synthesize multiple agent outputs into a coherent result.
|
|
73
|
+
*/
|
|
74
|
+
async synthesize(outputs) {
|
|
75
|
+
this.emit({ type: 'synthesis.started', outputCount: outputs.length });
|
|
76
|
+
if (outputs.length === 0) {
|
|
77
|
+
return this.createEmptyResult();
|
|
78
|
+
}
|
|
79
|
+
if (outputs.length === 1) {
|
|
80
|
+
return this.createSingleResult(outputs[0]);
|
|
81
|
+
}
|
|
82
|
+
// Detect conflicts
|
|
83
|
+
const conflicts = this.detectConflicts(outputs);
|
|
84
|
+
for (const conflict of conflicts) {
|
|
85
|
+
this.emit({ type: 'conflict.detected', conflict });
|
|
86
|
+
}
|
|
87
|
+
// Determine synthesis method based on output types
|
|
88
|
+
const method = this.determineMethod(outputs);
|
|
89
|
+
let result;
|
|
90
|
+
switch (method) {
|
|
91
|
+
case 'merge_structured':
|
|
92
|
+
result = await this.mergeStructured(outputs, conflicts);
|
|
93
|
+
break;
|
|
94
|
+
case 'synthesize_llm':
|
|
95
|
+
result = await this.synthesizeLLM(outputs, conflicts);
|
|
96
|
+
break;
|
|
97
|
+
case 'majority_vote':
|
|
98
|
+
result = this.majorityVote(outputs, conflicts);
|
|
99
|
+
break;
|
|
100
|
+
case 'deduplicate':
|
|
101
|
+
result = this.deduplicateMerge(outputs, conflicts);
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
result = this.concatenateMerge(outputs, conflicts);
|
|
105
|
+
}
|
|
106
|
+
this.emit({ type: 'synthesis.completed', result });
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Synthesize code changes from multiple agents.
|
|
111
|
+
*/
|
|
112
|
+
async synthesizeCode(outputs) {
|
|
113
|
+
const codeOutputs = outputs.filter((o) => o.type === 'code' || o.filesModified);
|
|
114
|
+
if (codeOutputs.length === 0) {
|
|
115
|
+
return this.createEmptyResult();
|
|
116
|
+
}
|
|
117
|
+
// Collect all file changes
|
|
118
|
+
const changesByFile = new Map();
|
|
119
|
+
for (const output of codeOutputs) {
|
|
120
|
+
for (const change of output.filesModified ?? []) {
|
|
121
|
+
if (!changesByFile.has(change.path)) {
|
|
122
|
+
changesByFile.set(change.path, []);
|
|
123
|
+
}
|
|
124
|
+
changesByFile.get(change.path).push(change);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Merge changes per file
|
|
128
|
+
const mergedChanges = [];
|
|
129
|
+
const conflicts = [];
|
|
130
|
+
for (const [filePath, changes] of changesByFile) {
|
|
131
|
+
if (changes.length === 1) {
|
|
132
|
+
mergedChanges.push(changes[0]);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const mergeResult = this.mergeFileChanges(filePath, changes, codeOutputs);
|
|
136
|
+
if (mergeResult.merged) {
|
|
137
|
+
mergedChanges.push(mergeResult.merged);
|
|
138
|
+
}
|
|
139
|
+
conflicts.push(...mergeResult.conflicts);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Build output content
|
|
143
|
+
const outputParts = [];
|
|
144
|
+
for (const change of mergedChanges) {
|
|
145
|
+
outputParts.push(`// File: ${change.path}`);
|
|
146
|
+
outputParts.push(change.newContent);
|
|
147
|
+
outputParts.push('');
|
|
148
|
+
}
|
|
149
|
+
const result = {
|
|
150
|
+
output: outputParts.join('\n'),
|
|
151
|
+
type: 'code',
|
|
152
|
+
confidence: this.calculateCombinedConfidence(codeOutputs),
|
|
153
|
+
fileChanges: mergedChanges,
|
|
154
|
+
findings: [],
|
|
155
|
+
conflicts,
|
|
156
|
+
stats: this.calculateStats(codeOutputs, outputParts.join('\n'), conflicts),
|
|
157
|
+
method: 'merge_structured',
|
|
158
|
+
};
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Synthesize research findings from multiple agents.
|
|
163
|
+
*/
|
|
164
|
+
synthesizeFindings(outputs) {
|
|
165
|
+
const allFindings = [];
|
|
166
|
+
for (const output of outputs) {
|
|
167
|
+
for (const finding of output.findings ?? []) {
|
|
168
|
+
allFindings.push({
|
|
169
|
+
finding,
|
|
170
|
+
agentId: output.agentId,
|
|
171
|
+
confidence: output.confidence,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
// Also extract findings from content
|
|
175
|
+
const extracted = this.extractFindingsFromContent(output.content);
|
|
176
|
+
for (const finding of extracted) {
|
|
177
|
+
allFindings.push({
|
|
178
|
+
finding,
|
|
179
|
+
agentId: output.agentId,
|
|
180
|
+
confidence: output.confidence * 0.8, // Lower confidence for extracted
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Deduplicate findings
|
|
185
|
+
const deduplicated = this.deduplicateFindings(allFindings);
|
|
186
|
+
this.emit({
|
|
187
|
+
type: 'deduplication.performed',
|
|
188
|
+
original: allFindings.length,
|
|
189
|
+
deduplicated: deduplicated.length,
|
|
190
|
+
});
|
|
191
|
+
// Build output
|
|
192
|
+
const outputParts = [
|
|
193
|
+
'## Synthesized Findings',
|
|
194
|
+
'',
|
|
195
|
+
...deduplicated.map((f, i) => `${i + 1}. ${f.finding} (confidence: ${(f.confidence * 100).toFixed(0)}%)`),
|
|
196
|
+
];
|
|
197
|
+
// Detect contradictions
|
|
198
|
+
const conflicts = this.detectFindingContradictions(deduplicated);
|
|
199
|
+
return {
|
|
200
|
+
output: outputParts.join('\n'),
|
|
201
|
+
type: 'research',
|
|
202
|
+
confidence: this.calculateCombinedConfidence(outputs),
|
|
203
|
+
fileChanges: [],
|
|
204
|
+
findings: deduplicated.map((f) => f.finding),
|
|
205
|
+
conflicts,
|
|
206
|
+
stats: this.calculateStats(outputs, outputParts.join('\n'), conflicts),
|
|
207
|
+
method: 'deduplicate',
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
// ===========================================================================
|
|
211
|
+
// CONFLICT DETECTION
|
|
212
|
+
// ===========================================================================
|
|
213
|
+
/**
|
|
214
|
+
* Detect conflicts between agent outputs.
|
|
215
|
+
*/
|
|
216
|
+
detectConflicts(outputs) {
|
|
217
|
+
const conflicts = [];
|
|
218
|
+
// Check for code overlaps
|
|
219
|
+
conflicts.push(...this.detectCodeOverlaps(outputs));
|
|
220
|
+
// Check for logic contradictions
|
|
221
|
+
conflicts.push(...this.detectLogicContradictions(outputs));
|
|
222
|
+
// Check for approach mismatches
|
|
223
|
+
conflicts.push(...this.detectApproachMismatches(outputs));
|
|
224
|
+
return conflicts;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Detect overlapping code changes.
|
|
228
|
+
*/
|
|
229
|
+
detectCodeOverlaps(outputs) {
|
|
230
|
+
const conflicts = [];
|
|
231
|
+
const changesByFile = new Map();
|
|
232
|
+
// Collect changes by file
|
|
233
|
+
for (const output of outputs) {
|
|
234
|
+
for (const change of output.filesModified ?? []) {
|
|
235
|
+
if (!changesByFile.has(change.path)) {
|
|
236
|
+
changesByFile.set(change.path, []);
|
|
237
|
+
}
|
|
238
|
+
changesByFile.get(change.path).push({ change, agentId: output.agentId });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Check each file for overlaps
|
|
242
|
+
for (const [filePath, changes] of changesByFile) {
|
|
243
|
+
if (changes.length <= 1)
|
|
244
|
+
continue;
|
|
245
|
+
// Compare each pair
|
|
246
|
+
for (let i = 0; i < changes.length; i++) {
|
|
247
|
+
for (let j = i + 1; j < changes.length; j++) {
|
|
248
|
+
const overlap = this.checkCodeOverlap(changes[i].change, changes[j].change);
|
|
249
|
+
if (overlap) {
|
|
250
|
+
conflicts.push({
|
|
251
|
+
id: `conflict-${++this.conflictCounter}`,
|
|
252
|
+
type: 'code_overlap',
|
|
253
|
+
agentIds: [changes[i].agentId, changes[j].agentId],
|
|
254
|
+
description: `Overlapping changes to ${filePath}`,
|
|
255
|
+
conflictingContent: [changes[i].change.newContent, changes[j].change.newContent],
|
|
256
|
+
severity: 'high',
|
|
257
|
+
filePath,
|
|
258
|
+
lines: overlap.lines,
|
|
259
|
+
suggestedResolution: 'Review both changes and merge manually or choose one',
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return conflicts;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Check if two file changes overlap.
|
|
269
|
+
*/
|
|
270
|
+
checkCodeOverlap(a, b) {
|
|
271
|
+
// Simple line-based overlap detection
|
|
272
|
+
const aLines = new Set(a.newContent.split('\n').map((_, i) => i));
|
|
273
|
+
const bLines = new Set(b.newContent.split('\n').map((_, i) => i));
|
|
274
|
+
// If both modify similar regions, there's an overlap
|
|
275
|
+
if (a.type === 'modify' && b.type === 'modify') {
|
|
276
|
+
// Check for significantly different content
|
|
277
|
+
const similarity = this.calculateSimilarity(a.newContent, b.newContent);
|
|
278
|
+
if (similarity < 0.9) {
|
|
279
|
+
return { lines: Array.from(aLines).filter((l) => bLines.has(l)) };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Detect logic contradictions in findings.
|
|
286
|
+
*/
|
|
287
|
+
detectLogicContradictions(outputs) {
|
|
288
|
+
const conflicts = [];
|
|
289
|
+
// Check for contradicting findings
|
|
290
|
+
for (let i = 0; i < outputs.length; i++) {
|
|
291
|
+
for (let j = i + 1; j < outputs.length; j++) {
|
|
292
|
+
const contradictions = this.findContradictions(outputs[i].content, outputs[j].content);
|
|
293
|
+
for (const contradiction of contradictions) {
|
|
294
|
+
conflicts.push({
|
|
295
|
+
id: `conflict-${++this.conflictCounter}`,
|
|
296
|
+
type: 'logic_contradiction',
|
|
297
|
+
agentIds: [outputs[i].agentId, outputs[j].agentId],
|
|
298
|
+
description: contradiction.description,
|
|
299
|
+
conflictingContent: [contradiction.contentA, contradiction.contentB],
|
|
300
|
+
severity: 'medium',
|
|
301
|
+
suggestedResolution: 'Verify which conclusion is correct',
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return conflicts;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Find contradicting statements between two texts.
|
|
310
|
+
*/
|
|
311
|
+
findContradictions(textA, textB) {
|
|
312
|
+
const contradictions = [];
|
|
313
|
+
// Simple heuristic: look for opposite assertions
|
|
314
|
+
const negationPairs = [
|
|
315
|
+
['is', 'is not'],
|
|
316
|
+
['does', 'does not'],
|
|
317
|
+
['can', 'cannot'],
|
|
318
|
+
['should', 'should not'],
|
|
319
|
+
['will', 'will not'],
|
|
320
|
+
['works', 'does not work'],
|
|
321
|
+
['exists', 'does not exist'],
|
|
322
|
+
['found', 'not found'],
|
|
323
|
+
];
|
|
324
|
+
const sentencesA = textA.split(/[.!?]+/).map((s) => s.trim().toLowerCase());
|
|
325
|
+
const sentencesB = textB.split(/[.!?]+/).map((s) => s.trim().toLowerCase());
|
|
326
|
+
for (const sentA of sentencesA) {
|
|
327
|
+
for (const sentB of sentencesB) {
|
|
328
|
+
for (const [pos, neg] of negationPairs) {
|
|
329
|
+
if ((sentA.includes(pos) && sentB.includes(neg)) ||
|
|
330
|
+
(sentA.includes(neg) && sentB.includes(pos))) {
|
|
331
|
+
// Check if they're about the same thing
|
|
332
|
+
const similarity = this.calculateSimilarity(sentA.replace(pos, '').replace(neg, ''), sentB.replace(pos, '').replace(neg, ''));
|
|
333
|
+
if (similarity > 0.5) {
|
|
334
|
+
contradictions.push({
|
|
335
|
+
description: `Contradiction about: "${sentA.slice(0, 50)}..."`,
|
|
336
|
+
contentA: sentA,
|
|
337
|
+
contentB: sentB,
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return contradictions;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Detect different approaches to the same problem.
|
|
348
|
+
*/
|
|
349
|
+
detectApproachMismatches(outputs) {
|
|
350
|
+
const conflicts = [];
|
|
351
|
+
// Check for significantly different code structures
|
|
352
|
+
const codeOutputs = outputs.filter((o) => o.type === 'code');
|
|
353
|
+
if (codeOutputs.length <= 1)
|
|
354
|
+
return conflicts;
|
|
355
|
+
for (let i = 0; i < codeOutputs.length; i++) {
|
|
356
|
+
for (let j = i + 1; j < codeOutputs.length; j++) {
|
|
357
|
+
const similarity = this.calculateSimilarity(codeOutputs[i].content, codeOutputs[j].content);
|
|
358
|
+
// If outputs are similar in length but very different in content
|
|
359
|
+
const lengthRatio = Math.min(codeOutputs[i].content.length, codeOutputs[j].content.length) / Math.max(codeOutputs[i].content.length, codeOutputs[j].content.length);
|
|
360
|
+
if (lengthRatio > 0.5 && similarity < 0.3) {
|
|
361
|
+
conflicts.push({
|
|
362
|
+
id: `conflict-${++this.conflictCounter}`,
|
|
363
|
+
type: 'approach_mismatch',
|
|
364
|
+
agentIds: [codeOutputs[i].agentId, codeOutputs[j].agentId],
|
|
365
|
+
description: 'Different approaches to the same implementation',
|
|
366
|
+
conflictingContent: [
|
|
367
|
+
codeOutputs[i].content.slice(0, 200),
|
|
368
|
+
codeOutputs[j].content.slice(0, 200),
|
|
369
|
+
],
|
|
370
|
+
severity: 'medium',
|
|
371
|
+
suggestedResolution: 'Review both approaches and select the best one',
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return conflicts;
|
|
377
|
+
}
|
|
378
|
+
// ===========================================================================
|
|
379
|
+
// MERGE STRATEGIES
|
|
380
|
+
// ===========================================================================
|
|
381
|
+
/**
|
|
382
|
+
* Merge with deduplication.
|
|
383
|
+
*/
|
|
384
|
+
deduplicateMerge(outputs, conflicts) {
|
|
385
|
+
// Combine all content
|
|
386
|
+
const allParts = [];
|
|
387
|
+
for (const output of outputs) {
|
|
388
|
+
// Split content into paragraphs/sections
|
|
389
|
+
const parts = output.content.split(/\n\n+/);
|
|
390
|
+
for (const part of parts) {
|
|
391
|
+
if (part.trim().length > 20) {
|
|
392
|
+
allParts.push({ content: part.trim(), confidence: output.confidence });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// Deduplicate
|
|
397
|
+
const deduplicated = [];
|
|
398
|
+
for (const part of allParts) {
|
|
399
|
+
const isDuplicate = deduplicated.some((d) => this.calculateSimilarity(d.content, part.content) > this.config.deduplicationThreshold);
|
|
400
|
+
if (!isDuplicate) {
|
|
401
|
+
deduplicated.push(part);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Sort by confidence
|
|
405
|
+
deduplicated.sort((a, b) => b.confidence - a.confidence);
|
|
406
|
+
const output = deduplicated.map((d) => d.content).join('\n\n');
|
|
407
|
+
return {
|
|
408
|
+
output,
|
|
409
|
+
type: this.determineOutputType(outputs),
|
|
410
|
+
confidence: this.calculateCombinedConfidence(outputs),
|
|
411
|
+
fileChanges: this.mergeAllFileChanges(outputs),
|
|
412
|
+
findings: this.extractAllFindings(outputs),
|
|
413
|
+
conflicts,
|
|
414
|
+
stats: this.calculateStats(outputs, output, conflicts),
|
|
415
|
+
method: 'deduplicate',
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Simple concatenation merge.
|
|
420
|
+
*/
|
|
421
|
+
concatenateMerge(outputs, conflicts) {
|
|
422
|
+
const parts = outputs.map((o) => `## From ${o.agentId}\n\n${o.content}`);
|
|
423
|
+
const output = parts.join('\n\n---\n\n');
|
|
424
|
+
return {
|
|
425
|
+
output,
|
|
426
|
+
type: 'mixed',
|
|
427
|
+
confidence: this.calculateCombinedConfidence(outputs),
|
|
428
|
+
fileChanges: this.mergeAllFileChanges(outputs),
|
|
429
|
+
findings: this.extractAllFindings(outputs),
|
|
430
|
+
conflicts,
|
|
431
|
+
stats: this.calculateStats(outputs, output, conflicts),
|
|
432
|
+
method: 'concatenate',
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Structured merge for code.
|
|
437
|
+
*/
|
|
438
|
+
async mergeStructured(outputs, conflicts) {
|
|
439
|
+
// Resolve conflicts first
|
|
440
|
+
for (const conflict of conflicts) {
|
|
441
|
+
if (!conflict.resolution) {
|
|
442
|
+
conflict.resolution = this.resolveConflict(conflict, outputs);
|
|
443
|
+
this.emit({ type: 'conflict.resolved', conflict });
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// Merge file changes
|
|
447
|
+
const mergedChanges = this.mergeAllFileChanges(outputs);
|
|
448
|
+
// Build output
|
|
449
|
+
const outputParts = [];
|
|
450
|
+
for (const change of mergedChanges) {
|
|
451
|
+
outputParts.push(`// File: ${change.path}`);
|
|
452
|
+
outputParts.push(change.newContent);
|
|
453
|
+
}
|
|
454
|
+
const output = outputParts.join('\n\n');
|
|
455
|
+
return {
|
|
456
|
+
output,
|
|
457
|
+
type: 'code',
|
|
458
|
+
confidence: this.calculateCombinedConfidence(outputs),
|
|
459
|
+
fileChanges: mergedChanges,
|
|
460
|
+
findings: [],
|
|
461
|
+
conflicts,
|
|
462
|
+
stats: this.calculateStats(outputs, output, conflicts),
|
|
463
|
+
method: 'merge_structured',
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* LLM-assisted synthesis.
|
|
468
|
+
*/
|
|
469
|
+
async synthesizeLLM(outputs, conflicts) {
|
|
470
|
+
if (!this.config.llmSynthesizer) {
|
|
471
|
+
return this.deduplicateMerge(outputs, conflicts);
|
|
472
|
+
}
|
|
473
|
+
try {
|
|
474
|
+
const llmResult = await this.config.llmSynthesizer(outputs, conflicts);
|
|
475
|
+
// Apply LLM conflict resolutions
|
|
476
|
+
for (const resolution of llmResult.resolutions) {
|
|
477
|
+
const conflict = conflicts.find((c) => c.id === resolution.conflictId);
|
|
478
|
+
if (conflict && !conflict.resolution) {
|
|
479
|
+
conflict.resolution = {
|
|
480
|
+
strategy: 'llm_decision',
|
|
481
|
+
mergedContent: resolution.resolution,
|
|
482
|
+
explanation: resolution.explanation,
|
|
483
|
+
resolvedAt: new Date(),
|
|
484
|
+
};
|
|
485
|
+
this.emit({ type: 'conflict.resolved', conflict });
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return {
|
|
489
|
+
output: llmResult.content,
|
|
490
|
+
type: this.determineOutputType(outputs),
|
|
491
|
+
confidence: llmResult.confidence,
|
|
492
|
+
fileChanges: this.mergeAllFileChanges(outputs),
|
|
493
|
+
findings: llmResult.findings,
|
|
494
|
+
conflicts,
|
|
495
|
+
stats: this.calculateStats(outputs, llmResult.content, conflicts),
|
|
496
|
+
method: 'synthesize_llm',
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
catch {
|
|
500
|
+
// Fall back to deduplication
|
|
501
|
+
return this.deduplicateMerge(outputs, conflicts);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Majority vote synthesis.
|
|
506
|
+
*/
|
|
507
|
+
majorityVote(outputs, conflicts) {
|
|
508
|
+
// Group similar outputs
|
|
509
|
+
const groups = [];
|
|
510
|
+
for (const output of outputs) {
|
|
511
|
+
let addedToGroup = false;
|
|
512
|
+
for (const group of groups) {
|
|
513
|
+
if (this.calculateSimilarity(output.content, group.representative.content) > 0.7) {
|
|
514
|
+
group.outputs.push(output);
|
|
515
|
+
// Update representative if this one has higher confidence
|
|
516
|
+
if (output.confidence > group.representative.confidence) {
|
|
517
|
+
group.representative = output;
|
|
518
|
+
}
|
|
519
|
+
addedToGroup = true;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (!addedToGroup) {
|
|
524
|
+
groups.push({ outputs: [output], representative: output });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
// Choose the largest group
|
|
528
|
+
groups.sort((a, b) => b.outputs.length - a.outputs.length);
|
|
529
|
+
const winner = groups[0].representative;
|
|
530
|
+
return {
|
|
531
|
+
output: winner.content,
|
|
532
|
+
type: winner.type,
|
|
533
|
+
confidence: winner.confidence * (groups[0].outputs.length / outputs.length),
|
|
534
|
+
fileChanges: winner.filesModified ?? [],
|
|
535
|
+
findings: winner.findings ?? [],
|
|
536
|
+
conflicts,
|
|
537
|
+
stats: this.calculateStats(outputs, winner.content, conflicts),
|
|
538
|
+
method: 'majority_vote',
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
// ===========================================================================
|
|
542
|
+
// CONFLICT RESOLUTION
|
|
543
|
+
// ===========================================================================
|
|
544
|
+
/**
|
|
545
|
+
* Resolve a conflict using the configured strategy.
|
|
546
|
+
*/
|
|
547
|
+
resolveConflict(conflict, outputs) {
|
|
548
|
+
switch (this.config.conflictResolution) {
|
|
549
|
+
case 'choose_highest_confidence':
|
|
550
|
+
return this.resolveByConfidence(conflict, outputs);
|
|
551
|
+
case 'choose_highest_authority':
|
|
552
|
+
return this.resolveByAuthority(conflict, outputs);
|
|
553
|
+
case 'merge_both':
|
|
554
|
+
return this.resolveMergeBoth(conflict);
|
|
555
|
+
case 'voting':
|
|
556
|
+
return this.resolveByVoting(conflict, outputs);
|
|
557
|
+
default:
|
|
558
|
+
return {
|
|
559
|
+
strategy: 'discard_all',
|
|
560
|
+
explanation: 'No resolution strategy available',
|
|
561
|
+
resolvedAt: new Date(),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
resolveByConfidence(conflict, outputs) {
|
|
566
|
+
const relevant = outputs.filter((o) => conflict.agentIds.includes(o.agentId));
|
|
567
|
+
const winner = relevant.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
|
|
568
|
+
return {
|
|
569
|
+
strategy: 'choose_highest_confidence',
|
|
570
|
+
chosenAgentId: winner.agentId,
|
|
571
|
+
explanation: `Chose ${winner.agentId} with confidence ${winner.confidence}`,
|
|
572
|
+
resolvedAt: new Date(),
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
resolveByAuthority(conflict, outputs) {
|
|
576
|
+
const relevant = outputs.filter((o) => conflict.agentIds.includes(o.agentId));
|
|
577
|
+
const winner = relevant.reduce((best, curr) => (curr.authority ?? 0) > (best.authority ?? 0) ? curr : best);
|
|
578
|
+
return {
|
|
579
|
+
strategy: 'choose_highest_authority',
|
|
580
|
+
chosenAgentId: winner.agentId,
|
|
581
|
+
explanation: `Chose ${winner.agentId} with authority ${winner.authority}`,
|
|
582
|
+
resolvedAt: new Date(),
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
resolveMergeBoth(conflict) {
|
|
586
|
+
const merged = conflict.conflictingContent.join('\n\n// --- Alternative ---\n\n');
|
|
587
|
+
return {
|
|
588
|
+
strategy: 'merge_both',
|
|
589
|
+
mergedContent: merged,
|
|
590
|
+
explanation: 'Merged both versions',
|
|
591
|
+
resolvedAt: new Date(),
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
resolveByVoting(conflict, _outputs) {
|
|
595
|
+
// Count "votes" for each version
|
|
596
|
+
const votes = new Map();
|
|
597
|
+
for (const agentId of conflict.agentIds) {
|
|
598
|
+
votes.set(agentId, (votes.get(agentId) ?? 0) + 1);
|
|
599
|
+
}
|
|
600
|
+
const winner = Array.from(votes.entries()).reduce((best, curr) => curr[1] > best[1] ? curr : best)[0];
|
|
601
|
+
return {
|
|
602
|
+
strategy: 'voting',
|
|
603
|
+
chosenAgentId: winner,
|
|
604
|
+
explanation: `${winner} won by vote`,
|
|
605
|
+
resolvedAt: new Date(),
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
// ===========================================================================
|
|
609
|
+
// UTILITIES
|
|
610
|
+
// ===========================================================================
|
|
611
|
+
/**
|
|
612
|
+
* Calculate content similarity (Jaccard index).
|
|
613
|
+
*/
|
|
614
|
+
calculateSimilarity(a, b) {
|
|
615
|
+
const wordsA = new Set(a.toLowerCase().split(/\s+/));
|
|
616
|
+
const wordsB = new Set(b.toLowerCase().split(/\s+/));
|
|
617
|
+
const intersection = new Set([...wordsA].filter((x) => wordsB.has(x)));
|
|
618
|
+
const union = new Set([...wordsA, ...wordsB]);
|
|
619
|
+
return intersection.size / union.size;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Calculate combined confidence from multiple outputs.
|
|
623
|
+
*/
|
|
624
|
+
calculateCombinedConfidence(outputs) {
|
|
625
|
+
if (outputs.length === 0)
|
|
626
|
+
return 0;
|
|
627
|
+
// Weight by confidence and agreement
|
|
628
|
+
const totalWeight = outputs.reduce((sum, o) => sum + o.confidence, 0);
|
|
629
|
+
const avgConfidence = totalWeight / outputs.length;
|
|
630
|
+
// Boost if agents agree
|
|
631
|
+
const agreementBoost = this.calculateAgreement(outputs) * 0.1;
|
|
632
|
+
return Math.min(1, avgConfidence + agreementBoost);
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Calculate agreement rate between outputs.
|
|
636
|
+
*/
|
|
637
|
+
calculateAgreement(outputs) {
|
|
638
|
+
if (outputs.length <= 1)
|
|
639
|
+
return 1;
|
|
640
|
+
let totalSimilarity = 0;
|
|
641
|
+
let pairs = 0;
|
|
642
|
+
for (let i = 0; i < outputs.length; i++) {
|
|
643
|
+
for (let j = i + 1; j < outputs.length; j++) {
|
|
644
|
+
totalSimilarity += this.calculateSimilarity(outputs[i].content, outputs[j].content);
|
|
645
|
+
pairs++;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return pairs > 0 ? totalSimilarity / pairs : 0;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Determine synthesis method based on output types.
|
|
652
|
+
*/
|
|
653
|
+
determineMethod(outputs) {
|
|
654
|
+
const types = outputs.map((o) => o.type);
|
|
655
|
+
if (types.every((t) => t === 'code')) {
|
|
656
|
+
return 'merge_structured';
|
|
657
|
+
}
|
|
658
|
+
if (types.every((t) => t === 'research')) {
|
|
659
|
+
return 'deduplicate';
|
|
660
|
+
}
|
|
661
|
+
if (this.config.useLLM && this.config.llmSynthesizer !== undefined) {
|
|
662
|
+
return 'synthesize_llm';
|
|
663
|
+
}
|
|
664
|
+
return this.config.defaultMethod;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Determine output type from multiple outputs.
|
|
668
|
+
*/
|
|
669
|
+
determineOutputType(outputs) {
|
|
670
|
+
const types = outputs.map((o) => o.type);
|
|
671
|
+
const uniqueTypes = new Set(types);
|
|
672
|
+
if (uniqueTypes.size === 1) {
|
|
673
|
+
return types[0];
|
|
674
|
+
}
|
|
675
|
+
return 'mixed';
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Merge all file changes from outputs.
|
|
679
|
+
*/
|
|
680
|
+
mergeAllFileChanges(outputs) {
|
|
681
|
+
const byFile = new Map();
|
|
682
|
+
for (const output of outputs) {
|
|
683
|
+
for (const change of output.filesModified ?? []) {
|
|
684
|
+
if (!byFile.has(change.path)) {
|
|
685
|
+
byFile.set(change.path, []);
|
|
686
|
+
}
|
|
687
|
+
byFile.get(change.path).push(change);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
const merged = [];
|
|
691
|
+
for (const [_filePath, changes] of byFile) {
|
|
692
|
+
if (changes.length === 1) {
|
|
693
|
+
merged.push(changes[0]);
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
// Take the one with most content or merge
|
|
697
|
+
const best = changes.reduce((a, b) => a.newContent.length > b.newContent.length ? a : b);
|
|
698
|
+
merged.push(best);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return merged;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Merge file changes for a single file.
|
|
705
|
+
*/
|
|
706
|
+
mergeFileChanges(filePath, changes, outputs) {
|
|
707
|
+
const conflicts = [];
|
|
708
|
+
// Simple strategy: take the change with highest confidence
|
|
709
|
+
let bestChange = changes[0];
|
|
710
|
+
let bestConfidence = 0;
|
|
711
|
+
for (const change of changes) {
|
|
712
|
+
const output = outputs.find((o) => o.filesModified?.some((f) => f.path === filePath && f.newContent === change.newContent));
|
|
713
|
+
if (output && output.confidence > bestConfidence) {
|
|
714
|
+
bestConfidence = output.confidence;
|
|
715
|
+
bestChange = change;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
// Detect if there are significant differences
|
|
719
|
+
for (let i = 0; i < changes.length; i++) {
|
|
720
|
+
for (let j = i + 1; j < changes.length; j++) {
|
|
721
|
+
const similarity = this.calculateSimilarity(changes[i].newContent, changes[j].newContent);
|
|
722
|
+
if (similarity < 0.8) {
|
|
723
|
+
conflicts.push({
|
|
724
|
+
id: `conflict-${++this.conflictCounter}`,
|
|
725
|
+
type: 'code_overlap',
|
|
726
|
+
agentIds: outputs
|
|
727
|
+
.filter((o) => o.filesModified?.some((f) => f.path === filePath))
|
|
728
|
+
.map((o) => o.agentId),
|
|
729
|
+
description: `Different versions of ${filePath}`,
|
|
730
|
+
conflictingContent: [changes[i].newContent.slice(0, 200), changes[j].newContent.slice(0, 200)],
|
|
731
|
+
severity: 'high',
|
|
732
|
+
filePath,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return { merged: bestChange, conflicts };
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Extract all findings from outputs.
|
|
741
|
+
*/
|
|
742
|
+
extractAllFindings(outputs) {
|
|
743
|
+
const all = [];
|
|
744
|
+
for (const output of outputs) {
|
|
745
|
+
all.push(...(output.findings ?? []));
|
|
746
|
+
}
|
|
747
|
+
// Deduplicate
|
|
748
|
+
return [...new Set(all)];
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Extract findings from content text.
|
|
752
|
+
*/
|
|
753
|
+
extractFindingsFromContent(content) {
|
|
754
|
+
const findings = [];
|
|
755
|
+
const lines = content.split('\n');
|
|
756
|
+
for (const line of lines) {
|
|
757
|
+
const trimmed = line.trim();
|
|
758
|
+
// Look for bullet points or findings indicators
|
|
759
|
+
if (trimmed.match(/^[-*•]\s+/) ||
|
|
760
|
+
trimmed.match(/^\d+\.\s+/) ||
|
|
761
|
+
trimmed.toLowerCase().includes('found:') ||
|
|
762
|
+
trimmed.toLowerCase().includes('discovered:')) {
|
|
763
|
+
const finding = trimmed.replace(/^[-*•\d.]+\s+/, '');
|
|
764
|
+
if (finding.length > 10) {
|
|
765
|
+
findings.push(finding);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return findings;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Deduplicate findings.
|
|
773
|
+
*/
|
|
774
|
+
deduplicateFindings(findings) {
|
|
775
|
+
const deduplicated = [];
|
|
776
|
+
for (const f of findings) {
|
|
777
|
+
const existing = deduplicated.find((d) => this.calculateSimilarity(d.finding, f.finding) > this.config.deduplicationThreshold);
|
|
778
|
+
if (existing) {
|
|
779
|
+
// Keep higher confidence
|
|
780
|
+
if (f.confidence > existing.confidence) {
|
|
781
|
+
existing.confidence = f.confidence;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
deduplicated.push({ finding: f.finding, confidence: f.confidence });
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return deduplicated;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Detect contradictions between findings.
|
|
792
|
+
*/
|
|
793
|
+
detectFindingContradictions(findings) {
|
|
794
|
+
const conflicts = [];
|
|
795
|
+
for (let i = 0; i < findings.length; i++) {
|
|
796
|
+
for (let j = i + 1; j < findings.length; j++) {
|
|
797
|
+
const contradictions = this.findContradictions(findings[i].finding, findings[j].finding);
|
|
798
|
+
for (const c of contradictions) {
|
|
799
|
+
conflicts.push({
|
|
800
|
+
id: `conflict-${++this.conflictCounter}`,
|
|
801
|
+
type: 'fact_disagreement',
|
|
802
|
+
agentIds: [],
|
|
803
|
+
description: c.description,
|
|
804
|
+
conflictingContent: [c.contentA, c.contentB],
|
|
805
|
+
severity: 'medium',
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return conflicts;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Calculate synthesis statistics.
|
|
814
|
+
*/
|
|
815
|
+
calculateStats(outputs, synthesizedContent, conflicts) {
|
|
816
|
+
const totalContentLength = outputs.reduce((sum, o) => sum + o.content.length, 0);
|
|
817
|
+
return {
|
|
818
|
+
inputCount: outputs.length,
|
|
819
|
+
totalContentLength,
|
|
820
|
+
synthesizedLength: synthesizedContent.length,
|
|
821
|
+
deduplicationRate: totalContentLength > 0
|
|
822
|
+
? 1 - (synthesizedContent.length / totalContentLength)
|
|
823
|
+
: 0,
|
|
824
|
+
conflictsDetected: conflicts.length,
|
|
825
|
+
conflictsResolved: conflicts.filter((c) => c.resolution).length,
|
|
826
|
+
agreementRate: this.calculateAgreement(outputs),
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Create empty result.
|
|
831
|
+
*/
|
|
832
|
+
createEmptyResult() {
|
|
833
|
+
return {
|
|
834
|
+
output: '',
|
|
835
|
+
type: 'mixed',
|
|
836
|
+
confidence: 0,
|
|
837
|
+
fileChanges: [],
|
|
838
|
+
findings: [],
|
|
839
|
+
conflicts: [],
|
|
840
|
+
stats: {
|
|
841
|
+
inputCount: 0,
|
|
842
|
+
totalContentLength: 0,
|
|
843
|
+
synthesizedLength: 0,
|
|
844
|
+
deduplicationRate: 0,
|
|
845
|
+
conflictsDetected: 0,
|
|
846
|
+
conflictsResolved: 0,
|
|
847
|
+
agreementRate: 1,
|
|
848
|
+
},
|
|
849
|
+
method: 'concatenate',
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Create result from single output.
|
|
854
|
+
*/
|
|
855
|
+
createSingleResult(output) {
|
|
856
|
+
return {
|
|
857
|
+
output: output.content,
|
|
858
|
+
type: output.type,
|
|
859
|
+
confidence: output.confidence,
|
|
860
|
+
fileChanges: output.filesModified ?? [],
|
|
861
|
+
findings: output.findings ?? [],
|
|
862
|
+
conflicts: [],
|
|
863
|
+
stats: {
|
|
864
|
+
inputCount: 1,
|
|
865
|
+
totalContentLength: output.content.length,
|
|
866
|
+
synthesizedLength: output.content.length,
|
|
867
|
+
deduplicationRate: 0,
|
|
868
|
+
conflictsDetected: 0,
|
|
869
|
+
conflictsResolved: 0,
|
|
870
|
+
agreementRate: 1,
|
|
871
|
+
},
|
|
872
|
+
method: 'concatenate',
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Subscribe to events.
|
|
877
|
+
*/
|
|
878
|
+
on(listener) {
|
|
879
|
+
this.listeners.push(listener);
|
|
880
|
+
return () => {
|
|
881
|
+
const idx = this.listeners.indexOf(listener);
|
|
882
|
+
if (idx >= 0)
|
|
883
|
+
this.listeners.splice(idx, 1);
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
emit(event) {
|
|
887
|
+
for (const listener of this.listeners) {
|
|
888
|
+
try {
|
|
889
|
+
listener(event);
|
|
890
|
+
}
|
|
891
|
+
catch {
|
|
892
|
+
// Ignore listener errors
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
// =============================================================================
|
|
898
|
+
// FACTORY FUNCTIONS
|
|
899
|
+
// =============================================================================
|
|
900
|
+
/**
|
|
901
|
+
* Create a result synthesizer.
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```typescript
|
|
905
|
+
* const synthesizer = createResultSynthesizer({
|
|
906
|
+
* conflictResolution: 'choose_highest_confidence',
|
|
907
|
+
* deduplicationThreshold: 0.85,
|
|
908
|
+
* });
|
|
909
|
+
*
|
|
910
|
+
* const result = await synthesizer.synthesize(agentOutputs);
|
|
911
|
+
* ```
|
|
912
|
+
*/
|
|
913
|
+
export function createResultSynthesizer(config = {}) {
|
|
914
|
+
return new ResultSynthesizer(config);
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Create an LLM prompt for synthesis.
|
|
918
|
+
*/
|
|
919
|
+
export function createSynthesisPrompt(outputs, conflicts) {
|
|
920
|
+
const parts = [
|
|
921
|
+
'You are synthesizing results from multiple AI agents. Combine their findings into a coherent, unified response.',
|
|
922
|
+
'',
|
|
923
|
+
'## Agent Outputs',
|
|
924
|
+
'',
|
|
925
|
+
];
|
|
926
|
+
for (const output of outputs) {
|
|
927
|
+
parts.push(`### Agent: ${output.agentId} (confidence: ${output.confidence})`);
|
|
928
|
+
parts.push('');
|
|
929
|
+
parts.push(output.content);
|
|
930
|
+
parts.push('');
|
|
931
|
+
}
|
|
932
|
+
if (conflicts.length > 0) {
|
|
933
|
+
parts.push('## Detected Conflicts');
|
|
934
|
+
parts.push('');
|
|
935
|
+
for (const conflict of conflicts) {
|
|
936
|
+
parts.push(`- ${conflict.type}: ${conflict.description}`);
|
|
937
|
+
}
|
|
938
|
+
parts.push('');
|
|
939
|
+
parts.push('Please resolve these conflicts in your synthesis.');
|
|
940
|
+
}
|
|
941
|
+
parts.push('');
|
|
942
|
+
parts.push('## Instructions');
|
|
943
|
+
parts.push('1. Combine the key insights from all agents');
|
|
944
|
+
parts.push('2. Remove duplicate information');
|
|
945
|
+
parts.push('3. Resolve any contradictions');
|
|
946
|
+
parts.push('4. Provide a unified, coherent response');
|
|
947
|
+
parts.push('');
|
|
948
|
+
parts.push('Respond with JSON: { "content": "...", "findings": [...], "resolutions": [...], "confidence": 0.X }');
|
|
949
|
+
return parts.join('\n');
|
|
950
|
+
}
|
|
951
|
+
//# sourceMappingURL=result-synthesizer.js.map
|