@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
@@ -1,16 +1,5 @@
1
1
  import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
- import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
3
- import {
4
- createEvidenceList,
5
- createPartialEvidenceList,
6
- type EvidenceList,
7
- } from "../../analysis/evidence.ts";
8
- import type { RelationLocationPartialReason } from "../../analysis/relations/provider-locations.ts";
9
- import type {
10
- CallEntry,
11
- ImplementationEntry,
12
- ReferenceEntry,
13
- } from "../../analysis/relations/types.ts";
2
+ import type { EvidenceList, EvidenceListMetadata } from "../../analysis/evidence.ts";
14
3
  import { toDisplayPath } from "../../analysis/search/paths.ts";
15
4
  import type { GraphSection } from "../../session/graph-types.ts";
16
5
  import {
@@ -26,27 +15,16 @@ import type { GraphDetails, GraphFileGroup, GraphSectionDetails } from "./detail
26
15
  import { graphDisplaySection } from "./display.ts";
27
16
  import { formatGraphEvidence } from "./format.ts";
28
17
  import { graphReadNext } from "./read-next.ts";
18
+ import { type AssembledGraphSection, assembleGraphSection } from "./section.ts";
29
19
  import { structuredGraphCandidates, structuredGraphResult } from "./structured.ts";
30
20
 
31
21
  export type { GraphRelationKind, GraphSection } from "../../session/graph-types.ts";
32
22
 
33
- type UnavailableGraphSection = Extract<GraphSection, { kind: "unavailable" }>;
34
- type ReferenceGraphSection = Extract<GraphSection, { kind: "ok"; rel: "references" }>;
35
- type CalleeGraphSection = Extract<GraphSection, { kind: "ok"; rel: "callees" }>;
36
- type ImplementationGraphSection = Extract<GraphSection, { kind: "ok"; rel: "implements" }>;
37
-
38
- /** A relation section after canonical evidence bounding. */
39
- export type AssembledGraphSection =
40
- | UnavailableGraphSection
41
- | (ReferenceGraphSection & { readonly evidence: EvidenceList<ReferenceEntry> })
42
- | (CalleeGraphSection & { readonly evidence: EvidenceList<CallEntry> })
43
- | (ImplementationGraphSection & {
44
- readonly evidence: EvidenceList<ImplementationEntry>;
45
- });
46
-
47
23
  /** Presentation-neutral assembled graph result. */
48
24
  export interface GraphResultAssembly {
49
25
  displayName: string;
26
+ /** Target-resolution notes shown before relation sections. */
27
+ notes: readonly string[];
50
28
  sections: readonly AssembledGraphSection[];
51
29
  resolvedDisplayFile: string;
52
30
  cwd: string;
@@ -62,8 +40,11 @@ export function assembleGraphResult(input: {
62
40
  resolvedDisplayFile: string;
63
41
  maxResults: number;
64
42
  cwd: string;
43
+ notes?: readonly string[];
65
44
  }): GraphResultAssembly {
66
- const sections = input.sections.map((section) => assembleGraphSection(section, input.maxResults));
45
+ const sections = input.sections.map((section) =>
46
+ assembleGraphSection(section, input.maxResults, input.cwd),
47
+ );
67
48
  const evidenceLists = sections.flatMap((section) =>
68
49
  section.kind === "ok" ? [section.evidence.metadata] : [],
69
50
  );
@@ -85,7 +66,7 @@ export function assembleGraphResult(input: {
85
66
  })),
86
67
  evidenceLists,
87
68
  nextQueries: [],
88
- readNext: graphReadNext(sections),
69
+ readNext: graphReadNext(sections, input.cwd),
89
70
  candidateCount,
90
71
  confidence,
91
72
  provenance,
@@ -96,6 +77,7 @@ export function assembleGraphResult(input: {
96
77
 
97
78
  return {
98
79
  displayName: input.displayName,
80
+ notes: input.notes ?? [],
99
81
  sections,
100
82
  resolvedDisplayFile: input.resolvedDisplayFile,
101
83
  cwd: input.cwd,
@@ -130,103 +112,19 @@ function graphSectionDetails(
130
112
  ? { ...calls.enclosingScope, file: toDisplayPath(cwd, calls.enclosingScope.file) }
131
113
  : null,
132
114
  depth: calls?.depth ?? null,
133
- recovery: calls?.recovery ?? null,
115
+ recovery: calls?.recovery
116
+ ? { ...calls.recovery, file: toDisplayPath(cwd, calls.recovery.file) }
117
+ : null,
134
118
  fileGroups,
135
119
  };
136
120
  }
137
121
 
138
- function assembleGraphSection(section: GraphSection, maxResults: number): AssembledGraphSection {
139
- if (section.kind === "unavailable") return section;
140
- switch (section.rel) {
141
- case "references":
142
- return {
143
- ...section,
144
- evidence: createRelationEvidenceList({
145
- key: "references.locations",
146
- items: [...section.data.references],
147
- maxResults,
148
- invalidLocationCount: section.data.invalidLocationCount,
149
- partialReason: section.data.partialReason,
150
- }),
151
- };
152
- case "callees": {
153
- const evidence = section.data.recovery
154
- ? createPartialEvidenceList({
155
- key: "callees.calls",
156
- items: [...section.data.calls],
157
- maxResults,
158
- partialReason: "provider-limited",
159
- })
160
- : createEvidenceList({
161
- key: "callees.calls",
162
- items: [...section.data.calls],
163
- maxResults,
164
- });
165
- return {
166
- ...section,
167
- evidence: section.data.recovery
168
- ? {
169
- ...evidence,
170
- metadata: {
171
- ...evidence.metadata,
172
- partialMessage: recoveryMessage(section.data.recovery),
173
- },
174
- }
175
- : evidence,
176
- };
177
- }
178
- case "implements":
179
- return {
180
- ...section,
181
- evidence: createRelationEvidenceList({
182
- key: "implements.locations",
183
- items: [...section.data.implementations],
184
- maxResults,
185
- invalidLocationCount: section.data.invalidLocationCount,
186
- partialReason: section.data.partialReason,
187
- }),
188
- };
189
- }
190
- }
191
-
192
- function createRelationEvidenceList<T>(params: {
193
- key: string;
194
- items: T[];
195
- maxResults: number;
196
- invalidLocationCount: number;
197
- partialReason: RelationLocationPartialReason | null;
198
- }): EvidenceList<T> {
199
- const evidence =
200
- params.partialReason === "provider-limited"
201
- ? createPartialEvidenceList({ ...params, partialReason: params.partialReason })
202
- : createEvidenceList(params);
203
- if (params.partialReason === null) return evidence;
204
- return {
205
- ...evidence,
206
- metadata: {
207
- ...evidence.metadata,
208
- partialReason: params.partialReason,
209
- invalidLocationCount: params.invalidLocationCount,
210
- },
211
- };
212
- }
213
-
214
- function recoveryMessage(recovery: NonNullable<CalleeGraphSection["data"]["recovery"]>): string {
215
- const locations = recovery.errorRanges.map(
216
- (range) => `L${range.start.line + 1}:${range.start.character + 1}`,
217
- );
218
- const suffix = locations.length > 0 ? ` Error locations: ${locations.join(", ")}.` : "";
219
- return `${recovery.file}: ${recovery.reason}${suffix}`;
220
- }
221
-
222
122
  function evidenceTotal(evidence: EvidenceList<unknown>): number {
223
123
  return evidence.metadata.totalCount ?? evidence.metadata.shownCount;
224
124
  }
225
125
 
226
126
  function evidenceStatus(evidence: EvidenceList<unknown>): "complete" | "partial" {
227
- return evidence.metadata.partialReason !== null || (evidence.metadata.omittedCount ?? 0) > 0
228
- ? "partial"
229
- : "complete";
127
+ return evidence.metadata.partialReason !== null ? "partial" : "complete";
230
128
  }
231
129
 
232
130
  function sectionConfidence(section: AssembledGraphSection): ConfidenceMode {
@@ -279,7 +177,7 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
279
177
  };
280
178
  }
281
179
  if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
282
- return finishGraphCandidates(outcome);
180
+ return finishGraphCandidates(outcome, cwd);
283
181
  }
284
182
 
285
183
  const assembly = assembleGraphResult({
@@ -288,6 +186,7 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
288
186
  resolvedDisplayFile: outcome.resolvedDisplayFile,
289
187
  maxResults: outcome.maxResults,
290
188
  cwd,
189
+ notes: outcome.notes,
291
190
  });
292
191
  const displayTruncated = hasHiddenDisplayEvidence(assembly);
293
192
  return {
@@ -304,8 +203,16 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
304
203
  }
305
204
 
306
205
  function finishGraphCandidates(
307
- outcome: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
206
+ input: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
207
+ cwd: string,
308
208
  ): CodeIntelResult {
209
+ const outcome = {
210
+ ...input,
211
+ candidates: input.candidates.map((candidate) => ({
212
+ ...candidate,
213
+ file: toDisplayPath(cwd, candidate.file),
214
+ })),
215
+ };
309
216
  const lines = [
310
217
  outcome.kind === "kind-mismatch"
311
218
  ? `**No target matched provider kind \`${outcome.requestedKind}\`. Near matches:**`
@@ -0,0 +1,133 @@
1
+ import {
2
+ createEvidenceList,
3
+ createPartialEvidenceList,
4
+ type EvidenceList,
5
+ } from "../../analysis/evidence.ts";
6
+ import type { RelationLocationPartialReason } from "../../analysis/relations/provider-locations.ts";
7
+ import type {
8
+ CallEntry,
9
+ ImplementationEntry,
10
+ ReferenceEntry,
11
+ } from "../../analysis/relations/types.ts";
12
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
13
+ import type { GraphSection } from "../../session/graph-types.ts";
14
+ import { selectReferenceLocations } from "./reference-selection.ts";
15
+
16
+ type UnavailableGraphSection = Extract<GraphSection, { kind: "unavailable" }>;
17
+ type ReferenceGraphSection = Extract<GraphSection, { kind: "ok"; rel: "references" }>;
18
+ type CalleeGraphSection = Extract<GraphSection, { kind: "ok"; rel: "callees" }>;
19
+ type ImplementationGraphSection = Extract<GraphSection, { kind: "ok"; rel: "implements" }>;
20
+
21
+ /** A relation section after canonical evidence bounding. */
22
+ export type AssembledGraphSection =
23
+ | UnavailableGraphSection
24
+ | (ReferenceGraphSection & {
25
+ readonly evidence: EvidenceList<ReferenceEntry>;
26
+ readonly selectionNote: string | null;
27
+ })
28
+ | (CalleeGraphSection & { readonly evidence: EvidenceList<CallEntry> })
29
+ | (ImplementationGraphSection & {
30
+ readonly evidence: EvidenceList<ImplementationEntry>;
31
+ });
32
+
33
+ /** Bound one relation section's evidence once, before any presentation consumes it. */
34
+ export function assembleGraphSection(
35
+ section: GraphSection,
36
+ maxResults: number,
37
+ cwd: string,
38
+ ): AssembledGraphSection {
39
+ if (section.kind === "unavailable") return section;
40
+ switch (section.rel) {
41
+ case "references": {
42
+ const evidence = createRelationEvidenceList({
43
+ key: "references.locations",
44
+ items: [...section.data.references],
45
+ maxResults,
46
+ invalidLocationCount: section.data.invalidLocationCount,
47
+ partialReason: section.data.partialReason,
48
+ });
49
+ return {
50
+ ...section,
51
+ evidence: {
52
+ ...evidence,
53
+ items: selectReferenceLocations(section.data.references, evidence.metadata.shownCount),
54
+ },
55
+ selectionNote:
56
+ (evidence.metadata.omittedCount ?? 0) > 0 &&
57
+ section.data.references.some((site) => site.file !== section.data.references[0]?.file)
58
+ ? "Selection: one site per file per round."
59
+ : null,
60
+ };
61
+ }
62
+ case "callees": {
63
+ const evidence = section.data.recovery
64
+ ? createPartialEvidenceList({
65
+ key: "callees.calls",
66
+ items: [...section.data.calls],
67
+ maxResults,
68
+ partialReason: "provider-limited",
69
+ })
70
+ : createEvidenceList({
71
+ key: "callees.calls",
72
+ items: [...section.data.calls],
73
+ maxResults,
74
+ });
75
+ return {
76
+ ...section,
77
+ evidence: section.data.recovery
78
+ ? {
79
+ ...evidence,
80
+ metadata: {
81
+ ...evidence.metadata,
82
+ partialMessage: recoveryMessage(section.data.recovery, cwd),
83
+ },
84
+ }
85
+ : evidence,
86
+ };
87
+ }
88
+ case "implements":
89
+ return {
90
+ ...section,
91
+ evidence: createRelationEvidenceList({
92
+ key: "implements.locations",
93
+ items: [...section.data.implementations],
94
+ maxResults,
95
+ invalidLocationCount: section.data.invalidLocationCount,
96
+ partialReason: section.data.partialReason,
97
+ }),
98
+ };
99
+ }
100
+ }
101
+
102
+ function createRelationEvidenceList<T>(params: {
103
+ key: string;
104
+ items: T[];
105
+ maxResults: number;
106
+ invalidLocationCount: number;
107
+ partialReason: RelationLocationPartialReason | null;
108
+ }): EvidenceList<T> {
109
+ const evidence =
110
+ params.partialReason === "provider-limited"
111
+ ? createPartialEvidenceList({ ...params, partialReason: params.partialReason })
112
+ : createEvidenceList(params);
113
+ if (params.partialReason === null) return evidence;
114
+ return {
115
+ ...evidence,
116
+ metadata: {
117
+ ...evidence.metadata,
118
+ partialReason: params.partialReason,
119
+ invalidLocationCount: params.invalidLocationCount,
120
+ },
121
+ };
122
+ }
123
+
124
+ function recoveryMessage(
125
+ recovery: NonNullable<CalleeGraphSection["data"]["recovery"]>,
126
+ cwd: string,
127
+ ): string {
128
+ const locations = recovery.errorRanges.map(
129
+ (range) => `L${range.start.line + 1}:${range.start.character + 1}`,
130
+ );
131
+ const suffix = locations.length > 0 ? ` Error locations: ${locations.join(", ")}.` : "";
132
+ return `${toDisplayPath(cwd, recovery.file)}: ${recovery.reason}${suffix}`;
133
+ }
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { Type } from "typebox";
3
2
  import type { CodeIntelToolExecCtx } from "../../types/index.ts";
4
3
  import { GraphTargetParam, MaxResultsParam } from "../schemas.ts";
@@ -18,7 +17,7 @@ export const codeGraphSpec = {
18
17
  {
19
18
  target: GraphTargetParam,
20
19
  relations: Type.Optional(
21
- Type.Array(StringEnum(["all", "references", "callees", "implements"]), {
20
+ Type.Array(Type.Enum(["all", "references", "callees", "implements"], { type: "string" }), {
22
21
  description:
23
22
  'Requested relations; defaults to ["references"]. "all" must be the only item.',
24
23
  minItems: 1,
@@ -27,7 +26,8 @@ export const codeGraphSpec = {
27
26
  ),
28
27
  maxResults: Type.Optional(MaxResultsParam),
29
28
  calleeDepth: Type.Optional(
30
- StringEnum(["direct", "deep"], {
29
+ Type.Enum(["direct", "deep"], {
30
+ type: "string",
31
31
  description: "direct excludes nested scopes; deep includes them.",
32
32
  }),
33
33
  ),
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { type Static, Type } from "typebox";
3
2
  import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
4
3
  import { toDisplayPath } from "../../analysis/search/paths.ts";
@@ -14,14 +13,20 @@ import type { GraphResultAssembly } from "./result.ts";
14
13
  /** Codemode relation evidence; callees describe written expressions, not resolved identities. */
15
14
  export const GraphOutputSchema = Type.Object(
16
15
  {
17
- kind: StringEnum(["completed", "invalid-input", "disambiguation", "kind-mismatch"]),
16
+ kind: Type.Enum(["completed", "invalid-input", "disambiguation", "kind-mismatch"], {
17
+ type: "string",
18
+ }),
18
19
  target: Type.Optional(Type.Object({ name: Type.String(), file: Type.String() })),
19
20
  sections: Type.Array(
20
21
  Type.Object(
21
22
  {
22
- relation: StringEnum(["references", "callees", "implements"]),
23
- source: StringEnum(["semantic", "structural"]),
24
- status: StringEnum(["complete", "partial", "unavailable"]),
23
+ relation: Type.Enum(["references", "callees", "implements"], { type: "string" }),
24
+ source: Type.Enum(["semantic", "structural"], { type: "string" }),
25
+ status: Type.Enum(["complete", "partial", "unavailable"], {
26
+ type: "string",
27
+ description:
28
+ "Completeness of collected relation evidence; display caps are reported separately in evidence counts.",
29
+ }),
25
30
  message: Type.Union([Type.String(), Type.Null()]),
26
31
  items: Type.Array(
27
32
  Type.Object(
@@ -36,7 +41,7 @@ export const GraphOutputSchema = Type.Object(
36
41
  ),
37
42
  evidence: Type.Optional(EvidenceListSchema),
38
43
  externalCount: Type.Integer(),
39
- depth: Type.Union([StringEnum(["direct", "deep"]), Type.Null()]),
44
+ depth: Type.Union([Type.Enum(["direct", "deep"], { type: "string" }), Type.Null()]),
40
45
  enclosingScope: Type.Union([
41
46
  Type.Object({
42
47
  name: Type.String(),
@@ -62,6 +67,11 @@ export const GraphOutputSchema = Type.Object(
62
67
  evidenceLists: Type.Array(EvidenceListSchema),
63
68
  readNext: Type.Array(ReadNextSchema),
64
69
  message: Type.Optional(Type.String()),
70
+ notes: Type.Optional(
71
+ Type.Array(Type.String(), {
72
+ description: "Target-resolution notes, such as excluded paths beside a unique match.",
73
+ }),
74
+ ),
65
75
  requestedKind: Type.Optional(Type.String()),
66
76
  nextQueries: Type.Array(Type.String()),
67
77
  },
@@ -109,6 +119,7 @@ export function structuredGraphResult(
109
119
  }),
110
120
  evidenceLists: assembly.assembled.evidenceLists.map((evidence) => ({ ...evidence })),
111
121
  readNext: assembly.details.readNext.map((item) => ({ ...item })),
122
+ ...(assembly.notes.length > 0 ? { notes: [...assembly.notes] } : {}),
112
123
  nextQueries: [],
113
124
  };
114
125
  }
@@ -0,0 +1,92 @@
1
+ import type { DiagnosticEvidenceSummary } from "@mrclrchtr/supi-lsp/api";
2
+ import { formatProjectServerRoot } from "../../analysis/health/server-status.ts";
3
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
4
+ import type {
5
+ HealthData,
6
+ HealthDiagnosticScope,
7
+ HealthRefreshAttempt,
8
+ } from "../../session/health-types.ts";
9
+
10
+ /** Clone source navigation and recovery labels for display; retain observed ownership identities and stored session facts. */
11
+ export function displayHealthPaths(input: HealthData, cwd: string): HealthData {
12
+ const display = (file: string) => toDisplayPath(cwd, file);
13
+ const scope = (value: HealthDiagnosticScope): HealthDiagnosticScope =>
14
+ value.kind === "file"
15
+ ? { ...value, path: display(value.path) }
16
+ : { ...value, filter: value.filter === null ? null : display(value.filter) };
17
+ const evidence = (value: DiagnosticEvidenceSummary): DiagnosticEvidenceSummary => ({
18
+ ...value,
19
+ documents: value.documents.map((document) => ({ ...document, file: display(document.file) })),
20
+ });
21
+ const attempt = (value: HealthRefreshAttempt): HealthRefreshAttempt => ({
22
+ ...value,
23
+ requestedDiagnosticScope: scope(value.requestedDiagnosticScope),
24
+ ...(value.processCrashRecovery
25
+ ? {
26
+ processCrashRecovery: {
27
+ ...value.processCrashRecovery,
28
+ entries: value.processCrashRecovery.entries.map((entry) => ({
29
+ ...entry,
30
+ root: formatProjectServerRoot(cwd, entry.root),
31
+ })),
32
+ },
33
+ }
34
+ : {}),
35
+ ...(value.startupRetry
36
+ ? {
37
+ startupRetry: {
38
+ ...value.startupRetry,
39
+ entries: value.startupRetry.entries.map((entry) => ({
40
+ ...entry,
41
+ root: formatProjectServerRoot(cwd, entry.root),
42
+ })),
43
+ },
44
+ }
45
+ : {}),
46
+ ...("diagnosticEvidence" in value && value.diagnosticEvidence
47
+ ? { diagnosticEvidence: evidence(value.diagnosticEvidence) }
48
+ : {}),
49
+ ...(value.sourceTracking
50
+ ? {
51
+ sourceTracking: {
52
+ ...value.sourceTracking,
53
+ discovered: value.sourceTracking.discovered.map(display),
54
+ tracked: value.sourceTracking.tracked.map(display),
55
+ skipped: value.sourceTracking.skipped.map(display),
56
+ unavailable: value.sourceTracking.unavailable.map(display),
57
+ },
58
+ }
59
+ : {}),
60
+ });
61
+ const { diagnostics, refresh } = input;
62
+ return {
63
+ ...input,
64
+ diagnostics:
65
+ diagnostics.kind === "not-requested"
66
+ ? diagnostics
67
+ : {
68
+ ...diagnostics,
69
+ scope: scope(diagnostics.scope),
70
+ entries: diagnostics.entries.map((entry) => ({ ...entry, file: display(entry.file) })),
71
+ evidence: evidence(diagnostics.evidence),
72
+ ...(diagnostics.scopeStatus
73
+ ? {
74
+ scopeStatus: {
75
+ ...diagnostics.scopeStatus,
76
+ configPath:
77
+ diagnostics.scopeStatus.configPath === null
78
+ ? null
79
+ : display(diagnostics.scopeStatus.configPath),
80
+ },
81
+ }
82
+ : {}),
83
+ },
84
+ refresh:
85
+ refresh.kind === "not-requested" || refresh.kind === "not-attempted"
86
+ ? {
87
+ ...refresh,
88
+ lastAttempt: refresh.lastAttempt === null ? null : attempt(refresh.lastAttempt),
89
+ }
90
+ : attempt(refresh),
91
+ };
92
+ }
@@ -1,3 +1,4 @@
1
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
1
2
  import type { HealthDiagnosticObservation } from "../../session/health-types.ts";
2
3
 
3
4
  /** Render the tsconfig coverage result for a single-file health request. */
@@ -37,7 +38,7 @@ function formatConfigPath(configPath: string | null, cwd: string): string {
37
38
  return `\`${makeRelative(cwd, configPath)}\``;
38
39
  }
39
40
 
40
- /** Format a workspace path without exposing an absolute root. */
41
+ /** Format a diagnostic source with the shared workspace/external path policy. */
41
42
  export function makeRelative(cwd: string, file: string): string {
42
- return file.startsWith(cwd) ? file.slice(cwd.length + 1) : file;
43
+ return toDisplayPath(cwd, file);
43
44
  }
@@ -1,6 +1,7 @@
1
1
  /** Markdown renderer for code_health results. */
2
2
  import type { CapabilityWarningReport } from "../../analysis/capability/capability-warnings.ts";
3
3
  import {
4
+ formatProjectServerCompiler,
4
5
  formatProjectServerOperationSupport,
5
6
  formatProjectServerRoot,
6
7
  formatProjectServerRouteSummary,
@@ -372,13 +373,22 @@ function renderServersSection(
372
373
  lines.push(
373
374
  `- ${statusIcon} **${server.name}** @ \`${formatProjectServerRoot(cwd, server.root)}\` (${server.fileTypes.join(", ")}) — ${server.status}${reason}`,
374
375
  );
375
- const operationSupport = formatProjectServerOperationSupport(server.operationSupport);
376
- if (operationSupport) lines.push(` - ${operationSupport}`);
376
+ renderServerDetails(lines, server);
377
377
  }
378
378
  }
379
379
  lines.push("");
380
380
  }
381
381
 
382
+ function renderServerDetails(lines: string[], server: HealthData["servers"][number]): void {
383
+ for (const detail of [
384
+ formatProjectServerCompiler(server.typescript),
385
+ server.failureMessage,
386
+ formatProjectServerOperationSupport(server.operationSupport),
387
+ ]) {
388
+ if (detail) lines.push(` - ${detail}`);
389
+ }
390
+ }
391
+
382
392
  function displaySemanticStatus(data: HealthData): string {
383
393
  return formatSemanticHealthState(data.semanticState);
384
394
  }
@@ -1,6 +1,7 @@
1
1
  import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
2
  import {
3
3
  countProjectServerRouteStatuses,
4
+ formatProjectServerCompiler,
4
5
  formatProjectServerOperationSupport,
5
6
  formatProjectServerRoot,
6
7
  formatProjectServerStatusReason,
@@ -14,6 +15,7 @@ import {
14
15
  } from "../result/assembly.ts";
15
16
  import { createToolDisplaySection, truncateDisplayText } from "../result/display.ts";
16
17
  import type { HealthDetails, HealthSectionDetails, ToolDisplaySection } from "../result/types.ts";
18
+ import { displayHealthPaths } from "./display-paths.ts";
17
19
 
18
20
  export type {
19
21
  HealthData,
@@ -43,7 +45,8 @@ const SECTION_TITLES: Record<HealthSection, string> = {
43
45
  };
44
46
 
45
47
  /** Assemble public code_health evidence and details before presentation adapters render it. */
46
- export function assembleHealthResult(data: HealthData, cwd?: string): HealthResultAssembly {
48
+ export function assembleHealthResult(input: HealthData, cwd?: string): HealthResultAssembly {
49
+ const data = cwd === undefined ? input : displayHealthPaths(input, cwd);
47
50
  const projections = data.includedSections.map((section) => projectSection(section, data));
48
51
  const sections = projections.map((projection) => projection.section);
49
52
  const sectionDetails = projections.map((projection) => projection.details);
@@ -117,7 +120,14 @@ function buildHealthDisplaySections(data: HealthData, cwd?: string): ToolDisplay
117
120
  totalCount: data.servers.length,
118
121
  format: (server) => {
119
122
  const root = cwd ? formatProjectServerRoot(cwd, server.root) : server.root;
120
- const support = formatProjectServerOperationSupport(server.operationSupport);
123
+ const compiler = formatProjectServerCompiler(server.typescript);
124
+ const support = [
125
+ compiler,
126
+ server.failureMessage,
127
+ formatProjectServerOperationSupport(server.operationSupport),
128
+ ]
129
+ .filter(Boolean)
130
+ .join(" — ");
121
131
  return `${server.name} @ ${root} (${server.fileTypes.join(", ")}) — ${server.status}${server.statusReason ? ` — ${formatProjectServerStatusReason(server.statusReason)}` : ""}${support ? ` — ${support}` : ""}`;
122
132
  },
123
133
  }),
@@ -257,6 +267,7 @@ function uniqueProvenance(provenance: readonly ResultProvenance[]): ResultProven
257
267
  import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
258
268
  import { healthErrorResult } from "../result/errors.ts";
259
269
  import { renderHealthResult } from "./markdown.ts";
270
+ import { structuredHealthResult } from "./structured.ts";
260
271
 
261
272
  type HealthOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["health"]>>;
262
273
 
@@ -264,12 +275,16 @@ type HealthOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["health"
264
275
  export function finishHealthResult(outcome: HealthOutcome, cwd: string): CodeIntelResult {
265
276
  if (outcome.kind === "unavailable") throw new Error(outcome.reason);
266
277
  if (outcome.kind === "invalid-input") {
267
- return healthErrorResult(`**Error:** ${outcome.message}`, outcome.message);
278
+ return {
279
+ ...healthErrorResult(`**Error:** ${outcome.message}`, outcome.message),
280
+ structuredContent: { kind: "invalid-input", message: outcome.message },
281
+ };
268
282
  }
269
283
 
270
284
  const assembly = assembleHealthResult(outcome.data, cwd);
271
285
  return {
272
286
  content: renderHealthResult(assembly, cwd),
287
+ structuredContent: structuredHealthResult(assembly.data),
273
288
  details: {
274
289
  type: "health",
275
290
  data: assembly.details,
@@ -1,8 +1,8 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { Type } from "typebox";
3
2
  import type { CodeIntelToolExecCtx } from "../../types/index.ts";
4
3
  import { ScopeParam } from "../schemas.ts";
5
4
  import { executeHealthTool } from "./execute.ts";
5
+ import { HealthOutputSchema } from "./structured-schema.ts";
6
6
  import { renderHealthCall, renderHealthResult } from "./tui.ts";
7
7
 
8
8
  export const CODE_HEALTH_TOOL_NAME = "code_health";
@@ -22,19 +22,21 @@ export const codeHealthSpec = {
22
22
  }),
23
23
  ),
24
24
  include: Type.Optional(
25
- Type.Array(StringEnum(["diagnostics", "servers"]), {
25
+ Type.Array(Type.Enum(["diagnostics", "servers"], { type: "string" }), {
26
26
  description: "Requested health-signal sections.",
27
27
  uniqueItems: true,
28
28
  }),
29
29
  ),
30
30
  level: Type.Optional(
31
- StringEnum(["summary", "detailed"], {
31
+ Type.Enum(["summary", "detailed"], {
32
+ type: "string",
32
33
  description: "Detail level for the health report.",
33
34
  }),
34
35
  ),
35
36
  },
36
37
  { additionalProperties: false },
37
38
  ),
39
+ outputSchema: HealthOutputSchema,
38
40
  run: (params: unknown, ctx: CodeIntelToolExecCtx) =>
39
41
  executeHealthTool(params as Parameters<typeof executeHealthTool>[0], ctx),
40
42
  renderCall: renderHealthCall,