@travisennis/acai 0.0.7 → 0.0.9
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 +76 -27
- package/dist/agent/index.d.ts +21 -25
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +145 -103
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -17
- 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-command.js → add-directory/index.js} +6 -10
- 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/types.js +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} +0 -2
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/{copy-command.js → copy/index.js} +4 -26
- 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-command.d.ts → exit/index.d.ts} +4 -4
- 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} +57 -96
- 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-command.js → handoff/utils.js} +24 -92
- 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-command.d.ts → help/index.d.ts} +2 -2
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +1 -1
- 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} +16 -100
- 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} +16 -7
- 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} +1 -1
- 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-command.js → list-tools/index.js} +4 -16
- package/dist/commands/manager.d.ts +2 -2
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +35 -43
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/{model-command.js → model/index.js} +15 -52
- 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-command.d.ts → paste/index.d.ts} +2 -2
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/{paste-command.js → paste/index.js} +6 -111
- 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 +122 -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} +2 -2
- 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} +7 -2
- 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 -3
- 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 +230 -0
- package/dist/commands/session/types.d.ts +20 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/share/html-renderer.d.ts +25 -0
- package/dist/commands/share/html-renderer.d.ts.map +1 -0
- package/dist/commands/share/html-renderer.js +384 -0
- package/dist/commands/share/index.d.ts +3 -0
- package/dist/commands/share/index.d.ts.map +1 -0
- package/dist/commands/share/index.js +122 -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} +3 -3
- package/dist/commands/types.d.ts +2 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +25 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -20
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +60 -64
- package/dist/formatting.d.ts +27 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +194 -95
- 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/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -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 +14 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +39 -0
- package/dist/models/opencode-zen-provider.d.ts +24 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +94 -0
- package/dist/models/openrouter-provider.d.ts +35 -29
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +108 -80
- package/dist/models/providers.d.ts +4 -4
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +7 -1
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- 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 +12 -2
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +74 -411
- 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 +18 -4
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +256 -43
- package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +62 -14
- package/dist/skills.d.ts +0 -4
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +100 -59
- package/dist/stdin.d.ts +9 -0
- package/dist/stdin.d.ts.map +1 -0
- package/dist/stdin.js +26 -0
- package/dist/terminal/control.d.ts +1 -0
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +29 -6
- package/dist/terminal/formatting.d.ts +1 -2
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +1 -2
- 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/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +9 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +104 -123
- package/dist/tools/directory-tree.d.ts +9 -7
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +89 -70
- package/dist/tools/dynamic-tool-loader.d.ts +22 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +39 -44
- 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 +19 -76
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +77 -119
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -108
- package/dist/tools/index.d.ts +200 -179
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -315
- 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 +49 -82
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +37 -66
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -38
- package/dist/tools/types.d.ts +5 -25
- 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/box.d.ts.map +1 -1
- package/dist/tui/components/box.js +16 -10
- package/dist/tui/components/editor.d.ts +6 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +166 -107
- package/dist/tui/components/footer.d.ts +20 -7
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +89 -196
- 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 +2 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +7 -2
- package/dist/tui/components/markdown.d.ts +5 -4
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +51 -40
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -8
- 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 +64 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -1
- package/dist/tui/components/progress-bar.js +3 -15
- package/dist/tui/components/select-list.d.ts +0 -15
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +5 -28
- package/dist/tui/components/tool-execution.d.ts +3 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +26 -38
- 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/editor-launcher.d.ts +13 -0
- package/dist/tui/editor-launcher.d.ts.map +1 -0
- package/dist/tui/editor-launcher.js +39 -0
- package/dist/tui/index.d.ts +7 -3
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +3 -2
- package/dist/tui/terminal.d.ts +29 -2
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +153 -28
- package/dist/tui/tui.d.ts +2 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +39 -29
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +2 -3
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +4 -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.d.ts +1 -0
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +17 -0
- package/package.json +31 -29
- package/bin/acai-wrapper.js +0 -26
- 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/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 -43
- 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 -55
- 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 -124
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- 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 -42
- 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 -36
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -30
- 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 -68
- 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/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -118
- 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 -71
- 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/model-command.d.ts +0 -3
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/paste-command.d.ts.map +0 -1
- 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 -109
- package/dist/commands/prompt-command.d.ts +0 -21
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -258
- 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 -73
- 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 -31
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/project-status-line.d.ts +0 -3
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -61
- 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/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -120
- package/dist/tokens/threshold.d.ts +0 -20
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -67
- 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 -285
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -117
- package/dist/tools/batch.d.ts +0 -34
- package/dist/tools/batch.d.ts.map +0 -1
- package/dist/tools/batch.js +0 -174
- 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 -183
- 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 -77
- 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/llm-edit-fixer.d.ts +0 -24
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -136
- 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 -65
- 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 -196
- 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 -148
- package/dist/tui/components/prompt-status.d.ts +0 -17
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -26
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noControlCharactersInRegex: handle terminal ansii codes */
|
|
2
|
+
/** biome-ignore-all lint/style/useNamingConvention: will fix later */
|
|
3
|
+
/**
|
|
4
|
+
* Kitty keyboard protocol key sequence helpers.
|
|
5
|
+
*
|
|
6
|
+
* The Kitty keyboard protocol sends enhanced escape sequences in the format:
|
|
7
|
+
* \x1b[<codepoint>;<modifier>u
|
|
8
|
+
*
|
|
9
|
+
* Modifier bits (before adding 1 for transmission):
|
|
10
|
+
* - Shift: 1 (value 2)
|
|
11
|
+
* - Alt: 2 (value 3)
|
|
12
|
+
* - Ctrl: 4 (value 5)
|
|
13
|
+
* - Super: 8 (value 9)
|
|
14
|
+
* - Hyper: 16
|
|
15
|
+
* - Meta: 32
|
|
16
|
+
* - Caps_Lock: 64
|
|
17
|
+
* - Num_Lock: 128
|
|
18
|
+
*
|
|
19
|
+
* See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
|
20
|
+
*
|
|
21
|
+
* NOTE: Some terminals (e.g., Ghostty on Linux) include lock key states
|
|
22
|
+
* (Caps Lock, Num Lock) in the modifier field. We mask these out when
|
|
23
|
+
* checking for key combinations since they shouldn't affect behavior.
|
|
24
|
+
*/
|
|
25
|
+
// Common codepoints
|
|
26
|
+
const CODEPOINTS = {
|
|
27
|
+
// Letters (lowercase ASCII)
|
|
28
|
+
a: 97,
|
|
29
|
+
c: 99,
|
|
30
|
+
d: 100,
|
|
31
|
+
e: 101,
|
|
32
|
+
g: 103,
|
|
33
|
+
k: 107,
|
|
34
|
+
l: 108,
|
|
35
|
+
o: 111,
|
|
36
|
+
p: 112,
|
|
37
|
+
t: 116,
|
|
38
|
+
u: 117,
|
|
39
|
+
w: 119,
|
|
40
|
+
z: 122,
|
|
41
|
+
// Special keys
|
|
42
|
+
escape: 27,
|
|
43
|
+
tab: 9,
|
|
44
|
+
enter: 13,
|
|
45
|
+
backspace: 127,
|
|
46
|
+
};
|
|
47
|
+
// Lock key bits to ignore when matching (Caps Lock + Num Lock)
|
|
48
|
+
const LOCK_MASK = 64 + 128; // 192
|
|
49
|
+
// Modifier bits (before adding 1)
|
|
50
|
+
const MODIFIERS = {
|
|
51
|
+
shift: 1,
|
|
52
|
+
alt: 2,
|
|
53
|
+
ctrl: 4,
|
|
54
|
+
super: 8,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Build a Kitty keyboard protocol sequence for a key with modifier.
|
|
58
|
+
*/
|
|
59
|
+
function kittySequence(codepoint, modifier) {
|
|
60
|
+
return `\x1b[${codepoint};${modifier + 1}u`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Parse a Kitty keyboard protocol sequence.
|
|
64
|
+
* Handles formats:
|
|
65
|
+
* - \x1b[<codepoint>u (no modifier)
|
|
66
|
+
* - \x1b[<codepoint>;<modifier>u (with modifier)
|
|
67
|
+
* - \x1b[1;<modifier>A/B/C/D (arrow keys with modifier)
|
|
68
|
+
*
|
|
69
|
+
* Returns null if not a valid Kitty sequence.
|
|
70
|
+
*/
|
|
71
|
+
// Virtual codepoints for functional keys (negative to avoid conflicts)
|
|
72
|
+
const FUNCTIONAL_CODEPOINTS = {
|
|
73
|
+
delete: -10,
|
|
74
|
+
insert: -11,
|
|
75
|
+
pageUp: -12,
|
|
76
|
+
pageDown: -13,
|
|
77
|
+
home: -14,
|
|
78
|
+
end: -15,
|
|
79
|
+
};
|
|
80
|
+
function parseKittySequence(data) {
|
|
81
|
+
// Match CSI u format: \x1b[<num>u or \x1b[<num>;<mod>u
|
|
82
|
+
const csiUMatch = data.match(/^\x1b\[(\d+)(?:;(\d+))?u$/);
|
|
83
|
+
if (csiUMatch?.[1]) {
|
|
84
|
+
const codepoint = Number.parseInt(csiUMatch[1], 10);
|
|
85
|
+
const modValue = csiUMatch[2] ? Number.parseInt(csiUMatch[2], 10) : 1;
|
|
86
|
+
return { codepoint, modifier: modValue - 1 };
|
|
87
|
+
}
|
|
88
|
+
// Match arrow keys with modifier: \x1b[1;<mod>A/B/C/D
|
|
89
|
+
const arrowMatch = data.match(/^\x1b\[1;(\d+)([ABCD])$/);
|
|
90
|
+
if (arrowMatch?.[1] && arrowMatch?.[2]) {
|
|
91
|
+
const modValue = Number.parseInt(arrowMatch[1], 10);
|
|
92
|
+
// Map arrow letters to virtual codepoints for easier matching
|
|
93
|
+
const arrowCodes = { A: -1, B: -2, C: -3, D: -4 };
|
|
94
|
+
const codepoint = arrowCodes[arrowMatch[2]];
|
|
95
|
+
return { codepoint, modifier: modValue - 1 };
|
|
96
|
+
}
|
|
97
|
+
// Match functional keys with ~ terminator: \x1b[<num>~ or \x1b[<num>;<mod>~
|
|
98
|
+
// DELETE=3, INSERT=2, PAGEUP=5, PAGEDOWN=6, etc.
|
|
99
|
+
const funcMatch = data.match(/^\x1b\[(\d+)(?:;(\d+))?~$/);
|
|
100
|
+
if (funcMatch?.[1]) {
|
|
101
|
+
const keyNum = Number.parseInt(funcMatch[1], 10);
|
|
102
|
+
const modValue = funcMatch[2] ? Number.parseInt(funcMatch[2], 10) : 1;
|
|
103
|
+
// Map functional key numbers to virtual codepoints
|
|
104
|
+
const funcCodes = {
|
|
105
|
+
2: FUNCTIONAL_CODEPOINTS.insert,
|
|
106
|
+
3: FUNCTIONAL_CODEPOINTS.delete,
|
|
107
|
+
5: FUNCTIONAL_CODEPOINTS.pageUp,
|
|
108
|
+
6: FUNCTIONAL_CODEPOINTS.pageDown,
|
|
109
|
+
7: FUNCTIONAL_CODEPOINTS.home, // Alternative home
|
|
110
|
+
8: FUNCTIONAL_CODEPOINTS.end, // Alternative end
|
|
111
|
+
};
|
|
112
|
+
const codepoint = funcCodes[keyNum];
|
|
113
|
+
if (codepoint !== undefined) {
|
|
114
|
+
return { codepoint, modifier: modValue - 1 };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Match Home/End with modifier: \x1b[1;<mod>H/F
|
|
118
|
+
const homeEndMatch = data.match(/^\x1b\[1;(\d+)([HF])$/);
|
|
119
|
+
if (homeEndMatch?.[1]) {
|
|
120
|
+
const modValue = Number.parseInt(homeEndMatch[1], 10);
|
|
121
|
+
const codepoint = homeEndMatch[2] === "H"
|
|
122
|
+
? FUNCTIONAL_CODEPOINTS.home
|
|
123
|
+
: FUNCTIONAL_CODEPOINTS.end;
|
|
124
|
+
return { codepoint, modifier: modValue - 1 };
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Check if a Kitty sequence matches the expected codepoint and modifier,
|
|
130
|
+
* ignoring lock key bits (Caps Lock, Num Lock).
|
|
131
|
+
*/
|
|
132
|
+
function matchesKittySequence(data, expectedCodepoint, expectedModifier) {
|
|
133
|
+
const parsed = parseKittySequence(data);
|
|
134
|
+
if (!parsed)
|
|
135
|
+
return false;
|
|
136
|
+
// Mask out lock bits from both sides for comparison
|
|
137
|
+
const actualMod = parsed.modifier & ~LOCK_MASK;
|
|
138
|
+
const expectedMod = expectedModifier & ~LOCK_MASK;
|
|
139
|
+
return parsed.codepoint === expectedCodepoint && actualMod === expectedMod;
|
|
140
|
+
}
|
|
141
|
+
// Pre-built sequences for common key combinations
|
|
142
|
+
const Keys = {
|
|
143
|
+
// Ctrl+<letter> combinations
|
|
144
|
+
CTRL_A: kittySequence(CODEPOINTS.a, MODIFIERS.ctrl),
|
|
145
|
+
CTRL_C: kittySequence(CODEPOINTS.c, MODIFIERS.ctrl),
|
|
146
|
+
CTRL_D: kittySequence(CODEPOINTS.d, MODIFIERS.ctrl),
|
|
147
|
+
CTRL_E: kittySequence(CODEPOINTS.e, MODIFIERS.ctrl),
|
|
148
|
+
CTRL_G: kittySequence(CODEPOINTS.g, MODIFIERS.ctrl),
|
|
149
|
+
CTRL_K: kittySequence(CODEPOINTS.k, MODIFIERS.ctrl),
|
|
150
|
+
CTRL_L: kittySequence(CODEPOINTS.l, MODIFIERS.ctrl),
|
|
151
|
+
CTRL_O: kittySequence(CODEPOINTS.o, MODIFIERS.ctrl),
|
|
152
|
+
CTRL_P: kittySequence(CODEPOINTS.p, MODIFIERS.ctrl),
|
|
153
|
+
CTRL_T: kittySequence(CODEPOINTS.t, MODIFIERS.ctrl),
|
|
154
|
+
CTRL_U: kittySequence(CODEPOINTS.u, MODIFIERS.ctrl),
|
|
155
|
+
CTRL_W: kittySequence(CODEPOINTS.w, MODIFIERS.ctrl),
|
|
156
|
+
CTRL_Z: kittySequence(CODEPOINTS.z, MODIFIERS.ctrl),
|
|
157
|
+
// Enter combinations
|
|
158
|
+
SHIFT_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.shift),
|
|
159
|
+
ALT_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.alt),
|
|
160
|
+
CTRL_ENTER: kittySequence(CODEPOINTS.enter, MODIFIERS.ctrl),
|
|
161
|
+
// Tab combinations
|
|
162
|
+
SHIFT_TAB: kittySequence(CODEPOINTS.tab, MODIFIERS.shift),
|
|
163
|
+
// Backspace combinations
|
|
164
|
+
ALT_BACKSPACE: kittySequence(CODEPOINTS.backspace, MODIFIERS.alt),
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Check if input matches a Kitty protocol Ctrl+<key> sequence.
|
|
168
|
+
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
169
|
+
* @param data - The input data to check
|
|
170
|
+
* @param key - Single lowercase letter (e.g., 'c' for Ctrl+C)
|
|
171
|
+
*/
|
|
172
|
+
export function isKittyCtrl(data, key) {
|
|
173
|
+
if (key.length !== 1)
|
|
174
|
+
return false;
|
|
175
|
+
const codepoint = key.charCodeAt(0);
|
|
176
|
+
// Check exact match first (fast path)
|
|
177
|
+
if (data === kittySequence(codepoint, MODIFIERS.ctrl))
|
|
178
|
+
return true;
|
|
179
|
+
// Check with lock bits masked out
|
|
180
|
+
return matchesKittySequence(data, codepoint, MODIFIERS.ctrl);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Check if input matches a Kitty protocol key sequence with specific modifier.
|
|
184
|
+
* Ignores lock key bits (Caps Lock, Num Lock).
|
|
185
|
+
* @param data - The input data to check
|
|
186
|
+
* @param codepoint - ASCII codepoint of the key
|
|
187
|
+
* @param modifier - Modifier value (use MODIFIERS constants)
|
|
188
|
+
*/
|
|
189
|
+
export function isKittyKey(data, codepoint, modifier) {
|
|
190
|
+
// Check exact match first (fast path)
|
|
191
|
+
if (data === kittySequence(codepoint, modifier))
|
|
192
|
+
return true;
|
|
193
|
+
// Check with lock bits masked out
|
|
194
|
+
return matchesKittySequence(data, codepoint, modifier);
|
|
195
|
+
}
|
|
196
|
+
// Raw control character codes
|
|
197
|
+
const RAW = {
|
|
198
|
+
CTRL_A: "\x01",
|
|
199
|
+
CTRL_C: "\x03",
|
|
200
|
+
CTRL_D: "\x04",
|
|
201
|
+
CTRL_E: "\x05",
|
|
202
|
+
CTRL_G: "\x07",
|
|
203
|
+
CTRL_K: "\x0b",
|
|
204
|
+
CTRL_L: "\x0c",
|
|
205
|
+
CTRL_O: "\x0f",
|
|
206
|
+
CTRL_P: "\x10",
|
|
207
|
+
CTRL_T: "\x14",
|
|
208
|
+
CTRL_U: "\x15",
|
|
209
|
+
CTRL_W: "\x17",
|
|
210
|
+
CTRL_Z: "\x1a",
|
|
211
|
+
ALT_BACKSPACE: "\x1b\x7f",
|
|
212
|
+
SHIFT_TAB: "\x1b[Z",
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Check if input matches Ctrl+A (raw byte or Kitty protocol).
|
|
216
|
+
* Ignores lock key bits.
|
|
217
|
+
*/
|
|
218
|
+
export function isCtrlA(data) {
|
|
219
|
+
return (data === RAW.CTRL_A ||
|
|
220
|
+
data === Keys.CTRL_A ||
|
|
221
|
+
matchesKittySequence(data, CODEPOINTS.a, MODIFIERS.ctrl));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Check if input matches Ctrl+C (raw byte or Kitty protocol).
|
|
225
|
+
* Ignores lock key bits.
|
|
226
|
+
*/
|
|
227
|
+
export function isCtrlC(data) {
|
|
228
|
+
return (data === RAW.CTRL_C ||
|
|
229
|
+
data === Keys.CTRL_C ||
|
|
230
|
+
matchesKittySequence(data, CODEPOINTS.c, MODIFIERS.ctrl));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Check if input matches Ctrl+D (raw byte or Kitty protocol).
|
|
234
|
+
* Ignores lock key bits.
|
|
235
|
+
*/
|
|
236
|
+
export function isCtrlD(data) {
|
|
237
|
+
return (data === RAW.CTRL_D ||
|
|
238
|
+
data === Keys.CTRL_D ||
|
|
239
|
+
matchesKittySequence(data, CODEPOINTS.d, MODIFIERS.ctrl));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Check if input matches Ctrl+E (raw byte or Kitty protocol).
|
|
243
|
+
* Ignores lock key bits.
|
|
244
|
+
*/
|
|
245
|
+
export function isCtrlE(data) {
|
|
246
|
+
return (data === RAW.CTRL_E ||
|
|
247
|
+
data === Keys.CTRL_E ||
|
|
248
|
+
matchesKittySequence(data, CODEPOINTS.e, MODIFIERS.ctrl));
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Check if input matches Ctrl+G (raw byte or Kitty protocol).
|
|
252
|
+
* Ignores lock key bits.
|
|
253
|
+
*/
|
|
254
|
+
export function isCtrlG(data) {
|
|
255
|
+
return (data === RAW.CTRL_G ||
|
|
256
|
+
data === Keys.CTRL_G ||
|
|
257
|
+
matchesKittySequence(data, CODEPOINTS.g, MODIFIERS.ctrl));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Check if input matches Ctrl+K (raw byte or Kitty protocol).
|
|
261
|
+
* Ignores lock key bits.
|
|
262
|
+
* Also checks if first byte is 0x0b for compatibility with terminals
|
|
263
|
+
* that may send trailing bytes.
|
|
264
|
+
*/
|
|
265
|
+
export function isCtrlK(data) {
|
|
266
|
+
return (data === RAW.CTRL_K ||
|
|
267
|
+
(data.length > 0 && data.charCodeAt(0) === 0x0b) || // compatibility with terminals that may send trailing bytes
|
|
268
|
+
data === Keys.CTRL_K ||
|
|
269
|
+
matchesKittySequence(data, CODEPOINTS.k, MODIFIERS.ctrl));
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Check if input matches Ctrl+L (raw byte or Kitty protocol).
|
|
273
|
+
* Ignores lock key bits.
|
|
274
|
+
*/
|
|
275
|
+
export function isCtrlL(data) {
|
|
276
|
+
return (data === RAW.CTRL_L ||
|
|
277
|
+
data === Keys.CTRL_L ||
|
|
278
|
+
matchesKittySequence(data, CODEPOINTS.l, MODIFIERS.ctrl));
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Check if input matches Ctrl+O (raw byte or Kitty protocol).
|
|
282
|
+
* Ignores lock key bits.
|
|
283
|
+
*/
|
|
284
|
+
export function isCtrlO(data) {
|
|
285
|
+
return (data === RAW.CTRL_O ||
|
|
286
|
+
data === Keys.CTRL_O ||
|
|
287
|
+
matchesKittySequence(data, CODEPOINTS.o, MODIFIERS.ctrl));
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Check if input matches Shift+Ctrl+O (Kitty protocol only).
|
|
291
|
+
* Ignores lock key bits.
|
|
292
|
+
*/
|
|
293
|
+
export function isShiftCtrlO(data) {
|
|
294
|
+
return matchesKittySequence(data, CODEPOINTS.o, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Check if input matches Ctrl+P (raw byte or Kitty protocol).
|
|
298
|
+
* Ignores lock key bits.
|
|
299
|
+
*/
|
|
300
|
+
export function isCtrlP(data) {
|
|
301
|
+
return (data === RAW.CTRL_P ||
|
|
302
|
+
data === Keys.CTRL_P ||
|
|
303
|
+
matchesKittySequence(data, CODEPOINTS.p, MODIFIERS.ctrl));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Check if input matches Shift+Ctrl+P (Kitty protocol only).
|
|
307
|
+
* Ignores lock key bits.
|
|
308
|
+
*/
|
|
309
|
+
export function isShiftCtrlP(data) {
|
|
310
|
+
return matchesKittySequence(data, CODEPOINTS.p, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Check if input matches Shift+Ctrl+D (Kitty protocol only, for debug).
|
|
314
|
+
* Ignores lock key bits.
|
|
315
|
+
*/
|
|
316
|
+
export function isShiftCtrlD(data) {
|
|
317
|
+
return matchesKittySequence(data, CODEPOINTS.d, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Check if input matches Ctrl+T (raw byte or Kitty protocol).
|
|
321
|
+
* Ignores lock key bits.
|
|
322
|
+
*/
|
|
323
|
+
export function isCtrlT(data) {
|
|
324
|
+
return (data === RAW.CTRL_T ||
|
|
325
|
+
data === Keys.CTRL_T ||
|
|
326
|
+
matchesKittySequence(data, CODEPOINTS.t, MODIFIERS.ctrl));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Check if input matches Ctrl+U (raw byte or Kitty protocol).
|
|
330
|
+
* Ignores lock key bits.
|
|
331
|
+
*/
|
|
332
|
+
export function isCtrlU(data) {
|
|
333
|
+
return (data === RAW.CTRL_U ||
|
|
334
|
+
data === Keys.CTRL_U ||
|
|
335
|
+
matchesKittySequence(data, CODEPOINTS.u, MODIFIERS.ctrl));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Check if input matches Ctrl+W (raw byte or Kitty protocol).
|
|
339
|
+
* Ignores lock key bits.
|
|
340
|
+
*/
|
|
341
|
+
export function isCtrlW(data) {
|
|
342
|
+
return (data === RAW.CTRL_W ||
|
|
343
|
+
data === Keys.CTRL_W ||
|
|
344
|
+
matchesKittySequence(data, CODEPOINTS.w, MODIFIERS.ctrl));
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Check if input matches Ctrl+Z (raw byte or Kitty protocol).
|
|
348
|
+
* Ignores lock key bits.
|
|
349
|
+
*/
|
|
350
|
+
export function isCtrlZ(data) {
|
|
351
|
+
return (data === RAW.CTRL_Z ||
|
|
352
|
+
data === Keys.CTRL_Z ||
|
|
353
|
+
matchesKittySequence(data, CODEPOINTS.z, MODIFIERS.ctrl));
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Check if input matches Alt+Backspace (legacy or Kitty protocol).
|
|
357
|
+
* Ignores lock key bits.
|
|
358
|
+
*/
|
|
359
|
+
export function isAltBackspace(data) {
|
|
360
|
+
return (data === RAW.ALT_BACKSPACE ||
|
|
361
|
+
data === Keys.ALT_BACKSPACE ||
|
|
362
|
+
matchesKittySequence(data, CODEPOINTS.backspace, MODIFIERS.alt));
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Check if input matches Shift+Tab (legacy or Kitty protocol).
|
|
366
|
+
* Ignores lock key bits.
|
|
367
|
+
*/
|
|
368
|
+
export function isShiftTab(data) {
|
|
369
|
+
return (data === RAW.SHIFT_TAB ||
|
|
370
|
+
data === Keys.SHIFT_TAB ||
|
|
371
|
+
data === "\x1b[1;2Z" || // shift+tab with modifier
|
|
372
|
+
matchesKittySequence(data, CODEPOINTS.tab, MODIFIERS.shift));
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Check if input matches the Escape key (raw byte or Kitty protocol).
|
|
376
|
+
* Raw: \x1b (single byte)
|
|
377
|
+
* Kitty: \x1b[27u (codepoint 27 = escape)
|
|
378
|
+
* Ignores lock key bits.
|
|
379
|
+
*/
|
|
380
|
+
export function isEscape(data) {
|
|
381
|
+
return (data === "\x1b" ||
|
|
382
|
+
data === `\x1b[${CODEPOINTS.escape}u` ||
|
|
383
|
+
matchesKittySequence(data, CODEPOINTS.escape, 0));
|
|
384
|
+
}
|
|
385
|
+
// Arrow key virtual codepoints (negative to avoid conflicts with real codepoints)
|
|
386
|
+
const ARROW_CODEPOINTS = {
|
|
387
|
+
up: -1,
|
|
388
|
+
down: -2,
|
|
389
|
+
right: -3,
|
|
390
|
+
left: -4,
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* Check if input matches Arrow Up key.
|
|
394
|
+
* Handles both legacy (\x1b[A) and Kitty protocol with modifiers.
|
|
395
|
+
*/
|
|
396
|
+
export function isArrowUp(data) {
|
|
397
|
+
return (data === "\x1b[A" || matchesKittySequence(data, ARROW_CODEPOINTS.up, 0));
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Check if input matches Arrow Down key.
|
|
401
|
+
* Handles both legacy (\x1b[B) and Kitty protocol with modifiers.
|
|
402
|
+
*/
|
|
403
|
+
export function isArrowDown(data) {
|
|
404
|
+
return (data === "\x1b[B" || matchesKittySequence(data, ARROW_CODEPOINTS.down, 0));
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Check if input matches Arrow Right key.
|
|
408
|
+
* Handles both legacy (\x1b[C) and Kitty protocol with modifiers.
|
|
409
|
+
*/
|
|
410
|
+
export function isArrowRight(data) {
|
|
411
|
+
return (data === "\x1b[C" || matchesKittySequence(data, ARROW_CODEPOINTS.right, 0));
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Check if input matches Arrow Left key.
|
|
415
|
+
* Handles both legacy (\x1b[D) and Kitty protocol with modifiers.
|
|
416
|
+
*/
|
|
417
|
+
export function isArrowLeft(data) {
|
|
418
|
+
return (data === "\x1b[D" || matchesKittySequence(data, ARROW_CODEPOINTS.left, 0));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Check if input matches plain Tab key (no modifiers).
|
|
422
|
+
* Handles both legacy (\t) and Kitty protocol.
|
|
423
|
+
*/
|
|
424
|
+
export function isTab(data) {
|
|
425
|
+
return data === "\t" || matchesKittySequence(data, CODEPOINTS.tab, 0);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Check if input matches plain Enter/Return key (no modifiers).
|
|
429
|
+
* Handles both legacy (\r) and Kitty protocol.
|
|
430
|
+
*/
|
|
431
|
+
export function isEnter(data) {
|
|
432
|
+
return data === "\r" || matchesKittySequence(data, CODEPOINTS.enter, 0);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Check if input matches plain Backspace key (no modifiers).
|
|
436
|
+
* Handles both legacy (\x7f, \x08) and Kitty protocol.
|
|
437
|
+
*/
|
|
438
|
+
export function isBackspace(data) {
|
|
439
|
+
return (data === "\x7f" ||
|
|
440
|
+
data === "\x08" ||
|
|
441
|
+
matchesKittySequence(data, CODEPOINTS.backspace, 0));
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Check if input matches Shift+Enter.
|
|
445
|
+
* Ignores lock key bits.
|
|
446
|
+
*/
|
|
447
|
+
export function isShiftEnter(data) {
|
|
448
|
+
return (data === Keys.SHIFT_ENTER ||
|
|
449
|
+
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.shift));
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Check if input matches Alt+Enter.
|
|
453
|
+
* Ignores lock key bits.
|
|
454
|
+
*/
|
|
455
|
+
export function isAltEnter(data) {
|
|
456
|
+
return (data === Keys.ALT_ENTER ||
|
|
457
|
+
data === "\x1b\r" ||
|
|
458
|
+
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.alt));
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Check if input matches Option/Alt+Left (word navigation).
|
|
462
|
+
* Handles multiple formats including Kitty protocol.
|
|
463
|
+
*/
|
|
464
|
+
export function isAltLeft(data) {
|
|
465
|
+
return (data === "\x1b[1;3D" ||
|
|
466
|
+
data === "\x1bb" ||
|
|
467
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.alt));
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Check if input matches Option/Alt+Right (word navigation).
|
|
471
|
+
* Handles multiple formats including Kitty protocol.
|
|
472
|
+
*/
|
|
473
|
+
export function isAltRight(data) {
|
|
474
|
+
return (data === "\x1b[1;3C" ||
|
|
475
|
+
data === "\x1bf" ||
|
|
476
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.alt));
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Check if input matches Ctrl+Left (word navigation).
|
|
480
|
+
* Handles multiple formats including Kitty protocol.
|
|
481
|
+
*/
|
|
482
|
+
export function isCtrlLeft(data) {
|
|
483
|
+
return (data === "\x1b[1;5D" ||
|
|
484
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.ctrl));
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Check if input matches Ctrl+Right (word navigation).
|
|
488
|
+
* Handles multiple formats including Kitty protocol.
|
|
489
|
+
*/
|
|
490
|
+
export function isCtrlRight(data) {
|
|
491
|
+
return (data === "\x1b[1;5C" ||
|
|
492
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.ctrl));
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Check if input matches Home key.
|
|
496
|
+
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
497
|
+
*/
|
|
498
|
+
export function isHome(data) {
|
|
499
|
+
return (data === "\x1b[H" ||
|
|
500
|
+
data === "\x1b[1~" ||
|
|
501
|
+
data === "\x1b[7~" ||
|
|
502
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.home, 0));
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Check if input matches End key.
|
|
506
|
+
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
507
|
+
*/
|
|
508
|
+
export function isEnd(data) {
|
|
509
|
+
return (data === "\x1b[F" ||
|
|
510
|
+
data === "\x1b[4~" ||
|
|
511
|
+
data === "\x1b[8~" ||
|
|
512
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.end, 0));
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Check if input matches Delete key (forward delete).
|
|
516
|
+
* Handles legacy format and Kitty protocol with lock key modifiers.
|
|
517
|
+
*/
|
|
518
|
+
export function isDelete(data) {
|
|
519
|
+
return (data === "\x1b[3~" ||
|
|
520
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.delete, 0));
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Check if input matches Page Up key.
|
|
524
|
+
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
525
|
+
*/
|
|
526
|
+
export function isPageUp(data) {
|
|
527
|
+
return (data === "\x1b[5~" ||
|
|
528
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageUp, 0));
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Check if input matches Page Down key.
|
|
532
|
+
* Handles legacy formats and Kitty protocol with lock key modifiers.
|
|
533
|
+
*/
|
|
534
|
+
export function isPageDown(data) {
|
|
535
|
+
return (data === "\x1b[6~" ||
|
|
536
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageDown, 0));
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Check if key data represents navigation key (arrows, Tab, Shift+Tab).
|
|
540
|
+
*/
|
|
541
|
+
export function isNavigationKey(keyData) {
|
|
542
|
+
return (isArrowUp(keyData) ||
|
|
543
|
+
isArrowDown(keyData) ||
|
|
544
|
+
isTab(keyData) ||
|
|
545
|
+
isShiftTab(keyData));
|
|
546
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmenter.d.ts","sourceRoot":"","sources":["../../source/terminal/segmenter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,YAAY,IAAI,IAAI,CAAC,SAAS,CAK7C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Intl.Segmenter singleton for grapheme segmentation.
|
|
3
|
+
* Used for proper Unicode iteration (handles emojis, combining characters, etc.)
|
|
4
|
+
*/
|
|
5
|
+
let segmenter = null;
|
|
6
|
+
export function getSegmenter() {
|
|
7
|
+
if (!segmenter) {
|
|
8
|
+
segmenter = new Intl.Segmenter();
|
|
9
|
+
}
|
|
10
|
+
return segmenter;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AAyBH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,KAAK,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAQpD,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,UAAU,aAAa,CAAC,CAAC,GAAG,OAAO;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAgGD,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EACxC,OAAkB,EAClB,OAAO,EACP,OAAW,EACX,QAAY,EACZ,MAAM,EACN,QAA2D,GAC5D,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgN/B"}
|
|
@@ -3,19 +3,7 @@
|
|
|
3
3
|
* Standalone select prompt (inquirer-like)
|
|
4
4
|
* - TypeScript version
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
up: "\x1b[A",
|
|
8
|
-
down: "\x1b[B",
|
|
9
|
-
home: "\x1b[H",
|
|
10
|
-
homeAlt: "\x1b[1~",
|
|
11
|
-
end: "\x1b[F",
|
|
12
|
-
endAlt: "\x1b[4~",
|
|
13
|
-
ctrlC: "\u0003",
|
|
14
|
-
enter: "\r",
|
|
15
|
-
newline: "\n",
|
|
16
|
-
backspace: "\x7f",
|
|
17
|
-
backspaceAlt: "\b",
|
|
18
|
-
};
|
|
6
|
+
import { isArrowDown, isArrowUp, isBackspace, isCtrlC, isEnd, isEnter, isHome, } from "./keys.js";
|
|
19
7
|
const ANSI = {
|
|
20
8
|
hideCursor: "\x1b[?25l",
|
|
21
9
|
showCursor: "\x1b[?25h",
|
|
@@ -189,7 +177,7 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
189
177
|
signal.addEventListener("abort", abortHandler);
|
|
190
178
|
}
|
|
191
179
|
function onData(key) {
|
|
192
|
-
if (key
|
|
180
|
+
if (isCtrlC(key)) {
|
|
193
181
|
cleanup();
|
|
194
182
|
stdout.write("\n");
|
|
195
183
|
const err = new Error("Cancelled");
|
|
@@ -197,34 +185,34 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
197
185
|
reject(err);
|
|
198
186
|
return;
|
|
199
187
|
}
|
|
200
|
-
if (key
|
|
188
|
+
if (isEnter(key)) {
|
|
201
189
|
cleanup();
|
|
202
190
|
const chosen = filteredChoices[pointer];
|
|
203
191
|
stdout.write("\n");
|
|
204
192
|
resolve(chosen.value);
|
|
205
193
|
return;
|
|
206
194
|
}
|
|
207
|
-
if (key
|
|
195
|
+
if (isArrowUp(key)) {
|
|
208
196
|
move(-1);
|
|
209
197
|
return;
|
|
210
198
|
}
|
|
211
|
-
if (key
|
|
199
|
+
if (isArrowDown(key)) {
|
|
212
200
|
move(1);
|
|
213
201
|
return;
|
|
214
202
|
}
|
|
215
|
-
if (key
|
|
203
|
+
if (isHome(key)) {
|
|
216
204
|
pointer = findFirstEnabledIndex(filteredChoices);
|
|
217
205
|
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
218
206
|
renderToScreen();
|
|
219
207
|
return;
|
|
220
208
|
}
|
|
221
|
-
if (key
|
|
209
|
+
if (isEnd(key)) {
|
|
222
210
|
pointer = findLastEnabledIndex(filteredChoices);
|
|
223
211
|
pageStart = updatePageStart(pointer, pageSize, filteredChoices.length);
|
|
224
212
|
renderToScreen();
|
|
225
213
|
return;
|
|
226
214
|
}
|
|
227
|
-
if (key
|
|
215
|
+
if (isBackspace(key)) {
|
|
228
216
|
if (searchBuffer.length > 0) {
|
|
229
217
|
searchBuffer = searchBuffer.slice(0, -1);
|
|
230
218
|
if (searchBuffer.length === 0) {
|
|
@@ -269,7 +257,7 @@ export async function select({ message = "Select", choices, initial = 0, pageSiz
|
|
|
269
257
|
});
|
|
270
258
|
}
|
|
271
259
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
272
|
-
(async () => {
|
|
260
|
+
void (async () => {
|
|
273
261
|
try {
|
|
274
262
|
const res = await select({
|
|
275
263
|
message: "Pick a fruit",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-width.d.ts","sourceRoot":"","sources":["../../source/terminal/string-width.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string-width.d.ts","sourceRoot":"","sources":["../../source/terminal/string-width.ts"],"names":[],"mappings":"AAIA,UAAU,kBAAkB;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AA8CD,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAuDR"}
|