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,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 2.2: Agent State Machine
|
|
3
|
+
*
|
|
4
|
+
* Formalizes the phase tracking that previously lived in economics.ts into a
|
|
5
|
+
* proper state machine with typed transitions, event emission, and per-phase
|
|
6
|
+
* metrics. Testable independently of the economics system.
|
|
7
|
+
*
|
|
8
|
+
* Phases:
|
|
9
|
+
* - exploring: Reading files, searching code, understanding the problem
|
|
10
|
+
* - planning: Creating or editing a plan
|
|
11
|
+
* - acting: Writing/editing files, running commands
|
|
12
|
+
* - verifying: Running tests, checking results
|
|
13
|
+
*
|
|
14
|
+
* Valid transitions:
|
|
15
|
+
* exploring → planning | acting
|
|
16
|
+
* planning → acting | exploring
|
|
17
|
+
* acting → verifying | exploring
|
|
18
|
+
* verifying → acting | exploring
|
|
19
|
+
*/
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// VALID TRANSITIONS
|
|
22
|
+
// =============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Allowed phase transitions. Each phase lists the phases it can transition to.
|
|
25
|
+
* Invalid transitions are rejected with a warning.
|
|
26
|
+
*/
|
|
27
|
+
const VALID_TRANSITIONS = {
|
|
28
|
+
exploring: new Set(['planning', 'acting']),
|
|
29
|
+
planning: new Set(['acting', 'exploring']),
|
|
30
|
+
acting: new Set(['verifying', 'exploring']),
|
|
31
|
+
verifying: new Set(['acting', 'exploring']),
|
|
32
|
+
};
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// AGENT STATE MACHINE
|
|
35
|
+
// =============================================================================
|
|
36
|
+
export class AgentStateMachine {
|
|
37
|
+
currentPhase;
|
|
38
|
+
phaseEnteredAt;
|
|
39
|
+
phaseIterations = 0;
|
|
40
|
+
phaseToolCalls = 0;
|
|
41
|
+
listeners = [];
|
|
42
|
+
transitions = [];
|
|
43
|
+
// Per-phase tracking (mirrors economics PhaseState for backward compat)
|
|
44
|
+
uniqueFilesRead = new Set();
|
|
45
|
+
uniqueSearches = new Set();
|
|
46
|
+
filesModified = new Set();
|
|
47
|
+
testsRun = 0;
|
|
48
|
+
shouldTransition = false;
|
|
49
|
+
recentNewFiles = 0;
|
|
50
|
+
lastTestPassed = null;
|
|
51
|
+
consecutiveTestFailures = 0;
|
|
52
|
+
inTestFixCycle = false;
|
|
53
|
+
consecutiveBashFailures = 0;
|
|
54
|
+
// Accumulated metrics per phase (for history)
|
|
55
|
+
phaseHistory = [];
|
|
56
|
+
// Tuning thresholds
|
|
57
|
+
explorationFileThreshold;
|
|
58
|
+
explorationIterThreshold;
|
|
59
|
+
constructor(options) {
|
|
60
|
+
this.currentPhase = options?.initialPhase ?? 'exploring';
|
|
61
|
+
this.phaseEnteredAt = Date.now();
|
|
62
|
+
this.explorationFileThreshold = options?.explorationFileThreshold ?? 10;
|
|
63
|
+
this.explorationIterThreshold = options?.explorationIterThreshold ?? 5;
|
|
64
|
+
}
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// PUBLIC API
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
/** Get the current phase */
|
|
69
|
+
getPhase() {
|
|
70
|
+
return this.currentPhase;
|
|
71
|
+
}
|
|
72
|
+
/** Get a snapshot of the current phase state (backward-compatible with economics) */
|
|
73
|
+
getPhaseSnapshot() {
|
|
74
|
+
return {
|
|
75
|
+
phase: this.currentPhase,
|
|
76
|
+
iterationsInPhase: this.phaseIterations,
|
|
77
|
+
uniqueFilesRead: new Set(this.uniqueFilesRead),
|
|
78
|
+
uniqueSearches: new Set(this.uniqueSearches),
|
|
79
|
+
filesModified: new Set(this.filesModified),
|
|
80
|
+
testsRun: this.testsRun,
|
|
81
|
+
shouldTransition: this.shouldTransition,
|
|
82
|
+
recentNewFiles: this.recentNewFiles,
|
|
83
|
+
lastTestPassed: this.lastTestPassed,
|
|
84
|
+
consecutiveTestFailures: this.consecutiveTestFailures,
|
|
85
|
+
inTestFixCycle: this.inTestFixCycle,
|
|
86
|
+
consecutiveBashFailures: this.consecutiveBashFailures,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Get metrics for the current phase */
|
|
90
|
+
getCurrentPhaseMetrics() {
|
|
91
|
+
return {
|
|
92
|
+
phase: this.currentPhase,
|
|
93
|
+
iterations: this.phaseIterations,
|
|
94
|
+
enteredAt: this.phaseEnteredAt,
|
|
95
|
+
duration: Date.now() - this.phaseEnteredAt,
|
|
96
|
+
filesRead: this.uniqueFilesRead.size,
|
|
97
|
+
filesModified: this.filesModified.size,
|
|
98
|
+
toolCalls: this.phaseToolCalls,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Get all phase transition history */
|
|
102
|
+
getTransitions() {
|
|
103
|
+
return this.transitions;
|
|
104
|
+
}
|
|
105
|
+
/** Get accumulated phase history */
|
|
106
|
+
getPhaseHistory() {
|
|
107
|
+
return this.phaseHistory;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Attempt a phase transition.
|
|
111
|
+
* Returns true if transition was valid and executed, false if rejected.
|
|
112
|
+
*/
|
|
113
|
+
transition(to, reason) {
|
|
114
|
+
if (to === this.currentPhase)
|
|
115
|
+
return false;
|
|
116
|
+
const validTargets = VALID_TRANSITIONS[this.currentPhase];
|
|
117
|
+
if (!validTargets.has(to)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const fromMetrics = this.getCurrentPhaseMetrics();
|
|
121
|
+
fromMetrics.duration = Date.now() - this.phaseEnteredAt;
|
|
122
|
+
const transition = {
|
|
123
|
+
from: this.currentPhase,
|
|
124
|
+
to,
|
|
125
|
+
reason,
|
|
126
|
+
timestamp: Date.now(),
|
|
127
|
+
fromMetrics,
|
|
128
|
+
};
|
|
129
|
+
// Record history
|
|
130
|
+
this.phaseHistory.push({ ...fromMetrics });
|
|
131
|
+
this.transitions.push(transition);
|
|
132
|
+
// Reset phase-local counters
|
|
133
|
+
this.currentPhase = to;
|
|
134
|
+
this.phaseEnteredAt = Date.now();
|
|
135
|
+
this.phaseIterations = 0;
|
|
136
|
+
this.phaseToolCalls = 0;
|
|
137
|
+
this.recentNewFiles = 0;
|
|
138
|
+
this.shouldTransition = false;
|
|
139
|
+
// Emit event
|
|
140
|
+
this.emit({ type: 'phase.changed', transition });
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Record a tool call and update phase state.
|
|
145
|
+
* This is the primary input signal for the state machine.
|
|
146
|
+
*/
|
|
147
|
+
recordToolCall(toolName, args, result) {
|
|
148
|
+
this.phaseIterations++;
|
|
149
|
+
this.phaseToolCalls++;
|
|
150
|
+
// Reset recentNewFiles counter every 3 iterations
|
|
151
|
+
if (this.phaseIterations % 3 === 0) {
|
|
152
|
+
this.recentNewFiles = 0;
|
|
153
|
+
}
|
|
154
|
+
// Track file reads
|
|
155
|
+
if (toolName === 'read_file' && args.path) {
|
|
156
|
+
const path = String(args.path);
|
|
157
|
+
const isNew = !this.uniqueFilesRead.has(path);
|
|
158
|
+
this.uniqueFilesRead.add(path);
|
|
159
|
+
if (isNew)
|
|
160
|
+
this.recentNewFiles++;
|
|
161
|
+
}
|
|
162
|
+
// Track searches
|
|
163
|
+
if (['grep', 'search', 'glob', 'find_files', 'search_files'].includes(toolName)) {
|
|
164
|
+
const query = String(args.pattern || args.query || args.path || '');
|
|
165
|
+
this.uniqueSearches.add(query);
|
|
166
|
+
}
|
|
167
|
+
// Track file modifications → auto-transition to acting
|
|
168
|
+
if (['write_file', 'edit_file'].includes(toolName) && args.path) {
|
|
169
|
+
this.filesModified.add(String(args.path));
|
|
170
|
+
if (this.currentPhase === 'exploring' || this.currentPhase === 'planning') {
|
|
171
|
+
this.transition('acting', 'First file edit made');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Track bash commands
|
|
175
|
+
if (toolName === 'bash' && args.command) {
|
|
176
|
+
const command = String(args.command);
|
|
177
|
+
const bashResult = extractBashSuccess(result);
|
|
178
|
+
// Track consecutive bash failures
|
|
179
|
+
if (result !== undefined) {
|
|
180
|
+
if (!bashResult) {
|
|
181
|
+
this.consecutiveBashFailures++;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this.consecutiveBashFailures = 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Detect test runs
|
|
188
|
+
if (isTestCommand(command)) {
|
|
189
|
+
this.testsRun++;
|
|
190
|
+
// Auto-transition to verifying when tests run after edits
|
|
191
|
+
if (this.currentPhase === 'acting' && this.filesModified.size > 0) {
|
|
192
|
+
this.transition('verifying', 'Tests run after edits');
|
|
193
|
+
}
|
|
194
|
+
// Track test outcomes
|
|
195
|
+
if (result !== undefined) {
|
|
196
|
+
if (bashResult) {
|
|
197
|
+
this.lastTestPassed = true;
|
|
198
|
+
this.consecutiveTestFailures = 0;
|
|
199
|
+
this.inTestFixCycle = false;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.lastTestPassed = false;
|
|
203
|
+
this.consecutiveTestFailures++;
|
|
204
|
+
// Enter test-fix cycle after 2+ failures
|
|
205
|
+
if (this.consecutiveTestFailures >= 2) {
|
|
206
|
+
this.inTestFixCycle = true;
|
|
207
|
+
// Go back to acting to fix
|
|
208
|
+
if (this.currentPhase === 'verifying') {
|
|
209
|
+
this.transition('acting', `Test failed ${this.consecutiveTestFailures} times, fixing`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Check exploration saturation
|
|
217
|
+
this.checkExplorationSaturation();
|
|
218
|
+
}
|
|
219
|
+
/** Subscribe to state machine events */
|
|
220
|
+
subscribe(listener) {
|
|
221
|
+
this.listeners.push(listener);
|
|
222
|
+
return () => {
|
|
223
|
+
const idx = this.listeners.indexOf(listener);
|
|
224
|
+
if (idx >= 0)
|
|
225
|
+
this.listeners.splice(idx, 1);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** Reset state machine to initial state */
|
|
229
|
+
reset(phase) {
|
|
230
|
+
this.currentPhase = phase ?? 'exploring';
|
|
231
|
+
this.phaseEnteredAt = Date.now();
|
|
232
|
+
this.phaseIterations = 0;
|
|
233
|
+
this.phaseToolCalls = 0;
|
|
234
|
+
this.uniqueFilesRead.clear();
|
|
235
|
+
this.uniqueSearches.clear();
|
|
236
|
+
this.filesModified.clear();
|
|
237
|
+
this.testsRun = 0;
|
|
238
|
+
this.shouldTransition = false;
|
|
239
|
+
this.recentNewFiles = 0;
|
|
240
|
+
this.lastTestPassed = null;
|
|
241
|
+
this.consecutiveTestFailures = 0;
|
|
242
|
+
this.inTestFixCycle = false;
|
|
243
|
+
this.consecutiveBashFailures = 0;
|
|
244
|
+
this.transitions = [];
|
|
245
|
+
this.phaseHistory = [];
|
|
246
|
+
}
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// PRIVATE
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
/** Check for exploration saturation (too many reads without action) */
|
|
251
|
+
checkExplorationSaturation() {
|
|
252
|
+
if (this.currentPhase !== 'exploring') {
|
|
253
|
+
this.shouldTransition = false;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
// After N+ unique files without edits
|
|
257
|
+
if (this.uniqueFilesRead.size >= this.explorationFileThreshold && this.filesModified.size === 0) {
|
|
258
|
+
this.shouldTransition = true;
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
// After N+ iterations with diminishing returns
|
|
262
|
+
if (this.phaseIterations >= this.explorationIterThreshold && this.recentNewFiles < 2 && this.filesModified.size === 0) {
|
|
263
|
+
this.shouldTransition = true;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
this.shouldTransition = false;
|
|
267
|
+
}
|
|
268
|
+
emit(event) {
|
|
269
|
+
for (const listener of this.listeners) {
|
|
270
|
+
try {
|
|
271
|
+
listener(event);
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
// Don't let listener errors break the state machine
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// =============================================================================
|
|
280
|
+
// HELPERS
|
|
281
|
+
// =============================================================================
|
|
282
|
+
/** Check if a bash command is a test command */
|
|
283
|
+
function isTestCommand(command) {
|
|
284
|
+
return (command.includes('test') ||
|
|
285
|
+
command.includes('pytest') ||
|
|
286
|
+
command.includes('npm test') ||
|
|
287
|
+
command.includes('jest'));
|
|
288
|
+
}
|
|
289
|
+
/** Extract success from a bash result (object or string) */
|
|
290
|
+
function extractBashSuccess(result) {
|
|
291
|
+
if (result && typeof result === 'object') {
|
|
292
|
+
return result.success !== false;
|
|
293
|
+
}
|
|
294
|
+
return true; // strings and undefined are treated as success
|
|
295
|
+
}
|
|
296
|
+
// =============================================================================
|
|
297
|
+
// FACTORY
|
|
298
|
+
// =============================================================================
|
|
299
|
+
export function createAgentStateMachine(options) {
|
|
300
|
+
return new AgentStateMachine(options);
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=agent-state-machine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-state-machine.js","sourceRoot":"","sources":["../../../src/core/agent-state-machine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA4DH,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,iBAAiB,GAAwC;IAC7D,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC1C,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC3C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;CAC5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,MAAe;IACzC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAQ,MAAkC,CAAC,OAAO,KAAK,KAAK,CAAC;IAC/D,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,+CAA+C;AAC9D,CAAC;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,UAAU,uBAAuB,CAAC,OAIvC;IACC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 2.3: Base Manager Pattern
|
|
3
|
+
*
|
|
4
|
+
* Provides a common base class for managers with consistent lifecycle
|
|
5
|
+
* (init/cleanup/reset), event emission, and subscription management.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* interface MyEvent { type: 'my.event'; data: string }
|
|
10
|
+
*
|
|
11
|
+
* class MyManager extends BaseManager<MyEvent> {
|
|
12
|
+
* protected managerName = 'MyManager';
|
|
13
|
+
*
|
|
14
|
+
* async onInit(): Promise<void> { ... }
|
|
15
|
+
* async onCleanup(): Promise<void> { ... }
|
|
16
|
+
* onReset(): void { ... }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/** Standard lifecycle states for managers */
|
|
21
|
+
export type ManagerState = 'created' | 'initializing' | 'ready' | 'cleaning_up' | 'disposed';
|
|
22
|
+
/** Base event type — all manager events must have a `type` field */
|
|
23
|
+
export interface BaseEvent {
|
|
24
|
+
type: string;
|
|
25
|
+
}
|
|
26
|
+
/** Lifecycle events emitted by all managers */
|
|
27
|
+
export interface ManagerLifecycleEvent extends BaseEvent {
|
|
28
|
+
type: 'manager.initialized' | 'manager.cleanup' | 'manager.reset' | 'manager.error';
|
|
29
|
+
manager: string;
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare abstract class BaseManager<TEvent extends BaseEvent = BaseEvent> {
|
|
33
|
+
/** Name for logging and events */
|
|
34
|
+
protected abstract readonly managerName: string;
|
|
35
|
+
private _state;
|
|
36
|
+
private _listeners;
|
|
37
|
+
private _unsubscribers;
|
|
38
|
+
private _initPromise;
|
|
39
|
+
/** Current lifecycle state */
|
|
40
|
+
get state(): ManagerState;
|
|
41
|
+
/** Whether the manager is ready to use */
|
|
42
|
+
get isReady(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Initialize the manager. Idempotent — calling multiple times returns the
|
|
45
|
+
* same promise. Override `onInit()` for custom initialization.
|
|
46
|
+
*/
|
|
47
|
+
init(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Clean up resources. Override `onCleanup()` for custom cleanup.
|
|
50
|
+
* Automatically unsubscribes all tracked subscriptions.
|
|
51
|
+
*/
|
|
52
|
+
cleanup(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Reset manager to initial state without disposing.
|
|
55
|
+
* Override `onReset()` for custom reset logic.
|
|
56
|
+
*/
|
|
57
|
+
reset(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to manager events.
|
|
60
|
+
* Returns an unsubscribe function.
|
|
61
|
+
*/
|
|
62
|
+
subscribe(listener: (event: TEvent | ManagerLifecycleEvent) => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Track an external unsubscription function.
|
|
65
|
+
* All tracked subscriptions are cleaned up on `cleanup()`.
|
|
66
|
+
*/
|
|
67
|
+
protected trackSubscription(unsub: () => void): void;
|
|
68
|
+
/** Emit a typed event to all listeners */
|
|
69
|
+
protected emit(event: TEvent): void;
|
|
70
|
+
/** Called during init(). Override for custom initialization. */
|
|
71
|
+
protected onInit(): Promise<void>;
|
|
72
|
+
/** Called during cleanup(). Override for custom resource release. */
|
|
73
|
+
protected onCleanup(): Promise<void>;
|
|
74
|
+
/** Called during reset(). Override to clear state without disposing. */
|
|
75
|
+
protected onReset(): void;
|
|
76
|
+
private _doInit;
|
|
77
|
+
private emitLifecycle;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=base-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-manager.d.ts","sourceRoot":"","sources":["../../../src/core/base-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,CAAC;AAE7F,oEAAoE;AACpE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,IAAI,EAAE,qBAAqB,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAAC;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,8BAAsB,WAAW,CAAC,MAAM,SAAS,SAAS,GAAG,SAAS;IACpE,kCAAkC;IAClC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEhD,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,UAAU,CAA8D;IAChF,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,YAAY,CAA8B;IAMlD,8BAA8B;IAC9B,IAAI,KAAK,IAAI,YAAY,CAExB;IAED,0CAA0C;IAC1C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAWb;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,KAAK,IAAI,GAAG,MAAM,IAAI;IAShF;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI;IAIpD,0CAA0C;IAC1C,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAcnC,gEAAgE;cAChD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvC,qEAAqE;cACrD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,wEAAwE;IACxE,SAAS,CAAC,OAAO,IAAI,IAAI;YAQX,OAAO;IAarB,OAAO,CAAC,aAAa;CAWtB"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 2.3: Base Manager Pattern
|
|
3
|
+
*
|
|
4
|
+
* Provides a common base class for managers with consistent lifecycle
|
|
5
|
+
* (init/cleanup/reset), event emission, and subscription management.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* interface MyEvent { type: 'my.event'; data: string }
|
|
10
|
+
*
|
|
11
|
+
* class MyManager extends BaseManager<MyEvent> {
|
|
12
|
+
* protected managerName = 'MyManager';
|
|
13
|
+
*
|
|
14
|
+
* async onInit(): Promise<void> { ... }
|
|
15
|
+
* async onCleanup(): Promise<void> { ... }
|
|
16
|
+
* onReset(): void { ... }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// BASE MANAGER
|
|
22
|
+
// =============================================================================
|
|
23
|
+
export class BaseManager {
|
|
24
|
+
_state = 'created';
|
|
25
|
+
_listeners = [];
|
|
26
|
+
_unsubscribers = [];
|
|
27
|
+
_initPromise = null;
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// LIFECYCLE
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
/** Current lifecycle state */
|
|
32
|
+
get state() {
|
|
33
|
+
return this._state;
|
|
34
|
+
}
|
|
35
|
+
/** Whether the manager is ready to use */
|
|
36
|
+
get isReady() {
|
|
37
|
+
return this._state === 'ready';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the manager. Idempotent — calling multiple times returns the
|
|
41
|
+
* same promise. Override `onInit()` for custom initialization.
|
|
42
|
+
*/
|
|
43
|
+
async init() {
|
|
44
|
+
if (this._state === 'ready')
|
|
45
|
+
return;
|
|
46
|
+
if (this._initPromise)
|
|
47
|
+
return this._initPromise;
|
|
48
|
+
this._state = 'initializing';
|
|
49
|
+
this._initPromise = this._doInit();
|
|
50
|
+
return this._initPromise;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Clean up resources. Override `onCleanup()` for custom cleanup.
|
|
54
|
+
* Automatically unsubscribes all tracked subscriptions.
|
|
55
|
+
*/
|
|
56
|
+
async cleanup() {
|
|
57
|
+
if (this._state === 'disposed')
|
|
58
|
+
return;
|
|
59
|
+
this._state = 'cleaning_up';
|
|
60
|
+
// Unsubscribe all tracked subscriptions
|
|
61
|
+
for (const unsub of this._unsubscribers) {
|
|
62
|
+
try {
|
|
63
|
+
unsub();
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Ignore errors during cleanup
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this._unsubscribers = [];
|
|
70
|
+
try {
|
|
71
|
+
await this.onCleanup();
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
this.emitLifecycle('manager.error', String(err));
|
|
75
|
+
}
|
|
76
|
+
this._state = 'disposed';
|
|
77
|
+
this._initPromise = null;
|
|
78
|
+
this.emitLifecycle('manager.cleanup');
|
|
79
|
+
this._listeners = [];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Reset manager to initial state without disposing.
|
|
83
|
+
* Override `onReset()` for custom reset logic.
|
|
84
|
+
*/
|
|
85
|
+
reset() {
|
|
86
|
+
this.onReset();
|
|
87
|
+
this._state = 'ready';
|
|
88
|
+
this._initPromise = null;
|
|
89
|
+
this.emitLifecycle('manager.reset');
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// EVENT SYSTEM
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
/**
|
|
95
|
+
* Subscribe to manager events.
|
|
96
|
+
* Returns an unsubscribe function.
|
|
97
|
+
*/
|
|
98
|
+
subscribe(listener) {
|
|
99
|
+
this._listeners.push(listener);
|
|
100
|
+
const unsub = () => {
|
|
101
|
+
const idx = this._listeners.indexOf(listener);
|
|
102
|
+
if (idx >= 0)
|
|
103
|
+
this._listeners.splice(idx, 1);
|
|
104
|
+
};
|
|
105
|
+
return unsub;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Track an external unsubscription function.
|
|
109
|
+
* All tracked subscriptions are cleaned up on `cleanup()`.
|
|
110
|
+
*/
|
|
111
|
+
trackSubscription(unsub) {
|
|
112
|
+
this._unsubscribers.push(unsub);
|
|
113
|
+
}
|
|
114
|
+
/** Emit a typed event to all listeners */
|
|
115
|
+
emit(event) {
|
|
116
|
+
for (const listener of this._listeners) {
|
|
117
|
+
try {
|
|
118
|
+
listener(event);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// Don't let listener errors break the manager
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// HOOKS (override in subclasses)
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/** Called during init(). Override for custom initialization. */
|
|
129
|
+
async onInit() {
|
|
130
|
+
// Default: no-op
|
|
131
|
+
}
|
|
132
|
+
/** Called during cleanup(). Override for custom resource release. */
|
|
133
|
+
async onCleanup() {
|
|
134
|
+
// Default: no-op
|
|
135
|
+
}
|
|
136
|
+
/** Called during reset(). Override to clear state without disposing. */
|
|
137
|
+
onReset() {
|
|
138
|
+
// Default: no-op
|
|
139
|
+
}
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
// PRIVATE
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
async _doInit() {
|
|
144
|
+
try {
|
|
145
|
+
await this.onInit();
|
|
146
|
+
this._state = 'ready';
|
|
147
|
+
this.emitLifecycle('manager.initialized');
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
this._state = 'created';
|
|
151
|
+
this._initPromise = null;
|
|
152
|
+
this.emitLifecycle('manager.error', String(err));
|
|
153
|
+
throw err;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
emitLifecycle(type, error) {
|
|
157
|
+
const event = { type, manager: this.managerName };
|
|
158
|
+
if (error)
|
|
159
|
+
event.error = error;
|
|
160
|
+
for (const listener of this._listeners) {
|
|
161
|
+
try {
|
|
162
|
+
listener(event);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Ignore
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=base-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-manager.js","sourceRoot":"","sources":["../../../src/core/base-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAqBH,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,MAAM,OAAgB,WAAW;IAIvB,MAAM,GAAiB,SAAS,CAAC;IACjC,UAAU,GAA2D,EAAE,CAAC;IACxE,cAAc,GAAsB,EAAE,CAAC;IACvC,YAAY,GAAyB,IAAI,CAAC;IAElD,8EAA8E;IAC9E,YAAY;IACZ,8EAA8E;IAE9E,8BAA8B;IAC9B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,0CAA0C;IAC1C,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC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C;YACb,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,IAAmC,EAAE,KAAc;QACvE,MAAM,KAAK,GAA0B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QACzE,IAAI,KAAK;YAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAC/B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,IAAI,CAAC;gBACH,QAAQ,CAAC,KAAuC,CAAC,CAAC;YACpD,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Analyzer
|
|
3
|
+
*
|
|
4
|
+
* Shared logic for identifying responses that describe future intent
|
|
5
|
+
* ("I'll do X") instead of completed work. This must stay centralized so
|
|
6
|
+
* execution-loop and final run guardrails classify consistently.
|
|
7
|
+
*/
|
|
8
|
+
export interface CompletionIntentAnalysis {
|
|
9
|
+
isIncompleteAction: boolean;
|
|
10
|
+
reason: 'none' | 'future_intent' | 'failure_admission' | 'narrative_action';
|
|
11
|
+
confidence: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function analyzeCompletionIntent(content: string): CompletionIntentAnalysis;
|
|
14
|
+
export declare function detectIncompleteActionResponse(content: string): boolean;
|
|
15
|
+
//# sourceMappingURL=completion-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-analyzer.d.ts","sourceRoot":"","sources":["../../../src/core/completion-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,wBAAwB,CA+CjF;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Analyzer
|
|
3
|
+
*
|
|
4
|
+
* Shared logic for identifying responses that describe future intent
|
|
5
|
+
* ("I'll do X") instead of completed work. This must stay centralized so
|
|
6
|
+
* execution-loop and final run guardrails classify consistently.
|
|
7
|
+
*/
|
|
8
|
+
export function analyzeCompletionIntent(content) {
|
|
9
|
+
const trimmed = content.trim();
|
|
10
|
+
if (!trimmed) {
|
|
11
|
+
return { isIncompleteAction: false, reason: 'none', confidence: 0 };
|
|
12
|
+
}
|
|
13
|
+
const lower = trimmed.toLowerCase();
|
|
14
|
+
// Positive completion signals should override weaker future-intent cues.
|
|
15
|
+
const completionSignals = /\b(done|completed|finished|here is the (final|complete)|created successfully|saved|wrote|all (changes|tasks) (are )?complete)\b/;
|
|
16
|
+
if (completionSignals.test(lower)) {
|
|
17
|
+
return { isIncompleteAction: false, reason: 'none', confidence: 0.9 };
|
|
18
|
+
}
|
|
19
|
+
const futureIntentPatterns = [
|
|
20
|
+
/\b(i\s+will|i'll|let me)\s+(create|write|save|update|modify|fix|add|edit|implement|change|run|execute|build|set up|start)\b/,
|
|
21
|
+
/\b(i\s+need to|i\s+should|i\s+can)\s+(create|write|update|modify|fix|add|edit|implement)\b/,
|
|
22
|
+
/\b(the next step|first[, ]+i|now i)\b/,
|
|
23
|
+
/\b(i am going to|i'm going to)\b/,
|
|
24
|
+
];
|
|
25
|
+
if (futureIntentPatterns.some(pattern => pattern.test(lower))) {
|
|
26
|
+
return { isIncompleteAction: true, reason: 'future_intent', confidence: 0.95 };
|
|
27
|
+
}
|
|
28
|
+
const failureAdmissionPatterns = [
|
|
29
|
+
/\bran out of budget\b/,
|
|
30
|
+
/\bbudget exhausted\b/,
|
|
31
|
+
/\bunable to complete\b/,
|
|
32
|
+
/\bcould not complete\b/,
|
|
33
|
+
/\bno changes were made\b/,
|
|
34
|
+
/\bno files were modified\b/,
|
|
35
|
+
];
|
|
36
|
+
if (failureAdmissionPatterns.some(pattern => pattern.test(lower))) {
|
|
37
|
+
return { isIncompleteAction: true, reason: 'failure_admission', confidence: 0.9 };
|
|
38
|
+
}
|
|
39
|
+
// Heuristic: short narrative about "changing code" with no artifact.
|
|
40
|
+
const hasCodeBlock = /```/.test(trimmed);
|
|
41
|
+
const mentionsCodeConcepts = /\b(file|function|class|module|component|import|export|variable|method)\b/i.test(trimmed);
|
|
42
|
+
if (!hasCodeBlock && mentionsCodeConcepts && trimmed.length < 600) {
|
|
43
|
+
const actionWords = /\b(update|modify|create|add|change|fix|implement|refactor|write|edit)\b/i;
|
|
44
|
+
if (actionWords.test(lower)) {
|
|
45
|
+
return { isIncompleteAction: true, reason: 'narrative_action', confidence: 0.65 };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { isIncompleteAction: false, reason: 'none', confidence: 0.3 };
|
|
49
|
+
}
|
|
50
|
+
export function detectIncompleteActionResponse(content) {
|
|
51
|
+
return analyzeCompletionIntent(content).isIncompleteAction;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=completion-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-analyzer.js","sourceRoot":"","sources":["../../../src/core/completion-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,C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