@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
package/dist/tools/web-fetch.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { load } from "cheerio";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { logger } from "../logger.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
export const WebFetchTool = {
|
|
6
|
-
name: "webFetch",
|
|
7
|
-
};
|
|
8
|
-
const inputSchema = z.object({
|
|
9
|
-
url: z.string().describe("The URL to fetch content from."),
|
|
10
|
-
});
|
|
11
|
-
export const createWebFetchTool = (options) => {
|
|
12
|
-
return {
|
|
13
|
-
toolDef: {
|
|
14
|
-
description: "Fetches the content of a given URL. It intelligently handles HTML content by attempting to use a specialized service for cleaner extraction, falling back to local cleaning if needed. For non-HTML content (like plain text or markdown), it fetches the raw content directly. IMPORTANT: Does not retrieve binary files.",
|
|
15
|
-
inputSchema,
|
|
16
|
-
},
|
|
17
|
-
async *execute({ url }, { toolCallId, abortSignal }) {
|
|
18
|
-
try {
|
|
19
|
-
yield {
|
|
20
|
-
name: WebFetchTool.name,
|
|
21
|
-
event: "tool-init",
|
|
22
|
-
id: toolCallId,
|
|
23
|
-
data: `${style.cyan(url)}`,
|
|
24
|
-
};
|
|
25
|
-
logger.info(`Initiating fetch for URL: ${url}`);
|
|
26
|
-
const result = await readUrl(url, abortSignal);
|
|
27
|
-
const urlContent = result.data;
|
|
28
|
-
const tokenCount = options.tokenCounter.count(urlContent);
|
|
29
|
-
yield {
|
|
30
|
-
name: WebFetchTool.name,
|
|
31
|
-
event: "tool-completion",
|
|
32
|
-
id: toolCallId,
|
|
33
|
-
data: `Fetched URL (${tokenCount} tokens)`,
|
|
34
|
-
};
|
|
35
|
-
logger.info(`Successfully read URL: ${url} (${tokenCount} tokens)`);
|
|
36
|
-
yield urlContent;
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
const errorMessage = error.message;
|
|
40
|
-
yield {
|
|
41
|
-
name: WebFetchTool.name,
|
|
42
|
-
event: "tool-error",
|
|
43
|
-
id: toolCallId,
|
|
44
|
-
data: `${style.cyan(url)} ${errorMessage}`,
|
|
45
|
-
};
|
|
46
|
-
logger.error(`Error reading URL ${url}: ${errorMessage}`);
|
|
47
|
-
yield `Failed to read URL: ${errorMessage}`;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export async function readUrl(url, abortSignal) {
|
|
53
|
-
let initialResponse;
|
|
54
|
-
try {
|
|
55
|
-
// Initial fetch to check content type and potentially use directly
|
|
56
|
-
logger.debug(`Performing initial fetch for: ${url}`);
|
|
57
|
-
initialResponse = await fetch(url, { signal: abortSignal });
|
|
58
|
-
if (!initialResponse.ok) {
|
|
59
|
-
throw new Error(`HTTP error! status: ${initialResponse.status} ${initialResponse.statusText}`);
|
|
60
|
-
}
|
|
61
|
-
logger.debug(`Initial fetch successful for: ${url}, Status: ${initialResponse.status}`);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
// If the initial fetch fails entirely, rethrow
|
|
65
|
-
logger.error(`Initial fetch failed for ${url}: ${error}`);
|
|
66
|
-
throw new Error(`Error fetching initial data for ${url}: ${error}`);
|
|
67
|
-
}
|
|
68
|
-
const contentType = initialResponse.headers.get("content-type") ??
|
|
69
|
-
"text/plain";
|
|
70
|
-
logger.debug(`Content-Type for ${url}: ${contentType}`);
|
|
71
|
-
// If content type is HTML, try Jina first
|
|
72
|
-
if (contentType.includes("text/html")) {
|
|
73
|
-
logger.info(`Detected HTML content for ${url}. Attempting Jina AI fetch.`);
|
|
74
|
-
try {
|
|
75
|
-
const apiKey = process.env["JINA_READER_API_KEY"];
|
|
76
|
-
if (!apiKey) {
|
|
77
|
-
logger.warn("JINA_READER_API_KEY not set. Skipping Jina fetch.");
|
|
78
|
-
throw new Error("Jina API key not available"); // Skip to fallback
|
|
79
|
-
}
|
|
80
|
-
const jinaReadUrl = `https://r.jina.ai/${url}`;
|
|
81
|
-
logger.debug(`Fetching with Jina: ${jinaReadUrl}`);
|
|
82
|
-
const jinaResponse = await fetch(jinaReadUrl, {
|
|
83
|
-
method: "GET",
|
|
84
|
-
headers: {
|
|
85
|
-
// biome-ignore lint/style/useNamingConvention: API requirement
|
|
86
|
-
Authorization: `Bearer ${apiKey}`,
|
|
87
|
-
"X-With-Generated-Alt": "true", // Optional: Ask Jina to include image descriptions
|
|
88
|
-
"X-With-Links-Summary": "true", // Optional: Ask Jina for a summary of links
|
|
89
|
-
},
|
|
90
|
-
signal: abortSignal,
|
|
91
|
-
});
|
|
92
|
-
if (jinaResponse.ok) {
|
|
93
|
-
const data = await jinaResponse.text();
|
|
94
|
-
logger.info(`Successfully fetched and processed HTML URL with Jina: ${url}`);
|
|
95
|
-
return {
|
|
96
|
-
contentType,
|
|
97
|
-
data,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
logger.warn(`Jina fetch failed for ${url} with status ${jinaResponse.status}: ${jinaResponse.statusText}. Falling back to direct fetch and clean.`);
|
|
101
|
-
// Fall through to use the initialResponse if Jina fails
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
logger.warn(`Error fetching from Jina for ${url}: ${error.message}. Falling back to direct fetch and clean.`);
|
|
105
|
-
// Fall through to use the initialResponse if Jina fails
|
|
106
|
-
}
|
|
107
|
-
// Fallback for HTML: Use the initial response and clean it
|
|
108
|
-
try {
|
|
109
|
-
logger.warn(`Falling back to direct fetch and cleaning for HTML URL: ${url}`);
|
|
110
|
-
const htmlText = await initialResponse.text();
|
|
111
|
-
logger.debug(`Cleaning HTML content for ${url} (length: ${htmlText.length})`);
|
|
112
|
-
const cleaner = HtmlCleaner.new(htmlText);
|
|
113
|
-
const processedText = cleaner.clean();
|
|
114
|
-
logger.info(`Successfully cleaned HTML content for ${url} (length: ${processedText.length})`);
|
|
115
|
-
return {
|
|
116
|
-
contentType,
|
|
117
|
-
data: processedText,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
catch (cleanError) {
|
|
121
|
-
logger.error(`Error cleaning HTML from fallback fetch for ${url}: ${cleanError}`);
|
|
122
|
-
throw new Error(`Error cleaning HTML from fallback fetch for ${url}: ${cleanError}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
// If not HTML, return the text directly from the initial response
|
|
127
|
-
logger.info(`Fetched non-HTML content directly: ${url} (Content-Type: ${contentType})`);
|
|
128
|
-
try {
|
|
129
|
-
if (contentType.startsWith("image/")) {
|
|
130
|
-
const arrayBuffer = await initialResponse.arrayBuffer();
|
|
131
|
-
const base64 = Buffer.from(arrayBuffer).toString("base64");
|
|
132
|
-
const base64Url = `data:${contentType};base64,${base64}`;
|
|
133
|
-
logger.debug(`Returning base64 image data for ${url} (length: ${base64.length})`);
|
|
134
|
-
return {
|
|
135
|
-
contentType,
|
|
136
|
-
data: base64Url,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
const textContent = await initialResponse.text();
|
|
140
|
-
logger.debug(`Returning raw text content for ${url} (length: ${textContent.length})`);
|
|
141
|
-
return {
|
|
142
|
-
contentType,
|
|
143
|
-
data: textContent,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
catch (textError) {
|
|
147
|
-
logger.error(`Error reading response for ${url}: ${textError}`);
|
|
148
|
-
throw new Error(`Error reading response for ${url}: ${textError}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
export class HtmlCleaner {
|
|
153
|
-
static new(html) {
|
|
154
|
-
return new HtmlCleaner(html);
|
|
155
|
-
}
|
|
156
|
-
html;
|
|
157
|
-
constructor(html) {
|
|
158
|
-
this.html = html;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Cleans HTML content by removing unnecessary elements and simplifying structure
|
|
162
|
-
* @param {Object} [options] - Configuration options for cleaning
|
|
163
|
-
* @param {boolean} [options.simplify=true] - Whether to simplify HTML structure by removing redundant elements
|
|
164
|
-
* @param {boolean} [options.empty=true] - Whether to remove empty elements from the HTML
|
|
165
|
-
* @returns {string} Cleaned HTML content with removed whitespace and line breaks
|
|
166
|
-
*/
|
|
167
|
-
clean(options) {
|
|
168
|
-
const { simplify = true, empty = true } = options ?? {};
|
|
169
|
-
const $ = load(this.html);
|
|
170
|
-
// Remove scripts, styles, and comments
|
|
171
|
-
this.removeUnnecessaryElements($);
|
|
172
|
-
// Simplify HTML structure
|
|
173
|
-
if (simplify) {
|
|
174
|
-
this.simplifyStructure($);
|
|
175
|
-
}
|
|
176
|
-
// Remove empty elements
|
|
177
|
-
if (empty) {
|
|
178
|
-
this.removeEmptyElements($);
|
|
179
|
-
}
|
|
180
|
-
// Get cleaned HTML
|
|
181
|
-
return $.html()
|
|
182
|
-
.trim()
|
|
183
|
-
.replace(/^\s*[\r\n]/gm, "");
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Removes scripts, styles, and comments from HTML
|
|
187
|
-
*/
|
|
188
|
-
removeUnnecessaryElements($) {
|
|
189
|
-
// Remove all script tags
|
|
190
|
-
$("script").remove();
|
|
191
|
-
// Remove all noscript tags
|
|
192
|
-
$("noscript").remove();
|
|
193
|
-
// Remove all style tags
|
|
194
|
-
$("style").remove();
|
|
195
|
-
// Remove all link tags (external stylesheets)
|
|
196
|
-
$('link[rel="stylesheet"]').remove();
|
|
197
|
-
// Remove all preload link tags
|
|
198
|
-
$('link[rel="preload"]').remove();
|
|
199
|
-
// Remove all link tags
|
|
200
|
-
$("link").remove();
|
|
201
|
-
// Remove all forms
|
|
202
|
-
$("form").remove();
|
|
203
|
-
// Remove comments
|
|
204
|
-
$("*")
|
|
205
|
-
.contents()
|
|
206
|
-
.each((_, element) => {
|
|
207
|
-
if (element.type === "comment") {
|
|
208
|
-
$(element).remove();
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
// Remove all inline styles
|
|
212
|
-
$("[style]").removeAttr("style");
|
|
213
|
-
// Remove all class attributes
|
|
214
|
-
$("[class]").removeAttr("class");
|
|
215
|
-
// Remove all id attributes
|
|
216
|
-
$("[id]").removeAttr("id");
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Simplifies HTML structure by merging redundant tags
|
|
220
|
-
*/
|
|
221
|
-
simplifyStructure($) {
|
|
222
|
-
// Merge nested divs
|
|
223
|
-
$("div div").each((_, element) => {
|
|
224
|
-
const $element = $(element);
|
|
225
|
-
const parent = $element.parent();
|
|
226
|
-
if (parent.children().length === 1 && parent.get(0)?.tagName === "div") {
|
|
227
|
-
$element.unwrap();
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
// Remove redundant spans
|
|
231
|
-
$("span").each((_, element) => {
|
|
232
|
-
const $element = $(element);
|
|
233
|
-
if (!$element.attr() || Object.keys($element.attr() ?? {}).length === 0) {
|
|
234
|
-
const h = $element.html();
|
|
235
|
-
if (h) {
|
|
236
|
-
$element.replaceWith(h);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Removes empty elements from HTML
|
|
243
|
-
*/
|
|
244
|
-
removeEmptyElements($) {
|
|
245
|
-
$(":empty").remove();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
@@ -1,23 +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 WebSearchTool: {
|
|
6
|
-
name: "webSearch";
|
|
7
|
-
};
|
|
8
|
-
declare const inputSchema: z.ZodObject<{
|
|
9
|
-
query: z.ZodString;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
export declare const createWebSearchTool: ({ tokenCounter, }: {
|
|
12
|
-
tokenCounter: TokenCounter;
|
|
13
|
-
}) => {
|
|
14
|
-
toolDef: {
|
|
15
|
-
description: string;
|
|
16
|
-
inputSchema: z.ZodObject<{
|
|
17
|
-
query: z.ZodString;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
};
|
|
20
|
-
execute: ({ query }: z.infer<typeof inputSchema>, { toolCallId, abortSignal }: ToolCallOptions) => AsyncGenerator<ToolResult>;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=web-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-search.d.ts","sourceRoot":"","sources":["../../source/tools/web-search.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;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,aAAa;;CAEzB,CAAC;AAEF,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,mBAEjC;IACD,YAAY,EAAE,YAAY,CAAC;CAC5B;;;;;;;yBAQc,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,+BACT,eAAe,KAC3C,cAAc,CAAC,UAAU,CAAC;CA0D9B,CAAC"}
|
package/dist/tools/web-search.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { SafeSearchType, search } from "duck-duck-scrape";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import Exa from "../api/exa/index.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { manageTokenLimit } from "../tokens/threshold.js";
|
|
6
|
-
export const WebSearchTool = {
|
|
7
|
-
name: "webSearch",
|
|
8
|
-
};
|
|
9
|
-
const inputSchema = z.object({
|
|
10
|
-
query: z.string().describe("The search query."),
|
|
11
|
-
});
|
|
12
|
-
export const createWebSearchTool = ({ tokenCounter, }) => {
|
|
13
|
-
const toolDef = {
|
|
14
|
-
description: "Searches the web and returns match documents with their title, url, and text content. The query should be formulated as a natural language question.",
|
|
15
|
-
inputSchema,
|
|
16
|
-
};
|
|
17
|
-
const execute = async function* ({ query }, { toolCallId, abortSignal }) {
|
|
18
|
-
try {
|
|
19
|
-
// Check if execution has been aborted
|
|
20
|
-
if (abortSignal?.aborted) {
|
|
21
|
-
throw new Error("Web search aborted");
|
|
22
|
-
}
|
|
23
|
-
yield {
|
|
24
|
-
name: WebSearchTool.name,
|
|
25
|
-
event: "tool-init",
|
|
26
|
-
id: toolCallId,
|
|
27
|
-
data: `${style.cyan(query)}`,
|
|
28
|
-
};
|
|
29
|
-
if (abortSignal?.aborted) {
|
|
30
|
-
throw new Error("Web search aborted before search execution");
|
|
31
|
-
}
|
|
32
|
-
const result = await performSearch(query, abortSignal);
|
|
33
|
-
const sources = result.results.map((source) => `## ${source.title}\nURL: ${source.url}\n\n${source.text}`);
|
|
34
|
-
const resultText = `# Search Results:\n\n${sources.join("\n\n")}`;
|
|
35
|
-
const searchResult = await manageTokenLimit(resultText, tokenCounter, "WebSearch", "Use more specific search queries or reduce number of results");
|
|
36
|
-
yield {
|
|
37
|
-
name: WebSearchTool.name,
|
|
38
|
-
event: "tool-completion",
|
|
39
|
-
id: toolCallId,
|
|
40
|
-
data: `Found ${result.results.length} results (${searchResult.tokenCount} tokens)`,
|
|
41
|
-
};
|
|
42
|
-
yield searchResult.content;
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
46
|
-
yield {
|
|
47
|
-
name: WebSearchTool.name,
|
|
48
|
-
event: "tool-error",
|
|
49
|
-
id: toolCallId,
|
|
50
|
-
data: errorMessage,
|
|
51
|
-
};
|
|
52
|
-
yield errorMessage;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
toolDef,
|
|
57
|
-
execute,
|
|
58
|
-
// No ask method needed for read-only tool
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
async function performSearch(query, abortSignal) {
|
|
62
|
-
// Check if EXA API key is available
|
|
63
|
-
const hasExaApiKey = process.env["EXA_API_KEY"] && process.env["EXA_API_KEY"].trim() !== "";
|
|
64
|
-
if (hasExaApiKey) {
|
|
65
|
-
// Use Exa search
|
|
66
|
-
try {
|
|
67
|
-
if (abortSignal?.aborted) {
|
|
68
|
-
throw new Error("Web search aborted before Exa search");
|
|
69
|
-
}
|
|
70
|
-
const exa = new Exa(process.env["EXA_API_KEY"]);
|
|
71
|
-
// Create a promise that races with the abort signal
|
|
72
|
-
const searchPromise = exa.searchAndContents(query, {
|
|
73
|
-
numResults: 5,
|
|
74
|
-
text: true,
|
|
75
|
-
});
|
|
76
|
-
const result = await Promise.race([
|
|
77
|
-
searchPromise,
|
|
78
|
-
new Promise((_, reject) => {
|
|
79
|
-
if (abortSignal) {
|
|
80
|
-
abortSignal.addEventListener("abort", () => {
|
|
81
|
-
reject(new Error("Web search aborted during Exa search"));
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}),
|
|
85
|
-
]);
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
// If Exa fails, fall back to duck duck scrape
|
|
90
|
-
console.info("Exa search failed, falling back to DuckDuckGo:", error);
|
|
91
|
-
return await searchWithDuckDuckGo(query, abortSignal);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// Use DuckDuckGo search as fallback
|
|
96
|
-
console.info("EXA_API_KEY not set, using DuckDuckGo search");
|
|
97
|
-
return await searchWithDuckDuckGo(query, abortSignal);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function searchWithDuckDuckGo(query, abortSignal) {
|
|
101
|
-
try {
|
|
102
|
-
if (abortSignal?.aborted) {
|
|
103
|
-
throw new Error("Web search aborted before DuckDuckGo search");
|
|
104
|
-
}
|
|
105
|
-
// Create a promise that races with the abort signal
|
|
106
|
-
const searchPromise = search(query, {
|
|
107
|
-
safeSearch: SafeSearchType.MODERATE,
|
|
108
|
-
});
|
|
109
|
-
const searchResults = await Promise.race([
|
|
110
|
-
searchPromise,
|
|
111
|
-
new Promise((_, reject) => {
|
|
112
|
-
if (abortSignal) {
|
|
113
|
-
abortSignal.addEventListener("abort", () => {
|
|
114
|
-
reject(new Error("Web search aborted during DuckDuckGo search"));
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}),
|
|
118
|
-
]);
|
|
119
|
-
// Transform duck-duck-scrape results to match Exa format
|
|
120
|
-
// Take only first 5 results to match Exa behavior
|
|
121
|
-
const results = searchResults.results
|
|
122
|
-
.slice(0, 5)
|
|
123
|
-
.map((result) => ({
|
|
124
|
-
title: result.title,
|
|
125
|
-
url: result.url,
|
|
126
|
-
text: result.description || "",
|
|
127
|
-
}));
|
|
128
|
-
return { results };
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
throw new Error(`Failed to perform web search: ${error}`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ModelManager } from "../../models/manager.ts";
|
|
2
|
-
import type { Component } from "../index.ts";
|
|
3
|
-
type State = {
|
|
4
|
-
projectStatus: string;
|
|
5
|
-
currentContextWindow: number;
|
|
6
|
-
contextWindow: number;
|
|
7
|
-
};
|
|
8
|
-
export declare class PromptStatusComponent implements Component {
|
|
9
|
-
private modelManager;
|
|
10
|
-
private state;
|
|
11
|
-
constructor(modelManager: ModelManager, state: State);
|
|
12
|
-
setState(state: State): void;
|
|
13
|
-
render(width: number): string[];
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=prompt-status.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-status.d.ts","sourceRoot":"","sources":["../../../source/tui/components/prompt-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,KAAK,KAAK,GAAG;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,SAAS;IACrD,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,KAAK,CAAQ;gBACT,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK;IAKpD,QAAQ,CAAC,KAAK,EAAE,KAAK;IAIrB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAkBhC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { displayProgressBar } from "../../terminal/index.js";
|
|
2
|
-
import style from "../../terminal/style.js";
|
|
3
|
-
export class PromptStatusComponent {
|
|
4
|
-
modelManager;
|
|
5
|
-
state;
|
|
6
|
-
constructor(modelManager, state) {
|
|
7
|
-
this.modelManager = modelManager;
|
|
8
|
-
this.state = state;
|
|
9
|
-
}
|
|
10
|
-
setState(state) {
|
|
11
|
-
this.state = state;
|
|
12
|
-
}
|
|
13
|
-
render(width) {
|
|
14
|
-
const results = [];
|
|
15
|
-
// results.push(style.dim(hr(width)));
|
|
16
|
-
results.push(this.state.projectStatus);
|
|
17
|
-
results.push(style.dim(`${this.modelManager.getModelMetadata("repl").id} [${this.modelManager.getModel("repl").modelId}]`));
|
|
18
|
-
results.push(displayProgressBar(this.state.currentContextWindow, this.state.contextWindow, width));
|
|
19
|
-
return results;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../source/utils/filesystem.ts"],"names":[],"mappings":"AAIA,wBAAgB,MAAM,CAAC,SAAS,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB1E;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,aAAa,EAAE,GAAG,GAAG,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAuGf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-utils.d.ts","sourceRoot":"","sources":["../../source/utils/zod-utils.ts"],"names":[],"mappings":"AAAA,OAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjE;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB"}
|
package/dist/utils/zod-utils.js
DELETED
|
File without changes
|
|
File without changes
|