@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
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { eastAsianWidth } from "./east-asian-width.js";
|
|
2
|
+
import { getSegmenter } from "./segmenter.js";
|
|
2
3
|
import stripAnsi from "./strip-ansi.js";
|
|
3
|
-
|
|
4
|
+
// Precompile regexes (these are already at module level, which is good)
|
|
4
5
|
// Whole-cluster zero-width
|
|
5
6
|
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v;
|
|
6
7
|
// Pick the base scalar if the cluster starts with Prepend/Format/Marks
|
|
7
8
|
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
|
|
8
9
|
// RGI emoji sequences
|
|
9
10
|
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function isZeroWidthCluster(segment) {
|
|
14
|
-
return zeroWidthClusterRegex.test(segment);
|
|
15
|
-
}
|
|
11
|
+
// Halfwidth/Fullwidth range constants
|
|
12
|
+
const HALFWIDTH_START = 0xff00;
|
|
13
|
+
const HALFWIDTH_END = 0xffef;
|
|
16
14
|
function trailingHalfwidthWidth(segment, eastAsianWidthOptions) {
|
|
15
|
+
const len = segment.length;
|
|
16
|
+
if (len <= 1) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
17
19
|
let extra = 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
// Use for loop with index for better performance
|
|
21
|
+
for (let i = 1; i < len; i++) {
|
|
22
|
+
const codePoint = segment.codePointAt(i);
|
|
23
|
+
if (codePoint !== undefined &&
|
|
24
|
+
codePoint >= HALFWIDTH_START &&
|
|
25
|
+
codePoint <= HALFWIDTH_END) {
|
|
26
|
+
extra += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
27
|
+
// Skip next char if this was a surrogate pair
|
|
28
|
+
if (codePoint > 0xffff) {
|
|
29
|
+
i++;
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
}
|
|
@@ -33,15 +40,17 @@ export default function stringWidth(input, options = {}) {
|
|
|
33
40
|
let string = input;
|
|
34
41
|
if (!countAnsiEscapeCodes) {
|
|
35
42
|
string = stripAnsi(string);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
if (string.length === 0) {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
39
46
|
}
|
|
40
47
|
let width = 0;
|
|
41
48
|
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
49
|
+
// Use lazy segmenter initialization
|
|
50
|
+
const segmenter = getSegmenter();
|
|
42
51
|
for (const { segment } of segmenter.segment(string)) {
|
|
43
|
-
// Zero-width
|
|
44
|
-
if (
|
|
52
|
+
// Zero-width clusters - inline test for hot path
|
|
53
|
+
if (zeroWidthClusterRegex.test(segment)) {
|
|
45
54
|
continue;
|
|
46
55
|
}
|
|
47
56
|
// Emoji width logic
|
|
@@ -49,12 +58,22 @@ export default function stringWidth(input, options = {}) {
|
|
|
49
58
|
width += 2;
|
|
50
59
|
continue;
|
|
51
60
|
}
|
|
52
|
-
//
|
|
53
|
-
const
|
|
61
|
+
// Get first code point directly, avoiding intermediate string
|
|
62
|
+
const firstCodePoint = segment.codePointAt(0);
|
|
63
|
+
if (firstCodePoint === undefined) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// Check if we need to strip leading non-printing characters
|
|
67
|
+
const hasLeadingNonPrinting = leadingNonPrintingRegex.test(segment);
|
|
68
|
+
const codePoint = hasLeadingNonPrinting
|
|
69
|
+
? segment.replace(leadingNonPrintingRegex, "").codePointAt(0)
|
|
70
|
+
: firstCodePoint;
|
|
54
71
|
if (codePoint !== undefined) {
|
|
55
72
|
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
56
|
-
//
|
|
57
|
-
|
|
73
|
+
// Only check trailing width if segment has multiple characters
|
|
74
|
+
if (segment.length > 1) {
|
|
75
|
+
width += trailingHalfwidthWidth(segment, eastAsianWidthOptions);
|
|
76
|
+
}
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
return width;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-ansi.d.ts","sourceRoot":"","sources":["../../source/terminal/strip-ansi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strip-ansi.d.ts","sourceRoot":"","sources":["../../source/terminal/strip-ansi.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
//
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const pattern = `${osc}|${csi}`;
|
|
10
|
-
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
11
|
-
};
|
|
1
|
+
// Pre-compile the regex outside the function to avoid recreation on every call
|
|
2
|
+
const ANSI_REGEX = (() => {
|
|
3
|
+
const St = "(?:\u0007|\u001B\u005C|\u009C)";
|
|
4
|
+
// biome-ignore lint/suspicious/noUselessEscapeInString: later
|
|
5
|
+
const osc = `(?:\u001B\][\\s\\S]*?${St})`;
|
|
6
|
+
const csi = "[\u001B\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
7
|
+
return new RegExp(`${osc}|${csi}`, "g");
|
|
8
|
+
})();
|
|
12
9
|
export default function stripAnsi(string) {
|
|
13
10
|
if (typeof string !== "string") {
|
|
14
11
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
18
|
-
// and doing it manually has a performance penalty.
|
|
19
|
-
return string.replace(ansiRegex(), "");
|
|
13
|
+
return string.replace(ANSI_REGEX, "");
|
|
20
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../source/tokens/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAO7C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,CAAC,kBAAkB,CAAC,CAAC;CAC7B;AAED,qBAAa,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IAChE,OAAO,CAAC,MAAM,CAAoB;IAElC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,SAAS;IAQ9D,aAAa,IAAI,kBAAkB;
|
|
1
|
+
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../source/tokens/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAO7C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,CAAC,kBAAkB,CAAC,CAAC;CAC7B;AAED,qBAAa,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IAChE,OAAO,CAAC,MAAM,CAAoB;IAElC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,SAAS;IAQ9D,aAAa,IAAI,kBAAkB;IA0CnC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;IA0C9C,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAY3C,YAAY;CAOb"}
|
package/dist/tokens/tracker.js
CHANGED
|
@@ -11,29 +11,71 @@ export class TokenTracker extends EventEmitter {
|
|
|
11
11
|
}
|
|
12
12
|
getTotalUsage() {
|
|
13
13
|
return this.usages.reduce((acc, { usage }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
acc.
|
|
14
|
+
// After AI SDK v6 upgrade, all usage is in the unified format
|
|
15
|
+
const inputTokens = usage.inputTokens ?? 0;
|
|
16
|
+
const outputTokens = usage.outputTokens ?? 0;
|
|
17
|
+
const totalTokens = usage.totalTokens ?? inputTokens + outputTokens;
|
|
18
|
+
acc.inputTokens += isNumber(inputTokens) ? inputTokens : 0;
|
|
19
|
+
acc.outputTokens += isNumber(outputTokens) ? outputTokens : 0;
|
|
20
|
+
acc.totalTokens += isNumber(totalTokens) ? totalTokens : 0;
|
|
21
|
+
// Input token details
|
|
22
|
+
acc.inputTokenDetails.noCacheTokens +=
|
|
23
|
+
usage.inputTokenDetails?.noCacheTokens ?? 0;
|
|
24
|
+
acc.inputTokenDetails.cacheReadTokens +=
|
|
25
|
+
usage.inputTokenDetails?.cacheReadTokens ?? 0;
|
|
26
|
+
acc.inputTokenDetails.cacheWriteTokens +=
|
|
27
|
+
usage.inputTokenDetails?.cacheWriteTokens ?? 0;
|
|
28
|
+
// Output token details
|
|
29
|
+
const v3OutputDetails = usage.outputTokenDetails;
|
|
30
|
+
acc.outputTokenDetails.textTokens += v3OutputDetails?.textTokens ?? 0;
|
|
31
|
+
acc.outputTokenDetails.reasoningTokens +=
|
|
32
|
+
v3OutputDetails?.reasoningTokens ?? 0;
|
|
19
33
|
return acc;
|
|
20
|
-
}, {
|
|
34
|
+
}, {
|
|
35
|
+
inputTokens: 0,
|
|
36
|
+
outputTokens: 0,
|
|
37
|
+
totalTokens: 0,
|
|
38
|
+
inputTokenDetails: {
|
|
39
|
+
noCacheTokens: 0,
|
|
40
|
+
cacheReadTokens: 0,
|
|
41
|
+
cacheWriteTokens: 0,
|
|
42
|
+
},
|
|
43
|
+
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
|
|
44
|
+
});
|
|
21
45
|
}
|
|
22
46
|
getUsageByApp(app) {
|
|
23
47
|
return this.usages
|
|
24
48
|
.filter(({ tool }) => tool === app)
|
|
25
49
|
.reduce((acc, { usage }) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
acc.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
const inputTokens = usage.inputTokens ?? 0;
|
|
51
|
+
const outputTokens = usage.outputTokens ?? 0;
|
|
52
|
+
const totalTokens = usage.totalTokens ?? inputTokens + outputTokens;
|
|
53
|
+
acc.inputTokens += isNumber(inputTokens) ? inputTokens : 0;
|
|
54
|
+
acc.outputTokens += isNumber(outputTokens) ? outputTokens : 0;
|
|
55
|
+
acc.totalTokens += isNumber(totalTokens) ? totalTokens : 0;
|
|
56
|
+
const v3InputDetails = usage.inputTokenDetails;
|
|
57
|
+
acc.inputTokenDetails.cacheReadTokens +=
|
|
58
|
+
v3InputDetails?.cacheReadTokens ?? 0;
|
|
59
|
+
acc.inputTokenDetails.noCacheTokens +=
|
|
60
|
+
v3InputDetails?.noCacheTokens ?? 0;
|
|
61
|
+
acc.inputTokenDetails.cacheWriteTokens +=
|
|
62
|
+
v3InputDetails?.cacheWriteTokens ?? 0;
|
|
63
|
+
const v3OutputDetails = usage.outputTokenDetails;
|
|
64
|
+
acc.outputTokenDetails.textTokens += v3OutputDetails?.textTokens ?? 0;
|
|
65
|
+
acc.outputTokenDetails.reasoningTokens +=
|
|
66
|
+
v3OutputDetails?.reasoningTokens ?? 0;
|
|
35
67
|
return acc;
|
|
36
|
-
}, {
|
|
68
|
+
}, {
|
|
69
|
+
inputTokens: 0,
|
|
70
|
+
outputTokens: 0,
|
|
71
|
+
totalTokens: 0,
|
|
72
|
+
inputTokenDetails: {
|
|
73
|
+
noCacheTokens: 0,
|
|
74
|
+
cacheReadTokens: 0,
|
|
75
|
+
cacheWriteTokens: 0,
|
|
76
|
+
},
|
|
77
|
+
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
|
|
78
|
+
});
|
|
37
79
|
}
|
|
38
80
|
getUsageBreakdown() {
|
|
39
81
|
return this.usages.reduce((acc, { tool, usage }) => {
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import type {
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
2
|
+
import type { ToolExecutionOptions } from "./types.ts";
|
|
5
3
|
export declare const BashTool: {
|
|
6
|
-
name: "
|
|
4
|
+
name: "Bash";
|
|
7
5
|
};
|
|
8
6
|
declare const inputSchema: z.ZodObject<{
|
|
9
7
|
command: z.ZodString;
|
|
10
|
-
cwd: z.ZodNullable<z.ZodString
|
|
11
|
-
timeout: z.ZodNullable<z.ZodCoercedNumber<unknown
|
|
8
|
+
cwd: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
9
|
+
timeout: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
12
10
|
background: z.ZodOptional<z.ZodBoolean>;
|
|
13
11
|
}, z.core.$strip>;
|
|
14
12
|
type BashInputSchema = z.infer<typeof inputSchema>;
|
|
15
|
-
export declare const createBashTool: ({ baseDir, allowedDirs,
|
|
13
|
+
export declare const createBashTool: ({ baseDir, allowedDirs, }: {
|
|
16
14
|
baseDir: string;
|
|
17
15
|
allowedDirs?: string[];
|
|
18
|
-
tokenCounter: TokenCounter;
|
|
19
16
|
}) => Promise<{
|
|
20
17
|
toolDef: {
|
|
21
18
|
description: string;
|
|
22
19
|
inputSchema: z.ZodObject<{
|
|
23
20
|
command: z.ZodString;
|
|
24
|
-
cwd: z.ZodNullable<z.ZodString
|
|
25
|
-
timeout: z.ZodNullable<z.ZodCoercedNumber<unknown
|
|
21
|
+
cwd: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodString>>;
|
|
22
|
+
timeout: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
26
23
|
background: z.ZodOptional<z.ZodBoolean>;
|
|
27
24
|
}, z.core.$strip>;
|
|
28
25
|
};
|
|
29
|
-
|
|
26
|
+
display({ command }: BashInputSchema): string;
|
|
27
|
+
execute({ command, cwd, timeout, background }: BashInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
30
28
|
}>;
|
|
31
29
|
export {};
|
|
32
30
|
//# sourceMappingURL=bash.d.ts.map
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../source/tools/bash.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../source/tools/bash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAqCvD,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAYF,QAAA,MAAM,WAAW;;;;;iBAkBf,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEnD,eAAO,MAAM,cAAc,GAAU,2BAGlC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;;yBAQwB,eAAe;mDAIK,eAAe,mBACrC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAgGrB,CAAC"}
|
package/dist/tools/bash.js
CHANGED
|
@@ -3,10 +3,40 @@ import { z } from "zod";
|
|
|
3
3
|
import { initExecutionEnvironment } from "../execution/index.js";
|
|
4
4
|
import { logger } from "../logger.js";
|
|
5
5
|
import style from "../terminal/style.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { resolveCwd, validatePaths } from "../utils/bash.js";
|
|
7
|
+
import { convertNullString } from "../utils/zod.js";
|
|
8
|
+
/**
|
|
9
|
+
* Detects git commit commands with multi-line -m messages that will fail in shell.
|
|
10
|
+
* Returns an error message if detected, or null if the command is safe.
|
|
11
|
+
*/
|
|
12
|
+
function detectMultilineGitCommit(command) {
|
|
13
|
+
const trimmed = command.trim();
|
|
14
|
+
// Check if it's a git commit command
|
|
15
|
+
if (!trimmed.startsWith("git commit") && !trimmed.startsWith("git ")) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
// Look for -m flag with a message containing newlines
|
|
19
|
+
// Match patterns like: git commit -m "message\nwith\nnewlines"
|
|
20
|
+
// Using [\s\S] instead of [^] to match any character including newlines
|
|
21
|
+
const messageMatch = trimmed.match(/-m\s+["']([\s\S]*?)["']/);
|
|
22
|
+
if (!messageMatch) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const message = messageMatch[1];
|
|
26
|
+
if (message.includes("\n")) {
|
|
27
|
+
return `Multi-line commit messages with -m flag cause shell parsing errors. Instead:
|
|
28
|
+
1. Write the commit message to a temporary file (e.g., /tmp/acai/commit-msg.txt)
|
|
29
|
+
2. Use: git commit -F /tmp/acai/commit-msg.txt
|
|
30
|
+
3. Optionally remove the temp file after committing
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
First, create the file with the commit message using the write_file tool.
|
|
34
|
+
Then run: git commit -F /tmp/acai/commit-msg.txt`;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
8
38
|
export const BashTool = {
|
|
9
|
-
name: "
|
|
39
|
+
name: "Bash",
|
|
10
40
|
};
|
|
11
41
|
const installedTools = getInstalledTools();
|
|
12
42
|
const toolDescription = `Execute commands in a shell. Commands can execute only within the allowed directories. Always use absolute paths.
|
|
@@ -18,19 +48,17 @@ const DEFAULT_TIMEOUT = 1.5 * 60 * 1000; // 1.5 minutes
|
|
|
18
48
|
const inputSchema = z.object({
|
|
19
49
|
command: z.string().describe("Full CLI command to execute."),
|
|
20
50
|
cwd: z
|
|
21
|
-
.string()
|
|
22
|
-
.nullable()
|
|
51
|
+
.preprocess((val) => convertNullString(val), z.string().nullable())
|
|
23
52
|
.describe("Working directory file path (default: project root). Must be within the project directory. Required but nullable."),
|
|
24
|
-
timeout: z
|
|
25
|
-
.number()
|
|
26
|
-
.nullable()
|
|
53
|
+
timeout: z
|
|
54
|
+
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
27
55
|
.describe(`Command execution timeout in milliseconds. Required but nullable. If null, the default value is ${DEFAULT_TIMEOUT}ms`),
|
|
28
56
|
background: z
|
|
29
57
|
.boolean()
|
|
30
58
|
.optional()
|
|
31
59
|
.describe("Run command in background. If true, command will run until program exit."),
|
|
32
60
|
});
|
|
33
|
-
export const createBashTool = async ({ baseDir, allowedDirs,
|
|
61
|
+
export const createBashTool = async ({ baseDir, allowedDirs, }) => {
|
|
34
62
|
const execEnv = await initExecutionEnvironment();
|
|
35
63
|
const allowedDirectories = allowedDirs ?? [baseDir];
|
|
36
64
|
return {
|
|
@@ -38,123 +66,76 @@ export const createBashTool = async ({ baseDir, allowedDirs, tokenCounter, }) =>
|
|
|
38
66
|
description: toolDescription,
|
|
39
67
|
inputSchema,
|
|
40
68
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
// Handle background execution
|
|
73
|
-
if (background) {
|
|
74
|
-
// Strip any existing & from command to avoid double backgrounding
|
|
75
|
-
let processedCommand = command.trim();
|
|
76
|
-
if (processedCommand.endsWith("&")) {
|
|
77
|
-
logger.warn(`Stripping '&' from command since background=true: ${command}`);
|
|
78
|
-
processedCommand = processedCommand.slice(0, -1).trim();
|
|
79
|
-
}
|
|
80
|
-
// Fix rg commands that don't have an explicit path
|
|
81
|
-
processedCommand = fixRgCommand(processedCommand);
|
|
82
|
-
const backgroundProcess = execEnv.executeCommandInBackground(processedCommand, {
|
|
83
|
-
cwd: resolvedCwd,
|
|
84
|
-
abortSignal,
|
|
85
|
-
onOutput: (output) => {
|
|
86
|
-
logger.debug({ output }, "Background command output:");
|
|
87
|
-
},
|
|
88
|
-
onError: (error) => {
|
|
89
|
-
logger.debug({ error }, "Background command error:");
|
|
90
|
-
},
|
|
91
|
-
onExit: (code) => {
|
|
92
|
-
logger.debug(`Background command exited with code ${code}`);
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
yield {
|
|
96
|
-
name: BashTool.name,
|
|
97
|
-
event: "tool-completion",
|
|
98
|
-
id: toolCallId,
|
|
99
|
-
data: `Background process started with PID: ${backgroundProcess.pid}`,
|
|
100
|
-
};
|
|
101
|
-
yield `Background process started with PID: ${backgroundProcess.pid}`;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
// Handle regular synchronous execution
|
|
105
|
-
// Strip & if present to ensure synchronous behavior
|
|
106
|
-
let processedCommand = command.trim();
|
|
107
|
-
if (processedCommand.endsWith("&")) {
|
|
108
|
-
logger.warn(`Stripping '&' from command since background=false: ${command}`);
|
|
109
|
-
processedCommand = processedCommand.slice(0, -1).trim();
|
|
110
|
-
}
|
|
111
|
-
// Fix rg commands that don't have an explicit path
|
|
112
|
-
// rg hangs when stdin is a socket and no path is given
|
|
113
|
-
processedCommand = fixRgCommand(processedCommand);
|
|
114
|
-
const { output, exitCode } = await execEnv.executeCommand(processedCommand, {
|
|
115
|
-
cwd: resolvedCwd,
|
|
116
|
-
timeout: safeTimeout,
|
|
117
|
-
abortSignal,
|
|
118
|
-
preserveOutputOnError: true,
|
|
119
|
-
captureStderr: true,
|
|
120
|
-
throwOnError: false,
|
|
121
|
-
});
|
|
122
|
-
try {
|
|
123
|
-
const result = await manageTokenLimit(output, tokenCounter, "Bash", "Adjust command to return more specific results");
|
|
124
|
-
const statusText = exitCode === 0 ? "success" : "error";
|
|
125
|
-
yield {
|
|
126
|
-
name: BashTool.name,
|
|
127
|
-
event: "tool-completion",
|
|
128
|
-
id: toolCallId,
|
|
129
|
-
data: `${statusText}${isMutating ? " *" : ""} (${result.tokenCount} tokens)`,
|
|
130
|
-
};
|
|
131
|
-
yield result.content;
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
if (error instanceof TokenLimitExceededError) {
|
|
135
|
-
yield {
|
|
136
|
-
name: BashTool.name,
|
|
137
|
-
event: "tool-error",
|
|
138
|
-
id: toolCallId,
|
|
139
|
-
data: error.message,
|
|
140
|
-
};
|
|
141
|
-
yield error.message;
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
throw error;
|
|
145
|
-
}
|
|
69
|
+
display({ command }) {
|
|
70
|
+
return `\n> ${style.cyan(command)}`;
|
|
71
|
+
},
|
|
72
|
+
async execute({ command, cwd, timeout, background }, { abortSignal }) {
|
|
73
|
+
if (abortSignal?.aborted) {
|
|
74
|
+
throw new Error("Command execution aborted");
|
|
75
|
+
}
|
|
76
|
+
// grok doesn't follow my instructions
|
|
77
|
+
const safeCwd = cwd === "null" ? null : cwd;
|
|
78
|
+
const resolvedCwd = resolveCwd(safeCwd, baseDir, allowedDirectories);
|
|
79
|
+
const safeTimeout = timeout ?? DEFAULT_TIMEOUT;
|
|
80
|
+
const pathValidation = validatePaths(command, allowedDirectories, resolvedCwd);
|
|
81
|
+
if (!pathValidation.isValid) {
|
|
82
|
+
throw new Error(pathValidation.error ?? "Unknown error.");
|
|
83
|
+
}
|
|
84
|
+
// Check for multi-line git commit messages that will fail
|
|
85
|
+
const multilineError = detectMultilineGitCommit(command);
|
|
86
|
+
if (multilineError) {
|
|
87
|
+
throw new Error(multilineError);
|
|
88
|
+
}
|
|
89
|
+
if (abortSignal?.aborted) {
|
|
90
|
+
throw new Error("Command execution aborted before running the command");
|
|
91
|
+
}
|
|
92
|
+
// Handle background execution
|
|
93
|
+
if (background) {
|
|
94
|
+
// Strip any existing & from command to avoid double backgrounding
|
|
95
|
+
let processedCommand = command.trim();
|
|
96
|
+
if (processedCommand.endsWith("&")) {
|
|
97
|
+
logger.warn(`Stripping '&' from command since background=true: ${command}`);
|
|
98
|
+
processedCommand = processedCommand.slice(0, -1).trim();
|
|
146
99
|
}
|
|
100
|
+
// Fix rg commands that don't have an explicit path
|
|
101
|
+
processedCommand = fixRgCommand(processedCommand);
|
|
102
|
+
const backgroundProcess = execEnv.executeCommandInBackground(processedCommand, {
|
|
103
|
+
cwd: resolvedCwd,
|
|
104
|
+
abortSignal,
|
|
105
|
+
onOutput: (output) => {
|
|
106
|
+
logger.debug({ output }, "Background command output:");
|
|
107
|
+
},
|
|
108
|
+
onError: (error) => {
|
|
109
|
+
logger.debug({ error }, "Background command error:");
|
|
110
|
+
},
|
|
111
|
+
onExit: (code) => {
|
|
112
|
+
logger.debug(`Background command exited with code ${code}`);
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
return `Background process started with PID: ${backgroundProcess.pid}`;
|
|
116
|
+
}
|
|
117
|
+
// Handle regular synchronous execution
|
|
118
|
+
// Strip & if present to ensure synchronous behavior
|
|
119
|
+
let processedCommand = command.trim();
|
|
120
|
+
if (processedCommand.endsWith("&")) {
|
|
121
|
+
logger.warn(`Stripping '&' from command since background=false: ${command}`);
|
|
122
|
+
processedCommand = processedCommand.slice(0, -1).trim();
|
|
147
123
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
124
|
+
// Fix rg commands that don't have an explicit path
|
|
125
|
+
// rg hangs when stdin is a socket and no path is given
|
|
126
|
+
processedCommand = fixRgCommand(processedCommand);
|
|
127
|
+
const { output, exitCode } = await execEnv.executeCommand(processedCommand, {
|
|
128
|
+
cwd: resolvedCwd,
|
|
129
|
+
timeout: safeTimeout,
|
|
130
|
+
abortSignal,
|
|
131
|
+
preserveOutputOnError: true,
|
|
132
|
+
captureStderr: true,
|
|
133
|
+
throwOnError: false,
|
|
134
|
+
});
|
|
135
|
+
if (exitCode !== 0) {
|
|
136
|
+
throw new Error(output);
|
|
157
137
|
}
|
|
138
|
+
return output;
|
|
158
139
|
},
|
|
159
140
|
};
|
|
160
141
|
};
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import type {
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
2
|
+
import type { ToolExecutionOptions } from "./types.ts";
|
|
5
3
|
export declare const DirectoryTreeTool: {
|
|
6
|
-
name: "
|
|
4
|
+
name: "DirectoryTree";
|
|
7
5
|
};
|
|
8
6
|
declare const inputSchema: z.ZodObject<{
|
|
9
7
|
path: z.ZodString;
|
|
8
|
+
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
9
|
+
maxDepth: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
11
|
type DirectoryTreeInputSchema = z.infer<typeof inputSchema>;
|
|
12
|
-
export declare const createDirectoryTreeTool: ({ workingDir, allowedDirs,
|
|
12
|
+
export declare const createDirectoryTreeTool: ({ workingDir, allowedDirs, }: {
|
|
13
13
|
workingDir: string;
|
|
14
14
|
allowedDirs?: string[];
|
|
15
|
-
tokenCounter: TokenCounter;
|
|
16
15
|
}) => Promise<{
|
|
17
16
|
toolDef: {
|
|
18
17
|
description: string;
|
|
19
18
|
inputSchema: z.ZodObject<{
|
|
20
19
|
path: z.ZodString;
|
|
20
|
+
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
21
|
+
maxDepth: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
21
22
|
}, z.core.$strip>;
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
+
display({ path, maxDepth, maxResults }: DirectoryTreeInputSchema): string;
|
|
25
|
+
execute({ path, maxResults, maxDepth }: DirectoryTreeInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
24
26
|
}>;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=directory-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-tree.d.ts","sourceRoot":"","sources":["../../source/tools/directory-tree.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"directory-tree.d.ts","sourceRoot":"","sources":["../../source/tools/directory-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKvD,eAAO,MAAM,iBAAiB;;CAE7B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;iBAYf,CAAC;AAEH,KAAK,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,eAAO,MAAM,uBAAuB,GAAU,8BAG3C;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;4CAO2C,wBAAwB;4CAW9B,wBAAwB,mBACvC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAyBrB,CAAC"}
|