wave-code 0.0.16 → 0.0.17

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 (90) hide show
  1. package/dist/cli.d.ts +1 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/commands/plugin/disable.d.ts +5 -0
  5. package/dist/commands/plugin/disable.d.ts.map +1 -0
  6. package/dist/commands/plugin/disable.js +21 -0
  7. package/dist/commands/plugin/enable.d.ts +5 -0
  8. package/dist/commands/plugin/enable.d.ts.map +1 -0
  9. package/dist/commands/plugin/enable.js +21 -0
  10. package/dist/commands/plugin/install.d.ts +5 -0
  11. package/dist/commands/plugin/install.d.ts.map +1 -0
  12. package/dist/commands/plugin/install.js +28 -0
  13. package/dist/commands/plugin/list.d.ts +2 -0
  14. package/dist/commands/plugin/list.d.ts.map +1 -0
  15. package/dist/commands/plugin/list.js +53 -0
  16. package/dist/commands/plugin/marketplace.d.ts +8 -0
  17. package/dist/commands/plugin/marketplace.d.ts.map +1 -0
  18. package/dist/commands/plugin/marketplace.js +73 -0
  19. package/dist/components/App.d.ts +1 -0
  20. package/dist/components/App.d.ts.map +1 -1
  21. package/dist/components/App.js +4 -4
  22. package/dist/components/BashHistorySelector.d.ts +1 -0
  23. package/dist/components/BashHistorySelector.d.ts.map +1 -1
  24. package/dist/components/BashHistorySelector.js +15 -5
  25. package/dist/components/BashShellManager.d.ts.map +1 -1
  26. package/dist/components/BashShellManager.js +4 -4
  27. package/dist/components/ChatInterface.d.ts.map +1 -1
  28. package/dist/components/ChatInterface.js +1 -2
  29. package/dist/components/CommandSelector.d.ts.map +1 -1
  30. package/dist/components/CommandSelector.js +2 -2
  31. package/dist/components/Confirmation.d.ts +1 -0
  32. package/dist/components/Confirmation.d.ts.map +1 -1
  33. package/dist/components/Confirmation.js +151 -48
  34. package/dist/components/DiffDisplay.d.ts +3 -2
  35. package/dist/components/DiffDisplay.d.ts.map +1 -1
  36. package/dist/components/DiffDisplay.js +87 -82
  37. package/dist/components/FileSelector.d.ts.map +1 -1
  38. package/dist/components/FileSelector.js +2 -2
  39. package/dist/components/InputBox.d.ts.map +1 -1
  40. package/dist/components/InputBox.js +2 -2
  41. package/dist/components/McpManager.d.ts.map +1 -1
  42. package/dist/components/McpManager.js +3 -3
  43. package/dist/components/MemoryTypeSelector.d.ts.map +1 -1
  44. package/dist/components/MemoryTypeSelector.js +1 -1
  45. package/dist/components/MessageList.js +1 -1
  46. package/dist/components/PlanDisplay.d.ts +8 -0
  47. package/dist/components/PlanDisplay.d.ts.map +1 -0
  48. package/dist/components/PlanDisplay.js +14 -0
  49. package/dist/components/ToolResultDisplay.d.ts.map +1 -1
  50. package/dist/components/ToolResultDisplay.js +1 -1
  51. package/dist/contexts/useChat.d.ts +1 -0
  52. package/dist/contexts/useChat.d.ts.map +1 -1
  53. package/dist/contexts/useChat.js +3 -1
  54. package/dist/hooks/useInputManager.d.ts +1 -0
  55. package/dist/hooks/useInputManager.d.ts.map +1 -1
  56. package/dist/hooks/useInputManager.js +4 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +103 -0
  59. package/dist/managers/InputManager.d.ts +1 -0
  60. package/dist/managers/InputManager.d.ts.map +1 -1
  61. package/dist/managers/InputManager.js +7 -2
  62. package/dist/print-cli.d.ts +1 -0
  63. package/dist/print-cli.d.ts.map +1 -1
  64. package/dist/print-cli.js +2 -1
  65. package/package.json +2 -2
  66. package/src/cli.tsx +8 -1
  67. package/src/commands/plugin/disable.ts +31 -0
  68. package/src/commands/plugin/enable.ts +31 -0
  69. package/src/commands/plugin/install.ts +42 -0
  70. package/src/commands/plugin/list.ts +64 -0
  71. package/src/commands/plugin/marketplace.ts +72 -0
  72. package/src/components/App.tsx +11 -5
  73. package/src/components/BashHistorySelector.tsx +25 -7
  74. package/src/components/BashShellManager.tsx +16 -8
  75. package/src/components/ChatInterface.tsx +29 -27
  76. package/src/components/CommandSelector.tsx +8 -4
  77. package/src/components/Confirmation.tsx +312 -106
  78. package/src/components/DiffDisplay.tsx +167 -149
  79. package/src/components/FileSelector.tsx +8 -4
  80. package/src/components/InputBox.tsx +14 -4
  81. package/src/components/McpManager.tsx +12 -6
  82. package/src/components/MemoryTypeSelector.tsx +4 -2
  83. package/src/components/MessageList.tsx +1 -1
  84. package/src/components/PlanDisplay.tsx +46 -0
  85. package/src/components/ToolResultDisplay.tsx +4 -2
  86. package/src/contexts/useChat.tsx +4 -0
  87. package/src/hooks/useInputManager.ts +8 -0
  88. package/src/index.ts +178 -0
  89. package/src/managers/InputManager.ts +12 -1
  90. package/src/print-cli.ts +3 -0
