@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,340 +0,0 @@
|
|
|
1
|
-
import { formatModelInfo, getModelsByCategory, isValidModel, modelRegistry, models, providers, } from "../models/providers.js";
|
|
2
|
-
import { getTerminalSize } from "../terminal/formatting.js";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { Container, Input, Spacer, Text, } from "../tui/index.js";
|
|
5
|
-
export function modelCommand(options) {
|
|
6
|
-
const { terminal, modelManager } = options;
|
|
7
|
-
function switchModel(newModelName) {
|
|
8
|
-
try {
|
|
9
|
-
// Get current and new model configs
|
|
10
|
-
const currentModelConfig = modelManager.getModelMetadata("repl");
|
|
11
|
-
const newModelConfig = modelRegistry[newModelName]; // Ensure modelRegistry is available
|
|
12
|
-
if (!newModelConfig) {
|
|
13
|
-
terminal.error(`Model configuration not found for: ${newModelName}`);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
// Check for capability differences
|
|
17
|
-
if (currentModelConfig.supportsToolCalling &&
|
|
18
|
-
!newModelConfig.supportsToolCalling) {
|
|
19
|
-
terminal.warn("The new model doesn't support tool calling, which may limit functionality.");
|
|
20
|
-
}
|
|
21
|
-
if (currentModelConfig.supportsReasoning &&
|
|
22
|
-
!newModelConfig.supportsReasoning) {
|
|
23
|
-
terminal.warn("The new model doesn't support reasoning, which may change response quality.");
|
|
24
|
-
}
|
|
25
|
-
// Update model in ModelManager
|
|
26
|
-
modelManager.setModel("repl", newModelName);
|
|
27
|
-
// Assuming ModelManager handles the actual model instance switching internally.
|
|
28
|
-
terminal.info(`Model set to ${newModelName}.`); // Simplified message
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
terminal.error(`Failed to switch model: ${error.message}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
command: "/model",
|
|
36
|
-
description: "List available models or switch to a different model. Usage: /model [provider:model-name|category|provider]",
|
|
37
|
-
getSubCommands: () => Promise.resolve(models),
|
|
38
|
-
async execute(args) {
|
|
39
|
-
const arg = args.join(" ").trim();
|
|
40
|
-
const modelConfig = modelManager.getModelMetadata("repl");
|
|
41
|
-
// No args - display current model and list available models by category
|
|
42
|
-
if (!arg) {
|
|
43
|
-
const currentModel = modelConfig.id;
|
|
44
|
-
terminal.header(`Current model: ${currentModel}`);
|
|
45
|
-
terminal.header("Available models by category:");
|
|
46
|
-
// Display models by category
|
|
47
|
-
for (const category of ["fast", "balanced", "powerful"]) {
|
|
48
|
-
// Use 'as const' for stricter typing
|
|
49
|
-
terminal.writeln(`\n${category.charAt(0).toUpperCase() + category.slice(1)} models:`);
|
|
50
|
-
for (const model of getModelsByCategory(category)) {
|
|
51
|
-
terminal.writeln(formatModelInfo(model));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return "continue";
|
|
55
|
-
}
|
|
56
|
-
// Switch to a specific model
|
|
57
|
-
if (isValidModel(arg)) {
|
|
58
|
-
// Call the standalone switchModel function
|
|
59
|
-
switchModel(arg);
|
|
60
|
-
return "continue";
|
|
61
|
-
}
|
|
62
|
-
// Display models by category
|
|
63
|
-
const categories = ["fast", "balanced", "powerful"];
|
|
64
|
-
if (categories.includes(arg)) {
|
|
65
|
-
terminal.header(`${arg.charAt(0).toUpperCase() + arg.slice(1)} models:`);
|
|
66
|
-
// Need to assert arg is a valid category if the check passes
|
|
67
|
-
for (const model of getModelsByCategory(arg)) {
|
|
68
|
-
terminal.writeln(formatModelInfo(model));
|
|
69
|
-
}
|
|
70
|
-
return "continue";
|
|
71
|
-
}
|
|
72
|
-
// Display models by provider
|
|
73
|
-
if (providers.includes(arg)) {
|
|
74
|
-
terminal.header(`Models from ${arg}:`);
|
|
75
|
-
// Need to ensure modelRegistry is accessible and correctly typed
|
|
76
|
-
for (const model of Object.values(modelRegistry).filter((m) => m.provider === arg)) {
|
|
77
|
-
terminal.writeln(formatModelInfo(model));
|
|
78
|
-
}
|
|
79
|
-
return "continue";
|
|
80
|
-
}
|
|
81
|
-
// Invalid model name
|
|
82
|
-
terminal.error(`Invalid model name or category: ${arg}`);
|
|
83
|
-
terminal.info("Usage: /model [provider:model-name|category|provider]");
|
|
84
|
-
return "continue";
|
|
85
|
-
},
|
|
86
|
-
async handle(args, { tui, container, inputContainer, editor, }) {
|
|
87
|
-
const arg = args.join(" ").trim();
|
|
88
|
-
const modelConfig = modelManager.getModelMetadata("repl");
|
|
89
|
-
// No args - display current model and list available models by category
|
|
90
|
-
if (!arg) {
|
|
91
|
-
// Create model selector with current model
|
|
92
|
-
const modelSelector = new ModelSelectorComponent(modelConfig.id, (model) => {
|
|
93
|
-
// Apply the selected model
|
|
94
|
-
modelManager.setModel("repl", model);
|
|
95
|
-
// Hide selector and show editor again
|
|
96
|
-
hideModelSelector(inputContainer, editor, tui);
|
|
97
|
-
tui.requestRender();
|
|
98
|
-
}, () => {
|
|
99
|
-
// Just hide the selector
|
|
100
|
-
hideModelSelector(inputContainer, editor, tui);
|
|
101
|
-
tui.requestRender();
|
|
102
|
-
});
|
|
103
|
-
// Replace editor with selector
|
|
104
|
-
inputContainer.clear();
|
|
105
|
-
inputContainer.addChild(modelSelector);
|
|
106
|
-
tui.setFocus(modelSelector);
|
|
107
|
-
tui.requestRender();
|
|
108
|
-
return "continue";
|
|
109
|
-
}
|
|
110
|
-
// Switch to a specific model
|
|
111
|
-
if (isValidModel(arg)) {
|
|
112
|
-
try {
|
|
113
|
-
// Get current and new model configs
|
|
114
|
-
const currentModelConfig = modelManager.getModelMetadata("repl");
|
|
115
|
-
const newModelConfig = modelRegistry[arg];
|
|
116
|
-
if (!newModelConfig) {
|
|
117
|
-
container.addChild(new Text(style.red(`Model configuration not found for: ${arg}`), 1, 0));
|
|
118
|
-
tui.requestRender();
|
|
119
|
-
editor.setText("");
|
|
120
|
-
return "continue";
|
|
121
|
-
}
|
|
122
|
-
// Check for capability differences
|
|
123
|
-
if (currentModelConfig.supportsToolCalling &&
|
|
124
|
-
!newModelConfig.supportsToolCalling) {
|
|
125
|
-
container.addChild(new Text(style.yellow("The new model doesn't support tool calling, which may limit functionality."), 1, 0));
|
|
126
|
-
}
|
|
127
|
-
if (currentModelConfig.supportsReasoning &&
|
|
128
|
-
!newModelConfig.supportsReasoning) {
|
|
129
|
-
container.addChild(new Text(style.yellow("The new model doesn't support reasoning, which may change response quality."), 2, 0));
|
|
130
|
-
}
|
|
131
|
-
// Update model in ModelManager
|
|
132
|
-
modelManager.setModel("repl", arg);
|
|
133
|
-
// container.addChild(
|
|
134
|
-
// new Text(style.green(`Model set to ${arg}.`), 3, 0),
|
|
135
|
-
// );
|
|
136
|
-
tui.requestRender();
|
|
137
|
-
editor.setText("");
|
|
138
|
-
return "continue";
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
container.addChild(new Text(style.red(`Failed to switch model: ${error.message}`), 0, 0));
|
|
142
|
-
tui.requestRender();
|
|
143
|
-
editor.setText("");
|
|
144
|
-
return "continue";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// // Display models by category
|
|
148
|
-
// const categories = ["fast", "balanced", "powerful"];
|
|
149
|
-
// if (categories.includes(arg)) {
|
|
150
|
-
// container.addChild(
|
|
151
|
-
// new Text(
|
|
152
|
-
// `${arg.charAt(0).toUpperCase() + arg.slice(1)} models:`,
|
|
153
|
-
// 1,
|
|
154
|
-
// 0,
|
|
155
|
-
// ),
|
|
156
|
-
// );
|
|
157
|
-
// let lineIndex = 2;
|
|
158
|
-
// for (const model of getModelsByCategory(
|
|
159
|
-
// arg as "fast" | "balanced" | "powerful",
|
|
160
|
-
// )) {
|
|
161
|
-
// container.addChild(new Text(formatModelInfo(model), lineIndex, 0));
|
|
162
|
-
// lineIndex++;
|
|
163
|
-
// }
|
|
164
|
-
// tui.requestRender();
|
|
165
|
-
// editor.setText("");
|
|
166
|
-
// return "continue";
|
|
167
|
-
// }
|
|
168
|
-
// // Display models by provider
|
|
169
|
-
// if (providers.includes(arg as ModelProvider)) {
|
|
170
|
-
// container.addChild(new Text(`Models from ${arg}:`, 0, 1));
|
|
171
|
-
// let lineIndex = 2;
|
|
172
|
-
// for (const model of Object.values(modelRegistry).filter(
|
|
173
|
-
// (m) => m.provider === arg,
|
|
174
|
-
// )) {
|
|
175
|
-
// container.addChild(new Text(formatModelInfo(model), lineIndex, 0));
|
|
176
|
-
// lineIndex++;
|
|
177
|
-
// }
|
|
178
|
-
// tui.requestRender();
|
|
179
|
-
// editor.setText("");
|
|
180
|
-
// return "continue";
|
|
181
|
-
// }
|
|
182
|
-
// // Invalid model name
|
|
183
|
-
// container.addChild(
|
|
184
|
-
// new Text(style.red(`Invalid model name or category: ${arg}`), 0, 1),
|
|
185
|
-
// );
|
|
186
|
-
// container.addChild(
|
|
187
|
-
// new Text(
|
|
188
|
-
// style.dim("Usage: /model [provider:model-name|category|provider]"),
|
|
189
|
-
// 2,
|
|
190
|
-
// 0,
|
|
191
|
-
// ),
|
|
192
|
-
// );
|
|
193
|
-
tui.requestRender();
|
|
194
|
-
editor.setText("");
|
|
195
|
-
return "continue";
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function hideModelSelector(editorContainer, editor, tui) {
|
|
200
|
-
// Replace selector with editor in the container
|
|
201
|
-
editorContainer.clear();
|
|
202
|
-
editorContainer.addChild(editor);
|
|
203
|
-
tui.setFocus(editor);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Component that renders a model selector with search
|
|
207
|
-
*/
|
|
208
|
-
export class ModelSelectorComponent extends Container {
|
|
209
|
-
searchInput;
|
|
210
|
-
listContainer;
|
|
211
|
-
allModels = [];
|
|
212
|
-
filteredModels = [];
|
|
213
|
-
selectedIndex = 0;
|
|
214
|
-
currentModel;
|
|
215
|
-
onSelectCallback;
|
|
216
|
-
onCancelCallback;
|
|
217
|
-
constructor(currentModel, onSelect, onCancel) {
|
|
218
|
-
super();
|
|
219
|
-
this.currentModel = currentModel;
|
|
220
|
-
this.onSelectCallback = onSelect;
|
|
221
|
-
this.onCancelCallback = onCancel;
|
|
222
|
-
// Load all models
|
|
223
|
-
this.loadModels();
|
|
224
|
-
const { columns } = getTerminalSize();
|
|
225
|
-
// Add top border
|
|
226
|
-
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
227
|
-
this.addChild(new Spacer(1));
|
|
228
|
-
// Create search input
|
|
229
|
-
this.searchInput = new Input();
|
|
230
|
-
this.searchInput.onSubmit = () => {
|
|
231
|
-
// Enter on search input selects the first filtered item
|
|
232
|
-
if (this.filteredModels[this.selectedIndex]) {
|
|
233
|
-
this.handleSelect(this.filteredModels[this.selectedIndex]);
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
this.addChild(this.searchInput);
|
|
237
|
-
this.addChild(new Spacer(1));
|
|
238
|
-
// Create list container
|
|
239
|
-
this.listContainer = new Container();
|
|
240
|
-
this.addChild(this.listContainer);
|
|
241
|
-
this.addChild(new Spacer(1));
|
|
242
|
-
// Add bottom border
|
|
243
|
-
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
244
|
-
// Initial render
|
|
245
|
-
this.updateList();
|
|
246
|
-
}
|
|
247
|
-
loadModels() {
|
|
248
|
-
this.allModels = models;
|
|
249
|
-
this.filteredModels = models;
|
|
250
|
-
}
|
|
251
|
-
filterModels(query) {
|
|
252
|
-
if (!query.trim()) {
|
|
253
|
-
this.filteredModels = this.allModels;
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
const searchTokens = query
|
|
257
|
-
.toLowerCase()
|
|
258
|
-
.split(/\s+/)
|
|
259
|
-
.filter((t) => t);
|
|
260
|
-
this.filteredModels = this.allModels.filter((model) => {
|
|
261
|
-
const searchText = `${model}`.toLowerCase();
|
|
262
|
-
return searchTokens.every((token) => searchText.includes(token));
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredModels.length - 1));
|
|
266
|
-
this.updateList();
|
|
267
|
-
}
|
|
268
|
-
updateList() {
|
|
269
|
-
this.listContainer.clear();
|
|
270
|
-
const maxVisible = 10;
|
|
271
|
-
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(maxVisible / 2), this.filteredModels.length - maxVisible));
|
|
272
|
-
const endIndex = Math.min(startIndex + maxVisible, this.filteredModels.length);
|
|
273
|
-
// Show visible slice of filtered models
|
|
274
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
275
|
-
const item = this.filteredModels[i];
|
|
276
|
-
if (!item)
|
|
277
|
-
continue;
|
|
278
|
-
const isSelected = i === this.selectedIndex;
|
|
279
|
-
const isCurrent = this.currentModel === item;
|
|
280
|
-
let line = "";
|
|
281
|
-
if (isSelected) {
|
|
282
|
-
const prefix = style.blue("→ ");
|
|
283
|
-
const modelText = `${item}`;
|
|
284
|
-
// const providerBadge = style.gray(`[${item.provider}]`);
|
|
285
|
-
const checkmark = isCurrent ? style.green(" ✓") : "";
|
|
286
|
-
line = `${prefix + style.blue(modelText)} ${checkmark}`;
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
const modelText = ` ${item}`;
|
|
290
|
-
// const providerBadge = style.gray(`[${item.provider}]`);
|
|
291
|
-
const checkmark = isCurrent ? style.green(" ✓") : "";
|
|
292
|
-
line = `${modelText} ${checkmark}`;
|
|
293
|
-
}
|
|
294
|
-
this.listContainer.addChild(new Text(line, 0, 0));
|
|
295
|
-
}
|
|
296
|
-
// Add scroll indicator if needed
|
|
297
|
-
if (startIndex > 0 || endIndex < this.filteredModels.length) {
|
|
298
|
-
const scrollInfo = style.gray(` (${this.selectedIndex + 1}/${this.filteredModels.length})`);
|
|
299
|
-
this.listContainer.addChild(new Text(scrollInfo, 0, 0));
|
|
300
|
-
}
|
|
301
|
-
// Show "no results" if empty
|
|
302
|
-
if (this.filteredModels.length === 0) {
|
|
303
|
-
this.listContainer.addChild(new Text(style.gray(" No matching models"), 0, 0));
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
handleInput(keyData) {
|
|
307
|
-
// Up arrow
|
|
308
|
-
if (keyData === "\x1b[A") {
|
|
309
|
-
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
310
|
-
this.updateList();
|
|
311
|
-
}
|
|
312
|
-
// Down arrow
|
|
313
|
-
else if (keyData === "\x1b[B") {
|
|
314
|
-
this.selectedIndex = Math.min(this.filteredModels.length - 1, this.selectedIndex + 1);
|
|
315
|
-
this.updateList();
|
|
316
|
-
}
|
|
317
|
-
// Enter
|
|
318
|
-
else if (keyData === "\r") {
|
|
319
|
-
const selectedModel = this.filteredModels[this.selectedIndex];
|
|
320
|
-
if (selectedModel) {
|
|
321
|
-
this.handleSelect(selectedModel);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
// Escape
|
|
325
|
-
else if (keyData === "\x1b") {
|
|
326
|
-
this.onCancelCallback();
|
|
327
|
-
}
|
|
328
|
-
// Pass everything else to search input
|
|
329
|
-
else {
|
|
330
|
-
this.searchInput.handleInput(keyData);
|
|
331
|
-
this.filterModels(this.searchInput.getValue());
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
handleSelect(model) {
|
|
335
|
-
this.onSelectCallback(model);
|
|
336
|
-
}
|
|
337
|
-
getSearchInput() {
|
|
338
|
-
return this.searchInput;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-command.d.ts","sourceRoot":"","sources":["../../source/commands/paste-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAsH9D,eAAO,MAAM,YAAY,GAAI,0DAK1B,cAAc,KAAG,WAqRnB,CAAC"}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import Clipboard from "@crosscopy/clipboard";
|
|
2
|
-
import { formatBlock } from "../formatting.js";
|
|
3
|
-
import { logger } from "../logger.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { Text } from "../tui/index.js";
|
|
6
|
-
function extractBase64Content(dataUrl) {
|
|
7
|
-
return dataUrl.replace(/^data:.*?;base64,/, "");
|
|
8
|
-
}
|
|
9
|
-
function isValidBase64(str) {
|
|
10
|
-
try {
|
|
11
|
-
// Remove data URL prefix if present
|
|
12
|
-
const base64Content = extractBase64Content(str);
|
|
13
|
-
// Try to decode the base64 string
|
|
14
|
-
const decoded = Buffer.from(base64Content, "base64");
|
|
15
|
-
// Re-encode to verify it's valid base64
|
|
16
|
-
const reEncoded = decoded.toString("base64");
|
|
17
|
-
// Remove padding for comparison
|
|
18
|
-
const normalizedOriginal = base64Content.replace(/=/g, "");
|
|
19
|
-
const normalizedReEncoded = reEncoded.replace(/=/g, "");
|
|
20
|
-
return normalizedOriginal === normalizedReEncoded;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function detectImageFormatFromBase64(base64Content) {
|
|
27
|
-
try {
|
|
28
|
-
const buffer = Buffer.from(base64Content, "base64");
|
|
29
|
-
// Check for JPEG signature (FF D8 FF)
|
|
30
|
-
if (buffer.length >= 3 &&
|
|
31
|
-
buffer[0] === 0xff &&
|
|
32
|
-
buffer[1] === 0xd8 &&
|
|
33
|
-
buffer[2] === 0xff) {
|
|
34
|
-
return "image/jpeg";
|
|
35
|
-
}
|
|
36
|
-
// Check for PNG signature (89 50 4E 47 0D 0A 1A 0A)
|
|
37
|
-
if (buffer.length >= 8 &&
|
|
38
|
-
buffer[0] === 0x89 &&
|
|
39
|
-
buffer[1] === 0x50 &&
|
|
40
|
-
buffer[2] === 0x4e &&
|
|
41
|
-
buffer[3] === 0x47 &&
|
|
42
|
-
buffer[4] === 0x0d &&
|
|
43
|
-
buffer[5] === 0x0a &&
|
|
44
|
-
buffer[6] === 0x1a &&
|
|
45
|
-
buffer[7] === 0x0a) {
|
|
46
|
-
return "image/png";
|
|
47
|
-
}
|
|
48
|
-
// Check for GIF signature (GIF87a or GIF89a)
|
|
49
|
-
if (buffer.length >= 6 &&
|
|
50
|
-
((buffer[0] === 0x47 &&
|
|
51
|
-
buffer[1] === 0x49 &&
|
|
52
|
-
buffer[2] === 0x46 &&
|
|
53
|
-
buffer[3] === 0x38 &&
|
|
54
|
-
buffer[4] === 0x37 &&
|
|
55
|
-
buffer[5] === 0x61) ||
|
|
56
|
-
(buffer[0] === 0x47 &&
|
|
57
|
-
buffer[1] === 0x49 &&
|
|
58
|
-
buffer[2] === 0x46 &&
|
|
59
|
-
buffer[3] === 0x38 &&
|
|
60
|
-
buffer[4] === 0x39 &&
|
|
61
|
-
buffer[5] === 0x61))) {
|
|
62
|
-
return "image/gif";
|
|
63
|
-
}
|
|
64
|
-
// Check for WebP signature (RIFF .... WEBP)
|
|
65
|
-
if (buffer.length >= 12 &&
|
|
66
|
-
buffer[0] === 0x52 &&
|
|
67
|
-
buffer[1] === 0x49 &&
|
|
68
|
-
buffer[2] === 0x46 &&
|
|
69
|
-
buffer[3] === 0x46 &&
|
|
70
|
-
buffer[8] === 0x57 &&
|
|
71
|
-
buffer[9] === 0x45 &&
|
|
72
|
-
buffer[10] === 0x42 &&
|
|
73
|
-
buffer[11] === 0x50) {
|
|
74
|
-
return "image/webp";
|
|
75
|
-
}
|
|
76
|
-
// Check for BMP signature (BM)
|
|
77
|
-
if (buffer.length >= 2 && buffer[0] === 0x42 && buffer[1] === 0x4d) {
|
|
78
|
-
return "image/bmp";
|
|
79
|
-
}
|
|
80
|
-
// Check for TIFF signatures (II* or MM*)
|
|
81
|
-
if (buffer.length >= 4 &&
|
|
82
|
-
((buffer[0] === 0x49 &&
|
|
83
|
-
buffer[1] === 0x49 &&
|
|
84
|
-
buffer[2] === 0x2a &&
|
|
85
|
-
buffer[3] === 0x00) ||
|
|
86
|
-
(buffer[0] === 0x4d &&
|
|
87
|
-
buffer[1] === 0x4d &&
|
|
88
|
-
buffer[2] === 0x00 &&
|
|
89
|
-
buffer[3] === 0x2a))) {
|
|
90
|
-
return "image/tiff";
|
|
91
|
-
}
|
|
92
|
-
// If no known signature found, fall back to the data URL MIME type
|
|
93
|
-
return "unknown";
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return "unknown";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function extractMimeTypeFromDataUrl(dataUrl) {
|
|
100
|
-
const match = dataUrl.match(/^data:([^;]+);base64,/);
|
|
101
|
-
return match?.[1] ? match[1] : "image/png";
|
|
102
|
-
}
|
|
103
|
-
export const pasteCommand = ({ terminal, modelManager, promptManager, tokenCounter, }) => {
|
|
104
|
-
return {
|
|
105
|
-
command: "/paste",
|
|
106
|
-
description: "Pastes image or text content from the clipboard into the next prompt.",
|
|
107
|
-
getSubCommands: () => Promise.resolve([]),
|
|
108
|
-
execute: async () => {
|
|
109
|
-
try {
|
|
110
|
-
if (Clipboard.hasImage()) {
|
|
111
|
-
const base64DataUrl = await Clipboard.getImageBase64();
|
|
112
|
-
// Validate the base64 data
|
|
113
|
-
if (!isValidBase64(base64DataUrl)) {
|
|
114
|
-
terminal.error("Invalid base64 data in clipboard. The image data may be corrupted.");
|
|
115
|
-
return "continue";
|
|
116
|
-
}
|
|
117
|
-
// Extract MIME type with better error handling and actual image format detection
|
|
118
|
-
let mimeType;
|
|
119
|
-
try {
|
|
120
|
-
// First, try to get MIME type from data URL
|
|
121
|
-
const dataUrlMimeType = extractMimeTypeFromDataUrl(base64DataUrl);
|
|
122
|
-
// Then, detect actual image format from base64 content
|
|
123
|
-
const base64Content = extractBase64Content(base64DataUrl);
|
|
124
|
-
const detectedFormat = detectImageFormatFromBase64(base64Content);
|
|
125
|
-
// Use detected format if available, otherwise fall back to data URL MIME type
|
|
126
|
-
if (detectedFormat !== "unknown") {
|
|
127
|
-
mimeType = detectedFormat;
|
|
128
|
-
// Log if there's a mismatch between data URL and actual format
|
|
129
|
-
if (dataUrlMimeType !== detectedFormat) {
|
|
130
|
-
logger.warn(`Clipboard library reported ${dataUrlMimeType} but actual image format is ${detectedFormat}. Using detected format.`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
mimeType = dataUrlMimeType;
|
|
135
|
-
logger.warn(`Could not detect image format, using data URL MIME type: ${mimeType}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
logger.warn(`Failed to extract MIME type from clipboard image: ${error}`);
|
|
140
|
-
mimeType = "image/png";
|
|
141
|
-
}
|
|
142
|
-
// Ensure the data URL format is correct
|
|
143
|
-
if (!base64DataUrl.startsWith(`data:${mimeType};base64,`)) {
|
|
144
|
-
// Fix malformed data URLs
|
|
145
|
-
const base64Content = base64DataUrl.replace(/^data:.*?;base64,/, "");
|
|
146
|
-
const correctedDataUrl = `data:${mimeType};base64,${base64Content}`;
|
|
147
|
-
// Final validation
|
|
148
|
-
if (!isValidBase64(correctedDataUrl)) {
|
|
149
|
-
terminal.error("Failed to correct base64 data format. The image data may be corrupted.");
|
|
150
|
-
return "continue";
|
|
151
|
-
}
|
|
152
|
-
promptManager.addContext({
|
|
153
|
-
type: "image",
|
|
154
|
-
image: correctedDataUrl,
|
|
155
|
-
mediaType: mimeType,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
promptManager.addContext({
|
|
160
|
-
type: "image",
|
|
161
|
-
image: base64DataUrl,
|
|
162
|
-
mediaType: mimeType,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
terminal.success("Image from clipboard will be added to your next prompt.");
|
|
166
|
-
return "continue";
|
|
167
|
-
}
|
|
168
|
-
const clipboardContent = await Clipboard.getText();
|
|
169
|
-
if (!clipboardContent || clipboardContent.trim() === "") {
|
|
170
|
-
terminal.warn("Clipboard is empty.");
|
|
171
|
-
return "continue";
|
|
172
|
-
}
|
|
173
|
-
const content = formatBlock(clipboardContent, "clipboard", modelManager.getModelMetadata("repl").promptFormat);
|
|
174
|
-
promptManager.addContext(content);
|
|
175
|
-
const tokenCount = tokenCounter.count(content);
|
|
176
|
-
terminal.success(`Clipboard content will be added to your next prompt. (${tokenCount} tokens)`);
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
180
|
-
terminal.error(`Error processing clipboard content: ${message}`);
|
|
181
|
-
logger.error(error, "Paste command error:");
|
|
182
|
-
return "continue";
|
|
183
|
-
}
|
|
184
|
-
return "continue";
|
|
185
|
-
},
|
|
186
|
-
async handle(_args, { tui, container, editor, }) {
|
|
187
|
-
try {
|
|
188
|
-
if (Clipboard.hasImage()) {
|
|
189
|
-
const base64DataUrl = await Clipboard.getImageBase64();
|
|
190
|
-
// Validate the base64 data
|
|
191
|
-
if (!isValidBase64(base64DataUrl)) {
|
|
192
|
-
container.addChild(new Text(style.red("Invalid base64 data in clipboard. The image data may be corrupted."), 1, 0));
|
|
193
|
-
tui.requestRender();
|
|
194
|
-
editor.setText("");
|
|
195
|
-
return "continue";
|
|
196
|
-
}
|
|
197
|
-
// Extract MIME type with better error handling and actual image format detection
|
|
198
|
-
let mimeType;
|
|
199
|
-
try {
|
|
200
|
-
// First, try to get MIME type from data URL
|
|
201
|
-
const dataUrlMimeType = extractMimeTypeFromDataUrl(base64DataUrl);
|
|
202
|
-
// Then, detect actual image format from base64 content
|
|
203
|
-
const base64Content = extractBase64Content(base64DataUrl);
|
|
204
|
-
const detectedFormat = detectImageFormatFromBase64(base64Content);
|
|
205
|
-
// Use detected format if available, otherwise fall back to data URL MIME type
|
|
206
|
-
if (detectedFormat !== "unknown") {
|
|
207
|
-
mimeType = detectedFormat;
|
|
208
|
-
// Log if there's a mismatch between data URL and actual format
|
|
209
|
-
if (dataUrlMimeType !== detectedFormat) {
|
|
210
|
-
logger.warn(`Clipboard library reported ${dataUrlMimeType} but actual image format is ${detectedFormat}. Using detected format.`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
mimeType = dataUrlMimeType;
|
|
215
|
-
logger.warn(`Could not detect image format, using data URL MIME type: ${mimeType}`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
logger.warn(`Failed to extract MIME type from clipboard image: ${error}`);
|
|
220
|
-
mimeType = "image/png";
|
|
221
|
-
}
|
|
222
|
-
// Ensure the data URL format is correct
|
|
223
|
-
if (!base64DataUrl.startsWith(`data:${mimeType};base64,`)) {
|
|
224
|
-
// Fix malformed data URLs
|
|
225
|
-
const base64Content = base64DataUrl.replace(/^data:.*?;base64,/, "");
|
|
226
|
-
const correctedDataUrl = `data:${mimeType};base64,${base64Content}`;
|
|
227
|
-
// Final validation
|
|
228
|
-
if (!isValidBase64(correctedDataUrl)) {
|
|
229
|
-
container.addChild(new Text(style.red("Failed to correct base64 data format. The image data may be corrupted."), 1, 0));
|
|
230
|
-
tui.requestRender();
|
|
231
|
-
editor.setText("");
|
|
232
|
-
return "continue";
|
|
233
|
-
}
|
|
234
|
-
promptManager.addContext({
|
|
235
|
-
type: "image",
|
|
236
|
-
image: correctedDataUrl,
|
|
237
|
-
mediaType: mimeType,
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
promptManager.addContext({
|
|
242
|
-
type: "image",
|
|
243
|
-
image: base64DataUrl,
|
|
244
|
-
mediaType: mimeType,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
container.addChild(new Text(style.green("Image from clipboard will be added to your next prompt."), 1, 0));
|
|
248
|
-
tui.requestRender();
|
|
249
|
-
editor.setText("");
|
|
250
|
-
return "continue";
|
|
251
|
-
}
|
|
252
|
-
const clipboardContent = await Clipboard.getText();
|
|
253
|
-
if (!clipboardContent || clipboardContent.trim() === "") {
|
|
254
|
-
container.addChild(new Text(style.yellow("Clipboard is empty."), 0, 1));
|
|
255
|
-
tui.requestRender();
|
|
256
|
-
editor.setText("");
|
|
257
|
-
return "continue";
|
|
258
|
-
}
|
|
259
|
-
const content = formatBlock(clipboardContent, "clipboard", modelManager.getModelMetadata("repl").promptFormat);
|
|
260
|
-
promptManager.addContext(content);
|
|
261
|
-
const tokenCount = tokenCounter.count(content);
|
|
262
|
-
container.addChild(new Text(style.green(`Clipboard content will be added to your next prompt. (${tokenCount} tokens)`), 1, 0));
|
|
263
|
-
tui.requestRender();
|
|
264
|
-
editor.setText("");
|
|
265
|
-
return "continue";
|
|
266
|
-
}
|
|
267
|
-
catch (error) {
|
|
268
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
269
|
-
container.addChild(new Text(style.red(`Error processing clipboard content: ${message}`), 1, 0));
|
|
270
|
-
logger.error(error, "Paste command error:");
|
|
271
|
-
tui.requestRender();
|
|
272
|
-
editor.setText("");
|
|
273
|
-
return "continue";
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickup-command.d.ts","sourceRoot":"","sources":["../../source/commands/pickup-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,WAoMvD,CAAC"}
|