attocode 0.2.4 → 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 +56 -1
- package/dist/src/adapters.d.ts +2 -1
- package/dist/src/adapters.d.ts.map +1 -1
- package/dist/src/adapters.js +60 -2
- 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 +14 -115
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +36 -1177
- package/dist/src/agent.js.map +1 -1
- package/dist/src/cli.js +1 -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 +8 -7
- package/dist/src/commands/handler.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/config/schema.d.ts +6 -6
- package/dist/src/core/execution-loop.d.ts.map +1 -1
- package/dist/src/core/execution-loop.js +155 -16
- package/dist/src/core/execution-loop.js.map +1 -1
- package/dist/src/core/response-handler.d.ts.map +1 -1
- package/dist/src/core/response-handler.js +3 -2
- package/dist/src/core/response-handler.js.map +1 -1
- package/dist/src/core/subagent-spawner.d.ts.map +1 -1
- package/dist/src/core/subagent-spawner.js +13 -6
- package/dist/src/core/subagent-spawner.js.map +1 -1
- package/dist/src/core/tool-executor.d.ts.map +1 -1
- package/dist/src/core/tool-executor.js +7 -2
- package/dist/src/core/tool-executor.js.map +1 -1
- package/dist/src/core/types.d.ts +1 -0
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/types.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/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/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/index.d.ts +72 -68
- package/dist/src/integrations/index.d.ts.map +1 -1
- package/dist/src/integrations/index.js +76 -68
- package/dist/src/integrations/index.js.map +1 -1
- 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/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/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/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/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/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/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/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.js +1 -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.map +1 -1
- package/dist/src/integrations/swarm/swarm-config-loader.js +7 -0
- package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts +1 -1
- package/dist/src/integrations/swarm/swarm-events.d.ts.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 +84 -203
- package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
- package/dist/src/integrations/swarm/swarm-orchestrator.js +251 -2870
- 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.map +1 -1
- package/dist/src/integrations/swarm/swarm-state-store.js +6 -0
- package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts +1 -1
- package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
- package/dist/src/integrations/swarm/task-queue.js +28 -1
- package/dist/src/integrations/swarm/task-queue.js.map +1 -1
- package/dist/src/integrations/swarm/types.d.ts +17 -5
- package/dist/src/integrations/swarm/types.d.ts.map +1 -1
- package/dist/src/integrations/swarm/types.js.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts +1 -1
- package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
- package/dist/src/integrations/swarm/worker-pool.js +13 -9
- package/dist/src/integrations/swarm/worker-pool.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 +10 -4
- package/dist/src/main.js.map +1 -1
- package/dist/src/modes/repl.d.ts.map +1 -1
- package/dist/src/modes/repl.js +22 -5
- 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 +23 -6
- 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.js +1 -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 +31 -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 +99 -15
- 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 +39 -8
- 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 +73 -3
- package/dist/src/providers/adapters/openrouter.js.map +1 -1
- package/dist/src/providers/provider.js +1 -1
- package/dist/src/providers/provider.js.map +1 -1
- package/dist/src/providers/resilient-provider.js +1 -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 +1 -1
- package/dist/src/session-picker.js.map +1 -1
- package/dist/src/shared/budget-tracker.js +1 -1
- package/dist/src/shared/budget-tracker.js.map +1 -1
- package/dist/src/tools/agent.d.ts +1 -1
- package/dist/src/tools/agent.d.ts.map +1 -1
- package/dist/src/tools/bash.js +1 -1
- package/dist/src/tools/bash.js.map +1 -1
- package/dist/src/tools/file.js +1 -1
- package/dist/src/tools/file.js.map +1 -1
- package/dist/src/tools/permission.js +2 -2
- 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/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 +22 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -1
- package/dist/src/tracing/trace-collector.js +27 -3
- package/dist/src/tracing/trace-collector.js.map +1 -1
- package/dist/src/tracing/types.d.ts +17 -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.js +1 -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 +3 -3
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +86 -14
- 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.js +1 -1
- 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.js +1 -1
- package/dist/src/tui/event-display.js.map +1 -1
- package/dist/src/tui/index.js +1 -1
- 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 +27 -2
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .agentignore Support
|
|
3
|
+
*
|
|
4
|
+
* AI-specific file exclusion patterns, separate from .gitignore.
|
|
5
|
+
* Allows hiding files from the agent that shouldn't be modified or seen,
|
|
6
|
+
* without affecting git behavior.
|
|
7
|
+
*
|
|
8
|
+
* Priority order (highest first):
|
|
9
|
+
* 1. .agentignore in current directory
|
|
10
|
+
* 2. .gitignore in current directory
|
|
11
|
+
* 3. Global ~/.agent/ignore
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* const ignore = createIgnoreManager();
|
|
15
|
+
* await ignore.load(process.cwd());
|
|
16
|
+
* const filtered = ignore.filterPaths(paths);
|
|
17
|
+
*/
|
|
18
|
+
import { readFile, stat } from 'fs/promises';
|
|
19
|
+
import { join, relative, isAbsolute, normalize, sep } from 'path';
|
|
20
|
+
import { homedir } from 'os';
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// GITIGNORE PATTERN COMPILER
|
|
23
|
+
// =============================================================================
|
|
24
|
+
/**
|
|
25
|
+
* Convert a gitignore-style pattern to a regex.
|
|
26
|
+
* Implements most of the gitignore specification.
|
|
27
|
+
*/
|
|
28
|
+
function compilePattern(pattern) {
|
|
29
|
+
// Check if anchored to root (starts with /)
|
|
30
|
+
const isAnchored = pattern.startsWith('/');
|
|
31
|
+
// Remove leading and trailing slashes for processing
|
|
32
|
+
let cleanPattern = pattern;
|
|
33
|
+
if (isAnchored) {
|
|
34
|
+
cleanPattern = cleanPattern.slice(1); // Remove leading /
|
|
35
|
+
}
|
|
36
|
+
if (cleanPattern.endsWith('/')) {
|
|
37
|
+
cleanPattern = cleanPattern.slice(0, -1); // Remove trailing /
|
|
38
|
+
}
|
|
39
|
+
// Convert gitignore pattern to regex, processing glob patterns before escaping
|
|
40
|
+
let regexStr = cleanPattern
|
|
41
|
+
// First, replace ** with a placeholder
|
|
42
|
+
.replace(/\*\*/g, '\x00GLOBSTAR\x00')
|
|
43
|
+
// Then replace single *
|
|
44
|
+
.replace(/\*/g, '\x00STAR\x00')
|
|
45
|
+
// Then replace ?
|
|
46
|
+
.replace(/\?/g, '\x00QUESTION\x00')
|
|
47
|
+
// Escape remaining regex special chars
|
|
48
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
49
|
+
// Restore glob patterns as regex
|
|
50
|
+
.replace(/\x00GLOBSTAR\x00/g, '.*')
|
|
51
|
+
.replace(/\x00STAR\x00/g, '[^/]*')
|
|
52
|
+
.replace(/\x00QUESTION\x00/g, '[^/]');
|
|
53
|
+
// Handle the prefix: **/ at start matches any depth including root
|
|
54
|
+
if (cleanPattern.startsWith('**/')) {
|
|
55
|
+
// The pattern can match at root level or at any subdirectory
|
|
56
|
+
// (.*/)? matches optional path prefix, then the rest of the pattern
|
|
57
|
+
regexStr = '(.*/)?' + regexStr.slice(4); // slice(4) removes the '.*/' from regex
|
|
58
|
+
}
|
|
59
|
+
else if (cleanPattern.startsWith('**')) {
|
|
60
|
+
regexStr = `^${regexStr}`;
|
|
61
|
+
}
|
|
62
|
+
else if (!isAnchored) {
|
|
63
|
+
// Match anywhere in path (at start or after /)
|
|
64
|
+
regexStr = `(^|/)${regexStr}`;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Anchored to root
|
|
68
|
+
regexStr = `^${regexStr}`;
|
|
69
|
+
}
|
|
70
|
+
// Match at end of path or as a directory prefix
|
|
71
|
+
regexStr = `${regexStr}(/.*)?$`;
|
|
72
|
+
return new RegExp(regexStr);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse a pattern line from ignore file.
|
|
76
|
+
*/
|
|
77
|
+
function parsePatternLine(line, source) {
|
|
78
|
+
// Trim whitespace
|
|
79
|
+
let pattern = line.trim();
|
|
80
|
+
// Skip empty lines and comments
|
|
81
|
+
if (!pattern || pattern.startsWith('#')) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
// Check for negation
|
|
85
|
+
let negated = false;
|
|
86
|
+
if (pattern.startsWith('!')) {
|
|
87
|
+
negated = true;
|
|
88
|
+
pattern = pattern.slice(1);
|
|
89
|
+
}
|
|
90
|
+
// Check for directory-only
|
|
91
|
+
const directoryOnly = pattern.endsWith('/');
|
|
92
|
+
// Compile to regex
|
|
93
|
+
const regex = compilePattern(pattern);
|
|
94
|
+
return {
|
|
95
|
+
pattern,
|
|
96
|
+
negated,
|
|
97
|
+
directoryOnly,
|
|
98
|
+
regex,
|
|
99
|
+
source,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
// =============================================================================
|
|
103
|
+
// DEFAULT PATTERNS
|
|
104
|
+
// =============================================================================
|
|
105
|
+
/**
|
|
106
|
+
* Built-in patterns that are always ignored.
|
|
107
|
+
*/
|
|
108
|
+
const BUILTIN_PATTERNS = [
|
|
109
|
+
// Version control
|
|
110
|
+
'.git',
|
|
111
|
+
'.svn',
|
|
112
|
+
'.hg',
|
|
113
|
+
// Dependencies
|
|
114
|
+
'node_modules',
|
|
115
|
+
'__pycache__',
|
|
116
|
+
'.venv',
|
|
117
|
+
'venv',
|
|
118
|
+
// IDE/Editor
|
|
119
|
+
'.idea',
|
|
120
|
+
'.vscode',
|
|
121
|
+
'*.swp',
|
|
122
|
+
'*.swo',
|
|
123
|
+
'*~',
|
|
124
|
+
// OS files
|
|
125
|
+
'.DS_Store',
|
|
126
|
+
'Thumbs.db',
|
|
127
|
+
// Build outputs (common)
|
|
128
|
+
'dist',
|
|
129
|
+
'build',
|
|
130
|
+
'out',
|
|
131
|
+
// Sensitive files
|
|
132
|
+
'.env',
|
|
133
|
+
'.env.local',
|
|
134
|
+
'*.pem',
|
|
135
|
+
'*.key',
|
|
136
|
+
'credentials.json',
|
|
137
|
+
'secrets.json',
|
|
138
|
+
];
|
|
139
|
+
// =============================================================================
|
|
140
|
+
// IGNORE MANAGER
|
|
141
|
+
// =============================================================================
|
|
142
|
+
/**
|
|
143
|
+
* Manages ignore patterns for file filtering.
|
|
144
|
+
*/
|
|
145
|
+
export class IgnoreManager {
|
|
146
|
+
config;
|
|
147
|
+
patterns = [];
|
|
148
|
+
workspaceRoot = process.cwd();
|
|
149
|
+
eventListeners = new Set();
|
|
150
|
+
loaded = false;
|
|
151
|
+
constructor(config = {}) {
|
|
152
|
+
this.config = {
|
|
153
|
+
enabled: config.enabled ?? true,
|
|
154
|
+
includeGitignore: config.includeGitignore ?? true,
|
|
155
|
+
includeGlobal: config.includeGlobal ?? true,
|
|
156
|
+
extraPatterns: config.extraPatterns ?? [],
|
|
157
|
+
};
|
|
158
|
+
// Add built-in patterns
|
|
159
|
+
this.addPatterns(BUILTIN_PATTERNS, 'built-in');
|
|
160
|
+
// Add extra patterns from config
|
|
161
|
+
if (this.config.extraPatterns.length > 0) {
|
|
162
|
+
this.addPatterns(this.config.extraPatterns, 'config');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Load ignore patterns from files.
|
|
167
|
+
*/
|
|
168
|
+
async load(workspaceRoot) {
|
|
169
|
+
if (!this.config.enabled)
|
|
170
|
+
return;
|
|
171
|
+
this.workspaceRoot = workspaceRoot ?? process.cwd();
|
|
172
|
+
// Load global patterns first (lowest priority)
|
|
173
|
+
if (this.config.includeGlobal) {
|
|
174
|
+
await this.loadFromFile(join(homedir(), '.agent', 'ignore'));
|
|
175
|
+
}
|
|
176
|
+
// Load .gitignore (medium priority)
|
|
177
|
+
if (this.config.includeGitignore) {
|
|
178
|
+
await this.loadFromFile(join(this.workspaceRoot, '.gitignore'));
|
|
179
|
+
}
|
|
180
|
+
// Load .agentignore (highest priority)
|
|
181
|
+
await this.loadFromFile(join(this.workspaceRoot, '.agentignore'));
|
|
182
|
+
this.loaded = true;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Load patterns from a file.
|
|
186
|
+
*/
|
|
187
|
+
async loadFromFile(filePath) {
|
|
188
|
+
try {
|
|
189
|
+
const content = await readFile(filePath, 'utf-8');
|
|
190
|
+
const lines = content.split('\n');
|
|
191
|
+
let count = 0;
|
|
192
|
+
for (const line of lines) {
|
|
193
|
+
const pattern = parsePatternLine(line, filePath);
|
|
194
|
+
if (pattern) {
|
|
195
|
+
this.patterns.push(pattern);
|
|
196
|
+
count++;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.emit({ type: 'ignore.loaded', source: filePath, patternCount: count });
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// File doesn't exist - that's ok
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Add patterns programmatically.
|
|
207
|
+
*/
|
|
208
|
+
addPatterns(patterns, source = 'manual') {
|
|
209
|
+
for (const line of patterns) {
|
|
210
|
+
const pattern = parsePatternLine(line, source);
|
|
211
|
+
if (pattern) {
|
|
212
|
+
this.patterns.push(pattern);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Check if a path should be ignored.
|
|
218
|
+
*/
|
|
219
|
+
shouldIgnore(path, isDirectory = false) {
|
|
220
|
+
if (!this.config.enabled)
|
|
221
|
+
return false;
|
|
222
|
+
// Normalize the path
|
|
223
|
+
let normalizedPath = this.normalizePath(path);
|
|
224
|
+
// If path ends with /, treat it as a directory
|
|
225
|
+
if (normalizedPath.endsWith('/')) {
|
|
226
|
+
isDirectory = true;
|
|
227
|
+
normalizedPath = normalizedPath.slice(0, -1);
|
|
228
|
+
}
|
|
229
|
+
let ignored = false;
|
|
230
|
+
for (const pattern of this.patterns) {
|
|
231
|
+
// Skip directory-only patterns for files
|
|
232
|
+
if (pattern.directoryOnly && !isDirectory) {
|
|
233
|
+
// However, if the path is inside a directory that matches,
|
|
234
|
+
// we should still ignore it (e.g., temp/cache matches temp/)
|
|
235
|
+
const dirPath = normalizedPath.split('/').slice(0, -1).join('/');
|
|
236
|
+
if (dirPath && pattern.regex.test(dirPath)) {
|
|
237
|
+
ignored = true;
|
|
238
|
+
this.emit({ type: 'ignore.matched', path, pattern: pattern.pattern });
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const matches = pattern.regex.test(normalizedPath);
|
|
244
|
+
if (matches) {
|
|
245
|
+
if (pattern.negated) {
|
|
246
|
+
// Negation pattern - unignore
|
|
247
|
+
ignored = false;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
// Regular pattern - ignore
|
|
251
|
+
ignored = true;
|
|
252
|
+
this.emit({ type: 'ignore.matched', path, pattern: pattern.pattern });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return ignored;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Filter a list of paths, removing ignored ones.
|
|
260
|
+
*/
|
|
261
|
+
filterPaths(paths) {
|
|
262
|
+
return paths.filter(path => !this.shouldIgnore(path));
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Filter paths with directory info.
|
|
266
|
+
*/
|
|
267
|
+
async filterPathsWithStats(paths) {
|
|
268
|
+
const results = [];
|
|
269
|
+
for (const path of paths) {
|
|
270
|
+
try {
|
|
271
|
+
const stats = await stat(path);
|
|
272
|
+
if (!this.shouldIgnore(path, stats.isDirectory())) {
|
|
273
|
+
results.push(path);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
// File doesn't exist or can't be read - include it
|
|
278
|
+
if (!this.shouldIgnore(path)) {
|
|
279
|
+
results.push(path);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return results;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get all patterns for debugging.
|
|
287
|
+
*/
|
|
288
|
+
getPatterns() {
|
|
289
|
+
return [...this.patterns];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Check if patterns have been loaded.
|
|
293
|
+
*/
|
|
294
|
+
isLoaded() {
|
|
295
|
+
return this.loaded;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Clear all patterns.
|
|
299
|
+
*/
|
|
300
|
+
clear() {
|
|
301
|
+
this.patterns = [];
|
|
302
|
+
this.loaded = false;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Reload patterns from files.
|
|
306
|
+
*/
|
|
307
|
+
async reload() {
|
|
308
|
+
this.patterns = [];
|
|
309
|
+
this.addPatterns(BUILTIN_PATTERNS, 'built-in');
|
|
310
|
+
this.addPatterns(this.config.extraPatterns, 'config');
|
|
311
|
+
await this.load(this.workspaceRoot);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Subscribe to events.
|
|
315
|
+
*/
|
|
316
|
+
subscribe(listener) {
|
|
317
|
+
this.eventListeners.add(listener);
|
|
318
|
+
return () => this.eventListeners.delete(listener);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Cleanup resources.
|
|
322
|
+
*/
|
|
323
|
+
cleanup() {
|
|
324
|
+
this.patterns = [];
|
|
325
|
+
this.eventListeners.clear();
|
|
326
|
+
this.loaded = false;
|
|
327
|
+
}
|
|
328
|
+
// Internal methods
|
|
329
|
+
/**
|
|
330
|
+
* Normalize a path for matching.
|
|
331
|
+
*/
|
|
332
|
+
normalizePath(path) {
|
|
333
|
+
// Make path relative to workspace root
|
|
334
|
+
let normalizedPath = path;
|
|
335
|
+
if (isAbsolute(path)) {
|
|
336
|
+
normalizedPath = relative(this.workspaceRoot, path);
|
|
337
|
+
}
|
|
338
|
+
// Normalize separators to /
|
|
339
|
+
normalizedPath = normalize(normalizedPath).replace(new RegExp(`\\${sep}`, 'g'), '/');
|
|
340
|
+
// Remove leading ./
|
|
341
|
+
if (normalizedPath.startsWith('./')) {
|
|
342
|
+
normalizedPath = normalizedPath.slice(2);
|
|
343
|
+
}
|
|
344
|
+
return normalizedPath;
|
|
345
|
+
}
|
|
346
|
+
emit(event) {
|
|
347
|
+
for (const listener of this.eventListeners) {
|
|
348
|
+
try {
|
|
349
|
+
listener(event);
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
// Ignore listener errors
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// =============================================================================
|
|
358
|
+
// FACTORY FUNCTIONS
|
|
359
|
+
// =============================================================================
|
|
360
|
+
/**
|
|
361
|
+
* Create an ignore manager.
|
|
362
|
+
*/
|
|
363
|
+
export function createIgnoreManager(config) {
|
|
364
|
+
return new IgnoreManager(config);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Quick check if a path should be ignored using default patterns.
|
|
368
|
+
*/
|
|
369
|
+
export function quickShouldIgnore(path) {
|
|
370
|
+
const manager = new IgnoreManager({ includeGitignore: false, includeGlobal: false });
|
|
371
|
+
return manager.shouldIgnore(path);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Get sample .agentignore content.
|
|
375
|
+
*/
|
|
376
|
+
export function getSampleAgentignore() {
|
|
377
|
+
return `# .agentignore - AI-specific file exclusion
|
|
378
|
+
# Files listed here will be hidden from the AI agent
|
|
379
|
+
# but remain visible to git and other tools
|
|
380
|
+
|
|
381
|
+
# Large data files that don't need AI analysis
|
|
382
|
+
data/
|
|
383
|
+
*.csv
|
|
384
|
+
*.json.bak
|
|
385
|
+
|
|
386
|
+
# Generated documentation
|
|
387
|
+
docs/api/
|
|
388
|
+
docs/generated/
|
|
389
|
+
|
|
390
|
+
# Test fixtures with large data
|
|
391
|
+
tests/fixtures/large/
|
|
392
|
+
|
|
393
|
+
# Temporary development files
|
|
394
|
+
scratch/
|
|
395
|
+
notes.md
|
|
396
|
+
|
|
397
|
+
# Sensitive configuration not needed for code changes
|
|
398
|
+
.env.production
|
|
399
|
+
config/secrets/
|
|
400
|
+
|
|
401
|
+
# Build artifacts already in .gitignore but ensure agent ignores
|
|
402
|
+
coverage/
|
|
403
|
+
.nyc_output/
|
|
404
|
+
|
|
405
|
+
# IDE project files
|
|
406
|
+
*.code-workspace
|
|
407
|
+
.project
|
|
408
|
+
.classpath
|
|
409
|
+
`;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Get built-in patterns for reference.
|
|
413
|
+
*/
|
|
414
|
+
export function getBuiltinIgnorePatterns() {
|
|
415
|
+
return [...BUILTIN_PATTERNS];
|
|
416
|
+
}
|
|
417
|
+
//# sourceMappingURL=ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../../../src/integrations/utilities/ignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,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EG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCR,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Renderer
|
|
3
|
+
*
|
|
4
|
+
* Renders images inline in the terminal using the best available protocol.
|
|
5
|
+
* Supports Kitty, iTerm2/WezTerm, and falls back to block characters.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const renderer = createImageRenderer();
|
|
10
|
+
* await renderer.renderFile('/path/to/image.png');
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Supported terminal image protocols.
|
|
15
|
+
*/
|
|
16
|
+
export type ImageProtocol = 'kitty' | 'iterm' | 'sixel' | 'block' | 'none';
|
|
17
|
+
/**
|
|
18
|
+
* Image renderer configuration.
|
|
19
|
+
*/
|
|
20
|
+
export interface ImageRendererConfig {
|
|
21
|
+
/** Force a specific protocol (default: auto-detect) */
|
|
22
|
+
protocol?: ImageProtocol | 'auto';
|
|
23
|
+
/** Maximum width in cells (default: 80) */
|
|
24
|
+
maxWidth?: number;
|
|
25
|
+
/** Maximum height in cells (default: 24) */
|
|
26
|
+
maxHeight?: number;
|
|
27
|
+
/** Preserve aspect ratio (default: true) */
|
|
28
|
+
preserveAspectRatio?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Image rendering result.
|
|
32
|
+
*/
|
|
33
|
+
export interface ImageRenderResult {
|
|
34
|
+
/** The escape sequence or text to display */
|
|
35
|
+
output: string;
|
|
36
|
+
/** Protocol used for rendering */
|
|
37
|
+
protocol: ImageProtocol;
|
|
38
|
+
/** Whether rendering was successful */
|
|
39
|
+
success: boolean;
|
|
40
|
+
/** Error message if failed */
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Detect the best available image protocol for the current terminal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function detectProtocol(): ImageProtocol;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a protocol is available.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isProtocolAvailable(protocol: ImageProtocol): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Image renderer class.
|
|
53
|
+
*/
|
|
54
|
+
export declare class ImageRenderer {
|
|
55
|
+
private config;
|
|
56
|
+
private protocol;
|
|
57
|
+
constructor(config?: ImageRendererConfig);
|
|
58
|
+
/**
|
|
59
|
+
* Get the current protocol.
|
|
60
|
+
*/
|
|
61
|
+
getProtocol(): ImageProtocol;
|
|
62
|
+
/**
|
|
63
|
+
* Check if image rendering is supported.
|
|
64
|
+
*/
|
|
65
|
+
isSupported(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Check if a file is a supported image format.
|
|
68
|
+
*/
|
|
69
|
+
isSupportedFormat(filePath: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Render an image from a file path.
|
|
72
|
+
*/
|
|
73
|
+
renderFile(filePath: string): Promise<ImageRenderResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Render an image from a buffer.
|
|
76
|
+
*/
|
|
77
|
+
renderBuffer(data: Buffer, filename?: string): Promise<ImageRenderResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Render using Kitty graphics protocol.
|
|
80
|
+
* @see https://sw.kovidgoyal.net/kitty/graphics-protocol/
|
|
81
|
+
*/
|
|
82
|
+
private renderKitty;
|
|
83
|
+
/**
|
|
84
|
+
* Render using iTerm2 inline images protocol.
|
|
85
|
+
* @see https://iterm2.com/documentation-images.html
|
|
86
|
+
*/
|
|
87
|
+
private renderITerm;
|
|
88
|
+
/**
|
|
89
|
+
* Render using Sixel graphics (limited support).
|
|
90
|
+
* This is a stub - full sixel encoding is complex.
|
|
91
|
+
*/
|
|
92
|
+
private renderSixel;
|
|
93
|
+
/**
|
|
94
|
+
* Render using block characters (fallback).
|
|
95
|
+
* Uses terminal-image if available.
|
|
96
|
+
*/
|
|
97
|
+
private renderBlock;
|
|
98
|
+
/**
|
|
99
|
+
* Render an image with a caption.
|
|
100
|
+
*/
|
|
101
|
+
renderWithCaption(filePath: string, caption?: string): Promise<string>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create an image renderer with auto-detected protocol.
|
|
105
|
+
*/
|
|
106
|
+
export declare function createImageRenderer(config?: ImageRendererConfig): ImageRenderer;
|
|
107
|
+
/**
|
|
108
|
+
* Get protocol info for display.
|
|
109
|
+
*/
|
|
110
|
+
export declare function getProtocolInfo(): {
|
|
111
|
+
detected: ImageProtocol;
|
|
112
|
+
terminal: string | undefined;
|
|
113
|
+
supported: boolean;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Check if a file can be rendered as an image.
|
|
117
|
+
*/
|
|
118
|
+
export declare function canRenderImage(filePath: string): boolean;
|
|
119
|
+
//# sourceMappingURL=image-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-renderer.d.ts","sourceRoot":"","sources":["../../../../src/integrations/utilities/image-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;IAClC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM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