snow-ai 0.2.24 → 0.2.26

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 (46) hide show
  1. package/dist/api/chat.d.ts +0 -8
  2. package/dist/api/chat.js +1 -144
  3. package/dist/api/responses.d.ts +0 -11
  4. package/dist/api/responses.js +1 -189
  5. package/dist/api/systemPrompt.d.ts +1 -1
  6. package/dist/api/systemPrompt.js +90 -295
  7. package/dist/app.d.ts +2 -1
  8. package/dist/app.js +11 -13
  9. package/dist/cli.js +16 -3
  10. package/dist/hooks/useClipboard.js +4 -4
  11. package/dist/hooks/useGlobalNavigation.d.ts +1 -1
  12. package/dist/hooks/useKeyboardInput.d.ts +1 -0
  13. package/dist/hooks/useKeyboardInput.js +8 -4
  14. package/dist/hooks/useTerminalFocus.d.ts +5 -0
  15. package/dist/hooks/useTerminalFocus.js +22 -2
  16. package/dist/mcp/aceCodeSearch.d.ts +58 -4
  17. package/dist/mcp/aceCodeSearch.js +563 -20
  18. package/dist/mcp/filesystem.d.ts +59 -10
  19. package/dist/mcp/filesystem.js +431 -124
  20. package/dist/mcp/ideDiagnostics.d.ts +36 -0
  21. package/dist/mcp/ideDiagnostics.js +92 -0
  22. package/dist/ui/components/ChatInput.js +6 -3
  23. package/dist/ui/pages/ChatScreen.d.ts +4 -2
  24. package/dist/ui/pages/ChatScreen.js +31 -2
  25. package/dist/ui/pages/ConfigProfileScreen.d.ts +7 -0
  26. package/dist/ui/pages/ConfigProfileScreen.js +300 -0
  27. package/dist/ui/pages/{ApiConfigScreen.d.ts → ConfigScreen.d.ts} +1 -1
  28. package/dist/ui/pages/ConfigScreen.js +748 -0
  29. package/dist/ui/pages/WelcomeScreen.js +7 -18
  30. package/dist/utils/apiConfig.d.ts +0 -2
  31. package/dist/utils/apiConfig.js +12 -0
  32. package/dist/utils/configManager.d.ts +45 -0
  33. package/dist/utils/configManager.js +274 -0
  34. package/dist/utils/contextCompressor.js +355 -49
  35. package/dist/utils/escapeHandler.d.ts +79 -0
  36. package/dist/utils/escapeHandler.js +153 -0
  37. package/dist/utils/incrementalSnapshot.js +2 -1
  38. package/dist/utils/mcpToolsManager.js +44 -0
  39. package/dist/utils/retryUtils.js +6 -0
  40. package/dist/utils/textBuffer.js +13 -15
  41. package/dist/utils/vscodeConnection.js +26 -11
  42. package/dist/utils/workspaceSnapshot.js +2 -1
  43. package/package.json +2 -1
  44. package/dist/ui/pages/ApiConfigScreen.js +0 -161
  45. package/dist/ui/pages/ModelConfigScreen.d.ts +0 -8
  46. package/dist/ui/pages/ModelConfigScreen.js +0 -504
@@ -17,6 +17,10 @@ import { useState, useEffect } from 'react';
17
17
  *
18
18
  * Also provides a function to check if input contains focus events
19
19
  * so they can be filtered from normal input processing.
20
+ *
21
+ * Auto-focus recovery: If user input is detected while in unfocused state,
22
+ * automatically restore focus state to ensure cursor visibility during
23
+ * operations like Shift+drag file drop where focus events may be delayed.
20
24
  */
21
25
  export function useTerminalFocus() {
22
26
  const [hasFocus, setHasFocus] = useState(true); // Default to focused
@@ -27,10 +31,22 @@ export function useTerminalFocus() {
27
31
  // Focus gained: ESC[I
28
32
  if (str === '\x1b[I') {
29
33
  setHasFocus(true);
34
+ return;
30
35
  }
31
36
  // Focus lost: ESC[O
32
37
  if (str === '\x1b[O') {
33
38
  setHasFocus(false);
39
+ return;
40
+ }
41
+ // Auto-recovery: If we receive any input that's NOT a focus event
42
+ // while in unfocused state, treat it as an implicit focus gain.
43
+ // This handles cases where focus events are delayed (e.g., Shift+drag operations)
44
+ // Filter out escape sequences and other non-printable characters
45
+ const isPrintableInput = str.length > 0 &&
46
+ !str.startsWith('\x1b') && // Not an escape sequence
47
+ !/^[\x00-\x1f\x7f]+$/.test(str); // Not only control characters
48
+ if (!hasFocus && isPrintableInput) {
49
+ setHasFocus(true);
34
50
  }
35
51
  };
36
52
  // Listen to stdin data
@@ -48,10 +64,14 @@ export function useTerminalFocus() {
48
64
  process.stdout.write('\x1b[?1004l');
49
65
  process.stdin.off('data', handleData);
50
66
  };
51
- }, []);
67
+ }, [hasFocus]); // Add hasFocus to dependencies to access current state
52
68
  // Helper function to check if input is a focus event
