snow-ai 0.3.27 → 0.3.29

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.
@@ -6,80 +6,399 @@
6
6
  */
7
7
  export const LANGUAGE_CONFIG = {
8
8
  typescript: {
9
- extensions: ['.ts', '.tsx'],
9
+ extensions: ['.ts', '.tsx', '.mts', '.cts'],
10
10
  parser: 'typescript',
11
11
  symbolPatterns: {
12
- function: /(?:export\s+)?(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>/,
13
- class: /(?:export\s+)?(?:abstract\s+)?class\s+(\w+)/,
14
- variable: /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=/,
15
- import: /import\s+(?:{[^}]+}|\w+)\s+from\s+['"]([^'"]+)['"]/,
16
- export: /export\s+(?:default\s+)?(?:class|function|const|let|var|interface|type|enum)\s+(\w+)/,
12
+ function: /(?:export\s+)?(?:async\s+)?(?:function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>)|(?:@\w+\s+)*(?:public|private|protected|static)?\s*(?:async)?\s*(\w+)\s*[<(]/,
13
+ class: /(?:export\s+)?(?:abstract\s+)?(?:class|interface)\s+(\w+)|(?:export\s+)?type\s+(\w+)\s*=|(?:export\s+)?enum\s+(\w+)|(?:export\s+)?namespace\s+(\w+)/,
14
+ variable: /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::|=)|(?:@\w+\s+)*(?:public|private|protected|readonly|static)?\s+(\w+)\s*[?:]/,
15
+ import: /import\s+(?:type\s+)?(?:{[^}]+}|\w+|\*\s+as\s+\w+)\s+from\s+['"]([^'"]+)['"]/,
16
+ export: /export\s+(?:default\s+)?(?:class|function|const|let|var|interface|type|enum|namespace|abstract\s+class)\s+(\w+)/,
17
17
  },
18
18
  },
19
19
  javascript: {
20
- extensions: ['.js', '.jsx', '.mjs', '.cjs'],
20
+ extensions: ['.js', '.jsx', '.mjs', '.cjs', '.es', '.es6'],
21
21
  parser: 'javascript',
22
22
  symbolPatterns: {
23
- function: /(?:export\s+)?(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>/,
23
+ function: /(?:export\s+)?(?:async\s+)?(?:function\s*\*?\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:function\s*\*?\s*)?(?:\([^)]*\)\s*=>|\([^)]*\)\s*\{))|(\w+)\s*\([^)]*\)\s*\{/,
24
24
  class: /(?:export\s+)?class\s+(\w+)/,
25
25
  variable: /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=/,
26
- import: /import\s+(?:{[^}]+}|\w+)\s+from\s+['"]([^'"]+)['"]/,
26
+ import: /import\s+(?:{[^}]+}|\w+|\*\s+as\s+\w+)\s+from\s+['"]([^'"]+)['"]/,
27
27
  export: /export\s+(?:default\s+)?(?:class|function|const|let|var)\s+(\w+)/,
28
28
  },
29
29
  },
