@mrclrchtr/supi-code-intelligence 11.1.0 → 11.3.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 (199) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +41 -6
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  6. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  7. package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  8. package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  9. package/node_modules/@mrclrchtr/supi-lsp/README.md +81 -7
  10. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  11. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  12. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/LICENSE +15 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
  34. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
  37. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
  40. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
  45. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
  52. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
  53. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
  56. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
  57. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
  63. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
  65. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
  66. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
  67. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
  69. package/node_modules/@mrclrchtr/supi-lsp/package.json +5 -3
  70. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
  71. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
  72. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
  73. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +174 -49
  75. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
  76. package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
  77. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
  78. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
  79. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
  80. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
  81. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
  82. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +306 -75
  83. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
  84. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
  85. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +19 -2
  86. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
  87. package/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +27 -15
  88. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +5 -1
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +5 -1
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
  104. package/package.json +6 -5
  105. package/src/analysis/capability/capability-warnings.ts +18 -12
  106. package/src/analysis/health/check.ts +115 -0
  107. package/src/analysis/health/diagnostics.ts +3 -0
  108. package/src/analysis/health/file-scope.ts +2 -3
  109. package/src/analysis/health/semantic-state.ts +38 -0
  110. package/src/analysis/health/server-status.ts +14 -2
  111. package/src/analysis/health/signals.ts +2 -0
  112. package/src/analysis/health/status.ts +82 -0
  113. package/src/analysis/refactor/apply.ts +17 -8
  114. package/src/analysis/search/exclusions.ts +47 -0
  115. package/src/analysis/search/paths.ts +32 -9
  116. package/src/analysis/target/anchored-structural.ts +3 -8
  117. package/src/analysis/target/anchored.ts +4 -20
  118. package/src/analysis/target/identity.ts +1 -1
  119. package/src/analysis/target/latex-label-container.ts +6 -6
  120. package/src/analysis/target/latex-section-anchor.ts +6 -6
  121. package/src/analysis/target/resolution.ts +18 -0
  122. package/src/analysis/target/symbol.ts +39 -11
  123. package/src/analysis/target/types.ts +6 -1
  124. package/src/extension.ts +17 -11
  125. package/src/session/graph/collect.ts +1 -10
  126. package/src/session/graph-types.ts +2 -0
  127. package/src/session/graph-workflow.ts +1 -0
  128. package/src/session/health-types.ts +7 -0
  129. package/src/session/health-workflow.ts +8 -43
  130. package/src/session/inspect/collect.ts +8 -2
  131. package/src/session/inspect/file-point.ts +2 -3
  132. package/src/session/inspect-workflow.ts +1 -1
  133. package/src/session/orientation/collect.ts +184 -20
  134. package/src/session/orientation/context-facts.ts +27 -2
  135. package/src/session/orientation/context-sections.ts +49 -3
  136. package/src/session/orientation/facts.ts +132 -0
  137. package/src/session/orientation/gather.ts +98 -11
  138. package/src/session/orientation/workspace-context.ts +16 -6
  139. package/src/session/orientation-types.ts +8 -0
  140. package/src/session/orientation-workflow.ts +20 -6
  141. package/src/session/refactor-identity.ts +76 -0
  142. package/src/session/refactor-plans.ts +5 -2
  143. package/src/session/refactor-workflow.ts +15 -17
  144. package/src/session/target-store.ts +3 -18
  145. package/src/session/target-workflow.ts +33 -16
  146. package/src/substrate/lsp/recovery.ts +5 -5
  147. package/src/tool/code_find/guidance.ts +1 -1
  148. package/src/tool/code_find/render.ts +8 -4
  149. package/src/tool/code_find/result.ts +78 -6
  150. package/src/tool/code_find/spec.ts +4 -3
  151. package/src/tool/code_find/structured.ts +25 -9
  152. package/src/tool/code_graph/details.ts +1 -0
  153. package/src/tool/code_graph/display.ts +1 -1
  154. package/src/tool/code_graph/guidance.ts +1 -1
  155. package/src/tool/code_graph/markdown.ts +11 -6
  156. package/src/tool/code_graph/read-next.ts +38 -9
  157. package/src/tool/code_graph/reference-selection.ts +30 -0
  158. package/src/tool/code_graph/result.ts +25 -118
  159. package/src/tool/code_graph/section.ts +133 -0
  160. package/src/tool/code_graph/spec.ts +3 -3
  161. package/src/tool/code_graph/structured.ts +17 -6
  162. package/src/tool/code_health/display-paths.ts +92 -0
  163. package/src/tool/code_health/file-scope-markdown.ts +3 -2
  164. package/src/tool/code_health/markdown.ts +12 -2
  165. package/src/tool/code_health/result.ts +18 -3
  166. package/src/tool/code_health/spec.ts +5 -3
  167. package/src/tool/code_health/structured-schema.ts +250 -0
  168. package/src/tool/code_health/structured.ts +256 -0
  169. package/src/tool/code_inspect/result.ts +11 -5
  170. package/src/tool/code_inspect/spec.ts +7 -1
  171. package/src/tool/code_inspect/structured.ts +231 -0
  172. package/src/tool/code_orientation/execute.ts +1 -1
  173. package/src/tool/code_orientation/result.ts +31 -8
  174. package/src/tool/code_orientation/spec.ts +2 -0
  175. package/src/tool/code_orientation/structured-schema.ts +617 -0
  176. package/src/tool/code_orientation/structured-workspace.ts +194 -0
  177. package/src/tool/code_orientation/structured.ts +189 -0
  178. package/src/tool/code_orientation/workspace-format.ts +2 -5
  179. package/src/tool/code_orientation/workspace-observations.ts +81 -0
  180. package/src/tool/code_orientation/workspace-output.ts +5 -0
  181. package/src/tool/code_orientation/workspace-projects.ts +16 -31
  182. package/src/tool/code_orientation/workspace-sections.ts +46 -32
  183. package/src/tool/code_refactor_apply/execute.ts +1 -1
  184. package/src/tool/code_refactor_apply/result.ts +14 -6
  185. package/src/tool/code_refactor_apply/spec.ts +2 -0
  186. package/src/tool/code_refactor_apply/structured.ts +49 -0
  187. package/src/tool/code_refactor_plan/result.ts +18 -9
  188. package/src/tool/code_refactor_plan/spec.ts +2 -0
  189. package/src/tool/code_refactor_plan/structured.ts +127 -0
  190. package/src/tool/code_resolve/markdown.ts +6 -30
  191. package/src/tool/code_resolve/result.ts +24 -11
  192. package/src/tool/code_resolve/structured.ts +7 -9
  193. package/src/tool/result/refactor.ts +8 -5
  194. package/src/tool/result/structured.ts +8 -5
  195. package/src/tool/result/types.ts +18 -14
  196. package/src/tool/schemas.ts +12 -6
  197. package/src/ui/status-command.ts +147 -322
  198. package/src/ui/status-overlay.ts +584 -421
  199. package/src/ui/status-presentation.ts +108 -0
