@mrclrchtr/supi-code-intelligence 11.2.0 → 11.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 (145) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +19 -9
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  6. package/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  9. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  10. package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  12. package/node_modules/@mrclrchtr/supi-lsp/README.md +40 -3
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +2 -2
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +30 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +1 -1
  26. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  27. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
  32. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +10 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
  34. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +118 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
  36. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +318 -58
  37. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +87 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +22 -17
  39. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +68 -6
  40. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
  48. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
  49. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
  51. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
  52. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  53. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +9 -1
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +9 -1
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
  60. package/package.json +6 -5
  61. package/src/analysis/health/server-status.ts +6 -2
  62. package/src/analysis/helpers.ts +0 -7
  63. package/src/analysis/relations/implementations.ts +5 -0
  64. package/src/analysis/relations/references.ts +5 -0
  65. package/src/analysis/search/exclusions.ts +47 -0
  66. package/src/analysis/search/paths.ts +32 -9
  67. package/src/analysis/target/anchored-structural.ts +3 -8
  68. package/src/analysis/target/anchored.ts +4 -20
  69. package/src/analysis/target/file-merge.ts +162 -0
  70. package/src/analysis/target/file-outline-omissions.ts +146 -0
  71. package/src/analysis/target/file-refinement.ts +7 -7
  72. package/src/analysis/target/file.ts +44 -156
  73. package/src/analysis/target/identity.ts +1 -1
  74. package/src/analysis/target/latex-label-container.ts +6 -6
  75. package/src/analysis/target/latex-section-anchor.ts +6 -6
  76. package/src/analysis/target/resolution.ts +18 -0
  77. package/src/analysis/target/symbol.ts +44 -12
  78. package/src/analysis/target/types.ts +38 -7
  79. package/src/api.ts +1 -1
  80. package/src/app/app.ts +9 -3
  81. package/src/extension.ts +17 -11
  82. package/src/session/graph/collect.ts +3 -10
  83. package/src/session/graph-types.ts +5 -1
  84. package/src/session/graph-workflow.ts +6 -4
  85. package/src/session/inspect/collect.ts +8 -2
  86. package/src/session/inspect/file-point.ts +2 -3
  87. package/src/session/inspect-workflow.ts +1 -1
  88. package/src/session/orientation/collect.ts +54 -16
  89. package/src/session/orientation/context-sections.ts +2 -3
  90. package/src/session/orientation/facts.ts +9 -1
  91. package/src/session/orientation/workspace-context.ts +3 -0
  92. package/src/session/orientation-types.ts +3 -0
  93. package/src/session/orientation-workflow.ts +24 -8
  94. package/src/session/refactor-identity.ts +76 -0
  95. package/src/session/refactor-workflow.ts +14 -16
  96. package/src/session/session.ts +87 -12
  97. package/src/session/target-store.ts +3 -18
  98. package/src/session/target-workflow.ts +56 -37
  99. package/src/substrate/lsp/recovery.ts +5 -5
  100. package/src/tool/code_find/render.ts +8 -4
  101. package/src/tool/code_find/result.ts +78 -6
  102. package/src/tool/code_find/spec.ts +4 -3
  103. package/src/tool/code_find/structured.ts +25 -9
  104. package/src/tool/code_graph/details.ts +1 -0
  105. package/src/tool/code_graph/display.ts +1 -1
  106. package/src/tool/code_graph/guidance.ts +1 -1
  107. package/src/tool/code_graph/markdown.ts +11 -6
  108. package/src/tool/code_graph/read-next.ts +38 -9
  109. package/src/tool/code_graph/reference-selection.ts +30 -0
  110. package/src/tool/code_graph/result.ts +25 -118
  111. package/src/tool/code_graph/section.ts +137 -0
  112. package/src/tool/code_graph/spec.ts +3 -3
  113. package/src/tool/code_graph/structured.ts +17 -6
  114. package/src/tool/code_health/display-paths.ts +92 -0
  115. package/src/tool/code_health/file-scope-markdown.ts +3 -2
  116. package/src/tool/code_health/result.ts +4 -2
  117. package/src/tool/code_health/spec.ts +3 -3
  118. package/src/tool/code_health/structured-schema.ts +44 -44
  119. package/src/tool/code_inspect/spec.ts +5 -1
  120. package/src/tool/code_inspect/structured.ts +1 -2
  121. package/src/tool/code_orientation/directory-navigation.ts +20 -31
  122. package/src/tool/code_orientation/execute.ts +1 -1
  123. package/src/tool/code_orientation/result.ts +22 -5
  124. package/src/tool/code_orientation/structured-schema.ts +46 -36
  125. package/src/tool/code_orientation/structured-workspace.ts +2 -1
  126. package/src/tool/code_orientation/structured.ts +6 -12
  127. package/src/tool/code_orientation/workspace-format.ts +2 -5
  128. package/src/tool/code_orientation/workspace-output.ts +40 -13
  129. package/src/tool/code_orientation/workspace-sections.ts +48 -4
  130. package/src/tool/code_refactor_apply/result.ts +1 -1
  131. package/src/tool/code_refactor_plan/result.ts +2 -1
  132. package/src/tool/code_refactor_plan/structured.ts +2 -3
  133. package/src/tool/code_resolve/guidance.ts +1 -1
  134. package/src/tool/code_resolve/markdown.ts +127 -64
  135. package/src/tool/code_resolve/result.ts +41 -25
  136. package/src/tool/code_resolve/structured.ts +49 -18
  137. package/src/tool/result/model-budget.ts +2 -2
  138. package/src/tool/result/refactor.ts +8 -5
  139. package/src/tool/result/structured.ts +8 -5
  140. package/src/tool/result/types.ts +31 -24
  141. package/src/tool/schemas.ts +5 -5
  142. package/src/ui/status-command.ts +37 -1
  143. package/src/ui/status-overlay.ts +70 -51
  144. package/src/ui/status-presentation.ts +108 -0
  145. package/src/ui/tui/common.ts +10 -10
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-tree-sitter",
3
- "version": "11.2.0",
3
+ "version": "11.4.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.2.0",
40
- "@mrclrchtr/supi-core": "11.2.0"
39
+ "@mrclrchtr/supi-code-runtime": "11.4.0",
40
+ "@mrclrchtr/supi-core": "11.4.0"
41
41
  },
