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.
Files changed (67) hide show
  1. package/dist/api/anthropic.d.ts +1 -1
  2. package/dist/api/anthropic.js +52 -76
  3. package/dist/api/chat.d.ts +4 -4
  4. package/dist/api/chat.js +32 -17
  5. package/dist/api/gemini.d.ts +1 -1
  6. package/dist/api/gemini.js +20 -13
  7. package/dist/api/responses.d.ts +5 -5
  8. package/dist/api/responses.js +29 -27
  9. package/dist/app.js +4 -1
  10. package/dist/hooks/useClipboard.d.ts +4 -0
  11. package/dist/hooks/useClipboard.js +120 -0
  12. package/dist/hooks/useCommandHandler.d.ts +26 -0
  13. package/dist/hooks/useCommandHandler.js +158 -0
  14. package/dist/hooks/useCommandPanel.d.ts +16 -0
  15. package/dist/hooks/useCommandPanel.js +53 -0
  16. package/dist/hooks/useConversation.d.ts +9 -1
  17. package/dist/hooks/useConversation.js +152 -58
  18. package/dist/hooks/useFilePicker.d.ts +17 -0
  19. package/dist/hooks/useFilePicker.js +91 -0
  20. package/dist/hooks/useHistoryNavigation.d.ts +21 -0
  21. package/dist/hooks/useHistoryNavigation.js +50 -0
  22. package/dist/hooks/useInputBuffer.d.ts +6 -0
  23. package/dist/hooks/useInputBuffer.js +29 -0
  24. package/dist/hooks/useKeyboardInput.d.ts +51 -0
  25. package/dist/hooks/useKeyboardInput.js +272 -0
  26. package/dist/hooks/useSnapshotState.d.ts +12 -0
  27. package/dist/hooks/useSnapshotState.js +28 -0
  28. package/dist/hooks/useStreamingState.d.ts +24 -0
  29. package/dist/hooks/useStreamingState.js +96 -0
  30. package/dist/hooks/useVSCodeState.d.ts +8 -0
  31. package/dist/hooks/useVSCodeState.js +63 -0
  32. package/dist/mcp/filesystem.d.ts +25 -9
  33. package/dist/mcp/filesystem.js +56 -51
  34. package/dist/mcp/todo.js +4 -8
  35. package/dist/ui/components/ChatInput.js +68 -557
  36. package/dist/ui/components/DiffViewer.js +57 -30
  37. package/dist/ui/components/FileList.js +70 -26
  38. package/dist/ui/components/MessageList.d.ts +6 -0
  39. package/dist/ui/components/MessageList.js +47 -15
  40. package/dist/ui/components/ShimmerText.d.ts +9 -0
  41. package/dist/ui/components/ShimmerText.js +30 -0
  42. package/dist/ui/components/TodoTree.d.ts +1 -1
  43. package/dist/ui/components/TodoTree.js +0 -4
  44. package/dist/ui/components/ToolConfirmation.js +14 -6
  45. package/dist/ui/pages/ChatScreen.js +159 -359
  46. package/dist/ui/pages/CustomHeadersScreen.d.ts +6 -0
  47. package/dist/ui/pages/CustomHeadersScreen.js +104 -0
  48. package/dist/ui/pages/WelcomeScreen.js +5 -0
  49. package/dist/utils/apiConfig.d.ts +10 -0
  50. package/dist/utils/apiConfig.js +51 -0
  51. package/dist/utils/incrementalSnapshot.d.ts +8 -0
  52. package/dist/utils/incrementalSnapshot.js +63 -0
  53. package/dist/utils/mcpToolsManager.js +8 -3
  54. package/dist/utils/retryUtils.d.ts +22 -0
  55. package/dist/utils/retryUtils.js +180 -0
  56. package/dist/utils/sessionConverter.js +80 -17
  57. package/dist/utils/sessionManager.js +35 -4
  58. package/dist/utils/textUtils.d.ts +4 -0
  59. package/dist/utils/textUtils.js +19 -0
  60. package/dist/utils/todoPreprocessor.d.ts +1 -1
  61. package/dist/utils/todoPreprocessor.js +0 -1
  62. package/dist/utils/vscodeConnection.d.ts +8 -0
  63. package/dist/utils/vscodeConnection.js +44 -0
  64. package/package.json +1 -13
  65. package/readme.md +6 -2
  66. package/dist/mcp/multiLanguageASTParser.d.ts +0 -67
  67. package/dist/mcp/multiLanguageASTParser.js +0 -360
@@ -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 a file
305
- * @param filePath - Path to the file to delete
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(filePath) {
308
+ async deleteFile(filePaths) {
310
309
  try {
311
- const fullPath = this.resolvePath(filePath);
312
- await this.validatePath(fullPath);
313
- const stats = await fs.stat(fullPath);
314
- if (!stats.isFile()) {
315
- throw new Error(`Path is not a file: ${filePath}`);
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
- // Backup file before deletion
318
- await incrementalSnapshotManager.backupFile(fullPath);
319
- await fs.unlink(fullPath);
320
- return `File deleted successfully: ${filePath}`;
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 file ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
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
- // AST search mode - supports multiple languages via tree-sitter
664
- if (searchMode === 'ast') {
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 a file',
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 the file to delete',
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: ['filePath'],
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', 'ast'],
904
- description: 'Search mode: "text" for literal text search (default), "regex" for regular expression search, "ast" for AST-based semantic search (supports function/class/variable names)',
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, UPDATES LAST:
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
- ## SIMPLIFIED STATUS MODEL:
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
- - Task is 100% finished (no partial work)
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
- Complete 3-5 tasks, then batch update them all to "completed" at once. This is more efficient than constant status updates.`,
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: {