@mrclrchtr/supi-code-intelligence 6.2.0 → 6.4.0

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 (68) hide show
  1. package/README.md +2 -0
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-lsp/README.md +2 -0
  5. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  7. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/README.md +52 -0
  8. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +785 -129
  9. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +660 -98
  10. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +10 -4
  11. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  12. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +16 -2
  13. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +4 -32
  14. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sources.ts +108 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-process-crash-report.ts +106 -0
  16. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +4 -4
  17. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +513 -113
  18. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -15
  19. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +40 -33
  20. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +36 -6
  21. package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +1 -1
  22. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +18 -9
  23. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  24. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  25. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +29 -1
  26. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +99 -19
  27. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +4 -4
  28. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +94 -18
  29. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +4 -4
  30. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  31. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +14 -14
  32. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +13 -8
  33. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +97 -19
  34. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +4 -4
  35. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +28 -8
  36. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  37. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +28 -8
  38. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  39. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +92 -18
  40. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +4 -4
  41. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +17 -17
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +7 -4
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +2 -2
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
  48. package/package.json +5 -5
  49. package/src/session/health-refresh.ts +19 -12
  50. package/src/session/health-types.ts +8 -3
  51. package/src/session/health-workflow.ts +7 -3
  52. package/src/session/session.ts +12 -5
  53. package/src/substrate/lsp/maintenance.ts +53 -47
  54. package/src/substrate/lsp/settings.ts +2 -1
  55. package/src/substrate/lsp/source-tracking.ts +247 -0
  56. package/src/tool/code_find/guidance.ts +3 -3
  57. package/src/tool/code_graph/guidance.ts +2 -2
  58. package/src/tool/code_health/guidance.ts +3 -3
  59. package/src/tool/code_health/markdown.ts +21 -5
  60. package/src/tool/code_health/refresh-outcome.ts +48 -7
  61. package/src/tool/code_health/refresh-status.ts +83 -16
  62. package/src/tool/code_health/tui.ts +4 -0
  63. package/src/tool/code_inspect/guidance.ts +5 -3
  64. package/src/tool/code_orientation/guidance.ts +3 -4
  65. package/src/tool/code_refactor_apply/guidance.ts +1 -1
  66. package/src/tool/code_refactor_plan/guidance.ts +3 -5
  67. package/src/tool/code_resolve/guidance.ts +3 -3
  68. package/src/tool/guidance.ts +11 -9
