snow-ai 0.2.14 → 0.2.16
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/anthropic.d.ts +1 -1
- package/dist/api/anthropic.js +52 -76
- package/dist/api/chat.d.ts +4 -4
- package/dist/api/chat.js +32 -17
- package/dist/api/gemini.d.ts +1 -1
- package/dist/api/gemini.js +20 -13
- package/dist/api/responses.d.ts +5 -5
- package/dist/api/responses.js +29 -27
- package/dist/app.js +4 -1
- package/dist/hooks/useClipboard.d.ts +4 -0
- package/dist/hooks/useClipboard.js +120 -0
- package/dist/hooks/useCommandHandler.d.ts +26 -0
- package/dist/hooks/useCommandHandler.js +158 -0
- package/dist/hooks/useCommandPanel.d.ts +16 -0
- package/dist/hooks/useCommandPanel.js +53 -0
- package/dist/hooks/useConversation.d.ts +9 -1
- package/dist/hooks/useConversation.js +152 -58
- package/dist/hooks/useFilePicker.d.ts +17 -0
- package/dist/hooks/useFilePicker.js +91 -0
- package/dist/hooks/useHistoryNavigation.d.ts +21 -0
- package/dist/hooks/useHistoryNavigation.js +50 -0
- package/dist/hooks/useInputBuffer.d.ts +6 -0
- package/dist/hooks/useInputBuffer.js +29 -0
- package/dist/hooks/useKeyboardInput.d.ts +51 -0
- package/dist/hooks/useKeyboardInput.js +272 -0
- package/dist/hooks/useSnapshotState.d.ts +12 -0
- package/dist/hooks/useSnapshotState.js +28 -0
- package/dist/hooks/useStreamingState.d.ts +24 -0
- package/dist/hooks/useStreamingState.js +96 -0
- package/dist/hooks/useVSCodeState.d.ts +8 -0
- package/dist/hooks/useVSCodeState.js +63 -0
- package/dist/mcp/filesystem.d.ts +25 -9
- package/dist/mcp/filesystem.js +56 -51
- package/dist/mcp/todo.js +4 -8
- package/dist/ui/components/ChatInput.js +68 -557
- package/dist/ui/components/DiffViewer.js +57 -30
- package/dist/ui/components/FileList.js +70 -26
- package/dist/ui/components/MessageList.d.ts +6 -0
- package/dist/ui/components/MessageList.js +47 -15
- package/dist/ui/components/ShimmerText.d.ts +9 -0
- package/dist/ui/components/ShimmerText.js +30 -0
- package/dist/ui/components/TodoTree.d.ts +1 -1
- package/dist/ui/components/TodoTree.js +0 -4
- package/dist/ui/components/ToolConfirmation.js +14 -6
- package/dist/ui/pages/ChatScreen.js +159 -359
- package/dist/ui/pages/CustomHeadersScreen.d.ts +6 -0
- package/dist/ui/pages/CustomHeadersScreen.js +104 -0
- package/dist/ui/pages/WelcomeScreen.js +5 -0
- package/dist/utils/apiConfig.d.ts +10 -0
- package/dist/utils/apiConfig.js +51 -0
- package/dist/utils/incrementalSnapshot.d.ts +8 -0
- package/dist/utils/incrementalSnapshot.js +63 -0
- package/dist/utils/mcpToolsManager.js +8 -3
- package/dist/utils/retryUtils.d.ts +22 -0
- package/dist/utils/retryUtils.js +180 -0
- package/dist/utils/sessionConverter.js +80 -17
- package/dist/utils/sessionManager.js +35 -4
- package/dist/utils/textUtils.d.ts +4 -0
- package/dist/utils/textUtils.js +19 -0
- package/dist/utils/todoPreprocessor.d.ts +1 -1
- package/dist/utils/todoPreprocessor.js +0 -1
- package/dist/utils/vscodeConnection.d.ts +8 -0
- package/dist/utils/vscodeConnection.js +44 -0
- package/package.json +1 -13
- package/readme.md +6 -2
- package/dist/mcp/multiLanguageASTParser.d.ts +0 -67
- package/dist/mcp/multiLanguageASTParser.js +0 -360
package/dist/mcp/filesystem.js
CHANGED
|
@@ -3,7 +3,6 @@ import * as path from 'path';
|
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import { vscodeConnection } from '../utils/vscodeConnection.js';
|
|
5
5
|
import { incrementalSnapshotManager } from '../utils/incrementalSnapshot.js';
|
|
6
|
-
import { multiLanguageASTParser } from './multiLanguageASTParser.js';
|
|
7
6
|
const { resolve, dirname, isAbsolute } = path;
|
|
8
7
|
/**
|
|
9
8
|
* Filesystem MCP Service
|
|
@@ -301,26 +300,45 @@ export class FilesystemMCPService {
|
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
302
|
/**
|
|
304
|
-
* Delete
|
|
305
|
-
* @param
|
|
306
|
-
* @returns Success message
|
|
303
|
+
* Delete one or multiple files
|
|
304
|
+
* @param filePaths - Single file path or array of file paths to delete
|
|
305
|
+
* @returns Success message with details
|
|
307
306
|
* @throws Error if file deletion fails
|
|
308
307
|
*/
|
|
309
|
-
async deleteFile(
|
|
308
|
+
async deleteFile(filePaths) {
|
|
310
309
|
try {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
const paths = Array.isArray(filePaths) ? filePaths : [filePaths];
|
|
311
|
+
const results = [];
|
|
312
|
+
const errors = [];
|
|
313
|
+
for (const filePath of paths) {
|
|
314
|
+
try {
|
|
315
|
+
const fullPath = this.resolvePath(filePath);
|
|
316
|
+
await this.validatePath(fullPath);
|
|
317
|
+
const stats = await fs.stat(fullPath);
|
|
318
|
+
if (!stats.isFile()) {
|
|
319
|
+
throw new Error(`Path is not a file: ${filePath}`);
|
|
320
|
+
}
|
|
321
|
+
// Backup file before deletion
|
|
322
|
+
await incrementalSnapshotManager.backupFile(fullPath);
|
|
323
|
+
await fs.unlink(fullPath);
|
|
324
|
+
results.push(`✅ ${filePath}`);
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
328
|
+
errors.push(`❌ ${filePath}: ${errorMsg}`);
|
|
329
|
+
}
|
|
316
330
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
331
|
+
const summary = [];
|
|
332
|
+
if (results.length > 0) {
|
|
333
|
+
summary.push(`Successfully deleted ${results.length} file(s):\n${results.join('\n')}`);
|
|
334
|
+
}
|
|
335
|
+
if (errors.length > 0) {
|
|
336
|
+
summary.push(`Failed to delete ${errors.length} file(s):\n${errors.join('\n')}`);
|
|
337
|
+
}
|
|
338
|
+
return summary.join('\n\n');
|
|
321
339
|
}
|
|
322
340
|
catch (error) {
|
|
323
|
-
throw new Error(`Failed to delete
|
|
341
|
+
throw new Error(`Failed to delete files: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
324
342
|
}
|
|
325
343
|
}
|
|
326
344
|
/**
|
|
@@ -660,37 +678,8 @@ export class FilesystemMCPService {
|
|
|
660
678
|
searchedFiles++;
|
|
661
679
|
try {
|
|
662
680
|
const content = await fs.readFile(fullPath, 'utf-8');
|
|
663
|
-
//
|
|
664
|
-
if (
|
|
665
|
-
// Check if file is supported for AST parsing
|
|
666
|
-
if (multiLanguageASTParser.isSupported(fullPath)) {
|
|
667
|
-
try {
|
|
668
|
-
const astResults = multiLanguageASTParser.searchAST(content, fullPath, query, caseSensitive);
|
|
669
|
-
for (const result of astResults) {
|
|
670
|
-
if (matches.length >= maxResults) {
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
const lineContent = content.split('\n')[result.startPosition.line - 1] ||
|
|
674
|
-
'';
|
|
675
|
-
matches.push({
|
|
676
|
-
filePath: path.relative(this.basePath, fullPath),
|
|
677
|
-
lineNumber: result.startPosition.line,
|
|
678
|
-
lineContent: lineContent.trim(),
|
|
679
|
-
column: result.startPosition.column,
|
|
680
|
-
matchedText: result.name,
|
|
681
|
-
nodeType: result.type,
|
|
682
|
-
nodeName: result.name,
|
|
683
|
-
language: result.language,
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
catch (error) {
|
|
688
|
-
// Skip files with AST parsing errors
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
else if (searchRegex) {
|
|
693
|
-
// Text or Regex search mode
|
|
681
|
+
// Text or Regex search mode
|
|
682
|
+
if (searchRegex) {
|
|
694
683
|
const lines = content.split('\n');
|
|
695
684
|
lines.forEach((line, index) => {
|
|
696
685
|
if (matches.length >= maxResults) {
|
|
@@ -808,16 +797,32 @@ export const mcpTools = [
|
|
|
808
797
|
},
|
|
809
798
|
{
|
|
810
799
|
name: 'filesystem_delete',
|
|
811
|
-
description: 'Delete
|
|
800
|
+
description: 'Delete one or multiple files. Supports both single file and batch deletion.',
|
|
812
801
|
inputSchema: {
|
|
813
802
|
type: 'object',
|
|
814
803
|
properties: {
|
|
815
804
|
filePath: {
|
|
816
805
|
type: 'string',
|
|
817
|
-
description: 'Path to
|
|
806
|
+
description: 'Path to a single file to delete (deprecated: use filePaths for single or multiple files)',
|
|
807
|
+
},
|
|
808
|
+
filePaths: {
|
|
809
|
+
oneOf: [
|
|
810
|
+
{
|
|
811
|
+
type: 'string',
|
|
812
|
+
description: 'Path to a single file to delete'
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
type: 'array',
|
|
816
|
+
items: {
|
|
817
|
+
type: 'string'
|
|
818
|
+
},
|
|
819
|
+
description: 'Array of file paths to delete'
|
|
820
|
+
}
|
|
821
|
+
],
|
|
822
|
+
description: 'Single file path or array of file paths to delete'
|
|
818
823
|
},
|
|
819
824
|
},
|
|
820
|
-
required
|
|
825
|
+
// Make both optional, but at least one is required (validated in code)
|
|
821
826
|
},
|
|
822
827
|
},
|
|
823
828
|
{
|
|
@@ -900,8 +905,8 @@ export const mcpTools = [
|
|
|
900
905
|
},
|
|
901
906
|
searchMode: {
|
|
902
907
|
type: 'string',
|
|
903
|
-
enum: ['text', 'regex'
|
|
904
|
-
description: 'Search mode: "text" for literal text search (default), "regex" for regular expression search
|
|
908
|
+
enum: ['text', 'regex'],
|
|
909
|
+
description: 'Search mode: "text" for literal text search (default), "regex" for regular expression search',
|
|
905
910
|
default: 'text',
|
|
906
911
|
},
|
|
907
912
|
},
|
package/dist/mcp/todo.js
CHANGED
|
@@ -192,28 +192,24 @@ Complete TODO list with all task IDs, content, status, and hierarchy.`,
|
|
|
192
192
|
name: 'todo-update',
|
|
193
193
|
description: `Update TODO status or content - USE ONLY WHEN COMPLETING TASKS.
|
|
194
194
|
|
|
195
|
-
## CORE PRINCIPLE - WORK FIRST,
|
|
196
|
-
Focus on COMPLETING TASKS, not updating status. Only update TODO when a task is 100% finished and verified.
|
|
195
|
+
## CORE PRINCIPLE - WORK FIRST, completed in an orderly manner:
|
|
197
196
|
|
|
198
|
-
##
|
|
197
|
+
## STATUS MODEL:
|
|
199
198
|
- **pending**: Task not yet completed (default)
|
|
200
199
|
- **completed**: Task is 100% finished and verified
|
|
201
200
|
|
|
202
201
|
## WHEN TO UPDATE:
|
|
203
202
|
✅ **Mark "completed"** ONLY when:
|
|
204
|
-
-
|
|
205
|
-
- Tests/builds passed (if applicable)
|
|
203
|
+
- When completing a task in the List
|
|
206
204
|
- No errors or blockers
|
|
207
205
|
- You've actually verified it works
|
|
208
206
|
|
|
209
207
|
## WHEN NOT TO UPDATE:
|
|
210
208
|
❌ Don't update status to track "in progress" - just do the work
|
|
211
|
-
❌ Don't update multiple times per task - once when done is enough
|
|
212
209
|
❌ Don't update before verifying the work is complete
|
|
213
|
-
❌ Don't update content unless there's a genuine error in the description
|
|
214
210
|
|
|
215
211
|
## BEST PRACTICE:
|
|
216
|
-
|
|
212
|
+
Every time you complete a task in Task, it will be updated to "Completed" immediately.`,
|
|
217
213
|
inputSchema: {
|
|
218
214
|
type: 'object',
|
|
219
215
|
properties: {
|