42
42
  "bundledDependencies": [
43
43
  "@mrclrchtr/supi-code-runtime",
@@ -18,7 +18,15 @@
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"
25
+ },
26
+ {
27
+ "id": "import-type-member-type-arguments-v1",
28
+ "file": "common/define-grammar.js"
21
29
  }
22
30
  ],
23
- "sha256": "c5101ee00725c52a8aa083afa4749b598a5ff884482f80ed114fca18e88629a6"
31
+ "sha256": "7c7552ea30a3a6785826e26c12c9dd33410ac577d9cb09a4fa5cf5701665abd8"
24
32
  }
@@ -18,7 +18,15 @@
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"
25
+ },
26
+ {
27
+ "id": "import-type-member-type-arguments-v1",
28
+ "file": "common/define-grammar.js"
21
29
  }
22
30
  ],
23
- "sha256": "db071e260bcfec92f4b11997516dec49393c5086775eb8f090217d38de300c0d"
31
+ "sha256": "d9e67877e2da665b26ab837bccd036e267cf1b5f521073e76352ec4af22ded4c"
24
32
  }
@@ -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.2.0",
3
+ "version": "11.4.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.2.0",
46
- "@mrclrchtr/supi-core": "11.2.0",
47
- "@mrclrchtr/supi-lsp": "11.2.0",
48
- "@mrclrchtr/supi-tree-sitter": "11.2.0"
46
+ "@mrclrchtr/supi-lsp": "11.4.0",
47
+ "@mrclrchtr/supi-tree-sitter": "11.4.0",
48
+ "@mrclrchtr/supi-core": "11.4.0",
49
+ "@mrclrchtr/supi-code-runtime": "11.4.0"
49
50
  },