@@ -126,7 +126,21 @@ function setModule(module2) {
126
126
  __name(setModule, "setModule");
127
127
  var C;
128
128
 
129
+ // src/finalization_registry.ts
130
+ function newFinalizer(handler) {
131
+ try {
132
+ return new FinalizationRegistry(handler);
133
+ } catch (e) {
134
+ console.error("Unsupported FinalizationRegistry:", e);
135
+ return;
136
+ }
137
+ }
138
+ __name(newFinalizer, "newFinalizer");
139
+
129
140
  // src/lookahead_iterator.ts
141
+ var finalizer = newFinalizer((address) => {
142
+ C._ts_lookahead_iterator_delete(address);
143
+ });
130
144
  var LookaheadIterator = class {
131
145
  static {
132
146
  __name(this, "LookaheadIterator");
@@ -137,21 +151,39 @@ var LookaheadIterator = class {
137
151
  /** @internal */
138
152
  language;
139
153
  /** @internal */
154
+ positioned = false;
155
+ /** @internal */
140
156
  constructor(internal, address, language) {
141
157
  assertInternal(internal);
142
158
  this[0] = address;
143
159
  this.language = language;
160
+ finalizer?.register(this, address, this);
144
161
  }
145
- /** Get the current symbol of the lookahead iterator. */
162
+ /**
163
+ * Get the current symbol of the lookahead iterator.
164
+ *
165
+ * Returns `null` if the iterator is not positioned on a symbol:
166
+ *
167
+ * - Before the first iteration step
168
+ * - After the iterator is exhausted
169
+ * - After a {@link reset} or {@link resetState} call
170
+ */
146
171
  get currentTypeId() {
147
- return C._ts_lookahead_iterator_current_symbol(this[0]);
172
+ return this.positioned ? C._ts_lookahead_iterator_current_symbol(this[0]) : null;
148
173
  }
149
- /** Get the current symbol name of the lookahead iterator. */
174
+ /**
175
+ * Get the current symbol name of the lookahead iterator.
176
+ *
177
+ * Returns `null` if the iterator is not positioned on a symbol.
178
+ */
150
179
  get currentType() {
151
- return this.language.types[this.currentTypeId] || "ERROR";
180
+ const id = this.currentTypeId;
181
+ if (id === null) return null;
182
+ return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
152
183
  }
153
184
  /** Delete the lookahead iterator, freeing its resources. */
154
185
  delete() {
186
+ finalizer?.unregister(this);
155
187
  C._ts_lookahead_iterator_delete(this[0]);
156
188
  this[0] = 0;
157
189
  }
@@ -164,6 +196,7 @@ var LookaheadIterator = class {
164
196
  reset(language, stateId) {
165
197
  if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
166
198
  this.language = language;
199
+ this.positioned = false;
167
200
  return true;
168
201
  }
169
202
  return false;
@@ -175,7 +208,9 @@ var LookaheadIterator = class {
175
208
  * `false` otherwise.
176
209
  */
177
210
  resetState(stateId) {
178
- return Boolean(C._ts_lookahead_iterator_reset_state(this[0], stateId));
211
+ if (!C._ts_lookahead_iterator_reset_state(this[0], stateId)) return false;
212
+ this.positioned = false;
213
+ return true;
179
214
  }
180
215
  /**
181
216
  * Returns an iterator that iterates over the symbols of the lookahead iterator.
@@ -186,10 +221,9 @@ var LookaheadIterator = class {
186
221
  [Symbol.iterator]() {
187
222
  return {
188
223
  next: /* @__PURE__ */ __name(() => {
189
- if (C._ts_lookahead_iterator_next(this[0])) {
190
- return { done: false, value: this.currentType };
191
- }
192
- return { done: true, value: "" };
224
+ this.positioned = Boolean(C._ts_lookahead_iterator_next(this[0]));
225
+ const value = this.currentType;
226
+ return value === null ? { done: true, value: "" } : { done: false, value };
193
227
  }, "next")
194
228
  };
195
229
  }
@@ -217,6 +251,9 @@ function getText(tree, startIndex, endIndex, startPosition) {
217
251
  return result ?? "";
218
252
  }
219
253
  __name(getText, "getText");
254
+ var finalizer2 = newFinalizer((address) => {
255
+ C._ts_tree_delete(address);
256
+ });
220
257
  var Tree = class _Tree {
221
258
  static {
222
259
  __name(this, "Tree");
@@ -234,6 +271,7 @@ var Tree = class _Tree {
234
271
  this[0] = address;
235
272
  this.language = language;
236
273
  this.textCallback = textCallback;
274
+ finalizer2?.register(this, address, this);
237
275
  }
238
276
  /** Create a shallow copy of the syntax tree. This is very fast. */
239
277
  copy() {
@@ -242,6 +280,7 @@ var Tree = class _Tree {
242
280
  }
243
281
  /** Delete the syntax tree, freeing its resources. */
244
282
  delete() {
283
+ finalizer2?.unregister(this);
245
284
  C._ts_tree_delete(this[0]);
246
285
  this[0] = 0;
247
286
  }
@@ -324,6 +363,9 @@ var Tree = class _Tree {
324
363
  };
325
364
 
326
365
  // src/tree_cursor.ts
366
+ var finalizer3 = newFinalizer((address) => {
367
+ C._ts_tree_cursor_delete_wasm(address);
368
+ });
327
369
  var TreeCursor = class _TreeCursor {
328
370
  static {
329
371
  __name(this, "TreeCursor");
@@ -351,6 +393,7 @@ var TreeCursor = class _TreeCursor {
351
393
  assertInternal(internal);
352
394
  this.tree = tree;
353
395
  unmarshalTreeCursor(this);
396
+ finalizer3?.register(this, this.tree[0], this);
354
397
  }
355
398
  /** Creates a deep copy of the tree cursor. This allocates new memory. */
356
399
  copy() {
@@ -361,6 +404,7 @@ var TreeCursor = class _TreeCursor {
361
404
  }
362
405
  /** Delete the tree cursor, freeing its resources. */
363
406
  delete() {
407
+ finalizer3?.unregister(this);
364
408
  marshalTreeCursor(this);
365
409
  C._ts_tree_cursor_delete_wasm(this.tree[0]);
366
410
  this[0] = this[1] = this[2] = 0;
@@ -1461,8 +1505,9 @@ var Language = class _Language {
1461
1505
  * This returns `null` if state is invalid for this language.
1462
1506
  *
1463
1507
  * Iterating {@link LookaheadIterator} will yield valid symbols in the given
1464
- * parse state. Newly created lookahead iterators will return the `ERROR`
1465
- * symbol from {@link LookaheadIterator#currentType}.
1508
+ * parse state. A newly created iterator is not positioned on a symbol, so
1509
+ * {@link LookaheadIterator#currentType} returns `null` until the first
1510
+ * iteration step.
1466
1511
  *
1467
1512
  * Lookahead iterators can be useful for generating suggestions and improving
1468
1513
  * syntax error diagnostics. To get symbols valid in an `ERROR` node, use the
@@ -1477,7 +1522,8 @@ var Language = class _Language {
1477
1522
  }
1478
1523
  /**
1479
1524
  * Load a language from a WebAssembly module.
1480
- * The module can be provided as a path to a file or as a buffer.
1525
+ * The module can be provided as a path to a file, a `URL` to a file, or as a
1526
+ * buffer.
1481
1527
  */
1482
1528
  static async load(input) {
1483
1529
  let binary2;
@@ -1504,16 +1550,27 @@ ${body2}`);
1504
1550
  }
1505
1551
  }
1506
1552
  const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
1553
+ return _Language.loadFromWasmExports(mod, { sync: false });
1554
+ }
1555
+ static loadFromWasmExports(mod, { sync }) {
1507
1556
  const symbolNames = Object.keys(mod);
1508
1557
  const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
1509
1558
  if (!functionName) {
1510
1559
  console.log(`Couldn't find language function in Wasm file. Symbols:
1511
1560
  ${JSON.stringify(symbolNames, null, 2)}`);
1512
- throw new Error("Language.load failed: no language function found in Wasm file");
1561
+ throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
1513
1562
  }
1514
1563
  const languageAddress = mod[functionName]();
1515
1564
  return new _Language(INTERNAL, languageAddress);
1516
1565
  }
1566
+ /**
1567
+ * Load a language synchronously from a pre-compiled WebAssembly module.
1568
+ * Use this when the host environment provides a `WebAssembly.Module` directly.
1569
+ */
1570
+ static loadSync(wasmModule) {
1571
+ const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
1572
+ return _Language.loadFromWasmExports(mod, { sync: true });
1573
+ }
1517
1574
  };
1518
1575
 
1519
1576
  // lib/web-tree-sitter.mjs
@@ -2299,7 +2356,7 @@ async function Module2(moduleArg = {}) {
2299
2356
  newDSO("__main__", 0, wasmImports);
2300
2357
  }
2301
2358
  };
2302
- var ___heap_base = 78224;
2359
+ var ___heap_base = 82240;
2303
2360
  var alignMemory = /* @__PURE__ */ __name((size, alignment) => {
2304
2361
  assert(alignment, "alignment argument is required");
2305
2362
  return Math.ceil(size / alignment) * alignment;
@@ -2930,12 +2987,12 @@ async function Module2(moduleArg = {}) {
2930
2987
  "value": "i32",
2931
2988
  "mutable": false
2932
2989
  }, 1024);
2933
- var ___stack_high = 78224;
2934
- var ___stack_low = 12688;
2990
+ var ___stack_high = 82240;
2991
+ var ___stack_low = 16704;
2935
2992
  var ___stack_pointer = new WebAssembly.Global({
2936
2993
  "value": "i32",
2937
2994
  "mutable": true
2938
- }, 78224);
2995
+ }, 82240);
2939
2996
  var ___table_base = new WebAssembly.Global({
2940
2997
  "value": "i32",
2941
2998
  "mutable": false
@@ -3287,6 +3344,7 @@ async function Module2(moduleArg = {}) {
3287
3344
  var _ts_query_new = Module["_ts_query_new"] = makeInvalidEarlyAccess("_ts_query_new");
3288
3345
  var _ts_query_delete = Module["_ts_query_delete"] = makeInvalidEarlyAccess("_ts_query_delete");
3289
3346
  var _iswspace = Module["_iswspace"] = makeInvalidEarlyAccess("_iswspace");
3347
+ var _ts_query_copy = Module["_ts_query_copy"] = makeInvalidEarlyAccess("_ts_query_copy");
3290
3348
  var _ts_query_pattern_count = Module["_ts_query_pattern_count"] = makeInvalidEarlyAccess("_ts_query_pattern_count");
3291
3349
  var _ts_query_capture_count = Module["_ts_query_capture_count"] = makeInvalidEarlyAccess("_ts_query_capture_count");
3292
3350
  var _ts_query_string_count = Module["_ts_query_string_count"] = makeInvalidEarlyAccess("_ts_query_string_count");
@@ -3396,6 +3454,7 @@ async function Module2(moduleArg = {}) {
3396
3454
  var _iswblank = Module["_iswblank"] = makeInvalidEarlyAccess("_iswblank");
3397
3455
  var _iswdigit = Module["_iswdigit"] = makeInvalidEarlyAccess("_iswdigit");
3398
3456
  var _iswlower = Module["_iswlower"] = makeInvalidEarlyAccess("_iswlower");
3457
+ var _iswpunct = Module["_iswpunct"] = makeInvalidEarlyAccess("_iswpunct");
3399
3458
  var _iswupper = Module["_iswupper"] = makeInvalidEarlyAccess("_iswupper");
3400
3459
  var _iswxdigit = Module["_iswxdigit"] = makeInvalidEarlyAccess("_iswxdigit");
3401
3460
  var _memchr = Module["_memchr"] = makeInvalidEarlyAccess("_memchr");
@@ -3446,6 +3505,7 @@ async function Module2(moduleArg = {}) {
3446
3505
  Module["_ts_query_new"] = _ts_query_new = createExportWrapper("ts_query_new", 5);
3447
3506
  Module["_ts_query_delete"] = _ts_query_delete = createExportWrapper("ts_query_delete", 1);
3448
3507
  Module["_iswspace"] = _iswspace = createExportWrapper("iswspace", 1);
3508
+ Module["_ts_query_copy"] = _ts_query_copy = createExportWrapper("ts_query_copy", 1);
3449
3509
  Module["_ts_query_pattern_count"] = _ts_query_pattern_count = createExportWrapper("ts_query_pattern_count", 1);
3450
3510
  Module["_ts_query_capture_count"] = _ts_query_capture_count = createExportWrapper("ts_query_capture_count", 1);
3451
3511
  Module["_ts_query_string_count"] = _ts_query_string_count = createExportWrapper("ts_query_string_count", 1);
@@ -3555,6 +3615,7 @@ async function Module2(moduleArg = {}) {
3555
3615
  Module["_iswblank"] = _iswblank = createExportWrapper("iswblank", 1);
3556
3616
  Module["_iswdigit"] = _iswdigit = createExportWrapper("iswdigit", 1);
3557
3617
  Module["_iswlower"] = _iswlower = createExportWrapper("iswlower", 1);
3618
+ Module["_iswpunct"] = _iswpunct = createExportWrapper("iswpunct", 1);
3558
3619
  Module["_iswupper"] = _iswupper = createExportWrapper("iswupper", 1);
3559
3620
  Module["_iswxdigit"] = _iswxdigit = createExportWrapper("iswxdigit", 1);
3560
3621
  Module["_memchr"] = _memchr = createExportWrapper("memchr", 3);
@@ -3645,7 +3706,7 @@ async function Module2(moduleArg = {}) {
3645
3706
  }
3646
3707
  __name(callMain, "callMain");
3647
3708
  function stackCheckInit() {
3648
- _emscripten_stack_set_limits(78224, 12688);
3709
+ _emscripten_stack_set_limits(82240, 16704);
3649
3710
  writeStackCookie();
3650
3711
  }
3651
3712
  __name(stackCheckInit, "stackCheckInit");
@@ -3747,6 +3808,10 @@ __name(checkModule, "checkModule");
3747
3808
  var TRANSFER_BUFFER;
3748
3809
  var LANGUAGE_VERSION;
3749
3810
  var MIN_COMPATIBLE_VERSION;
3811
+ var finalizer4 = newFinalizer((addresses) => {
3812
+ C._ts_parser_delete(addresses[0]);
3813
+ C._free(addresses[1]);
3814
+ });
3750
3815
  var Parser = class {
3751
3816
  static {
3752
3817
  __name(this, "Parser");
@@ -3778,6 +3843,7 @@ var Parser = class {
3778
3843
  */
3779
3844
  constructor() {
3780
3845
  this.initialize();
3846
+ finalizer4?.register(this, [this[0], this[1]], this);
3781
3847
  }
3782
3848
  /** @internal */
3783
3849
  initialize() {
@@ -3790,6 +3856,7 @@ var Parser = class {
3790
3856
  }
3791
3857
  /** Delete the parser, freeing its resources. */
3792
3858
  delete() {
3859
+ finalizer4?.unregister(this);
3793
3860
  C._ts_parser_delete(this[0]);
3794
3861
  C._free(this[1]);
3795
3862
  this[0] = 0;
@@ -3967,6 +4034,10 @@ var QueryError = class _QueryError extends Error {
3967
4034
  this.length = length;
3968
4035
  this.name = "QueryError";
3969
4036
  }
4037
+ kind;
4038
+ info;
4039
+ index;
4040
+ length;
3970
4041
  static {
3971
4042
  __name(this, "QueryError");
3972
4043
  }
@@ -4162,6 +4233,9 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
4162
4233
  }
4163
4234
  }
4164
4235
  __name(parsePattern, "parsePattern");
4236
+ var finalizer5 = newFinalizer((address) => {
4237
+ C._ts_query_delete(address);
4238
+ });
4165
4239
  var Query = class {
4166
4240
  static {
4167
4241
  __name(this, "Query");
@@ -4316,9 +4390,11 @@ var Query = class {
4316
4390
  this.assertedProperties = assertedProperties;
4317
4391
  this.refutedProperties = refutedProperties;
4318
4392
  this.exceededMatchLimit = false;
4393
+ finalizer5?.register(this, address, this);
4319
4394
  }
4320
4395
  /** Delete the query, freeing its resources. */
4321
4396
  delete() {
4397
+ finalizer5?.unregister(this);
4322
4398
  C._ts_query_delete(this[0]);
4323
4399
  this[0] = 0;
4324
4400
  }