@@ -0,0 +1,72 @@
1
+ import { MarketplaceService } from "wave-agent-sdk";
2
+
3
+ export async function addMarketplaceCommand(argv: { input: string }) {
4
+ const service = new MarketplaceService();
5
+ try {
6
+ const marketplace = await service.addMarketplace(argv.input);
7
+ const source = marketplace.source;
8
+ let sourceInfo = "";
9
+ if (source.source === "directory") {
10
+ sourceInfo = source.path;
11
+ } else if (source.source === "github") {
12
+ sourceInfo = source.repo + (source.ref ? `#${source.ref}` : "");
13
+ } else {
14
+ sourceInfo = source.url + (source.ref ? `#${source.ref}` : "");
15
+ }
16
+ console.log(
17
+ `Successfully added marketplace: ${marketplace.name} (${sourceInfo})`,
18
+ );
19
+ process.exit(0);
20
+ } catch (error) {
21
+ const message = error instanceof Error ? error.message : String(error);
22
+ console.error(`Failed to add marketplace: ${message}`);
23
+ process.exit(1);
24
+ }
25
+ }
26
+
27
+ export async function listMarketplacesCommand() {
28
+ const service = new MarketplaceService();
29
+ try {
30
+ const marketplaces = await service.listMarketplaces();
31
+ if (marketplaces.length === 0) {
32
+ console.log("No marketplaces registered.");
33
+ } else {
34
+ console.log("Registered Marketplaces:");
35
+ marketplaces.forEach((m) => {
36
+ const source = m.source;
37
+ let sourceInfo = "";
38
+ if (source.source === "directory") {
39
+ sourceInfo = source.path;
40
+ } else if (source.source === "github") {
41
+ sourceInfo = source.repo + (source.ref ? `#${source.ref}` : "");
42
+ } else {
43
+ sourceInfo = source.url + (source.ref ? `#${source.ref}` : "");
44
+ }
45
+ console.log(`- ${m.name}: ${sourceInfo} (${m.source.source})`);
46
+ });
47
+ }
48
+ process.exit(0);
49
+ } catch (error) {
50
+ const message = error instanceof Error ? error.message : String(error);
51
+ console.error(`Failed to list marketplaces: ${message}`);
52
+ process.exit(1);
53
+ }
54
+ }
55
+
56
+ export async function updateMarketplaceCommand(argv: { name?: string }) {
57
+ const service = new MarketplaceService();
58
+ try {
59
+ console.log(
60
+ argv.name
61
+ ? `Updating marketplace: ${argv.name}...`
62
+ : "Updating all marketplaces...",
63
+ );
64
+ await service.updateMarketplace(argv.name);
65
+ console.log("Successfully updated.");
66
+ process.exit(0);
67
+ } catch (error) {
68
+ const message = error instanceof Error ? error.message : String(error);
69
+ console.error(`Failed to update marketplace: ${message}`);
70
+ process.exit(1);
71
+ }
72
+ }
@@ -7,13 +7,15 @@ interface AppProps {
7
7
  restoreSessionId?: string;
8
8
  continueLastSession?: boolean;
9
9
  bypassPermissions?: boolean;
10
+ pluginDirs?: string[];
10
11
  }
