@travisennis/acai 0.0.11 → 0.0.13
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 +5 -5
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -12
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +6 -19
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +4 -1
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +6 -0
- package/dist/commands/session/types.d.ts +1 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.d.ts.map +1 -0
- package/dist/commands/tools/index.js +191 -0
- package/dist/commands/tools/templates.d.ts +6 -0
- package/dist/commands/tools/templates.d.ts.map +1 -0
- package/dist/commands/tools/templates.js +97 -0
- package/dist/config/index.d.ts +5 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +42 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -68
- package/dist/models/anthropic-provider.d.ts +1 -1
- package/dist/models/deepseek-provider.d.ts +3 -3
- package/dist/models/deepseek-provider.js +17 -17
- package/dist/models/google-provider.d.ts +2 -4
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +2 -17
- package/dist/models/groq-provider.d.ts +2 -4
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +3 -21
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +11 -1
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +130 -0
- package/dist/models/opencode-zen-provider.d.ts +3 -3
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +26 -32
- package/dist/models/openrouter-provider.d.ts +4 -15
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +26 -169
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/xai-provider.d.ts +1 -2
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -13
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +5 -1
- package/dist/prompts/system-prompt.d.ts +1 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +26 -15
- package/dist/repl/index.d.ts +28 -13
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +242 -305
- package/dist/skills/activated-tracker.d.ts +11 -0
- package/dist/skills/activated-tracker.d.ts.map +1 -0
- package/dist/skills/activated-tracker.js +16 -0
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +127 -71
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts +4 -4
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +27 -13
- package/dist/tools/dynamic-tool-loader.d.ts +17 -3
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +360 -81
- package/dist/tools/edit-file.d.ts +2 -2
- package/dist/tools/index.d.ts +27 -151
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -21
- package/dist/tools/read-file.d.ts +8 -8
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/skill.d.ts +2 -1
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +64 -14
- package/dist/tools/types.d.ts +8 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.d.ts +8 -12
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +86 -44
- package/dist/tools/web-search.d.ts +4 -8
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +41 -33
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/footer.d.ts +0 -2
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +1 -17
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/binary-output.d.ts +32 -0
- package/dist/utils/binary-output.d.ts.map +1 -0
- package/dist/utils/binary-output.js +127 -0
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +121 -29
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +32 -29
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/modes/manager.d.ts +0 -24
- package/dist/modes/manager.d.ts.map +0 -1
- package/dist/modes/manager.js +0 -77
- package/dist/modes/prompts.d.ts +0 -2
- package/dist/modes/prompts.d.ts.map +0 -1
- package/dist/modes/prompts.js +0 -142
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -152
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -159
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -601
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -82
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AsyncReturnType } from "@travisennis/stdlib/types";
|
|
2
2
|
import type { Tool } from "ai";
|
|
3
3
|
import type { WorkspaceContext } from "../index.ts";
|
|
4
|
+
import { ActivatedSkillsTracker } from "../skills/activated-tracker.ts";
|
|
4
5
|
export type CompleteToolSet = {
|
|
5
6
|
-readonly [K in keyof AsyncReturnType<typeof initTools>]: AsyncReturnType<typeof initTools>[K];
|
|
6
7
|
};
|
|
@@ -8,6 +9,11 @@ export type CompleteTools = {
|
|
|
8
9
|
-readonly [K in keyof AsyncReturnType<typeof initTools>]: Tool<unknown, string>;
|
|
9
10
|
};
|
|
10
11
|
export type CompleteToolNames = keyof CompleteToolSet;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the activated skills tracker instance.
|
|
14
|
+
* Used to reset the tracker when a new session starts.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getActivatedSkillsTracker(): ActivatedSkillsTracker;
|
|
11
17
|
export declare function initTools({ workspace, }: {
|
|
12
18
|
workspace: WorkspaceContext;
|
|
13
19
|
}): Promise<{
|
|
@@ -30,7 +36,7 @@ export declare function initTools({ workspace, }: {
|
|
|
30
36
|
description: string;
|
|
31
37
|
inputSchema: import("zod").ZodObject<{
|
|
32
38
|
path: import("zod").ZodString;
|
|
33
|
-
edits: import("zod").
|
|
39
|
+
edits: import("zod").ZodPreprocess<import("zod").ZodArray<import("zod").ZodObject<{
|
|
34
40
|
oldText: import("zod").ZodString;
|
|
35
41
|
newText: import("zod").ZodString;
|
|
36
42
|
}, import("zod/v4/core").$strip>>>;
|
|
@@ -56,8 +62,8 @@ export declare function initTools({ workspace, }: {
|
|
|
56
62
|
description: string;
|
|
57
63
|
inputSchema: import("zod").ZodObject<{
|
|
58
64
|
command: import("zod").ZodString;
|
|
59
|
-
cwd: import("zod").
|
|
60
|
-
timeout: import("zod").
|
|
65
|
+
cwd: import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
66
|
+
timeout: import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
61
67
|
background: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
62
68
|
}, import("zod/v4/core").$strip>;
|
|
63
69
|
};
|
|
@@ -81,14 +87,14 @@ export declare function initTools({ workspace, }: {
|
|
|
81
87
|
path: import("zod").ZodString;
|
|
82
88
|
content: import("zod").ZodString;
|
|
83
89
|
encoding: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
90
|
+
base64: "base64";
|
|
91
|
+
base64url: "base64url";
|
|
84
92
|
utf8: "utf8";
|
|
85
93
|
ascii: "ascii";
|
|
86
94
|
"utf-8": "utf-8";
|
|
87
95
|
utf16le: "utf16le";
|
|
88
96
|
ucs2: "ucs2";
|
|
89
97
|
"ucs-2": "ucs-2";
|
|
90
|
-
base64: "base64";
|
|
91
|
-
base64url: "base64url";
|
|
92
98
|
latin1: "latin1";
|
|
93
99
|
binary: "binary";
|
|
94
100
|
hex: "hex";
|
|
@@ -98,12 +104,12 @@ export declare function initTools({ workspace, }: {
|
|
|
98
104
|
display({ path }: {
|
|
99
105
|
path: string;
|
|
100
106
|
content: string;
|
|
101
|
-
encoding: "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "
|
|
107
|
+
encoding: "base64" | "base64url" | "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "latin1" | "binary" | "hex";
|
|
102
108
|
}): string;
|
|
103
109
|
execute({ path: userPath, content, encoding }: {
|
|
104
110
|
path: string;
|
|
105
111
|
content: string;
|
|
106
|
-
encoding: "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "
|
|
112
|
+
encoding: "base64" | "base64url" | "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "latin1" | "binary" | "hex";
|
|
107
113
|
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
108
114
|
};
|
|
109
115
|
readonly Read: {
|
|
@@ -112,128 +118,35 @@ export declare function initTools({ workspace, }: {
|
|
|
112
118
|
inputSchema: import("zod").ZodObject<{
|
|
113
119
|
path: import("zod").ZodString;
|
|
114
120
|
encoding: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodEnum<{
|
|
121
|
+
base64: "base64";
|
|
122
|
+
base64url: "base64url";
|
|
115
123
|
utf8: "utf8";
|
|
116
124
|
ascii: "ascii";
|
|
117
125
|
"utf-8": "utf-8";
|
|
118
126
|
utf16le: "utf16le";
|
|
119
127
|
ucs2: "ucs2";
|
|
120
128
|
"ucs-2": "ucs-2";
|
|
121
|
-
base64: "base64";
|
|
122
|
-
base64url: "base64url";
|
|
123
129
|
latin1: "latin1";
|
|
124
130
|
binary: "binary";
|
|
125
131
|
hex: "hex";
|
|
126
132
|
}>>>;
|
|
127
|
-
startLine: import("zod").
|
|
128
|
-
lineCount: import("zod").
|
|
133
|
+
startLine: import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
134
|
+
lineCount: import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
129
135
|
}, import("zod/v4/core").$strip>;
|
|
130
136
|
};
|
|
131
137
|
display({ path: providedPath, startLine, lineCount }: {
|
|
132
138
|
path: string;
|
|
133
|
-
encoding: "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "
|
|
139
|
+
encoding: "base64" | "base64url" | "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "latin1" | "binary" | "hex" | null;
|
|
134
140
|
startLine: number | null;
|
|
135
141
|
lineCount: number | null;
|
|
136
142
|
}): string;
|
|
137
143
|
execute({ path: providedPath, encoding, startLine, lineCount, }: {
|
|
138
144
|
path: string;
|
|
139
|
-
encoding: "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "
|
|
145
|
+
encoding: "base64" | "base64url" | "utf8" | "ascii" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "latin1" | "binary" | "hex" | null;
|
|
140
146
|
startLine: number | null;
|
|
141
147
|
lineCount: number | null;
|
|
142
148
|
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
143
149
|
};
|
|
144
|
-
readonly Glob: {
|
|
145
|
-
toolDef: {
|
|
146
|
-
description: string;
|
|
147
|
-
inputSchema: import("zod").ZodObject<{
|
|
148
|
-
patterns: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
149
|
-
path: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodString>;
|
|
150
|
-
gitignore: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
151
|
-
recursive: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
152
|
-
expandDirectories: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
153
|
-
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>]>>>;
|
|
154
|
-
cwd: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedString<unknown>>>;
|
|
155
|
-
maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
156
|
-
}, import("zod/v4/core").$strip>;
|
|
157
|
-
};
|
|
158
|
-
display({ patterns, path }: {
|
|
159
|
-
patterns: string | string[];
|
|
160
|
-
path: string;
|
|
161
|
-
gitignore: boolean | null;
|
|
162
|
-
recursive: boolean | null;
|
|
163
|
-
expandDirectories: boolean | null;
|
|
164
|
-
ignoreFiles: string | string[] | null;
|
|
165
|
-
cwd: string | null;
|
|
166
|
-
maxResults: number | null;
|
|
167
|
-
}): string;
|
|
168
|
-
execute({ patterns, path, gitignore, recursive, expandDirectories, ignoreFiles, cwd, maxResults, }: {
|
|
169
|
-
patterns: string | string[];
|
|
170
|
-
path: string;
|
|
171
|
-
gitignore: boolean | null;
|
|
172
|
-
recursive: boolean | null;
|
|
173
|
-
expandDirectories: boolean | null;
|
|
174
|
-
ignoreFiles: string | string[] | null;
|
|
175
|
-
cwd: string | null;
|
|
176
|
-
maxResults: number | null;
|
|
177
|
-
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
178
|
-
};
|
|
179
|
-
readonly Grep: {
|
|
180
|
-
toolDef: {
|
|
181
|
-
description: string;
|
|
182
|
-
inputSchema: import("zod").ZodObject<{
|
|
183
|
-
pattern: import("zod").ZodString;
|
|
184
|
-
path: import("zod").ZodString;
|
|
185
|
-
recursive: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
186
|
-
ignoreCase: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
187
|
-
filePattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedString<unknown>>>;
|
|
188
|
-
contextLines: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
189
|
-
searchIgnored: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
190
|
-
literal: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
|
|
191
|
-
maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
192
|
-
}, import("zod/v4/core").$strip>;
|
|
193
|
-
};
|
|
194
|
-
display({ pattern, path, filePattern, recursive, ignoreCase, contextLines, }: {
|
|
195
|
-
pattern: string;
|
|
196
|
-
path: string;
|
|
197
|
-
recursive: boolean | null;
|
|
198
|
-
ignoreCase: boolean | null;
|
|
199
|
-
filePattern: string | null;
|
|
200
|
-
contextLines: number | null;
|
|
201
|
-
searchIgnored: boolean | null;
|
|
202
|
-
literal: boolean | null;
|
|
203
|
-
maxResults: number | null;
|
|
204
|
-
}): string;
|
|
205
|
-
execute({ pattern, path, recursive, ignoreCase, filePattern, contextLines, searchIgnored, literal, maxResults, }: {
|
|
206
|
-
pattern: string;
|
|
207
|
-
path: string;
|
|
208
|
-
recursive: boolean | null;
|
|
209
|
-
ignoreCase: boolean | null;
|
|
210
|
-
filePattern: string | null;
|
|
211
|
-
contextLines: number | null;
|
|
212
|
-
searchIgnored: boolean | null;
|
|
213
|
-
literal: boolean | null;
|
|
214
|
-
maxResults: number | null;
|
|
215
|
-
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
216
|
-
};
|
|
217
|
-
readonly DirectoryTree: {
|
|
218
|
-
toolDef: {
|
|
219
|
-
description: string;
|
|
220
|
-
inputSchema: import("zod").ZodObject<{
|
|
221
|
-
path: import("zod").ZodString;
|
|
222
|
-
maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
223
|
-
maxDepth: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
224
|
-
}, import("zod/v4/core").$strip>;
|
|
225
|
-
};
|
|
226
|
-
display({ path, maxDepth, maxResults }: {
|
|
227
|
-
path: string;
|
|
228
|
-
maxResults: number | null;
|
|
229
|
-
maxDepth: number | null;
|
|
230
|
-
}): string;
|
|
231
|
-
execute({ path, maxResults, maxDepth }: {
|
|
232
|
-
path: string;
|
|
233
|
-
maxResults: number | null;
|
|
234
|
-
maxDepth: number | null;
|
|
235
|
-
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
236
|
-
};
|
|
237
150
|
readonly Think: {
|
|
238
151
|
toolDef: {
|
|
239
152
|
description: string;
|
|
@@ -246,23 +159,6 @@ export declare function initTools({ workspace, }: {
|
|
|
246
159
|
thought: import("zod").ZodString;
|
|
247
160
|
}, import("zod/v4/core").$strip>>, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
248
161
|
};
|
|
249
|
-
readonly LS: {
|
|
250
|
-
toolDef: {
|
|
251
|
-
description: string;
|
|
252
|
-
inputSchema: import("zod").ZodObject<{
|
|
253
|
-
path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
254
|
-
limit: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
|
|
255
|
-
}, import("zod/v4/core").$strip>;
|
|
256
|
-
};
|
|
257
|
-
display({ path: providedPath, limit }: {
|
|
258
|
-
limit: number | null;
|
|
259
|
-
path?: string | undefined;
|
|
260
|
-
}): string;
|
|
261
|
-
execute({ path: providedPath, limit }: {
|
|
262
|
-
limit: number | null;
|
|
263
|
-
path?: string | undefined;
|
|
264
|
-
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
265
|
-
};
|
|
266
162
|
readonly Skill: {
|
|
267
163
|
toolDef: {
|
|
268
164
|
description: string;
|
|
@@ -280,33 +176,13 @@ export declare function initTools({ workspace, }: {
|
|
|
280
176
|
args?: string | undefined;
|
|
281
177
|
}, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
|
|
282
178
|
};
|
|
283
|
-
readonly Agent: {
|
|
284
|
-
toolDef: {
|
|
285
|
-
description: string;
|
|
286
|
-
inputSchema: import("zod").ZodObject<{
|
|
287
|
-
prompt: import("zod").ZodString;
|
|
288
|
-
type: import("zod").ZodString;
|
|
289
|
-
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
290
|
-
}, import("zod/v4/core").$strip>;
|
|
291
|
-
};
|
|
292
|
-
display: ({ prompt, type }: import("zod").infer<import("zod").ZodObject<{
|
|
293
|
-
prompt: import("zod").ZodString;
|
|
294
|
-
type: import("zod").ZodString;
|
|
295
|
-
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
296
|
-
}, import("zod/v4/core").$strip>>) => string;
|
|
297
|
-
execute: ({ prompt, type, timeout }: import("zod").infer<import("zod").ZodObject<{
|
|
298
|
-
prompt: import("zod").ZodString;
|
|
299
|
-
type: import("zod").ZodString;
|
|
300
|
-
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
301
|
-
}, import("zod/v4/core").$strip>>, { abortSignal }: import("./types.ts").ToolExecutionOptions) => Promise<string>;
|
|
302
|
-
};
|
|
303
179
|
readonly WebSearch: {
|
|
304
180
|
toolDef: {
|
|
305
181
|
description: string;
|
|
306
182
|
inputSchema: import("zod").ZodObject<{
|
|
307
183
|
query: import("zod").ZodString;
|
|
308
|
-
numResults: import("zod").ZodOptional<import("zod").
|
|
309
|
-
timeout: import("zod").ZodOptional<import("zod").
|
|
184
|
+
numResults: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
185
|
+
timeout: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
310
186
|
provider: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
311
187
|
exa: "exa";
|
|
312
188
|
duckduckgo: "duckduckgo";
|
|
@@ -334,24 +210,24 @@ export declare function initTools({ workspace, }: {
|
|
|
334
210
|
output: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
335
211
|
markdown: "markdown";
|
|
336
212
|
text: "text";
|
|
337
|
-
html: "html";
|
|
338
213
|
json: "json";
|
|
214
|
+
html: "html";
|
|
339
215
|
}>>;
|
|
340
|
-
jina: import("zod").ZodOptional<import("zod").
|
|
341
|
-
timeout: import("zod").ZodOptional<import("zod").
|
|
342
|
-
headers: import("zod").ZodOptional<import("zod").
|
|
216
|
+
jina: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
|
|
217
|
+
timeout: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
|
|
218
|
+
headers: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
|
|
343
219
|
}, import("zod/v4/core").$strip>;
|
|
344
220
|
};
|
|
345
221
|
display({ url }: {
|
|
346
222
|
url: string;
|
|
347
|
-
output: "markdown" | "text" | "
|
|
223
|
+
output: "markdown" | "text" | "json" | "html";
|
|
348
224
|
jina?: boolean | null | undefined;
|
|
349
225
|
timeout?: number | null | undefined;
|
|
350
226
|
headers?: boolean | null | undefined;
|
|
351
227
|
}): string;
|
|
352
228
|
execute(options: {
|
|
353
229
|
url: string;
|
|
354
|
-
output: "markdown" | "text" | "
|
|
230
|
+
output: "markdown" | "text" | "json" | "html";
|
|
355
231
|
jina?: boolean | null | undefined;
|
|
356
232
|
timeout?: number | null | undefined;
|
|
357
233
|
headers?: boolean | null | undefined;
|
|
@@ -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;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,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;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAYxE,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;AAKtD;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,sBAAsB,CAElE;AAED,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DA"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { config } from "../config/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ActivatedSkillsTracker } from "../skills/activated-tracker.js";
|
|
3
3
|
import { ApplyPatchTool, createApplyPatchTool } from "./apply-patch.js";
|
|
4
4
|
import { BashTool, createBashTool } from "./bash.js";
|
|
5
|
-
import { createDirectoryTreeTool, DirectoryTreeTool, } from "./directory-tree.js";
|
|
6
5
|
import { loadDynamicTools } from "./dynamic-tool-loader.js";
|
|
7
6
|
import { createEditFileTool, EditFileTool } from "./edit-file.js";
|
|
8
|
-
import { createGlobTool, GlobTool } from "./glob.js";
|
|
9
|
-
import { createGrepTool, GrepTool } from "./grep.js";
|
|
10
|
-
import { createLsTool, LsTool } from "./ls.js";
|
|
11
7
|
import { createReadFileTool, ReadFileTool } from "./read-file.js";
|
|
12
8
|
import { createSaveFileTool, SaveFileTool } from "./save-file.js";
|
|
13
9
|
import { createSkillTool, SkillTool } from "./skill.js";
|
|
14
10
|
import { createThinkTool, ThinkTool } from "./think.js";
|
|
15
11
|
import { createWebFetchTool, WebFetchTool } from "./web-fetch.js";
|
|
16
12
|
import { createWebSearchTool, WebSearchTool } from "./web-search.js";
|
|
13
|
+
// Singleton tracker for activated skills, reset when a new session starts
|
|
14
|
+
const activatedSkillsTracker = new ActivatedSkillsTracker();
|
|
15
|
+
/**
|
|
16
|
+
* Returns the activated skills tracker instance.
|
|
17
|
+
* Used to reset the tracker when a new session starts.
|
|
18
|
+
*/
|
|
19
|
+
export function getActivatedSkillsTracker() {
|
|
20
|
+
return activatedSkillsTracker;
|
|
21
|
+
}
|
|
17
22
|
export async function initTools({ workspace, }) {
|
|
18
23
|
const readFileTool = await createReadFileTool({ workspace });
|
|
19
24
|
const editFileTool = await createEditFileTool({ workspace });
|
|
20
25
|
const saveFileTool = await createSaveFileTool({ workspace });
|
|
21
|
-
const directoryTreeTool = await createDirectoryTreeTool({ workspace });
|
|
22
|
-
const globTool = createGlobTool();
|
|
23
|
-
const grepTool = createGrepTool();
|
|
24
26
|
const thinkTool = createThinkTool();
|
|
25
|
-
const lsTool = await createLsTool({ workspace });
|
|
26
27
|
const projectConfig = await config.getConfig();
|
|
27
28
|
const bashTool = await createBashTool({ workspace, env: projectConfig.env });
|
|
28
|
-
const skillTool = await createSkillTool();
|
|
29
|
-
const agentTool = await createAgentTools({ workspace });
|
|
29
|
+
const skillTool = await createSkillTool(activatedSkillsTracker);
|
|
30
30
|
const webSearchTool = await createWebSearchTool();
|
|
31
31
|
const webFetchTool = await createWebFetchTool();
|
|
32
32
|
const applyPatchTool = await createApplyPatchTool({ workspace });
|
|
@@ -38,16 +38,16 @@ export async function initTools({ workspace, }) {
|
|
|
38
38
|
BashTool.name,
|
|
39
39
|
SaveFileTool.name,
|
|
40
40
|
ReadFileTool.name,
|
|
41
|
-
GlobTool.name,
|
|
42
|
-
GrepTool.name,
|
|
43
|
-
DirectoryTreeTool.name,
|
|
44
41
|
ThinkTool.name,
|
|
45
|
-
LsTool.name,
|
|
46
42
|
SkillTool.name,
|
|
47
|
-
AgentTool.name,
|
|
48
43
|
WebSearchTool.name,
|
|
49
44
|
WebFetchTool.name,
|
|
50
45
|
],
|
|
46
|
+
sessionContext: {
|
|
47
|
+
sessionId: "",
|
|
48
|
+
projectDir: workspace.primaryDir,
|
|
49
|
+
agentName: "repl",
|
|
50
|
+
},
|
|
51
51
|
});
|
|
52
52
|
// Build tools object for AI SDK
|
|
53
53
|
const tools = {
|
|
@@ -56,13 +56,8 @@ export async function initTools({ workspace, }) {
|
|
|
56
56
|
[BashTool.name]: bashTool,
|
|
57
57
|
[SaveFileTool.name]: saveFileTool,
|
|
58
58
|
[ReadFileTool.name]: readFileTool,
|
|
59
|
-
[GlobTool.name]: globTool,
|
|
60
|
-
[GrepTool.name]: grepTool,
|
|
61
|
-
[DirectoryTreeTool.name]: directoryTreeTool,
|
|
62
59
|
[ThinkTool.name]: thinkTool,
|
|
63
|
-
[LsTool.name]: lsTool,
|
|
64
60
|
[SkillTool.name]: skillTool,
|
|
65
|
-
[AgentTool.name]: agentTool,
|
|
66
61
|
[WebSearchTool.name]: webSearchTool,
|
|
67
62
|
[WebFetchTool.name]: webFetchTool,
|
|
68
63
|
// Add dynamic tools - they already have toolDef structure
|
|
@@ -7,20 +7,20 @@ export declare const ReadFileTool: {
|
|
|
7
7
|
declare const inputSchema: z.ZodObject<{
|
|
8
8
|
path: z.ZodString;
|
|
9
9
|
encoding: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
10
|
+
base64: "base64";
|
|
11
|
+
base64url: "base64url";
|
|
10
12
|
utf8: "utf8";
|
|
11
13
|
ascii: "ascii";
|
|
12
14
|
"utf-8": "utf-8";
|
|
13
15
|
utf16le: "utf16le";
|
|
14
16
|
ucs2: "ucs2";
|
|
15
17
|
"ucs-2": "ucs-2";
|
|
16
|
-
base64: "base64";
|
|
17
|
-
base64url: "base64url";
|
|
18
18
|
latin1: "latin1";
|
|
19
19
|
binary: "binary";
|
|
20
20
|
hex: "hex";
|
|
21
21
|
}>>>;
|
|
22
|
-
startLine: z.
|
|
23
|
-
lineCount: z.
|
|
22
|
+
startLine: z.ZodPreprocess<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
23
|
+
lineCount: z.ZodPreprocess<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
24
24
|
}, z.core.$strip>;
|
|
25
25
|
type ReadFileInputSchema = z.infer<typeof inputSchema>;
|
|
26
26
|
export declare const createReadFileTool: (options: {
|
|
@@ -31,20 +31,20 @@ export declare const createReadFileTool: (options: {
|
|
|
31
31
|
inputSchema: z.ZodObject<{
|
|
32
32
|
path: z.ZodString;
|
|
33
33
|
encoding: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
34
|
+
base64: "base64";
|
|
35
|
+
base64url: "base64url";
|
|
34
36
|
utf8: "utf8";
|
|
35
37
|
ascii: "ascii";
|
|
36
38
|
"utf-8": "utf-8";
|
|
37
39
|
utf16le: "utf16le";
|
|
38
40
|
ucs2: "ucs2";
|
|
39
41
|
"ucs-2": "ucs-2";
|
|
40
|
-
base64: "base64";
|
|
41
|
-
base64url: "base64url";
|
|
42
42
|
latin1: "latin1";
|
|
43
43
|
binary: "binary";
|
|
44
44
|
hex: "hex";
|
|
45
45
|
}>>>;
|
|
46
|
-
startLine: z.
|
|
47
|
-
lineCount: z.
|
|
46
|
+
startLine: z.ZodPreprocess<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
47
|
+
lineCount: z.ZodPreprocess<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
48
48
|
}, z.core.$strip>;
|
|
49
49
|
};
|
|
50
50
|
display({ path: providedPath, startLine, lineCount }: ReadFileInputSchema): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsBvD,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;iBAkBf,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;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsBvD,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;iBAkBf,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;qEAUpE,mBAAmB,mBACL,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAqBrB,CAAC"}
|
package/dist/tools/read-file.js
CHANGED
|
@@ -43,7 +43,7 @@ export const createReadFileTool = async (options) => {
|
|
|
43
43
|
const { primaryDir } = options.workspace;
|
|
44
44
|
return {
|
|
45
45
|
toolDef: {
|
|
46
|
-
description: "Read the contents of a file.",
|
|
46
|
+
description: "Read the contents of a file. When you need to read multiple files, ALWAYS issue multiple Read tool calls in the same assistant message rather than reading one, waiting for the result, then reading the next. The runtime executes parallel tool calls concurrently, so batching reads is several times faster than serial reads.",
|
|
47
47
|
inputSchema,
|
|
48
48
|
},
|
|
49
49
|
display({ path: providedPath, startLine, lineCount }) {
|
|
@@ -57,8 +57,8 @@ export const createReadFileTool = async (options) => {
|
|
|
57
57
|
const filePath = resolveReadPath(providedPath, primaryDir);
|
|
58
58
|
const effectiveEncoding = encoding ?? "utf-8";
|
|
59
59
|
const file = await readFileContent(filePath, effectiveEncoding, startLine, lineCount, abortSignal);
|
|
60
|
-
|
|
61
|
-
return file;
|
|
60
|
+
const totalLines = file === "" ? 0 : file.split("\n").length;
|
|
61
|
+
return applyByteLimit(file, effectiveEncoding, BYTE_LIMIT, totalLines);
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
};
|
|
@@ -105,15 +105,34 @@ async function readFileLines(filePath, startLine, lineCount, abortSignal) {
|
|
|
105
105
|
}
|
|
106
106
|
return lines.join("\n");
|
|
107
107
|
}
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"• Use startLine and lineCount to read specific portions (e.g., startLine: 1, lineCount: 100)\n" +
|
|
116
|
-
"• Use the Grep tool to search for specific content\n" +
|
|
117
|
-
`• Use the Bash tool with 'tail' or 'head' commands`);
|
|
108
|
+
// Truncate content to a byte limit, safely handling multi-byte encodings.
|
|
109
|
+
// Returns the truncated content with a message indicating how much remains
|
|
110
|
+
// and the total number of lines in the original content.
|
|
111
|
+
function applyByteLimit(content, encoding, maxBytes, totalLines) {
|
|
112
|
+
const byteLength = Buffer.byteLength(content, encoding);
|
|
113
|
+
if (byteLength <= maxBytes) {
|
|
114
|
+
return content;
|
|
118
115
|
}
|
|
116
|
+
const truncated = truncateToByteLimit(content, encoding, maxBytes);
|
|
117
|
+
const truncatedBytes = Buffer.byteLength(truncated, encoding);
|
|
118
|
+
const remainingBytes = byteLength - truncatedBytes;
|
|
119
|
+
const limitKb = (maxBytes / 1024).toFixed(0);
|
|
120
|
+
const remainingKb = (remainingBytes / 1024).toFixed(1);
|
|
121
|
+
const message = [
|
|
122
|
+
"",
|
|
123
|
+
`[File truncated at ${limitKb}KB limit. ${remainingKb}KB remaining. Total lines: ${totalLines.toLocaleString()}.]`,
|
|
124
|
+
"To read more, use the startLine and lineCount parameters, or use Bash with head/tail/sed.",
|
|
125
|
+
].join("\n");
|
|
126
|
+
return truncated + message;
|
|
127
|
+
}
|
|
128
|
+
// Safely truncate a string to a maximum number of bytes in the given encoding.
|
|
129
|
+
// Uses TextDecoder for UTF-8 to avoid splitting multi-byte characters.
|
|
130
|
+
function truncateToByteLimit(content, encoding, maxBytes) {
|
|
131
|
+
if (encoding === "utf-8" || encoding === "utf8") {
|
|
132
|
+
const decoder = new TextDecoder("utf-8");
|
|
133
|
+
return decoder.decode(Buffer.from(content, encoding).subarray(0, maxBytes), {
|
|
134
|
+
stream: true,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return Buffer.from(content, encoding).toString(encoding, 0, maxBytes);
|
|
119
138
|
}
|
|
@@ -8,14 +8,14 @@ declare const inputSchema: z.ZodObject<{
|
|
|
8
8
|
path: z.ZodString;
|
|
9
9
|
content: z.ZodString;
|
|
10
10
|
encoding: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
base64: "base64";
|
|
12
|
+
base64url: "base64url";
|
|
11
13
|
utf8: "utf8";
|
|
12
14
|
ascii: "ascii";
|
|
13
15
|
"utf-8": "utf-8";
|
|
14
16
|
utf16le: "utf16le";
|
|
15
17
|
ucs2: "ucs2";
|
|
16
18
|
"ucs-2": "ucs-2";
|
|
17
|
-
base64: "base64";
|
|
18
|
-
base64url: "base64url";
|
|
19
19
|
latin1: "latin1";
|
|
20
20
|
binary: "binary";
|
|
21
21
|
hex: "hex";
|
|
@@ -31,14 +31,14 @@ export declare const createSaveFileTool: (options: {
|
|
|
31
31
|
path: z.ZodString;
|
|
32
32
|
content: z.ZodString;
|
|
33
33
|
encoding: z.ZodDefault<z.ZodEnum<{
|
|
34
|
+
base64: "base64";
|
|
35
|
+
base64url: "base64url";
|
|
34
36
|
utf8: "utf8";
|
|
35
37
|
ascii: "ascii";
|
|
36
38
|
"utf-8": "utf-8";
|
|
37
39
|
utf16le: "utf16le";
|
|
38
40
|
ucs2: "ucs2";
|
|
39
41
|
"ucs-2": "ucs-2";
|
|
40
|
-
base64: "base64";
|
|
41
|
-
base64url: "base64url";
|
|
42
42
|
latin1: "latin1";
|
|
43
43
|
binary: "binary";
|
|
44
44
|
hex: "hex";
|
package/dist/tools/skill.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { ActivatedSkillsTracker } from "../skills/activated-tracker.ts";
|
|
2
3
|
import type { ToolExecutionOptions } from "./types.ts";
|
|
3
4
|
export declare const SkillTool: {
|
|
4
5
|
name: "Skill";
|
|
@@ -8,7 +9,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
8
9
|
args: z.ZodOptional<z.ZodString>;
|
|
9
10
|
}, z.core.$strip>;
|
|
10
11
|
type SkillInputSchema = z.infer<typeof inputSchema>;
|
|
11
|
-
export declare function createSkillTool(): Promise<{
|
|
12
|
+
export declare function createSkillTool(activatedSkillsTracker: ActivatedSkillsTracker): Promise<{
|
|
12
13
|
toolDef: {
|
|
13
14
|
description: string;
|
|
14
15
|
inputSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../source/tools/skill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../source/tools/skill.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAK7E,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;AA2DpD,wBAAsB,eAAe,CACnC,sBAAsB,EAAE,sBAAsB;;;;;;;;kCAcd,gBAAgB,GAAG,MAAM;wCAIzB,gBAAgB,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;GAgDrB"}
|