wave-code 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/components/BackgroundTaskManager.d.ts +6 -0
  2. package/dist/components/BackgroundTaskManager.d.ts.map +1 -0
  3. package/dist/components/{TaskManager.js → BackgroundTaskManager.js} +1 -1
  4. package/dist/components/ChatInterface.d.ts.map +1 -1
  5. package/dist/components/ChatInterface.js +55 -5
  6. package/dist/components/CommandSelector.d.ts.map +1 -1
  7. package/dist/components/CommandSelector.js +10 -2
  8. package/dist/components/CompressDisplay.d.ts.map +1 -1
  9. package/dist/components/CompressDisplay.js +6 -10
  10. package/dist/components/ConfirmationDetails.d.ts +9 -0
  11. package/dist/components/ConfirmationDetails.d.ts.map +1 -0
  12. package/dist/components/ConfirmationDetails.js +53 -0
  13. package/dist/components/{Confirmation.d.ts → ConfirmationSelector.d.ts} +3 -3
  14. package/dist/components/ConfirmationSelector.d.ts.map +1 -0
  15. package/dist/components/{Confirmation.js → ConfirmationSelector.js} +34 -96
  16. package/dist/components/DiffDisplay.d.ts.map +1 -1
  17. package/dist/components/DiffDisplay.js +44 -1
  18. package/dist/components/FileSelector.d.ts.map +1 -1
  19. package/dist/components/FileSelector.js +2 -2
  20. package/dist/components/HistorySearch.d.ts.map +1 -1
  21. package/dist/components/HistorySearch.js +12 -4
  22. package/dist/components/InputBox.d.ts +1 -2
  23. package/dist/components/InputBox.d.ts.map +1 -1
  24. package/dist/components/InputBox.js +5 -9
  25. package/dist/components/LoadingIndicator.d.ts +11 -0
  26. package/dist/components/LoadingIndicator.d.ts.map +1 -0
  27. package/dist/components/LoadingIndicator.js +6 -0
  28. package/dist/components/Markdown.d.ts.map +1 -1
  29. package/dist/components/Markdown.js +114 -121
  30. package/dist/components/MessageItem.d.ts.map +1 -1
  31. package/dist/components/MessageItem.js +1 -2
  32. package/dist/components/MessageList.d.ts +2 -3
  33. package/dist/components/MessageList.d.ts.map +1 -1
  34. package/dist/components/MessageList.js +7 -7
  35. package/dist/components/PlanDisplay.d.ts.map +1 -1
  36. package/dist/components/PlanDisplay.js +4 -12
  37. package/dist/components/SubagentBlock.d.ts.map +1 -1
  38. package/dist/components/SubagentBlock.js +9 -6
  39. package/dist/components/TaskList.d.ts +3 -0
  40. package/dist/components/TaskList.d.ts.map +1 -0
  41. package/dist/components/TaskList.js +49 -0
  42. package/dist/components/ToolResultDisplay.js +1 -1
  43. package/dist/contexts/useChat.d.ts +5 -2
  44. package/dist/contexts/useChat.d.ts.map +1 -1
  45. package/dist/contexts/useChat.js +25 -25
  46. package/dist/hooks/useInputManager.d.ts +2 -7
  47. package/dist/hooks/useInputManager.d.ts.map +1 -1
  48. package/dist/hooks/useInputManager.js +8 -40
  49. package/dist/hooks/useTasks.d.ts +2 -0
  50. package/dist/hooks/useTasks.d.ts.map +1 -0
  51. package/dist/hooks/useTasks.js +5 -0
  52. package/dist/managers/InputManager.d.ts +4 -19
  53. package/dist/managers/InputManager.d.ts.map +1 -1
  54. package/dist/managers/InputManager.js +22 -65
  55. package/package.json +5 -6
  56. package/src/components/{TaskManager.tsx → BackgroundTaskManager.tsx} +4 -2
  57. package/src/components/ChatInterface.tsx +100 -20
  58. package/src/components/CommandSelector.tsx +35 -17
  59. package/src/components/CompressDisplay.tsx +5 -22
  60. package/src/components/ConfirmationDetails.tsx +108 -0
  61. package/src/components/{Confirmation.tsx → ConfirmationSelector.tsx} +69 -184
  62. package/src/components/DiffDisplay.tsx +62 -1
  63. package/src/components/FileSelector.tsx +0 -2
  64. package/src/components/HistorySearch.tsx +45 -21
  65. package/src/components/InputBox.tsx +9 -24
  66. package/src/components/LoadingIndicator.tsx +56 -0
  67. package/src/components/Markdown.tsx +126 -324
  68. package/src/components/MessageItem.tsx +1 -3
  69. package/src/components/MessageList.tsx +10 -67
  70. package/src/components/PlanDisplay.tsx +4 -27
  71. package/src/components/SubagentBlock.tsx +25 -16
  72. package/src/components/TaskList.tsx +70 -0
  73. package/src/components/ToolResultDisplay.tsx +2 -2
  74. package/src/contexts/useChat.tsx +38 -33
  75. package/src/hooks/useInputManager.ts +9 -47
  76. package/src/hooks/useTasks.ts +6 -0
  77. package/src/managers/InputManager.ts +25 -83
  78. package/dist/components/Confirmation.d.ts.map +0 -1
  79. package/dist/components/MemoryDisplay.d.ts +0 -8
  80. package/dist/components/MemoryDisplay.d.ts.map +0 -1
  81. package/dist/components/MemoryDisplay.js +0 -25
  82. package/dist/components/MemoryTypeSelector.d.ts +0 -8
  83. package/dist/components/MemoryTypeSelector.d.ts.map +0 -1
  84. package/dist/components/MemoryTypeSelector.js +0 -38
  85. package/dist/components/TaskManager.d.ts +0 -6
  86. package/dist/components/TaskManager.d.ts.map +0 -1
  87. package/src/components/MemoryDisplay.tsx +0 -62
  88. package/src/components/MemoryTypeSelector.tsx +0 -98