@@ -139,6 +139,8 @@ function recordScopeDecisionEvent(manager: LspManager): void {
139
139
  }
140
140
  }
141
141
 
142
+ const FILE_STARTUP_FAILURE_REASON = "The routed LSP client could not be started for this file";
143
+
142
144
  class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
143
145
  constructor(private readonly manager: LspManager) {}
144
146
 
@@ -157,6 +159,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
157
159
  const resolvedPath = this.resolveFilePath(filePath);
158
160
  const client = await this.manager.ensureFileOpen(resolvedPath, {
159
161
  recoverProcessCrash: true,
162
+ protectInputs: true,
160
163
  control,
161
164
  });
162
165
  if (!client) return unavailableFileQuery("hover", resolvedPath);
@@ -171,6 +174,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
171
174
  const resolvedPath = this.resolveFilePath(filePath);
172
175
  const client = await this.manager.ensureFileOpen(resolvedPath, {
173
176
  recoverProcessCrash: true,
177
+ protectInputs: true,
174
178
  control,
175
179
  });
176
180
  if (!client) return unavailableFileQuery("definition", resolvedPath);
@@ -185,6 +189,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
185
189
  const resolvedPath = this.resolveFilePath(filePath);
186
190
  const client = await this.manager.ensureFileOpen(resolvedPath, {
187
191
  recoverProcessCrash: true,
192
+ protectInputs: true,
188
193
  control,
189
194
  });
190
195
  if (!client) return unavailableFileQuery("references", resolvedPath);
@@ -202,6 +207,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
202
207
  const resolvedPath = this.resolveFilePath(filePath);
203
208
  const client = await this.manager.ensureFileOpen(resolvedPath, {
204
209
  recoverProcessCrash: true,
210
+ protectInputs: true,
205
211
  control,
206
212
  });
207
213
  if (!client) return unavailableFileQuery("implementation", resolvedPath);
@@ -215,6 +221,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
215
221
  const resolvedPath = this.resolveFilePath(filePath);
216
222
  const client = await this.manager.ensureFileOpen(resolvedPath, {
217
223
  recoverProcessCrash: true,
224
+ protectInputs: true,
218
225
  control,
219
226
  });
