@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
package/src/ui/status-command.ts
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
// Code Intelligence status command — toggleable center dialog with persistent
|
|
2
|
-
// status bar, custom footer, and below-editor widget for LSP + structural awareness.
|
|
3
|
-
|
|
4
1
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
6
2
|
import { getDefaultWorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { type CiStatusData, createCiStatusDialog } from "./status-overlay.ts";
|
|
19
|
-
|
|
20
|
-
const STATUS_KEY = "code-intelligence";
|
|
21
|
-
const WIDGET_KEY = "code-intelligence";
|
|
22
|
-
|
|
23
|
-
interface InspectorState {
|
|
24
|
-
handle: unknown;
|
|
25
|
-
close: (() => void) | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Owned LSP facts used by the status warning collector. */
|
|
3
|
+
import { type AutomaticLspPathPolicy, getWorkspaceLspRuntime } from "@mrclrchtr/supi-lsp/api";
|
|
4
|
+
import type { CapabilityWarningMissingServerSource } from "../analysis/capability/capability-warnings.ts";
|
|
5
|
+
import { checkWorkspaceDiagnostics } from "../analysis/health/check.ts";
|
|
6
|
+
import { observeWorkspaceStatus } from "../analysis/health/status.ts";
|
|
7
|
+
import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
|
|
8
|
+
import { throwIfAborted } from "../session/workflow-control.ts";
|
|
9
|
+
import { DEFAULT_WORKFLOW_DEADLINE_MS } from "../tool/infra/workflow-control.ts";
|
|
10
|
+
import { type CiStatusDialog, createCiStatusDialog } from "./status-overlay.ts";
|
|
11
|
+
import { CiHealthRefreshError, presentHealthRefresh } from "./status-presentation.ts";
|
|
12
|
+
|
|
13
|
+
/** Owned LSP facts used by the passive status warning collector. */
|
|
29
14
|
export interface CiStatusWarningSource {
|
|
30
15
|
get(cwd: string): {
|
|
31
16
|
lspController: CapabilityWarningMissingServerSource | null;
|
|
@@ -33,317 +18,157 @@ export interface CiStatusWarningSource {
|
|
|
33
18
|
};
|
|
34
19
|
}
|
|
35
20
|
|
|
36
|
-
|
|
21
|
+
async function collectStatusData(
|
|
22
|
+
pi: ExtensionAPI,
|
|
23
|
+
ctx: ExtensionContext,
|
|
24
|
+
homeDir?: string,
|
|
25
|
+
warningSource?: CiStatusWarningSource,
|
|
26
|
+
) {
|
|
27
|
+
const workspace = getDefaultWorkspaceRuntime().getWorkspace(ctx.cwd);
|
|
28
|
+
const facts = warningSource?.get(ctx.cwd);
|
|
29
|
+
return {
|
|
30
|
+
...(await observeWorkspaceStatus({
|
|
31
|
+
cwd: ctx.cwd,
|
|
32
|
+
lspState: getWorkspaceLspRuntime(ctx.cwd),
|
|
33
|
+
semanticState: workspace.semantic.state,
|
|
34
|
+
structuralState: workspace.structural.state,
|
|
35
|
+
projectTrusted: ctx.isProjectTrusted(),
|
|
36
|
+
homeDir,
|
|
37
|
+
lspController: facts?.lspController,
|
|
38
|
+
automaticPathPolicy: facts?.automaticPathPolicy,
|
|
39
|
+
})),
|
|
40
|
+
activeTools: pi.getActiveTools().filter((tool) => tool.startsWith("code_")),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function readDiagnosticDetails(cwd: string) {
|
|
45
|
+
const lsp = getWorkspaceLspRuntime(cwd);
|
|
46
|
+
if (lsp.kind !== "ready") throw new Error("LSP diagnostics are unavailable");
|
|
47
|
+
return lsp.runtime.getOutstandingDiagnostics(2);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface StatusInteraction {
|
|
51
|
+
cancelled: boolean;
|
|
52
|
+
close?: () => void;
|
|
53
|
+
dialog?: CiStatusDialog;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Register the terminal inspector. Persistent footer contributions have a separate owner. */
|
|
37
57
|
export function registerCiStatusCommand(
|
|
38
58
|
pi: ExtensionAPI,
|
|
39
59
|
homeDir?: string,
|
|
40
60
|
warningSource?: CiStatusWarningSource,
|
|
61
|
+
getSession?: (ctx: ExtensionContext) => Pick<WorkspaceCodeIntelligenceSession, "health">,
|
|
41
62
|
): void {
|
|
42
|
-
|
|
63
|
+
let interaction: StatusInteraction | undefined;
|
|
64
|
+
const close = () => {
|
|
65
|
+
if (!interaction) return;
|
|
66
|
+
interaction.cancelled = true;
|
|
67
|
+
interaction.dialog?.dispose();
|
|
68
|
+
interaction.close?.();
|
|
69
|
+
};
|
|
70
|
+
pi.on("session_shutdown", close);
|
|
71
|
+
pi.on("session_start", close);
|
|
72
|
+
|
|
43
73
|
pi.registerCommand("supi-ci-status", {
|
|
44
|
-
description:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
74
|
+
description:
|
|
75
|
+
"Toggle diagnostic evidence inspector with explicit check and health refresh actions",
|
|
76
|
+
handler: async (_args, ctx) => {
|
|
77
|
+
if (ctx.mode !== "tui") {
|
|
78
|
+
ctx.ui.notify(
|
|
79
|
+
"The status inspector requires a terminal UI. Use code_health instead.",
|
|
80
|
+
"warning",
|
|
81
|
+
);
|
|
48
82
|
return;
|
|
49
83
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
if (interaction) {
|
|
85
|
+
close();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const current: StatusInteraction = { cancelled: false };
|
|
89
|
+
interaction = current;
|
|
90
|
+
const observe = () => collectStatusData(pi, ctx, homeDir, warningSource);
|
|
91
|
+
let checkOffset = 0;
|
|
92
|
+
const check = async (signal: AbortSignal) => {
|
|
93
|
+
const lsp = getWorkspaceLspRuntime(ctx.cwd);
|
|
94
|
+
if (lsp.kind !== "ready")
|
|
95
|
+
throw new Error(`LSP runtime is ${lsp.kind}; diagnostics cannot be checked.`);
|
|
96
|
+
pi.events.emit("supi:working:start", { source: "supi-code-intelligence" });
|
|
97
|
+
try {
|
|
98
|
+
const diagnosticCheck = await checkWorkspaceDiagnostics({
|
|
99
|
+
runtime: lsp.runtime,
|
|
100
|
+
cwd: ctx.cwd,
|
|
101
|
+
offset: checkOffset,
|
|
102
|
+
control: { signal, deadline: Date.now() + 30_000 },
|
|
103
|
+
});
|
|
104
|
+
throwIfAborted({ signal });
|
|
105
|
+
const snapshot = await observe();
|
|
106
|
+
checkOffset = diagnosticCheck.nextOffset;
|
|
107
|
+
return { ...snapshot, diagnosticCheck };
|
|
108
|
+
} finally {
|
|
109
|
+
pi.events.emit("supi:working:end", { source: "supi-code-intelligence" });
|
|
110
|
+
}
|
|
59
111
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
const refreshHealth = async (signal: AbortSignal) => {
|
|
113
|
+
const startedAt = Date.now();
|
|
114
|
+
const control = { signal, deadline: startedAt + DEFAULT_WORKFLOW_DEADLINE_MS };
|
|
115
|
+
let stage = "health workflow";
|
|
116
|
+
let healthRefresh: readonly string[] | undefined;
|
|
117
|
+
pi.events.emit("supi:working:start", { source: "supi-code-intelligence" });
|
|
118
|
+
try {
|
|
119
|
+
if (!getSession) throw new Error("Session health workflow is unavailable");
|
|
120
|
+
const outcome = await getSession(ctx).health(
|
|
121
|
+
{ refresh: true, include: ["diagnostics", "servers"] },
|
|
122
|
+
control,
|
|
123
|
+
);
|
|
124
|
+
throwIfAborted(control);
|
|
125
|
+
healthRefresh = presentHealthRefresh(outcome, Date.now() - startedAt, ctx.cwd);
|
|
126
|
+
stage = "passive snapshot";
|
|
127
|
+
const snapshot = await observe();
|
|
128
|
+
throwIfAborted(control);
|
|
129
|
+
return { ...snapshot, healthRefresh };
|
|
130
|
+
} catch (error) {
|
|
131
|
+
throw new CiHealthRefreshError(stage, {
|
|
132
|
+
cause: error,
|
|
133
|
+
elapsedMs: Date.now() - startedAt,
|
|
134
|
+
healthRefresh,
|
|
135
|
+
});
|
|
136
|
+
} finally {
|
|
137
|
+
pi.events.emit("supi:working:end", { source: "supi-code-intelligence" });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
try {
|
|
141
|
+
const data = await observe();
|
|
142
|
+
if (current.cancelled) return;
|
|
143
|
+
await ctx.ui.custom<void>(
|
|
144
|
+
(tui, theme, keybindings, done) => {
|
|
145
|
+
current.close = () => done(undefined);
|
|
146
|
+
const dialog = createCiStatusDialog(data, {
|
|
77
147
|
tui,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cwd: ctx.cwd,
|
|
86
|
-
pi,
|
|
87
|
-
projectTrusted: ctx.isProjectTrusted(),
|
|
88
|
-
homeDir,
|
|
89
|
-
warningSource,
|
|
90
|
-
});
|
|
91
|
-
dataRef.current = fresh;
|
|
92
|
-
updateStatusAndWidget(ctx, fresh);
|
|
93
|
-
return fresh;
|
|
94
|
-
},
|
|
148
|
+
theme,
|
|
149
|
+
keybindings,
|
|
150
|
+
done: current.close,
|
|
151
|
+
onRefresh: observe,
|
|
152
|
+
onCheck: check,
|
|
153
|
+
onHealth: refreshHealth,
|
|
154
|
+
fetchDetailedDiagnostics: () => readDiagnosticDetails(ctx.cwd),
|
|
95
155
|
});
|
|
156
|
+
current.dialog = dialog;
|
|
157
|
+
if (current.cancelled) current.close();
|
|
158
|
+
return dialog;
|
|
96
159
|
},
|
|
97
160
|
{
|
|
98
161
|
overlay: true,
|
|
99
|
-
overlayOptions: {
|
|
100
|
-
anchor: "center",
|
|
101
|
-
width: "66%",
|
|
102
|
-
minWidth: 60,
|
|
103
|
-
maxHeight: "85%",
|
|
104
|
-
visible: (termWidth: number) => termWidth >= 60,
|
|
105
|
-
},
|
|
106
|
-
onHandle: (handle) => {
|
|
107
|
-
inspector.handle = handle;
|
|
108
|
-
},
|
|
162
|
+
overlayOptions: { anchor: "center", width: "85%", maxHeight: "85%" },
|
|
109
163
|
},
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
164
|
+
);
|
|
165
|
+
} catch (error) {
|
|
166
|
+
if (!current.cancelled)
|
|
167
|
+
ctx.ui.notify(`Unable to open code intelligence status: ${String(error)}`, "error");
|
|
168
|
+
} finally {
|
|
169
|
+
current.dialog?.dispose();
|
|
170
|
+
if (interaction === current) interaction = undefined;
|
|
171
|
+
}
|
|
117
172
|
},
|
|
118
173
|
});
|
|
119
174
|
}
|
|
120
|
-
|
|
121
|
-
/** Inputs for one status dialog snapshot. */
|
|
122
|
-
interface GatherCiStatusOptions {
|
|
123
|
-
cwd: string;
|
|
124
|
-
pi: ExtensionAPI;
|
|
125
|
-
projectTrusted: boolean;
|
|
126
|
-
homeDir?: string;
|
|
127
|
-
warningSource?: CiStatusWarningSource;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Gather a snapshot of LSP and structural state for the dialog. */
|
|
131
|
-
async function gatherCiStatusData(options: GatherCiStatusOptions): Promise<CiStatusData> {
|
|
132
|
-
const { cwd, pi, projectTrusted, homeDir, warningSource } = options;
|
|
133
|
-
const workspace = getDefaultWorkspaceRuntime().getWorkspace(cwd);
|
|
134
|
-
const lspState = getWorkspaceLspRuntime(cwd);
|
|
135
|
-
const serverInventoryAvailable = lspState.kind === "ready" || lspState.kind === "disabled";
|
|
136
|
-
const servers = lspState.kind === "ready" ? lspState.runtime.getProjectServers() : [];
|
|
137
|
-
const semanticAvailable = servers.some(
|
|
138
|
-
(server) => server.status === "running" && server.ready === true,
|
|
139
|
-
);
|
|
140
|
-
const diagnosticSnapshot =
|
|
141
|
-
lspState.kind === "ready" && semanticAvailable
|
|
142
|
-
? lspState.runtime.getOutstandingDiagnosticSummary(1)
|
|
143
|
-
: { entries: [], current: false };
|
|
144
|
-
const diagnostics = diagnosticSnapshot.entries;
|
|
145
|
-
const semanticState = deriveSemanticCapabilityState(workspace, lspState, semanticAvailable);
|
|
146
|
-
|
|
147
|
-
// Sort: errors desc, warnings desc, info desc, hints desc
|
|
148
|
-
diagnostics.sort((a, b) => {
|
|
149
|
-
if (b.errors !== a.errors) return b.errors - a.errors;
|
|
150
|
-
if (b.warnings !== a.warnings) return b.warnings - a.warnings;
|
|
151
|
-
if (b.information !== a.information) return b.information - a.information;
|
|
152
|
-
return b.hints - a.hints;
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const structState = workspace.structural.state;
|
|
156
|
-
const structKind = structState.kind;
|
|
157
|
-
const structReason = structState.kind === "unavailable" ? structState.reason : undefined;
|
|
158
|
-
|
|
159
|
-
const activeTools = pi.getActiveTools().filter((t) => t.startsWith("code_"));
|
|
160
|
-
|
|
161
|
-
// Evaluate current Capability Warnings from available data.
|
|
162
|
-
const warningFacts = warningSource?.get(cwd);
|
|
163
|
-
const capabilityWarnings = evaluateCapabilityWarnings(
|
|
164
|
-
gatherCapabilityWarningInput(cwd, warningFacts?.lspController ?? null, {
|
|
165
|
-
projectTrusted,
|
|
166
|
-
homeDir,
|
|
167
|
-
automaticPathPolicy: warningFacts?.automaticPathPolicy ?? undefined,
|
|
168
|
-
}),
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
return {
|
|
172
|
-
workspaceRoot: cwd,
|
|
173
|
-
servers,
|
|
174
|
-
diagnostics,
|
|
175
|
-
serverInventoryAvailable,
|
|
176
|
-
semanticAvailable,
|
|
177
|
-
diagnosticSnapshotCurrent: diagnosticSnapshot.current,
|
|
178
|
-
capabilities: {
|
|
179
|
-
semantic: semanticState,
|
|
180
|
-
structural: {
|
|
181
|
-
kind: structKind,
|
|
182
|
-
reason: structReason,
|
|
183
|
-
providerAvailable: structState.kind === "ready",
|
|
184
|
-
},
|
|
185
|
-
refactorAvailable: workspace.semantic.refactorAvailable,
|
|
186
|
-
},
|
|
187
|
-
activeTools,
|
|
188
|
-
capabilityWarnings: capabilityWarnings.hasWarnings ? capabilityWarnings : undefined,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function deriveSemanticCapabilityState(
|
|
193
|
-
workspace: {
|
|
194
|
-
semantic: {
|
|
195
|
-
state: { kind: string };
|
|
196
|
-
provider: unknown | null;
|
|
197
|
-
};
|
|
198
|
-
},
|
|
199
|
-
lspState: WorkspaceLspRuntimeState,
|
|
200
|
-
semanticAvailable: boolean,
|
|
201
|
-
): CiStatusData["capabilities"]["semantic"] {
|
|
202
|
-
if (lspState.kind === "ready") {
|
|
203
|
-
return semanticAvailable
|
|
204
|
-
? {
|
|
205
|
-
kind: "ready",
|
|
206
|
-
providerAvailable: workspace.semantic.provider !== null,
|
|
207
|
-
}
|
|
208
|
-
: {
|
|
209
|
-
kind: "pending",
|
|
210
|
-
reason: "No active, ready project servers",
|
|
211
|
-
providerAvailable: workspace.semantic.provider !== null,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
if (workspace.semantic.state.kind === "pending" || lspState.kind === "pending") {
|
|
215
|
-
return {
|
|
216
|
-
kind: "pending",
|
|
217
|
-
providerAvailable: workspace.semantic.provider !== null,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
if (lspState.kind === "inactive") {
|
|
221
|
-
return { kind: "inactive", providerAvailable: workspace.semantic.provider !== null };
|
|
222
|
-
}
|
|
223
|
-
if (lspState.kind === "disabled") {
|
|
224
|
-
return {
|
|
225
|
-
kind: "disabled",
|
|
226
|
-
reason: "LSP is disabled in settings",
|
|
227
|
-
providerAvailable: workspace.semantic.provider !== null,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
kind: workspace.semantic.state.kind,
|
|
232
|
-
reason: "reason" in lspState ? lspState.reason : "No LSP service",
|
|
233
|
-
providerAvailable: workspace.semantic.provider !== null,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/** Render the custom footer line. */
|
|
238
|
-
function renderFooterLine(ctx: ExtensionContext, data: CiStatusData): string {
|
|
239
|
-
const t = ctx.ui.theme;
|
|
240
|
-
const parts: string[] = [];
|
|
241
|
-
const running = data.servers.filter((s) => s.status === "running").length;
|
|
242
|
-
if (running > 0) {
|
|
243
|
-
parts.push(
|
|
244
|
-
t.fg("accent", "λ ci") + t.fg("dim", ` ${running} server${running === 1 ? "" : "s"}`),
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
const totalErrors = data.diagnostics.reduce((sum, d) => sum + d.errors, 0);
|
|
248
|
-
if (totalErrors > 0) {
|
|
249
|
-
parts.push(t.fg("error", `${totalErrors} error${totalErrors === 1 ? "" : "s"}`));
|
|
250
|
-
}
|
|
251
|
-
const totalWarnings = data.diagnostics.reduce((sum, d) => sum + d.warnings, 0);
|
|
252
|
-
if (totalWarnings > 0) {
|
|
253
|
-
parts.push(t.fg("warning", `${totalWarnings} warning${totalWarnings === 1 ? "" : "s"}`));
|
|
254
|
-
}
|
|
255
|
-
addProjectServerRouteCounts(parts, data, t);
|
|
256
|
-
const structKind = data.capabilities.structural.kind;
|
|
257
|
-
if (structKind === "ready") parts.push(t.fg("success", "✓ ts"));
|
|
258
|
-
if (parts.length === 0) return t.fg("dim", "CI — no data available");
|
|
259
|
-
return parts.join(t.fg("dim", " "));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function addProjectServerRouteCounts(
|
|
263
|
-
parts: string[],
|
|
264
|
-
data: CiStatusData,
|
|
265
|
-
theme: ExtensionContext["ui"]["theme"],
|
|
266
|
-
): void {
|
|
267
|
-
const counts = countProjectServerRouteStatuses(data.servers);
|
|
268
|
-
if (counts.recovering > 0) {
|
|
269
|
-
parts.push(
|
|
270
|
-
theme.fg(
|
|
271
|
-
"warning",
|
|
272
|
-
`${counts.recovering} route${counts.recovering === 1 ? "" : "s"} recovering`,
|
|
273
|
-
),
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
if (counts.error > 0) {
|
|
277
|
-
parts.push(theme.fg("error", `${counts.error} route error${counts.error === 1 ? "" : "s"}`));
|
|
278
|
-
}
|
|
279
|
-
if (counts.unavailable > 0) {
|
|
280
|
-
parts.push(
|
|
281
|
-
theme.fg(
|
|
282
|
-
"warning",
|
|
283
|
-
`${counts.unavailable} route${counts.unavailable === 1 ? "" : "s"} unavailable`,
|
|
284
|
-
),
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function truncateFooterLine(line: string, width: number): string {
|
|
290
|
-
return truncateToWidth(line, width, "…");
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/** Update the persistent status bar and below-editor widget. */
|
|
294
|
-
function updateStatusAndWidget(ctx: ExtensionContext, data: CiStatusData): void {
|
|
295
|
-
const t = ctx.ui.theme;
|
|
296
|
-
|
|
297
|
-
// Status bar: concise one-liner
|
|
298
|
-
const parts: string[] = [t.fg("accent", "λ ci")];
|
|
299
|
-
const runningServers = data.servers.filter((s) => s.status === "running").length;
|
|
300
|
-
if (runningServers > 0) {
|
|
301
|
-
parts.push(t.fg("dim", `${runningServers} server${runningServers === 1 ? "" : "s"}`));
|
|
302
|
-
}
|
|
303
|
-
const totalErrors = data.diagnostics.reduce((sum, d) => sum + d.errors, 0);
|
|
304
|
-
if (totalErrors > 0) {
|
|
305
|
-
parts.push(t.fg("error", `${totalErrors} error${totalErrors === 1 ? "" : "s"}`));
|
|
306
|
-
}
|
|
307
|
-
const totalWarnings = data.diagnostics.reduce((sum, d) => sum + d.warnings, 0);
|
|
308
|
-
if (totalWarnings > 0) {
|
|
309
|
-
parts.push(t.fg("warning", `${totalWarnings} warning${totalWarnings === 1 ? "" : "s"}`));
|
|
310
|
-
}
|
|
311
|
-
addProjectServerRouteCounts(parts, data, t);
|
|
312
|
-
const structKind = data.capabilities.structural.kind;
|
|
313
|
-
if (structKind === "ready") parts.push(t.fg("success", "✓ ts"));
|
|
314
|
-
|
|
315
|
-
const statusText = parts.length > 1 ? parts.join(t.fg("dim", " · ")) : undefined;
|
|
316
|
-
ctx.ui.setStatus(STATUS_KEY, statusText);
|
|
317
|
-
|
|
318
|
-
// Widget (below editor) — top problem files
|
|
319
|
-
if (data.diagnostics.length > 0) {
|
|
320
|
-
const top = data.diagnostics.slice(0, 2);
|
|
321
|
-
const fileLines = top.map((d) => {
|
|
322
|
-
const counts: string[] = [];
|
|
323
|
-
if (d.errors > 0) {
|
|
324
|
-
counts.push(t.fg("error", `${d.errors} error${d.errors === 1 ? "" : "s"}`));
|
|
325
|
-
}
|
|
326
|
-
if (d.warnings > 0) {
|
|
327
|
-
counts.push(t.fg("warning", `${d.warnings} warning${d.warnings === 1 ? "" : "s"}`));
|
|
328
|
-
}
|
|
329
|
-
return ` ${d.file} (${counts.join(", ")})`;
|
|
330
|
-
});
|
|
331
|
-
const more = data.diagnostics.length - top.length;
|
|
332
|
-
const moreSuffix = more > 0 ? t.fg("dim", ` +${more} more`) : "";
|
|
333
|
-
ctx.ui.setWidget(
|
|
334
|
-
WIDGET_KEY,
|
|
335
|
-
[
|
|
336
|
-
t.fg("accent", `λ CI — ${data.diagnostics.length} files with issues`) + moreSuffix,
|
|
337
|
-
...fileLines,
|
|
338
|
-
],
|
|
339
|
-
{ placement: "belowEditor" },
|
|
340
|
-
);
|
|
341
|
-
} else {
|
|
342
|
-
ctx.ui.setWidget(WIDGET_KEY, undefined);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function clearStatusAndWidget(ctx: ExtensionContext): void {
|
|
347
|
-
ctx.ui.setStatus(STATUS_KEY, undefined);
|
|
348
|
-
ctx.ui.setWidget(WIDGET_KEY, undefined);
|
|
349
|
-
}
|