@mrclrchtr/supi-code-intelligence 11.1.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 +41 -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 +81 -7
- 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/node_modules/semver/LICENSE +15 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +5 -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 +174 -49
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +306 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
- 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/scanner.ts +27 -15
- 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/capability/capability-warnings.ts +18 -12
- package/src/analysis/health/check.ts +115 -0
- package/src/analysis/health/diagnostics.ts +3 -0
- package/src/analysis/health/file-scope.ts +2 -3
- package/src/analysis/health/semantic-state.ts +38 -0
- package/src/analysis/health/server-status.ts +14 -2
- package/src/analysis/health/signals.ts +2 -0
- package/src/analysis/health/status.ts +82 -0
- package/src/analysis/refactor/apply.ts +17 -8
- 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/health-types.ts +7 -0
- package/src/session/health-workflow.ts +8 -43
- 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 +184 -20
- package/src/session/orientation/context-facts.ts +27 -2
- package/src/session/orientation/context-sections.ts +49 -3
- package/src/session/orientation/facts.ts +132 -0
- package/src/session/orientation/gather.ts +98 -11
- package/src/session/orientation/workspace-context.ts +16 -6
- package/src/session/orientation-types.ts +8 -0
- package/src/session/orientation-workflow.ts +20 -6
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-plans.ts +5 -2
- package/src/session/refactor-workflow.ts +15 -17
- 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/guidance.ts +1 -1
- 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/markdown.ts +12 -2
- package/src/tool/code_health/result.ts +18 -3
- package/src/tool/code_health/spec.ts +5 -3
- package/src/tool/code_health/structured-schema.ts +250 -0
- package/src/tool/code_health/structured.ts +256 -0
- package/src/tool/code_inspect/result.ts +11 -5
- package/src/tool/code_inspect/spec.ts +7 -1
- package/src/tool/code_inspect/structured.ts +231 -0
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +31 -8
- package/src/tool/code_orientation/spec.ts +2 -0
- package/src/tool/code_orientation/structured-schema.ts +617 -0
- package/src/tool/code_orientation/structured-workspace.ts +194 -0
- package/src/tool/code_orientation/structured.ts +189 -0
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-observations.ts +81 -0
- package/src/tool/code_orientation/workspace-output.ts +5 -0
- package/src/tool/code_orientation/workspace-projects.ts +16 -31
- package/src/tool/code_orientation/workspace-sections.ts +46 -32
- package/src/tool/code_refactor_apply/execute.ts +1 -1
- package/src/tool/code_refactor_apply/result.ts +14 -6
- package/src/tool/code_refactor_apply/spec.ts +2 -0
- package/src/tool/code_refactor_apply/structured.ts +49 -0
- package/src/tool/code_refactor_plan/result.ts +18 -9
- package/src/tool/code_refactor_plan/spec.ts +2 -0
- package/src/tool/code_refactor_plan/structured.ts +127 -0
- 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 +12 -6
- package/src/ui/status-command.ts +147 -322
- package/src/ui/status-overlay.ts +584 -421
- package/src/ui/status-presentation.ts +108 -0
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
-
import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
|
|
3
|
-
import {
|
|
4
|
-
createEvidenceList,
|
|
5
|
-
createPartialEvidenceList,
|
|
6
|
-
type EvidenceList,
|
|
7
|
-
} from "../../analysis/evidence.ts";
|
|
8
|
-
import type { RelationLocationPartialReason } from "../../analysis/relations/provider-locations.ts";
|
|
9
|
-
import type {
|
|
10
|
-
CallEntry,
|
|
11
|
-
ImplementationEntry,
|
|
12
|
-
ReferenceEntry,
|
|
13
|
-
} from "../../analysis/relations/types.ts";
|
|
2
|
+
import type { EvidenceList, EvidenceListMetadata } from "../../analysis/evidence.ts";
|
|
14
3
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
15
4
|
import type { GraphSection } from "../../session/graph-types.ts";
|
|
16
5
|
import {
|
|
@@ -26,27 +15,16 @@ import type { GraphDetails, GraphFileGroup, GraphSectionDetails } from "./detail
|
|
|
26
15
|
import { graphDisplaySection } from "./display.ts";
|
|
27
16
|
import { formatGraphEvidence } from "./format.ts";
|
|
28
17
|
import { graphReadNext } from "./read-next.ts";
|
|
18
|
+
import { type AssembledGraphSection, assembleGraphSection } from "./section.ts";
|
|
29
19
|
import { structuredGraphCandidates, structuredGraphResult } from "./structured.ts";
|
|
30
20
|
|
|
31
21
|
export type { GraphRelationKind, GraphSection } from "../../session/graph-types.ts";
|
|
32
22
|
|
|
33
|
-
type UnavailableGraphSection = Extract<GraphSection, { kind: "unavailable" }>;
|
|
34
|
-
type ReferenceGraphSection = Extract<GraphSection, { kind: "ok"; rel: "references" }>;
|
|
35
|
-
type CalleeGraphSection = Extract<GraphSection, { kind: "ok"; rel: "callees" }>;
|
|
36
|
-
type ImplementationGraphSection = Extract<GraphSection, { kind: "ok"; rel: "implements" }>;
|
|
37
|
-
|
|
38
|
-
/** A relation section after canonical evidence bounding. */
|
|
39
|
-
export type AssembledGraphSection =
|
|
40
|
-
| UnavailableGraphSection
|
|
41
|
-
| (ReferenceGraphSection & { readonly evidence: EvidenceList<ReferenceEntry> })
|
|
42
|
-
| (CalleeGraphSection & { readonly evidence: EvidenceList<CallEntry> })
|
|
43
|
-
| (ImplementationGraphSection & {
|
|
44
|
-
readonly evidence: EvidenceList<ImplementationEntry>;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
23
|
/** Presentation-neutral assembled graph result. */
|
|
48
24
|
export interface GraphResultAssembly {
|
|
49
25
|
displayName: string;
|
|
26
|
+
/** Target-resolution notes shown before relation sections. */
|
|
27
|
+
notes: readonly string[];
|
|
50
28
|
sections: readonly AssembledGraphSection[];
|
|
51
29
|
resolvedDisplayFile: string;
|
|
52
30
|
cwd: string;
|
|
@@ -62,8 +40,11 @@ export function assembleGraphResult(input: {
|
|
|
62
40
|
resolvedDisplayFile: string;
|
|
63
41
|
maxResults: number;
|
|
64
42
|
cwd: string;
|
|
43
|
+
notes?: readonly string[];
|
|
65
44
|
}): GraphResultAssembly {
|
|
66
|
-
const sections = input.sections.map((section) =>
|
|
45
|
+
const sections = input.sections.map((section) =>
|
|
46
|
+
assembleGraphSection(section, input.maxResults, input.cwd),
|
|
47
|
+
);
|
|
67
48
|
const evidenceLists = sections.flatMap((section) =>
|
|
68
49
|
section.kind === "ok" ? [section.evidence.metadata] : [],
|
|
69
50
|
);
|
|
@@ -85,7 +66,7 @@ export function assembleGraphResult(input: {
|
|
|
85
66
|
})),
|
|
86
67
|
evidenceLists,
|
|
87
68
|
nextQueries: [],
|
|
88
|
-
readNext: graphReadNext(sections),
|
|
69
|
+
readNext: graphReadNext(sections, input.cwd),
|
|
89
70
|
candidateCount,
|
|
90
71
|
confidence,
|
|
91
72
|
provenance,
|
|
@@ -96,6 +77,7 @@ export function assembleGraphResult(input: {
|
|
|
96
77
|
|
|
97
78
|
return {
|
|
98
79
|
displayName: input.displayName,
|
|
80
|
+
notes: input.notes ?? [],
|
|
99
81
|
sections,
|
|
100
82
|
resolvedDisplayFile: input.resolvedDisplayFile,
|
|
101
83
|
cwd: input.cwd,
|
|
@@ -130,103 +112,19 @@ function graphSectionDetails(
|
|
|
130
112
|
? { ...calls.enclosingScope, file: toDisplayPath(cwd, calls.enclosingScope.file) }
|
|
131
113
|
: null,
|
|
132
114
|
depth: calls?.depth ?? null,
|
|
133
|
-
recovery: calls?.recovery
|
|
115
|
+
recovery: calls?.recovery
|
|
116
|
+
? { ...calls.recovery, file: toDisplayPath(cwd, calls.recovery.file) }
|
|
117
|
+
: null,
|
|
134
118
|
fileGroups,
|
|
135
119
|
};
|
|
136
120
|
}
|
|
137
121
|
|
|
138
|
-
function assembleGraphSection(section: GraphSection, maxResults: number): AssembledGraphSection {
|
|
139
|
-
if (section.kind === "unavailable") return section;
|
|
140
|
-
switch (section.rel) {
|
|
141
|
-
case "references":
|
|
142
|
-
return {
|
|
143
|
-
...section,
|
|
144
|
-
evidence: createRelationEvidenceList({
|
|
145
|
-
key: "references.locations",
|
|
146
|
-
items: [...section.data.references],
|
|
147
|
-
maxResults,
|
|
148
|
-
invalidLocationCount: section.data.invalidLocationCount,
|
|
149
|
-
partialReason: section.data.partialReason,
|
|
150
|
-
}),
|
|
151
|
-
};
|
|
152
|
-
case "callees": {
|
|
153
|
-
const evidence = section.data.recovery
|
|
154
|
-
? createPartialEvidenceList({
|
|
155
|
-
key: "callees.calls",
|
|
156
|
-
items: [...section.data.calls],
|
|
157
|
-
maxResults,
|
|
158
|
-
partialReason: "provider-limited",
|
|
159
|
-
})
|
|
160
|
-
: createEvidenceList({
|
|
161
|
-
key: "callees.calls",
|
|
162
|
-
items: [...section.data.calls],
|
|
163
|
-
maxResults,
|
|
164
|
-
});
|
|
165
|
-
return {
|
|
166
|
-
...section,
|
|
167
|
-
evidence: section.data.recovery
|
|
168
|
-
? {
|
|
169
|
-
...evidence,
|
|
170
|
-
metadata: {
|
|
171
|
-
...evidence.metadata,
|
|
172
|
-
partialMessage: recoveryMessage(section.data.recovery),
|
|
173
|
-
},
|
|
174
|
-
}
|
|
175
|
-
: evidence,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
case "implements":
|
|
179
|
-
return {
|
|
180
|
-
...section,
|
|
181
|
-
evidence: createRelationEvidenceList({
|
|
182
|
-
key: "implements.locations",
|
|
183
|
-
items: [...section.data.implementations],
|
|
184
|
-
maxResults,
|
|
185
|
-
invalidLocationCount: section.data.invalidLocationCount,
|
|
186
|
-
partialReason: section.data.partialReason,
|
|
187
|
-
}),
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function createRelationEvidenceList<T>(params: {
|
|
193
|
-
key: string;
|
|
194
|
-
items: T[];
|
|
195
|
-
maxResults: number;
|
|
196
|
-
invalidLocationCount: number;
|
|
197
|
-
partialReason: RelationLocationPartialReason | null;
|
|
198
|
-
}): EvidenceList<T> {
|
|
199
|
-
const evidence =
|
|
200
|
-
params.partialReason === "provider-limited"
|
|
201
|
-
? createPartialEvidenceList({ ...params, partialReason: params.partialReason })
|
|
202
|
-
: createEvidenceList(params);
|
|
203
|
-
if (params.partialReason === null) return evidence;
|
|
204
|
-
return {
|
|
205
|
-
...evidence,
|
|
206
|
-
metadata: {
|
|
207
|
-
...evidence.metadata,
|
|
208
|
-
partialReason: params.partialReason,
|
|
209
|
-
invalidLocationCount: params.invalidLocationCount,
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function recoveryMessage(recovery: NonNullable<CalleeGraphSection["data"]["recovery"]>): string {
|
|
215
|
-
const locations = recovery.errorRanges.map(
|
|
216
|
-
(range) => `L${range.start.line + 1}:${range.start.character + 1}`,
|
|
217
|
-
);
|
|
218
|
-
const suffix = locations.length > 0 ? ` Error locations: ${locations.join(", ")}.` : "";
|
|
219
|
-
return `${recovery.file}: ${recovery.reason}${suffix}`;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
122
|
function evidenceTotal(evidence: EvidenceList<unknown>): number {
|
|
223
123
|
return evidence.metadata.totalCount ?? evidence.metadata.shownCount;
|
|
224
124
|
}
|
|
225
125
|
|
|
226
126
|
function evidenceStatus(evidence: EvidenceList<unknown>): "complete" | "partial" {
|
|
227
|
-
return evidence.metadata.partialReason !== null
|
|
228
|
-
? "partial"
|
|
229
|
-
: "complete";
|
|
127
|
+
return evidence.metadata.partialReason !== null ? "partial" : "complete";
|
|
230
128
|
}
|
|
231
129
|
|
|
232
130
|
function sectionConfidence(section: AssembledGraphSection): ConfidenceMode {
|
|
@@ -279,7 +177,7 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
|
|
|
279
177
|
};
|
|
280
178
|
}
|
|
281
179
|
if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
|
|
282
|
-
return finishGraphCandidates(outcome);
|
|
180
|
+
return finishGraphCandidates(outcome, cwd);
|
|
283
181
|
}
|
|
284
182
|
|
|
285
183
|
const assembly = assembleGraphResult({
|
|
@@ -288,6 +186,7 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
|
|
|
288
186
|
resolvedDisplayFile: outcome.resolvedDisplayFile,
|
|
289
187
|
maxResults: outcome.maxResults,
|
|
290
188
|
cwd,
|
|
189
|
+
notes: outcome.notes,
|
|
291
190
|
});
|
|
292
191
|
const displayTruncated = hasHiddenDisplayEvidence(assembly);
|
|
293
192
|
return {
|
|
@@ -304,8 +203,16 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
|
|
|
304
203
|
}
|
|
305
204
|
|
|
306
205
|
function finishGraphCandidates(
|
|
307
|
-
|
|
206
|
+
input: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
|
|
207
|
+
cwd: string,
|
|
308
208
|
): CodeIntelResult {
|
|
209
|
+
const outcome = {
|
|
210
|
+
...input,
|
|
211
|
+
candidates: input.candidates.map((candidate) => ({
|
|
212
|
+
...candidate,
|
|
213
|
+
file: toDisplayPath(cwd, candidate.file),
|
|
214
|
+
})),
|
|
215
|
+
};
|
|
309
216
|
const lines = [
|
|
310
217
|
outcome.kind === "kind-mismatch"
|
|
311
218
|
? `**No target matched provider kind \`${outcome.requestedKind}\`. Near matches:**`
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEvidenceList,
|
|
3
|
+
createPartialEvidenceList,
|
|
4
|
+
type EvidenceList,
|
|
5
|
+
} from "../../analysis/evidence.ts";
|
|
6
|
+
import type { RelationLocationPartialReason } from "../../analysis/relations/provider-locations.ts";
|
|
7
|
+
import type {
|
|
8
|
+
CallEntry,
|
|
9
|
+
ImplementationEntry,
|
|
10
|
+
ReferenceEntry,
|
|
11
|
+
} from "../../analysis/relations/types.ts";
|
|
12
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
13
|
+
import type { GraphSection } from "../../session/graph-types.ts";
|
|
14
|
+
import { selectReferenceLocations } from "./reference-selection.ts";
|
|
15
|
+
|
|
16
|
+
type UnavailableGraphSection = Extract<GraphSection, { kind: "unavailable" }>;
|
|
17
|
+
type ReferenceGraphSection = Extract<GraphSection, { kind: "ok"; rel: "references" }>;
|
|
18
|
+
type CalleeGraphSection = Extract<GraphSection, { kind: "ok"; rel: "callees" }>;
|
|
19
|
+
type ImplementationGraphSection = Extract<GraphSection, { kind: "ok"; rel: "implements" }>;
|
|
20
|
+
|
|
21
|
+
/** A relation section after canonical evidence bounding. */
|
|
22
|
+
export type AssembledGraphSection =
|
|
23
|
+
| UnavailableGraphSection
|
|
24
|
+
| (ReferenceGraphSection & {
|
|
25
|
+
readonly evidence: EvidenceList<ReferenceEntry>;
|
|
26
|
+
readonly selectionNote: string | null;
|
|
27
|
+
})
|
|
28
|
+
| (CalleeGraphSection & { readonly evidence: EvidenceList<CallEntry> })
|
|
29
|
+
| (ImplementationGraphSection & {
|
|
30
|
+
readonly evidence: EvidenceList<ImplementationEntry>;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/** Bound one relation section's evidence once, before any presentation consumes it. */
|
|
34
|
+
export function assembleGraphSection(
|
|
35
|
+
section: GraphSection,
|
|
36
|
+
maxResults: number,
|
|
37
|
+
cwd: string,
|
|
38
|
+
): AssembledGraphSection {
|
|
39
|
+
if (section.kind === "unavailable") return section;
|
|
40
|
+
switch (section.rel) {
|
|
41
|
+
case "references": {
|
|
42
|
+
const evidence = createRelationEvidenceList({
|
|
43
|
+
key: "references.locations",
|
|
44
|
+
items: [...section.data.references],
|
|
45
|
+
maxResults,
|
|
46
|
+
invalidLocationCount: section.data.invalidLocationCount,
|
|
47
|
+
partialReason: section.data.partialReason,
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
...section,
|
|
51
|
+
evidence: {
|
|
52
|
+
...evidence,
|
|
53
|
+
items: selectReferenceLocations(section.data.references, evidence.metadata.shownCount),
|
|
54
|
+
},
|
|
55
|
+
selectionNote:
|
|
56
|
+
(evidence.metadata.omittedCount ?? 0) > 0 &&
|
|
57
|
+
section.data.references.some((site) => site.file !== section.data.references[0]?.file)
|
|
58
|
+
? "Selection: one site per file per round."
|
|
59
|
+
: null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
case "callees": {
|
|
63
|
+
const evidence = section.data.recovery
|
|
64
|
+
? createPartialEvidenceList({
|
|
65
|
+
key: "callees.calls",
|
|
66
|
+
items: [...section.data.calls],
|
|
67
|
+
maxResults,
|
|
68
|
+
partialReason: "provider-limited",
|
|
69
|
+
})
|
|
70
|
+
: createEvidenceList({
|
|
71
|
+
key: "callees.calls",
|
|
72
|
+
items: [...section.data.calls],
|
|
73
|
+
maxResults,
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
...section,
|
|
77
|
+
evidence: section.data.recovery
|
|
78
|
+
? {
|
|
79
|
+
...evidence,
|
|
80
|
+
metadata: {
|
|
81
|
+
...evidence.metadata,
|
|
82
|
+
partialMessage: recoveryMessage(section.data.recovery, cwd),
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
: evidence,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
case "implements":
|
|
89
|
+
return {
|
|
90
|
+
...section,
|
|
91
|
+
evidence: createRelationEvidenceList({
|
|
92
|
+
key: "implements.locations",
|
|
93
|
+
items: [...section.data.implementations],
|
|
94
|
+
maxResults,
|
|
95
|
+
invalidLocationCount: section.data.invalidLocationCount,
|
|
96
|
+
partialReason: section.data.partialReason,
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function createRelationEvidenceList<T>(params: {
|
|
103
|
+
key: string;
|
|
104
|
+
items: T[];
|
|
105
|
+
maxResults: number;
|
|
106
|
+
invalidLocationCount: number;
|
|
107
|
+
partialReason: RelationLocationPartialReason | null;
|
|
108
|
+
}): EvidenceList<T> {
|
|
109
|
+
const evidence =
|
|
110
|
+
params.partialReason === "provider-limited"
|
|
111
|
+
? createPartialEvidenceList({ ...params, partialReason: params.partialReason })
|
|
112
|
+
: createEvidenceList(params);
|
|
113
|
+
if (params.partialReason === null) return evidence;
|
|
114
|
+
return {
|
|
115
|
+
...evidence,
|
|
116
|
+
metadata: {
|
|
117
|
+
...evidence.metadata,
|
|
118
|
+
partialReason: params.partialReason,
|
|
119
|
+
invalidLocationCount: params.invalidLocationCount,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function recoveryMessage(
|
|
125
|
+
recovery: NonNullable<CalleeGraphSection["data"]["recovery"]>,
|
|
126
|
+
cwd: string,
|
|
127
|
+
): string {
|
|
128
|
+
const locations = recovery.errorRanges.map(
|
|
129
|
+
(range) => `L${range.start.line + 1}:${range.start.character + 1}`,
|
|
130
|
+
);
|
|
131
|
+
const suffix = locations.length > 0 ? ` Error locations: ${locations.join(", ")}.` : "";
|
|
132
|
+
return `${toDisplayPath(cwd, recovery.file)}: ${recovery.reason}${suffix}`;
|
|
133
|
+
}
|
|
@@ -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 { GraphTargetParam, MaxResultsParam } from "../schemas.ts";
|
|
@@ -18,7 +17,7 @@ export const codeGraphSpec = {
|
|
|
18
17
|
{
|
|
19
18
|
target: GraphTargetParam,
|
|
20
19
|
relations: Type.Optional(
|
|
21
|
-
Type.Array(
|
|
20
|
+
Type.Array(Type.Enum(["all", "references", "callees", "implements"], { type: "string" }), {
|
|
22
21
|
description:
|
|
23
22
|
'Requested relations; defaults to ["references"]. "all" must be the only item.',
|
|
24
23
|
minItems: 1,
|
|
@@ -27,7 +26,8 @@ export const codeGraphSpec = {
|
|
|
27
26
|
),
|
|
28
27
|
maxResults: Type.Optional(MaxResultsParam),
|
|
29
28
|
calleeDepth: Type.Optional(
|
|
30
|
-
|
|
29
|
+
Type.Enum(["direct", "deep"], {
|
|
30
|
+
type: "string",
|
|
31
31
|
description: "direct excludes nested scopes; deep includes them.",
|
|
32
32
|
}),
|
|
33
33
|
),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StringEnum } from "@earendil-works/pi-ai";
|
|
2
1
|
import { type Static, Type } from "typebox";
|
|
3
2
|
import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
|
|
4
3
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
@@ -14,14 +13,20 @@ import type { GraphResultAssembly } from "./result.ts";
|
|
|
14
13
|
/** Codemode relation evidence; callees describe written expressions, not resolved identities. */
|
|
15
14
|
export const GraphOutputSchema = Type.Object(
|
|
16
15
|
{
|
|
17
|
-
kind:
|
|
16
|
+
kind: Type.Enum(["completed", "invalid-input", "disambiguation", "kind-mismatch"], {
|
|
17
|
+
type: "string",
|
|
18
|
+
}),
|
|
18
19
|
target: Type.Optional(Type.Object({ name: Type.String(), file: Type.String() })),
|
|
19
20
|
sections: Type.Array(
|
|
20
21
|
Type.Object(
|
|
21
22
|
{
|
|
22
|
-
relation:
|
|
23
|
-
source:
|
|
24
|
-
status:
|
|
23
|
+
relation: Type.Enum(["references", "callees", "implements"], { type: "string" }),
|
|
24
|
+
source: Type.Enum(["semantic", "structural"], { type: "string" }),
|
|
25
|
+
status: Type.Enum(["complete", "partial", "unavailable"], {
|
|
26
|
+
type: "string",
|
|
27
|
+
description:
|
|
28
|
+
"Completeness of collected relation evidence; display caps are reported separately in evidence counts.",
|
|
29
|
+
}),
|
|
25
30
|
message: Type.Union([Type.String(), Type.Null()]),
|
|
26
31
|
items: Type.Array(
|
|
27
32
|
Type.Object(
|
|
@@ -36,7 +41,7 @@ export const GraphOutputSchema = Type.Object(
|
|
|
36
41
|
),
|
|
37
42
|
evidence: Type.Optional(EvidenceListSchema),
|
|
38
43
|
externalCount: Type.Integer(),
|
|
39
|
-
depth: Type.Union([
|
|
44
|
+
depth: Type.Union([Type.Enum(["direct", "deep"], { type: "string" }), Type.Null()]),
|
|
40
45
|
enclosingScope: Type.Union([
|
|
41
46
|
Type.Object({
|
|
42
47
|
name: Type.String(),
|
|
@@ -62,6 +67,11 @@ export const GraphOutputSchema = Type.Object(
|
|
|
62
67
|
evidenceLists: Type.Array(EvidenceListSchema),
|
|
63
68
|
readNext: Type.Array(ReadNextSchema),
|
|
64
69
|
message: Type.Optional(Type.String()),
|
|
70
|
+
notes: Type.Optional(
|
|
71
|
+
Type.Array(Type.String(), {
|
|
72
|
+
description: "Target-resolution notes, such as excluded paths beside a unique match.",
|
|
73
|
+
}),
|
|
74
|
+
),
|
|
65
75
|
requestedKind: Type.Optional(Type.String()),
|
|
66
76
|
nextQueries: Type.Array(Type.String()),
|
|
67
77
|
},
|
|
@@ -109,6 +119,7 @@ export function structuredGraphResult(
|
|
|
109
119
|
}),
|
|
110
120
|
evidenceLists: assembly.assembled.evidenceLists.map((evidence) => ({ ...evidence })),
|
|
111
121
|
readNext: assembly.details.readNext.map((item) => ({ ...item })),
|
|
122
|
+
...(assembly.notes.length > 0 ? { notes: [...assembly.notes] } : {}),
|
|
112
123
|
nextQueries: [],
|
|
113
124
|
};
|
|
114
125
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { DiagnosticEvidenceSummary } from "@mrclrchtr/supi-lsp/api";
|
|
2
|
+
import { formatProjectServerRoot } from "../../analysis/health/server-status.ts";
|
|
3
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
4
|
+
import type {
|
|
5
|
+
HealthData,
|
|
6
|
+
HealthDiagnosticScope,
|
|
7
|
+
HealthRefreshAttempt,
|
|
8
|
+
} from "../../session/health-types.ts";
|
|
9
|
+
|
|
10
|
+
/** Clone source navigation and recovery labels for display; retain observed ownership identities and stored session facts. */
|
|
11
|
+
export function displayHealthPaths(input: HealthData, cwd: string): HealthData {
|
|
12
|
+
const display = (file: string) => toDisplayPath(cwd, file);
|
|
13
|
+
const scope = (value: HealthDiagnosticScope): HealthDiagnosticScope =>
|
|
14
|
+
value.kind === "file"
|
|
15
|
+
? { ...value, path: display(value.path) }
|
|
16
|
+
: { ...value, filter: value.filter === null ? null : display(value.filter) };
|
|
17
|
+
const evidence = (value: DiagnosticEvidenceSummary): DiagnosticEvidenceSummary => ({
|
|
18
|
+
...value,
|
|
19
|
+
documents: value.documents.map((document) => ({ ...document, file: display(document.file) })),
|
|
20
|
+
});
|
|
21
|
+
const attempt = (value: HealthRefreshAttempt): HealthRefreshAttempt => ({
|
|
22
|
+
...value,
|
|
23
|
+
requestedDiagnosticScope: scope(value.requestedDiagnosticScope),
|
|
24
|
+
...(value.processCrashRecovery
|
|
25
|
+
? {
|
|
26
|
+
processCrashRecovery: {
|
|
27
|
+
...value.processCrashRecovery,
|
|
28
|
+
entries: value.processCrashRecovery.entries.map((entry) => ({
|
|
29
|
+
...entry,
|
|
30
|
+
root: formatProjectServerRoot(cwd, entry.root),
|
|
31
|
+
})),
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: {}),
|
|
35
|
+
...(value.startupRetry
|
|
36
|
+
? {
|
|
37
|
+
startupRetry: {
|
|
38
|
+
...value.startupRetry,
|
|
39
|
+
entries: value.startupRetry.entries.map((entry) => ({
|
|
40
|
+
...entry,
|
|
41
|
+
root: formatProjectServerRoot(cwd, entry.root),
|
|
42
|
+
})),
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
: {}),
|
|
46
|
+
...("diagnosticEvidence" in value && value.diagnosticEvidence
|
|
47
|
+
? { diagnosticEvidence: evidence(value.diagnosticEvidence) }
|
|
48
|
+
: {}),
|
|
49
|
+
...(value.sourceTracking
|
|
50
|
+
? {
|
|
51
|
+
sourceTracking: {
|
|
52
|
+
...value.sourceTracking,
|
|
53
|
+
discovered: value.sourceTracking.discovered.map(display),
|
|
54
|
+
tracked: value.sourceTracking.tracked.map(display),
|
|
55
|
+
skipped: value.sourceTracking.skipped.map(display),
|
|
56
|
+
unavailable: value.sourceTracking.unavailable.map(display),
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
});
|
|
61
|
+
const { diagnostics, refresh } = input;
|
|
62
|
+
return {
|
|
63
|
+
...input,
|
|
64
|
+
diagnostics:
|
|
65
|
+
diagnostics.kind === "not-requested"
|
|
66
|
+
? diagnostics
|
|
67
|
+
: {
|
|
68
|
+
...diagnostics,
|
|
69
|
+
scope: scope(diagnostics.scope),
|
|
70
|
+
entries: diagnostics.entries.map((entry) => ({ ...entry, file: display(entry.file) })),
|
|
71
|
+
evidence: evidence(diagnostics.evidence),
|
|
72
|
+
...(diagnostics.scopeStatus
|
|
73
|
+
? {
|
|
74
|
+
scopeStatus: {
|
|
75
|
+
...diagnostics.scopeStatus,
|
|
76
|
+
configPath:
|
|
77
|
+
diagnostics.scopeStatus.configPath === null
|
|
78
|
+
? null
|
|
79
|
+
: display(diagnostics.scopeStatus.configPath),
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
: {}),
|
|
83
|
+
},
|
|
84
|
+
refresh:
|
|
85
|
+
refresh.kind === "not-requested" || refresh.kind === "not-attempted"
|
|
86
|
+
? {
|
|
87
|
+
...refresh,
|
|
88
|
+
lastAttempt: refresh.lastAttempt === null ? null : attempt(refresh.lastAttempt),
|
|
89
|
+
}
|
|
90
|
+
: attempt(refresh),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
1
2
|
import type { HealthDiagnosticObservation } from "../../session/health-types.ts";
|
|
2
3
|
|
|
3
4
|
/** Render the tsconfig coverage result for a single-file health request. */
|
|
@@ -37,7 +38,7 @@ function formatConfigPath(configPath: string | null, cwd: string): string {
|
|
|
37
38
|
return `\`${makeRelative(cwd, configPath)}\``;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
/** Format a
|
|
41
|
+
/** Format a diagnostic source with the shared workspace/external path policy. */
|
|
41
42
|
export function makeRelative(cwd: string, file: string): string {
|
|
42
|
-
return
|
|
43
|
+
return toDisplayPath(cwd, file);
|
|
43
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Markdown renderer for code_health results. */
|
|
2
2
|
import type { CapabilityWarningReport } from "../../analysis/capability/capability-warnings.ts";
|
|
3
3
|
import {
|
|
4
|
+
formatProjectServerCompiler,
|
|
4
5
|
formatProjectServerOperationSupport,
|
|
5
6
|
formatProjectServerRoot,
|
|
6
7
|
formatProjectServerRouteSummary,
|
|
@@ -372,13 +373,22 @@ function renderServersSection(
|
|
|
372
373
|
lines.push(
|
|
373
374
|
`- ${statusIcon} **${server.name}** @ \`${formatProjectServerRoot(cwd, server.root)}\` (${server.fileTypes.join(", ")}) — ${server.status}${reason}`,
|
|
374
375
|
);
|
|
375
|
-
|
|
376
|
-
if (operationSupport) lines.push(` - ${operationSupport}`);
|
|
376
|
+
renderServerDetails(lines, server);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
lines.push("");
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
function renderServerDetails(lines: string[], server: HealthData["servers"][number]): void {
|
|
383
|
+
for (const detail of [
|
|
384
|
+
formatProjectServerCompiler(server.typescript),
|
|
385
|
+
server.failureMessage,
|
|
386
|
+
formatProjectServerOperationSupport(server.operationSupport),
|
|
387
|
+
]) {
|
|
388
|
+
if (detail) lines.push(` - ${detail}`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
382
392
|
function displaySemanticStatus(data: HealthData): string {
|
|
383
393
|
return formatSemanticHealthState(data.semanticState);
|
|
384
394
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
2
|
import {
|
|
3
3
|
countProjectServerRouteStatuses,
|
|
4
|
+
formatProjectServerCompiler,
|
|
4
5
|
formatProjectServerOperationSupport,
|
|
5
6
|
formatProjectServerRoot,
|
|
6
7
|
formatProjectServerStatusReason,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
} from "../result/assembly.ts";
|
|
15
16
|
import { createToolDisplaySection, truncateDisplayText } from "../result/display.ts";
|
|
16
17
|
import type { HealthDetails, HealthSectionDetails, ToolDisplaySection } from "../result/types.ts";
|
|
18
|
+
import { displayHealthPaths } from "./display-paths.ts";
|
|
17
19
|
|
|
18
20
|
export type {
|
|
19
21
|
HealthData,
|
|
@@ -43,7 +45,8 @@ const SECTION_TITLES: Record<HealthSection, string> = {
|
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
/** Assemble public code_health evidence and details before presentation adapters render it. */
|
|
46
|
-
export function assembleHealthResult(
|
|
48
|
+
export function assembleHealthResult(input: HealthData, cwd?: string): HealthResultAssembly {
|
|
49
|
+
const data = cwd === undefined ? input : displayHealthPaths(input, cwd);
|
|
47
50
|
const projections = data.includedSections.map((section) => projectSection(section, data));
|
|
48
51
|
const sections = projections.map((projection) => projection.section);
|
|
49
52
|
const sectionDetails = projections.map((projection) => projection.details);
|
|
@@ -117,7 +120,14 @@ function buildHealthDisplaySections(data: HealthData, cwd?: string): ToolDisplay
|
|
|
117
120
|
totalCount: data.servers.length,
|
|
118
121
|
format: (server) => {
|
|
119
122
|
const root = cwd ? formatProjectServerRoot(cwd, server.root) : server.root;
|
|
120
|
-
const
|
|
123
|
+
const compiler = formatProjectServerCompiler(server.typescript);
|
|
124
|
+
const support = [
|
|
125
|
+
compiler,
|
|
126
|
+
server.failureMessage,
|
|
127
|
+
formatProjectServerOperationSupport(server.operationSupport),
|
|
128
|
+
]
|
|
129
|
+
.filter(Boolean)
|
|
130
|
+
.join(" — ");
|
|
121
131
|
return `${server.name} @ ${root} (${server.fileTypes.join(", ")}) — ${server.status}${server.statusReason ? ` — ${formatProjectServerStatusReason(server.statusReason)}` : ""}${support ? ` — ${support}` : ""}`;
|
|
122
132
|
},
|
|
123
133
|
}),
|
|
@@ -257,6 +267,7 @@ function uniqueProvenance(provenance: readonly ResultProvenance[]): ResultProven
|
|
|
257
267
|
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
258
268
|
import { healthErrorResult } from "../result/errors.ts";
|
|
259
269
|
import { renderHealthResult } from "./markdown.ts";
|
|
270
|
+
import { structuredHealthResult } from "./structured.ts";
|
|
260
271
|
|
|
261
272
|
type HealthOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["health"]>>;
|
|
262
273
|
|
|
@@ -264,12 +275,16 @@ type HealthOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["health"
|
|
|
264
275
|
export function finishHealthResult(outcome: HealthOutcome, cwd: string): CodeIntelResult {
|
|
265
276
|
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
266
277
|
if (outcome.kind === "invalid-input") {
|
|
267
|
-
return
|
|
278
|
+
return {
|
|
279
|
+
...healthErrorResult(`**Error:** ${outcome.message}`, outcome.message),
|
|
280
|
+
structuredContent: { kind: "invalid-input", message: outcome.message },
|
|
281
|
+
};
|
|
268
282
|
}
|
|
269
283
|
|
|
270
284
|
const assembly = assembleHealthResult(outcome.data, cwd);
|
|
271
285
|
return {
|
|
272
286
|
content: renderHealthResult(assembly, cwd),
|
|
287
|
+
structuredContent: structuredHealthResult(assembly.data),
|
|
273
288
|
details: {
|
|
274
289
|
type: "health",
|
|
275
290
|
data: assembly.details,
|
|
@@ -1,8 +1,8 @@
|
|
|
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 { ScopeParam } from "../schemas.ts";
|
|
5
4
|
import { executeHealthTool } from "./execute.ts";
|
|
5
|
+
import { HealthOutputSchema } from "./structured-schema.ts";
|
|
6
6
|
import { renderHealthCall, renderHealthResult } from "./tui.ts";
|
|
7
7
|
|
|
8
8
|
export const CODE_HEALTH_TOOL_NAME = "code_health";
|
|
@@ -22,19 +22,21 @@ export const codeHealthSpec = {
|
|
|
22
22
|
}),
|
|
23
23
|
),
|
|
24
24
|
include: Type.Optional(
|
|
25
|
-
Type.Array(
|
|
25
|
+
Type.Array(Type.Enum(["diagnostics", "servers"], { type: "string" }), {
|
|
26
26
|
description: "Requested health-signal sections.",
|
|
27
27
|
uniqueItems: true,
|
|
28
28
|
}),
|
|
29
29
|
),
|
|
30
30
|
level: Type.Optional(
|
|
31
|
-
|
|
31
|
+
Type.Enum(["summary", "detailed"], {
|
|
32
|
+
type: "string",
|
|
32
33
|
description: "Detail level for the health report.",
|
|
33
34
|
}),
|
|
34
35
|
),
|
|
35
36
|
},
|
|
36
37
|
{ additionalProperties: false },
|
|
37
38
|
),
|
|
39
|
+
outputSchema: HealthOutputSchema,
|
|
38
40
|
run: (params: unknown, ctx: CodeIntelToolExecCtx) =>
|
|
39
41
|
executeHealthTool(params as Parameters<typeof executeHealthTool>[0], ctx),
|
|
40
42
|
renderCall: renderHealthCall,
|