wave-code 0.4.0 → 0.5.1
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/commands/plugin/uninstall.js +1 -1
- package/dist/components/CommandSelector.js +3 -3
- package/dist/components/Confirmation.d.ts.map +1 -1
- package/dist/components/Confirmation.js +72 -19
- package/dist/components/DiffDisplay.d.ts +0 -1
- package/dist/components/DiffDisplay.d.ts.map +1 -1
- package/dist/components/DiffDisplay.js +38 -59
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +6 -5
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +4 -3
- package/dist/components/PlanDisplay.d.ts.map +1 -1
- package/dist/components/PlanDisplay.js +2 -2
- package/dist/components/PluginDetail.js +1 -1
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +4 -0
- package/dist/components/TaskManager.d.ts +6 -0
- package/dist/components/TaskManager.d.ts.map +1 -0
- package/dist/components/TaskManager.js +114 -0
- package/dist/components/ToolResultDisplay.d.ts.map +1 -1
- package/dist/components/ToolResultDisplay.js +2 -1
- package/dist/contexts/useChat.d.ts +5 -4
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +16 -12
- package/dist/hooks/useInputManager.d.ts +2 -2
- package/dist/hooks/useInputManager.js +10 -10
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +8 -4
- package/dist/managers/InputManager.d.ts +7 -6
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +17 -12
- package/package.json +6 -6
- package/src/commands/plugin/uninstall.ts +1 -1
- package/src/components/CommandSelector.tsx +3 -3
- package/src/components/Confirmation.tsx +114 -24
- package/src/components/DiffDisplay.tsx +60 -106
- package/src/components/InputBox.tsx +9 -7
- package/src/components/Markdown.tsx +10 -4
- package/src/components/PlanDisplay.tsx +14 -19
- package/src/components/PluginDetail.tsx +1 -1
- package/src/components/SubagentBlock.tsx +5 -0
- package/src/components/{BashShellManager.tsx → TaskManager.tsx} +79 -75
- package/src/components/ToolResultDisplay.tsx +4 -0
- package/src/contexts/useChat.tsx +25 -20
- package/src/hooks/useInputManager.ts +10 -10
- package/src/hooks/usePluginManager.ts +10 -4
- package/src/managers/InputManager.ts +22 -15
- package/dist/components/BashShellManager.d.ts +0 -6
- package/dist/components/BashShellManager.d.ts.map +0 -1
- package/dist/components/BashShellManager.js +0 -116
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BashShellManager.d.ts","sourceRoot":"","sources":["../../src/components/BashShellManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAwS5D,CAAC"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { useChat } from "../contexts/useChat.js";
|
|
5
|
-
export const BashShellManager = ({ onCancel, }) => {
|
|
6
|
-
const { backgroundShells, getBackgroundShellOutput, killBackgroundShell } = useChat();
|
|
7
|
-
const [shells, setShells] = useState([]);
|
|
8
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
9
|
-
const [viewMode, setViewMode] = useState("list");
|
|
10
|
-
const [detailShellId, setDetailShellId] = useState(null);
|
|
11
|
-
const [detailOutput, setDetailOutput] = useState(null);
|
|
12
|
-
// Convert backgroundShells to local BashShell format
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setShells(backgroundShells.map((shell) => ({
|
|
15
|
-
id: shell.id,
|
|
16
|
-
command: shell.command,
|
|
17
|
-
status: shell.status,
|
|
18
|
-
startTime: shell.startTime,
|
|
19
|
-
exitCode: shell.exitCode,
|
|
20
|
-
runtime: shell.runtime,
|
|
21
|
-
})));
|
|
22
|
-
}, [backgroundShells]);
|
|
23
|
-
// Load detail output for selected shell
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (viewMode === "detail" && detailShellId) {
|
|
26
|
-
const output = getBackgroundShellOutput(detailShellId);
|
|
27
|
-
setDetailOutput(output);
|
|
28
|
-
}
|
|
29
|
-
}, [viewMode, detailShellId, getBackgroundShellOutput]);
|
|
30
|
-
const formatDuration = (ms) => {
|
|
31
|
-
if (ms < 1000)
|
|
32
|
-
return `${ms}ms`;
|
|
33
|
-
if (ms < 60000)
|
|
34
|
-
return `${Math.round(ms / 1000)}s`;
|
|
35
|
-
const minutes = Math.floor(ms / 60000);
|
|
36
|
-
const seconds = Math.round((ms % 60000) / 1000);
|
|
37
|
-
return `${minutes}m ${seconds}s`;
|
|
38
|
-
};
|
|
39
|
-
const formatTime = (timestamp) => {
|
|
40
|
-
return new Date(timestamp).toLocaleTimeString();
|
|
41
|
-
};
|
|
42
|
-
const killShell = (shellId) => {
|
|
43
|
-
killBackgroundShell(shellId);
|
|
44
|
-
};
|
|
45
|
-
useInput((input, key) => {
|
|
46
|
-
if (viewMode === "list") {
|
|
47
|
-
// List mode navigation
|
|
48
|
-
if (key.return) {
|
|
49
|
-
if (shells.length > 0 && selectedIndex < shells.length) {
|
|
50
|
-
const selectedShell = shells[selectedIndex];
|
|
51
|
-
setDetailShellId(selectedShell.id);
|
|
52
|
-
setViewMode("detail");
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (key.escape) {
|
|
57
|
-
onCancel();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (key.upArrow) {
|
|
61
|
-
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (key.downArrow) {
|
|
65
|
-
setSelectedIndex(Math.min(shells.length - 1, selectedIndex + 1));
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (input === "k" && shells.length > 0 && selectedIndex < shells.length) {
|
|
69
|
-
const selectedShell = shells[selectedIndex];
|
|
70
|
-
if (selectedShell.status === "running") {
|
|
71
|
-
killShell(selectedShell.id);
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else if (viewMode === "detail") {
|
|
77
|
-
// Detail mode navigation
|
|
78
|
-
if (key.escape) {
|
|
79
|
-
setViewMode("list");
|
|
80
|
-
setDetailShellId(null);
|
|
81
|
-
setDetailOutput(null);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (input === "k" && detailShellId) {
|
|
85
|
-
const shell = shells.find((s) => s.id === detailShellId);
|
|
86
|
-
if (shell && shell.status === "running") {
|
|
87
|
-
killShell(detailShellId);
|
|
88
|
-
}
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (viewMode === "detail" && detailShellId && detailOutput) {
|
|
94
|
-
const shell = shells.find((s) => s.id === detailShellId);
|
|
95
|
-
if (!shell) {
|
|
96
|
-
setViewMode("list");
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: "cyan", bold: true, children: ["Background Shell Details: ", shell.id] }) }), _jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Command:" }), " ", shell.command] }) }), _jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Status:" }), " ", shell.status, shell.exitCode !== undefined &&
|
|
100
|
-
` (exit code: ${shell.exitCode})`] }) }), _jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Started:" }), " ", formatTime(shell.startTime), shell.runtime !== undefined && (_jsxs(Text, { children: [" ", "| ", _jsx(Text, { color: "blue", children: "Runtime:" }), " ", formatDuration(shell.runtime)] }))] }) })] }), detailOutput.stdout && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: "green", bold: true, children: "STDOUT (last 10 lines):" }), _jsx(Box, { borderStyle: "single", borderColor: "green", padding: 1, children: _jsx(Text, { children: detailOutput.stdout.split("\n").slice(-10).join("\n") }) })] })), detailOutput.stderr && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: "red", bold: true, children: "STDERR:" }), _jsx(Box, { borderStyle: "single", borderColor: "red", padding: 1, children: _jsx(Text, { color: "red", children: detailOutput.stderr.split("\n").slice(-10).join("\n") }) })] })), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: [shell.status === "running" ? "k to kill · " : "", "Esc to go back"] }) })] }));
|
|
101
|
-
}
|
|
102
|
-
if (!backgroundShells) {
|
|
103
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "Background Bash Shells" }), _jsx(Text, { children: "Background bash shells not available" }), _jsx(Text, { dimColor: true, children: "Press Escape to close" })] }));
|
|
104
|
-
}
|
|
105
|
-
if (shells.length === 0) {
|
|
106
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "Background Bash Shells" }), _jsx(Text, { children: "No background shells found" }), _jsx(Text, { dimColor: true, children: "Press Escape to close" })] }));
|
|
107
|
-
}
|
|
108
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Background Bash Shells" }) }), _jsx(Text, { dimColor: true, children: "Select a shell to view details" }), shells.map((shell, index) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: index === selectedIndex ? "black" : "white", backgroundColor: index === selectedIndex ? "cyan" : undefined, children: [index === selectedIndex ? "▶ " : " ", index + 1, ".", " ", shell.command.length > 50
|
|
109
|
-
? shell.command.substring(0, 47) + "..."
|
|
110
|
-
: shell.command, _jsxs(Text, { color: shell.status === "running"
|
|
111
|
-
? "green"
|
|
112
|
-
: shell.status === "completed"
|
|
113
|
-
? "blue"
|
|
114
|
-
: "red", children: [" ", "(", shell.status, ")"] })] }), index === selectedIndex && (_jsx(Box, { marginLeft: 4, flexDirection: "column", children: _jsxs(Text, { color: "gray", dimColor: true, children: ["ID: ", shell.id, " | Started: ", formatTime(shell.startTime), shell.runtime !== undefined &&
|
|
115
|
-
` | Runtime: ${formatDuration(shell.runtime)}`, shell.exitCode !== undefined && ` | Exit: ${shell.exitCode}`] }) }))] }, shell.id))), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["\u2191/\u2193 to select \u00B7 Enter to view \u00B7", " ", shells[selectedIndex]?.status === "running" ? "k to kill · " : "", "Esc to close"] }) })] }));
|
|
116
|
-
};
|