orquesta-cli 0.1.12
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/.eslintrc.json +26 -0
- package/.prettierrc.json +10 -0
- package/CLAUDE.md +199 -0
- package/LICENSE +21 -0
- package/README.md +280 -0
- package/SECURITY.md +290 -0
- package/TEST_LOCAL.md +245 -0
- package/dist/agents/base/base-agent.d.ts +38 -0
- package/dist/agents/base/base-agent.d.ts.map +1 -0
- package/dist/agents/base/base-agent.js +69 -0
- package/dist/agents/base/base-agent.js.map +1 -0
- package/dist/agents/docs-search/index.d.ts +33 -0
- package/dist/agents/docs-search/index.d.ts.map +1 -0
- package/dist/agents/docs-search/index.js +244 -0
- package/dist/agents/docs-search/index.js.map +1 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/planner/index.d.ts +17 -0
- package/dist/agents/planner/index.d.ts.map +1 -0
- package/dist/agents/planner/index.js +250 -0
- package/dist/agents/planner/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +144 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/compact/compact-manager.d.ts +22 -0
- package/dist/core/compact/compact-manager.d.ts.map +1 -0
- package/dist/core/compact/compact-manager.js +75 -0
- package/dist/core/compact/compact-manager.js.map +1 -0
- package/dist/core/compact/compact-prompts.d.ts +11 -0
- package/dist/core/compact/compact-prompts.d.ts.map +1 -0
- package/dist/core/compact/compact-prompts.js +90 -0
- package/dist/core/compact/compact-prompts.js.map +1 -0
- package/dist/core/compact/context-tracker.d.ts +28 -0
- package/dist/core/compact/context-tracker.d.ts.map +1 -0
- package/dist/core/compact/context-tracker.js +71 -0
- package/dist/core/compact/context-tracker.js.map +1 -0
- package/dist/core/compact/index.d.ts +4 -0
- package/dist/core/compact/index.d.ts.map +1 -0
- package/dist/core/compact/index.js +4 -0
- package/dist/core/compact/index.js.map +1 -0
- package/dist/core/config/config-manager.d.ts +44 -0
- package/dist/core/config/config-manager.d.ts.map +1 -0
- package/dist/core/config/config-manager.js +259 -0
- package/dist/core/config/config-manager.js.map +1 -0
- package/dist/core/config/index.d.ts +2 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +2 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/docs-manager.d.ts +46 -0
- package/dist/core/docs-manager.d.ts.map +1 -0
- package/dist/core/docs-manager.js +475 -0
- package/dist/core/docs-manager.js.map +1 -0
- package/dist/core/git-auto-updater.d.ts +58 -0
- package/dist/core/git-auto-updater.d.ts.map +1 -0
- package/dist/core/git-auto-updater.js +374 -0
- package/dist/core/git-auto-updater.js.map +1 -0
- package/dist/core/llm/index.d.ts +2 -0
- package/dist/core/llm/index.d.ts.map +1 -0
- package/dist/core/llm/index.js +2 -0
- package/dist/core/llm/index.js.map +1 -0
- package/dist/core/llm/llm-client.d.ts +97 -0
- package/dist/core/llm/llm-client.d.ts.map +1 -0
- package/dist/core/llm/llm-client.js +1000 -0
- package/dist/core/llm/llm-client.js.map +1 -0
- package/dist/core/session/index.d.ts +2 -0
- package/dist/core/session/index.d.ts.map +1 -0
- package/dist/core/session/index.js +2 -0
- package/dist/core/session/index.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +71 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +250 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/slash-command-handler.d.ts +31 -0
- package/dist/core/slash-command-handler.d.ts.map +1 -0
- package/dist/core/slash-command-handler.js +302 -0
- package/dist/core/slash-command-handler.js.map +1 -0
- package/dist/core/usage-tracker.d.ts +70 -0
- package/dist/core/usage-tracker.d.ts.map +1 -0
- package/dist/core/usage-tracker.js +251 -0
- package/dist/core/usage-tracker.js.map +1 -0
- package/dist/errors/base.d.ts +22 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +43 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/file.d.ts +31 -0
- package/dist/errors/file.d.ts.map +1 -0
- package/dist/errors/file.js +110 -0
- package/dist/errors/file.js.map +1 -0
- package/dist/errors/index.d.ts +10 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +41 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/llm.d.ts +26 -0
- package/dist/errors/llm.d.ts.map +1 -0
- package/dist/errors/llm.js +86 -0
- package/dist/errors/llm.js.map +1 -0
- package/dist/errors/network.d.ts +19 -0
- package/dist/errors/network.d.ts.map +1 -0
- package/dist/errors/network.js +82 -0
- package/dist/errors/network.js.map +1 -0
- package/dist/errors/validation.d.ts +19 -0
- package/dist/errors/validation.d.ts.map +1 -0
- package/dist/errors/validation.js +62 -0
- package/dist/errors/validation.js.map +1 -0
- package/dist/eval/eval-runner.d.ts +24 -0
- package/dist/eval/eval-runner.d.ts.map +1 -0
- package/dist/eval/eval-runner.js +309 -0
- package/dist/eval/eval-runner.js.map +1 -0
- package/dist/eval/index.d.ts +3 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +3 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/types.d.ts +77 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +4 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +3 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/plan-executor.d.ts +28 -0
- package/dist/orchestration/plan-executor.d.ts.map +1 -0
- package/dist/orchestration/plan-executor.js +382 -0
- package/dist/orchestration/plan-executor.js.map +1 -0
- package/dist/orchestration/types.d.ts +66 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +2 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/orchestration/utils.d.ts +13 -0
- package/dist/orchestration/utils.d.ts.map +1 -0
- package/dist/orchestration/utils.js +78 -0
- package/dist/orchestration/utils.js.map +1 -0
- package/dist/orquesta/connection.d.ts +35 -0
- package/dist/orquesta/connection.d.ts.map +1 -0
- package/dist/orquesta/connection.js +189 -0
- package/dist/orquesta/connection.js.map +1 -0
- package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
- package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
- package/dist/prompts/agents/docs-search-decision.js +46 -0
- package/dist/prompts/agents/docs-search-decision.js.map +1 -0
- package/dist/prompts/agents/docs-search.d.ts +4 -0
- package/dist/prompts/agents/docs-search.d.ts.map +1 -0
- package/dist/prompts/agents/docs-search.js +70 -0
- package/dist/prompts/agents/docs-search.js.map +1 -0
- package/dist/prompts/agents/planning.d.ts +4 -0
- package/dist/prompts/agents/planning.d.ts.map +1 -0
- package/dist/prompts/agents/planning.js +119 -0
- package/dist/prompts/agents/planning.js.map +1 -0
- package/dist/prompts/index.d.ts +10 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +10 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/shared/codebase-rules.d.ts +4 -0
- package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
- package/dist/prompts/shared/codebase-rules.js +16 -0
- package/dist/prompts/shared/codebase-rules.js.map +1 -0
- package/dist/prompts/shared/git-rules.d.ts +2 -0
- package/dist/prompts/shared/git-rules.d.ts.map +1 -0
- package/dist/prompts/shared/git-rules.js +87 -0
- package/dist/prompts/shared/git-rules.js.map +1 -0
- package/dist/prompts/shared/language-rules.d.ts +4 -0
- package/dist/prompts/shared/language-rules.d.ts.map +1 -0
- package/dist/prompts/shared/language-rules.js +22 -0
- package/dist/prompts/shared/language-rules.js.map +1 -0
- package/dist/prompts/shared/tool-usage.d.ts +12 -0
- package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
- package/dist/prompts/shared/tool-usage.js +51 -0
- package/dist/prompts/shared/tool-usage.js.map +1 -0
- package/dist/prompts/system/compact.d.ts +3 -0
- package/dist/prompts/system/compact.d.ts.map +1 -0
- package/dist/prompts/system/compact.js +73 -0
- package/dist/prompts/system/compact.js.map +1 -0
- package/dist/prompts/system/plan-execute.d.ts +3 -0
- package/dist/prompts/system/plan-execute.d.ts.map +1 -0
- package/dist/prompts/system/plan-execute.js +83 -0
- package/dist/prompts/system/plan-execute.js.map +1 -0
- package/dist/tools/browser/browser-client.d.ts +107 -0
- package/dist/tools/browser/browser-client.d.ts.map +1 -0
- package/dist/tools/browser/browser-client.js +958 -0
- package/dist/tools/browser/browser-client.js.map +1 -0
- package/dist/tools/browser/browser-tools.d.ts +17 -0
- package/dist/tools/browser/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser/browser-tools.js +972 -0
- package/dist/tools/browser/browser-tools.js.map +1 -0
- package/dist/tools/browser/index.d.ts +7 -0
- package/dist/tools/browser/index.d.ts.map +1 -0
- package/dist/tools/browser/index.js +17 -0
- package/dist/tools/browser/index.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
- package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
- package/dist/tools/llm/agents/docs-search-tools.js +265 -0
- package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
- package/dist/tools/llm/agents/index.d.ts +4 -0
- package/dist/tools/llm/agents/index.d.ts.map +1 -0
- package/dist/tools/llm/agents/index.js +3 -0
- package/dist/tools/llm/agents/index.js.map +1 -0
- package/dist/tools/llm/index.d.ts +3 -0
- package/dist/tools/llm/index.d.ts.map +1 -0
- package/dist/tools/llm/index.js +3 -0
- package/dist/tools/llm/index.js.map +1 -0
- package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
- package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/ask-user-tool.js +7 -0
- package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
- package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
- package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/background-bash-tool.js +323 -0
- package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
- package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
- package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/background-powershell-tool.js +305 -0
- package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
- package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
- package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/bash-tool.js +178 -0
- package/dist/tools/llm/simple/bash-tool.js.map +1 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
- package/dist/tools/llm/simple/file-tools.d.ts +13 -0
- package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/file-tools.js +785 -0
- package/dist/tools/llm/simple/file-tools.js.map +1 -0
- package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
- package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/final-response-tool.js +107 -0
- package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
- package/dist/tools/llm/simple/index.d.ts +11 -0
- package/dist/tools/llm/simple/index.d.ts.map +1 -0
- package/dist/tools/llm/simple/index.js +20 -0
- package/dist/tools/llm/simple/index.js.map +1 -0
- package/dist/tools/llm/simple/planning-tools.d.ts +5 -0
- package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/planning-tools.js +117 -0
- package/dist/tools/llm/simple/planning-tools.js.map +1 -0
- package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
- package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/powershell-tool.js +178 -0
- package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
- package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
- package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
- package/dist/tools/llm/simple/simple-tool-executor.js +134 -0
- package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
- package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
- package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/todo-tools.js +145 -0
- package/dist/tools/llm/simple/todo-tools.js.map +1 -0
- package/dist/tools/llm/simple/user-interaction-tools.d.ts +22 -0
- package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/user-interaction-tools.js +168 -0
- package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
- package/dist/tools/office/common/constants.d.ts +194 -0
- package/dist/tools/office/common/constants.d.ts.map +1 -0
- package/dist/tools/office/common/constants.js +169 -0
- package/dist/tools/office/common/constants.js.map +1 -0
- package/dist/tools/office/common/index.d.ts +4 -0
- package/dist/tools/office/common/index.d.ts.map +1 -0
- package/dist/tools/office/common/index.js +3 -0
- package/dist/tools/office/common/index.js.map +1 -0
- package/dist/tools/office/common/types.d.ts +82 -0
- package/dist/tools/office/common/types.d.ts.map +1 -0
- package/dist/tools/office/common/types.js +2 -0
- package/dist/tools/office/common/types.js.map +1 -0
- package/dist/tools/office/common/utils.d.ts +14 -0
- package/dist/tools/office/common/utils.d.ts.map +1 -0
- package/dist/tools/office/common/utils.js +58 -0
- package/dist/tools/office/common/utils.js.map +1 -0
- package/dist/tools/office/excel-client.d.ts +123 -0
- package/dist/tools/office/excel-client.d.ts.map +1 -0
- package/dist/tools/office/excel-client.js +1037 -0
- package/dist/tools/office/excel-client.js.map +1 -0
- package/dist/tools/office/excel-tools/cells.d.ts +10 -0
- package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/cells.js +279 -0
- package/dist/tools/office/excel-tools/cells.js.map +1 -0
- package/dist/tools/office/excel-tools/charts.d.ts +6 -0
- package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/charts.js +124 -0
- package/dist/tools/office/excel-tools/charts.js.map +1 -0
- package/dist/tools/office/excel-tools/comments.d.ts +6 -0
- package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/comments.js +114 -0
- package/dist/tools/office/excel-tools/comments.js.map +1 -0
- package/dist/tools/office/excel-tools/data-ops.d.ts +10 -0
- package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/data-ops.js +266 -0
- package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
- package/dist/tools/office/excel-tools/export.d.ts +5 -0
- package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/export.js +75 -0
- package/dist/tools/office/excel-tools/export.js.map +1 -0
- package/dist/tools/office/excel-tools/formatting.d.ts +10 -0
- package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/formatting.js +276 -0
- package/dist/tools/office/excel-tools/formatting.js.map +1 -0
- package/dist/tools/office/excel-tools/index.d.ts +16 -0
- package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/index.js +42 -0
- package/dist/tools/office/excel-tools/index.js.map +1 -0
- package/dist/tools/office/excel-tools/launch.d.ts +10 -0
- package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/launch.js +248 -0
- package/dist/tools/office/excel-tools/launch.js.map +1 -0
- package/dist/tools/office/excel-tools/media.d.ts +5 -0
- package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/media.js +84 -0
- package/dist/tools/office/excel-tools/media.js.map +1 -0
- package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
- package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/named-ranges.js +113 -0
- package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
- package/dist/tools/office/excel-tools/protection.d.ts +5 -0
- package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/protection.js +75 -0
- package/dist/tools/office/excel-tools/protection.js.map +1 -0
- package/dist/tools/office/excel-tools/rows-columns.d.ts +11 -0
- package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/rows-columns.js +293 -0
- package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
- package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
- package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/sheets.js +177 -0
- package/dist/tools/office/excel-tools/sheets.js.map +1 -0
- package/dist/tools/office/excel-tools/validation.d.ts +7 -0
- package/dist/tools/office/excel-tools/validation.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/validation.js +175 -0
- package/dist/tools/office/excel-tools/validation.js.map +1 -0
- package/dist/tools/office/excel-tools.d.ts +3 -0
- package/dist/tools/office/excel-tools.d.ts.map +1 -0
- package/dist/tools/office/excel-tools.js +3 -0
- package/dist/tools/office/excel-tools.js.map +1 -0
- package/dist/tools/office/index.d.ts +6 -0
- package/dist/tools/office/index.d.ts.map +1 -0
- package/dist/tools/office/index.js +9 -0
- package/dist/tools/office/index.js.map +1 -0
- package/dist/tools/office/office-client-base.d.ts +31 -0
- package/dist/tools/office/office-client-base.d.ts.map +1 -0
- package/dist/tools/office/office-client-base.js +154 -0
- package/dist/tools/office/office-client-base.js.map +1 -0
- package/dist/tools/office/office-client.d.ts +196 -0
- package/dist/tools/office/office-client.d.ts.map +1 -0
- package/dist/tools/office/office-client.js +200 -0
- package/dist/tools/office/office-client.js.map +1 -0
- package/dist/tools/office/powerpoint-client.d.ts +135 -0
- package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-client.js +1136 -0
- package/dist/tools/office/powerpoint-client.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/effects.d.ts +9 -0
- package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/effects.js +246 -0
- package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/export.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/export.js +108 -0
- package/dist/tools/office/powerpoint-tools/export.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/index.d.ts +13 -0
- package/dist/tools/office/powerpoint-tools/index.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/index.js +33 -0
- package/dist/tools/office/powerpoint-tools/index.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/launch.d.ts +9 -0
- package/dist/tools/office/powerpoint-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/launch.js +214 -0
- package/dist/tools/office/powerpoint-tools/launch.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/media.d.ts +8 -0
- package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/media.js +211 -0
- package/dist/tools/office/powerpoint-tools/media.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/notes.d.ts +8 -0
- package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/notes.js +171 -0
- package/dist/tools/office/powerpoint-tools/notes.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/sections.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/sections.js +104 -0
- package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/shapes.d.ts +22 -0
- package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/shapes.js +681 -0
- package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/slides.d.ts +11 -0
- package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/slides.js +283 -0
- package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/tables.js +132 -0
- package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/text.d.ts +12 -0
- package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/text.js +366 -0
- package/dist/tools/office/powerpoint-tools/text.js.map +1 -0
- package/dist/tools/office/powerpoint-tools.d.ts +3 -0
- package/dist/tools/office/powerpoint-tools.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools.js +3 -0
- package/dist/tools/office/powerpoint-tools.js.map +1 -0
- package/dist/tools/office/word-client.d.ts +147 -0
- package/dist/tools/office/word-client.d.ts.map +1 -0
- package/dist/tools/office/word-client.js +1341 -0
- package/dist/tools/office/word-client.js.map +1 -0
- package/dist/tools/office/word-tools/bookmarks.d.ts +7 -0
- package/dist/tools/office/word-tools/bookmarks.d.ts.map +1 -0
- package/dist/tools/office/word-tools/bookmarks.js +146 -0
- package/dist/tools/office/word-tools/bookmarks.js.map +1 -0
- package/dist/tools/office/word-tools/comments.d.ts +7 -0
- package/dist/tools/office/word-tools/comments.d.ts.map +1 -0
- package/dist/tools/office/word-tools/comments.js +146 -0
- package/dist/tools/office/word-tools/comments.js.map +1 -0
- package/dist/tools/office/word-tools/content.d.ts +7 -0
- package/dist/tools/office/word-tools/content.d.ts.map +1 -0
- package/dist/tools/office/word-tools/content.js +168 -0
- package/dist/tools/office/word-tools/content.js.map +1 -0
- package/dist/tools/office/word-tools/export.d.ts +5 -0
- package/dist/tools/office/word-tools/export.d.ts.map +1 -0
- package/dist/tools/office/word-tools/export.js +73 -0
- package/dist/tools/office/word-tools/export.js.map +1 -0
- package/dist/tools/office/word-tools/formatting.d.ts +6 -0
- package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
- package/dist/tools/office/word-tools/formatting.js +129 -0
- package/dist/tools/office/word-tools/formatting.js.map +1 -0
- package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
- package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
- package/dist/tools/office/word-tools/headers-footers.js +117 -0
- package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
- package/dist/tools/office/word-tools/index.d.ts +16 -0
- package/dist/tools/office/word-tools/index.d.ts.map +1 -0
- package/dist/tools/office/word-tools/index.js +45 -0
- package/dist/tools/office/word-tools/index.js.map +1 -0
- package/dist/tools/office/word-tools/launch.d.ts +10 -0
- package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/word-tools/launch.js +255 -0
- package/dist/tools/office/word-tools/launch.js.map +1 -0
- package/dist/tools/office/word-tools/lists.d.ts +5 -0
- package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
- package/dist/tools/office/word-tools/lists.js +73 -0
- package/dist/tools/office/word-tools/lists.js.map +1 -0
- package/dist/tools/office/word-tools/navigation.d.ts +5 -0
- package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
- package/dist/tools/office/word-tools/navigation.js +85 -0
- package/dist/tools/office/word-tools/navigation.js.map +1 -0
- package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
- package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
- package/dist/tools/office/word-tools/page-setup.js +152 -0
- package/dist/tools/office/word-tools/page-setup.js.map +1 -0
- package/dist/tools/office/word-tools/tables.d.ts +8 -0
- package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
- package/dist/tools/office/word-tools/tables.js +197 -0
- package/dist/tools/office/word-tools/tables.js.map +1 -0
- package/dist/tools/office/word-tools/text.d.ts +9 -0
- package/dist/tools/office/word-tools/text.d.ts.map +1 -0
- package/dist/tools/office/word-tools/text.js +235 -0
- package/dist/tools/office/word-tools/text.js.map +1 -0
- package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
- package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
- package/dist/tools/office/word-tools/undo-redo.js +73 -0
- package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
- package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
- package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
- package/dist/tools/office/word-tools/watermarks.js +81 -0
- package/dist/tools/office/word-tools/watermarks.js.map +1 -0
- package/dist/tools/office/word-tools.d.ts +3 -0
- package/dist/tools/office/word-tools.d.ts.map +1 -0
- package/dist/tools/office/word-tools.js +3 -0
- package/dist/tools/office/word-tools.js.map +1 -0
- package/dist/tools/registry.d.ts +53 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +278 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +88 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +19 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/index.d.ts +126 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/PlanExecuteView.d.ts +11 -0
- package/dist/ui/PlanExecuteView.d.ts.map +1 -0
- package/dist/ui/PlanExecuteView.js +29 -0
- package/dist/ui/PlanExecuteView.js.map +1 -0
- package/dist/ui/TodoPanel.d.ts +13 -0
- package/dist/ui/TodoPanel.d.ts.map +1 -0
- package/dist/ui/TodoPanel.js +135 -0
- package/dist/ui/TodoPanel.js.map +1 -0
- package/dist/ui/UpdateNotification.d.ts +13 -0
- package/dist/ui/UpdateNotification.d.ts.map +1 -0
- package/dist/ui/UpdateNotification.js +42 -0
- package/dist/ui/UpdateNotification.js.map +1 -0
- package/dist/ui/components/ActivityIndicator.d.ts +25 -0
- package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/ui/components/ActivityIndicator.js +115 -0
- package/dist/ui/components/ActivityIndicator.js.map +1 -0
- package/dist/ui/components/CommandBrowser.d.ts +10 -0
- package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
- package/dist/ui/components/CommandBrowser.js +53 -0
- package/dist/ui/components/CommandBrowser.js.map +1 -0
- package/dist/ui/components/CustomTextInput.d.ts +13 -0
- package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
- package/dist/ui/components/CustomTextInput.js +245 -0
- package/dist/ui/components/CustomTextInput.js.map +1 -0
- package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
- package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
- package/dist/ui/components/DocsSearchProgress.js +37 -0
- package/dist/ui/components/DocsSearchProgress.js.map +1 -0
- package/dist/ui/components/FileBrowser.d.ts +11 -0
- package/dist/ui/components/FileBrowser.d.ts.map +1 -0
- package/dist/ui/components/FileBrowser.js +45 -0
- package/dist/ui/components/FileBrowser.js.map +1 -0
- package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
- package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
- package/dist/ui/components/LLMSetupWizard.js +192 -0
- package/dist/ui/components/LLMSetupWizard.js.map +1 -0
- package/dist/ui/components/Logo.d.ts +19 -0
- package/dist/ui/components/Logo.d.ts.map +1 -0
- package/dist/ui/components/Logo.js +55 -0
- package/dist/ui/components/Logo.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +198 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/ModelSelector.d.ts +8 -0
- package/dist/ui/components/ModelSelector.d.ts.map +1 -0
- package/dist/ui/components/ModelSelector.js +111 -0
- package/dist/ui/components/ModelSelector.js.map +1 -0
- package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
- package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
- package/dist/ui/components/PlanExecuteApp.js +1324 -0
- package/dist/ui/components/PlanExecuteApp.js.map +1 -0
- package/dist/ui/components/ProgressBar.d.ts +10 -0
- package/dist/ui/components/ProgressBar.d.ts.map +1 -0
- package/dist/ui/components/ProgressBar.js +26 -0
- package/dist/ui/components/ProgressBar.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +23 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +162 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
- package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
- package/dist/ui/components/ThinkingIndicator.js +63 -0
- package/dist/ui/components/ThinkingIndicator.js.map +1 -0
- package/dist/ui/components/TodoListView.d.ts +11 -0
- package/dist/ui/components/TodoListView.d.ts.map +1 -0
- package/dist/ui/components/TodoListView.js +69 -0
- package/dist/ui/components/TodoListView.js.map +1 -0
- package/dist/ui/components/ToolSelector.d.ts +7 -0
- package/dist/ui/components/ToolSelector.d.ts.map +1 -0
- package/dist/ui/components/ToolSelector.js +111 -0
- package/dist/ui/components/ToolSelector.js.map +1 -0
- package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
- package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
- package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
- package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
- package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
- package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
- package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
- package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
- package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
- package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
- package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
- package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
- package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
- package/dist/ui/components/dialogs/index.d.ts +4 -0
- package/dist/ui/components/dialogs/index.d.ts.map +1 -0
- package/dist/ui/components/dialogs/index.js +4 -0
- package/dist/ui/components/dialogs/index.js.map +1 -0
- package/dist/ui/components/index.d.ts +12 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +9 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/panels/LogPanel.d.ts +7 -0
- package/dist/ui/components/panels/LogPanel.d.ts.map +1 -0
- package/dist/ui/components/panels/LogPanel.js +280 -0
- package/dist/ui/components/panels/LogPanel.js.map +1 -0
- package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
- package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
- package/dist/ui/components/panels/SessionPanel.js +81 -0
- package/dist/ui/components/panels/SessionPanel.js.map +1 -0
- package/dist/ui/components/panels/index.d.ts +4 -0
- package/dist/ui/components/panels/index.d.ts.map +1 -0
- package/dist/ui/components/panels/index.js +4 -0
- package/dist/ui/components/panels/index.js.map +1 -0
- package/dist/ui/components/views/ChatView.d.ts +12 -0
- package/dist/ui/components/views/ChatView.d.ts.map +1 -0
- package/dist/ui/components/views/ChatView.js +289 -0
- package/dist/ui/components/views/ChatView.js.map +1 -0
- package/dist/ui/components/views/index.d.ts +2 -0
- package/dist/ui/components/views/index.d.ts.map +1 -0
- package/dist/ui/components/views/index.js +2 -0
- package/dist/ui/components/views/index.js.map +1 -0
- package/dist/ui/contexts/TokenContext.d.ts +29 -0
- package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
- package/dist/ui/contexts/TokenContext.js +79 -0
- package/dist/ui/contexts/TokenContext.js.map +1 -0
- package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
- package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
- package/dist/ui/hooks/atFileProcessor.js +88 -0
- package/dist/ui/hooks/atFileProcessor.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +8 -0
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +8 -0
- package/dist/ui/hooks/index.js.map +1 -0
- package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
- package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
- package/dist/ui/hooks/slashCommandProcessor.js +100 -0
- package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
- package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
- package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
- package/dist/ui/hooks/useCommandBrowserState.js +66 -0
- package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
- package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
- package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
- package/dist/ui/hooks/useFileBrowserState.js +80 -0
- package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
- package/dist/ui/hooks/useFileList.d.ts +20 -0
- package/dist/ui/hooks/useFileList.d.ts.map +1 -0
- package/dist/ui/hooks/useFileList.js +57 -0
- package/dist/ui/hooks/useFileList.js.map +1 -0
- package/dist/ui/hooks/useInputHistory.d.ts +9 -0
- package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
- package/dist/ui/hooks/useInputHistory.js +68 -0
- package/dist/ui/hooks/useInputHistory.js.map +1 -0
- package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
- package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
- package/dist/ui/hooks/usePlanExecution.js +214 -0
- package/dist/ui/hooks/usePlanExecution.js.map +1 -0
- package/dist/ui/index.d.ts +7 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +7 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/ink-entry.d.ts +3 -0
- package/dist/ui/ink-entry.d.ts.map +1 -0
- package/dist/ui/ink-entry.js +22 -0
- package/dist/ui/ink-entry.js.map +1 -0
- package/dist/utils/env-filter.d.ts +4 -0
- package/dist/utils/env-filter.d.ts.map +1 -0
- package/dist/utils/env-filter.js +101 -0
- package/dist/utils/env-filter.js.map +1 -0
- package/dist/utils/file-system.d.ts +9 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +99 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/git-utils.d.ts +2 -0
- package/dist/utils/git-utils.d.ts.map +1 -0
- package/dist/utils/git-utils.js +16 -0
- package/dist/utils/git-utils.js.map +1 -0
- package/dist/utils/json-stream-logger.d.ts +74 -0
- package/dist/utils/json-stream-logger.d.ts.map +1 -0
- package/dist/utils/json-stream-logger.js +808 -0
- package/dist/utils/json-stream-logger.js.map +1 -0
- package/dist/utils/logger.d.ts +152 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +1672 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform-utils.d.ts +19 -0
- package/dist/utils/platform-utils.d.ts.map +1 -0
- package/dist/utils/platform-utils.js +134 -0
- package/dist/utils/platform-utils.js.map +1 -0
- package/dist/utils/wsl-utils.d.ts +4 -0
- package/dist/utils/wsl-utils.d.ts.map +1 -0
- package/dist/utils/wsl-utils.js +72 -0
- package/dist/utils/wsl-utils.js.map +1 -0
- package/electron.vite.config.ts +63 -0
- package/google374b9eba0c52b043.html +1 -0
- package/package.json +122 -0
- package/src/agents/base/base-agent.ts +159 -0
- package/src/agents/docs-search/index.ts +365 -0
- package/src/agents/index.ts +34 -0
- package/src/agents/planner/index.ts +544 -0
- package/src/cli.ts +201 -0
- package/src/constants.ts +47 -0
- package/src/core/compact/compact-manager.ts +160 -0
- package/src/core/compact/compact-prompts.ts +150 -0
- package/src/core/compact/context-tracker.ts +164 -0
- package/src/core/compact/index.ts +25 -0
- package/src/core/config/config-manager.ts +460 -0
- package/src/core/config/index.ts +5 -0
- package/src/core/docs-manager.ts +678 -0
- package/src/core/llm/index.ts +7 -0
- package/src/core/llm/llm-client.ts +1550 -0
- package/src/core/session/index.ts +5 -0
- package/src/core/session/session-manager.ts +464 -0
- package/src/core/slash-command-handler.ts +410 -0
- package/src/core/usage-tracker.ts +438 -0
- package/src/errors/base.ts +81 -0
- package/src/errors/file.ts +183 -0
- package/src/errors/index.ts +95 -0
- package/src/errors/llm.ts +151 -0
- package/src/errors/network.ts +124 -0
- package/src/errors/validation.ts +111 -0
- package/src/eval/eval-runner.ts +456 -0
- package/src/eval/index.ts +8 -0
- package/src/eval/types.ts +139 -0
- package/src/index.ts +22 -0
- package/src/orchestration/index.ts +30 -0
- package/src/orchestration/plan-executor.ts +652 -0
- package/src/orchestration/types.ts +127 -0
- package/src/orchestration/utils.ts +119 -0
- package/src/orquesta/connection.ts +291 -0
- package/src/prompts/agents/docs-search-decision.ts +74 -0
- package/src/prompts/agents/docs-search.ts +84 -0
- package/src/prompts/agents/planning.ts +143 -0
- package/src/prompts/index.ts +31 -0
- package/src/prompts/shared/codebase-rules.ts +29 -0
- package/src/prompts/shared/git-rules.ts +94 -0
- package/src/prompts/shared/language-rules.ts +36 -0
- package/src/prompts/shared/tool-usage.ts +72 -0
- package/src/prompts/system/compact.ts +80 -0
- package/src/prompts/system/plan-execute.ts +89 -0
- package/src/tools/browser/browser-client.ts +1363 -0
- package/src/tools/browser/browser-tools.ts +1139 -0
- package/src/tools/browser/index.ts +65 -0
- package/src/tools/index.ts +23 -0
- package/src/tools/llm/agents/docs-search-tools.ts +368 -0
- package/src/tools/llm/agents/index.ts +22 -0
- package/src/tools/llm/index.ts +11 -0
- package/src/tools/llm/simple/ask-user-tool.ts +25 -0
- package/src/tools/llm/simple/background-bash-tool.ts +443 -0
- package/src/tools/llm/simple/background-powershell-tool.ts +421 -0
- package/src/tools/llm/simple/bash-tool.ts +238 -0
- package/src/tools/llm/simple/docs-search-agent-tool.ts +146 -0
- package/src/tools/llm/simple/file-tools.ts +1051 -0
- package/src/tools/llm/simple/final-response-tool.ts +180 -0
- package/src/tools/llm/simple/index.ts +42 -0
- package/src/tools/llm/simple/planning-tools.ts +143 -0
- package/src/tools/llm/simple/powershell-tool.ts +241 -0
- package/src/tools/llm/simple/simple-tool-executor.ts +279 -0
- package/src/tools/llm/simple/todo-tools.ts +207 -0
- package/src/tools/llm/simple/user-interaction-tools.ts +277 -0
- package/src/tools/office/common/constants.ts +335 -0
- package/src/tools/office/common/index.ts +133 -0
- package/src/tools/office/common/types.ts +286 -0
- package/src/tools/office/common/utils.ts +116 -0
- package/src/tools/office/excel-client.ts +1336 -0
- package/src/tools/office/excel-tools/cells.ts +359 -0
- package/src/tools/office/excel-tools/charts.ts +166 -0
- package/src/tools/office/excel-tools/comments.ts +155 -0
- package/src/tools/office/excel-tools/data-ops.ts +349 -0
- package/src/tools/office/excel-tools/export.ts +105 -0
- package/src/tools/office/excel-tools/formatting.ts +357 -0
- package/src/tools/office/excel-tools/index.ts +55 -0
- package/src/tools/office/excel-tools/launch.ts +303 -0
- package/src/tools/office/excel-tools/media.ts +117 -0
- package/src/tools/office/excel-tools/named-ranges.ts +148 -0
- package/src/tools/office/excel-tools/protection.ts +105 -0
- package/src/tools/office/excel-tools/rows-columns.ts +386 -0
- package/src/tools/office/excel-tools/sheets.ts +228 -0
- package/src/tools/office/excel-tools/validation.ts +226 -0
- package/src/tools/office/excel-tools.ts +9 -0
- package/src/tools/office/index.ts +259 -0
- package/src/tools/office/office-client-base.ts +242 -0
- package/src/tools/office/office-client.ts +377 -0
- package/src/tools/office/powerpoint-client.ts +1498 -0
- package/src/tools/office/powerpoint-tools/effects.ts +315 -0
- package/src/tools/office/powerpoint-tools/export.ts +138 -0
- package/src/tools/office/powerpoint-tools/index.ts +45 -0
- package/src/tools/office/powerpoint-tools/launch.ts +263 -0
- package/src/tools/office/powerpoint-tools/media.ts +291 -0
- package/src/tools/office/powerpoint-tools/notes.ts +220 -0
- package/src/tools/office/powerpoint-tools/sections.ts +140 -0
- package/src/tools/office/powerpoint-tools/shapes.ts +870 -0
- package/src/tools/office/powerpoint-tools/slides.ts +350 -0
- package/src/tools/office/powerpoint-tools/tables.ts +182 -0
- package/src/tools/office/powerpoint-tools/text.ts +473 -0
- package/src/tools/office/powerpoint-tools.ts +9 -0
- package/src/tools/office/word-client.ts +1697 -0
- package/src/tools/office/word-tools/bookmarks.ts +186 -0
- package/src/tools/office/word-tools/comments.ts +185 -0
- package/src/tools/office/word-tools/content.ts +229 -0
- package/src/tools/office/word-tools/export.ts +97 -0
- package/src/tools/office/word-tools/formatting.ts +161 -0
- package/src/tools/office/word-tools/headers-footers.ts +155 -0
- package/src/tools/office/word-tools/index.ts +57 -0
- package/src/tools/office/word-tools/launch.ts +312 -0
- package/src/tools/office/word-tools/lists.ts +97 -0
- package/src/tools/office/word-tools/navigation.ts +114 -0
- package/src/tools/office/word-tools/page-setup.ts +195 -0
- package/src/tools/office/word-tools/tables.ts +262 -0
- package/src/tools/office/word-tools/text.ts +294 -0
- package/src/tools/office/word-tools/undo-redo.ts +97 -0
- package/src/tools/office/word-tools/watermarks.ts +105 -0
- package/src/tools/office/word-tools.ts +9 -0
- package/src/tools/registry.ts +527 -0
- package/src/tools/types.ts +231 -0
- package/src/types/index.ts +181 -0
- package/src/ui/PlanExecuteView.tsx +119 -0
- package/src/ui/TodoPanel.tsx +240 -0
- package/src/ui/UpdateNotification.tsx +105 -0
- package/src/ui/components/ActivityIndicator.tsx +234 -0
- package/src/ui/components/CommandBrowser.tsx +114 -0
- package/src/ui/components/CustomTextInput.tsx +389 -0
- package/src/ui/components/DocsSearchProgress.tsx +85 -0
- package/src/ui/components/FileBrowser.tsx +93 -0
- package/src/ui/components/LLMSetupWizard.tsx +333 -0
- package/src/ui/components/Logo.tsx +125 -0
- package/src/ui/components/MarkdownRenderer.tsx +358 -0
- package/src/ui/components/ModelSelector.tsx +203 -0
- package/src/ui/components/PlanExecuteApp.tsx +2007 -0
- package/src/ui/components/ProgressBar.tsx +51 -0
- package/src/ui/components/StatusBar.tsx +302 -0
- package/src/ui/components/ThinkingIndicator.tsx +120 -0
- package/src/ui/components/TodoListView.tsx +140 -0
- package/src/ui/components/ToolSelector.tsx +215 -0
- package/src/ui/components/dialogs/ApprovalDialog.tsx +259 -0
- package/src/ui/components/dialogs/AskUserDialog.tsx +159 -0
- package/src/ui/components/dialogs/DocsBrowser.tsx +222 -0
- package/src/ui/components/dialogs/SettingsDialog.tsx +939 -0
- package/src/ui/components/dialogs/index.ts +13 -0
- package/src/ui/components/index.ts +27 -0
- package/src/ui/components/panels/LogPanel.tsx +385 -0
- package/src/ui/components/panels/SessionPanel.tsx +146 -0
- package/src/ui/components/panels/index.ts +13 -0
- package/src/ui/components/views/ChatView.tsx +447 -0
- package/src/ui/components/views/index.ts +5 -0
- package/src/ui/contexts/TokenContext.tsx +139 -0
- package/src/ui/hooks/atFileProcessor.ts +167 -0
- package/src/ui/hooks/index.ts +11 -0
- package/src/ui/hooks/slashCommandProcessor.ts +174 -0
- package/src/ui/hooks/useCommandBrowserState.ts +97 -0
- package/src/ui/hooks/useFileBrowserState.ts +116 -0
- package/src/ui/hooks/useFileList.ts +132 -0
- package/src/ui/hooks/useInputHistory.ts +89 -0
- package/src/ui/hooks/usePlanExecution.ts +339 -0
- package/src/ui/index.ts +10 -0
- package/src/ui/ink-entry.tsx +36 -0
- package/src/utils/env-filter.ts +164 -0
- package/src/utils/file-system.ts +133 -0
- package/src/utils/git-utils.ts +30 -0
- package/src/utils/json-stream-logger.ts +1259 -0
- package/src/utils/logger.ts +2767 -0
- package/src/utils/platform-utils.ts +256 -0
- package/src/utils/wsl-utils.ts +113 -0
- package/tsconfig.electron.json +39 -0
- package/tsconfig.json +64 -0
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File System Tools (LLM Simple)
|
|
3
|
+
*
|
|
4
|
+
* Tools that allow LLM to interact with the file system
|
|
5
|
+
* Category: LLM Simple Tools - LLM calls via tool_call, no Sub-LLM
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from 'fs/promises';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
import { ToolDefinition } from '../../../types/index.js';
|
|
11
|
+
import { LLMSimpleTool, ToolResult, ToolCategory } from '../../types.js';
|
|
12
|
+
import { logger } from '../../../utils/logger.js';
|
|
13
|
+
|
|
14
|
+
// Safety limits
|
|
15
|
+
const EXCLUDED_DIRS = new Set([
|
|
16
|
+
'node_modules',
|
|
17
|
+
'.git',
|
|
18
|
+
'dist',
|
|
19
|
+
'.next',
|
|
20
|
+
'coverage',
|
|
21
|
+
'.cache',
|
|
22
|
+
'build',
|
|
23
|
+
'__pycache__',
|
|
24
|
+
]);
|
|
25
|
+
const MAX_DEPTH = 5;
|
|
26
|
+
const MAX_FILES = 100;
|
|
27
|
+
|
|
28
|
+
// Read file limits (Claude Code style)
|
|
29
|
+
const DEFAULT_LINE_LIMIT = 2000;
|
|
30
|
+
const MAX_LINE_LIMIT = 10000;
|
|
31
|
+
|
|
32
|
+
// File size limits (security - prevent memory exhaustion)
|
|
33
|
+
const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB max file size
|
|
34
|
+
const MAX_WRITE_SIZE = 50 * 1024 * 1024; // 50MB max write size
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* read_file Tool Definition
|
|
38
|
+
*/
|
|
39
|
+
const READ_FILE_DEFINITION: ToolDefinition = {
|
|
40
|
+
type: 'function',
|
|
41
|
+
function: {
|
|
42
|
+
name: 'read_file',
|
|
43
|
+
description: `Read the contents of a file. Only text files are supported.
|
|
44
|
+
By default, reads up to ${DEFAULT_LINE_LIMIT} lines. Use offset/limit for large files.`,
|
|
45
|
+
parameters: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
reason: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: `A natural, conversational explanation for the user about what you're doing.
|
|
51
|
+
Write as if you're talking to the user directly. Use the same language as the user.
|
|
52
|
+
Examples:
|
|
53
|
+
- "Checking how the current authentication logic is implemented"
|
|
54
|
+
- "Opening the file where the error occurred to find the problem"
|
|
55
|
+
- "Checking package.json to understand the project setup"
|
|
56
|
+
- "Looking at the existing code before making changes"`,
|
|
57
|
+
},
|
|
58
|
+
file_path: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Absolute or relative path of the file to read',
|
|
61
|
+
},
|
|
62
|
+
offset: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
description: 'Starting line number (1-based, default: 1)',
|
|
65
|
+
},
|
|
66
|
+
limit: {
|
|
67
|
+
type: 'number',
|
|
68
|
+
description: `Number of lines to read (default: ${DEFAULT_LINE_LIMIT}, max: ${MAX_LINE_LIMIT})`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['reason', 'file_path'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Internal: Execute read_file
|
|
78
|
+
* Supports offset/limit for reading portions of large files (Claude Code style)
|
|
79
|
+
*/
|
|
80
|
+
async function _executeReadFile(args: Record<string, unknown>): Promise<ToolResult> {
|
|
81
|
+
const filePath = args['file_path'] as string;
|
|
82
|
+
const offset = Math.max(1, (args['offset'] as number) || 1); // 1-based, default 1
|
|
83
|
+
const limit = Math.min(MAX_LINE_LIMIT, Math.max(1, (args['limit'] as number) || DEFAULT_LINE_LIMIT));
|
|
84
|
+
|
|
85
|
+
logger.toolStart('read_file', args);
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
// Remove @ prefix if present
|
|
89
|
+
const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
90
|
+
const resolvedPath = path.resolve(cleanPath);
|
|
91
|
+
const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
92
|
+
|
|
93
|
+
// Check file size before reading (security: prevent memory exhaustion)
|
|
94
|
+
const stats = await fs.stat(resolvedPath);
|
|
95
|
+
if (stats.size > MAX_FILE_SIZE) {
|
|
96
|
+
logger.warn('File too large to read', { path: displayPath, size: stats.size, max: MAX_FILE_SIZE });
|
|
97
|
+
return {
|
|
98
|
+
success: false,
|
|
99
|
+
error: `File too large to read (${(stats.size / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_FILE_SIZE / 1024 / 1024}MB`,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const content = await fs.readFile(resolvedPath, 'utf-8');
|
|
104
|
+
|
|
105
|
+
// Split into lines and apply offset/limit
|
|
106
|
+
const allLines = content.split('\n');
|
|
107
|
+
const totalLines = allLines.length;
|
|
108
|
+
const startIdx = offset - 1; // Convert to 0-based
|
|
109
|
+
const endIdx = Math.min(startIdx + limit, totalLines);
|
|
110
|
+
const selectedLines = allLines.slice(startIdx, endIdx);
|
|
111
|
+
|
|
112
|
+
// Format with line numbers (Claude Code style: " 1→content")
|
|
113
|
+
const formattedLines = selectedLines.map((line, idx) => {
|
|
114
|
+
const lineNum = startIdx + idx + 1;
|
|
115
|
+
const padding = String(totalLines).length;
|
|
116
|
+
return `${String(lineNum).padStart(padding)}→${line}`;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
let result = formattedLines.join('\n');
|
|
120
|
+
|
|
121
|
+
// Add info header if file is larger than what we're showing
|
|
122
|
+
if (totalLines > limit || offset > 1) {
|
|
123
|
+
const header = `[File: ${displayPath} | Lines ${offset}-${endIdx} of ${totalLines}]`;
|
|
124
|
+
const hasMore = endIdx < totalLines;
|
|
125
|
+
const footer = hasMore
|
|
126
|
+
? `\n[... ${totalLines - endIdx} more lines. Use offset=${endIdx + 1} to continue reading]`
|
|
127
|
+
: '';
|
|
128
|
+
result = `${header}\n${result}${footer}`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
logger.toolSuccess('read_file', args, { linesRead: selectedLines.length, totalLines }, 0);
|
|
132
|
+
return {
|
|
133
|
+
success: true,
|
|
134
|
+
result,
|
|
135
|
+
};
|
|
136
|
+
} catch (error) {
|
|
137
|
+
const err = error as NodeJS.ErrnoException;
|
|
138
|
+
const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
139
|
+
|
|
140
|
+
if (err.code === 'ENOENT') {
|
|
141
|
+
logger.toolError('read_file', args, err, 0);
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: `File not found: ${displayPath}`,
|
|
145
|
+
};
|
|
146
|
+
} else if (err.code === 'EACCES') {
|
|
147
|
+
logger.toolError('read_file', args, err, 0);
|
|
148
|
+
return {
|
|
149
|
+
success: false,
|
|
150
|
+
error: `Permission denied reading file: ${displayPath}`,
|
|
151
|
+
};
|
|
152
|
+
} else {
|
|
153
|
+
logger.toolError('read_file', args, err, 0);
|
|
154
|
+
return {
|
|
155
|
+
success: false,
|
|
156
|
+
error: `Failed to read file: ${err.message}`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* read_file LLM Simple Tool
|
|
164
|
+
*/
|
|
165
|
+
export const readFileTool: LLMSimpleTool = {
|
|
166
|
+
definition: READ_FILE_DEFINITION,
|
|
167
|
+
execute: _executeReadFile,
|
|
168
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
169
|
+
description: 'Read file contents',
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* create_file Tool Definition
|
|
174
|
+
* Used for creating NEW files only. Use edit_file for existing files.
|
|
175
|
+
*/
|
|
176
|
+
const CREATE_FILE_DEFINITION: ToolDefinition = {
|
|
177
|
+
type: 'function',
|
|
178
|
+
function: {
|
|
179
|
+
name: 'create_file',
|
|
180
|
+
description: `Create a NEW file with the given content.
|
|
181
|
+
IMPORTANT: Only use this for files that do NOT exist yet.
|
|
182
|
+
For modifying existing files, use edit_file instead.
|
|
183
|
+
If the file already exists, this tool will fail.`,
|
|
184
|
+
parameters: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
reason: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: `A natural, conversational explanation for the user about what you're doing.
|
|
190
|
+
Write as if you're talking to the user directly. Use the same language as the user.
|
|
191
|
+
Examples:
|
|
192
|
+
- "Creating a new file for the authentication service"
|
|
193
|
+
- "Creating a new test config file since one doesn't exist"
|
|
194
|
+
- "Creating a new file to separate the API router"
|
|
195
|
+
- "Adding a new component file"`,
|
|
196
|
+
},
|
|
197
|
+
file_path: {
|
|
198
|
+
type: 'string',
|
|
199
|
+
description: 'Absolute or relative path of the new file to create',
|
|
200
|
+
},
|
|
201
|
+
content: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
description: 'Content to write to the new file',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
required: ['reason', 'file_path', 'content'],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Internal: Execute create_file
|
|
213
|
+
*/
|
|
214
|
+
async function _executeCreateFile(args: Record<string, unknown>): Promise<ToolResult> {
|
|
215
|
+
const filePath = args['file_path'] as string;
|
|
216
|
+
const content = args['content'] as string;
|
|
217
|
+
|
|
218
|
+
logger.toolStart('create_file', { file_path: filePath, contentLength: content?.length || 0 });
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
222
|
+
const resolvedPath = path.resolve(cleanPath);
|
|
223
|
+
const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
224
|
+
|
|
225
|
+
// Check content size (security: prevent excessive writes)
|
|
226
|
+
const contentSize = Buffer.byteLength(content, 'utf-8');
|
|
227
|
+
if (contentSize > MAX_WRITE_SIZE) {
|
|
228
|
+
logger.warn('Content too large to write', { path: displayPath, size: contentSize, max: MAX_WRITE_SIZE });
|
|
229
|
+
return {
|
|
230
|
+
success: false,
|
|
231
|
+
error: `Content too large to write (${(contentSize / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_WRITE_SIZE / 1024 / 1024}MB`,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Check if file already exists
|
|
236
|
+
try {
|
|
237
|
+
await fs.access(resolvedPath);
|
|
238
|
+
logger.toolError('create_file', args, new Error('File already exists'), 0);
|
|
239
|
+
return {
|
|
240
|
+
success: false,
|
|
241
|
+
error: `File already exists: ${displayPath}. Use edit_file to modify existing files.`,
|
|
242
|
+
};
|
|
243
|
+
} catch {
|
|
244
|
+
// File doesn't exist, which is what we want
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Create directory if it doesn't exist
|
|
248
|
+
const dir = path.dirname(resolvedPath);
|
|
249
|
+
await fs.mkdir(dir, { recursive: true });
|
|
250
|
+
|
|
251
|
+
await fs.writeFile(resolvedPath, content, 'utf-8');
|
|
252
|
+
|
|
253
|
+
const lines = content.split('\n').length;
|
|
254
|
+
logger.toolSuccess('create_file', args, { file: displayPath, lines }, 0);
|
|
255
|
+
return {
|
|
256
|
+
success: true,
|
|
257
|
+
result: JSON.stringify({
|
|
258
|
+
action: 'created',
|
|
259
|
+
file: displayPath,
|
|
260
|
+
lines: lines,
|
|
261
|
+
message: `Created ${displayPath} (${lines} lines)`,
|
|
262
|
+
}),
|
|
263
|
+
};
|
|
264
|
+
} catch (error) {
|
|
265
|
+
const err = error as NodeJS.ErrnoException;
|
|
266
|
+
const displayPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
267
|
+
logger.toolError('create_file', args, err, 0);
|
|
268
|
+
return {
|
|
269
|
+
success: false,
|
|
270
|
+
error: `Failed to create file (${displayPath}): ${err.message}`,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* create_file LLM Simple Tool
|
|
277
|
+
*/
|
|
278
|
+
export const createFileTool: LLMSimpleTool = {
|
|
279
|
+
definition: CREATE_FILE_DEFINITION,
|
|
280
|
+
execute: _executeCreateFile,
|
|
281
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
282
|
+
description: 'Create a new file',
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* edit_file Tool Definition
|
|
287
|
+
* Used for modifying EXISTING files only. Use create_file for new files.
|
|
288
|
+
* Claude Code style: old_string/new_string based replacement
|
|
289
|
+
*/
|
|
290
|
+
const EDIT_FILE_DEFINITION: ToolDefinition = {
|
|
291
|
+
type: 'function',
|
|
292
|
+
function: {
|
|
293
|
+
name: 'edit_file',
|
|
294
|
+
description: `Edit an EXISTING file by replacing a specific text block.
|
|
295
|
+
IMPORTANT: Only use this for files that already exist. For new files, use create_file.
|
|
296
|
+
|
|
297
|
+
HOW TO USE:
|
|
298
|
+
1. First use read_file to see the current content
|
|
299
|
+
2. Copy the EXACT text block you want to change (can be multiple lines)
|
|
300
|
+
3. Provide old_string (text to find) and new_string (replacement)
|
|
301
|
+
|
|
302
|
+
RULES:
|
|
303
|
+
- old_string must match EXACTLY (including whitespace and indentation)
|
|
304
|
+
- old_string must be UNIQUE in the file (if it appears multiple times, use replace_all: true)
|
|
305
|
+
- Both old_string and new_string can be multi-line
|
|
306
|
+
- To delete text, use empty string "" for new_string
|
|
307
|
+
|
|
308
|
+
EXAMPLES:
|
|
309
|
+
1. Change a single line:
|
|
310
|
+
old_string: "const x = 1;"
|
|
311
|
+
new_string: "const x = 2;"
|
|
312
|
+
|
|
313
|
+
2. Change multiple lines at once:
|
|
314
|
+
old_string: "function foo() {\\n return 1;\\n}"
|
|
315
|
+
new_string: "function foo() {\\n return 2;\\n}"
|
|
316
|
+
|
|
317
|
+
3. Delete a line:
|
|
318
|
+
old_string: "// delete this line\\n"
|
|
319
|
+
new_string: ""
|
|
320
|
+
|
|
321
|
+
4. Replace all occurrences:
|
|
322
|
+
old_string: "oldName"
|
|
323
|
+
new_string: "newName"
|
|
324
|
+
replace_all: true`,
|
|
325
|
+
parameters: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {
|
|
328
|
+
reason: {
|
|
329
|
+
type: 'string',
|
|
330
|
+
description: `A natural, conversational explanation for the user about what you're doing.
|
|
331
|
+
Write as if you're talking to the user directly. Use the same language as the user.
|
|
332
|
+
Examples:
|
|
333
|
+
- "Fixing the buggy section"
|
|
334
|
+
- "Changing the function name as requested"
|
|
335
|
+
- "Adding the import statement"
|
|
336
|
+
- "Fixing the type error"`,
|
|
337
|
+
},
|
|
338
|
+
file_path: {
|
|
339
|
+
type: 'string',
|
|
340
|
+
description: 'Absolute or relative path of the existing file to edit',
|
|
341
|
+
},
|
|
342
|
+
old_string: {
|
|
343
|
+
type: 'string',
|
|
344
|
+
description: 'The exact text to find and replace (can be multi-line)',
|
|
345
|
+
},
|
|
346
|
+
new_string: {
|
|
347
|
+
type: 'string',
|
|
348
|
+
description: 'The new text to replace with (can be multi-line, use "" to delete)',
|
|
349
|
+
},
|
|
350
|
+
replace_all: {
|
|
351
|
+
type: 'boolean',
|
|
352
|
+
description: 'If true, replace ALL occurrences of old_string. Default is false (requires unique match).',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
required: ['reason', 'file_path', 'old_string', 'new_string'],
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Internal: Execute edit_file (Claude Code style - old_string/new_string)
|
|
362
|
+
*/
|
|
363
|
+
async function _executeEditFile(args: Record<string, unknown>): Promise<ToolResult> {
|
|
364
|
+
const filePath = args['file_path'] as string;
|
|
365
|
+
const oldString = args['old_string'] as string;
|
|
366
|
+
const newString = args['new_string'] as string;
|
|
367
|
+
const replaceAll = args['replace_all'] as boolean | undefined;
|
|
368
|
+
|
|
369
|
+
logger.toolStart('edit_file', { file_path: filePath, oldStringLength: oldString?.length || 0, newStringLength: newString?.length || 0, replaceAll });
|
|
370
|
+
|
|
371
|
+
// Compute displayPath once at the top for use in both try and catch
|
|
372
|
+
const cleanPath = filePath.startsWith('@') ? filePath.slice(1) : filePath;
|
|
373
|
+
const displayPath = cleanPath;
|
|
374
|
+
|
|
375
|
+
try {
|
|
376
|
+
const resolvedPath = path.resolve(cleanPath);
|
|
377
|
+
|
|
378
|
+
// Validate old_string is not empty
|
|
379
|
+
if (!oldString) {
|
|
380
|
+
return {
|
|
381
|
+
success: false,
|
|
382
|
+
error: 'old_string cannot be empty.',
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Check if file exists
|
|
387
|
+
try {
|
|
388
|
+
await fs.access(resolvedPath);
|
|
389
|
+
} catch {
|
|
390
|
+
return {
|
|
391
|
+
success: false,
|
|
392
|
+
error: `File does not exist: ${displayPath}. Use create_file to create new files.`,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Check file size before reading (security: prevent memory exhaustion)
|
|
397
|
+
const stats = await fs.stat(resolvedPath);
|
|
398
|
+
if (stats.size > MAX_FILE_SIZE) {
|
|
399
|
+
logger.warn('File too large to edit', { path: displayPath, size: stats.size, max: MAX_FILE_SIZE });
|
|
400
|
+
return {
|
|
401
|
+
success: false,
|
|
402
|
+
error: `File too large to edit (${(stats.size / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_FILE_SIZE / 1024 / 1024}MB`,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Read current content
|
|
407
|
+
const originalContent = await fs.readFile(resolvedPath, 'utf-8');
|
|
408
|
+
|
|
409
|
+
// Check if old_string exists in the file
|
|
410
|
+
if (!originalContent.includes(oldString)) {
|
|
411
|
+
// Try to provide helpful context
|
|
412
|
+
const lines = originalContent.split('\n');
|
|
413
|
+
const preview = lines.slice(0, 20).map((l, i) => `${i + 1}: ${l}`).join('\n');
|
|
414
|
+
return {
|
|
415
|
+
success: false,
|
|
416
|
+
error: `old_string not found in file.\n\nSearched for:\n"${oldString.slice(0, 200)}${oldString.length > 200 ? '...' : ''}"\n\nFile preview (first 20 lines):\n${preview}\n\n💡 Use read_file to check the exact content and try again.`,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Count occurrences
|
|
421
|
+
const occurrences = originalContent.split(oldString).length - 1;
|
|
422
|
+
|
|
423
|
+
// If not replace_all, old_string must be unique
|
|
424
|
+
if (!replaceAll && occurrences > 1) {
|
|
425
|
+
return {
|
|
426
|
+
success: false,
|
|
427
|
+
error: `old_string appears ${occurrences} times in the file. Either:\n1. Make old_string more specific (include more context)\n2. Use replace_all: true to replace all occurrences\n\n💡 Include surrounding lines to make the match unique.`,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Perform replacement
|
|
432
|
+
let newContent: string;
|
|
433
|
+
if (replaceAll) {
|
|
434
|
+
newContent = originalContent.split(oldString).join(newString);
|
|
435
|
+
} else {
|
|
436
|
+
// Replace only first occurrence (which should be unique)
|
|
437
|
+
newContent = originalContent.replace(oldString, newString);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Check new content size (security: prevent excessive writes)
|
|
441
|
+
const newContentSize = Buffer.byteLength(newContent, 'utf-8');
|
|
442
|
+
if (newContentSize > MAX_WRITE_SIZE) {
|
|
443
|
+
logger.warn('Modified content too large', { path: displayPath, size: newContentSize, max: MAX_WRITE_SIZE });
|
|
444
|
+
return {
|
|
445
|
+
success: false,
|
|
446
|
+
error: `Modified content too large (${(newContentSize / 1024 / 1024).toFixed(2)}MB). Maximum: ${MAX_WRITE_SIZE / 1024 / 1024}MB`,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Write the modified content
|
|
451
|
+
await fs.writeFile(resolvedPath, newContent, 'utf-8');
|
|
452
|
+
|
|
453
|
+
// Calculate diff stats (split once, reuse)
|
|
454
|
+
const oldLinesArr = oldString.split('\n');
|
|
455
|
+
const newLinesArr = newString.split('\n');
|
|
456
|
+
const replacements = replaceAll ? occurrences : 1;
|
|
457
|
+
|
|
458
|
+
// Build simple diff preview
|
|
459
|
+
const diffPreview: string[] = [];
|
|
460
|
+
const oldPreview = oldLinesArr.slice(0, 5);
|
|
461
|
+
const newPreview = newLinesArr.slice(0, 5);
|
|
462
|
+
|
|
463
|
+
oldPreview.forEach(line => diffPreview.push(`- ${line}`));
|
|
464
|
+
if (oldLinesArr.length > 5) diffPreview.push('- ...');
|
|
465
|
+
newPreview.forEach(line => diffPreview.push(`+ ${line}`));
|
|
466
|
+
if (newLinesArr.length > 5) diffPreview.push('+ ...');
|
|
467
|
+
|
|
468
|
+
logger.toolSuccess('edit_file', args, { file: displayPath, replacements, oldLines: oldLinesArr.length, newLines: newLinesArr.length }, 0);
|
|
469
|
+
return {
|
|
470
|
+
success: true,
|
|
471
|
+
result: JSON.stringify({
|
|
472
|
+
action: 'edited',
|
|
473
|
+
file: displayPath,
|
|
474
|
+
replacements: replacements,
|
|
475
|
+
oldLines: oldLinesArr.length,
|
|
476
|
+
newLines: newLinesArr.length,
|
|
477
|
+
message: replaceAll
|
|
478
|
+
? `Replaced ${replacements} occurrence(s) in ${displayPath}`
|
|
479
|
+
: `Updated ${displayPath}`,
|
|
480
|
+
diff: diffPreview,
|
|
481
|
+
}),
|
|
482
|
+
};
|
|
483
|
+
} catch (error) {
|
|
484
|
+
const err = error as NodeJS.ErrnoException;
|
|
485
|
+
logger.toolError('edit_file', args, err, 0);
|
|
486
|
+
return {
|
|
487
|
+
success: false,
|
|
488
|
+
error: `File edit failed (${displayPath}): ${err.message}`,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* edit_file LLM Simple Tool
|
|
495
|
+
*/
|
|
496
|
+
export const editFileTool: LLMSimpleTool = {
|
|
497
|
+
definition: EDIT_FILE_DEFINITION,
|
|
498
|
+
execute: _executeEditFile,
|
|
499
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
500
|
+
description: 'Edit an existing file',
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* list_files Tool Definition
|
|
505
|
+
*/
|
|
506
|
+
const LIST_FILES_DEFINITION: ToolDefinition = {
|
|
507
|
+
type: 'function',
|
|
508
|
+
function: {
|
|
509
|
+
name: 'list_files',
|
|
510
|
+
description: 'List files and folders in a directory.',
|
|
511
|
+
parameters: {
|
|
512
|
+
type: 'object',
|
|
513
|
+
properties: {
|
|
514
|
+
reason: {
|
|
515
|
+
type: 'string',
|
|
516
|
+
description: `A natural, conversational explanation for the user about what you're doing.
|
|
517
|
+
Write as if you're talking to the user directly. Use the same language as the user.
|
|
518
|
+
Examples:
|
|
519
|
+
- "Looking at the folder structure to understand the project"
|
|
520
|
+
- "Checking what files are available"
|
|
521
|
+
- "Seeing what's inside the src folder"
|
|
522
|
+
- "Checking the directory to find related files"`,
|
|
523
|
+
},
|
|
524
|
+
directory_path: {
|
|
525
|
+
type: 'string',
|
|
526
|
+
description: 'Directory path to list (default: current directory)',
|
|
527
|
+
},
|
|
528
|
+
recursive: {
|
|
529
|
+
type: 'boolean',
|
|
530
|
+
description: 'Whether to list subdirectories recursively (default: false)',
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
required: ['reason'],
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Get files recursively with safety limits
|
|
540
|
+
*/
|
|
541
|
+
async function getFilesRecursively(
|
|
542
|
+
dirPath: string,
|
|
543
|
+
baseDir: string = dirPath,
|
|
544
|
+
depth: number = 0,
|
|
545
|
+
fileCount: { count: number } = { count: 0 }
|
|
546
|
+
): Promise<Array<{ name: string; type: string; path: string }>> {
|
|
547
|
+
// Safety: depth limit
|
|
548
|
+
if (depth > MAX_DEPTH) {
|
|
549
|
+
return [];
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Safety: file count limit
|
|
553
|
+
if (fileCount.count >= MAX_FILES) {
|
|
554
|
+
return [];
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
let entries;
|
|
558
|
+
try {
|
|
559
|
+
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
560
|
+
} catch {
|
|
561
|
+
return [];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const files: Array<{ name: string; type: string; path: string }> = [];
|
|
565
|
+
|
|
566
|
+
for (const entry of entries) {
|
|
567
|
+
if (fileCount.count >= MAX_FILES) {
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Skip hidden files/directories (starting with .)
|
|
572
|
+
if (entry.name.startsWith('.')) {
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
577
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
578
|
+
|
|
579
|
+
if (entry.isDirectory()) {
|
|
580
|
+
// Safety: exclude heavy directories
|
|
581
|
+
if (EXCLUDED_DIRS.has(entry.name)) {
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
files.push({
|
|
586
|
+
name: entry.name,
|
|
587
|
+
type: 'directory',
|
|
588
|
+
path: relativePath,
|
|
589
|
+
});
|
|
590
|
+
fileCount.count++;
|
|
591
|
+
|
|
592
|
+
// Recursive call with increased depth
|
|
593
|
+
const subFiles = await getFilesRecursively(fullPath, baseDir, depth + 1, fileCount);
|
|
594
|
+
files.push(...subFiles);
|
|
595
|
+
} else {
|
|
596
|
+
files.push({
|
|
597
|
+
name: entry.name,
|
|
598
|
+
type: 'file',
|
|
599
|
+
path: relativePath,
|
|
600
|
+
});
|
|
601
|
+
fileCount.count++;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
return files;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Internal: Execute list_files
|
|
610
|
+
*/
|
|
611
|
+
async function _executeListFilesInternal(args: Record<string, unknown>): Promise<ToolResult> {
|
|
612
|
+
const directoryPath = (args['directory_path'] as string) || '.';
|
|
613
|
+
const recursive = (args['recursive'] as boolean) || false;
|
|
614
|
+
|
|
615
|
+
logger.toolStart('list_files', { directory_path: directoryPath, recursive });
|
|
616
|
+
|
|
617
|
+
try {
|
|
618
|
+
const resolvedPath = path.resolve(directoryPath);
|
|
619
|
+
|
|
620
|
+
if (recursive) {
|
|
621
|
+
const files = await getFilesRecursively(resolvedPath);
|
|
622
|
+
logger.toolSuccess('list_files', args, { fileCount: files.length }, 0);
|
|
623
|
+
return {
|
|
624
|
+
success: true,
|
|
625
|
+
result: JSON.stringify(files, null, 2),
|
|
626
|
+
};
|
|
627
|
+
} else {
|
|
628
|
+
const entries = await fs.readdir(resolvedPath, { withFileTypes: true });
|
|
629
|
+
const files = entries.map((entry) => ({
|
|
630
|
+
name: entry.name,
|
|
631
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
632
|
+
path: path.join(directoryPath, entry.name),
|
|
633
|
+
}));
|
|
634
|
+
|
|
635
|
+
logger.toolSuccess('list_files', args, { fileCount: files.length }, 0);
|
|
636
|
+
return {
|
|
637
|
+
success: true,
|
|
638
|
+
result: JSON.stringify(files, null, 2),
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
} catch (error) {
|
|
642
|
+
const err = error as NodeJS.ErrnoException;
|
|
643
|
+
logger.toolError('list_files', args, err, 0);
|
|
644
|
+
if (err.code === 'ENOENT') {
|
|
645
|
+
return {
|
|
646
|
+
success: false,
|
|
647
|
+
error: `Directory not found: ${directoryPath}`,
|
|
648
|
+
};
|
|
649
|
+
} else {
|
|
650
|
+
return {
|
|
651
|
+
success: false,
|
|
652
|
+
error: `Failed to read directory: ${err.message}`,
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* list_files LLM Simple Tool
|
|
660
|
+
*/
|
|
661
|
+
export const listFilesTool: LLMSimpleTool = {
|
|
662
|
+
definition: LIST_FILES_DEFINITION,
|
|
663
|
+
execute: _executeListFilesInternal,
|
|
664
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
665
|
+
description: 'List directory contents',
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* find_files Tool Definition
|
|
670
|
+
*/
|
|
671
|
+
const FIND_FILES_DEFINITION: ToolDefinition = {
|
|
672
|
+
type: 'function',
|
|
673
|
+
function: {
|
|
674
|
+
name: 'find_files',
|
|
675
|
+
description: 'Search for files by filename pattern.',
|
|
676
|
+
parameters: {
|
|
677
|
+
type: 'object',
|
|
678
|
+
properties: {
|
|
679
|
+
reason: {
|
|
680
|
+
type: 'string',
|
|
681
|
+
description: `A natural, conversational explanation for the user about what you're doing (in user's language).
|
|
682
|
+
Write as if you're talking to the user directly.
|
|
683
|
+
Examples:
|
|
684
|
+
- "Looking for where the config files are located"
|
|
685
|
+
- "Searching for test files"
|
|
686
|
+
- "Checking where TypeScript files are"
|
|
687
|
+
- "Finding related component files"`,
|
|
688
|
+
},
|
|
689
|
+
pattern: {
|
|
690
|
+
type: 'string',
|
|
691
|
+
description: 'Filename pattern to search for (e.g., *.ts, package.json)',
|
|
692
|
+
},
|
|
693
|
+
directory_path: {
|
|
694
|
+
type: 'string',
|
|
695
|
+
description: 'Directory path to start search from (default: current directory)',
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
required: ['reason', 'pattern'],
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Find files recursively with safety limits
|
|
705
|
+
*/
|
|
706
|
+
async function findFilesRecursively(
|
|
707
|
+
dirPath: string,
|
|
708
|
+
regex: RegExp,
|
|
709
|
+
baseDir: string,
|
|
710
|
+
depth: number = 0,
|
|
711
|
+
fileCount: { count: number } = { count: 0 }
|
|
712
|
+
): Promise<Array<{ name: string; path: string }>> {
|
|
713
|
+
// Safety: depth limit
|
|
714
|
+
if (depth > MAX_DEPTH) {
|
|
715
|
+
return [];
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// Safety: file count limit
|
|
719
|
+
if (fileCount.count >= MAX_FILES) {
|
|
720
|
+
return [];
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
let entries;
|
|
724
|
+
try {
|
|
725
|
+
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
726
|
+
} catch {
|
|
727
|
+
return [];
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const matchedFiles: Array<{ name: string; path: string }> = [];
|
|
731
|
+
|
|
732
|
+
for (const entry of entries) {
|
|
733
|
+
if (fileCount.count >= MAX_FILES) {
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// Skip hidden files/directories (starting with .)
|
|
738
|
+
if (entry.name.startsWith('.')) {
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
743
|
+
|
|
744
|
+
if (entry.isDirectory()) {
|
|
745
|
+
// Safety: exclude heavy directories
|
|
746
|
+
if (EXCLUDED_DIRS.has(entry.name)) {
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
// Recursive call with increased depth
|
|
750
|
+
const subFiles = await findFilesRecursively(fullPath, regex, baseDir, depth + 1, fileCount);
|
|
751
|
+
matchedFiles.push(...subFiles);
|
|
752
|
+
} else if (regex.test(entry.name)) {
|
|
753
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
754
|
+
matchedFiles.push({
|
|
755
|
+
name: entry.name,
|
|
756
|
+
path: relativePath,
|
|
757
|
+
});
|
|
758
|
+
fileCount.count++;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return matchedFiles;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Internal: Execute find_files
|
|
767
|
+
*/
|
|
768
|
+
async function _executeFindFilesInternal(args: Record<string, unknown>): Promise<ToolResult> {
|
|
769
|
+
const pattern = args['pattern'] as string;
|
|
770
|
+
const directoryPath = (args['directory_path'] as string) || '.';
|
|
771
|
+
|
|
772
|
+
logger.toolStart('find_files', { pattern, directory_path: directoryPath });
|
|
773
|
+
|
|
774
|
+
try {
|
|
775
|
+
const resolvedPath = path.resolve(directoryPath);
|
|
776
|
+
|
|
777
|
+
// Convert pattern to regex (simple glob support)
|
|
778
|
+
const regexPattern = pattern
|
|
779
|
+
.replace(/\./g, '\\.')
|
|
780
|
+
.replace(/\*/g, '.*')
|
|
781
|
+
.replace(/\?/g, '.');
|
|
782
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
783
|
+
|
|
784
|
+
const matchedFiles = await findFilesRecursively(resolvedPath, regex, resolvedPath);
|
|
785
|
+
|
|
786
|
+
if (matchedFiles.length === 0) {
|
|
787
|
+
logger.toolSuccess('find_files', args, { matchCount: 0 }, 0);
|
|
788
|
+
return {
|
|
789
|
+
success: true,
|
|
790
|
+
result: `No files found matching pattern "${pattern}".`,
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
logger.toolSuccess('find_files', args, { matchCount: matchedFiles.length }, 0);
|
|
795
|
+
return {
|
|
796
|
+
success: true,
|
|
797
|
+
result: JSON.stringify(matchedFiles, null, 2),
|
|
798
|
+
};
|
|
799
|
+
} catch (error) {
|
|
800
|
+
const err = error as NodeJS.ErrnoException;
|
|
801
|
+
logger.toolError('find_files', args, err, 0);
|
|
802
|
+
return {
|
|
803
|
+
success: false,
|
|
804
|
+
error: `File search failed: ${err.message}`,
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* find_files LLM Simple Tool
|
|
811
|
+
*/
|
|
812
|
+
export const findFilesTool: LLMSimpleTool = {
|
|
813
|
+
definition: FIND_FILES_DEFINITION,
|
|
814
|
+
execute: _executeFindFilesInternal,
|
|
815
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
816
|
+
description: 'Search files by pattern',
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// =============================================================================
|
|
820
|
+
// search_content Tool
|
|
821
|
+
// =============================================================================
|
|
822
|
+
|
|
823
|
+
const SEARCH_CONTENT_DEFINITION: ToolDefinition = {
|
|
824
|
+
type: 'function',
|
|
825
|
+
function: {
|
|
826
|
+
name: 'search_content',
|
|
827
|
+
description: 'Search for text pattern inside files.',
|
|
828
|
+
parameters: {
|
|
829
|
+
type: 'object',
|
|
830
|
+
properties: {
|
|
831
|
+
reason: {
|
|
832
|
+
type: 'string',
|
|
833
|
+
description: `A natural, conversational explanation for the user about what you're doing.
|
|
834
|
+
Write as if you're talking to the user directly. Use the same language as the user.
|
|
835
|
+
Examples:
|
|
836
|
+
- "Searching for usages of the function"
|
|
837
|
+
- "Finding where the error message is defined"
|
|
838
|
+
- "Looking for references to the API endpoint"`,
|
|
839
|
+
},
|
|
840
|
+
pattern: {
|
|
841
|
+
type: 'string',
|
|
842
|
+
description: 'Text or regex pattern to search for',
|
|
843
|
+
},
|
|
844
|
+
directory_path: {
|
|
845
|
+
type: 'string',
|
|
846
|
+
description: 'Directory path to search in (default: current directory)',
|
|
847
|
+
},
|
|
848
|
+
file_pattern: {
|
|
849
|
+
type: 'string',
|
|
850
|
+
description: 'File pattern to filter (e.g., *.ts)',
|
|
851
|
+
},
|
|
852
|
+
max_results: {
|
|
853
|
+
type: 'number',
|
|
854
|
+
description: 'Maximum number of results (default: 50)',
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
required: ['reason', 'pattern'],
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
const TEXT_EXTENSIONS = [
|
|
863
|
+
'.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.txt', '.css', '.scss',
|
|
864
|
+
'.html', '.xml', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.conf',
|
|
865
|
+
'.sh', '.bash', '.ps1', '.py', '.rb', '.go', '.rs', '.java', '.c',
|
|
866
|
+
'.cpp', '.h', '.hpp', '.cs', '.php', '.vue', '.svelte',
|
|
867
|
+
];
|
|
868
|
+
|
|
869
|
+
async function searchContentRecursively(
|
|
870
|
+
dirPath: string,
|
|
871
|
+
searchRegex: RegExp,
|
|
872
|
+
baseDir: string,
|
|
873
|
+
fileRegex: RegExp | null,
|
|
874
|
+
resultCount: { count: number },
|
|
875
|
+
maxResults: number,
|
|
876
|
+
depth: number = 0
|
|
877
|
+
): Promise<Array<{ file: string; line: number; content: string }>> {
|
|
878
|
+
if (depth > MAX_DEPTH || resultCount.count >= maxResults) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
let entries;
|
|
883
|
+
try {
|
|
884
|
+
entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
885
|
+
} catch {
|
|
886
|
+
return [];
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const results: Array<{ file: string; line: number; content: string }> = [];
|
|
890
|
+
|
|
891
|
+
for (const entry of entries) {
|
|
892
|
+
if (resultCount.count >= maxResults) break;
|
|
893
|
+
|
|
894
|
+
if (entry.name.startsWith('.')) continue;
|
|
895
|
+
|
|
896
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
897
|
+
|
|
898
|
+
if (entry.isDirectory()) {
|
|
899
|
+
if (EXCLUDED_DIRS.has(entry.name)) continue;
|
|
900
|
+
|
|
901
|
+
const subResults = await searchContentRecursively(
|
|
902
|
+
fullPath, searchRegex, baseDir, fileRegex, resultCount, maxResults, depth + 1
|
|
903
|
+
);
|
|
904
|
+
results.push(...subResults);
|
|
905
|
+
} else {
|
|
906
|
+
if (fileRegex && !fileRegex.test(entry.name)) continue;
|
|
907
|
+
|
|
908
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
909
|
+
if (!TEXT_EXTENSIONS.includes(ext)) continue;
|
|
910
|
+
|
|
911
|
+
try {
|
|
912
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
913
|
+
const lines = content.split('\n');
|
|
914
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
915
|
+
|
|
916
|
+
for (let i = 0; i < lines.length && resultCount.count < maxResults; i++) {
|
|
917
|
+
const line = lines[i] ?? '';
|
|
918
|
+
if (searchRegex.test(line)) {
|
|
919
|
+
results.push({
|
|
920
|
+
file: relativePath,
|
|
921
|
+
line: i + 1,
|
|
922
|
+
content: line.trim().substring(0, 200),
|
|
923
|
+
});
|
|
924
|
+
resultCount.count++;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
} catch {
|
|
928
|
+
// Skip files that can't be read
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
return results;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
async function executeSearchContent(args: Record<string, unknown>): Promise<ToolResult> {
|
|
937
|
+
const pattern = args['pattern'] as string;
|
|
938
|
+
const directoryPath = (args['directory_path'] as string) || '.';
|
|
939
|
+
const filePattern = args['file_pattern'] as string | undefined;
|
|
940
|
+
const maxResults = (args['max_results'] as number) || 50;
|
|
941
|
+
|
|
942
|
+
logger.toolStart('search_content', { pattern, directory_path: directoryPath, file_pattern: filePattern, maxResults });
|
|
943
|
+
|
|
944
|
+
try {
|
|
945
|
+
const resolvedPath = path.isAbsolute(directoryPath) ? directoryPath : path.resolve(process.cwd(), directoryPath);
|
|
946
|
+
const searchRegex = new RegExp(pattern, 'gi');
|
|
947
|
+
|
|
948
|
+
let fileRegex: RegExp | null = null;
|
|
949
|
+
if (filePattern) {
|
|
950
|
+
const regexPattern = filePattern
|
|
951
|
+
.replace(/\./g, '\\.')
|
|
952
|
+
.replace(/\*/g, '.*')
|
|
953
|
+
.replace(/\?/g, '.');
|
|
954
|
+
fileRegex = new RegExp(`^${regexPattern}$`, 'i');
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
const results = await searchContentRecursively(
|
|
958
|
+
resolvedPath, searchRegex, resolvedPath, fileRegex, { count: 0 }, maxResults
|
|
959
|
+
);
|
|
960
|
+
|
|
961
|
+
logger.toolSuccess('search_content', args, { matchedCount: results.length }, 0);
|
|
962
|
+
|
|
963
|
+
if (results.length === 0) {
|
|
964
|
+
return { success: true, result: `No matches found for pattern "${pattern}".` };
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
return { success: true, result: JSON.stringify(results, null, 2) };
|
|
968
|
+
} catch (error) {
|
|
969
|
+
const err = error as NodeJS.ErrnoException;
|
|
970
|
+
logger.toolError('search_content', args, err, 0);
|
|
971
|
+
return { success: false, error: `Content search failed: ${err.message}` };
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
export const searchContentTool: LLMSimpleTool = {
|
|
976
|
+
definition: SEARCH_CONTENT_DEFINITION,
|
|
977
|
+
execute: executeSearchContent,
|
|
978
|
+
categories: ['llm-simple'] as ToolCategory[],
|
|
979
|
+
description: 'Search content in files',
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* File operation tools (read, create, edit, list, find, search_content)
|
|
984
|
+
*/
|
|
985
|
+
export const FILE_TOOLS: LLMSimpleTool[] = [
|
|
986
|
+
readFileTool,
|
|
987
|
+
createFileTool,
|
|
988
|
+
editFileTool,
|
|
989
|
+
listFilesTool,
|
|
990
|
+
findFilesTool,
|
|
991
|
+
searchContentTool,
|
|
992
|
+
];
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* System utility tools
|
|
996
|
+
*
|
|
997
|
+
* Note: Shell tools (bash/powershell) are now managed separately by platform.
|
|
998
|
+
* Use `getShellTools()` from index.ts for platform-specific shell tools.
|
|
999
|
+
* This array is kept for backward compatibility but is now empty.
|
|
1000
|
+
*/
|
|
1001
|
+
export const SYSTEM_TOOLS: LLMSimpleTool[] = [];
|
|
1002
|
+
|
|
1003
|
+
// Re-export user interaction tools
|
|
1004
|
+
export {
|
|
1005
|
+
USER_INTERACTION_TOOLS,
|
|
1006
|
+
tellToUserTool,
|
|
1007
|
+
askToUserTool,
|
|
1008
|
+
setTellToUserCallback,
|
|
1009
|
+
setAskUserCallback,
|
|
1010
|
+
clearAskUserCallback,
|
|
1011
|
+
hasAskUserCallback,
|
|
1012
|
+
type AskUserRequest,
|
|
1013
|
+
type AskUserResponse,
|
|
1014
|
+
type AskUserCallback,
|
|
1015
|
+
} from './user-interaction-tools.js';
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* @deprecated Use FILE_TOOLS, USER_INTERACTION_TOOLS, SYSTEM_TOOLS separately
|
|
1019
|
+
*/
|
|
1020
|
+
export { FILE_TOOLS as FILE_SIMPLE_TOOLS };
|
|
1021
|
+
|
|
1022
|
+
// Re-export from simple-tool-executor for backward compatibility
|
|
1023
|
+
export {
|
|
1024
|
+
// Callback setters
|
|
1025
|
+
setToolExecutionCallback,
|
|
1026
|
+
setToolResponseCallback,
|
|
1027
|
+
setPlanCreatedCallback,
|
|
1028
|
+
setTodoStartCallback,
|
|
1029
|
+
setTodoCompleteCallback,
|
|
1030
|
+
setTodoFailCallback,
|
|
1031
|
+
setToolApprovalCallback,
|
|
1032
|
+
setCompactCallback,
|
|
1033
|
+
setAssistantResponseCallback,
|
|
1034
|
+
setReasoningCallback,
|
|
1035
|
+
// Callback getters & emitters
|
|
1036
|
+
getToolExecutionCallback,
|
|
1037
|
+
requestToolApproval,
|
|
1038
|
+
emitPlanCreated,
|
|
1039
|
+
emitTodoStart,
|
|
1040
|
+
emitTodoComplete,
|
|
1041
|
+
emitTodoFail,
|
|
1042
|
+
emitCompact,
|
|
1043
|
+
emitAssistantResponse,
|
|
1044
|
+
emitReasoning,
|
|
1045
|
+
// Tool executor
|
|
1046
|
+
executeSimpleTool,
|
|
1047
|
+
executeFileTool,
|
|
1048
|
+
// Types
|
|
1049
|
+
type ToolApprovalResult,
|
|
1050
|
+
} from './simple-tool-executor.js';
|
|
1051
|
+
|