@kenkaiiii/ggcoder 4.2.72 → 4.2.74
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/dist/cli.js +174 -0
- 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 +1 -0
- package/dist/config.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 +14 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/agent-home-mode.d.ts +21 -0
- package/dist/modes/agent-home-mode.d.ts.map +1 -0
- package/dist/modes/agent-home-mode.js +553 -0
- package/dist/modes/agent-home-mode.js.map +1 -0
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +25 -3
- 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 +6 -1
- package/dist/ui/components/ActivityIndicator.d.ts.map +1 -1
- package/dist/ui/components/ActivityIndicator.js +52 -8
- package/dist/ui/components/ActivityIndicator.js.map +1 -1
- package/dist/ui/components/AnimationContext.d.ts +5 -0
- package/dist/ui/components/AnimationContext.d.ts.map +1 -1
- package/dist/ui/components/AnimationContext.js +8 -1
- package/dist/ui/components/AnimationContext.js.map +1 -1
- package/dist/ui/components/AssistantMessage.d.ts.map +1 -1
- package/dist/ui/components/AssistantMessage.js +3 -2
- 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/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/Markdown.d.ts +4 -0
- package/dist/ui/components/Markdown.d.ts.map +1 -1
- package/dist/ui/components/Markdown.js +109 -6
- 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/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 +51 -5
- package/dist/ui/components/Spinner.js.map +1 -1
- package/dist/ui/components/StreamingArea.d.ts.map +1 -1
- package/dist/ui/components/StreamingArea.js +4 -3
- 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 +4 -3
- package/dist/ui/components/SubAgentPanel.js.map +1 -1
- package/dist/ui/components/ToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolExecution.js +38 -12
- 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/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 +8 -0
- package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentLoop.js +16 -0
- 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/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/package.json +4 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from "react";
|
|
2
|
+
import { type BoxProps } from "ink";
|
|
3
|
+
type Props = Omit<BoxProps, "children"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Extend the exclusion zone from column 0 to this box's right edge.
|
|
6
|
+
* Use for gutters rendered inside a wider indented container (e.g. the
|
|
7
|
+
* MessageResponse bracket) so a multi-row drag picks up clean content.
|
|
8
|
+
*/
|
|
9
|
+
fromLeftEdge?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Marks its contents as non-selectable in terminal text selection.
|
|
13
|
+
*
|
|
14
|
+
* If Ink supports the `noSelect` prop on Box this component passes it
|
|
15
|
+
* through; otherwise it acts as a semantic wrapper and a single place
|
|
16
|
+
* to wire the feature when Ink adds support.
|
|
17
|
+
*/
|
|
18
|
+
export declare function NoSelect({ children, fromLeftEdge: _fromLeftEdge, ...boxProps }: PropsWithChildren<Props>): React.ReactNode;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=NoSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoSelect.d.ts","sourceRoot":"","sources":["../../../src/ui/components/NoSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEzC,KAAK,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG;IACxC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,GAAG,QAAQ,EACZ,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,SAAS,CAE5C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, {} from "react";
|
|
3
|
+
import { Box } from "ink";
|
|
4
|
+
/**
|
|
5
|
+
* Marks its contents as non-selectable in terminal text selection.
|
|
6
|
+
*
|
|
7
|
+
* If Ink supports the `noSelect` prop on Box this component passes it
|
|
8
|
+
* through; otherwise it acts as a semantic wrapper and a single place
|
|
9
|
+
* to wire the feature when Ink adds support.
|
|
10
|
+
*/
|
|
11
|
+
export function NoSelect({ children, fromLeftEdge: _fromLeftEdge, ...boxProps }) {
|
|
12
|
+
return _jsx(Box, { ...boxProps, children: children });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=NoSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoSelect.js","sourceRoot":"","sources":["../../../src/ui/components/NoSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAA0B,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,GAAG,EAAiB,MAAM,KAAK,CAAC;AAWzC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,GAAG,QAAQ,EACc;IACzB,OAAO,KAAC,GAAG,OAAK,QAAQ,YAAG,QAAQ,GAAO,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* `"always"` — permanently lock height to the maximum seen.
|
|
5
|
+
* `"offscreen"` — same behaviour for now; full viewport detection
|
|
6
|
+
* can be added later without changing callers.
|
|
7
|
+
*/
|
|
8
|
+
lock?: "always" | "offscreen";
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Height-ratchet: once content grows to N rows the outer Box never
|
|
13
|
+
* shrinks below N, preventing jarring visual jumps when streaming
|
|
14
|
+
* content temporarily shortens (e.g. markdown re-parse flicker).
|
|
15
|
+
*
|
|
16
|
+
* Mirrors claude-code's Ratchet component.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Ratchet({ children, lock: _lock }: Props): React.ReactNode;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=Ratchet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ratchet.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Ratchet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,UAAU,KAAK;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAgB,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CA0BpF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef, useState, useLayoutEffect, useCallback } from "react";
|
|
3
|
+
import { Box, measureElement } from "ink";
|
|
4
|
+
/**
|
|
5
|
+
* Height-ratchet: once content grows to N rows the outer Box never
|
|
6
|
+
* shrinks below N, preventing jarring visual jumps when streaming
|
|
7
|
+
* content temporarily shortens (e.g. markdown re-parse flicker).
|
|
8
|
+
*
|
|
9
|
+
* Mirrors claude-code's Ratchet component.
|
|
10
|
+
*/
|
|
11
|
+
export function Ratchet({ children, lock: _lock = "always" }) {
|
|
12
|
+
const innerRef = useRef(null);
|
|
13
|
+
const maxHeight = useRef(0);
|
|
14
|
+
const [minHeight, setMinHeight] = useState(0);
|
|
15
|
+
const outerRef = useCallback((_el) => {
|
|
16
|
+
// Placeholder for future viewport tracking.
|
|
17
|
+
}, []);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
if (!innerRef.current)
|
|
20
|
+
return;
|
|
21
|
+
const { height } = measureElement(innerRef.current);
|
|
22
|
+
const termRows = process.stdout.rows ?? 24;
|
|
23
|
+
if (height > maxHeight.current) {
|
|
24
|
+
maxHeight.current = Math.min(height, termRows);
|
|
25
|
+
setMinHeight(maxHeight.current);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return (_jsx(Box, { minHeight: minHeight, ref: outerRef, children: _jsx(Box, { ref: innerRef, flexDirection: "column", children: children }) }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Ratchet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ratchet.js","sourceRoot":"","sources":["../../../src/ui/components/Ratchet.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,cAAc,EAAmB,MAAM,KAAK,CAAC;AAY3D;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,EAAS;IACjE,MAAM,QAAQ,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAsB,EAAE,EAAE;QACtD,4CAA4C;IAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAO;QAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3C,IAAI,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;YAC/B,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC/C,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,GAAG,IAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,YACtC,KAAC,GAAG,IAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,YACvC,QAAQ,GACL,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerToolExecution.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ServerToolExecution.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerToolExecution.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ServerToolExecution.tsx"],"names":[],"mappings":"AAQA,UAAU,sBAAsB;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,wBAAwB,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAK7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CA0DlE"}
|
|
@@ -3,24 +3,23 @@ import React 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 { useTerminalSize } from "../hooks/useTerminalSize.js";
|
|
7
|
-
//
|
|
9
|
+
// ToolUseLoader minWidth={2} = 2 chars
|
|
8
10
|
const HEADER_PREFIX = 2;
|
|
9
|
-
// paddingLeft(2) + "⎿ " = 5 chars
|
|
10
|
-
const DETAIL_PREFIX = 5;
|
|
11
11
|
export function ServerToolExecution(props) {
|
|
12
12
|
const theme = useTheme();
|
|
13
13
|
const { columns } = useTerminalSize();
|
|
14
14
|
const { label, detail } = getHeader(props.name, props.input);
|
|
15
15
|
const headerContentWidth = Math.max(10, columns - HEADER_PREFIX);
|
|
16
|
-
const detailContentWidth = Math.max(10, columns - DETAIL_PREFIX);
|
|
17
16
|
const headerContent = (_jsxs(Text, { wrap: "wrap", children: [_jsx(Text, { bold: true, color: theme.toolName, children: label }), detail && (_jsxs(Text, { color: theme.text, children: ["(", _jsx(Text, { color: theme.textDim, children: '"' }), detail, _jsx(Text, { color: theme.textDim, children: '"' }), ")"] }))] }));
|
|
18
17
|
if (props.status === "running") {
|
|
19
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(
|
|
18
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(ToolUseLoader, { status: "running" }), _jsx(Box, { flexGrow: 1, width: headerContentWidth, children: headerContent })] }), _jsx(MessageResponse, { children: _jsx(Spinner, { label: "Searching..." }) })] }));
|
|
20
19
|
}
|
|
21
20
|
const isAborted = props.resultType === "aborted";
|
|
22
21
|
const duration = Math.round(props.durationMs / 1000);
|
|
23
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(
|
|
22
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(ToolUseLoader, { status: isAborted ? "error" : "done" }), _jsx(Box, { flexGrow: 1, width: headerContentWidth, children: headerContent })] }), _jsx(MessageResponse, { children: _jsx(Text, { color: theme.textDim, wrap: "wrap", children: isAborted ? "Stopped." : `Did 1 search in ${duration}s` }) })] }));
|
|
24
23
|
}
|
|
25
24
|
function getHeader(name, input) {
|
|
26
25
|
const inp = (input ?? {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerToolExecution.js","sourceRoot":"","sources":["../../../src/ui/components/ServerToolExecution.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,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ServerToolExecution.js","sourceRoot":"","sources":["../../../src/ui/components/ServerToolExecution.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,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,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E,CAAC;IAChD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -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,14 +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, useAnimationActive, 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();
|
|
9
32
|
useAnimationActive();
|
|
10
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
|
+
}
|
|
11
41
|
const frame = deriveFrame(tick, SPINNER_INTERVAL, SPINNER_FRAMES.length);
|
|
12
|
-
|
|
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 })] }));
|
|
13
59
|
}
|
|
14
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,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GAAG,KAAK,CAAC,YAAY,CAAC;IAC/B,IAAI,SAAS,IAAI,eAAe,GAAG,IAAI,EAAE,CAAC;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingArea.d.ts","sourceRoot":"","sources":["../../../src/ui/components/StreamingArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;
|
|
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"}
|
|
@@ -2,11 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
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
|
-
|
|
9
|
+
import { BLACK_CIRCLE, PLAN_SYMBOL } from "../constants/figures.js";
|
|
10
|
+
// BLACK_CIRCLE + " " = 2 chars
|
|
10
11
|
const PREFIX_WIDTH = 2;
|
|
11
12
|
export const StreamingArea = memo(function StreamingArea({ isRunning, streamingText, streamingThinking, showThinking = true, thinkingMs, planMode, }) {
|
|
12
13
|
const theme = useTheme();
|
|
@@ -22,6 +23,6 @@ export const StreamingArea = memo(function StreamingArea({ isRunning, streamingT
|
|
|
22
23
|
return null;
|
|
23
24
|
if (!isRunning && !streamingText)
|
|
24
25
|
return null;
|
|
25
|
-
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 ? "
|
|
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() }) })] }))] }));
|
|
26
27
|
});
|
|
27
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,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,
|
|
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,yBAAyB,CAAC;AAEpE,+BAA+B;AAC/B,MAAM,YAAY,GAAG,CAAC,CAAC;AAWvB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,a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AG,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"}
|
|
@@ -5,6 +5,7 @@ import { useTheme } from "../theme/theme.js";
|
|
|
5
5
|
import { SPINNER_FRAMES, SPINNER_INTERVAL } from "../spinner-frames.js";
|
|
6
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`;
|
|
@@ -63,13 +64,12 @@ const AgentRow = React.memo(function AgentRow({ agent, isLast, aborted, columns,
|
|
|
63
64
|
return false;
|
|
64
65
|
});
|
|
65
66
|
export function SubAgentPanel({ agents, aborted = false }) {
|
|
66
|
-
const theme = useTheme();
|
|
67
67
|
const { columns } = useTerminalSize();
|
|
68
68
|
if (agents.length === 0)
|
|
69
69
|
return null;
|
|
70
70
|
const runningCount = agents.filter((a) => a.status === "running").length;
|
|
71
71
|
const allDone = runningCount === 0;
|
|
72
|
-
//
|
|
72
|
+
// ToolUseLoader minWidth={2} = 2 chars
|
|
73
73
|
const HEADER_PREFIX = 2;
|
|
74
74
|
const contentColumns = Math.max(10, columns - HEADER_PREFIX);
|
|
75
75
|
const headerText = aborted
|
|
@@ -77,6 +77,7 @@ export function SubAgentPanel({ agents, aborted = false }) {
|
|
|
77
77
|
: allDone
|
|
78
78
|
? `${agents.length} agent${agents.length !== 1 ? "s" : ""} completed`
|
|
79
79
|
: `${agents.length} agent${agents.length !== 1 ? "s" : ""} launched`;
|
|
80
|
-
|
|
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)))] })] }));
|
|
81
82
|
}
|
|
82
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,kBAAkB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,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,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmBnD,SAAS,YAAY,CAAC,CAAS;IAC7B,IAAI,CAAC,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5D,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACpD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,SA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AC,CAAC,GAAG,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY;YACrE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;IAEzE,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEnE,OAAO,CACL,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,KAAK,aACpC,KAAC,aAAa,IAAC,MAAM,EAAE,SAAS,GAAI,EACpC,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,aAC5D,KAAC,IAAI,IAAC,IAAI,QAAC,IAAI,EAAC,MAAM,YACnB,UAAU,GACN,EACN,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,KAAC,QAAQ,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 +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,13 +25,14 @@ 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
37
|
const { name, args, result, isError, details } = props;
|
|
33
38
|
const headerContentWidth = Math.max(10, columns - HEADER_PREFIX);
|
|
@@ -35,7 +40,7 @@ export function ToolExecution(props) {
|
|
|
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
|
|
41
46
|
const editDetails = details;
|
|
@@ -49,11 +54,11 @@ export function ToolExecution(props) {
|
|
|
49
54
|
// Compact display — no body to show, but show inline summary
|
|
50
55
|
if (!body) {
|
|
51
56
|
const inline = getInlineSummary(name, result, isError);
|
|
52
|
-
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] })] }) })] }));
|
|
53
58
|
}
|
|
54
59
|
const { lines, totalLines } = body;
|
|
55
60
|
const hiddenCount = totalLines - lines.length;
|
|
56
|
-
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)"] }))] }) })] }));
|
|
57
62
|
}
|
|
58
63
|
// ── Compact tool labels ─────────────────────────────────────
|
|
59
64
|
function getCompactRunningLabel(name, _args) {
|
|
@@ -286,6 +291,17 @@ function buildDiffBody(result, args, _columns) {
|
|
|
286
291
|
const startIdx = Math.max(0, firstChangeIdx - 2);
|
|
287
292
|
const endIdx = Math.min(numbered.length, lastChangeIdx + 3);
|
|
288
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
|
+
}
|
|
289
305
|
// Highlight context lines using file extension
|
|
290
306
|
const filePath = String(args?.file_path ?? "");
|
|
291
307
|
const lang = langFromPath(filePath);
|
|
@@ -294,10 +310,12 @@ function buildDiffBody(result, args, _columns) {
|
|
|
294
310
|
const padWidth = String(maxLineNo).length;
|
|
295
311
|
const displayLines = highlighted.slice(0, MAX_OUTPUT_LINES);
|
|
296
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"));
|
|
297
315
|
return {
|
|
298
316
|
lines: [
|
|
299
317
|
_jsx(Text, { color: "#9ca3af", children: summaryText }, "summary"),
|
|
300
|
-
|
|
318
|
+
diffFrame,
|
|
301
319
|
],
|
|
302
320
|
totalLines: focused.length + 1,
|
|
303
321
|
};
|
|
@@ -415,10 +433,18 @@ function buildResultBody(name, result, isError, columns) {
|
|
|
415
433
|
const DiffLine = memo(function DiffLine({ line, padWidth, }) {
|
|
416
434
|
const lineNo = String(line.lineNo).padStart(padWidth, " ");
|
|
417
435
|
if (line.type === "add") {
|
|
418
|
-
|
|
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] }));
|
|
419
441
|
}
|
|
420
442
|
if (line.type === "remove") {
|
|
421
|
-
|
|
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] }));
|
|
422
448
|
}
|
|
423
449
|
return (_jsxs(Text, { children: [_jsxs(Text, { color: "#6b7280", children: [lineNo, " "] }), line.content] }));
|
|
424
450
|
});
|