11
12
 
12
- const AppWithProviders: React.FC<{ bypassPermissions?: boolean }> = ({
13
- bypassPermissions,
14
- }) => {
13
+ const AppWithProviders: React.FC<{
14
+ bypassPermissions?: boolean;
15
+ pluginDirs?: string[];
16
+ }> = ({ bypassPermissions, pluginDirs }) => {
15
17
  return (
16
- <ChatProvider bypassPermissions={bypassPermissions}>
18
+ <ChatProvider bypassPermissions={bypassPermissions} pluginDirs={pluginDirs}>
17
19
  <ChatInterface />
18
20
  </ChatProvider>
19
21
  );
@@ -23,13 +25,17 @@ export const App: React.FC<AppProps> = ({
23
25
  restoreSessionId,
24
26
  continueLastSession,
25
27
  bypassPermissions,
28
+ pluginDirs,
26
29
  }) => {
27
30
  return (
28
31
  <AppProvider
29
32
  restoreSessionId={restoreSessionId}
30
33
  continueLastSession={continueLastSession}
31
34
  >
32
- <AppWithProviders bypassPermissions={bypassPermissions} />
35
+ <AppWithProviders
36
+ bypassPermissions={bypassPermissions}
37
+ pluginDirs={pluginDirs}
38
+ />
33
39
  </AppProvider>
34
40
  );
35
41
  };
@@ -8,6 +8,7 @@ export interface BashHistorySelectorProps {
8
8
  workdir: string;
9
9
  onSelect: (command: string) => void;
10
10
  onExecute: (command: string) => void;
11
+ onDelete: (command: string, workdir?: string) => void;
11
12
  onCancel: () => void;
12
13
  }
13
14
 
@@ -16,22 +17,25 @@ export const BashHistorySelector: React.FC<BashHistorySelectorProps> = ({
16
17
  workdir,
17
18
  onSelect,
18
19
  onExecute,
20
+ onDelete,
19
21
  onCancel,
20
22
  }) => {
21
23
  const [selectedIndex, setSelectedIndex] = useState(0);
22
24
  const [commands, setCommands] = useState<BashHistoryEntry[]>([]);
25
+ const [refreshCounter, setRefreshCounter] = useState(0);
23
26
 
24
27
  // Search bash history
25
28
  useEffect(() => {
26
- const results = searchBashHistory(searchQuery, 10, workdir);
29
+ const results = searchBashHistory(searchQuery, 10);
27
30
  setCommands(results);
28
31
  setSelectedIndex(0);
29
32
  logger.debug("Bash history search:", {
30
33
  searchQuery,
31
34
  workdir,
32
35
  resultCount: results.length,
36
+ refreshCounter,
33
37
  });
34
- }, [searchQuery, workdir]);
38
+ }, [searchQuery, workdir, refreshCounter]);
35
39
 
36
40
  useInput((input, key) => {
37
41
  logger.debug("BashHistorySelector useInput:", {
@@ -68,6 +72,15 @@ export const BashHistorySelector: React.FC<BashHistorySelectorProps> = ({
68
72
  return;
69
73
  }
70
74
 
75
+ if (key.ctrl && input === "d") {
76
+ if (commands.length > 0 && selectedIndex < commands.length) {
77
+ const selectedCommand = commands[selectedIndex];
78
+ onDelete(selectedCommand.command, selectedCommand.workdir);
79
+ setRefreshCounter((prev) => prev + 1);
80
+ }
81
+ return;
82
+ }
83
+
71
84
  if (key.upArrow) {
72
85
  setSelectedIndex(Math.max(0, selectedIndex - 1));
73
86
  return;
@@ -85,8 +98,10 @@ export const BashHistorySelector: React.FC<BashHistorySelectorProps> = ({
85
98
  flexDirection="column"
86
99
  borderStyle="single"
87
100
  borderColor="yellow"
88
- padding={1}
89
- marginBottom={1}
101
+ borderBottom={false}
102
+ borderLeft={false}
103
+ borderRight={false}
104
+ paddingTop={1}
90
105
  >
91
106
  <Text color="yellow">
92
107
  No bash history found {searchQuery && `for "${searchQuery}"`}
@@ -124,9 +139,11 @@ export const BashHistorySelector: React.FC<BashHistorySelectorProps> = ({
124
139
  flexDirection="column"
125
140
  borderStyle="single"
126
141
  borderColor="blue"
127
- padding={1}
142
+ borderBottom={false}
143
+ borderLeft={false}
144
+ borderRight={false}
145
+ paddingTop={1}
128
146
  gap={1}
129
- marginBottom={1}
130
147
  >
131
148
  <Box>
132
149
  <Text color="blue" bold>
@@ -155,7 +172,8 @@ export const BashHistorySelector: React.FC<BashHistorySelectorProps> = ({
155
172
 
156
173
  <Box>
157
174
  <Text dimColor>
158
- Use ↑↓ to navigate, Enter to execute, Tab to insert, Escape to cancel
175
+ Use ↑↓ to navigate, Enter to execute, Tab to insert, Ctrl+d to remove,
176
+ Escape to cancel
159
177
  </Text>
160
178
  </Box>
161
179
  </Box>
@@ -133,9 +133,11 @@ export const BashShellManager: React.FC<BashShellManagerProps> = ({
133
133
  flexDirection="column"
134
134
  borderStyle="single"
135
135
  borderColor="cyan"
136
- padding={1}
136
+ borderBottom={false}
137
+ borderLeft={false}
138
+ borderRight={false}
139
+ paddingTop={1}
137
140
  gap={1}
138
- marginBottom={1}
139
141
  >
140
142
  <Box>
141
143
  <Text color="cyan" bold>
@@ -211,8 +213,10 @@ export const BashShellManager: React.FC<BashShellManagerProps> = ({
211
213
  flexDirection="column"
212
214
  borderStyle="single"
213
215
  borderColor="cyan"
214
- padding={1}
215
- marginBottom={1}
216
+ borderBottom={false}
217
+ borderLeft={false}
218
+ borderRight={false}
219
+ paddingTop={1}
216
220
  >
217
221
  <Text color="cyan" bold>
218
222
  Background Bash Shells
@@ -229,8 +233,10 @@ export const BashShellManager: React.FC<BashShellManagerProps> = ({
229
233
  flexDirection="column"
230
234
  borderStyle="single"
231
235
  borderColor="cyan"
232
- padding={1}
233
- marginBottom={1}
236
+ borderBottom={false}
237
+ borderLeft={false}
238
+ borderRight={false}
239
+ paddingTop={1}
234
240
  >
235
241
  <Text color="cyan" bold>
236
242
  Background Bash Shells
@@ -246,9 +252,11 @@ export const BashShellManager: React.FC<BashShellManagerProps> = ({
246
252
  flexDirection="column"
247
253
  borderStyle="single"
248
254
  borderColor="cyan"
249
- padding={1}
255
+ borderBottom={false}
256
+ borderLeft={false}
257
+ borderRight={false}
258
+ paddingTop={1}
250
259
  gap={1}
251
- marginBottom={1}
252
260
  >
253
261
  <Box>
254
262
  <Text color="cyan" bold>
@@ -32,7 +32,7 @@ export const ChatInterface: React.FC = () => {
32
32
  if (!sessionId) return null;
33
33
 
34
34
  return (
35
- <Box flexDirection="column" height="100%" paddingY={1}>
35
+ <Box flexDirection="column" height="100%" paddingY={1} paddingRight={1}>
36
36
  <MessageList
37
37
  messages={messages}
38
38
  isLoading={isLoading}
@@ -43,32 +43,34 @@ export const ChatInterface: React.FC = () => {
43
43
  key={String(isExpanded) + sessionId}
44
44
  />
45
45
 
46
- {!isExpanded &&
47
- (isConfirmationVisible ? (
48
- <Confirmation
49
- toolName={confirmingTool!.name}
50
- toolInput={confirmingTool!.input}
51
- suggestedPrefix={confirmingTool!.suggestedPrefix}
52
- hidePersistentOption={confirmingTool!.hidePersistentOption}
53
- onDecision={handleConfirmationDecision}
54
- onCancel={handleConfirmationCancel}
55
- onAbort={abortMessage}
56
- />
57
- ) : (
58
- <InputBox
59
- isLoading={isLoading}
60
- isCommandRunning={isCommandRunning}
61
- userInputHistory={userInputHistory}
62
- sendMessage={sendMessage}
63
- abortMessage={abortMessage}
64
- saveMemory={saveMemory}
65
- mcpServers={mcpServers}
66
- connectMcpServer={connectMcpServer}
67
- disconnectMcpServer={disconnectMcpServer}
68
- slashCommands={slashCommands}
69
- hasSlashCommand={hasSlashCommand}
70
- />
71
- ))}
46
+ {isConfirmationVisible && (
47
+ <Confirmation
48
+ toolName={confirmingTool!.name}
49
+ toolInput={confirmingTool!.input}
50
+ suggestedPrefix={confirmingTool!.suggestedPrefix}
51
+ hidePersistentOption={confirmingTool!.hidePersistentOption}
52
+ isExpanded={isExpanded}
53
+ onDecision={handleConfirmationDecision}
54
+ onCancel={handleConfirmationCancel}
55
+ onAbort={abortMessage}
56
+ />
57
+ )}
58
+
59
+ {!isConfirmationVisible && !isExpanded && (
60
+ <InputBox
61
+ isLoading={isLoading}
62
+ isCommandRunning={isCommandRunning}
63
+ userInputHistory={userInputHistory}
64
+ sendMessage={sendMessage}
65
+ abortMessage={abortMessage}
66
+ saveMemory={saveMemory}
67
+ mcpServers={mcpServers}
68
+ connectMcpServer={connectMcpServer}
69
+ disconnectMcpServer={disconnectMcpServer}
70
+ slashCommands={slashCommands}
71
+ hasSlashCommand={hasSlashCommand}
72
+ />
73
+ )}
72
74
  </Box>
73
75
  );
74
76
  };
@@ -91,8 +91,10 @@ export const CommandSelector: React.FC<CommandSelectorProps> = ({
91
91
  flexDirection="column"
92
92
  borderStyle="single"
93
93
  borderColor="yellow"
94
- padding={1}
95
- marginBottom={1}
94
+ borderBottom={false}
95
+ borderLeft={false}
96
+ borderRight={false}
97
+ paddingTop={1}
96
98
  >
97
99
  <Text color="yellow">No commands found for "{searchQuery}"</Text>
98
100
  <Text dimColor>Press Escape to cancel</Text>
@@ -105,9 +107,11 @@ export const CommandSelector: React.FC<CommandSelectorProps> = ({
105
107
  flexDirection="column"
106
108
  borderStyle="single"
107
109
  borderColor="magenta"
108
- padding={1}
110
+ borderBottom={false}
111
+ borderLeft={false}
112
+ borderRight={false}
113
+ paddingTop={1}
109
114
  gap={1}
110
- marginBottom={1}
111
115
  >
112
116
  <Box>
113
117
  <Text color="magenta" bold>