220
227
  if (!client) return unavailableFileQuery("document symbols", resolvedPath);
@@ -260,6 +267,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
260
267
  const resolvedPath = this.resolveFilePath(filePath);
261
268
  const client = await this.manager.ensureFileOpen(resolvedPath, {
262
269
  recoverProcessCrash: true,
270
+ protectInputs: true,
263
271
  control,
264
272
  });
265
273
  if (!client) return null;
@@ -309,7 +317,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
309
317
  const processCrashRecovery = this.manager.getProcessCrashRecoveryReportForFile(resolvedPath);
310
318
  return {
311
319
  kind: "unavailable",
312
- reason: "No LSP client can serve this file",
320
+ reason: this.fileUnavailableReason(resolvedPath, "No LSP client can serve this file"),
313
321
  ...(processCrashRecovery ? { processCrashRecovery } : {}),
314
322
  };
315
323
  }
@@ -347,7 +355,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
347
355
  if (!client) {
348
356
  return {
349
357
  kind: "unavailable",
350
- reason: "The routed LSP client could not be started for this file",
358
+ reason: this.fileUnavailableReason(resolvedPath, FILE_STARTUP_FAILURE_REASON),
351
359
  ...startup,
352
360
  ...recovery,
353
361
  };
@@ -355,6 +363,15 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
355
363
  return { kind: "ready", ...startup, ...recovery };
356
364
  }
357
365
 
366
+ private fileUnavailableReason(filePath: string, configuredRouteReason: string): string {
367
+ if (!this.manager.hasConfiguredServerForFile(filePath)) {
368
+ return "No compatible LSP server is configured for this file";
369
+ }
370
+ return this.manager.hasFailedStartupForFile(filePath)
371
+ ? FILE_STARTUP_FAILURE_REASON
372
+ : configuredRouteReason;
373
+ }
374
+
358
375
  /**
359
376
  * Wait until all started LSP clients are ready for semantic queries.
360
377
  * Performs one representative warm-up probe per client/root.
@@ -21,6 +21,7 @@ export async function runRoutedRename(options: {
21
21
  const { manager, file, position, newName, control } = options;
22
22
  const client = await manager.ensureFileOpen(file, {
23
23
  recoverProcessCrash: true,
24
+ protectInputs: true,
24
25
  control,
25
26
  });
26
27
  if (!client) return null;
@@ -7,6 +7,7 @@ import type {
7
7
  MissingServer,
8
8
  ServerConfig,
9
9
  } from "../config/types.ts";
10
+ import { inspectTypeScriptLaunch } from "../config/typescript-launch.ts";
10
11
  import type { LspManager } from "../manager/manager.ts";
11
12
  import { commandExists } from "../utils.ts";
12
13
  import {
@@ -32,20 +33,16 @@ export function scanProjectCapabilities(
32
33
 
33
34
  return Object.entries(config.servers)
34
35
  .flatMap(([serverName, server]) => {
35
- if (!commandExists(server.command)) return [];
36
36
  const allRoots = new Set(markerMatches.get(serverName) ?? []);
37
37
  if (extensionBasedServers.has(serverName)) {
38
38
  allRoots.add(cwd);
39
39
  }
40
40
  const roots = dedupeTopmostRoots(Array.from(allRoots));
41
- return roots.map(
42
- (root) =>
43
- ({
44
- name: serverName,
45
- root,
46
- fileTypes: [...server.fileTypes],
47
- }) satisfies DetectedProjectServer,
48
- );
41
+ return roots.flatMap((root) => {
42
+ const { command, ...selection } = inspectTypeScriptLaunch(serverName, server, root);
43
+ if (!selection.failureMessage && !commandExists(command)) return [];
44
+ return [{ name: serverName, root, fileTypes: [...server.fileTypes], ...selection }];
45
+ });
49
46
  })
50
47
  .sort((a, b) => a.root.localeCompare(b.root) || a.name.localeCompare(b.name));
51
48
  }
@@ -79,8 +76,6 @@ function inspectDirectory(
79
76
  ctx: HintContext,
80
77
  ): void {
81
78
  for (const [serverName, server] of Object.entries(servers)) {
82
- if (!commandExists(server.command)) continue;
83
-
84
79
  if (server.rootMarkers.length === 0) {
85
80
  if (hasMatchingFile(directory, entryNames, server.fileTypes)) {
86
81
  ctx.extensionBasedServers.add(serverName);
@@ -122,7 +117,7 @@ export async function startDetectedServers(
122
117
 
123
118
  /**
124
119
  * Scan the project for languages whose source files exist but whose LSP server
125
- * binary is not installed on PATH. Walks the project directory tree collecting
120
+ * executable or selected compiler is unavailable. Walks the project tree collecting
126
121
  * file extensions, then checks each configured server.
127
122
  */