30
30
  python: {
31
- extensions: ['.py', '.pyx', '.pyi'],
31
+ extensions: ['.py', '.pyx', '.pyi', '.pyw', '.pyz'],
32
32
  parser: 'python',
33
33
  symbolPatterns: {
34
- function: /def\s+(\w+)\s*\(/,
35
- class: /class\s+(\w+)\s*[(:]/,
36
- variable: /(\w+)\s*=\s*[^=]/,
37
- import: /(?:from\s+[\w.]+\s+)?import\s+([\w, ]+)/,
38
- export: /^(\w+)\s*=\s*/, // Python doesn't have explicit exports
34
+ function: /(?:@\w+\s+)*(?:async\s+)?def\s+(\w+)\s*\(/,
35
+ class: /(?:@\w+\s+)*class\s+(\w+)\s*[(:]/,
36
+ variable: /^(?:[\t ]*)([\w_][\w\d_]*)\s*(?::.*)?=\s*(?![=\s])|^([\w_][\w\d_]*)\s*:\s*(?!.*=)/m,
37
+ import: /(?:from\s+([\w.]+)\s+import\s+[\w, *]+|import\s+([\w.]+(?:\s+as\s+\w+)?))/,
38
+ export: /^(?:__all__\s*=|def\s+(\w+)|class\s+(\w+))/, // Python exports via __all__ or top-level
39
39
  },
40
40
  },
41
41
  go: {
42
42
  extensions: ['.go'],
43
43
  parser: 'go',
44
44
  symbolPatterns: {
45
- function: /func\s+(?:\([^)]+\)\s+)?(\w+)\s*\(/,
46
- class: /type\s+(\w+)\s+struct/,
47
- variable: /(?:var|const)\s+(\w+)\s+/,
48
- import: /import\s+(?:"([^"]+)"|[(]([^)]+)[)])/,
49
- export: /^(?:func|type|var|const)\s+([A-Z]\w+)/, // Go exports start with capital letter
45
+ function: /func\s+(?:\([^)]+\)\s+)?(\w+)\s*[<(]/,
46
+ class: /type\s+(\w+)\s+(?:struct|interface)/,
47
+ variable: /(?:var|const)\s+(\w+)\s+[\w\[\]*{]|(?:var|const)\s+\(\s*(\w+)/,
48
+ import: /import\s+(?:"([^"]+)"|_\s+"([^"]+)"|\w+\s+"([^"]+)")/,
49
+ export: /^(?:func|type|var|const)\s+([A-Z]\w+)|^type\s+([A-Z]\w+)\s+(?:struct|interface)/, // Go exports start with capital letter
50
50
  },
51
51
  },
52
52
  rust: {
53
53
  extensions: ['.rs'],
54
54
  parser: 'rust',
55
55
  symbolPatterns: {
56
- function: /(?:pub\s+)?(?:async\s+)?fn\s+(\w+)\s*[<(]/,
57
- class: /(?:pub\s+)?struct\s+(\w+)|(?:pub\s+)?enum\s+(\w+)|(?:pub\s+)?trait\s+(\w+)/,
58
- variable: /(?:pub\s+)?(?:static|const)\s+(\w+)\s*:/,
59
- import: /use\s+([^;]+);/,
60
- export: /pub\s+(?:fn|struct|enum|trait|const|static)\s+(\w+)/,
56
+ function: /(?:pub(?:\s*\([^)]+\))?\s+)?(?:unsafe\s+)?(?:async\s+)?(?:const\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?fn\s+(\w+)\s*[<(]/,
57
+ class: /(?:pub(?:\s*\([^)]+\))?\s+)?(?:struct|enum|trait|union|type)\s+(\w+)|impl(?:\s+<[^>]+>)?\s+(?:\w+::)*(\w+)/,
58
+ variable: /(?:pub(?:\s*\([^)]+\))?\s+)?(?:static|const|mut)?\s*(?:let\s+(?:mut\s+)?)?(\w+)\s*[:=]/,
59
+ import: /use\s+([^;]+);|extern\s+crate\s+(\w+);/,
60
+ export: /pub(?:\s*\([^)]+\))?\s+(?:fn|struct|enum|trait|const|static|type|mod|use)\s+(\w+)/,
61
61
  },
62
62
  },
63
63
  java: {
64
64
  extensions: ['.java'],
65
65
  parser: 'java',
66
66
  symbolPatterns: {
67
- function: /(?:public|private|protected|static|\s)+[\w<>\[\]]+\s+(\w+)\s*\([^)]*\)\s*\{/,
68
- class: /(?:public|private|protected)?\s*(?:abstract|final)?\s*class\s+(\w+)/,
69
- variable: /(?:public|private|protected|static|final|\s)+[\w<>\[\]]+\s+(\w+)\s*[=;]/,
70
- import: /import\s+([\w.]+);/,
71
- export: /public\s+(?:class|interface|enum)\s+(\w+)/,
67
+ function: /(?:@\w+\s+)*(?:public|private|protected|static|final|synchronized|native|abstract|\s)+[\w<>\[\]]+\s+(\w+)\s*\([^)]*\)\s*(?:throws\s+[\w,\s]+)?\s*[{;]/,
68
+ class: /(?:@\w+\s+)*(?:public|private|protected)?\s*(?:abstract|final|static)?\s*(?:class|interface|enum|record|@interface)\s+(\w+)/,
69
+ variable: /(?:@\w+\s+)*(?:public|private|protected|static|final|transient|volatile|\s)+[\w<>\[\]]+\s+(\w+)\s*[=;]/,
70
+ import: /import\s+(?:static\s+)?([\w.*]+);/,
71
+ export: /public\s+(?:class|interface|enum|record|@interface)\s+(\w+)/,
72
72
  },
73
73
  },
74
74
  csharp: {
75
75
  extensions: ['.cs'],
76
76
  parser: 'csharp',
77
77
  symbolPatterns: {
78
- function: /(?:public|private|protected|internal|static|\s)+[\w<>\[\]]+\s+(\w+)\s*\([^)]*\)\s*\{/,
79
- class: /(?:public|private|protected|internal)?\s*(?:abstract|sealed|static)?\s*class\s+(\w+)/,
80
- variable: /(?:public|private|protected|internal|static|readonly|\s)+[\w<>\[\]]+\s+(\w+)\s*[=;]/,
81
- import: /using\s+([\w.]+);/,
82
- export: /public\s+(?:class|interface|enum|struct)\s+(\w+)/,
78
+ function: /(?:\[[\w\s,()]+\]\s+)*(?:public|private|protected|internal|static|virtual|override|abstract|async|\s)+[\w<>\[\]?]+\s+(\w+)\s*[<(]/,
79
+ class: /(?:\[[\w\s,()]+\]\s+)*(?:public|private|protected|internal)?\s*(?:abstract|sealed|static|partial)?\s*(?:class|interface|struct|record|enum)\s+(\w+)/,
80
+ variable: /(?:\[[\w\s,()]+\]\s+)*(?:public|private|protected|internal|static|readonly|const|volatile|\s)+[\w<>\[\]?]+\s+(\w+)\s*[{=;]|(?:public|private|protected|internal)?\s*[\w<>\[\]?]+\s+(\w+)\s*\{\s*get/,
81
+ import: /using\s+(?:static\s+)?([\w.]+);/,
82
+ export: /public\s+(?:class|interface|enum|struct|record|delegate)\s+(\w+)/,
83
+ },
84
+ },
85
+ c: {
86
+ extensions: ['.c', '.h'],
87
+ parser: 'c',
88
+ symbolPatterns: {
89
+ function: /(?:static|extern|inline)?\s*[\w\s\*]+\s+(\w+)\s*\([^)]*\)\s*\{/,
90
+ class: /(?:struct|union|enum)\s+(\w+)\s*\{/,
91
+ variable: /(?:extern|static|const)?\s*[\w\s\*]+\s+(\w+)\s*[=;]/,
92
+ import: /#include\s+[<"]([^>"]+)[>"]/,
93
+ export: /^[\w\s\*]+\s+(\w+)\s*\([^)]*\)\s*;/, // Function declarations
94
+ },
95
+ },
96
+ cpp: {
97
+ extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx', '.h++', '.c++'],
98
+ parser: 'cpp',
99
+ symbolPatterns: {
100
+ function: /(?:static|extern|inline|virtual|explicit|constexpr)?\s*[\w\s\*&:<>,]+\s+(\w+)\s*\([^)]*\)\s*(?:const)?\s*(?:override)?\s*\{/,
101
+ class: /(?:class|struct|union|enum\s+class|enum\s+struct)\s+(\w+)(?:\s*:\s*(?:public|private|protected)\s+[\w,\s<>]+)?\s*\{/,
102
+ variable: /(?:extern|static|const|constexpr|inline)?\s*[\w\s\*&:<>,]+\s+(\w+)\s*[=;]/,
103
+ import: /#include\s+[<"]([^>"]+)[>"]/,
104
+ export: /^[\w\s\*&:<>,]+\s+(\w+)\s*\([^)]*\)\s*;/,
105
+ },
106
+ },
107
+ php: {
108
+ extensions: ['.php', '.phtml', '.php3', '.php4', '.php5', '.phps'],
109
+ parser: 'php',
110
+ symbolPatterns: {
111
+ function: /(?:public|private|protected|static)?\s*function\s+(\w+)\s*\(/,
112
+ class: /(?:abstract|final)?\s*class\s+(\w+)(?:\s+extends\s+\w+)?(?:\s+implements\s+[\w,\s]+)?\s*\{/,
113
+ variable: /(?:public|private|protected|static)?\s*\$(\w+)\s*[=;]/,
114
+ import: /(?:require|require_once|include|include_once)\s*[('"]([^'"]+)['"]/,
115
+ export: /^(?:public\s+)?(?:function|class|interface|trait)\s+(\w+)/,
116
+ },
117
+ },
118
+ ruby: {
119
+ extensions: ['.rb', '.rake', '.gemspec', '.ru', '.rbw'],
120
+ parser: 'ruby',
121
+ symbolPatterns: {
122
+ function: /def\s+(?:self\.)?(\w+)/,
123
+ class: /class\s+(\w+)(?:\s+<\s+[\w:]+)?/,
124
+ variable: /(?:@|@@|\$)?(\w+)\s*=(?!=)/,
125
+ import: /require(?:_relative)?\s+['"]([^'"]+)['"]/,
126
+ export: /module_function\s+:(\w+)|^def\s+(\w+)/, // Ruby's module exports
127
+ },
128
+ },
129
+ swift: {
130
+ extensions: ['.swift'],
131
+ parser: 'swift',
132
+ symbolPatterns: {
133
+ function: /(?:public|private|internal|fileprivate|open)?\s*(?:static|class)?\s*func\s+(\w+)\s*[<(]/,
134
+ class: /(?:public|private|internal|fileprivate|open)?\s*(?:final)?\s*(?:class|struct|enum|protocol|actor)\s+(\w+)/,
135
+ variable: /(?:public|private|internal|fileprivate|open)?\s*(?:static|class)?\s*(?:let|var)\s+(\w+)\s*[:=]/,
136
+ import: /import\s+(?:class|struct|enum|protocol)?\s*([\w.]+)/,
137
+ export: /public\s+(?:func|class|struct|enum|protocol|var|let)\s+(\w+)/,
138
+ },
139
+ },
140
+ kotlin: {
141
+ extensions: ['.kt', '.kts'],
142
+ parser: 'kotlin',
143
+ symbolPatterns: {
144
+ function: /(?:public|private|protected|internal)?\s*(?:suspend|inline|infix|operator)?\s*fun\s+(\w+)\s*[<(]/,
145
+ class: /(?:public|private|protected|internal)?\s*(?:abstract|open|final|sealed|data|inline|value)?\s*(?:class|interface|object|enum\s+class)\s+(\w+)/,
146
+ variable: /(?:public|private|protected|internal)?\s*(?:const)?\s*(?:val|var)\s+(\w+)\s*[:=]/,
147
+ import: /import\s+([\w.]+)/,
148
+ export: /^(?:public\s+)?(?:fun|class|interface|object|val|var)\s+(\w+)/,
149
+ },
150
+ },
151
+ dart: {
152
+ extensions: ['.dart'],
153
+ parser: 'dart',
154
+ symbolPatterns: {
155
+ function: /(?:static|abstract|external)?\s*[\w<>?,\s]+\s+(\w+)\s*\([^)]*\)\s*(?:async|sync\*)?\s*\{/,
156
+ class: /(?:abstract)?\s*class\s+(\w+)(?:\s+extends\s+[\w<>]+)?(?:\s+with\s+[\w,\s<>]+)?(?:\s+implements\s+[\w,\s<>]+)?\s*\{/,
157
+ variable: /(?:static|final|const|late)?\s*(?:var|[\w<>?,\s]+)\s+(\w+)\s*[=;]/,
158
+ import: /import\s+['"]([^'"]+)['"]/,
159
+ export: /^(?:class|abstract\s+class|enum|mixin)\s+(\w+)/,
160
+ },
161
+ },
162
+ shell: {
163
+ extensions: ['.sh', '.bash', '.zsh', '.ksh', '.fish'],
164
+ parser: 'shell',
165
+ symbolPatterns: {
166
+ function: /(?:function\s+)?(\w+)\s*\(\s*\)\s*\{/,
167
+ class: /^$/, // Shell doesn't have classes
168
+ variable: /(?:export\s+)?(\w+)=/,
169
+ import: /(?:source|\.)\s+([^\s;]+)/,
170
+ export: /export\s+(?:function\s+)?(\w+)/,
171
+ },
172
+ },
173
+ scala: {
174
+ extensions: ['.scala', '.sc'],
175
+ parser: 'scala',
176
+ symbolPatterns: {
177
+ function: /def\s+(\w+)\s*[:\[(]/,
178
+ class: /(?:sealed|abstract|final|implicit)?\s*(?:class|trait|object|case\s+class|case\s+object)\s+(\w+)/,
179
+ variable: /(?:val|var|lazy\s+val)\s+(\w+)\s*[:=]/,
180
+ import: /import\s+([\w.{},\s=>]+)/,
181
+ export: /^(?:object|class|trait)\s+(\w+)/,
182
+ },
183
+ },
184
+ r: {
185
+ extensions: ['.r', '.R', '.rmd', '.Rmd'],
186
+ parser: 'r',
187
+ symbolPatterns: {
188
+ function: /(\w+)\s*<-\s*function\s*\(|^(\w+)\s*=\s*function\s*\(/,
189
+ class: /setClass\s*\(\s*['"](\w+)['"]/,
190
+ variable: /(\w+)\s*(?:<-|=)\s*(?!function)/,
191
+ import: /(?:library|require)\s*\(\s*['"]?(\w+)['"]?\s*\)/,
192
+ export: /^(\w+)\s*<-\s*function/, // R exports at top level
193
+ },
194
+ },
195
+ lua: {
196
+ extensions: ['.lua'],
197
+ parser: 'lua',
198
+ symbolPatterns: {
199
+ function: /(?:local\s+)?function\s+(?:[\w.]+[.:])?(\w+)\s*\(/,
200
+ class: /(\w+)\s*=\s*\{\s*\}|(\w+)\s*=\s*class\s*\(/,
201
+ variable: /(?:local\s+)?(\w+)\s*=/,
202
+ import: /require\s*\(?['"]([^'"]+)['"]\)?/,
203
+ export: /return\s+(\w+)|module\s*\(\s*['"]([^'"]+)['"]/,
204
+ },
205
+ },
206
+ perl: {
207
+ extensions: ['.pl', '.pm', '.t', '.pod'],
208
+ parser: 'perl',
209
+ symbolPatterns: {
210
+ function: /sub\s+(\w+)\s*\{/,
211
+ class: /package\s+([\w:]+)\s*;/,
212
+ variable: /(?:my|our|local)\s*[\$@%](\w+)\s*=/,
213
+ import: /(?:use|require)\s+([\w:]+)/,
214
+ export: /^sub\s+(\w+)|our\s+[\$@%](\w+)/,
215
+ },
216
+ },
217
+ objectivec: {
218
+ extensions: ['.m', '.mm', '.h'],
219
+ parser: 'objectivec',
220
+ symbolPatterns: {
221
+ function: /[-+]\s*\([^)]+\)\s*(\w+)(?::|;|\s*\{)/,
222
+ class: /@(?:interface|implementation|protocol)\s+(\w+)/,
223
+ variable: /@property\s+[^;]+\s+(\w+);|^[\w\s\*]+\s+(\w+)\s*[=;]/,
224
+ import: /#import\s+[<"]([^>"]+)[>"]/,
225
+ export: /@interface\s+(\w+)|@protocol\s+(\w+)/,
226
+ },
227
+ },
228
+ haskell: {
229
+ extensions: ['.hs', '.lhs'],
230
+ parser: 'haskell',
231
+ symbolPatterns: {
232
+ function: /^(\w+)\s*::/,
233
+ class: /(?:class|instance)\s+(\w+)/,
234
+ variable: /^(\w+)\s*=/,
235
+ import: /import\s+(?:qualified\s+)?([\w.]+)/,
236
+ export: /module\s+[\w.]+\s*\(([^)]+)\)/,
237
+ },
238
+ },
239
+ elixir: {
240
+ extensions: ['.ex', '.exs'],
241
+ parser: 'elixir',
242
+ symbolPatterns: {
243
+ function: /def(?:p|macro|macrop)?\s+(\w+)(?:\(|,|\s+do)/,
244
+ class: /defmodule\s+([\w.]+)\s+do/,
245
+ variable: /@(\w+)\s+|(\w+)\s*=\s*(?!fn)/,
246
+ import: /(?:import|alias|require|use)\s+([\w.]+)/,
247
+ export: /^def\s+(\w+)/,
248
+ },
249
+ },
250
+ clojure: {
251
+ extensions: ['.clj', '.cljs', '.cljc', '.edn'],
252
+ parser: 'clojure',
253
+ symbolPatterns: {
254
+ function: /\(defn-?\s+(\w+)/,
255
+ class: /\(defrecord\s+(\w+)|\(deftype\s+(\w+)|\(defprotocol\s+(\w+)/,
256
+ variable: /\(def\s+(\w+)/,
257
+ import: /\(:require\s+\[([^\]]+)\]/,
258
+ export: /\(defn-?\s+(\w+)/,
259
+ },
260
+ },
261
+ fsharp: {
262
+ extensions: ['.fs', '.fsx', '.fsi'],
263
+ parser: 'fsharp',
264
+ symbolPatterns: {
265
+ function: /let\s+(?:rec\s+)?(\w+)(?:\s+\w+)*\s*=/,
266
+ class: /type\s+(\w+)\s*(?:=|<|\()/,
267
+ variable: /let\s+(?:mutable\s+)?(\w+)\s*=/,
268
+ import: /open\s+([\w.]+)/,
269
+ export: /^(?:let|type)\s+(\w+)/,
270
+ },
271
+ },
272
+ vbnet: {
273
+ extensions: ['.vb', '.vbs'],
274
+ parser: 'vbnet',
275
+ symbolPatterns: {
276
+ function: /(?:Public|Private|Protected|Friend)?\s*(?:Shared)?\s*(?:Function|Sub)\s+(\w+)/i,
277
+ class: /(?:Public|Private|Protected|Friend)?\s*(?:MustInherit|NotInheritable)?\s*Class\s+(\w+)/i,
278
+ variable: /(?:Public|Private|Protected|Friend|Dim|Const)?\s*(\w+)\s+As\s+/i,
279
+ import: /Imports\s+([\w.]+)/i,
280
+ export: /Public\s+(?:Class|Module|Function|Sub)\s+(\w+)/i,
281
+ },
282
+ },
283
+ matlab: {
284
+ extensions: ['.m', '.mlx'],
285
+ parser: 'matlab',
286
+ symbolPatterns: {
287
+ function: /function\s+(?:\[[^\]]+\]\s*=\s*|[\w,\s]+\s*=\s*)?(\w+)\s*\(/,
288
+ class: /classdef\s+(\w+)/,
289
+ variable: /(\w+)\s*=\s*(?!function)/,
290
+ import: /import\s+([\w.*]+)/,
291
+ export: /^function\s+(?:\[[^\]]+\]\s*=\s*)?(\w+)/,
292
+ },
293
+ },
294
+ sql: {
295
+ extensions: ['.sql', '.ddl', '.dml'],
296
+ parser: 'sql',
297
+ symbolPatterns: {
298
+ function: /CREATE\s+(?:OR\s+REPLACE\s+)?(?:FUNCTION|PROCEDURE)\s+(\w+)/i,
299
+ class: /CREATE\s+(?:TABLE|VIEW)\s+(\w+)/i,
300
+ variable: /DECLARE\s+@?(\w+)/i,
301
+ import: /^$/, // SQL doesn't have imports
302
+ export: /^CREATE\s+(?:FUNCTION|PROCEDURE|VIEW)\s+(\w+)/i,
303
+ },
304
+ },
305
+ html: {
306
+ extensions: ['.html', '.htm', '.xhtml'],
307
+ parser: 'html',
308
+ symbolPatterns: {
309
+ function: /<script[^>]*>[\s\S]*?function\s+(\w+)/,
310
+ class: /class\s*=\s*["']([^"']+)["']/,
311
+ variable: /id\s*=\s*["']([^"']+)["']/,
312
+ import: /<(?:link|script)[^>]+(?:href|src)\s*=\s*["']([^"']+)["']/,
313
+ export: /<(?:div|section|article|header|footer)[^>]+id\s*=\s*["']([^"']+)["']/,
314
+ },
315
+ },
316
+ css: {
317
+ extensions: ['.css', '.scss', '.sass', '.less', '.styl'],
318
+ parser: 'css',
319
+ symbolPatterns: {
320
+ function: /@mixin\s+(\w+)|@function\s+(\w+)/,
321
+ class: /\.(\w+(?:-\w+)*)\s*\{/,
322
+ variable: /--(\w+(?:-\w+)*):|@(\w+):|(\$\w+):/,
323
+ import: /@import\s+(?:url\()?['"]([^'"]+)['"]/,
324
+ export: /@mixin\s+(\w+)|@function\s+(\w+)/,
325
+ },
326
+ },
327
+ vue: {
328
+ extensions: ['.vue'],
329
+ parser: 'vue',
330
+ symbolPatterns: {
331
+ function: /<script[^>]*>[\s\S]*?(?:export\s+default\s*\{[\s\S]*?)?(?:function|const|let|var)\s+(\w+)|methods\s*:\s*\{[\s\S]*?(\w+)\s*\(/,
332
+ class: /<template[^>]*>[\s\S]*?<(\w+)/,
333
+ variable: /<script[^>]*>[\s\S]*?(?:data\s*\(\s*\)\s*\{[\s\S]*?return\s*\{[\s\S]*?(\w+)|(?:const|let|var)\s+(\w+)\s*=)/,
334
+ import: /<script[^>]*>[\s\S]*?import\s+(?:{[^}]+}|\w+)\s+from\s+['"]([^'"]+)['"]/,
335
+ export: /<script[^>]*>[\s\S]*?export\s+default/,
336
+ },
337
+ },
338
+ svelte: {
339
+ extensions: ['.svelte'],
340
+ parser: 'svelte',
341
+ symbolPatterns: {
342
+ function: /<script[^>]*>[\s\S]*?(?:function|const|let|var)\s+(\w+)\s*[=(]/,
343
+ class: /<[\w-]+/,
344
+ variable: /<script[^>]*>[\s\S]*?(?:let|const|var)\s+(\w+)\s*=/,
345
+ import: /<script[^>]*>[\s\S]*?import\s+(?:{[^}]+}|\w+)\s+from\s+['"]([^'"]+)['"]/,
346
+ export: /<script[^>]*>[\s\S]*?export\s+(?:let|const|function)\s+(\w+)/,
347
+ },
348
+ },
349
+ xml: {
350
+ extensions: ['.xml', '.xsd', '.xsl', '.xslt', '.svg'],
351
+ parser: 'xml',
352
+ symbolPatterns: {
353
+ function: /<xsl:template[^>]+name\s*=\s*["']([^"']+)["']/,
354
+ class: /<(?:xsd:)?(?:complexType|simpleType)[^>]+name\s*=\s*["']([^"']+)["']/,
355
+ variable: /<(?:xsd:)?element[^>]+name\s*=\s*["']([^"']+)["']/,
356
+ import: /<(?:xsd:)?import[^>]+schemaLocation\s*=\s*["']([^"']+)["']/,
357
+ export: /<(?:xsd:)?element[^>]+name\s*=\s*["']([^"']+)["']/,
358
+ },
359
+ },
360
+ yaml: {
361
+ extensions: ['.yaml', '.yml'],
362
+ parser: 'yaml',
363
+ symbolPatterns: {
364
+ function: /^(\w+):\s*\|/m,
365
+ class: /^(\w+):$/m,
366
+ variable: /^(\w+):\s*[^|>]/m,
367
+ import: /^$/, // YAML doesn't have imports
368
+ export: /^(\w+):$/m,
369
+ },
370
+ },
371
+ json: {
372
+ extensions: ['.json', '.jsonc', '.json5'],
373
+ parser: 'json',
374
+ symbolPatterns: {
375
+ function: /^$/,
376
+ class: /^$/,
377
+ variable: /"(\w+)"\s*:/,
378
+ import: /^$/,
379
+ export: /^$/,
380
+ },
381
+ },
382
+ toml: {
383
+ extensions: ['.toml'],
384
+ parser: 'toml',
385
+ symbolPatterns: {
386
+ function: /^$/,
387
+ class: /^\[(\w+(?:\.\w+)*)\]/,
388
+ variable: /^(\w+)\s*=/,
389
+ import: /^$/,
390
+ export: /^\[(\w+(?:\.\w+)*)\]/,
391
+ },
392
+ },
393
+ markdown: {
394
+ extensions: ['.md', '.markdown', '.mdown', '.mkd'],
395
+ parser: 'markdown',
396
+ symbolPatterns: {
397
+ function: /```[\w]*\n[\s\S]*?function\s+(\w+)/,
398
+ class: /^#{1,6}\s+(.+)$/m,
399
+ variable: /\[([^\]]+)\]:/,
400
+ import: /\[([^\]]+)\]\(([^)]+)\)/,
401
+ export: /^#{1,6}\s+(.+)$/m,
83
402
  },
84
403
  },
85
404
  };
@@ -39,6 +39,7 @@ export interface Message {
39
39
  isComplete?: boolean;
40
40
  };
41
41
  subAgentInternal?: boolean;
42
+ parallelGroup?: string;
42
43
  }
43
44
  interface Props {
44
45
  messages: Message[];
@@ -913,6 +913,35 @@ export default function ChatScreen({ skipWelcome }) {
913
913
  let toolStatusColor = 'cyan';
914
914
  let isToolMessage = false;
915
915
  const isLastMessage = index === filteredMessages.length - 1;
916
+ // Check if this message is part of a parallel group
917
+ const isInParallelGroup = message.parallelGroup !== undefined &&
918
+ message.parallelGroup !== null;
919
+ // Check if this is a time-consuming tool (has toolPending or starts with ⚡)
920
+ // Time-consuming tools should not show parallel group indicators
921
+ const isTimeConsumingTool = message.toolPending ||
922
+ (message.role === 'assistant' &&
923
+ (message.content.startsWith('⚡') ||
924
+ message.content.includes('⚇⚡')));
925
+ // Only show parallel group indicators for non-time-consuming tools
926
+ const shouldShowParallelIndicator = isInParallelGroup && !isTimeConsumingTool;
927
+ const isFirstInGroup = shouldShowParallelIndicator &&
928
+ (index === 0 ||
929
+ filteredMessages[index - 1]?.parallelGroup !==
930
+ message.parallelGroup ||
931
+ // Previous message is time-consuming tool, so this is the first non-time-consuming one
932
+ filteredMessages[index - 1]?.toolPending ||
933
+ filteredMessages[index - 1]?.content.startsWith('⚡'));
934
+ // Check if this is the last message in the parallel group
935
+ // Only show end indicator if:
936
+ // 1. This is truly the last message, OR
937
+ // 2. Next message has a DIFFERENT non-null parallelGroup (not just undefined)
938
+ const nextMessage = filteredMessages[index + 1];
939
+ const nextHasDifferentGroup = nextMessage &&
940
+ nextMessage.parallelGroup !== undefined &&
941
+ nextMessage.parallelGroup !== null &&
942
+ nextMessage.parallelGroup !== message.parallelGroup;
943
+ const isLastInGroup = shouldShowParallelIndicator &&
944
+ (!nextMessage || nextHasDifferentGroup);
916
945
  if (message.role === 'assistant' || message.role === 'subagent') {
917
946
  if (message.content.startsWith('⚡') ||
918
947
  message.content.includes('⚇⚡')) {
@@ -934,17 +963,23 @@ export default function ChatScreen({ skipWelcome }) {
934
963
  message.role === 'subagent' ? 'magenta' : 'blue';
935
964
  }
936
965
  }
937
- return (React.createElement(Box, { key: `msg-${index}`, marginTop: index > 0 ? 1 : 0, marginBottom: isLastMessage ? 1 : 0, paddingX: 1, flexDirection: "column", width: terminalWidth },
966
+ return (React.createElement(Box, { key: `msg-${index}`, marginTop: index > 0 && !shouldShowParallelIndicator ? 1 : 0, marginBottom: isLastMessage ? 1 : 0, paddingX: 1, flexDirection: "column", width: terminalWidth },
967
+ isFirstInGroup && (React.createElement(Box, { marginBottom: 0 },
968
+ React.createElement(Text, { color: "#FF6EBF", dimColor: true }, "\u250C\u2500 Parallel execution"))),
938
969
  React.createElement(Box, null,
939
970
  React.createElement(Text, { color: message.role === 'user'
940
971
  ? 'green'
941
972
  : message.role === 'command'
942
973
  ? 'gray'
943
- : toolStatusColor, bold: true }, message.role === 'user'
944
- ? '⛇'
945
- : message.role === 'command'
946
- ? ''
947
- : ''),
974
+ : toolStatusColor, bold: true },
975
+ shouldShowParallelIndicator && !isFirstInGroup
976
+ ? ''
977
+ : '',
978
+ message.role === 'user'
979
+ ? '⛇'
980
+ : message.role === 'command'
981
+ ? '⌘'
982
+ : '❆'),
948
983
  React.createElement(Box, { marginLeft: 1, flexDirection: "column" }, message.role === 'command' ? (React.createElement(React.Fragment, null,
949
984
  React.createElement(Text, { color: "gray", dimColor: true },
950
985
  "\u2514\u2500 ",
@@ -1022,7 +1057,9 @@ export default function ChatScreen({ skipWelcome }) {
1022
1057
  "\u2514\u2500 [image #",
1023
1058
  imageIndex + 1,
1024
1059
  "]"))))),
1025
- message.discontinued && (React.createElement(Text, { color: "red", bold: true }, "\u2514\u2500 user discontinue"))))))));
1060
+ message.discontinued && (React.createElement(Text, { color: "red", bold: true }, "\u2514\u2500 user discontinue")))))),
1061
+ isLastInGroup && (React.createElement(Box, { marginTop: 0 },
1062
+ React.createElement(Text, { color: "#FF6EBF", dimColor: true }, "\u2514\u2500 End parallel execution")))));
1026
1063
  }),
1027
1064
  ] }, item => item),
1028
1065
  (streamingState.isStreaming || isSaving) && !pendingToolConfirmation && (React.createElement(Box, { marginBottom: 1, paddingX: 1, width: terminalWidth },
@@ -88,6 +88,7 @@ const toolCategories = [
88
88
  export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId, }) {
89
89
  const [agentName, setAgentName] = useState('');
90
90
  const [description, setDescription] = useState('');
91
+ const [role, setRole] = useState('');
91
92
  const [selectedTools, setSelectedTools] = useState(new Set());
92
93
  const [currentField, setCurrentField] = useState('name');
93
94
  const [selectedCategoryIndex, setSelectedCategoryIndex] = useState(0);
@@ -105,6 +106,7 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
105
106
  if (agent) {
106
107
  setAgentName(agent.name);
107
108
  setDescription(agent.description);
109
+ setRole(agent.role || '');
108
110
  setSelectedTools(new Set(agent.tools));
109
111
  }
110
112
  }
@@ -207,12 +209,13 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
207
209
  updateSubAgent(agentId, {
208
210
  name: agentName,
209
211
  description: description,
212
+ role: role || undefined,
210
213
  tools: Array.from(selectedTools),
211
214
  });
212
215
  }
213
216
  else {
214
217
  // Create new agent
215
- createSubAgent(agentName, description, Array.from(selectedTools));
218
+ createSubAgent(agentName, description, Array.from(selectedTools), role || undefined);
216
219
  }
217
220
  setShowSuccess(true);
218
221
  setTimeout(() => {
@@ -223,7 +226,15 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
223
226
  catch (error) {
224
227
  setSaveError(error instanceof Error ? error.message : 'Failed to save sub-agent');
225
228
  }
226
- }, [agentName, description, selectedTools, onSave, isEditMode, agentId]);
229
+ }, [
230
+ agentName,
231
+ description,
232
+ role,
233
+ selectedTools,
234
+ onSave,
235
+ isEditMode,
236
+ agentId,
237
+ ]);
227
238
  useInput((rawInput, key) => {
228
239
  const input = stripFocusArtifacts(rawInput);
229
240
  // Ignore focus events completely
@@ -247,6 +258,10 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
247
258
  setCurrentField('name');
248
259
  return;
249
260
  }
261
+ else if (currentField === 'role') {
262
+ setCurrentField('description');
263
+ return;
264
+ }
250
265
  else if (currentField === 'tools') {
251
266
  // Navigate within tools
252
267
  if (selectedToolIndex > 0) {
@@ -258,8 +273,8 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
258
273
  setSelectedToolIndex(prevCategory ? prevCategory.tools.length - 1 : 0);
259
274
  }
260
275
  else {
261
- // At top of tools, go to description
262
- setCurrentField('description');
276
+ // At top of tools, go to role
277
+ setCurrentField('role');
263
278
  }
264
279
  return;
265
280
  }
@@ -270,6 +285,10 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
270
285
  return;
271
286
  }
272
287
  else if (currentField === 'description') {
288
+ setCurrentField('role');
289
+ return;
290
+ }
291
+ else if (currentField === 'role') {
273
292
  setCurrentField('tools');
274
293
  setSelectedCategoryIndex(0);
275
294
  setSelectedToolIndex(0);
@@ -387,6 +406,10 @@ export default function SubAgentConfigScreen({ onBack, onSave, inlineMode = fals
387
406
  React.createElement(Text, { bold: true, color: currentField === 'description' ? 'green' : 'white' }, "Description:"),
388
407
  React.createElement(Box, { marginLeft: 2 },
389
408
  React.createElement(TextInput, { value: description, onChange: value => setDescription(stripFocusArtifacts(value)), placeholder: "Enter agent description...", focus: currentField === 'description' }))),
409
+ React.createElement(Box, { flexDirection: "column" },
410
+ React.createElement(Text, { bold: true, color: currentField === 'role' ? 'green' : 'white' }, "Role (Optional):"),
411
+ React.createElement(Box, { marginLeft: 2 },
412
+ React.createElement(TextInput, { value: role, onChange: value => setRole(stripFocusArtifacts(value)), placeholder: "Specify agent role to guide output and focus...", focus: currentField === 'role' }))),
390
413
  renderToolSelection(),
391
414
  React.createElement(Box, { marginTop: 1 },
392
415
  React.createElement(Text, { color: "gray", dimColor: true }, "\u2191\u2193: Navigate | \u2190\u2192: Switch category | Space: Toggle | A: Toggle all | Enter: Save | Esc: Back")))));