50
51
  "bundledDependencies": [
51
52
  "@mrclrchtr/supi-code-runtime",
@@ -45,9 +45,13 @@ export function formatProjectServerRouteStatusCounts(
45
45
  return parts.length > 0 ? `workspace routes: ${parts.join(", ")}` : null;
46
46
  }
47
47
 
48
- /** Render an LSP route root relative to its workspace. */
48
+ /** Render observed route roots relatively inside the workspace and absolutely outside, without resolving aliases. */
49
49
  export function formatProjectServerRoot(cwd: string, root: string): string {
50
- const relative = path.relative(cwd, root);
50
+ const absolute = path.resolve(cwd, root);
51
+ const relative = path.relative(cwd, absolute);
52
+ if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
53
+ return absolute;
54
+ }
51
55
  return (relative || ".").replaceAll("\\", "/");
52
56
  }
53
57
 
@@ -1,17 +1,10 @@
1
1
  import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
- import type { ResolvedTargetData, ResolvedTargetGroupData } from "./target/types.ts";
3
2
 
4
3
  interface FileLineRef {
5
4
  file: string;
6
5
  line: number;
7
6
  }
8
7
 
9
- export function isResolvedTargetGroup(
10
- target: ResolvedTargetData | ResolvedTargetGroupData,
11
- ): target is ResolvedTargetGroupData {
12
- return "targets" in target;
13
- }
14
-
15
8
  export function highestConfidence(confidences: ConfidenceMode[]): ConfidenceMode {
16
9
  if (confidences.includes("semantic")) return "semantic";
17
10
  if (confidences.includes("structural")) return "structural";
@@ -18,6 +18,8 @@ interface ImplementationsResultBase {
18
18
  /** Provider locations omitted because their URI or position was unusable. */
19
19
  invalidLocationCount: number;
20
20
  partialReason: RelationLocationPartialReason | null;
21
+ /** Provider explanation when the provider reported partial collection. */
22
+ partialMessage: string | null;
21
23
  }
22
24
 
23
25
  /** An implementation lookup result with a reason on every unavailable outcome. */
@@ -43,6 +45,7 @@ export async function collectImplementations(
43
45
  externalCount: 0,
44
46
  invalidLocationCount: 0,
45
47
  partialReason: null,
48
+ partialMessage: null,
46
49
  confidence: "unavailable",
47
50
  message: "No semantic implementations provider",
48
51
  };
@@ -57,6 +60,7 @@ export async function collectImplementations(
57
60
  externalCount: 0,
58
61
  invalidLocationCount: 0,
59
62
  partialReason: null,
63
+ partialMessage: null,
60
64
  confidence: "unavailable",
61
65
  message: result.reason,
62
66
  };
@@ -79,6 +83,7 @@ export async function collectImplementations(
79
83
  externalCount: normalized.external.length,
80
84
  invalidLocationCount: normalized.invalidLocationCount,
81
85
  partialReason: result.kind === "partial" ? "provider-limited" : normalized.partialReason,
86
+ partialMessage: result.kind === "partial" ? result.reason : null,
82
87
  confidence: "semantic",
83
88
  };
84
89
  }
@@ -21,6 +21,8 @@ interface CallerEvidenceData {
21
21
  /** Provider locations omitted because their URI or position was unusable. */
22
22
  invalidLocationCount: number;
23
23
  partialReason: RelationLocationPartialReason | null;
24
+ /** Provider explanation when the provider reported partial collection. */
25
+ partialMessage: string | null;
24
26
  evidence: CallerEvidence;
25
27
  }
26
28
 
