@travisennis/acai 0.0.6 → 0.0.8
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/README.md +225 -39
- package/dist/agent/index.d.ts +30 -21
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +237 -198
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -18
- package/dist/commands/add-directory/index.d.ts +3 -0
- package/dist/commands/add-directory/index.d.ts.map +1 -0
- package/dist/commands/add-directory/index.js +50 -0
- package/dist/commands/add-directory/types.d.ts +6 -0
- package/dist/commands/add-directory/types.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.d.ts +3 -0
- package/dist/commands/add-directory/utils.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.js +15 -0
- package/dist/commands/clear/index.d.ts +3 -0
- package/dist/commands/clear/index.d.ts.map +1 -0
- package/dist/commands/{clear-command.js → clear/index.js} +1 -7
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/copy/index.js +39 -0
- package/dist/commands/copy/types.d.ts +3 -0
- package/dist/commands/copy/types.d.ts.map +1 -0
- package/dist/commands/copy/types.js +1 -0
- package/dist/commands/copy/utils.d.ts +3 -0
- package/dist/commands/copy/utils.d.ts.map +1 -0
- package/dist/commands/copy/utils.js +22 -0
- package/dist/commands/exit/index.d.ts +10 -0
- package/dist/commands/exit/index.d.ts.map +1 -0
- package/dist/commands/exit/index.js +21 -0
- package/dist/commands/exit/types.d.ts +8 -0
- package/dist/commands/exit/types.d.ts.map +1 -0
- package/dist/commands/exit/types.js +1 -0
- package/dist/commands/exit/utils.d.ts +2 -0
- package/dist/commands/exit/utils.d.ts.map +1 -0
- package/dist/commands/exit/utils.js +13 -0
- package/dist/commands/generate-rules/index.d.ts +3 -0
- package/dist/commands/generate-rules/index.d.ts.map +1 -0
- package/dist/commands/{generate-rules-command.js → generate-rules/index.js} +65 -147
- package/dist/commands/generate-rules/utils.d.ts +5 -0
- package/dist/commands/generate-rules/utils.d.ts.map +1 -0
- package/dist/commands/generate-rules/utils.js +25 -0
- package/dist/commands/handoff/index.d.ts +3 -0
- package/dist/commands/handoff/index.d.ts.map +1 -0
- package/dist/commands/handoff/index.js +97 -0
- package/dist/commands/handoff/utils.d.ts +4 -0
- package/dist/commands/handoff/utils.d.ts.map +1 -0
- package/dist/commands/handoff/utils.js +123 -0
- package/dist/commands/health/index.d.ts +3 -0
- package/dist/commands/health/index.d.ts.map +1 -0
- package/dist/commands/health/index.js +56 -0
- package/dist/commands/health/utils.d.ts +15 -0
- package/dist/commands/health/utils.d.ts.map +1 -0
- package/dist/commands/health/utils.js +52 -0
- package/dist/commands/help/index.d.ts +3 -0
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +6 -14
- package/dist/commands/history/index.d.ts +3 -0
- package/dist/commands/history/index.d.ts.map +1 -0
- package/dist/commands/{history-command.js → history/index.js} +40 -200
- package/dist/commands/history/types.d.ts +11 -0
- package/dist/commands/history/types.d.ts.map +1 -0
- package/dist/commands/history/types.js +1 -0
- package/dist/commands/history/utils.d.ts +4 -0
- package/dist/commands/history/utils.d.ts.map +1 -0
- package/dist/commands/history/utils.js +86 -0
- package/dist/commands/init/index.d.ts +3 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/{init-command.js → init/index.js} +17 -27
- package/dist/commands/init-project/index.d.ts +3 -0
- package/dist/commands/init-project/index.d.ts.map +1 -0
- package/dist/commands/init-project/index.js +51 -0
- package/dist/commands/init-project/utils.d.ts +9 -0
- package/dist/commands/init-project/utils.d.ts.map +1 -0
- package/dist/commands/init-project/utils.js +43 -0
- package/dist/commands/list-directories/index.d.ts +3 -0
- package/dist/commands/list-directories/index.d.ts.map +1 -0
- package/dist/commands/{list-directories-command.js → list-directories/index.js} +2 -15
- package/dist/commands/list-tools/index.d.ts +3 -0
- package/dist/commands/list-tools/index.d.ts.map +1 -0
- package/dist/commands/list-tools/index.js +89 -0
- package/dist/commands/manager.d.ts +2 -9
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +38 -83
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/model/index.js +182 -0
- package/dist/commands/model/utils.d.ts +3 -0
- package/dist/commands/model/utils.d.ts.map +1 -0
- package/dist/commands/model/utils.js +5 -0
- package/dist/commands/paste/index.d.ts +3 -0
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/paste/index.js +94 -0
- package/dist/commands/paste/utils.d.ts +5 -0
- package/dist/commands/paste/utils.d.ts.map +1 -0
- package/dist/commands/paste/utils.js +86 -0
- package/dist/commands/pickup/index.d.ts +3 -0
- package/dist/commands/pickup/index.d.ts.map +1 -0
- package/dist/commands/pickup/index.js +138 -0
- package/dist/commands/pickup/types.d.ts +6 -0
- package/dist/commands/pickup/types.d.ts.map +1 -0
- package/dist/commands/pickup/types.js +1 -0
- package/dist/commands/pickup/utils.d.ts +7 -0
- package/dist/commands/pickup/utils.d.ts.map +1 -0
- package/dist/commands/pickup/utils.js +56 -0
- package/dist/commands/prompt/index.d.ts +5 -0
- package/dist/commands/prompt/index.d.ts.map +1 -0
- package/dist/commands/prompt/index.js +126 -0
- package/dist/commands/prompt/types.d.ts +15 -0
- package/dist/commands/prompt/types.d.ts.map +1 -0
- package/dist/commands/prompt/types.js +1 -0
- package/dist/commands/prompt/utils.d.ts +12 -0
- package/dist/commands/prompt/utils.d.ts.map +1 -0
- package/dist/commands/prompt/utils.js +107 -0
- package/dist/commands/remove-directory/index.d.ts +3 -0
- package/dist/commands/remove-directory/index.d.ts.map +1 -0
- package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +3 -35
- package/dist/commands/reset/index.d.ts +3 -0
- package/dist/commands/reset/index.d.ts.map +1 -0
- package/dist/commands/{reset-command.js → reset/index.js} +8 -11
- package/dist/commands/reset/types.d.ts +1 -0
- package/dist/commands/reset/types.d.ts.map +1 -0
- package/dist/commands/reset/types.js +3 -0
- package/dist/commands/resources/index.d.ts +3 -0
- package/dist/commands/resources/index.d.ts.map +1 -0
- package/dist/commands/resources/index.js +84 -0
- package/dist/commands/review/index.d.ts +3 -0
- package/dist/commands/review/index.d.ts.map +1 -0
- package/dist/commands/review/index.js +126 -0
- package/dist/commands/review/types.d.ts +12 -0
- package/dist/commands/review/types.d.ts.map +1 -0
- package/dist/commands/review/types.js +1 -0
- package/dist/commands/review/utils.d.ts +4 -0
- package/dist/commands/review/utils.d.ts.map +1 -0
- package/dist/commands/review/utils.js +87 -0
- package/dist/commands/save/index.d.ts +3 -0
- package/dist/commands/save/index.d.ts.map +1 -0
- package/dist/commands/{save-command.js → save/index.js} +3 -10
- package/dist/commands/session/index.d.ts +3 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +197 -0
- package/dist/commands/session/types.d.ts +13 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/shell/index.d.ts +3 -0
- package/dist/commands/shell/index.d.ts.map +1 -0
- package/dist/commands/{shell-command.js → shell/index.js} +4 -51
- package/dist/commands/types.d.ts +2 -5
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +36 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +118 -60
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +18 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +119 -81
- package/dist/formatting.d.ts +46 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +94 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +299 -177
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -11
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +3 -53
- package/dist/middleware/audit-message.d.ts +2 -2
- package/dist/middleware/audit-message.d.ts.map +1 -1
- package/dist/middleware/audit-message.js +40 -2
- package/dist/middleware/cache.d.ts +2 -2
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +111 -27
- package/dist/middleware/rate-limit.d.ts +2 -2
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +1 -0
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +46 -29
- package/dist/models/anthropic-provider.d.ts +14 -13
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +0 -7
- package/dist/models/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +7 -4
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +5 -25
- package/dist/models/openai-provider.d.ts +11 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/opencode-zen-provider.d.ts +23 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +76 -0
- package/dist/models/openrouter-provider.d.ts +34 -28
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +148 -139
- package/dist/models/providers.d.ts +6 -16
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +8 -58
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts/manager.d.ts +1 -1
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +1 -1
- package/dist/prompts.d.ts +8 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +155 -177
- package/dist/repl/project-status.d.ts +19 -0
- package/dist/repl/project-status.d.ts.map +1 -0
- package/dist/repl/project-status.js +78 -0
- package/dist/repl-new.d.ts +15 -6
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +266 -83
- package/dist/{messages.d.ts → sessions/manager.d.ts} +13 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +126 -16
- package/dist/skills.d.ts +16 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +233 -0
- package/dist/terminal/control.d.ts +56 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +111 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -26
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -53
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -101
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -464
- package/dist/terminal/keys.d.ts +211 -0
- package/dist/terminal/keys.d.ts.map +1 -0
- package/dist/terminal/keys.js +546 -0
- package/dist/terminal/segmenter.d.ts +6 -0
- package/dist/terminal/segmenter.d.ts.map +1 -0
- package/dist/terminal/segmenter.js +11 -0
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +9 -21
- package/dist/terminal/string-width.d.ts.map +1 -1
- package/dist/terminal/string-width.js +40 -21
- package/dist/terminal/strip-ansi.d.ts.map +1 -1
- package/dist/terminal/strip-ansi.js +9 -15
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +11 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +189 -81
- package/dist/tools/directory-tree.d.ts +9 -13
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +90 -60
- package/dist/tools/dynamic-tool-loader.d.ts +22 -8
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +41 -46
- package/dist/tools/edit-file.d.ts +6 -16
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +22 -66
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +78 -109
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -93
- package/dist/tools/index.d.ts +202 -167
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -273
- package/dist/tools/ls.d.ts +26 -0
- package/dist/tools/ls.d.ts.map +1 -0
- package/dist/tools/ls.js +80 -0
- package/dist/tools/read-file.d.ts +15 -15
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +52 -76
- package/dist/tools/save-file.d.ts +8 -8
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +42 -53
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -32
- package/dist/tools/types.d.ts +5 -21
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +0 -9
- package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
- package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/attachment-provider.js +159 -0
- package/dist/tui/autocomplete/base-provider.d.ts +17 -0
- package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/base-provider.js +1 -0
- package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
- package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/combined-provider.js +61 -0
- package/dist/tui/autocomplete/command-provider.d.ts +20 -0
- package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/command-provider.js +90 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/file-search-provider.js +123 -0
- package/dist/tui/autocomplete/path-provider.d.ts +21 -0
- package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/path-provider.js +164 -0
- package/dist/tui/autocomplete/utils.d.ts +16 -0
- package/dist/tui/autocomplete/utils.d.ts.map +1 -0
- package/dist/tui/autocomplete/utils.js +137 -0
- package/dist/tui/autocomplete.d.ts +12 -43
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +20 -465
- package/dist/tui/components/assistant-message.js +1 -1
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +87 -0
- package/dist/tui/components/editor.d.ts +61 -7
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +630 -127
- package/dist/tui/components/footer.d.ts +19 -18
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +90 -185
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +8 -7
- package/dist/tui/components/loader.d.ts +6 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +8 -3
- package/dist/tui/components/markdown.d.ts +31 -27
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +131 -67
- package/dist/tui/components/modal.d.ts +0 -11
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -37
- package/dist/tui/components/notification.d.ts +28 -0
- package/dist/tui/components/notification.d.ts.map +1 -0
- package/dist/tui/components/notification.js +63 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +66 -0
- package/dist/tui/components/select-list.d.ts +12 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +73 -32
- package/dist/tui/components/spacer.d.ts +1 -1
- package/dist/tui/components/spacer.d.ts.map +1 -1
- package/dist/tui/components/spacer.js +2 -2
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +4 -1
- package/dist/tui/components/tool-execution.d.ts +7 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +81 -85
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/components/welcome.d.ts +8 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/components/welcome.js +45 -6
- package/dist/tui/index.d.ts +12 -6
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +7 -3
- package/dist/tui/terminal.d.ts +4 -3
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +43 -49
- package/dist/tui/tui.d.ts +3 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +58 -43
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +80 -1
- package/dist/{tools/bash-utils.d.ts → utils/bash.d.ts} +3 -3
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +22 -11
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.d.ts → utils/filesystem/security.d.ts} +3 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +62 -4
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/yaml.d.ts +11 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +207 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +2 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +24 -0
- package/package.json +31 -29
- package/dist/agent/manual-loop.d.ts +0 -41
- package/dist/agent/manual-loop.d.ts.map +0 -1
- package/dist/agent/manual-loop.js +0 -278
- package/dist/api/exa/index.d.ts +0 -177
- package/dist/api/exa/index.d.ts.map +0 -1
- package/dist/api/exa/index.js +0 -439
- package/dist/commands/add-directory-command.d.ts +0 -3
- package/dist/commands/add-directory-command.d.ts.map +0 -1
- package/dist/commands/add-directory-command.js +0 -85
- package/dist/commands/application-log-command.d.ts +0 -3
- package/dist/commands/application-log-command.d.ts.map +0 -1
- package/dist/commands/application-log-command.js +0 -79
- package/dist/commands/clear-command.d.ts +0 -3
- package/dist/commands/clear-command.d.ts.map +0 -1
- package/dist/commands/compact-command.d.ts +0 -3
- package/dist/commands/compact-command.d.ts.map +0 -1
- package/dist/commands/compact-command.js +0 -64
- package/dist/commands/context-command.d.ts +0 -3
- package/dist/commands/context-command.d.ts.map +0 -1
- package/dist/commands/context-command.js +0 -183
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- package/dist/commands/copy-command.js +0 -80
- package/dist/commands/edit-command.d.ts +0 -3
- package/dist/commands/edit-command.d.ts.map +0 -1
- package/dist/commands/edit-command.js +0 -88
- package/dist/commands/edit-prompt-command.d.ts +0 -3
- package/dist/commands/edit-prompt-command.d.ts.map +0 -1
- package/dist/commands/edit-prompt-command.js +0 -61
- package/dist/commands/exit-command.d.ts +0 -13
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -46
- package/dist/commands/files-command.d.ts +0 -3
- package/dist/commands/files-command.d.ts.map +0 -1
- package/dist/commands/files-command.js +0 -121
- package/dist/commands/generate-rules-command.d.ts +0 -3
- package/dist/commands/generate-rules-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.d.ts +0 -3
- package/dist/commands/handoff-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.js +0 -202
- package/dist/commands/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -213
- package/dist/commands/help-command.d.ts +0 -3
- package/dist/commands/help-command.d.ts.map +0 -1
- package/dist/commands/history-command.d.ts +0 -3
- package/dist/commands/history-command.d.ts.map +0 -1
- package/dist/commands/init-command.d.ts +0 -3
- package/dist/commands/init-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.d.ts +0 -3
- package/dist/commands/last-log-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.js +0 -98
- package/dist/commands/list-directories-command.d.ts +0 -3
- package/dist/commands/list-directories-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.d.ts +0 -3
- package/dist/commands/list-tools-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.js +0 -124
- package/dist/commands/model-command.d.ts +0 -25
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/model-command.js +0 -340
- package/dist/commands/paste-command.d.ts +0 -3
- package/dist/commands/paste-command.d.ts.map +0 -1
- package/dist/commands/paste-command.js +0 -277
- package/dist/commands/pickup-command.d.ts +0 -3
- package/dist/commands/pickup-command.d.ts.map +0 -1
- package/dist/commands/pickup-command.js +0 -161
- package/dist/commands/prompt-command.d.ts +0 -3
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -280
- package/dist/commands/remove-directory-command.d.ts +0 -3
- package/dist/commands/remove-directory-command.d.ts.map +0 -1
- package/dist/commands/reset-command.d.ts +0 -3
- package/dist/commands/reset-command.d.ts.map +0 -1
- package/dist/commands/rules-command.d.ts +0 -3
- package/dist/commands/rules-command.d.ts.map +0 -1
- package/dist/commands/rules-command.js +0 -135
- package/dist/commands/save-command.d.ts +0 -3
- package/dist/commands/save-command.d.ts.map +0 -1
- package/dist/commands/shell-command.d.ts +0 -3
- package/dist/commands/shell-command.d.ts.map +0 -1
- package/dist/commands/usage-command.d.ts +0 -3
- package/dist/commands/usage-command.d.ts.map +0 -1
- package/dist/commands/usage-command.js +0 -42
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -58
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -9
- package/dist/repl/project-status-line.d.ts +0 -2
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -31
- package/dist/repl/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- package/dist/repl/tool-call-repair.d.ts +0 -4
- package/dist/repl/tool-call-repair.d.ts.map +0 -1
- package/dist/repl/tool-call-repair.js +0 -54
- package/dist/repl.d.ts +0 -29
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -218
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -368
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -17
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -118
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -280
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/tokens/threshold.d.ts +0 -35
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -85
- package/dist/tools/advanced-edit-file.d.ts +0 -69
- package/dist/tools/advanced-edit-file.d.ts.map +0 -1
- package/dist/tools/advanced-edit-file.js +0 -281
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -103
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/code-interpreter.d.ts +0 -25
- package/dist/tools/code-interpreter.d.ts.map +0 -1
- package/dist/tools/code-interpreter.js +0 -167
- package/dist/tools/delete-file.d.ts +0 -24
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/delete-file.js +0 -70
- package/dist/tools/dynamic-tool-parser.d.ts +0 -21
- package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
- package/dist/tools/dynamic-tool-parser.js +0 -22
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -25
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -150
- package/dist/tools/move-file.d.ts +0 -26
- package/dist/tools/move-file.d.ts.map +0 -1
- package/dist/tools/move-file.js +0 -58
- package/dist/tools/read-multiple-files.d.ts +0 -26
- package/dist/tools/read-multiple-files.d.ts.map +0 -1
- package/dist/tools/read-multiple-files.js +0 -139
- package/dist/tools/web-fetch.d.ts +0 -56
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -247
- package/dist/tools/web-search.d.ts +0 -23
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -133
- package/dist/tui/components/prompt-status.d.ts +0 -16
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -21
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- package/dist/utils/zod-utils.js +0 -7
- /package/dist/{terminal → commands/add-directory}/types.js +0 -0
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { joinWorkingDir, validatePath } from "./filesystem-utils.js";
|
|
6
|
-
export const DeleteFileTool = {
|
|
7
|
-
name: "deleteFile",
|
|
8
|
-
};
|
|
9
|
-
const inputSchema = z.object({
|
|
10
|
-
path: z.string().describe("Absolute path to the file to delete"),
|
|
11
|
-
});
|
|
12
|
-
export const createDeleteFileTool = async ({ workingDir, allowedDirs, }) => {
|
|
13
|
-
const allowedDirectory = allowedDirs ?? [workingDir];
|
|
14
|
-
return {
|
|
15
|
-
toolDef: {
|
|
16
|
-
description: "Delete a file permanently.",
|
|
17
|
-
inputSchema,
|
|
18
|
-
},
|
|
19
|
-
async *execute({ path: userPath }, { toolCallId, abortSignal }) {
|
|
20
|
-
try {
|
|
21
|
-
if (abortSignal?.aborted) {
|
|
22
|
-
throw new Error("File deletion aborted");
|
|
23
|
-
}
|
|
24
|
-
yield {
|
|
25
|
-
name: DeleteFileTool.name,
|
|
26
|
-
id: toolCallId,
|
|
27
|
-
event: "tool-init",
|
|
28
|
-
data: `${style.cyan(userPath)}`,
|
|
29
|
-
};
|
|
30
|
-
const filePath = await validatePath(joinWorkingDir(userPath, workingDir), allowedDirectory, { abortSignal });
|
|
31
|
-
// Check if file exists before attempting delete
|
|
32
|
-
if (!existsSync(filePath)) {
|
|
33
|
-
throw new Error(`File not found: ${filePath}`);
|
|
34
|
-
}
|
|
35
|
-
// Pre-check for stat
|
|
36
|
-
if (abortSignal?.aborted) {
|
|
37
|
-
throw new Error("File deletion aborted before stat");
|
|
38
|
-
}
|
|
39
|
-
// Ensure it's a file, not a directory
|
|
40
|
-
const stats = await fs.stat(filePath);
|
|
41
|
-
if (stats.isDirectory()) {
|
|
42
|
-
throw new Error(`Path is a directory, not a file: ${filePath}`);
|
|
43
|
-
}
|
|
44
|
-
// Pre-side-effect check
|
|
45
|
-
if (abortSignal?.aborted) {
|
|
46
|
-
throw new Error("File deletion aborted before unlink");
|
|
47
|
-
}
|
|
48
|
-
// Delete the file with signal
|
|
49
|
-
await fs.unlink(filePath);
|
|
50
|
-
yield {
|
|
51
|
-
name: DeleteFileTool.name,
|
|
52
|
-
id: toolCallId,
|
|
53
|
-
event: "tool-completion",
|
|
54
|
-
data: "File deleted",
|
|
55
|
-
};
|
|
56
|
-
yield `Successfully deleted ${filePath}`;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
const errorMessage = error.message;
|
|
60
|
-
yield {
|
|
61
|
-
name: DeleteFileTool.name,
|
|
62
|
-
id: toolCallId,
|
|
63
|
-
event: "tool-error",
|
|
64
|
-
data: errorMessage,
|
|
65
|
-
};
|
|
66
|
-
yield errorMessage;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const toolMetadataSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
description: z.ZodString;
|
|
5
|
-
parameters: z.ZodArray<z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
type: z.ZodEnum<{
|
|
8
|
-
string: "string";
|
|
9
|
-
number: "number";
|
|
10
|
-
boolean: "boolean";
|
|
11
|
-
}>;
|
|
12
|
-
description: z.ZodString;
|
|
13
|
-
required: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
-
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
needsApproval: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export type ToolMetadata = z.infer<typeof toolMetadataSchema>;
|
|
19
|
-
export declare function parseToolMetadata(output: string): ToolMetadata;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=dynamic-tool-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-tool-parser.d.ts","sourceRoot":"","sources":["../../source/tools/dynamic-tool-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;iBAatB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS9D"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
const toolMetadataSchema = z.object({
|
|
3
|
-
name: z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_-]*$/),
|
|
4
|
-
description: z.string().min(1),
|
|
5
|
-
parameters: z.array(z.object({
|
|
6
|
-
name: z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_-]*$/),
|
|
7
|
-
type: z.enum(["string", "number", "boolean"]),
|
|
8
|
-
description: z.string().min(1),
|
|
9
|
-
required: z.boolean().default(true),
|
|
10
|
-
default: z.union([z.string(), z.number(), z.boolean()]).optional(),
|
|
11
|
-
})),
|
|
12
|
-
needsApproval: z.boolean().default(true),
|
|
13
|
-
});
|
|
14
|
-
export function parseToolMetadata(output) {
|
|
15
|
-
try {
|
|
16
|
-
const parsed = JSON.parse(output.trim());
|
|
17
|
-
return toolMetadataSchema.parse(parsed);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new Error(`Failed to parse tool metadata: ${error instanceof Error ? error.message : String(error)}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-utils.d.ts","sourceRoot":"","sources":["../../source/tools/filesystem-utils.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAK3E;AAUD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAGD,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAIT;AAGD,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,EACnC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GACtE,OAAO,CAAC,MAAM,CAAC,CAwHjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../source/tools/git-utils.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW;;;;GAyDhC;AAED,wBAAsB,YAAY;;;;;GAmCjC;AAED,eAAO,MAAM,cAAc,QAAqB,OAAO,CAAC,OAAO,CAS7D,CAAC;AAEH;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAgB9D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsB/D"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ModelManager } from "../models/manager.ts";
|
|
3
|
-
declare const SearchReplaceEditSchema: z.ZodObject<{
|
|
4
|
-
search: z.ZodString;
|
|
5
|
-
replace: z.ZodString;
|
|
6
|
-
noChangesRequired: z.ZodBoolean;
|
|
7
|
-
explanation: z.ZodString;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
type SearchReplaceEdit = z.infer<typeof SearchReplaceEditSchema>;
|
|
10
|
-
/**
|
|
11
|
-
* Attempts to fix a failed edit by using an LLM to generate a new search and replace pair.
|
|
12
|
-
*
|
|
13
|
-
* @param instruction The instruction for what needs to be done. If not provided, will auto-generate from oldString/newString
|
|
14
|
-
* @param oldString The original string to be replaced
|
|
15
|
-
* @param newString The original replacement string
|
|
16
|
-
* @param error The error that occurred during the initial edit
|
|
17
|
-
* @param currentContent The current content of the file
|
|
18
|
-
* @param modelManager The model manager for accessing LLM models
|
|
19
|
-
* @param tokenTracker The token tracker for usage monitoring
|
|
20
|
-
* @param abortSignal An abort signal to cancel the operation
|
|
21
|
-
* @returns A corrected search and replace pair, or null if fixing failed
|
|
22
|
-
*/
|
|
23
|
-
export declare function fixLlmEditWithInstruction(instruction: string | undefined, oldString: string, newString: string, error: string, currentContent: string, modelManager: ModelManager | undefined, abortSignal?: AbortSignal): Promise<SearchReplaceEdit | null>;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=llm-edit-fixer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-edit-fixer.d.ts","sourceRoot":"","sources":["../../source/tools/llm-edit-fixer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAyDzD,QAAA,MAAM,uBAAuB;;;;;iBAK3B,CAAC;AAEH,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAuEjE;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAyCnC"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { logger } from "../logger.js";
|
|
3
|
-
const GENERATE_JSON_TIMEOUT_MS = 40000; // 40 seconds
|
|
4
|
-
const EDIT_SYS_PROMPT = `
|
|
5
|
-
You are an expert code-editing assistant specializing in debugging and correcting failed search-and-replace operations.
|
|
6
|
-
|
|
7
|
-
# Primary Goal
|
|
8
|
-
Your task is to analyze a failed edit attempt and provide a corrected \`search\` string that will match the text in the file precisely. The correction should be as minimal as possible, staying very close to the original, failed \`search\` string. Do NOT invent a completely new edit based on the instruction; your job is to fix the provided parameters.
|
|
9
|
-
|
|
10
|
-
It is important that you do no try to figure out if the instruction is correct. DO NOT GIVE ADVICE. Your only goal here is to do your best to perform the search and replace task!
|
|
11
|
-
|
|
12
|
-
# Input Context
|
|
13
|
-
You will be given:
|
|
14
|
-
1. The high-level instruction for the original edit.
|
|
15
|
-
2. The exact \`search\` and \`replace\` strings that failed.
|
|
16
|
-
3. The error message that was produced.
|
|
17
|
-
4. The full content of the latest version of the source file.
|
|
18
|
-
|
|
19
|
-
# Rules for Correction
|
|
20
|
-
1. **Minimal Correction:** Your new \`search\` string must be a close variation of the original. Focus on fixing issues like whitespace, indentation, line endings, or small contextual differences.
|
|
21
|
-
2. **Explain the Fix:** Your \`explanation\` MUST state exactly why the original \`search\` failed and how your new \`search\` string resolves that specific failure. (e.g., "The original search failed due to incorrect indentation; the new search corrects the indentation to match the source file.").
|
|
22
|
-
3. **Preserve the \`replace\` String:** Do NOT modify the \`replace\` string unless the instruction explicitly requires it and it was the source of the error. Do not escape any characters in \`replace\`. Your primary focus is fixing the \`search\` string.
|
|
23
|
-
4. **No Changes Case:** CRUCIAL: if the change is already present in the file, set \`noChangesRequired\` to True and explain why in the \`explanation\`. It is crucial that you only do this if the changes outline in \`replace\` are already in the file and suits the instruction.
|
|
24
|
-
5. **Exactness:** The final \`search\` field must be the EXACT literal text from the file. Do not escape characters.
|
|
25
|
-
`;
|
|
26
|
-
const EDIT_USER_PROMPT = `
|
|
27
|
-
# Goal of the Original Edit
|
|
28
|
-
<instruction>
|
|
29
|
-
{instruction}
|
|
30
|
-
</instruction>
|
|
31
|
-
|
|
32
|
-
# Failed Attempt Details
|
|
33
|
-
- **Original \`search\` parameter (failed):**
|
|
34
|
-
<search>
|
|
35
|
-
{old_string}
|
|
36
|
-
</search>
|
|
37
|
-
- **Original \`replace\` parameter:**
|
|
38
|
-
<replace>
|
|
39
|
-
{new_string}
|
|
40
|
-
</replace>
|
|
41
|
-
- **Error Encountered:**
|
|
42
|
-
<error>
|
|
43
|
-
{error}
|
|
44
|
-
</error>
|
|
45
|
-
|
|
46
|
-
# Full File Content
|
|
47
|
-
<file_content>
|
|
48
|
-
{current_content}
|
|
49
|
-
</file_content>
|
|
50
|
-
|
|
51
|
-
# Your Task
|
|
52
|
-
Based on the error and the file content, provide a corrected \`search\` string that will succeed. Remember to keep your correction minimal and explain the precise reason for the failure in your \`explanation\`.
|
|
53
|
-
`;
|
|
54
|
-
// Zod schema for the LLM response
|
|
55
|
-
const SearchReplaceEditSchema = z.object({
|
|
56
|
-
search: z.string(),
|
|
57
|
-
replace: z.string(),
|
|
58
|
-
noChangesRequired: z.boolean(),
|
|
59
|
-
explanation: z.string(),
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Auto-generates an instruction based on edit parameters when none is provided
|
|
63
|
-
*/
|
|
64
|
-
function autoGenerateInstruction(oldString, newString) {
|
|
65
|
-
// Create a natural language description of the edit intent
|
|
66
|
-
const oldPreview = oldString.length > 50 ? `${oldString.slice(0, 47)}...` : oldString;
|
|
67
|
-
const newPreview = newString.length > 50 ? `${newString.slice(0, 47)}...` : newString;
|
|
68
|
-
return `Replace "${oldPreview}" with "${newPreview}"`;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Generates JSON with timeout and proper error handling
|
|
72
|
-
*/
|
|
73
|
-
async function generateJsonWithTimeout(modelManager, params, timeoutMs) {
|
|
74
|
-
try {
|
|
75
|
-
const controller = new AbortController();
|
|
76
|
-
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
77
|
-
// Combine abort signals
|
|
78
|
-
const combinedSignal = AbortSignal.any([
|
|
79
|
-
params.abortSignal ?? new AbortController().signal,
|
|
80
|
-
timeoutSignal,
|
|
81
|
-
controller.signal,
|
|
82
|
-
]);
|
|
83
|
-
if (!modelManager) {
|
|
84
|
-
throw new Error("Edit-fix model not available");
|
|
85
|
-
}
|
|
86
|
-
const { text } = await modelManager.getText("edit-fix", params.system, params.prompt, combinedSignal);
|
|
87
|
-
// Parse the JSON response
|
|
88
|
-
try {
|
|
89
|
-
const parsed = JSON.parse(text);
|
|
90
|
-
return parsed;
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
logger.error(error, "Failed to parse LLM response as JSON.");
|
|
94
|
-
logger.info(`Response preview: ${text.slice(0, 500)}`);
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
100
|
-
logger.warn(`LLM edit fix operation timed out. Timeout: ${timeoutMs}ms`);
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
logger.error(`LLM edit fix operation failed. Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Attempts to fix a failed edit by using an LLM to generate a new search and replace pair.
|
|
109
|
-
*
|
|
110
|
-
* @param instruction The instruction for what needs to be done. If not provided, will auto-generate from oldString/newString
|
|
111
|
-
* @param oldString The original string to be replaced
|
|
112
|
-
* @param newString The original replacement string
|
|
113
|
-
* @param error The error that occurred during the initial edit
|
|
114
|
-
* @param currentContent The current content of the file
|
|
115
|
-
* @param modelManager The model manager for accessing LLM models
|
|
116
|
-
* @param tokenTracker The token tracker for usage monitoring
|
|
117
|
-
* @param abortSignal An abort signal to cancel the operation
|
|
118
|
-
* @returns A corrected search and replace pair, or null if fixing failed
|
|
119
|
-
*/
|
|
120
|
-
export async function fixLlmEditWithInstruction(instruction, oldString, newString, error, currentContent, modelManager, abortSignal) {
|
|
121
|
-
// If no modelManager is available, return null (LLM fix not available)
|
|
122
|
-
if (!modelManager) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
const finalInstruction = instruction || autoGenerateInstruction(oldString, newString);
|
|
126
|
-
// Generate the user prompt with substitutions
|
|
127
|
-
const userPrompt = EDIT_USER_PROMPT.replace("{instruction}", finalInstruction)
|
|
128
|
-
.replace("{old_string}", oldString)
|
|
129
|
-
.replace("{new_string}", newString)
|
|
130
|
-
.replace("{error}", error)
|
|
131
|
-
.replace("{current_content}", currentContent);
|
|
132
|
-
const result = await generateJsonWithTimeout(modelManager, {
|
|
133
|
-
system: EDIT_SYS_PROMPT,
|
|
134
|
-
prompt: userPrompt,
|
|
135
|
-
abortSignal,
|
|
136
|
-
}, GENERATE_JSON_TIMEOUT_MS);
|
|
137
|
-
// Validate the result with Zod schema
|
|
138
|
-
if (result) {
|
|
139
|
-
try {
|
|
140
|
-
const validatedResult = SearchReplaceEditSchema.parse(result);
|
|
141
|
-
logger.info("LLM edit fix successful.");
|
|
142
|
-
return validatedResult;
|
|
143
|
-
}
|
|
144
|
-
catch (validationError) {
|
|
145
|
-
logger.error(`LLM edit fix response validation failed. Error: ${validationError instanceof Error ? validationError.message : "Unknown validation error"}`);
|
|
146
|
-
console.info("Response:", result);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { ToolResult } from "./types.ts";
|
|
4
|
-
export declare const MoveFileTool: {
|
|
5
|
-
name: "moveFile";
|
|
6
|
-
};
|
|
7
|
-
declare const inputSchema: z.ZodObject<{
|
|
8
|
-
source: z.ZodString;
|
|
9
|
-
destination: z.ZodString;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
type MoveFileInputSchema = z.infer<typeof inputSchema>;
|
|
12
|
-
export declare const createMoveFileTool: ({ workingDir, allowedDirs, }: {
|
|
13
|
-
workingDir: string;
|
|
14
|
-
allowedDirs?: string[];
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
toolDef: {
|
|
17
|
-
description: string;
|
|
18
|
-
inputSchema: z.ZodObject<{
|
|
19
|
-
source: z.ZodString;
|
|
20
|
-
destination: z.ZodString;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
};
|
|
23
|
-
execute({ source, destination }: MoveFileInputSchema, { toolCallId, abortSignal }: ToolCallOptions): AsyncGenerator<ToolResult>;
|
|
24
|
-
}>;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=move-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-file.d.ts","sourceRoot":"","sources":["../../source/tools/move-file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAGf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,8BAGtC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;qCAY8B,mBAAmB,+BACf,eAAe,GAC3C,cAAc,CAAC,UAAU,CAAC;EAkDhC,CAAC"}
|
package/dist/tools/move-file.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { joinWorkingDir, validatePath } from "./filesystem-utils.js";
|
|
5
|
-
export const MoveFileTool = {
|
|
6
|
-
name: "moveFile",
|
|
7
|
-
};
|
|
8
|
-
const inputSchema = z.object({
|
|
9
|
-
source: z.string(),
|
|
10
|
-
destination: z.string(),
|
|
11
|
-
});
|
|
12
|
-
export const createMoveFileTool = async ({ workingDir, allowedDirs, }) => {
|
|
13
|
-
const allowedDirectory = allowedDirs ?? [workingDir];
|
|
14
|
-
return {
|
|
15
|
-
toolDef: {
|
|
16
|
-
description: "Move or rename files and directories. Can move files between directories " +
|
|
17
|
-
"and rename them in a single operation. If the destination exists, the " +
|
|
18
|
-
"operation will fail. Works across different directories and can be used " +
|
|
19
|
-
"for simple renaming within the same directory. Both source and destination must be within allowed directories.",
|
|
20
|
-
inputSchema,
|
|
21
|
-
},
|
|
22
|
-
async *execute({ source, destination }, { toolCallId, abortSignal }) {
|
|
23
|
-
try {
|
|
24
|
-
if (abortSignal?.aborted) {
|
|
25
|
-
throw new Error("File move aborted");
|
|
26
|
-
}
|
|
27
|
-
yield {
|
|
28
|
-
name: MoveFileTool.name,
|
|
29
|
-
id: toolCallId,
|
|
30
|
-
event: "tool-init",
|
|
31
|
-
data: `${style.cyan(source)} => ${style.cyan(destination)}`,
|
|
32
|
-
};
|
|
33
|
-
const validSourcePath = await validatePath(joinWorkingDir(source, workingDir), allowedDirectory, { abortSignal });
|
|
34
|
-
const validDestPath = await validatePath(joinWorkingDir(destination, workingDir), allowedDirectory, { requireExistence: false, abortSignal });
|
|
35
|
-
if (abortSignal?.aborted) {
|
|
36
|
-
throw new Error("File move aborted before file operation");
|
|
37
|
-
}
|
|
38
|
-
await fs.rename(validSourcePath, validDestPath);
|
|
39
|
-
yield {
|
|
40
|
-
name: MoveFileTool.name,
|
|
41
|
-
id: toolCallId,
|
|
42
|
-
event: "tool-completion",
|
|
43
|
-
data: "File moved",
|
|
44
|
-
};
|
|
45
|
-
yield `Successfully moved ${source} to ${destination}`;
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
yield {
|
|
49
|
-
name: MoveFileTool.name,
|
|
50
|
-
event: "tool-error",
|
|
51
|
-
id: toolCallId,
|
|
52
|
-
data: error.message,
|
|
53
|
-
};
|
|
54
|
-
yield `Failed to move file: ${error.message}`;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { TokenCounter } from "../tokens/counter.ts";
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
5
|
-
export declare const ReadMultipleFilesTool: {
|
|
6
|
-
name: "readMultipleFiles";
|
|
7
|
-
};
|
|
8
|
-
declare const inputSchema: z.ZodObject<{
|
|
9
|
-
paths: z.ZodArray<z.ZodString>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
type ReadMultipleFilesInputSchema = z.infer<typeof inputSchema>;
|
|
12
|
-
export declare const createReadMultipleFilesTool: ({ workingDir, allowedDirs, tokenCounter, }: {
|
|
13
|
-
workingDir: string;
|
|
14
|
-
allowedDirs?: string[];
|
|
15
|
-
tokenCounter: TokenCounter;
|
|
16
|
-
}) => Promise<{
|
|
17
|
-
toolDef: {
|
|
18
|
-
description: string;
|
|
19
|
-
inputSchema: z.ZodObject<{
|
|
20
|
-
paths: z.ZodArray<z.ZodString>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
};
|
|
23
|
-
execute({ paths }: ReadMultipleFilesInputSchema, { toolCallId, abortSignal }: ToolCallOptions): AsyncGenerator<ToolResult>;
|
|
24
|
-
}>;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=read-multiple-files.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-multiple-files.d.ts","sourceRoot":"","sources":["../../source/tools/read-multiple-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,qBAAqB;;CAEjC,CAAC;AAEF,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAEH,KAAK,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhE,eAAO,MAAM,2BAA2B,GAAU,4CAI/C;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;CAC5B;;;;;;;uBAcgB,4BAA4B,+BACV,eAAe,GAC3C,cAAc,CAAC,UAAU,CAAC;EAwIhC,CAAC"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { formatFile } from "../formatting.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { manageTokenLimit } from "../tokens/threshold.js";
|
|
6
|
-
import { joinWorkingDir, validatePath } from "./filesystem-utils.js";
|
|
7
|
-
export const ReadMultipleFilesTool = {
|
|
8
|
-
name: "readMultipleFiles",
|
|
9
|
-
};
|
|
10
|
-
const inputSchema = z.object({
|
|
11
|
-
paths: z.array(z.string()),
|
|
12
|
-
});
|
|
13
|
-
export const createReadMultipleFilesTool = async ({ workingDir, allowedDirs, tokenCounter, }) => {
|
|
14
|
-
const allowedDirectory = allowedDirs ?? [workingDir];
|
|
15
|
-
return {
|
|
16
|
-
toolDef: {
|
|
17
|
-
description: "Read the contents of multiple files simultaneously. This is more " +
|
|
18
|
-
"efficient than reading files one by one when you need to analyze " +
|
|
19
|
-
"or compare multiple files. Each file's content is returned with its " +
|
|
20
|
-
"path as a reference. Failed reads for individual files won't stop " +
|
|
21
|
-
"the entire operation. Only works within allowed directories.",
|
|
22
|
-
inputSchema,
|
|
23
|
-
},
|
|
24
|
-
async *execute({ paths }, { toolCallId, abortSignal }) {
|
|
25
|
-
try {
|
|
26
|
-
// Check if execution has been aborted
|
|
27
|
-
if (abortSignal?.aborted) {
|
|
28
|
-
throw new Error("Multiple file reading aborted");
|
|
29
|
-
}
|
|
30
|
-
yield {
|
|
31
|
-
name: ReadMultipleFilesTool.name,
|
|
32
|
-
id: toolCallId,
|
|
33
|
-
event: "tool-init",
|
|
34
|
-
data: `${paths.map((p) => style.cyan(p)).join(", ")}`,
|
|
35
|
-
};
|
|
36
|
-
if (abortSignal?.aborted) {
|
|
37
|
-
throw new Error("Multiple file reading aborted before reading files");
|
|
38
|
-
}
|
|
39
|
-
const results = await Promise.all(paths.map(async (filePath) => {
|
|
40
|
-
if (abortSignal?.aborted) {
|
|
41
|
-
throw new Error("Multiple file reading aborted during file processing");
|
|
42
|
-
}
|
|
43
|
-
const fileResult = await validateAndReadFile(filePath, workingDir, allowedDirectory);
|
|
44
|
-
return fileResult;
|
|
45
|
-
}));
|
|
46
|
-
const processedResults = await Promise.all(results.map(async (result) => {
|
|
47
|
-
if (result.error) {
|
|
48
|
-
return {
|
|
49
|
-
path: result.path,
|
|
50
|
-
content: `${result.path}: Error - ${result.error}`,
|
|
51
|
-
tokenCount: 0,
|
|
52
|
-
error: result.error,
|
|
53
|
-
truncated: false,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
// Apply token limit check to each file
|
|
57
|
-
const managedResult = await manageTokenLimit(result.content ?? "", tokenCounter, "ReadMultipleFiles", "Use readFile with startLine/lineCount or grepFiles for targeted access");
|
|
58
|
-
return {
|
|
59
|
-
path: result.path,
|
|
60
|
-
content: formatFile(result.path, managedResult.content, "markdown"),
|
|
61
|
-
tokenCount: managedResult.tokenCount,
|
|
62
|
-
error: null,
|
|
63
|
-
truncated: managedResult.truncated,
|
|
64
|
-
};
|
|
65
|
-
}));
|
|
66
|
-
const formattedResults = processedResults.map((r) => r.content);
|
|
67
|
-
const finalResult = await manageTokenLimit(formattedResults.join("\n---\n"), tokenCounter, "ReadMultipleFiles", "Reduce number of files or use more specific paths");
|
|
68
|
-
// Aggregate results with detailed breakdown
|
|
69
|
-
let totalTokens = 0;
|
|
70
|
-
let filesReadCount = 0;
|
|
71
|
-
let filesExceededLimitCount = 0;
|
|
72
|
-
let filesErrorCount = 0;
|
|
73
|
-
for (const processedResult of processedResults) {
|
|
74
|
-
if (processedResult.error) {
|
|
75
|
-
filesErrorCount++;
|
|
76
|
-
}
|
|
77
|
-
else if (processedResult.truncated) {
|
|
78
|
-
filesExceededLimitCount++;
|
|
79
|
-
totalTokens += processedResult.tokenCount;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
filesReadCount++;
|
|
83
|
-
totalTokens += processedResult.tokenCount;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const parts = [];
|
|
87
|
-
if (filesReadCount > 0) {
|
|
88
|
-
parts.push(`Read ${filesReadCount} files successfully (${totalTokens} total tokens)`);
|
|
89
|
-
}
|
|
90
|
-
if (filesExceededLimitCount > 0) {
|
|
91
|
-
parts.push(`${filesExceededLimitCount} files exceeded token limit`);
|
|
92
|
-
}
|
|
93
|
-
if (filesErrorCount > 0) {
|
|
94
|
-
parts.push(`${filesErrorCount} files could not be read`);
|
|
95
|
-
}
|
|
96
|
-
if (finalResult.truncated) {
|
|
97
|
-
parts.push(`Combined output exceeded token limit. ${finalResult.content}`);
|
|
98
|
-
}
|
|
99
|
-
const completionMessage = `${parts.join(", ")}.`;
|
|
100
|
-
yield {
|
|
101
|
-
name: ReadMultipleFilesTool.name,
|
|
102
|
-
id: toolCallId,
|
|
103
|
-
event: "tool-completion",
|
|
104
|
-
data: completionMessage,
|
|
105
|
-
};
|
|
106
|
-
yield finalResult.content;
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
const errorMsg = error.message;
|
|
110
|
-
yield {
|
|
111
|
-
name: ReadMultipleFilesTool.name,
|
|
112
|
-
id: toolCallId,
|
|
113
|
-
event: "tool-error",
|
|
114
|
-
data: errorMsg,
|
|
115
|
-
};
|
|
116
|
-
yield errorMsg;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
async function validateAndReadFile(filePath, workingDir, allowedDirectory) {
|
|
122
|
-
try {
|
|
123
|
-
const validPath = await validatePath(joinWorkingDir(filePath, workingDir), allowedDirectory);
|
|
124
|
-
const content = await readFile(validPath, "utf-8");
|
|
125
|
-
return {
|
|
126
|
-
path: filePath,
|
|
127
|
-
content,
|
|
128
|
-
error: null,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
133
|
-
return {
|
|
134
|
-
path: filePath,
|
|
135
|
-
content: null,
|
|
136
|
-
error: errorMessage,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { TokenCounter } from "../tokens/counter.ts";
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
5
|
-
export declare const WebFetchTool: {
|
|
6
|
-
name: "webFetch";
|
|
7
|
-
};
|
|
8
|
-
export declare const createWebFetchTool: (options: {
|
|
9
|
-
tokenCounter: TokenCounter;
|
|
10
|
-
}) => {
|
|
11
|
-
toolDef: {
|
|
12
|
-
description: string;
|
|
13
|
-
inputSchema: z.ZodObject<{
|
|
14
|
-
url: z.ZodString;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
};
|
|
17
|
-
execute({ url }: {
|
|
18
|
-
url: string;
|
|
19
|
-
}, { toolCallId, abortSignal }: ToolCallOptions): AsyncGenerator<ToolResult>;
|
|
20
|
-
};
|
|
21
|
-
type ContentType = "text/plain" | "text/html" | "text/markdown" | "application/json" | "application/xml" | "application/pdf" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml" | "audio/mpeg" | "audio/wav" | "video/mp4" | "video/webm" | "application/zip" | "application/octet-stream";
|
|
22
|
-
export type ReadUrlResult = {
|
|
23
|
-
contentType: ContentType;
|
|
24
|
-
data: string;
|
|
25
|
-
};
|
|
26
|
-
export declare function readUrl(url: string, abortSignal?: AbortSignal | undefined): Promise<ReadUrlResult>;
|
|
27
|
-
export declare class HtmlCleaner {
|
|
28
|
-
static new(html: string): HtmlCleaner;
|
|
29
|
-
private html;
|
|
30
|
-
private constructor();
|
|
31
|
-
/**
|
|
32
|
-
* Cleans HTML content by removing unnecessary elements and simplifying structure
|
|
33
|
-
* @param {Object} [options] - Configuration options for cleaning
|
|
34
|
-
* @param {boolean} [options.simplify=true] - Whether to simplify HTML structure by removing redundant elements
|
|
35
|
-
* @param {boolean} [options.empty=true] - Whether to remove empty elements from the HTML
|
|
36
|
-
* @returns {string} Cleaned HTML content with removed whitespace and line breaks
|
|
37
|
-
*/
|
|
38
|
-
clean(options?: {
|
|
39
|
-
simplify?: boolean;
|
|
40
|
-
empty?: boolean;
|
|
41
|
-
}): string;
|
|
42
|
-
/**
|
|
43
|
-
* Removes scripts, styles, and comments from HTML
|
|
44
|
-
*/
|
|
45
|
-
private removeUnnecessaryElements;
|
|
46
|
-
/**
|
|
47
|
-
* Simplifies HTML structure by merging redundant tags
|
|
48
|
-
*/
|
|
49
|
-
private simplifyStructure;
|
|
50
|
-
/**
|
|
51
|
-
* Removes empty elements from HTML
|
|
52
|
-
*/
|
|
53
|
-
private removeEmptyElements;
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
56
|
-
//# sourceMappingURL=web-fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-fetch.d.ts","sourceRoot":"","sources":["../../source/tools/web-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,YAAY;;CAExB,CAAC;AAMF,eAAO,MAAM,kBAAkB,GAAI,SAAS;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE;;;;;;;qBAQ3D;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,+BACK,eAAe,GAC3C,cAAc,CAAC,UAAU,CAAC;CAmChC,CAAC;AAEF,KAAK,WAAW,GACZ,YAAY,GACZ,WAAW,GACX,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,WAAW,GACX,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,0BAA0B,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,wBAAsB,OAAO,CAC3B,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,GACpC,OAAO,CAAC,aAAa,CAAC,CA6HxB;AAED,qBAAa,WAAW;IACtB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAIrC,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAIP;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAuBhE;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAyCjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAG5B"}
|