wave-code 0.5.0 → 0.6.2
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/components/App.d.ts.map +1 -1
- package/dist/components/App.js +40 -2
- package/dist/components/BackgroundTaskManager.d.ts +6 -0
- package/dist/components/BackgroundTaskManager.d.ts.map +1 -0
- package/dist/components/{TaskManager.js → BackgroundTaskManager.js} +1 -1
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +40 -5
- package/dist/components/CommandOutputDisplay.d.ts.map +1 -1
- package/dist/components/CommandOutputDisplay.js +6 -17
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +16 -2
- package/dist/components/CompressDisplay.d.ts.map +1 -1
- package/dist/components/CompressDisplay.js +6 -10
- package/dist/components/ConfirmationDetails.d.ts +9 -0
- package/dist/components/ConfirmationDetails.d.ts.map +1 -0
- package/dist/components/ConfirmationDetails.js +53 -0
- package/dist/components/{Confirmation.d.ts → ConfirmationSelector.d.ts} +3 -3
- package/dist/components/ConfirmationSelector.d.ts.map +1 -0
- package/dist/components/{Confirmation.js → ConfirmationSelector.js} +34 -96
- package/dist/components/DiffDisplay.d.ts.map +1 -1
- package/dist/components/DiffDisplay.js +48 -1
- package/dist/components/FileSelector.d.ts.map +1 -1
- package/dist/components/FileSelector.js +2 -2
- package/dist/components/HelpView.d.ts +6 -0
- package/dist/components/HelpView.d.ts.map +1 -0
- package/dist/components/HelpView.js +24 -0
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +12 -4
- package/dist/components/InputBox.d.ts +1 -3
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +14 -17
- package/dist/components/LoadingIndicator.d.ts +11 -0
- package/dist/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/components/LoadingIndicator.js +6 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +114 -121
- package/dist/components/MessageItem.d.ts +1 -1
- package/dist/components/MessageItem.d.ts.map +1 -1
- package/dist/components/MessageItem.js +3 -5
- package/dist/components/MessageList.d.ts +2 -3
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +29 -12
- package/dist/components/PlanDisplay.d.ts.map +1 -1
- package/dist/components/PlanDisplay.js +4 -12
- package/dist/components/RewindCommand.d.ts +4 -0
- package/dist/components/RewindCommand.d.ts.map +1 -1
- package/dist/components/RewindCommand.js +20 -3
- package/dist/components/TaskList.d.ts +3 -0
- package/dist/components/TaskList.d.ts.map +1 -0
- package/dist/components/TaskList.js +40 -0
- package/dist/components/ToolDisplay.d.ts +9 -0
- package/dist/components/ToolDisplay.d.ts.map +1 -0
- package/dist/components/ToolDisplay.js +44 -0
- package/dist/contexts/useChat.d.ts +11 -3
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +51 -32
- package/dist/hooks/useInputManager.d.ts +4 -15
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +20 -65
- package/dist/hooks/useTasks.d.ts +2 -0
- package/dist/hooks/useTasks.d.ts.map +1 -0
- package/dist/hooks/useTasks.js +5 -0
- package/dist/managers/InputManager.d.ts +8 -30
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +38 -144
- package/dist/print-cli.d.ts.map +1 -1
- package/dist/print-cli.js +11 -30
- package/package.json +5 -6
- package/src/components/App.tsx +51 -3
- package/src/components/{TaskManager.tsx → BackgroundTaskManager.tsx} +4 -2
- package/src/components/ChatInterface.tsx +80 -23
- package/src/components/CommandOutputDisplay.tsx +16 -38
- package/src/components/CommandSelector.tsx +41 -17
- package/src/components/CompressDisplay.tsx +5 -22
- package/src/components/ConfirmationDetails.tsx +108 -0
- package/src/components/{Confirmation.tsx → ConfirmationSelector.tsx} +74 -193
- package/src/components/DiffDisplay.tsx +71 -1
- package/src/components/FileSelector.tsx +0 -2
- package/src/components/HelpView.tsx +59 -0
- package/src/components/HistorySearch.tsx +45 -21
- package/src/components/InputBox.tsx +51 -63
- package/src/components/LoadingIndicator.tsx +56 -0
- package/src/components/Markdown.tsx +126 -323
- package/src/components/MessageItem.tsx +13 -24
- package/src/components/MessageList.tsx +48 -82
- package/src/components/PlanDisplay.tsx +4 -27
- package/src/components/RewindCommand.tsx +39 -2
- package/src/components/TaskList.tsx +58 -0
- package/src/components/{ToolResultDisplay.tsx → ToolDisplay.tsx} +8 -18
- package/src/contexts/useChat.tsx +73 -41
- package/src/hooks/useInputManager.ts +21 -83
- package/src/hooks/useTasks.ts +6 -0
- package/src/managers/InputManager.ts +43 -179
- package/src/print-cli.ts +17 -35
- package/dist/components/Confirmation.d.ts.map +0 -1
- package/dist/components/MemoryDisplay.d.ts +0 -8
- package/dist/components/MemoryDisplay.d.ts.map +0 -1
- package/dist/components/MemoryDisplay.js +0 -25
- package/dist/components/MemoryTypeSelector.d.ts +0 -8
- package/dist/components/MemoryTypeSelector.d.ts.map +0 -1
- package/dist/components/MemoryTypeSelector.js +0 -38
- package/dist/components/SubagentBlock.d.ts +0 -8
- package/dist/components/SubagentBlock.d.ts.map +0 -1
- package/dist/components/SubagentBlock.js +0 -70
- package/dist/components/TaskManager.d.ts +0 -6
- package/dist/components/TaskManager.d.ts.map +0 -1
- package/dist/components/ToolResultDisplay.d.ts +0 -9
- package/dist/components/ToolResultDisplay.d.ts.map +0 -1
- package/dist/components/ToolResultDisplay.js +0 -54
- package/src/components/MemoryDisplay.tsx +0 -62
- package/src/components/MemoryTypeSelector.tsx +0 -98
- package/src/components/SubagentBlock.tsx +0 -143
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/components/App.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/components/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,QAAQ;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AA4DD,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAiBlC,CAAC"}
|
package/dist/components/App.js
CHANGED
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef } from "react";
|
|
3
|
+
import { useStdout } from "ink";
|
|
2
4
|
import { ChatInterface } from "./ChatInterface.js";
|
|
3
|
-
import { ChatProvider } from "../contexts/useChat.js";
|
|
5
|
+
import { ChatProvider, useChat } from "../contexts/useChat.js";
|
|
4
6
|
import { AppProvider } from "../contexts/useAppConfig.js";
|
|
5
7
|
const AppWithProviders = ({ bypassPermissions, pluginDirs }) => {
|
|
6
|
-
return (_jsx(ChatProvider, { bypassPermissions: bypassPermissions, pluginDirs: pluginDirs, children: _jsx(
|
|
8
|
+
return (_jsx(ChatProvider, { bypassPermissions: bypassPermissions, pluginDirs: pluginDirs, children: _jsx(ChatInterfaceWithRemount, {}) }));
|
|
9
|
+
};
|
|
10
|
+
const ChatInterfaceWithRemount = () => {
|
|
11
|
+
const { stdout } = useStdout();
|
|
12
|
+
const { isExpanded, rewindId, wasLastDetailsTooTall, sessionId } = useChat();
|
|
13
|
+
const [remountKey, setRemountKey] = useState(String(isExpanded) + rewindId + wasLastDetailsTooTall);
|
|
14
|
+
const prevSessionId = useRef(sessionId);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const newKey = String(isExpanded) +
|
|
17
|
+
rewindId +
|
|
18
|
+
wasLastDetailsTooTall +
|
|
19
|
+
(prevSessionId.current && sessionId && prevSessionId.current !== sessionId
|
|
20
|
+
? sessionId
|
|
21
|
+
: "");
|
|
22
|
+
if (newKey !== remountKey) {
|
|
23
|
+
const timeout = setTimeout(() => {
|
|
24
|
+
stdout?.write("\u001b[2J\u001b[0;0H", (err) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
console.error("Failed to clear terminal:", err);
|
|
27
|
+
}
|
|
28
|
+
setRemountKey(newKey);
|
|
29
|
+
});
|
|
30
|
+
}, 100);
|
|
31
|
+
return () => clearTimeout(timeout);
|
|
32
|
+
}
|
|
33
|
+
if (sessionId) {
|
|
34
|
+
prevSessionId.current = sessionId;
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
isExpanded,
|
|
38
|
+
rewindId,
|
|
39
|
+
wasLastDetailsTooTall,
|
|
40
|
+
sessionId,
|
|
41
|
+
remountKey,
|
|
42
|
+
stdout,
|
|
43
|
+
]);
|
|
44
|
+
return _jsx(ChatInterface, {}, remountKey);
|
|
7
45
|
};
|
|
8
46
|
export const App = ({ restoreSessionId, continueLastSession, bypassPermissions, pluginDirs, }) => {
|
|
9
47
|
return (_jsx(AppProvider, { restoreSessionId: restoreSessionId, continueLastSession: continueLastSession, children: _jsx(AppWithProviders, { bypassPermissions: bypassPermissions, pluginDirs: pluginDirs }) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundTaskManager.d.ts","sourceRoot":"","sources":["../../src/components/BackgroundTaskManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA6StE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { useChat } from "../contexts/useChat.js";
|
|
5
|
-
export const
|
|
5
|
+
export const BackgroundTaskManager = ({ onCancel, }) => {
|
|
6
6
|
const { backgroundTasks, getBackgroundTaskOutput, stopBackgroundTask } = useChat();
|
|
7
7
|
const [tasks, setTasks] = useState([]);
|
|
8
8
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInterface.d.ts","sourceRoot":"","sources":["../../src/components/ChatInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ChatInterface.d.ts","sourceRoot":"","sources":["../../src/components/ChatInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAyHjC,CAAC"}
|
|
@@ -1,12 +1,47 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { Box, useStdout } from "ink";
|
|
3
4
|
import { MessageList } from "./MessageList.js";
|
|
4
5
|
import { InputBox } from "./InputBox.js";
|
|
5
|
-
import {
|
|
6
|
+
import { LoadingIndicator } from "./LoadingIndicator.js";
|
|
7
|
+
import { TaskList } from "./TaskList.js";
|
|
8
|
+
import { ConfirmationDetails } from "./ConfirmationDetails.js";
|
|
9
|
+
import { ConfirmationSelector } from "./ConfirmationSelector.js";
|
|
6
10
|
import { useChat } from "../contexts/useChat.js";
|
|
7
11
|
export const ChatInterface = () => {
|
|
8
|
-
const {
|
|
12
|
+
const { stdout } = useStdout();
|
|
13
|
+
const [isDetailsTooTall, setIsDetailsTooTall] = useState(false);
|
|
14
|
+
const { messages, isLoading, isCommandRunning, isCompressing, sendMessage, abortMessage, mcpServers, connectMcpServer, disconnectMcpServer, isExpanded, sessionId, latestTotalTokens, slashCommands, hasSlashCommand, isConfirmationVisible, confirmingTool, handleConfirmationDecision, handleConfirmationCancel: originalHandleConfirmationCancel, setWasLastDetailsTooTall, } = useChat();
|
|
15
|
+
const handleHeightMeasured = useCallback((height) => {
|
|
16
|
+
const terminalHeight = stdout?.rows || 24;
|
|
17
|
+
if (height > terminalHeight - 10) {
|
|
18
|
+
setIsDetailsTooTall(true);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
setIsDetailsTooTall(false);
|
|
22
|
+
}
|
|
23
|
+
}, [stdout?.rows]);
|
|
24
|
+
const handleConfirmationCancel = useCallback(() => {
|
|
25
|
+
if (isDetailsTooTall) {
|
|
26
|
+
setWasLastDetailsTooTall((prev) => prev + 1);
|
|
27
|
+
setIsDetailsTooTall(false);
|
|
28
|
+
}
|
|
29
|
+
originalHandleConfirmationCancel();
|
|
30
|
+
}, [
|
|
31
|
+
isDetailsTooTall,
|
|
32
|
+
originalHandleConfirmationCancel,
|
|
33
|
+
setWasLastDetailsTooTall,
|
|
34
|
+
]);
|
|
35
|
+
const wrappedHandleConfirmationDecision = useCallback((decision) => {
|
|
36
|
+
if (isDetailsTooTall) {
|
|
37
|
+
setWasLastDetailsTooTall((prev) => prev + 1);
|
|
38
|
+
setIsDetailsTooTall(false);
|
|
39
|
+
}
|
|
40
|
+
handleConfirmationDecision(decision);
|
|
41
|
+
}, [isDetailsTooTall, handleConfirmationDecision, setWasLastDetailsTooTall]);
|
|
9
42
|
if (!sessionId)
|
|
10
43
|
return null;
|
|
11
|
-
return (_jsxs(Box, { flexDirection: "column",
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MessageList, { messages: messages, isLoading: isLoading, isCommandRunning: isCommandRunning, isExpanded: isExpanded, forceStaticLastMessage: isDetailsTooTall }), (isLoading || isCommandRunning || isCompressing) &&
|
|
45
|
+
!isConfirmationVisible &&
|
|
46
|
+
!isExpanded && (_jsx(LoadingIndicator, { isLoading: isLoading, isCommandRunning: isCommandRunning, isCompressing: isCompressing, latestTotalTokens: latestTotalTokens })), !isConfirmationVisible && !isExpanded && _jsx(TaskList, {}), isConfirmationVisible && (_jsxs(_Fragment, { children: [_jsx(ConfirmationDetails, { toolName: confirmingTool.name, toolInput: confirmingTool.input, isExpanded: isExpanded, onHeightMeasured: handleHeightMeasured }), _jsx(ConfirmationSelector, { toolName: confirmingTool.name, toolInput: confirmingTool.input, suggestedPrefix: confirmingTool.suggestedPrefix, hidePersistentOption: confirmingTool.hidePersistentOption, isExpanded: isExpanded, onDecision: wrappedHandleConfirmationDecision, onCancel: handleConfirmationCancel, onAbort: abortMessage })] })), !isConfirmationVisible && !isExpanded && (_jsx(InputBox, { isLoading: isLoading, isCommandRunning: isCommandRunning, sendMessage: sendMessage, abortMessage: abortMessage, mcpServers: mcpServers, connectMcpServer: connectMcpServer, disconnectMcpServer: disconnectMcpServer, slashCommands: slashCommands, hasSlashCommand: hasSlashCommand }))] }));
|
|
12
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandOutputDisplay.d.ts","sourceRoot":"","sources":["../../src/components/CommandOutputDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,UAAU,yBAAyB;IACjC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"CommandOutputDisplay.d.ts","sourceRoot":"","sources":["../../src/components/CommandOutputDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,UAAU,yBAAyB;IACjC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAiDpE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { Box, Text } from "ink";
|
|
|
4
4
|
export const CommandOutputDisplay = ({ block, isExpanded = false, }) => {
|
|
5
5
|
const { command, output, isRunning, exitCode } = block;
|
|
6
6
|
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
7
|
-
const MAX_LINES =
|
|
7
|
+
const MAX_LINES = 3; // Set maximum display lines
|
|
8
8
|
// Detect if content is overflowing
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
if (output) {
|
|
@@ -21,20 +21,9 @@ export const CommandOutputDisplay = ({ block, isExpanded = false, }) => {
|
|
|
21
21
|
return "red";
|
|
22
22
|
return "gray"; // Unknown state
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (exitCode === 130)
|
|
30
|
-
return "⚠️"; // SIGINT (Ctrl+C)
|
|
31
|
-
if (exitCode !== null && exitCode !== 0)
|
|
32
|
-
return "❌";
|
|
33
|
-
return ""; // Don't display text for unknown state
|
|
34
|
-
};
|
|
35
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "cyan", children: "$ " }), _jsx(Text, { color: "white", children: command }), _jsxs(Text, { color: getStatusColor(), children: [" ", getStatusText()] })] }), output && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", height: isExpanded
|
|
36
|
-
? undefined
|
|
37
|
-
: Math.min(output.split("\n").length, MAX_LINES), overflow: "hidden", children: _jsx(Text, { color: "gray", children: isOverflowing
|
|
38
|
-
? output.split("\n").slice(-MAX_LINES).join("\n")
|
|
39
|
-
: output }) }), isOverflowing && (_jsx(Box, { paddingLeft: 2, marginTop: 1, children: _jsxs(Text, { color: "yellow", dimColor: true, children: ["Content truncated (", output.split("\n").length, " lines total, showing last ", MAX_LINES, " lines)"] }) }))] }))] }));
|
|
24
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: getStatusColor(), children: "$ " }), _jsx(Text, { color: "white", children: command })] }), output && (_jsx(Box, { paddingLeft: 2, height: isExpanded
|
|
25
|
+
? undefined
|
|
26
|
+
: Math.min(output.split("\n").length, MAX_LINES), overflow: "hidden", children: _jsx(Text, { color: "gray", children: isOverflowing
|
|
27
|
+
? output.split("\n").slice(-MAX_LINES).join("\n")
|
|
28
|
+
: output }) }))] }));
|
|
40
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandSelector.d.ts","sourceRoot":"","sources":["../../src/components/CommandSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandSelector.d.ts","sourceRoot":"","sources":["../../src/components/CommandSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA8BnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0I1D,CAAC"}
|
|
@@ -20,15 +20,25 @@ const AVAILABLE_COMMANDS = [
|
|
|
20
20
|
description: "Revert conversation and file changes to a previous checkpoint",
|
|
21
21
|
handler: () => { }, // Handler here won't be used, actual processing is in the hook
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
id: "help",
|
|
25
|
+
name: "help",
|
|
26
|
+
description: "Show help and key bindings",
|
|
27
|
+
handler: () => { }, // Handler here won't be used, actual processing is in the hook
|
|
28
|
+
},
|
|
23
29
|
];
|
|
24
30
|
export const CommandSelector = ({ searchQuery, onSelect, onInsert, onCancel, commands = [], // Default to empty array
|
|
25
31
|
}) => {
|
|
32
|
+
const MAX_VISIBLE_ITEMS = 3;
|
|
26
33
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
27
34
|
// Merge agent commands and local commands
|
|
28
35
|
const allCommands = [...commands, ...AVAILABLE_COMMANDS];
|
|
29
36
|
// Filter command list
|
|
30
37
|
const filteredCommands = allCommands.filter((command) => !searchQuery ||
|
|
31
38
|
command.id.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
39
|
+
// Calculate visible window
|
|
40
|
+
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, filteredCommands.length - MAX_VISIBLE_ITEMS)));
|
|
41
|
+
const visibleCommands = filteredCommands.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
32
42
|
useInput((input, key) => {
|
|
33
43
|
if (key.return) {
|
|
34
44
|
if (filteredCommands.length > 0 &&
|
|
@@ -60,7 +70,11 @@ export const CommandSelector = ({ searchQuery, onSelect, onInsert, onCancel, com
|
|
|
60
70
|
}
|
|
61
71
|
});
|
|
62
72
|
if (filteredCommands.length === 0) {
|
|
63
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderBottom: false, borderLeft: false, borderRight: false,
|
|
73
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderBottom: false, borderLeft: false, borderRight: false, children: [_jsxs(Text, { color: "yellow", children: ["No commands found for \"", searchQuery, "\""] }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
64
74
|
}
|
|
65
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "magenta", borderBottom: false, borderLeft: false, borderRight: false,
|
|
75
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "magenta", borderBottom: false, borderLeft: false, borderRight: false, gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: "magenta", bold: true, children: ["Command Selector ", searchQuery && `(filtering: "${searchQuery}")`] }) }), _jsx(Box, { flexDirection: "column", children: visibleCommands.map((command, index) => {
|
|
76
|
+
const actualIndex = startIndex + index;
|
|
77
|
+
const isSelected = actualIndex === selectedIndex;
|
|
78
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: isSelected ? "black" : "white", backgroundColor: isSelected ? "magenta" : undefined, children: [isSelected ? "▶ " : " ", "/", command.id] }), isSelected && (_jsx(Box, { marginLeft: 4, children: _jsx(Text, { color: "gray", dimColor: true, children: command.description }) }))] }, command.id));
|
|
79
|
+
}) }), _jsx(Box, { children: _jsxs(Text, { dimColor: true, children: ["\u2191\u2193 navigate \u2022 Enter execute \u2022 ", onInsert ? "Tab insert • " : "", "Esc cancel"] }) })] }));
|
|
66
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompressDisplay.d.ts","sourceRoot":"","sources":["../../src/components/CompressDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CompressDisplay.d.ts","sourceRoot":"","sources":["../../src/components/CompressDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+B1D,CAAC"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
|
-
export const CompressDisplay = ({ block
|
|
4
|
+
export const CompressDisplay = ({ block }) => {
|
|
5
5
|
const { content } = block;
|
|
6
|
-
const
|
|
7
|
-
const { displayContent, isOverflowing } = useMemo(() => {
|
|
6
|
+
const { displayContent } = useMemo(() => {
|
|
8
7
|
if (!content) {
|
|
9
|
-
return { displayContent: ""
|
|
8
|
+
return { displayContent: "" };
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return { displayContent: display, isOverflowing: overflow };
|
|
15
|
-
}, [content, isExpanded]);
|
|
16
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: _jsx(Text, { children: "\uD83D\uDCE6 Compressed Messages" }) }), content && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: _jsx(Text, { color: "white", children: displayContent }) }), isOverflowing && (_jsx(Box, { paddingLeft: 2, marginTop: 1, children: _jsxs(Text, { color: "yellow", dimColor: true, children: ["Content truncated (", content.split("\n").length, " lines total, showing first ", MAX_LINES, " lines. Press Ctrl+O to expand."] }) }))] }))] }));
|
|
10
|
+
return { displayContent: content };
|
|
11
|
+
}, [content]);
|
|
12
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: _jsx(Text, { children: "\uD83D\uDCE6 Compressed Messages" }) }), content && (_jsx(Box, { marginTop: 1, flexDirection: "column", children: _jsx(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: _jsx(Text, { color: "white", children: displayContent }) }) }))] }));
|
|
17
13
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ConfirmationDetailsProps {
|
|
3
|
+
toolName: string;
|
|
4
|
+
toolInput?: Record<string, unknown>;
|
|
5
|
+
isExpanded?: boolean;
|
|
6
|
+
onHeightMeasured?: (height: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ConfirmationDetails: React.FC<ConfirmationDetailsProps>;
|
|
9
|
+
//# sourceMappingURL=ConfirmationDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationDetails.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmationDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AA2CjE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAuDlE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { Box, Text, useStdout, measureElement, Static } from "ink";
|
|
4
|
+
import { BASH_TOOL_NAME, EDIT_TOOL_NAME, MULTI_EDIT_TOOL_NAME, DELETE_FILE_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, ASK_USER_QUESTION_TOOL_NAME, } from "wave-agent-sdk";
|
|
5
|
+
import { DiffDisplay } from "./DiffDisplay.js";
|
|
6
|
+
import { PlanDisplay } from "./PlanDisplay.js";
|
|
7
|
+
// Helper function to generate descriptive action text
|
|
8
|
+
const getActionDescription = (toolName, toolInput) => {
|
|
9
|
+
if (!toolInput) {
|
|
10
|
+
return "Execute operation";
|
|
11
|
+
}
|
|
12
|
+
switch (toolName) {
|
|
13
|
+
case BASH_TOOL_NAME:
|
|
14
|
+
return `Execute command: ${toolInput.command || "unknown command"}`;
|
|
15
|
+
case EDIT_TOOL_NAME:
|
|
16
|
+
return `Edit file: ${toolInput.file_path || "unknown file"}`;
|
|
17
|
+
case MULTI_EDIT_TOOL_NAME:
|
|
18
|
+
return `Edit multiple sections in: ${toolInput.file_path || "unknown file"}`;
|
|
19
|
+
case DELETE_FILE_TOOL_NAME:
|
|
20
|
+
return `Delete file: ${toolInput.target_file || "unknown file"}`;
|
|
21
|
+
case WRITE_TOOL_NAME:
|
|
22
|
+
return `Write to file: ${toolInput.file_path || "unknown file"}`;
|
|
23
|
+
case EXIT_PLAN_MODE_TOOL_NAME:
|
|
24
|
+
return "Review and approve the plan";
|
|
25
|
+
case ASK_USER_QUESTION_TOOL_NAME:
|
|
26
|
+
return "Answer questions to clarify intent";
|
|
27
|
+
default:
|
|
28
|
+
return "Execute operation";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const ConfirmationDetails = ({ toolName, toolInput, isExpanded = false, onHeightMeasured, }) => {
|
|
32
|
+
const { stdout } = useStdout();
|
|
33
|
+
const [isStatic, setIsStatic] = useState(false);
|
|
34
|
+
const boxRef = useRef(null);
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
|
+
if (boxRef.current) {
|
|
37
|
+
const { height } = measureElement(boxRef.current);
|
|
38
|
+
const terminalHeight = stdout?.rows || 24;
|
|
39
|
+
if (height > terminalHeight - 10) {
|
|
40
|
+
setIsStatic(true);
|
|
41
|
+
}
|
|
42
|
+
onHeightMeasured?.(height);
|
|
43
|
+
}
|
|
44
|
+
}, [stdout?.rows, onHeightMeasured]);
|
|
45
|
+
const content = (_jsxs(Box, { ref: boxRef, flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsxs(Text, { color: "yellow", bold: true, children: ["Tool: ", toolName] }), _jsx(Text, { color: "yellow", children: getActionDescription(toolName, toolInput) }), _jsx(DiffDisplay, { toolName: toolName, parameters: JSON.stringify(toolInput) }), toolName !== ASK_USER_QUESTION_TOOL_NAME &&
|
|
46
|
+
toolName === EXIT_PLAN_MODE_TOOL_NAME &&
|
|
47
|
+
!!toolInput?.plan_content && (_jsx(PlanDisplay, { plan: toolInput.plan_content, isExpanded: isExpanded }))] }));
|
|
48
|
+
if (isStatic) {
|
|
49
|
+
return _jsx(Static, { items: [1], children: () => content });
|
|
50
|
+
}
|
|
51
|
+
return content;
|
|
52
|
+
};
|
|
53
|
+
ConfirmationDetails.displayName = "ConfirmationDetails";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { PermissionDecision } from "wave-agent-sdk";
|
|
3
|
-
export interface
|
|
3
|
+
export interface ConfirmationSelectorProps {
|
|
4
4
|
toolName: string;
|
|
5
5
|
toolInput?: Record<string, unknown>;
|
|
6
6
|
suggestedPrefix?: string;
|
|
@@ -10,5 +10,5 @@ export interface ConfirmationProps {
|
|
|
10
10
|
onCancel: () => void;
|
|
11
11
|
onAbort: () => void;
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
14
|
-
//# sourceMappingURL=
|
|
13
|
+
export declare const ConfirmationSelector: React.FC<ConfirmationSelectorProps>;
|
|
14
|
+
//# sourceMappingURL=ConfirmationSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationSelector.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmationSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAgB/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AASD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwapE,CAAC"}
|