agent-sory 1.0.0
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/LICENSE +21 -0
- package/README.md +265 -0
- package/dist/commands/base.d.ts +26 -0
- package/dist/commands/base.d.ts.map +1 -0
- package/dist/commands/base.js +3 -0
- package/dist/commands/base.js.map +1 -0
- package/dist/commands/definitions/clear.d.ts +3 -0
- package/dist/commands/definitions/clear.d.ts.map +1 -0
- package/dist/commands/definitions/clear.js +12 -0
- package/dist/commands/definitions/clear.js.map +1 -0
- package/dist/commands/definitions/help.d.ts +3 -0
- package/dist/commands/definitions/help.d.ts.map +1 -0
- package/dist/commands/definitions/help.js +28 -0
- package/dist/commands/definitions/help.js.map +1 -0
- package/dist/commands/definitions/init.d.ts +3 -0
- package/dist/commands/definitions/init.d.ts.map +1 -0
- package/dist/commands/definitions/init.js +23 -0
- package/dist/commands/definitions/init.js.map +1 -0
- package/dist/commands/definitions/login.d.ts +3 -0
- package/dist/commands/definitions/login.d.ts.map +1 -0
- package/dist/commands/definitions/login.js +8 -0
- package/dist/commands/definitions/login.js.map +1 -0
- package/dist/commands/definitions/model.d.ts +3 -0
- package/dist/commands/definitions/model.d.ts.map +1 -0
- package/dist/commands/definitions/model.js +10 -0
- package/dist/commands/definitions/model.js.map +1 -0
- package/dist/commands/definitions/reasoning.d.ts +3 -0
- package/dist/commands/definitions/reasoning.d.ts.map +1 -0
- package/dist/commands/definitions/reasoning.js +21 -0
- package/dist/commands/definitions/reasoning.js.map +1 -0
- package/dist/commands/definitions/stats.d.ts +3 -0
- package/dist/commands/definitions/stats.d.ts.map +1 -0
- package/dist/commands/definitions/stats.js +22 -0
- package/dist/commands/definitions/stats.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +38 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/agent.d.ts +41 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +266 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/cli.d.ts +3 -0
- package/dist/core/cli.d.ts.map +1 -0
- package/dist/core/cli.js +48 -0
- package/dist/core/cli.js.map +1 -0
- package/dist/core/llm/factory.d.ts +12 -0
- package/dist/core/llm/factory.d.ts.map +1 -0
- package/dist/core/llm/factory.js +44 -0
- package/dist/core/llm/factory.js.map +1 -0
- package/dist/core/llm/providers/gemini.d.ts +22 -0
- package/dist/core/llm/providers/gemini.d.ts.map +1 -0
- package/dist/core/llm/providers/gemini.js +167 -0
- package/dist/core/llm/providers/gemini.js.map +1 -0
- package/dist/core/llm/providers/groq.d.ts +23 -0
- package/dist/core/llm/providers/groq.d.ts.map +1 -0
- package/dist/core/llm/providers/groq.js +96 -0
- package/dist/core/llm/providers/groq.js.map +1 -0
- package/dist/core/llm/providers/openai-compatible.d.ts +24 -0
- package/dist/core/llm/providers/openai-compatible.d.ts.map +1 -0
- package/dist/core/llm/providers/openai-compatible.js +86 -0
- package/dist/core/llm/providers/openai-compatible.js.map +1 -0
- package/dist/core/llm/types.d.ts +37 -0
- package/dist/core/llm/types.d.ts.map +1 -0
- package/dist/core/llm/types.js +2 -0
- package/dist/core/llm/types.js.map +1 -0
- package/dist/core/prompts/system.d.ts +6 -0
- package/dist/core/prompts/system.d.ts.map +1 -0
- package/dist/core/prompts/system.js +36 -0
- package/dist/core/prompts/system.js.map +1 -0
- package/dist/tests/proxy-config.test.d.ts +2 -0
- package/dist/tests/proxy-config.test.d.ts.map +1 -0
- package/dist/tests/proxy-config.test.js +169 -0
- package/dist/tests/proxy-config.test.js.map +1 -0
- package/dist/tools/tool-schemas.d.ts +36 -0
- package/dist/tools/tool-schemas.d.ts.map +1 -0
- package/dist/tools/tool-schemas.js +482 -0
- package/dist/tools/tool-schemas.js.map +1 -0
- package/dist/tools/tools.d.ts +114 -0
- package/dist/tools/tools.d.ts.map +1 -0
- package/dist/tools/tools.js +1015 -0
- package/dist/tools/tools.js.map +1 -0
- package/dist/tools/utils/edit-logic.d.ts +9 -0
- package/dist/tools/utils/edit-logic.d.ts.map +1 -0
- package/dist/tools/utils/edit-logic.js +149 -0
- package/dist/tools/utils/edit-logic.js.map +1 -0
- package/dist/tools/utils/ripgrep-runner.d.ts +15 -0
- package/dist/tools/utils/ripgrep-runner.d.ts.map +1 -0
- package/dist/tools/utils/ripgrep-runner.js +90 -0
- package/dist/tools/utils/ripgrep-runner.js.map +1 -0
- package/dist/tools/validators.d.ts +4 -0
- package/dist/tools/validators.d.ts.map +1 -0
- package/dist/tools/validators.js +18 -0
- package/dist/tools/validators.js.map +1 -0
- package/dist/ui/App.d.ts +7 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +12 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/components/core/Chat.d.ts +7 -0
- package/dist/ui/components/core/Chat.d.ts.map +1 -0
- package/dist/ui/components/core/Chat.js +60 -0
- package/dist/ui/components/core/Chat.js.map +1 -0
- package/dist/ui/components/core/MessageHistory.d.ts +7 -0
- package/dist/ui/components/core/MessageHistory.d.ts.map +1 -0
- package/dist/ui/components/core/MessageHistory.js +39 -0
- package/dist/ui/components/core/MessageHistory.js.map +1 -0
- package/dist/ui/components/core/MessageInput.d.ts +10 -0
- package/dist/ui/components/core/MessageInput.d.ts.map +1 -0
- package/dist/ui/components/core/MessageInput.js +130 -0
- package/dist/ui/components/core/MessageInput.js.map +1 -0
- package/dist/ui/components/display/DiffPreview.d.ts +15 -0
- package/dist/ui/components/display/DiffPreview.d.ts.map +1 -0
- package/dist/ui/components/display/DiffPreview.js +298 -0
- package/dist/ui/components/display/DiffPreview.js.map +1 -0
- package/dist/ui/components/display/Stats.d.ts +19 -0
- package/dist/ui/components/display/Stats.d.ts.map +1 -0
- package/dist/ui/components/display/Stats.js +31 -0
- package/dist/ui/components/display/Stats.js.map +1 -0
- package/dist/ui/components/display/TokenMetrics.d.ts +11 -0
- package/dist/ui/components/display/TokenMetrics.d.ts.map +1 -0
- package/dist/ui/components/display/TokenMetrics.js +16 -0
- package/dist/ui/components/display/TokenMetrics.js.map +1 -0
- package/dist/ui/components/display/ToolHistoryItem.d.ts +7 -0
- package/dist/ui/components/display/ToolHistoryItem.d.ts.map +1 -0
- package/dist/ui/components/display/ToolHistoryItem.js +102 -0
- package/dist/ui/components/display/ToolHistoryItem.js.map +1 -0
- package/dist/ui/components/input-overlays/ErrorRetry.d.ts +8 -0
- package/dist/ui/components/input-overlays/ErrorRetry.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/ErrorRetry.js +6 -0
- package/dist/ui/components/input-overlays/ErrorRetry.js.map +1 -0
- package/dist/ui/components/input-overlays/Login.d.ts +7 -0
- package/dist/ui/components/input-overlays/Login.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/Login.js +32 -0
- package/dist/ui/components/input-overlays/Login.js.map +1 -0
- package/dist/ui/components/input-overlays/MaxIterationsContinue.d.ts +8 -0
- package/dist/ui/components/input-overlays/MaxIterationsContinue.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/MaxIterationsContinue.js +32 -0
- package/dist/ui/components/input-overlays/MaxIterationsContinue.js.map +1 -0
- package/dist/ui/components/input-overlays/ModelSelector.d.ts +12 -0
- package/dist/ui/components/input-overlays/ModelSelector.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/ModelSelector.js +114 -0
- package/dist/ui/components/input-overlays/ModelSelector.js.map +1 -0
- package/dist/ui/components/input-overlays/PendingToolApproval.d.ts +10 -0
- package/dist/ui/components/input-overlays/PendingToolApproval.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/PendingToolApproval.js +51 -0
- package/dist/ui/components/input-overlays/PendingToolApproval.js.map +1 -0
- package/dist/ui/components/input-overlays/SlashCommandSuggestions.d.ts +8 -0
- package/dist/ui/components/input-overlays/SlashCommandSuggestions.d.ts.map +1 -0
- package/dist/ui/components/input-overlays/SlashCommandSuggestions.js +13 -0
- package/dist/ui/components/input-overlays/SlashCommandSuggestions.js.map +1 -0
- package/dist/ui/hooks/useAgent.d.ts +41 -0
- package/dist/ui/hooks/useAgent.d.ts.map +1 -0
- package/dist/ui/hooks/useAgent.js +205 -0
- package/dist/ui/hooks/useAgent.js.map +1 -0
- package/dist/ui/hooks/useMouseScroll.d.ts +3 -0
- package/dist/ui/hooks/useMouseScroll.d.ts.map +1 -0
- package/dist/ui/hooks/useMouseScroll.js +32 -0
- package/dist/ui/hooks/useMouseScroll.js.map +1 -0
- package/dist/ui/hooks/useSessionStats.d.ts +20 -0
- package/dist/ui/hooks/useSessionStats.d.ts.map +1 -0
- package/dist/ui/hooks/useSessionStats.js +36 -0
- package/dist/ui/hooks/useSessionStats.js.map +1 -0
- package/dist/ui/hooks/useTokenMetrics.d.ts +21 -0
- package/dist/ui/hooks/useTokenMetrics.d.ts.map +1 -0
- package/dist/ui/hooks/useTokenMetrics.js +102 -0
- package/dist/ui/hooks/useTokenMetrics.js.map +1 -0
- package/dist/ui/utils/CodeColorizer.d.ts +5 -0
- package/dist/ui/utils/CodeColorizer.d.ts.map +1 -0
- package/dist/ui/utils/CodeColorizer.js +47 -0
- package/dist/ui/utils/CodeColorizer.js.map +1 -0
- package/dist/utils/constants.d.ts +8 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +104 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/context.d.ts +36 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +239 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/file-ops.d.ts +21 -0
- package/dist/utils/file-ops.d.ts.map +1 -0
- package/dist/utils/file-ops.js +125 -0
- package/dist/utils/file-ops.js.map +1 -0
- package/dist/utils/local-settings.d.ts +18 -0
- package/dist/utils/local-settings.d.ts.map +1 -0
- package/dist/utils/local-settings.js +176 -0
- package/dist/utils/local-settings.js.map +1 -0
- package/dist/utils/markdown.d.ts +13 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +122 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/proxy-config.d.ts +25 -0
- package/dist/utils/proxy-config.d.ts.map +1 -0
- package/dist/utils/proxy-config.js +145 -0
- package/dist/utils/proxy-config.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool schemas for Groq function calling API.
|
|
3
|
+
* These define the available tools that the LLM can call.
|
|
4
|
+
*/
|
|
5
|
+
// File Operation Tools
|
|
6
|
+
export const READ_FILE_SCHEMA = {
|
|
7
|
+
type: 'function',
|
|
8
|
+
function: {
|
|
9
|
+
name: 'read_file',
|
|
10
|
+
description: 'Read file contents with optional line range. REQUIRED before edit_file. Use to check if files exist and examine current code before making changes. Example: {"file_path": "src/app.js", "start_line": 10, "end_line": 20}',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
file_path: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Path to file. For files in current directory use just filename (e.g. "app.js"). For subdirectories use "src/app.js". DO NOT use absolute paths or leading slashes.'
|
|
17
|
+
},
|
|
18
|
+
start_line: {
|
|
19
|
+
type: 'integer',
|
|
20
|
+
description: 'Starting line number (1-indexed, optional)',
|
|
21
|
+
minimum: 1
|
|
22
|
+
},
|
|
23
|
+
end_line: {
|
|
24
|
+
type: 'integer',
|
|
25
|
+
description: 'Ending line number (1-indexed, optional)',
|
|
26
|
+
minimum: 1
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: ['file_path']
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const READ_MANY_FILES_SCHEMA = {
|
|
34
|
+
type: 'function',
|
|
35
|
+
function: {
|
|
36
|
+
name: 'read_many_files',
|
|
37
|
+
description: 'Read multiple files at once. Efficient for exploring dependencies or related files.',
|
|
38
|
+
parameters: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
file_paths: {
|
|
42
|
+
type: 'array',
|
|
43
|
+
items: { type: 'string' },
|
|
44
|
+
description: 'List of file paths to read'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
required: ['file_paths']
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const CREATE_FILE_SCHEMA = {
|
|
52
|
+
type: 'function',
|
|
53
|
+
function: {
|
|
54
|
+
name: 'create_file',
|
|
55
|
+
description: 'Create NEW files or directories that DO NOT EXIST. CRITICAL: Always check if file exists first using list_files or read_file before creating. If file exists, use edit_file instead. Set overwrite=true only if you explicitly need to replace existing content. Example: {"file_path": "src/utils/new-helper.js", "content": "function helper() { return true; }", "file_type": "file"}',
|
|
56
|
+
parameters: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
file_path: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'Path for new file/directory. For files in current directory use just filename (e.g. "app.js"). For subdirectories use "src/app.js". DO NOT use absolute paths or leading slashes.'
|
|
62
|
+
},
|
|
63
|
+
content: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'File content (use empty string "" for directories)'
|
|
66
|
+
},
|
|
67
|
+
file_type: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
enum: ['file', 'directory'],
|
|
70
|
+
description: 'Create file or directory',
|
|
71
|
+
default: 'file'
|
|
72
|
+
},
|
|
73
|
+
overwrite: {
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
description: 'Overwrite existing file',
|
|
76
|
+
default: false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
required: ['file_path', 'content']
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export const EDIT_FILE_SCHEMA = {
|
|
84
|
+
type: 'function',
|
|
85
|
+
function: {
|
|
86
|
+
name: 'edit_file',
|
|
87
|
+
description: 'Replaces text within a file. By default, replaces a single occurrence. CRITICAL: Include at least 3 lines of context BEFORE and AFTER the target text to uniquely identify it. Text must match EXACTLY including whitespace and indentation.',
|
|
88
|
+
parameters: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
file_path: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Path to the file to modify.'
|
|
94
|
+
},
|
|
95
|
+
old_string: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'The exact literal text to replace. Include context lines.'
|
|
98
|
+
},
|
|
99
|
+
new_string: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
description: 'The replacement text.'
|
|
102
|
+
},
|
|
103
|
+
expected_replacements: {
|
|
104
|
+
type: 'integer',
|
|
105
|
+
description: 'Number of replacements expected. Defaults to 1.',
|
|
106
|
+
default: 1
|
|
107
|
+
},
|
|
108
|
+
instruction: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'A clear description of WHY this change is being made.'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
required: ['file_path', 'old_string', 'new_string']
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
export const DELETE_FILE_SCHEMA = {
|
|
118
|
+
type: 'function',
|
|
119
|
+
function: {
|
|
120
|
+
name: 'delete_file',
|
|
121
|
+
description: 'Remove files or directories. Use with caution. Example: {"file_path": "temp/old_file.txt"} or {"file_path": "temp_dir", "recursive": true}',
|
|
122
|
+
parameters: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
properties: {
|
|
125
|
+
file_path: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Path to file/directory to delete. For files in current directory use just filename (e.g. "app.js"). For subdirectories use "src/app.js". DO NOT use absolute paths or leading slashes.'
|
|
128
|
+
},
|
|
129
|
+
recursive: {
|
|
130
|
+
type: 'boolean',
|
|
131
|
+
description: 'Delete directories and their contents',
|
|
132
|
+
default: false
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
required: ['file_path']
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// Code Execution Tools
|
|
140
|
+
export const EXECUTE_COMMAND_SCHEMA = {
|
|
141
|
+
type: 'function',
|
|
142
|
+
function: {
|
|
143
|
+
name: 'execute_command',
|
|
144
|
+
description: 'Run shell commands, scripts, or code. SAFETY WARNING: Only use for commands that COMPLETE and EXIT (test scripts, build commands, short-running scripts). NEVER use for commands that run indefinitely (flask server, node app starting, python -m http.server, etc.). Always prefer short-running commands that exit. Example: {"command": "npm test", "command_type": "bash"}',
|
|
145
|
+
parameters: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
command: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
description: 'Shell command to execute. Only use commands that exit/stop automatically. Examples: "python my_script.py", "npm test", "ls -la". Avoid: long-running commands, "npm start" (starts servers), etc.'
|
|
151
|
+
},
|
|
152
|
+
command_type: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
enum: ['bash', 'python', 'setup', 'run'],
|
|
155
|
+
description: 'Command type: bash (shell), python (script), setup (auto-run), run (needs approval)'
|
|
156
|
+
},
|
|
157
|
+
working_directory: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
description: 'Directory to run command in (optional)'
|
|
160
|
+
},
|
|
161
|
+
timeout: {
|
|
162
|
+
type: 'integer',
|
|
163
|
+
description: 'Max execution time in seconds (1-300)',
|
|
164
|
+
minimum: 1,
|
|
165
|
+
maximum: 300
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
required: ['command', 'command_type']
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
// Information Tools
|
|
173
|
+
export const SEARCH_FILES_SCHEMA = {
|
|
174
|
+
type: 'function',
|
|
175
|
+
function: {
|
|
176
|
+
name: 'search_files',
|
|
177
|
+
description: 'Find text patterns in files across the codebase. Perfect for locating functions, classes, or specific code. Example: {"pattern": "function handleClick", "file_pattern": "*.js", "context_lines": 3}',
|
|
178
|
+
parameters: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {
|
|
181
|
+
pattern: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
description: 'Text to search for (can be function names, classes, strings, etc.)'
|
|
184
|
+
},
|
|
185
|
+
file_pattern: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
description: 'File pattern filter (e.g., "*.py", "*.js", "src/*.ts")',
|
|
188
|
+
default: '*'
|
|
189
|
+
},
|
|
190
|
+
directory: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'Directory to search in. Use "." or "" for current directory, "src" for subdirectory. DO NOT include leading slash.',
|
|
193
|
+
default: '.'
|
|
194
|
+
},
|
|
195
|
+
case_sensitive: {
|
|
196
|
+
type: 'boolean',
|
|
197
|
+
description: 'Case-sensitive search',
|
|
198
|
+
default: false
|
|
199
|
+
},
|
|
200
|
+
pattern_type: {
|
|
201
|
+
type: 'string',
|
|
202
|
+
enum: ['substring', 'regex', 'exact', 'fuzzy'],
|
|
203
|
+
description: 'Match type: substring (partial), regex (patterns), exact (whole), fuzzy (similar)',
|
|
204
|
+
default: 'substring'
|
|
205
|
+
},
|
|
206
|
+
file_types: {
|
|
207
|
+
type: 'array',
|
|
208
|
+
items: { type: 'string' },
|
|
209
|
+
description: 'File extensions to include (["py", "js", "ts"])'
|
|
210
|
+
},
|
|
211
|
+
exclude_dirs: {
|
|
212
|
+
type: 'array',
|
|
213
|
+
items: { type: 'string' },
|
|
214
|
+
description: 'Directories to skip (["node_modules", ".git", "dist"])'
|
|
215
|
+
},
|
|
216
|
+
exclude_files: {
|
|
217
|
+
type: 'array',
|
|
218
|
+
items: { type: 'string' },
|
|
219
|
+
description: 'File patterns to skip (["*.min.js", "*.log"])'
|
|
220
|
+
},
|
|
221
|
+
max_results: {
|
|
222
|
+
type: 'integer',
|
|
223
|
+
description: 'Maximum results to return (1-1000)',
|
|
224
|
+
default: 100,
|
|
225
|
+
minimum: 1,
|
|
226
|
+
maximum: 1000
|
|
227
|
+
},
|
|
228
|
+
context_lines: {
|
|
229
|
+
type: 'integer',
|
|
230
|
+
description: 'Lines of context around matches (0-10)',
|
|
231
|
+
default: 0,
|
|
232
|
+
minimum: 0,
|
|
233
|
+
maximum: 10
|
|
234
|
+
},
|
|
235
|
+
group_by_file: {
|
|
236
|
+
type: 'boolean',
|
|
237
|
+
description: 'Group results by filename',
|
|
238
|
+
default: false
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
required: ['pattern']
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
export const LIST_FILES_SCHEMA = {
|
|
246
|
+
type: 'function',
|
|
247
|
+
function: {
|
|
248
|
+
name: 'list_files',
|
|
249
|
+
description: 'Browse directory contents and file structure. Use to explore project layout and CHECK IF FILES EXIST before deciding between create_file vs edit_file. Example: {"directory": "src", "pattern": "*.js", "recursive": true}',
|
|
250
|
+
parameters: {
|
|
251
|
+
type: 'object',
|
|
252
|
+
properties: {
|
|
253
|
+
directory: {
|
|
254
|
+
type: 'string',
|
|
255
|
+
description: 'Directory path to list. Use "." or "" for current directory, "src" for subdirectory. DO NOT include leading slash.',
|
|
256
|
+
default: '.'
|
|
257
|
+
},
|
|
258
|
+
pattern: {
|
|
259
|
+
type: 'string',
|
|
260
|
+
description: 'File pattern filter ("*.py", "test_*", etc.)',
|
|
261
|
+
default: '*'
|
|
262
|
+
},
|
|
263
|
+
recursive: {
|
|
264
|
+
type: 'boolean',
|
|
265
|
+
description: 'List subdirectories recursively',
|
|
266
|
+
default: false
|
|
267
|
+
},
|
|
268
|
+
show_hidden: {
|
|
269
|
+
type: 'boolean',
|
|
270
|
+
description: 'Include hidden files (.gitignore, .env, etc.)',
|
|
271
|
+
default: false
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
required: []
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// Task Management Tools
|
|
279
|
+
export const CREATE_TASKS_SCHEMA = {
|
|
280
|
+
type: 'function',
|
|
281
|
+
function: {
|
|
282
|
+
name: 'create_tasks',
|
|
283
|
+
description: 'Break down complex requests into organized task lists. Use for multi-step projects. Example: {"user_query": "Build login system", "tasks": [{"id": "1", "description": "Create user model", "status": "pending"}]}',
|
|
284
|
+
parameters: {
|
|
285
|
+
type: 'object',
|
|
286
|
+
properties: {
|
|
287
|
+
user_query: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
description: 'Original user request being broken down'
|
|
290
|
+
},
|
|
291
|
+
tasks: {
|
|
292
|
+
type: 'array',
|
|
293
|
+
description: 'List of actionable subtasks',
|
|
294
|
+
items: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
id: {
|
|
298
|
+
type: 'string',
|
|
299
|
+
description: 'Unique task identifier string (e.g., "1", "2", "3")'
|
|
300
|
+
},
|
|
301
|
+
description: {
|
|
302
|
+
type: 'string',
|
|
303
|
+
description: 'Clear, actionable task description'
|
|
304
|
+
},
|
|
305
|
+
status: {
|
|
306
|
+
type: 'string',
|
|
307
|
+
enum: ['pending', 'in_progress', 'completed'],
|
|
308
|
+
description: 'Task status: pending, in_progress, or completed',
|
|
309
|
+
default: 'pending'
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
required: ['id', 'description']
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
required: ['user_query', 'tasks']
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
export const UPDATE_TASKS_SCHEMA = {
|
|
321
|
+
type: 'function',
|
|
322
|
+
function: {
|
|
323
|
+
name: 'update_tasks',
|
|
324
|
+
description: 'Update task progress and status. Use to mark tasks as started or completed. Example: {"task_updates": [{"id": "1", "status": "completed", "notes": "Successfully implemented"}]}',
|
|
325
|
+
parameters: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {
|
|
328
|
+
task_updates: {
|
|
329
|
+
type: 'array',
|
|
330
|
+
description: 'Array of status updates for specific tasks',
|
|
331
|
+
items: {
|
|
332
|
+
type: 'object',
|
|
333
|
+
properties: {
|
|
334
|
+
id: {
|
|
335
|
+
type: 'string',
|
|
336
|
+
description: 'ID string of task to update (must match existing task ID)'
|
|
337
|
+
},
|
|
338
|
+
status: {
|
|
339
|
+
type: 'string',
|
|
340
|
+
enum: ['pending', 'in_progress', 'completed'],
|
|
341
|
+
description: 'New status: pending, in_progress, or completed'
|
|
342
|
+
},
|
|
343
|
+
notes: {
|
|
344
|
+
type: 'string',
|
|
345
|
+
description: 'Optional progress notes or completion details'
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
required: ['id', 'status']
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
required: ['task_updates']
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
export const GREP_SCHEMA = {
|
|
357
|
+
type: 'function',
|
|
358
|
+
function: {
|
|
359
|
+
name: 'grep',
|
|
360
|
+
description: 'FAST, optimized search powered by `ripgrep`. Returns matches with context. Preferred over search_files for large codebases.',
|
|
361
|
+
parameters: {
|
|
362
|
+
type: 'object',
|
|
363
|
+
properties: {
|
|
364
|
+
pattern: { type: 'string', description: 'The pattern to search for (regex by default).' },
|
|
365
|
+
include: { type: 'string', description: 'Glob pattern to filter files (e.g., "*.ts", "src/**").' },
|
|
366
|
+
context: { type: 'integer', description: 'Lines of context around each match.', default: 2 },
|
|
367
|
+
case_sensitive: { type: 'boolean', description: 'Case-sensitive search.', default: false },
|
|
368
|
+
dir_path: { type: 'string', description: 'Directory to search in. Defaults to current directory.', default: '.' },
|
|
369
|
+
fixed_strings: { type: 'boolean', description: 'Treat pattern as a literal string.', default: false }
|
|
370
|
+
},
|
|
371
|
+
required: ['pattern']
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
export const GLOB_SCHEMA = {
|
|
376
|
+
type: 'function',
|
|
377
|
+
function: {
|
|
378
|
+
name: 'glob',
|
|
379
|
+
description: 'Trouve des fichiers correspondant à un pattern glob spécifique (ex: "**/*.md", "src/ui/*.tsx"). Très utile pour localiser des fichiers sans lister tous les répertoires.',
|
|
380
|
+
parameters: {
|
|
381
|
+
type: 'object',
|
|
382
|
+
properties: {
|
|
383
|
+
pattern: { type: 'string', description: 'Le pattern glob (ex: "src/**/*.ts")' }
|
|
384
|
+
},
|
|
385
|
+
required: ['pattern']
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
export const SAVE_MEMORY_SCHEMA = {
|
|
390
|
+
type: 'function',
|
|
391
|
+
function: {
|
|
392
|
+
name: 'save_memory',
|
|
393
|
+
description: 'Enregistre une information cruciale dans la mémoire à long terme du projet (SORY.md). À utiliser quand l\'utilisateur donne une instruction importante pour le futur ou un fait technique clé.',
|
|
394
|
+
parameters: {
|
|
395
|
+
type: 'object',
|
|
396
|
+
properties: {
|
|
397
|
+
fact: { type: 'string', description: 'Le fait ou l\'instruction à mémoriser (ex: "Le serveur tourne sur le port 4000")' }
|
|
398
|
+
},
|
|
399
|
+
required: ['fact']
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
export const GOOGLE_WEB_SEARCH_SCHEMA = {
|
|
404
|
+
type: 'function',
|
|
405
|
+
function: {
|
|
406
|
+
name: 'google_web_search',
|
|
407
|
+
description: 'Recherche multi-sources (GitHub, NPM, PyPI, Wikipedia, Web). L\'outil détecte intelligemment la source, mais tu peux forcer une source spécifique.',
|
|
408
|
+
parameters: {
|
|
409
|
+
type: 'object',
|
|
410
|
+
properties: {
|
|
411
|
+
query: {
|
|
412
|
+
type: 'string',
|
|
413
|
+
description: 'La requête de recherche (ex: "OpenCode CLI")'
|
|
414
|
+
},
|
|
415
|
+
source: {
|
|
416
|
+
type: 'string',
|
|
417
|
+
enum: ['auto', 'github', 'npm', 'pypi', 'wikipedia', 'web'],
|
|
418
|
+
description: 'Optionnel. Force la source de recherche. "github" pour les repos/versions, "npm" pour les outils JS, "wikipedia" pour les définitions.',
|
|
419
|
+
default: 'auto'
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
required: ['query']
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
export const WEB_FETCH_SCHEMA = {
|
|
427
|
+
type: 'function',
|
|
428
|
+
function: {
|
|
429
|
+
name: 'web_fetch',
|
|
430
|
+
description: 'Lit le contenu textuel d\'une page web à partir d\'une URL. Utile pour lire une documentation ou un article de blog trouvé via la recherche.',
|
|
431
|
+
parameters: {
|
|
432
|
+
type: 'object',
|
|
433
|
+
properties: {
|
|
434
|
+
url: { type: 'string', description: 'L\'URL de la page à lire (commençant par http ou https)' }
|
|
435
|
+
},
|
|
436
|
+
required: ['url']
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
// All tools combined
|
|
441
|
+
export const ALL_TOOL_SCHEMAS = [
|
|
442
|
+
READ_FILE_SCHEMA,
|
|
443
|
+
READ_MANY_FILES_SCHEMA,
|
|
444
|
+
CREATE_FILE_SCHEMA,
|
|
445
|
+
EDIT_FILE_SCHEMA,
|
|
446
|
+
DELETE_FILE_SCHEMA,
|
|
447
|
+
SEARCH_FILES_SCHEMA,
|
|
448
|
+
LIST_FILES_SCHEMA,
|
|
449
|
+
CREATE_TASKS_SCHEMA,
|
|
450
|
+
UPDATE_TASKS_SCHEMA,
|
|
451
|
+
EXECUTE_COMMAND_SCHEMA,
|
|
452
|
+
GREP_SCHEMA,
|
|
453
|
+
GLOB_SCHEMA,
|
|
454
|
+
SAVE_MEMORY_SCHEMA,
|
|
455
|
+
GOOGLE_WEB_SEARCH_SCHEMA,
|
|
456
|
+
WEB_FETCH_SCHEMA
|
|
457
|
+
];
|
|
458
|
+
// Safe tools that can be auto-executed without approval
|
|
459
|
+
export const SAFE_TOOLS = [
|
|
460
|
+
'read_file',
|
|
461
|
+
'read_many_files',
|
|
462
|
+
'list_files',
|
|
463
|
+
'search_files',
|
|
464
|
+
'create_tasks',
|
|
465
|
+
'update_tasks',
|
|
466
|
+
'grep',
|
|
467
|
+
'glob',
|
|
468
|
+
'save_memory',
|
|
469
|
+
'google_web_search',
|
|
470
|
+
'web_fetch'
|
|
471
|
+
];
|
|
472
|
+
// Tools that require approval, unless auto-approval is enabled
|
|
473
|
+
export const APPROVAL_REQUIRED_TOOLS = [
|
|
474
|
+
'create_file',
|
|
475
|
+
'edit_file',
|
|
476
|
+
];
|
|
477
|
+
// Dangerous tools that always require approval
|
|
478
|
+
export const DANGEROUS_TOOLS = [
|
|
479
|
+
'delete_file',
|
|
480
|
+
'execute_command'
|
|
481
|
+
];
|
|
482
|
+
//# sourceMappingURL=tool-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.js","sourceRoot":"","sources":["../../src/tools/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,uBAAuB;AAEvB,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,4NAA4N;QACzO,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oKAAoK;iBAClL;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,4CAA4C;oBACzD,OAAO,EAAE,CAAC;iBACX;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,0CAA0C;oBACvD,OAAO,EAAE,CAAC;iBACX;aACF;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAe;IAChD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,qFAAqF;QAClG,UAAU,EAA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SACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,8IAA8I;QAC3J,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yDAAyD,EAAE;aAChG;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;KACF;CACF,CAAC;AAEF,qBAAqB;AACrB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;IACnB,sBAAsB;IACtB,WAAW;IACX,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,gBAAgB;CACjB,CAAC;AAEF,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,MAAM;IACN,MAAM;IACN,aAAa;IACb,mBAAmB;IACnB,WAAW;CACZ,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,aAAa;IACb,WAAW;CACZ,CAAC;AAEF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface ToolResult {
|
|
2
|
+
success: boolean;
|
|
3
|
+
content?: any;
|
|
4
|
+
data?: any;
|
|
5
|
+
message?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
interface TaskUpdate {
|
|
9
|
+
id: string;
|
|
10
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
11
|
+
notes?: string;
|
|
12
|
+
}
|
|
13
|
+
interface Task {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string;
|
|
16
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
17
|
+
notes?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getReadFilesTracker(): Set<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Format key parameters for tool call display
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatToolParams(toolName: string, toolArgs: Record<string, any>, options?: {
|
|
25
|
+
includePrefix?: boolean;
|
|
26
|
+
separator?: string;
|
|
27
|
+
}): string;
|
|
28
|
+
/**
|
|
29
|
+
* Create a standardized tool response format
|
|
30
|
+
*/
|
|
31
|
+
export declare function createToolResponse(success: boolean, data?: any, message?: string, error?: string): ToolResult;
|
|
32
|
+
/**
|
|
33
|
+
* Read the contents of a file, optionally specifying line range
|
|
34
|
+
*/
|
|
35
|
+
export declare function readFile(filePath: string, startLine?: number, endLine?: number): Promise<ToolResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Read multiple files at once
|
|
38
|
+
*/
|
|
39
|
+
export declare function readManyFiles(filePaths: string[]): Promise<ToolResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new file or directory with specified content
|
|
42
|
+
*/
|
|
43
|
+
export declare function createFile(filePath: string, content: string, fileType?: string, overwrite?: boolean): Promise<ToolResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Edit a file by replacing text strings using multiple strategies (exact, flexible, regex)
|
|
46
|
+
*/
|
|
47
|
+
export declare function editFile(filePath: string, oldString: string, newString: string, expectedReplacements?: number): Promise<ToolResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a file or directory with safety checks
|
|
50
|
+
*/
|
|
51
|
+
export declare function deleteFile(filePath: string, recursive?: boolean): Promise<ToolResult>;
|
|
52
|
+
/**
|
|
53
|
+
* List files and directories in a path with tree-style display
|
|
54
|
+
*/
|
|
55
|
+
export declare function listFiles(directory?: string, pattern?: string, recursive?: boolean, showHidden?: boolean): Promise<ToolResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Search for text patterns in files with advanced filtering and matching options
|
|
58
|
+
*/
|
|
59
|
+
export declare function searchFiles(pattern: string, filePattern?: string, directory?: string, caseSensitive?: boolean, patternType?: 'substring' | 'regex' | 'exact' | 'fuzzy', fileTypes?: string[], excludeDirs?: string[], excludeFiles?: string[], maxResults?: number, contextLines?: number, groupByFile?: boolean): Promise<ToolResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Execute a shell command or run code
|
|
62
|
+
*/
|
|
63
|
+
export declare function executeCommand(command: string, commandType: string, workingDirectory?: string, timeout?: number): Promise<ToolResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Create a task list of subtasks to complete the user's request
|
|
66
|
+
*/
|
|
67
|
+
export declare function createTasks(userQuery: string, tasks: Task[]): Promise<ToolResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Update the status of one or more tasks in the task list
|
|
70
|
+
*/
|
|
71
|
+
export declare function updateTasks(taskUpdates: TaskUpdate[]): Promise<ToolResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Find files matching a glob pattern
|
|
74
|
+
*/
|
|
75
|
+
export declare function glob(pattern: string): Promise<ToolResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Search text in files using ripgrep
|
|
78
|
+
*/
|
|
79
|
+
export declare function grep(pattern: string, include?: string, context?: number, caseSensitive?: boolean, directory?: string, fixedStrings?: boolean): Promise<ToolResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Save a fact to the project's long-term memory (SORY.md)
|
|
82
|
+
*/
|
|
83
|
+
export declare function saveMemory(fact: string): Promise<ToolResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Search the web using multiple sources with technical prioritization and manual override
|
|
86
|
+
*/
|
|
87
|
+
export declare function googleWebSearch(query: string, source?: 'auto' | 'github' | 'npm' | 'pypi' | 'wikipedia' | 'web'): Promise<ToolResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Fetch and extract text from a website
|
|
90
|
+
*/
|
|
91
|
+
export declare function webFetch(url: string): Promise<ToolResult>;
|
|
92
|
+
export declare const TOOL_REGISTRY: {
|
|
93
|
+
read_file: typeof readFile;
|
|
94
|
+
create_file: typeof createFile;
|
|
95
|
+
edit_file: typeof editFile;
|
|
96
|
+
delete_file: typeof deleteFile;
|
|
97
|
+
list_files: typeof listFiles;
|
|
98
|
+
search_files: typeof searchFiles;
|
|
99
|
+
execute_command: typeof executeCommand;
|
|
100
|
+
create_tasks: typeof createTasks;
|
|
101
|
+
update_tasks: typeof updateTasks;
|
|
102
|
+
grep: typeof grep;
|
|
103
|
+
glob: typeof glob;
|
|
104
|
+
read_many_files: typeof readManyFiles;
|
|
105
|
+
save_memory: typeof saveMemory;
|
|
106
|
+
google_web_search: typeof googleWebSearch;
|
|
107
|
+
web_fetch: typeof webFetch;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Execute a tool by name with given arguments
|
|
111
|
+
*/
|
|
112
|
+
export declare function executeTool(toolName: string, toolArgs: Record<string, any>): Promise<ToolResult>;
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,IAAI;IACZ,E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