attocode 0.2.2 → 0.2.4
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 +169 -3
- package/README.md +65 -5
- package/dist/src/adapters.d.ts.map +1 -1
- package/dist/src/adapters.js +15 -11
- package/dist/src/adapters.js.map +1 -1
- package/dist/src/agent.d.ts +44 -98
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +716 -2648
- package/dist/src/agent.js.map +1 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +25 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/handler.d.ts.map +1 -1
- package/dist/src/commands/handler.js +11 -3
- 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 +1258 -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 +4 -4
- 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 +234 -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 +966 -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 +677 -0
- package/dist/src/core/tool-executor.js.map +1 -0
- package/dist/src/core/types.d.ts +133 -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 +8 -3
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +65 -3
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/integrations/agent-registry.d.ts +11 -0
- package/dist/src/integrations/agent-registry.d.ts.map +1 -1
- package/dist/src/integrations/agent-registry.js.map +1 -1
- package/dist/src/integrations/auto-compaction.d.ts.map +1 -1
- package/dist/src/integrations/auto-compaction.js +8 -3
- package/dist/src/integrations/auto-compaction.js.map +1 -1
- package/dist/src/integrations/bash-policy.d.ts +33 -0
- package/dist/src/integrations/bash-policy.d.ts.map +1 -0
- package/dist/src/integrations/bash-policy.js +142 -0
- package/dist/src/integrations/bash-policy.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 +23 -0
- package/dist/src/integrations/codebase-context.d.ts.map +1 -1
- package/dist/src/integrations/codebase-context.js +230 -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-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/delegation-protocol.js +2 -2
- package/dist/src/integrations/delegation-protocol.js.map +1 -1
- package/dist/src/integrations/economics.d.ts +67 -1
- package/dist/src/integrations/economics.d.ts.map +1 -1
- package/dist/src/integrations/economics.js +328 -33
- 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 +20 -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 +10 -1
- package/dist/src/integrations/index.d.ts.map +1 -1
- package/dist/src/integrations/index.js +12 -2
- 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.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-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.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/policy-engine.d.ts +55 -0
- package/dist/src/integrations/policy-engine.d.ts.map +1 -0
- package/dist/src/integrations/policy-engine.js +247 -0
- package/dist/src/integrations/policy-engine.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.d.ts +5 -4
- package/dist/src/integrations/safety.d.ts.map +1 -1
- package/dist/src/integrations/safety.js +45 -20
- package/dist/src/integrations/safety.js.map +1 -1
- package/dist/src/integrations/sandbox/basic.d.ts +7 -0
- package/dist/src/integrations/sandbox/basic.d.ts.map +1 -1
- package/dist/src/integrations/sandbox/basic.js +27 -2
- package/dist/src/integrations/sandbox/basic.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 +6 -0
- package/dist/src/integrations/sandbox/index.d.ts.map +1 -1
- package/dist/src/integrations/sandbox/index.js +8 -4
- package/dist/src/integrations/sandbox/index.js.map +1 -1
- package/dist/src/integrations/sandbox/landlock.d.ts.map +1 -1
- package/dist/src/integrations/sandbox/landlock.js +3 -0
- package/dist/src/integrations/sandbox/landlock.js.map +1 -1
- package/dist/src/integrations/self-improvement.d.ts.map +1 -1
- package/dist/src/integrations/self-improvement.js +12 -0
- package/dist/src/integrations/self-improvement.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/smart-decomposer.d.ts +45 -1
- package/dist/src/integrations/smart-decomposer.d.ts.map +1 -1
- package/dist/src/integrations/smart-decomposer.js +486 -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/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 +1 -1
- package/dist/src/integrations/swarm/index.d.ts.map +1 -1
- package/dist/src/integrations/swarm/index.js.map +1 -1
- package/dist/src/integrations/swarm/model-selector.d.ts +15 -0
- package/dist/src/integrations/swarm/model-selector.d.ts.map +1 -1
- package/dist/src/integrations/swarm/model-selector.js +100 -20
- package/dist/src/integrations/swarm/model-selector.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-budget.d.ts +4 -0
- package/dist/src/integrations/swarm/swarm-budget.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-budget.js +6 -0
- 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 +249 -7
- package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-event-bridge.d.ts +86 -1
- package/dist/src/integrations/swarm/swarm-event-bridge.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-event-bridge.js +207 -23
- package/dist/src/integrations/swarm/swarm-event-bridge.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts +58 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.js +22 -5
- package/dist/src/integrations/swarm/swarm-events.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts +147 -8
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-orchestrator.js +2179 -132
- package/dist/src/integrations/swarm/swarm-orchestrator.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-quality-gate.d.ts +83 -2
- package/dist/src/integrations/swarm/swarm-quality-gate.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-quality-gate.js +278 -19
- package/dist/src/integrations/swarm/swarm-quality-gate.js.map +1 -1
- 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 +8 -1
- package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts +54 -0
- package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
- package/dist/src/integrations/swarm/task-queue.js +310 -12
- package/dist/src/integrations/swarm/task-queue.js.map +1 -1
- package/dist/src/integrations/swarm/types.d.ts +251 -13
- package/dist/src/integrations/swarm/types.d.ts.map +1 -1
- package/dist/src/integrations/swarm/types.js +70 -8
- package/dist/src/integrations/swarm/types.js.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts +21 -4
- package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.js +223 -44
- 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/tool-recommendation.d.ts +7 -4
- package/dist/src/integrations/tool-recommendation.d.ts.map +1 -1
- package/dist/src/integrations/tool-recommendation.js +58 -5
- package/dist/src/integrations/tool-recommendation.js.map +1 -1
- package/dist/src/integrations/work-log.js +4 -4
- package/dist/src/integrations/work-log.js.map +1 -1
- package/dist/src/main.js +106 -30
- package/dist/src/main.js.map +1 -1
- package/dist/src/modes/repl.d.ts.map +1 -1
- package/dist/src/modes/repl.js +50 -12
- 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 +41 -6
- package/dist/src/modes/tui.js.map +1 -1
- package/dist/src/modes.d.ts.map +1 -1
- package/dist/src/modes.js +4 -27
- 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.map +1 -1
- package/dist/src/persistence/schema.js +11 -0
- package/dist/src/persistence/schema.js.map +1 -1
- package/dist/src/providers/adapters/anthropic.d.ts.map +1 -1
- package/dist/src/providers/adapters/anthropic.js +3 -2
- package/dist/src/providers/adapters/anthropic.js.map +1 -1
- package/dist/src/providers/adapters/openai.d.ts.map +1 -1
- package/dist/src/providers/adapters/openai.js +3 -2
- package/dist/src/providers/adapters/openai.js.map +1 -1
- package/dist/src/providers/adapters/openrouter.d.ts.map +1 -1
- package/dist/src/providers/adapters/openrouter.js +11 -11
- 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/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.map +1 -1
- package/dist/src/tools/agent.js +11 -2
- package/dist/src/tools/agent.js.map +1 -1
- package/dist/src/tools/bash.d.ts +1 -1
- 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/coercion.d.ts +6 -0
- package/dist/src/tools/coercion.d.ts.map +1 -1
- package/dist/src/tools/coercion.js +13 -0
- package/dist/src/tools/coercion.js.map +1 -1
- package/dist/src/tools/file.d.ts +5 -5
- package/dist/src/tools/file.js +2 -2
- 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 +10 -116
- package/dist/src/tools/permission.js.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/tracing/trace-collector.d.ts +292 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -1
- package/dist/src/tracing/trace-collector.js +249 -5
- package/dist/src/tracing/trace-collector.js.map +1 -1
- package/dist/src/tracing/types.d.ts +200 -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/tui/app.d.ts +13 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +162 -19
- package/dist/src/tui/app.js.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/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/types.d.ts +214 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,172 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.4] - 2026-02-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### ESLint 9 and Prettier
|
|
13
|
+
- **ESLint 9 and Prettier** — Add eslint.config.js with TypeScript and import-x rules; .prettierrc.json and .prettierignore; lint, lint:fix, format, format:check scripts; CI workflow updates; formatting and lint fixes across src and tests
|
|
14
|
+
|
|
15
|
+
#### Config Module
|
|
16
|
+
- **Config module with schema** — New `attocode/src/config` (index, config-manager, schema, base-types); `loadConfig()` supports hierarchical sources; legacy `config.ts` delegates to it; deprecate `loadUserConfig()` for backward compatibility; wire main.ts and integrations to use `loadConfig` from config/index; tests for config schema and config manager (`tests/config/`)
|
|
17
|
+
|
|
18
|
+
#### Agent Architecture Refactor
|
|
19
|
+
- **Agent state machine** — New `AgentStateMachine` for formalized phase tracking with typed transitions and metrics
|
|
20
|
+
- **Base manager pattern** — New `BaseManager` class for consistent lifecycle management across managers
|
|
21
|
+
- **Execution loop extraction** — Extracted execution loop, response handling, and tool execution into dedicated modules (`execution-loop.ts`, `response-handler.ts`, `tool-executor.ts`, `subagent-spawner.ts`) for improved organization; tool execution enhanced with batching and policy enforcement
|
|
22
|
+
- **Core module exports** — Updated core index with new module structure and exports
|
|
23
|
+
|
|
24
|
+
#### Swarm Shared State
|
|
25
|
+
- **SharedContextState** — Cross-worker failure learning and reference pooling among swarm workers
|
|
26
|
+
- **SharedEconomicsState** — Doom loop aggregation and shared insights across workers; methods for recording failures and tool calls
|
|
27
|
+
- **ProductionAgent integration** — Updated agent and related modules to utilize shared states for coordination and resource management
|
|
28
|
+
- **Tests** — `shared-context-state.test.ts`, `shared-economics-state.test.ts`
|
|
29
|
+
|
|
30
|
+
#### Tree-sitter AST
|
|
31
|
+
- **AST-based symbol and dependency extraction** — Tree-sitter integration for Python and TypeScript; improved codebase context analysis
|
|
32
|
+
- **Edit validator** — Post-edit syntax validation using tree-sitter; execution loop runs syntax validation after file edits
|
|
33
|
+
- **Swarm worker budget** — Per-worker utilization metrics in swarm worker budget tracking
|
|
34
|
+
- **Tests** — `codebase-ast.test.ts`, `edit-validator.test.ts`
|
|
35
|
+
|
|
36
|
+
#### Agent Execution and Safety
|
|
37
|
+
- **Swarm decomposition fallback** — ProductionAgent falls back to direct execution when swarm decomposition fails
|
|
38
|
+
- **Strict tool usage** — Defaults enforce strict tool usage rules for file operations
|
|
39
|
+
- **Execution policy** — Improved settings for non-interactive modes and subagent risk management
|
|
40
|
+
- **Safeguards** — Tool call limits and context overflow prevention in execution loops
|
|
41
|
+
- **Tests** — `execution-loop.test.ts`, `tool-executor.test.ts`, `economics-global-doom.test.ts`
|
|
42
|
+
|
|
43
|
+
#### Task Management and Diagnostics
|
|
44
|
+
- **Completion event diagnostics** — ProductionAgent completion event now includes insights on available tasks and pending tasks with owners
|
|
45
|
+
- **`countPendingTasksWithOwners()`** — New function for task management accuracy
|
|
46
|
+
- **Task ownership normalization** — Only in-progress tasks retain ownership metadata; enhances task dispatchability
|
|
47
|
+
- **TUI diagnostics** — Display additional diagnostic info when task completion is blocked; improved user feedback
|
|
48
|
+
- **Tests** — Task ownership normalization and scenario validation in `task-manager.test.ts`
|
|
49
|
+
|
|
50
|
+
#### Other
|
|
51
|
+
- **package-lock.json** — Lockfile for consistent installations
|
|
52
|
+
- **Lifecycle hooks** — Document payload/event usage and operational notes in API reference
|
|
53
|
+
- **Trace dashboard** — Agent topology page, code map, session detail enhancements, swarm dashboard improvements
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Legacy config** — `loadUserConfig()` in config.ts deprecated; use `loadConfig()` from config/index
|
|
58
|
+
- **Agent structure** — ~3.4K lines extracted from agent.ts into core modules; cleaner separation of concerns
|
|
59
|
+
|
|
60
|
+
### Documentation
|
|
61
|
+
|
|
62
|
+
- **README** — Branch change highlights, resilience tuning
|
|
63
|
+
- **TUI/modes guide** — Bounded incomplete-action auto-loop behavior
|
|
64
|
+
- **Troubleshooting** — New guide: `open_tasks` stale leases, swarm `dispatchLeaseStaleMs` stale dispatched recovery
|
|
65
|
+
- **API/config** — Document `resilience.taskLeaseStaleMs`, swarm `resilience.dispatchLeaseStaleMs`
|
|
66
|
+
- **Swarm configuration guide** — Clarify camelCase/snake_case alias support in budget, communication, resilience
|
|
67
|
+
- **examples/config/config.json** — Add `taskLeaseStaleMs`
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- Trivial `let` → `const`; rename unused catch param to `_err`
|
|
72
|
+
|
|
73
|
+
## [0.2.3] - 2026-02-13
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
#### Pre-Dispatch Auto-Split
|
|
78
|
+
- **Pre-dispatch auto-split** — Proactively splits high-complexity foundation tasks before dispatch using heuristic pre-filtering + LLM judgment (`shouldAutoSplit`, `judgeSplit` in orchestrator, `autoSplit` config in types)
|
|
79
|
+
|
|
80
|
+
#### Per-Model Hollow Tracking
|
|
81
|
+
- **Per-model hollow tracking** — Separate hollow completion tracking per model (`recordHollow`, `getHollowRate`, `getHollowCount` in `ModelHealthTracker`), hollow-aware worker selection sorting
|
|
82
|
+
|
|
83
|
+
#### Unified Policy Engine
|
|
84
|
+
- **Unified policy engine** (`policy-engine.ts`, 334 lines) — Centralized permission resolution for all tool and bash operations, merges built-in defaults with user/project overrides, supports per-task-type policy profiles
|
|
85
|
+
|
|
86
|
+
#### Bash Policy Module
|
|
87
|
+
- **Bash policy module** (`bash-policy.ts`, 168 lines) — Single source of truth for bash command classification (read-only, write, file mutation patterns), replaces scattered inline regex
|
|
88
|
+
|
|
89
|
+
#### Per-Task-Type Configuration
|
|
90
|
+
- **Per-task-type configuration** — `BUILTIN_TASK_TYPE_CONFIGS` with type-specific timeouts, budgets, tool requirements, and policy profiles for implement/test/refactor/research/review/document tasks
|
|
91
|
+
|
|
92
|
+
#### Resilience & Recovery
|
|
93
|
+
- **Artifact-aware cascade skip** — Tasks with failed dependencies check for on-disk artifacts before skipping; partial results from failed predecessors are reused
|
|
94
|
+
- **Artifact inventory** — Post-swarm disk scan (`collectArtifactInventory`) that reports total files, bytes, and per-task file lists in `swarm.complete` event
|
|
95
|
+
- **Mid-swarm re-planning** — Stall detection (`swarm.stall` event) with progress ratio monitoring; automatic re-planning (`swarm.replan`) that generates replacement tasks for stuck work
|
|
96
|
+
- **All-probe-failure abort** — `swarm.abort` event when all probe models fail, preventing infinite retry loops
|
|
97
|
+
- **Wave-level all-failed recovery** — `swarm.wave.allFailed` event and recovery path when every task in a wave fails
|
|
98
|
+
- **Circuit breaker for rate limits** — `swarm.circuit.open`/`closed` events with configurable pause duration
|
|
99
|
+
|
|
100
|
+
#### Decision Traceability
|
|
101
|
+
- **Decision traceability** — Full per-attempt event records (`swarm.task.attempt`) with model, duration, tool calls, failure mode; plus `swarm.task.resilience` events for recovery strategies
|
|
102
|
+
|
|
103
|
+
#### Foundation Task Detection
|
|
104
|
+
- **Foundation task detection** — Tasks with 3+ dependents auto-tagged `isFoundation`, receive extra retries (+1) and relaxed quality thresholds (-1)
|
|
105
|
+
|
|
106
|
+
#### Quality Gate Enhancements
|
|
107
|
+
- **Quality gate enhancements** — `recordQualityRejection` on `ModelHealthTracker` undoes premature `recordSuccess`; pre-flight rejection tracking; file artifact passing to quality judge
|
|
108
|
+
|
|
109
|
+
#### Swarm Events & Observability
|
|
110
|
+
- **Swarm phase progress events** — `swarm.phase.progress` for decomposing/planning/scheduling visibility in dashboard
|
|
111
|
+
- **Orchestrator LLM call tracking** — `swarm.orchestrator.llm` events for all orchestrator-level LLM calls with token/cost tracking
|
|
112
|
+
|
|
113
|
+
#### Other Additions
|
|
114
|
+
- **Smart decomposer dependency mapping** — Improved smart-decomposer with proper 0-based task ID mapping for dependency references
|
|
115
|
+
- **Model selector write capability** — `selectWorkerForCapability` now handles `'write'` capability with fallback to code workers
|
|
116
|
+
- **Swarm config YAML loader enhancements** — Extended YAML config support for all new config fields (`autoSplit`, `hollowTermination`, `probeModels`, `artifactAwareSkip`, `permissions`, `policyProfiles`, `taskTypeConfigs`)
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
|
|
120
|
+
- **SwarmFileWatcher replay bug** — When `sinceSeq=0`, watcher incorrectly skipped to end of `events.jsonl` producing empty Event Feed; fixed to replay from offset 0
|
|
121
|
+
- **Worker-pool double-selection** — `dispatch()` now accepts optional pre-selected worker to avoid selecting a different worker than intended
|
|
122
|
+
- **toolAccessMode default** — Reverted from `'whitelist'` to `'all'` (whitelist broke swarms without explicit `allowedTools`)
|
|
123
|
+
- **swarm-event-bridge completion** — `swarm.complete` now correctly updates `lastStatus.phase` to `'completed'` and cancels pending debounced writes
|
|
124
|
+
- **Hollow recording specificity** — Changed generic `recordFailure(model, 'error')` to `recordHollow(model)` for hollow completions, preserving failure tracking while adding hollow-specific metrics
|
|
125
|
+
- **selectAlternativeModel ghost models** — Returns `undefined` when no configured alternative exists instead of injecting unconfigured fallback workers
|
|
126
|
+
- **Subagent cleanup** — Per-agent blackboard cleanup (`releaseAll` + `unsubscribeAgent`) for subagents, full `clear()` for root
|
|
127
|
+
- **DynamicBudgetPool parallel spawns** — Temporarily swapped in for parallel spawn operations
|
|
128
|
+
- **Quality gate file artifacts** — `evaluateWorkerOutput` accepts optional `fileArtifacts` param for passing actual file contents to judge
|
|
129
|
+
|
|
130
|
+
### Improved
|
|
131
|
+
|
|
132
|
+
- **Agent.ts** — +582 lines of improvements including enhanced subagent lifecycle, better cancellation handling, improved spawn orchestration
|
|
133
|
+
- **Swarm orchestrator** — +1,984 lines with comprehensive resilience, traceability, and recovery improvements
|
|
134
|
+
- **Task queue** — +293 lines with `partialDependencyThreshold` support, improved wave scheduling
|
|
135
|
+
- **Worker pool** — +282 lines with better dispatch logic, worker selection improvements
|
|
136
|
+
- **Quality gate** — +356 lines with enhanced evaluation, pre-flight checks, artifact awareness
|
|
137
|
+
- **Economics** — +181 lines with improved budget tracking and doom loop detection
|
|
138
|
+
- **Safety module** — Enhanced safety checks and policy integration
|
|
139
|
+
- **CLI** — Updated CLI with new command support and configuration options
|
|
140
|
+
|
|
141
|
+
### Tests
|
|
142
|
+
|
|
143
|
+
#### New Test Files (~6,391 lines)
|
|
144
|
+
- `tests/swarm/auto-split.test.ts` — Pre-dispatch auto-split heuristics, LLM judge parsing, config defaults (11 tests)
|
|
145
|
+
- `tests/swarm/anti-death.test.ts` — Death spiral prevention, hollow termination, probe model fallback
|
|
146
|
+
- `tests/swarm/artifact-inventory.test.ts` — Post-swarm artifact collection and reporting
|
|
147
|
+
- `tests/swarm/cascade-timing.test.ts` — Cascade skip timing, artifact-aware skip, partial dependency threshold
|
|
148
|
+
- `tests/swarm/decision-traceability.test.ts` — Per-attempt records, resilience events, decision logging
|
|
149
|
+
- `tests/swarm/resilience-all-paths.test.ts` — All resilience recovery paths (micro-decompose, degraded acceptance, auto-split)
|
|
150
|
+
- `tests/swarm/resume-recovery.test.ts` — Session resume, checkpoint restore, wave recovery
|
|
151
|
+
- `tests/swarm/swarm-orchestrator-resilience.test.ts` — Orchestrator-level resilience integration tests
|
|
152
|
+
- `tests/integrations/bash-policy.test.ts` — Bash command classification, read-only detection, mutation patterns
|
|
153
|
+
- `tests/integrations/policy-engine.test.ts` — Policy resolution, profile merging, override precedence
|
|
154
|
+
|
|
155
|
+
#### Modified Test Files
|
|
156
|
+
- `tests/swarm/model-selector.test.ts` — Added 7 new tests for hollow tracking, quality rejection, write capability
|
|
157
|
+
- `tests/swarm/swarm-quality-gate.test.ts` — Enhanced quality gate test coverage
|
|
158
|
+
- `tests/swarm/swarm-quality-death-spiral.test.ts` — Death spiral detection improvements
|
|
159
|
+
- `tests/swarm/swarm-hollow-completion.test.ts` — Hollow completion handling updates
|
|
160
|
+
- `tests/swarm/foundation-and-gaps.test.ts` — Foundation task detection tests
|
|
161
|
+
- `tests/swarm/config-loader.test.ts` — Extended config loading tests
|
|
162
|
+
- `tests/swarm/types.test.ts` — New type validation tests
|
|
163
|
+
- `tests/swarm/worker-prompts.test.ts` — Worker prompt generation tests
|
|
164
|
+
- `tests/economics.test.ts` — Economics system test updates
|
|
165
|
+
- `tests/smart-decomposer-deps.test.ts` — Decomposer dependency mapping tests
|
|
166
|
+
- `tests/tool-recommendation.test.ts` — Tool recommendation test updates
|
|
167
|
+
|
|
168
|
+
### Documentation
|
|
169
|
+
|
|
170
|
+
- `docs/swarm-mode.md` — Updated swarm mode documentation
|
|
171
|
+
- `docs/swarm/configuration-guide.md` — Extended configuration guide with new options
|
|
172
|
+
- `docs/swarm/examples/quality-focused.yaml` — Quality-focused swarm configuration example
|
|
173
|
+
|
|
8
174
|
## [0.2.2] - 2026-02-10
|
|
9
175
|
|
|
10
176
|
### Added
|
|
@@ -91,8 +257,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
91
257
|
- **Doom loop detection** (`src/integrations/economics.ts`) — `updateDoomLoopState()` now uses fingerprint-based fuzzy matching in addition to exact-match detection.
|
|
92
258
|
- **Plan mode security** (`src/modes.ts`) — `shouldInterceptTool()` switched from blocklist to allowlist for bash commands.
|
|
93
259
|
|
|
94
|
-
### Notes
|
|
95
|
-
- Phase 2-4 modules are exported and fully tested but not yet wired into `agent.ts` main loop (`spawnAgent()`, `buildMessages()`, `executeDirectly()`, `run()`). Integration wiring is planned as a separate step to minimize risk to the core agent loop.
|
|
96
260
|
|
|
97
261
|
## [0.2.1] - 2026-02-08
|
|
98
262
|
|
|
@@ -421,7 +585,9 @@ A new execution mode where one orchestrator model decomposes tasks into subtask
|
|
|
421
585
|
- Sandbox execution for bash commands (macOS Seatbelt)
|
|
422
586
|
- Dangerous operation blocking in strict mode
|
|
423
587
|
|
|
424
|
-
[Unreleased]: https://github.com/eren23/attocode/compare/v0.2.
|
|
588
|
+
[Unreleased]: https://github.com/eren23/attocode/compare/v0.2.4...HEAD
|
|
589
|
+
[0.2.4]: https://github.com/eren23/attocode/compare/v0.2.3...v0.2.4
|
|
590
|
+
[0.2.3]: https://github.com/eren23/attocode/compare/v0.2.2...v0.2.3
|
|
425
591
|
[0.2.2]: https://github.com/eren23/attocode/compare/v0.2.1...v0.2.2
|
|
426
592
|
[0.2.1]: https://github.com/eren23/attocode/compare/v0.2.0...v0.2.1
|
|
427
593
|
[0.2.0]: https://github.com/eren23/attocode/compare/v0.1.9...v0.2.0
|
package/README.md
CHANGED
|
@@ -237,14 +237,74 @@ Config file: `~/.config/attocode/config.json`
|
|
|
237
237
|
"model": "anthropic/claude-sonnet-4",
|
|
238
238
|
"maxIterations": 50,
|
|
239
239
|
"timeout": 300000,
|
|
240
|
-
"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
"memory": { "enabled": true },
|
|
241
|
+
"planning": { "enabled": true },
|
|
242
|
+
"sandbox": { "enabled": true },
|
|
243
|
+
"resilience": {
|
|
244
|
+
"incompleteActionAutoLoop": true,
|
|
245
|
+
"maxIncompleteAutoLoops": 2,
|
|
246
|
+
"autoLoopPromptStyle": "strict",
|
|
247
|
+
"taskLeaseStaleMs": 300000
|
|
248
|
+
},
|
|
249
|
+
"hooks": {
|
|
250
|
+
"enabled": true,
|
|
251
|
+
"shell": {
|
|
252
|
+
"enabled": false,
|
|
253
|
+
"defaultTimeoutMs": 5000,
|
|
254
|
+
"envAllowlist": ["SLACK_WEBHOOK_URL"],
|
|
255
|
+
"commands": [
|
|
256
|
+
{
|
|
257
|
+
"id": "notify-on-complete",
|
|
258
|
+
"event": "run.after",
|
|
259
|
+
"command": "node",
|
|
260
|
+
"args": ["./scripts/hook-notify.js"],
|
|
261
|
+
"timeoutMs": 3000
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
244
265
|
}
|
|
245
266
|
}
|
|
246
267
|
```
|
|
247
268
|
|
|
269
|
+
### Behavior Tuning (Incomplete Recovery)
|
|
270
|
+
|
|
271
|
+
These settings control what happens when the model replies with "I'll do X" but has not executed the action yet:
|
|
272
|
+
|
|
273
|
+
- `resilience.incompleteActionAutoLoop`: Automatically retry incomplete runs in TUI.
|
|
274
|
+
- `resilience.maxIncompleteAutoLoops`: Maximum retry runs before terminal `[INCOMPLETE]`.
|
|
275
|
+
- `resilience.autoLoopPromptStyle`: Guidance style for retries (`strict` or `concise`).
|
|
276
|
+
- `resilience.taskLeaseStaleMs`: Requeue stale `in_progress` tasks to `pending` at run boundaries.
|
|
277
|
+
|
|
278
|
+
For swarm runs, `resilience.dispatchLeaseStaleMs` in swarm config controls stale `dispatched` task recovery back to `ready`.
|
|
279
|
+
|
|
280
|
+
### Branch Change Highlights
|
|
281
|
+
|
|
282
|
+
- Added bounded incomplete-action recovery (`future_intent` / `incomplete_action`) in TUI.
|
|
283
|
+
- Added run-boundary stale task lease recovery in core task manager.
|
|
284
|
+
- Added stale dispatched-task recovery in swarm queue/orchestrator.
|
|
285
|
+
- Added lifecycle shell-hook coverage for completion/recovery/run phases.
|
|
286
|
+
|
|
287
|
+
### Lifecycle Hooks (Trigger External Automations)
|
|
288
|
+
|
|
289
|
+
You can trigger scripts on lifecycle events (for notifications, logging, CI checks, policy alerts).
|
|
290
|
+
|
|
291
|
+
Common lifecycle events:
|
|
292
|
+
- `run.before`, `run.after`
|
|
293
|
+
- `iteration.before`, `iteration.after`
|
|
294
|
+
- `completion.before`, `completion.after`
|
|
295
|
+
- `recovery.before`, `recovery.after`
|
|
296
|
+
- `llm.before`, `llm.after`
|
|
297
|
+
- `tool.before`, `tool.after`
|
|
298
|
+
|
|
299
|
+
Shell hooks receive JSON on stdin:
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"event": "run.after",
|
|
304
|
+
"payload": { "...": "event-specific data" }
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
248
308
|
## File Locations (XDG compliant)
|
|
249
309
|
|
|
250
310
|
| Purpose | Location |
|
|
@@ -399,4 +459,4 @@ rm -rf ~/.config/attocode
|
|
|
399
459
|
rm -rf ~/.local/share/attocode
|
|
400
460
|
rm -rf ~/.local/state/attocode
|
|
401
461
|
rm -rf ~/.cache/attocode
|
|
402
|
-
```
|
|
462
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,WAAW,IAAI,qBAAqB,EACpC,WAAW,IAAI,qBAAqB,EACpC,YAAY,IAAI,sBAAsB,EACtC,cAAc,IAAI,wBAAwB,EAC1C,OAAO,IAAI,iBAAiB,EAC7B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,WAAW,IAAI,qBAAqB,EACpC,WAAW,IAAI,qBAAqB,EACpC,YAAY,IAAI,sBAAsB,EACtC,cAAc,IAAI,wBAAwB,EAC1C,OAAO,IAAI,iBAAiB,EAC7B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASxD;;;;;;GAMG;AACH,qBAAa,eAAgB,YAAW,qBAAqB;IAEzD,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,YAAY,CAAC;gBADb,QAAQ,EAAE,oBAAoB,EAC9B,YAAY,CAAC,EAAE,MAAM,YAAA;IAGzB,IAAI,CACR,QAAQ,EAA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AAC;KAC/C,KAAK,IAAI,CAAC;IAEX,2CAA2C;IAC3C,OAAO,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE9C,0CAA0C;IAC1C,UAAU,EAAE,MAAM,OAAO,CAAC;IAE1B,8DAA8D;IAC9D,WAAW,EAAE,MAAM,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,uBAA4B,GAAG,iBAAiB,CAiE/F"}
|
package/dist/src/adapters.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { stableStringify } from './integrations/index.js';
|
|
8
8
|
import { safeParseJson } from './tricks/json-utils.js';
|
|
9
|
+
import { logger } from './integrations/logger.js';
|
|
9
10
|
// =============================================================================
|
|
10
11
|
// PROVIDER ADAPTER
|
|
11
12
|
// =============================================================================
|
|
@@ -69,9 +70,12 @@ export class ProviderAdapter {
|
|
|
69
70
|
context: `tool ${tc.function.name}`,
|
|
70
71
|
});
|
|
71
72
|
if (!result.success) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
logger.warn('Failed to parse tool call arguments', {
|
|
74
|
+
tool: tc.function.name,
|
|
75
|
+
error: result.error,
|
|
76
|
+
firstChars: tc.function.arguments.slice(0, 100),
|
|
77
|
+
lastChars: tc.function.arguments.slice(-50),
|
|
78
|
+
});
|
|
75
79
|
parseError = `Failed to parse arguments as JSON. Raw text (first 200 chars): ${tc.function.arguments.slice(0, 200)}`;
|
|
76
80
|
}
|
|
77
81
|
args = result.success && result.value ? result.value : {};
|
|
@@ -165,16 +169,16 @@ export function createInteractiveApprovalHandler(rl) {
|
|
|
165
169
|
cyan: '\x1b[36m',
|
|
166
170
|
dim: '\x1b[2m',
|
|
167
171
|
};
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
logger.info(`\n${colors.yellow}⚠️ Approval Required${colors.reset}`);
|
|
173
|
+
logger.info(`${colors.cyan}Action:${colors.reset} ${request.action}`);
|
|
170
174
|
if (request.tool) {
|
|
171
|
-
|
|
175
|
+
logger.info(`${colors.cyan}Tool:${colors.reset} ${request.tool}`);
|
|
172
176
|
}
|
|
173
177
|
if (request.args) {
|
|
174
|
-
|
|
178
|
+
logger.info(`${colors.cyan}Args:${colors.reset} ${JSON.stringify(request.args, null, 2)}`);
|
|
175
179
|
}
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
logger.info(`${colors.cyan}Risk:${colors.reset} ${request.risk}`);
|
|
181
|
+
logger.info(`${colors.dim}${request.context}${colors.reset}`);
|
|
178
182
|
const answer = await rl.question(`\n${colors.yellow}Approve? (y/n/reason): ${colors.reset}`);
|
|
179
183
|
const trimmed = answer.trim().toLowerCase();
|
|
180
184
|
if (trimmed === 'y' || trimmed === 'yes') {
|
|
@@ -231,7 +235,7 @@ export function createTUIApprovalBridge(config = {}) {
|
|
|
231
235
|
// Set up timeout - deny if not resolved within the timeout period
|
|
232
236
|
pendingTimeoutId = setTimeout(() => {
|
|
233
237
|
if (pendingResolve) {
|
|
234
|
-
|
|
238
|
+
logger.warn('TUI approval timeout - denying operation for safety', { timeoutMs });
|
|
235
239
|
config.onTimeout?.(request);
|
|
236
240
|
pendingResolve({
|
|
237
241
|
approved: false,
|
|
@@ -245,7 +249,7 @@ export function createTUIApprovalBridge(config = {}) {
|
|
|
245
249
|
else {
|
|
246
250
|
// TUI not connected yet - BLOCK dangerous operations instead of auto-approving
|
|
247
251
|
// This is a safety fallback to prevent operations when the approval system isn't ready
|
|
248
|
-
|
|
252
|
+
logger.warn('No TUI connected - blocking operation for safety');
|
|
249
253
|
resolve({ approved: false, reason: 'Approval system not ready - TUI not connected' });
|
|
250
254
|
pendingResolve = null;
|
|
251
255
|
}
|
package/dist/src/adapters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAEhB;IACA;IAFV,YACU,QAA8B,EAC9B,YAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,iBAAY,GAAZ,YAAY,CAAS;IAC5B,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,QAA6B,EAC7B,OAA+B;QAE/B,yDAAyD;QACzD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,CAAC,CAAC,IAAgD;YACxD,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBAClC,EAAE,EAAE,EAAE,CAAC,EAAE;gBACT,IAAI,EAAE,UAAmB;gBACzB,QAAQ,EAAE;oBACR,IAAI,EAAE,EAAE,CAAC,IAAI;oBACb,SAAS,EAAE,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC;iBACzC;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AE,CAAC,cAAc,KAAK,IAAI,CAAC;IAEjD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC;IAEpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
|
package/dist/src/agent.d.ts
CHANGED
|
@@ -21,44 +21,11 @@
|
|
|
21
21
|
import type { ProductionAgentConfig, LLMProvider, Message, ToolDefinition, AgentState, AgentMetrics, AgentPlan, AgentResult, AgentEventListener, AgentRoleConfig } from './types.js';
|
|
22
22
|
import { type AgentMode } from './modes.js';
|
|
23
23
|
import { type LSPFileToolsConfig } from './agent-tools/index.js';
|
|
24
|
-
import { AgentRegistry, LSPManager, SkillManager, type ExecutionBudget, type AgentRole, type TeamTask, type TeamResult, type ReActTrace, type Checkpoint, type AgentDefinition, type LoadedAgent, type SpawnResult, type
|
|
24
|
+
import { AgentRegistry, LSPManager, SkillManager, type ExecutionBudget, type AgentRole, type TeamTask, type TeamResult, type ReActTrace, type Checkpoint, type AgentDefinition, type LoadedAgent, type SpawnResult, type CancellationTokenType, type Skill, type ApprovalScope, type PendingPlan, LearningStore, AutoCompactionManager, FileChangeTracker, CapabilitiesRegistry, TaskManager, type SQLiteStore } from './integrations/index.js';
|
|
25
25
|
import { TraceCollector } from './tracing/trace-collector.js';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
export declare const PARALLELIZABLE_TOOLS: Set<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Tools that can run in parallel IF they target different files.
|
|
33
|
-
* write_file and edit_file on different paths are safe to parallelize.
|
|
34
|
-
*/
|
|
35
|
-
export declare const CONDITIONALLY_PARALLEL_TOOLS: Set<string>;
|
|
36
|
-
/**
|
|
37
|
-
* Extract the target file path from a tool call's arguments.
|
|
38
|
-
* Returns null if no file path can be determined.
|
|
39
|
-
*/
|
|
40
|
-
export declare function extractToolFilePath(toolCall: {
|
|
41
|
-
name: string;
|
|
42
|
-
[key: string]: unknown;
|
|
43
|
-
}): string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Groups tool calls into batches for parallel/sequential execution.
|
|
46
|
-
* Uses accumulate-and-flush: parallelizable tools accumulate until a
|
|
47
|
-
* non-parallelizable tool flushes them as a batch. This produces optimal
|
|
48
|
-
* batching even for non-consecutive parallelizable tools.
|
|
49
|
-
*
|
|
50
|
-
* Enhanced with conditional parallelism: write_file/edit_file on
|
|
51
|
-
* DIFFERENT files can be batched together for parallel execution.
|
|
52
|
-
*
|
|
53
|
-
* Example: [read1, read2, write, read3, grep] → [[read1, read2], [write], [read3, grep]]
|
|
54
|
-
* (Previous algorithm produced 4 batches; this produces 3)
|
|
55
|
-
*
|
|
56
|
-
* Enhanced: [write_a, write_b, write_a] → [[write_a, write_b], [write_a]]
|
|
57
|
-
* (Different files parallelized, same file sequential)
|
|
58
|
-
*/
|
|
59
|
-
export declare function groupToolCallsIntoBatches<T extends {
|
|
60
|
-
name: string;
|
|
61
|
-
}>(toolCalls: T[], isParallelizable?: (tc: T) => boolean, isConditionallyParallel?: (tc: T) => boolean): T[][];
|
|
26
|
+
import { type SpawnConstraints } from './tools/agent.js';
|
|
27
|
+
import { PARALLELIZABLE_TOOLS, CONDITIONALLY_PARALLEL_TOOLS, extractToolFilePath, groupToolCallsIntoBatches } from './core/index.js';
|
|
28
|
+
export { PARALLELIZABLE_TOOLS, CONDITIONALLY_PARALLEL_TOOLS, extractToolFilePath, groupToolCallsIntoBatches };
|
|
62
29
|
/**
|
|
63
30
|
* Production-ready agent that composes all features.
|
|
64
31
|
*/
|
|
@@ -86,6 +53,7 @@ export declare class ProductionAgent {
|
|
|
86
53
|
private skillManager;
|
|
87
54
|
private contextEngineering;
|
|
88
55
|
private codebaseContext;
|
|
56
|
+
private codebaseAnalysisTriggered;
|
|
89
57
|
private traceCollector;
|
|
90
58
|
private modeManager;
|
|
91
59
|
private pendingPlanManager;
|
|
@@ -100,6 +68,8 @@ export declare class ProductionAgent {
|
|
|
100
68
|
private agentId;
|
|
101
69
|
private blackboard;
|
|
102
70
|
private fileCache;
|
|
71
|
+
private _sharedContextState;
|
|
72
|
+
private _sharedEconomicsState;
|
|
103
73
|
private budgetPool;
|
|
104
74
|
private taskManager;
|
|
105
75
|
private store;
|
|
@@ -111,14 +81,16 @@ export declare class ProductionAgent {
|
|
|
111
81
|
private subagentOutputStore;
|
|
112
82
|
private autoCheckpointManager;
|
|
113
83
|
private toolRecommendation;
|
|
84
|
+
private stateMachine;
|
|
114
85
|
private lastComplexityAssessment;
|
|
86
|
+
private lastSystemPromptLength;
|
|
115
87
|
private spawnedTasks;
|
|
116
|
-
private static readonly SPAWN_DEDUP_WINDOW_MS;
|
|
117
88
|
private parentIterations;
|
|
118
89
|
private externalCancellationToken;
|
|
119
90
|
private wrapupRequested;
|
|
120
91
|
private wrapupReason;
|
|
121
92
|
private cacheableSystemBlocks;
|
|
93
|
+
private compactionPending;
|
|
122
94
|
private initPromises;
|
|
123
95
|
private initComplete;
|
|
124
96
|
private unsubscribers;
|
|
@@ -156,7 +128,7 @@ export declare class ProductionAgent {
|
|
|
156
128
|
*/
|
|
157
129
|
private runSwarm;
|
|
158
130
|
/**
|
|
159
|
-
* Execute a task directly without planning.
|
|
131
|
+
* Execute a task directly without planning (delegates to core/execution-loop).
|
|
160
132
|
*/
|
|
161
133
|
private executeDirectly;
|
|
162
134
|
/**
|
|
@@ -166,24 +138,14 @@ export declare class ProductionAgent {
|
|
|
166
138
|
* is available, ensuring static content is ordered for optimal KV-cache reuse.
|
|
167
139
|
*/
|
|
168
140
|
private buildMessages;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
private callLLM;
|
|
141
|
+
private buildContext;
|
|
142
|
+
private buildMutators;
|
|
143
|
+
private createSubAgentFactory;
|
|
173
144
|
/**
|
|
174
145
|
* Execute an async callback while excluding wall-clock wait time from duration budgeting.
|
|
175
146
|
* Used for external waits such as approval dialogs and delegation confirmation.
|
|
176
147
|
*/
|
|
177
148
|
private withPausedDuration;
|
|
178
|
-
/**
|
|
179
|
-
* Execute tool calls with safety checks and execution policy enforcement.
|
|
180
|
-
* Parallelizable read-only tools are batched and executed concurrently.
|
|
181
|
-
*/
|
|
182
|
-
private executeToolCalls;
|
|
183
|
-
/**
|
|
184
|
-
* Execute a single tool call with all safety checks, tracing, and error handling.
|
|
185
|
-
*/
|
|
186
|
-
private executeSingleToolCall;
|
|
187
149
|
/**
|
|
188
150
|
* Get recently modified file paths from the file change tracker.
|
|
189
151
|
* Returns paths of files modified in this session (not undone).
|
|
@@ -203,20 +165,6 @@ export declare class ProductionAgent {
|
|
|
203
165
|
* Emit an event.
|
|
204
166
|
*/
|
|
205
167
|
private emit;
|
|
206
|
-
/**
|
|
207
|
-
* Create a brief summary of a tool result for insight display.
|
|
208
|
-
*/
|
|
209
|
-
private summarizeToolResult;
|
|
210
|
-
/**
|
|
211
|
-
* Format tool arguments for plan display.
|
|
212
|
-
*/
|
|
213
|
-
private formatToolArgsForPlan;
|
|
214
|
-
/**
|
|
215
|
-
* Extract contextual reasoning for a proposed change in plan mode.
|
|
216
|
-
* Looks at recent assistant messages to find relevant explanation.
|
|
217
|
-
* Returns a more complete reason than simple truncation.
|
|
218
|
-
*/
|
|
219
|
-
private extractChangeReasoning;
|
|
220
168
|
/**
|
|
221
169
|
* Update memory statistics.
|
|
222
170
|
* Memory stats are retrieved via memory manager, not stored in state.
|
|
@@ -226,15 +174,35 @@ export declare class ProductionAgent {
|
|
|
226
174
|
* Get current metrics.
|
|
227
175
|
*/
|
|
228
176
|
getMetrics(): AgentResult['metrics'];
|
|
177
|
+
getResilienceConfig(): ProductionAgentConfig['resilience'];
|
|
229
178
|
/**
|
|
230
179
|
* Get current state.
|
|
231
180
|
*/
|
|
232
181
|
getState(): AgentState;
|
|
182
|
+
/**
|
|
183
|
+
* Get shared state stats for TUI visibility.
|
|
184
|
+
* Returns null when not in a swarm context.
|
|
185
|
+
*/
|
|
186
|
+
getSharedStats(): {
|
|
187
|
+
context: {
|
|
188
|
+
failures: number;
|
|
189
|
+
references: number;
|
|
190
|
+
};
|
|
191
|
+
economics: {
|
|
192
|
+
fingerprints: number;
|
|
193
|
+
globalLoops: string[];
|
|
194
|
+
};
|
|
195
|
+
} | null;
|
|
233
196
|
/**
|
|
234
197
|
* Get the maximum context tokens for this agent's model.
|
|
235
198
|
* Priority: user config > OpenRouter API > hardcoded ModelRegistry > 200K default
|
|
236
199
|
*/
|
|
237
200
|
getMaxContextTokens(): number;
|
|
201
|
+
/**
|
|
202
|
+
* Estimate tokens used by the system prompt (codebase context, tools, rules).
|
|
203
|
+
* Used by TUI to display accurate context % that includes system overhead.
|
|
204
|
+
*/
|
|
205
|
+
getSystemPromptTokenEstimate(): number;
|
|
238
206
|
/**
|
|
239
207
|
* Get the trace collector (Lesson 26).
|
|
240
208
|
* Returns null if trace capture is not enabled.
|
|
@@ -352,10 +320,8 @@ export declare class ProductionAgent {
|
|
|
352
320
|
* Check whether a requested artifact appears to be missing based on executed tools.
|
|
353
321
|
*/
|
|
354
322
|
private isRequestedArtifactMissing;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
*/
|
|
358
|
-
private detectIncompleteActionResponse;
|
|
323
|
+
private getOpenTasksSummary;
|
|
324
|
+
private reconcileStaleTasks;
|
|
359
325
|
/**
|
|
360
326
|
* Get audit log (if human-in-loop is enabled).
|
|
361
327
|
*/
|
|
@@ -426,6 +392,10 @@ export declare class ProductionAgent {
|
|
|
426
392
|
commandsRun: number;
|
|
427
393
|
isStuck: boolean;
|
|
428
394
|
} | null;
|
|
395
|
+
/**
|
|
396
|
+
* Get actual file paths modified during this agent's session.
|
|
397
|
+
*/
|
|
398
|
+
getModifiedFilePaths(): string[];
|
|
429
399
|
/**
|
|
430
400
|
* Extend the budget limits.
|
|
431
401
|
*/
|
|
@@ -489,26 +459,11 @@ export declare class ProductionAgent {
|
|
|
489
459
|
*/
|
|
490
460
|
unregisterAgent(name: string): boolean;
|
|
491
461
|
/**
|
|
492
|
-
* Spawn
|
|
493
|
-
* Returns the result when the agent completes.
|
|
494
|
-
*
|
|
495
|
-
* @param agentName - Name of the agent to spawn (researcher, coder, etc.)
|
|
496
|
-
* @param task - The task description for the agent
|
|
497
|
-
* @param constraints - Optional constraints to keep the subagent focused
|
|
462
|
+
* Spawn a subagent (delegates to core/subagent-spawner).
|
|
498
463
|
*/
|
|
499
|
-
spawnAgent(agentName: string, task: string, constraints?:
|
|
464
|
+
spawnAgent(agentName: string, task: string, constraints?: SpawnConstraints): Promise<SpawnResult>;
|
|
500
465
|
/**
|
|
501
|
-
* Spawn multiple
|
|
502
|
-
* Uses the shared blackboard for coordination and conflict prevention.
|
|
503
|
-
*
|
|
504
|
-
* Get budget for a subagent, using the pooled budget when available.
|
|
505
|
-
* Falls back to the static SUBAGENT_BUDGET if no pool is configured.
|
|
506
|
-
* Returns both the budget and the pool allocation ID (if any) for tracking.
|
|
507
|
-
*/
|
|
508
|
-
private getSubagentBudget;
|
|
509
|
-
/**
|
|
510
|
-
* Uses Promise.allSettled to handle partial failures gracefully - if one
|
|
511
|
-
* agent fails or times out, others can still complete successfully.
|
|
466
|
+
* Spawn multiple subagents in parallel (delegates to core/subagent-spawner).
|
|
512
467
|
*/
|
|
513
468
|
spawnAgentsParallel(tasks: Array<{
|
|
514
469
|
agent: string;
|
|
@@ -919,14 +874,5 @@ export declare class ProductionAgentBuilder {
|
|
|
919
874
|
* Start building a production agent.
|
|
920
875
|
*/
|
|
921
876
|
export declare function buildAgent(): ProductionAgentBuilder;
|
|
922
|
-
|
|
923
|
-
* Parse a structured closure report from a subagent's text response.
|
|
924
|
-
* The subagent may have produced JSON in response to a TIMEOUT_WRAPUP_PROMPT.
|
|
925
|
-
*
|
|
926
|
-
* @param text - The subagent's last response text
|
|
927
|
-
* @param defaultExitReason - Exit reason to use (completed, timeout_graceful, cancelled, etc.)
|
|
928
|
-
* @param fallbackTask - Original task description for fallback remainingWork
|
|
929
|
-
* @returns Parsed StructuredClosureReport, or undefined if no JSON found and no fallback needed
|
|
930
|
-
*/
|
|
931
|
-
export declare function parseStructuredClosureReport(text: string, defaultExitReason: StructuredClosureReport['exitReason'], fallbackTask?: string): StructuredClosureReport | undefined;
|
|
877
|
+
export { parseStructuredClosureReport } from './core/index.js';
|
|
932
878
|
//# sourceMappingURL=agent.d.ts.map
|