@@ -29,12 +29,8 @@ export interface InputManagerCallbacks {
29
29
  position: number,
30
30
  ) => void;
31
31
  onHistorySearchStateChange?: (show: boolean, query: string) => void;
32
- onMemoryTypeSelectorStateChange?: (show: boolean, message: string) => void;
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;
39
35
  onImagesStateChange?: (images: AttachedImage[]) => void;
40
36
  onSendMessage?: (
@@ -42,7 +38,6 @@ 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;
47
42
  onBackgroundCurrentTask?: () => void;
48
43
  onResetHistoryNavigation?: () => void;
@@ -71,10 +66,6 @@ export class InputManager {
71
66
  private showHistorySearch: boolean = false;
72
67
  private historySearchQuery: string = "";
73
68
 
74
- // Memory type selector state
75
- private showMemoryTypeSelector: boolean = false;
76
- private memoryMessage: string = "";
77
-
78
69
  // Input history state
79
70
  private userInputHistory: string[] = [];
80
71
  private historyIndex: number = -1;
@@ -95,7 +86,7 @@ export class InputManager {
95
86
  private imageIdCounter: number = 1;
96
87
 
97
88
  // Additional UI state
98
- private showTaskManager: boolean = false;
89
+ private showBackgroundTaskManager: boolean = false;
99
90
  private showMcpManager: boolean = false;
100
91
  private showRewindManager: boolean = false;
101
92
 
@@ -362,17 +353,14 @@ export class InputManager {
362
353
 
363
354
  // If not an agent command or execution failed, check local commands
364
355
  if (!commandExecuted) {
365
- if (command === "tasks" && this.callbacks.onShowTaskManager) {
366
- this.callbacks.onShowTaskManager();
356
+ if (command === "tasks") {
357
+ this.setShowBackgroundTaskManager(true);
367
358
  commandExecuted = true;
368
- } else if (command === "mcp" && this.callbacks.onShowMcpManager) {
369
- this.callbacks.onShowMcpManager();
359
+ } else if (command === "mcp") {
360
+ this.setShowMcpManager(true);
370
361
  commandExecuted = true;
371
- } else if (
372
- command === "rewind" &&
373
- this.callbacks.onShowRewindManager
374
- ) {
375
- this.callbacks.onShowRewindManager();
362
+ } else if (command === "rewind") {
363
+ this.setShowRewindManager(true);
376
364
  commandExecuted = true;
377
365
  }
378
366
  }
@@ -439,35 +427,6 @@ export class InputManager {
439
427
  return false;
440
428
  }
441
429
 
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
430
  // Input history methods
472
431
  setUserInputHistory(history: string[]): void {
473
432
  this.userInputHistory = history;
@@ -537,10 +496,6 @@ export class InputManager {
537
496
  return this.showCommandSelector;
538
497
  }
539
498
 
540
- isMemoryTypeSelectorActive(): boolean {
541
- return this.showMemoryTypeSelector;
542
- }
543
-
544
499
  getFileSelectorState() {
545
500
  return {
546
501
  show: this.showFileSelector,
@@ -558,13 +513,6 @@ export class InputManager {
558
513
  };
559
514
  }
560
515
 
561
- getMemoryTypeSelectorState() {
562
- return {
563
- show: this.showMemoryTypeSelector,
564
- message: this.memoryMessage,
565
- };
566
- }
567
-
568
516
  // Update search queries for active selectors
569
517
  private updateSearchQueriesForActiveSelectors(
570
518
  inputText: string,
@@ -595,8 +543,6 @@ export class InputManager {
595
543
  // Don't activate command selector when file selector is active
596
544
  // Only activate command selector if '/' is at the start of input
597
545
  this.activateCommandSelector(this.cursorPosition - 1);
598
- } else if (char === "#" && this.cursorPosition === 1) {
599
- // Memory message detection will be handled in submit
600
546
  } else {
601
547
  // Update search queries for active selectors
602
548
  this.updateSearchQueriesForActiveSelectors(
@@ -753,13 +699,13 @@ export class InputManager {
753
699
  }
754
700
 
755
701
  // Task manager state methods
756
- getShowTaskManager(): boolean {
757
- return this.showTaskManager;
702
+ getShowBackgroundTaskManager(): boolean {
703
+ return this.showBackgroundTaskManager;
758
704
  }
759
705
 
760
- setShowTaskManager(show: boolean): void {
761
- this.showTaskManager = show;
762
- this.callbacks.onTaskManagerStateChange?.(show);
706
+ setShowBackgroundTaskManager(show: boolean): void {
707
+ this.showBackgroundTaskManager = show;
708
+ this.callbacks.onBackgroundTaskManagerStateChange?.(show);
763
709
  }
764
710
 
765
711
  getShowMcpManager(): boolean {
@@ -815,15 +761,6 @@ export class InputManager {
815
761
  }
816
762
 
817
763
  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
764
  // Extract image information
828
765
  const imageRegex = /\[Image #(\d+)\]/g;
829
766
  const matches = [...this.inputText.matchAll(imageRegex)];
@@ -1060,7 +997,13 @@ export class InputManager {
1060
997
  }
1061
998
 
1062
999
  // Handle interrupt request - use Esc key to interrupt AI request or command
1063
- if (key.escape && (isLoading || isCommandRunning)) {
1000
+ if (
1001
+ key.escape &&
1002
+ (isLoading || isCommandRunning) &&
1003
+ !this.showBackgroundTaskManager &&
1004
+ !this.showMcpManager &&
1005
+ !this.showRewindManager
1006
+ ) {
1064
1007
  // Unified interrupt for AI message generation and command execution
1065
1008
  this.callbacks.onAbortMessage?.();
1066
1009
  return true;
@@ -1078,19 +1021,18 @@ export class InputManager {
1078
1021
  this.showFileSelector ||
1079
1022
  this.showCommandSelector ||
1080
1023
  this.showHistorySearch ||
1081
- this.showMemoryTypeSelector ||
1082
- this.showTaskManager ||
1024
+ this.showBackgroundTaskManager ||
1083
1025
  this.showMcpManager ||
1084
1026
  this.showRewindManager
1085
1027
  ) {
1086
1028
  if (
1087
- this.showMemoryTypeSelector ||
1088
- this.showTaskManager ||
1029
+ this.showBackgroundTaskManager ||
1089
1030
  this.showMcpManager ||
1090
1031
  this.showRewindManager
1091
1032
  ) {
1092
- // Memory type selector, task manager, MCP manager and Rewind don't need to handle input, handled by component itself
1093
- return false;
1033
+ // Task manager, MCP manager and Rewind don't need to handle input, handled by component itself
1034
+ // Return true to indicate we've "handled" it (by ignoring it) so it doesn't leak to normal input
1035
+ return true;
1094
1036
  }
1095
1037
 
1096
1038
  if (this.showHistorySearch) {
@@ -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,8 +0,0 @@
1
- import React from "react";
2
- import type { MemoryBlock } from "wave-agent-sdk";
3
- interface MemoryDisplayProps {
4
- block: MemoryBlock;
5
- }
6
- export declare const MemoryDisplay: React.FC<MemoryDisplayProps>;
7
- export {};
8
- //# sourceMappingURL=MemoryDisplay.d.ts.map
@@ -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,6 +0,0 @@
1
- import React from "react";
2
- export interface TaskManagerProps {
3
- onCancel: () => void;
4
- }
5
- export declare const TaskManager: React.FC<TaskManagerProps>;
6
- //# sourceMappingURL=TaskManager.d.ts.map
@@ -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,62 +0,0 @@
1
- import React from "react";
2
- import { Box, Text } from "ink";
3
- import type { MemoryBlock } from "wave-agent-sdk";
4
-
5
- interface MemoryDisplayProps {
6
- block: MemoryBlock;
7
- }
8
-
9
- export const MemoryDisplay: React.FC<MemoryDisplayProps> = ({ block }) => {
10
- const { content, isSuccess, memoryType, storagePath } = block;
11
-
12
- const getStatusIcon = () => {
13
- return isSuccess ? "💾" : "⚠️";
14
- };
15
-
16
- const getStatusColor = () => {
17
- return isSuccess ? "green" : "red";
18
- };
19
-
20
- const getStatusText = () => {
21
- return isSuccess ? "Added to memory" : "Failed to add memory";
22
- };
23
-
24
- const getStorageText = () => {
25
- if (!isSuccess) return null;
26
-
27
- if (memoryType === "user") {
28
- return `Memory saved to ${storagePath || "AGENTS.md"}`;
29
- } else {
30
- return `Memory saved to ${storagePath || "AGENTS.md"}`;
31
- }
32
- };
33
-
34
- return (
35
- <Box flexDirection="column">
36
- <Box>
37
- <Text color={getStatusColor()}>{getStatusIcon()} </Text>
38
- <Text color={getStatusColor()}>{getStatusText()}</Text>
39
- </Box>
40
-
41
- {content && (
42
- <Box marginTop={1} paddingLeft={2}>
43
- <Box
44
- borderLeft
45
- borderColor={isSuccess ? "green" : "red"}
46
- paddingLeft={1}
47
- >
48
- <Text color="gray">{content}</Text>
49
- </Box>
50
- </Box>
51
- )}
52
-
53
- {isSuccess && (
54
- <Box paddingLeft={2} marginTop={1}>
55
- <Text color="yellow" dimColor>
56
- {getStorageText()}
57
- </Text>
58
- </Box>
59
- )}
60
- </Box>
61
- );
62
- };
@@ -1,98 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Box, Text, useInput } from "ink";
3
-
4
- export interface MemoryTypeSelectorProps {
5
- message: string;
6
- onSelect: (type: "project" | "user") => void;
7
- onCancel: () => void;
8
- }
9
-
10
- export const MemoryTypeSelector: React.FC<MemoryTypeSelectorProps> = ({
11
- message,
12
- onSelect,
13
- onCancel,
14
- }) => {
15
- const [selectedIndex, setSelectedIndex] = useState(0);
16
-
17
- const options = [
18
- {
19
- type: "project" as const,
20
- label: "Project Memory",
21
- description: "Save to current project (AGENTS.md)",
22
- },
23
- {
24
- type: "user" as const,
25
- label: "User Memory",
26
- description: "Save to user global memory",
27
- },
28
- ];
29
-
30
- useInput((input, key) => {
31
- if (key.return) {
32
- const selectedOption = options[selectedIndex];
33
- onSelect(selectedOption.type);
34
- return;
35
- }
36
-
37
- if (key.escape) {
38
- onCancel();
39
- return;
40
- }
41
-
42
- if (key.upArrow) {
43
- setSelectedIndex(Math.max(0, selectedIndex - 1));
44
- return;
45
- }
46
-
47
- if (key.downArrow) {
48
- setSelectedIndex(Math.min(options.length - 1, selectedIndex + 1));
49
- return;
50
- }
51
- });
52
-
53
- return (
54
- <Box
55
- flexDirection="column"
56
- borderStyle="single"
57
- borderColor="green"
58
- borderBottom={false}
59
- borderLeft={false}
60
- borderRight={false}
61
- paddingTop={1}
62
- gap={1}
63
- >
64
- <Box>
65
- <Text color="green" bold>
66
- Save Memory: "{message.substring(1).trim()}"
67
- </Text>
68
- </Box>
69
-
70
- <Text color="gray">Choose where to save this memory:</Text>
71
-
72
- {options.map((option, index) => (
73
- <Box key={option.type} flexDirection="column">
74
- <Text
75
- color={index === selectedIndex ? "black" : "white"}
76
- backgroundColor={index === selectedIndex ? "green" : undefined}
77
- bold={index === selectedIndex}
78
- >
79
- {option.label}
80
- </Text>
81
- {index === selectedIndex && (
82
- <Box marginLeft={2}>
83
- <Text color="gray" dimColor>
84
- {option.description}
85
- </Text>
86
- </Box>
87
- )}
88
- </Box>
89
- ))}
90
-
91
- <Box>
92
- <Text dimColor>
93
- Use ↑↓ to navigate, Enter to select, Escape to cancel
94
- </Text>
95
- </Box>
96
- </Box>
97
- );
98
- };