@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,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { type Static, Type } from "typebox";
3
2
  import type { TargetWorkflowOutcome } from "../../session/target-workflow.ts";
4
3
  import {
@@ -9,16 +8,18 @@ import {
9
8
  } from "../result/structured.ts";
10
9
  import type { ResolveDetails } from "../result/types.ts";
11
10
 
11
+ const NameSpanSchema = Type.Object(
12
+ { count: Type.Integer(), startLine: Type.Integer(), endLine: Type.Integer() },
13
+ { additionalProperties: false },
14
+ );
15
+
12
16
  /** Codemode contract for resolution, including candidate selection and invalid input. */
13
17
  export const ResolveOutputSchema = Type.Object(
14
18
  {
15
- kind: StringEnum([
16
- "resolved",
17
- "target-group",
18
- "disambiguation",
19
- "kind-mismatch",
20
- "invalid-input",
21
- ]),
19
+ kind: Type.Enum(
20
+ ["resolved", "file-outline", "disambiguation", "kind-mismatch", "invalid-input"],
21
+ { type: "string" },
22
+ ),
22
23
  confidence: ConfidenceSchema,
23
24
  targets: Type.Array(NavigationTargetSchema),
24
25
  evidenceLists: Type.Array(EvidenceListSchema),
@@ -27,8 +28,21 @@ export const ResolveOutputSchema = Type.Object(
27
28
  message: Type.Optional(Type.String()),
28
29
  file: Type.Optional(Type.String()),
29
30
  requestedKind: Type.Optional(Type.String()),
30
- unknownNestingCount: Type.Optional(Type.Integer()),
31
- discoveryProvenance: Type.Optional(Type.Array(StringEnum(["semantic", "structural"]))),
31
+ unknownLevelCount: Type.Optional(Type.Integer()),
32
+ notListed: Type.Optional(
33
+ Type.Object(
34
+ {
35
+ importedNames: Type.Union([NameSpanSchema, Type.Null()]),
36
+ exportListNames: Type.Union([NameSpanSchema, Type.Null()]),
37
+ reExportStatements: Type.Union([NameSpanSchema, Type.Null()]),
38
+ localDeclarations: Type.Integer(),
39
+ },
40
+ { additionalProperties: false },
41
+ ),
42
+ ),
43
+ discoveryProvenance: Type.Optional(
44
+ Type.Array(Type.Enum(["semantic", "structural"], { type: "string" })),
45
+ ),
32
46
  partialReason: Type.Optional(Type.Union([Type.String(), Type.Null()])),
33
47
  errorRanges: Type.Optional(Type.Array(RecoveryRangeSchema)),
34
48
  },
@@ -82,22 +96,39 @@ export function structuredResolveResult(
82
96
  nextQueries: data.nextQueries,
83
97
  notes: outcome.kind === "resolved" ? [...outcome.notes] : [],
84
98
  ...(data.message === undefined ? {} : { message: data.message }),
85
- ...(data.groupFile === undefined ? {} : { file: data.groupFile }),
99
+ ...(data.outlineFile === undefined ? {} : { file: data.outlineFile }),
86
100
  ...(data.requestedKind === undefined ? {} : { requestedKind: data.requestedKind }),
87
- ...(data.groupUnknownNestingCount === undefined
101
+ ...(data.outlineNotListed === undefined
102
+ ? {}
103
+ : { notListed: structuredNotListed(data.outlineNotListed) }),
104
+ ...(data.outlineUnknownLevelCount === undefined
105
+ ? {}
106
+ : { unknownLevelCount: data.outlineUnknownLevelCount }),
107
+ ...(data.outlineDiscoveryProvenance === undefined
88
108
  ? {}
89
- : { unknownNestingCount: data.groupUnknownNestingCount }),
90
- ...(data.groupDiscoveryProvenance === undefined
109
+ : { discoveryProvenance: [...data.outlineDiscoveryProvenance] }),
110
+ ...(data.outlinePartialReason === undefined
91
111
  ? {}
92
- : { discoveryProvenance: [...data.groupDiscoveryProvenance] }),
93
- ...(data.groupPartialReason === undefined ? {} : { partialReason: data.groupPartialReason }),
94
- ...(data.groupErrorRanges === undefined
112
+ : { partialReason: data.outlinePartialReason }),
113
+ ...(data.outlineErrorRanges === undefined
95
114
  ? {}
96
115
  : {
97
- errorRanges: data.groupErrorRanges.map((range) => ({
116
+ errorRanges: data.outlineErrorRanges.map((range) => ({
98
117
  start: { ...range.start },
99
118
  end: { ...range.end },
100
119
  })),
101
120
  }),
102
121
  };
103
122
  }
123
+
124
+ /** Copy outline omission counts into the codemode contract. */
125
+ function structuredNotListed(notListed: NonNullable<ResolveDetails["outlineNotListed"]>) {
126
+ const span = (value: { count: number; startLine: number; endLine: number } | null) =>
127
+ value ? { ...value } : null;
128
+ return {
129
+ importedNames: span(notListed.importedNames),
130
+ exportListNames: span(notListed.exportListNames),
131
+ reExportStatements: span(notListed.reExportStatements),
132
+ localDeclarations: notListed.localDeclarations,
133
+ };
134
+ }
@@ -113,8 +113,8 @@ function sectionFacts(details: Details): string[] {
113
113
  case "resolve":
114
114
  return [
115
115
  `${details.data.resultKind}: ${details.data.targetCount} targets; ${details.data.omittedCount} cap omissions.`,
116
- ...(details.data.groupPartialReason
117
- ? [`Partial discovery: ${details.data.groupPartialReason}`]
116
+ ...(details.data.outlinePartialReason
117
+ ? [`Partial discovery: ${details.data.outlinePartialReason}`]
118
118
  : []),
119
119
  ...details.data.targets
120
120
  .slice(0, 3)
@@ -1,6 +1,7 @@
1
1
  import type { FileEdit } from "@mrclrchtr/supi-code-runtime/api";
2
2
  import { createEvidenceList, type EvidenceList } from "../../analysis/evidence.ts";
3
3
  import type { ApplyResult } from "../../analysis/refactor/apply.ts";
4
+ import { toDisplayPath } from "../../analysis/search/paths.ts";
4
5
  import type { RefactorPlan } from "../../session/refactor-plans.ts";
5
6
  import { assembledNextQueries, assembleToolResult, type ToolResultAssembly } from "./assembly.ts";
6
7
  import { createToolDisplaySection } from "./display.ts";
@@ -29,10 +30,10 @@ export interface RefactorApplyResultAssembly {
29
30
  readonly displaySections: readonly ToolDisplaySection[];
30
31
  }
31
32
 
32
- function formatEdit(edit: FileEdit): string {
33
+ function formatEdit(edit: FileEdit, cwd: string): string {
33
34
  const range = edit.range;
34
35
  const replacement = edit.newText.replace(/\n/g, " ↵ ");
35
- return `${edit.file} L${range.start.line + 1}:${range.start.character + 1} → L${range.end.line + 1}:${range.end.character + 1}: ${replacement}`;
36
+ return `${toDisplayPath(cwd, edit.file)} L${range.start.line + 1}:${range.start.character + 1} → L${range.end.line + 1}:${range.end.character + 1}: ${replacement}`;
36
37
  }
37
38
 
38
39
  /** Assemble a bounded refactor plan and all facts needed by its renderers. */
@@ -82,7 +83,7 @@ export function assembleRefactorPlanDetails(
82
83
  totalCount: edits.metadata.totalCount,
83
84
  omittedCount: edits.metadata.omittedCount,
84
85
  partialReason: edits.metadata.partialReason,
85
- format: formatEdit,
86
+ format: (edit) => formatEdit(edit, cwd),
86
87
  }),
87
88
  ],
88
89
  details: {
@@ -100,6 +101,7 @@ export function assembleRefactorPlanDetails(
100
101
  export function assembleRefactorApplyDetails(
101
102
  applyResult: ApplyResult,
102
103
  plan: Readonly<RefactorPlan>,
104
+ cwd: string,
103
105
  ): RefactorApplyResultAssembly {
104
106
  const candidateCount = applyResult.kind === "applied" ? applyResult.totalEdits : 0;
105
107
  const evidenceSource = plan.evidenceSource ?? "semantic";
@@ -133,7 +135,8 @@ export function assembleRefactorApplyDetails(
133
135
  provenance,
134
136
  });
135
137
 
136
- const changedFiles = [...new Set(plan.edits.edits.map((edit) => edit.file))];
138
+ const recoveryFiles = [...new Set(plan.edits.edits.map((edit) => edit.file))];
139
+ const changedFiles = recoveryFiles.map((file) => toDisplayPath(cwd, file));
137
140
 
138
141
  return {
139
142
  assembled,
@@ -156,7 +159,7 @@ export function assembleRefactorApplyDetails(
156
159
  omittedCount: assembled.totals.omittedCount,
157
160
  evidenceLists: [...assembled.evidenceLists],
158
161
  nextQueries: assembledNextQueries(assembled),
159
- ...(applyResult.kind === "applied" ? { changedFiles } : {}),
162
+ ...(applyResult.kind === "applied" ? { changedFiles, recoveryFiles } : {}),
160
163
  },
161
164
  };
162
165
  }
@@ -1,8 +1,9 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { Type } from "typebox";
3
2
 
4
3
  /** Collection confidence, independent of result completeness. */
5
- export const ConfidenceSchema = StringEnum(["semantic", "structural", "heuristic", "unavailable"]);
4
+ export const ConfidenceSchema = Type.Enum(["semantic", "structural", "heuristic", "unavailable"], {
5
+ type: "string",
6
+ });
6
7
 
7
8
  /** Canonical evidence counts; null totals mean collection could not establish completeness. */
8
9
  export const EvidenceListSchema = Type.Object(
@@ -34,16 +35,18 @@ export const NavigationTargetSchema = Type.Object(
34
35
  file: Type.String(),
35
36
  line: Type.Integer(),
36
37
  character: Type.Integer(),
37
- anchorKind: StringEnum(["name", "declaration"]),
38
+ anchorKind: Type.Enum(["name", "declaration"], { type: "string" }),
38
39
  container: Type.Optional(Type.Union([Type.String(), Type.Null()])),
39
40
  confidence: Type.Optional(ConfidenceSchema),
40
- provenance: Type.Optional(Type.Array(StringEnum(["semantic", "structural"]))),
41
+ provenance: Type.Optional(
42
+ Type.Array(Type.Enum(["semantic", "structural"], { type: "string" })),
43
+ ),
41
44
  resolution: Type.Optional(
42
45
  Type.Object({
43
46
  requested: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
44
47
  resolved: Type.Object({ line: Type.Integer(), character: Type.Integer() }),
45
48
  snapped: Type.Boolean(),
46
- source: StringEnum(["semantic", "structural", "structural-identifier"]),
49
+ source: Type.Enum(["semantic", "structural", "structural-identifier"], { type: "string" }),
47
50
  }),
48
51
  ),
49
52
  },
@@ -1,17 +1,15 @@
1
- import type {
2
- CodeQueryPartialMetadata,
3
- ConfidenceMode,
4
- SourceRange,
5
- } from "@mrclrchtr/supi-code-runtime/api";
1
+ import type { ConfidenceMode, SourceRange } from "@mrclrchtr/supi-code-runtime/api";
6
2
  import type { CapabilityWarningReport } from "../../analysis/capability/capability-warnings.ts";
7
3
  import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
8
4
  import type { InstructionFilesMetadata } from "../../analysis/instruction-files.ts";
9
5
  import type { ReadNextItem } from "../../analysis/read-next.ts";
6
+ import type { AutomaticPathExclusionDisplay } from "../../analysis/search/exclusions.ts";
10
7
  import type {
11
8
  StructuredFailure,
12
9
  StructuredMatch,
13
10
  StructuredScanSummary,
14
11
  } from "../../analysis/search/pattern.ts";
12
+ import type { FileOutlineNotListed } from "../../analysis/target/types.ts";
15
13
  import type {
16
14
  HealthDiagnosticObservation,
17
15
  HealthRefreshState,
@@ -75,23 +73,26 @@ export interface ToolDisplaySection {
75
73
  export type AnchoredResolutionSource = "semantic" | "structural" | "structural-identifier";
76
74
 
77
75
  /**
78
- * Resolution metadata for a target resolved from anchored coordinates.
76
+ * Immutable resolution metadata for the current anchored request, not target history.
77
+ * Symbol, file, and handle selectors do not inherit an earlier request's metadata.
79
78
  *
80
79
  * Records the requested coordinate, the resolved anchor coordinate, whether
81
80
  * the resolved anchor differs from the request (a snap), and the
82
- * provider-backed evidence source. Structured details always carry this when
81
+ * provider-backed evidence source. Normalizing an interior identifier position
82
+ * to its name anchor is a snap even when the symbol match is exact.
83
+ * Structured details always carry this when
83
84
  * a target was resolved from coordinates; markdown surfaces a note only when
84
85
  * the resolution was non-obvious (snapped or degraded).
85
86
  */
86
87
  export interface AnchoredResolutionMetadata {
87
88
  /** The 1-based coordinate the caller requested. */
88
- requested: { line: number; character: number };
89
+ readonly requested: { readonly line: number; readonly character: number };
89
90
  /** The 1-based anchor coordinate the target was resolved to. */
90
- resolved: { line: number; character: number };
91
+ readonly resolved: { readonly line: number; readonly character: number };
91
92
  /** Whether the resolved anchor differs from the requested coordinate. */
92
- snapped: boolean;
93
+ readonly snapped: boolean;
93
94
  /** Provider-backed evidence source that identified the target. */
94
- source: AnchoredResolutionSource;
95
+ readonly source: AnchoredResolutionSource;
95
96
  }
96
97
 
97
98
  /** Structured details metadata for relationship and pattern results. */
@@ -102,8 +103,10 @@ export interface SearchDetails {
102
103
  omittedCount: number;
103
104
  evidenceLists?: EvidenceListMetadata[];
104
105
  nextQueries: string[];
105
- /** Paths successfully changed by `code_refactor_apply`. */
106
+ /** Display paths successfully changed by `code_refactor_apply`; never use as document identities. */
106
107
  changedFiles?: readonly string[];
108
+ /** Original provider document paths for post-Apply synchronization; never render or canonicalize. */
109
+ recoveryFiles?: readonly string[];
107
110
  /** Present for AST mode; declares the operation-specific source-file universe and completeness. */
108
111
  scan?: StructuredScanSummary;
109
112
  /** Source-mapped structural matches returned by AST mode. */
@@ -111,7 +114,7 @@ export interface SearchDetails {
111
114
  /** Per-file structural failures, including available syntax recovery ranges. */
112
115
  structuralFailures?: readonly StructuredFailure[];
113
116
  /** Structured disclosure for semantic results removed by the automatic path policy. */
114
- automaticPathExclusion?: CodeQueryPartialMetadata["automaticPathExclusion"];
117
+ automaticPathExclusion?: AutomaticPathExclusionDisplay;
115
118
  }
116
119
 
117
120
  // Canonical disambiguation candidate — re-exported from resolution/types.ts
@@ -121,20 +124,22 @@ export type { DisambiguationCandidateData as DisambiguationCandidate } from "../
121
124
  export interface ResolveDetails {
122
125
  resultKind:
123
126
  | "resolved"
124
- | "target-group"
127
+ | "file-outline"
125
128
  | "disambiguation"
126
129
  | "kind-mismatch"
127
130
  | "invalid-input"
128
131
  | "unavailable";
129
- /** Workspace-relative source file for a file-derived Target group. */
130
- groupFile?: string;
131
- /** Providers that successfully enumerated a file-derived Target group. */
132
- groupDiscoveryProvenance?: readonly TargetProviderProvenance[];
133
- /** Complete-group declarations whose providers could not establish nesting. */
134
- groupUnknownNestingCount?: number;
135
- /** Provider recovery that makes this target group incomplete. */
136
- groupPartialReason?: string | null;
137
- groupErrorRanges?: readonly SourceRange[];
132
+ /** Workspace-relative source file of a File outline. */
133
+ outlineFile?: string;
134
+ /** Providers that successfully enumerated the File outline's file. */
135
+ outlineDiscoveryProvenance?: readonly TargetProviderProvenance[];
136
+ /** Outline declarations whose provider reported no enclosing declaration. */
137
+ outlineUnknownLevelCount?: number;
138
+ /** Provider recovery that makes this File outline incomplete. */
139
+ outlinePartialReason?: string | null;
140
+ outlineErrorRanges?: readonly SourceRange[];
141
+ /** Discovered declarations left out of the File outline, with exact counts. */
142
+ outlineNotListed?: FileOutlineNotListed;
138
143
  /** Strict provider kind that produced a near-match result. */
139
144
  requestedKind?: TargetSymbolKind;
140
145
  confidence: ConfidenceMode;
@@ -158,7 +163,7 @@ export interface ResolveDetails {
158
163
  anchorKind: AnchorKind;
159
164
  confidence: ConfidenceMode;
160
165
  provenance: readonly TargetProviderProvenance[];
161
- /** Resolution provenance — present when the target was resolved from anchored coordinates. */
166
+ /** Resolution observation for this anchored request only. */
162
167
  resolution?: AnchoredResolutionMetadata;
163
168
  }>;
164
169
  /** Disambiguation candidates from the resolve service. */
@@ -211,6 +216,8 @@ export interface ContextDetails {
211
216
  * File paths are absolute; compute relative paths at render time.
212
217
  */
213
218
  target?: TargetStoreEntry;
219
+ /** Resolution observation for this anchored focus only. */
220
+ resolution?: AnchoredResolutionMetadata;
214
221
  /**
215
222
  * Bounded candidates with targetIds when target selection is ambiguous or
216
223
  * has a Symbol-kind mismatch. No task sections are rendered in that case.
@@ -1,4 +1,3 @@
1
- import { StringEnum } from "@earendil-works/pi-ai";
2
1
  import { type TSchema, Type } from "typebox";
3
2
  import {
4
3
  PUBLIC_REFACTOR_OPERATION_NAMES,
@@ -46,7 +45,8 @@ const SymbolTargetParam = Type.Object(
46
45
  query: QueryParam,
47
46
  scope: Type.Optional(ScopeParam),
48
47
  symbolKind: Type.Optional(
49
- StringEnum(TARGET_SYMBOL_KINDS, {
48
+ Type.Enum(TARGET_SYMBOL_KINDS, {
49
+ type: "string",
50
50
  description: "LSP SymbolKind filter; omit when uncertain.",
51
51
  }),
52
52
  ),
@@ -85,7 +85,7 @@ export const ResolveTargetParam = exactOneSelector(
85
85
 
86
86
  export const GraphTargetParam = exactOneSelector(
87
87
  {
88
- handle: Type.String({ description: "Target handle returned by code_resolve." }),
88
+ handle: Type.String({ description: "Target handle from a previous code tool result." }),
89
89
  anchor: SourcePointParam,
90
90
  symbol: SymbolTargetParam,
91
91
  },
@@ -94,7 +94,7 @@ export const GraphTargetParam = exactOneSelector(
94
94
 
95
95
  const OrientationTargetParam = exactOneSelector(
96
96
  {
97
- handle: Type.String({ description: "Target handle returned by code_resolve." }),
97
+ handle: Type.String({ description: "Target handle from a previous code tool result." }),
98
98
  anchor: SourcePointParam,
99
99
  symbol: SymbolTargetParam,
100
100
  },
@@ -114,7 +114,7 @@ export const OrientationFocusParam = exactOneSelector(
114
114
 
115
115
  export const RefactorTargetParam = exactOneSelector(
116
116
  {
117
- handle: Type.String({ description: "Target handle returned by code_resolve." }),
117
+ handle: Type.String({ description: "Target handle from a previous code tool result." }),
118
118
  anchor: SourcePointParam,
119
119
  },
120
120
  "Exactly one refactor target.",
@@ -4,7 +4,11 @@ import { type AutomaticLspPathPolicy, getWorkspaceLspRuntime } from "@mrclrchtr/
4
4
  import type { CapabilityWarningMissingServerSource } from "../analysis/capability/capability-warnings.ts";
5
5
  import { checkWorkspaceDiagnostics } from "../analysis/health/check.ts";
6
6
  import { observeWorkspaceStatus } from "../analysis/health/status.ts";
7
+ import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
8
+ import { throwIfAborted } from "../session/workflow-control.ts";
9
+ import { DEFAULT_WORKFLOW_DEADLINE_MS } from "../tool/infra/workflow-control.ts";
7
10
  import { type CiStatusDialog, createCiStatusDialog } from "./status-overlay.ts";
11
+ import { CiHealthRefreshError, presentHealthRefresh } from "./status-presentation.ts";
8
12
 
9
13
  /** Owned LSP facts used by the passive status warning collector. */
10
14
  export interface CiStatusWarningSource {
@@ -54,6 +58,7 @@ export function registerCiStatusCommand(
54
58
  pi: ExtensionAPI,
55
59
  homeDir?: string,
56
60
  warningSource?: CiStatusWarningSource,
61
+ getSession?: (ctx: ExtensionContext) => Pick<WorkspaceCodeIntelligenceSession, "health">,
57
62
  ): void {
58
63
  let interaction: StatusInteraction | undefined;
59
64
  const close = () => {
@@ -66,7 +71,8 @@ export function registerCiStatusCommand(
66
71
  pi.on("session_start", close);
67
72
 
68
73
  pi.registerCommand("supi-ci-status", {
69
- description: "Toggle the code intelligence inspector (passive health snapshot)",
74
+ description:
75
+ "Toggle diagnostic evidence inspector with explicit check and health refresh actions",
70
76
  handler: async (_args, ctx) => {
71
77
  if (ctx.mode !== "tui") {
72
78
  ctx.ui.notify(
@@ -95,6 +101,7 @@ export function registerCiStatusCommand(
95
101
  offset: checkOffset,
96
102
  control: { signal, deadline: Date.now() + 30_000 },
97
103
  });
104
+ throwIfAborted({ signal });
98
105
  const snapshot = await observe();
99
106
  checkOffset = diagnosticCheck.nextOffset;
100
107
  return { ...snapshot, diagnosticCheck };
@@ -102,6 +109,34 @@ export function registerCiStatusCommand(
102
109
  pi.events.emit("supi:working:end", { source: "supi-code-intelligence" });
103
110
  }
104
111
  };
112
+ const refreshHealth = async (signal: AbortSignal) => {
113
+ const startedAt = Date.now();
114
+ const control = { signal, deadline: startedAt + DEFAULT_WORKFLOW_DEADLINE_MS };
115
+ let stage = "health workflow";
116
+ let healthRefresh: readonly string[] | undefined;
117
+ pi.events.emit("supi:working:start", { source: "supi-code-intelligence" });
118
+ try {
119
+ if (!getSession) throw new Error("Session health workflow is unavailable");
120
+ const outcome = await getSession(ctx).health(
121
+ { refresh: true, include: ["diagnostics", "servers"] },
122
+ control,
123
+ );
124
+ throwIfAborted(control);
125
+ healthRefresh = presentHealthRefresh(outcome, Date.now() - startedAt, ctx.cwd);
126
+ stage = "passive snapshot";
127
+ const snapshot = await observe();
128
+ throwIfAborted(control);
129
+ return { ...snapshot, healthRefresh };
130
+ } catch (error) {
131
+ throw new CiHealthRefreshError(stage, {
132
+ cause: error,
133
+ elapsedMs: Date.now() - startedAt,
134
+ healthRefresh,
135
+ });
136
+ } finally {
137
+ pi.events.emit("supi:working:end", { source: "supi-code-intelligence" });
138
+ }
139
+ };
105
140
  try {
106
141
  const data = await observe();
107
142
  if (current.cancelled) return;
@@ -115,6 +150,7 @@ export function registerCiStatusCommand(
115
150
  done: current.close,
116
151
  onRefresh: observe,
117
152
  onCheck: check,
153
+ onHealth: refreshHealth,
118
154
  fetchDetailedDiagnostics: () => readDiagnosticDetails(ctx.cwd),
119
155
  });
120
156
  current.dialog = dialog;