@mrclrchtr/supi-code-intelligence 11.2.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.
- package/CHANGELOG.md +19 -0
- package/README.md +16 -6
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +39 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +254 -56
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +19 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
- package/package.json +6 -5
- package/src/analysis/health/server-status.ts +6 -2
- package/src/analysis/search/exclusions.ts +47 -0
- package/src/analysis/search/paths.ts +32 -9
- package/src/analysis/target/anchored-structural.ts +3 -8
- package/src/analysis/target/anchored.ts +4 -20
- package/src/analysis/target/identity.ts +1 -1
- package/src/analysis/target/latex-label-container.ts +6 -6
- package/src/analysis/target/latex-section-anchor.ts +6 -6
- package/src/analysis/target/resolution.ts +18 -0
- package/src/analysis/target/symbol.ts +39 -11
- package/src/analysis/target/types.ts +6 -1
- package/src/extension.ts +17 -11
- package/src/session/graph/collect.ts +1 -10
- package/src/session/graph-types.ts +2 -0
- package/src/session/graph-workflow.ts +1 -0
- package/src/session/inspect/collect.ts +8 -2
- package/src/session/inspect/file-point.ts +2 -3
- package/src/session/inspect-workflow.ts +1 -1
- package/src/session/orientation/collect.ts +54 -16
- package/src/session/orientation/context-sections.ts +2 -3
- package/src/session/orientation/facts.ts +9 -1
- package/src/session/orientation-types.ts +3 -0
- package/src/session/orientation-workflow.ts +18 -5
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-workflow.ts +11 -14
- package/src/session/target-store.ts +3 -18
- package/src/session/target-workflow.ts +33 -16
- package/src/substrate/lsp/recovery.ts +5 -5
- package/src/tool/code_find/render.ts +8 -4
- package/src/tool/code_find/result.ts +78 -6
- package/src/tool/code_find/spec.ts +4 -3
- package/src/tool/code_find/structured.ts +25 -9
- package/src/tool/code_graph/details.ts +1 -0
- package/src/tool/code_graph/display.ts +1 -1
- package/src/tool/code_graph/guidance.ts +1 -1
- package/src/tool/code_graph/markdown.ts +11 -6
- package/src/tool/code_graph/read-next.ts +38 -9
- package/src/tool/code_graph/reference-selection.ts +30 -0
- package/src/tool/code_graph/result.ts +25 -118
- package/src/tool/code_graph/section.ts +133 -0
- package/src/tool/code_graph/spec.ts +3 -3
- package/src/tool/code_graph/structured.ts +17 -6
- package/src/tool/code_health/display-paths.ts +92 -0
- package/src/tool/code_health/file-scope-markdown.ts +3 -2
- package/src/tool/code_health/result.ts +4 -2
- package/src/tool/code_health/spec.ts +3 -3
- package/src/tool/code_health/structured-schema.ts +44 -44
- package/src/tool/code_inspect/spec.ts +5 -1
- package/src/tool/code_inspect/structured.ts +1 -2
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +22 -5
- package/src/tool/code_orientation/structured-schema.ts +46 -36
- package/src/tool/code_orientation/structured-workspace.ts +2 -1
- package/src/tool/code_orientation/structured.ts +6 -12
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-sections.ts +3 -2
- package/src/tool/code_refactor_apply/result.ts +1 -1
- package/src/tool/code_refactor_plan/result.ts +2 -1
- package/src/tool/code_refactor_plan/structured.ts +2 -3
- package/src/tool/code_resolve/markdown.ts +6 -30
- package/src/tool/code_resolve/result.ts +24 -11
- package/src/tool/code_resolve/structured.ts +7 -9
- package/src/tool/result/refactor.ts +8 -5
- package/src/tool/result/structured.ts +8 -5
- package/src/tool/result/types.ts +18 -14
- package/src/tool/schemas.ts +5 -5
- package/src/ui/status-command.ts +37 -1
- package/src/ui/status-overlay.ts +70 -51
- package/src/ui/status-presentation.ts +108 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Markdown adapter for assembled code_resolve outcomes. */
|
|
2
2
|
|
|
3
|
-
import { relative } from "node:path";
|
|
4
3
|
import { renderEvidenceListMetadataDisclosure } from "../../analysis/evidence.ts";
|
|
5
|
-
import
|
|
4
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
5
|
+
import type { TargetWorkflowOutcome } from "../../session/target-workflow.ts";
|
|
6
6
|
import { formatPartialCandidateDisclosure } from "../result/candidate-row.ts";
|
|
7
7
|
import type { ResolveDetails } from "../result/types.ts";
|
|
8
8
|
import type { ResolveResultAssembly } from "./result.ts";
|
|
@@ -12,7 +12,7 @@ export function renderResolveResult(assembly: ResolveResultAssembly): string {
|
|
|
12
12
|
const { outcome, cwd } = assembly;
|
|
13
13
|
switch (outcome.kind) {
|
|
14
14
|
case "resolved":
|
|
15
|
-
return renderResolved(outcome
|
|
15
|
+
return renderResolved(outcome, cwd);
|
|
16
16
|
case "target-group":
|
|
17
17
|
return renderTargetGroup(assembly.details);
|
|
18
18
|
case "disambiguation":
|
|
@@ -27,11 +27,11 @@ export function renderResolveResult(assembly: ResolveResultAssembly): string {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function renderResolved(
|
|
30
|
-
|
|
31
|
-
notes: readonly string[],
|
|
30
|
+
outcome: Extract<TargetWorkflowOutcome, { kind: "resolved" }>,
|
|
32
31
|
cwd: string,
|
|
33
32
|
): string {
|
|
34
|
-
const
|
|
33
|
+
const { entry: target, notes } = outcome;
|
|
34
|
+
const relFile = toDisplayPath(cwd, target.file);
|
|
35
35
|
const displayKind = target.nativeKind ?? target.kind;
|
|
36
36
|
const kind = displayKind ? ` \`${displayKind}\`` : "";
|
|
37
37
|
const name = target.name ? ` **${target.name}**${kind}` : "";
|
|
@@ -41,22 +41,12 @@ function renderResolved(
|
|
|
41
41
|
`confidence: ${target.confidence}; provenance: ${target.provenance.join("+")}`,
|
|
42
42
|
];
|
|
43
43
|
|
|
44
|
-
const resolutionNote = renderAnchoredResolutionNote(target);
|
|
45
|
-
if (resolutionNote) lines.push("", resolutionNote);
|
|
46
44
|
for (const note of notes) {
|
|
47
|
-
if (resolutionNote && isResolutionMetadataNote(note)) continue;
|
|
48
45
|
lines.push("", `_Note: ${note}_`);
|
|
49
46
|
}
|
|
50
47
|
return lines.join("\n");
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
function isResolutionMetadataNote(note: string): boolean {
|
|
54
|
-
return (
|
|
55
|
-
note.startsWith("Resolved from a declaration header and snapped to the identifier") ||
|
|
56
|
-
note === "Resolved from provider-backed structural identifier evidence."
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
function renderTargetGroup(details: ResolveDetails): string {
|
|
61
51
|
const discovery = details.groupDiscoveryProvenance?.join("+") || "unavailable";
|
|
62
52
|
const lines = [
|
|
@@ -114,20 +104,6 @@ function appendUnknownHierarchyDisclosure(lines: string[], count: number): void
|
|
|
114
104
|
);
|
|
115
105
|
}
|
|
116
106
|
|
|
117
|
-
function renderAnchoredResolutionNote(target: Readonly<TargetStoreEntry>): string | null {
|
|
118
|
-
const resolution = target.resolution;
|
|
119
|
-
if (!resolution) return null;
|
|
120
|
-
const degraded = resolution.source !== "semantic";
|
|
121
|
-
if (!resolution.snapped && !degraded) return null;
|
|
122
|
-
|
|
123
|
-
const requested = `${resolution.requested.line}:${resolution.requested.character}`;
|
|
124
|
-
const resolved = `${resolution.resolved.line}:${resolution.resolved.character}`;
|
|
125
|
-
if (resolution.snapped) {
|
|
126
|
-
return `_Note: snapped from requested coordinate ${requested} to name anchor ${resolved} (evidence: ${resolution.source})._`;
|
|
127
|
-
}
|
|
128
|
-
return `_Note: resolved from ${resolution.source} evidence; use code_inspect for point-level facts._`;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
107
|
function renderDisambiguation(details: ResolveDetails): string {
|
|
132
108
|
const lines = [
|
|
133
109
|
"# Multiple matches found",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { relative } from "node:path";
|
|
2
1
|
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
3
2
|
import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
|
|
4
3
|
import { createEvidenceList } from "../../analysis/evidence.ts";
|
|
4
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
5
5
|
import type { ResolveTargetInput } from "../../session/target-input.ts";
|
|
6
6
|
import type { TargetStoreEntry } from "../../session/target-store.ts";
|
|
7
7
|
import type { TargetWorkflowOutcome } from "../../session/target-workflow.ts";
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
import { formatCandidateRow } from "../result/candidate-row.ts";
|
|
15
15
|
import { createToolDisplaySection } from "../result/display.ts";
|
|
16
16
|
import { scopedSymbolFailureMessage } from "../result/errors.ts";
|
|
17
|
-
import type {
|
|
17
|
+
import type {
|
|
18
|
+
AnchoredResolutionMetadata,
|
|
19
|
+
ResolveDetails,
|
|
20
|
+
ToolDisplaySection,
|
|
21
|
+
} from "../result/types.ts";
|
|
18
22
|
|
|
19
23
|
/** Presentation-neutral assembled code_resolve result. */
|
|
20
24
|
export interface ResolveResultAssembly {
|
|
@@ -80,19 +84,23 @@ export function assembleResolveResult(
|
|
|
80
84
|
function projectResolveOutcome(outcome: TargetWorkflowOutcome, cwd: string): ResolveProjection {
|
|
81
85
|
switch (outcome.kind) {
|
|
82
86
|
case "resolved":
|
|
83
|
-
return projectResolved(outcome
|
|
87
|
+
return projectResolved(outcome, cwd);
|
|
84
88
|
case "target-group":
|
|
85
89
|
return projectTargetGroup(outcome, cwd);
|
|
86
90
|
case "disambiguation":
|
|
87
91
|
case "kind-mismatch":
|
|
88
|
-
return projectCandidateOutcome(outcome);
|
|
92
|
+
return projectCandidateOutcome(outcome, cwd);
|
|
89
93
|
case "invalid-input":
|
|
90
94
|
case "unavailable":
|
|
91
95
|
return projectFailure(outcome);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
function projectResolved(
|
|
99
|
+
function projectResolved(
|
|
100
|
+
outcome: Extract<TargetWorkflowOutcome, { kind: "resolved" }>,
|
|
101
|
+
cwd: string,
|
|
102
|
+
): ResolveProjection {
|
|
103
|
+
const { entry: target, resolution } = outcome;
|
|
96
104
|
const evidence = createEvidenceList({ key: "resolve.targets", items: [target] }).metadata;
|
|
97
105
|
return {
|
|
98
106
|
key: "resolve.targets",
|
|
@@ -107,7 +115,7 @@ function projectResolved(target: Readonly<TargetStoreEntry>, cwd: string): Resol
|
|
|
107
115
|
targetCount: 1,
|
|
108
116
|
omittedCount: 0,
|
|
109
117
|
evidenceLists: [evidence],
|
|
110
|
-
targets: [toTargetDetails(target, cwd)],
|
|
118
|
+
targets: [toTargetDetails(target, cwd, resolution)],
|
|
111
119
|
nextQueries: [],
|
|
112
120
|
},
|
|
113
121
|
};
|
|
@@ -138,7 +146,7 @@ function projectTargetGroup(
|
|
|
138
146
|
evidence: evidence.metadata,
|
|
139
147
|
details: {
|
|
140
148
|
resultKind: "target-group",
|
|
141
|
-
groupFile:
|
|
149
|
+
groupFile: toDisplayPath(cwd, outcome.file),
|
|
142
150
|
groupDiscoveryProvenance: [...outcome.discoveryProvenance],
|
|
143
151
|
groupUnknownNestingCount: outcome.unknownNestingCount,
|
|
144
152
|
groupPartialReason: outcome.partial?.reason ?? null,
|
|
@@ -158,6 +166,7 @@ function projectTargetGroup(
|
|
|
158
166
|
|
|
159
167
|
function projectCandidateOutcome(
|
|
160
168
|
outcome: Extract<TargetWorkflowOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
|
|
169
|
+
cwd: string,
|
|
161
170
|
): ResolveProjection {
|
|
162
171
|
const evidence: EvidenceListMetadata = {
|
|
163
172
|
key: "resolve.candidates",
|
|
@@ -189,7 +198,7 @@ function projectCandidateOutcome(
|
|
|
189
198
|
name: candidate.name,
|
|
190
199
|
kind: candidate.kind,
|
|
191
200
|
container: candidate.container,
|
|
192
|
-
file: candidate.file,
|
|
201
|
+
file: toDisplayPath(cwd, candidate.file),
|
|
193
202
|
line: candidate.line,
|
|
194
203
|
character: candidate.character,
|
|
195
204
|
rank: candidate.rank,
|
|
@@ -228,11 +237,15 @@ function projectFailure(
|
|
|
228
237
|
};
|
|
229
238
|
}
|
|
230
239
|
|
|
231
|
-
function toTargetDetails(
|
|
240
|
+
function toTargetDetails(
|
|
241
|
+
target: Readonly<TargetStoreEntry>,
|
|
242
|
+
cwd: string,
|
|
243
|
+
resolution?: AnchoredResolutionMetadata,
|
|
244
|
+
) {
|
|
232
245
|
return {
|
|
233
246
|
targetId: target.targetId,
|
|
234
247
|
spanId: target.spanId,
|
|
235
|
-
file:
|
|
248
|
+
file: toDisplayPath(cwd, target.file),
|
|
236
249
|
displayLine: target.displayLine,
|
|
237
250
|
displayCharacter: target.displayCharacter,
|
|
238
251
|
name: target.name,
|
|
@@ -242,7 +255,7 @@ function toTargetDetails(target: Readonly<TargetStoreEntry>, cwd: string) {
|
|
|
242
255
|
anchorKind: target.anchorKind,
|
|
243
256
|
confidence: target.confidence,
|
|
244
257
|
provenance: [...target.provenance],
|
|
245
|
-
resolution:
|
|
258
|
+
...(resolution ? { resolution } : {}),
|
|
246
259
|
};
|
|
247
260
|
}
|
|
248
261
|
|
|
@@ -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 {
|
|
@@ -12,13 +11,10 @@ import type { ResolveDetails } from "../result/types.ts";
|
|
|
12
11
|
/** Codemode contract for resolution, including candidate selection and invalid input. */
|
|
13
12
|
export const ResolveOutputSchema = Type.Object(
|
|
14
13
|
{
|
|
15
|
-
kind:
|
|
16
|
-
"resolved",
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"kind-mismatch",
|
|
20
|
-
"invalid-input",
|
|
21
|
-
]),
|
|
14
|
+
kind: Type.Enum(
|
|
15
|
+
["resolved", "target-group", "disambiguation", "kind-mismatch", "invalid-input"],
|
|
16
|
+
{ type: "string" },
|
|
17
|
+
),
|
|
22
18
|
confidence: ConfidenceSchema,
|
|
23
19
|
targets: Type.Array(NavigationTargetSchema),
|
|
24
20
|
evidenceLists: Type.Array(EvidenceListSchema),
|
|
@@ -28,7 +24,9 @@ export const ResolveOutputSchema = Type.Object(
|
|
|
28
24
|
file: Type.Optional(Type.String()),
|
|
29
25
|
requestedKind: Type.Optional(Type.String()),
|
|
30
26
|
unknownNestingCount: Type.Optional(Type.Integer()),
|
|
31
|
-
discoveryProvenance: Type.Optional(
|
|
27
|
+
discoveryProvenance: Type.Optional(
|
|
28
|
+
Type.Array(Type.Enum(["semantic", "structural"], { type: "string" })),
|
|
29
|
+
),
|
|
32
30
|
partialReason: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
33
31
|
errorRanges: Type.Optional(Type.Array(RecoveryRangeSchema)),
|
|
34
32
|
},
|
|
@@ -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
|
|
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 =
|
|
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:
|
|
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(
|
|
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:
|
|
49
|
+
source: Type.Enum(["semantic", "structural", "structural-identifier"], { type: "string" }),
|
|
47
50
|
}),
|
|
48
51
|
),
|
|
49
52
|
},
|
package/src/tool/result/types.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
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,
|
|
@@ -75,23 +72,26 @@ export interface ToolDisplaySection {
|
|
|
75
72
|
export type AnchoredResolutionSource = "semantic" | "structural" | "structural-identifier";
|
|
76
73
|
|
|
77
74
|
/**
|
|
78
|
-
*
|
|
75
|
+
* Immutable resolution metadata for the current anchored request, not target history.
|
|
76
|
+
* Symbol, file, and handle selectors do not inherit an earlier request's metadata.
|
|
79
77
|
*
|
|
80
78
|
* Records the requested coordinate, the resolved anchor coordinate, whether
|
|
81
79
|
* the resolved anchor differs from the request (a snap), and the
|
|
82
|
-
* provider-backed evidence source.
|
|
80
|
+
* provider-backed evidence source. Normalizing an interior identifier position
|
|
81
|
+
* to its name anchor is a snap even when the symbol match is exact.
|
|
82
|
+
* Structured details always carry this when
|
|
83
83
|
* a target was resolved from coordinates; markdown surfaces a note only when
|
|
84
84
|
* the resolution was non-obvious (snapped or degraded).
|
|
85
85
|
*/
|
|
86
86
|
export interface AnchoredResolutionMetadata {
|
|
87
87
|
/** The 1-based coordinate the caller requested. */
|
|
88
|
-
requested: { line: number; character: number };
|
|
88
|
+
readonly requested: { readonly line: number; readonly character: number };
|
|
89
89
|
/** The 1-based anchor coordinate the target was resolved to. */
|
|
90
|
-
resolved: { line: number; character: number };
|
|
90
|
+
readonly resolved: { readonly line: number; readonly character: number };
|
|
91
91
|
/** Whether the resolved anchor differs from the requested coordinate. */
|
|
92
|
-
snapped: boolean;
|
|
92
|
+
readonly snapped: boolean;
|
|
93
93
|
/** Provider-backed evidence source that identified the target. */
|
|
94
|
-
source: AnchoredResolutionSource;
|
|
94
|
+
readonly source: AnchoredResolutionSource;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/** Structured details metadata for relationship and pattern results. */
|
|
@@ -102,8 +102,10 @@ export interface SearchDetails {
|
|
|
102
102
|
omittedCount: number;
|
|
103
103
|
evidenceLists?: EvidenceListMetadata[];
|
|
104
104
|
nextQueries: string[];
|
|
105
|
-
/**
|
|
105
|
+
/** Display paths successfully changed by `code_refactor_apply`; never use as document identities. */
|
|
106
106
|
changedFiles?: readonly string[];
|
|
107
|
+
/** Original provider document paths for post-Apply synchronization; never render or canonicalize. */
|
|
108
|
+
recoveryFiles?: readonly string[];
|
|
107
109
|
/** Present for AST mode; declares the operation-specific source-file universe and completeness. */
|
|
108
110
|
scan?: StructuredScanSummary;
|
|
109
111
|
/** Source-mapped structural matches returned by AST mode. */
|
|
@@ -111,7 +113,7 @@ export interface SearchDetails {
|
|
|
111
113
|
/** Per-file structural failures, including available syntax recovery ranges. */
|
|
112
114
|
structuralFailures?: readonly StructuredFailure[];
|
|
113
115
|
/** Structured disclosure for semantic results removed by the automatic path policy. */
|
|
114
|
-
automaticPathExclusion?:
|
|
116
|
+
automaticPathExclusion?: AutomaticPathExclusionDisplay;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
// Canonical disambiguation candidate — re-exported from resolution/types.ts
|
|
@@ -158,7 +160,7 @@ export interface ResolveDetails {
|
|
|
158
160
|
anchorKind: AnchorKind;
|
|
159
161
|
confidence: ConfidenceMode;
|
|
160
162
|
provenance: readonly TargetProviderProvenance[];
|
|
161
|
-
/** Resolution
|
|
163
|
+
/** Resolution observation for this anchored request only. */
|
|
162
164
|
resolution?: AnchoredResolutionMetadata;
|
|
163
165
|
}>;
|
|
164
166
|
/** Disambiguation candidates from the resolve service. */
|
|
@@ -211,6 +213,8 @@ export interface ContextDetails {
|
|
|
211
213
|
* File paths are absolute; compute relative paths at render time.
|
|
212
214
|
*/
|
|
213
215
|
target?: TargetStoreEntry;
|
|
216
|
+
/** Resolution observation for this anchored focus only. */
|
|
217
|
+
resolution?: AnchoredResolutionMetadata;
|
|
214
218
|
/**
|
|
215
219
|
* Bounded candidates with targetIds when target selection is ambiguous or
|
|
216
220
|
* has a Symbol-kind mismatch. No task sections are rendered in that case.
|
package/src/tool/schemas.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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.",
|
package/src/ui/status-command.ts
CHANGED
|
@@ -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:
|
|
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;
|