snow-ai 0.2.18 → 0.2.19
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/dist/api/systemPrompt.d.ts +1 -1
- package/dist/api/systemPrompt.js +87 -25
- package/dist/hooks/useConversation.js +5 -2
- package/dist/mcp/aceCodeSearch.d.ts +314 -0
- package/dist/mcp/aceCodeSearch.js +822 -0
- package/dist/mcp/filesystem.d.ts +65 -77
- package/dist/mcp/filesystem.js +286 -144
- package/dist/ui/components/DiffViewer.d.ts +2 -1
- package/dist/ui/components/DiffViewer.js +33 -16
- package/dist/ui/components/ToolConfirmation.js +9 -0
- package/dist/ui/components/ToolResultPreview.js +146 -24
- package/dist/ui/pages/ChatScreen.js +6 -1
- package/dist/utils/mcpToolsManager.js +54 -9
- package/dist/utils/sessionConverter.js +8 -2
- package/package.json +1 -1
package/dist/mcp/filesystem.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { type Diagnostic } from '../utils/vscodeConnection.js';
|
|
2
|
-
interface SearchMatch {
|
|
3
|
-
filePath: string;
|
|
4
|
-
lineNumber: number;
|
|
5
|
-
lineContent: string;
|
|
6
|
-
column: number;
|
|
7
|
-
matchedText?: string;
|
|
8
|
-
}
|
|
9
|
-
interface SearchResult {
|
|
10
|
-
query: string;
|
|
11
|
-
totalMatches: number;
|
|
12
|
-
matches: SearchMatch[];
|
|
13
|
-
searchedFiles: number;
|
|
14
|
-
}
|
|
15
2
|
interface StructureAnalysis {
|
|
16
3
|
bracketBalance: {
|
|
17
4
|
curly: {
|
|
@@ -47,6 +34,10 @@ interface StructureAnalysis {
|
|
|
47
34
|
*/
|
|
48
35
|
export declare class FilesystemMCPService {
|
|
49
36
|
private basePath;
|
|
37
|
+
/**
|
|
38
|
+
* File extensions supported by Prettier for automatic formatting
|
|
39
|
+
*/
|
|
40
|
+
private readonly prettierSupportedExtensions;
|
|
50
41
|
constructor(basePath?: string);
|
|
51
42
|
/**
|
|
52
43
|
* Analyze code structure for balance and completeness
|
|
@@ -114,6 +105,35 @@ export declare class FilesystemMCPService {
|
|
|
114
105
|
modified: Date;
|
|
115
106
|
created: Date;
|
|
116
107
|
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Edit a file by searching for exact content and replacing it
|
|
110
|
+
* This method is SAFER than line-based editing as it automatically handles code boundaries.
|
|
111
|
+
*
|
|
112
|
+
* @param filePath - Path to the file to edit
|
|
113
|
+
* @param searchContent - Exact content to search for (must match precisely, including whitespace)
|
|
114
|
+
* @param replaceContent - New content to replace the search content with
|
|
115
|
+
* @param occurrence - Which occurrence to replace (1-indexed, default: 1, use -1 for all)
|
|
116
|
+
* @param contextLines - Number of context lines to return before and after the edit (default: 8)
|
|
117
|
+
* @returns Object containing success message, before/after comparison, and diagnostics
|
|
118
|
+
* @throws Error if search content is not found or multiple matches exist
|
|
119
|
+
*/
|
|
120
|
+
editFileBySearch(filePath: string, searchContent: string, replaceContent: string, occurrence?: number, contextLines?: number): Promise<{
|
|
121
|
+
message: string;
|
|
122
|
+
oldContent: string;
|
|
123
|
+
newContent: string;
|
|
124
|
+
replacedContent: string;
|
|
125
|
+
matchLocation: {
|
|
126
|
+
startLine: number;
|
|
127
|
+
endLine: number;
|
|
128
|
+
};
|
|
129
|
+
contextStartLine: number;
|
|
130
|
+
contextEndLine: number;
|
|
131
|
+
totalLines: number;
|
|
132
|
+
structureAnalysis?: StructureAnalysis;
|
|
133
|
+
diagnostics?: Diagnostic[];
|
|
134
|
+
completeOldContent?: string;
|
|
135
|
+
completeNewContent?: string;
|
|
136
|
+
}>;
|
|
117
137
|
/**
|
|
118
138
|
* Edit a file by replacing lines within a specified range
|
|
119
139
|
* BEST PRACTICE: Keep edits small and focused (≤15 lines recommended) for better accuracy.
|
|
@@ -141,16 +161,6 @@ export declare class FilesystemMCPService {
|
|
|
141
161
|
completeOldContent?: string;
|
|
142
162
|
completeNewContent?: string;
|
|
143
163
|
}>;
|
|
144
|
-
/**
|
|
145
|
-
* Search for code keywords in files within a directory
|
|
146
|
-
* @param query - Search keyword or pattern
|
|
147
|
-
* @param dirPath - Directory to search in (default: current directory)
|
|
148
|
-
* @param fileExtensions - Array of file extensions to search (e.g., ['.ts', '.tsx', '.js']). If empty, search all files.
|
|
149
|
-
* @param caseSensitive - Whether the search should be case-sensitive (default: false)
|
|
150
|
-
* @param maxResults - Maximum number of results to return (default: 100)
|
|
151
|
-
* @returns Search results with file paths, line numbers, and matched content
|
|
152
|
-
*/
|
|
153
|
-
searchCode(query: string, dirPath?: string, fileExtensions?: string[], caseSensitive?: boolean, maxResults?: number, searchMode?: 'text' | 'regex'): Promise<SearchResult>;
|
|
154
164
|
/**
|
|
155
165
|
* Resolve path relative to base path and normalize it
|
|
156
166
|
* @private
|
|
@@ -185,13 +195,11 @@ export declare const mcpTools: ({
|
|
|
185
195
|
createDirectories?: undefined;
|
|
186
196
|
filePaths?: undefined;
|
|
187
197
|
dirPath?: undefined;
|
|
188
|
-
|
|
198
|
+
searchContent?: undefined;
|
|
199
|
+
replaceContent?: undefined;
|
|
200
|
+
occurrence?: undefined;
|
|
189
201
|
contextLines?: undefined;
|
|
190
|
-
|
|
191
|
-
fileExtensions?: undefined;
|
|
192
|
-
caseSensitive?: undefined;
|
|
193
|
-
maxResults?: undefined;
|
|
194
|
-
searchMode?: undefined;
|
|
202
|
+
newContent?: undefined;
|
|
195
203
|
};
|
|
196
204
|
required: string[];
|
|
197
205
|
};
|
|
@@ -218,13 +226,11 @@ export declare const mcpTools: ({
|
|
|
218
226
|
endLine?: undefined;
|
|
219
227
|
filePaths?: undefined;
|
|
220
228
|
dirPath?: undefined;
|
|
221
|
-
|
|
229
|
+
searchContent?: undefined;
|
|
230
|
+
replaceContent?: undefined;
|
|
231
|
+
occurrence?: undefined;
|
|
222
232
|
contextLines?: undefined;
|
|
223
|
-
|
|
224
|
-
fileExtensions?: undefined;
|
|
225
|
-
caseSensitive?: undefined;
|
|
226
|
-
maxResults?: undefined;
|
|
227
|
-
searchMode?: undefined;
|
|
233
|
+
newContent?: undefined;
|
|
228
234
|
};
|
|
229
235
|
required: string[];
|
|
230
236
|
};
|
|
@@ -257,13 +263,11 @@ export declare const mcpTools: ({
|
|
|
257
263
|
content?: undefined;
|
|
258
264
|
createDirectories?: undefined;
|
|
259
265
|
dirPath?: undefined;
|
|
260
|
-
|
|
266
|
+
searchContent?: undefined;
|
|
267
|
+
replaceContent?: undefined;
|
|
268
|
+
occurrence?: undefined;
|
|
261
269
|
contextLines?: undefined;
|
|
262
|
-
|
|
263
|
-
fileExtensions?: undefined;
|
|
264
|
-
caseSensitive?: undefined;
|
|
265
|
-
maxResults?: undefined;
|
|
266
|
-
searchMode?: undefined;
|
|
270
|
+
newContent?: undefined;
|
|
267
271
|
};
|
|
268
272
|
required?: undefined;
|
|
269
273
|
};
|
|
@@ -284,13 +288,11 @@ export declare const mcpTools: ({
|
|
|
284
288
|
content?: undefined;
|
|
285
289
|
createDirectories?: undefined;
|
|
286
290
|
filePaths?: undefined;
|
|
287
|
-
|
|
291
|
+
searchContent?: undefined;
|
|
292
|
+
replaceContent?: undefined;
|
|
293
|
+
occurrence?: undefined;
|
|
288
294
|
contextLines?: undefined;
|
|
289
|
-
|
|
290
|
-
fileExtensions?: undefined;
|
|
291
|
-
caseSensitive?: undefined;
|
|
292
|
-
maxResults?: undefined;
|
|
293
|
-
searchMode?: undefined;
|
|
295
|
+
newContent?: undefined;
|
|
294
296
|
};
|
|
295
297
|
required?: undefined;
|
|
296
298
|
};
|
|
@@ -304,32 +306,31 @@ export declare const mcpTools: ({
|
|
|
304
306
|
type: string;
|
|
305
307
|
description: string;
|
|
306
308
|
};
|
|
307
|
-
|
|
309
|
+
searchContent: {
|
|
308
310
|
type: string;
|
|
309
311
|
description: string;
|
|
310
312
|
};
|
|
311
|
-
|
|
313
|
+
replaceContent: {
|
|
312
314
|
type: string;
|
|
313
315
|
description: string;
|
|
314
316
|
};
|
|
315
|
-
|
|
317
|
+
occurrence: {
|
|
316
318
|
type: string;
|
|
317
319
|
description: string;
|
|
320
|
+
default: number;
|
|
318
321
|
};
|
|
319
322
|
contextLines: {
|
|
320
323
|
type: string;
|
|
321
324
|
description: string;
|
|
322
325
|
default: number;
|
|
323
326
|
};
|
|
327
|
+
startLine?: undefined;
|
|
328
|
+
endLine?: undefined;
|
|
324
329
|
content?: undefined;
|
|
325
330
|
createDirectories?: undefined;
|
|
326
331
|
filePaths?: undefined;
|
|
327
332
|
dirPath?: undefined;
|
|
328
|
-
|
|
329
|
-
fileExtensions?: undefined;
|
|
330
|
-
caseSensitive?: undefined;
|
|
331
|
-
maxResults?: undefined;
|
|
332
|
-
searchMode?: undefined;
|
|
333
|
+
newContent?: undefined;
|
|
333
334
|
};
|
|
334
335
|
required: string[];
|
|
335
336
|
};
|
|
@@ -339,47 +340,34 @@ export declare const mcpTools: ({
|
|
|
339
340
|
inputSchema: {
|
|
340
341
|
type: string;
|
|
341
342
|
properties: {
|
|
342
|
-
|
|
343
|
+
filePath: {
|
|
343
344
|
type: string;
|
|
344
345
|
description: string;
|
|
345
346
|
};
|
|
346
|
-
|
|
347
|
+
startLine: {
|
|
347
348
|
type: string;
|
|
348
349
|
description: string;
|
|
349
|
-
default: string;
|
|
350
350
|
};
|
|
351
|
-
|
|
351
|
+
endLine: {
|
|
352
352
|
type: string;
|
|
353
|
-
items: {
|
|
354
|
-
type: string;
|
|
355
|
-
};
|
|
356
353
|
description: string;
|
|
357
|
-
default: never[];
|
|
358
354
|
};
|
|
359
|
-
|
|
355
|
+
newContent: {
|
|
360
356
|
type: string;
|
|
361
357
|
description: string;
|
|
362
|
-
default: boolean;
|
|
363
358
|
};
|
|
364
|
-
|
|
359
|
+
contextLines: {
|
|
365
360
|
type: string;
|
|
366
361
|
description: string;
|
|
367
362
|
default: number;
|
|
368
363
|
};
|
|
369
|
-
searchMode: {
|
|
370
|
-
type: string;
|
|
371
|
-
enum: string[];
|
|
372
|
-
description: string;
|
|
373
|
-
default: string;
|
|
374
|
-
};
|
|
375
|
-
filePath?: undefined;
|
|
376
|
-
startLine?: undefined;
|
|
377
|
-
endLine?: undefined;
|
|
378
364
|
content?: undefined;
|
|
379
365
|
createDirectories?: undefined;
|
|
380
366
|
filePaths?: undefined;
|
|
381
|
-
|
|
382
|
-
|
|
367
|
+
dirPath?: undefined;
|
|
368
|
+
searchContent?: undefined;
|
|
369
|
+
replaceContent?: undefined;
|
|
370
|
+
occurrence?: undefined;
|
|
383
371
|
};
|
|
384
372
|
required: string[];
|
|
385
373
|
};
|