@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/agent.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { generateText, stepCountIs } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { AiConfig } from "../models/ai-config.js";
|
|
4
|
-
import { DirectoryTreeTool } from "./directory-tree.js";
|
|
5
|
-
import { GlobTool } from "./glob.js";
|
|
6
|
-
import { GrepTool } from "./grep.js";
|
|
7
|
-
import { initCliTools } from "./index.js";
|
|
8
|
-
import { ReadFileTool } from "./read-file.js";
|
|
9
|
-
import { ReadMultipleFilesTool } from "./read-multiple-files.js";
|
|
10
|
-
export const AgentTool = {
|
|
11
|
-
name: "agent",
|
|
12
|
-
};
|
|
13
|
-
const TOOLS = [
|
|
14
|
-
GrepTool.name,
|
|
15
|
-
GlobTool.name,
|
|
16
|
-
ReadFileTool.name,
|
|
17
|
-
ReadMultipleFilesTool.name,
|
|
18
|
-
DirectoryTreeTool.name,
|
|
19
|
-
];
|
|
20
|
-
function getToolDescription() {
|
|
21
|
-
const toolNames = TOOLS.join(", ");
|
|
22
|
-
return `Launch a new agent that has access to the following tools: ${toolNames}. This agent is specifically designed for file discovery and code search tasks. Use the ${AgentTool.name} tool when you need to search for files or code patterns across the codebase.
|
|
23
|
-
|
|
24
|
-
Use cases:
|
|
25
|
-
- Search for files matching specific patterns (e.g., "*.ts", "**/*.test.ts") using ${GlobTool.name}
|
|
26
|
-
- Find code patterns or text within files using ${GrepTool.name}
|
|
27
|
-
- Read specific files or multiple files using ${ReadFileTool.name} and ${ReadMultipleFilesTool.name}
|
|
28
|
-
|
|
29
|
-
Important limitations:
|
|
30
|
-
- This agent cannot execute shell commands or run external tools
|
|
31
|
-
- It is focused purely on file discovery and content reading
|
|
32
|
-
- For complex operations or command execution, use the main assistant directly
|
|
33
|
-
|
|
34
|
-
Usage notes:
|
|
35
|
-
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
|
|
36
|
-
2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
|
|
37
|
-
3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
|
|
38
|
-
4. The agent's outputs should generally be trusted.`;
|
|
39
|
-
}
|
|
40
|
-
const inputSchema = z.object({
|
|
41
|
-
prompt: z.string().describe("The task for the agent to perform"),
|
|
42
|
-
});
|
|
43
|
-
export const createAgentTools = (options) => {
|
|
44
|
-
const { modelManager, tokenTracker, tokenCounter } = options;
|
|
45
|
-
const toolDef = {
|
|
46
|
-
description: getToolDescription(),
|
|
47
|
-
inputSchema,
|
|
48
|
-
};
|
|
49
|
-
async function* execute({ prompt }, { toolCallId, abortSignal }) {
|
|
50
|
-
if (abortSignal?.aborted) {
|
|
51
|
-
throw new Error("Agent execution aborted");
|
|
52
|
-
}
|
|
53
|
-
yield {
|
|
54
|
-
name: AgentTool.name,
|
|
55
|
-
event: "tool-init",
|
|
56
|
-
id: toolCallId,
|
|
57
|
-
data: "Invoking agent...",
|
|
58
|
-
};
|
|
59
|
-
yield {
|
|
60
|
-
name: AgentTool.name,
|
|
61
|
-
event: "tool-update",
|
|
62
|
-
id: toolCallId,
|
|
63
|
-
data: `## Prompt:\n\n${prompt}`,
|
|
64
|
-
};
|
|
65
|
-
try {
|
|
66
|
-
const modelConfig = modelManager.getModelMetadata("task-agent");
|
|
67
|
-
const aiConfig = new AiConfig({
|
|
68
|
-
modelMetadata: modelConfig,
|
|
69
|
-
prompt,
|
|
70
|
-
});
|
|
71
|
-
const { text, usage } = await generateText({
|
|
72
|
-
model: modelManager.getModel("task-agent"),
|
|
73
|
-
maxOutputTokens: aiConfig.maxOutputTokens(),
|
|
74
|
-
system: "You are a code search assistant that will be given a task that will require you to search a code base to find relevant code and files.",
|
|
75
|
-
prompt: prompt,
|
|
76
|
-
temperature: aiConfig.temperature(),
|
|
77
|
-
topP: aiConfig.topP(),
|
|
78
|
-
stopWhen: stepCountIs(30),
|
|
79
|
-
providerOptions: aiConfig.providerOptions(),
|
|
80
|
-
tools: (await initCliTools({
|
|
81
|
-
tokenCounter,
|
|
82
|
-
workspace: options.workspace,
|
|
83
|
-
})).toolDefs,
|
|
84
|
-
abortSignal: abortSignal,
|
|
85
|
-
// biome-ignore lint/style/useNamingConvention: third-party code
|
|
86
|
-
experimental_activeTools: [...TOOLS],
|
|
87
|
-
});
|
|
88
|
-
tokenTracker.trackUsage("task-agent", usage);
|
|
89
|
-
yield {
|
|
90
|
-
name: AgentTool.name,
|
|
91
|
-
event: "tool-update",
|
|
92
|
-
id: toolCallId,
|
|
93
|
-
data: `## Response:\n\n${text}`,
|
|
94
|
-
};
|
|
95
|
-
yield {
|
|
96
|
-
name: AgentTool.name,
|
|
97
|
-
event: "tool-completion",
|
|
98
|
-
id: toolCallId,
|
|
99
|
-
data: `Finished (${usage.totalTokens} tokens)`,
|
|
100
|
-
};
|
|
101
|
-
yield text;
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
yield {
|
|
105
|
-
name: AgentTool.name,
|
|
106
|
-
event: "tool-error",
|
|
107
|
-
id: toolCallId,
|
|
108
|
-
data: error.message,
|
|
109
|
-
};
|
|
110
|
-
yield error.message;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
toolDef,
|
|
115
|
-
execute,
|
|
116
|
-
};
|
|
117
|
-
};
|
package/dist/tools/batch.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { TokenCounter } from "../tokens/counter.ts";
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
5
|
-
export declare const BatchTool: {
|
|
6
|
-
name: "batch";
|
|
7
|
-
};
|
|
8
|
-
declare const inputSchema: z.ZodObject<{
|
|
9
|
-
calls: z.ZodArray<z.ZodObject<{
|
|
10
|
-
tool: z.ZodString;
|
|
11
|
-
arguments: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
12
|
-
id: z.ZodOptional<z.ZodString>;
|
|
13
|
-
}, z.core.$strip>>;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
type BatchInputSchema = z.infer<typeof inputSchema>;
|
|
16
|
-
type ToolExecutor = (args: Record<string, unknown>, options: ToolCallOptions) => AsyncGenerator<ToolResult> | Promise<string>;
|
|
17
|
-
export declare const createBatchTool: ({ tokenCounter, executors, }: {
|
|
18
|
-
tokenCounter: TokenCounter;
|
|
19
|
-
executors: Map<string, ToolExecutor>;
|
|
20
|
-
}) => Promise<{
|
|
21
|
-
toolDef: {
|
|
22
|
-
description: string;
|
|
23
|
-
inputSchema: z.ZodObject<{
|
|
24
|
-
calls: z.ZodArray<z.ZodObject<{
|
|
25
|
-
tool: z.ZodString;
|
|
26
|
-
arguments: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
27
|
-
id: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
|
-
}, z.core.$strip>;
|
|
30
|
-
};
|
|
31
|
-
execute({ calls }: BatchInputSchema, { toolCallId, messages, abortSignal }: ToolCallOptions): AsyncGenerator<ToolResult>;
|
|
32
|
-
}>;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../source/tools/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,SAAS;;CAErB,CAAC;AAaF,QAAA,MAAM,WAAW;;;;;;iBAMf,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACpD,KAAK,YAAY,GAAG,CAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,KACrB,cAAc,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,eAAe,GAAU,8BAGnC;IACD,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACtC;;;;;;;;;;;uBAQgB,gBAAgB,yCACY,eAAe,GACrD,cAAc,CAAC,UAAU,CAAC;EAkLhC,CAAC"}
|
package/dist/tools/batch.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { logger } from "../logger.js";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { manageTokenLimit, TokenLimitExceededError, } from "../tokens/threshold.js";
|
|
5
|
-
export const BatchTool = {
|
|
6
|
-
name: "batch",
|
|
7
|
-
};
|
|
8
|
-
const toolCallSchema = z.object({
|
|
9
|
-
tool: z.string().describe("Name of the tool to execute"),
|
|
10
|
-
arguments: z
|
|
11
|
-
.record(z.any(), z.any())
|
|
12
|
-
.describe("Arguments to pass to the tool"),
|
|
13
|
-
id: z
|
|
14
|
-
.string()
|
|
15
|
-
.optional()
|
|
16
|
-
.describe("Optional ID for tracking this specific call"),
|
|
17
|
-
});
|
|
18
|
-
const inputSchema = z.object({
|
|
19
|
-
calls: z
|
|
20
|
-
.array(toolCallSchema)
|
|
21
|
-
.min(1)
|
|
22
|
-
.max(10)
|
|
23
|
-
.describe("Array of tool calls to execute in sequence"),
|
|
24
|
-
});
|
|
25
|
-
export const createBatchTool = async ({ tokenCounter, executors, }) => {
|
|
26
|
-
return {
|
|
27
|
-
toolDef: {
|
|
28
|
-
description: "Execute multiple tool calls in a single request. Reduces roundtrips by batching operations. Tools are executed sequentially in the order provided.",
|
|
29
|
-
inputSchema,
|
|
30
|
-
},
|
|
31
|
-
async *execute({ calls }, { toolCallId, messages, abortSignal }) {
|
|
32
|
-
try {
|
|
33
|
-
if (abortSignal?.aborted) {
|
|
34
|
-
throw new Error("Batch execution aborted");
|
|
35
|
-
}
|
|
36
|
-
const totalCalls = calls.length;
|
|
37
|
-
yield {
|
|
38
|
-
name: BatchTool.name,
|
|
39
|
-
event: "tool-init",
|
|
40
|
-
id: toolCallId,
|
|
41
|
-
data: `Starting batch execution of ${totalCalls} tool calls`,
|
|
42
|
-
};
|
|
43
|
-
const results = [];
|
|
44
|
-
for (let i = 0; i < calls.length; i++) {
|
|
45
|
-
const call = calls[i];
|
|
46
|
-
const { tool: toolName, arguments: args, id: callId } = call;
|
|
47
|
-
const callNumber = i + 1;
|
|
48
|
-
if (abortSignal?.aborted) {
|
|
49
|
-
results.push({
|
|
50
|
-
tool: toolName,
|
|
51
|
-
id: callId,
|
|
52
|
-
status: "error",
|
|
53
|
-
error: "Batch execution aborted",
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const executor = executors.get(toolName);
|
|
58
|
-
if (!executor) {
|
|
59
|
-
results.push({
|
|
60
|
-
tool: toolName,
|
|
61
|
-
id: callId,
|
|
62
|
-
status: "error",
|
|
63
|
-
error: `Unknown tool '${toolName}'`,
|
|
64
|
-
});
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
yield {
|
|
68
|
-
name: BatchTool.name,
|
|
69
|
-
event: "tool-update",
|
|
70
|
-
id: toolCallId,
|
|
71
|
-
data: `[${callNumber}/${totalCalls}] ${style.cyan(toolName)}${callId ? ` (${callId})` : ""} ${style.dim(JSON.stringify(args).slice(0, 60))}...`,
|
|
72
|
-
};
|
|
73
|
-
try {
|
|
74
|
-
const executorResult = executor(args, {
|
|
75
|
-
toolCallId: callId || `${toolCallId}-${i}`,
|
|
76
|
-
messages,
|
|
77
|
-
abortSignal,
|
|
78
|
-
});
|
|
79
|
-
let toolOutput = "";
|
|
80
|
-
// Handle both async generators and regular async functions
|
|
81
|
-
if (typeof executorResult[Symbol.asyncIterator] === "function") {
|
|
82
|
-
// It's an async generator
|
|
83
|
-
const generator = executorResult;
|
|
84
|
-
for await (const chunk of generator) {
|
|
85
|
-
if (typeof chunk === "string") {
|
|
86
|
-
toolOutput += chunk;
|
|
87
|
-
}
|
|
88
|
-
else if (chunk.event === "tool-completion") {
|
|
89
|
-
// Capture completion message
|
|
90
|
-
toolOutput += chunk.data;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// It's a regular async function returning a string
|
|
96
|
-
toolOutput = await executorResult;
|
|
97
|
-
}
|
|
98
|
-
results.push({
|
|
99
|
-
tool: toolName,
|
|
100
|
-
id: callId,
|
|
101
|
-
status: "success",
|
|
102
|
-
result: toolOutput,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
107
|
-
logger.error({ error, toolName, args }, "Batch tool execution failed");
|
|
108
|
-
results.push({
|
|
109
|
-
tool: toolName,
|
|
110
|
-
id: callId,
|
|
111
|
-
status: "error",
|
|
112
|
-
error: errorMessage,
|
|
113
|
-
});
|
|
114
|
-
// Yield update for failed command
|
|
115
|
-
yield {
|
|
116
|
-
name: BatchTool.name,
|
|
117
|
-
event: "tool-update",
|
|
118
|
-
id: toolCallId,
|
|
119
|
-
data: `[${callNumber}/${totalCalls}] ${style.red("✗")} ${style.cyan(toolName)} failed: ${errorMessage.slice(0, 100)}`,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Format results as JSON
|
|
124
|
-
const jsonResults = JSON.stringify(results, null, 2);
|
|
125
|
-
try {
|
|
126
|
-
const result = await manageTokenLimit(jsonResults, tokenCounter, "Batch", "Consider reducing the number of calls or using more specific tool calls");
|
|
127
|
-
// Create a more informative completion message
|
|
128
|
-
const successful = results.filter((r) => r.status === "success").length;
|
|
129
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
130
|
-
let completionMessage = `Batch execution completed: ${successful}/${totalCalls} successful`;
|
|
131
|
-
if (failed > 0) {
|
|
132
|
-
const failedTools = results
|
|
133
|
-
.filter((r) => r.status === "error")
|
|
134
|
-
.map((r) => `${r.tool}${r.id ? ` (${r.id})` : ""}`)
|
|
135
|
-
.join(", ");
|
|
136
|
-
completionMessage += `, ${failed} failed: ${failedTools}`;
|
|
137
|
-
}
|
|
138
|
-
completionMessage += ` (${result.tokenCount} tokens)`;
|
|
139
|
-
yield {
|
|
140
|
-
name: BatchTool.name,
|
|
141
|
-
event: "tool-completion",
|
|
142
|
-
id: toolCallId,
|
|
143
|
-
data: completionMessage,
|
|
144
|
-
};
|
|
145
|
-
yield result.content;
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
if (error instanceof TokenLimitExceededError) {
|
|
149
|
-
yield {
|
|
150
|
-
name: BatchTool.name,
|
|
151
|
-
event: "tool-error",
|
|
152
|
-
id: toolCallId,
|
|
153
|
-
data: error.message,
|
|
154
|
-
};
|
|
155
|
-
yield error.message;
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
throw error;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
163
|
-
logger.error({ error }, "Batch tool failed");
|
|
164
|
-
yield {
|
|
165
|
-
name: BatchTool.name,
|
|
166
|
-
event: "tool-error",
|
|
167
|
-
id: toolCallId,
|
|
168
|
-
data: errorMessage,
|
|
169
|
-
};
|
|
170
|
-
yield errorMessage;
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { TokenCounter } from "../tokens/counter.ts";
|
|
4
|
-
import type { ToolResult } from "./types.ts";
|
|
5
|
-
export declare const CodeInterpreterTool: {
|
|
6
|
-
name: "codeInterpreter";
|
|
7
|
-
};
|
|
8
|
-
declare const inputSchema: z.ZodObject<{
|
|
9
|
-
code: z.ZodString;
|
|
10
|
-
timeoutSeconds: z.ZodNullable<z.ZodNumber>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export declare const createCodeInterpreterTool: ({ tokenCounter, }: {
|
|
13
|
-
tokenCounter: TokenCounter;
|
|
14
|
-
}) => Promise<{
|
|
15
|
-
toolDef: {
|
|
16
|
-
description: string;
|
|
17
|
-
inputSchema: z.ZodObject<{
|
|
18
|
-
code: z.ZodString;
|
|
19
|
-
timeoutSeconds: z.ZodNullable<z.ZodNumber>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
};
|
|
22
|
-
execute: ({ code, timeoutSeconds }: z.infer<typeof inputSchema>, { toolCallId, abortSignal }: ToolCallOptions) => AsyncGenerator<ToolResult>;
|
|
23
|
-
}>;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=code-interpreter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-interpreter.d.ts","sourceRoot":"","sources":["../../source/tools/code-interpreter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,mBAAmB;;CAE/B,CAAC;AAmBF,QAAA,MAAM,WAAW;;;iBASf,CAAC;AAEH,eAAO,MAAM,yBAAyB,GAAU,mBAE7C;IACD,YAAY,EAAE,YAAY,CAAC;CAC5B;;;;;;;;wCAO6B,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,+BACxB,eAAe,KAC3C,cAAc,CAAC,UAAU,CAAC;EAoL9B,CAAC"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import process from "node:process";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { manageTokenLimit, TokenLimitExceededError, } from "../tokens/threshold.js";
|
|
8
|
-
export const CodeInterpreterTool = {
|
|
9
|
-
name: "codeInterpreter",
|
|
10
|
-
};
|
|
11
|
-
const toolDescription = `Executes Typescript code in a separate Node.js process using Node's Permission Model.
|
|
12
|
-
|
|
13
|
-
⚠️ **IMPORTANT**: This tool uses ES Modules (ESM) only.
|
|
14
|
-
- Use \`import\` statements, NOT \`require()\`
|
|
15
|
-
- Examples: \`import fs from 'node:fs'\` NOT \`const fs = require('fs')\`
|
|
16
|
-
- Add file extensions for relative imports: \`import { utils } from './utils.js'\`
|
|
17
|
-
|
|
18
|
-
These scripts are run in the \`${process.cwd()}/.acai-ci-tmp\`. You can import project source files using relative paths from the project root with .ts extensions:
|
|
19
|
-
|
|
20
|
-
\`\`\` typescript
|
|
21
|
-
import { functionName } from '../source/path/to/module.ts';
|
|
22
|
-
\`\`\`
|
|
23
|
-
|
|
24
|
-
The interpreter supports ES Modules with TypeScript files directly.
|
|
25
|
-
|
|
26
|
-
Timeout defaults to 5 seconds and can be extended up to 60 seconds.`;
|
|
27
|
-
const inputSchema = z.object({
|
|
28
|
-
code: z.string().describe("The Typescript code to be executed."),
|
|
29
|
-
timeoutSeconds: z
|
|
30
|
-
.number()
|
|
31
|
-
.int()
|
|
32
|
-
.min(1)
|
|
33
|
-
.max(60)
|
|
34
|
-
.nullable()
|
|
35
|
-
.describe("Execution timeout in seconds (1-60). Default 5."),
|
|
36
|
-
});
|
|
37
|
-
export const createCodeInterpreterTool = async ({ tokenCounter, }) => {
|
|
38
|
-
const toolDef = {
|
|
39
|
-
description: toolDescription,
|
|
40
|
-
inputSchema,
|
|
41
|
-
};
|
|
42
|
-
async function* execute({ code, timeoutSeconds }, { toolCallId, abortSignal }) {
|
|
43
|
-
// Check if execution has been aborted
|
|
44
|
-
if (abortSignal?.aborted) {
|
|
45
|
-
throw new Error("Code interpretation aborted");
|
|
46
|
-
}
|
|
47
|
-
const workingDirectory = process.cwd();
|
|
48
|
-
const lines = code.split("\n");
|
|
49
|
-
try {
|
|
50
|
-
yield {
|
|
51
|
-
name: CodeInterpreterTool.name,
|
|
52
|
-
event: "tool-init",
|
|
53
|
-
id: toolCallId,
|
|
54
|
-
data: `Executing ${lines.length} lines of code.`,
|
|
55
|
-
};
|
|
56
|
-
if (code.trim().length === 0) {
|
|
57
|
-
throw new Error("No code provided");
|
|
58
|
-
}
|
|
59
|
-
if (abortSignal?.aborted) {
|
|
60
|
-
throw new Error("Code interpretation aborted before execution");
|
|
61
|
-
}
|
|
62
|
-
const timeoutMs = Math.min(Math.max((timeoutSeconds ?? 5) * 1000, 1000), 60000);
|
|
63
|
-
const tmpBase = join(workingDirectory, ".acai-ci-tmp");
|
|
64
|
-
await mkdir(tmpBase, { recursive: true });
|
|
65
|
-
const ext = ".ts";
|
|
66
|
-
const scriptPath = join(tmpBase, `temp_script_${Date.now()}_${randomUUID()}${ext}`);
|
|
67
|
-
await writeFile(scriptPath, code, { encoding: "utf8" });
|
|
68
|
-
const args = [
|
|
69
|
-
"--permission",
|
|
70
|
-
`--allow-fs-read=${workingDirectory}`,
|
|
71
|
-
`--allow-fs-write=${workingDirectory}`,
|
|
72
|
-
"--allow-net",
|
|
73
|
-
scriptPath,
|
|
74
|
-
];
|
|
75
|
-
const child = spawn(process.execPath, args, {
|
|
76
|
-
cwd: workingDirectory,
|
|
77
|
-
// do not rely solely on spawn's timeout; we implement manual timeout below
|
|
78
|
-
stdio: "pipe",
|
|
79
|
-
env: Object.assign({}, process.env, {
|
|
80
|
-
// biome-ignore lint/style/useNamingConvention: Environment variable keys are uppercase by convention
|
|
81
|
-
NO_COLOR: "true",
|
|
82
|
-
// biome-ignore lint/style/useNamingConvention: Environment variable keys are uppercase by convention
|
|
83
|
-
NODE_OPTIONS: "",
|
|
84
|
-
// biome-ignore lint/style/useNamingConvention: Environment variable keys are uppercase by convention
|
|
85
|
-
ACAI_CODE_INTERPRETER: "true",
|
|
86
|
-
}),
|
|
87
|
-
});
|
|
88
|
-
// Handle abort signal by killing the child process
|
|
89
|
-
if (abortSignal) {
|
|
90
|
-
const abortHandler = () => {
|
|
91
|
-
try {
|
|
92
|
-
child.kill("SIGKILL");
|
|
93
|
-
}
|
|
94
|
-
catch { }
|
|
95
|
-
throw new Error("Code interpretation aborted during execution");
|
|
96
|
-
};
|
|
97
|
-
abortSignal.addEventListener("abort", abortHandler);
|
|
98
|
-
}
|
|
99
|
-
let stdout = "";
|
|
100
|
-
let stderr = "";
|
|
101
|
-
let timedOut = false;
|
|
102
|
-
const timer = setTimeout(() => {
|
|
103
|
-
timedOut = true;
|
|
104
|
-
try {
|
|
105
|
-
child.kill("SIGKILL");
|
|
106
|
-
}
|
|
107
|
-
catch { }
|
|
108
|
-
}, timeoutMs);
|
|
109
|
-
child.stdout.setEncoding("utf8");
|
|
110
|
-
child.stderr.setEncoding("utf8");
|
|
111
|
-
child.stdout.on("data", (chunk) => {
|
|
112
|
-
stdout += String(chunk);
|
|
113
|
-
});
|
|
114
|
-
child.stderr.on("data", (chunk) => {
|
|
115
|
-
stderr += String(chunk);
|
|
116
|
-
});
|
|
117
|
-
const completed = await new Promise((resolve, reject) => {
|
|
118
|
-
child.on("error", (err) => reject(err));
|
|
119
|
-
child.on("close", (code, signal) => resolve({ code, signal }));
|
|
120
|
-
});
|
|
121
|
-
clearTimeout(timer);
|
|
122
|
-
// Cleanup temp file/directory
|
|
123
|
-
await rm(scriptPath, { force: true });
|
|
124
|
-
await rm(tmpBase, { force: true, recursive: true });
|
|
125
|
-
if (timedOut) {
|
|
126
|
-
throw new Error("Script timed out");
|
|
127
|
-
}
|
|
128
|
-
if (completed.code === null) {
|
|
129
|
-
throw new Error(`Process terminated by signal ${completed.signal ?? "unknown"}`);
|
|
130
|
-
}
|
|
131
|
-
if (completed.code !== 0) {
|
|
132
|
-
const message = `Process exited with code ${completed.code}. Stderr:\n${stderr.trim()}`;
|
|
133
|
-
throw new Error(message);
|
|
134
|
-
}
|
|
135
|
-
const result = {
|
|
136
|
-
stdout: stdout.trim(),
|
|
137
|
-
stderr: stderr.trim(),
|
|
138
|
-
exitCode: completed.code ?? -1,
|
|
139
|
-
};
|
|
140
|
-
const resultJson = JSON.stringify(result, null, 2);
|
|
141
|
-
try {
|
|
142
|
-
const managedResult = await manageTokenLimit(resultJson, tokenCounter, "CodeInterpreter", "Reduce script complexity or output size");
|
|
143
|
-
yield {
|
|
144
|
-
name: CodeInterpreterTool.name,
|
|
145
|
-
event: "tool-completion",
|
|
146
|
-
id: toolCallId,
|
|
147
|
-
data: `Completed successfully${managedResult.tokenCount > 0 ? ` (${managedResult.tokenCount} tokens)` : ""}`,
|
|
148
|
-
};
|
|
149
|
-
yield managedResult.content;
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
if (error instanceof TokenLimitExceededError) {
|
|
153
|
-
yield {
|
|
154
|
-
name: CodeInterpreterTool.name,
|
|
155
|
-
event: "tool-error",
|
|
156
|
-
id: toolCallId,
|
|
157
|
-
data: error.message,
|
|
158
|
-
};
|
|
159
|
-
yield error.message;
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
catch (err) {
|
|
166
|
-
const errorMessage = err.name === "ETIMEDOUT" ||
|
|
167
|
-
err.message.includes("timed out")
|
|
168
|
-
? "Script timed out"
|
|
169
|
-
: err.message;
|
|
170
|
-
yield {
|
|
171
|
-
name: CodeInterpreterTool.name,
|
|
172
|
-
event: "tool-error",
|
|
173
|
-
id: toolCallId,
|
|
174
|
-
data: errorMessage,
|
|
175
|
-
};
|
|
176
|
-
yield errorMessage;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
toolDef,
|
|
181
|
-
execute,
|
|
182
|
-
};
|
|
183
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ToolCallOptions } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { ToolResult } from "./types.ts";
|
|
4
|
-
export declare const DeleteFileTool: {
|
|
5
|
-
name: "deleteFile";
|
|
6
|
-
};
|
|
7
|
-
declare const inputSchema: z.ZodObject<{
|
|
8
|
-
path: z.ZodString;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
type DeleteFileInputSchema = z.infer<typeof inputSchema>;
|
|
11
|
-
export declare const createDeleteFileTool: ({ workingDir, allowedDirs, }: {
|
|
12
|
-
workingDir: string;
|
|
13
|
-
allowedDirs?: string[];
|
|
14
|
-
}) => Promise<{
|
|
15
|
-
toolDef: {
|
|
16
|
-
description: string;
|
|
17
|
-
inputSchema: z.ZodObject<{
|
|
18
|
-
path: z.ZodString;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
};
|
|
21
|
-
execute({ path: userPath }: DeleteFileInputSchema, { toolCallId, abortSignal }: ToolCallOptions): AsyncGenerator<ToolResult>;
|
|
22
|
-
}>;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=delete-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../source/tools/delete-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAEF,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAEH,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD,eAAO,MAAM,oBAAoB,GAAU,8BAGxC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;gCAUyB,qBAAqB,+BACZ,eAAe,GAC3C,cAAc,CAAC,UAAU,CAAC;EAmEhC,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { config } from "../config.js";
|
|
5
|
-
import { clearProjectStatusCache } from "../repl/project-status-line.js";
|
|
6
|
-
import style from "../terminal/style.js";
|
|
7
|
-
import { joinWorkingDir, validateFileNotReadOnly, validatePath, } from "../utils/filesystem/security.js";
|
|
8
|
-
export const DeleteFileTool = {
|
|
9
|
-
name: "deleteFile",
|
|
10
|
-
};
|
|
11
|
-
const inputSchema = z.object({
|
|
12
|
-
path: z.string().describe("Absolute path to the file to delete"),
|
|
13
|
-
});
|
|
14
|
-
export const createDeleteFileTool = async ({ workingDir, allowedDirs, }) => {
|
|
15
|
-
const allowedDirectory = allowedDirs ?? [workingDir];
|
|
16
|
-
return {
|
|
17
|
-
toolDef: {
|
|
18
|
-
description: "Delete a file permanently. Only deletes files within allowed directories.",
|
|
19
|
-
inputSchema,
|
|
20
|
-
},
|
|
21
|
-
async *execute({ path: userPath }, { toolCallId, abortSignal }) {
|
|
22
|
-
try {
|
|
23
|
-
if (abortSignal?.aborted) {
|
|
24
|
-
throw new Error("File deletion aborted");
|
|
25
|
-
}
|
|
26
|
-
yield {
|
|
27
|
-
name: DeleteFileTool.name,
|
|
28
|
-
id: toolCallId,
|
|
29
|
-
event: "tool-init",
|
|
30
|
-
data: `${style.cyan(userPath)}`,
|
|
31
|
-
};
|
|
32
|
-
const filePath = await validatePath(joinWorkingDir(userPath, workingDir), allowedDirectory, { abortSignal });
|
|
33
|
-
// Check if file is read-only
|
|
34
|
-
const projectConfig = await config.getConfig();
|
|
35
|
-
validateFileNotReadOnly(filePath, projectConfig, workingDir);
|
|
36
|
-
// Check if file exists before attempting delete
|
|
37
|
-
if (!existsSync(filePath)) {
|
|
38
|
-
throw new Error(`File not found: ${filePath}`);
|
|
39
|
-
}
|
|
40
|
-
// Pre-check for stat
|
|
41
|
-
if (abortSignal?.aborted) {
|
|
42
|
-
throw new Error("File deletion aborted before stat");
|
|
43
|
-
}
|
|
44
|
-
// Ensure it's a file, not a directory
|
|
45
|
-
const stats = await fs.stat(filePath);
|
|
46
|
-
if (stats.isDirectory()) {
|
|
47
|
-
throw new Error(`Path is a directory, not a file: ${filePath}`);
|
|
48
|
-
}
|
|
49
|
-
// Pre-side-effect check
|
|
50
|
-
if (abortSignal?.aborted) {
|
|
51
|
-
throw new Error("File deletion aborted before unlink");
|
|
52
|
-
}
|
|
53
|
-
// Delete the file with signal
|
|
54
|
-
await fs.unlink(filePath);
|
|
55
|
-
yield {
|
|
56
|
-
name: DeleteFileTool.name,
|
|
57
|
-
id: toolCallId,
|
|
58
|
-
event: "tool-completion",
|
|
59
|
-
data: "File deleted",
|
|
60
|
-
};
|
|
61
|
-
// Clear project status cache since file operations change git status
|
|
62
|
-
clearProjectStatusCache();
|
|
63
|
-
yield `Successfully deleted ${filePath}`;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const errorMessage = error.message;
|
|
67
|
-
yield {
|
|
68
|
-
name: DeleteFileTool.name,
|
|
69
|
-
id: toolCallId,
|
|
70
|
-
event: "tool-error",
|
|
71
|
-
data: errorMessage,
|
|
72
|
-
};
|
|
73
|
-
yield errorMessage;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const toolMetadataSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
description: z.ZodString;
|
|
5
|
-
parameters: z.ZodArray<z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
type: z.ZodEnum<{
|
|
8
|
-
string: "string";
|
|
9
|
-
number: "number";
|
|
10
|
-
boolean: "boolean";
|
|
11
|
-
}>;
|
|
12
|
-
description: z.ZodString;
|
|
13
|
-
required: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
-
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
needsApproval: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export type ToolMetadata = z.infer<typeof toolMetadataSchema>;
|
|
19
|
-
export declare function parseToolMetadata(output: string): ToolMetadata;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=dynamic-tool-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-tool-parser.d.ts","sourceRoot":"","sources":["../../source/tools/dynamic-tool-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;iBAatB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS9D"}
|