53
69
  const isFocusEvent = (input) => {
54
70
  return input === '\x1b[I' || input === '\x1b[O';
55
71
  };
56
- return { hasFocus, isFocusEvent };
72
+ // Manual focus restoration function (can be called externally if needed)
73
+ const ensureFocus = () => {
74
+ setHasFocus(true);
75
+ };
76
+ return { hasFocus, isFocusEvent, ensureFocus };
57
77
  }
@@ -43,7 +43,21 @@ export declare class ACECodeSearchService {
43
43
  private indexCache;
44
44
  private lastIndexTime;
45
45
  private readonly INDEX_CACHE_DURATION;
46
+ private fzfIndex;
47
+ private allIndexedFiles;
48
+ private fileModTimes;
49
+ private customExcludes;
50
+ private excludesLoaded;
51
+ private readonly DEFAULT_EXCLUDES;
46
52
  constructor(basePath?: string);
53
+ /**
54
+ * Load custom exclusion patterns from .gitignore and .snowignore
55
+ */
56
+ private loadExclusionPatterns;
57
+ /**
58
+ * Check if a directory should be excluded based on exclusion patterns
59
+ */
60
+ private shouldExcludeDirectory;
47
61
  /**
48
62
  * Detect programming language from file extension
49
63
  */
@@ -57,13 +71,33 @@ export declare class ACECodeSearchService {
57
71
  */
58
72
  private getContext;
59
73
  /**
60
- * Build or refresh the code symbol index
74
+ * Check if a directory is a Git repository
75
+ */
76
+ private isGitRepository;
77
+ /**
78
+ * Check if a command is available in the system PATH
79
+ */
80
+ private isCommandAvailable;
81
+ /**
82
+ * Parse grep output (format: filePath:lineNumber:lineContent)
83
+ */
84
+ private parseGrepOutput;
85
+ /**
86
+ * Build or refresh the code symbol index with incremental updates
61
87
  */
62
88
  private buildIndex;
63
89
  /**
64
- * Search for symbols by name with fuzzy matching
90
+ * Build fzf index for fast fuzzy symbol name matching
91
+ */
92
+ private buildFzfIndex;
93
+ /**
94
+ * Search for symbols by name with fuzzy matching using fzf
65
95
  */
66
96
  searchSymbols(query: string, symbolType?: CodeSymbol['type'], language?: string, maxResults?: number): Promise<SemanticSearchResult>;
97
+ /**
98
+ * Fallback symbol search using manual fuzzy matching
99
+ */
100
+ private searchSymbolsManual;
67
101
  /**
68
102
  * Find all references to a symbol
69
103
  */
@@ -73,7 +107,22 @@ export declare class ACECodeSearchService {
73
107
  */
74
108
  findDefinition(symbolName: string, contextFile?: string): Promise<CodeSymbol | null>;
75
109
  /**
76
- * Fast text search using built-in Node.js (no external dependencies)
110
+ * Strategy 1: Use git grep for fast searching in Git repositories
111
+ */
112
+ private gitGrepSearch;
113
+ /**
114
+ * Strategy 2: Use system grep (or ripgrep if available) for fast searching
115
+ */
116
+ private systemGrepSearch;
117
+ /**
118
+ * Strategy 3: Pure JavaScript fallback search
119
+ */
120
+ private jsTextSearch;
121
+ /**
122
+ * Fast text search with multi-layer strategy
123
+ * Strategy 1: git grep (fastest, uses git index)
124
+ * Strategy 2: system grep/ripgrep (fast, system-optimized)
125
+ * Strategy 3: JavaScript fallback (slower, but always works)
77
126
  * Searches for text patterns across files with glob filtering
78
127
  */
79
128
  textSearch(pattern: string, fileGlob?: string, isRegex?: boolean, maxResults?: number): Promise<Array<{
@@ -82,6 +131,11 @@ export declare class ACECodeSearchService {
82
131
  column: number;
83
132
  content: string;
84
133
  }>>;
134
+ /**
135
+ * Sort search results by file modification time (recent files first)
136
+ * Files modified within last 24 hours are prioritized
137
+ */
138
+ private sortResultsByRecency;
85
139
  /**
86
140
  * Convert glob pattern to RegExp
87
141
  * Supports: *, **, ?, [abc], {js,ts}
@@ -96,7 +150,7 @@ export declare class ACECodeSearchService {
96
150
  */
97
151
  semanticSearch(query: string, searchType?: 'definition' | 'usage' | 'implementation' | 'all', language?: string, maxResults?: number): Promise<SemanticSearchResult>;
98
152
  /**
99
- * Clear the symbol index cache
153
+ * Clear the symbol index cache and force full re-index on next search
100
154
  */
101
155
  clearCache(): void;
102
156
  /**