@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
package/dist/tui/terminal.js
CHANGED
|
@@ -1,36 +1,120 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import tty from "node:tty";
|
|
1
3
|
/**
|
|
2
4
|
* Real terminal using process.stdin/stdout
|
|
5
|
+
*
|
|
6
|
+
* When useTty is true (for piped stdin scenarios), input is read from /dev/tty
|
|
7
|
+
* instead of process.stdin, allowing interactive input after piped content.
|
|
3
8
|
*/
|
|
4
9
|
export class ProcessTerminal {
|
|
5
10
|
wasRaw = false;
|
|
6
11
|
sigintHandler;
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
boundInputListener;
|
|
13
|
+
boundResizeListener;
|
|
9
14
|
stopped = false;
|
|
15
|
+
inExternalMode = false;
|
|
16
|
+
resumeCallback;
|
|
17
|
+
inputStream;
|
|
18
|
+
ttyFd;
|
|
19
|
+
useTty;
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this.useTty = options.useTty ?? false;
|
|
22
|
+
this.inputStream = process.stdin;
|
|
23
|
+
}
|
|
24
|
+
handleSigCont = () => {
|
|
25
|
+
if (this.inExternalMode) {
|
|
26
|
+
this.exitExternalMode();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
10
29
|
start(onInput, onResize) {
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
if (this.useTty) {
|
|
31
|
+
try {
|
|
32
|
+
this.ttyFd = fs.openSync("/dev/tty", "r");
|
|
33
|
+
this.inputStream = new tty.ReadStream(this.ttyFd);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
throw new Error("Cannot open /dev/tty for interactive input");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.inputStream = process.stdin;
|
|
41
|
+
}
|
|
42
|
+
if (!this.inputStream.isTTY || !process.stdout.isTTY) {
|
|
14
43
|
throw new Error("Terminal requires TTY environment");
|
|
15
44
|
}
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
process.stdin.setRawMode(true);
|
|
45
|
+
this.wasRaw = this.inputStream.isRaw ?? false;
|
|
46
|
+
if (this.inputStream.setRawMode) {
|
|
47
|
+
this.inputStream.setRawMode(true);
|
|
20
48
|
}
|
|
21
|
-
|
|
22
|
-
|
|
49
|
+
this.inputStream.setEncoding("utf8");
|
|
50
|
+
this.inputStream.resume();
|
|
23
51
|
// Enable bracketed paste mode - terminal will wrap pastes in \x1b[200~ ... \x1b[201~
|
|
24
52
|
process.stdout.write("\x1b[?2004h");
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
53
|
+
// Create bound listeners so we can properly remove them later
|
|
54
|
+
this.boundInputListener = (data) => {
|
|
55
|
+
onInput(typeof data === "string" ? data : data.toString("utf8"));
|
|
56
|
+
};
|
|
57
|
+
this.boundResizeListener = () => {
|
|
58
|
+
onResize();
|
|
59
|
+
};
|
|
60
|
+
this.attachListeners();
|
|
61
|
+
this.sigintHandler = () => {
|
|
62
|
+
// Let the custom editor.onCtrlC handler in NewRepl handle Ctrl+C
|
|
63
|
+
// This prevents a race condition where stop() gets called without the exit message
|
|
64
|
+
};
|
|
65
|
+
process.on("SIGINT", this.sigintHandler);
|
|
66
|
+
process.on("SIGCONT", this.handleSigCont);
|
|
67
|
+
process.on("SIGTERM", () => this.stop());
|
|
68
|
+
process.on("SIGHUP", () => this.stop());
|
|
69
|
+
this.setupCrashCleanup();
|
|
70
|
+
}
|
|
71
|
+
attachListeners() {
|
|
72
|
+
if (this.boundInputListener) {
|
|
73
|
+
this.inputStream.on("data", this.boundInputListener);
|
|
74
|
+
}
|
|
75
|
+
if (this.boundResizeListener) {
|
|
76
|
+
process.stdout.on("resize", this.boundResizeListener);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
detachListeners() {
|
|
80
|
+
if (this.boundInputListener) {
|
|
81
|
+
this.inputStream.removeListener("data", this.boundInputListener);
|
|
82
|
+
}
|
|
83
|
+
if (this.boundResizeListener) {
|
|
84
|
+
process.stdout.removeListener("resize", this.boundResizeListener);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
setupCrashCleanup() {
|
|
88
|
+
process.on("exit", () => {
|
|
89
|
+
process.stdout.write("\x1b[?25h");
|
|
90
|
+
process.stdout.write("\x1b[?2004l");
|
|
91
|
+
process.stdout.write("\x1b[0m");
|
|
92
|
+
if (this.inputStream.setRawMode) {
|
|
93
|
+
this.inputStream.setRawMode(this.wasRaw);
|
|
94
|
+
}
|
|
95
|
+
this.closeTtyFd();
|
|
28
96
|
});
|
|
29
|
-
process.
|
|
30
|
-
|
|
97
|
+
process.on("uncaughtException", (error) => {
|
|
98
|
+
process.stdout.write("\x1b[?25h");
|
|
99
|
+
process.stdout.write("\x1b[?2004l");
|
|
100
|
+
process.stdout.write("\x1b[0m");
|
|
101
|
+
if (this.inputStream.setRawMode) {
|
|
102
|
+
this.inputStream.setRawMode(this.wasRaw);
|
|
103
|
+
}
|
|
104
|
+
this.closeTtyFd();
|
|
105
|
+
throw error;
|
|
31
106
|
});
|
|
32
|
-
|
|
33
|
-
|
|
107
|
+
}
|
|
108
|
+
closeTtyFd() {
|
|
109
|
+
if (this.ttyFd !== undefined) {
|
|
110
|
+
try {
|
|
111
|
+
fs.closeSync(this.ttyFd);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Ignore close errors
|
|
115
|
+
}
|
|
116
|
+
this.ttyFd = undefined;
|
|
117
|
+
}
|
|
34
118
|
}
|
|
35
119
|
stop() {
|
|
36
120
|
if (this.stopped)
|
|
@@ -38,23 +122,25 @@ export class ProcessTerminal {
|
|
|
38
122
|
this.stopped = true;
|
|
39
123
|
if (this.sigintHandler) {
|
|
40
124
|
process.off("SIGINT", this.sigintHandler);
|
|
125
|
+
this.sigintHandler = undefined;
|
|
41
126
|
}
|
|
42
127
|
// Disable bracketed paste mode
|
|
43
128
|
process.stdout.write("\x1b[?2004l");
|
|
44
|
-
// Remove event handlers
|
|
45
|
-
if (this.
|
|
46
|
-
|
|
47
|
-
this.
|
|
129
|
+
// Remove event handlers using the exact references that were added
|
|
130
|
+
if (this.boundInputListener) {
|
|
131
|
+
this.inputStream.removeListener("data", this.boundInputListener);
|
|
132
|
+
this.boundInputListener = undefined;
|
|
48
133
|
}
|
|
49
|
-
if (this.
|
|
50
|
-
process.stdout.removeListener("resize", this.
|
|
51
|
-
this.
|
|
134
|
+
if (this.boundResizeListener) {
|
|
135
|
+
process.stdout.removeListener("resize", this.boundResizeListener);
|
|
136
|
+
this.boundResizeListener = undefined;
|
|
52
137
|
}
|
|
53
|
-
|
|
138
|
+
this.inputStream.pause();
|
|
54
139
|
// Restore raw mode state
|
|
55
|
-
if (
|
|
56
|
-
|
|
140
|
+
if (this.inputStream.setRawMode) {
|
|
141
|
+
this.inputStream.setRawMode(this.wasRaw);
|
|
57
142
|
}
|
|
143
|
+
this.closeTtyFd();
|
|
58
144
|
}
|
|
59
145
|
write(data) {
|
|
60
146
|
process.stdout.write(data);
|
|
@@ -91,4 +177,43 @@ export class ProcessTerminal {
|
|
|
91
177
|
clearScreen() {
|
|
92
178
|
process.stdout.write("\x1b[2J\x1b[H"); // Clear screen and move to home (1,1)
|
|
93
179
|
}
|
|
180
|
+
enterExternalMode() {
|
|
181
|
+
if (this.inExternalMode || this.stopped)
|
|
182
|
+
return;
|
|
183
|
+
this.inExternalMode = true;
|
|
184
|
+
this.detachListeners();
|
|
185
|
+
this.inputStream.pause();
|
|
186
|
+
if (this.inputStream.setRawMode) {
|
|
187
|
+
this.inputStream.setRawMode(false);
|
|
188
|
+
}
|
|
189
|
+
process.stdout.write("\x1b[0m");
|
|
190
|
+
process.stdout.write("\x1b[?25h");
|
|
191
|
+
process.stdout.write("\x1b[?2004l");
|
|
192
|
+
}
|
|
193
|
+
exitExternalMode() {
|
|
194
|
+
if (!this.inExternalMode || this.stopped)
|
|
195
|
+
return;
|
|
196
|
+
this.inExternalMode = false;
|
|
197
|
+
if (this.inputStream.setRawMode) {
|
|
198
|
+
this.inputStream.setRawMode(true);
|
|
199
|
+
}
|
|
200
|
+
this.inputStream.setEncoding("utf8");
|
|
201
|
+
this.inputStream.resume();
|
|
202
|
+
process.stdout.write("\x1b[?2004h");
|
|
203
|
+
process.stdout.write("\x1b[?25l");
|
|
204
|
+
this.attachListeners();
|
|
205
|
+
if (this.resumeCallback) {
|
|
206
|
+
this.resumeCallback();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
background() {
|
|
210
|
+
this.enterExternalMode();
|
|
211
|
+
process.kill(process.pid, "SIGSTOP");
|
|
212
|
+
}
|
|
213
|
+
isInExternalMode() {
|
|
214
|
+
return this.inExternalMode;
|
|
215
|
+
}
|
|
216
|
+
onResume(callback) {
|
|
217
|
+
this.resumeCallback = callback;
|
|
218
|
+
}
|
|
94
219
|
}
|
package/dist/tui/tui.d.ts
CHANGED
|
@@ -46,11 +46,13 @@ export declare class TUI extends Container {
|
|
|
46
46
|
private isRendering;
|
|
47
47
|
private renderAgain;
|
|
48
48
|
private activeModal;
|
|
49
|
+
onCtrlC?: () => void;
|
|
49
50
|
constructor(terminal: Terminal);
|
|
50
51
|
setFocus(component: Component | null): void;
|
|
51
52
|
start(): void;
|
|
52
53
|
stop(): void;
|
|
53
54
|
requestRender(): void;
|
|
55
|
+
private inBracketedPaste;
|
|
54
56
|
private handleInput;
|
|
55
57
|
private doRender;
|
|
56
58
|
/**
|
package/dist/tui/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../source/tui/tui.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../source/tui/tui.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEhC;;OAEG;IACH,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC/C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;GAEG;AACH,qBAAa,SAAU,YAAW,SAAS;IACzC,QAAQ,EAAE,SAAS,EAAE,CAAM;IAE3B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIpC,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAOvC,KAAK,IAAI,IAAI;IAIb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAGhC;AAED;;GAEG;AAGH,qBAAa,GAAI,SAAQ,SAAS;IAChC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAsB;IAElC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;gBAEhB,QAAQ,EAAE,QAAQ;IAK9B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;IAI3C,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IAKZ,aAAa,IAAI,IAAI;IAarB,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,WAAW;IA6CnB,OAAO,CAAC,QAAQ;IA0FhB;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK7B;;OAEG;IACH,SAAS,IAAI,IAAI;IAKjB;;OAEG;IACH,aAAa,IAAI,OAAO;CAGzB"}
|
package/dist/tui/tui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Minimal TUI implementation with differential rendering
|
|
3
3
|
*/
|
|
4
|
-
import { getTerminalSize } from "../terminal/
|
|
4
|
+
import { getTerminalSize, isCtrlC, isCtrlZ, isEscape, } from "../terminal/control.js";
|
|
5
5
|
import style from "../terminal/style.js";
|
|
6
6
|
import { visibleWidth } from "./utils.js";
|
|
7
7
|
export { visibleWidth };
|
|
@@ -23,11 +23,7 @@ export class Container {
|
|
|
23
23
|
this.children = [];
|
|
24
24
|
}
|
|
25
25
|
render(width) {
|
|
26
|
-
|
|
27
|
-
for (const child of this.children) {
|
|
28
|
-
lines.push(...child.render(width));
|
|
29
|
-
}
|
|
30
|
-
return lines;
|
|
26
|
+
return this.children.flatMap((child) => child.render(width));
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
29
|
/**
|
|
@@ -41,6 +37,7 @@ export class TUI extends Container {
|
|
|
41
37
|
isRendering = false;
|
|
42
38
|
renderAgain = false;
|
|
43
39
|
activeModal = null;
|
|
40
|
+
onCtrlC;
|
|
44
41
|
constructor(terminal) {
|
|
45
42
|
super();
|
|
46
43
|
this.terminal = terminal;
|
|
@@ -50,6 +47,7 @@ export class TUI extends Container {
|
|
|
50
47
|
}
|
|
51
48
|
start() {
|
|
52
49
|
this.terminal.start((data) => this.handleInput(data), () => this.requestRender());
|
|
50
|
+
this.terminal.onResume(() => this.requestRender());
|
|
53
51
|
this.terminal.hideCursor();
|
|
54
52
|
this.requestRender();
|
|
55
53
|
}
|
|
@@ -70,15 +68,34 @@ export class TUI extends Container {
|
|
|
70
68
|
this.doRender();
|
|
71
69
|
});
|
|
72
70
|
}
|
|
71
|
+
inBracketedPaste = false;
|
|
73
72
|
handleInput(data) {
|
|
73
|
+
if (data.includes("\x1b[200~")) {
|
|
74
|
+
this.inBracketedPaste = true;
|
|
75
|
+
}
|
|
76
|
+
if (data.includes("\x1b[201~")) {
|
|
77
|
+
this.inBracketedPaste = false;
|
|
78
|
+
}
|
|
79
|
+
// Handle Ctrl+Z - background the process (POSIX only)
|
|
80
|
+
if (isCtrlZ(data) &&
|
|
81
|
+
!this.inBracketedPaste &&
|
|
82
|
+
process.platform !== "win32") {
|
|
83
|
+
this.terminal.background();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
74
86
|
// Handle Ctrl+C globally - exit the application
|
|
75
|
-
if (data
|
|
87
|
+
if (isCtrlC(data)) {
|
|
76
88
|
console.info("\nCtrl+C pressed - exiting...");
|
|
77
|
-
this.
|
|
78
|
-
|
|
89
|
+
if (this.onCtrlC) {
|
|
90
|
+
this.onCtrlC();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.stop();
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
79
96
|
}
|
|
80
97
|
// Handle Escape key to close modal if one is active
|
|
81
|
-
if (data
|
|
98
|
+
if (isEscape(data) && this.activeModal) {
|
|
82
99
|
this.hideModal();
|
|
83
100
|
return;
|
|
84
101
|
}
|
|
@@ -102,39 +119,32 @@ export class TUI extends Container {
|
|
|
102
119
|
const width = this.terminal.columns;
|
|
103
120
|
// Render all components to get new lines
|
|
104
121
|
const newLines = this.render(width);
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
buffer += "\r\n";
|
|
112
|
-
buffer += newLines[i];
|
|
113
|
-
}
|
|
122
|
+
// Build output buffer using array join (more efficient than string concat)
|
|
123
|
+
const bufferParts = [
|
|
124
|
+
"\x1b[?2026h", // Begin synchronized output
|
|
125
|
+
"\x1b[3J\x1b[2J\x1b[H", // Clear scrollback, screen, and home
|
|
126
|
+
newLines.join("\r\n"),
|
|
127
|
+
];
|
|
114
128
|
// Render modal on top if active
|
|
115
129
|
if (this.activeModal) {
|
|
116
130
|
const modalLines = this.activeModal.render(width);
|
|
117
131
|
// Render backdrop first if modal has backdrop
|
|
118
132
|
if (this.activeModal.backdrop) {
|
|
119
133
|
const backdropLine = style.bgRgb(0, 0, 0)(" ".repeat(width));
|
|
120
|
-
const {
|
|
121
|
-
for (let i = 0; i <
|
|
122
|
-
|
|
123
|
-
buffer += `\x1b[${i + 1};1H`;
|
|
124
|
-
buffer += backdropLine;
|
|
134
|
+
const { rows } = getTerminalSize();
|
|
135
|
+
for (let i = 0; i < rows; i++) {
|
|
136
|
+
bufferParts.push(`\x1b[${i + 1};1H`, backdropLine);
|
|
125
137
|
}
|
|
126
138
|
}
|
|
127
139
|
// Render modal content
|
|
128
140
|
for (let i = 0; i < modalLines.length; i++) {
|
|
129
141
|
if (modalLines[i]) {
|
|
130
|
-
|
|
131
|
-
buffer += `\x1b[${i + 1};1H`;
|
|
132
|
-
buffer += modalLines[i];
|
|
142
|
+
bufferParts.push(`\x1b[${i + 1};1H`, modalLines[i]);
|
|
133
143
|
}
|
|
134
144
|
}
|
|
135
145
|
}
|
|
136
|
-
|
|
137
|
-
this.terminal.write(
|
|
146
|
+
bufferParts.push("\x1b[?2026l"); // End synchronized output
|
|
147
|
+
this.terminal.write(bufferParts.join(""));
|
|
138
148
|
}
|
|
139
149
|
finally {
|
|
140
150
|
this.isRendering = false;
|
package/dist/tui/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../source/tui/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../source/tui/utils.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AA4BD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAQ,GACf,MAAM,CA+DR;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,CASR"}
|
package/dist/tui/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { getSegmenter } from "../terminal/segmenter.js";
|
|
1
2
|
import stringWidth from "../terminal/string-width.js";
|
|
2
|
-
// Grapheme segmenter for proper Unicode iteration (handles emojis, etc.)
|
|
3
|
-
const segmenter = new Intl.Segmenter();
|
|
4
3
|
/**
|
|
5
4
|
* Calculate the visible width of a string in terminal columns.
|
|
6
5
|
* This correctly handles:
|
|
@@ -67,7 +66,7 @@ export function truncateToWidth(text, maxWidth, ellipsis = "...") {
|
|
|
67
66
|
}
|
|
68
67
|
// Segment this non-ANSI portion into graphemes
|
|
69
68
|
const textPortion = text.slice(i, end);
|
|
70
|
-
for (const seg of
|
|
69
|
+
for (const seg of getSegmenter().segment(textPortion)) {
|
|
71
70
|
segments.push({ type: "grapheme", value: seg.segment });
|
|
72
71
|
}
|
|
73
72
|
i = end;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../source/utils/filesystem/security.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAsCrD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAK3E;AAoCD,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAIT;AAGD,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,EACnC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GACtE,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../source/utils/filesystem/security.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAsCrD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAK3E;AAoCD,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAIT;AAGD,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,EACnC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GACtE,OAAO,CAAC,MAAM,CAAC,CAiIjB;AA8BD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CAIN"}
|
|
@@ -116,8 +116,11 @@ export async function validatePath(requestedPath, allowedDirectory, options = {}
|
|
|
116
116
|
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
|
+
// Resolve symlinks in ancestors of the requested path for accurate comparison
|
|
120
|
+
// This handles cases like /tmp -> /private/tmp on macOS
|
|
121
|
+
const resolvedRequested = resolveExistingAncestorSync(normalizedRequested);
|
|
119
122
|
// Check intended path is within any allowed directory
|
|
120
|
-
if (!isWithinAllowed(
|
|
123
|
+
if (!isWithinAllowed(resolvedRequested)) {
|
|
121
124
|
throw new Error(`Access denied - path outside allowed directories: ${absolute} not in any of ${allowedDirectories.join(", ")}`);
|
|
122
125
|
}
|
|
123
126
|
let validatedPath;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type YamlValue = string | number | boolean | null | YamlObject | YamlValue[];
|
|
2
|
+
type YamlObject = {
|
|
3
|
+
[key: string]: YamlValue;
|
|
4
|
+
};
|
|
5
|
+
export declare function parseYaml(input: string): YamlObject;
|
|
6
|
+
export declare function parseFrontMatter(markdown: string): {
|
|
7
|
+
data: YamlObject;
|
|
8
|
+
content: string;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../source/utils/yaml.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,EAAE,CAAC;AAC7E,KAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CA0DnD;AA2JD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAClD,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAwBA"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export function parseYaml(input) {
|
|
2
|
+
const lines = input.split("\n");
|
|
3
|
+
const result = {};
|
|
4
|
+
let i = 0;
|
|
5
|
+
while (i < lines.length) {
|
|
6
|
+
const line = lines[i];
|
|
7
|
+
const trimmed = line.trim();
|
|
8
|
+
// Skip empty lines and comments
|
|
9
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
10
|
+
i++;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
// Check for key-value pair
|
|
14
|
+
const colonIndex = line.indexOf(":");
|
|
15
|
+
if (colonIndex === -1) {
|
|
16
|
+
i++;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const indent = getIndent(line);
|
|
20
|
+
const key = line.slice(0, colonIndex).trim();
|
|
21
|
+
const afterColon = line.slice(colonIndex + 1).trim();
|
|
22
|
+
if (afterColon) {
|
|
23
|
+
// Inline value
|
|
24
|
+
result[key] = parseValue(afterColon);
|
|
25
|
+
i++;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// Check next line for nested content
|
|
29
|
+
i++;
|
|
30
|
+
if (i < lines.length) {
|
|
31
|
+
const nextLine = lines[i];
|
|
32
|
+
const nextIndent = getIndent(nextLine);
|
|
33
|
+
const nextTrimmed = nextLine.trim();
|
|
34
|
+
if (nextTrimmed.startsWith("-")) {
|
|
35
|
+
// Array
|
|
36
|
+
const [arr, newIndex] = parseArray(lines, i, nextIndent);
|
|
37
|
+
result[key] = arr;
|
|
38
|
+
i = newIndex;
|
|
39
|
+
}
|
|
40
|
+
else if (nextIndent > indent && nextTrimmed.includes(":")) {
|
|
41
|
+
// Nested object
|
|
42
|
+
const [obj, newIndex] = parseObject(lines, i, nextIndent);
|
|
43
|
+
result[key] = obj;
|
|
44
|
+
i = newIndex;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
result[key] = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
result[key] = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
function parseObject(lines, start, baseIndent) {
|
|
58
|
+
const obj = {};
|
|
59
|
+
let i = start;
|
|
60
|
+
while (i < lines.length) {
|
|
61
|
+
const line = lines[i];
|
|
62
|
+
const indent = getIndent(line);
|
|
63
|
+
const trimmed = line.trim();
|
|
64
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
65
|
+
i++;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (indent < baseIndent) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
if (indent === baseIndent) {
|
|
72
|
+
const colonIndex = line.indexOf(":");
|
|
73
|
+
if (colonIndex === -1) {
|
|
74
|
+
i++;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const key = line.slice(0, colonIndex).trim();
|
|
78
|
+
const afterColon = line.slice(colonIndex + 1).trim();
|
|
79
|
+
if (afterColon) {
|
|
80
|
+
obj[key] = parseValue(afterColon);
|
|
81
|
+
i++;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
i++;
|
|
85
|
+
if (i < lines.length) {
|
|
86
|
+
const nextLine = lines[i];
|
|
87
|
+
const nextIndent = getIndent(nextLine);
|
|
88
|
+
const nextTrimmed = nextLine.trim();
|
|
89
|
+
if (nextTrimmed.startsWith("-")) {
|
|
90
|
+
const [arr, newIndex] = parseArray(lines, i, nextIndent);
|
|
91
|
+
obj[key] = arr;
|
|
92
|
+
i = newIndex;
|
|
93
|
+
}
|
|
94
|
+
else if (nextIndent > indent && nextTrimmed.includes(":")) {
|
|
95
|
+
const [nested, newIndex] = parseObject(lines, i, nextIndent);
|
|
96
|
+
obj[key] = nested;
|
|
97
|
+
i = newIndex;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
obj[key] = null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
obj[key] = null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
i++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return [obj, i];
|
|
113
|
+
}
|
|
114
|
+
function parseArray(lines, start, baseIndent) {
|
|
115
|
+
const arr = [];
|
|
116
|
+
let i = start;
|
|
117
|
+
while (i < lines.length) {
|
|
118
|
+
const line = lines[i];
|
|
119
|
+
const indent = getIndent(line);
|
|
120
|
+
const trimmed = line.trim();
|
|
121
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
122
|
+
i++;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (indent < baseIndent) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (indent === baseIndent && trimmed.startsWith("-")) {
|
|
129
|
+
const afterDash = trimmed.slice(1).trim();
|
|
130
|
+
if (afterDash) {
|
|
131
|
+
// Inline array item
|
|
132
|
+
arr.push(parseValue(afterDash));
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// Check next line for nested content
|
|
137
|
+
i++;
|
|
138
|
+
if (i < lines.length) {
|
|
139
|
+
const nextLine = lines[i];
|
|
140
|
+
const nextIndent = getIndent(nextLine);
|
|
141
|
+
const nextTrimmed = nextLine.trim();
|
|
142
|
+
if (nextTrimmed.includes(":")) {
|
|
143
|
+
const [obj, newIndex] = parseObject(lines, i, nextIndent);
|
|
144
|
+
arr.push(obj);
|
|
145
|
+
i = newIndex;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
i++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
i++;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return [arr, i];
|
|
158
|
+
}
|
|
159
|
+
function parseValue(value) {
|
|
160
|
+
// Handle quoted strings
|
|
161
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
162
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
163
|
+
return value.slice(1, -1);
|
|
164
|
+
}
|
|
165
|
+
// Handle booleans
|
|
166
|
+
if (value === "true")
|
|
167
|
+
return true;
|
|
168
|
+
if (value === "false")
|
|
169
|
+
return false;
|
|
170
|
+
// Handle null
|
|
171
|
+
if (value === "null" || value === "~")
|
|
172
|
+
return null;
|
|
173
|
+
// Handle numbers
|
|
174
|
+
if (/^-?\d+$/.test(value)) {
|
|
175
|
+
return Number.parseInt(value, 10);
|
|
176
|
+
}
|
|
177
|
+
if (/^-?\d+\.\d+$/.test(value)) {
|
|
178
|
+
return Number.parseFloat(value);
|
|
179
|
+
}
|
|
180
|
+
// Default to string
|
|
181
|
+
return value;
|
|
182
|
+
}
|
|
183
|
+
function getIndent(line) {
|
|
184
|
+
const match = line.match(/^(\s*)/);
|
|
185
|
+
return match ? match[1].length : 0;
|
|
186
|
+
}
|
|
187
|
+
// Helper function to extract and parse Yaml front matter from markdown
|
|
188
|
+
export function parseFrontMatter(markdown) {
|
|
189
|
+
const lines = markdown.split("\n");
|
|
190
|
+
if (lines[0] !== "---") {
|
|
191
|
+
return { data: {}, content: markdown };
|
|
192
|
+
}
|
|
193
|
+
let endIndex = -1;
|
|
194
|
+
for (let i = 1; i < lines.length; i++) {
|
|
195
|
+
if (lines[i] === "---" || lines[i] === "...") {
|
|
196
|
+
endIndex = i;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (endIndex === -1) {
|
|
201
|
+
return { data: {}, content: markdown };
|
|
202
|
+
}
|
|
203
|
+
const yamlContent = lines.slice(1, endIndex).join("\n");
|
|
204
|
+
const data = parseYaml(yamlContent);
|
|
205
|
+
const content = lines.slice(endIndex + 1).join("\n");
|
|
206
|
+
return { data, content };
|
|
207
|
+
}
|
package/dist/utils/zod.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ZodType } from "zod";
|
|
2
2
|
export declare function isZodSchema(obj: unknown): obj is ZodType<unknown>;
|
|
3
3
|
export declare function zodToJsonSchema(schema: ZodType<unknown>): Record<string, unknown>;
|
|
4
|
+
export declare const convertNullString: (value: unknown) => unknown;
|
|
4
5
|
//# sourceMappingURL=zod.d.ts.map
|
package/dist/utils/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../source/utils/zod.ts"],"names":[],"mappings":"AAAA,OAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjE;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB"}
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../source/utils/zod.ts"],"names":[],"mappings":"AAAA,OAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjE;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB;AAID,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,OAgBlD,CAAC"}
|
package/dist/utils/zod.js
CHANGED
|
@@ -5,3 +5,20 @@ export function isZodSchema(obj) {
|
|
|
5
5
|
export function zodToJsonSchema(schema) {
|
|
6
6
|
return z.toJSONSchema(schema);
|
|
7
7
|
}
|
|
8
|
+
// Many models do not reliably pass null to optional tool fields. Instead they pass "null", "None", "undefined", or empty strings.
|
|
9
|
+
// This function will coerce all of those values into null.
|
|
10
|
+
export const convertNullString = (value) => {
|
|
11
|
+
if (typeof value === "undefined") {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
if (trimmed.toLowerCase() === "null" ||
|
|
17
|
+
trimmed.toLowerCase() === "none" ||
|
|
18
|
+
trimmed.toLowerCase() === "undefined" ||
|
|
19
|
+
trimmed === "") {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|