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
package/src/contexts/useChat.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
Message,
|
|
13
13
|
McpServerStatus,
|
|
14
14
|
BackgroundTask,
|
|
15
|
+
Task,
|
|
15
16
|
SlashCommand,
|
|
16
17
|
PermissionDecision,
|
|
17
18
|
PermissionMode,
|
|
@@ -30,9 +31,10 @@ export interface ChatContextType {
|
|
|
30
31
|
isLoading: boolean;
|
|
31
32
|
isCommandRunning: boolean;
|
|
32
33
|
isCompressing: boolean;
|
|
33
|
-
userInputHistory: string[];
|
|
34
34
|
// Message display state
|
|
35
35
|
isExpanded: boolean;
|
|
36
|
+
isTaskListVisible: boolean;
|
|
37
|
+
setIsTaskListVisible: (visible: boolean) => void;
|
|
36
38
|
// AI functionality
|
|
37
39
|
sessionId: string;
|
|
38
40
|
sendMessage: (
|
|
@@ -41,14 +43,14 @@ export interface ChatContextType {
|
|
|
41
43
|
) => Promise<void>;
|
|
42
44
|
abortMessage: () => void;
|
|
43
45
|
latestTotalTokens: number;
|
|
44
|
-
// Memory functionality
|
|
45
|
-
saveMemory: (message: string, type: "project" | "user") => Promise<void>;
|
|
46
46
|
// MCP functionality
|
|
47
47
|
mcpServers: McpServerStatus[];
|
|
48
48
|
connectMcpServer: (serverName: string) => Promise<boolean>;
|
|
49
49
|
disconnectMcpServer: (serverName: string) => Promise<boolean>;
|
|
50
50
|
// Background tasks
|
|
51
51
|
backgroundTasks: BackgroundTask[];
|
|
52
|
+
// Session tasks
|
|
53
|
+
sessionTasks: Task[];
|
|
52
54
|
getBackgroundTaskOutput: (
|
|
53
55
|
taskId: string,
|
|
54
56
|
) => { stdout: string; stderr: string; status: string } | null;
|
|
@@ -58,6 +60,7 @@ export interface ChatContextType {
|
|
|
58
60
|
hasSlashCommand: (commandId: string) => boolean;
|
|
59
61
|
// Subagent messages
|
|
60
62
|
subagentMessages: Record<string, Message[]>;
|
|
63
|
+
subagentLatestTokens: Record<string, number>;
|
|
61
64
|
// Permission functionality
|
|
62
65
|
permissionMode: PermissionMode;
|
|
63
66
|
setPermissionMode: (mode: PermissionMode) => void;
|
|
@@ -83,6 +86,12 @@ export interface ChatContextType {
|
|
|
83
86
|
// Rewind functionality
|
|
84
87
|
rewindId: number;
|
|
85
88
|
handleRewindSelect: (index: number) => Promise<void>;
|
|
89
|
+
getFullMessageThread: () => Promise<{
|
|
90
|
+
messages: Message[];
|
|
91
|
+
sessionIds: string[];
|
|
92
|
+
}>;
|
|
93
|
+
wasLastDetailsTooTall: number;
|
|
94
|
+
setWasLastDetailsTooTall: React.Dispatch<React.SetStateAction<number>>;
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
const ChatContext = createContext<ChatContextType | null>(null);
|
|
@@ -110,6 +119,14 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
110
119
|
|
|
111
120
|
// Message Display State
|
|
112
121
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
122
|
+
const isExpandedRef = useRef(isExpanded);
|
|
123
|
+
const frozenMessagesRef = useRef<Message[] | null>(null);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
isExpandedRef.current = isExpanded;
|
|
127
|
+
}, [isExpanded]);
|
|
128
|
+
|
|
129
|
+
const [isTaskListVisible, setIsTaskListVisible] = useState(true);
|
|
113
130
|
|
|
114
131
|
// AI State
|
|
115
132
|
const [messages, setMessages] = useState<Message[]>([]);
|
|
@@ -118,13 +135,14 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
118
135
|
const [sessionId, setSessionId] = useState("");
|
|
119
136
|
const [isCommandRunning, setIsCommandRunning] = useState(false);
|
|
120
137
|
const [isCompressing, setIsCompressing] = useState(false);
|
|
121
|
-
const [userInputHistory, setUserInputHistory] = useState<string[]>([]);
|
|
122
138
|
|
|
123
139
|
// MCP State
|
|
124
140
|
const [mcpServers, setMcpServers] = useState<McpServerStatus[]>([]);
|
|
125
141
|
|
|
126
142
|
// Background tasks state
|
|
127
143
|
const [backgroundTasks, setBackgroundTasks] = useState<BackgroundTask[]>([]);
|
|
144
|
+
// Session tasks state
|
|
145
|
+
const [sessionTasks, setSessionTasks] = useState<Task[]>([]);
|
|
128
146
|
|
|
129
147
|
// Command state
|
|
130
148
|
const [slashCommands, setSlashCommands] = useState<SlashCommand[]>([]);
|
|
@@ -133,6 +151,9 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
133
151
|
const [subagentMessages, setSubagentMessages] = useState<
|
|
134
152
|
Record<string, Message[]>
|
|
135
153
|
>({});
|
|
154
|
+
const [subagentLatestTokens, setSubagentLatestTokens] = useState<
|
|
155
|
+
Record<string, number>
|
|
156
|
+
>({});
|
|
136
157
|
|
|
137
158
|
// Permission state
|
|
138
159
|
const [permissionMode, setPermissionModeState] =
|
|
@@ -171,6 +192,9 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
171
192
|
// Rewind state
|
|
172
193
|
const [rewindId, setRewindId] = useState(0);
|
|
173
194
|
|
|
195
|
+
// Confirmation too tall state
|
|
196
|
+
const [wasLastDetailsTooTall, setWasLastDetailsTooTall] = useState(0);
|
|
197
|
+
|
|
174
198
|
const agentRef = useRef<Agent | null>(null);
|
|
175
199
|
|
|
176
200
|
// Permission confirmation methods with queue support
|
|
@@ -203,35 +227,46 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
203
227
|
const initializeAgent = async () => {
|
|
204
228
|
const callbacks: AgentCallbacks = {
|
|
205
229
|
onMessagesChange: (newMessages) => {
|
|
206
|
-
|
|
230
|
+
if (isExpandedRef.current) {
|
|
231
|
+
frozenMessagesRef.current = [...newMessages];
|
|
232
|
+
} else {
|
|
233
|
+
setMessages([...newMessages]);
|
|
234
|
+
}
|
|
207
235
|
},
|
|
208
236
|
onServersChange: (servers) => {
|
|
209
237
|
setMcpServers([...servers]);
|
|
210
238
|
},
|
|
211
239
|
onSessionIdChange: (sessionId) => {
|
|
212
|
-
|
|
213
|
-
setSessionId(sessionId);
|
|
214
|
-
});
|
|
240
|
+
setSessionId(sessionId);
|
|
215
241
|
},
|
|
216
242
|
onLatestTotalTokensChange: (tokens) => {
|
|
217
243
|
setlatestTotalTokens(tokens);
|
|
218
244
|
},
|
|
219
|
-
onUserInputHistoryChange: (history) => {
|
|
220
|
-
setUserInputHistory([...history]);
|
|
221
|
-
},
|
|
222
245
|
onCompressionStateChange: (isCompressingState) => {
|
|
223
246
|
setIsCompressing(isCompressingState);
|
|
224
247
|
},
|
|
225
248
|
onTasksChange: (tasks) => {
|
|
226
249
|
setBackgroundTasks([...tasks]);
|
|
227
250
|
},
|
|
228
|
-
|
|
251
|
+
onSessionTasksChange: (tasks) => {
|
|
252
|
+
setSessionTasks([...tasks]);
|
|
253
|
+
},
|
|
254
|
+
onSubagentMessagesChange: (subagentId: string, messages: Message[]) => {
|
|
229
255
|
logger.debug("onSubagentMessagesChange", subagentId, messages.length);
|
|
230
256
|
setSubagentMessages((prev) => ({
|
|
231
257
|
...prev,
|
|
232
258
|
[subagentId]: [...messages],
|
|
233
259
|
}));
|
|
234
260
|
},
|
|
261
|
+
onSubagentLatestTotalTokensChange: (
|
|
262
|
+
subagentId: string,
|
|
263
|
+
tokens: number,
|
|
264
|
+
) => {
|
|
265
|
+
setSubagentLatestTokens((prev) => ({
|
|
266
|
+
...prev,
|
|
267
|
+
[subagentId]: tokens,
|
|
268
|
+
}));
|
|
269
|
+
},
|
|
235
270
|
onPermissionModeChange: (mode) => {
|
|
236
271
|
setPermissionModeState(mode);
|
|
237
272
|
},
|
|
@@ -283,7 +318,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
283
318
|
setlatestTotalTokens(agent.latestTotalTokens);
|
|
284
319
|
setIsCommandRunning(agent.isCommandRunning);
|
|
285
320
|
setIsCompressing(agent.isCompressing);
|
|
286
|
-
setUserInputHistory(agent.userInputHistory);
|
|
287
321
|
setPermissionModeState(agent.getPermissionMode());
|
|
288
322
|
|
|
289
323
|
// Get initial MCP servers state
|
|
@@ -338,16 +372,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
338
372
|
if (!hasTextContent && !hasImageAttachments) return;
|
|
339
373
|
|
|
340
374
|
try {
|
|
341
|
-
// Handle memory mode - check if it's a memory message (starts with # and only one line)
|
|
342
|
-
if (content.startsWith("#") && !content.includes("\n")) {
|
|
343
|
-
const memoryText = content.substring(1).trim();
|
|
344
|
-
if (!memoryText) return;
|
|
345
|
-
|
|
346
|
-
// In memory mode, don't add user message, only wait for user to choose memory type then add assistant message
|
|
347
|
-
// Don't auto-save, wait for user to choose memory type
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
375
|
// Handle bash mode - check if it's a bash command (starts with ! and only one line)
|
|
352
376
|
if (content.startsWith("!") && !content.includes("\n")) {
|
|
353
377
|
const command = content.substring(1).trim();
|
|
@@ -394,14 +418,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
394
418
|
agentRef.current?.abortMessage();
|
|
395
419
|
}, []);
|
|
396
420
|
|
|
397
|
-
// Memory save function - delegate to Agent
|
|
398
|
-
const saveMemory = useCallback(
|
|
399
|
-
async (message: string, type: "project" | "user") => {
|
|
400
|
-
await agentRef.current?.saveMemory(message, type);
|
|
401
|
-
},
|
|
402
|
-
[],
|
|
403
|
-
);
|
|
404
|
-
|
|
405
421
|
// Permission management methods
|
|
406
422
|
const setPermissionMode = useCallback((mode: PermissionMode) => {
|
|
407
423
|
setPermissionModeState((prev) => {
|
|
@@ -492,27 +508,38 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
492
508
|
await agentRef.current.truncateHistory(index);
|
|
493
509
|
|
|
494
510
|
// Clear terminal screen after rewind
|
|
495
|
-
|
|
496
|
-
setRewindId((prev) => prev + 1);
|
|
497
|
-
});
|
|
511
|
+
setRewindId((prev) => prev + 1);
|
|
498
512
|
} catch (error) {
|
|
499
513
|
logger.error("Failed to rewind:", error);
|
|
500
514
|
}
|
|
501
515
|
}
|
|
502
516
|
}, []);
|
|
503
517
|
|
|
518
|
+
const getFullMessageThread = useCallback(async () => {
|
|
519
|
+
if (agentRef.current) {
|
|
520
|
+
return await agentRef.current.getFullMessageThread();
|
|
521
|
+
}
|
|
522
|
+
return { messages: [], sessionIds: [] };
|
|
523
|
+
}, []);
|
|
524
|
+
|
|
504
525
|
// Listen for Ctrl+O hotkey to toggle collapse/expand state and ESC to cancel confirmation
|
|
505
526
|
useInput((input, key) => {
|
|
506
527
|
if (key.ctrl && input === "o") {
|
|
507
528
|
// Clear terminal screen when expanded state changes
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
529
|
+
setIsExpanded((prev) => {
|
|
530
|
+
const newExpanded = !prev;
|
|
531
|
+
if (!newExpanded && frozenMessagesRef.current) {
|
|
532
|
+
setMessages(frozenMessagesRef.current);
|
|
533
|
+
frozenMessagesRef.current = null;
|
|
534
|
+
}
|
|
535
|
+
return newExpanded;
|
|
513
536
|
});
|
|
514
537
|
}
|
|
515
538
|
|
|
539
|
+
if (key.ctrl && input === "t") {
|
|
540
|
+
setIsTaskListVisible((prev) => !prev);
|
|
541
|
+
}
|
|
542
|
+
|
|
516
543
|
// Handle ESC key to cancel confirmation
|
|
517
544
|
if (key.escape && isConfirmationVisible) {
|
|
518
545
|
handleConfirmationCancel();
|
|
@@ -523,23 +550,25 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
523
550
|
messages,
|
|
524
551
|
isLoading,
|
|
525
552
|
isCommandRunning,
|
|
526
|
-
userInputHistory,
|
|
527
553
|
isExpanded,
|
|
554
|
+
isTaskListVisible,
|
|
555
|
+
setIsTaskListVisible,
|
|
528
556
|
sessionId,
|
|
529
557
|
sendMessage,
|
|
530
558
|
abortMessage,
|
|
531
559
|
latestTotalTokens,
|
|
532
560
|
isCompressing,
|
|
533
|
-
saveMemory,
|
|
534
561
|
mcpServers,
|
|
535
562
|
connectMcpServer,
|
|
536
563
|
disconnectMcpServer,
|
|
537
564
|
backgroundTasks,
|
|
565
|
+
sessionTasks,
|
|
538
566
|
getBackgroundTaskOutput,
|
|
539
567
|
stopBackgroundTask,
|
|
540
568
|
slashCommands,
|
|
541
569
|
hasSlashCommand,
|
|
542
570
|
subagentMessages,
|
|
571
|
+
subagentLatestTokens,
|
|
543
572
|
permissionMode,
|
|
544
573
|
setPermissionMode,
|
|
545
574
|
isConfirmationVisible,
|
|
@@ -551,6 +580,9 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
551
580
|
backgroundCurrentTask,
|
|
552
581
|
rewindId,
|
|
553
582
|
handleRewindSelect,
|
|
583
|
+
getFullMessageThread,
|
|
584
|
+
wasLastDetailsTooTall,
|
|
585
|
+
setWasLastDetailsTooTall,
|
|
554
586
|
};
|
|
555
587
|
|
|
556
588
|
return (
|
|
@@ -33,13 +33,11 @@ export const useInputManager = (
|
|
|
33
33
|
show: false,
|
|
34
34
|
query: "",
|
|
35
35
|
});
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
message: "",
|
|
39
|
-
});
|
|
40
|
-
const [showTaskManager, setShowTaskManager] = useState(false);
|
|
36
|
+
const [showBackgroundTaskManager, setShowBackgroundTaskManager] =
|
|
37
|
+
useState(false);
|
|
41
38
|
const [showMcpManager, setShowMcpManager] = useState(false);
|
|
42
39
|
const [showRewindManager, setShowRewindManager] = useState(false);
|
|
40
|
+
const [showHelp, setShowHelp] = useState(false);
|
|
43
41
|
const [permissionMode, setPermissionModeState] =
|
|
44
42
|
useState<PermissionMode>("default");
|
|
45
43
|
const [attachedImages, setAttachedImages] = useState<AttachedImage[]>([]);
|
|
@@ -61,11 +59,8 @@ export const useInputManager = (
|
|
|
61
59
|
onHistorySearchStateChange: (show, query) => {
|
|
62
60
|
setHistorySearchState({ show, query });
|
|
63
61
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
onTaskManagerStateChange: (show) => {
|
|
68
|
-
setShowTaskManager(show);
|
|
62
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
63
|
+
setShowBackgroundTaskManager(show);
|
|
69
64
|
},
|
|
70
65
|
onMcpManagerStateChange: (show) => {
|
|
71
66
|
setShowMcpManager(show);
|
|
@@ -73,14 +68,14 @@ export const useInputManager = (
|
|
|
73
68
|
onRewindManagerStateChange: (show) => {
|
|
74
69
|
setShowRewindManager(show);
|
|
75
70
|
},
|
|
71
|
+
onHelpStateChange: (show) => {
|
|
72
|
+
setShowHelp(show);
|
|
73
|
+
},
|
|
76
74
|
onPermissionModeChange: (mode) => {
|
|
77
75
|
setPermissionModeState(mode);
|
|
78
76
|
callbacks.onPermissionModeChange?.(mode);
|
|
79
77
|
},
|
|
80
78
|
onImagesStateChange: setAttachedImages,
|
|
81
|
-
onShowTaskManager: () => setShowTaskManager(true),
|
|
82
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
83
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
84
79
|
...callbacks,
|
|
85
80
|
});
|
|
86
81
|
|
|
@@ -101,11 +96,8 @@ export const useInputManager = (
|
|
|
101
96
|
onHistorySearchStateChange: (show, query) => {
|
|
102
97
|
setHistorySearchState({ show, query });
|
|
103
98
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
onTaskManagerStateChange: (show) => {
|
|
108
|
-
setShowTaskManager(show);
|
|
99
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
100
|
+
setShowBackgroundTaskManager(show);
|
|
109
101
|
},
|
|
110
102
|
onMcpManagerStateChange: (show) => {
|
|
111
103
|
setShowMcpManager(show);
|
|
@@ -113,14 +105,14 @@ export const useInputManager = (
|
|
|
113
105
|
onRewindManagerStateChange: (show) => {
|
|
114
106
|
setShowRewindManager(show);
|
|
115
107
|
},
|
|
108
|
+
onHelpStateChange: (show) => {
|
|
109
|
+
setShowHelp(show);
|
|
110
|
+
},
|
|
116
111
|
onPermissionModeChange: (mode) => {
|
|
117
112
|
setPermissionModeState(mode);
|
|
118
113
|
callbacks.onPermissionModeChange?.(mode);
|
|
119
114
|
},
|
|
120
115
|
onImagesStateChange: setAttachedImages,
|
|
121
|
-
onShowTaskManager: () => setShowTaskManager(true),
|
|
122
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
123
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
124
116
|
...callbacks,
|
|
125
117
|
});
|
|
126
118
|
}
|
|
@@ -165,14 +157,6 @@ export const useInputManager = (
|
|
|
165
157
|
managerRef.current?.moveCursorRight();
|
|
166
158
|
}, []);
|
|
167
159
|
|
|
168
|
-
const moveCursorToStart = useCallback(() => {
|
|
169
|
-
managerRef.current?.moveCursorToStart();
|
|
170
|
-
}, []);
|
|
171
|
-
|
|
172
|
-
const moveCursorToEnd = useCallback(() => {
|
|
173
|
-
managerRef.current?.moveCursorToEnd();
|
|
174
|
-
}, []);
|
|
175
|
-
|
|
176
160
|
// File selector methods
|
|
177
161
|
const activateFileSelector = useCallback((position: number) => {
|
|
178
162
|
managerRef.current?.activateFileSelector(position);
|
|
@@ -252,43 +236,6 @@ export const useInputManager = (
|
|
|
252
236
|
managerRef.current?.handleCancelHistorySearch();
|
|
253
237
|
}, []);
|
|
254
238
|
|
|
255
|
-
// Memory type selector methods
|
|
256
|
-
const activateMemoryTypeSelector = useCallback((message: string) => {
|
|
257
|
-
managerRef.current?.activateMemoryTypeSelector(message);
|
|
258
|
-
}, []);
|
|
259
|
-
|
|
260
|
-
const handleMemoryTypeSelect = useCallback(
|
|
261
|
-
async (type: "project" | "user") => {
|
|
262
|
-
await managerRef.current?.handleMemoryTypeSelect(type);
|
|
263
|
-
},
|
|
264
|
-
[],
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
const handleCancelMemoryTypeSelect = useCallback(() => {
|
|
268
|
-
managerRef.current?.handleCancelMemoryTypeSelect();
|
|
269
|
-
}, []);
|
|
270
|
-
|
|
271
|
-
// Input history methods
|
|
272
|
-
const setUserInputHistory = useCallback((history: string[]) => {
|
|
273
|
-
managerRef.current?.setUserInputHistory(history);
|
|
274
|
-
}, []);
|
|
275
|
-
|
|
276
|
-
const navigateHistory = useCallback(
|
|
277
|
-
(direction: "up" | "down", currentInput: string) => {
|
|
278
|
-
return (
|
|
279
|
-
managerRef.current?.navigateHistory(direction, currentInput) || {
|
|
280
|
-
newInput: currentInput,
|
|
281
|
-
newCursorPosition: currentInput.length,
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
},
|
|
285
|
-
[],
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
const resetHistoryNavigation = useCallback(() => {
|
|
289
|
-
managerRef.current?.resetHistoryNavigation();
|
|
290
|
-
}, []);
|
|
291
|
-
|
|
292
239
|
// Special character handling
|
|
293
240
|
const handleSpecialCharInput = useCallback((char: string) => {
|
|
294
241
|
managerRef.current?.handleSpecialCharInput(char);
|
|
@@ -317,11 +264,10 @@ export const useInputManager = (
|
|
|
317
264
|
slashPosition: commandSelectorState.position,
|
|
318
265
|
showHistorySearch: historySearchState.show,
|
|
319
266
|
historySearchQuery: historySearchState.query,
|
|
320
|
-
|
|
321
|
-
memoryMessage: memoryTypeSelectorState.message,
|
|
322
|
-
showTaskManager,
|
|
267
|
+
showBackgroundTaskManager,
|
|
323
268
|
showMcpManager,
|
|
324
269
|
showRewindManager,
|
|
270
|
+
showHelp,
|
|
325
271
|
permissionMode,
|
|
326
272
|
attachedImages,
|
|
327
273
|
isManagerReady,
|
|
@@ -332,8 +278,6 @@ export const useInputManager = (
|
|
|
332
278
|
clearInput,
|
|
333
279
|
moveCursorLeft,
|
|
334
280
|
moveCursorRight,
|
|
335
|
-
moveCursorToStart,
|
|
336
|
-
moveCursorToEnd,
|
|
337
281
|
|
|
338
282
|
// File selector
|
|
339
283
|
activateFileSelector,
|
|
@@ -354,22 +298,12 @@ export const useInputManager = (
|
|
|
354
298
|
handleHistorySearchSelect,
|
|
355
299
|
handleCancelHistorySearch,
|
|
356
300
|
|
|
357
|
-
// Memory type selector
|
|
358
|
-
activateMemoryTypeSelector,
|
|
359
|
-
handleMemoryTypeSelect,
|
|
360
|
-
handleCancelMemoryTypeSelect,
|
|
361
|
-
|
|
362
|
-
// Input history
|
|
363
|
-
setUserInputHistory,
|
|
364
|
-
navigateHistory,
|
|
365
|
-
resetHistoryNavigation,
|
|
366
|
-
|
|
367
301
|
// Special handling
|
|
368
302
|
handleSpecialCharInput,
|
|
369
303
|
|
|
370
304
|
// Bash/MCP Manager
|
|
371
|
-
|
|
372
|
-
managerRef.current?.
|
|
305
|
+
setShowBackgroundTaskManager: useCallback((show: boolean) => {
|
|
306
|
+
managerRef.current?.setShowBackgroundTaskManager(show);
|
|
373
307
|
}, []),
|
|
374
308
|
setShowMcpManager: useCallback((show: boolean) => {
|
|
375
309
|
managerRef.current?.setShowMcpManager(show);
|
|
@@ -378,6 +312,10 @@ export const useInputManager = (
|
|
|
378
312
|
managerRef.current?.setShowRewindManager(show);
|
|
379
313
|
setShowRewindManager(show);
|
|
380
314
|
}, []),
|
|
315
|
+
setShowHelp: useCallback((show: boolean) => {
|
|
316
|
+
managerRef.current?.setShowHelp(show);
|
|
317
|
+
setShowHelp(show);
|
|
318
|
+
}, []),
|
|
381
319
|
setPermissionMode: useCallback((mode: PermissionMode) => {
|
|
382
320
|
setPermissionModeState(mode);
|
|
383
321
|
managerRef.current?.setPermissionMode(mode);
|