@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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type DeclarationOccurrenceCandidate,
|
|
11
11
|
declarationOccurrenceFor,
|
|
12
12
|
} from "./identity.ts";
|
|
13
|
+
import { createAnchoredResolution } from "./resolution.ts";
|
|
13
14
|
import type { ResolvedTargetData } from "./types.ts";
|
|
14
15
|
|
|
15
16
|
interface SectionCandidate extends DeclarationOccurrenceCandidate {
|
|
@@ -67,12 +68,11 @@ export async function resolveLatexSectionTargetAtAnchor(input: {
|
|
|
67
68
|
provenance: ["structural"],
|
|
68
69
|
anchorKind: "name",
|
|
69
70
|
container: selected.container,
|
|
70
|
-
resolution:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
71
|
+
resolution: createAnchoredResolution(
|
|
72
|
+
{ line: input.line, character: input.character },
|
|
73
|
+
anchor,
|
|
74
|
+
"structural",
|
|
75
|
+
),
|
|
76
76
|
};
|
|
77
77
|
} catch (error) {
|
|
78
78
|
if (isCodeRequestInterruption(error, input.control)) throw error;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AnchoredResolutionMetadata, AnchoredResolutionSource } from "../../types/index.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record one coordinate request independently of the provider's symbol-match category.
|
|
5
|
+
* An exact identifier hit still snaps when normalized to a different name-anchor position.
|
|
6
|
+
*/
|
|
7
|
+
export function createAnchoredResolution(
|
|
8
|
+
requested: AnchoredResolutionMetadata["requested"],
|
|
9
|
+
resolved: AnchoredResolutionMetadata["resolved"],
|
|
10
|
+
source: AnchoredResolutionSource,
|
|
11
|
+
): AnchoredResolutionMetadata {
|
|
12
|
+
return {
|
|
13
|
+
requested: { line: requested.line, character: requested.character },
|
|
14
|
+
resolved: { line: resolved.line, character: resolved.character },
|
|
15
|
+
snapped: requested.line !== resolved.line || requested.character !== resolved.character,
|
|
16
|
+
source,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
18
18
|
import type { TargetSymbolKind } from "../../session/target-input.ts";
|
|
19
19
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
20
|
+
import { describePartialQuery } from "../search/exclusions.ts";
|
|
20
21
|
import { normalizePath } from "../search/paths.ts";
|
|
21
22
|
import type {
|
|
22
23
|
DisambiguationCandidateData,
|
|
@@ -131,7 +132,7 @@ export async function resolveSymbolTarget(
|
|
|
131
132
|
reason: `Symbol discovery for \`${symbol}\` is unavailable: ${result.reason}`,
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
if (result.data.length === 0) return emptySymbolOutcome(symbol, result, options?.path);
|
|
135
|
+
if (result.data.length === 0) return emptySymbolOutcome(symbol, result, cwd, options?.path);
|
|
135
136
|
|
|
136
137
|
const scoped = result.data
|
|
137
138
|
.filter((candidate) => (scopePath ? isWithinOrEqual(scopePath, candidate.file) : true))
|
|
@@ -139,7 +140,7 @@ export async function resolveSymbolTarget(
|
|
|
139
140
|
const eligible = options?.exportedOnly
|
|
140
141
|
? scoped.filter((candidate) => !NON_EXPORTED_KINDS.has(candidate.kind))
|
|
141
142
|
: scoped;
|
|
142
|
-
if (eligible.length === 0) return emptySymbolOutcome(symbol, result, options?.path);
|
|
143
|
+
if (eligible.length === 0) return emptySymbolOutcome(symbol, result, cwd, options?.path);
|
|
143
144
|
|
|
144
145
|
const requestedKind = options?.kind;
|
|
145
146
|
if (requestedKind) {
|
|
@@ -150,7 +151,7 @@ export async function resolveSymbolTarget(
|
|
|
150
151
|
return buildCandidateOutcome({
|
|
151
152
|
kind: "kind-mismatch",
|
|
152
153
|
candidates: eligible,
|
|
153
|
-
...candidateCompleteness(result, eligible.length),
|
|
154
|
+
...candidateCompleteness(result, eligible.length, cwd),
|
|
154
155
|
semantic,
|
|
155
156
|
cwd,
|
|
156
157
|
maxResults: options.maxResults,
|
|
@@ -160,7 +161,8 @@ export async function resolveSymbolTarget(
|
|
|
160
161
|
}
|
|
161
162
|
return resolveCandidates({
|
|
162
163
|
candidates: exactKind,
|
|
163
|
-
...candidateCompleteness(result, exactKind.length),
|
|
164
|
+
...candidateCompleteness(result, exactKind.length, cwd),
|
|
165
|
+
exclusionNote: exclusionOnlyNote(result, cwd),
|
|
164
166
|
semantic,
|
|
165
167
|
cwd,
|
|
166
168
|
maxResults: options.maxResults,
|
|
@@ -170,7 +172,8 @@ export async function resolveSymbolTarget(
|
|
|
170
172
|
|
|
171
173
|
return resolveCandidates({
|
|
172
174
|
candidates: eligible,
|
|
173
|
-
...candidateCompleteness(result, eligible.length),
|
|
175
|
+
...candidateCompleteness(result, eligible.length, cwd),
|
|
176
|
+
exclusionNote: exclusionOnlyNote(result, cwd),
|
|
174
177
|
semantic,
|
|
175
178
|
cwd,
|
|
176
179
|
maxResults: options?.maxResults,
|
|
@@ -187,7 +190,11 @@ function normalizeProviderKind(kind: string): string {
|
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
async function resolveCandidates(
|
|
190
|
-
options: CandidateOutcomeBase &
|
|
193
|
+
options: CandidateOutcomeBase &
|
|
194
|
+
Omit<TargetCandidateCompleteness, "omittedCount"> & {
|
|
195
|
+
/** Disclosure for a unique match beside policy-excluded rows. */
|
|
196
|
+
exclusionNote?: string;
|
|
197
|
+
},
|
|
191
198
|
): Promise<TargetOutcome> {
|
|
192
199
|
const {
|
|
193
200
|
candidates,
|
|
@@ -198,13 +205,16 @@ async function resolveCandidates(
|
|
|
198
205
|
totalCount,
|
|
199
206
|
partialReason,
|
|
200
207
|
partialMessage,
|
|
208
|
+
exclusionNote,
|
|
201
209
|
} = options;
|
|
202
210
|
const ranged = candidates.filter(
|
|
203
211
|
(candidate) =>
|
|
204
212
|
candidate.declarationAnchor.line > 0 || candidate.declarationAnchor.character > 0,
|
|
205
213
|
);
|
|
206
214
|
if (ranged.length === 1 && totalCount !== null) {
|
|
207
|
-
|
|
215
|
+
const resolved = resolvedTarget(await refineResolvedSymbolAnchor(ranged[0], semantic, control));
|
|
216
|
+
// Exclusion-only evidence resolves, but the excluded rows stay disclosed.
|
|
217
|
+
return exclusionNote ? { ...resolved, notes: [exclusionNote] } : resolved;
|
|
208
218
|
}
|
|
209
219
|
return buildCandidateOutcome({
|
|
210
220
|
kind: "disambiguation",
|
|
@@ -219,7 +229,7 @@ async function resolveCandidates(
|
|
|
219
229
|
});
|
|
220
230
|
}
|
|
221
231
|
|
|
222
|
-
function resolvedTarget(candidate: CodeSymbol): TargetOutcome {
|
|
232
|
+
function resolvedTarget(candidate: CodeSymbol): Extract<TargetOutcome, { kind: "resolved" }> {
|
|
223
233
|
const anchor = anchorOf(candidate);
|
|
224
234
|
return {
|
|
225
235
|
kind: "resolved",
|
|
@@ -251,12 +261,29 @@ interface CandidateOutcomeBase {
|
|
|
251
261
|
function candidateCompleteness(
|
|
252
262
|
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
253
263
|
totalCount: number,
|
|
264
|
+
cwd: string,
|
|
254
265
|
): Omit<TargetCandidateCompleteness, "omittedCount"> {
|
|
255
|
-
|
|
256
|
-
|
|
266
|
+
// Policy exclusions alone remove only rows the workspace marked out of
|
|
267
|
+
// automatic scope; the retained in-policy rows are complete. Failures and
|
|
268
|
+
// coverage gaps keep the total unknown.
|
|
269
|
+
return result.kind === "partial" && result.metadata?.exclusionOnly !== true
|
|
270
|
+
? {
|
|
271
|
+
totalCount: null,
|
|
272
|
+
partialReason: "provider-limited",
|
|
273
|
+
partialMessage: describePartialQuery(result.reason, result.metadata, cwd),
|
|
274
|
+
}
|
|
257
275
|
: { totalCount, partialReason: null };
|
|
258
276
|
}
|
|
259
277
|
|
|
278
|
+
/** Describe exclusion-only evidence so a resolved target still discloses dropped rows. */
|
|
279
|
+
function exclusionOnlyNote(
|
|
280
|
+
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
281
|
+
cwd: string,
|
|
282
|
+
): string | undefined {
|
|
283
|
+
if (result.kind !== "partial" || result.metadata?.exclusionOnly !== true) return undefined;
|
|
284
|
+
return describePartialQuery(result.reason, result.metadata, cwd);
|
|
285
|
+
}
|
|
286
|
+
|
|
260
287
|
type CandidateOutcomeOptions = CandidateOutcomeBase &
|
|
261
288
|
Omit<TargetCandidateCompleteness, "omittedCount"> &
|
|
262
289
|
(
|
|
@@ -272,12 +299,13 @@ type CandidateOutcomeOptions = CandidateOutcomeBase &
|
|
|
272
299
|
function emptySymbolOutcome(
|
|
273
300
|
symbol: string,
|
|
274
301
|
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
302
|
+
cwd: string,
|
|
275
303
|
scope?: string,
|
|
276
304
|
): TargetOutcome {
|
|
277
305
|
if (result.kind === "partial") {
|
|
278
306
|
return {
|
|
279
307
|
kind: "unavailable",
|
|
280
|
-
reason: `Symbol discovery for \`${symbol}\` is incomplete: ${result.reason}`,
|
|
308
|
+
reason: `Symbol discovery for \`${symbol}\` is incomplete: ${describePartialQuery(result.reason, result.metadata, cwd)}`,
|
|
281
309
|
};
|
|
282
310
|
}
|
|
283
311
|
return {
|
|
@@ -160,7 +160,12 @@ export interface TargetCandidateCompleteness {
|
|
|
160
160
|
* the resolution pipeline itself stays presentation-agnostic.
|
|
161
161
|
*/
|
|
162
162
|
export type TargetOutcome =
|
|
163
|
-
| {
|
|
163
|
+
| {
|
|
164
|
+
kind: "resolved";
|
|
165
|
+
target: ResolvedTargetData;
|
|
166
|
+
/** Request-scoped evidence notes, such as policy exclusions beside a unique match. */
|
|
167
|
+
notes?: readonly string[];
|
|
168
|
+
}
|
|
164
169
|
| { kind: "group"; group: ResolvedTargetGroupData }
|
|
165
170
|
| ({
|
|
166
171
|
kind: "disambiguation";
|
package/src/extension.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default function codeIntelligenceExtension(
|
|
|
47
47
|
);
|
|
48
48
|
registerWorkspaceRecoveryHandler(pi, lspState);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const resolveSession = (cwd: string) => {
|
|
51
51
|
const session = getOrCreateSession?.(cwd) ?? app.getSession(cwd) ?? app.createSession(cwd);
|
|
52
52
|
const lease = lspState.providerLease;
|
|
53
53
|
if (lease?.cwd === cwd) {
|
|
@@ -56,17 +56,23 @@ export default function codeIntelligenceExtension(
|
|
|
56
56
|
}
|
|
57
57
|
session.setHomeDir(homeDir);
|
|
58
58
|
return session;
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
|
+
registerCodeIntelligenceTools(pi, resolveSession);
|
|
60
61
|
|
|
61
|
-
registerCiStatusCommand(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
registerCiStatusCommand(
|
|
63
|
+
pi,
|
|
64
|
+
homeDir,
|
|
65
|
+
{
|
|
66
|
+
get: (cwd) =>
|
|
67
|
+
lspState.providerLease?.cwd === cwd
|
|
68
|
+
? {
|
|
69
|
+
lspController: lspState.controller,
|
|
70
|
+
automaticPathPolicy: lspState.providerLease.automaticPathPolicy,
|
|
71
|
+
}
|
|
72
|
+
: { lspController: null, automaticPathPolicy: null },
|
|
73
|
+
},
|
|
74
|
+
(ctx) => resolveSession(ctx.cwd),
|
|
75
|
+
);
|
|
70
76
|
const lspFooter = registerLspFooterContribution(pi, lspState);
|
|
71
77
|
|
|
72
78
|
pi.on("session_shutdown", () => {
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
readNextAround,
|
|
11
11
|
readNextEnclosingScope,
|
|
12
12
|
readNextTarget,
|
|
13
|
-
readNextTopSites,
|
|
14
13
|
} from "../../analysis/read-next.ts";
|
|
15
14
|
import { collectCallees } from "../../analysis/relations/callees.ts";
|
|
16
15
|
import { collectImplementations } from "../../analysis/relations/implementations.ts";
|
|
@@ -97,14 +96,6 @@ async function collectReferences(options: CollectRelationOptions): Promise<Graph
|
|
|
97
96
|
targetLine,
|
|
98
97
|
"inspect the resolved target before editing",
|
|
99
98
|
),
|
|
100
|
-
...readNextTopSites(
|
|
101
|
-
references.slice(0, options.maxResults).map((reference) => ({
|
|
102
|
-
file: toDisplayPath(options.cwd, reference.file),
|
|
103
|
-
line: reference.line,
|
|
104
|
-
})),
|
|
105
|
-
2,
|
|
106
|
-
"reference",
|
|
107
|
-
),
|
|
108
99
|
],
|
|
109
100
|
};
|
|
110
101
|
}
|
|
@@ -115,7 +106,7 @@ async function collectCalleesRelation(options: CollectRelationOptions): Promise<
|
|
|
115
106
|
kind: "unavailable",
|
|
116
107
|
rel: "callees",
|
|
117
108
|
message:
|
|
118
|
-
"Callees require a name anchor.
|
|
109
|
+
"Callees require a name anchor. To inspect callees, retry code_graph with target.anchor at the symbol's identifier.",
|
|
119
110
|
};
|
|
120
111
|
}
|
|
121
112
|
if (!options.provider?.calleesAt) {
|
|
@@ -75,6 +75,8 @@ export interface CompletedGraphWorkflow {
|
|
|
75
75
|
readonly resolvedDisplayFile: string;
|
|
76
76
|
readonly maxResults: number;
|
|
77
77
|
readonly sections: readonly GraphSection[];
|
|
78
|
+
/** Target-resolution notes, such as anchor snaps or policy exclusions beside a unique match. */
|
|
79
|
+
readonly notes: readonly string[];
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
/** Graph workflow outcome, preserving target disambiguation and failure states. */
|
|
@@ -76,7 +76,10 @@ async function collectNode(
|
|
|
76
76
|
kind: "partial",
|
|
77
77
|
data,
|
|
78
78
|
reason: result.reason,
|
|
79
|
-
recovery: {
|
|
79
|
+
recovery: {
|
|
80
|
+
file: relativeDisplayPath(input.cwd, result.file),
|
|
81
|
+
errorRanges: result.errorRanges,
|
|
82
|
+
},
|
|
80
83
|
}
|
|
81
84
|
: { kind: "completed", data };
|
|
82
85
|
} catch (error) {
|
|
@@ -103,7 +106,10 @@ async function collectEnclosingSymbol(
|
|
|
103
106
|
kind: "partial",
|
|
104
107
|
data: symbol,
|
|
105
108
|
reason: result.reason,
|
|
106
|
-
recovery: {
|
|
109
|
+
recovery: {
|
|
110
|
+
file: relativeDisplayPath(input.cwd, result.file),
|
|
111
|
+
errorRanges: result.errorRanges,
|
|
112
|
+
},
|
|
107
113
|
}
|
|
108
114
|
: { kind: "completed", data: symbol };
|
|
109
115
|
} catch (error) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** Filesystem and UTF-16 validation for exact point inspection. */
|
|
2
2
|
|
|
3
3
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
4
|
-
import {
|
|
5
|
-
import { normalizePath } from "../../analysis/search/paths.ts";
|
|
4
|
+
import { normalizePath, toDisplayPath } from "../../analysis/search/paths.ts";
|
|
6
5
|
import type { InputValidation } from "../input/common.ts";
|
|
7
6
|
import type { SourcePointInput } from "../target-input.ts";
|
|
8
7
|
|
|
@@ -60,7 +59,7 @@ export function validateInspectPoint(
|
|
|
60
59
|
kind: "valid",
|
|
61
60
|
value: {
|
|
62
61
|
file,
|
|
63
|
-
relPath:
|
|
62
|
+
relPath: toDisplayPath(cwd, file),
|
|
64
63
|
line: point.line,
|
|
65
64
|
character: point.character,
|
|
66
65
|
lineCount: lines.length,
|
|
@@ -112,7 +112,7 @@ function buildInspectNextQueries(
|
|
|
112
112
|
character: definition.character,
|
|
113
113
|
});
|
|
114
114
|
queries.push(
|
|
115
|
-
`
|
|
115
|
+
`To explore this definition's relationships, call code_graph with target.anchor ${anchor}`,
|
|
116
116
|
);
|
|
117
117
|
} else if (!semanticReady) {
|
|
118
118
|
queries.push(
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
readNextEnclosingScope,
|
|
16
16
|
readNextTarget,
|
|
17
17
|
} from "../../analysis/read-next.ts";
|
|
18
|
+
import { isNonFileUri, toDisplayPath } from "../../analysis/search/paths.ts";
|
|
18
19
|
import { diagnosticMessageString } from "../../substrate/lsp/utils.ts";
|
|
19
20
|
import type {
|
|
20
21
|
OrientationDeps,
|
|
@@ -26,7 +27,7 @@ import type {
|
|
|
26
27
|
} from "../orientation-types.ts";
|
|
27
28
|
import type { TargetStoreEntry } from "../target-store.ts";
|
|
28
29
|
import { collectContextOrientationFacts } from "./context-facts.ts";
|
|
29
|
-
import { gatherSubstrateContext } from "./gather.ts";
|
|
30
|
+
import { gatherSubstrateContext, type SubstrateContext } from "./gather.ts";
|
|
30
31
|
|
|
31
32
|
interface TargetSectionCollection {
|
|
32
33
|
readonly items: OrientationItem[];
|
|
@@ -142,7 +143,7 @@ async function buildRequestedSection(options: {
|
|
|
142
143
|
switch (section) {
|
|
143
144
|
case "defs": {
|
|
144
145
|
const result = await buildEnrichedDefsSection(target, deps, treeContext, limit);
|
|
145
|
-
const contextFacts = targetContextFacts(treeContext, limit);
|
|
146
|
+
const contextFacts = targetContextFacts(treeContext, limit, deps.cwd);
|
|
146
147
|
const operations = treeContext?.operations;
|
|
147
148
|
const semanticObserved =
|
|
148
149
|
result.hasSemanticEvidence ||
|
|
@@ -177,10 +178,11 @@ async function buildRequestedSection(options: {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
/** Select
|
|
181
|
+
/** Select independent source observations with public locations and unchanged evidence status. */
|
|
181
182
|
function targetContextFacts(
|
|
182
183
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>,
|
|
183
184
|
limit: number,
|
|
185
|
+
cwd: string,
|
|
184
186
|
) {
|
|
185
187
|
return treeContext
|
|
186
188
|
? {
|
|
@@ -217,7 +219,7 @@ function targetContextFacts(
|
|
|
217
219
|
: null,
|
|
218
220
|
recovery: treeContext.recovery.map(({ operation, file, reason, errorRanges }) => ({
|
|
219
221
|
operation,
|
|
220
|
-
file,
|
|
222
|
+
file: toDisplayPath(cwd, file),
|
|
221
223
|
reason,
|
|
222
224
|
errorRanges: errorRanges.map(publicRange),
|
|
223
225
|
})),
|
|
@@ -225,9 +227,16 @@ function targetContextFacts(
|
|
|
225
227
|
...treeContext.operations.definition,
|
|
226
228
|
...(treeContext.definition !== null
|
|
227
229
|
? {
|
|
228
|
-
entries: treeContext.definition
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
entries: treeContext.definition.slice(0, limit).map(({ uri, range }) => ({
|
|
231
|
+
...(isNonFileUri(uri)
|
|
232
|
+
? {
|
|
233
|
+
uri,
|
|
234
|
+
navigation: "unavailable" as const,
|
|
235
|
+
reason: "Provider URI is not a local filesystem source.",
|
|
236
|
+
}
|
|
237
|
+
: { file: toDisplayPath(cwd, uri) }),
|
|
238
|
+
range: publicRange(range),
|
|
239
|
+
})),
|
|
231
240
|
collectedCount: treeContext.definition.length,
|
|
232
241
|
omittedCount: Math.max(0, treeContext.definition.length - limit),
|
|
233
242
|
}
|
|
@@ -254,9 +263,9 @@ async function buildEnrichedDefsSection(
|
|
|
254
263
|
limit: number,
|
|
255
264
|
): Promise<TargetSectionCollection> {
|
|
256
265
|
const items = buildDefinitionItems(target, deps.cwd, treeContext);
|
|
257
|
-
const recovery = treeContext?.recovery ?? [];
|
|
266
|
+
const recovery = groupedRecovery(treeContext?.recovery ?? [], deps.cwd);
|
|
258
267
|
const recoveryReason = recovery
|
|
259
|
-
.map(({
|
|
268
|
+
.map(({ operations, reason }) => `${operations.join(", ")}: ${reason}`)
|
|
260
269
|
.join("; ");
|
|
261
270
|
const recoveryRanges = uniqueRecoveryRanges(recovery);
|
|
262
271
|
const hasSemanticContext = Boolean(
|
|
@@ -379,7 +388,7 @@ async function collectDefinitionTargets(
|
|
|
379
388
|
};
|
|
380
389
|
}
|
|
381
390
|
const locations = result.data.map((definition) => ({
|
|
382
|
-
file:
|
|
391
|
+
file: toDisplayPath(deps.cwd, uriToFile(definition.uri)),
|
|
383
392
|
range: publicRange(definition.range),
|
|
384
393
|
}));
|
|
385
394
|
const evidence =
|
|
@@ -398,7 +407,7 @@ async function collectDefinitionTargets(
|
|
|
398
407
|
return {
|
|
399
408
|
items: evidence.items.map((location) => ({
|
|
400
409
|
kind: "paragraph",
|
|
401
|
-
text: `\`${location.file}:${location.range.start.line + 1}:${location.range.start.character + 1}
|
|
410
|
+
text: `\`${location.file}:${location.range.start.line + 1}:${location.range.start.character + 1}\`${isNonFileUri(location.file) ? " (provider URI; filesystem navigation unavailable)" : ""}`,
|
|
402
411
|
})),
|
|
403
412
|
facts: { definitions: evidence.items },
|
|
404
413
|
hasSemanticEvidence: true,
|
|
@@ -690,6 +699,33 @@ function uniqueRecoveryRanges(
|
|
|
690
699
|
return [...ranges.values()];
|
|
691
700
|
}
|
|
692
701
|
|
|
702
|
+
/** Group only equivalent display warnings; native per-operation observations remain untouched. */
|
|
703
|
+
function groupedRecovery(recovery: SubstrateContext["recovery"], cwd: string) {
|
|
704
|
+
const groups = new Map<
|
|
705
|
+
string,
|
|
706
|
+
{
|
|
707
|
+
file: string;
|
|
708
|
+
reason: string;
|
|
709
|
+
errorRanges: readonly SourceRange[];
|
|
710
|
+
operations: string[];
|
|
711
|
+
}
|
|
712
|
+
>();
|
|
713
|
+
for (const item of recovery) {
|
|
714
|
+
const file = toDisplayPath(cwd, item.file);
|
|
715
|
+
const key = JSON.stringify([file, item.reason, item.errorRanges]);
|
|
716
|
+
const existing = groups.get(key);
|
|
717
|
+
if (existing) existing.operations.push(item.operation);
|
|
718
|
+
else
|
|
719
|
+
groups.set(key, {
|
|
720
|
+
file,
|
|
721
|
+
reason: item.reason,
|
|
722
|
+
errorRanges: item.errorRanges,
|
|
723
|
+
operations: [item.operation],
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
return [...groups.values()];
|
|
727
|
+
}
|
|
728
|
+
|
|
693
729
|
function buildDefinitionItems(
|
|
694
730
|
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
695
731
|
cwd: string,
|
|
@@ -715,14 +751,16 @@ function buildDefinitionItems(
|
|
|
715
751
|
if (treeContext?.nodeInfo?.type) {
|
|
716
752
|
items.push({ kind: "list-item", text: `Node: \`${treeContext.nodeInfo.type}\`` });
|
|
717
753
|
}
|
|
718
|
-
for (const recovery of treeContext?.recovery ?? []) {
|
|
754
|
+
for (const recovery of groupedRecovery(treeContext?.recovery ?? [], cwd)) {
|
|
719
755
|
const locations = recovery.errorRanges.map(
|
|
720
756
|
(range) => `L${range.start.line + 1}:${range.start.character + 1}`,
|
|
721
757
|
);
|
|
722
758
|
const suffix = locations.length > 0 ? ` Errors: ${locations.join(", ")}.` : "";
|
|
759
|
+
const reason = recovery.reason.trim();
|
|
760
|
+
const punctuation = /[.!?]$/.test(reason) ? "" : ".";
|
|
723
761
|
items.push({
|
|
724
762
|
kind: "paragraph",
|
|
725
|
-
text: `Partial ${recovery.
|
|
763
|
+
text: `Partial ${recovery.operations.join(", ")} evidence in \`${recovery.file}\`: ${reason}${punctuation}${suffix}`,
|
|
726
764
|
});
|
|
727
765
|
}
|
|
728
766
|
if (treeContext?.hover?.contents) {
|
|
@@ -809,7 +847,7 @@ function hoverBodyItems(lines: readonly string[]): OrientationItem[] {
|
|
|
809
847
|
}
|
|
810
848
|
|
|
811
849
|
function formatFocusTarget(target: Readonly<TargetStoreEntry>, cwd: string): string {
|
|
812
|
-
const relPath =
|
|
850
|
+
const relPath = toDisplayPath(cwd, target.file);
|
|
813
851
|
return `${relPath}:${target.displayLine}:${target.displayCharacter}`;
|
|
814
852
|
}
|
|
815
853
|
|
|
@@ -819,7 +857,7 @@ function buildNextQueries(
|
|
|
819
857
|
): string[] {
|
|
820
858
|
if (!target) return ["Use `code_orientation` for a neutral orientation summary."];
|
|
821
859
|
|
|
822
|
-
const relPath =
|
|
860
|
+
const relPath = toDisplayPath(cwd, target.file);
|
|
823
861
|
return [
|
|
824
862
|
`\`code_graph\` with \`target: { anchor: { file: "${relPath}", line: ${target.displayLine}, character: ${target.displayCharacter} } }\` for relation follow-up`,
|
|
825
863
|
];
|
|
@@ -831,7 +869,7 @@ function buildReadNextGuidance(
|
|
|
831
869
|
cwd: string,
|
|
832
870
|
): ReadNextItem[] {
|
|
833
871
|
if (!target) return [];
|
|
834
|
-
const relPath =
|
|
872
|
+
const relPath = toDisplayPath(cwd, target.file);
|
|
835
873
|
const enclosing = findEnclosingOutlineItem(target, treeContext);
|
|
836
874
|
if (enclosing) {
|
|
837
875
|
return [readNextEnclosingScope(relPath, enclosing, target.displayLine)];
|
|
@@ -12,6 +12,7 @@ import type { WorkspaceLspRuntimeState } from "@mrclrchtr/supi-lsp/api";
|
|
|
12
12
|
import type { EvidenceListMetadata, EvidencePartialReason } from "../../analysis/evidence.ts";
|
|
13
13
|
import { createEvidenceList } from "../../analysis/evidence.ts";
|
|
14
14
|
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
15
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
15
16
|
import type {
|
|
16
17
|
OrientationProvenance,
|
|
17
18
|
OrientationResultData,
|
|
@@ -381,9 +382,7 @@ export function filesystemProvenance(cwd: string, target: string): OrientationPr
|
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
export function displayPath(cwd: string, target: string): string {
|
|
384
|
-
|
|
385
|
-
if (relative.length === 0) return ".";
|
|
386
|
-
return relative.startsWith("../") || relative === ".." ? target : relative;
|
|
385
|
+
return toDisplayPath(cwd, target);
|
|
387
386
|
}
|
|
388
387
|
|
|
389
388
|
export function formatManifestValue(value: unknown): string {
|
|
@@ -75,7 +75,15 @@ export interface OrientationFacts {
|
|
|
75
75
|
readonly definitions?: readonly { readonly file: string; readonly range: SourceRange }[];
|
|
76
76
|
/** Independent context query; unavailable observations have no manufactured entries or counts. */
|
|
77
77
|
readonly contextDefinitions?: import("./gather.ts").ContextObservationStatus & {
|
|
78
|
-
readonly entries?: readonly
|
|
78
|
+
readonly entries?: readonly (
|
|
79
|
+
| { readonly file: string; readonly range: SourceRange }
|
|
80
|
+
| {
|
|
81
|
+
readonly uri: string;
|
|
82
|
+
readonly range: SourceRange;
|
|
83
|
+
readonly navigation: "unavailable";
|
|
84
|
+
readonly reason: string;
|
|
85
|
+
}
|
|
86
|
+
)[];
|
|
79
87
|
readonly collectedCount?: number;
|
|
80
88
|
readonly omittedCount?: number;
|
|
81
89
|
};
|
|
@@ -10,6 +10,7 @@ import type { InstructionFilesMetadata } from "../analysis/instruction-files.ts"
|
|
|
10
10
|
import type { CodeProvider } from "../analysis/provider.ts";
|
|
11
11
|
import type { ReadNextItem } from "../analysis/read-next.ts";
|
|
12
12
|
import type { TargetCandidateCompleteness } from "../analysis/target/types.ts";
|
|
13
|
+
import type { AnchoredResolutionMetadata } from "../types/index.ts";
|
|
13
14
|
import type { OrientationTargetInput, TargetSymbolKind } from "./target-input.ts";
|
|
14
15
|
import type { AnchorKind, TargetStoreEntry } from "./target-store.ts";
|
|
15
16
|
|
|
@@ -135,6 +136,8 @@ export interface OrientationResultData {
|
|
|
135
136
|
/** Captured generic workspace facts; absent for the unchanged file and symbol paths. */
|
|
136
137
|
readonly workspace?: import("./orientation/workspace-context.ts").WorkspaceOrientationFacts;
|
|
137
138
|
readonly target?: Readonly<TargetStoreEntry>;
|
|
139
|
+
/** Current anchored focus observation, separate from reusable target facts. */
|
|
140
|
+
readonly resolution?: AnchoredResolutionMetadata;
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
export type OrientationWorkflowOutcome =
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** Session-owned Orientation workflow. */
|
|
2
2
|
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
|
-
import { relative } from "node:path";
|
|
5
4
|
import { buildArchitectureModel } from "../analysis/architecture/discovery.ts";
|
|
6
5
|
import type { ArchitectureModel } from "../analysis/architecture/model.ts";
|
|
7
6
|
import {
|
|
@@ -10,7 +9,7 @@ import {
|
|
|
10
9
|
} from "../analysis/instruction-files.ts";
|
|
11
10
|
import { createStructuralCodeProvider, withSemanticRequestControl } from "../analysis/provider.ts";
|
|
12
11
|
import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
|
|
13
|
-
import { normalizePath } from "../analysis/search/paths.ts";
|
|
12
|
+
import { normalizePath, toDisplayPath } from "../analysis/search/paths.ts";
|
|
14
13
|
import { loadCodeIntelligenceConfig } from "../config.ts";
|
|
15
14
|
import type { CapabilityAdapter } from "./capability-adapter.ts";
|
|
16
15
|
import { parseOrientationWorkflowInput } from "./input/workflows.ts";
|
|
@@ -195,7 +194,16 @@ async function orientTarget(options: {
|
|
|
195
194
|
throwIfAborted(control);
|
|
196
195
|
return {
|
|
197
196
|
kind: "completed",
|
|
198
|
-
data: addTargetSummary(
|
|
197
|
+
data: addTargetSummary(
|
|
198
|
+
{
|
|
199
|
+
...result,
|
|
200
|
+
focusKind: "symbol",
|
|
201
|
+
...(target.resolution ? { resolution: target.resolution } : {}),
|
|
202
|
+
},
|
|
203
|
+
entry,
|
|
204
|
+
target.notes,
|
|
205
|
+
deps.cwd,
|
|
206
|
+
),
|
|
199
207
|
};
|
|
200
208
|
}
|
|
201
209
|
|
|
@@ -240,7 +248,12 @@ function addInstructionFiles(
|
|
|
240
248
|
surfacedDirectories: deps.surfacedInstructionDirs,
|
|
241
249
|
projectTrusted: deps.projectTrusted,
|
|
242
250
|
});
|
|
243
|
-
const collected = collectInstructionFiles(
|
|
251
|
+
const collected = collectInstructionFiles(
|
|
252
|
+
matches.map((match) => ({
|
|
253
|
+
...match,
|
|
254
|
+
relativePath: toDisplayPath(deps.cwd, match.absolutePath),
|
|
255
|
+
})),
|
|
256
|
+
);
|
|
244
257
|
if (!collected) return result;
|
|
245
258
|
const items: OrientationItem[] = [];
|
|
246
259
|
for (const file of collected.files) {
|
|
@@ -300,7 +313,7 @@ function addTargetSummary(
|
|
|
300
313
|
const name = entry.name ? ` ${entry.name}` : "";
|
|
301
314
|
const summaryNotes = [
|
|
302
315
|
...notes.map((note) => `Note: ${note}`),
|
|
303
|
-
`Resolved target${name}: ${
|
|
316
|
+
`Resolved target${name}: ${toDisplayPath(cwd, entry.file)}:${entry.displayLine}:${entry.displayCharacter} — Target ID: ${entry.targetId}`,
|
|
304
317
|
];
|
|
305
318
|
return { ...result, notes: [...summaryNotes, ...result.notes], target: { ...entry } };
|
|
306
319
|
}
|