@compass-ai/nova 1.0.73 → 1.0.74
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/dist/acp/agent.d.ts +318 -0
- package/dist/acp/agent.d.ts.map +1 -0
- package/dist/acp/agent.js +795 -0
- package/dist/acp/agent.js.map +1 -0
- package/dist/acp/backpressure-writer.d.ts +49 -0
- package/dist/acp/backpressure-writer.d.ts.map +1 -0
- package/dist/acp/backpressure-writer.js +153 -0
- package/dist/acp/backpressure-writer.js.map +1 -0
- package/dist/acp/event-adapter.d.ts +242 -0
- package/dist/acp/event-adapter.d.ts.map +1 -0
- package/dist/acp/event-adapter.js +456 -0
- package/dist/acp/event-adapter.js.map +1 -0
- package/dist/acp/index.d.ts +30 -0
- package/dist/acp/index.d.ts.map +1 -0
- package/dist/acp/index.js +36 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/modes.d.ts +56 -0
- package/dist/acp/modes.d.ts.map +1 -0
- package/dist/acp/modes.js +135 -0
- package/dist/acp/modes.js.map +1 -0
- package/dist/acp/session-manager.d.ts +170 -0
- package/dist/acp/session-manager.d.ts.map +1 -0
- package/dist/acp/session-manager.js +381 -0
- package/dist/acp/session-manager.js.map +1 -0
- package/dist/acp/text-coalescer.d.ts +45 -0
- package/dist/acp/text-coalescer.d.ts.map +1 -0
- package/dist/acp/text-coalescer.js +110 -0
- package/dist/acp/text-coalescer.js.map +1 -0
- package/dist/acp/tool-bridge.d.ts +156 -0
- package/dist/acp/tool-bridge.d.ts.map +1 -0
- package/dist/acp/tool-bridge.js +381 -0
- package/dist/acp/tool-bridge.js.map +1 -0
- package/dist/acp/types.d.ts +314 -0
- package/dist/acp/types.d.ts.map +1 -0
- package/dist/acp/types.js +8 -0
- package/dist/acp/types.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +185 -184
- package/dist/cli.js.map +1 -0
- package/dist/commands/acp.d.ts +26 -0
- package/dist/commands/acp.d.ts.map +1 -0
- package/dist/commands/acp.js +492 -0
- package/dist/commands/acp.js.map +1 -0
- package/dist/commands/cache.d.ts +33 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +537 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/config.d.ts +10 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +367 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/consent.d.ts +21 -0
- package/dist/commands/consent.d.ts.map +1 -0
- package/dist/commands/consent.js +334 -0
- package/dist/commands/consent.js.map +1 -0
- package/dist/commands/data.d.ts +24 -0
- package/dist/commands/data.d.ts.map +1 -0
- package/dist/commands/data.js +586 -0
- package/dist/commands/data.js.map +1 -0
- package/dist/commands/index.d.ts +145 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +210 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +106 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +349 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logs.d.ts +13 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +359 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/mcp.d.ts +20 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +687 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/reset.d.ts +20 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +372 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/setup.d.ts +74 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +863 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/slash/agents.d.ts +40 -0
- package/dist/commands/slash/agents.d.ts.map +1 -0
- package/dist/commands/slash/agents.js +519 -0
- package/dist/commands/slash/agents.js.map +1 -0
- package/dist/commands/slash/approve.d.ts +46 -0
- package/dist/commands/slash/approve.d.ts.map +1 -0
- package/dist/commands/slash/approve.js +239 -0
- package/dist/commands/slash/approve.js.map +1 -0
- package/dist/commands/slash/attach.d.ts +70 -0
- package/dist/commands/slash/attach.d.ts.map +1 -0
- package/dist/commands/slash/attach.js +333 -0
- package/dist/commands/slash/attach.js.map +1 -0
- package/dist/commands/slash/clear.d.ts +47 -0
- package/dist/commands/slash/clear.d.ts.map +1 -0
- package/dist/commands/slash/clear.js +261 -0
- package/dist/commands/slash/clear.js.map +1 -0
- package/dist/commands/slash/commit.d.ts +40 -0
- package/dist/commands/slash/commit.d.ts.map +1 -0
- package/dist/commands/slash/commit.js +337 -0
- package/dist/commands/slash/commit.js.map +1 -0
- package/dist/commands/slash/compact.d.ts +48 -0
- package/dist/commands/slash/compact.d.ts.map +1 -0
- package/dist/commands/slash/compact.js +288 -0
- package/dist/commands/slash/compact.js.map +1 -0
- package/dist/commands/slash/config.d.ts +20 -0
- package/dist/commands/slash/config.d.ts.map +1 -0
- package/dist/commands/slash/config.js +136 -0
- package/dist/commands/slash/config.js.map +1 -0
- package/dist/commands/slash/context.d.ts +49 -0
- package/dist/commands/slash/context.d.ts.map +1 -0
- package/dist/commands/slash/context.js +430 -0
- package/dist/commands/slash/context.js.map +1 -0
- package/dist/commands/slash/cost.d.ts +34 -0
- package/dist/commands/slash/cost.d.ts.map +1 -0
- package/dist/commands/slash/cost.js +312 -0
- package/dist/commands/slash/cost.js.map +1 -0
- package/dist/commands/slash/custom.d.ts +41 -0
- package/dist/commands/slash/custom.d.ts.map +1 -0
- package/dist/commands/slash/custom.js +126 -0
- package/dist/commands/slash/custom.js.map +1 -0
- package/dist/commands/slash/exit.d.ts +25 -0
- package/dist/commands/slash/exit.d.ts.map +1 -0
- package/dist/commands/slash/exit.js +186 -0
- package/dist/commands/slash/exit.js.map +1 -0
- package/dist/commands/slash/export.d.ts +27 -0
- package/dist/commands/slash/export.d.ts.map +1 -0
- package/dist/commands/slash/export.js +318 -0
- package/dist/commands/slash/export.js.map +1 -0
- package/dist/commands/slash/files.d.ts +47 -0
- package/dist/commands/slash/files.d.ts.map +1 -0
- package/dist/commands/slash/files.js +521 -0
- package/dist/commands/slash/files.js.map +1 -0
- package/dist/commands/slash/help.d.ts +50 -0
- package/dist/commands/slash/help.d.ts.map +1 -0
- package/dist/commands/slash/help.js +282 -0
- package/dist/commands/slash/help.js.map +1 -0
- package/dist/commands/slash/index-cmd.d.ts +41 -0
- package/dist/commands/slash/index-cmd.d.ts.map +1 -0
- package/dist/commands/slash/index-cmd.js +349 -0
- package/dist/commands/slash/index-cmd.js.map +1 -0
- package/dist/commands/slash/index.d.ts +97 -0
- package/dist/commands/slash/index.d.ts.map +1 -0
- package/dist/commands/slash/index.js +251 -0
- package/dist/commands/slash/index.js.map +1 -0
- package/dist/commands/slash/login.d.ts +23 -0
- package/dist/commands/slash/login.d.ts.map +1 -0
- package/dist/commands/slash/login.js +175 -0
- package/dist/commands/slash/login.js.map +1 -0
- package/dist/commands/slash/logout.d.ts +23 -0
- package/dist/commands/slash/logout.d.ts.map +1 -0
- package/dist/commands/slash/logout.js +153 -0
- package/dist/commands/slash/logout.js.map +1 -0
- package/dist/commands/slash/logs.d.ts +29 -0
- package/dist/commands/slash/logs.d.ts.map +1 -0
- package/dist/commands/slash/logs.js +423 -0
- package/dist/commands/slash/logs.js.map +1 -0
- package/dist/commands/slash/mcp.d.ts +29 -0
- package/dist/commands/slash/mcp.d.ts.map +1 -0
- package/dist/commands/slash/mcp.js +1026 -0
- package/dist/commands/slash/mcp.js.map +1 -0
- package/dist/commands/slash/model.d.ts +60 -0
- package/dist/commands/slash/model.d.ts.map +1 -0
- package/dist/commands/slash/model.js +466 -0
- package/dist/commands/slash/model.js.map +1 -0
- package/dist/commands/slash/personality.d.ts +40 -0
- package/dist/commands/slash/personality.d.ts.map +1 -0
- package/dist/commands/slash/personality.js +272 -0
- package/dist/commands/slash/personality.js.map +1 -0
- package/dist/commands/slash/purge.d.ts +42 -0
- package/dist/commands/slash/purge.d.ts.map +1 -0
- package/dist/commands/slash/purge.js +233 -0
- package/dist/commands/slash/purge.js.map +1 -0
- package/dist/commands/slash/reset.d.ts +44 -0
- package/dist/commands/slash/reset.d.ts.map +1 -0
- package/dist/commands/slash/reset.js +326 -0
- package/dist/commands/slash/reset.js.map +1 -0
- package/dist/commands/slash/skills.d.ts +40 -0
- package/dist/commands/slash/skills.d.ts.map +1 -0
- package/dist/commands/slash/skills.js +207 -0
- package/dist/commands/slash/skills.js.map +1 -0
- package/dist/commands/slash/tokens.d.ts +34 -0
- package/dist/commands/slash/tokens.d.ts.map +1 -0
- package/dist/commands/slash/tokens.js +205 -0
- package/dist/commands/slash/tokens.js.map +1 -0
- package/dist/commands/slash/unleash.d.ts +50 -0
- package/dist/commands/slash/unleash.d.ts.map +1 -0
- package/dist/commands/slash/unleash.js +262 -0
- package/dist/commands/slash/unleash.js.map +1 -0
- package/dist/commands/slash/update.d.ts +34 -0
- package/dist/commands/slash/update.d.ts.map +1 -0
- package/dist/commands/slash/update.js +364 -0
- package/dist/commands/slash/update.js.map +1 -0
- package/dist/commands/slash/wrap.d.ts +18 -0
- package/dist/commands/slash/wrap.d.ts.map +1 -0
- package/dist/commands/slash/wrap.js +21 -0
- package/dist/commands/slash/wrap.js.map +1 -0
- package/dist/commands/tokens.d.ts +26 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +245 -0
- package/dist/commands/tokens.js.map +1 -0
- package/dist/constants/builtin-agents.d.ts +27 -0
- package/dist/constants/builtin-agents.d.ts.map +1 -0
- package/dist/constants/builtin-agents.js +710 -0
- package/dist/constants/builtin-agents.js.map +1 -0
- package/dist/constants/builtin-skills.d.ts +32 -0
- package/dist/constants/builtin-skills.d.ts.map +1 -0
- package/dist/constants/builtin-skills.js +389 -0
- package/dist/constants/builtin-skills.js.map +1 -0
- package/dist/constants/defaults.d.ts +448 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +829 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/index.d.ts +27 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +85 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/install-hints.d.ts +7 -0
- package/dist/constants/install-hints.d.ts.map +1 -0
- package/dist/constants/install-hints.js +123 -0
- package/dist/constants/install-hints.js.map +1 -0
- package/dist/constants/models.d.ts +255 -0
- package/dist/constants/models.d.ts.map +1 -0
- package/dist/constants/models.js +596 -0
- package/dist/constants/models.js.map +1 -0
- package/dist/constants/schedule.d.ts +43 -0
- package/dist/constants/schedule.d.ts.map +1 -0
- package/dist/constants/schedule.js +110 -0
- package/dist/constants/schedule.js.map +1 -0
- package/dist/constants/system-utilities.d.ts +57 -0
- package/dist/constants/system-utilities.d.ts.map +1 -0
- package/dist/constants/system-utilities.js +421 -0
- package/dist/constants/system-utilities.js.map +1 -0
- package/dist/constants/token-limits.d.ts +102 -0
- package/dist/constants/token-limits.d.ts.map +1 -0
- package/dist/constants/token-limits.js +286 -0
- package/dist/constants/token-limits.js.map +1 -0
- package/dist/core/autocomplete.d.ts +132 -0
- package/dist/core/autocomplete.d.ts.map +1 -0
- package/dist/core/autocomplete.js +653 -0
- package/dist/core/autocomplete.js.map +1 -0
- package/dist/core/command-parser.d.ts +301 -0
- package/dist/core/command-parser.d.ts.map +1 -0
- package/dist/core/command-parser.js +526 -0
- package/dist/core/command-parser.js.map +1 -0
- package/dist/core/context-builder.d.ts +264 -0
- package/dist/core/context-builder.d.ts.map +1 -0
- package/dist/core/context-builder.js +1018 -0
- package/dist/core/context-builder.js.map +1 -0
- package/dist/core/event-emitter.d.ts +411 -0
- package/dist/core/event-emitter.d.ts.map +1 -0
- package/dist/core/event-emitter.js +138 -0
- package/dist/core/event-emitter.js.map +1 -0
- package/dist/core/history-manager.d.ts +62 -0
- package/dist/core/history-manager.d.ts.map +1 -0
- package/dist/core/history-manager.js +151 -0
- package/dist/core/history-manager.js.map +1 -0
- package/dist/core/slash-command-handler.d.ts +352 -0
- package/dist/core/slash-command-handler.d.ts.map +1 -0
- package/dist/core/slash-command-handler.js +563 -0
- package/dist/core/slash-command-handler.js.map +1 -0
- package/dist/core/task-processor.d.ts +179 -0
- package/dist/core/task-processor.d.ts.map +1 -0
- package/dist/core/task-processor.js +519 -0
- package/dist/core/task-processor.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -0
- package/dist/prompts/agent-prompt-generator.d.ts +26 -0
- package/dist/prompts/agent-prompt-generator.d.ts.map +1 -0
- package/dist/prompts/agent-prompt-generator.js +244 -0
- package/dist/prompts/agent-prompt-generator.js.map +1 -0
- package/dist/prompts/commit-message.d.ts +35 -0
- package/dist/prompts/commit-message.d.ts.map +1 -0
- package/dist/prompts/commit-message.js +187 -0
- package/dist/prompts/commit-message.js.map +1 -0
- package/dist/prompts/conversation.d.ts +51 -0
- package/dist/prompts/conversation.d.ts.map +1 -0
- package/dist/prompts/conversation.js +115 -0
- package/dist/prompts/conversation.js.map +1 -0
- package/dist/prompts/index.d.ts +39 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +74 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/memory.d.ts +6 -0
- package/dist/prompts/memory.d.ts.map +1 -0
- package/dist/prompts/memory.js +29 -0
- package/dist/prompts/memory.js.map +1 -0
- package/dist/prompts/personality.d.ts +77 -0
- package/dist/prompts/personality.d.ts.map +1 -0
- package/dist/prompts/personality.js +393 -0
- package/dist/prompts/personality.js.map +1 -0
- package/dist/prompts/plan-generator.d.ts +144 -0
- package/dist/prompts/plan-generator.d.ts.map +1 -0
- package/dist/prompts/plan-generator.js +553 -0
- package/dist/prompts/plan-generator.js.map +1 -0
- package/dist/prompts/system.d.ts +95 -0
- package/dist/prompts/system.d.ts.map +1 -0
- package/dist/prompts/system.js +461 -0
- package/dist/prompts/system.js.map +1 -0
- package/dist/prompts/task-processor.d.ts +94 -0
- package/dist/prompts/task-processor.d.ts.map +1 -0
- package/dist/prompts/task-processor.js +554 -0
- package/dist/prompts/task-processor.js.map +1 -0
- package/dist/prompts/unguarded.d.ts +78 -0
- package/dist/prompts/unguarded.d.ts.map +1 -0
- package/dist/prompts/unguarded.js +418 -0
- package/dist/prompts/unguarded.js.map +1 -0
- package/dist/prompts/utils.d.ts +73 -0
- package/dist/prompts/utils.d.ts.map +1 -0
- package/dist/prompts/utils.js +114 -0
- package/dist/prompts/utils.js.map +1 -0
- package/dist/prompts/workflow.d.ts +241 -0
- package/dist/prompts/workflow.d.ts.map +1 -0
- package/dist/prompts/workflow.js +608 -0
- package/dist/prompts/workflow.js.map +1 -0
- package/dist/services/action-logger.d.ts +383 -0
- package/dist/services/action-logger.d.ts.map +1 -0
- package/dist/services/action-logger.js +544 -0
- package/dist/services/action-logger.js.map +1 -0
- package/dist/services/agent-budget-allocator.d.ts +111 -0
- package/dist/services/agent-budget-allocator.d.ts.map +1 -0
- package/dist/services/agent-budget-allocator.js +278 -0
- package/dist/services/agent-budget-allocator.js.map +1 -0
- package/dist/services/agent-manager.d.ts +181 -0
- package/dist/services/agent-manager.d.ts.map +1 -0
- package/dist/services/agent-manager.js +749 -0
- package/dist/services/agent-manager.js.map +1 -0
- package/dist/services/agent-spawner.d.ts +138 -0
- package/dist/services/agent-spawner.d.ts.map +1 -0
- package/dist/services/agent-spawner.js +748 -0
- package/dist/services/agent-spawner.js.map +1 -0
- package/dist/services/agent-state-service.d.ts +145 -0
- package/dist/services/agent-state-service.d.ts.map +1 -0
- package/dist/services/agent-state-service.js +247 -0
- package/dist/services/agent-state-service.js.map +1 -0
- package/dist/services/anthropic-client.d.ts +357 -0
- package/dist/services/anthropic-client.d.ts.map +1 -0
- package/dist/services/anthropic-client.js +1451 -0
- package/dist/services/anthropic-client.js.map +1 -0
- package/dist/services/approval-manager.d.ts +385 -0
- package/dist/services/approval-manager.d.ts.map +1 -0
- package/dist/services/approval-manager.js +1044 -0
- package/dist/services/approval-manager.js.map +1 -0
- package/dist/services/audit-logger.d.ts +245 -0
- package/dist/services/audit-logger.d.ts.map +1 -0
- package/dist/services/audit-logger.js +324 -0
- package/dist/services/audit-logger.js.map +1 -0
- package/dist/services/backup-manager.d.ts +136 -0
- package/dist/services/backup-manager.d.ts.map +1 -0
- package/dist/services/backup-manager.js +260 -0
- package/dist/services/backup-manager.js.map +1 -0
- package/dist/services/cache-service.d.ts +247 -0
- package/dist/services/cache-service.d.ts.map +1 -0
- package/dist/services/cache-service.js +558 -0
- package/dist/services/cache-service.js.map +1 -0
- package/dist/services/chat-archival-service.d.ts +108 -0
- package/dist/services/chat-archival-service.d.ts.map +1 -0
- package/dist/services/chat-archival-service.js +465 -0
- package/dist/services/chat-archival-service.js.map +1 -0
- package/dist/services/codebase-indexer.d.ts +272 -0
- package/dist/services/codebase-indexer.d.ts.map +1 -0
- package/dist/services/codebase-indexer.js +863 -0
- package/dist/services/codebase-indexer.js.map +1 -0
- package/dist/services/compass-auth-service.d.ts +204 -0
- package/dist/services/compass-auth-service.d.ts.map +1 -0
- package/dist/services/compass-auth-service.js +391 -0
- package/dist/services/compass-auth-service.js.map +1 -0
- package/dist/services/complexity-classifier.d.ts +208 -0
- package/dist/services/complexity-classifier.d.ts.map +1 -0
- package/dist/services/complexity-classifier.js +1410 -0
- package/dist/services/complexity-classifier.js.map +1 -0
- package/dist/services/config-manager.d.ts +278 -0
- package/dist/services/config-manager.d.ts.map +1 -0
- package/dist/services/config-manager.js +651 -0
- package/dist/services/config-manager.js.map +1 -0
- package/dist/services/consent-manager.d.ts +239 -0
- package/dist/services/consent-manager.d.ts.map +1 -0
- package/dist/services/consent-manager.js +516 -0
- package/dist/services/consent-manager.js.map +1 -0
- package/dist/services/conversation-compactor.d.ts +223 -0
- package/dist/services/conversation-compactor.d.ts.map +1 -0
- package/dist/services/conversation-compactor.js +750 -0
- package/dist/services/conversation-compactor.js.map +1 -0
- package/dist/services/cost-tracker.d.ts +167 -0
- package/dist/services/cost-tracker.d.ts.map +1 -0
- package/dist/services/cost-tracker.js +199 -0
- package/dist/services/cost-tracker.js.map +1 -0
- package/dist/services/credential-store.d.ts +273 -0
- package/dist/services/credential-store.d.ts.map +1 -0
- package/dist/services/credential-store.js +877 -0
- package/dist/services/credential-store.js.map +1 -0
- package/dist/services/custom-command-service.d.ts +112 -0
- package/dist/services/custom-command-service.d.ts.map +1 -0
- package/dist/services/custom-command-service.js +464 -0
- package/dist/services/custom-command-service.js.map +1 -0
- package/dist/services/default-statusline-renderer.d.ts +60 -0
- package/dist/services/default-statusline-renderer.d.ts.map +1 -0
- package/dist/services/default-statusline-renderer.js +110 -0
- package/dist/services/default-statusline-renderer.js.map +1 -0
- package/dist/services/enhanced-context-gatherer.d.ts +116 -0
- package/dist/services/enhanced-context-gatherer.d.ts.map +1 -0
- package/dist/services/enhanced-context-gatherer.js +605 -0
- package/dist/services/enhanced-context-gatherer.js.map +1 -0
- package/dist/services/file-hash-tracker.d.ts +95 -0
- package/dist/services/file-hash-tracker.d.ts.map +1 -0
- package/dist/services/file-hash-tracker.js +199 -0
- package/dist/services/file-hash-tracker.js.map +1 -0
- package/dist/services/file-service.d.ts +274 -0
- package/dist/services/file-service.d.ts.map +1 -0
- package/dist/services/file-service.js +876 -0
- package/dist/services/file-service.js.map +1 -0
- package/dist/services/git-service.d.ts +536 -0
- package/dist/services/git-service.d.ts.map +1 -0
- package/dist/services/git-service.js +1215 -0
- package/dist/services/git-service.js.map +1 -0
- package/dist/services/hook-service.d.ts +148 -0
- package/dist/services/hook-service.d.ts.map +1 -0
- package/dist/services/hook-service.js +705 -0
- package/dist/services/hook-service.js.map +1 -0
- package/dist/services/ide-state-service.d.ts +114 -0
- package/dist/services/ide-state-service.d.ts.map +1 -0
- package/dist/services/ide-state-service.js +204 -0
- package/dist/services/ide-state-service.js.map +1 -0
- package/dist/services/interactive-clarifier.d.ts +90 -0
- package/dist/services/interactive-clarifier.d.ts.map +1 -0
- package/dist/services/interactive-clarifier.js +446 -0
- package/dist/services/interactive-clarifier.js.map +1 -0
- package/dist/services/iteration-scoper.d.ts +225 -0
- package/dist/services/iteration-scoper.d.ts.map +1 -0
- package/dist/services/iteration-scoper.js +387 -0
- package/dist/services/iteration-scoper.js.map +1 -0
- package/dist/services/llm-plan-generator.d.ts +44 -0
- package/dist/services/llm-plan-generator.d.ts.map +1 -0
- package/dist/services/llm-plan-generator.js +863 -0
- package/dist/services/llm-plan-generator.js.map +1 -0
- package/dist/services/llm-system-prompt-generator.d.ts +85 -0
- package/dist/services/llm-system-prompt-generator.d.ts.map +1 -0
- package/dist/services/llm-system-prompt-generator.js +257 -0
- package/dist/services/llm-system-prompt-generator.js.map +1 -0
- package/dist/services/log-interpreter.d.ts +190 -0
- package/dist/services/log-interpreter.d.ts.map +1 -0
- package/dist/services/log-interpreter.js +520 -0
- package/dist/services/log-interpreter.js.map +1 -0
- package/dist/services/mcp-config-manager.d.ts +141 -0
- package/dist/services/mcp-config-manager.d.ts.map +1 -0
- package/dist/services/mcp-config-manager.js +678 -0
- package/dist/services/mcp-config-manager.js.map +1 -0
- package/dist/services/mcp-oauth-service.d.ts +170 -0
- package/dist/services/mcp-oauth-service.d.ts.map +1 -0
- package/dist/services/mcp-oauth-service.js +892 -0
- package/dist/services/mcp-oauth-service.js.map +1 -0
- package/dist/services/mcp-plugin-support.d.ts +81 -0
- package/dist/services/mcp-plugin-support.d.ts.map +1 -0
- package/dist/services/mcp-plugin-support.js +305 -0
- package/dist/services/mcp-plugin-support.js.map +1 -0
- package/dist/services/mcp-server-manager.d.ts +134 -0
- package/dist/services/mcp-server-manager.d.ts.map +1 -0
- package/dist/services/mcp-server-manager.js +613 -0
- package/dist/services/mcp-server-manager.js.map +1 -0
- package/dist/services/mcp-tool-integration.d.ts +119 -0
- package/dist/services/mcp-tool-integration.d.ts.map +1 -0
- package/dist/services/mcp-tool-integration.js +381 -0
- package/dist/services/mcp-tool-integration.js.map +1 -0
- package/dist/services/mcp-transport.d.ts +105 -0
- package/dist/services/mcp-transport.d.ts.map +1 -0
- package/dist/services/mcp-transport.js +1316 -0
- package/dist/services/mcp-transport.js.map +1 -0
- package/dist/services/memory-service.d.ts +55 -0
- package/dist/services/memory-service.d.ts.map +1 -0
- package/dist/services/memory-service.js +251 -0
- package/dist/services/memory-service.js.map +1 -0
- package/dist/services/model-availability.d.ts +64 -0
- package/dist/services/model-availability.d.ts.map +1 -0
- package/dist/services/model-availability.js +114 -0
- package/dist/services/model-availability.js.map +1 -0
- package/dist/services/plan-generator.d.ts +98 -0
- package/dist/services/plan-generator.d.ts.map +1 -0
- package/dist/services/plan-generator.js +658 -0
- package/dist/services/plan-generator.js.map +1 -0
- package/dist/services/plan-mode-fallback.d.ts +80 -0
- package/dist/services/plan-mode-fallback.d.ts.map +1 -0
- package/dist/services/plan-mode-fallback.js +307 -0
- package/dist/services/plan-mode-fallback.js.map +1 -0
- package/dist/services/plan-mode-handler.d.ts +42 -0
- package/dist/services/plan-mode-handler.d.ts.map +1 -0
- package/dist/services/plan-mode-handler.js +388 -0
- package/dist/services/plan-mode-handler.js.map +1 -0
- package/dist/services/plan-persistence.d.ts +203 -0
- package/dist/services/plan-persistence.d.ts.map +1 -0
- package/dist/services/plan-persistence.js +538 -0
- package/dist/services/plan-persistence.js.map +1 -0
- package/dist/services/prompt-preprocessor.d.ts +73 -0
- package/dist/services/prompt-preprocessor.d.ts.map +1 -0
- package/dist/services/prompt-preprocessor.js +146 -0
- package/dist/services/prompt-preprocessor.js.map +1 -0
- package/dist/services/rating-service.d.ts +84 -0
- package/dist/services/rating-service.d.ts.map +1 -0
- package/dist/services/rating-service.js +171 -0
- package/dist/services/rating-service.js.map +1 -0
- package/dist/services/rating-state-manager.d.ts +131 -0
- package/dist/services/rating-state-manager.d.ts.map +1 -0
- package/dist/services/rating-state-manager.js +270 -0
- package/dist/services/rating-state-manager.js.map +1 -0
- package/dist/services/sdk-runner.d.ts +113 -0
- package/dist/services/sdk-runner.d.ts.map +1 -0
- package/dist/services/sdk-runner.js +1424 -0
- package/dist/services/sdk-runner.js.map +1 -0
- package/dist/services/session-manager.d.ts +528 -0
- package/dist/services/session-manager.d.ts.map +1 -0
- package/dist/services/session-manager.js +1184 -0
- package/dist/services/session-manager.js.map +1 -0
- package/dist/services/shell-executor.d.ts +337 -0
- package/dist/services/shell-executor.d.ts.map +1 -0
- package/dist/services/shell-executor.js +1201 -0
- package/dist/services/shell-executor.js.map +1 -0
- package/dist/services/skill-service.d.ts +149 -0
- package/dist/services/skill-service.d.ts.map +1 -0
- package/dist/services/skill-service.js +594 -0
- package/dist/services/skill-service.js.map +1 -0
- package/dist/services/statusline-executor.d.ts +102 -0
- package/dist/services/statusline-executor.d.ts.map +1 -0
- package/dist/services/statusline-executor.js +305 -0
- package/dist/services/statusline-executor.js.map +1 -0
- package/dist/services/step-tracker.d.ts +356 -0
- package/dist/services/step-tracker.d.ts.map +1 -0
- package/dist/services/step-tracker.js +634 -0
- package/dist/services/step-tracker.js.map +1 -0
- package/dist/services/system-event-logger.d.ts +473 -0
- package/dist/services/system-event-logger.d.ts.map +1 -0
- package/dist/services/system-event-logger.js +790 -0
- package/dist/services/system-event-logger.js.map +1 -0
- package/dist/services/system-utility-detector.d.ts +91 -0
- package/dist/services/system-utility-detector.d.ts.map +1 -0
- package/dist/services/system-utility-detector.js +238 -0
- package/dist/services/system-utility-detector.js.map +1 -0
- package/dist/services/team-context-store.d.ts +100 -0
- package/dist/services/team-context-store.d.ts.map +1 -0
- package/dist/services/team-context-store.js +513 -0
- package/dist/services/team-context-store.js.map +1 -0
- package/dist/services/temp-file-service.d.ts +164 -0
- package/dist/services/temp-file-service.d.ts.map +1 -0
- package/dist/services/temp-file-service.js +303 -0
- package/dist/services/temp-file-service.js.map +1 -0
- package/dist/services/token-limit-enforcer.d.ts +53 -0
- package/dist/services/token-limit-enforcer.d.ts.map +1 -0
- package/dist/services/token-limit-enforcer.js +90 -0
- package/dist/services/token-limit-enforcer.js.map +1 -0
- package/dist/services/token-limit-store.d.ts +105 -0
- package/dist/services/token-limit-store.d.ts.map +1 -0
- package/dist/services/token-limit-store.js +288 -0
- package/dist/services/token-limit-store.js.map +1 -0
- package/dist/services/token-tracker.d.ts +290 -0
- package/dist/services/token-tracker.d.ts.map +1 -0
- package/dist/services/token-tracker.js +751 -0
- package/dist/services/token-tracker.js.map +1 -0
- package/dist/services/tool-registry.d.ts +302 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +606 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/tools-logger.d.ts +152 -0
- package/dist/services/tools-logger.d.ts.map +1 -0
- package/dist/services/tools-logger.js +222 -0
- package/dist/services/tools-logger.js.map +1 -0
- package/dist/services/update-plan-handler.d.ts +56 -0
- package/dist/services/update-plan-handler.d.ts.map +1 -0
- package/dist/services/update-plan-handler.js +372 -0
- package/dist/services/update-plan-handler.js.map +1 -0
- package/dist/services/update-service.d.ts +197 -0
- package/dist/services/update-service.d.ts.map +1 -0
- package/dist/services/update-service.js +749 -0
- package/dist/services/update-service.js.map +1 -0
- package/dist/services/verifier.d.ts +113 -0
- package/dist/services/verifier.d.ts.map +1 -0
- package/dist/services/verifier.js +541 -0
- package/dist/services/verifier.js.map +1 -0
- package/dist/services/workflow-manager.d.ts +277 -0
- package/dist/services/workflow-manager.d.ts.map +1 -0
- package/dist/services/workflow-manager.js +616 -0
- package/dist/services/workflow-manager.js.map +1 -0
- package/dist/services/workflow-orchestrator.d.ts +148 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +617 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/worktree-manager.d.ts +36 -0
- package/dist/services/worktree-manager.d.ts.map +1 -0
- package/dist/services/worktree-manager.js +185 -0
- package/dist/services/worktree-manager.js.map +1 -0
- package/dist/templates/ascii-art.d.ts +136 -0
- package/dist/templates/ascii-art.d.ts.map +1 -0
- package/dist/templates/ascii-art.js +286 -0
- package/dist/templates/ascii-art.js.map +1 -0
- package/dist/templates/help.d.ts +186 -0
- package/dist/templates/help.d.ts.map +1 -0
- package/dist/templates/help.js +588 -0
- package/dist/templates/help.js.map +1 -0
- package/dist/templates/prompts/workflow-prompts.d.ts +9 -0
- package/dist/templates/prompts/workflow-prompts.d.ts.map +1 -0
- package/dist/templates/prompts/workflow-prompts.js +9 -0
- package/dist/templates/prompts/workflow-prompts.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +9 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +349 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/edit-replacers.d.ts +90 -0
- package/dist/tools/edit-replacers.d.ts.map +1 -0
- package/dist/tools/edit-replacers.js +553 -0
- package/dist/tools/edit-replacers.js.map +1 -0
- package/dist/tools/file-tools.d.ts +13 -0
- package/dist/tools/file-tools.d.ts.map +1 -0
- package/dist/tools/file-tools.js +954 -0
- package/dist/tools/file-tools.js.map +1 -0
- package/dist/tools/git-tools.d.ts +9 -0
- package/dist/tools/git-tools.d.ts.map +1 -0
- package/dist/tools/git-tools.js +261 -0
- package/dist/tools/git-tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +70 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/network-tools.d.ts +8 -0
- package/dist/tools/network-tools.d.ts.map +1 -0
- package/dist/tools/network-tools.js +261 -0
- package/dist/tools/network-tools.js.map +1 -0
- package/dist/tools/openai-tools.d.ts +16 -0
- package/dist/tools/openai-tools.d.ts.map +1 -0
- package/dist/tools/openai-tools.js +385 -0
- package/dist/tools/openai-tools.js.map +1 -0
- package/dist/tools/plan-tools.d.ts +9 -0
- package/dist/tools/plan-tools.d.ts.map +1 -0
- package/dist/tools/plan-tools.js +223 -0
- package/dist/tools/plan-tools.js.map +1 -0
- package/dist/tools/schedule-tools.d.ts +9 -0
- package/dist/tools/schedule-tools.d.ts.map +1 -0
- package/dist/tools/schedule-tools.js +405 -0
- package/dist/tools/schedule-tools.js.map +1 -0
- package/dist/tools/search-tools.d.ts +8 -0
- package/dist/tools/search-tools.d.ts.map +1 -0
- package/dist/tools/search-tools.js +357 -0
- package/dist/tools/search-tools.js.map +1 -0
- package/dist/tools/shared-utils.d.ts +91 -0
- package/dist/tools/shared-utils.d.ts.map +1 -0
- package/dist/tools/shared-utils.js +385 -0
- package/dist/tools/shared-utils.js.map +1 -0
- package/dist/tools/shell-tools.d.ts +9 -0
- package/dist/tools/shell-tools.d.ts.map +1 -0
- package/dist/tools/shell-tools.js +409 -0
- package/dist/tools/shell-tools.js.map +1 -0
- package/dist/tools/skill-tools.d.ts +13 -0
- package/dist/tools/skill-tools.d.ts.map +1 -0
- package/dist/tools/skill-tools.js +244 -0
- package/dist/tools/skill-tools.js.map +1 -0
- package/dist/tools/swarm-tools.d.ts +9 -0
- package/dist/tools/swarm-tools.d.ts.map +1 -0
- package/dist/tools/swarm-tools.js +422 -0
- package/dist/tools/swarm-tools.js.map +1 -0
- package/dist/tools/user-tools.d.ts +13 -0
- package/dist/tools/user-tools.d.ts.map +1 -0
- package/dist/tools/user-tools.js +232 -0
- package/dist/tools/user-tools.js.map +1 -0
- package/dist/types/agent-process.d.ts +244 -0
- package/dist/types/agent-process.d.ts.map +1 -0
- package/dist/types/agent-process.js +93 -0
- package/dist/types/agent-process.js.map +1 -0
- package/dist/types/agent.d.ts +358 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +171 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/anthropic.d.ts +438 -0
- package/dist/types/anthropic.d.ts.map +1 -0
- package/dist/types/anthropic.js +9 -0
- package/dist/types/anthropic.js.map +1 -0
- package/dist/types/approval.d.ts +332 -0
- package/dist/types/approval.d.ts.map +1 -0
- package/dist/types/approval.js +44 -0
- package/dist/types/approval.js.map +1 -0
- package/dist/types/autocomplete.d.ts +57 -0
- package/dist/types/autocomplete.d.ts.map +1 -0
- package/dist/types/autocomplete.js +7 -0
- package/dist/types/autocomplete.js.map +1 -0
- package/dist/types/chat-archive.d.ts +161 -0
- package/dist/types/chat-archive.d.ts.map +1 -0
- package/dist/types/chat-archive.js +36 -0
- package/dist/types/chat-archive.js.map +1 -0
- package/dist/types/config.d.ts +268 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +188 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/consent.d.ts +191 -0
- package/dist/types/consent.d.ts.map +1 -0
- package/dist/types/consent.js +119 -0
- package/dist/types/consent.js.map +1 -0
- package/dist/types/custom-command.d.ts +139 -0
- package/dist/types/custom-command.d.ts.map +1 -0
- package/dist/types/custom-command.js +7 -0
- package/dist/types/custom-command.js.map +1 -0
- package/dist/types/git.d.ts +20 -0
- package/dist/types/git.d.ts.map +1 -0
- package/dist/types/git.js +2 -0
- package/dist/types/git.js.map +1 -0
- package/dist/types/hook.d.ts +342 -0
- package/dist/types/hook.d.ts.map +1 -0
- package/dist/types/hook.js +84 -0
- package/dist/types/hook.js.map +1 -0
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +71 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +456 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +94 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/rating.d.ts +110 -0
- package/dist/types/rating.d.ts.map +1 -0
- package/dist/types/rating.js +53 -0
- package/dist/types/rating.js.map +1 -0
- package/dist/types/schedule.d.ts +91 -0
- package/dist/types/schedule.d.ts.map +1 -0
- package/dist/types/schedule.js +8 -0
- package/dist/types/schedule.js.map +1 -0
- package/dist/types/session.d.ts +361 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +9 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/skill.d.ts +258 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/skill.js +79 -0
- package/dist/types/skill.js.map +1 -0
- package/dist/types/statusline.d.ts +212 -0
- package/dist/types/statusline.d.ts.map +1 -0
- package/dist/types/statusline.js +8 -0
- package/dist/types/statusline.js.map +1 -0
- package/dist/types/stream.d.ts +61 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/dist/types/stream.js +17 -0
- package/dist/types/stream.js.map +1 -0
- package/dist/types/swarm.d.ts +132 -0
- package/dist/types/swarm.d.ts.map +1 -0
- package/dist/types/swarm.js +21 -0
- package/dist/types/swarm.js.map +1 -0
- package/dist/types/token-limits.d.ts +107 -0
- package/dist/types/token-limits.d.ts.map +1 -0
- package/dist/types/token-limits.js +57 -0
- package/dist/types/token-limits.js.map +1 -0
- package/dist/types/token.d.ts +329 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/token.js +9 -0
- package/dist/types/token.js.map +1 -0
- package/dist/types/update.d.ts +189 -0
- package/dist/types/update.d.ts.map +1 -0
- package/dist/types/update.js +55 -0
- package/dist/types/update.js.map +1 -0
- package/dist/types/workflow.d.ts +396 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +46 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/ui/App.d.ts +62 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +511 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/InteractiveSession.d.ts +34 -0
- package/dist/ui/InteractiveSession.d.ts.map +1 -0
- package/dist/ui/InteractiveSession.js +3611 -0
- package/dist/ui/InteractiveSession.js.map +1 -0
- package/dist/ui/MCPApprovalPrompt.d.ts +27 -0
- package/dist/ui/MCPApprovalPrompt.d.ts.map +1 -0
- package/dist/ui/MCPApprovalPrompt.js +51 -0
- package/dist/ui/MCPApprovalPrompt.js.map +1 -0
- package/dist/ui/SetupWizard.d.ts +26 -0
- package/dist/ui/SetupWizard.d.ts.map +1 -0
- package/dist/ui/SetupWizard.js +396 -0
- package/dist/ui/SetupWizard.js.map +1 -0
- package/dist/ui/components/AgentCreationWizard.d.ts +36 -0
- package/dist/ui/components/AgentCreationWizard.d.ts.map +1 -0
- package/dist/ui/components/AgentCreationWizard.js +619 -0
- package/dist/ui/components/AgentCreationWizard.js.map +1 -0
- package/dist/ui/components/AgentManager.d.ts +41 -0
- package/dist/ui/components/AgentManager.d.ts.map +1 -0
- package/dist/ui/components/AgentManager.js +343 -0
- package/dist/ui/components/AgentManager.js.map +1 -0
- package/dist/ui/components/ApprovalDialog.d.ts +18 -0
- package/dist/ui/components/ApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/ApprovalDialog.js +439 -0
- package/dist/ui/components/ApprovalDialog.js.map +1 -0
- package/dist/ui/components/AsciiArt.d.ts +54 -0
- package/dist/ui/components/AsciiArt.d.ts.map +1 -0
- package/dist/ui/components/AsciiArt.js +89 -0
- package/dist/ui/components/AsciiArt.js.map +1 -0
- package/dist/ui/components/ClarificationWizard.d.ts +36 -0
- package/dist/ui/components/ClarificationWizard.d.ts.map +1 -0
- package/dist/ui/components/ClarificationWizard.js +407 -0
- package/dist/ui/components/ClarificationWizard.js.map +1 -0
- package/dist/ui/components/CompassSpinner.d.ts +15 -0
- package/dist/ui/components/CompassSpinner.d.ts.map +1 -0
- package/dist/ui/components/CompassSpinner.js +50 -0
- package/dist/ui/components/CompassSpinner.js.map +1 -0
- package/dist/ui/components/ConfirmationSelector.d.ts +45 -0
- package/dist/ui/components/ConfirmationSelector.d.ts.map +1 -0
- package/dist/ui/components/ConfirmationSelector.js +106 -0
- package/dist/ui/components/ConfirmationSelector.js.map +1 -0
- package/dist/ui/components/ContextUsage.d.ts +76 -0
- package/dist/ui/components/ContextUsage.d.ts.map +1 -0
- package/dist/ui/components/ContextUsage.js +188 -0
- package/dist/ui/components/ContextUsage.js.map +1 -0
- package/dist/ui/components/DiffPreview.d.ts +13 -0
- package/dist/ui/components/DiffPreview.d.ts.map +1 -0
- package/dist/ui/components/DiffPreview.js +30 -0
- package/dist/ui/components/DiffPreview.js.map +1 -0
- package/dist/ui/components/ExecutionModeSelector.d.ts +45 -0
- package/dist/ui/components/ExecutionModeSelector.d.ts.map +1 -0
- package/dist/ui/components/ExecutionModeSelector.js +120 -0
- package/dist/ui/components/ExecutionModeSelector.js.map +1 -0
- package/dist/ui/components/FileTree.d.ts +47 -0
- package/dist/ui/components/FileTree.d.ts.map +1 -0
- package/dist/ui/components/FileTree.js +258 -0
- package/dist/ui/components/FileTree.js.map +1 -0
- package/dist/ui/components/HelpMenu.d.ts +49 -0
- package/dist/ui/components/HelpMenu.d.ts.map +1 -0
- package/dist/ui/components/HelpMenu.js +91 -0
- package/dist/ui/components/HelpMenu.js.map +1 -0
- package/dist/ui/components/InterleavedStream.d.ts +42 -0
- package/dist/ui/components/InterleavedStream.d.ts.map +1 -0
- package/dist/ui/components/InterleavedStream.js +1500 -0
- package/dist/ui/components/InterleavedStream.js.map +1 -0
- package/dist/ui/components/ModelSelector.d.ts +81 -0
- package/dist/ui/components/ModelSelector.d.ts.map +1 -0
- package/dist/ui/components/ModelSelector.js +305 -0
- package/dist/ui/components/ModelSelector.js.map +1 -0
- package/dist/ui/components/PlanApprovalDialog.d.ts +21 -0
- package/dist/ui/components/PlanApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/PlanApprovalDialog.js +189 -0
- package/dist/ui/components/PlanApprovalDialog.js.map +1 -0
- package/dist/ui/components/PlanExecutionTracker.d.ts +53 -0
- package/dist/ui/components/PlanExecutionTracker.d.ts.map +1 -0
- package/dist/ui/components/PlanExecutionTracker.js +113 -0
- package/dist/ui/components/PlanExecutionTracker.js.map +1 -0
- package/dist/ui/components/ProgressIndicator.d.ts +151 -0
- package/dist/ui/components/ProgressIndicator.d.ts.map +1 -0
- package/dist/ui/components/ProgressIndicator.js +171 -0
- package/dist/ui/components/ProgressIndicator.js.map +1 -0
- package/dist/ui/components/Prompt.d.ts +47 -0
- package/dist/ui/components/Prompt.d.ts.map +1 -0
- package/dist/ui/components/Prompt.js +632 -0
- package/dist/ui/components/Prompt.js.map +1 -0
- package/dist/ui/components/RatingPanel.d.ts +45 -0
- package/dist/ui/components/RatingPanel.d.ts.map +1 -0
- package/dist/ui/components/RatingPanel.js +119 -0
- package/dist/ui/components/RatingPanel.js.map +1 -0
- package/dist/ui/components/StatusLine.d.ts +43 -0
- package/dist/ui/components/StatusLine.d.ts.map +1 -0
- package/dist/ui/components/StatusLine.js +44 -0
- package/dist/ui/components/StatusLine.js.map +1 -0
- package/dist/ui/components/StreamingResponse.d.ts +45 -0
- package/dist/ui/components/StreamingResponse.d.ts.map +1 -0
- package/dist/ui/components/StreamingResponse.js +56 -0
- package/dist/ui/components/StreamingResponse.js.map +1 -0
- package/dist/ui/components/TokenUsage.d.ts +89 -0
- package/dist/ui/components/TokenUsage.d.ts.map +1 -0
- package/dist/ui/components/TokenUsage.js +99 -0
- package/dist/ui/components/TokenUsage.js.map +1 -0
- package/dist/ui/components/ToolSummary.d.ts +77 -0
- package/dist/ui/components/ToolSummary.d.ts.map +1 -0
- package/dist/ui/components/ToolSummary.js +162 -0
- package/dist/ui/components/ToolSummary.js.map +1 -0
- package/dist/ui/components/UpdateNotification.d.ts +65 -0
- package/dist/ui/components/UpdateNotification.d.ts.map +1 -0
- package/dist/ui/components/UpdateNotification.js +166 -0
- package/dist/ui/components/UpdateNotification.js.map +1 -0
- package/dist/ui/diff-renderer.d.ts +18 -0
- package/dist/ui/diff-renderer.d.ts.map +1 -0
- package/dist/ui/diff-renderer.js +206 -0
- package/dist/ui/diff-renderer.js.map +1 -0
- package/dist/ui/themes/markdown-theme.d.ts +48 -0
- package/dist/ui/themes/markdown-theme.d.ts.map +1 -0
- package/dist/ui/themes/markdown-theme.js +79 -0
- package/dist/ui/themes/markdown-theme.js.map +1 -0
- package/dist/ui/themes/ui-theme.d.ts +301 -0
- package/dist/ui/themes/ui-theme.d.ts.map +1 -0
- package/dist/ui/themes/ui-theme.js +204 -0
- package/dist/ui/themes/ui-theme.js.map +1 -0
- package/dist/utils/attachment-handler.d.ts +129 -0
- package/dist/utils/attachment-handler.d.ts.map +1 -0
- package/dist/utils/attachment-handler.js +280 -0
- package/dist/utils/attachment-handler.js.map +1 -0
- package/dist/utils/backup-cleanup.d.ts +28 -0
- package/dist/utils/backup-cleanup.d.ts.map +1 -0
- package/dist/utils/backup-cleanup.js +99 -0
- package/dist/utils/backup-cleanup.js.map +1 -0
- package/dist/utils/clipboard-handler.d.ts +82 -0
- package/dist/utils/clipboard-handler.d.ts.map +1 -0
- package/dist/utils/clipboard-handler.js +311 -0
- package/dist/utils/clipboard-handler.js.map +1 -0
- package/dist/utils/cloud-detection.d.ts +14 -0
- package/dist/utils/cloud-detection.d.ts.map +1 -0
- package/dist/utils/cloud-detection.js +92 -0
- package/dist/utils/cloud-detection.js.map +1 -0
- package/dist/utils/command-parser.d.ts +56 -0
- package/dist/utils/command-parser.d.ts.map +1 -0
- package/dist/utils/command-parser.js +206 -0
- package/dist/utils/command-parser.js.map +1 -0
- package/dist/utils/console-capture.d.ts +30 -0
- package/dist/utils/console-capture.d.ts.map +1 -0
- package/dist/utils/console-capture.js +88 -0
- package/dist/utils/console-capture.js.map +1 -0
- package/dist/utils/cron-parser.d.ts +52 -0
- package/dist/utils/cron-parser.d.ts.map +1 -0
- package/dist/utils/cron-parser.js +455 -0
- package/dist/utils/cron-parser.js.map +1 -0
- package/dist/utils/crypto.d.ts +351 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +615 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/diff.d.ts +311 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +566 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/editor.d.ts +12 -0
- package/dist/utils/editor.d.ts.map +1 -0
- package/dist/utils/editor.js +30 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/file-system.d.ts +512 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +798 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/format.d.ts +318 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +587 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/ignore-patterns.d.ts +93 -0
- package/dist/utils/ignore-patterns.d.ts.map +1 -0
- package/dist/utils/ignore-patterns.js +710 -0
- package/dist/utils/ignore-patterns.js.map +1 -0
- package/dist/utils/log-cleanup.d.ts +16 -0
- package/dist/utils/log-cleanup.d.ts.map +1 -0
- package/dist/utils/log-cleanup.js +51 -0
- package/dist/utils/log-cleanup.js.map +1 -0
- package/dist/utils/logger.d.ts +305 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +447 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path.d.ts +406 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +549 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/schedule-file.d.ts +63 -0
- package/dist/utils/schedule-file.d.ts.map +1 -0
- package/dist/utils/schedule-file.js +244 -0
- package/dist/utils/schedule-file.js.map +1 -0
- package/dist/utils/task-id.d.ts +29 -0
- package/dist/utils/task-id.d.ts.map +1 -0
- package/dist/utils/task-id.js +53 -0
- package/dist/utils/task-id.js.map +1 -0
- package/dist/utils/temp-cleanup.d.ts +46 -0
- package/dist/utils/temp-cleanup.d.ts.map +1 -0
- package/dist/utils/temp-cleanup.js +95 -0
- package/dist/utils/temp-cleanup.js.map +1 -0
- package/dist/utils/terminal-output.d.ts +34 -0
- package/dist/utils/terminal-output.d.ts.map +1 -0
- package/dist/utils/terminal-output.js +40 -0
- package/dist/utils/terminal-output.js.map +1 -0
- package/dist/utils/token-counter.d.ts +224 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +332 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/dist/utils/tool-mapper.d.ts +70 -0
- package/dist/utils/tool-mapper.d.ts.map +1 -0
- package/dist/utils/tool-mapper.js +234 -0
- package/dist/utils/tool-mapper.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,954 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File operation tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for reading, writing, and manipulating files and directories.
|
|
5
|
+
* Extracted from the monolithic built-in-tools.ts for better maintainability.
|
|
6
|
+
*/
|
|
7
|
+
import { getFileService } from '../services/file-service.js';
|
|
8
|
+
import { ActionType } from '../services/action-logger.js';
|
|
9
|
+
import { pathExists } from '../utils/file-system.js';
|
|
10
|
+
import { trackFileHash, updateFileHash, validateFileIntegrity, untrackFile, FileModifiedExternallyError, } from '../services/file-hash-tracker.js';
|
|
11
|
+
import { MAX_FILE_READ_TOKENS, MAX_FILE_TOKENS_REJECT_THRESHOLD } from '../constants/defaults.js';
|
|
12
|
+
import { estimateTokens } from '../utils/token-counter.js';
|
|
13
|
+
import { isBlocklistedFile, truncateToolResult, formatBytes, findSimilarText, } from './shared-utils.js';
|
|
14
|
+
import { replaceWithStrategies } from './edit-replacers.js';
|
|
15
|
+
import { generateCompactEditResponse } from '../utils/diff.js';
|
|
16
|
+
import path from 'path';
|
|
17
|
+
import { logger } from '../utils/logger.js';
|
|
18
|
+
import { getGlobalCompassDir, getProjectCompassDir } from '../utils/path.js';
|
|
19
|
+
const turnFileCache = new Map();
|
|
20
|
+
const TURN_CACHE_TTL_MS = 60000; // 60 seconds - covers typical LLM turn duration
|
|
21
|
+
/**
|
|
22
|
+
* Gets a cached file entry if it exists and hasn't expired
|
|
23
|
+
*/
|
|
24
|
+
function getCachedFile(filePath) {
|
|
25
|
+
const entry = turnFileCache.get(filePath);
|
|
26
|
+
if (entry && Date.now() - entry.timestamp < TURN_CACHE_TTL_MS) {
|
|
27
|
+
return entry;
|
|
28
|
+
}
|
|
29
|
+
// Expired or not found - clean up if expired
|
|
30
|
+
if (entry) {
|
|
31
|
+
turnFileCache.delete(filePath);
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Caches a file read result
|
|
37
|
+
* @param fullContentReturned - Whether the full file content was returned to the LLM
|
|
38
|
+
*/
|
|
39
|
+
function cacheFileRead(filePath, content, totalLines, fullContentReturned) {
|
|
40
|
+
// Limit cache size to prevent memory bloat
|
|
41
|
+
if (turnFileCache.size >= 50) {
|
|
42
|
+
// Evict oldest entries
|
|
43
|
+
const now = Date.now();
|
|
44
|
+
for (const [key, entry] of turnFileCache) {
|
|
45
|
+
if (now - entry.timestamp > TURN_CACHE_TTL_MS / 2) {
|
|
46
|
+
turnFileCache.delete(key);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const existing = turnFileCache.get(filePath);
|
|
51
|
+
turnFileCache.set(filePath, {
|
|
52
|
+
content,
|
|
53
|
+
timestamp: Date.now(),
|
|
54
|
+
size: content.length,
|
|
55
|
+
totalLines,
|
|
56
|
+
// Once full content has been returned, keep it flagged
|
|
57
|
+
fullContentReturned: fullContentReturned || (existing?.fullContentReturned ?? false),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Invalidates a cached file (call after writes/edits)
|
|
62
|
+
*/
|
|
63
|
+
function invalidateCachedFile(filePath) {
|
|
64
|
+
turnFileCache.delete(filePath);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Clears the entire turn cache (call on new conversation turns if needed)
|
|
68
|
+
*/
|
|
69
|
+
export function clearTurnFileCache() {
|
|
70
|
+
turnFileCache.clear();
|
|
71
|
+
}
|
|
72
|
+
export function registerFileTools(registry) {
|
|
73
|
+
registry.registerTool('read_file', `Reads the contents of a file from the project.
|
|
74
|
+
|
|
75
|
+
IMPORTANT: To minimize token usage and context bloat:
|
|
76
|
+
- For large files (>200 lines), ALWAYS use offset/limit to read specific sections
|
|
77
|
+
- First read a small portion (limit: 50) to understand structure, then target specific areas
|
|
78
|
+
- Use grep_search to find relevant line numbers before reading
|
|
79
|
+
- Full file reads are truncated at ~8000 tokens and rejected entirely above ~40000 tokens
|
|
80
|
+
|
|
81
|
+
Parameters:
|
|
82
|
+
- path: File path to read
|
|
83
|
+
- offset: Starting line number (0-indexed). Use to skip to relevant sections.
|
|
84
|
+
- limit: Max lines to read. Use 50-100 for targeted reads.`, {
|
|
85
|
+
type: 'object',
|
|
86
|
+
properties: {
|
|
87
|
+
path: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Relative or absolute path to the file to read',
|
|
90
|
+
},
|
|
91
|
+
offset: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Line number to start reading from (0-indexed). Defaults to 0 (start of file).',
|
|
94
|
+
},
|
|
95
|
+
limit: {
|
|
96
|
+
type: 'number',
|
|
97
|
+
description: 'Maximum number of lines to read. If not specified, reads to end of file.',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: ['path'],
|
|
101
|
+
}, async (input, context) => {
|
|
102
|
+
const fileService = getFileService();
|
|
103
|
+
const filePath = path.resolve(context.projectRoot, input.path);
|
|
104
|
+
// Check if file is blocklisted (large/generated files that would bloat context)
|
|
105
|
+
const blocklistCheck = isBlocklistedFile(input.path);
|
|
106
|
+
if (blocklistCheck.blocked) {
|
|
107
|
+
logger.warn(`Blocked read of file: ${input.path}`, { reason: blocklistCheck.reason });
|
|
108
|
+
return {
|
|
109
|
+
path: input.path,
|
|
110
|
+
content: '',
|
|
111
|
+
size: 0,
|
|
112
|
+
totalLines: 0,
|
|
113
|
+
linesReturned: 0,
|
|
114
|
+
blocked: true,
|
|
115
|
+
blockReason: blocklistCheck.reason,
|
|
116
|
+
suggestion: 'If you need specific information from this file, please describe what you\'re looking for and I can help find an alternative approach.',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const exists = await pathExists(filePath);
|
|
120
|
+
if (!exists) {
|
|
121
|
+
throw new Error(`File not found: ${input.path}`);
|
|
122
|
+
}
|
|
123
|
+
// Check turn cache first to avoid redundant disk reads
|
|
124
|
+
const hasPartialRead = input.offset !== undefined || input.limit !== undefined;
|
|
125
|
+
const cachedEntry = getCachedFile(filePath);
|
|
126
|
+
let content;
|
|
127
|
+
let fromCache = false;
|
|
128
|
+
if (cachedEntry && !hasPartialRead && cachedEntry.fullContentReturned) {
|
|
129
|
+
// Full file read with cache hit AND full content was already shown to LLM
|
|
130
|
+
// DON'T return full content again - this prevents context bloat
|
|
131
|
+
logger.debug(`Turn cache hit for ${input.path} (${cachedEntry.size} bytes) - returning stub (already read)`);
|
|
132
|
+
return {
|
|
133
|
+
path: input.path,
|
|
134
|
+
content: '', // Empty content to save tokens
|
|
135
|
+
size: cachedEntry.size,
|
|
136
|
+
totalLines: cachedEntry.totalLines,
|
|
137
|
+
linesReturned: 0,
|
|
138
|
+
fromCache: true,
|
|
139
|
+
alreadyRead: true,
|
|
140
|
+
note: `This file (${cachedEntry.totalLines} lines) was already read in this conversation. Use the previously read content instead of re-reading. If you need a specific section, use offset/limit parameters.`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
else if (cachedEntry && !hasPartialRead && !cachedEntry.fullContentReturned) {
|
|
144
|
+
// Full file read, file is cached but only partial content was shown before
|
|
145
|
+
// Return full content from cache and mark as fully returned
|
|
146
|
+
content = cachedEntry.content;
|
|
147
|
+
fromCache = true;
|
|
148
|
+
// Update cache to mark full content as returned
|
|
149
|
+
cacheFileRead(filePath, content, cachedEntry.totalLines, true);
|
|
150
|
+
logger.debug(`Turn cache hit for ${input.path} - returning full content (first full read)`);
|
|
151
|
+
}
|
|
152
|
+
else if (cachedEntry && hasPartialRead) {
|
|
153
|
+
// Partial read but we have the full file cached - slice from cache
|
|
154
|
+
content = cachedEntry.content;
|
|
155
|
+
fromCache = true;
|
|
156
|
+
logger.debug(`Turn cache hit (partial read) for ${input.path}`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Cache miss - read from disk
|
|
160
|
+
content = await fileService.readFile(filePath) || '';
|
|
161
|
+
// Cache full file content for future reads in this turn
|
|
162
|
+
// Mark fullContentReturned based on whether this is a full read or partial
|
|
163
|
+
const lines = content.split('\n');
|
|
164
|
+
cacheFileRead(filePath, content, lines.length, !hasPartialRead);
|
|
165
|
+
logger.debug(`Turn cache miss for ${input.path}, cached ${content.length} bytes`);
|
|
166
|
+
}
|
|
167
|
+
// Track the full file content hash for integrity checking on future edits
|
|
168
|
+
// Only track if reading the full file (no offset/limit)
|
|
169
|
+
const fullContent = content;
|
|
170
|
+
if (!hasPartialRead) {
|
|
171
|
+
trackFileHash(filePath, fullContent);
|
|
172
|
+
// Check if full file read would exceed token threshold
|
|
173
|
+
const estimatedTokenCount = estimateTokens(content);
|
|
174
|
+
if (estimatedTokenCount > MAX_FILE_TOKENS_REJECT_THRESHOLD) {
|
|
175
|
+
throw new Error(`File content (${estimatedTokenCount} tokens) exceeds maximum allowed tokens (${MAX_FILE_TOKENS_REJECT_THRESHOLD}). ` +
|
|
176
|
+
`Please use offset and limit parameters to read specific portions of the file, ` +
|
|
177
|
+
`or use the GrepTool to search for specific content.`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
let lines = content.split('\n');
|
|
181
|
+
const totalLines = lines.length;
|
|
182
|
+
let truncated = false;
|
|
183
|
+
let tokenTruncated = false;
|
|
184
|
+
let originalTokens;
|
|
185
|
+
// Apply offset (start line)
|
|
186
|
+
const startLine = input.offset !== undefined && input.offset > 0 ? Math.min(input.offset, totalLines) : 0;
|
|
187
|
+
// Apply limit (number of lines to read)
|
|
188
|
+
let endLine = totalLines;
|
|
189
|
+
if (input.limit !== undefined && input.limit > 0) {
|
|
190
|
+
endLine = Math.min(startLine + input.limit, totalLines);
|
|
191
|
+
}
|
|
192
|
+
// Slice the lines if we have offset or limit
|
|
193
|
+
if (startLine > 0 || endLine < totalLines) {
|
|
194
|
+
lines = lines.slice(startLine, endLine);
|
|
195
|
+
truncated = startLine > 0 || endLine < totalLines;
|
|
196
|
+
content = lines.join('\n');
|
|
197
|
+
}
|
|
198
|
+
// Apply token-based truncation to prevent context bloat
|
|
199
|
+
const truncationResult = truncateToolResult(content, MAX_FILE_READ_TOKENS, 'File content');
|
|
200
|
+
if (truncationResult.wasTruncated) {
|
|
201
|
+
content = truncationResult.content;
|
|
202
|
+
tokenTruncated = true;
|
|
203
|
+
originalTokens = truncationResult.originalTokens;
|
|
204
|
+
logger.info(`Truncated file read for ${input.path}: ${truncationResult.originalTokens} -> ${truncationResult.truncatedTokens} tokens`);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
path: input.path,
|
|
208
|
+
content,
|
|
209
|
+
size: content.length,
|
|
210
|
+
totalLines,
|
|
211
|
+
linesReturned: lines.length,
|
|
212
|
+
truncated: truncated || tokenTruncated,
|
|
213
|
+
tokenTruncated,
|
|
214
|
+
originalTokens,
|
|
215
|
+
startLine: startLine > 0 ? startLine : undefined,
|
|
216
|
+
fromCache,
|
|
217
|
+
// Hint to LLM: if fromCache is true, this file was already read recently
|
|
218
|
+
...(fromCache && { note: 'This file was read recently in this conversation. Content served from cache.' }),
|
|
219
|
+
};
|
|
220
|
+
}, {
|
|
221
|
+
actionType: ActionType.FILE_READ,
|
|
222
|
+
requiresApproval: false,
|
|
223
|
+
category: 'file_operations',
|
|
224
|
+
tags: ['io', 'read'],
|
|
225
|
+
displayName: 'Read',
|
|
226
|
+
});
|
|
227
|
+
registry.registerTool('write_file', `Writes content to a file. Creates the file if it doesn't exist, or overwrites if it does.
|
|
228
|
+
|
|
229
|
+
When to use:
|
|
230
|
+
- Creating NEW files
|
|
231
|
+
- Complete file rewrites (replacing all content)
|
|
232
|
+
- When you have the full file content ready
|
|
233
|
+
|
|
234
|
+
Use edit_file instead for: targeted changes to specific parts of existing files.`, {
|
|
235
|
+
type: 'object',
|
|
236
|
+
properties: {
|
|
237
|
+
path: {
|
|
238
|
+
type: 'string',
|
|
239
|
+
description: 'Relative or absolute path to the file to write',
|
|
240
|
+
},
|
|
241
|
+
content: {
|
|
242
|
+
type: 'string',
|
|
243
|
+
description: 'Content to write to the file',
|
|
244
|
+
},
|
|
245
|
+
description: {
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: 'Human-readable description of why this file is being written',
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
required: ['path', 'content'],
|
|
251
|
+
}, async (input, context) => {
|
|
252
|
+
const fileService = getFileService();
|
|
253
|
+
const filePath = path.resolve(context.projectRoot, input.path);
|
|
254
|
+
// If file exists, validate it hasn't been modified externally since last read
|
|
255
|
+
const fileExists = await pathExists(filePath);
|
|
256
|
+
if (fileExists) {
|
|
257
|
+
try {
|
|
258
|
+
await validateFileIntegrity(filePath);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
if (error instanceof FileModifiedExternallyError) {
|
|
262
|
+
// Invalidate stale caches so next read_file hits disk and re-tracks
|
|
263
|
+
invalidateCachedFile(filePath);
|
|
264
|
+
untrackFile(filePath);
|
|
265
|
+
return error.toToolResponse();
|
|
266
|
+
}
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Auto-approve writes to internal CLI directories (memory, config, etc.)
|
|
271
|
+
const isCompassPath = filePath.startsWith(getGlobalCompassDir())
|
|
272
|
+
|| filePath.startsWith(getProjectCompassDir(context.projectRoot));
|
|
273
|
+
const result = await fileService.writeFile(filePath, input.content, {
|
|
274
|
+
description: input.description || `Write file: ${input.path}`,
|
|
275
|
+
requireApproval: !isCompassPath,
|
|
276
|
+
createBackup: !isCompassPath,
|
|
277
|
+
});
|
|
278
|
+
// Update the tracked hash after successful write
|
|
279
|
+
if (result.success) {
|
|
280
|
+
updateFileHash(filePath, input.content);
|
|
281
|
+
// Invalidate turn cache so next read gets fresh content
|
|
282
|
+
invalidateCachedFile(filePath);
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
path: input.path,
|
|
286
|
+
success: result.success,
|
|
287
|
+
operation: result.operation,
|
|
288
|
+
backupCreated: !!result.backup,
|
|
289
|
+
error: result.error, // Pass through error for rejection detection
|
|
290
|
+
lineCount: input.content.split('\n').length,
|
|
291
|
+
byteSize: Buffer.byteLength(input.content, 'utf-8'),
|
|
292
|
+
};
|
|
293
|
+
}, {
|
|
294
|
+
actionType: ActionType.FILE_WRITE,
|
|
295
|
+
requiresApproval: true,
|
|
296
|
+
category: 'file_operations',
|
|
297
|
+
tags: ['io', 'write', 'modify'],
|
|
298
|
+
displayName: 'Write',
|
|
299
|
+
});
|
|
300
|
+
registry.registerTool('delete_file', 'Deletes a file from the filesystem. A backup will be created automatically before deletion.', {
|
|
301
|
+
type: 'object',
|
|
302
|
+
properties: {
|
|
303
|
+
path: {
|
|
304
|
+
type: 'string',
|
|
305
|
+
description: 'Relative or absolute path to the file to delete',
|
|
306
|
+
},
|
|
307
|
+
description: {
|
|
308
|
+
type: 'string',
|
|
309
|
+
description: 'Reason for deleting this file',
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
required: ['path'],
|
|
313
|
+
}, async (input, context) => {
|
|
314
|
+
const fileService = getFileService();
|
|
315
|
+
const filePath = path.resolve(context.projectRoot, input.path);
|
|
316
|
+
const result = await fileService.deleteFile(filePath, {
|
|
317
|
+
description: input.description || `Delete file: ${input.path}`,
|
|
318
|
+
requireApproval: true,
|
|
319
|
+
});
|
|
320
|
+
// Invalidate turn cache for deleted file
|
|
321
|
+
if (result.success) {
|
|
322
|
+
invalidateCachedFile(filePath);
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
path: input.path,
|
|
326
|
+
success: result.success,
|
|
327
|
+
backupCreated: !!result.backup,
|
|
328
|
+
error: result.error, // Pass through error for rejection detection
|
|
329
|
+
};
|
|
330
|
+
}, {
|
|
331
|
+
actionType: ActionType.FILE_DELETE,
|
|
332
|
+
requiresApproval: true,
|
|
333
|
+
category: 'file_operations',
|
|
334
|
+
tags: ['io', 'delete', 'remove'],
|
|
335
|
+
displayName: 'Delete',
|
|
336
|
+
});
|
|
337
|
+
registry.registerTool('list_files', 'Lists files in a directory with optional glob pattern filtering. Always provide the "directory" parameter — use "." for the project root. To search recursively, set "recursive" to true. Example: directory="src", pattern="*.tsx", recursive=true.', {
|
|
338
|
+
type: 'object',
|
|
339
|
+
properties: {
|
|
340
|
+
directory: {
|
|
341
|
+
type: 'string',
|
|
342
|
+
description: 'Directory to list files from (relative or absolute). Use "." for the project root. This parameter is required.',
|
|
343
|
+
},
|
|
344
|
+
pattern: {
|
|
345
|
+
type: 'string',
|
|
346
|
+
description: 'Glob pattern to filter file names (e.g., "*.ts", "*.{png,jpg,svg}"). Only matches file names, not paths. Defaults to "*" (all files).',
|
|
347
|
+
},
|
|
348
|
+
recursive: {
|
|
349
|
+
type: 'boolean',
|
|
350
|
+
description: 'Whether to list files recursively in subdirectories. Set to true when searching the whole tree.',
|
|
351
|
+
default: false,
|
|
352
|
+
},
|
|
353
|
+
excludePatterns: {
|
|
354
|
+
type: 'array',
|
|
355
|
+
items: { type: 'string' },
|
|
356
|
+
description: 'Glob patterns to exclude (e.g., ["**/test/**", "**/*.spec.ts"]). Defaults to node_modules, .git, dist, build.',
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
required: ['directory'],
|
|
360
|
+
}, async (input, context) => {
|
|
361
|
+
const { glob } = await import('glob');
|
|
362
|
+
const directory = input.directory || '.';
|
|
363
|
+
const dirPath = path.resolve(context.projectRoot, directory);
|
|
364
|
+
const exists = await pathExists(dirPath);
|
|
365
|
+
if (!exists) {
|
|
366
|
+
throw new Error(`Directory not found: ${directory}`);
|
|
367
|
+
}
|
|
368
|
+
const pattern = input.pattern || '*';
|
|
369
|
+
// Convert to forward slashes for glob compatibility on Windows
|
|
370
|
+
const globPattern = (input.recursive
|
|
371
|
+
? path.join(dirPath, '**', pattern)
|
|
372
|
+
: path.join(dirPath, pattern)).replace(/\\/g, '/');
|
|
373
|
+
const defaultExcludes = ['**/node_modules/**', '**/.git/**', '**/dist/**', '**/build/**'];
|
|
374
|
+
let excludePatterns = input.excludePatterns || defaultExcludes;
|
|
375
|
+
// CLI data directories (.compass/, .claude/) should always be accessible —
|
|
376
|
+
// strip any exclude patterns that would block them when explicitly targeted
|
|
377
|
+
const normalizedDir = directory.replace(/\\/g, '/').toLowerCase();
|
|
378
|
+
const isCliDataDir = normalizedDir === '.compass' || normalizedDir.startsWith('.compass/') ||
|
|
379
|
+
normalizedDir === '.claude' || normalizedDir.startsWith('.claude/');
|
|
380
|
+
if (isCliDataDir) {
|
|
381
|
+
excludePatterns = excludePatterns.filter((p) => {
|
|
382
|
+
const lp = p.toLowerCase();
|
|
383
|
+
return !lp.includes('.compass') && !lp.includes('.claude');
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
const files = await glob(globPattern, {
|
|
387
|
+
nodir: true,
|
|
388
|
+
dot: true,
|
|
389
|
+
ignore: excludePatterns,
|
|
390
|
+
});
|
|
391
|
+
return {
|
|
392
|
+
directory,
|
|
393
|
+
pattern: input.pattern,
|
|
394
|
+
excludePatterns,
|
|
395
|
+
files: files.map((f) => path.relative(context.projectRoot, f)),
|
|
396
|
+
count: files.length,
|
|
397
|
+
};
|
|
398
|
+
}, {
|
|
399
|
+
actionType: ActionType.SEARCH,
|
|
400
|
+
requiresApproval: false,
|
|
401
|
+
category: 'file_operations',
|
|
402
|
+
tags: ['io', 'search', 'explore'],
|
|
403
|
+
displayName: 'Glob',
|
|
404
|
+
});
|
|
405
|
+
registry.registerTool('read_media_file', 'Reads an image or audio file and returns it as base64 data with MIME type. Use for processing media files.', {
|
|
406
|
+
type: 'object',
|
|
407
|
+
properties: {
|
|
408
|
+
path: {
|
|
409
|
+
type: 'string',
|
|
410
|
+
description: 'Path to the image or audio file to read',
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
required: ['path'],
|
|
414
|
+
}, async (input, context) => {
|
|
415
|
+
const fs = await import('fs/promises');
|
|
416
|
+
const filePath = path.resolve(context.projectRoot, input.path);
|
|
417
|
+
const exists = await pathExists(filePath);
|
|
418
|
+
if (!exists) {
|
|
419
|
+
throw new Error(`File not found: ${input.path}`);
|
|
420
|
+
}
|
|
421
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
422
|
+
// Map extensions to MIME types
|
|
423
|
+
const mimeTypes = {
|
|
424
|
+
// Images
|
|
425
|
+
'.jpg': 'image/jpeg',
|
|
426
|
+
'.jpeg': 'image/jpeg',
|
|
427
|
+
'.png': 'image/png',
|
|
428
|
+
'.gif': 'image/gif',
|
|
429
|
+
'.webp': 'image/webp',
|
|
430
|
+
'.bmp': 'image/bmp',
|
|
431
|
+
'.svg': 'image/svg+xml',
|
|
432
|
+
'.ico': 'image/x-icon',
|
|
433
|
+
'.tiff': 'image/tiff',
|
|
434
|
+
'.tif': 'image/tiff',
|
|
435
|
+
// Audio
|
|
436
|
+
'.mp3': 'audio/mpeg',
|
|
437
|
+
'.wav': 'audio/wav',
|
|
438
|
+
'.ogg': 'audio/ogg',
|
|
439
|
+
'.m4a': 'audio/mp4',
|
|
440
|
+
'.flac': 'audio/flac',
|
|
441
|
+
'.aac': 'audio/aac',
|
|
442
|
+
'.wma': 'audio/x-ms-wma',
|
|
443
|
+
'.webm': 'audio/webm',
|
|
444
|
+
};
|
|
445
|
+
const mimeType = mimeTypes[ext];
|
|
446
|
+
if (!mimeType) {
|
|
447
|
+
throw new Error(`Unsupported media file type: ${ext}. Supported: ${Object.keys(mimeTypes).join(', ')}`);
|
|
448
|
+
}
|
|
449
|
+
const buffer = await fs.readFile(filePath);
|
|
450
|
+
const base64 = buffer.toString('base64');
|
|
451
|
+
const stats = await fs.stat(filePath);
|
|
452
|
+
return {
|
|
453
|
+
path: input.path,
|
|
454
|
+
mimeType,
|
|
455
|
+
base64,
|
|
456
|
+
size: stats.size,
|
|
457
|
+
sizeHuman: formatBytes(stats.size),
|
|
458
|
+
};
|
|
459
|
+
}, {
|
|
460
|
+
actionType: ActionType.FILE_READ,
|
|
461
|
+
requiresApproval: false,
|
|
462
|
+
category: 'file_operations',
|
|
463
|
+
tags: ['io', 'read', 'media', 'image', 'audio'],
|
|
464
|
+
displayName: 'Read Media',
|
|
465
|
+
});
|
|
466
|
+
registry.registerTool('create_directory', 'Creates a new directory. Creates parent directories if needed. Succeeds silently if directory already exists.', {
|
|
467
|
+
type: 'object',
|
|
468
|
+
properties: {
|
|
469
|
+
path: {
|
|
470
|
+
type: 'string',
|
|
471
|
+
description: 'Path of the directory to create (relative or absolute)',
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
required: ['path'],
|
|
475
|
+
}, async (input, context) => {
|
|
476
|
+
const fs = await import('fs/promises');
|
|
477
|
+
const dirPath = path.resolve(context.projectRoot, input.path);
|
|
478
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
479
|
+
return {
|
|
480
|
+
path: input.path,
|
|
481
|
+
success: true,
|
|
482
|
+
message: `Directory created: ${input.path}`,
|
|
483
|
+
};
|
|
484
|
+
}, {
|
|
485
|
+
actionType: ActionType.FILE_WRITE,
|
|
486
|
+
requiresApproval: true,
|
|
487
|
+
category: 'file_operations',
|
|
488
|
+
tags: ['io', 'write', 'directory', 'mkdir'],
|
|
489
|
+
displayName: 'Create Directory',
|
|
490
|
+
});
|
|
491
|
+
registry.registerTool('list_directory', 'Lists directory contents with [FILE] or [DIR] prefixes for each entry.', {
|
|
492
|
+
type: 'object',
|
|
493
|
+
properties: {
|
|
494
|
+
path: {
|
|
495
|
+
type: 'string',
|
|
496
|
+
description: 'Directory path to list (relative or absolute)',
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
required: ['path'],
|
|
500
|
+
}, async (input, context) => {
|
|
501
|
+
const fs = await import('fs/promises');
|
|
502
|
+
const dirPath = path.resolve(context.projectRoot, input.path);
|
|
503
|
+
const exists = await pathExists(dirPath);
|
|
504
|
+
if (!exists) {
|
|
505
|
+
throw new Error(`Directory not found: ${input.path}`);
|
|
506
|
+
}
|
|
507
|
+
const stats = await fs.stat(dirPath);
|
|
508
|
+
if (!stats.isDirectory()) {
|
|
509
|
+
throw new Error(`Path is not a directory: ${input.path}`);
|
|
510
|
+
}
|
|
511
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
512
|
+
const listing = entries.map((entry) => {
|
|
513
|
+
const prefix = entry.isDirectory() ? '[DIR]' : '[FILE]';
|
|
514
|
+
return `${prefix} ${entry.name}`;
|
|
515
|
+
});
|
|
516
|
+
return {
|
|
517
|
+
path: input.path,
|
|
518
|
+
entries: listing,
|
|
519
|
+
totalFiles: entries.filter((e) => e.isFile()).length,
|
|
520
|
+
totalDirectories: entries.filter((e) => e.isDirectory()).length,
|
|
521
|
+
total: entries.length,
|
|
522
|
+
};
|
|
523
|
+
}, {
|
|
524
|
+
actionType: ActionType.SEARCH,
|
|
525
|
+
requiresApproval: false,
|
|
526
|
+
category: 'file_operations',
|
|
527
|
+
tags: ['io', 'read', 'directory', 'ls'],
|
|
528
|
+
displayName: 'List',
|
|
529
|
+
});
|
|
530
|
+
registry.registerTool('list_directory_with_sizes', 'Lists directory contents with file sizes, sorted by name or size.', {
|
|
531
|
+
type: 'object',
|
|
532
|
+
properties: {
|
|
533
|
+
path: {
|
|
534
|
+
type: 'string',
|
|
535
|
+
description: 'Directory path to list (relative or absolute)',
|
|
536
|
+
},
|
|
537
|
+
sortBy: {
|
|
538
|
+
type: 'string',
|
|
539
|
+
enum: ['name', 'size'],
|
|
540
|
+
description: 'Sort entries by name or size (default: name)',
|
|
541
|
+
default: 'name',
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
required: ['path'],
|
|
545
|
+
}, async (input, context) => {
|
|
546
|
+
const fs = await import('fs/promises');
|
|
547
|
+
const dirPath = path.resolve(context.projectRoot, input.path);
|
|
548
|
+
const exists = await pathExists(dirPath);
|
|
549
|
+
if (!exists) {
|
|
550
|
+
throw new Error(`Directory not found: ${input.path}`);
|
|
551
|
+
}
|
|
552
|
+
const stats = await fs.stat(dirPath);
|
|
553
|
+
if (!stats.isDirectory()) {
|
|
554
|
+
throw new Error(`Path is not a directory: ${input.path}`);
|
|
555
|
+
}
|
|
556
|
+
const dirEntries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
557
|
+
const entries = await Promise.all(dirEntries.map(async (entry) => {
|
|
558
|
+
const entryPath = path.join(dirPath, entry.name);
|
|
559
|
+
const entryStats = await fs.stat(entryPath);
|
|
560
|
+
return {
|
|
561
|
+
name: entry.name,
|
|
562
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
563
|
+
size: entryStats.size,
|
|
564
|
+
sizeHuman: formatBytes(entryStats.size),
|
|
565
|
+
};
|
|
566
|
+
}));
|
|
567
|
+
// Sort entries
|
|
568
|
+
if (input.sortBy === 'size') {
|
|
569
|
+
entries.sort((a, b) => b.size - a.size);
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
573
|
+
}
|
|
574
|
+
const totalSize = entries.reduce((sum, e) => sum + e.size, 0);
|
|
575
|
+
const fileCount = entries.filter((e) => e.type === 'file').length;
|
|
576
|
+
const dirCount = entries.filter((e) => e.type === 'directory').length;
|
|
577
|
+
const listing = entries.map((e) => {
|
|
578
|
+
const prefix = e.type === 'directory' ? '[DIR]' : '[FILE]';
|
|
579
|
+
const sizeStr = e.type === 'file' ? ` (${e.sizeHuman})` : '';
|
|
580
|
+
return `${prefix} ${e.name}${sizeStr}`;
|
|
581
|
+
});
|
|
582
|
+
return {
|
|
583
|
+
path: input.path,
|
|
584
|
+
sortBy: input.sortBy || 'name',
|
|
585
|
+
entries: listing,
|
|
586
|
+
details: entries,
|
|
587
|
+
summary: {
|
|
588
|
+
totalFiles: fileCount,
|
|
589
|
+
totalDirectories: dirCount,
|
|
590
|
+
totalEntries: entries.length,
|
|
591
|
+
totalSize,
|
|
592
|
+
totalSizeHuman: formatBytes(totalSize),
|
|
593
|
+
},
|
|
594
|
+
};
|
|
595
|
+
}, {
|
|
596
|
+
actionType: ActionType.SEARCH,
|
|
597
|
+
requiresApproval: false,
|
|
598
|
+
category: 'file_operations',
|
|
599
|
+
tags: ['io', 'read', 'directory', 'ls', 'size'],
|
|
600
|
+
displayName: 'List',
|
|
601
|
+
});
|
|
602
|
+
registry.registerTool('move_file', 'Moves or renames a file or directory. Fails if destination already exists.', {
|
|
603
|
+
type: 'object',
|
|
604
|
+
properties: {
|
|
605
|
+
source: {
|
|
606
|
+
type: 'string',
|
|
607
|
+
description: 'Source path (relative or absolute)',
|
|
608
|
+
},
|
|
609
|
+
destination: {
|
|
610
|
+
type: 'string',
|
|
611
|
+
description: 'Destination path (relative or absolute)',
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
required: ['source', 'destination'],
|
|
615
|
+
}, async (input, context) => {
|
|
616
|
+
const fs = await import('fs/promises');
|
|
617
|
+
const sourcePath = path.resolve(context.projectRoot, input.source);
|
|
618
|
+
const destPath = path.resolve(context.projectRoot, input.destination);
|
|
619
|
+
const sourceExists = await pathExists(sourcePath);
|
|
620
|
+
if (!sourceExists) {
|
|
621
|
+
throw new Error(`Source not found: ${input.source}`);
|
|
622
|
+
}
|
|
623
|
+
const destExists = await pathExists(destPath);
|
|
624
|
+
if (destExists) {
|
|
625
|
+
throw new Error(`Destination already exists: ${input.destination}`);
|
|
626
|
+
}
|
|
627
|
+
// Ensure destination directory exists
|
|
628
|
+
const destDir = path.dirname(destPath);
|
|
629
|
+
await fs.mkdir(destDir, { recursive: true });
|
|
630
|
+
await fs.rename(sourcePath, destPath);
|
|
631
|
+
return {
|
|
632
|
+
source: input.source,
|
|
633
|
+
destination: input.destination,
|
|
634
|
+
success: true,
|
|
635
|
+
message: `Moved ${input.source} to ${input.destination}`,
|
|
636
|
+
};
|
|
637
|
+
}, {
|
|
638
|
+
actionType: ActionType.FILE_WRITE,
|
|
639
|
+
requiresApproval: true,
|
|
640
|
+
category: 'file_operations',
|
|
641
|
+
tags: ['io', 'write', 'move', 'rename'],
|
|
642
|
+
displayName: 'Move',
|
|
643
|
+
});
|
|
644
|
+
registry.registerTool('directory_tree', 'Gets a recursive JSON tree structure of directory contents.', {
|
|
645
|
+
type: 'object',
|
|
646
|
+
properties: {
|
|
647
|
+
path: {
|
|
648
|
+
type: 'string',
|
|
649
|
+
description: 'Starting directory path (relative or absolute)',
|
|
650
|
+
},
|
|
651
|
+
excludePatterns: {
|
|
652
|
+
type: 'array',
|
|
653
|
+
items: { type: 'string' },
|
|
654
|
+
description: 'Glob patterns to exclude (e.g., ["node_modules", ".git"]). Defaults to node_modules, .git, dist, build.',
|
|
655
|
+
},
|
|
656
|
+
maxDepth: {
|
|
657
|
+
type: 'number',
|
|
658
|
+
description: 'Maximum depth to traverse (default: 10)',
|
|
659
|
+
default: 10,
|
|
660
|
+
},
|
|
661
|
+
},
|
|
662
|
+
required: ['path'],
|
|
663
|
+
}, async (input, context) => {
|
|
664
|
+
const fs = await import('fs/promises');
|
|
665
|
+
const dirPath = path.resolve(context.projectRoot, input.path);
|
|
666
|
+
const exists = await pathExists(dirPath);
|
|
667
|
+
if (!exists) {
|
|
668
|
+
throw new Error(`Directory not found: ${input.path}`);
|
|
669
|
+
}
|
|
670
|
+
const defaultExcludes = ['node_modules', '.git', 'dist', 'build'];
|
|
671
|
+
const excludePatterns = input.excludePatterns || defaultExcludes;
|
|
672
|
+
const maxDepth = input.maxDepth || 10;
|
|
673
|
+
// Simple glob matching for exclude patterns
|
|
674
|
+
const matchesPattern = (name, pattern) => {
|
|
675
|
+
// Handle exact match
|
|
676
|
+
if (pattern === name)
|
|
677
|
+
return true;
|
|
678
|
+
// Handle wildcard patterns like *.js or .*
|
|
679
|
+
if (pattern.includes('*')) {
|
|
680
|
+
const regexPattern = pattern
|
|
681
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
682
|
+
.replace(/\*/g, '.*')
|
|
683
|
+
.replace(/\?/g, '.');
|
|
684
|
+
return new RegExp(`^${regexPattern}$`).test(name);
|
|
685
|
+
}
|
|
686
|
+
return false;
|
|
687
|
+
};
|
|
688
|
+
const shouldExclude = (name) => {
|
|
689
|
+
return excludePatterns.some((pattern) => matchesPattern(name, pattern));
|
|
690
|
+
};
|
|
691
|
+
const buildTree = async (currentPath, depth) => {
|
|
692
|
+
if (depth > maxDepth) {
|
|
693
|
+
return [];
|
|
694
|
+
}
|
|
695
|
+
const entries = await fs.readdir(currentPath, { withFileTypes: true });
|
|
696
|
+
const nodes = [];
|
|
697
|
+
for (const entry of entries) {
|
|
698
|
+
if (shouldExclude(entry.name)) {
|
|
699
|
+
continue;
|
|
700
|
+
}
|
|
701
|
+
const node = {
|
|
702
|
+
name: entry.name,
|
|
703
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
704
|
+
};
|
|
705
|
+
if (entry.isDirectory()) {
|
|
706
|
+
const childPath = path.join(currentPath, entry.name);
|
|
707
|
+
node.children = await buildTree(childPath, depth + 1);
|
|
708
|
+
}
|
|
709
|
+
nodes.push(node);
|
|
710
|
+
}
|
|
711
|
+
// Sort: directories first, then files, both alphabetically
|
|
712
|
+
nodes.sort((a, b) => {
|
|
713
|
+
if (a.type !== b.type) {
|
|
714
|
+
return a.type === 'directory' ? -1 : 1;
|
|
715
|
+
}
|
|
716
|
+
return a.name.localeCompare(b.name);
|
|
717
|
+
});
|
|
718
|
+
return nodes;
|
|
719
|
+
};
|
|
720
|
+
const tree = await buildTree(dirPath, 1);
|
|
721
|
+
return {
|
|
722
|
+
path: input.path,
|
|
723
|
+
excludePatterns,
|
|
724
|
+
maxDepth,
|
|
725
|
+
tree,
|
|
726
|
+
};
|
|
727
|
+
}, {
|
|
728
|
+
actionType: ActionType.SEARCH,
|
|
729
|
+
requiresApproval: false,
|
|
730
|
+
category: 'file_operations',
|
|
731
|
+
tags: ['io', 'read', 'directory', 'tree', 'structure'],
|
|
732
|
+
displayName: 'Dir Tree',
|
|
733
|
+
});
|
|
734
|
+
// ============================================================
|
|
735
|
+
// EDIT FILE
|
|
736
|
+
// ============================================================
|
|
737
|
+
registry.registerTool('edit_file', `Edits a file by replacing specific strings with new content.
|
|
738
|
+
|
|
739
|
+
When to use:
|
|
740
|
+
- Making targeted changes to EXISTING files
|
|
741
|
+
- Modifying specific functions, classes, or sections
|
|
742
|
+
- Small to medium changes where you don't need to rewrite the whole file
|
|
743
|
+
|
|
744
|
+
Use write_file instead for: new files or complete rewrites.
|
|
745
|
+
|
|
746
|
+
Features: multiple simultaneous edits, dry run preview mode.
|
|
747
|
+
|
|
748
|
+
CRITICAL — Rules for reliable edits:
|
|
749
|
+
1. ALWAYS read the file first (read_file) before attempting any edit. Never edit a file you haven't read in the current conversation.
|
|
750
|
+
2. Copy oldText EXACTLY from the read_file output — including whitespace, indentation, and line breaks. Do NOT retype or paraphrase from memory.
|
|
751
|
+
3. Include enough surrounding context in oldText to make it unique (at least 3-5 lines). If the text appears multiple times, expand oldText until it is unambiguous.
|
|
752
|
+
4. NEVER truncate or abbreviate oldText with "..." or comments. The full literal text must be provided.
|
|
753
|
+
5. If an edit fails with "Text not found" or "Text is not unique", re-read the file and retry with the exact text from the fresh read. Do NOT guess or retry with the same text.`, {
|
|
754
|
+
type: 'object',
|
|
755
|
+
properties: {
|
|
756
|
+
path: {
|
|
757
|
+
type: 'string',
|
|
758
|
+
description: 'Path to the file to edit',
|
|
759
|
+
},
|
|
760
|
+
edits: {
|
|
761
|
+
type: 'array',
|
|
762
|
+
description: 'List of edit operations to perform',
|
|
763
|
+
items: {
|
|
764
|
+
type: 'object',
|
|
765
|
+
properties: {
|
|
766
|
+
oldText: {
|
|
767
|
+
type: 'string',
|
|
768
|
+
description: 'The text to search for (can be substring)',
|
|
769
|
+
},
|
|
770
|
+
newText: {
|
|
771
|
+
type: 'string',
|
|
772
|
+
description: 'The text to replace with. MUST be different from oldText',
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
required: ['oldText', 'newText'],
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
dryRun: {
|
|
779
|
+
type: 'boolean',
|
|
780
|
+
description: 'Preview changes without applying them (default: false)',
|
|
781
|
+
default: false,
|
|
782
|
+
},
|
|
783
|
+
description: {
|
|
784
|
+
type: 'string',
|
|
785
|
+
description: 'Description of what this edit does',
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
required: ['path', 'edits'],
|
|
789
|
+
}, async (input, context) => {
|
|
790
|
+
const fileService = getFileService();
|
|
791
|
+
const filePath = path.resolve(context.projectRoot, input.path);
|
|
792
|
+
const exists = await pathExists(filePath);
|
|
793
|
+
if (!exists) {
|
|
794
|
+
throw new Error(`File not found: ${input.path}`);
|
|
795
|
+
}
|
|
796
|
+
// Validate file integrity - check if file was modified externally since last read
|
|
797
|
+
try {
|
|
798
|
+
await validateFileIntegrity(filePath);
|
|
799
|
+
}
|
|
800
|
+
catch (error) {
|
|
801
|
+
if (error instanceof FileModifiedExternallyError) {
|
|
802
|
+
// Invalidate stale caches so next read_file hits disk and re-tracks
|
|
803
|
+
invalidateCachedFile(filePath);
|
|
804
|
+
untrackFile(filePath);
|
|
805
|
+
return error.toToolResponse();
|
|
806
|
+
}
|
|
807
|
+
throw error;
|
|
808
|
+
}
|
|
809
|
+
const content = await fileService.readFile(filePath);
|
|
810
|
+
if (content === null) {
|
|
811
|
+
throw new Error(`Could not read file: ${input.path}`);
|
|
812
|
+
}
|
|
813
|
+
// Track the file content hash for future integrity checks
|
|
814
|
+
trackFileHash(filePath, content);
|
|
815
|
+
const edits = input.edits;
|
|
816
|
+
if (!edits || edits.length === 0) {
|
|
817
|
+
throw new Error('No edits provided');
|
|
818
|
+
}
|
|
819
|
+
// Validate each edit has required properties with informative error messages
|
|
820
|
+
// Note: Error messages are designed to be clear that oldText/newText are PROPERTIES, not tools
|
|
821
|
+
for (let i = 0; i < edits.length; i++) {
|
|
822
|
+
const edit = edits[i];
|
|
823
|
+
if (typeof edit?.oldText !== 'string') {
|
|
824
|
+
throw new Error(`edit_file validation error: Item ${i + 1} in the "edits" array is missing a valid "oldText" string property. ` +
|
|
825
|
+
`Each edit must be an object like: { "oldText": "text to find", "newText": "replacement" }. ` +
|
|
826
|
+
`Received ${edit?.oldText === undefined ? 'undefined' : typeof edit?.oldText} instead of string.`);
|
|
827
|
+
}
|
|
828
|
+
if (typeof edit?.newText !== 'string') {
|
|
829
|
+
throw new Error(`edit_file validation error: Item ${i + 1} in the "edits" array is missing a valid "newText" string property. ` +
|
|
830
|
+
`Each edit must be an object like: { "oldText": "text to find", "newText": "replacement" }. ` +
|
|
831
|
+
`Received ${edit?.newText === undefined ? 'undefined' : typeof edit?.newText} instead of string.`);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
// Track edit results for reporting
|
|
835
|
+
const editResults = [];
|
|
836
|
+
let workingContent = content;
|
|
837
|
+
for (const edit of edits) {
|
|
838
|
+
try {
|
|
839
|
+
// Use the chain of replacer strategies to find and replace the text
|
|
840
|
+
const result = replaceWithStrategies(workingContent, edit.oldText, edit.newText, false // Don't replace all, handle uniqueness per edit
|
|
841
|
+
);
|
|
842
|
+
// Find line number of the matched text for reporting
|
|
843
|
+
let lineNumber;
|
|
844
|
+
const matchIndex = workingContent.indexOf(result.matchedText);
|
|
845
|
+
if (matchIndex !== -1) {
|
|
846
|
+
// Count newlines before the match to get line number
|
|
847
|
+
const textBeforeMatch = workingContent.substring(0, matchIndex);
|
|
848
|
+
lineNumber = (textBeforeMatch.match(/\n/g) || []).length + 1;
|
|
849
|
+
}
|
|
850
|
+
editResults.push({
|
|
851
|
+
oldText: edit.oldText,
|
|
852
|
+
newText: edit.newText,
|
|
853
|
+
actualOldText: result.matchedText,
|
|
854
|
+
lineNumber,
|
|
855
|
+
strategy: result.strategy,
|
|
856
|
+
});
|
|
857
|
+
// Update working content with the result
|
|
858
|
+
workingContent = result.content;
|
|
859
|
+
}
|
|
860
|
+
catch (error) {
|
|
861
|
+
// Provide helpful error with suggestions when text is not found
|
|
862
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
863
|
+
if (errorMessage.includes('not found')) {
|
|
864
|
+
const suggestions = findSimilarText(workingContent, edit.oldText);
|
|
865
|
+
let errorMsg = `Text not found in file: "${edit.oldText.slice(0, 80)}${edit.oldText.length > 80 ? '...' : ''}"`;
|
|
866
|
+
if (suggestions.length > 0) {
|
|
867
|
+
errorMsg += `\n\nDid you mean one of these? (similar content found):`;
|
|
868
|
+
for (const suggestion of suggestions) {
|
|
869
|
+
errorMsg += `\n Line ${suggestion.lineNumber}: "${suggestion.preview}"`;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
// Add hint about potential whitespace issues
|
|
873
|
+
if (edit.oldText.includes('\r') || edit.oldText.match(/[ \t]$/m)) {
|
|
874
|
+
errorMsg += `\n\nNote: The search text may have trailing whitespace or CRLF line endings that don't match the file.`;
|
|
875
|
+
}
|
|
876
|
+
throw new Error(errorMsg);
|
|
877
|
+
}
|
|
878
|
+
else if (errorMessage.includes('multiple matches')) {
|
|
879
|
+
throw new Error(`Text is not unique: "${edit.oldText.slice(0, 50)}${edit.oldText.length > 50 ? '...' : ''}". Please provide more context to make it unique.`);
|
|
880
|
+
}
|
|
881
|
+
else if (errorMessage.includes('identical')) {
|
|
882
|
+
// oldText and newText are the same - no change needed
|
|
883
|
+
throw new Error(`No change needed: oldText and newText are identical. If you intended to make a change, check that newText differs from oldText. Preview of text: "${edit.oldText.slice(0, 80)}${edit.oldText.length > 80 ? '...' : ''}"`);
|
|
884
|
+
}
|
|
885
|
+
throw error;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
// If dry run, return preview without applying using compact format
|
|
889
|
+
if (input.dryRun) {
|
|
890
|
+
const compactPreview = generateCompactEditResponse(content, workingContent, input.path, 2 // Context lines
|
|
891
|
+
);
|
|
892
|
+
return {
|
|
893
|
+
path: input.path,
|
|
894
|
+
dryRun: true,
|
|
895
|
+
success: true,
|
|
896
|
+
editsCount: edits.length,
|
|
897
|
+
// Echo edits (truncated) - helps LLM learn expected input format
|
|
898
|
+
editsApplied: edits.map((e) => ({
|
|
899
|
+
oldText: e.oldText.slice(0, 60) + (e.oldText.length > 60 ? '...' : ''),
|
|
900
|
+
newText: e.newText.slice(0, 60) + (e.newText.length > 60 ? '...' : ''),
|
|
901
|
+
})),
|
|
902
|
+
context: compactPreview.context,
|
|
903
|
+
changes: compactPreview.changes,
|
|
904
|
+
additions: compactPreview.additions,
|
|
905
|
+
deletions: compactPreview.deletions,
|
|
906
|
+
message: 'Dry run complete. No changes applied.',
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
// Apply the edits
|
|
910
|
+
const isCompassPath = filePath.startsWith(getGlobalCompassDir())
|
|
911
|
+
|| filePath.startsWith(getProjectCompassDir(context.projectRoot));
|
|
912
|
+
const result = await fileService.writeFile(filePath, workingContent, {
|
|
913
|
+
description: input.description || `Edit file: ${input.path} (${edits.length} edit${edits.length > 1 ? 's' : ''})`,
|
|
914
|
+
requireApproval: !isCompassPath,
|
|
915
|
+
createBackup: !isCompassPath,
|
|
916
|
+
});
|
|
917
|
+
// Update the tracked hash after successful write
|
|
918
|
+
if (result.success) {
|
|
919
|
+
updateFileHash(filePath, workingContent);
|
|
920
|
+
// Invalidate turn cache so next read gets fresh content
|
|
921
|
+
invalidateCachedFile(filePath);
|
|
922
|
+
}
|
|
923
|
+
// Generate compact edit response for token efficiency
|
|
924
|
+
// This reduces response size from ~8K to ~500 chars on average
|
|
925
|
+
const compactResponse = generateCompactEditResponse(content, workingContent, input.path, 2 // Context lines before/after changes
|
|
926
|
+
);
|
|
927
|
+
return {
|
|
928
|
+
path: input.path,
|
|
929
|
+
dryRun: false,
|
|
930
|
+
success: result.success,
|
|
931
|
+
operation: 'edit',
|
|
932
|
+
editsCount: edits.length,
|
|
933
|
+
backupCreated: !!result.backup,
|
|
934
|
+
error: result.error,
|
|
935
|
+
// Echo applied edits (truncated) - helps LLM learn expected input format
|
|
936
|
+
editsApplied: edits.map((e) => ({
|
|
937
|
+
oldText: e.oldText.slice(0, 60) + (e.oldText.length > 60 ? '...' : ''),
|
|
938
|
+
newText: e.newText.slice(0, 60) + (e.newText.length > 60 ? '...' : ''),
|
|
939
|
+
})),
|
|
940
|
+
// Compact diff format for token efficiency
|
|
941
|
+
context: compactResponse.context,
|
|
942
|
+
changes: compactResponse.changes,
|
|
943
|
+
additions: compactResponse.additions,
|
|
944
|
+
deletions: compactResponse.deletions,
|
|
945
|
+
};
|
|
946
|
+
}, {
|
|
947
|
+
actionType: ActionType.FILE_WRITE,
|
|
948
|
+
requiresApproval: true,
|
|
949
|
+
category: 'file_operations',
|
|
950
|
+
tags: ['io', 'write', 'edit', 'modify'],
|
|
951
|
+
displayName: 'Edit',
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
//# sourceMappingURL=file-tools.js.map
|