@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.
- package/CHANGELOG.md +30 -0
- package/README.md +19 -9
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
- 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 +40 -3
- 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/api.ts +2 -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/declaration-level.ts +34 -0
- 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-code-runtime/src/types.ts +13 -5
- 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/node_modules/semver/classes/range.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +30 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +1 -1
- 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/config/tsconfig-scope.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +118 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +318 -58
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +87 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +22 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +68 -6
- 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/api.ts +2 -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/declaration-level.ts +34 -0
- 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-code-runtime/src/types.ts +13 -5
- 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 +9 -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 +9 -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/helpers.ts +0 -7
- package/src/analysis/relations/implementations.ts +5 -0
- package/src/analysis/relations/references.ts +5 -0
- 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/file-merge.ts +162 -0
- package/src/analysis/target/file-outline-omissions.ts +146 -0
- package/src/analysis/target/file-refinement.ts +7 -7
- package/src/analysis/target/file.ts +44 -156
- 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 +44 -12
- package/src/analysis/target/types.ts +38 -7
- package/src/api.ts +1 -1
- package/src/app/app.ts +9 -3
- package/src/extension.ts +17 -11
- package/src/session/graph/collect.ts +3 -10
- package/src/session/graph-types.ts +5 -1
- package/src/session/graph-workflow.ts +6 -4
- 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/workspace-context.ts +3 -0
- package/src/session/orientation-types.ts +3 -0
- package/src/session/orientation-workflow.ts +24 -8
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-workflow.ts +14 -16
- package/src/session/session.ts +87 -12
- package/src/session/target-store.ts +3 -18
- package/src/session/target-workflow.ts +56 -37
- 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 +137 -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/directory-navigation.ts +20 -31
- 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-output.ts +40 -13
- package/src/tool/code_orientation/workspace-sections.ts +48 -4
- 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/guidance.ts +1 -1
- package/src/tool/code_resolve/markdown.ts +127 -64
- package/src/tool/code_resolve/result.ts +41 -25
- package/src/tool/code_resolve/structured.ts +49 -18
- package/src/tool/result/model-budget.ts +2 -2
- package/src/tool/result/refactor.ts +8 -5
- package/src/tool/result/structured.ts +8 -5
- package/src/tool/result/types.ts +31 -24
- 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
- package/src/ui/tui/common.ts +10 -10
|
@@ -31,9 +31,9 @@ export type TargetProviderProvenance = "semantic" | "structural";
|
|
|
31
31
|
/**
|
|
32
32
|
* A stored resolved target entry with handles and metadata.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Contains stable target facts only; request-local resolution metadata belongs
|
|
35
|
+
* to the Target workflow outcome. Computed fields like relative paths are
|
|
36
|
+
* derived at the rendering boundary.
|
|
37
37
|
*/
|
|
38
38
|
export interface TargetStoreEntry {
|
|
39
39
|
targetId: string;
|
|
@@ -60,12 +60,6 @@ export interface TargetStoreEntry {
|
|
|
60
60
|
fileFingerprint: string;
|
|
61
61
|
/** Named symbolic container, or null when no container name was reported. */
|
|
62
62
|
container: string | null;
|
|
63
|
-
/**
|
|
64
|
-
* Resolution provenance — present when the target was resolved from
|
|
65
|
-
* anchored coordinates. Carries requested/resolved coordinates, whether
|
|
66
|
-
* the anchor was snapped, and the provider-backed evidence source.
|
|
67
|
-
*/
|
|
68
|
-
resolution?: import("../types/index.ts").AnchoredResolutionMetadata;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
/** Input shape for registering a resolved target. */
|
|
@@ -95,12 +89,6 @@ export interface TargetRegistrationInput {
|
|
|
95
89
|
anchorKind: AnchorKind;
|
|
96
90
|
/** Named symbolic container used to disambiguate same-file identity collisions, or null when unreported (ADR 0003). */
|
|
97
91
|
container: string | null;
|
|
98
|
-
/**
|
|
99
|
-
* Resolution provenance — present when the target was resolved from
|
|
100
|
-
* anchored coordinates. Carries requested/resolved coordinates, whether
|
|
101
|
-
* the anchor was snapped, and the provider-backed evidence source.
|
|
102
|
-
*/
|
|
103
|
-
resolution?: import("../types/index.ts").AnchoredResolutionMetadata;
|
|
104
92
|
/** Reuse one verified fingerprint across a bounded registration batch. */
|
|
105
93
|
fileFingerprint?: string;
|
|
106
94
|
}
|
|
@@ -261,7 +249,6 @@ export function registerWorkflowTarget(
|
|
|
261
249
|
anchorKind: input.anchorKind,
|
|
262
250
|
fileFingerprint: fingerprint,
|
|
263
251
|
container: input.container,
|
|
264
|
-
resolution: input.resolution,
|
|
265
252
|
};
|
|
266
253
|
|
|
267
254
|
const existing = store.get(targetId);
|
|
@@ -293,7 +280,6 @@ function mergeTargetRefinement(
|
|
|
293
280
|
displayCharacter: anchorSource.displayCharacter,
|
|
294
281
|
kind: displayKind,
|
|
295
282
|
anchorKind: anchorSource.anchorKind,
|
|
296
|
-
resolution: anchorSource.resolution,
|
|
297
283
|
confidence: strongestEvidenceSource.confidence,
|
|
298
284
|
provenance: mergeProvenance(existing.provenance, incoming.provenance),
|
|
299
285
|
};
|
|
@@ -305,7 +291,6 @@ function selectAnchorSource(
|
|
|
305
291
|
): TargetStoreEntry {
|
|
306
292
|
if (existing.anchorKind === "declaration" && incoming.anchorKind === "name") return incoming;
|
|
307
293
|
if (existing.anchorKind === "name" && incoming.anchorKind === "declaration") return existing;
|
|
308
|
-
if (!existing.resolution && incoming.resolution) return incoming;
|
|
309
294
|
return existing;
|
|
310
295
|
}
|
|
311
296
|
|
|
@@ -10,18 +10,19 @@ import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
|
10
10
|
import { withSemanticRequestControl, withStructuralRequestControl } from "../analysis/provider.ts";
|
|
11
11
|
import { normalizePath, resolveScope } from "../analysis/search/paths.ts";
|
|
12
12
|
import { resolveAnchoredSymbolTarget } from "../analysis/target/anchored.ts";
|
|
13
|
-
import {
|
|
13
|
+
import { resolveFileOutline, validateFileTargetDiscovery } from "../analysis/target/file.ts";
|
|
14
14
|
import {
|
|
15
15
|
canonicalDeclarationKind,
|
|
16
16
|
refineTargetOutcomeIdentity,
|
|
17
17
|
} from "../analysis/target/identity.ts";
|
|
18
18
|
import { resolveSymbolTarget } from "../analysis/target/symbol.ts";
|
|
19
19
|
import type {
|
|
20
|
+
FileOutlineData,
|
|
20
21
|
ResolvedTargetData,
|
|
21
|
-
ResolvedTargetGroupData,
|
|
22
22
|
TargetCandidateCompleteness,
|
|
23
23
|
TargetOutcome,
|
|
24
24
|
} from "../analysis/target/types.ts";
|
|
25
|
+
import type { AnchoredResolutionMetadata } from "../types/index.ts";
|
|
25
26
|
import type { CapabilityAdapter } from "./capability-adapter.ts";
|
|
26
27
|
import { parseTargetInput } from "./input/common.ts";
|
|
27
28
|
import { resolveWorkspaceSemanticDemand } from "./semantic-demand.ts";
|
|
@@ -49,17 +50,24 @@ export interface TargetWorkflowPolicy {
|
|
|
49
50
|
|
|
50
51
|
/** Typed Target workflow outcome. */
|
|
51
52
|
export type TargetWorkflowOutcome =
|
|
52
|
-
| { kind: "resolved"; entry: Readonly<TargetStoreEntry>; notes: readonly string[] }
|
|
53
53
|
| {
|
|
54
|
-
kind: "
|
|
54
|
+
kind: "resolved";
|
|
55
|
+
entry: Readonly<TargetStoreEntry>;
|
|
56
|
+
/** Immutable observation of this anchored request, never stored with the target. */
|
|
57
|
+
readonly resolution?: AnchoredResolutionMetadata;
|
|
58
|
+
notes: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
kind: "file-outline";
|
|
55
62
|
file: string;
|
|
56
63
|
confidence: ResolvedTargetData["confidence"];
|
|
57
|
-
discoveryProvenance:
|
|
64
|
+
discoveryProvenance: FileOutlineData["discoveryProvenance"];
|
|
58
65
|
targets: ReadonlyArray<Readonly<TargetStoreEntry>>;
|
|
59
66
|
totalCount: number;
|
|
60
67
|
omittedCount: number;
|
|
61
|
-
|
|
62
|
-
partial?:
|
|
68
|
+
unknownLevelCount: number;
|
|
69
|
+
partial?: FileOutlineData["partial"];
|
|
70
|
+
notListed: FileOutlineData["notListed"];
|
|
63
71
|
}
|
|
64
72
|
| ({
|
|
65
73
|
kind: "disambiguation";
|
|
@@ -259,7 +267,7 @@ async function resolveFileOnlyWorkflow(
|
|
|
259
267
|
return { kind: "unavailable", reason: readiness.reason };
|
|
260
268
|
}
|
|
261
269
|
|
|
262
|
-
const result = await
|
|
270
|
+
const result = await resolveFileOutline(
|
|
263
271
|
file,
|
|
264
272
|
deps.cwd,
|
|
265
273
|
{
|
|
@@ -277,7 +285,7 @@ async function resolveFileOnlyWorkflow(
|
|
|
277
285
|
return { kind: "unavailable", reason: result.message };
|
|
278
286
|
}
|
|
279
287
|
|
|
280
|
-
return
|
|
288
|
+
return registerFileOutline(result.outline, deps, maxResults);
|
|
281
289
|
}
|
|
282
290
|
|
|
283
291
|
function toWorkflowOutcome(
|
|
@@ -301,15 +309,17 @@ function toWorkflowOutcome(
|
|
|
301
309
|
};
|
|
302
310
|
}
|
|
303
311
|
const registered = registerFromTargetData(outcome.target, deps);
|
|
312
|
+
const resolution = immutableResolution(outcome.target.resolution);
|
|
304
313
|
return {
|
|
305
314
|
kind: "resolved",
|
|
306
315
|
entry: immutableEntry(registered.entry),
|
|
307
|
-
|
|
316
|
+
...(resolution ? { resolution } : {}),
|
|
317
|
+
notes: [...buildResolutionNotes(resolution), ...(outcome.notes ?? [])],
|
|
308
318
|
};
|
|
309
319
|
}
|
|
310
320
|
|
|
311
|
-
if (outcome.kind === "
|
|
312
|
-
return
|
|
321
|
+
if (outcome.kind === "file-outline") {
|
|
322
|
+
return registerFileOutline(outcome.outline, deps, policy.maxResults ?? 10);
|
|
313
323
|
}
|
|
314
324
|
|
|
315
325
|
const candidates = registerTargetCandidates(outcome.candidates, deps.registerTarget);
|
|
@@ -333,40 +343,44 @@ function toWorkflowOutcome(
|
|
|
333
343
|
};
|
|
334
344
|
}
|
|
335
345
|
|
|
336
|
-
function
|
|
337
|
-
|
|
346
|
+
function registerFileOutline(
|
|
347
|
+
outline: FileOutlineData,
|
|
338
348
|
deps: TargetWorkflowDeps,
|
|
339
349
|
maxResults: number,
|
|
340
350
|
): TargetWorkflowOutcome {
|
|
341
|
-
const totalCount =
|
|
342
|
-
const visibleTargets =
|
|
343
|
-
const fingerprint = computeFileFingerprint(
|
|
351
|
+
const totalCount = outline.targets.length;
|
|
352
|
+
const visibleTargets = outline.targets.slice(0, Math.max(0, maxResults));
|
|
353
|
+
const fingerprint = computeFileFingerprint(outline.file);
|
|
344
354
|
const fileFingerprint = fingerprint.kind === "ok" ? fingerprint.fingerprint : "unfingerprinted";
|
|
345
355
|
const targets = visibleTargets.map((target) =>
|
|
346
356
|
immutableEntry(registerFromTargetData(target, deps, fileFingerprint).entry),
|
|
347
357
|
);
|
|
348
358
|
return Object.freeze({
|
|
349
|
-
kind: "
|
|
350
|
-
file:
|
|
351
|
-
confidence:
|
|
352
|
-
discoveryProvenance: Object.freeze([...
|
|
359
|
+
kind: "file-outline",
|
|
360
|
+
file: outline.file,
|
|
361
|
+
confidence: outline.confidence,
|
|
362
|
+
discoveryProvenance: Object.freeze([...outline.discoveryProvenance]),
|
|
353
363
|
targets: Object.freeze(targets),
|
|
354
364
|
totalCount,
|
|
355
365
|
omittedCount: totalCount - targets.length,
|
|
356
|
-
|
|
357
|
-
...(
|
|
366
|
+
unknownLevelCount: outline.unknownLevelCount,
|
|
367
|
+
...(outline.partial ? { partial: outline.partial } : {}),
|
|
368
|
+
notListed: outline.notListed,
|
|
358
369
|
});
|
|
359
370
|
}
|
|
360
371
|
|
|
361
|
-
function buildResolutionNotes(
|
|
372
|
+
function buildResolutionNotes(
|
|
373
|
+
resolution: AnchoredResolutionMetadata | undefined,
|
|
374
|
+
): readonly string[] {
|
|
362
375
|
const notes: string[] = [];
|
|
363
|
-
if (
|
|
376
|
+
if (resolution?.snapped) {
|
|
377
|
+
const requested = `${resolution.requested.line}:${resolution.requested.character}`;
|
|
378
|
+
const resolved = `${resolution.resolved.line}:${resolution.resolved.character}`;
|
|
364
379
|
notes.push(
|
|
365
|
-
`
|
|
380
|
+
`Requested coordinate snapped from ${requested} to name anchor ${resolved} (evidence: ${resolution.source}).`,
|
|
366
381
|
);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
notes.push("Resolved from provider-backed structural identifier evidence.");
|
|
382
|
+
} else if (resolution && resolution.source !== "semantic") {
|
|
383
|
+
notes.push(`Resolved from ${resolution.source} evidence.`);
|
|
370
384
|
}
|
|
371
385
|
return Object.freeze(notes);
|
|
372
386
|
}
|
|
@@ -394,7 +408,6 @@ function registerFromTargetData(
|
|
|
394
408
|
provenance: target.provenance,
|
|
395
409
|
anchorKind: target.anchorKind,
|
|
396
410
|
container: target.container,
|
|
397
|
-
resolution: target.resolution,
|
|
398
411
|
fileFingerprint,
|
|
399
412
|
});
|
|
400
413
|
}
|
|
@@ -407,12 +420,18 @@ function immutableEntry(entry: TargetStoreEntry): Readonly<TargetStoreEntry> {
|
|
|
407
420
|
declarationPosition: entry.declarationPosition
|
|
408
421
|
? Object.freeze({ ...entry.declarationPosition })
|
|
409
422
|
: entry.declarationPosition,
|
|
410
|
-
resolution: entry.resolution
|
|
411
|
-
? Object.freeze({
|
|
412
|
-
...entry.resolution,
|
|
413
|
-
requested: Object.freeze({ ...entry.resolution.requested }),
|
|
414
|
-
resolved: Object.freeze({ ...entry.resolution.resolved }),
|
|
415
|
-
})
|
|
416
|
-
: undefined,
|
|
417
423
|
});
|
|
418
424
|
}
|
|
425
|
+
|
|
426
|
+
/** Keep the current request observation independent of provider and target-store state. */
|
|
427
|
+
function immutableResolution(
|
|
428
|
+
resolution: AnchoredResolutionMetadata | undefined,
|
|
429
|
+
): AnchoredResolutionMetadata | undefined {
|
|
430
|
+
return resolution
|
|
431
|
+
? Object.freeze({
|
|
432
|
+
...resolution,
|
|
433
|
+
requested: Object.freeze({ ...resolution.requested }),
|
|
434
|
+
resolved: Object.freeze({ ...resolution.resolved }),
|
|
435
|
+
})
|
|
436
|
+
: undefined;
|
|
437
|
+
}
|
|
@@ -62,16 +62,16 @@ function getFilePathFromToolResult(event: ToolResultEvent): string | null {
|
|
|
62
62
|
return pathValue;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** Extract
|
|
65
|
+
/** Extract original document identities, never display paths, from a successful Apply. */
|
|
66
66
|
function getRefactorApplyPaths(event: ToolResultEvent): string[] {
|
|
67
67
|
const details = (event as { details?: unknown }).details as
|
|
68
|
-
| { data?: {
|
|
68
|
+
| { data?: { recoveryFiles?: unknown } }
|
|
69
69
|
| undefined;
|
|
70
|
-
const
|
|
71
|
-
if (!Array.isArray(
|
|
70
|
+
const recoveryFiles = details?.data?.recoveryFiles;
|
|
71
|
+
if (!Array.isArray(recoveryFiles)) return [];
|
|
72
72
|
return [
|
|
73
73
|
...new Set(
|
|
74
|
-
|
|
74
|
+
recoveryFiles.filter((file): file is string => typeof file === "string" && file.length > 0),
|
|
75
75
|
),
|
|
76
76
|
];
|
|
77
77
|
}
|
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
type EvidenceListMetadata,
|
|
5
5
|
renderEvidenceListMetadataDisclosure,
|
|
6
6
|
} from "../../analysis/evidence.ts";
|
|
7
|
+
import {
|
|
8
|
+
type AutomaticPathExclusionDisplay,
|
|
9
|
+
describeExcludedPath,
|
|
10
|
+
} from "../../analysis/search/exclusions.ts";
|
|
7
11
|
import { renderStructuredEmptyState, renderStructuredMatches } from "./markdown.ts";
|
|
8
12
|
import type { FindResultAssembly } from "./result.ts";
|
|
9
13
|
|
|
@@ -52,19 +56,19 @@ function renderSemantic(assembly: FindResultAssembly, evidence: EvidenceListMeta
|
|
|
52
56
|
const disclosure = renderEvidenceListMetadataDisclosure(evidence);
|
|
53
57
|
if (disclosure) lines.push(disclosure);
|
|
54
58
|
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(
|
|
55
|
-
|
|
59
|
+
assembly.details.automaticPathExclusion,
|
|
56
60
|
);
|
|
57
61
|
if (exclusionDisclosure) lines.push(exclusionDisclosure);
|
|
58
62
|
return lines.join("\n");
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
function renderAutomaticPathExclusionDisclosure(
|
|
62
|
-
exclusion:
|
|
66
|
+
exclusion: AutomaticPathExclusionDisplay | undefined,
|
|
63
67
|
): string | null {
|
|
64
68
|
if (!exclusion || exclusion.excludedCount <= 0) return null;
|
|
65
69
|
const noun = `workspace-symbol result${exclusion.excludedCount === 1 ? "" : "s"}`;
|
|
66
70
|
const examples = exclusion.examples.length
|
|
67
|
-
? `
|
|
71
|
+
? ` Excluded path examples: ${exclusion.examples.map(describeExcludedPath).join(", ")}.`
|
|
68
72
|
: "";
|
|
69
73
|
return `_Automatic path policy excluded ${exclusion.excludedCount} ${noun}.${examples}_`;
|
|
70
74
|
}
|
|
@@ -82,7 +86,7 @@ function renderEmptySemantic(assembly: FindResultAssembly, evidence: EvidenceLis
|
|
|
82
86
|
const disclosure = renderEvidenceListMetadataDisclosure(evidence);
|
|
83
87
|
if (disclosure) lines.push("", disclosure);
|
|
84
88
|
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(
|
|
85
|
-
|
|
89
|
+
assembly.details.automaticPathExclusion,
|
|
86
90
|
);
|
|
87
91
|
if (exclusionDisclosure) lines.push("", exclusionDisclosure);
|
|
88
92
|
lines.push("", "Document-level semantic symbols can differ from the workspace index.");
|
|
@@ -4,6 +4,12 @@ import {
|
|
|
4
4
|
createPartialEvidenceList,
|
|
5
5
|
type EvidenceListMetadata,
|
|
6
6
|
} from "../../analysis/evidence.ts";
|
|
7
|
+
import {
|
|
8
|
+
describeExcludedPath,
|
|
9
|
+
describePartialQuery,
|
|
10
|
+
displayAutomaticPathExclusion,
|
|
11
|
+
} from "../../analysis/search/exclusions.ts";
|
|
12
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
7
13
|
import type { FindMode, FindWorkflowOutcome } from "../../session/find-types.ts";
|
|
8
14
|
import {
|
|
9
15
|
assembledNextQueries,
|
|
@@ -24,8 +30,14 @@ export interface FindResultAssembly {
|
|
|
24
30
|
|
|
25
31
|
/** Assemble one completed code-aware search outcome before presentation. */
|
|
26
32
|
export function assembleFindWorkflowResult(
|
|
27
|
-
|
|
33
|
+
input: Extract<FindWorkflowOutcome, { kind: "completed" }>,
|
|
34
|
+
cwd: string,
|
|
28
35
|
): FindResultAssembly {
|
|
36
|
+
const outcome = withDisplayPaths(input, cwd);
|
|
37
|
+
const exclusion =
|
|
38
|
+
outcome.data.kind === "semantic"
|
|
39
|
+
? displayAutomaticPathExclusion(outcome.data.partialMetadata?.automaticPathExclusion, cwd)
|
|
40
|
+
: undefined;
|
|
29
41
|
const evidence = createFindEvidence(outcome);
|
|
30
42
|
const confidence: ConfidenceMode = outcome.data.kind === "semantic" ? "semantic" : "structural";
|
|
31
43
|
const nextQueries = findNextQueries(outcome);
|
|
@@ -61,6 +73,19 @@ export function assembleFindWorkflowResult(
|
|
|
61
73
|
}),
|
|
62
74
|
];
|
|
63
75
|
|
|
76
|
+
if (exclusion?.examples.length) {
|
|
77
|
+
displaySections.push(
|
|
78
|
+
createToolDisplaySection({
|
|
79
|
+
key: "find.excludedPaths",
|
|
80
|
+
title: "Excluded path examples",
|
|
81
|
+
items: exclusion.examples,
|
|
82
|
+
totalCount: exclusion.examples.length,
|
|
83
|
+
omittedCount: 0,
|
|
84
|
+
format: describeExcludedPath,
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
64
89
|
return {
|
|
65
90
|
outcome,
|
|
66
91
|
assembled,
|
|
@@ -79,9 +104,52 @@ export function assembleFindWorkflowResult(
|
|
|
79
104
|
structuralFailures: [...outcome.data.result.failures],
|
|
80
105
|
}
|
|
81
106
|
: {}),
|
|
82
|
-
...(
|
|
83
|
-
|
|
84
|
-
|
|
107
|
+
...(exclusion ? { automaticPathExclusion: exclusion } : {}),
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Clone source-path projections for all output adapters without changing workflow facts. */
|
|
113
|
+
function withDisplayPaths(
|
|
114
|
+
outcome: Extract<FindWorkflowOutcome, { kind: "completed" }>,
|
|
115
|
+
cwd: string,
|
|
116
|
+
): Extract<FindWorkflowOutcome, { kind: "completed" }> {
|
|
117
|
+
const display = (file: string) => toDisplayPath(cwd, file);
|
|
118
|
+
const { data } = outcome;
|
|
119
|
+
if (data.kind === "semantic") {
|
|
120
|
+
return {
|
|
121
|
+
...outcome,
|
|
122
|
+
data: {
|
|
123
|
+
...data,
|
|
124
|
+
symbols: data.symbols.map((symbol) => ({ ...symbol, file: display(symbol.file) })),
|
|
125
|
+
partialReason: data.partialReason
|
|
126
|
+
? describePartialQuery(data.partialReason, data.partialMetadata, cwd)
|
|
127
|
+
: null,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const { result } = data;
|
|
132
|
+
return {
|
|
133
|
+
...outcome,
|
|
134
|
+
data: {
|
|
135
|
+
...data,
|
|
136
|
+
result: {
|
|
137
|
+
...result,
|
|
138
|
+
matches: result.matches.map((match) => ({ ...match, file: display(match.file) })),
|
|
139
|
+
failures: result.failures.map((failure) => ({ ...failure, file: display(failure.file) })),
|
|
140
|
+
scan: {
|
|
141
|
+
...result.scan,
|
|
142
|
+
roots: result.scan.roots.map(display),
|
|
143
|
+
exclusions: result.scan.exclusions.map((entry) => ({
|
|
144
|
+
...entry,
|
|
145
|
+
examples: entry.examples.map(display),
|
|
146
|
+
})),
|
|
147
|
+
limitations: result.scan.limitations.map((entry) => ({
|
|
148
|
+
...entry,
|
|
149
|
+
examples: entry.examples.map(display),
|
|
150
|
+
})),
|
|
151
|
+
},
|
|
152
|
+
},
|
|
85
153
|
},
|
|
86
154
|
};
|
|
87
155
|
}
|
|
@@ -105,7 +173,11 @@ function createFindEvidence(outcome: Extract<FindWorkflowOutcome, { kind: "compl
|
|
|
105
173
|
items: [...outcome.data.symbols],
|
|
106
174
|
maxResults: outcome.maxResults,
|
|
107
175
|
};
|
|
108
|
-
|
|
176
|
+
// Exclusion-only results counted every in-policy row; the separate
|
|
177
|
+
// exclusion disclosure still reports the dropped paths.
|
|
178
|
+
const providerLimited =
|
|
179
|
+
outcome.data.partialReason !== null && outcome.data.partialMetadata?.exclusionOnly !== true;
|
|
180
|
+
const evidence = providerLimited
|
|
109
181
|
? createPartialEvidenceList({ ...params, partialReason: "provider-limited" })
|
|
110
182
|
: createEvidenceList(params);
|
|
111
183
|
return { total: outcome.data.symbols.length, metadata: evidence.metadata };
|
|
@@ -207,7 +279,7 @@ export function finishFindResult(
|
|
|
207
279
|
};
|
|
208
280
|
}
|
|
209
281
|
|
|
210
|
-
const assembly = assembleFindWorkflowResult(outcome);
|
|
282
|
+
const assembly = assembleFindWorkflowResult(outcome, cwd);
|
|
211
283
|
return {
|
|
212
284
|
content: renderFindResult(assembly),
|
|
213
285
|
structuredContent: structuredFindResult(assembly, cwd),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StringEnum } from "@earendil-works/pi-ai";
|
|
2
1
|
import { Type } from "typebox";
|
|
3
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
4
3
|
import { FindQueryParam, FindScopeParam, MaxResultsParam } from "../schemas.ts";
|
|
@@ -20,12 +19,14 @@ export const codeFindSpec = {
|
|
|
20
19
|
{
|
|
21
20
|
query: FindQueryParam,
|
|
22
21
|
scope: Type.Optional(FindScopeParam),
|
|
23
|
-
mode:
|
|
22
|
+
mode: Type.Enum(CODE_FIND_MODES, {
|
|
23
|
+
type: "string",
|
|
24
24
|
description:
|
|
25
25
|
"Required code-aware search mode. AST mode requires `kind`; semantic mode rejects `kind`.",
|
|
26
26
|
}),
|
|
27
27
|
kind: Type.Optional(
|
|
28
|
-
|
|
28
|
+
Type.Enum(CODE_FIND_AST_KINDS, {
|
|
29
|
+
type: "string",
|
|
29
30
|
description: 'AST structure kind; required only for mode:"ast".',
|
|
30
31
|
}),
|
|
31
32
|
),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StringEnum } from "@earendil-works/pi-ai";
|
|
2
1
|
import { type Static, Type } from "typebox";
|
|
3
2
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
4
3
|
import { ConfidenceSchema, EvidenceListSchema, RecoveryRangeSchema } from "../result/structured.ts";
|
|
@@ -13,8 +12,8 @@ const ScanPathSummary = Type.Object({
|
|
|
13
12
|
/** Codemode search evidence, including scan-universe limits independently of match counts. */
|
|
14
13
|
export const FindOutputSchema = Type.Object(
|
|
15
14
|
{
|
|
16
|
-
kind:
|
|
17
|
-
mode: Type.Optional(
|
|
15
|
+
kind: Type.Enum(["completed", "invalid-input"], { type: "string" }),
|
|
16
|
+
mode: Type.Optional(Type.Enum(["semantic", "ast"], { type: "string" })),
|
|
18
17
|
confidence: ConfidenceSchema,
|
|
19
18
|
matches: Type.Array(
|
|
20
19
|
Type.Object(
|
|
@@ -26,7 +25,7 @@ export const FindOutputSchema = Type.Object(
|
|
|
26
25
|
character: Type.Integer(),
|
|
27
26
|
endLine: Type.Optional(Type.Integer()),
|
|
28
27
|
endCharacter: Type.Optional(Type.Integer()),
|
|
29
|
-
anchorKind: Type.Optional(
|
|
28
|
+
anchorKind: Type.Optional(Type.Enum(["name", "declaration"], { type: "string" })),
|
|
30
29
|
container: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
31
30
|
},
|
|
32
31
|
{ additionalProperties: false },
|
|
@@ -35,9 +34,25 @@ export const FindOutputSchema = Type.Object(
|
|
|
35
34
|
evidenceLists: Type.Array(EvidenceListSchema),
|
|
36
35
|
nextQueries: Type.Array(Type.String()),
|
|
37
36
|
message: Type.Optional(Type.String()),
|
|
38
|
-
partialReason: Type.Optional(
|
|
37
|
+
partialReason: Type.Optional(
|
|
38
|
+
Type.Union([Type.String(), Type.Null()], {
|
|
39
|
+
description:
|
|
40
|
+
"Why semantic results may be incomplete; null when complete. Policy exclusions alone are reported in automaticPathExclusion, not here.",
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
39
43
|
automaticPathExclusion: Type.Optional(
|
|
40
|
-
Type.Object({
|
|
44
|
+
Type.Object({
|
|
45
|
+
excludedCount: Type.Integer(),
|
|
46
|
+
examples: Type.Array(
|
|
47
|
+
Type.Object({
|
|
48
|
+
observedPath: Type.String({
|
|
49
|
+
description:
|
|
50
|
+
"Original path observed by the exclusion policy, not a canonical navigation path.",
|
|
51
|
+
}),
|
|
52
|
+
canonicalPath: Type.String({ description: "Canonical source navigation path." }),
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
}),
|
|
41
56
|
),
|
|
42
57
|
scan: Type.Optional(
|
|
43
58
|
Type.Object({
|
|
@@ -93,7 +108,7 @@ export function structuredFindResult(
|
|
|
93
108
|
nextQueries: assembly.details.nextQueries,
|
|
94
109
|
};
|
|
95
110
|
if (data.kind === "semantic") {
|
|
96
|
-
const exclusion =
|
|
111
|
+
const exclusion = assembly.details.automaticPathExclusion;
|
|
97
112
|
return {
|
|
98
113
|
...base,
|
|
99
114
|
matches: data.symbols.slice(0, shown).map((symbol) => {
|
|
@@ -108,12 +123,13 @@ export function structuredFindResult(
|
|
|
108
123
|
container: symbol.container ?? null,
|
|
109
124
|
};
|
|
110
125
|
}),
|
|
111
|
-
|
|
126
|
+
// Exclusion-only evidence is complete; automaticPathExclusion carries it.
|
|
127
|
+
partialReason: data.partialMetadata?.exclusionOnly === true ? null : data.partialReason,
|
|
112
128
|
...(exclusion
|
|
113
129
|
? {
|
|
114
130
|
automaticPathExclusion: {
|
|
115
131
|
excludedCount: exclusion.excludedCount,
|
|
116
|
-
examples:
|
|
132
|
+
examples: exclusion.examples.map((example) => ({ ...example })),
|
|
117
133
|
},
|
|
118
134
|
}
|
|
119
135
|
: {}),
|
|
@@ -14,6 +14,7 @@ export interface GraphFileGroup {
|
|
|
14
14
|
export interface GraphSectionDetails {
|
|
15
15
|
rel: GraphRelationKind;
|
|
16
16
|
source: "semantic" | "structural";
|
|
17
|
+
/** Collection completeness; display caps are disclosed by the evidence-list counts. */
|
|
17
18
|
status: "complete" | "partial" | "unavailable";
|
|
18
19
|
message: string | null;
|
|
19
20
|
externalCount: number;
|
|
@@ -4,7 +4,7 @@ import { createToolDisplaySection } from "../result/display.ts";
|
|
|
4
4
|
import type { ToolDisplaySection } from "../result/types.ts";
|
|
5
5
|
import type { GraphFileGroup } from "./details.ts";
|
|
6
6
|
import { compactGraphLabel } from "./format.ts";
|
|
7
|
-
import type { AssembledGraphSection } from "./
|
|
7
|
+
import type { AssembledGraphSection } from "./section.ts";
|
|
8
8
|
|
|
9
9
|
/** Bound sites before grouping them. Each file group partitions the display rows. */
|
|
10
10
|
export function graphDisplaySection(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const toolDescription =
|
|
2
|
-
"Find semantic references and implementations, or non-symbol-aware structural calls written inside a target's enclosing scope.";
|
|
2
|
+
"Find semantic references and implementations, or non-symbol-aware structural calls written inside a target's enclosing scope. To find relationships for a known symbol or source position, pass it directly as the target.";
|
|
3
3
|
|
|
4
4
|
export const promptSnippet = "trace code relationships";
|
|
5
5
|
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
formatGraphRange,
|
|
11
11
|
graphCodeSpan,
|
|
12
12
|
} from "./format.ts";
|
|
13
|
-
import type {
|
|
13
|
+
import type { GraphResultAssembly } from "./result.ts";
|
|
14
|
+
import type { AssembledGraphSection } from "./section.ts";
|
|
14
15
|
|
|
15
16
|
/** Render one target and one summary per requested relation. */
|
|
16
17
|
export function renderGraphResult(assembly: GraphResultAssembly): string {
|
|
@@ -18,6 +19,7 @@ export function renderGraphResult(assembly: GraphResultAssembly): string {
|
|
|
18
19
|
`Target: ${graphCodeSpan(assembly.displayName)} — ${graphCodeSpan(assembly.resolvedDisplayFile)}`,
|
|
19
20
|
"",
|
|
20
21
|
];
|
|
22
|
+
for (const note of assembly.notes) lines.push(`_Note: ${note}_`, "");
|
|
21
23
|
for (const section of assembly.sections) lines.push(...renderSection(section, assembly), "");
|
|
22
24
|
lines.push(...renderReadNextSection(assembledReadNext(assembly.assembled)));
|
|
23
25
|
return lines.join("\n");
|
|
@@ -28,12 +30,15 @@ function renderSection(section: AssembledGraphSection, assembly: GraphResultAsse
|
|
|
28
30
|
const depth = section.kind === "ok" && section.rel === "callees" ? `, ${section.data.depth}` : "";
|
|
29
31
|
const lines = [`## ${section.rel} (${source}${depth})`];
|
|
30
32
|
if (section.kind === "unavailable") return [...lines, `Unavailable — ${section.message}`];
|
|
33
|
+
const summary = formatGraphEvidence(
|
|
34
|
+
section.evidence.metadata,
|
|
35
|
+
section.rel === "callees" ? "call sites" : "locations",
|
|
36
|
+
section.rel === "callees" ? 0 : section.data.externalCount,
|
|
37
|
+
);
|
|
31
38
|
lines.push(
|
|
32
|
-
|
|
33
|
-
section.
|
|
34
|
-
|
|
35
|
-
section.rel === "callees" ? 0 : section.data.externalCount,
|
|
36
|
-
),
|
|
39
|
+
section.rel === "references" && section.selectionNote
|
|
40
|
+
? `${summary} — ${section.selectionNote}`
|
|
41
|
+
: summary,
|
|
37
42
|
"",
|
|
38
43
|
);
|
|
39
44
|
if (section.rel !== "callees") return [...lines, ...formatLocations(section, assembly.cwd)];
|