@travisennis/acai 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -27
- package/dist/agent/index.d.ts +21 -25
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +145 -103
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -17
- package/dist/commands/add-directory/index.d.ts +3 -0
- package/dist/commands/add-directory/index.d.ts.map +1 -0
- package/dist/commands/{add-directory-command.js → add-directory/index.js} +6 -10
- package/dist/commands/add-directory/types.d.ts +6 -0
- package/dist/commands/add-directory/types.d.ts.map +1 -0
- package/dist/commands/add-directory/types.js +1 -0
- package/dist/commands/add-directory/utils.d.ts +3 -0
- package/dist/commands/add-directory/utils.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.js +15 -0
- package/dist/commands/clear/index.d.ts +3 -0
- package/dist/commands/clear/index.d.ts.map +1 -0
- package/dist/commands/{clear-command.js → clear/index.js} +0 -2
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/{copy-command.js → copy/index.js} +4 -26
- package/dist/commands/copy/types.d.ts +3 -0
- package/dist/commands/copy/types.d.ts.map +1 -0
- package/dist/commands/copy/types.js +1 -0
- package/dist/commands/copy/utils.d.ts +3 -0
- package/dist/commands/copy/utils.d.ts.map +1 -0
- package/dist/commands/copy/utils.js +22 -0
- package/dist/commands/{exit-command.d.ts → exit/index.d.ts} +4 -4
- package/dist/commands/exit/index.d.ts.map +1 -0
- package/dist/commands/exit/index.js +21 -0
- package/dist/commands/exit/types.d.ts +8 -0
- package/dist/commands/exit/types.d.ts.map +1 -0
- package/dist/commands/exit/types.js +1 -0
- package/dist/commands/exit/utils.d.ts +2 -0
- package/dist/commands/exit/utils.d.ts.map +1 -0
- package/dist/commands/exit/utils.js +13 -0
- package/dist/commands/generate-rules/index.d.ts +3 -0
- package/dist/commands/generate-rules/index.d.ts.map +1 -0
- package/dist/commands/{generate-rules-command.js → generate-rules/index.js} +57 -96
- package/dist/commands/generate-rules/utils.d.ts +5 -0
- package/dist/commands/generate-rules/utils.d.ts.map +1 -0
- package/dist/commands/generate-rules/utils.js +25 -0
- package/dist/commands/handoff/index.d.ts +3 -0
- package/dist/commands/handoff/index.d.ts.map +1 -0
- package/dist/commands/handoff/index.js +97 -0
- package/dist/commands/handoff/utils.d.ts +4 -0
- package/dist/commands/handoff/utils.d.ts.map +1 -0
- package/dist/commands/{handoff-command.js → handoff/utils.js} +24 -92
- package/dist/commands/health/index.d.ts +3 -0
- package/dist/commands/health/index.d.ts.map +1 -0
- package/dist/commands/health/index.js +56 -0
- package/dist/commands/health/utils.d.ts +15 -0
- package/dist/commands/health/utils.d.ts.map +1 -0
- package/dist/commands/health/utils.js +52 -0
- package/dist/commands/{help-command.d.ts → help/index.d.ts} +2 -2
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +1 -1
- package/dist/commands/history/index.d.ts +3 -0
- package/dist/commands/history/index.d.ts.map +1 -0
- package/dist/commands/{history-command.js → history/index.js} +16 -100
- package/dist/commands/history/types.d.ts +11 -0
- package/dist/commands/history/types.d.ts.map +1 -0
- package/dist/commands/history/types.js +1 -0
- package/dist/commands/history/utils.d.ts +4 -0
- package/dist/commands/history/utils.d.ts.map +1 -0
- package/dist/commands/history/utils.js +86 -0
- package/dist/commands/init/index.d.ts +3 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/{init-command.js → init/index.js} +16 -7
- package/dist/commands/init-project/index.d.ts +3 -0
- package/dist/commands/init-project/index.d.ts.map +1 -0
- package/dist/commands/init-project/index.js +51 -0
- package/dist/commands/init-project/utils.d.ts +9 -0
- package/dist/commands/init-project/utils.d.ts.map +1 -0
- package/dist/commands/init-project/utils.js +43 -0
- package/dist/commands/list-directories/index.d.ts +3 -0
- package/dist/commands/list-directories/index.d.ts.map +1 -0
- package/dist/commands/{list-directories-command.js → list-directories/index.js} +1 -1
- package/dist/commands/list-tools/index.d.ts +3 -0
- package/dist/commands/list-tools/index.d.ts.map +1 -0
- package/dist/commands/{list-tools-command.js → list-tools/index.js} +4 -16
- package/dist/commands/manager.d.ts +2 -2
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +35 -43
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/{model-command.js → model/index.js} +15 -52
- package/dist/commands/model/utils.d.ts +3 -0
- package/dist/commands/model/utils.d.ts.map +1 -0
- package/dist/commands/model/utils.js +5 -0
- package/dist/commands/{paste-command.d.ts → paste/index.d.ts} +2 -2
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/{paste-command.js → paste/index.js} +6 -111
- package/dist/commands/paste/utils.d.ts +5 -0
- package/dist/commands/paste/utils.d.ts.map +1 -0
- package/dist/commands/paste/utils.js +86 -0
- package/dist/commands/pickup/index.d.ts +3 -0
- package/dist/commands/pickup/index.d.ts.map +1 -0
- package/dist/commands/pickup/index.js +138 -0
- package/dist/commands/pickup/types.d.ts +6 -0
- package/dist/commands/pickup/types.d.ts.map +1 -0
- package/dist/commands/pickup/types.js +1 -0
- package/dist/commands/pickup/utils.d.ts +7 -0
- package/dist/commands/pickup/utils.d.ts.map +1 -0
- package/dist/commands/pickup/utils.js +56 -0
- package/dist/commands/prompt/index.d.ts +5 -0
- package/dist/commands/prompt/index.d.ts.map +1 -0
- package/dist/commands/prompt/index.js +122 -0
- package/dist/commands/prompt/types.d.ts +15 -0
- package/dist/commands/prompt/types.d.ts.map +1 -0
- package/dist/commands/prompt/types.js +1 -0
- package/dist/commands/prompt/utils.d.ts +12 -0
- package/dist/commands/prompt/utils.d.ts.map +1 -0
- package/dist/commands/prompt/utils.js +107 -0
- package/dist/commands/remove-directory/index.d.ts +3 -0
- package/dist/commands/remove-directory/index.d.ts.map +1 -0
- package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +2 -2
- package/dist/commands/reset/index.d.ts +3 -0
- package/dist/commands/reset/index.d.ts.map +1 -0
- package/dist/commands/{reset-command.js → reset/index.js} +7 -2
- package/dist/commands/reset/types.d.ts +1 -0
- package/dist/commands/reset/types.d.ts.map +1 -0
- package/dist/commands/reset/types.js +3 -0
- package/dist/commands/resources/index.d.ts +3 -0
- package/dist/commands/resources/index.d.ts.map +1 -0
- package/dist/commands/resources/index.js +84 -0
- package/dist/commands/review/index.d.ts +3 -0
- package/dist/commands/review/index.d.ts.map +1 -0
- package/dist/commands/review/index.js +126 -0
- package/dist/commands/review/types.d.ts +12 -0
- package/dist/commands/review/types.d.ts.map +1 -0
- package/dist/commands/review/types.js +1 -0
- package/dist/commands/review/utils.d.ts +4 -0
- package/dist/commands/review/utils.d.ts.map +1 -0
- package/dist/commands/review/utils.js +87 -0
- package/dist/commands/save/index.d.ts +3 -0
- package/dist/commands/save/index.d.ts.map +1 -0
- package/dist/commands/{save-command.js → save/index.js} +3 -3
- package/dist/commands/session/index.d.ts +3 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +230 -0
- package/dist/commands/session/types.d.ts +20 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/share/html-renderer.d.ts +25 -0
- package/dist/commands/share/html-renderer.d.ts.map +1 -0
- package/dist/commands/share/html-renderer.js +384 -0
- package/dist/commands/share/index.d.ts +3 -0
- package/dist/commands/share/index.d.ts.map +1 -0
- package/dist/commands/share/index.js +122 -0
- package/dist/commands/shell/index.d.ts +3 -0
- package/dist/commands/shell/index.d.ts.map +1 -0
- package/dist/commands/{shell-command.js → shell/index.js} +3 -3
- package/dist/commands/types.d.ts +2 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +25 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -20
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +60 -64
- package/dist/formatting.d.ts +27 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +194 -95
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -11
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +3 -53
- package/dist/middleware/audit-message.d.ts +2 -2
- package/dist/middleware/audit-message.d.ts.map +1 -1
- package/dist/middleware/audit-message.js +40 -2
- package/dist/middleware/cache.d.ts +2 -2
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +111 -27
- package/dist/middleware/rate-limit.d.ts +2 -2
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +1 -0
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +46 -29
- package/dist/models/anthropic-provider.d.ts +14 -13
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/manager.d.ts +7 -4
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +5 -25
- package/dist/models/openai-provider.d.ts +14 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +39 -0
- package/dist/models/opencode-zen-provider.d.ts +24 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +94 -0
- package/dist/models/openrouter-provider.d.ts +35 -29
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +108 -80
- package/dist/models/providers.d.ts +4 -4
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +7 -1
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/prompts/manager.d.ts +1 -1
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +1 -1
- package/dist/prompts.d.ts +12 -2
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +74 -411
- package/dist/repl/project-status.d.ts +19 -0
- package/dist/repl/project-status.d.ts.map +1 -0
- package/dist/repl/project-status.js +78 -0
- package/dist/repl-new.d.ts +18 -4
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +256 -43
- package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +62 -14
- package/dist/skills.d.ts +0 -4
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +100 -59
- package/dist/stdin.d.ts +9 -0
- package/dist/stdin.d.ts.map +1 -0
- package/dist/stdin.js +26 -0
- package/dist/terminal/control.d.ts +1 -0
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +29 -6
- package/dist/terminal/formatting.d.ts +1 -2
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +1 -2
- package/dist/terminal/keys.d.ts +211 -0
- package/dist/terminal/keys.d.ts.map +1 -0
- package/dist/terminal/keys.js +546 -0
- package/dist/terminal/segmenter.d.ts +6 -0
- package/dist/terminal/segmenter.d.ts.map +1 -0
- package/dist/terminal/segmenter.js +11 -0
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +9 -21
- package/dist/terminal/string-width.d.ts.map +1 -1
- package/dist/terminal/string-width.js +40 -21
- package/dist/terminal/strip-ansi.d.ts.map +1 -1
- package/dist/terminal/strip-ansi.js +9 -15
- package/dist/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +9 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +104 -123
- package/dist/tools/directory-tree.d.ts +9 -7
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +89 -70
- package/dist/tools/dynamic-tool-loader.d.ts +22 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +39 -44
- package/dist/tools/edit-file.d.ts +6 -16
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +19 -76
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +77 -119
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -108
- package/dist/tools/index.d.ts +200 -179
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -315
- package/dist/tools/ls.d.ts +26 -0
- package/dist/tools/ls.d.ts.map +1 -0
- package/dist/tools/ls.js +80 -0
- package/dist/tools/read-file.d.ts +15 -15
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +49 -82
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +37 -66
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -38
- package/dist/tools/types.d.ts +5 -25
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +0 -9
- package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
- package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/attachment-provider.js +159 -0
- package/dist/tui/autocomplete/base-provider.d.ts +17 -0
- package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/base-provider.js +1 -0
- package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
- package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/combined-provider.js +61 -0
- package/dist/tui/autocomplete/command-provider.d.ts +20 -0
- package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/command-provider.js +90 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/file-search-provider.js +123 -0
- package/dist/tui/autocomplete/path-provider.d.ts +21 -0
- package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/path-provider.js +164 -0
- package/dist/tui/autocomplete/utils.d.ts +16 -0
- package/dist/tui/autocomplete/utils.d.ts.map +1 -0
- package/dist/tui/autocomplete/utils.js +137 -0
- package/dist/tui/autocomplete.d.ts +12 -43
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +20 -465
- package/dist/tui/components/box.d.ts.map +1 -1
- package/dist/tui/components/box.js +16 -10
- package/dist/tui/components/editor.d.ts +6 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +166 -107
- package/dist/tui/components/footer.d.ts +20 -7
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +89 -196
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +8 -7
- package/dist/tui/components/loader.d.ts +2 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +7 -2
- package/dist/tui/components/markdown.d.ts +5 -4
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +51 -40
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -8
- package/dist/tui/components/notification.d.ts +28 -0
- package/dist/tui/components/notification.d.ts.map +1 -0
- package/dist/tui/components/notification.js +64 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -1
- package/dist/tui/components/progress-bar.js +3 -15
- package/dist/tui/components/select-list.d.ts +0 -15
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +5 -28
- package/dist/tui/components/tool-execution.d.ts +3 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +26 -38
- package/dist/tui/components/welcome.d.ts +8 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/components/welcome.js +45 -6
- package/dist/tui/editor-launcher.d.ts +13 -0
- package/dist/tui/editor-launcher.d.ts.map +1 -0
- package/dist/tui/editor-launcher.js +39 -0
- package/dist/tui/index.d.ts +7 -3
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +3 -2
- package/dist/tui/terminal.d.ts +29 -2
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +153 -28
- package/dist/tui/tui.d.ts +2 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +39 -29
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +2 -3
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +4 -1
- package/dist/utils/yaml.d.ts +11 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +207 -0
- package/dist/utils/zod.d.ts +1 -0
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +17 -0
- package/package.json +31 -29
- package/bin/acai-wrapper.js +0 -26
- package/dist/api/exa/index.d.ts +0 -177
- package/dist/api/exa/index.d.ts.map +0 -1
- package/dist/api/exa/index.js +0 -439
- package/dist/commands/add-directory-command.d.ts +0 -3
- package/dist/commands/add-directory-command.d.ts.map +0 -1
- package/dist/commands/application-log-command.d.ts +0 -3
- package/dist/commands/application-log-command.d.ts.map +0 -1
- package/dist/commands/application-log-command.js +0 -43
- package/dist/commands/clear-command.d.ts +0 -3
- package/dist/commands/clear-command.d.ts.map +0 -1
- package/dist/commands/compact-command.d.ts +0 -3
- package/dist/commands/compact-command.d.ts.map +0 -1
- package/dist/commands/compact-command.js +0 -55
- package/dist/commands/context-command.d.ts +0 -3
- package/dist/commands/context-command.d.ts.map +0 -1
- package/dist/commands/context-command.js +0 -124
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- package/dist/commands/edit-command.d.ts +0 -3
- package/dist/commands/edit-command.d.ts.map +0 -1
- package/dist/commands/edit-command.js +0 -42
- package/dist/commands/edit-prompt-command.d.ts +0 -3
- package/dist/commands/edit-prompt-command.d.ts.map +0 -1
- package/dist/commands/edit-prompt-command.js +0 -36
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -30
- package/dist/commands/files-command.d.ts +0 -3
- package/dist/commands/files-command.d.ts.map +0 -1
- package/dist/commands/files-command.js +0 -68
- package/dist/commands/generate-rules-command.d.ts +0 -3
- package/dist/commands/generate-rules-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.d.ts +0 -3
- package/dist/commands/handoff-command.d.ts.map +0 -1
- package/dist/commands/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -118
- package/dist/commands/help-command.d.ts.map +0 -1
- package/dist/commands/history-command.d.ts +0 -3
- package/dist/commands/history-command.d.ts.map +0 -1
- package/dist/commands/init-command.d.ts +0 -3
- package/dist/commands/init-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.d.ts +0 -3
- package/dist/commands/last-log-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.js +0 -71
- package/dist/commands/list-directories-command.d.ts +0 -3
- package/dist/commands/list-directories-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.d.ts +0 -3
- package/dist/commands/list-tools-command.d.ts.map +0 -1
- package/dist/commands/model-command.d.ts +0 -3
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/paste-command.d.ts.map +0 -1
- package/dist/commands/pickup-command.d.ts +0 -3
- package/dist/commands/pickup-command.d.ts.map +0 -1
- package/dist/commands/pickup-command.js +0 -109
- package/dist/commands/prompt-command.d.ts +0 -21
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -258
- package/dist/commands/remove-directory-command.d.ts +0 -3
- package/dist/commands/remove-directory-command.d.ts.map +0 -1
- package/dist/commands/reset-command.d.ts +0 -3
- package/dist/commands/reset-command.d.ts.map +0 -1
- package/dist/commands/rules-command.d.ts +0 -3
- package/dist/commands/rules-command.d.ts.map +0 -1
- package/dist/commands/rules-command.js +0 -73
- package/dist/commands/save-command.d.ts +0 -3
- package/dist/commands/save-command.d.ts.map +0 -1
- package/dist/commands/shell-command.d.ts +0 -3
- package/dist/commands/shell-command.d.ts.map +0 -1
- package/dist/commands/usage-command.d.ts +0 -3
- package/dist/commands/usage-command.d.ts.map +0 -1
- package/dist/commands/usage-command.js +0 -31
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/project-status-line.d.ts +0 -3
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -61
- package/dist/repl/tool-call-repair.d.ts +0 -4
- package/dist/repl/tool-call-repair.d.ts.map +0 -1
- package/dist/repl/tool-call-repair.js +0 -54
- package/dist/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -120
- package/dist/tokens/threshold.d.ts +0 -20
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -67
- package/dist/tools/advanced-edit-file.d.ts +0 -69
- package/dist/tools/advanced-edit-file.d.ts.map +0 -1
- package/dist/tools/advanced-edit-file.js +0 -285
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -117
- package/dist/tools/batch.d.ts +0 -34
- package/dist/tools/batch.d.ts.map +0 -1
- package/dist/tools/batch.js +0 -174
- package/dist/tools/code-interpreter.d.ts +0 -25
- package/dist/tools/code-interpreter.d.ts.map +0 -1
- package/dist/tools/code-interpreter.js +0 -183
- package/dist/tools/delete-file.d.ts +0 -24
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/delete-file.js +0 -77
- package/dist/tools/dynamic-tool-parser.d.ts +0 -21
- package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
- package/dist/tools/dynamic-tool-parser.js +0 -22
- package/dist/tools/llm-edit-fixer.d.ts +0 -24
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -136
- package/dist/tools/move-file.d.ts +0 -26
- package/dist/tools/move-file.d.ts.map +0 -1
- package/dist/tools/move-file.js +0 -65
- package/dist/tools/read-multiple-files.d.ts +0 -26
- package/dist/tools/read-multiple-files.d.ts.map +0 -1
- package/dist/tools/read-multiple-files.js +0 -196
- package/dist/tools/web-fetch.d.ts +0 -56
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -247
- package/dist/tools/web-search.d.ts +0 -23
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -148
- package/dist/tui/components/prompt-status.d.ts +0 -17
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -26
package/dist/tools/read-file.js
CHANGED
|
@@ -2,106 +2,73 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import { isNumber } from "@travisennis/stdlib/typeguards";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import style from "../terminal/style.js";
|
|
5
|
-
import { manageTokenLimit, TokenLimitExceededError, } from "../tokens/threshold.js";
|
|
6
5
|
import { joinWorkingDir, validatePath } from "../utils/filesystem/security.js";
|
|
6
|
+
import { convertNullString } from "../utils/zod.js";
|
|
7
7
|
import { fileEncodingSchema } from "./types.js";
|
|
8
|
+
// default limit in bytes
|
|
9
|
+
const DEFAULT_BYTE_LIMIT = 80 * 1024;
|
|
8
10
|
export const ReadFileTool = {
|
|
9
|
-
name: "
|
|
11
|
+
name: "Read",
|
|
10
12
|
};
|
|
11
13
|
const inputSchema = z.object({
|
|
12
14
|
path: z.string().describe("Absolute path to file to read"),
|
|
13
|
-
encoding: fileEncodingSchema
|
|
14
|
-
startLine: z.coerce
|
|
15
|
-
.number()
|
|
15
|
+
encoding: fileEncodingSchema
|
|
16
16
|
.nullable()
|
|
17
|
+
.default("utf-8")
|
|
18
|
+
.describe('Encoding format for reading the file. Use "utf-8" as default for text files'),
|
|
19
|
+
startLine: z
|
|
20
|
+
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
17
21
|
.describe("1-based line number to start reading from. Required but nullable. Pass null to start at beginning of file"),
|
|
18
|
-
lineCount: z
|
|
19
|
-
.number()
|
|
20
|
-
.nullable()
|
|
22
|
+
lineCount: z
|
|
23
|
+
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
21
24
|
.describe("Maximum number of lines to read. Required but nullable. Pass null to get all lines."),
|
|
25
|
+
maxBytes: z
|
|
26
|
+
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
27
|
+
.describe("Maximum number of bytes to read. Set to 0 for no limit. (Default: 80KB)"),
|
|
22
28
|
});
|
|
23
|
-
export const createReadFileTool = async ({ workingDir, allowedDirs,
|
|
29
|
+
export const createReadFileTool = async ({ workingDir, allowedDirs, }) => {
|
|
24
30
|
const allowedDirectory = allowedDirs ?? [workingDir];
|
|
25
31
|
return {
|
|
26
32
|
toolDef: {
|
|
27
|
-
description:
|
|
33
|
+
description: `Read the complete contents of a file from the file system unless startLine and lineCount are given to read a file selection. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories. Automatically limits file size to prevent overwhelming output. Default limit is ${DEFAULT_BYTE_LIMIT} bytes (${DEFAULT_BYTE_LIMIT / 1024}KB). Use maxBytes parameter to override this limit.`,
|
|
28
34
|
inputSchema,
|
|
29
35
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const startIndex = (startLine ?? 1) - 1; // Default to start of file if only lineCount is given
|
|
52
|
-
const count = lineCount ?? totalLines - startIndex; // Default to read all lines from start if only startLine is given
|
|
53
|
-
if (startIndex < 0 || startIndex >= totalLines) {
|
|
54
|
-
const errorMsg = `startLine ${startLine} is out of bounds for file with ${totalLines} lines.`;
|
|
55
|
-
yield {
|
|
56
|
-
name: ReadFileTool.name,
|
|
57
|
-
event: "tool-error",
|
|
58
|
-
id: toolCallId,
|
|
59
|
-
data: errorMsg,
|
|
60
|
-
};
|
|
61
|
-
yield errorMsg;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const endIndex = Math.min(startIndex + count, totalLines);
|
|
65
|
-
file = lines.slice(startIndex, endIndex).join("\n");
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const result = await manageTokenLimit(file, tokenCounter, "ReadFile", isNumber(startLine) || isNumber(lineCount)
|
|
69
|
-
? "Consider adjusting startLine/lineCount or using grepFiles"
|
|
70
|
-
: "Use startLine and lineCount parameters to read specific portions, or use grepFiles for targeted access", encoding);
|
|
71
|
-
// Calculate line count for the returned content
|
|
72
|
-
const linesRead = result.content.split("\n").length;
|
|
73
|
-
yield {
|
|
74
|
-
name: ReadFileTool.name,
|
|
75
|
-
id: toolCallId,
|
|
76
|
-
event: "tool-completion",
|
|
77
|
-
data: `Read ${linesRead} lines (${result.tokenCount} tokens)`,
|
|
78
|
-
};
|
|
79
|
-
yield result.content;
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (error instanceof TokenLimitExceededError) {
|
|
83
|
-
yield {
|
|
84
|
-
name: ReadFileTool.name,
|
|
85
|
-
event: "tool-error",
|
|
86
|
-
id: toolCallId,
|
|
87
|
-
data: error.message,
|
|
88
|
-
};
|
|
89
|
-
yield error.message;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
throw error;
|
|
36
|
+
display({ path: providedPath, startLine, lineCount }) {
|
|
37
|
+
return `\n> ${style.cyan(providedPath)}${startLine ? style.cyan(`:${startLine}`) : ""}${lineCount ? style.cyan(`:${lineCount}`) : ""}`;
|
|
38
|
+
},
|
|
39
|
+
async execute({ path: providedPath, encoding, startLine, lineCount, maxBytes, }, { abortSignal }) {
|
|
40
|
+
if (abortSignal?.aborted) {
|
|
41
|
+
throw new Error("File reading aborted");
|
|
42
|
+
}
|
|
43
|
+
const filePath = await validatePath(joinWorkingDir(providedPath, workingDir), allowedDirectory, { abortSignal });
|
|
44
|
+
if (abortSignal?.aborted) {
|
|
45
|
+
throw new Error("File reading aborted before file read");
|
|
46
|
+
}
|
|
47
|
+
let file = await fs.readFile(filePath, {
|
|
48
|
+
encoding: encoding ?? "utf-8",
|
|
49
|
+
});
|
|
50
|
+
if (isNumber(startLine) || isNumber(lineCount)) {
|
|
51
|
+
const lines = file.split("\n");
|
|
52
|
+
const totalLines = lines.length;
|
|
53
|
+
const startIndex = (startLine ?? 1) - 1;
|
|
54
|
+
const count = lineCount ?? totalLines - startIndex;
|
|
55
|
+
if (startIndex < 0 || startIndex >= totalLines) {
|
|
56
|
+
throw new Error(`startLine ${startLine} is out of bounds for file with ${totalLines} lines.`);
|
|
93
57
|
}
|
|
58
|
+
const endIndex = Math.min(startIndex + count, totalLines);
|
|
59
|
+
file = lines.slice(startIndex, endIndex).join("\n");
|
|
94
60
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
61
|
+
const effectiveMaxBytes = maxBytes ?? DEFAULT_BYTE_LIMIT;
|
|
62
|
+
if (effectiveMaxBytes !== null &&
|
|
63
|
+
effectiveMaxBytes !== undefined &&
|
|
64
|
+
effectiveMaxBytes > 0) {
|
|
65
|
+
const buffer = Buffer.from(file, encoding ?? "utf-8");
|
|
66
|
+
if (buffer.byteLength > effectiveMaxBytes) {
|
|
67
|
+
const truncatedBuffer = buffer.subarray(0, effectiveMaxBytes);
|
|
68
|
+
file = truncatedBuffer.toString(encoding ?? "utf-8");
|
|
69
|
+
}
|
|
104
70
|
}
|
|
71
|
+
return file;
|
|
105
72
|
},
|
|
106
73
|
};
|
|
107
74
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import { type
|
|
2
|
+
import { type ToolExecutionOptions } from "./types.ts";
|
|
4
3
|
export declare const SaveFileTool: {
|
|
5
|
-
name: "
|
|
4
|
+
name: "Write";
|
|
6
5
|
};
|
|
7
6
|
declare const inputSchema: z.ZodObject<{
|
|
8
7
|
path: z.ZodString;
|
|
@@ -46,7 +45,8 @@ export declare const createSaveFileTool: ({ workingDir, allowedDirs, }: {
|
|
|
46
45
|
}>>;
|
|
47
46
|
}, z.core.$strip>;
|
|
48
47
|
};
|
|
49
|
-
|
|
48
|
+
display({ path }: SaveFileInputSchema): string;
|
|
49
|
+
execute({ path: userPath, content, encoding }: SaveFileInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
50
50
|
}>;
|
|
51
51
|
export {};
|
|
52
52
|
//# sourceMappingURL=save-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-file.d.ts","sourceRoot":"","sources":["../../source/tools/save-file.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"save-file.d.ts","sourceRoot":"","sources":["../../source/tools/save-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;iBAQf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,8BAGtC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;sBAYqB,mBAAmB;mDAII,mBAAmB,mBACzC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAqDrB,CAAC"}
|
package/dist/tools/save-file.js
CHANGED
|
@@ -2,12 +2,12 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { config } from "../config.js";
|
|
5
|
-
import { clearProjectStatusCache } from "../repl/project-status
|
|
5
|
+
import { clearProjectStatusCache } from "../repl/project-status.js";
|
|
6
6
|
import style from "../terminal/style.js";
|
|
7
7
|
import { joinWorkingDir, validateFileNotReadOnly, validatePath, } from "../utils/filesystem/security.js";
|
|
8
8
|
import { fileEncodingSchema } from "./types.js";
|
|
9
9
|
export const SaveFileTool = {
|
|
10
|
-
name: "
|
|
10
|
+
name: "Write",
|
|
11
11
|
};
|
|
12
12
|
const inputSchema = z.object({
|
|
13
13
|
path: z.string().describe("Absolute path to file to save to"),
|
|
@@ -26,76 +26,47 @@ export const createSaveFileTool = async ({ workingDir, allowedDirs, }) => {
|
|
|
26
26
|
"Handles text content with proper encoding. Only works within allowed directories.",
|
|
27
27
|
inputSchema,
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
display({ path }) {
|
|
30
|
+
return `\n> ${style.cyan(path)}`;
|
|
31
|
+
},
|
|
32
|
+
async execute({ path: userPath, content, encoding }, { abortSignal }) {
|
|
33
|
+
if (abortSignal?.aborted) {
|
|
34
|
+
throw new Error("File saving aborted");
|
|
35
|
+
}
|
|
36
|
+
const filePath = await validatePath(joinWorkingDir(userPath, workingDir), allowedDirectory, { requireExistence: false, abortSignal });
|
|
30
37
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
data: `${style.cyan(userPath)}`,
|
|
39
|
-
};
|
|
40
|
-
const filePath = await validatePath(joinWorkingDir(userPath, workingDir), allowedDirectory, { requireExistence: false, abortSignal });
|
|
41
|
-
// Check if file is read-only (only if it exists)
|
|
42
|
-
try {
|
|
43
|
-
await fs.stat(filePath);
|
|
44
|
-
const projectConfig = await config.getConfig();
|
|
45
|
-
validateFileNotReadOnly(filePath, projectConfig, workingDir);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
// File doesn't exist, so it's not read-only
|
|
49
|
-
if (error.code !== "ENOENT") {
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// Check if path exists and is a directory
|
|
54
|
-
try {
|
|
55
|
-
const stat = await fs.stat(filePath);
|
|
56
|
-
if (stat.isDirectory()) {
|
|
57
|
-
throw new Error(`Cannot save file - path is a directory: ${filePath}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
// Only re-throw if it's our directory error, otherwise continue (file doesn't exist)
|
|
62
|
-
if (error instanceof Error &&
|
|
63
|
-
error.message.includes("is a directory")) {
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
38
|
+
await fs.stat(filePath);
|
|
39
|
+
const projectConfig = await config.getConfig();
|
|
40
|
+
validateFileNotReadOnly(filePath, projectConfig, workingDir);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error.code !== "ENOENT") {
|
|
44
|
+
throw error;
|
|
66
45
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const stat = await fs.stat(filePath);
|
|
49
|
+
if (stat.isDirectory()) {
|
|
50
|
+
throw new Error(`Cannot save file - path is a directory: ${filePath}`);
|
|
70
51
|
}
|
|
71
|
-
// Ensure parent directory exists (create missing parents)
|
|
72
|
-
const parentDir = path.dirname(filePath);
|
|
73
|
-
await fs.mkdir(parentDir, { recursive: true });
|
|
74
|
-
await fs.writeFile(filePath, content, {
|
|
75
|
-
encoding,
|
|
76
|
-
signal: abortSignal,
|
|
77
|
-
});
|
|
78
|
-
const lines = content.split("\n").length;
|
|
79
|
-
const bytes = Buffer.byteLength(content, encoding);
|
|
80
|
-
yield {
|
|
81
|
-
name: SaveFileTool.name,
|
|
82
|
-
event: "tool-completion",
|
|
83
|
-
id: toolCallId,
|
|
84
|
-
data: `Saved ${lines} lines, ${bytes} bytes`,
|
|
85
|
-
};
|
|
86
|
-
// Clear project status cache since file operations change git status
|
|
87
|
-
clearProjectStatusCache();
|
|
88
|
-
yield `File saved successfully: ${filePath}`;
|
|
89
52
|
}
|
|
90
53
|
catch (error) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
54
|
+
if (error instanceof Error &&
|
|
55
|
+
error.message.includes("is a directory")) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (abortSignal?.aborted) {
|
|
60
|
+
throw new Error("File saving aborted before writing");
|
|
98
61
|
}
|
|
62
|
+
const parentDir = path.dirname(filePath);
|
|
63
|
+
await fs.mkdir(parentDir, { recursive: true });
|
|
64
|
+
await fs.writeFile(filePath, content, {
|
|
65
|
+
encoding,
|
|
66
|
+
signal: abortSignal,
|
|
67
|
+
});
|
|
68
|
+
clearProjectStatusCache();
|
|
69
|
+
return `File saved successfully: ${filePath}`;
|
|
99
70
|
},
|
|
100
71
|
};
|
|
101
72
|
};
|
package/dist/tools/think.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import type {
|
|
2
|
+
import type { ToolExecutionOptions } from "./types.ts";
|
|
4
3
|
export declare const ThinkTool: {
|
|
5
|
-
name: "
|
|
4
|
+
name: "Think";
|
|
6
5
|
};
|
|
7
6
|
declare const inputSchema: z.ZodObject<{
|
|
8
7
|
thought: z.ZodString;
|
|
@@ -14,7 +13,8 @@ export declare const createThinkTool: () => {
|
|
|
14
13
|
thought: z.ZodString;
|
|
15
14
|
}, z.core.$strip>;
|
|
16
15
|
};
|
|
17
|
-
|
|
16
|
+
display(): string;
|
|
17
|
+
execute({ thought }: z.infer<typeof inputSchema>, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
18
18
|
};
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=think.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"think.d.ts","sourceRoot":"","sources":["../../source/tools/think.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"think.d.ts","sourceRoot":"","sources":["../../source/tools/think.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,SAAS;;CAErB,CAAC;AAWF,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAGH,eAAO,MAAM,eAAe;;;;;;;;yBAUT,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,mBACvB,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;CAUrB,CAAC"}
|
package/dist/tools/think.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const ThinkTool = {
|
|
3
|
-
name: "
|
|
3
|
+
name: "Think",
|
|
4
4
|
};
|
|
5
5
|
const toolDescription = `Use the tool to think about something. It will not obtain new information or make any changes to the repository, but just log the thought. Use it when complex reasoning or brainstorming is needed.
|
|
6
6
|
Common use cases:
|
|
@@ -20,44 +20,15 @@ export const createThinkTool = () => {
|
|
|
20
20
|
description: toolDescription,
|
|
21
21
|
inputSchema,
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Replace literal '\\n' with actual newline characters
|
|
30
|
-
const formattedThought = thought.replace(/\\n/g, "\n");
|
|
31
|
-
yield {
|
|
32
|
-
name: ThinkTool.name,
|
|
33
|
-
event: "tool-init",
|
|
34
|
-
id: toolCallId,
|
|
35
|
-
data: "Logging thought",
|
|
36
|
-
};
|
|
37
|
-
yield {
|
|
38
|
-
name: ThinkTool.name,
|
|
39
|
-
event: "tool-update",
|
|
40
|
-
id: toolCallId,
|
|
41
|
-
data: `${formattedThought}`,
|
|
42
|
-
};
|
|
43
|
-
yield {
|
|
44
|
-
name: ThinkTool.name,
|
|
45
|
-
event: "tool-completion",
|
|
46
|
-
id: toolCallId,
|
|
47
|
-
data: "Thought logged",
|
|
48
|
-
};
|
|
49
|
-
yield "Your thought has been logged.";
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
53
|
-
yield {
|
|
54
|
-
name: ThinkTool.name,
|
|
55
|
-
event: "tool-error",
|
|
56
|
-
id: toolCallId,
|
|
57
|
-
data: errorMessage,
|
|
58
|
-
};
|
|
59
|
-
yield errorMessage;
|
|
23
|
+
display() {
|
|
24
|
+
return "\n> Logging thought";
|
|
25
|
+
},
|
|
26
|
+
async execute({ thought }, { abortSignal }) {
|
|
27
|
+
if (abortSignal?.aborted) {
|
|
28
|
+
throw new Error("Thinking process aborted");
|
|
60
29
|
}
|
|
30
|
+
const formattedThought = thought.replace(/\\n/g, "\n");
|
|
31
|
+
return `Thought: ${formattedThought}`;
|
|
61
32
|
},
|
|
62
33
|
};
|
|
63
34
|
};
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -12,29 +12,9 @@ export declare const fileEncodingSchema: z.ZodEnum<{
|
|
|
12
12
|
binary: "binary";
|
|
13
13
|
hex: "hex";
|
|
14
14
|
}>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
interface ToolInitMessage extends BaseMessage {
|
|
21
|
-
event: "tool-init";
|
|
22
|
-
data: string;
|
|
23
|
-
}
|
|
24
|
-
interface ToolUpdateMessage extends BaseMessage {
|
|
25
|
-
event: "tool-update";
|
|
26
|
-
data: string;
|
|
27
|
-
}
|
|
28
|
-
interface ToolErrorMessage extends BaseMessage {
|
|
29
|
-
event: "tool-error";
|
|
30
|
-
data: string;
|
|
31
|
-
}
|
|
32
|
-
interface ToolCompletionMessage extends BaseMessage {
|
|
33
|
-
event: "tool-completion";
|
|
34
|
-
data: string;
|
|
35
|
-
}
|
|
36
|
-
type Message = ToolInitMessage | ToolUpdateMessage | ToolErrorMessage | ToolCompletionMessage;
|
|
37
|
-
export type ToolResult = Message | string;
|
|
38
|
-
export declare function isToolMessage(value: unknown): value is Message;
|
|
39
|
-
export {};
|
|
15
|
+
export type ToolExecutionOptions = {
|
|
16
|
+
toolCallId: string;
|
|
17
|
+
messages?: any[];
|
|
18
|
+
abortSignal?: AbortSignal;
|
|
19
|
+
};
|
|
40
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/tools/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAY7B,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/tools/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAY7B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC"}
|
package/dist/tools/types.js
CHANGED
|
@@ -12,12 +12,3 @@ export const fileEncodingSchema = z.enum([
|
|
|
12
12
|
"binary",
|
|
13
13
|
"hex",
|
|
14
14
|
]);
|
|
15
|
-
export function isToolMessage(value) {
|
|
16
|
-
if (!value || typeof value !== "object") {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
const candidate = value;
|
|
20
|
-
return (typeof candidate.event === "string" &&
|
|
21
|
-
typeof candidate.id === "string" &&
|
|
22
|
-
("data" in candidate || "retry" in candidate));
|
|
23
|
-
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AutocompleteItem } from "./base-provider.ts";
|
|
2
|
+
import { PathProvider } from "./path-provider.ts";
|
|
3
|
+
export declare class AttachmentProvider extends PathProvider {
|
|
4
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
|
|
5
|
+
items: AutocompleteItem[];
|
|
6
|
+
prefix: string;
|
|
7
|
+
} | null>;
|
|
8
|
+
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
9
|
+
lines: string[];
|
|
10
|
+
cursorLine: number;
|
|
11
|
+
cursorCol: number;
|
|
12
|
+
};
|
|
13
|
+
getForceFileSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
|
|
14
|
+
items: AutocompleteItem[];
|
|
15
|
+
prefix: string;
|
|
16
|
+
} | null>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=attachment-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/attachment-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,qBAAa,kBAAmB,SAAQ,YAAY;IACnC,cAAc,CAC3B,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAyCvD,eAAe,CACtB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAwB9C,uBAAuB,CACpC,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CA0CjE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { extname } from "node:path";
|
|
2
|
+
import { PathProvider } from "./path-provider.js";
|
|
3
|
+
export class AttachmentProvider extends PathProvider {
|
|
4
|
+
async getSuggestions(lines, cursorLine, cursorCol) {
|
|
5
|
+
const currentLine = lines[cursorLine] || "";
|
|
6
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
7
|
+
// Only handle @ file attachments
|
|
8
|
+
const pathMatch = textBeforeCursor.match(/@([^\s]*)$/);
|
|
9
|
+
if (!pathMatch) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
let prefix = pathMatch[0]; // Includes the @
|
|
13
|
+
// Handle @ file attachment prefix
|
|
14
|
+
if (prefix.startsWith("@")) {
|
|
15
|
+
prefix = prefix.slice(1); // Remove the @
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const suggestions = await this.getFileSuggestions(prefix);
|
|
21
|
+
if (suggestions.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
// For @ prefix, filter to only show directories and attachable files
|
|
24
|
+
const filteredSuggestions = [];
|
|
25
|
+
for (const suggestion of suggestions) {
|
|
26
|
+
if (!suggestion.value.endsWith("/") &&
|
|
27
|
+
!isAttachableFile(suggestion.value)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
suggestion.value = `@${suggestion.value}`;
|
|
31
|
+
filteredSuggestions.push(suggestion);
|
|
32
|
+
}
|
|
33
|
+
if (filteredSuggestions.length === 0)
|
|
34
|
+
return null;
|
|
35
|
+
return {
|
|
36
|
+
items: filteredSuggestions,
|
|
37
|
+
prefix: pathMatch[0],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
41
|
+
const currentLine = lines[cursorLine] || "";
|
|
42
|
+
const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
|
|
43
|
+
const afterCursor = currentLine.slice(cursorCol);
|
|
44
|
+
// Only handle @ file attachment completion if prefix starts with "@"
|
|
45
|
+
if (prefix.startsWith("@")) {
|
|
46
|
+
// Handle @ file attachment completion
|
|
47
|
+
const newLine = `${beforePrefix + item.value} ${afterCursor}`;
|
|
48
|
+
const newLines = [...lines];
|
|
49
|
+
newLines[cursorLine] = newLine;
|
|
50
|
+
return {
|
|
51
|
+
lines: newLines,
|
|
52
|
+
cursorLine,
|
|
53
|
+
cursorCol: beforePrefix.length + item.value.length + 1, // +1 for space
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// If not an @ attachment, let other providers handle it
|
|
57
|
+
return { lines, cursorLine, cursorCol };
|
|
58
|
+
}
|
|
59
|
+
// Force file completion (called on Tab key) - always returns suggestions
|
|
60
|
+
async getForceFileSuggestions(lines, cursorLine, cursorCol) {
|
|
61
|
+
const currentLine = lines[cursorLine] || "";
|
|
62
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
63
|
+
// Check for @ file attachment syntax first
|
|
64
|
+
const atMatch = textBeforeCursor.match(/@([^\s]*)$/);
|
|
65
|
+
const pathMatch = atMatch ? atMatch[0] : null;
|
|
66
|
+
console.log("pathMatch", textBeforeCursor, pathMatch);
|
|
67
|
+
if (pathMatch !== null) {
|
|
68
|
+
let prefix = pathMatch; // Includes the @
|
|
69
|
+
// Handle @ file attachment prefix
|
|
70
|
+
if (prefix.startsWith("@")) {
|
|
71
|
+
prefix = prefix.slice(1); // Remove the @
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const suggestions = await this.getFileSuggestions(prefix);
|
|
77
|
+
if (suggestions.length === 0)
|
|
78
|
+
return null;
|
|
79
|
+
// For @ prefix, filter to only show directories and attachable files
|
|
80
|
+
const filteredSuggestions = [];
|
|
81
|
+
for (const suggestion of suggestions) {
|
|
82
|
+
if (!suggestion.value.endsWith("/") &&
|
|
83
|
+
!isAttachableFile(suggestion.value)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
suggestion.value = `@${suggestion.value}`;
|
|
87
|
+
filteredSuggestions.push(suggestion);
|
|
88
|
+
}
|
|
89
|
+
if (filteredSuggestions.length === 0)
|
|
90
|
+
return null;
|
|
91
|
+
return {
|
|
92
|
+
items: suggestions,
|
|
93
|
+
prefix: pathMatch,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isAttachableFile(filePath) {
|
|
100
|
+
// Check file extension for common text files that might be misidentified
|
|
101
|
+
const textExtensions = [
|
|
102
|
+
".txt",
|
|
103
|
+
".md",
|
|
104
|
+
".markdown",
|
|
105
|
+
".js",
|
|
106
|
+
".ts",
|
|
107
|
+
".tsx",
|
|
108
|
+
".jsx",
|
|
109
|
+
".py",
|
|
110
|
+
".java",
|
|
111
|
+
".c",
|
|
112
|
+
".cpp",
|
|
113
|
+
".h",
|
|
114
|
+
".hpp",
|
|
115
|
+
".cs",
|
|
116
|
+
".php",
|
|
117
|
+
".rb",
|
|
118
|
+
".go",
|
|
119
|
+
".rs",
|
|
120
|
+
".swift",
|
|
121
|
+
".kt",
|
|
122
|
+
".scala",
|
|
123
|
+
".sh",
|
|
124
|
+
".bash",
|
|
125
|
+
".zsh",
|
|
126
|
+
".fish",
|
|
127
|
+
".html",
|
|
128
|
+
".htm",
|
|
129
|
+
".css",
|
|
130
|
+
".scss",
|
|
131
|
+
".sass",
|
|
132
|
+
".less",
|
|
133
|
+
".xml",
|
|
134
|
+
".json",
|
|
135
|
+
".yaml",
|
|
136
|
+
".yml",
|
|
137
|
+
".toml",
|
|
138
|
+
".ini",
|
|
139
|
+
".cfg",
|
|
140
|
+
".conf",
|
|
141
|
+
".log",
|
|
142
|
+
".sql",
|
|
143
|
+
".r",
|
|
144
|
+
".R",
|
|
145
|
+
".m",
|
|
146
|
+
".pl",
|
|
147
|
+
".lua",
|
|
148
|
+
".vim",
|
|
149
|
+
".dockerfile",
|
|
150
|
+
".makefile",
|
|
151
|
+
".cmake",
|
|
152
|
+
".gradle",
|
|
153
|
+
".maven",
|
|
154
|
+
".properties",
|
|
155
|
+
".env",
|
|
156
|
+
];
|
|
157
|
+
const ext = extname(filePath).toLowerCase();
|
|
158
|
+
return textExtensions.includes(ext);
|
|
159
|
+
}
|