@prestyj/cli 4.2.56 → 4.2.75
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 +1 -1
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -5
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +11 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compactor.d.ts +3 -1
- package/dist/core/compaction/compactor.d.ts.map +1 -1
- package/dist/core/compaction/compactor.js +28 -5
- package/dist/core/compaction/compactor.js.map +1 -1
- package/dist/core/compaction/compactor.test.js +86 -10
- package/dist/core/compaction/compactor.test.js.map +1 -1
- package/dist/core/compaction/token-estimator.test.js +1 -1
- package/dist/core/compaction/token-estimator.test.js.map +1 -1
- package/dist/core/model-registry.js +8 -8
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +2 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +18 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/telegram.d.ts.map +1 -1
- package/dist/core/telegram.js +3 -0
- package/dist/core/telegram.js.map +1 -1
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +1 -0
- package/dist/interactive.js.map +1 -1
- package/dist/system-prompt.d.ts.map +1 -1
- package/dist/system-prompt.js +21 -3
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +4 -7
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +4 -1
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/overflow.d.ts +6 -0
- package/dist/tools/overflow.d.ts.map +1 -0
- package/dist/tools/overflow.js +13 -0
- package/dist/tools/overflow.js.map +1 -0
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +6 -2
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/truncate-utils.test.js +11 -11
- package/dist/tools/truncate-utils.test.js.map +1 -1
- package/dist/tools/truncate.d.ts +6 -4
- package/dist/tools/truncate.d.ts.map +1 -1
- package/dist/tools/truncate.js +12 -10
- package/dist/tools/truncate.js.map +1 -1
- package/dist/ui/App.d.ts +1 -0
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +261 -62
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/buddy/Buddy.d.ts +15 -0
- package/dist/ui/buddy/Buddy.d.ts.map +1 -0
- package/dist/ui/buddy/Buddy.js +118 -0
- package/dist/ui/buddy/Buddy.js.map +1 -0
- package/dist/ui/buddy/gacha.d.ts +8 -0
- package/dist/ui/buddy/gacha.d.ts.map +1 -0
- package/dist/ui/buddy/gacha.js +94 -0
- package/dist/ui/buddy/gacha.js.map +1 -0
- package/dist/ui/buddy/species.d.ts +52 -0
- package/dist/ui/buddy/species.d.ts.map +1 -0
- package/dist/ui/buddy/species.js +257 -0
- package/dist/ui/buddy/species.js.map +1 -0
- package/dist/ui/components/ActivityIndicator.d.ts +10 -2
- package/dist/ui/components/ActivityIndicator.d.ts.map +1 -1
- package/dist/ui/components/ActivityIndicator.js +79 -22
- package/dist/ui/components/ActivityIndicator.js.map +1 -1
- package/dist/ui/components/AnimationContext.d.ts +14 -2
- package/dist/ui/components/AnimationContext.d.ts.map +1 -1
- package/dist/ui/components/AnimationContext.js +54 -8
- package/dist/ui/components/AnimationContext.js.map +1 -1
- package/dist/ui/components/AssistantMessage.d.ts +2 -1
- package/dist/ui/components/AssistantMessage.d.ts.map +1 -1
- package/dist/ui/components/AssistantMessage.js +5 -4
- package/dist/ui/components/AssistantMessage.js.map +1 -1
- package/dist/ui/components/BackgroundTasksBar.js +2 -2
- package/dist/ui/components/BackgroundTasksBar.js.map +1 -1
- package/dist/ui/components/CompactionNotice.d.ts.map +1 -1
- package/dist/ui/components/CompactionNotice.js +2 -1
- package/dist/ui/components/CompactionNotice.js.map +1 -1
- package/dist/ui/components/Footer.d.ts +3 -1
- package/dist/ui/components/Footer.d.ts.map +1 -1
- package/dist/ui/components/Footer.js +23 -48
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/ui/components/InputArea.d.ts.map +1 -1
- package/dist/ui/components/InputArea.js +2 -1
- package/dist/ui/components/InputArea.js.map +1 -1
- package/dist/ui/components/Markdown.d.ts +11 -6
- package/dist/ui/components/Markdown.d.ts.map +1 -1
- package/dist/ui/components/Markdown.js +170 -18
- package/dist/ui/components/Markdown.js.map +1 -1
- package/dist/ui/components/MessageResponse.d.ts +25 -0
- package/dist/ui/components/MessageResponse.d.ts.map +1 -0
- package/dist/ui/components/MessageResponse.js +42 -0
- package/dist/ui/components/MessageResponse.js.map +1 -0
- package/dist/ui/components/NoSelect.d.ts +20 -0
- package/dist/ui/components/NoSelect.d.ts.map +1 -0
- package/dist/ui/components/NoSelect.js +14 -0
- package/dist/ui/components/NoSelect.js.map +1 -0
- package/dist/ui/components/PlanProgress.d.ts +7 -0
- package/dist/ui/components/PlanProgress.d.ts.map +1 -0
- package/dist/ui/components/PlanProgress.js +30 -0
- package/dist/ui/components/PlanProgress.js.map +1 -0
- package/dist/ui/components/Ratchet.d.ts +20 -0
- package/dist/ui/components/Ratchet.d.ts.map +1 -0
- package/dist/ui/components/Ratchet.js +30 -0
- package/dist/ui/components/Ratchet.js.map +1 -0
- package/dist/ui/components/ServerToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ServerToolExecution.js +5 -6
- package/dist/ui/components/ServerToolExecution.js.map +1 -1
- package/dist/ui/components/Spinner.d.ts +8 -2
- package/dist/ui/components/Spinner.d.ts.map +1 -1
- package/dist/ui/components/Spinner.js +52 -5
- package/dist/ui/components/Spinner.js.map +1 -1
- package/dist/ui/components/StreamingArea.d.ts +2 -1
- package/dist/ui/components/StreamingArea.d.ts.map +1 -1
- package/dist/ui/components/StreamingArea.js +9 -44
- package/dist/ui/components/StreamingArea.js.map +1 -1
- package/dist/ui/components/SubAgentPanel.d.ts.map +1 -1
- package/dist/ui/components/SubAgentPanel.js +6 -4
- package/dist/ui/components/SubAgentPanel.js.map +1 -1
- package/dist/ui/components/ThinkingBlock.d.ts +2 -1
- package/dist/ui/components/ThinkingBlock.d.ts.map +1 -1
- package/dist/ui/components/ThinkingBlock.js +2 -2
- package/dist/ui/components/ThinkingBlock.js.map +1 -1
- package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -1
- package/dist/ui/components/ThinkingIndicator.js +2 -1
- package/dist/ui/components/ThinkingIndicator.js.map +1 -1
- package/dist/ui/components/ToolExecution.d.ts +1 -0
- package/dist/ui/components/ToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolExecution.js +44 -15
- package/dist/ui/components/ToolExecution.js.map +1 -1
- package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolGroupExecution.js +21 -17
- package/dist/ui/components/ToolGroupExecution.js.map +1 -1
- package/dist/ui/components/ToolUseLoader.d.ts +19 -0
- package/dist/ui/components/ToolUseLoader.d.ts.map +1 -0
- package/dist/ui/components/ToolUseLoader.js +42 -0
- package/dist/ui/components/ToolUseLoader.js.map +1 -0
- package/dist/ui/components/index.d.ts +1 -1
- package/dist/ui/components/index.d.ts.map +1 -1
- package/dist/ui/components/index.js +1 -1
- package/dist/ui/components/index.js.map +1 -1
- package/dist/ui/constants/figures.d.ts +30 -0
- package/dist/ui/constants/figures.d.ts.map +1 -0
- package/dist/ui/constants/figures.js +41 -0
- package/dist/ui/constants/figures.js.map +1 -0
- package/dist/ui/hooks/useAgentLoop.d.ts +16 -1
- package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentLoop.js +49 -141
- package/dist/ui/hooks/useAgentLoop.js.map +1 -1
- package/dist/ui/hooks/useBlink.d.ts +11 -0
- package/dist/ui/hooks/useBlink.d.ts.map +1 -0
- package/dist/ui/hooks/useBlink.js +19 -0
- package/dist/ui/hooks/useBlink.js.map +1 -0
- package/dist/ui/hooks/useMinDisplayTime.d.ts +11 -0
- package/dist/ui/hooks/useMinDisplayTime.d.ts.map +1 -0
- package/dist/ui/hooks/useMinDisplayTime.js +34 -0
- package/dist/ui/hooks/useMinDisplayTime.js.map +1 -0
- package/dist/ui/hooks/useTerminalProgress.d.ts +2 -0
- package/dist/ui/hooks/useTerminalProgress.d.ts.map +1 -0
- package/dist/ui/hooks/useTerminalProgress.js +98 -0
- package/dist/ui/hooks/useTerminalProgress.js.map +1 -0
- package/dist/ui/hooks/useTerminalTitle.d.ts.map +1 -1
- package/dist/ui/hooks/useTerminalTitle.js +2 -1
- package/dist/ui/hooks/useTerminalTitle.js.map +1 -1
- package/dist/ui/spinner-frames.d.ts +1 -0
- package/dist/ui/spinner-frames.d.ts.map +1 -1
- package/dist/ui/spinner-frames.js +15 -5
- package/dist/ui/spinner-frames.js.map +1 -1
- package/dist/ui/theme/dark.json +2 -1
- package/dist/ui/theme/light.json +2 -1
- package/dist/ui/theme/theme.d.ts +1 -0
- package/dist/ui/theme/theme.d.ts.map +1 -1
- package/dist/ui/utils/markdown-cache.d.ts +12 -0
- package/dist/ui/utils/markdown-cache.d.ts.map +1 -0
- package/dist/ui/utils/markdown-cache.js +43 -0
- package/dist/ui/utils/markdown-cache.js.map +1 -0
- package/dist/ui/utils/word-diff.d.ts +11 -0
- package/dist/ui/utils/word-diff.d.ts.map +1 -0
- package/dist/ui/utils/word-diff.js +23 -0
- package/dist/ui/utils/word-diff.js.map +1 -0
- package/dist/utils/plan-steps.d.ts +41 -0
- package/dist/utils/plan-steps.d.ts.map +1 -0
- package/dist/utils/plan-steps.js +91 -0
- package/dist/utils/plan-steps.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface SpinnerProps {
|
|
2
2
|
label?: string;
|
|
3
|
-
|
|
3
|
+
/** When true, the spinner transitions to the error/red color. */
|
|
4
|
+
isStalled?: boolean;
|
|
5
|
+
/** How long (in ms) the spinner has been stalled. Controls transition speed. */
|
|
6
|
+
stallDurationMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function Spinner({ label, isStalled, stallDurationMs }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
4
10
|
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Spinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Spinner.tsx"],"names":[],"mappings":"AAyCA,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,eAAmB,EAAE,EAAE,YAAY,2CA0C9E"}
|
|
@@ -1,13 +1,60 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
3
|
import { Text } from "ink";
|
|
4
4
|
import { useTheme } from "../theme/theme.js";
|
|
5
|
-
import { SPINNER_FRAMES, SPINNER_INTERVAL } from "../spinner-frames.js";
|
|
6
|
-
import { useAnimationTick, deriveFrame } from "./AnimationContext.js";
|
|
7
|
-
|
|
5
|
+
import { SPINNER_FRAMES, SPINNER_INTERVAL, REDUCED_MOTION_DOT } from "../spinner-frames.js";
|
|
6
|
+
import { useAnimationTick, useAnimationActive, deriveFrame, useReducedMotion, TICK_INTERVAL, } from "./AnimationContext.js";
|
|
7
|
+
// Claude Code's error red for stall interpolation
|
|
8
|
+
const ERROR_RED = { r: 171, g: 43, b: 63 };
|
|
9
|
+
/**
|
|
10
|
+
* Parse a hex color string to RGB components.
|
|
11
|
+
*/
|
|
12
|
+
function parseHex(hex) {
|
|
13
|
+
const h = hex.replace("#", "");
|
|
14
|
+
return {
|
|
15
|
+
r: parseInt(h.slice(0, 2), 16),
|
|
16
|
+
g: parseInt(h.slice(2, 4), 16),
|
|
17
|
+
b: parseInt(h.slice(4, 6), 16),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Interpolate between two RGB colors by ratio t (0–1).
|
|
22
|
+
*/
|
|
23
|
+
function interpolateColor(a, b, t) {
|
|
24
|
+
const r = Math.round(a.r + (b.r - a.r) * t);
|
|
25
|
+
const g = Math.round(a.g + (b.g - a.g) * t);
|
|
26
|
+
const bl = Math.round(a.b + (b.b - a.b) * t);
|
|
27
|
+
return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${bl.toString(16).padStart(2, "0")}`;
|
|
28
|
+
}
|
|
29
|
+
export function Spinner({ label, isStalled, stallDurationMs = 0 }) {
|
|
8
30
|
const theme = useTheme();
|
|
31
|
+
const reducedMotion = useReducedMotion();
|
|
32
|
+
useAnimationActive();
|
|
9
33
|
const tick = useAnimationTick();
|
|
34
|
+
// Smoothed stall intensity via exponential lerp (matches CC: 0.1 step)
|
|
35
|
+
const intensityRef = useRef(0);
|
|
36
|
+
if (reducedMotion) {
|
|
37
|
+
// Static filled circle with slow dim/undim cycle (2s)
|
|
38
|
+
const dimCycle = Math.floor((tick * TICK_INTERVAL) / 1000) % 2;
|
|
39
|
+
return (_jsxs(Text, { color: theme.text, dimColor: dimCycle === 1, children: [REDUCED_MOTION_DOT, " ", label && _jsx(Text, { dimColor: true, children: label })] }));
|
|
40
|
+
}
|
|
10
41
|
const frame = deriveFrame(tick, SPINNER_INTERVAL, SPINNER_FRAMES.length);
|
|
11
|
-
|
|
42
|
+
// Stall color interpolation:
|
|
43
|
+
// - Stall starts after 3000ms of no tokens
|
|
44
|
+
// - Intensity ramps from 0 to 1 over the next 2000ms
|
|
45
|
+
// - Smoothed with 0.1 lerp steps
|
|
46
|
+
let color = theme.spinnerColor;
|
|
47
|
+
if (isStalled && stallDurationMs > 3000) {
|
|
48
|
+
const rawIntensity = Math.min((stallDurationMs - 3000) / 2000, 1);
|
|
49
|
+
const diff = rawIntensity - intensityRef.current;
|
|
50
|
+
intensityRef.current += diff * 0.1;
|
|
51
|
+
const baseRGB = parseHex(theme.spinnerColor);
|
|
52
|
+
color = interpolateColor(baseRGB, ERROR_RED, intensityRef.current);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Decay back toward 0 when not stalled
|
|
56
|
+
intensityRef.current *= 0.9;
|
|
57
|
+
}
|
|
58
|
+
return (_jsxs(Text, { color: color, wrap: "wrap", children: [SPINNER_FRAMES[frame], " ", label && _jsx(Text, { dimColor: true, children: label })] }));
|
|
12
59
|
}
|
|
13
60
|
//# sourceMappingURL=Spinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../src/ui/components/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../src/ui/components/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EACL,gBAAgB,EAChB,kBAAk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eAAe,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;QAClE,MAAM,IAAI,GAAG,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC;QACjD,YAAY,CAAC,OAAO,IAAI,IAAI,GAAG,GAAG,CAAC;QACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;SAAM,CAAC;QACN,uCAAuC;QACvC,YAAY,CAAC,OAAO,IAAI,GAAG,CAAC;IAC9B,CAAC;IAED,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,aAC5B,cAAc,CAAC,KAAK,CAAC,OAAG,KAAK,IAAI,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,GAAQ,IAC1D,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface StreamingAreaProps {
|
|
2
3
|
isRunning: boolean;
|
|
3
4
|
streamingText: string;
|
|
@@ -6,6 +7,6 @@ interface StreamingAreaProps {
|
|
|
6
7
|
thinkingMs?: number;
|
|
7
8
|
planMode?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare
|
|
10
|
+
export declare const StreamingArea: React.NamedExoticComponent<StreamingAreaProps>;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=StreamingArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingArea.d.ts","sourceRoot":"","sources":["../../../src/ui/components/StreamingArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StreamingArea.d.ts","sourceRoot":"","sources":["../../../src/ui/components/StreamingArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAY7C,UAAU,kBAAkB;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,gDA6CxB,CAAC"}
|
|
@@ -1,54 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { memo, useMemo } from "react";
|
|
3
3
|
import { Text, Box } from "ink";
|
|
4
4
|
import { useTheme } from "../theme/theme.js";
|
|
5
|
-
import {
|
|
5
|
+
import { StreamingMarkdown } from "./Markdown.js";
|
|
6
6
|
import { ThinkingBlock } from "./ThinkingBlock.js";
|
|
7
7
|
import { useTerminalSize } from "../hooks/useTerminalSize.js";
|
|
8
|
-
|
|
8
|
+
import { stripDoneMarkers } from "../../utils/plan-steps.js";
|
|
9
|
+
import { BLACK_CIRCLE, PLAN_SYMBOL } from "../constants/figures.js";
|
|
10
|
+
// BLACK_CIRCLE + " " = 2 chars
|
|
9
11
|
const PREFIX_WIDTH = 2;
|
|
10
|
-
export function StreamingArea({ isRunning, streamingText, streamingThinking, showThinking = true, thinkingMs, planMode, }) {
|
|
12
|
+
export const StreamingArea = memo(function StreamingArea({ isRunning, streamingText, streamingThinking, showThinking = true, thinkingMs, planMode, }) {
|
|
11
13
|
const theme = useTheme();
|
|
12
14
|
const { columns } = useTerminalSize();
|
|
13
15
|
const contentWidth = Math.max(10, columns - PREFIX_WIDTH);
|
|
14
|
-
|
|
15
|
-
// While text streams, the reveal animation already provides visual feedback,
|
|
16
|
-
// so we show a static cursor and avoid the extra re-renders from blinking.
|
|
17
|
-
const [cursorVisible, setCursorVisible] = useState(true);
|
|
18
|
-
const prevTextRef = useRef(streamingText);
|
|
19
|
-
const staleTimerRef = useRef(null);
|
|
20
|
-
// Track whether text is actively changing. The stale flag is promoted to
|
|
21
|
-
// React state so it can gate the blink interval — when text is actively
|
|
22
|
-
// streaming we skip the blink entirely (no interval running = no extra
|
|
23
|
-
// re-renders).
|
|
24
|
-
const [textStale, setTextStale] = useState(false);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (streamingText !== prevTextRef.current) {
|
|
27
|
-
prevTextRef.current = streamingText;
|
|
28
|
-
// Only trigger a re-render if we're transitioning from stale → active
|
|
29
|
-
if (textStale)
|
|
30
|
-
setTextStale(false);
|
|
31
|
-
if (staleTimerRef.current)
|
|
32
|
-
clearTimeout(staleTimerRef.current);
|
|
33
|
-
staleTimerRef.current = setTimeout(() => {
|
|
34
|
-
setTextStale(true);
|
|
35
|
-
}, 600);
|
|
36
|
-
}
|
|
37
|
-
return () => {
|
|
38
|
-
if (staleTimerRef.current)
|
|
39
|
-
clearTimeout(staleTimerRef.current);
|
|
40
|
-
};
|
|
41
|
-
}, [streamingText]); // textStale intentionally omitted — we only read it to gate the setState
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!isRunning || !textStale) {
|
|
44
|
-
setCursorVisible(true);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const timer = setInterval(() => {
|
|
48
|
-
setCursorVisible((v) => !v);
|
|
49
|
-
}, 800);
|
|
50
|
-
return () => clearInterval(timer);
|
|
51
|
-
}, [isRunning, textStale]);
|
|
16
|
+
const displayText = useMemo(() => (streamingText ? stripDoneMarkers(streamingText) : ""), [streamingText]);
|
|
52
17
|
// Return null when there is nothing to display. Previously this kept an
|
|
53
18
|
// empty <Box marginTop={1}> alive while isRunning was true, adding phantom
|
|
54
19
|
// height to Ink's live area. When isRunning later flipped to false in a
|
|
@@ -58,6 +23,6 @@ export function StreamingArea({ isRunning, streamingText, streamingThinking, sho
|
|
|
58
23
|
return null;
|
|
59
24
|
if (!isRunning && !streamingText)
|
|
60
25
|
return null;
|
|
61
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [showThinking && streamingThinking && (_jsx(ThinkingBlock, { text: streamingThinking, streaming: true, durationMs: thinkingMs })),
|
|
62
|
-
}
|
|
26
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [showThinking && streamingThinking && (_jsx(ThinkingBlock, { text: streamingThinking, streaming: true, durationMs: thinkingMs })), displayText && (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: PREFIX_WIDTH, flexShrink: 0, children: _jsx(Text, { color: planMode ? theme.planPrimary : theme.primary, children: planMode ? PLAN_SYMBOL + " " : BLACK_CIRCLE + " " }) }), _jsx(Box, { flexDirection: "column", flexGrow: 1, width: contentWidth, children: _jsx(StreamingMarkdown, { width: contentWidth, children: displayText.trimStart() }) })] }))] }));
|
|
27
|
+
});
|
|
63
28
|
//# sourceMappingURL=StreamingArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingArea.js","sourceRoot":"","sources":["../../../src/ui/components/StreamingArea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"StreamingArea.js","sourceRoot":"","sources":["../../../src/ui/components/StreamingArea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBA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AC,OAAO,YACtD,QAAQ,CAAC,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,GAC7C,GACH,EACN,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,YAE1D,KAAC,iBAAiB,IAAC,KAAK,EAAE,YAAY,YAAG,WAAW,CAAC,SAAS,EAAE,GAAqB,GACjF,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubAgentPanel.d.ts","sourceRoot":"","sources":["../../../src/ui/components/SubAgentPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubAgentPanel.d.ts","sourceRoot":"","sources":["../../../src/ui/components/SubAgentPanel.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA6HD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAe,EAAE,EAAE,kBAAkB,kDAuC5E"}
|
|
@@ -3,8 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { Text, Box } from "ink";
|
|
4
4
|
import { useTheme } from "../theme/theme.js";
|
|
5
5
|
import { SPINNER_FRAMES, SPINNER_INTERVAL } from "../spinner-frames.js";
|
|
6
|
-
import { useAnimationTick, deriveFrame } from "./AnimationContext.js";
|
|
6
|
+
import { useAnimationTick, useAnimationActive, deriveFrame } from "./AnimationContext.js";
|
|
7
7
|
import { useTerminalSize } from "../hooks/useTerminalSize.js";
|
|
8
|
+
import { ToolUseLoader } from "./ToolUseLoader.js";
|
|
8
9
|
function formatTokens(n) {
|
|
9
10
|
if (n >= 1_000_000)
|
|
10
11
|
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
@@ -28,6 +29,7 @@ const AgentRow = React.memo(function AgentRow({ agent, isLast, aborted, columns,
|
|
|
28
29
|
const theme = useTheme();
|
|
29
30
|
const isRunning = agent.status === "running" && !aborted;
|
|
30
31
|
// Derive spinner frame from global animation tick
|
|
32
|
+
useAnimationActive();
|
|
31
33
|
const tick = useAnimationTick();
|
|
32
34
|
const frame = deriveFrame(tick, SPINNER_INTERVAL, SPINNER_FRAMES.length);
|
|
33
35
|
const branch = isLast ? "└─" : "├─";
|
|
@@ -62,13 +64,12 @@ const AgentRow = React.memo(function AgentRow({ agent, isLast, aborted, columns,
|
|
|
62
64
|
return false;
|
|
63
65
|
});
|
|
64
66
|
export function SubAgentPanel({ agents, aborted = false }) {
|
|
65
|
-
const theme = useTheme();
|
|
66
67
|
const { columns } = useTerminalSize();
|
|
67
68
|
if (agents.length === 0)
|
|
68
69
|
return null;
|
|
69
70
|
const runningCount = agents.filter((a) => a.status === "running").length;
|
|
70
71
|
const allDone = runningCount === 0;
|
|
71
|
-
//
|
|
72
|
+
// ToolUseLoader minWidth={2} = 2 chars
|
|
72
73
|
const HEADER_PREFIX = 2;
|
|
73
74
|
const contentColumns = Math.max(10, columns - HEADER_PREFIX);
|
|
74
75
|
const headerText = aborted
|
|
@@ -76,6 +77,7 @@ export function SubAgentPanel({ agents, aborted = false }) {
|
|
|
76
77
|
: allDone
|
|
77
78
|
? `${agents.length} agent${agents.length !== 1 ? "s" : ""} completed`
|
|
78
79
|
: `${agents.length} agent${agents.length !== 1 ? "s" : ""} launched`;
|
|
79
|
-
|
|
80
|
+
const dotStatus = aborted ? "error" : allDone ? "done" : "running";
|
|
81
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(ToolUseLoader, { status: dotStatus }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, width: contentColumns, children: [_jsx(Text, { bold: true, wrap: "wrap", children: headerText }), agents.map((agent, i) => (_jsx(AgentRow, { agent: agent, isLast: i === agents.length - 1, aborted: aborted, columns: contentColumns }, agent.toolCallId)))] })] }));
|
|
80
82
|
}
|
|
81
83
|
//# sourceMappingURL=SubAgentPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubAgentPanel.js","sourceRoot":"","sources":["../../../src/ui/components/SubAgentPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SubAgentPanel.js","sourceRoot":"","sources":["../../../src/ui/components/SubAgentPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,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AAQ,IAEP,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,IAJlB,KAAK,CAAC,UAAU,CAKrB,CACH,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface ThinkingBlockProps {
|
|
2
3
|
text: string;
|
|
3
4
|
durationMs?: number;
|
|
@@ -6,6 +7,6 @@ interface ThinkingBlockProps {
|
|
|
6
7
|
/** Start collapsed (default true for completed, ignored when streaming) */
|
|
7
8
|
defaultCollapsed?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare
|
|
10
|
+
export declare const ThinkingBlock: React.NamedExoticComponent<ThinkingBlockProps>;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=ThinkingBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingBlock.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ThinkingBlock.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThinkingBlock.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ThinkingBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAaD,eAAO,MAAM,aAAa,gDAkExB,CAAC"}
|
|
@@ -12,7 +12,7 @@ function formatThinkingDuration(ms) {
|
|
|
12
12
|
}
|
|
13
13
|
const ACCENT_COLOR = "#818cf8";
|
|
14
14
|
const BORDER_COLOR = "#4b5563";
|
|
15
|
-
export function ThinkingBlock({ text, durationMs, streaming = false, defaultCollapsed = true, }) {
|
|
15
|
+
export const ThinkingBlock = React.memo(function ThinkingBlock({ text, durationMs, streaming = false, defaultCollapsed = true, }) {
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const [collapsed, setCollapsed] = useState(!streaming && defaultCollapsed);
|
|
18
18
|
// When streaming finishes (streaming goes from true to false), auto-collapse
|
|
@@ -39,5 +39,5 @@ export function ThinkingBlock({ text, durationMs, streaming = false, defaultColl
|
|
|
39
39
|
const showContent = !streaming && !collapsed;
|
|
40
40
|
const chevron = showContent ? " ▼" : " ▶";
|
|
41
41
|
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: ACCENT_COLOR, children: "💭 " }), _jsx(Text, { color: theme.textMuted, italic: true, children: headerText }), !streaming && _jsx(Text, { color: theme.textDim, children: chevron })] }), showContent && (_jsx(Box, { marginLeft: 1, borderStyle: "single", borderLeft: true, borderRight: false, borderTop: false, borderBottom: false, borderLeftColor: streaming ? ACCENT_COLOR : BORDER_COLOR, paddingLeft: 1, children: _jsx(Text, { color: theme.textDim, wrap: "wrap", children: text }) }))] }));
|
|
42
|
-
}
|
|
42
|
+
});
|
|
43
43
|
//# sourceMappingURL=ThinkingBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingBlock.js","sourceRoot":"","sources":["../../../src/ui/components/ThinkingBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAW7C,SAAS,sBAAsB,CAAC,EAAU;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;I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a,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aAEzC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAE,YAAY,YAAG,KAAK,GAAQ,EACzC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,kBACjC,UAAU,GACN,EACN,CAAC,SAAS,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAAG,OAAO,GAAQ,IACvD,EAGL,WAAW,IAAI,CACd,KAAC,GAAG,IACF,UAAU,EAAE,CAAC,EACb,WAAW,EAAC,QAAQ,EACpB,UAAU,QACV,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,EACnB,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,EACxD,WAAW,EAAE,CAAC,YAEd,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAC,MAAM,YACpC,IAAI,GACA,GACH,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingIndicator.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ThinkingIndicator.tsx"],"names":[],"mappings":"AAgJA,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,WAAgB,EAAE,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ThinkingIndicator.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ThinkingIndicator.tsx"],"names":[],"mappings":"AAgJA,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,WAAgB,EAAE,EAAE,sBAAsB,2CA+B7E"}
|
|
@@ -3,7 +3,7 @@ import React, { useMemo } from "react";
|
|
|
3
3
|
import { Text, Box } from "ink";
|
|
4
4
|
import { useTheme } from "../theme/theme.js";
|
|
5
5
|
import { SPINNER_FRAMES, SPINNER_INTERVAL } from "../spinner-frames.js";
|
|
6
|
-
import { useAnimationTick, deriveFrame } from "./AnimationContext.js";
|
|
6
|
+
import { useAnimationTick, useAnimationActive, deriveFrame } from "./AnimationContext.js";
|
|
7
7
|
// ── Color pulse cycle ─────────────────────────────────────
|
|
8
8
|
const PULSE_COLORS = [
|
|
9
9
|
"#60a5fa", // blue
|
|
@@ -126,6 +126,7 @@ function shuffleArray(arr) {
|
|
|
126
126
|
}
|
|
127
127
|
export function ThinkingIndicator({ userMessage = "" }) {
|
|
128
128
|
const theme = useTheme();
|
|
129
|
+
useAnimationActive();
|
|
129
130
|
const tick = useAnimationTick();
|
|
130
131
|
// Derive all animation frames from the single global tick
|
|
131
132
|
const spinnerFrame = deriveFrame(tick, SPINNER_INTERVAL, SPINNER_FRAMES.length);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingIndicator.js","sourceRoot":"","sources":["../../../src/ui/components/ThinkingIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ThinkingIndicator.js","sourceRoot":"","sources":["../../../src/ui/components/ThinkingIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM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AElE,OAAO,CACL,MAAC,GAAG,eACF,MAAC,IAAI,IAAC,KAAK,EAAE,YAAY,EAAE,IAAI,mBAC5B,cAAc,CAAC,YAAY,CAAC,EAAE,GAAG,IAC7B,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,YAAY,EAAE,IAAI,kBAC5B,MAAM,GACF,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAAG,cAAc,GAAQ,IAC/C,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -9,6 +9,7 @@ interface ToolDoneProps {
|
|
|
9
9
|
args: Record<string, unknown>;
|
|
10
10
|
result: string;
|
|
11
11
|
isError: boolean;
|
|
12
|
+
details?: unknown;
|
|
12
13
|
}
|
|
13
14
|
type ToolExecutionProps = ToolRunningProps | ToolDoneProps;
|
|
14
15
|
export declare function ToolExecution(props: ToolExecutionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolExecution.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ToolExecution.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolExecution.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ToolExecution.tsx"],"names":[],"mappings":"AAwBA,UAAU,gBAAgB;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,kBAAkB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAK3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA8HtD"}
|
|
@@ -3,13 +3,17 @@ import React, { memo } from "react";
|
|
|
3
3
|
import { Text, Box } from "ink";
|
|
4
4
|
import { useTheme } from "../theme/theme.js";
|
|
5
5
|
import { Spinner } from "./Spinner.js";
|
|
6
|
+
import { ToolUseLoader } from "./ToolUseLoader.js";
|
|
7
|
+
import { MessageResponse } from "./MessageResponse.js";
|
|
6
8
|
import { highlightCode, langFromPath } from "../utils/highlight.js";
|
|
7
9
|
import { useTerminalSize } from "../hooks/useTerminalSize.js";
|
|
10
|
+
import { computeWordDiff } from "../utils/word-diff.js";
|
|
11
|
+
import { DASHED_H } from "../constants/figures.js";
|
|
8
12
|
const MAX_OUTPUT_LINES = 4; // max lines shown per tool result
|
|
9
|
-
//
|
|
13
|
+
// ToolUseLoader minWidth={2} = 2 chars
|
|
10
14
|
const HEADER_PREFIX = 2;
|
|
11
|
-
//
|
|
12
|
-
const BODY_PREFIX =
|
|
15
|
+
// MessageResponse gutter: " ⎿ " = 6 chars
|
|
16
|
+
const BODY_PREFIX = 6;
|
|
13
17
|
/** Truncate a line so it fits within ~1 terminal row. */
|
|
14
18
|
function truncateLine(line, cols, reservedChars = 6) {
|
|
15
19
|
const max = cols - reservedChars;
|
|
@@ -21,36 +25,40 @@ export function ToolExecution(props) {
|
|
|
21
25
|
const theme = useTheme();
|
|
22
26
|
const { columns } = useTerminalSize();
|
|
23
27
|
if (props.status === "running") {
|
|
24
|
-
// Compact tools get a summary label
|
|
28
|
+
// Compact tools get a blinking dot + summary label
|
|
25
29
|
if (COMPACT_TOOLS.has(props.name)) {
|
|
26
30
|
const summary = getCompactRunningLabel(props.name, props.args);
|
|
27
|
-
return (
|
|
31
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(ToolUseLoader, { status: "running" }), _jsx(Text, { color: theme.toolName, bold: true, children: summary }), _jsx(Text, { color: theme.textDim, children: " (ctrl+o to expand)" })] }));
|
|
28
32
|
}
|
|
33
|
+
// Non-compact tools keep the sparkle spinner with a blinking dot prefix
|
|
29
34
|
const { label, detail } = getToolHeaderParts(props.name, props.args);
|
|
30
|
-
return (
|
|
35
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(ToolUseLoader, { status: "running" }), _jsx(Spinner, { label: detail ? `${label}(${detail})` : label })] }));
|
|
31
36
|
}
|
|
32
|
-
const { name, args, result, isError } = props;
|
|
37
|
+
const { name, args, result, isError, details } = props;
|
|
33
38
|
const headerContentWidth = Math.max(10, columns - HEADER_PREFIX);
|
|
34
39
|
const bodyContentWidth = Math.max(10, columns - BODY_PREFIX);
|
|
35
40
|
// Compact tools — one-line summary, no output content
|
|
36
41
|
if (COMPACT_TOOLS.has(name) && !isError) {
|
|
37
42
|
const summary = getCompactDoneLabel(name, args, result);
|
|
38
|
-
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(
|
|
43
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(ToolUseLoader, { status: "done" }), _jsx(Box, { flexGrow: 1, width: headerContentWidth, children: _jsx(Text, { bold: true, color: theme.toolName, wrap: "wrap", children: summary }) })] }));
|
|
39
44
|
}
|
|
40
|
-
|
|
45
|
+
// Extract diff from details (structured result) or fall back to result string
|
|
46
|
+
const editDetails = details;
|
|
47
|
+
const diffText = editDetails?.diff ?? (result.includes("---") ? result : undefined);
|
|
48
|
+
const isDiff = name === "edit" && !isError && !!diffText;
|
|
41
49
|
const { label, detail } = getToolHeaderParts(name, args);
|
|
42
50
|
const body = isDiff
|
|
43
|
-
? buildDiffBody(
|
|
51
|
+
? buildDiffBody(diffText, args, columns)
|
|
44
52
|
: buildResultBody(name, result, isError, columns);
|
|
45
53
|
const headerColor = isError ? theme.toolError : theme.toolName;
|
|
46
54
|
// Compact display — no body to show, but show inline summary
|
|
47
55
|
if (!body) {
|
|
48
56
|
const inline = getInlineSummary(name, result, isError);
|
|
49
|
-
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(
|
|
57
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "row", children: [_jsx(ToolUseLoader, { status: isError ? "error" : "done" }), _jsx(Box, { flexGrow: 1, width: headerContentWidth, children: _jsxs(Text, { wrap: "wrap", children: [_jsx(Text, { bold: true, color: headerColor, children: label }), detail && (_jsxs(Text, { color: theme.text, children: ["(", detail, ")"] })), inline && _jsxs(Text, { color: theme.textDim, children: [" ", inline] })] }) })] }));
|
|
50
58
|
}
|
|
51
59
|
const { lines, totalLines } = body;
|
|
52
60
|
const hiddenCount = totalLines - lines.length;
|
|
53
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(
|
|
61
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(ToolUseLoader, { status: isError ? "error" : "done" }), _jsx(Box, { flexGrow: 1, width: headerContentWidth, children: _jsxs(Text, { wrap: "wrap", children: [_jsx(Text, { bold: true, color: headerColor, children: label }), detail && (_jsxs(Text, { color: theme.text, children: ["(", detail, ")"] }))] }) })] }), _jsx(MessageResponse, { children: _jsxs(Box, { flexDirection: "column", children: [lines.map((line, i) => (_jsx(Box, { flexGrow: 1, width: bodyContentWidth, children: line }, i))), hiddenCount > 0 && (_jsxs(Text, { color: theme.textDim, wrap: "wrap", children: ["… +", hiddenCount, " lines (ctrl+o to expand)"] }))] }) })] }));
|
|
54
62
|
}
|
|
55
63
|
// ── Compact tool labels ─────────────────────────────────────
|
|
56
64
|
function getCompactRunningLabel(name, _args) {
|
|
@@ -283,6 +291,17 @@ function buildDiffBody(result, args, _columns) {
|
|
|
283
291
|
const startIdx = Math.max(0, firstChangeIdx - 2);
|
|
284
292
|
const endIdx = Math.min(numbered.length, lastChangeIdx + 3);
|
|
285
293
|
const focused = numbered.slice(startIdx, endIdx);
|
|
294
|
+
// Compute word-level diffs for adjacent remove/add pairs
|
|
295
|
+
for (let i = 0; i < focused.length - 1; i++) {
|
|
296
|
+
if (focused[i].type === "remove" && focused[i + 1].type === "add") {
|
|
297
|
+
const segments = computeWordDiff(focused[i].content, focused[i + 1].content);
|
|
298
|
+
focused[i] = { ...focused[i], wordSegments: segments.filter((s) => s.type !== "added") };
|
|
299
|
+
focused[i + 1] = {
|
|
300
|
+
...focused[i + 1],
|
|
301
|
+
wordSegments: segments.filter((s) => s.type !== "removed"),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
286
305
|
// Highlight context lines using file extension
|
|
287
306
|
const filePath = String(args?.file_path ?? "");
|
|
288
307
|
const lang = langFromPath(filePath);
|
|
@@ -291,10 +310,12 @@ function buildDiffBody(result, args, _columns) {
|
|
|
291
310
|
const padWidth = String(maxLineNo).length;
|
|
292
311
|
const displayLines = highlighted.slice(0, MAX_OUTPUT_LINES);
|
|
293
312
|
const rendered = displayLines.map((line, i) => (_jsx(DiffLine, { line: line, padWidth: padWidth }, i)));
|
|
313
|
+
// Wrap diff lines in a dashed border frame (top/bottom only)
|
|
314
|
+
const diffFrame = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "#4b5563", children: DASHED_H.repeat(40) }), rendered, _jsx(Text, { color: "#4b5563", children: DASHED_H.repeat(40) })] }, "diff-frame"));
|
|
294
315
|
return {
|
|
295
316
|
lines: [
|
|
296
317
|
_jsx(Text, { color: "#9ca3af", children: summaryText }, "summary"),
|
|
297
|
-
|
|
318
|
+
diffFrame,
|
|
298
319
|
],
|
|
299
320
|
totalLines: focused.length + 1,
|
|
300
321
|
};
|
|
@@ -412,10 +433,18 @@ function buildResultBody(name, result, isError, columns) {
|
|
|
412
433
|
const DiffLine = memo(function DiffLine({ line, padWidth, }) {
|
|
413
434
|
const lineNo = String(line.lineNo).padStart(padWidth, " ");
|
|
414
435
|
if (line.type === "add") {
|
|
415
|
-
|
|
436
|
+
const bgColor = "#16a34a";
|
|
437
|
+
const wordHighlight = "#bbf7d0"; // brighter green for changed words
|
|
438
|
+
return (_jsxs(Text, { backgroundColor: bgColor, color: "#ffffff", children: [lineNo, " ", line.wordSegments
|
|
439
|
+
? line.wordSegments.map((seg, i) => seg.type === "added" ? (_jsx(Text, { color: wordHighlight, bold: true, children: seg.text }, i)) : (_jsx(Text, { children: seg.text }, i)))
|
|
440
|
+
: line.content] }));
|
|
416
441
|
}
|
|
417
442
|
if (line.type === "remove") {
|
|
418
|
-
|
|
443
|
+
const bgColor = "#dc2626";
|
|
444
|
+
const wordHighlight = "#fecaca"; // brighter red for changed words
|
|
445
|
+
return (_jsxs(Text, { backgroundColor: bgColor, color: "#ffffff", children: [lineNo, " ", line.wordSegments
|
|
446
|
+
? line.wordSegments.map((seg, i) => seg.type === "removed" ? (_jsx(Text, { color: wordHighlight, bold: true, children: seg.text }, i)) : (_jsx(Text, { children: seg.text }, i)))
|
|
447
|
+
: line.content] }));
|
|
419
448
|
}
|
|
420
449
|
return (_jsxs(Text, { children: [_jsxs(Text, { color: "#6b7280", children: [lineNo, " "] }), line.content] }));
|
|
421
450
|
});
|