wave-code 0.4.0 → 0.6.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/App.d.ts.map +1 -1
- package/dist/components/App.js +38 -2
- package/dist/components/BackgroundTaskManager.d.ts +6 -0
- package/dist/components/BackgroundTaskManager.d.ts.map +1 -0
- package/dist/components/BackgroundTaskManager.js +114 -0
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +39 -5
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +13 -5
- 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} +92 -101
- package/dist/components/DiffDisplay.d.ts +0 -1
- package/dist/components/DiffDisplay.d.ts.map +1 -1
- package/dist/components/DiffDisplay.js +82 -60
- package/dist/components/FileSelector.d.ts.map +1 -1
- package/dist/components/FileSelector.js +2 -2
- 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 +9 -18
- 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 -120
- package/dist/components/MessageItem.d.ts.map +1 -1
- package/dist/components/MessageItem.js +1 -2
- package/dist/components/MessageList.d.ts +2 -3
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +7 -7
- package/dist/components/PlanDisplay.d.ts.map +1 -1
- package/dist/components/PlanDisplay.js +4 -12
- package/dist/components/PluginDetail.js +1 -1
- package/dist/components/RewindCommand.d.ts +4 -0
- package/dist/components/RewindCommand.d.ts.map +1 -1
- package/dist/components/RewindCommand.js +19 -2
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +12 -5
- package/dist/components/TaskList.d.ts +3 -0
- package/dist/components/TaskList.d.ts.map +1 -0
- package/dist/components/TaskList.js +49 -0
- package/dist/components/ToolResultDisplay.d.ts.map +1 -1
- package/dist/components/ToolResultDisplay.js +2 -1
- package/dist/contexts/useChat.d.ts +15 -6
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +52 -43
- package/dist/hooks/useInputManager.d.ts +2 -13
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +8 -57
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +8 -4
- 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 +5 -28
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +26 -127
- package/package.json +9 -10
- package/src/commands/plugin/uninstall.ts +1 -1
- package/src/components/App.tsx +50 -3
- package/src/components/{BashShellManager.tsx → BackgroundTaskManager.tsx} +79 -73
- package/src/components/ChatInterface.tsx +79 -23
- package/src/components/CommandSelector.tsx +38 -20
- package/src/components/CompressDisplay.tsx +5 -22
- package/src/components/ConfirmationDetails.tsx +108 -0
- package/src/components/{Confirmation.tsx → ConfirmationSelector.tsx} +162 -187
- package/src/components/DiffDisplay.tsx +122 -107
- package/src/components/FileSelector.tsx +0 -2
- package/src/components/HistorySearch.tsx +45 -21
- package/src/components/InputBox.tsx +14 -34
- package/src/components/LoadingIndicator.tsx +56 -0
- package/src/components/Markdown.tsx +126 -318
- package/src/components/MessageItem.tsx +1 -3
- package/src/components/MessageList.tsx +10 -67
- package/src/components/PlanDisplay.tsx +5 -33
- package/src/components/PluginDetail.tsx +1 -1
- package/src/components/RewindCommand.tsx +38 -1
- package/src/components/SubagentBlock.tsx +28 -14
- package/src/components/TaskList.tsx +70 -0
- package/src/components/ToolResultDisplay.tsx +6 -2
- package/src/contexts/useChat.tsx +82 -60
- package/src/hooks/useInputManager.ts +9 -73
- package/src/hooks/usePluginManager.ts +10 -4
- package/src/hooks/useTasks.ts +6 -0
- package/src/managers/InputManager.ts +30 -157
- package/dist/components/BashShellManager.d.ts +0 -6
- package/dist/components/BashShellManager.d.ts.map +0 -1
- package/dist/components/BashShellManager.js +0 -116
- 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/src/components/MemoryDisplay.tsx +0 -62
- package/src/components/MemoryTypeSelector.tsx +0 -98
|
@@ -33,11 +33,8 @@ export const useInputManager = (
|
|
|
33
33
|
show: false,
|
|
34
34
|
query: "",
|
|
35
35
|
});
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
message: "",
|
|
39
|
-
});
|
|
40
|
-
const [showBashManager, setShowBashManager] = useState(false);
|
|
36
|
+
const [showBackgroundTaskManager, setShowBackgroundTaskManager] =
|
|
37
|
+
useState(false);
|
|
41
38
|
const [showMcpManager, setShowMcpManager] = useState(false);
|
|
42
39
|
const [showRewindManager, setShowRewindManager] = useState(false);
|
|
43
40
|
const [permissionMode, setPermissionModeState] =
|
|
@@ -61,11 +58,8 @@ export const useInputManager = (
|
|
|
61
58
|
onHistorySearchStateChange: (show, query) => {
|
|
62
59
|
setHistorySearchState({ show, query });
|
|
63
60
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
onBashManagerStateChange: (show) => {
|
|
68
|
-
setShowBashManager(show);
|
|
61
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
62
|
+
setShowBackgroundTaskManager(show);
|
|
69
63
|
},
|
|
70
64
|
onMcpManagerStateChange: (show) => {
|
|
71
65
|
setShowMcpManager(show);
|
|
@@ -78,9 +72,6 @@ export const useInputManager = (
|
|
|
78
72
|
callbacks.onPermissionModeChange?.(mode);
|
|
79
73
|
},
|
|
80
74
|
onImagesStateChange: setAttachedImages,
|
|
81
|
-
onShowBashManager: () => setShowBashManager(true),
|
|
82
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
83
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
84
75
|
...callbacks,
|
|
85
76
|
});
|
|
86
77
|
|
|
@@ -101,11 +92,8 @@ export const useInputManager = (
|
|
|
101
92
|
onHistorySearchStateChange: (show, query) => {
|
|
102
93
|
setHistorySearchState({ show, query });
|
|
103
94
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
onBashManagerStateChange: (show) => {
|
|
108
|
-
setShowBashManager(show);
|
|
95
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
96
|
+
setShowBackgroundTaskManager(show);
|
|
109
97
|
},
|
|
110
98
|
onMcpManagerStateChange: (show) => {
|
|
111
99
|
setShowMcpManager(show);
|
|
@@ -118,9 +106,6 @@ export const useInputManager = (
|
|
|
118
106
|
callbacks.onPermissionModeChange?.(mode);
|
|
119
107
|
},
|
|
120
108
|
onImagesStateChange: setAttachedImages,
|
|
121
|
-
onShowBashManager: () => setShowBashManager(true),
|
|
122
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
123
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
124
109
|
...callbacks,
|
|
125
110
|
});
|
|
126
111
|
}
|
|
@@ -252,43 +237,6 @@ export const useInputManager = (
|
|
|
252
237
|
managerRef.current?.handleCancelHistorySearch();
|
|
253
238
|
}, []);
|
|
254
239
|
|
|
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
240
|
// Special character handling
|
|
293
241
|
const handleSpecialCharInput = useCallback((char: string) => {
|
|
294
242
|
managerRef.current?.handleSpecialCharInput(char);
|
|
@@ -317,9 +265,7 @@ export const useInputManager = (
|
|
|
317
265
|
slashPosition: commandSelectorState.position,
|
|
318
266
|
showHistorySearch: historySearchState.show,
|
|
319
267
|
historySearchQuery: historySearchState.query,
|
|
320
|
-
|
|
321
|
-
memoryMessage: memoryTypeSelectorState.message,
|
|
322
|
-
showBashManager,
|
|
268
|
+
showBackgroundTaskManager,
|
|
323
269
|
showMcpManager,
|
|
324
270
|
showRewindManager,
|
|
325
271
|
permissionMode,
|
|
@@ -354,22 +300,12 @@ export const useInputManager = (
|
|
|
354
300
|
handleHistorySearchSelect,
|
|
355
301
|
handleCancelHistorySearch,
|
|
356
302
|
|
|
357
|
-
// Memory type selector
|
|
358
|
-
activateMemoryTypeSelector,
|
|
359
|
-
handleMemoryTypeSelect,
|
|
360
|
-
handleCancelMemoryTypeSelect,
|
|
361
|
-
|
|
362
|
-
// Input history
|
|
363
|
-
setUserInputHistory,
|
|
364
|
-
navigateHistory,
|
|
365
|
-
resetHistoryNavigation,
|
|
366
|
-
|
|
367
303
|
// Special handling
|
|
368
304
|
handleSpecialCharInput,
|
|
369
305
|
|
|
370
306
|
// Bash/MCP Manager
|
|
371
|
-
|
|
372
|
-
managerRef.current?.
|
|
307
|
+
setShowBackgroundTaskManager: useCallback((show: boolean) => {
|
|
308
|
+
managerRef.current?.setShowBackgroundTaskManager(show);
|
|
373
309
|
}, []),
|
|
374
310
|
setShowMcpManager: useCallback((show: boolean) => {
|
|
375
311
|
managerRef.current?.setShowMcpManager(show);
|
|
@@ -210,7 +210,8 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
210
210
|
}));
|
|
211
211
|
try {
|
|
212
212
|
const pluginId = `${name}@${marketplace}`;
|
|
213
|
-
|
|
213
|
+
const workdir = process.cwd();
|
|
214
|
+
await marketplaceService.installPlugin(pluginId, workdir);
|
|
214
215
|
await pluginScopeManager.enablePlugin(scope, pluginId);
|
|
215
216
|
await refresh();
|
|
216
217
|
} catch (error) {
|
|
@@ -233,11 +234,16 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
233
234
|
}));
|
|
234
235
|
try {
|
|
235
236
|
const pluginId = `${name}@${marketplace}`;
|
|
236
|
-
|
|
237
|
+
const workdir = process.cwd();
|
|
238
|
+
|
|
239
|
+
// 1. Remove from global registry and potentially clean up cache
|
|
240
|
+
await marketplaceService.uninstallPlugin(pluginId, workdir);
|
|
241
|
+
|
|
242
|
+
// 2. Find the scope where it's currently enabled and remove it from there
|
|
237
243
|
const scope = pluginScopeManager.findPluginScope(pluginId);
|
|
238
244
|
if (scope) {
|
|
239
245
|
await configurationService.removeEnabledPlugin(
|
|
240
|
-
|
|
246
|
+
workdir,
|
|
241
247
|
scope,
|
|
242
248
|
pluginId,
|
|
243
249
|
);
|
|
@@ -251,7 +257,7 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
251
257
|
}));
|
|
252
258
|
}
|
|
253
259
|
},
|
|
254
|
-
[configurationService, pluginScopeManager, refresh],
|
|
260
|
+
[configurationService, marketplaceService, pluginScopeManager, refresh],
|
|
255
261
|
);
|
|
256
262
|
|
|
257
263
|
const updatePlugin = useCallback(
|
|
@@ -29,11 +29,7 @@ export interface InputManagerCallbacks {
|
|
|
29
29
|
position: number,
|
|
30
30
|
) => void;
|
|
31
31
|
onHistorySearchStateChange?: (show: boolean, query: string) => void;
|
|
32
|
-
|
|
33
|
-
onShowBashManager?: () => void;
|
|
34
|
-
onShowMcpManager?: () => void;
|
|
35
|
-
onShowRewindManager?: () => void;
|
|
36
|
-
onBashManagerStateChange?: (show: boolean) => void;
|
|
32
|
+
onBackgroundTaskManagerStateChange?: (show: boolean) => void;
|
|
37
33
|
onMcpManagerStateChange?: (show: boolean) => void;
|
|
38
34
|
onRewindManagerStateChange?: (show: boolean) => void;
|
|
39
35
|
onImagesStateChange?: (images: AttachedImage[]) => void;
|
|
@@ -42,8 +38,8 @@ export interface InputManagerCallbacks {
|
|
|
42
38
|
images?: Array<{ path: string; mimeType: string }>,
|
|
43
39
|
) => void | Promise<void>;
|
|
44
40
|
onHasSlashCommand?: (commandId: string) => boolean;
|
|
45
|
-
onSaveMemory?: (message: string, type: "project" | "user") => Promise<void>;
|
|
46
41
|
onAbortMessage?: () => void;
|
|
42
|
+
onBackgroundCurrentTask?: () => void;
|
|
47
43
|
onResetHistoryNavigation?: () => void;
|
|
48
44
|
onPermissionModeChange?: (mode: PermissionMode) => void;
|
|
49
45
|
logger?: Logger;
|
|
@@ -70,15 +66,6 @@ export class InputManager {
|
|
|
70
66
|
private showHistorySearch: boolean = false;
|
|
71
67
|
private historySearchQuery: string = "";
|
|
72
68
|
|
|
73
|
-
// Memory type selector state
|
|
74
|
-
private showMemoryTypeSelector: boolean = false;
|
|
75
|
-
private memoryMessage: string = "";
|
|
76
|
-
|
|
77
|
-
// Input history state
|
|
78
|
-
private userInputHistory: string[] = [];
|
|
79
|
-
private historyIndex: number = -1;
|
|
80
|
-
private historyBuffer: string = "";
|
|
81
|
-
|
|
82
69
|
// Paste debounce state
|
|
83
70
|
private pasteDebounceTimer: NodeJS.Timeout | null = null;
|
|
84
71
|
private pasteBuffer: string = "";
|
|
@@ -94,7 +81,7 @@ export class InputManager {
|
|
|
94
81
|
private imageIdCounter: number = 1;
|
|
95
82
|
|
|
96
83
|
// Additional UI state
|
|
97
|
-
private
|
|
84
|
+
private showBackgroundTaskManager: boolean = false;
|
|
98
85
|
private showMcpManager: boolean = false;
|
|
99
86
|
private showRewindManager: boolean = false;
|
|
100
87
|
|
|
@@ -361,17 +348,14 @@ export class InputManager {
|
|
|
361
348
|
|
|
362
349
|
// If not an agent command or execution failed, check local commands
|
|
363
350
|
if (!commandExecuted) {
|
|
364
|
-
if (command === "
|
|
365
|
-
this.
|
|
351
|
+
if (command === "tasks") {
|
|
352
|
+
this.setShowBackgroundTaskManager(true);
|
|
366
353
|
commandExecuted = true;
|
|
367
|
-
} else if (command === "mcp"
|
|
368
|
-
this.
|
|
354
|
+
} else if (command === "mcp") {
|
|
355
|
+
this.setShowMcpManager(true);
|
|
369
356
|
commandExecuted = true;
|
|
370
|
-
} else if (
|
|
371
|
-
|
|
372
|
-
this.callbacks.onShowRewindManager
|
|
373
|
-
) {
|
|
374
|
-
this.callbacks.onShowRewindManager();
|
|
357
|
+
} else if (command === "rewind") {
|
|
358
|
+
this.setShowRewindManager(true);
|
|
375
359
|
commandExecuted = true;
|
|
376
360
|
}
|
|
377
361
|
}
|
|
@@ -438,95 +422,6 @@ export class InputManager {
|
|
|
438
422
|
return false;
|
|
439
423
|
}
|
|
440
424
|
|
|
441
|
-
// Memory type selector methods
|
|
442
|
-
activateMemoryTypeSelector(message: string): void {
|
|
443
|
-
this.showMemoryTypeSelector = true;
|
|
444
|
-
this.memoryMessage = message;
|
|
445
|
-
|
|
446
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(true, message);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
async handleMemoryTypeSelect(type: "project" | "user"): Promise<void> {
|
|
450
|
-
const currentMessage = this.inputText.trim();
|
|
451
|
-
if (currentMessage.startsWith("#")) {
|
|
452
|
-
await this.callbacks.onSaveMemory?.(currentMessage, type);
|
|
453
|
-
}
|
|
454
|
-
// Close the selector
|
|
455
|
-
this.showMemoryTypeSelector = false;
|
|
456
|
-
this.memoryMessage = "";
|
|
457
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(false, "");
|
|
458
|
-
|
|
459
|
-
// Clear input box
|
|
460
|
-
this.clearInput();
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
handleCancelMemoryTypeSelect(): void {
|
|
464
|
-
this.showMemoryTypeSelector = false;
|
|
465
|
-
this.memoryMessage = "";
|
|
466
|
-
|
|
467
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(false, "");
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// Input history methods
|
|
471
|
-
setUserInputHistory(history: string[]): void {
|
|
472
|
-
this.userInputHistory = history;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
navigateHistory(
|
|
476
|
-
direction: "up" | "down",
|
|
477
|
-
currentInput: string,
|
|
478
|
-
): { newInput: string; newCursorPosition: number } {
|
|
479
|
-
if (this.historyIndex === -1) {
|
|
480
|
-
this.historyBuffer = currentInput;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
if (direction === "up") {
|
|
484
|
-
if (this.historyIndex < this.userInputHistory.length - 1) {
|
|
485
|
-
this.historyIndex++;
|
|
486
|
-
}
|
|
487
|
-
} else {
|
|
488
|
-
// Down direction
|
|
489
|
-
if (this.historyIndex > 0) {
|
|
490
|
-
this.historyIndex--;
|
|
491
|
-
} else if (this.historyIndex === 0) {
|
|
492
|
-
// Go from first history item to draft
|
|
493
|
-
this.historyIndex = -1;
|
|
494
|
-
} else if (this.historyIndex === -1) {
|
|
495
|
-
// Go from draft to empty (beyond history bottom)
|
|
496
|
-
this.historyIndex = -2;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
let newInput: string;
|
|
501
|
-
if (this.historyIndex === -1) {
|
|
502
|
-
newInput = this.historyBuffer;
|
|
503
|
-
} else if (this.historyIndex === -2) {
|
|
504
|
-
// Beyond history bottom, clear input
|
|
505
|
-
newInput = "";
|
|
506
|
-
} else {
|
|
507
|
-
const historyItem =
|
|
508
|
-
this.userInputHistory[
|
|
509
|
-
this.userInputHistory.length - 1 - this.historyIndex
|
|
510
|
-
];
|
|
511
|
-
newInput = historyItem || "";
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
const newCursorPosition = newInput.length;
|
|
515
|
-
|
|
516
|
-
this.inputText = newInput;
|
|
517
|
-
this.cursorPosition = newCursorPosition;
|
|
518
|
-
|
|
519
|
-
this.callbacks.onInputTextChange?.(newInput);
|
|
520
|
-
this.callbacks.onCursorPositionChange?.(newCursorPosition);
|
|
521
|
-
|
|
522
|
-
return { newInput, newCursorPosition };
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
resetHistoryNavigation(): void {
|
|
526
|
-
this.historyIndex = -1;
|
|
527
|
-
this.historyBuffer = "";
|
|
528
|
-
}
|
|
529
|
-
|
|
530
425
|
// Getter methods for state
|
|
531
426
|
isFileSelectorActive(): boolean {
|
|
532
427
|
return this.showFileSelector;
|
|
@@ -536,10 +431,6 @@ export class InputManager {
|
|
|
536
431
|
return this.showCommandSelector;
|
|
537
432
|
}
|
|
538
433
|
|
|
539
|
-
isMemoryTypeSelectorActive(): boolean {
|
|
540
|
-
return this.showMemoryTypeSelector;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
434
|
getFileSelectorState() {
|
|
544
435
|
return {
|
|
545
436
|
show: this.showFileSelector,
|
|
@@ -557,13 +448,6 @@ export class InputManager {
|
|
|
557
448
|
};
|
|
558
449
|
}
|
|
559
450
|
|
|
560
|
-
getMemoryTypeSelectorState() {
|
|
561
|
-
return {
|
|
562
|
-
show: this.showMemoryTypeSelector,
|
|
563
|
-
message: this.memoryMessage,
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
|
|
567
451
|
// Update search queries for active selectors
|
|
568
452
|
private updateSearchQueriesForActiveSelectors(
|
|
569
453
|
inputText: string,
|
|
@@ -594,8 +478,6 @@ export class InputManager {
|
|
|
594
478
|
// Don't activate command selector when file selector is active
|
|
595
479
|
// Only activate command selector if '/' is at the start of input
|
|
596
480
|
this.activateCommandSelector(this.cursorPosition - 1);
|
|
597
|
-
} else if (char === "#" && this.cursorPosition === 1) {
|
|
598
|
-
// Memory message detection will be handled in submit
|
|
599
481
|
} else {
|
|
600
482
|
// Update search queries for active selectors
|
|
601
483
|
this.updateSearchQueriesForActiveSelectors(
|
|
@@ -751,14 +633,14 @@ export class InputManager {
|
|
|
751
633
|
}
|
|
752
634
|
}
|
|
753
635
|
|
|
754
|
-
//
|
|
755
|
-
|
|
756
|
-
return this.
|
|
636
|
+
// Task manager state methods
|
|
637
|
+
getShowBackgroundTaskManager(): boolean {
|
|
638
|
+
return this.showBackgroundTaskManager;
|
|
757
639
|
}
|
|
758
640
|
|
|
759
|
-
|
|
760
|
-
this.
|
|
761
|
-
this.callbacks.
|
|
641
|
+
setShowBackgroundTaskManager(show: boolean): void {
|
|
642
|
+
this.showBackgroundTaskManager = show;
|
|
643
|
+
this.callbacks.onBackgroundTaskManagerStateChange?.(show);
|
|
762
644
|
}
|
|
763
645
|
|
|
764
646
|
getShowMcpManager(): boolean {
|
|
@@ -814,15 +696,6 @@ export class InputManager {
|
|
|
814
696
|
}
|
|
815
697
|
|
|
816
698
|
if (this.inputText.trim()) {
|
|
817
|
-
const trimmedInput = this.inputText.trim();
|
|
818
|
-
|
|
819
|
-
// Check if it's a memory message (starts with # and only one line)
|
|
820
|
-
if (trimmedInput.startsWith("#") && !trimmedInput.includes("\n")) {
|
|
821
|
-
// Activate memory type selector
|
|
822
|
-
this.activateMemoryTypeSelector(trimmedInput);
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
699
|
// Extract image information
|
|
827
700
|
const imageRegex = /\[Image #(\d+)\]/g;
|
|
828
701
|
const matches = [...this.inputText.matchAll(imageRegex)];
|
|
@@ -1005,14 +878,9 @@ export class InputManager {
|
|
|
1005
878
|
return true;
|
|
1006
879
|
}
|
|
1007
880
|
|
|
1008
|
-
// Handle
|
|
1009
|
-
if (key.
|
|
1010
|
-
this.
|
|
1011
|
-
return true;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
if (key.downArrow && !this.showFileSelector && !this.showCommandSelector) {
|
|
1015
|
-
this.navigateHistory("down", this.inputText);
|
|
881
|
+
// Handle Ctrl+B for backgrounding current task
|
|
882
|
+
if (key.ctrl && input === "b") {
|
|
883
|
+
this.callbacks.onBackgroundCurrentTask?.();
|
|
1016
884
|
return true;
|
|
1017
885
|
}
|
|
1018
886
|
|
|
@@ -1053,7 +921,13 @@ export class InputManager {
|
|
|
1053
921
|
}
|
|
1054
922
|
|
|
1055
923
|
// Handle interrupt request - use Esc key to interrupt AI request or command
|
|
1056
|
-
if (
|
|
924
|
+
if (
|
|
925
|
+
key.escape &&
|
|
926
|
+
(isLoading || isCommandRunning) &&
|
|
927
|
+
!this.showBackgroundTaskManager &&
|
|
928
|
+
!this.showMcpManager &&
|
|
929
|
+
!this.showRewindManager
|
|
930
|
+
) {
|
|
1057
931
|
// Unified interrupt for AI message generation and command execution
|
|
1058
932
|
this.callbacks.onAbortMessage?.();
|
|
1059
933
|
return true;
|
|
@@ -1071,19 +945,18 @@ export class InputManager {
|
|
|
1071
945
|
this.showFileSelector ||
|
|
1072
946
|
this.showCommandSelector ||
|
|
1073
947
|
this.showHistorySearch ||
|
|
1074
|
-
this.
|
|
1075
|
-
this.showBashManager ||
|
|
948
|
+
this.showBackgroundTaskManager ||
|
|
1076
949
|
this.showMcpManager ||
|
|
1077
950
|
this.showRewindManager
|
|
1078
951
|
) {
|
|
1079
952
|
if (
|
|
1080
|
-
this.
|
|
1081
|
-
this.showBashManager ||
|
|
953
|
+
this.showBackgroundTaskManager ||
|
|
1082
954
|
this.showMcpManager ||
|
|
1083
955
|
this.showRewindManager
|
|
1084
956
|
) {
|
|
1085
|
-
//
|
|
1086
|
-
|
|
957
|
+
// Task manager, MCP manager and Rewind don't need to handle input, handled by component itself
|
|
958
|
+
// Return true to indicate we've "handled" it (by ignoring it) so it doesn't leak to normal input
|
|
959
|
+
return true;
|
|
1087
960
|
}
|
|
1088
961
|
|
|
1089
962
|
if (this.showHistorySearch) {
|
|
@@ -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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../src/components/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAmD/E,MAAM,WAAW,iBAAiB;IAChC,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;AAQD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqapD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryDisplay.d.ts","sourceRoot":"","sources":["../../src/components/MemoryDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,UAAU,kBAAkB;IAC1B,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqDtD,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from "ink";
|
|
3
|
-
export const MemoryDisplay = ({ block }) => {
|
|
4
|
-
const { content, isSuccess, memoryType, storagePath } = block;
|
|
5
|
-
const getStatusIcon = () => {
|
|
6
|
-
return isSuccess ? "💾" : "⚠️";
|
|
7
|
-
};
|
|
8
|
-
const getStatusColor = () => {
|
|
9
|
-
return isSuccess ? "green" : "red";
|
|
10
|
-
};
|
|
11
|
-
const getStatusText = () => {
|
|
12
|
-
return isSuccess ? "Added to memory" : "Failed to add memory";
|
|
13
|
-
};
|
|
14
|
-
const getStorageText = () => {
|
|
15
|
-
if (!isSuccess)
|
|
16
|
-
return null;
|
|
17
|
-
if (memoryType === "user") {
|
|
18
|
-
return `Memory saved to ${storagePath || "AGENTS.md"}`;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return `Memory saved to ${storagePath || "AGENTS.md"}`;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color: getStatusColor(), children: [getStatusIcon(), " "] }), _jsx(Text, { color: getStatusColor(), children: getStatusText() })] }), content && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsx(Box, { borderLeft: true, borderColor: isSuccess ? "green" : "red", paddingLeft: 1, children: _jsx(Text, { color: "gray", children: content }) }) })), isSuccess && (_jsx(Box, { paddingLeft: 2, marginTop: 1, children: _jsx(Text, { color: "yellow", dimColor: true, children: getStorageText() }) }))] }));
|
|
25
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface MemoryTypeSelectorProps {
|
|
3
|
-
message: string;
|
|
4
|
-
onSelect: (type: "project" | "user") => void;
|
|
5
|
-
onCancel: () => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const MemoryTypeSelector: React.FC<MemoryTypeSelectorProps>;
|
|
8
|
-
//# sourceMappingURL=MemoryTypeSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryTypeSelector.d.ts","sourceRoot":"","sources":["../../src/components/MemoryTypeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAwFhE,CAAC"}
|