@mrclrchtr/supi-code-intelligence 4.10.0 → 5.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/README.md +2 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- package/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -3
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +80 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +2 -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/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +7 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +206 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +114 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +372 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +14 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-pull.ts +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +491 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +71 -11
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-waiters.ts +206 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +365 -297
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +52 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +185 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +25 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +467 -115
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +161 -33
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +10 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/defaults.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +45 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +38 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +79 -9
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +13 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +300 -24
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +5 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +464 -96
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +130 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +45 -329
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +57 -120
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +207 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/readiness.ts +72 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +151 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +50 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +136 -120
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +102 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +17 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +2 -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/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/README.md +258 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/babel.cjs +257 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/jiti.cjs +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.cjs +30 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.mjs +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/types.d.ts +420 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/package.json +146 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +0 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +16 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +65 -87
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +47 -95
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-timing.ts +147 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client-lifecycle.ts +39 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +561 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-message-size.ts +24 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +452 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +12 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +5 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +33 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/blocking-test-bootstrap.mjs +34 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/bootstrap.mjs +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store-helpers.ts +23 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +400 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/request-control.ts +48 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-parser-helpers.ts +24 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-query-helpers.ts +43 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +421 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +116 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +201 -0
- package/package.json +5 -5
- package/src/analysis/health/diagnostics.ts +236 -24
- package/src/analysis/health/recovery.ts +6 -2
- package/src/analysis/provider.ts +58 -0
- package/src/analysis/readiness.ts +30 -9
- package/src/analysis/refactor/apply.ts +45 -1
- package/src/analysis/refactor/mutation-authority.ts +143 -0
- package/src/analysis/relations/callees.ts +9 -1
- package/src/analysis/relations/types.ts +5 -2
- package/src/analysis/search/ast-scan-timing.ts +9 -2
- package/src/analysis/search/ast-scan.ts +1 -1
- package/src/analysis/search/deadline.ts +2 -2
- package/src/analysis/search/pattern-analysis.ts +46 -32
- package/src/analysis/search/pattern.ts +12 -2
- package/src/analysis/target/anchored.ts +20 -11
- package/src/analysis/target/file.ts +18 -11
- package/src/analysis/target/identity.ts +19 -3
- package/src/analysis/target/symbol.ts +36 -15
- package/src/api.ts +4 -0
- package/src/diagnostics/evidence.ts +51 -0
- package/src/session/capability-adapter.ts +12 -3
- package/src/session/find-workflow.ts +17 -7
- package/src/session/graph/collect.ts +18 -2
- package/src/session/graph-workflow.ts +19 -12
- package/src/session/health-refresh.ts +148 -0
- package/src/session/health-types.ts +37 -15
- package/src/session/health-workflow.ts +37 -39
- package/src/session/inspect/collect.ts +20 -3
- package/src/session/inspect-workflow.ts +10 -5
- package/src/session/orientation/collect.ts +10 -1
- package/src/session/orientation/context-facts.ts +3 -1
- package/src/session/orientation/context-sections.ts +20 -7
- package/src/session/orientation/gather.ts +17 -11
- package/src/session/orientation-types.ts +2 -1
- package/src/session/orientation-workflow.ts +15 -8
- package/src/session/refactor-plans.ts +2 -0
- package/src/session/refactor-workflow.ts +59 -14
- package/src/session/session.ts +4 -1
- package/src/session/target-workflow.ts +54 -23
- package/src/session/workflow-control.ts +7 -3
- package/src/substrate/lsp/lifecycle.ts +26 -46
- package/src/substrate/lsp/maintenance.ts +199 -25
- package/src/substrate/lsp/state.ts +2 -2
- package/src/substrate/workspace-provider-host.ts +25 -3
- package/src/tool/find/execute.ts +7 -1
- package/src/tool/find/render.ts +20 -3
- package/src/tool/find/tui.ts +23 -21
- package/src/tool/graph/execute.ts +23 -3
- package/src/tool/graph/tui.ts +59 -46
- package/src/tool/health/execute.ts +7 -2
- package/src/tool/health/markdown.ts +56 -14
- package/src/tool/health/refresh-status.ts +105 -0
- package/src/tool/health/tui.ts +95 -98
- package/src/tool/infra/workflow-control.ts +8 -0
- package/src/tool/inspect/execute.ts +7 -1
- package/src/tool/inspect/tui.ts +26 -18
- package/src/tool/orientation/execute.ts +21 -3
- package/src/tool/orientation/tui.ts +51 -35
- package/src/tool/refactor-apply/execute.ts +3 -0
- package/src/tool/refactor-apply/tui.ts +43 -25
- package/src/tool/refactor-plan/execute.ts +4 -0
- package/src/tool/refactor-plan/tui.ts +33 -20
- package/src/tool/register.ts +127 -22
- package/src/tool/resolve/execute.ts +18 -1
- package/src/tool/resolve/tui.ts +42 -24
- package/src/tool/result/display.ts +107 -0
- package/src/tool/result/errors.ts +20 -17
- package/src/tool/result/find.ts +52 -8
- package/src/tool/result/graph.ts +44 -1
- package/src/tool/result/health.ts +53 -1
- package/src/tool/result/inspect.ts +113 -1
- package/src/tool/result/orientation.ts +66 -14
- package/src/tool/result/refactor.ts +36 -4
- package/src/tool/result/resolve.ts +44 -7
- package/src/tool/result/types.ts +20 -0
- package/src/types/execution.ts +18 -5
- package/src/types/index.ts +8 -1
- package/src/ui/status-command.ts +5 -3
- package/src/ui/status-overlay.ts +4 -0
- package/src/ui/tui/common.ts +108 -10
- package/src/ui/tui/display.ts +48 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime.ts +0 -351
package/src/tool/health/tui.ts
CHANGED
|
@@ -6,33 +6,43 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
|
6
6
|
import { Container, Spacer, Text } from "@earendil-works/pi-tui";
|
|
7
7
|
import {
|
|
8
8
|
type EvidenceEntry,
|
|
9
|
-
|
|
9
|
+
formatCallValue,
|
|
10
10
|
type ResultOptios,
|
|
11
|
+
renderDomainError,
|
|
12
|
+
renderDomainResult,
|
|
11
13
|
renderEvidenceLines,
|
|
14
|
+
renderExecutionError,
|
|
12
15
|
renderMarkdownDetail,
|
|
13
16
|
renderPartial,
|
|
17
|
+
renderToolDisplaySections,
|
|
18
|
+
renderTruncationDisclosure,
|
|
19
|
+
type ToolRendererContext,
|
|
14
20
|
type ToolResult,
|
|
15
21
|
} from "../../ui/tui/common.ts";
|
|
16
22
|
import type { CodeHealthToolParams } from "./execute.ts";
|
|
23
|
+
import { readPreviousRefreshStatus, readRefreshStatus } from "./refresh-status.ts";
|
|
17
24
|
import { formatSemanticHealthState, readSemanticHealthState } from "./semantic-state.ts";
|
|
18
25
|
|
|
19
26
|
/** ── renderCall ────────────────────────────────────────────────── */
|
|
20
27
|
|
|
21
|
-
export function renderHealthCall(
|
|
22
|
-
|
|
28
|
+
export function renderHealthCall(
|
|
29
|
+
args: unknown,
|
|
30
|
+
theme: Theme,
|
|
31
|
+
_context: ToolRendererContext | undefined,
|
|
32
|
+
): Text {
|
|
33
|
+
const params = (args ?? {}) as Partial<CodeHealthToolParams>;
|
|
23
34
|
const sections =
|
|
24
35
|
params.include === undefined
|
|
25
36
|
? "diag, servers"
|
|
26
|
-
: params.include.length > 0
|
|
27
|
-
? params.include.join(", ")
|
|
37
|
+
: Array.isArray(params.include) && params.include.length > 0
|
|
38
|
+
? params.include.map((section) => formatCallValue(section, 20) ?? "?").join(", ")
|
|
28
39
|
: "none";
|
|
29
40
|
|
|
30
41
|
let content = theme.fg("toolTitle", "code_health");
|
|
31
42
|
content += ` ${theme.fg("accent", sections)}`;
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
44
|
+
const scope = formatCallValue(params.scope);
|
|
45
|
+
if (scope) content += ` ${theme.fg("dim", scope)}`;
|
|
36
46
|
|
|
37
47
|
return new Text(content, 0, 0);
|
|
38
48
|
}
|
|
@@ -43,27 +53,29 @@ export function renderHealthResult(
|
|
|
43
53
|
result: ToolResult,
|
|
44
54
|
options: ResultOptios,
|
|
45
55
|
theme: Theme,
|
|
46
|
-
|
|
56
|
+
context: ToolRendererContext | undefined,
|
|
47
57
|
): Container | Text {
|
|
48
|
-
if (options.isPartial)
|
|
49
|
-
return renderPartial("Gathering workspace health…", theme);
|
|
50
|
-
}
|
|
58
|
+
if (options.isPartial) return renderPartial("Gathering workspace health…", theme);
|
|
51
59
|
|
|
52
|
-
const container = new Container();
|
|
53
60
|
const data =
|
|
54
61
|
result.details?.type === "health" ? (result.details.data as Record<string, unknown>) : null;
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
62
|
+
const executionError = renderExecutionError(context, "code_health failed", theme);
|
|
63
|
+
if (executionError) return executionError;
|
|
64
|
+
const domainError = renderDomainError(result, theme);
|
|
65
|
+
if (domainError) return renderDomainResult(result, options, theme, domainError);
|
|
60
66
|
|
|
61
67
|
if (!options.expanded) {
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
const compact = buildCompactSummary(data, theme);
|
|
69
|
+
const truncation = renderTruncationDisclosure(result, theme);
|
|
70
|
+
if (!truncation) return compact;
|
|
71
|
+
const compactContainer = new Container();
|
|
72
|
+
compactContainer.addChild(compact);
|
|
73
|
+
compactContainer.addChild(new Spacer(1));
|
|
74
|
+
compactContainer.addChild(truncation);
|
|
75
|
+
return compactContainer;
|
|
64
76
|
}
|
|
65
77
|
|
|
66
|
-
|
|
78
|
+
const container = new Container();
|
|
67
79
|
container.addChild(buildStatusBar(data, theme));
|
|
68
80
|
const capabilityWarnings = readCapabilityWarnings(data);
|
|
69
81
|
if (capabilityWarnings.length > 0) {
|
|
@@ -72,8 +84,7 @@ export function renderHealthResult(
|
|
|
72
84
|
}
|
|
73
85
|
container.addChild(new Spacer(1));
|
|
74
86
|
container.addChild(buildDiagnosticSummary(data, theme));
|
|
75
|
-
|
|
76
|
-
if (diagnosticEntries) container.addChild(diagnosticEntries);
|
|
87
|
+
renderToolDisplaySections(container, result.details?.displaySections, theme);
|
|
77
88
|
container.addChild(buildHealthSectionSummary(data, theme));
|
|
78
89
|
|
|
79
90
|
const lists = data?.evidenceLists as EvidenceEntry[] | undefined;
|
|
@@ -82,6 +93,11 @@ export function renderHealthResult(
|
|
|
82
93
|
renderEvidenceLines(container, lists, theme);
|
|
83
94
|
}
|
|
84
95
|
|
|
96
|
+
const truncation = renderTruncationDisclosure(result, theme);
|
|
97
|
+
if (truncation) {
|
|
98
|
+
container.addChild(new Spacer(1));
|
|
99
|
+
container.addChild(truncation);
|
|
100
|
+
}
|
|
85
101
|
renderMarkdownDetail(container, result, theme);
|
|
86
102
|
|
|
87
103
|
return container;
|
|
@@ -105,12 +121,22 @@ function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme)
|
|
|
105
121
|
const semanticRequested = sections.some(
|
|
106
122
|
(section) => section.key === "diagnostics" || section.key === "servers",
|
|
107
123
|
);
|
|
108
|
-
const segments = sections.map((section) =>
|
|
124
|
+
const segments = sections.map((section) =>
|
|
125
|
+
formatSectionSummary(
|
|
126
|
+
section,
|
|
127
|
+
section.key === "diagnostics"
|
|
128
|
+
? formatCompactDiagnosticEvidence(readDiagnosticEvidence(data))
|
|
129
|
+
: null,
|
|
130
|
+
theme,
|
|
131
|
+
),
|
|
132
|
+
);
|
|
109
133
|
if (semanticRequested) {
|
|
110
134
|
const semanticStatus = readSemanticStatus(data);
|
|
111
135
|
const statusColor = semanticStatus.startsWith("ready") ? "success" : "warning";
|
|
112
136
|
segments.push(`${theme.fg("dim", "lsp")} ${theme.fg(statusColor, semanticStatus)}`);
|
|
113
137
|
}
|
|
138
|
+
const previousRefresh = readPreviousRefreshStatus(data);
|
|
139
|
+
if (previousRefresh) segments.push(theme.fg("dim", previousRefresh));
|
|
114
140
|
const capabilityWarningCount = readCapabilityWarnings(data).length;
|
|
115
141
|
if (capabilityWarningCount > 0) {
|
|
116
142
|
const label = capabilityWarningCount === 1 ? "capability warning" : "capability warnings";
|
|
@@ -123,20 +149,20 @@ function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme)
|
|
|
123
149
|
|
|
124
150
|
function formatSectionSummary(
|
|
125
151
|
section: HealthSectionSummary,
|
|
126
|
-
|
|
152
|
+
coverage: string | null,
|
|
127
153
|
theme: Theme,
|
|
128
154
|
): string {
|
|
129
155
|
const label = sectionLabel(section.key);
|
|
156
|
+
const coverageSuffix = coverage ? ` (${coverage})` : "";
|
|
130
157
|
if (section.status === "unavailable" || !section.available) {
|
|
131
|
-
return `${theme.fg("dim", label)} ${theme.fg("warning", "unavailable")}`;
|
|
158
|
+
return `${theme.fg("dim", label)} ${theme.fg("warning", "unavailable")}${coverageSuffix}`;
|
|
132
159
|
}
|
|
133
160
|
if (section.status === "partial") {
|
|
134
|
-
return `${theme.fg("dim", label)} ${theme.fg("warning", "partial")}`;
|
|
161
|
+
return `${theme.fg("dim", label)} ${theme.fg("warning", "partial")}${coverageSuffix}`;
|
|
135
162
|
}
|
|
136
|
-
if (evidence) return theme.fg("success", theme.bold(formatEvidenceEntry(evidence)));
|
|
137
163
|
|
|
138
|
-
const suffix = section.key === "diagnostics" ? " with issues" : "";
|
|
139
|
-
return `${theme.fg("dim", label)} ${theme.fg("success", theme.bold(`${section.itemCount}`))}${theme.fg("muted", suffix)}`;
|
|
164
|
+
const suffix = section.key === "diagnostics" && !coverage ? " with issues" : "";
|
|
165
|
+
return `${theme.fg("dim", label)} ${theme.fg("success", theme.bold(`${section.itemCount}`))}${theme.fg("muted", suffix)}${coverageSuffix}`;
|
|
140
166
|
}
|
|
141
167
|
|
|
142
168
|
function buildStatusBar(data: Record<string, unknown> | null, theme: Theme): Text {
|
|
@@ -162,32 +188,6 @@ function buildStatusBar(data: Record<string, unknown> | null, theme: Theme): Tex
|
|
|
162
188
|
return new Text(lines.join(" "), 0, 0);
|
|
163
189
|
}
|
|
164
190
|
|
|
165
|
-
function readRefreshStatus(data: Record<string, unknown> | null): string | null {
|
|
166
|
-
const refresh = readRecord(data?.refresh);
|
|
167
|
-
if (!refresh) return null;
|
|
168
|
-
|
|
169
|
-
switch (refresh.kind) {
|
|
170
|
-
case "completed": {
|
|
171
|
-
const attempted = readNumber(refresh.attemptedActiveClients);
|
|
172
|
-
const restarted = readNumber(refresh.restartedClients);
|
|
173
|
-
const stale = readRecord(refresh.staleAssessment);
|
|
174
|
-
const noOp = attempted === 0 && restarted === 0;
|
|
175
|
-
const base = noOp
|
|
176
|
-
? "refresh completed no-op"
|
|
177
|
-
: `refresh completed: ${attempted} clients targeted, ${restarted} restarted`;
|
|
178
|
-
return stale?.suspected === true
|
|
179
|
-
? `${base}; stale pattern suspected in ${readNumber(stale.matchedFileCount)} files`
|
|
180
|
-
: base;
|
|
181
|
-
}
|
|
182
|
-
case "failed":
|
|
183
|
-
return `refresh failed${typeof refresh.reason === "string" ? `: ${refresh.reason}` : ""}`;
|
|
184
|
-
case "not-attempted":
|
|
185
|
-
return "refresh not attempted";
|
|
186
|
-
default:
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
191
|
function diagnosticEmptySummary(data: Record<string, unknown> | null): string {
|
|
192
192
|
return diagnosticScopeKind(data) === "file"
|
|
193
193
|
? "No errors or warnings for file"
|
|
@@ -200,12 +200,44 @@ function diagnosticScopeKind(data: Record<string, unknown> | null): string | nul
|
|
|
200
200
|
return typeof scope?.kind === "string" ? scope.kind : null;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
function
|
|
204
|
-
|
|
203
|
+
function readDiagnosticEvidence(
|
|
204
|
+
data: Record<string, unknown> | null,
|
|
205
|
+
): Record<string, unknown> | null {
|
|
206
|
+
return readRecord(readRecord(data?.diagnosticObservation)?.evidence);
|
|
205
207
|
}
|
|
206
208
|
|
|
207
|
-
function
|
|
208
|
-
|
|
209
|
+
function formatCompactDiagnosticEvidence(evidence: Record<string, unknown> | null): string | null {
|
|
210
|
+
if (!evidence) return null;
|
|
211
|
+
const counts = [
|
|
212
|
+
evidence.requested,
|
|
213
|
+
evidence.confirmed,
|
|
214
|
+
evidence.unconfirmed,
|
|
215
|
+
evidence.failed,
|
|
216
|
+
evidence.removed,
|
|
217
|
+
];
|
|
218
|
+
if (!counts.every(isEvidenceCount)) return null;
|
|
219
|
+
return `req ${evidence.requested} · conf ${evidence.confirmed} · unconf ${evidence.unconfirmed} · failed ${evidence.failed} · removed ${evidence.removed}`;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function formatDiagnosticEvidence(evidence: Record<string, unknown> | null): string | null {
|
|
223
|
+
if (!evidence) return null;
|
|
224
|
+
const counts = [
|
|
225
|
+
evidence.requested,
|
|
226
|
+
evidence.confirmed,
|
|
227
|
+
evidence.unconfirmed,
|
|
228
|
+
evidence.failed,
|
|
229
|
+
evidence.removed,
|
|
230
|
+
];
|
|
231
|
+
if (!counts.every(isEvidenceCount)) return null;
|
|
232
|
+
return `${evidence.requested} requested, ${evidence.confirmed} confirmed, ${evidence.unconfirmed} unconfirmed, ${evidence.failed} failed, ${evidence.removed} removed`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function isEvidenceCount(value: unknown): value is number {
|
|
236
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function readRecord(value: unknown): Record<string, unknown> | null {
|
|
240
|
+
return typeof value === "object" && value !== null ? (value as Record<string, unknown>) : null;
|
|
209
241
|
}
|
|
210
242
|
|
|
211
243
|
interface RenderedCapabilityWarning {
|
|
@@ -268,14 +300,9 @@ function buildDiagnosticSummary(data: Record<string, unknown> | null, theme: The
|
|
|
268
300
|
}
|
|
269
301
|
const trackedFiles = diagnosticScopeKind(data) === "tracked-files";
|
|
270
302
|
if (section.status === "partial") {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
trackedFiles ? "Tracked-file diagnostics partial" : "Diagnostics partial",
|
|
275
|
-
),
|
|
276
|
-
0,
|
|
277
|
-
0,
|
|
278
|
-
);
|
|
303
|
+
const coverage = formatDiagnosticEvidence(readDiagnosticEvidence(data));
|
|
304
|
+
const label = trackedFiles ? "Tracked-file diagnostics partial" : "Diagnostics partial";
|
|
305
|
+
return new Text(theme.fg("warning", coverage ? `${label} (${coverage})` : label), 0, 0);
|
|
279
306
|
}
|
|
280
307
|
if (section.itemCount === 0) {
|
|
281
308
|
return new Text(theme.fg("success", diagnosticEmptySummary(data)), 0, 0);
|
|
@@ -289,36 +316,6 @@ function buildDiagnosticSummary(data: Record<string, unknown> | null, theme: The
|
|
|
289
316
|
);
|
|
290
317
|
}
|
|
291
318
|
|
|
292
|
-
/** Render per-file diagnostic messages in expanded detailed mode. */
|
|
293
|
-
function buildDiagnosticEntries(data: Record<string, unknown> | null, theme: Theme): Text | null {
|
|
294
|
-
const observation = readRecord(data?.diagnosticObservation);
|
|
295
|
-
const entries = observation?.entries;
|
|
296
|
-
if (!Array.isArray(entries) || entries.length === 0) return null;
|
|
297
|
-
|
|
298
|
-
const lines: string[] = [];
|
|
299
|
-
for (const raw of entries) {
|
|
300
|
-
const entry = readRecord(raw);
|
|
301
|
-
if (!entry || !Array.isArray(entry.messages) || entry.messages.length === 0) continue;
|
|
302
|
-
lines.push(theme.fg("dim", ` ${typeof entry.file === "string" ? entry.file : ""}`));
|
|
303
|
-
for (const rawMsg of entry.messages) {
|
|
304
|
-
const formatted = formatDiagnosticMessage(readRecord(rawMsg), theme);
|
|
305
|
-
if (formatted) lines.push(formatted);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return lines.length > 0 ? new Text(lines.join("\n"), 0, 0) : null;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function formatDiagnosticMessage(msg: Record<string, unknown> | null, theme: Theme): string | null {
|
|
313
|
-
if (!msg || typeof msg.message !== "string") return null;
|
|
314
|
-
const line = typeof msg.line === "number" ? `L${msg.line} ` : "";
|
|
315
|
-
const isError = msg.severity === "error";
|
|
316
|
-
const color = isError ? "error" : "warning";
|
|
317
|
-
const icon = isError ? "✖" : "⚠";
|
|
318
|
-
const source = typeof msg.source === "string" ? ` [${msg.source}]` : "";
|
|
319
|
-
return ` ${theme.fg(color, `${icon} ${line}${msg.severity}${source}`)}: ${msg.message}`;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
319
|
function readHealthSections(data: Record<string, unknown> | null): HealthSectionSummary[] {
|
|
323
320
|
const value = data?.sections;
|
|
324
321
|
if (!Array.isArray(value)) return [];
|
|
@@ -2,10 +2,18 @@ import type { WorkflowControl } from "../../session/workflow-control.ts";
|
|
|
2
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
3
3
|
import { emitToolProgress } from "./progress.ts";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Internal absolute deadline for one public code tool call. Pi supplies only
|
|
7
|
+
* a signal, so the adapter derives one bounded deadline per call.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_WORKFLOW_DEADLINE_MS = 60_000;
|
|
10
|
+
|
|
5
11
|
/** Translate Pi execution controls into presentation-free session controls. */
|
|
6
12
|
export function toWorkflowControl(ctx: CodeIntelToolExecCtx): WorkflowControl {
|
|
7
13
|
return {
|
|
14
|
+
operationId: ctx.operationId,
|
|
8
15
|
signal: ctx.signal,
|
|
16
|
+
deadline: Date.now() + DEFAULT_WORKFLOW_DEADLINE_MS,
|
|
9
17
|
progress: (event) => emitToolProgress(ctx.onUpdate, `${event.intent}: ${event.message}`),
|
|
10
18
|
};
|
|
11
19
|
}
|
|
@@ -23,12 +23,18 @@ export async function executeInspectTool(
|
|
|
23
23
|
return inspectErrorResult(`**Error:** ${outcome.message}`, {
|
|
24
24
|
focusTarget: "invalid input",
|
|
25
25
|
nextQueries: ["Provide an existing file and exact 1-based point"],
|
|
26
|
+
message: outcome.message,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const assembly = assembleInspectResult(outcome.data, outcome.nextQueries);
|
|
30
31
|
return {
|
|
31
32
|
content: renderInspectResult(assembly),
|
|
32
|
-
details: {
|
|
33
|
+
details: {
|
|
34
|
+
type: "inspect",
|
|
35
|
+
data: assembly.details,
|
|
36
|
+
status: "completed",
|
|
37
|
+
displaySections: assembly.displaySections,
|
|
38
|
+
},
|
|
33
39
|
};
|
|
34
40
|
}
|
package/src/tool/inspect/tui.ts
CHANGED
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TUI renderer for code_inspect — renderCall + renderResult.
|
|
3
|
-
*/
|
|
1
|
+
/** TUI renderer for code_inspect. */
|
|
4
2
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
5
3
|
import { Text } from "@earendil-works/pi-tui";
|
|
6
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
formatCallPath,
|
|
6
|
+
type ResultOptios,
|
|
7
|
+
renderSimpleResult,
|
|
8
|
+
type ToolRendererContext,
|
|
9
|
+
type ToolResult,
|
|
10
|
+
} from "../../ui/tui/common.ts";
|
|
7
11
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
/** Render the compact code_inspect call header. */
|
|
13
|
+
export function renderInspectCall(
|
|
14
|
+
args: unknown,
|
|
15
|
+
theme: Theme,
|
|
16
|
+
_context: ToolRendererContext | undefined,
|
|
17
|
+
): Text {
|
|
11
18
|
const params = (args ?? {}) as {
|
|
12
|
-
point?: { file
|
|
19
|
+
point?: { file?: unknown; line?: unknown; character?: unknown };
|
|
13
20
|
};
|
|
14
21
|
|
|
15
22
|
let content = theme.fg("toolTitle", "code_inspect");
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
const file =
|
|
19
|
-
content += ` ${theme.fg("accent", file)}`;
|
|
20
|
-
content += theme.fg("warning", `:${
|
|
21
|
-
|
|
23
|
+
const point = params.point;
|
|
24
|
+
if (point && typeof point === "object") {
|
|
25
|
+
const file = formatCallPath(point.file);
|
|
26
|
+
if (file) content += ` ${theme.fg("accent", file)}`;
|
|
27
|
+
if (typeof point.line === "number") content += theme.fg("warning", `:${point.line}`);
|
|
28
|
+
if (typeof point.character === "number") {
|
|
29
|
+
content += theme.fg("dim", `:${point.character}`);
|
|
30
|
+
}
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
return new Text(content, 0, 0);
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
36
|
+
/** Render code_inspect progress, status, and structured result details. */
|
|
29
37
|
export function renderInspectResult(
|
|
30
38
|
result: ToolResult,
|
|
31
39
|
options: ResultOptios,
|
|
32
40
|
theme: Theme,
|
|
33
|
-
|
|
41
|
+
context: ToolRendererContext | undefined,
|
|
34
42
|
): ReturnType<typeof renderSimpleResult> {
|
|
35
|
-
return renderSimpleResult(result, options, theme, "Inspecting…");
|
|
43
|
+
return renderSimpleResult(result, options, theme, "Inspecting…", context);
|
|
36
44
|
}
|
|
@@ -7,7 +7,11 @@ import type {
|
|
|
7
7
|
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
8
8
|
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
9
9
|
import { contextErrorResult } from "../result/errors.ts";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
assembleOrientationDetails,
|
|
12
|
+
assembleOrientationResult,
|
|
13
|
+
orientationCandidateDisplaySections,
|
|
14
|
+
} from "../result/orientation.ts";
|
|
11
15
|
import { renderOrientationResult } from "./markdown.ts";
|
|
12
16
|
|
|
13
17
|
export interface CodeOrientationToolParams {
|
|
@@ -27,6 +31,7 @@ export async function executeOrientationTool(
|
|
|
27
31
|
if (outcome.kind === "invalid-input") {
|
|
28
32
|
return contextErrorResult(`**Error:** ${outcome.message}`, {
|
|
29
33
|
nextQueries: ["Choose an existing path, module, or precise target"],
|
|
34
|
+
message: outcome.message,
|
|
30
35
|
});
|
|
31
36
|
}
|
|
32
37
|
if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
|
|
@@ -52,11 +57,24 @@ export async function executeOrientationTool(
|
|
|
52
57
|
candidates,
|
|
53
58
|
nextQueries,
|
|
54
59
|
});
|
|
55
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
content: lines.join("\n"),
|
|
62
|
+
details: {
|
|
63
|
+
type: "context",
|
|
64
|
+
data: details,
|
|
65
|
+
status: "completed",
|
|
66
|
+
displaySections: orientationCandidateDisplaySections(candidates, outcome.omittedCount),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
56
69
|
}
|
|
57
70
|
const assembly = assembleOrientationResult(outcome.data);
|
|
58
71
|
return {
|
|
59
72
|
content: renderOrientationResult(assembly),
|
|
60
|
-
details: {
|
|
73
|
+
details: {
|
|
74
|
+
type: "context",
|
|
75
|
+
data: assembly.details,
|
|
76
|
+
status: "completed",
|
|
77
|
+
displaySections: assembly.displaySections,
|
|
78
|
+
},
|
|
61
79
|
};
|
|
62
80
|
}
|
|
@@ -1,63 +1,79 @@
|
|
|
1
|
+
/** TUI renderer for code_orientation. */
|
|
1
2
|
import { getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
3
|
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
3
4
|
import {
|
|
4
5
|
type EvidenceEntry,
|
|
6
|
+
formatCallPath,
|
|
7
|
+
formatCallValue,
|
|
5
8
|
formatEvidenceEntry,
|
|
6
9
|
type ResultOptios,
|
|
7
10
|
readEvidenceEntries,
|
|
11
|
+
renderDomainError,
|
|
12
|
+
renderDomainResult,
|
|
13
|
+
renderExecutionError,
|
|
8
14
|
renderPartial,
|
|
15
|
+
renderStructuredDetailBody,
|
|
16
|
+
renderToolDisplaySections,
|
|
17
|
+
renderTruncationDisclosure,
|
|
18
|
+
type ToolRendererContext,
|
|
9
19
|
type ToolResult,
|
|
10
20
|
} from "../../ui/tui/common.ts";
|
|
11
21
|
import type { CodeOrientationToolParams } from "./execute.ts";
|
|
12
22
|
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
/** Render the compact code_orientation call header. */
|
|
24
|
+
export function renderOrientationCall(
|
|
25
|
+
args: unknown,
|
|
26
|
+
theme: Theme,
|
|
27
|
+
_context: ToolRendererContext | undefined,
|
|
28
|
+
): Text {
|
|
29
|
+
const params = (args ?? {}) as Partial<CodeOrientationToolParams>;
|
|
18
30
|
let content = theme.fg("toolTitle", "code_orientation");
|
|
31
|
+
const focus = params.focus;
|
|
19
32
|
|
|
20
|
-
if (!
|
|
33
|
+
if (!focus || typeof focus !== "object") {
|
|
21
34
|
content += ` ${theme.fg("muted", "workspace")}`;
|
|
22
|
-
} else if ("path" in
|
|
23
|
-
const
|
|
24
|
-
content += ` ${theme.fg("accent",
|
|
25
|
-
} else if ("module" in
|
|
26
|
-
content += ` ${theme.fg("accent",
|
|
27
|
-
} else {
|
|
35
|
+
} else if ("path" in focus) {
|
|
36
|
+
const path = formatCallPath(focus.path);
|
|
37
|
+
content += ` ${theme.fg("accent", path ?? "path?")}`;
|
|
38
|
+
} else if ("module" in focus) {
|
|
39
|
+
content += ` ${theme.fg("accent", formatCallValue(focus.module) ?? "module?")}`;
|
|
40
|
+
} else if ("target" in focus) {
|
|
28
41
|
content += ` ${theme.fg("accent", "target")}`;
|
|
29
42
|
}
|
|
30
43
|
|
|
31
44
|
return new Text(content, 0, 0);
|
|
32
45
|
}
|
|
33
46
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
47
|
+
/** Render code_orientation progress, status, and structured result details. */
|
|
36
48
|
export function renderOrientationResult(
|
|
37
49
|
result: ToolResult,
|
|
38
50
|
options: ResultOptios,
|
|
39
51
|
theme: Theme,
|
|
40
|
-
|
|
52
|
+
context: ToolRendererContext | undefined,
|
|
41
53
|
): Container | Text {
|
|
42
|
-
if (options.isPartial)
|
|
43
|
-
return renderPartial("Orienting…", theme);
|
|
44
|
-
}
|
|
54
|
+
if (options.isPartial) return renderPartial("Orienting…", theme);
|
|
45
55
|
|
|
46
|
-
const container = new Container();
|
|
47
56
|
const data =
|
|
48
57
|
result.details?.type === "context" ? (result.details.data as Record<string, unknown>) : null;
|
|
49
58
|
const markdownText = result.content.find((c) => c.type === "text")?.text ?? "";
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
const executionError = renderExecutionError(context, "code_orientation failed", theme);
|
|
61
|
+
if (executionError) return executionError;
|
|
62
|
+
const domainError = renderDomainError(result, theme);
|
|
63
|
+
if (domainError) return renderDomainResult(result, options, theme, domainError);
|
|
55
64
|
|
|
56
65
|
if (!options.expanded) {
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
const compact = buildCompactSummary(data, theme);
|
|
67
|
+
const truncation = renderTruncationDisclosure(result, theme);
|
|
68
|
+
if (!truncation) return compact;
|
|
69
|
+
const compactContainer = new Container();
|
|
70
|
+
compactContainer.addChild(compact);
|
|
71
|
+
compactContainer.addChild(new Spacer(1));
|
|
72
|
+
compactContainer.addChild(truncation);
|
|
73
|
+
return compactContainer;
|
|
59
74
|
}
|
|
60
75
|
|
|
76
|
+
const container = new Container();
|
|
61
77
|
container.addChild(buildHeader(data, theme));
|
|
62
78
|
|
|
63
79
|
const target = data?.target as Record<string, unknown> | undefined;
|
|
@@ -67,7 +83,7 @@ export function renderOrientationResult(
|
|
|
67
83
|
new Text(
|
|
68
84
|
theme.fg(
|
|
69
85
|
"muted",
|
|
70
|
-
`${
|
|
86
|
+
`${formatCallValue(target.name) ?? "symbol"} — ${formatCallPath(target.file) ?? ""}:${String(target.displayLine ?? "")}`,
|
|
71
87
|
),
|
|
72
88
|
0,
|
|
73
89
|
0,
|
|
@@ -75,10 +91,13 @@ export function renderOrientationResult(
|
|
|
75
91
|
);
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
94
|
+
renderToolDisplaySections(container, result.details?.displaySections, theme);
|
|
95
|
+
renderStructuredDetailBody(container, data ?? undefined, theme);
|
|
96
|
+
|
|
97
|
+
const truncation = renderTruncationDisclosure(result, theme);
|
|
98
|
+
if (truncation) {
|
|
80
99
|
container.addChild(new Spacer(1));
|
|
81
|
-
container.addChild(
|
|
100
|
+
container.addChild(truncation);
|
|
82
101
|
}
|
|
83
102
|
|
|
84
103
|
if (markdownText) {
|
|
@@ -90,8 +109,6 @@ export function renderOrientationResult(
|
|
|
90
109
|
return container;
|
|
91
110
|
}
|
|
92
111
|
|
|
93
|
-
/** ── Helpers ───────────────────────────────────────────────────── */
|
|
94
|
-
|
|
95
112
|
function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme): Text {
|
|
96
113
|
if (!data) return new Text(theme.fg("dim", "No orientation"), 0, 0);
|
|
97
114
|
|
|
@@ -112,9 +129,7 @@ function summarySegments(
|
|
|
112
129
|
): string[] {
|
|
113
130
|
const segments: string[] = [];
|
|
114
131
|
const evidence = orientationEvidence(data);
|
|
115
|
-
if (evidence)
|
|
116
|
-
segments.push(theme.fg(badgeColor, theme.bold(formatEvidenceEntry(evidence))));
|
|
117
|
-
}
|
|
132
|
+
if (evidence) segments.push(theme.fg(badgeColor, theme.bold(formatEvidenceEntry(evidence))));
|
|
118
133
|
|
|
119
134
|
const confidence = typeof data.confidence === "string" ? data.confidence : "";
|
|
120
135
|
if (confidence && confidence !== "unavailable") {
|
|
@@ -122,7 +137,8 @@ function summarySegments(
|
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
const target = data.target as Record<string, unknown> | undefined;
|
|
125
|
-
|
|
140
|
+
const targetName = formatCallValue(target?.name);
|
|
141
|
+
if (targetName) segments.push(theme.fg("muted", targetName));
|
|
126
142
|
|
|
127
143
|
return segments;
|
|
128
144
|
}
|
|
@@ -19,6 +19,7 @@ export async function executeRefactorApplyTool(
|
|
|
19
19
|
if (outcome.kind === "invalid-input") {
|
|
20
20
|
return searchErrorResult(`**Error:** ${outcome.message}`, {
|
|
21
21
|
nextQueries: ["Generate a fresh plan with code_refactor_plan"],
|
|
22
|
+
message: outcome.message,
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -28,6 +29,8 @@ export async function executeRefactorApplyTool(
|
|
|
28
29
|
details: {
|
|
29
30
|
type: "search",
|
|
30
31
|
data: assembly.details,
|
|
32
|
+
status: "completed",
|
|
33
|
+
displaySections: assembly.displaySections,
|
|
31
34
|
},
|
|
32
35
|
};
|
|
33
36
|
}
|