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
|
@@ -29,20 +29,16 @@ export interface InputManagerCallbacks {
|
|
|
29
29
|
position: number,
|
|
30
30
|
) => void;
|
|
31
31
|
onHistorySearchStateChange?: (show: boolean, query: string) => void;
|
|
32
|
-
|
|
33
|
-
onShowTaskManager?: () => void;
|
|
34
|
-
onTaskManagerStateChange?: (show: boolean) => void;
|
|
35
|
-
onShowMcpManager?: () => void;
|
|
32
|
+
onBackgroundTaskManagerStateChange?: (show: boolean) => void;
|
|
36
33
|
onMcpManagerStateChange?: (show: boolean) => void;
|
|
37
|
-
onShowRewindManager?: () => void;
|
|
38
34
|
onRewindManagerStateChange?: (show: boolean) => void;
|
|
35
|
+
onHelpStateChange?: (show: boolean) => void;
|
|
39
36
|
onImagesStateChange?: (images: AttachedImage[]) => void;
|
|
40
37
|
onSendMessage?: (
|
|
41
38
|
content: string,
|
|
42
39
|
images?: Array<{ path: string; mimeType: string }>,
|
|
43
40
|
) => void | Promise<void>;
|
|
44
41
|
onHasSlashCommand?: (commandId: string) => boolean;
|
|
45
|
-
onSaveMemory?: (message: string, type: "project" | "user") => Promise<void>;
|
|
46
42
|
onAbortMessage?: () => void;
|
|
47
43
|
onBackgroundCurrentTask?: () => void;
|
|
48
44
|
onResetHistoryNavigation?: () => void;
|
|
@@ -71,15 +67,6 @@ export class InputManager {
|
|
|
71
67
|
private showHistorySearch: boolean = false;
|
|
72
68
|
private historySearchQuery: string = "";
|
|
73
69
|
|
|
74
|
-
// Memory type selector state
|
|
75
|
-
private showMemoryTypeSelector: boolean = false;
|
|
76
|
-
private memoryMessage: string = "";
|
|
77
|
-
|
|
78
|
-
// Input history state
|
|
79
|
-
private userInputHistory: string[] = [];
|
|
80
|
-
private historyIndex: number = -1;
|
|
81
|
-
private historyBuffer: string = "";
|
|
82
|
-
|
|
83
70
|
// Paste debounce state
|
|
84
71
|
private pasteDebounceTimer: NodeJS.Timeout | null = null;
|
|
85
72
|
private pasteBuffer: string = "";
|
|
@@ -95,9 +82,10 @@ export class InputManager {
|
|
|
95
82
|
private imageIdCounter: number = 1;
|
|
96
83
|
|
|
97
84
|
// Additional UI state
|
|
98
|
-
private
|
|
85
|
+
private showBackgroundTaskManager: boolean = false;
|
|
99
86
|
private showMcpManager: boolean = false;
|
|
100
87
|
private showRewindManager: boolean = false;
|
|
88
|
+
private showHelp: boolean = false;
|
|
101
89
|
|
|
102
90
|
// Permission mode state
|
|
103
91
|
private permissionMode: PermissionMode = "default";
|
|
@@ -195,14 +183,6 @@ export class InputManager {
|
|
|
195
183
|
this.setCursorPosition(this.cursorPosition + 1);
|
|
196
184
|
}
|
|
197
185
|
|
|
198
|
-
moveCursorToStart(): void {
|
|
199
|
-
this.setCursorPosition(0);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
moveCursorToEnd(): void {
|
|
203
|
-
this.setCursorPosition(this.inputText.length);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
186
|
// File selector methods
|
|
207
187
|
private async searchFiles(query: string): Promise<void> {
|
|
208
188
|
try {
|
|
@@ -362,17 +342,17 @@ export class InputManager {
|
|
|
362
342
|
|
|
363
343
|
// If not an agent command or execution failed, check local commands
|
|
364
344
|
if (!commandExecuted) {
|
|
365
|
-
if (command === "tasks"
|
|
366
|
-
this.
|
|
345
|
+
if (command === "tasks") {
|
|
346
|
+
this.setShowBackgroundTaskManager(true);
|
|
347
|
+
commandExecuted = true;
|
|
348
|
+
} else if (command === "mcp") {
|
|
349
|
+
this.setShowMcpManager(true);
|
|
367
350
|
commandExecuted = true;
|
|
368
|
-
} else if (command === "
|
|
369
|
-
this.
|
|
351
|
+
} else if (command === "rewind") {
|
|
352
|
+
this.setShowRewindManager(true);
|
|
370
353
|
commandExecuted = true;
|
|
371
|
-
} else if (
|
|
372
|
-
|
|
373
|
-
this.callbacks.onShowRewindManager
|
|
374
|
-
) {
|
|
375
|
-
this.callbacks.onShowRewindManager();
|
|
354
|
+
} else if (command === "help") {
|
|
355
|
+
this.setShowHelp(true);
|
|
376
356
|
commandExecuted = true;
|
|
377
357
|
}
|
|
378
358
|
}
|
|
@@ -439,95 +419,6 @@ export class InputManager {
|
|
|
439
419
|
return false;
|
|
440
420
|
}
|
|
441
421
|
|
|
442
|
-
// Memory type selector methods
|
|
443
|
-
activateMemoryTypeSelector(message: string): void {
|
|
444
|
-
this.showMemoryTypeSelector = true;
|
|
445
|
-
this.memoryMessage = message;
|
|
446
|
-
|
|
447
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(true, message);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
async handleMemoryTypeSelect(type: "project" | "user"): Promise<void> {
|
|
451
|
-
const currentMessage = this.inputText.trim();
|
|
452
|
-
if (currentMessage.startsWith("#")) {
|
|
453
|
-
await this.callbacks.onSaveMemory?.(currentMessage, type);
|
|
454
|
-
}
|
|
455
|
-
// Close the selector
|
|
456
|
-
this.showMemoryTypeSelector = false;
|
|
457
|
-
this.memoryMessage = "";
|
|
458
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(false, "");
|
|
459
|
-
|
|
460
|
-
// Clear input box
|
|
461
|
-
this.clearInput();
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
handleCancelMemoryTypeSelect(): void {
|
|
465
|
-
this.showMemoryTypeSelector = false;
|
|
466
|
-
this.memoryMessage = "";
|
|
467
|
-
|
|
468
|
-
this.callbacks.onMemoryTypeSelectorStateChange?.(false, "");
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Input history methods
|
|
472
|
-
setUserInputHistory(history: string[]): void {
|
|
473
|
-
this.userInputHistory = history;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
navigateHistory(
|
|
477
|
-
direction: "up" | "down",
|
|
478
|
-
currentInput: string,
|
|
479
|
-
): { newInput: string; newCursorPosition: number } {
|
|
480
|
-
if (this.historyIndex === -1) {
|
|
481
|
-
this.historyBuffer = currentInput;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (direction === "up") {
|
|
485
|
-
if (this.historyIndex < this.userInputHistory.length - 1) {
|
|
486
|
-
this.historyIndex++;
|
|
487
|
-
}
|
|
488
|
-
} else {
|
|
489
|
-
// Down direction
|
|
490
|
-
if (this.historyIndex > 0) {
|
|
491
|
-
this.historyIndex--;
|
|
492
|
-
} else if (this.historyIndex === 0) {
|
|
493
|
-
// Go from first history item to draft
|
|
494
|
-
this.historyIndex = -1;
|
|
495
|
-
} else if (this.historyIndex === -1) {
|
|
496
|
-
// Go from draft to empty (beyond history bottom)
|
|
497
|
-
this.historyIndex = -2;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
let newInput: string;
|
|
502
|
-
if (this.historyIndex === -1) {
|
|
503
|
-
newInput = this.historyBuffer;
|
|
504
|
-
} else if (this.historyIndex === -2) {
|
|
505
|
-
// Beyond history bottom, clear input
|
|
506
|
-
newInput = "";
|
|
507
|
-
} else {
|
|
508
|
-
const historyItem =
|
|
509
|
-
this.userInputHistory[
|
|
510
|
-
this.userInputHistory.length - 1 - this.historyIndex
|
|
511
|
-
];
|
|
512
|
-
newInput = historyItem || "";
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const newCursorPosition = newInput.length;
|
|
516
|
-
|
|
517
|
-
this.inputText = newInput;
|
|
518
|
-
this.cursorPosition = newCursorPosition;
|
|
519
|
-
|
|
520
|
-
this.callbacks.onInputTextChange?.(newInput);
|
|
521
|
-
this.callbacks.onCursorPositionChange?.(newCursorPosition);
|
|
522
|
-
|
|
523
|
-
return { newInput, newCursorPosition };
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
resetHistoryNavigation(): void {
|
|
527
|
-
this.historyIndex = -1;
|
|
528
|
-
this.historyBuffer = "";
|
|
529
|
-
}
|
|
530
|
-
|
|
531
422
|
// Getter methods for state
|
|
532
423
|
isFileSelectorActive(): boolean {
|
|
533
424
|
return this.showFileSelector;
|
|
@@ -537,10 +428,6 @@ export class InputManager {
|
|
|
537
428
|
return this.showCommandSelector;
|
|
538
429
|
}
|
|
539
430
|
|
|
540
|
-
isMemoryTypeSelectorActive(): boolean {
|
|
541
|
-
return this.showMemoryTypeSelector;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
431
|
getFileSelectorState() {
|
|
545
432
|
return {
|
|
546
433
|
show: this.showFileSelector,
|
|
@@ -558,13 +445,6 @@ export class InputManager {
|
|
|
558
445
|
};
|
|
559
446
|
}
|
|
560
447
|
|
|
561
|
-
getMemoryTypeSelectorState() {
|
|
562
|
-
return {
|
|
563
|
-
show: this.showMemoryTypeSelector,
|
|
564
|
-
message: this.memoryMessage,
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
|
|
568
448
|
// Update search queries for active selectors
|
|
569
449
|
private updateSearchQueriesForActiveSelectors(
|
|
570
450
|
inputText: string,
|
|
@@ -595,8 +475,6 @@ export class InputManager {
|
|
|
595
475
|
// Don't activate command selector when file selector is active
|
|
596
476
|
// Only activate command selector if '/' is at the start of input
|
|
597
477
|
this.activateCommandSelector(this.cursorPosition - 1);
|
|
598
|
-
} else if (char === "#" && this.cursorPosition === 1) {
|
|
599
|
-
// Memory message detection will be handled in submit
|
|
600
478
|
} else {
|
|
601
479
|
// Update search queries for active selectors
|
|
602
480
|
this.updateSearchQueriesForActiveSelectors(
|
|
@@ -753,13 +631,13 @@ export class InputManager {
|
|
|
753
631
|
}
|
|
754
632
|
|
|
755
633
|
// Task manager state methods
|
|
756
|
-
|
|
757
|
-
return this.
|
|
634
|
+
getShowBackgroundTaskManager(): boolean {
|
|
635
|
+
return this.showBackgroundTaskManager;
|
|
758
636
|
}
|
|
759
637
|
|
|
760
|
-
|
|
761
|
-
this.
|
|
762
|
-
this.callbacks.
|
|
638
|
+
setShowBackgroundTaskManager(show: boolean): void {
|
|
639
|
+
this.showBackgroundTaskManager = show;
|
|
640
|
+
this.callbacks.onBackgroundTaskManagerStateChange?.(show);
|
|
763
641
|
}
|
|
764
642
|
|
|
765
643
|
getShowMcpManager(): boolean {
|
|
@@ -780,6 +658,15 @@ export class InputManager {
|
|
|
780
658
|
this.callbacks.onRewindManagerStateChange?.(show);
|
|
781
659
|
}
|
|
782
660
|
|
|
661
|
+
getShowHelp(): boolean {
|
|
662
|
+
return this.showHelp;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
setShowHelp(show: boolean): void {
|
|
666
|
+
this.showHelp = show;
|
|
667
|
+
this.callbacks.onHelpStateChange?.(show);
|
|
668
|
+
}
|
|
669
|
+
|
|
783
670
|
// Permission mode methods
|
|
784
671
|
getPermissionMode(): PermissionMode {
|
|
785
672
|
return this.permissionMode;
|
|
@@ -815,15 +702,6 @@ export class InputManager {
|
|
|
815
702
|
}
|
|
816
703
|
|
|
817
704
|
if (this.inputText.trim()) {
|
|
818
|
-
const trimmedInput = this.inputText.trim();
|
|
819
|
-
|
|
820
|
-
// Check if it's a memory message (starts with # and only one line)
|
|
821
|
-
if (trimmedInput.startsWith("#") && !trimmedInput.includes("\n")) {
|
|
822
|
-
// Activate memory type selector
|
|
823
|
-
this.activateMemoryTypeSelector(trimmedInput);
|
|
824
|
-
return;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
705
|
// Extract image information
|
|
828
706
|
const imageRegex = /\[Image #(\d+)\]/g;
|
|
829
707
|
const matches = [...this.inputText.matchAll(imageRegex)];
|
|
@@ -982,16 +860,6 @@ export class InputManager {
|
|
|
982
860
|
return true;
|
|
983
861
|
}
|
|
984
862
|
|
|
985
|
-
if (("home" in key && key.home) || (key.ctrl && input === "a")) {
|
|
986
|
-
this.moveCursorToStart();
|
|
987
|
-
return true;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (("end" in key && key.end) || (key.ctrl && input === "e")) {
|
|
991
|
-
this.moveCursorToEnd();
|
|
992
|
-
return true;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
863
|
// Handle Ctrl+V for pasting images
|
|
996
864
|
if (key.ctrl && input === "v") {
|
|
997
865
|
this.handlePasteImage().catch((error) => {
|
|
@@ -1012,17 +880,6 @@ export class InputManager {
|
|
|
1012
880
|
return true;
|
|
1013
881
|
}
|
|
1014
882
|
|
|
1015
|
-
// Handle up/down keys for history navigation (only when no selector is active)
|
|
1016
|
-
if (key.upArrow && !this.showFileSelector && !this.showCommandSelector) {
|
|
1017
|
-
this.navigateHistory("up", this.inputText);
|
|
1018
|
-
return true;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
if (key.downArrow && !this.showFileSelector && !this.showCommandSelector) {
|
|
1022
|
-
this.navigateHistory("down", this.inputText);
|
|
1023
|
-
return true;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
883
|
// Handle typing input
|
|
1027
884
|
if (
|
|
1028
885
|
input &&
|
|
@@ -1060,7 +917,13 @@ export class InputManager {
|
|
|
1060
917
|
}
|
|
1061
918
|
|
|
1062
919
|
// Handle interrupt request - use Esc key to interrupt AI request or command
|
|
1063
|
-
if (
|
|
920
|
+
if (
|
|
921
|
+
key.escape &&
|
|
922
|
+
(isLoading || isCommandRunning) &&
|
|
923
|
+
!this.showBackgroundTaskManager &&
|
|
924
|
+
!this.showMcpManager &&
|
|
925
|
+
!this.showRewindManager
|
|
926
|
+
) {
|
|
1064
927
|
// Unified interrupt for AI message generation and command execution
|
|
1065
928
|
this.callbacks.onAbortMessage?.();
|
|
1066
929
|
return true;
|
|
@@ -1078,19 +941,20 @@ export class InputManager {
|
|
|
1078
941
|
this.showFileSelector ||
|
|
1079
942
|
this.showCommandSelector ||
|
|
1080
943
|
this.showHistorySearch ||
|
|
1081
|
-
this.
|
|
1082
|
-
this.showTaskManager ||
|
|
944
|
+
this.showBackgroundTaskManager ||
|
|
1083
945
|
this.showMcpManager ||
|
|
1084
|
-
this.showRewindManager
|
|
946
|
+
this.showRewindManager ||
|
|
947
|
+
this.showHelp
|
|
1085
948
|
) {
|
|
1086
949
|
if (
|
|
1087
|
-
this.
|
|
1088
|
-
this.showTaskManager ||
|
|
950
|
+
this.showBackgroundTaskManager ||
|
|
1089
951
|
this.showMcpManager ||
|
|
1090
|
-
this.showRewindManager
|
|
952
|
+
this.showRewindManager ||
|
|
953
|
+
this.showHelp
|
|
1091
954
|
) {
|
|
1092
|
-
//
|
|
1093
|
-
|
|
955
|
+
// Task manager, MCP manager, Rewind and Help don't need to handle input, handled by component itself
|
|
956
|
+
// Return true to indicate we've "handled" it (by ignoring it) so it doesn't leak to normal input
|
|
957
|
+
return true;
|
|
1094
958
|
}
|
|
1095
959
|
|
|
1096
960
|
if (this.showHistorySearch) {
|
package/src/print-cli.ts
CHANGED
|
@@ -76,42 +76,10 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
|
|
|
76
76
|
process.stdout.write(chunk);
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
// Tool block callback - display tool name when tool starts
|
|
80
|
-
onToolBlockUpdated: (params) => {
|
|
81
|
-
// Print tool name only during 'running' stage (happens once per tool call)
|
|
82
|
-
if (params.stage === "running" && params.name) {
|
|
83
|
-
process.stdout.write(`\n🔧 ${params.name}`);
|
|
84
|
-
if (params.compactParams) {
|
|
85
|
-
process.stdout.write(` ${params.compactParams}`);
|
|
86
|
-
}
|
|
87
|
-
process.stdout.write(`\n`);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
// Subagent block callbacks
|
|
92
|
-
onSubAgentBlockAdded: (subagentId: string, parameters) => {
|
|
93
|
-
// Display subagent creation with indentation
|
|
94
|
-
process.stdout.write(
|
|
95
|
-
`\n🤖 Subagent [${parameters.subagent_type}]: ${parameters.description}\n`,
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
onSubAgentBlockUpdated: (subagentId: string, status) => {
|
|
99
|
-
// Display subagent status updates
|
|
100
|
-
const statusIconMap = {
|
|
101
|
-
active: "🔄",
|
|
102
|
-
completed: "✅",
|
|
103
|
-
error: "❌",
|
|
104
|
-
aborted: "⚠️",
|
|
105
|
-
} as const;
|
|
106
|
-
|
|
107
|
-
const statusIcon = statusIconMap[status] ?? "🔄";
|
|
108
|
-
process.stdout.write(` ${statusIcon} Subagent status: ${status}\n`);
|
|
109
|
-
},
|
|
110
79
|
// Subagent message callbacks
|
|
111
80
|
onSubagentAssistantMessageAdded: (subagentId: string) => {
|
|
112
81
|
subagentReasoningStates.set(subagentId, false);
|
|
113
82
|
subagentContentStates.set(subagentId, false);
|
|
114
|
-
// Subagent assistant message started - add indentation
|
|
115
83
|
process.stdout.write("\n ");
|
|
116
84
|
},
|
|
117
85
|
onSubagentAssistantReasoningUpdated: (
|
|
@@ -132,13 +100,27 @@ export async function startPrintCli(options: PrintCliOptions): Promise<void> {
|
|
|
132
100
|
process.stdout.write("\n 📝 Response: ");
|
|
133
101
|
subagentContentStates.set(subagentId, true);
|
|
134
102
|
}
|
|
135
|
-
// Stream subagent content with indentation - output only the new chunk
|
|
136
103
|
process.stdout.write(chunk);
|
|
137
104
|
},
|
|
138
|
-
onSubagentUserMessageAdded: (
|
|
139
|
-
|
|
105
|
+
onSubagentUserMessageAdded: (
|
|
106
|
+
_subagentId: string,
|
|
107
|
+
params: { content: string },
|
|
108
|
+
) => {
|
|
140
109
|
process.stdout.write(`\n 👤 User: ${params.content}\n`);
|
|
141
110
|
},
|
|
111
|
+
|
|
112
|
+
// Tool block callback - display tool name when tool starts
|
|
113
|
+
onToolBlockUpdated: (params) => {
|
|
114
|
+
// Print tool name only during 'running' stage (happens once per tool call)
|
|
115
|
+
if (params.stage === "running" && params.name) {
|
|
116
|
+
process.stdout.write(`\n🔧 ${params.name}`);
|
|
117
|
+
if (params.compactParams) {
|
|
118
|
+
process.stdout.write(` ${params.compactParams}`);
|
|
119
|
+
}
|
|
120
|
+
process.stdout.write(`\n`);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
|
|
142
124
|
// Error block callback
|
|
143
125
|
onErrorBlockAdded: (error: string) => {
|
|
144
126
|
// Display error blocks with distinct formatting
|
|
@@ -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;AASD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8fpD,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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
export const MemoryTypeSelector = ({ message, onSelect, onCancel, }) => {
|
|
5
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
|
-
const options = [
|
|
7
|
-
{
|
|
8
|
-
type: "project",
|
|
9
|
-
label: "Project Memory",
|
|
10
|
-
description: "Save to current project (AGENTS.md)",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
type: "user",
|
|
14
|
-
label: "User Memory",
|
|
15
|
-
description: "Save to user global memory",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
useInput((input, key) => {
|
|
19
|
-
if (key.return) {
|
|
20
|
-
const selectedOption = options[selectedIndex];
|
|
21
|
-
onSelect(selectedOption.type);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (key.escape) {
|
|
25
|
-
onCancel();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (key.upArrow) {
|
|
29
|
-
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (key.downArrow) {
|
|
33
|
-
setSelectedIndex(Math.min(options.length - 1, selectedIndex + 1));
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "green", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: "green", bold: true, children: ["Save Memory: \"", message.substring(1).trim(), "\""] }) }), _jsx(Text, { color: "gray", children: "Choose where to save this memory:" }), options.map((option, index) => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: index === selectedIndex ? "black" : "white", backgroundColor: index === selectedIndex ? "green" : undefined, bold: index === selectedIndex, children: option.label }), index === selectedIndex && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", dimColor: true, children: option.description }) }))] }, option.type))), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: "Use \u2191\u2193 to navigate, Enter to select, Escape to cancel" }) })] }));
|
|
38
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { SubagentBlock as SubagentBlockType } from "wave-agent-sdk";
|
|
3
|
-
interface SubagentBlockProps {
|
|
4
|
-
block: SubagentBlockType;
|
|
5
|
-
}
|
|
6
|
-
export declare const SubagentBlock: React.FC<SubagentBlockProps>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=SubagentBlock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubagentBlock.d.ts","sourceRoot":"","sources":["../../src/components/SubagentBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIzE,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoItD,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from "ink";
|
|
3
|
-
import { useChat } from "../contexts/useChat.js";
|
|
4
|
-
import { Markdown } from "./Markdown.js";
|
|
5
|
-
export const SubagentBlock = ({ block }) => {
|
|
6
|
-
const { subagentMessages } = useChat();
|
|
7
|
-
// If the subagent is running in the background, don't show the block
|
|
8
|
-
if (block.runInBackground) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
// Get messages for this subagent from context
|
|
12
|
-
const messages = subagentMessages[block.subagentId] || [];
|
|
13
|
-
// Status indicator mapping
|
|
14
|
-
const getStatusIndicator = (status) => {
|
|
15
|
-
switch (status) {
|
|
16
|
-
case "active":
|
|
17
|
-
return { icon: "🔄", color: "yellow" };
|
|
18
|
-
case "completed":
|
|
19
|
-
return { icon: "✅", color: "green" };
|
|
20
|
-
case "error":
|
|
21
|
-
return { icon: "❌", color: "red" };
|
|
22
|
-
case "aborted":
|
|
23
|
-
return { icon: "⏹️", color: "gray" };
|
|
24
|
-
default:
|
|
25
|
-
return { icon: "⏳", color: "gray" };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const statusInfo = getStatusIndicator(block.status);
|
|
29
|
-
// Find the last 2 tool names and their compact params, and count total tools
|
|
30
|
-
const getLastTwoTools = () => {
|
|
31
|
-
const tools = [];
|
|
32
|
-
let totalToolCount = 0;
|
|
33
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
34
|
-
const message = messages[i];
|
|
35
|
-
for (let j = message.blocks.length - 1; j >= 0; j--) {
|
|
36
|
-
const messageBlock = message.blocks[j];
|
|
37
|
-
if (messageBlock.type === "tool" && messageBlock.name) {
|
|
38
|
-
totalToolCount++;
|
|
39
|
-
if (tools.length < 2) {
|
|
40
|
-
tools.push({
|
|
41
|
-
name: messageBlock.name,
|
|
42
|
-
compactParams: messageBlock.compactParams,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return { tools: tools.reverse(), totalToolCount }; // Reverse to show oldest first, newest last
|
|
49
|
-
};
|
|
50
|
-
const { tools: lastTwoTools, totalToolCount } = getLastTwoTools();
|
|
51
|
-
// Get the last text message content if completed
|
|
52
|
-
const getLastTextMessage = () => {
|
|
53
|
-
if (block.status !== "completed")
|
|
54
|
-
return null;
|
|
55
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
56
|
-
const message = messages[i];
|
|
57
|
-
if (message.role === "assistant") {
|
|
58
|
-
for (let j = message.blocks.length - 1; j >= 0; j--) {
|
|
59
|
-
const messageBlock = message.blocks[j];
|
|
60
|
-
if (messageBlock.type === "text" && messageBlock.content) {
|
|
61
|
-
return messageBlock.content;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
};
|
|
68
|
-
const lastTextMessage = getLastTextMessage();
|
|
69
|
-
return (_jsxs(Box, { borderRight: false, borderTop: false, borderBottom: false, borderStyle: "classic", borderColor: "magenta", paddingX: 1, paddingY: 0, flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { flexDirection: "row", gap: 1, children: _jsxs(Box, { flexDirection: "row", alignItems: "center", children: [_jsxs(Text, { color: "cyan", children: ["\uD83E\uDD16 ", block.subagentName] }), _jsxs(Text, { color: statusInfo.color, dimColor: false, children: [" ", statusInfo.icon] }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "(", messages.length, " messages)"] })] }) }), lastTextMessage && (_jsx(Box, { marginTop: 1, children: _jsx(Markdown, { children: lastTextMessage }) })), block.status !== "completed" && lastTwoTools.length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, gap: 1, children: [totalToolCount > 2 && (_jsx(Text, { color: "gray", dimColor: true, children: "..." })), lastTwoTools.map((tool, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: "magenta", children: "\uD83D\uDD27 " }), _jsx(Text, { color: "white", children: tool.name }), tool.compactParams && (_jsxs(Text, { color: "gray", children: [" ", tool.compactParams] }))] }, index)))] }))] }));
|
|
70
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TaskManager.d.ts","sourceRoot":"","sources":["../../src/components/TaskManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2SlD,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { ToolBlock } from "wave-agent-sdk";
|
|
3
|
-
interface ToolResultDisplayProps {
|
|
4
|
-
block: ToolBlock;
|
|
5
|
-
isExpanded?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const ToolResultDisplay: React.FC<ToolResultDisplayProps>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=ToolResultDisplay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResultDisplay.d.ts","sourceRoot":"","sources":["../../src/components/ToolResultDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyI9D,CAAC"}
|