@mrclrchtr/supi-code-intelligence 13.0.0 → 14.0.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 +18 -0
- package/README.md +3 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/README.md +6 -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/query-result.ts +10 -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/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +14 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +8 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +7 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +24 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +64 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +27 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +16 -112
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +521 -83
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-collection.ts +163 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-row-limit.ts +72 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +36 -7
- 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/query-result.ts +10 -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/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
- package/package.json +5 -5
- package/src/analysis/health/server-status.ts +32 -9
- package/src/analysis/health/signals.ts +1 -0
- package/src/analysis/instruction-files.ts +11 -7
- package/src/analysis/search/exclusions.ts +18 -4
- package/src/analysis/target/file-outline-omissions.ts +17 -2
- package/src/analysis/target/symbol-selection.ts +100 -0
- package/src/analysis/target/symbol.ts +48 -8
- package/src/analysis/target/types.ts +8 -1
- package/src/app/app.ts +37 -21
- package/src/extension.ts +1 -2
- package/src/headless.ts +4 -2
- package/src/session/health-types.ts +2 -0
- package/src/session/orientation-types.ts +5 -0
- package/src/session/orientation-workflow.ts +13 -3
- package/src/session/target-workflow.ts +18 -12
- package/src/tool/code_find/render.ts +10 -11
- package/src/tool/code_find/result.ts +6 -1
- package/src/tool/code_graph/structured.ts +3 -0
- package/src/tool/code_health/markdown.ts +3 -1
- package/src/tool/code_health/structured-schema.ts +1 -0
- package/src/tool/code_health/structured.ts +2 -0
- package/src/tool/code_orientation/markdown.ts +6 -1
- package/src/tool/code_resolve/result.ts +2 -1
- package/src/tool/code_resolve/structured.ts +6 -1
- package/src/tool/result/candidate-selection.ts +17 -1
- package/src/ui/footer.ts +147 -42
- package/src/ui/status-overlay.ts +13 -8
|
@@ -151,7 +151,12 @@ async function orientTarget(options: {
|
|
|
151
151
|
candidates,
|
|
152
152
|
candidateEvidence: target.candidateEvidence,
|
|
153
153
|
}
|
|
154
|
-
: {
|
|
154
|
+
: {
|
|
155
|
+
kind: "disambiguation",
|
|
156
|
+
candidates,
|
|
157
|
+
candidateEvidence: target.candidateEvidence,
|
|
158
|
+
...(target.candidateNotes ? { candidateNotes: target.candidateNotes } : {}),
|
|
159
|
+
};
|
|
155
160
|
}
|
|
156
161
|
if (target.kind !== "resolved") return target;
|
|
157
162
|
throwIfAborted(control);
|
|
@@ -234,7 +239,7 @@ function addInstructionFiles(
|
|
|
234
239
|
): Awaited<ReturnType<typeof executeOrientation>> {
|
|
235
240
|
if (!deps.projectTrusted || !isDirectory(focusPath)) return result;
|
|
236
241
|
const config = loadCodeIntelligenceConfig(deps.cwd, deps.homeDir);
|
|
237
|
-
const matches = findInstructionFilesForDirectory({
|
|
242
|
+
const { matches, known } = findInstructionFilesForDirectory({
|
|
238
243
|
directory: focusPath,
|
|
239
244
|
cwd: deps.cwd,
|
|
240
245
|
fileNames: config.instructionFileNames,
|
|
@@ -248,7 +253,11 @@ function addInstructionFiles(
|
|
|
248
253
|
relativePath: toDisplayPath(deps.cwd, match.absolutePath),
|
|
249
254
|
})),
|
|
250
255
|
);
|
|
251
|
-
|
|
256
|
+
// The workspace-root file is in nearly every session's system prompt; naming it adds nothing.
|
|
257
|
+
const knownInstructionPaths = known
|
|
258
|
+
.filter((match) => match.relativeDirectory !== ".")
|
|
259
|
+
.map((match) => toDisplayPath(deps.cwd, match.absolutePath));
|
|
260
|
+
if (!collected) return { ...result, knownInstructionPaths };
|
|
252
261
|
const items: OrientationItem[] = [];
|
|
253
262
|
for (const file of collected.files) {
|
|
254
263
|
items.push(
|
|
@@ -277,6 +286,7 @@ function addInstructionFiles(
|
|
|
277
286
|
};
|
|
278
287
|
return {
|
|
279
288
|
...result,
|
|
289
|
+
knownInstructionPaths,
|
|
280
290
|
sections: [section, ...result.sections],
|
|
281
291
|
renderedSections: ["instructions", ...result.renderedSections],
|
|
282
292
|
instructions: collected.metadata,
|
|
@@ -84,7 +84,12 @@ export type TargetWorkflowOutcome =
|
|
|
84
84
|
candidates: ReadonlyArray<TargetWorkflowCandidate>;
|
|
85
85
|
} & TargetCandidateCompleteness)
|
|
86
86
|
| { kind: "invalid-input"; message: string }
|
|
87
|
-
| {
|
|
87
|
+
| {
|
|
88
|
+
kind: "unavailable";
|
|
89
|
+
reason: string;
|
|
90
|
+
/** A provider row limit, not readiness, left the result incomplete. */
|
|
91
|
+
rowLimited?: true;
|
|
92
|
+
};
|
|
88
93
|
|
|
89
94
|
/** Dependencies hidden behind the Workspace code-intelligence session seam. */
|
|
90
95
|
export interface TargetWorkflowDeps {
|
|
@@ -231,20 +236,18 @@ async function resolveSymbolWorkflow(
|
|
|
231
236
|
};
|
|
232
237
|
}
|
|
233
238
|
|
|
239
|
+
const structural =
|
|
240
|
+
withStructuralRequestControl(deps.capability.getStructuralProvider(deps.cwd), control) ??
|
|
241
|
+
undefined;
|
|
234
242
|
const outcome = await resolveSymbolTarget(symbol.query, deps.cwd, provider, {
|
|
235
243
|
path: scope,
|
|
236
244
|
kind: symbol.symbolKind,
|
|
237
245
|
maxResults: policy.maxResults,
|
|
238
246
|
control,
|
|
247
|
+
structural,
|
|
239
248
|
});
|
|
240
249
|
return toWorkflowOutcome(
|
|
241
|
-
await refineTargetOutcomeIdentity(
|
|
242
|
-
outcome,
|
|
243
|
-
deps.cwd,
|
|
244
|
-
withStructuralRequestControl(deps.capability.getStructuralProvider(deps.cwd), control) ??
|
|
245
|
-
undefined,
|
|
246
|
-
control,
|
|
247
|
-
),
|
|
250
|
+
await refineTargetOutcomeIdentity(outcome, deps.cwd, structural, control),
|
|
248
251
|
policy,
|
|
249
252
|
deps,
|
|
250
253
|
);
|
|
@@ -298,9 +301,7 @@ function toWorkflowOutcome(
|
|
|
298
301
|
policy: TargetWorkflowPolicy,
|
|
299
302
|
deps: TargetWorkflowDeps,
|
|
300
303
|
): TargetWorkflowOutcome {
|
|
301
|
-
if (outcome.kind === "unavailable")
|
|
302
|
-
return { kind: "unavailable", reason: outcome.reason };
|
|
303
|
-
}
|
|
304
|
+
if (outcome.kind === "unavailable") return outcome;
|
|
304
305
|
if (outcome.kind === "error") {
|
|
305
306
|
return { kind: "invalid-input", message: outcome.message };
|
|
306
307
|
}
|
|
@@ -335,7 +336,12 @@ function toWorkflowOutcome(
|
|
|
335
336
|
candidates,
|
|
336
337
|
candidateEvidence: outcome.candidateEvidence,
|
|
337
338
|
}
|
|
338
|
-
: {
|
|
339
|
+
: {
|
|
340
|
+
kind: "disambiguation",
|
|
341
|
+
candidates,
|
|
342
|
+
candidateEvidence: outcome.candidateEvidence,
|
|
343
|
+
...(outcome.candidateNotes ? { candidateNotes: outcome.candidateNotes } : {}),
|
|
344
|
+
};
|
|
339
345
|
}
|
|
340
346
|
|
|
341
347
|
function registerFileOutline(
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "../../analysis/evidence.ts";
|
|
7
7
|
import {
|
|
8
8
|
type AutomaticPathExclusionDisplay,
|
|
9
|
-
|
|
9
|
+
describeExcludedPathExamples,
|
|
10
10
|
} from "../../analysis/search/exclusions.ts";
|
|
11
11
|
import { renderStructuredEmptyState, renderStructuredMatches } from "./markdown.ts";
|
|
12
12
|
import type { FindResultAssembly } from "./result.ts";
|
|
@@ -55,21 +55,22 @@ function renderSemantic(assembly: FindResultAssembly, evidence: EvidenceListMeta
|
|
|
55
55
|
}
|
|
56
56
|
const disclosure = renderEvidenceListMetadataDisclosure(evidence);
|
|
57
57
|
if (disclosure) lines.push(disclosure);
|
|
58
|
-
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(
|
|
59
|
-
assembly.details.automaticPathExclusion,
|
|
60
|
-
);
|
|
58
|
+
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(assembly, evidence);
|
|
61
59
|
if (exclusionDisclosure) lines.push(exclusionDisclosure);
|
|
62
60
|
return lines.join("\n");
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
function renderAutomaticPathExclusionDisclosure(
|
|
66
|
-
|
|
64
|
+
assembly: FindResultAssembly,
|
|
65
|
+
evidence: EvidenceListMetadata,
|
|
67
66
|
): string | null {
|
|
67
|
+
// A provider-limited disclosure already carries the provider's exclusion sentence.
|
|
68
|
+
if (evidence.partialMessage) return null;
|
|
69
|
+
const exclusion: AutomaticPathExclusionDisplay | undefined =
|
|
70
|
+
assembly.details.automaticPathExclusion;
|
|
68
71
|
if (!exclusion || exclusion.excludedCount <= 0) return null;
|
|
69
72
|
const noun = `workspace-symbol result${exclusion.excludedCount === 1 ? "" : "s"}`;
|
|
70
|
-
const examples = exclusion
|
|
71
|
-
? ` Excluded path examples: ${exclusion.examples.map(describeExcludedPath).join(", ")}.`
|
|
72
|
-
: "";
|
|
73
|
+
const examples = describeExcludedPathExamples(exclusion);
|
|
73
74
|
return `_Automatic path policy excluded ${exclusion.excludedCount} ${noun}.${examples}_`;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -85,9 +86,7 @@ function renderEmptySemantic(assembly: FindResultAssembly, evidence: EvidenceLis
|
|
|
85
86
|
];
|
|
86
87
|
const disclosure = renderEvidenceListMetadataDisclosure(evidence);
|
|
87
88
|
if (disclosure) lines.push("", disclosure);
|
|
88
|
-
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(
|
|
89
|
-
assembly.details.automaticPathExclusion,
|
|
90
|
-
);
|
|
89
|
+
const exclusionDisclosure = renderAutomaticPathExclusionDisclosure(assembly, evidence);
|
|
91
90
|
if (exclusionDisclosure) lines.push("", exclusionDisclosure);
|
|
92
91
|
lines.push("", "Document-level semantic symbols can differ from the workspace index.");
|
|
93
92
|
const fileQuery = assembly.assembled.actions.find(
|
|
@@ -176,7 +176,12 @@ function createFindEvidence(outcome: Extract<FindWorkflowOutcome, { kind: "compl
|
|
|
176
176
|
const providerLimited =
|
|
177
177
|
outcome.data.partialReason !== null && outcome.data.partialMetadata?.exclusionOnly !== true;
|
|
178
178
|
const evidence = providerLimited
|
|
179
|
-
? createPartialEvidenceList({
|
|
179
|
+
? createPartialEvidenceList({
|
|
180
|
+
...params,
|
|
181
|
+
partialReason: "provider-limited",
|
|
182
|
+
// Names the provider's cause and next step, as target selection does.
|
|
183
|
+
...(outcome.data.partialReason ? { partialMessage: outcome.data.partialReason } : {}),
|
|
184
|
+
})
|
|
180
185
|
: createEvidenceList(params);
|
|
181
186
|
return { total: outcome.data.symbols.length, metadata: evidence.metadata };
|
|
182
187
|
}
|
|
@@ -147,6 +147,9 @@ export function structuredGraphCandidates(
|
|
|
147
147
|
})),
|
|
148
148
|
evidenceLists: [{ ...evidence }],
|
|
149
149
|
readNext: [],
|
|
150
|
+
...(outcome.kind === "disambiguation" && outcome.candidateNotes?.length
|
|
151
|
+
? { notes: [...outcome.candidateNotes] }
|
|
152
|
+
: {}),
|
|
150
153
|
nextQueries,
|
|
151
154
|
...(outcome.kind === "kind-mismatch" ? { requestedKind: outcome.requestedKind } : {}),
|
|
152
155
|
};
|
|
@@ -421,7 +421,9 @@ function renderServersSection(
|
|
|
421
421
|
const statusIcon = server.status === "running" ? "✓" : "✗";
|
|
422
422
|
const reason = server.statusReason
|
|
423
423
|
? ` — ${formatProjectServerStatusReason(server.statusReason)}`
|
|
424
|
-
:
|
|
424
|
+
: server.loadingProjects
|
|
425
|
+
? ", loading projects (symbol queries wait)"
|
|
426
|
+
: "";
|
|
425
427
|
lines.push(
|
|
426
428
|
`- ${statusIcon} **${server.name}** @ \`${formatProjectServerRoot(cwd, server.root)}\` (${server.fileTypes.join(", ")}) — ${server.status}${reason}`,
|
|
427
429
|
);
|
|
@@ -184,6 +184,7 @@ export function structuredHealthResult(data: HealthData): Output {
|
|
|
184
184
|
status,
|
|
185
185
|
statusReason,
|
|
186
186
|
ready,
|
|
187
|
+
loadingProjects,
|
|
187
188
|
operationSupport,
|
|
188
189
|
typescript,
|
|
189
190
|
failureMessage,
|
|
@@ -193,6 +194,7 @@ export function structuredHealthResult(data: HealthData): Output {
|
|
|
193
194
|
fileTypes: [...fileTypes],
|
|
194
195
|
status,
|
|
195
196
|
ready,
|
|
197
|
+
...(loadingProjects ? { loadingProjects } : {}),
|
|
196
198
|
...(statusReason === undefined ? {} : { statusReason }),
|
|
197
199
|
...(typescript ? { typescript } : {}),
|
|
198
200
|
...(failureMessage ? { failureMessage } : {}),
|
|
@@ -33,7 +33,12 @@ export function renderOrientationData(
|
|
|
33
33
|
|
|
34
34
|
if (data.workspace) lines.push(`# ${data.title}`, "");
|
|
35
35
|
for (const note of data.notes) lines.push(note);
|
|
36
|
-
|
|
36
|
+
const known = data.knownInstructionPaths ?? [];
|
|
37
|
+
if (known.length > 0)
|
|
38
|
+
lines.push(
|
|
39
|
+
`Instruction files already supplied in this session, not repeated: ${known.map(code).join(", ")}.`,
|
|
40
|
+
);
|
|
41
|
+
if (data.notes.length > 0 || known.length > 0) lines.push("");
|
|
37
42
|
|
|
38
43
|
if (!data.workspace) lines.push(`# ${data.title}`, "");
|
|
39
44
|
|
|
@@ -303,8 +303,9 @@ export function finishResolveResult(
|
|
|
303
303
|
target?: ResolveTargetInput,
|
|
304
304
|
): CodeIntelResult {
|
|
305
305
|
if (outcome.kind === "unavailable") {
|
|
306
|
+
// A row-limit reason already names its next step; readiness recovery would contradict it.
|
|
306
307
|
const reason =
|
|
307
|
-
target && "symbol" in target && target.symbol.scope
|
|
308
|
+
target && "symbol" in target && target.symbol.scope && !outcome.rowLimited
|
|
308
309
|
? scopedSymbolFailureMessage(outcome.reason)
|
|
309
310
|
: outcome.reason;
|
|
310
311
|
throw new Error(reason);
|
|
@@ -94,7 +94,12 @@ export function structuredResolveResult(
|
|
|
94
94
|
],
|
|
95
95
|
evidenceLists: (data.evidenceLists ?? []).map((evidence) => ({ ...evidence })),
|
|
96
96
|
nextQueries: data.nextQueries,
|
|
97
|
-
notes:
|
|
97
|
+
notes:
|
|
98
|
+
outcome.kind === "resolved"
|
|
99
|
+
? [...outcome.notes]
|
|
100
|
+
: outcome.kind === "disambiguation"
|
|
101
|
+
? [...(outcome.candidateNotes ?? [])]
|
|
102
|
+
: [],
|
|
98
103
|
...(data.message === undefined ? {} : { message: data.message }),
|
|
99
104
|
...(data.outlineFile === undefined ? {} : { file: data.outlineFile }),
|
|
100
105
|
...(data.requestedKind === undefined ? {} : { requestedKind: data.requestedKind }),
|
|
@@ -41,6 +41,8 @@ export type CandidateSelectionOutcome<C extends SelectionCandidate = SelectionCa
|
|
|
41
41
|
readonly kind: "disambiguation";
|
|
42
42
|
readonly candidates: readonly C[];
|
|
43
43
|
readonly candidateEvidence: EvidenceListMetadata;
|
|
44
|
+
/** Matches left out of the candidates on purpose; rendered as notes. */
|
|
45
|
+
readonly candidateNotes?: readonly string[];
|
|
44
46
|
}
|
|
45
47
|
| {
|
|
46
48
|
readonly kind: "kind-mismatch";
|
|
@@ -83,6 +85,12 @@ export interface CandidateSelection<C extends SelectionCandidate> {
|
|
|
83
85
|
const CANDIDATE_NOUN: EvidenceNoun = { one: "candidate", other: "candidates" };
|
|
84
86
|
const DISAMBIGUATION_RECOVERY =
|
|
85
87
|
"Choose one candidate handle, or narrow the symbol selector with scope or symbolKind";
|
|
88
|
+
/**
|
|
89
|
+
* An incomplete list discloses its cause and the step that applies to it.
|
|
90
|
+
* Generic narrowing advice can contradict that step, for example by suggesting
|
|
91
|
+
* a scope the caller already set.
|
|
92
|
+
*/
|
|
93
|
+
const INCOMPLETE_DISAMBIGUATION_RECOVERY = "Choose one candidate handle";
|
|
86
94
|
const MISMATCH_RECOVERY =
|
|
87
95
|
"Retry without symbolKind, use an observed provider kind, or choose a near-match handle";
|
|
88
96
|
|
|
@@ -97,7 +105,13 @@ export function assembleCandidateSelection<C extends SelectionCandidate>(
|
|
|
97
105
|
file: toDisplayPath(cwd, candidate.file),
|
|
98
106
|
}));
|
|
99
107
|
const evidence = rekeyEvidence(outcome.candidateEvidence, key);
|
|
100
|
-
const recovery =
|
|
108
|
+
const recovery =
|
|
109
|
+
input.recovery ??
|
|
110
|
+
(mismatch
|
|
111
|
+
? MISMATCH_RECOVERY
|
|
112
|
+
: evidence.partialReason === null
|
|
113
|
+
? DISAMBIGUATION_RECOVERY
|
|
114
|
+
: INCOMPLETE_DISAMBIGUATION_RECOVERY);
|
|
101
115
|
const title = mismatch ? "Near matches" : "Candidates";
|
|
102
116
|
|
|
103
117
|
const lines = mismatch
|
|
@@ -106,6 +120,8 @@ export function assembleCandidateSelection<C extends SelectionCandidate>(
|
|
|
106
120
|
for (const candidate of candidates) lines.push(formatCandidateMarkdownRow(candidate));
|
|
107
121
|
const disclosure = renderEvidenceListMetadataDisclosure(evidence, CANDIDATE_NOUN);
|
|
108
122
|
if (disclosure) lines.push("", disclosure);
|
|
123
|
+
const notes = outcome.kind === "disambiguation" ? (outcome.candidateNotes ?? []) : [];
|
|
124
|
+
for (const note of notes) lines.push("", `_Note: ${note}_`);
|
|
109
125
|
lines.push("", `${recovery}.`);
|
|
110
126
|
|
|
111
127
|
return Object.freeze({
|
package/src/ui/footer.ts
CHANGED
|
@@ -1,66 +1,171 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LSP footer
|
|
2
|
+
* LSP footer contribution for code-intelligence.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shows workspace LSP state on the right side of the footer path line, for
|
|
5
|
+
* example `λ 3✓ ◫43` (three ready routes, 43 tracked files).
|
|
6
|
+
*
|
|
7
|
+
* The text comes from the controller's latest published lifecycle snapshot.
|
|
8
|
+
* Rendering never queries the runtime, because route status can require
|
|
9
|
+
* file-system probes and the footer renders often. The same text is published
|
|
10
|
+
* through Pi's status API so the built-in footer and other custom footers
|
|
11
|
+
* show it too; the SuPi footer skips that same-key status.
|
|
7
12
|
*/
|
|
8
13
|
|
|
9
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
-
import {
|
|
11
|
-
|
|
14
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
15
|
+
import {
|
|
16
|
+
FOOTER_INVALIDATE_EVENT,
|
|
17
|
+
type FooterColor,
|
|
18
|
+
type FooterGlyphMode,
|
|
19
|
+
type FooterRenderContext,
|
|
20
|
+
footerContributions,
|
|
21
|
+
} from "@mrclrchtr/supi-core/footer-registry";
|
|
22
|
+
import type { LspRuntimeController } from "@mrclrchtr/supi-lsp/api";
|
|
23
|
+
import {
|
|
24
|
+
classifyProjectServerRoute,
|
|
25
|
+
type ProjectServerRouteState,
|
|
26
|
+
} from "../analysis/health/server-status.ts";
|
|
12
27
|
import { LSP_STATE_CHANGE_EVENT, type LspAdapterState } from "../substrate/lsp/state.ts";
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
type CountedState = Exclude<ProjectServerRouteState, "loading">;
|
|
30
|
+
|
|
31
|
+
interface LspFooterGlyphs {
|
|
32
|
+
label: string;
|
|
33
|
+
/** Tracked-file prefix, written directly before the count. */
|
|
34
|
+
files: string;
|
|
35
|
+
states: Record<CountedState, string>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const UNICODE_GLYPHS: LspFooterGlyphs = {
|
|
39
|
+
label: "λ",
|
|
40
|
+
files: "◫",
|
|
41
|
+
states: { ready: "✓", starting: "⟳", recovering: "↻", error: "✗", unavailable: "⊘" },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const GLYPHS: Record<FooterGlyphMode, LspFooterGlyphs> = {
|
|
45
|
+
// U+F0DCB: Material Design file outline.
|
|
46
|
+
nerd: { ...UNICODE_GLYPHS, files: "\u{F0DCB}" },
|
|
47
|
+
unicode: UNICODE_GLYPHS,
|
|
48
|
+
ascii: {
|
|
49
|
+
label: "lsp",
|
|
50
|
+
files: "f",
|
|
51
|
+
states: { ready: "ok", starting: "~", recovering: "r", error: "x", unavailable: "-" },
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Display order and color of each counted route state. `loading` counts as starting. */
|
|
56
|
+
const ROUTE_PARTS: ReadonlyArray<{ state: CountedState; color: FooterColor }> = [
|
|
57
|
+
{ state: "ready", color: "success" },
|
|
58
|
+
{ state: "starting", color: "accent" },
|
|
59
|
+
{ state: "recovering", color: "warning" },
|
|
60
|
+
{ state: "error", color: "error" },
|
|
61
|
+
{ state: "unavailable", color: "warning" },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const plainContext: FooterRenderContext = { style: (_color, text) => text, glyphMode: "unicode" };
|
|
65
|
+
|
|
66
|
+
type LspFooterController = Pick<
|
|
67
|
+
LspRuntimeController,
|
|
68
|
+
"kind" | "latestLifecycleTransition" | "getConfigurationError"
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Build the LSP status text, for example `λ 3✓ 1⟳ 1✗ ◫2`.
|
|
73
|
+
*
|
|
74
|
+
* A controller that could not start shows `✗ config` for a configuration error
|
|
75
|
+
* and `✗ unavailable` otherwise. A disabled or absent controller shows nothing.
|
|
76
|
+
*/
|
|
77
|
+
export function buildLspStatusText(
|
|
78
|
+
lspState: LspAdapterState,
|
|
79
|
+
ctx: FooterRenderContext = plainContext,
|
|
80
|
+
): string | undefined {
|
|
81
|
+
const controller = lspState.controller as LspFooterController | null;
|
|
82
|
+
if (!controller) return undefined;
|
|
83
|
+
const { style } = ctx;
|
|
84
|
+
const glyphs = GLYPHS[ctx.glyphMode];
|
|
85
|
+
const label = style("dim", glyphs.label);
|
|
86
|
+
const failure = glyphs.states.error;
|
|
87
|
+
|
|
88
|
+
if (controller.kind === "unavailable") {
|
|
89
|
+
const cause = controller.getConfigurationError() ? "config" : "unavailable";
|
|
90
|
+
return `${label} ${style("error", `${failure} ${cause}`)}`;
|
|
91
|
+
}
|
|
92
|
+
if (controller.kind !== "ready" && controller.kind !== "pending") return undefined;
|
|
93
|
+
|
|
94
|
+
const servers = controller.latestLifecycleTransition?.projectServers ?? [];
|
|
95
|
+
const counts = countRouteStates(servers);
|
|
96
|
+
const trackedFiles = servers.reduce((sum, server) => sum + server.openFiles.length, 0);
|
|
97
|
+
if (counts.size === 0 && trackedFiles === 0) return undefined;
|
|
98
|
+
|
|
99
|
+
const parts = [label];
|
|
100
|
+
for (const { state, color } of ROUTE_PARTS) {
|
|
101
|
+
const count = counts.get(state);
|
|
102
|
+
if (count) parts.push(style(color, `${count}${glyphs.states[state]}`));
|
|
103
|
+
}
|
|
104
|
+
if (trackedFiles > 0) parts.push(style("dim", `${glyphs.files}${trackedFiles}`));
|
|
105
|
+
return parts.join(" ");
|
|
40
106
|
}
|
|
41
107
|
|
|
42
|
-
|
|
108
|
+
function countRouteStates(
|
|
109
|
+
servers: readonly Parameters<typeof classifyProjectServerRoute>[0][],
|
|
110
|
+
): Map<CountedState, number> {
|
|
111
|
+
const counts = new Map<CountedState, number>();
|
|
112
|
+
for (const server of servers) {
|
|
113
|
+
const state = classifyProjectServerRoute(server);
|
|
114
|
+
// A route that still loads its projects answers queries but is not done yet.
|
|
115
|
+
const counted = state === "loading" ? "starting" : state;
|
|
116
|
+
counts.set(counted, (counts.get(counted) ?? 0) + 1);
|
|
117
|
+
}
|
|
118
|
+
return counts;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ── Footer contribution ─────────────────────────────────────────────────
|
|
43
122
|
|
|
44
123
|
const FOOTER_KEY = "lsp-status";
|
|
45
124
|
|
|
46
|
-
/** Register the LSP
|
|
125
|
+
/** Register the LSP footer contribution and its Pi status fallback. */
|
|
47
126
|
export function registerLspFooterContribution(
|
|
48
127
|
pi: ExtensionAPI,
|
|
49
128
|
lspState: LspAdapterState,
|
|
50
129
|
): {
|
|
51
130
|
dispose: () => void;
|
|
52
131
|
} {
|
|
132
|
+
let statusUi: ExtensionContext["ui"] | undefined;
|
|
133
|
+
|
|
53
134
|
footerContributions.register({
|
|
54
135
|
key: FOOTER_KEY,
|
|
55
|
-
placement: "
|
|
136
|
+
placement: "path-end",
|
|
56
137
|
priority: 100,
|
|
57
|
-
render: () =>
|
|
58
|
-
return buildLspStatusText(lspState) ?? "";
|
|
59
|
-
},
|
|
138
|
+
render: (ctx) => buildLspStatusText(lspState, ctx) ?? "",
|
|
60
139
|
});
|
|
61
140
|
|
|
62
|
-
|
|
63
|
-
|
|
141
|
+
const publishStatus = () => {
|
|
142
|
+
if (!statusUi) return;
|
|
143
|
+
const theme = statusUi.theme;
|
|
144
|
+
const text = buildLspStatusText(lspState, {
|
|
145
|
+
style: (color, value) => theme.fg(color, value),
|
|
146
|
+
glyphMode: "unicode",
|
|
147
|
+
});
|
|
148
|
+
try {
|
|
149
|
+
statusUi.setStatus(FOOTER_KEY, text);
|
|
150
|
+
} catch {
|
|
151
|
+
// Pi may be shutting down while the status changes.
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
pi.on("session_start", (_event, ctx) => {
|
|
156
|
+
statusUi = ctx.mode === "tui" ? ctx.ui : undefined;
|
|
157
|
+
publishStatus();
|
|
158
|
+
});
|
|
159
|
+
pi.on("session_shutdown", () => {
|
|
160
|
+
statusUi?.setStatus(FOOTER_KEY, undefined);
|
|
161
|
+
statusUi = undefined;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Re-render when the runtime publishes a new snapshot.
|
|
165
|
+
const handler = () => {
|
|
166
|
+
publishStatus();
|
|
167
|
+
pi.events.emit(FOOTER_INVALIDATE_EVENT, {});
|
|
168
|
+
};
|
|
64
169
|
lspState.stateChanges.addEventListener(LSP_STATE_CHANGE_EVENT, handler);
|
|
65
170
|
|
|
66
171
|
return {
|
|
@@ -71,7 +176,7 @@ export function registerLspFooterContribution(
|
|
|
71
176
|
};
|
|
72
177
|
}
|
|
73
178
|
|
|
74
|
-
/** Remove the LSP
|
|
179
|
+
/** Remove the LSP footer contribution. */
|
|
75
180
|
export function unregisterLspFooterContribution(): void {
|
|
76
181
|
footerContributions.unregister(FOOTER_KEY);
|
|
77
182
|
}
|
package/src/ui/status-overlay.ts
CHANGED
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
WorkspaceDiagnosticCheckReport,
|
|
23
23
|
} from "../analysis/health/check.ts";
|
|
24
24
|
import {
|
|
25
|
+
classifyProjectServerRoute,
|
|
25
26
|
countProjectServerRouteStatuses,
|
|
26
27
|
formatProjectServerCompiler,
|
|
27
28
|
formatProjectServerRoot,
|
|
@@ -405,18 +406,16 @@ export class CiStatusDialog {
|
|
|
405
406
|
private summaryLine(): string {
|
|
406
407
|
const t = this.deps.theme;
|
|
407
408
|
if (this.refreshError) return t.fg("error", this.refreshFailure());
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
).length;
|
|
411
|
-
const
|
|
412
|
-
(server) => server.status === "running" && !server.ready,
|
|
413
|
-
).length;
|
|
409
|
+
const states = this.data.servers.map(classifyProjectServerRoute);
|
|
410
|
+
const ready = states.filter((state) => state === "ready").length;
|
|
411
|
+
const starting = states.filter((state) => state === "starting").length;
|
|
412
|
+
const loading = states.filter((state) => state === "loading").length;
|
|
414
413
|
const counts = countProjectServerRouteStatuses(this.data.servers);
|
|
415
414
|
const entries = this.data.diagnostics.entries;
|
|
416
415
|
const errors = entries.reduce((sum, entry) => sum + entry.errors, 0);
|
|
417
416
|
const warnings = entries.reduce((sum, entry) => sum + entry.warnings, 0);
|
|
418
417
|
return [
|
|
419
|
-
`${ready} ready${starting ? ` · ${starting} starting` : ""}`,
|
|
418
|
+
`${ready} ready${starting ? ` · ${starting} starting` : ""}${loading ? ` · ${loading} loading projects` : ""}`,
|
|
420
419
|
errors ? t.fg("error", countLabel(errors, "error")) : "",
|
|
421
420
|
warnings ? t.fg("warning", countLabel(warnings, "warning")) : "",
|
|
422
421
|
counts.recovering
|
|
@@ -585,7 +584,13 @@ export class CiStatusDialog {
|
|
|
585
584
|
private addServer(server: ProjectServerInfo, text: (value: string) => void): void {
|
|
586
585
|
const t = this.deps.theme;
|
|
587
586
|
const state =
|
|
588
|
-
server.status
|
|
587
|
+
server.status !== "running"
|
|
588
|
+
? server.status
|
|
589
|
+
: !server.ready
|
|
590
|
+
? "starting"
|
|
591
|
+
: server.loadingProjects
|
|
592
|
+
? "loading projects"
|
|
593
|
+
: "ready";
|
|
589
594
|
text(
|
|
590
595
|
t.fg(
|
|
591
596
|
state === "ready" ? "success" : state === "error" ? "error" : "warning",
|