wave-code 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +2 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +24 -52
- package/dist/components/App.d.ts +3 -4
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +49 -6
- package/dist/components/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/components/BackgroundTaskManager.js +12 -20
- package/dist/components/BangDisplay.d.ts +9 -0
- package/dist/components/BangDisplay.d.ts.map +1 -0
- package/dist/components/{CommandOutputDisplay.js → BangDisplay.js} +1 -1
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +3 -2
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +18 -2
- package/dist/components/ConfirmationSelector.d.ts.map +1 -1
- package/dist/components/ConfirmationSelector.js +105 -8
- package/dist/components/HelpView.d.ts.map +1 -1
- package/dist/components/HelpView.js +2 -0
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +19 -25
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +9 -3
- package/dist/components/MarketplaceAddForm.d.ts.map +1 -1
- package/dist/components/MarketplaceAddForm.js +13 -6
- package/dist/components/MarketplaceDetail.d.ts.map +1 -1
- package/dist/components/MarketplaceDetail.js +8 -3
- package/dist/components/MessageBlockItem.js +2 -2
- package/dist/components/MessageList.d.ts +4 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +15 -8
- package/dist/components/PluginDetail.d.ts.map +1 -1
- package/dist/components/PluginDetail.js +14 -3
- package/dist/components/PluginManagerShell.d.ts.map +1 -1
- package/dist/components/PluginManagerShell.js +3 -3
- package/dist/components/PluginManagerTypes.d.ts +2 -0
- package/dist/components/PluginManagerTypes.d.ts.map +1 -1
- package/dist/components/SessionSelector.d.ts.map +1 -1
- package/dist/components/SessionSelector.js +10 -13
- package/dist/components/StatusCommand.d.ts +6 -0
- package/dist/components/StatusCommand.d.ts.map +1 -0
- package/dist/components/StatusCommand.js +28 -0
- package/dist/components/WorktreeExitPrompt.d.ts +13 -0
- package/dist/components/WorktreeExitPrompt.d.ts.map +1 -0
- package/dist/components/WorktreeExitPrompt.js +26 -0
- package/dist/contexts/useChat.d.ts +9 -5
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +38 -8
- package/dist/contracts/status.d.ts +8 -0
- package/dist/contracts/status.d.ts.map +1 -0
- package/dist/contracts/status.js +1 -0
- package/dist/hooks/useInputManager.d.ts +2 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +12 -0
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +41 -13
- package/dist/hooks/useTasks.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -4
- package/dist/managers/InputManager.d.ts +6 -0
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +32 -13
- package/dist/print-cli.d.ts +2 -4
- package/dist/print-cli.d.ts.map +1 -1
- package/dist/print-cli.js +31 -2
- package/dist/session-selector-cli.d.ts +3 -1
- package/dist/session-selector-cli.d.ts.map +1 -1
- package/dist/session-selector-cli.js +2 -2
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/worktree.d.ts +23 -0
- package/dist/utils/worktree.d.ts.map +1 -0
- package/dist/utils/worktree.js +135 -0
- package/package.json +2 -2
- package/src/cli.tsx +36 -59
- package/src/components/App.tsx +99 -11
- package/src/components/BackgroundTaskManager.tsx +12 -20
- package/src/components/{CommandOutputDisplay.tsx → BangDisplay.tsx} +4 -4
- package/src/components/ChatInterface.tsx +8 -0
- package/src/components/CommandSelector.tsx +18 -1
- package/src/components/ConfirmationSelector.tsx +118 -9
- package/src/components/HelpView.tsx +2 -0
- package/src/components/HistorySearch.tsx +25 -30
- package/src/components/InputBox.tsx +11 -1
- package/src/components/MarketplaceAddForm.tsx +21 -8
- package/src/components/MarketplaceDetail.tsx +19 -4
- package/src/components/MessageBlockItem.tsx +3 -3
- package/src/components/MessageList.tsx +47 -23
- package/src/components/PluginDetail.tsx +30 -6
- package/src/components/PluginManagerShell.tsx +24 -6
- package/src/components/PluginManagerTypes.ts +2 -0
- package/src/components/SessionSelector.tsx +38 -24
- package/src/components/StatusCommand.tsx +94 -0
- package/src/components/WorktreeExitPrompt.tsx +86 -0
- package/src/contexts/useChat.tsx +57 -13
- package/src/contracts/status.ts +7 -0
- package/src/hooks/useInputManager.ts +12 -0
- package/src/hooks/usePluginManager.ts +47 -13
- package/src/hooks/useTasks.ts +2 -2
- package/src/index.ts +71 -12
- package/src/managers/InputManager.ts +37 -15
- package/src/print-cli.ts +48 -5
- package/src/session-selector-cli.tsx +6 -2
- package/src/types.ts +11 -0
- package/src/utils/worktree.ts +164 -0
- package/dist/components/CommandOutputDisplay.d.ts +0 -9
- package/dist/components/CommandOutputDisplay.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import os from "os";
|
|
2
3
|
import { Box, Text, Static } from "ink";
|
|
3
4
|
import type { Message } from "wave-agent-sdk";
|
|
4
5
|
import { MessageBlockItem } from "./MessageBlockItem.js";
|
|
@@ -7,6 +8,9 @@ export interface MessageListProps {
|
|
|
7
8
|
messages: Message[];
|
|
8
9
|
isExpanded?: boolean;
|
|
9
10
|
hideDynamicBlocks?: boolean;
|
|
11
|
+
version?: string;
|
|
12
|
+
workdir?: string;
|
|
13
|
+
model?: string;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export const MessageList = React.memo(
|
|
@@ -14,17 +18,23 @@ export const MessageList = React.memo(
|
|
|
14
18
|
messages,
|
|
15
19
|
isExpanded = false,
|
|
16
20
|
hideDynamicBlocks = false,
|
|
21
|
+
version,
|
|
22
|
+
workdir,
|
|
23
|
+
model,
|
|
17
24
|
}: MessageListProps) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const welcomeMessage = (
|
|
26
|
+
<Box flexDirection="column" paddingTop={1}>
|
|
27
|
+
<Text color="gray">
|
|
28
|
+
WAVE{version ? ` v${version}` : ""}
|
|
29
|
+
{model ? ` • ${model}` : ""}
|
|
30
|
+
</Text>
|
|
31
|
+
{workdir && (
|
|
32
|
+
<Text color="gray" wrap="truncate-middle">
|
|
33
|
+
{workdir.replace(os.homedir(), "~")}
|
|
34
|
+
</Text>
|
|
35
|
+
)}
|
|
36
|
+
</Box>
|
|
37
|
+
);
|
|
28
38
|
|
|
29
39
|
// Limit messages when expanded to prevent long rendering times
|
|
30
40
|
const maxExpandedMessages = 20;
|
|
@@ -54,7 +64,7 @@ export const MessageList = React.memo(
|
|
|
54
64
|
const isDynamic =
|
|
55
65
|
isLastMessage &&
|
|
56
66
|
((block.type === "tool" && block.stage !== "end") ||
|
|
57
|
-
(block.type === "
|
|
67
|
+
(block.type === "bang" && block.isRunning));
|
|
58
68
|
return { ...item, isDynamic };
|
|
59
69
|
});
|
|
60
70
|
|
|
@@ -63,20 +73,34 @@ export const MessageList = React.memo(
|
|
|
63
73
|
? []
|
|
64
74
|
: blocksWithStatus.filter((b) => b.isDynamic);
|
|
65
75
|
|
|
76
|
+
const staticItems = [
|
|
77
|
+
{ isWelcome: true, key: "welcome", block: undefined, message: undefined },
|
|
78
|
+
...staticBlocks.map((b) => ({ ...b, isWelcome: false })),
|
|
79
|
+
];
|
|
80
|
+
|
|
66
81
|
return (
|
|
67
82
|
<Box flexDirection="column" paddingBottom={1}>
|
|
68
|
-
{/* Static blocks */}
|
|
69
|
-
{
|
|
70
|
-
<Static items={
|
|
71
|
-
{(item) =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
{/* Static items (Welcome message + Static blocks) */}
|
|
84
|
+
{staticItems.length > 0 && (
|
|
85
|
+
<Static items={staticItems}>
|
|
86
|
+
{(item) => {
|
|
87
|
+
if (item.isWelcome) {
|
|
88
|
+
return (
|
|
89
|
+
<React.Fragment key={item.key}>
|
|
90
|
+
{welcomeMessage}
|
|
91
|
+
</React.Fragment>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return (
|
|
95
|
+
<MessageBlockItem
|
|
96
|
+
key={item.key}
|
|
97
|
+
block={item.block!}
|
|
98
|
+
message={item.message!}
|
|
99
|
+
isExpanded={isExpanded}
|
|
100
|
+
paddingTop={1}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}}
|
|
80
104
|
</Static>
|
|
81
105
|
)}
|
|
82
106
|
|
|
@@ -49,7 +49,7 @@ export const PluginDetail: React.FC = () => {
|
|
|
49
49
|
setSelectedScopeIndex((prev) =>
|
|
50
50
|
prev < SCOPES.length - 1 ? prev + 1 : 0,
|
|
51
51
|
);
|
|
52
|
-
} else if (key.return && plugin) {
|
|
52
|
+
} else if (key.return && plugin && !state.isLoading) {
|
|
53
53
|
if (isInstalledAndEnabled) {
|
|
54
54
|
setSelectedActionIndex((prev) => {
|
|
55
55
|
const action = INSTALLED_ACTIONS[prev].id;
|
|
@@ -70,7 +70,6 @@ export const PluginDetail: React.FC = () => {
|
|
|
70
70
|
return prev;
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
actions.setView("INSTALLED");
|
|
74
73
|
}
|
|
75
74
|
});
|
|
76
75
|
|
|
@@ -102,6 +101,11 @@ export const PluginDetail: React.FC = () => {
|
|
|
102
101
|
</Text>
|
|
103
102
|
</Box>
|
|
104
103
|
)}
|
|
104
|
+
{state.isLoading && (
|
|
105
|
+
<Box marginBottom={1}>
|
|
106
|
+
<Text color="yellow">⌛ Processing operation...</Text>
|
|
107
|
+
</Box>
|
|
108
|
+
)}
|
|
105
109
|
|
|
106
110
|
<Box marginTop={1} flexDirection="column">
|
|
107
111
|
{isInstalledAndEnabled ? (
|
|
@@ -110,14 +114,24 @@ export const PluginDetail: React.FC = () => {
|
|
|
110
114
|
{INSTALLED_ACTIONS.map((action, index) => (
|
|
111
115
|
<Text
|
|
112
116
|
key={action.id}
|
|
113
|
-
color={
|
|
117
|
+
color={
|
|
118
|
+
index === selectedActionIndex
|
|
119
|
+
? state.isLoading
|
|
120
|
+
? "gray"
|
|
121
|
+
: "yellow"
|
|
122
|
+
: undefined
|
|
123
|
+
}
|
|
114
124
|
>
|
|
115
125
|
{index === selectedActionIndex ? "> " : " "}
|
|
116
126
|
{action.label}
|
|
117
127
|
</Text>
|
|
118
128
|
))}
|
|
119
129
|
<Box marginTop={1}>
|
|
120
|
-
<Text dimColor>
|
|
130
|
+
<Text dimColor>
|
|
131
|
+
{state.isLoading
|
|
132
|
+
? "Please wait..."
|
|
133
|
+
: "Use ↑/↓ to select, Enter to confirm"}
|
|
134
|
+
</Text>
|
|
121
135
|
</Box>
|
|
122
136
|
</Box>
|
|
123
137
|
) : (
|
|
@@ -126,14 +140,24 @@ export const PluginDetail: React.FC = () => {
|
|
|
126
140
|
{SCOPES.map((scope, index) => (
|
|
127
141
|
<Text
|
|
128
142
|
key={scope.id}
|
|
129
|
-
color={
|
|
143
|
+
color={
|
|
144
|
+
index === selectedScopeIndex
|
|
145
|
+
? state.isLoading
|
|
146
|
+
? "gray"
|
|
147
|
+
: "green"
|
|
148
|
+
: undefined
|
|
149
|
+
}
|
|
130
150
|
>
|
|
131
151
|
{index === selectedScopeIndex ? "> " : " "}
|
|
132
152
|
{scope.label}
|
|
133
153
|
</Text>
|
|
134
154
|
))}
|
|
135
155
|
<Box marginTop={1}>
|
|
136
|
-
<Text dimColor>
|
|
156
|
+
<Text dimColor>
|
|
157
|
+
{state.isLoading
|
|
158
|
+
? "Please wait..."
|
|
159
|
+
: "Use ↑/↓ to select, Enter to install"}
|
|
160
|
+
</Text>
|
|
137
161
|
</Box>
|
|
138
162
|
</Box>
|
|
139
163
|
)}
|
|
@@ -172,14 +172,32 @@ export const PluginManagerShell: React.FC<{ children?: React.ReactNode }> = ({
|
|
|
172
172
|
borderLeft={false}
|
|
173
173
|
borderRight={false}
|
|
174
174
|
>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
<Box flexGrow={1}>
|
|
176
|
+
<Text dimColor>
|
|
177
|
+
{state.isLoading
|
|
178
|
+
? "Loading..."
|
|
179
|
+
: "Use Tab to switch views, arrows to navigate, Enter to select, Esc to go back"}
|
|
180
|
+
</Text>
|
|
181
|
+
</Box>
|
|
182
|
+
{state.isLoading && (
|
|
183
|
+
<Box marginLeft={2}>
|
|
184
|
+
<Text color="yellow" bold>
|
|
185
|
+
⌛ Processing...
|
|
186
|
+
</Text>
|
|
187
|
+
</Box>
|
|
188
|
+
)}
|
|
189
|
+
{state.successMessage && (
|
|
190
|
+
<Box marginLeft={2}>
|
|
191
|
+
<Text color="green" bold>
|
|
192
|
+
✓ {state.successMessage}
|
|
193
|
+
</Text>
|
|
194
|
+
</Box>
|
|
195
|
+
)}
|
|
180
196
|
{state.error && (
|
|
181
197
|
<Box marginLeft={2}>
|
|
182
|
-
<Text color="red"
|
|
198
|
+
<Text color="red" bold>
|
|
199
|
+
✗ Error: {state.error}
|
|
200
|
+
</Text>
|
|
183
201
|
</Box>
|
|
184
202
|
)}
|
|
185
203
|
</Box>
|
|
@@ -17,6 +17,7 @@ export interface PluginManagerState {
|
|
|
17
17
|
selectedId: string | null; // Plugin name or Marketplace name
|
|
18
18
|
isLoading: boolean;
|
|
19
19
|
error: string | null;
|
|
20
|
+
successMessage: string | null;
|
|
20
21
|
searchQuery: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -43,5 +44,6 @@ export interface PluginManagerContextType {
|
|
|
43
44
|
uninstallPlugin: (name: string, marketplace: string) => Promise<void>;
|
|
44
45
|
updatePlugin: (name: string, marketplace: string) => Promise<void>;
|
|
45
46
|
refresh: () => Promise<void>;
|
|
47
|
+
clearPluginFeedback: () => void;
|
|
46
48
|
};
|
|
47
49
|
}
|
|
@@ -17,12 +17,9 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
17
17
|
|
|
18
18
|
useInput((input, key) => {
|
|
19
19
|
if (key.return) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return prev;
|
|
25
|
-
});
|
|
20
|
+
if (sessions.length > 0 && selectedIndex < sessions.length) {
|
|
21
|
+
onSelect(sessions[selectedIndex].id);
|
|
22
|
+
}
|
|
26
23
|
return;
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -32,12 +29,12 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
if (key.upArrow) {
|
|
35
|
-
setSelectedIndex(
|
|
32
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
36
33
|
return;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
if (key.downArrow) {
|
|
40
|
-
setSelectedIndex(
|
|
37
|
+
setSelectedIndex(Math.min(sessions.length - 1, selectedIndex + 1));
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
40
|
});
|
|
@@ -59,15 +56,18 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
59
56
|
);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
const
|
|
59
|
+
const MAX_VISIBLE_ITEMS = 3;
|
|
63
60
|
const startIndex = Math.max(
|
|
64
61
|
0,
|
|
65
62
|
Math.min(
|
|
66
|
-
selectedIndex - Math.floor(
|
|
67
|
-
sessions.length -
|
|
63
|
+
selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2),
|
|
64
|
+
Math.max(0, sessions.length - MAX_VISIBLE_ITEMS),
|
|
68
65
|
),
|
|
69
66
|
);
|
|
70
|
-
const displaySessions = sessions.slice(
|
|
67
|
+
const displaySessions = sessions.slice(
|
|
68
|
+
startIndex,
|
|
69
|
+
startIndex + MAX_VISIBLE_ITEMS,
|
|
70
|
+
);
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<Box
|
|
@@ -95,26 +95,40 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
95
95
|
return (
|
|
96
96
|
<Box key={session.id} flexDirection="column" width="100%">
|
|
97
97
|
<Box width="100%">
|
|
98
|
-
<
|
|
99
|
-
color={isSelected ? "black" : "white"}
|
|
98
|
+
<Box
|
|
100
99
|
backgroundColor={isSelected ? "cyan" : undefined}
|
|
100
|
+
flexShrink={0}
|
|
101
101
|
>
|
|
102
|
-
{isSelected ? "
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
<Text color={isSelected ? "black" : "white"}>
|
|
103
|
+
{isSelected ? "▶ " : " "}
|
|
104
|
+
</Text>
|
|
105
|
+
</Box>
|
|
106
|
+
<Box
|
|
107
|
+
backgroundColor={isSelected ? "cyan" : undefined}
|
|
108
|
+
flexGrow={1}
|
|
109
|
+
>
|
|
110
|
+
<Text
|
|
111
|
+
color={isSelected ? "black" : "white"}
|
|
112
|
+
wrap="truncate-end"
|
|
113
|
+
>
|
|
114
|
+
{session.id} | {lastActiveAt} | {session.latestTotalTokens}{" "}
|
|
115
|
+
tokens
|
|
116
|
+
</Text>
|
|
117
|
+
</Box>
|
|
111
118
|
</Box>
|
|
119
|
+
{isSelected && session.firstMessage && (
|
|
120
|
+
<Box marginLeft={2} width="100%">
|
|
121
|
+
<Text dimColor italic wrap="truncate-end">
|
|
122
|
+
{session.firstMessage.replace(/\n/g, "\\n")}
|
|
123
|
+
</Text>
|
|
124
|
+
</Box>
|
|
125
|
+
)}
|
|
112
126
|
</Box>
|
|
113
127
|
);
|
|
114
128
|
})}
|
|
115
129
|
</Box>
|
|
116
130
|
|
|
117
|
-
{sessions.length >
|
|
131
|
+
{sessions.length > MAX_VISIBLE_ITEMS && (
|
|
118
132
|
<Box>
|
|
119
133
|
<Text dimColor>
|
|
120
134
|
... showing {displaySessions.length} of {sessions.length} sessions
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { useChat } from "../contexts/useChat.js";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
export interface StatusCommandProps {
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const StatusCommand: React.FC<StatusCommandProps> = ({ onCancel }) => {
|
|
16
|
+
const { sessionId, workingDirectory, getGatewayConfig, getModelConfig } =
|
|
17
|
+
useChat();
|
|
18
|
+
|
|
19
|
+
useInput((_, key) => {
|
|
20
|
+
if (key.escape) {
|
|
21
|
+
onCancel();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const gatewayConfig = getGatewayConfig();
|
|
26
|
+
const modelConfig = getModelConfig();
|
|
27
|
+
|
|
28
|
+
let version = "unknown";
|
|
29
|
+
try {
|
|
30
|
+
const pkgPath = path.resolve(__dirname, "../../package.json");
|
|
31
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
32
|
+
version = pkg.version;
|
|
33
|
+
} catch {
|
|
34
|
+
// Fallback if package.json cannot be read
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Box
|
|
39
|
+
flexDirection="column"
|
|
40
|
+
borderStyle="round"
|
|
41
|
+
borderColor="cyan"
|
|
42
|
+
borderLeft={false}
|
|
43
|
+
borderRight={false}
|
|
44
|
+
paddingX={1}
|
|
45
|
+
>
|
|
46
|
+
<Box marginBottom={1}>
|
|
47
|
+
<Text color="cyan" bold underline>
|
|
48
|
+
Agent Status
|
|
49
|
+
</Text>
|
|
50
|
+
</Box>
|
|
51
|
+
|
|
52
|
+
<Box>
|
|
53
|
+
<Box width={20}>
|
|
54
|
+
<Text color="yellow">Version:</Text>
|
|
55
|
+
</Box>
|
|
56
|
+
<Text color="white">{version}</Text>
|
|
57
|
+
</Box>
|
|
58
|
+
|
|
59
|
+
<Box>
|
|
60
|
+
<Box width={20}>
|
|
61
|
+
<Text color="yellow">Session ID:</Text>
|
|
62
|
+
</Box>
|
|
63
|
+
<Text color="white">{sessionId}</Text>
|
|
64
|
+
</Box>
|
|
65
|
+
|
|
66
|
+
<Box>
|
|
67
|
+
<Box width={20}>
|
|
68
|
+
<Text color="yellow">cwd:</Text>
|
|
69
|
+
</Box>
|
|
70
|
+
<Text color="white" wrap="wrap">
|
|
71
|
+
{workingDirectory}
|
|
72
|
+
</Text>
|
|
73
|
+
</Box>
|
|
74
|
+
|
|
75
|
+
<Box>
|
|
76
|
+
<Box width={20}>
|
|
77
|
+
<Text color="yellow">Wave base URL:</Text>
|
|
78
|
+
</Box>
|
|
79
|
+
<Text color="white">{gatewayConfig.baseURL}</Text>
|
|
80
|
+
</Box>
|
|
81
|
+
|
|
82
|
+
<Box>
|
|
83
|
+
<Box width={20}>
|
|
84
|
+
<Text color="yellow">Model:</Text>
|
|
85
|
+
</Box>
|
|
86
|
+
<Text color="white">{modelConfig.model}</Text>
|
|
87
|
+
</Box>
|
|
88
|
+
|
|
89
|
+
<Box marginTop={1}>
|
|
90
|
+
<Text dimColor>Esc to cancel</Text>
|
|
91
|
+
</Box>
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
|
|
4
|
+
interface WorktreeExitPromptProps {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
hasUncommittedChanges: boolean;
|
|
8
|
+
hasNewCommits: boolean;
|
|
9
|
+
onKeep: () => void;
|
|
10
|
+
onRemove: () => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const WorktreeExitPrompt: React.FC<WorktreeExitPromptProps> = ({
|
|
15
|
+
name,
|
|
16
|
+
path: worktreePath,
|
|
17
|
+
hasUncommittedChanges,
|
|
18
|
+
hasNewCommits,
|
|
19
|
+
onKeep,
|
|
20
|
+
onRemove,
|
|
21
|
+
onCancel,
|
|
22
|
+
}) => {
|
|
23
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
24
|
+
|
|
25
|
+
useInput((input, key) => {
|
|
26
|
+
if (key.upArrow) {
|
|
27
|
+
setSelectedIndex((prev) => (prev === 0 ? 1 : 0));
|
|
28
|
+
}
|
|
29
|
+
if (key.downArrow) {
|
|
30
|
+
setSelectedIndex((prev) => (prev === 1 ? 0 : 1));
|
|
31
|
+
}
|
|
32
|
+
if (key.return) {
|
|
33
|
+
if (selectedIndex === 0) {
|
|
34
|
+
onKeep();
|
|
35
|
+
} else {
|
|
36
|
+
onRemove();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (key.escape) {
|
|
40
|
+
onCancel();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Box flexDirection="column" paddingX={1} marginY={1}>
|
|
46
|
+
<Box marginBottom={1}>
|
|
47
|
+
<Text bold>Exiting worktree session</Text>
|
|
48
|
+
</Box>
|
|
49
|
+
<Box marginBottom={1}>
|
|
50
|
+
{hasUncommittedChanges && hasNewCommits ? (
|
|
51
|
+
<Text>
|
|
52
|
+
You have uncommitted changes and new commits. These will be lost if
|
|
53
|
+
you remove the worktree.
|
|
54
|
+
</Text>
|
|
55
|
+
) : hasUncommittedChanges ? (
|
|
56
|
+
<Text>
|
|
57
|
+
You have uncommitted changes. These will be lost if you remove the
|
|
58
|
+
worktree.
|
|
59
|
+
</Text>
|
|
60
|
+
) : (
|
|
61
|
+
<Text>
|
|
62
|
+
You have new commits on worktree-{name}. The branch will be deleted
|
|
63
|
+
if you remove the worktree.
|
|
64
|
+
</Text>
|
|
65
|
+
)}
|
|
66
|
+
</Box>
|
|
67
|
+
<Box flexDirection="column">
|
|
68
|
+
<Box>
|
|
69
|
+
<Text color={selectedIndex === 0 ? "cyan" : undefined}>
|
|
70
|
+
{selectedIndex === 0 ? "❯ " : " "}Keep worktree Stays at{" "}
|
|
71
|
+
{worktreePath}
|
|
72
|
+
</Text>
|
|
73
|
+
</Box>
|
|
74
|
+
<Box>
|
|
75
|
+
<Text color={selectedIndex === 1 ? "cyan" : undefined}>
|
|
76
|
+
{selectedIndex === 1 ? "❯ " : " "}Remove worktree All changes and
|
|
77
|
+
commits will be lost.
|
|
78
|
+
</Text>
|
|
79
|
+
</Box>
|
|
80
|
+
</Box>
|
|
81
|
+
<Box marginTop={1}>
|
|
82
|
+
<Text dimColor>Enter to confirm · Esc to cancel</Text>
|
|
83
|
+
</Box>
|
|
84
|
+
</Box>
|
|
85
|
+
);
|
|
86
|
+
};
|