128
123
  export function scanMissingServers(
@@ -142,14 +137,31 @@ export function scanMissingServers(
142
137
  });
143
138
 
144
139
  const missing: MissingServer[] = [];
140
+ const { markerMatches } = collectServerHints(config, cwd, maxDepth, policy);
145
141
 
146
142
  for (const [name, server] of Object.entries(config.servers)) {
147
- if (commandExists(server.command)) continue;
148
-
149
143
  const matching = server.fileTypes.filter((ft) => foundExtensions.has(ft));
150
144
  if (matching.length === 0) continue;
151
145
 
152
- missing.push({ name, command: server.command, foundExtensions: matching });
146
+ const roots = dedupeTopmostRoots(Array.from(markerMatches.get(name) ?? []));
147
+ for (const root of roots.length ? roots : [cwd]) {
148
+ const selection = inspectTypeScriptLaunch(name, server, root);
149
+ const command = selection.command;
150
+ if (selection.failureMessage) {
151
+ missing.push({
152
+ name,
153
+ command,
154
+ foundExtensions: matching,
155
+ root,
156
+ failureMessage: selection.failureMessage,
157
+ });
158
+ continue;
159
+ }
160
+ if (!commandExists(command)) {
161
+ missing.push({ name, command, foundExtensions: matching });
162
+ break;
163
+ }
164
+ }
153
165
  }
154
166
 
155
167
  return missing;
@@ -143,7 +143,11 @@ export interface WorkspaceLspRuntime extends WorkspaceLspDiagnosticSurface {
143
143
  filePath: string,
144
144
  control?: CodeRequestControl,
145
145
  ): Promise<CodeQueryResult<DocumentSymbol[] | SymbolInformation[]>>;