@@ -47,6 +49,7 @@ export async function collectCallers(
47
49
  externalCount: 0,
48
50
  invalidLocationCount: 0,
49
51
  partialReason: null,
52
+ partialMessage: null,
50
53
  evidence: "semantic-references",
51
54
  confidence: "unavailable",
52
55
  message: "No semantic references provider",
@@ -62,6 +65,7 @@ export async function collectCallers(
62
65
  externalCount: 0,
63
66
  invalidLocationCount: 0,
64
67
  partialReason: null,
68
+ partialMessage: null,
65
69
  evidence: "semantic-references",
66
70
  confidence: "unavailable",
67
71
  message: result.reason,
@@ -83,6 +87,7 @@ export async function collectCallers(
83
87
  externalCount: normalized.external.length,
84
88
  invalidLocationCount: normalized.invalidLocationCount,
85
89
  partialReason: result.kind === "partial" ? "provider-limited" : normalized.partialReason,
90
+ partialMessage: result.kind === "partial" ? result.reason : null,
86
91
  evidence: "semantic-references",
87
92
  confidence: "semantic",
88
93
  };
@@ -0,0 +1,47 @@
1
+ import type { CodeQueryPartialMetadata } from "@mrclrchtr/supi-code-runtime/api";
2
+ import { toDisplayPath } from "./paths.ts";
3
+
4
+ /** Excluded provider observations, distinct from navigable canonical source locations. */
5
+ export interface AutomaticPathExclusionDisplay {
6
+ readonly excludedCount: number;
7
+ readonly examples: readonly {
8
+ /** Original policy observation; intentionally not canonicalized. */
9
+ readonly observedPath: string;
10
+ /** Canonical workspace-relative or external absolute navigation path. */
11
+ readonly canonicalPath: string;
12
+ }[];
13
+ }
14
+
15
+ /** Project typed exclusion evidence without rewriting provider prose or source identities. */
16
+ export function displayAutomaticPathExclusion(
17
+ exclusion: CodeQueryPartialMetadata["automaticPathExclusion"],
18
+ cwd: string,
19
+ ): AutomaticPathExclusionDisplay | undefined {
20
+ return exclusion
21
+ ? {
22
+ excludedCount: exclusion.excludedCount,
23
+ examples: exclusion.examples.map((observedPath) => ({
24
+ observedPath,
25
+ canonicalPath: toDisplayPath(cwd, observedPath),
26
+ })),
27
+ }
28
+ : undefined;
29
+ }
30
+
31
+ /** Explain which observed path was excluded even when a matching canonical source was retained. */
32
+ export function describeExcludedPath(
33
+ example: AutomaticPathExclusionDisplay["examples"][number],
34
+ ): string {
35
+ return `observed \`${example.observedPath}\` → canonical \`${example.canonicalPath}\``;
36
+ }
37
+
38
+ /** Preserve provider failure reasons and append path explanations from typed metadata only. */
39
+ export function describePartialQuery(
40
+ reason: string,
41
+ metadata: CodeQueryPartialMetadata | undefined,
42
+ cwd: string,
43
+ ): string {
44
+ const exclusion = displayAutomaticPathExclusion(metadata?.automaticPathExclusion, cwd);
45
+ if (!exclusion?.examples.length) return reason;
46
+ return `${reason} Excluded path examples: ${exclusion.examples.map(describeExcludedPath).join(", ")}.`;
47
+ }
@@ -1,6 +1,6 @@
1
- import { existsSync } from "node:fs";
1
+ import { existsSync, realpathSync } from "node:fs";
2
2
  import * as path from "node:path";
3
- import { resolveToolPath } from "@mrclrchtr/supi-core/path";
3
+ import { resolveToolPath, uriToFile } from "@mrclrchtr/supi-core/path";
4
4
 
5
5
  /** Check whether a path is within the project rather than a dependency store. */
6
6
  export function isInProjectPath(filePath: string, cwd: string): boolean {
@@ -58,7 +58,7 @@ export function resolveScopeSet(
58
58
  return {
59
59
  kind: "ok",
60
60
  paths,
61
- display: paths.map((resolved) => byPath.get(resolved) ?? resolved).join(", "),
61
+ display: paths.map((resolved) => toDisplayPath(cwd, resolved)).join(", "),
62
62
  };
63
63
  }
64
64
 
@@ -73,16 +73,39 @@ export function normalizePath(input: string, cwd: string): string {
73
73
  return resolveToolPath(cwd, input);
74
74
  }
75
75
 
76
- /** Render a path relative to a base, retaining absolute paths outside it. */
76
+ /** Render filesystem locations canonically; preserve virtual provider URIs without inventing files. */
77
77
  export function relativeDisplayPath(basePath: string, filePath: string, samePath = "."): string {
78
- const relativePath = path.relative(basePath, filePath);
78
+ if (isNonFileUri(filePath)) return filePath;
79
+ const base = canonicalDisplayPath(path.resolve(basePath));
80
+ const file = canonicalDisplayPath(path.resolve(basePath, uriToFile(filePath)));
81
+ const relativePath = path.relative(base, file);
79
82
  if (!relativePath || relativePath === ".") return samePath;
80
- if (relativePath.startsWith(`..${path.sep}`) || relativePath === "..") return filePath;
83
+ if (relativePath.startsWith(`..${path.sep}`) || relativePath === "..") return file;
81
84
  return relativePath.replaceAll("\\", "/");
82
85
  }
83
86
 
84
- /** Render an absolute path relative to cwd when it is inside the workspace. */
87
+ /** Identify provider URIs that cannot be navigated as local filesystem paths. */
88
+ export function isNonFileUri(value: string): boolean {
89
+ return !path.isAbsolute(value) && /^[a-z][a-z\d+.-]*:/iu.test(value) && !/^file:/iu.test(value);
90
+ }
91
+
92
+ /** Display filesystem sources relatively inside the workspace and absolutely outside; preserve other URIs. */
85
93
  export function toDisplayPath(cwd: string, filePath: string): string {
86
- if (!path.isAbsolute(filePath)) return filePath.replaceAll("\\", "/");
87
- return relativeDisplayPath(cwd, filePath, filePath);
94
+ return relativeDisplayPath(cwd, filePath);
95
+ }
96
+
97
+ /** Resolve existing ancestors too, so missing provider files retain the workspace's canonical spelling. */
98
+ function canonicalDisplayPath(absolutePath: string): string {
99
+ let current = absolutePath;
100
+ const suffix: string[] = [];
101
+ while (true) {
102
+ try {
103
+ return path.join(realpathSync(current), ...suffix.reverse());
104
+ } catch {
105
+ const parent = path.dirname(current);
106
+ if (parent === current) return absolutePath;
107
+ suffix.push(path.basename(current));
108
+ current = parent;
109
+ }
110
+ }
88
111
  }
@@ -6,8 +6,8 @@ import {
6
6
  type NodeAtData,
7
7
  type StructuralProvider,
8
8
  } from "@mrclrchtr/supi-code-runtime/api";
9
- import type { AnchoredResolutionMetadata } from "../../types/index.ts";
10
9
  import { resolveLatexTargetAtAnchor } from "./latex-target-anchor.ts";
10
+ import { createAnchoredResolution } from "./resolution.ts";
11
11
  import type { TargetOutcome } from "./types.ts";
12
12
 
13
13
  type Anchor = { line: number; character: number };
@@ -129,12 +129,7 @@ export async function resolveFromStructural(
129
129
  provenance: ["structural"],
130
130
  anchorKind: "name",
131
131
  container: null,
132
- resolution: {
133
- requested: { ...requested },
134
- resolved: anchor,
135
- snapped: anchor.line !== requested.line || anchor.character !== requested.character,
136
- source: "structural-identifier",
137
- } satisfies AnchoredResolutionMetadata,
132
+ resolution: createAnchoredResolution(requested, anchor, "structural-identifier"),
138
133
  },
139
134
  };
140
135
  }
@@ -143,7 +138,7 @@ function coordinateNotOnSymbolMessage(file: string, requested: Anchor, detail: s
143
138
  const at = `${basename(file)}:${requested.line}:${requested.character}`;
144
139
  return (
145
140
  `No symbol target resolved at \`${at}\` (on \`${detail}\`). ` +
146
- "`code_resolve` resolves real symbol targets from provider-backed evidence; " +
141
+ "Target resolution requires a real symbol backed by provider evidence; " +
147
142
  "use `code_inspect` for point-level facts at this coordinate, or pass the identifier coordinate of a declaration."
148
143
  );
149
144
  }
@@ -17,7 +17,7 @@ import {
17
17
  type StructuralProvider,
18
18
  } from "@mrclrchtr/supi-code-runtime/api";
19
19
  import type { AnchorKind } from "../../session/target-store.ts";
20
- import type { AnchoredResolutionMetadata, AnchoredResolutionSource } from "../../types/index.ts";
20
+ import type { AnchoredResolutionSource } from "../../types/index.ts";
21
21
  import { resolveFromStructural } from "./anchored-structural.ts";
22
22
  import {
23
23
  canonicalFileDeclarationKind,
@@ -25,6 +25,7 @@ import {
25
25
  type DeclarationOccurrenceIdentity,
26
26
  } from "./identity.ts";
27
27
  import { resolveTexlabSectionLabelCollision } from "./latex-label-container.ts";
28
+ import { createAnchoredResolution } from "./resolution.ts";
28
29
  import type { DisambiguationCandidateData, ResolvedTargetData, TargetOutcome } from "./types.ts";
29
30
 
30
31
  /** 1-based symbol anchor position (mirrors the runtime `SymbolAnchor`). */
@@ -93,25 +94,10 @@ function matchSymbolAt(s: CodeSymbol, line: number, character: number): "exact"
93
94
  return null;
94
95
  }
95
96
 
96
- function buildResolution(
97
- requested: Anchor,
98
- resolvedAnchor: Anchor,
99
- snapped: boolean,
100
- source: AnchoredResolutionSource,
101
- ): AnchoredResolutionMetadata {
102
- return {
103
- requested: { line: requested.line, character: requested.character },
104
- resolved: { line: resolvedAnchor.line, character: resolvedAnchor.character },
105
- snapped,
106
- source,
107
- };
108
- }
109
-
110
97
  function resolvedFromSymbol(
111
98
  file: string,
112
99
  s: CodeSymbol,
113
100
  opts: {
114
- snapped: boolean;
115
101
  requested: Anchor;
116
102
  source: AnchoredResolutionSource;
117
103
  identity: DeclarationOccurrenceIdentity;
@@ -135,7 +121,7 @@ function resolvedFromSymbol(
135
121
  provenance: opts.identity.structuralEvidence ? ["semantic", "structural"] : ["semantic"],
136
122
  anchorKind: (s.nameAnchor ? "name" : "declaration") as AnchorKind,
137
123
  container: s.container ?? null,
138
- resolution: buildResolution(opts.requested, a, opts.snapped, opts.source),
124
+ resolution: createAnchoredResolution(opts.requested, a, opts.source),
139
125
  },
140
126
  };
141
127
  }
@@ -213,7 +199,6 @@ async function resolveFromSemantic(
213
199
  const resolveIdentity = createCodeSymbolIdentityResolver(file, symbols, structural, control);
214
200
  if (exact.length === 1) {
215
201
  return resolvedFromSymbol(file, exact[0], {
216
- snapped: false,
217
202
  requested,
218
203
  source: "semantic",
219
204
  identity: await resolveIdentity(exact[0]),
@@ -222,7 +207,6 @@ async function resolveFromSemantic(
222
207
  if (exact.length > 1) return candidatesFromSymbols(file, exact, resolveIdentity);
223
208
  if (snap.length === 1) {
224
209
  return resolvedFromSymbol(file, snap[0], {
225
- snapped: true,
226
210
  requested,
227
211
  source: "semantic",
228
212
  identity: await resolveIdentity(snap[0]),
@@ -296,7 +280,7 @@ function coordinateNotOnSymbolMessage(
296
280
  const reason = detail ? ` (on \`${detail}\`)` : "";
297
281
  return (
298
282
  `No symbol target resolved at \`${at}\`${reason}. ` +
299
- "`code_resolve` resolves real symbol targets from provider-backed evidence; " +
283
+ "Target resolution requires a real symbol backed by provider evidence; " +
300
284
  "use `code_inspect` for point-level facts at this coordinate, or pass the identifier coordinate of a declaration."
301
285
  );
302
286
  }