@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
|
@@ -4,7 +4,8 @@ import { mkdir, readdir, readFile, rename, stat, unlink, writeFile, } from "node
|
|
|
4
4
|
import { basename, join } from "node:path";
|
|
5
5
|
import { isString } from "@travisennis/stdlib/typeguards";
|
|
6
6
|
import { generateText, } from "ai";
|
|
7
|
-
import {
|
|
7
|
+
import { dedent } from "../dedent.js";
|
|
8
|
+
import { logger } from "../logger.js";
|
|
8
9
|
export function createUserMessage(contentItems, prompt) {
|
|
9
10
|
const messageParts = [];
|
|
10
11
|
// Process content items (images and pre-defined texts)
|
|
@@ -38,7 +39,7 @@ function createAssistantMessage(content) {
|
|
|
38
39
|
],
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
export class
|
|
42
|
+
export class SessionManager extends EventEmitter {
|
|
42
43
|
history;
|
|
43
44
|
sessionId;
|
|
44
45
|
modelId;
|
|
@@ -53,7 +54,7 @@ export class MessageHistory extends EventEmitter {
|
|
|
53
54
|
super();
|
|
54
55
|
this.history = [];
|
|
55
56
|
this.sessionId = randomUUID();
|
|
56
|
-
this.modelId = "";
|
|
57
|
+
this.modelId = modelManager.getModel("repl").modelId;
|
|
57
58
|
this.title = "";
|
|
58
59
|
this.createdAt = new Date();
|
|
59
60
|
this.updatedAt = new Date();
|
|
@@ -70,6 +71,9 @@ export class MessageHistory extends EventEmitter {
|
|
|
70
71
|
this.createdAt = new Date();
|
|
71
72
|
this.updatedAt = new Date();
|
|
72
73
|
}
|
|
74
|
+
setModelId(modelId) {
|
|
75
|
+
this.modelId = modelId;
|
|
76
|
+
}
|
|
73
77
|
validMessage(msg) {
|
|
74
78
|
// Filter out messages with empty content arrays
|
|
75
79
|
if (Array.isArray(msg.content) && msg.content.length === 0) {
|
|
@@ -110,7 +114,7 @@ export class MessageHistory extends EventEmitter {
|
|
|
110
114
|
msgObj.content.length > 0) {
|
|
111
115
|
const textPart = msgObj.content.at(-1);
|
|
112
116
|
if (textPart?.text && textPart.text.trim() !== "") {
|
|
113
|
-
this.generateTitle(textPart.text);
|
|
117
|
+
void this.generateTitle(textPart.text);
|
|
114
118
|
}
|
|
115
119
|
this.createdAt = now;
|
|
116
120
|
}
|
|
@@ -193,23 +197,49 @@ export class MessageHistory extends EventEmitter {
|
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
195
199
|
const app = "title-conversation";
|
|
196
|
-
const systemPrompt =
|
|
200
|
+
const systemPrompt = dedent `
|
|
201
|
+
You are an assistant who is tasked to analyze messages to generate a conversation topic that can be used as a conversation title. For each message, generate a short title that captures the topic. Return only the title with no other text.
|
|
202
|
+
|
|
203
|
+
## Examples:
|
|
204
|
+
|
|
205
|
+
<example>
|
|
206
|
+
Message:
|
|
207
|
+
How do I implement authentication in my Express app?
|
|
208
|
+
|
|
209
|
+
Title:
|
|
210
|
+
Express Authentication Implementation
|
|
211
|
+
</example>
|
|
212
|
+
|
|
213
|
+
<example>
|
|
214
|
+
Message:
|
|
215
|
+
Can you help me debug this React component that isn't rendering correctly?
|
|
216
|
+
|
|
217
|
+
Title:
|
|
218
|
+
React Component Rendering Debug";
|
|
219
|
+
</example>
|
|
220
|
+
`;
|
|
221
|
+
let title = "";
|
|
197
222
|
try {
|
|
198
|
-
const
|
|
199
|
-
|
|
223
|
+
const model = this.modelManager.getModel(app);
|
|
224
|
+
const result = await generateText({
|
|
225
|
+
model,
|
|
200
226
|
system: systemPrompt,
|
|
201
|
-
|
|
202
|
-
prompt: `Request:\n${message}\nTitle:`,
|
|
227
|
+
prompt: `Message:\n${message}\n\nTitle:`,
|
|
203
228
|
});
|
|
204
|
-
this.tokenTracker.trackUsage(app, usage);
|
|
205
|
-
if (text && text.
|
|
206
|
-
|
|
207
|
-
this.
|
|
229
|
+
this.tokenTracker.trackUsage(app, result.usage);
|
|
230
|
+
if (result.text && result.text.length > 0) {
|
|
231
|
+
title = result.text;
|
|
232
|
+
this.title = title;
|
|
208
233
|
}
|
|
209
234
|
}
|
|
210
235
|
catch (error) {
|
|
211
|
-
|
|
236
|
+
logger.error(error, "[generateTitle] Failed to generate conversation title:");
|
|
212
237
|
}
|
|
238
|
+
if (title.length === 0) {
|
|
239
|
+
this.title =
|
|
240
|
+
message.slice(0, 50).trim() + (message.length > 50 ? "..." : "");
|
|
241
|
+
}
|
|
242
|
+
this.emit("update-title", this.title);
|
|
213
243
|
}
|
|
214
244
|
getFirstUserMessage() {
|
|
215
245
|
const firstUser = this.get().find((msg) => msg.role === "user");
|
|
@@ -251,6 +281,22 @@ export class MessageHistory extends EventEmitter {
|
|
|
251
281
|
}
|
|
252
282
|
return null;
|
|
253
283
|
}
|
|
284
|
+
// Getter methods for session information
|
|
285
|
+
getSessionId() {
|
|
286
|
+
return this.sessionId;
|
|
287
|
+
}
|
|
288
|
+
getModelId() {
|
|
289
|
+
return this.modelId;
|
|
290
|
+
}
|
|
291
|
+
getTitle() {
|
|
292
|
+
return this.title;
|
|
293
|
+
}
|
|
294
|
+
getCreatedAt() {
|
|
295
|
+
return this.createdAt;
|
|
296
|
+
}
|
|
297
|
+
getUpdatedAt() {
|
|
298
|
+
return this.updatedAt;
|
|
299
|
+
}
|
|
254
300
|
static async load(stateDir, count = 10) {
|
|
255
301
|
try {
|
|
256
302
|
const files = await readdir(stateDir);
|
|
@@ -327,6 +373,8 @@ export class MessageHistory extends EventEmitter {
|
|
|
327
373
|
}
|
|
328
374
|
// Method to restore state from a SavedMessageHistory object
|
|
329
375
|
restore(savedHistory) {
|
|
376
|
+
this.sessionId = savedHistory.sessionId;
|
|
377
|
+
this.modelId = savedHistory.modelId;
|
|
330
378
|
this.title = savedHistory.title;
|
|
331
379
|
// Ensure dates are Date objects, though load should handle this
|
|
332
380
|
this.createdAt =
|
package/dist/skills.d.ts
CHANGED
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../source/skills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../source/skills.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAwOD,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,EACjC,MAAM,SAAK,GACV,OAAO,CAAC,KAAK,EAAE,CAAC,CASlB;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAyDnD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAkC7D"}
|
package/dist/skills.js
CHANGED
|
@@ -1,40 +1,71 @@
|
|
|
1
1
|
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { join, resolve
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
4
|
import { logger } from "./logger.js";
|
|
5
|
+
import { parseFrontMatter } from "./utils/yaml.js";
|
|
5
6
|
const CONFIG_DIR_NAME = ".acai";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// Validation functions
|
|
8
|
+
function validateSkillName(name, directoryName) {
|
|
9
|
+
// Check required field
|
|
10
|
+
if (!name) {
|
|
11
|
+
return { valid: false, error: "Name field is required" };
|
|
10
12
|
}
|
|
11
|
-
|
|
13
|
+
// Check length (1-64 characters)
|
|
14
|
+
if (name.length < 1 || name.length > 64) {
|
|
15
|
+
return { valid: false, error: "Name must be 1-64 characters long" };
|
|
16
|
+
}
|
|
17
|
+
// Check allowed characters (lowercase letters, numbers, hyphens)
|
|
18
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
19
|
+
return {
|
|
20
|
+
valid: false,
|
|
21
|
+
error: "Name can only contain lowercase letters, numbers, and hyphens",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// Check no leading or trailing hyphens
|
|
25
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
26
|
+
return { valid: false, error: "Name cannot start or end with a hyphen" };
|
|
27
|
+
}
|
|
28
|
+
// Check no consecutive hyphens
|
|
29
|
+
if (name.includes("--")) {
|
|
30
|
+
return { valid: false, error: "Name cannot contain consecutive hyphens" };
|
|
31
|
+
}
|
|
32
|
+
// Check matches directory name
|
|
33
|
+
if (name !== directoryName) {
|
|
34
|
+
return {
|
|
35
|
+
valid: false,
|
|
36
|
+
error: `Name "${name}" must match directory name "${directoryName}"`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return { valid: true };
|
|
12
40
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return { frontmatter, body: normalizedContent };
|
|
18
|
-
}
|
|
19
|
-
const endIndex = normalizedContent.indexOf("\n---", 3);
|
|
20
|
-
if (endIndex === -1) {
|
|
21
|
-
return { frontmatter, body: normalizedContent };
|
|
22
|
-
}
|
|
23
|
-
const frontmatterBlock = normalizedContent.slice(4, endIndex);
|
|
24
|
-
const body = normalizedContent.slice(endIndex + 4).trim();
|
|
25
|
-
for (const line of frontmatterBlock.split("\n")) {
|
|
26
|
-
const match = line.match(/^(\w+):\s*(.*)$/);
|
|
27
|
-
if (match) {
|
|
28
|
-
const key = match[1];
|
|
29
|
-
const value = stripQuotes(match[2].trim());
|
|
30
|
-
if (key === "name") {
|
|
31
|
-
frontmatter.name = value;
|
|
32
|
-
}
|
|
33
|
-
else if (key === "description") {
|
|
34
|
-
frontmatter.description = value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
41
|
+
function validateSkillDescription(description) {
|
|
42
|
+
// Check required field
|
|
43
|
+
if (!description) {
|
|
44
|
+
return { valid: false, error: "Description field is required" };
|
|
37
45
|
}
|
|
46
|
+
// Check length (1-1024 characters)
|
|
47
|
+
if (description.length < 1 || description.length > 1024) {
|
|
48
|
+
return {
|
|
49
|
+
valid: false,
|
|
50
|
+
error: "Description must be 1-1024 characters long",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return { valid: true };
|
|
54
|
+
}
|
|
55
|
+
function parseFrontmatter(content) {
|
|
56
|
+
const { data, content: body } = parseFrontMatter(content);
|
|
57
|
+
// Type cast and validate required fields
|
|
58
|
+
const name = data["name"];
|
|
59
|
+
const description = data["description"];
|
|
60
|
+
// Set default empty values for optional fields
|
|
61
|
+
const frontmatter = {
|
|
62
|
+
name: name || "",
|
|
63
|
+
description: description || "",
|
|
64
|
+
license: data["license"] || undefined,
|
|
65
|
+
compatibility: data["compatibility"] || undefined,
|
|
66
|
+
metadata: data["metadata"] || undefined,
|
|
67
|
+
"allowed-tools": data["allowed-tools"] || undefined,
|
|
68
|
+
};
|
|
38
69
|
return { frontmatter, body };
|
|
39
70
|
}
|
|
40
71
|
async function loadSkillsFromDirInternal(dir, source, mode, useColonPath, subdir = "") {
|
|
@@ -72,12 +103,19 @@ async function loadSkillsFromDirInternal(dir, source, mode, useColonPath, subdir
|
|
|
72
103
|
try {
|
|
73
104
|
const content = await readFile(skillPath, "utf8");
|
|
74
105
|
const { frontmatter } = parseFrontmatter(content);
|
|
75
|
-
|
|
106
|
+
// Validate required fields
|
|
107
|
+
const nameValidation = validateSkillName(frontmatter.name, entry.name);
|
|
108
|
+
if (!nameValidation.valid) {
|
|
109
|
+
logger.warn(`Invalid skill name in ${skillPath}: ${nameValidation.error}`);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const descriptionValidation = validateSkillDescription(frontmatter.description);
|
|
113
|
+
if (!descriptionValidation.valid) {
|
|
114
|
+
logger.warn(`Invalid skill description in ${skillPath}: ${descriptionValidation.error}`);
|
|
76
115
|
continue;
|
|
77
116
|
}
|
|
78
|
-
const skillName = frontmatter.name || entry.name;
|
|
79
117
|
skills.push({
|
|
80
|
-
name:
|
|
118
|
+
name: frontmatter.name,
|
|
81
119
|
description: frontmatter.description,
|
|
82
120
|
filePath: skillPath,
|
|
83
121
|
baseDir: entryPath,
|
|
@@ -96,31 +134,21 @@ async function loadSkillsFromDirInternal(dir, source, mode, useColonPath, subdir
|
|
|
96
134
|
try {
|
|
97
135
|
const content = await readFile(entryPath, "utf8");
|
|
98
136
|
const { frontmatter } = parseFrontmatter(content);
|
|
99
|
-
|
|
137
|
+
// Validate required fields
|
|
138
|
+
const nameValidation = validateSkillName(frontmatter.name, basename(dirname(entryPath)));
|
|
139
|
+
if (!nameValidation.valid) {
|
|
140
|
+
logger.warn(`Invalid skill name in ${entryPath}: ${nameValidation.error}`);
|
|
100
141
|
continue;
|
|
101
142
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
else if (useColonPath && subdir) {
|
|
108
|
-
// Use colon-separated path for subdirectories
|
|
109
|
-
skillName = subdir.split(sep).join(":");
|
|
110
|
-
}
|
|
111
|
-
else if (subdir) {
|
|
112
|
-
// Use the directory name
|
|
113
|
-
const dirParts = subdir.split(sep);
|
|
114
|
-
skillName = dirParts[dirParts.length - 1];
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
// Shouldn't happen in practice, but fallback
|
|
118
|
-
skillName = "unnamed";
|
|
143
|
+
const descriptionValidation = validateSkillDescription(frontmatter.description);
|
|
144
|
+
if (!descriptionValidation.valid) {
|
|
145
|
+
logger.warn(`Invalid skill description in ${entryPath}: ${descriptionValidation.error}`);
|
|
146
|
+
continue;
|
|
119
147
|
}
|
|
120
148
|
// Base directory is the directory containing the SKILL.md file
|
|
121
149
|
const baseDir = subdir ? join(dir, subdir) : dir;
|
|
122
150
|
skills.push({
|
|
123
|
-
name:
|
|
151
|
+
name: frontmatter.name,
|
|
124
152
|
description: frontmatter.description,
|
|
125
153
|
filePath: entryPath,
|
|
126
154
|
baseDir,
|
|
@@ -161,7 +189,7 @@ export async function loadSkills() {
|
|
|
161
189
|
for (const skill of await loadSkillsFromDirInternal(claudeProjectDir, "claude-project", "claude", false)) {
|
|
162
190
|
skillMap.set(skill.name, skill);
|
|
163
191
|
}
|
|
164
|
-
//
|
|
192
|
+
// acai: recursive, colon-separated path names
|
|
165
193
|
const globalSkillsDir = join(homedir(), CONFIG_DIR_NAME, "skills");
|
|
166
194
|
for (const skill of await loadSkillsFromDirInternal(globalSkillsDir, "user", "recursive", true)) {
|
|
167
195
|
skillMap.set(skill.name, skill);
|
|
@@ -177,15 +205,28 @@ export function formatSkillsForPrompt(skills) {
|
|
|
177
205
|
return "";
|
|
178
206
|
}
|
|
179
207
|
const lines = [
|
|
180
|
-
"\n\n
|
|
181
|
-
"
|
|
208
|
+
"\n\n## Skills",
|
|
209
|
+
"",
|
|
210
|
+
"<skills_instructions>",
|
|
211
|
+
"When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.",
|
|
182
212
|
"Use the readFile tool to load a skill's file when the task matches its description.",
|
|
183
|
-
"Skills may contain {baseDir} placeholders - replace them with the skill's base directory path
|
|
213
|
+
"Skills may contain {baseDir} placeholders - replace them with the skill's base directory path.",
|
|
214
|
+
"</skills_instructions>",
|
|
215
|
+
"",
|
|
216
|
+
"<available_skills>",
|
|
184
217
|
];
|
|
185
218
|
for (const skill of skills) {
|
|
186
|
-
lines.push(
|
|
187
|
-
lines.push(
|
|
188
|
-
lines.push(
|
|
219
|
+
lines.push("<skill>");
|
|
220
|
+
lines.push("<name>");
|
|
221
|
+
lines.push(skill.name);
|
|
222
|
+
lines.push("</name>");
|
|
223
|
+
lines.push("<description>");
|
|
224
|
+
lines.push(skill.description);
|
|
225
|
+
lines.push("</description>");
|
|
226
|
+
lines.push("<location>");
|
|
227
|
+
lines.push(skill.filePath);
|
|
228
|
+
lines.push("</location>");
|
|
229
|
+
lines.push("</skill>");
|
|
189
230
|
}
|
|
190
231
|
lines.push("</available_skills>");
|
|
191
232
|
return lines.join("\n");
|
package/dist/stdin.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const STDIN_SOFT_LIMIT: number;
|
|
2
|
+
export declare const STDIN_HARD_LIMIT: number;
|
|
3
|
+
export interface StdinResult {
|
|
4
|
+
content: string | null;
|
|
5
|
+
sizeBytes: number;
|
|
6
|
+
wasPiped: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function readStdinWithLimits(): Promise<StdinResult>;
|
|
9
|
+
//# sourceMappingURL=stdin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdin.d.ts","sourceRoot":"","sources":["../source/stdin.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,QAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,QAAa,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC,CA6BhE"}
|
package/dist/stdin.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { text } from "node:stream/consumers";
|
|
2
|
+
export const STDIN_SOFT_LIMIT = 50 * 1024; // 50KB
|
|
3
|
+
export const STDIN_HARD_LIMIT = 200 * 1024; // 200KB
|
|
4
|
+
export async function readStdinWithLimits() {
|
|
5
|
+
if (process.stdin.isTTY) {
|
|
6
|
+
return { content: null, sizeBytes: 0, wasPiped: false };
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const content = await text(process.stdin);
|
|
10
|
+
const sizeBytes = Buffer.byteLength(content, "utf8");
|
|
11
|
+
if (sizeBytes > STDIN_HARD_LIMIT) {
|
|
12
|
+
const sizeKb = Math.round(sizeBytes / 1024);
|
|
13
|
+
console.error(`Error: Input exceeds ${STDIN_HARD_LIMIT / 1024}KB size limit (${sizeKb}KB provided).`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
if (sizeBytes > STDIN_SOFT_LIMIT) {
|
|
17
|
+
const sizeKb = Math.round(sizeBytes / 1024);
|
|
18
|
+
console.error(`Warning: Input is ${sizeKb}KB. Large inputs may increase latency and costs.`);
|
|
19
|
+
}
|
|
20
|
+
return { content, sizeBytes, wasPiped: true };
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error(`Error reading stdin: ${error.message}`);
|
|
24
|
+
return { content: null, sizeBytes: 0, wasPiped: true };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides functions for controlling terminal behavior and state.
|
|
5
5
|
*/
|
|
6
|
+
export { isAltBackspace, isAltEnter, isAltLeft, isAltRight, isArrowDown, isArrowLeft, isArrowRight, isArrowUp, isBackspace, isCtrlA, isCtrlC, isCtrlD, isCtrlE, isCtrlG, isCtrlK, isCtrlL, isCtrlP, isCtrlT, isCtrlU, isCtrlW, isCtrlZ, isDelete, isEnd, isEnter, isEscape, isHome, isKittyCtrl, isKittyKey, isNavigationKey, isPageDown, isPageUp, isShiftCtrlD, isShiftCtrlO, isShiftCtrlP, isShiftEnter, isShiftTab, isTab, } from "./keys.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Get the current shell
|
|
8
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../source/terminal/control.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../source/terminal/control.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,KAAK,GACN,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,wBAAgB,QAAQ,WAEvB;AAED;;GAEG;AACH,wBAAgB,aAAa,YAE5B;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB3C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAYpD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBnE;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAQpC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAQnC"}
|
package/dist/terminal/control.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { config } from "../config.js";
|
|
7
7
|
import { logger } from "../logger.js";
|
|
8
|
+
// Re-export key functions from keys.ts for convenient imports
|
|
9
|
+
export { isAltBackspace, isAltEnter, isAltLeft, isAltRight, isArrowDown, isArrowLeft, isArrowRight, isArrowUp, isBackspace, isCtrlA, isCtrlC, isCtrlD, isCtrlE, isCtrlG, isCtrlK, isCtrlL, isCtrlP, isCtrlT, isCtrlU, isCtrlW, isCtrlZ, isDelete, isEnd, isEnter, isEscape, isHome, isKittyCtrl, isKittyKey, isNavigationKey, isPageDown, isPageUp, isShiftCtrlD, isShiftCtrlO, isShiftCtrlP, isShiftEnter, isShiftTab, isTab, } from "./keys.js";
|
|
8
10
|
/**
|
|
9
11
|
* Get the current shell
|
|
10
12
|
*/
|
|
@@ -67,11 +69,18 @@ export function clearTerminal() {
|
|
|
67
69
|
* Sets the terminal title
|
|
68
70
|
*/
|
|
69
71
|
export function setTerminalTitle(title) {
|
|
70
|
-
|
|
71
|
-
process.
|
|
72
|
+
try {
|
|
73
|
+
if (process.platform === "win32") {
|
|
74
|
+
process.title = title ? `✳✳ ${title}` : title;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (process.stdout.writable) {
|
|
78
|
+
process.stdout.write(`\x1b]0;${title ? `✳✳ ${title}` : ""}\x07`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
catch (err) {
|
|
83
|
+
logger.warn({ err }, "Failed to set terminal title");
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
/**
|
|
@@ -98,12 +107,26 @@ export function getTerminalSize() {
|
|
|
98
107
|
* Sends terminal escape sequence to show progress animation
|
|
99
108
|
*/
|
|
100
109
|
export function startProgress() {
|
|
101
|
-
|
|
110
|
+
try {
|
|
111
|
+
if (process.stdout.writable) {
|
|
112
|
+
process.stdout.write("\u001b]9;4;3;0\u0007");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Ignore write errors (e.g., EPIPE)
|
|
117
|
+
}
|
|
102
118
|
}
|
|
103
119
|
/**
|
|
104
120
|
* Stop progress indicator in terminal
|
|
105
121
|
* Sends terminal escape sequence to hide progress animation
|
|
106
122
|
*/
|
|
107
123
|
export function stopProgress() {
|
|
108
|
-
|
|
124
|
+
try {
|
|
125
|
+
if (process.stdout.writable) {
|
|
126
|
+
process.stdout.write("\u001b]9;4;0;0\u0007");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// Ignore write errors (e.g., EPIPE)
|
|
131
|
+
}
|
|
109
132
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { clearScreen, clearTerminal, getTerminalSize, setTerminalTitle, startProgress, stopProgress, } from "./control.ts";
|
|
2
1
|
/**
|
|
3
2
|
* Create a horizontal rule
|
|
4
3
|
*/
|
|
@@ -7,7 +6,7 @@ export declare function hr(width: number): string;
|
|
|
7
6
|
* Word wrap text to the specified width
|
|
8
7
|
*/
|
|
9
8
|
export declare function wordWrap(text: string, width: number): string;
|
|
10
|
-
export declare const link: (text: string, url: string) => string;
|
|
9
|
+
export declare const link: (text: string, url: string) => string | null;
|
|
11
10
|
export declare const image: (data: string | Buffer, options?: {
|
|
12
11
|
width?: number | string;
|
|
13
12
|
height?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../source/terminal/formatting.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../source/terminal/formatting.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,UAE/B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI5D;AA2CD,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,kBAO7C,CAAC;AAEF,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,GAAG,MAAM,EACrB,UAAS;IACP,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B,WAiBP,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import style from "./style.js";
|
|
7
7
|
import { supportsHyperlinks } from "./supports-hyperlinks.js";
|
|
8
|
-
export { clearScreen, clearTerminal, getTerminalSize, setTerminalTitle, startProgress, stopProgress, } from "./control.js";
|
|
9
8
|
/**
|
|
10
9
|
* Create a horizontal rule
|
|
11
10
|
*/
|
|
@@ -60,7 +59,7 @@ export const link = (text, url) => {
|
|
|
60
59
|
if (supportsHyperlinks.stdout) {
|
|
61
60
|
return [OSC, "8", SEP, SEP, url, BEL, text, OSC, "8", SEP, SEP, BEL].join("");
|
|
62
61
|
}
|
|
63
|
-
return
|
|
62
|
+
return null;
|
|
64
63
|
};
|
|
65
64
|
export const image = (data, options = {}) => {
|
|
66
65
|
let returnValue = `${OSC}1337;File=inline=1`;
|