146
- /** Collect symbols from routes that can contribute within the optional path scopes. */
146
+ /**
147
+ * Collect symbols from contributing routes; completeness is relative to scopes.
148
+ * Data may include out-of-scope rows, which callers must filter themselves.
149
+ * Only policy exclusions proven outside every scope are irrelevant to completeness.
150
+ */
147
151
  workspaceSymbol(
148
152
  query: string,
149
153
  control?: CodeRequestControl,
@@ -82,11 +82,11 @@ The `type` filter accepts `class`, `interface`, `type`, `enum`, `struct`, `union
82
82
  ### Extraction limits
83
83
 
84
84
  - TS/JS, Python, Java, Go, Rust, and C/C++ outlines include nested named declarations and members. They are not complete indexes of local variables, parameters, or anonymous expressions. Other languages retain their existing extraction depth. HTML outlines list only elements with non-empty `id` attributes. SQL outlines list supported `CREATE` declarations and first-level table/type members. LaTeX outlines list section headings and selected command, environment, label, acronym, glossary-entry, and color definitions.
85
- - TypeScript and TSX use [checked build-time grammar patches](scripts/generate-typescript-wasm.mjs) for type-only star re-exports and arrays of qualified import types such as `import("node:fs").Dirent[]`. Runtime parsing retains the original source and coordinates; other grammar gaps still report recovered syntax.
85
+ - TypeScript and TSX use [checked build-time grammar patches](scripts/generate-typescript-wasm.mjs) for type-only star re-exports, arrays of qualified import types such as `import("node:fs").Dirent[]`, and import types in generic calls such as `read<import("./api").Value>()` or `read<typeof import("./api")>()`. Runtime parsing retains the original source and coordinates; other grammar gaps still report recovered syntax.
86
86
  - JavaScript-family imports collect `import` statements, not CommonJS `require()` calls. Exports collect file-level `export` statements, including TypeScript `export =`; they do not collect `module.exports` assignments or nested namespace exports. An eligible `.cjs` file can therefore return no imports or exports.
87
87
  - Python imports retain `import`/`from` module targets, including relative prefixes. Java imports retain ordinary/static targets. Go imports retain single/grouped paths. Rust imports retain explicit `use` paths, `extern crate`, and external `mod` names; inline module bodies are not imports. C/C++ imports retain literal quoted and angle-bracket include targets. Grouped paths use explicit syntax only; no files or bindings are resolved. Conditional directives are written evidence, not proof of active dependencies. Dynamic loaders, computed targets, and C++20 module imports remain outside extraction support.
88
88
  - LaTeX imports include package, class, source, and bibliography directives. Bibliography directives can refer to `.bib` files, but the grammar does not parse those files.
89
- - Call-site and callee queries use syntax, not resolved symbol identity. Distinct sites have source ranges; repeated names on one line are not merged. Rust macro invocations are syntax evidence, not expanded calls. JSX tags are not call expressions. Library callee queries work without LSP, but new `code_graph` targets require semantic readiness in Code Intelligence.
89
+ - Call-site and callee queries use syntax, not resolved symbol identity. Distinct sites have source ranges; repeated names on one line are not merged. Rust macro invocations are syntax evidence, not expanded calls. JSX tags and TypeScript/TSX import references in type syntax are excluded; dynamic import expressions remain call sites. Library callee queries work without LSP, but new `code_graph` targets require semantic readiness in Code Intelligence.
90
90
  - `.jsx` uses JavaScript; `.tsx` uses the separate TSX grammar. `.h` uses C by default. An explicit session association can select C++ without changing the supported suffix set. `.zsh` and `.ksh` use Bash; this is not complete support for those shell dialects.
91
91
  - Go module manifests (`.mod`), Ruby ERB templates (`.erb`), and BibTeX (`.bib`) have [built-in LSP routes](../supi-lsp/README.md#built-in-route-matrix), but no AST grammar. Unlisted extensions, including JSON, YAML, TOML, and CSS, have no grammar. Custom LSP configuration does not add one.
92
92
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -77,7 +77,9 @@ export interface SemanticProvider {
77
77
  ): Promise<CodeQueryResult<DocumentCodeSymbol[]>>;
78
78
  /**
79
79
  * Collect workspace symbols from routes that can contribute within the
80
- * optional canonical path scopes.
80
+ * optional path scopes. Completeness is relative to those scopes, but data
81
+ * may include out-of-scope rows; consumers must filter rows themselves.
82
+ * Policy exclusions proven outside every scope do not make the query partial.
81
83
  */
82
84
  workspaceSymbols(
83
85
  query: string,
@@ -3,8 +3,17 @@ export interface CodeQueryPartialMetadata {
3
3
  /** Automatic path-policy evidence removed from a collected result. */
4
4
  readonly automaticPathExclusion?: {
5
5
  readonly excludedCount: number;
6
+ /** Observed policy paths, not canonical navigation paths; retain aliases when presenting exclusions. */
6
7
  readonly examples: readonly string[];
7
8
  };
9
+ /**
10
+ * True when automatic path-policy exclusions are the only reason the result
11
+ * is partial: every contributing provider branch completed and no coverage
12
+ * gap was observed. Excluded rows matched paths the workspace policy treats
13
+ * as out of automatic scope, so the retained rows are the complete in-policy
14
+ * answer.
15
+ */
16
+ readonly exclusionOnly?: boolean;
8
17
  }
9
18
 
10
19
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,110 @@
1
+ // Session-provided Web tools for SuPi child sessions (Agent Runs and Reviewer Sessions).
2
+ //
3
+ // The loaded supi-web extension answers a synchronous request on the parent event bus.
4
+ // Consumers never depend on supi-web; when it is absent or provides no tools, the
5
+ // request returns undefined and the child simply lacks Web tools.
6
+
7
+ import type { ExtensionAPI, ExtensionFactory } from "@earendil-works/pi-coding-agent";
8
+
9
+ /** Web tools that child sessions may receive when the containing session provides them. */
10
+ export const CHILD_WEB_TOOL_NAMES = [
11
+ "web_fetch_md",
12
+ "web_search",
13
+ "web_docs_search",
14
+ "web_docs_fetch",
15
+ ] as const;
16
+
17
+ /** One session-provided Web tool name. */
18
+ export type ChildWebToolName = (typeof CHILD_WEB_TOOL_NAMES)[number];
19
+
20
+ /**
21
+ * Web tools currently callable in the containing session plus a child-only extension
22
+ * factory that registers them. The factory must not capture the parent session; it may
23
+ * capture plain data such as the containing session's configuration directory.
24
+ */
25
+ export interface ChildWebToolProvision {
26
+ readonly toolNames: readonly ChildWebToolName[];
27
+ /** Register the requested subset of `toolNames` in a child session. */
28
+ readonly createFactory: (toolNames: readonly ChildWebToolName[]) => ExtensionFactory;
29
+ }
30
+
31
+ /** Plain containing-session data supplied with a child Web tool request. */
32
+ export interface ChildWebToolsRequestContext {
33
+ /**
34
+ * Working directory whose SuPi configuration governs Web settings such as Firecrawl.
35
+ * Children with a different cwd (for example a frozen Review Workspace) keep this policy.
36
+ */
37
+ readonly configCwd: string;
38
+ }
39
+
40
+ type EventBusLike = Pick<ExtensionAPI["events"], "on" | "emit">;
41
+
42
+ const REQUEST_CHANNEL = "supi:child-web-tools:request";
43
+ const RESPONSE_CHANNEL = "supi:child-web-tools:response";
44
+
45
+ interface ChildWebToolsRequest extends ChildWebToolsRequestContext {
46
+ readonly requestId: string;
47
+ }
48
+
49
+ interface ChildWebToolsResponse {
50
+ readonly requestId: string;
51
+ readonly provision: ChildWebToolProvision;
52
+ }
53
+
54
+ let nextRequestId = 0;
55
+
56
+ /**
57
+ * Answer child Web tool requests on the parent event bus. The callback must be synchronous
58
+ * because Pi's event bus does not await listeners. Returns an unsubscribe function.
59
+ */
60
+ export function provideChildWebTools(
61
+ events: EventBusLike,
62
+ resolve: (context: ChildWebToolsRequestContext) => ChildWebToolProvision | undefined,
63
+ ): () => void {
64
+ return events.on(REQUEST_CHANNEL, (data) => {
65
+ const request = data as Partial<ChildWebToolsRequest> | undefined;
66
+ if (typeof request?.requestId !== "string" || typeof request.configCwd !== "string") return;
67
+ const { requestId, configCwd } = request;
68
+ const provision = resolve({ configCwd });
69
+ if (!provision || provision.toolNames.length === 0) return;
70
+ events.emit(RESPONSE_CHANNEL, { requestId, provision } satisfies ChildWebToolsResponse);
71
+ });
72
+ }
73
+
74
+ /** Capture the Web tools the containing session currently provides, if any. */
75
+ export function requestChildWebTools(
76
+ events: EventBusLike,
77
+ context: ChildWebToolsRequestContext,
78
+ ): ChildWebToolProvision | undefined {
79
+ const requestId = `child-web-${process.pid}-${++nextRequestId}`;
80
+ let provision: ChildWebToolProvision | undefined;
81
+ const unsubscribe = events.on(RESPONSE_CHANNEL, (data) => {
82
+ const response = data as Partial<ChildWebToolsResponse> | undefined;
83
+ if (response?.requestId === requestId && response.provision) provision = response.provision;
84
+ });
85
+ try {
86
+ events.emit(REQUEST_CHANNEL, { requestId, ...context } satisfies ChildWebToolsRequest);
87
+ } finally {
88
+ unsubscribe();
89
+ }
90
+ return provision;
91
+ }
92
+
93
+ /**
94
+ * Return the Web tools callable in a session under Pi's exposure rules: active `direct`
95
+ * tools, plus registered `codemode` and `deferred` tools. `model-only` and `hidden`
96
+ * tools are not callable.
97
+ */
98
+ export function callableChildWebToolNames(
99
+ pi: Pick<ExtensionAPI, "getAllTools" | "getActiveTools">,
100
+ ): ChildWebToolName[] {
101
+ const active = new Set(pi.getActiveTools());
102
+ const exposures = new Map(
103
+ pi.getAllTools().map((tool) => [tool.name, tool.exposure ?? "direct"] as const),
104
+ );
105
+ return CHILD_WEB_TOOL_NAMES.filter((name) => {
106
+ const exposure = exposures.get(name);
107
+ if (exposure === "direct") return active.has(name);
108
+ return exposure === "codemode" || exposure === "deferred";
109
+ });
110
+ }
@@ -1,5 +1,16 @@
1
1
  // supi-core session domain — session utilities and registries.
2
2
 
3
+ export type {
4
+ ChildWebToolName,
5
+ ChildWebToolProvision,
6
+ ChildWebToolsRequestContext,
7
+ } from "./child-web-tools.ts";
8
+ export {
9
+ CHILD_WEB_TOOL_NAMES,
10
+ callableChildWebToolNames,
11
+ provideChildWebTools,
12
+ requestChildWebTools,
13
+ } from "./child-web-tools.ts";
3
14
  export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
4
15
  export type {
5
16
  SessionCapabilitySkill,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-tree-sitter",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "Structural AST analysis for SuPi code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "jiti": "^2.7.0",
38
38
  "web-tree-sitter": "^0.27.0",
39
- "@mrclrchtr/supi-code-runtime": "11.1.0",
40
- "@mrclrchtr/supi-core": "11.1.0"
39
+ "@mrclrchtr/supi-code-runtime": "11.3.0",
40
+ "@mrclrchtr/supi-core": "11.3.0"
41
41
  },
42
42
  "bundledDependencies": [
43
43
  "@mrclrchtr/supi-code-runtime",
@@ -18,7 +18,11 @@
18
18
  {
19
19
  "id": "import-types-as-primary-types-v1",
20
20
  "file": "common/define-grammar.js"
21
+ },
22
+ {
23
+ "id": "import-type-generic-calls-v1",
24
+ "file": "common/define-grammar.js"
21
25
  }
22
26
  ],
23
- "sha256": "c5101ee00725c52a8aa083afa4749b598a5ff884482f80ed114fca18e88629a6"
27
+ "sha256": "aaa2904a00000d8e058708845172bd3ce7836566c7e16e9ee594c43f4ba4f451"
24
28
  }
@@ -18,7 +18,11 @@
18
18
  {
19
19
  "id": "import-types-as-primary-types-v1",
20
20
  "file": "common/define-grammar.js"
21
+ },
22
+ {
23
+ "id": "import-type-generic-calls-v1",
24
+ "file": "common/define-grammar.js"
21
25
  }
22
26
  ],
23
- "sha256": "db071e260bcfec92f4b11997516dec49393c5086775eb8f090217d38de300c0d"
27
+ "sha256": "86ba3af6f8214c90f32af1ea82214a0c1da87c9e2f5ea47c19577ba5b6c78bfb"
24
28
  }
@@ -2,7 +2,8 @@
2
2
 
3
3
  import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
4
4
  import type { CallSiteMatch, GrammarId, TreeSitterResult } from "../types.ts";
5
- import type { TreeSitterRuntime } from "../worker/runtime.ts";
5
+ import { isTypeOnlyImportCapture } from "../worker/call-context.ts";
6
+ import { queryParsedFile, type TreeSitterRuntime } from "../worker/runtime.ts";
6
7
  import { normalizeCallName } from "./call-name.ts";
7
8
 
8
9
  // ── Per-grammar call-site queries ─────────────────────────────────────
@@ -66,33 +67,47 @@ export async function extractCallSites(
66
67
  };
67
68
  }
68
69
 
69
- const queryResult = await runtime.queryFile(filePath, queryStr, control);
70
- if (queryResult.kind !== "success" && queryResult.kind !== "partial") return queryResult;
70
+ const parsed = await runtime.parseFile(filePath, control);
71
+ if (parsed.kind !== "success") return parsed;
72
+ const { tree, source } = parsed.data;
73
+ try {
74
+ const queryResult = await queryParsedFile(runtime, {
75
+ file: filePath,
76
+ grammarId,
77
+ tree,
78
+ source,
79
+ queryString: queryStr,
80
+ control,
81
+ });
82
+ if (queryResult.kind !== "success" && queryResult.kind !== "partial") return queryResult;
71
83
 
72
- const captures = queryResult.data;
73
- const seen = new Set<string>();
74
- const matches: CallSiteMatch[] = [];
84
+ const seen = new Set<string>();
85
+ const matches: CallSiteMatch[] = [];
75
86
 
76
- for (const capture of captures) {
77
- // Normalize: trim whitespace and collapse internal whitespace to single space
78
- const name = normalizeCallName(capture.text, grammarId, capture.nodeType);
79
- if (name.length === 0) continue;
87
+ for (const capture of queryResult.data) {
88
+ if (isTypeOnlyImportCapture(tree.rootNode, capture, grammarId)) continue;
89
+ // Normalize: trim whitespace and collapse internal whitespace to single space
90
+ const name = normalizeCallName(capture.text, grammarId, capture.nodeType);
91
+ if (name.length === 0) continue;
80
92
 
81
- // Collapse duplicate captures only when they identify the same source range.
82
- const key = `${capture.range.startLine}:${capture.range.startCharacter}:${capture.range.endLine}:${capture.range.endCharacter}`;
83
- if (seen.has(key)) continue;
84
- seen.add(key);
93
+ // Collapse duplicate captures only when they identify the same source range.
94
+ const key = `${capture.range.startLine}:${capture.range.startCharacter}:${capture.range.endLine}:${capture.range.endCharacter}`;
95
+ if (seen.has(key)) continue;
96
+ seen.add(key);
85
97
 
86
- matches.push({
87
- name,
88
- startLine: capture.range.startLine,
89
- startCharacter: capture.range.startCharacter,
90
- endLine: capture.range.endLine,
91
- endCharacter: capture.range.endCharacter,
92
- });
93
- }
98
+ matches.push({
99
+ name,
100
+ startLine: capture.range.startLine,
101
+ startCharacter: capture.range.startCharacter,
102
+ endLine: capture.range.endLine,
103
+ endCharacter: capture.range.endCharacter,
104
+ });
105
+ }
94
106
 
95
- return queryResult.kind === "partial"
96
- ? { ...queryResult, data: matches }
97
- : { kind: "success", data: matches };
107
+ return queryResult.kind === "partial"
108
+ ? { ...queryResult, data: matches }
109
+ : { kind: "success", data: matches };
110
+ } finally {
111
+ tree.delete();
112
+ }
98
113
  }
@@ -6,6 +6,7 @@ import { validatePublicPositionBounds } from "../coordinates.ts";
6
6
  import { withSyntaxCompleteness } from "../syntax-errors.ts";
7
7
  import type { SyntaxNodeLike } from "../syntax-node.ts";
8
8
  import type { GrammarId, SourceRange, TreeSitterResult } from "../types.ts";
9
+ import { isTypeOnlyImportCapture } from "../worker/call-context.ts";
9
10
  import { queryParsedFile, type TreeSitterRuntime } from "../worker/runtime.ts";
10
11
  import { normalizeCallName } from "./call-name.ts";
11
12
  import { createCalleeDisplayName, createSourceLineStarts } from "./callee-display-name.ts";
@@ -384,6 +385,7 @@ function filterCalleeCaptures(
384
385
  if (isInInner) continue;
385
386
  }
386
387
 
388
+ if (isTypeOnlyImportCapture(enclosingNode, capture, grammarId)) continue;
387
389
  const name = normalizeCallName(capture.text, grammarId, capture.nodeType);
388
390
  const rangeKey = sourceRangeKey(capture.range);
389
391
  if (name.length === 0 || seenRanges.has(rangeKey)) continue;
@@ -0,0 +1,44 @@
1
+ import type { Node } from "web-tree-sitter";
2
+ import type { GrammarId, QueryCapture } from "../types.ts";
3
+
4
+ const TYPE_ONLY_CONTEXTS = new Set([
5
+ "type_annotation",
6
+ "type_arguments",
7
+ "type_parameters",
8
+ "type_alias_declaration",
9
+ "type_query",
10
+ "type_predicate",
11
+ "interface_declaration",
12
+ "implements_clause",
13
+ ]);
14
+
15
+ /**
16
+ * Tree-sitter aliases TypeScript import types to call-expression nodes.
17
+ * Exclude those erased references without dropping dynamic import expressions.
18
+ */
19
+ export function isTypeOnlyImportCapture(
20
+ root: Node,
21
+ capture: Pick<QueryCapture, "nodeType" | "range">,
22
+ grammarId: GrammarId,
23
+ ): boolean {
24
+ if (capture.nodeType !== "import" || (grammarId !== "typescript" && grammarId !== "tsx")) {
25
+ return false;
26
+ }
27
+
28
+ let node = root.descendantForPosition(
29
+ { row: capture.range.startLine - 1, column: capture.range.startCharacter - 1 },
30
+ { row: capture.range.endLine - 1, column: capture.range.endCharacter - 1 },
31
+ );
32
+ while (node?.parent) {
33
+ const parent = node.parent;
34
+ if (TYPE_ONLY_CONTEXTS.has(parent.type)) return true;
35
+ if (parent.type === "as_expression" || parent.type === "satisfies_expression") {
36
+ const value = parent.firstNamedChild;
37
+ if (value && (node.startIndex !== value.startIndex || node.endIndex !== value.endIndex)) {
38
+ return true;
39
+ }
40
+ }
41
+ node = parent;
42
+ }
43
+ return false;
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-intelligence",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "LSP and AST navigation, search, diagnostics, and refactoring",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,6 +31,7 @@
31
31
  ],
32
32
  "type": "module",
33
33
  "files": [
34
+ "CHANGELOG.md",
34
35
  "src/**/*.ts",
35
36
  "gradle-helper/lib/*.jar",
36
37
  "gradle-helper/licenses/**",
@@ -42,10 +43,10 @@
42
43
  "ignore": "^7.0.12",
43
44
  "smol-toml": "^1.9.1",
44
45
  "yaml": "^2.9.0",
45
- "@mrclrchtr/supi-code-runtime": "11.1.0",
46
- "@mrclrchtr/supi-lsp": "11.1.0",
47
- "@mrclrchtr/supi-core": "11.1.0",
48
- "@mrclrchtr/supi-tree-sitter": "11.1.0"
46
+ "@mrclrchtr/supi-code-runtime": "11.3.0",
47
+ "@mrclrchtr/supi-lsp": "11.3.0",
48
+ "@mrclrchtr/supi-tree-sitter": "11.3.0",
49
+ "@mrclrchtr/supi-core": "11.3.0"
49
50
  },
50
51
  "bundledDependencies": [
51
52
  "@mrclrchtr/supi-code-runtime",