@travisennis/acai 0.0.8 → 0.0.10
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 +48 -729
- package/bin/acai +52 -0
- package/dist/agent/index.d.ts +12 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +378 -168
- package/dist/agent/sub-agent.d.ts +23 -0
- package/dist/agent/sub-agent.d.ts.map +1 -0
- package/dist/agent/sub-agent.js +109 -0
- package/dist/cli/index.d.ts +26 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/{cli.js → cli/index.js} +84 -76
- package/dist/cli/stdin.d.ts +9 -0
- package/dist/cli/stdin.d.ts.map +1 -0
- package/dist/cli/stdin.js +37 -0
- package/dist/commands/copy/index.js +2 -2
- package/dist/commands/copy/utils.d.ts.map +1 -1
- package/dist/commands/copy/utils.js +15 -13
- package/dist/commands/generate-rules/index.d.ts +1 -1
- package/dist/commands/generate-rules/index.d.ts.map +1 -1
- package/dist/commands/generate-rules/index.js +16 -100
- package/dist/commands/generate-rules/service.d.ts +21 -0
- package/dist/commands/generate-rules/service.d.ts.map +1 -0
- package/dist/commands/generate-rules/service.js +103 -0
- package/dist/commands/handoff/index.js +2 -2
- package/dist/commands/health/index.js +1 -1
- package/dist/commands/health/utils.d.ts.map +1 -1
- package/dist/commands/health/utils.js +6 -0
- package/dist/commands/history/index.d.ts +1 -1
- package/dist/commands/history/index.d.ts.map +1 -1
- package/dist/commands/history/index.js +17 -18
- package/dist/commands/history/types.d.ts +38 -0
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/history/utils.d.ts.map +1 -1
- package/dist/commands/history/utils.js +63 -58
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +3 -8
- package/dist/commands/init-project/index.d.ts.map +1 -1
- package/dist/commands/init-project/index.js +3 -3
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +10 -2
- package/dist/commands/list-tools/index.d.ts.map +1 -1
- package/dist/commands/list-tools/index.js +7 -31
- package/dist/commands/manager.d.ts +2 -2
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +57 -33
- package/dist/commands/model/index.d.ts.map +1 -1
- package/dist/commands/model/index.js +20 -151
- package/dist/commands/model/model-panel.d.ts +4 -0
- package/dist/commands/model/model-panel.d.ts.map +1 -0
- package/dist/commands/model/model-panel.js +144 -0
- package/dist/commands/paste/index.d.ts.map +1 -1
- package/dist/commands/paste/index.js +59 -62
- package/dist/commands/paste/utils.d.ts.map +1 -1
- package/dist/commands/paste/utils.js +88 -58
- package/dist/commands/pickup/index.d.ts.map +1 -1
- package/dist/commands/pickup/index.js +6 -3
- package/dist/commands/pickup/utils.js +3 -3
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +33 -50
- package/dist/commands/review/index.d.ts.map +1 -1
- package/dist/commands/review/index.js +3 -117
- package/dist/commands/review/review-panel.d.ts +3 -0
- package/dist/commands/review/review-panel.d.ts.map +1 -0
- package/dist/commands/review/review-panel.js +186 -0
- package/dist/commands/review/utils.d.ts +9 -0
- package/dist/commands/review/utils.d.ts.map +1 -1
- package/dist/commands/review/utils.js +127 -68
- package/dist/commands/session/index.d.ts +1 -1
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +134 -112
- package/dist/commands/session/types.d.ts +7 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/commands/shell/index.js +16 -1
- package/dist/commands/types.d.ts +2 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/{config.d.ts → config/index.d.ts} +20 -9
- package/dist/config/index.d.ts.map +1 -0
- package/dist/{config.js → config/index.js} +43 -42
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +75 -55
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +170 -127
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +18 -36
- package/dist/models/ai-config.d.ts +1 -0
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +4 -3
- package/dist/models/anthropic-provider.d.ts +2 -5
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +3 -70
- package/dist/models/deepseek-provider.d.ts +1 -0
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/google-provider.d.ts +2 -3
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -26
- package/dist/models/groq-provider.d.ts +1 -0
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/manager.d.ts +13 -2
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +20 -8
- package/dist/models/openai-provider.d.ts +5 -5
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +27 -40
- package/dist/models/opencode-zen-provider.d.ts +8 -3
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +68 -11
- package/dist/models/openrouter-provider.d.ts +24 -30
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +92 -177
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/xai-provider.d.ts +4 -3
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +18 -18
- package/dist/modes/manager.d.ts +23 -0
- package/dist/modes/manager.d.ts.map +1 -0
- package/dist/modes/manager.js +77 -0
- package/dist/modes/prompts.d.ts +2 -0
- package/dist/modes/prompts.d.ts.map +1 -0
- package/dist/modes/prompts.js +143 -0
- package/dist/prompts/mentions.d.ts +11 -0
- package/dist/prompts/mentions.d.ts.map +1 -0
- package/dist/{mentions.js → prompts/mentions.js} +21 -80
- package/dist/prompts/system-prompt.d.ts +26 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -0
- package/dist/{prompts.js → prompts/system-prompt.js} +50 -22
- package/dist/repl/index.d.ts +174 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/{repl-new.js → repl/index.js} +399 -76
- package/dist/repl/project-status.d.ts +1 -0
- package/dist/repl/project-status.d.ts.map +1 -1
- package/dist/repl/project-status.js +4 -1
- package/dist/sessions/manager.d.ts +93 -1
- package/dist/sessions/manager.d.ts.map +1 -1
- package/dist/sessions/manager.js +264 -9
- package/dist/sessions/summary.d.ts +4 -0
- package/dist/sessions/summary.d.ts.map +1 -0
- package/dist/sessions/summary.js +30 -0
- package/dist/{skills.d.ts → skills/index.d.ts} +14 -2
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +294 -0
- package/dist/subagents/index.d.ts +15 -0
- package/dist/subagents/index.d.ts.map +1 -0
- package/dist/subagents/index.js +231 -0
- package/dist/terminal/control.d.ts +1 -1
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +30 -9
- package/dist/terminal/east-asian-width.d.ts.map +1 -1
- package/dist/terminal/east-asian-width.js +404 -351
- package/dist/terminal/keys.d.ts +17 -0
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +37 -0
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +24 -12
- package/dist/terminal/string-width.d.ts.map +1 -1
- package/dist/terminal/string-width.js +25 -27
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/style.js +4 -7
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +41 -27
- package/dist/terminal/table/cell.d.ts +12 -0
- package/dist/terminal/table/cell.d.ts.map +1 -1
- package/dist/terminal/table/cell.js +40 -25
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +100 -68
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +17 -10
- package/dist/terminal/wrap-ansi.d.ts.map +1 -1
- package/dist/terminal/wrap-ansi.js +172 -103
- package/dist/tokens/tracker.d.ts +1 -0
- package/dist/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +3 -0
- package/dist/tools/agent.d.ts +27 -0
- package/dist/tools/agent.d.ts.map +1 -0
- package/dist/tools/agent.js +81 -0
- package/dist/tools/bash.d.ts +4 -3
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +343 -121
- package/dist/tools/code-search.d.ts +41 -0
- package/dist/tools/code-search.d.ts.map +1 -0
- package/dist/tools/code-search.js +195 -0
- package/dist/tools/directory-tree.d.ts +3 -3
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +8 -5
- package/dist/tools/dynamic-tool-loader.d.ts +2 -5
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +20 -4
- package/dist/tools/edit-file.d.ts +7 -7
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +164 -66
- package/dist/tools/glob.d.ts +6 -6
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +95 -55
- package/dist/tools/grep.d.ts +15 -12
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +300 -192
- package/dist/tools/index.d.ts +143 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +39 -24
- package/dist/tools/ls.d.ts +2 -2
- package/dist/tools/ls.d.ts.map +1 -1
- package/dist/tools/ls.js +7 -5
- package/dist/tools/read-file.d.ts +3 -3
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +74 -34
- package/dist/tools/save-file.d.ts +3 -3
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +11 -11
- package/dist/tools/skill.d.ts +23 -0
- package/dist/tools/skill.d.ts.map +1 -0
- package/dist/tools/skill.js +65 -0
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +2 -9
- package/dist/tools/utils.d.ts +2 -0
- package/dist/tools/utils.d.ts.map +1 -1
- package/dist/tools/utils.js +12 -0
- package/dist/tools/web-fetch.d.ts +62 -0
- package/dist/tools/web-fetch.d.ts.map +1 -0
- package/dist/tools/web-fetch.js +429 -0
- package/dist/tools/web-search.d.ts +62 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +226 -0
- package/dist/tui/autocomplete/attachment-provider.d.ts +3 -6
- package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -1
- package/dist/tui/autocomplete/attachment-provider.js +25 -78
- package/dist/tui/autocomplete/base-provider.d.ts +1 -0
- package/dist/tui/autocomplete/base-provider.d.ts.map +1 -1
- package/dist/tui/autocomplete/combined-provider.d.ts +1 -4
- package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -1
- package/dist/tui/autocomplete/combined-provider.js +3 -17
- package/dist/tui/autocomplete/command-provider.d.ts +1 -0
- package/dist/tui/autocomplete/command-provider.d.ts.map +1 -1
- package/dist/tui/autocomplete/command-provider.js +3 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts +2 -1
- package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -1
- package/dist/tui/autocomplete/file-search-provider.js +36 -16
- package/dist/tui/autocomplete/skill-provider.d.ts +17 -0
- package/dist/tui/autocomplete/skill-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/skill-provider.js +49 -0
- package/dist/tui/autocomplete.d.ts +2 -2
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +3 -5
- package/dist/tui/components/assistant-message.d.ts.map +1 -1
- package/dist/tui/components/assistant-message.js +0 -4
- package/dist/tui/components/editor.d.ts +21 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +228 -236
- package/dist/tui/components/footer.d.ts +6 -4
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +49 -25
- package/dist/tui/components/markdown.d.ts +8 -5
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +57 -39
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +35 -33
- package/dist/tui/components/notification.d.ts +13 -2
- package/dist/tui/components/notification.d.ts.map +1 -1
- package/dist/tui/components/notification.js +37 -2
- package/dist/tui/components/progress-bar.js +1 -1
- package/dist/tui/components/select-list.d.ts +1 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +14 -11
- package/dist/tui/components/text.d.ts +16 -0
- package/dist/tui/components/text.d.ts.map +1 -1
- package/dist/tui/components/text.js +72 -57
- package/dist/tui/components/thinking-block.d.ts +9 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +43 -11
- package/dist/tui/components/tool-execution.d.ts +5 -1
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +19 -10
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +0 -3
- package/dist/tui/components/welcome.js +2 -2
- 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 +3 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +1 -0
- package/dist/tui/terminal.d.ts +27 -0
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +144 -15
- package/dist/tui/tui.d.ts +43 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +172 -41
- package/dist/utils/bash/parse.d.ts +19 -0
- package/dist/utils/bash/parse.d.ts.map +1 -0
- package/dist/utils/bash/parse.js +223 -0
- package/dist/utils/bash/quote.d.ts +6 -0
- package/dist/utils/bash/quote.d.ts.map +1 -0
- package/dist/utils/bash/quote.js +23 -0
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +211 -126
- package/dist/utils/command-protection.d.ts +28 -0
- package/dist/utils/command-protection.d.ts.map +1 -0
- package/dist/utils/command-protection.js +324 -0
- package/dist/utils/dedent.d.ts.map +1 -0
- package/dist/utils/env-expand.d.ts +2 -0
- package/dist/utils/env-expand.d.ts.map +1 -0
- package/dist/utils/env-expand.js +8 -0
- package/dist/utils/filesystem/path-display.d.ts +11 -0
- package/dist/utils/filesystem/path-display.d.ts.map +1 -0
- package/dist/utils/filesystem/path-display.js +32 -0
- package/dist/utils/filesystem/security.d.ts +2 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +32 -31
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/{formatting.js → utils/formatting.js} +1 -1
- package/dist/utils/git.d.ts +4 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +30 -0
- package/dist/utils/glob.d.ts +1 -1
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/{logger.js → utils/logger.js} +1 -1
- package/dist/utils/parsing.d.ts.map +1 -0
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +90 -37
- package/dist/utils/templates.d.ts +2 -0
- package/dist/utils/templates.d.ts.map +1 -0
- package/dist/utils/templates.js +24 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/{version.js → utils/version.js} +1 -1
- package/package.json +34 -25
- package/dist/cli.d.ts +0 -23
- package/dist/cli.d.ts.map +0 -1
- package/dist/commands/exit/index.d.ts +0 -10
- package/dist/commands/exit/index.d.ts.map +0 -1
- package/dist/commands/exit/index.js +0 -21
- package/dist/commands/exit/types.d.ts +0 -8
- package/dist/commands/exit/types.d.ts.map +0 -1
- package/dist/commands/exit/types.js +0 -1
- package/dist/commands/exit/utils.d.ts +0 -2
- package/dist/commands/exit/utils.d.ts.map +0 -1
- package/dist/commands/exit/utils.js +0 -13
- package/dist/commands/prompt/index.d.ts +0 -5
- package/dist/commands/prompt/index.d.ts.map +0 -1
- package/dist/commands/prompt/index.js +0 -126
- package/dist/commands/prompt/types.d.ts +0 -15
- package/dist/commands/prompt/types.d.ts.map +0 -1
- package/dist/commands/prompt/types.js +0 -1
- package/dist/commands/prompt/utils.d.ts +0 -12
- package/dist/commands/prompt/utils.d.ts.map +0 -1
- package/dist/commands/prompt/utils.js +0 -107
- package/dist/commands/reset/index.d.ts +0 -3
- package/dist/commands/reset/index.d.ts.map +0 -1
- package/dist/commands/reset/index.js +0 -25
- package/dist/commands/reset/types.d.ts +0 -1
- package/dist/commands/reset/types.d.ts.map +0 -1
- package/dist/commands/reset/types.js +0 -3
- package/dist/commands/save/index.d.ts +0 -3
- package/dist/commands/save/index.d.ts.map +0 -1
- package/dist/commands/save/index.js +0 -19
- package/dist/config.d.ts.map +0 -1
- package/dist/dedent.d.ts.map +0 -1
- package/dist/formatting.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/mentions.d.ts +0 -14
- package/dist/mentions.d.ts.map +0 -1
- package/dist/parsing.d.ts.map +0 -1
- package/dist/prompts.d.ts +0 -10
- package/dist/prompts.d.ts.map +0 -1
- package/dist/repl-new.d.ts +0 -62
- package/dist/repl-new.d.ts.map +0 -1
- package/dist/skills.d.ts.map +0 -1
- package/dist/skills.js +0 -233
- package/dist/tui/autocomplete/path-provider.d.ts +0 -21
- package/dist/tui/autocomplete/path-provider.d.ts.map +0 -1
- package/dist/tui/autocomplete/path-provider.js +0 -164
- package/dist/version.d.ts.map +0 -1
- /package/dist/{dedent.d.ts → utils/dedent.d.ts} +0 -0
- /package/dist/{dedent.js → utils/dedent.js} +0 -0
- /package/dist/{formatting.d.ts → utils/formatting.d.ts} +0 -0
- /package/dist/{logger.d.ts → utils/logger.d.ts} +0 -0
- /package/dist/{parsing.d.ts → utils/parsing.d.ts} +0 -0
- /package/dist/{parsing.js → utils/parsing.js} +0 -0
- /package/dist/{version.d.ts → utils/version.d.ts} +0 -0
package/dist/tools/index.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export declare function initTools({ workspace, }: {
|
|
|
16
16
|
description: string;
|
|
17
17
|
inputSchema: import("zod").ZodObject<{
|
|
18
18
|
path: import("zod").ZodString;
|
|
19
|
-
edits: import("zod").ZodArray<import("zod").ZodObject<{
|
|
19
|
+
edits: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodArray<import("zod").ZodObject<{
|
|
20
20
|
oldText: import("zod").ZodString;
|
|
21
21
|
newText: import("zod").ZodString;
|
|
22
|
-
}, import("zod/v4/core").$strip
|
|
22
|
+
}, import("zod/v4/core").$strip>>>;
|
|
23
23
|
}, import("zod/v4/core").$strip>;
|
|
24
24
|
};
|
|
25
25
|
display({ path, edits }: {
|
|
@@ -134,12 +134,12 @@ export declare function initTools({ workspace, }: {
|
|
|
134
134
|
toolDef: {
|
|
135
135
|
description: string;
|
|
136
136
|
inputSchema: import("zod").ZodObject<{
|
|
137
|
-
patterns: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]
|
|
138
|
-
path: import("zod").ZodString
|
|
137
|
+
patterns: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
138
|
+
path: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodString>;
|
|
139
139
|
gitignore: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
140
140
|
recursive: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
141
141
|
expandDirectories: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
142
|
-
ignoreFiles: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]
|
|
142
|
+
ignoreFiles: import("zod").ZodPipe<import("zod").ZodTransform<{} | null | undefined, unknown>, import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>>;
|
|
143
143
|
cwd: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedString<unknown>>>;
|
|
144
144
|
maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
145
145
|
}, import("zod/v4/core").$strip>;
|
|
@@ -203,6 +203,50 @@ export declare function initTools({ workspace, }: {
|
|
|
203
203
|
maxResults: number | null;
|
|
204
204
|
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
205
205
|
};
|
|
206
|
+
readonly CodeSearch: {
|
|
207
|
+
toolDef: {
|
|
208
|
+
description: string;
|
|
209
|
+
inputSchema: import("zod").ZodObject<{
|
|
210
|
+
query: import("zod").ZodString;
|
|
211
|
+
path: import("zod").ZodDefault<import("zod").ZodString>;
|
|
212
|
+
regexPattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
|
|
213
|
+
filePattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
|
|
214
|
+
excludePattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
|
|
215
|
+
excludeDir: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
|
|
216
|
+
maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
217
|
+
contextLines: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
218
|
+
filesOnly: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
219
|
+
showContent: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
220
|
+
codeOnly: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
221
|
+
}, import("zod/v4/core").$strip>;
|
|
222
|
+
};
|
|
223
|
+
display({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: {
|
|
224
|
+
query: string;
|
|
225
|
+
path: string;
|
|
226
|
+
regexPattern: string | null;
|
|
227
|
+
filePattern: string | null;
|
|
228
|
+
excludePattern: string | null;
|
|
229
|
+
excludeDir: string | null;
|
|
230
|
+
maxResults: number | null;
|
|
231
|
+
contextLines: number | null;
|
|
232
|
+
filesOnly: boolean | null;
|
|
233
|
+
showContent: boolean | null;
|
|
234
|
+
codeOnly: boolean | null;
|
|
235
|
+
}): string;
|
|
236
|
+
execute({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: {
|
|
237
|
+
query: string;
|
|
238
|
+
path: string;
|
|
239
|
+
regexPattern: string | null;
|
|
240
|
+
filePattern: string | null;
|
|
241
|
+
excludePattern: string | null;
|
|
242
|
+
excludeDir: string | null;
|
|
243
|
+
maxResults: number | null;
|
|
244
|
+
contextLines: number | null;
|
|
245
|
+
filesOnly: boolean | null;
|
|
246
|
+
showContent: boolean | null;
|
|
247
|
+
codeOnly: boolean | null;
|
|
248
|
+
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
249
|
+
};
|
|
206
250
|
readonly DirectoryTree: {
|
|
207
251
|
toolDef: {
|
|
208
252
|
description: string;
|
|
@@ -252,5 +296,99 @@ export declare function initTools({ workspace, }: {
|
|
|
252
296
|
path?: string | undefined;
|
|
253
297
|
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
254
298
|
};
|
|
299
|
+
readonly Skill: {
|
|
300
|
+
toolDef: {
|
|
301
|
+
description: string;
|
|
302
|
+
inputSchema: import("zod").ZodObject<{
|
|
303
|
+
skill: import("zod").ZodString;
|
|
304
|
+
args: import("zod").ZodOptional<import("zod").ZodString>;
|
|
305
|
+
}, import("zod/v4/core").$strip>;
|
|
306
|
+
};
|
|
307
|
+
display({ skill: skillName }: {
|
|
308
|
+
skill: string;
|
|
309
|
+
args?: string | undefined;
|
|
310
|
+
}): string;
|
|
311
|
+
execute({ skill: skillName, args }: {
|
|
312
|
+
skill: string;
|
|
313
|
+
args?: string | undefined;
|
|
314
|
+
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
315
|
+
};
|
|
316
|
+
readonly Agent: {
|
|
317
|
+
toolDef: {
|
|
318
|
+
description: string;
|
|
319
|
+
inputSchema: import("zod").ZodObject<{
|
|
320
|
+
prompt: import("zod").ZodString;
|
|
321
|
+
type: import("zod").ZodString;
|
|
322
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
323
|
+
}, import("zod/v4/core").$strip>;
|
|
324
|
+
};
|
|
325
|
+
display: ({ prompt, type }: import("zod").infer<import("zod").ZodObject<{
|
|
326
|
+
prompt: import("zod").ZodString;
|
|
327
|
+
type: import("zod").ZodString;
|
|
328
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
329
|
+
}, import("zod/v4/core").$strip>>) => string;
|
|
330
|
+
execute: ({ prompt, type, timeout }: import("zod").infer<import("zod").ZodObject<{
|
|
331
|
+
prompt: import("zod").ZodString;
|
|
332
|
+
type: import("zod").ZodString;
|
|
333
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
334
|
+
}, import("zod/v4/core").$strip>>, { abortSignal }: import("./types.ts").ToolExecutionOptions) => Promise<string>;
|
|
335
|
+
};
|
|
336
|
+
readonly WebSearch: {
|
|
337
|
+
toolDef: {
|
|
338
|
+
description: string;
|
|
339
|
+
inputSchema: import("zod").ZodObject<{
|
|
340
|
+
query: import("zod").ZodString;
|
|
341
|
+
numResults: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
342
|
+
timeout: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
343
|
+
provider: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
344
|
+
exa: "exa";
|
|
345
|
+
duckduckgo: "duckduckgo";
|
|
346
|
+
}>>;
|
|
347
|
+
}, import("zod/v4/core").$strip>;
|
|
348
|
+
};
|
|
349
|
+
display({ query }: {
|
|
350
|
+
query: string;
|
|
351
|
+
numResults?: number | null | undefined;
|
|
352
|
+
timeout?: number | null | undefined;
|
|
353
|
+
provider?: "exa" | "duckduckgo" | undefined;
|
|
354
|
+
}): string;
|
|
355
|
+
execute(options: {
|
|
356
|
+
query: string;
|
|
357
|
+
numResults?: number | null | undefined;
|
|
358
|
+
timeout?: number | null | undefined;
|
|
359
|
+
provider?: "exa" | "duckduckgo" | undefined;
|
|
360
|
+
}, executionOptions: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
361
|
+
};
|
|
362
|
+
readonly WebFetch: {
|
|
363
|
+
toolDef: {
|
|
364
|
+
description: string;
|
|
365
|
+
inputSchema: import("zod").ZodObject<{
|
|
366
|
+
url: import("zod").ZodString;
|
|
367
|
+
output: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
368
|
+
markdown: "markdown";
|
|
369
|
+
text: "text";
|
|
370
|
+
html: "html";
|
|
371
|
+
json: "json";
|
|
372
|
+
}>>;
|
|
373
|
+
jina: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
|
|
374
|
+
timeout: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
375
|
+
headers: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
|
|
376
|
+
}, import("zod/v4/core").$strip>;
|
|
377
|
+
};
|
|
378
|
+
display({ url }: {
|
|
379
|
+
url: string;
|
|
380
|
+
output: "markdown" | "text" | "html" | "json";
|
|
381
|
+
jina?: boolean | null | undefined;
|
|
382
|
+
timeout?: number | null | undefined;
|
|
383
|
+
headers?: boolean | null | undefined;
|
|
384
|
+
}): string;
|
|
385
|
+
execute(options: {
|
|
386
|
+
url: string;
|
|
387
|
+
output: "markdown" | "text" | "html" | "json";
|
|
388
|
+
jina?: boolean | null | undefined;
|
|
389
|
+
timeout?: number | null | undefined;
|
|
390
|
+
headers?: boolean | null | undefined;
|
|
391
|
+
}, executionOptions: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
392
|
+
};
|
|
255
393
|
}>;
|
|
256
394
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoBpD,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,eAAe,CACvE,OAAO,SAAS,CACjB,CAAC,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,IAAI,CAC5D,OAAO,EACP,MAAM,CACP;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC;AAEtD,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EA"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { config } from "../config/index.js";
|
|
2
|
+
import { AgentTool, createAgentTools } from "./agent.js";
|
|
1
3
|
import { BashTool, createBashTool } from "./bash.js";
|
|
4
|
+
import { CodeSearchTool, createCodeSearchTool } from "./code-search.js";
|
|
2
5
|
import { createDirectoryTreeTool, DirectoryTreeTool, } from "./directory-tree.js";
|
|
3
6
|
import { loadDynamicTools } from "./dynamic-tool-loader.js";
|
|
4
7
|
import { createEditFileTool, EditFileTool } from "./edit-file.js";
|
|
@@ -7,37 +10,44 @@ import { createGrepTool, GrepTool } from "./grep.js";
|
|
|
7
10
|
import { createLsTool, LsTool } from "./ls.js";
|
|
8
11
|
import { createReadFileTool, ReadFileTool } from "./read-file.js";
|
|
9
12
|
import { createSaveFileTool, SaveFileTool } from "./save-file.js";
|
|
13
|
+
import { createSkillTool, SkillTool } from "./skill.js";
|
|
10
14
|
import { createThinkTool, ThinkTool } from "./think.js";
|
|
15
|
+
import { createWebFetchTool, WebFetchTool } from "./web-fetch.js";
|
|
16
|
+
import { createWebSearchTool, WebSearchTool } from "./web-search.js";
|
|
11
17
|
export async function initTools({ workspace, }) {
|
|
12
|
-
const readFileTool = await createReadFileTool({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
const editFileTool = await createEditFileTool({
|
|
17
|
-
workingDir: workspace.primaryDir,
|
|
18
|
-
allowedDirs: workspace.allowedDirs,
|
|
19
|
-
});
|
|
20
|
-
const saveFileTool = await createSaveFileTool({
|
|
21
|
-
workingDir: workspace.primaryDir,
|
|
22
|
-
allowedDirs: workspace.allowedDirs,
|
|
23
|
-
});
|
|
24
|
-
const directoryTreeTool = await createDirectoryTreeTool({
|
|
25
|
-
workingDir: workspace.primaryDir,
|
|
26
|
-
allowedDirs: workspace.allowedDirs,
|
|
27
|
-
});
|
|
18
|
+
const readFileTool = await createReadFileTool({ workspace });
|
|
19
|
+
const editFileTool = await createEditFileTool({ workspace });
|
|
20
|
+
const saveFileTool = await createSaveFileTool({ workspace });
|
|
21
|
+
const directoryTreeTool = await createDirectoryTreeTool({ workspace });
|
|
28
22
|
const globTool = createGlobTool();
|
|
29
23
|
const grepTool = createGrepTool();
|
|
24
|
+
const codeSearchTool = createCodeSearchTool();
|
|
30
25
|
const thinkTool = createThinkTool();
|
|
31
|
-
const lsTool = await createLsTool({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
26
|
+
const lsTool = await createLsTool({ workspace });
|
|
27
|
+
const projectConfig = await config.getConfig();
|
|
28
|
+
const bashTool = await createBashTool({ workspace, env: projectConfig.env });
|
|
29
|
+
const skillTool = await createSkillTool();
|
|
30
|
+
const agentTool = await createAgentTools({ workspace });
|
|
31
|
+
const webSearchTool = await createWebSearchTool();
|
|
32
|
+
const webFetchTool = await createWebFetchTool();
|
|
39
33
|
const dynamicTools = await loadDynamicTools({
|
|
40
34
|
baseDir: workspace.primaryDir,
|
|
35
|
+
existingToolNames: [
|
|
36
|
+
EditFileTool.name,
|
|
37
|
+
BashTool.name,
|
|
38
|
+
SaveFileTool.name,
|
|
39
|
+
ReadFileTool.name,
|
|
40
|
+
GlobTool.name,
|
|
41
|
+
GrepTool.name,
|
|
42
|
+
CodeSearchTool.name,
|
|
43
|
+
DirectoryTreeTool.name,
|
|
44
|
+
ThinkTool.name,
|
|
45
|
+
LsTool.name,
|
|
46
|
+
SkillTool.name,
|
|
47
|
+
AgentTool.name,
|
|
48
|
+
WebSearchTool.name,
|
|
49
|
+
WebFetchTool.name,
|
|
50
|
+
],
|
|
41
51
|
});
|
|
42
52
|
// Build tools object for AI SDK
|
|
43
53
|
const tools = {
|
|
@@ -47,9 +57,14 @@ export async function initTools({ workspace, }) {
|
|
|
47
57
|
[ReadFileTool.name]: readFileTool,
|
|
48
58
|
[GlobTool.name]: globTool,
|
|
49
59
|
[GrepTool.name]: grepTool,
|
|
60
|
+
[CodeSearchTool.name]: codeSearchTool,
|
|
50
61
|
[DirectoryTreeTool.name]: directoryTreeTool,
|
|
51
62
|
[ThinkTool.name]: thinkTool,
|
|
52
63
|
[LsTool.name]: lsTool,
|
|
64
|
+
[SkillTool.name]: skillTool,
|
|
65
|
+
[AgentTool.name]: agentTool,
|
|
66
|
+
[WebSearchTool.name]: webSearchTool,
|
|
67
|
+
[WebFetchTool.name]: webFetchTool,
|
|
53
68
|
// Add dynamic tools - they already have toolDef structure
|
|
54
69
|
...Object.fromEntries(Object.entries(dynamicTools).map(([name, toolObj]) => [name, toolObj])),
|
|
55
70
|
};
|
package/dist/tools/ls.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { WorkspaceContext } from "../index.ts";
|
|
2
3
|
import type { ToolExecutionOptions } from "./types.ts";
|
|
3
4
|
export declare const LsTool: {
|
|
4
5
|
name: "LS";
|
|
@@ -9,8 +10,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
9
10
|
}, z.core.$strip>;
|
|
10
11
|
type LsInputSchema = z.infer<typeof inputSchema>;
|
|
11
12
|
export declare const createLsTool: (options: {
|
|
12
|
-
|
|
13
|
-
allowedDirs?: string[];
|
|
13
|
+
workspace: WorkspaceContext;
|
|
14
14
|
}) => Promise<{
|
|
15
15
|
toolDef: {
|
|
16
16
|
description: string;
|
package/dist/tools/ls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../source/tools/ls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../source/tools/ls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAQf,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAIjD,eAAO,MAAM,YAAY,GAAU,SAAS;IAC1C,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;2CAS0C,aAAa;2CAOnB,aAAa,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EA6DrB,CAAC"}
|
package/dist/tools/ls.js
CHANGED
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import style from "../terminal/style.js";
|
|
5
5
|
import { isDirectory } from "../utils/filesystem/operations.js";
|
|
6
|
+
import { toDisplayPath } from "../utils/filesystem/path-display.js";
|
|
6
7
|
import { validatePath } from "../utils/filesystem/security.js";
|
|
7
8
|
import { convertNullString } from "../utils/zod.js";
|
|
8
9
|
export const LsTool = {
|
|
@@ -19,17 +20,18 @@ const inputSchema = z.object({
|
|
|
19
20
|
});
|
|
20
21
|
const DEFAULT_ENTRY_LIMIT = 500;
|
|
21
22
|
export const createLsTool = async (options) => {
|
|
22
|
-
const {
|
|
23
|
-
const allowedDirectory = allowedDirs ?? [
|
|
23
|
+
const { primaryDir, allowedDirs } = options.workspace;
|
|
24
|
+
const allowedDirectory = allowedDirs ?? [primaryDir];
|
|
24
25
|
return {
|
|
25
26
|
toolDef: {
|
|
26
|
-
description:
|
|
27
|
+
description: "List files in a directory.",
|
|
27
28
|
inputSchema,
|
|
28
29
|
},
|
|
29
30
|
display({ path: providedPath, limit }) {
|
|
30
31
|
const dirPath = providedPath ?? ".";
|
|
31
32
|
const effectiveLimit = limit ?? 500;
|
|
32
|
-
|
|
33
|
+
const displayPath = toDisplayPath(dirPath);
|
|
34
|
+
return `${style.cyan(displayPath)} (limit: ${effectiveLimit})`;
|
|
33
35
|
},
|
|
34
36
|
async execute({ path: providedPath, limit }, { abortSignal }) {
|
|
35
37
|
if (abortSignal?.aborted) {
|
|
@@ -37,7 +39,7 @@ export const createLsTool = async (options) => {
|
|
|
37
39
|
}
|
|
38
40
|
const dirPath = providedPath ?? ".";
|
|
39
41
|
const effectiveLimit = limit ?? DEFAULT_ENTRY_LIMIT;
|
|
40
|
-
const resolvedPath = await validatePath(path.resolve(
|
|
42
|
+
const resolvedPath = await validatePath(path.resolve(primaryDir, dirPath), allowedDirectory, { requireExistence: true, abortSignal });
|
|
41
43
|
if (abortSignal?.aborted) {
|
|
42
44
|
throw new Error("Directory listing aborted before validation");
|
|
43
45
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { WorkspaceContext } from "../index.ts";
|
|
2
3
|
import type { ToolExecutionOptions } from "./types.ts";
|
|
3
4
|
export declare const ReadFileTool: {
|
|
4
5
|
name: "Read";
|
|
@@ -23,9 +24,8 @@ declare const inputSchema: z.ZodObject<{
|
|
|
23
24
|
maxBytes: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
24
25
|
}, z.core.$strip>;
|
|
25
26
|
type ReadFileInputSchema = z.infer<typeof inputSchema>;
|
|
26
|
-
export declare const createReadFileTool: (
|
|
27
|
-
|
|
28
|
-
allowedDirs?: string[];
|
|
27
|
+
export declare const createReadFileTool: (options: {
|
|
28
|
+
workspace: WorkspaceContext;
|
|
29
29
|
}) => Promise<{
|
|
30
30
|
toolDef: {
|
|
31
31
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvD,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBAuBf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,SAAS;IAChD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;0DAQyD,mBAAmB;+EAWpE,mBAAmB,mBACL,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EA2BrB,CAAC"}
|
package/dist/tools/read-file.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
2
3
|
import { isNumber } from "@travisennis/stdlib/typeguards";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import style from "../terminal/style.js";
|
|
6
|
+
import { toDisplayPath } from "../utils/filesystem/path-display.js";
|
|
5
7
|
import { joinWorkingDir, validatePath } from "../utils/filesystem/security.js";
|
|
6
8
|
import { convertNullString } from "../utils/zod.js";
|
|
7
9
|
import { fileEncodingSchema } from "./types.js";
|
|
8
|
-
// default limit in bytes
|
|
9
|
-
const DEFAULT_BYTE_LIMIT =
|
|
10
|
+
// default limit in bytes (20KB)
|
|
11
|
+
const DEFAULT_BYTE_LIMIT = 20 * 1024;
|
|
10
12
|
export const ReadFileTool = {
|
|
11
13
|
name: "Read",
|
|
12
14
|
};
|
|
@@ -24,51 +26,89 @@ const inputSchema = z.object({
|
|
|
24
26
|
.describe("Maximum number of lines to read. Required but nullable. Pass null to get all lines."),
|
|
25
27
|
maxBytes: z
|
|
26
28
|
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
27
|
-
.describe("Maximum number of bytes to read. Set to 0 for no limit. (Default:
|
|
29
|
+
.describe("Maximum number of bytes to read. Set to 0 for no limit. (Default: 20KB)"),
|
|
28
30
|
});
|
|
29
|
-
export const createReadFileTool = async (
|
|
30
|
-
const
|
|
31
|
+
export const createReadFileTool = async (options) => {
|
|
32
|
+
const { primaryDir, allowedDirs } = options.workspace;
|
|
33
|
+
const allowedDirectory = allowedDirs ?? [primaryDir];
|
|
31
34
|
return {
|
|
32
35
|
toolDef: {
|
|
33
|
-
description:
|
|
36
|
+
description: "Read the contents of a file.",
|
|
34
37
|
inputSchema,
|
|
35
38
|
},
|
|
36
39
|
display({ path: providedPath, startLine, lineCount }) {
|
|
37
|
-
|
|
40
|
+
const displayPath = toDisplayPath(providedPath);
|
|
41
|
+
return `${style.cyan(displayPath)}${startLine ? style.cyan(`:${startLine}`) : ""}${lineCount ? style.cyan(`:${lineCount}`) : ""}`;
|
|
38
42
|
},
|
|
39
43
|
async execute({ path: providedPath, encoding, startLine, lineCount, maxBytes, }, { abortSignal }) {
|
|
40
44
|
if (abortSignal?.aborted) {
|
|
41
45
|
throw new Error("File reading aborted");
|
|
42
46
|
}
|
|
43
|
-
const filePath = await validatePath(joinWorkingDir(providedPath,
|
|
44
|
-
|
|
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.`);
|
|
57
|
-
}
|
|
58
|
-
const endIndex = Math.min(startIndex + count, totalLines);
|
|
59
|
-
file = lines.slice(startIndex, endIndex).join("\n");
|
|
60
|
-
}
|
|
47
|
+
const filePath = await validatePath(joinWorkingDir(providedPath, primaryDir), allowedDirectory, { abortSignal });
|
|
48
|
+
const effectiveEncoding = encoding ?? "utf-8";
|
|
61
49
|
const effectiveMaxBytes = maxBytes ?? DEFAULT_BYTE_LIMIT;
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
}
|
|
70
|
-
}
|
|
50
|
+
const file = await readFileContent(filePath, effectiveEncoding, startLine, lineCount, abortSignal);
|
|
51
|
+
validateByteLimit(file, effectiveEncoding, effectiveMaxBytes);
|
|
71
52
|
return file;
|
|
72
53
|
},
|
|
73
54
|
};
|
|
74
55
|
};
|
|
56
|
+
// Read file content either line-by-line or as a whole
|
|
57
|
+
async function readFileContent(filePath, encoding, startLine, lineCount, abortSignal) {
|
|
58
|
+
const useLineBasedRead = isNumber(startLine) || isNumber(lineCount);
|
|
59
|
+
if (useLineBasedRead) {
|
|
60
|
+
return readFileLines(filePath, startLine, lineCount, abortSignal);
|
|
61
|
+
}
|
|
62
|
+
if (abortSignal?.aborted) {
|
|
63
|
+
throw new Error("File reading aborted before file read");
|
|
64
|
+
}
|
|
65
|
+
return fs.readFile(filePath, { encoding });
|
|
66
|
+
}
|
|
67
|
+
// Read specific lines from a file using streaming
|
|
68
|
+
async function readFileLines(filePath, startLine, lineCount, abortSignal) {
|
|
69
|
+
const fileStream = await fs.open(filePath, "r");
|
|
70
|
+
const rl = createInterface({
|
|
71
|
+
input: fileStream.createReadStream(),
|
|
72
|
+
crlfDelay: Number.POSITIVE_INFINITY,
|
|
73
|
+
});
|
|
74
|
+
const lines = [];
|
|
75
|
+
const startIndex = (startLine ?? 1) - 1;
|
|
76
|
+
const count = lineCount ?? Number.POSITIVE_INFINITY;
|
|
77
|
+
let currentIndex = 0;
|
|
78
|
+
for await (const line of rl) {
|
|
79
|
+
if (currentIndex >= startIndex && currentIndex < startIndex + count) {
|
|
80
|
+
lines.push(line);
|
|
81
|
+
}
|
|
82
|
+
currentIndex++;
|
|
83
|
+
if (currentIndex >= startIndex + count) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (abortSignal?.aborted) {
|
|
87
|
+
rl.close();
|
|
88
|
+
await fileStream.close();
|
|
89
|
+
throw new Error("File reading aborted");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
rl.close();
|
|
93
|
+
await fileStream.close();
|
|
94
|
+
if (startIndex >= currentIndex) {
|
|
95
|
+
throw new Error(`startLine ${startLine} is out of bounds for file with ${currentIndex} lines.`);
|
|
96
|
+
}
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
// Validate that file content doesn't exceed byte limit
|
|
100
|
+
function validateByteLimit(file, encoding, maxBytes) {
|
|
101
|
+
if (maxBytes <= 0) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const byteLength = Buffer.byteLength(file, encoding);
|
|
105
|
+
if (byteLength > maxBytes) {
|
|
106
|
+
const fileSizeKb = (byteLength / 1024).toFixed(1);
|
|
107
|
+
const limitKb = (maxBytes / 1024).toFixed(0);
|
|
108
|
+
throw new Error(`File (${fileSizeKb}KB) exceeds the ${limitKb}KB read limit. To read this file, use one of these options:\n` +
|
|
109
|
+
"• Set maxBytes: 0 to read the entire file\n" +
|
|
110
|
+
"• Use startLine and lineCount to read specific portions (e.g., startLine: 1, lineCount: 100)\n" +
|
|
111
|
+
"• Use the Grep tool to search for specific content\n" +
|
|
112
|
+
`• Use the Bash tool with 'tail' or 'head' commands`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { WorkspaceContext } from "../index.ts";
|
|
2
3
|
import { type ToolExecutionOptions } from "./types.ts";
|
|
3
4
|
export declare const SaveFileTool: {
|
|
4
5
|
name: "Write";
|
|
@@ -21,9 +22,8 @@ declare const inputSchema: z.ZodObject<{
|
|
|
21
22
|
}>>;
|
|
22
23
|
}, z.core.$strip>;
|
|
23
24
|
type SaveFileInputSchema = z.infer<typeof inputSchema>;
|
|
24
|
-
export declare const createSaveFileTool: (
|
|
25
|
-
|
|
26
|
-
allowedDirs?: string[];
|
|
25
|
+
export declare const createSaveFileTool: (options: {
|
|
26
|
+
workspace: WorkspaceContext;
|
|
27
27
|
}) => Promise<{
|
|
28
28
|
toolDef: {
|
|
29
29
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AASpD,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,SAAS;IAChD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;sBAUqB,mBAAmB;mDAKI,mBAAmB,mBACzC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAoDrB,CAAC"}
|
package/dist/tools/save-file.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { config } from "../config.js";
|
|
4
|
+
import { config } from "../config/index.js";
|
|
5
5
|
import { clearProjectStatusCache } from "../repl/project-status.js";
|
|
6
6
|
import style from "../terminal/style.js";
|
|
7
|
+
import { toDisplayPath } from "../utils/filesystem/path-display.js";
|
|
7
8
|
import { joinWorkingDir, validateFileNotReadOnly, validatePath, } from "../utils/filesystem/security.js";
|
|
8
9
|
import { fileEncodingSchema } from "./types.js";
|
|
9
10
|
export const SaveFileTool = {
|
|
@@ -16,28 +17,27 @@ const inputSchema = z.object({
|
|
|
16
17
|
.describe('Encoding format for saving the file. Use "utf-8" as default for text files')
|
|
17
18
|
.default("utf-8"),
|
|
18
19
|
});
|
|
19
|
-
export const createSaveFileTool = async (
|
|
20
|
-
const
|
|
20
|
+
export const createSaveFileTool = async (options) => {
|
|
21
|
+
const { primaryDir, allowedDirs } = options.workspace;
|
|
22
|
+
const allowedDirectory = allowedDirs ?? [primaryDir];
|
|
23
|
+
const projectConfig = await config.getConfig();
|
|
21
24
|
return {
|
|
22
25
|
toolDef: {
|
|
23
|
-
description: "Create
|
|
24
|
-
"Automatically creates all missing parent directories. " +
|
|
25
|
-
"Use with caution as it will overwrite existing files without warning. " +
|
|
26
|
-
"Handles text content with proper encoding. Only works within allowed directories.",
|
|
26
|
+
description: "Create or overwrite a file with new content.",
|
|
27
27
|
inputSchema,
|
|
28
28
|
},
|
|
29
29
|
display({ path }) {
|
|
30
|
-
|
|
30
|
+
const displayPath = toDisplayPath(path);
|
|
31
|
+
return `${style.cyan(displayPath)}`;
|
|
31
32
|
},
|
|
32
33
|
async execute({ path: userPath, content, encoding }, { abortSignal }) {
|
|
33
34
|
if (abortSignal?.aborted) {
|
|
34
35
|
throw new Error("File saving aborted");
|
|
35
36
|
}
|
|
36
|
-
const filePath = await validatePath(joinWorkingDir(userPath,
|
|
37
|
+
const filePath = await validatePath(joinWorkingDir(userPath, primaryDir), allowedDirectory, { requireExistence: false, abortSignal });
|
|
37
38
|
try {
|
|
38
39
|
await fs.stat(filePath);
|
|
39
|
-
|
|
40
|
-
validateFileNotReadOnly(filePath, projectConfig, workingDir);
|
|
40
|
+
validateFileNotReadOnly(filePath, projectConfig, primaryDir);
|
|
41
41
|
}
|
|
42
42
|
catch (error) {
|
|
43
43
|
if (error.code !== "ENOENT") {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolExecutionOptions } from "./types.ts";
|
|
3
|
+
export declare const SkillTool: {
|
|
4
|
+
name: "Skill";
|
|
5
|
+
};
|
|
6
|
+
declare const inputSchema: z.ZodObject<{
|
|
7
|
+
skill: z.ZodString;
|
|
8
|
+
args: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
type SkillInputSchema = z.infer<typeof inputSchema>;
|
|
11
|
+
export declare function createSkillTool(): Promise<{
|
|
12
|
+
toolDef: {
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: z.ZodObject<{
|
|
15
|
+
skill: z.ZodString;
|
|
16
|
+
args: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
};
|
|
19
|
+
display({ skill: skillName }: SkillInputSchema): string;
|
|
20
|
+
execute({ skill: skillName, args }: SkillInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../source/tools/skill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAKf,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,wBAAsB,eAAe;;;;;;;;kCAWH,gBAAgB,GAAG,MAAM;wCAIzB,gBAAgB,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;GA4CrB"}
|