wave-code 0.9.2 → 0.9.4
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/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +10 -3
- package/dist/components/MarketplaceDetail.d.ts.map +1 -1
- package/dist/components/MarketplaceDetail.js +9 -2
- package/dist/components/PluginManagerShell.d.ts +1 -0
- package/dist/components/PluginManagerShell.d.ts.map +1 -1
- package/dist/components/PluginManagerShell.js +4 -1
- package/dist/components/PluginManagerTypes.d.ts +1 -0
- package/dist/components/PluginManagerTypes.d.ts.map +1 -1
- package/dist/constants/commands.d.ts.map +1 -1
- package/dist/constants/commands.js +6 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +3 -2
- package/dist/hooks/useInputManager.d.ts +2 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +8 -0
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +21 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -16
- package/dist/managers/inputHandlers.d.ts.map +1 -1
- package/dist/managers/inputHandlers.js +33 -9
- package/dist/managers/inputReducer.d.ts +11 -1
- package/dist/managers/inputReducer.d.ts.map +1 -1
- package/dist/managers/inputReducer.js +12 -2
- package/package.json +2 -2
- package/src/components/InputBox.tsx +12 -1
- package/src/components/MarketplaceDetail.tsx +16 -1
- package/src/components/PluginManagerShell.tsx +6 -3
- package/src/components/PluginManagerTypes.ts +1 -0
- package/src/constants/commands.ts +6 -0
- package/src/contexts/useChat.tsx +3 -1
- package/src/hooks/useInputManager.ts +10 -0
- package/src/hooks/usePluginManager.ts +26 -1
- package/src/index.ts +125 -155
- package/src/managers/inputHandlers.ts +35 -10
- package/src/managers/inputReducer.ts +27 -3
|
@@ -9,6 +9,7 @@ import { McpManager } from "./McpManager.js";
|
|
|
9
9
|
import { RewindCommand } from "./RewindCommand.js";
|
|
10
10
|
import { HelpView } from "./HelpView.js";
|
|
11
11
|
import { StatusCommand } from "./StatusCommand.js";
|
|
12
|
+
import { PluginManagerShell } from "./PluginManagerShell.js";
|
|
12
13
|
import { useInputManager } from "../hooks/useInputManager.js";
|
|
13
14
|
import { useChat } from "../contexts/useChat.js";
|
|
14
15
|
|
|
@@ -58,6 +59,7 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
58
59
|
getFullMessageThread,
|
|
59
60
|
clearMessages,
|
|
60
61
|
sessionId,
|
|
62
|
+
workingDirectory,
|
|
61
63
|
} = useChat();
|
|
62
64
|
|
|
63
65
|
// Input manager with all input state and functionality (including images)
|
|
@@ -91,11 +93,13 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
91
93
|
showRewindManager,
|
|
92
94
|
showHelp,
|
|
93
95
|
showStatusCommand,
|
|
96
|
+
showPluginManager,
|
|
94
97
|
setShowBackgroundTaskManager,
|
|
95
98
|
setShowMcpManager,
|
|
96
99
|
setShowRewindManager,
|
|
97
100
|
setShowHelp,
|
|
98
101
|
setShowStatusCommand,
|
|
102
|
+
setShowPluginManager,
|
|
99
103
|
// Permission mode
|
|
100
104
|
permissionMode,
|
|
101
105
|
setPermissionMode,
|
|
@@ -111,6 +115,8 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
111
115
|
onPermissionModeChange: setChatPermissionMode,
|
|
112
116
|
onClearMessages: clearMessages,
|
|
113
117
|
sessionId,
|
|
118
|
+
workdir: workingDirectory,
|
|
119
|
+
getFullMessageThread,
|
|
114
120
|
});
|
|
115
121
|
|
|
116
122
|
// Sync permission mode from useChat to InputManager
|
|
@@ -180,6 +186,10 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
180
186
|
return <StatusCommand onCancel={() => setShowStatusCommand(false)} />;
|
|
181
187
|
}
|
|
182
188
|
|
|
189
|
+
if (showPluginManager) {
|
|
190
|
+
return <PluginManagerShell onCancel={() => setShowPluginManager(false)} />;
|
|
191
|
+
}
|
|
192
|
+
|
|
183
193
|
return (
|
|
184
194
|
<Box flexDirection="column">
|
|
185
195
|
{showFileSelector && (
|
|
@@ -229,7 +239,8 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
229
239
|
showMcpManager ||
|
|
230
240
|
showRewindManager ||
|
|
231
241
|
showHelp ||
|
|
232
|
-
showStatusCommand ||
|
|
242
|
+
showStatusCommand ||
|
|
243
|
+
showPluginManager || (
|
|
233
244
|
<Box flexDirection="column">
|
|
234
245
|
<Box
|
|
235
246
|
borderStyle="single"
|
|
@@ -9,6 +9,10 @@ export const MarketplaceDetail: React.FC = () => {
|
|
|
9
9
|
const marketplace = marketplaces.find((m) => m.name === state.selectedId);
|
|
10
10
|
|
|
11
11
|
const ACTIONS = [
|
|
12
|
+
{
|
|
13
|
+
id: "toggle-auto-update",
|
|
14
|
+
label: `${marketplace?.autoUpdate ? "Disable" : "Enable"} auto-update`,
|
|
15
|
+
},
|
|
12
16
|
{ id: "update", label: "Update marketplace" },
|
|
13
17
|
{ id: "remove", label: "Remove marketplace" },
|
|
14
18
|
] as const;
|
|
@@ -26,7 +30,9 @@ export const MarketplaceDetail: React.FC = () => {
|
|
|
26
30
|
);
|
|
27
31
|
} else if (key.return && marketplace && !state.isLoading) {
|
|
28
32
|
const action = ACTIONS[selectedActionIndex].id;
|
|
29
|
-
if (action === "update") {
|
|
33
|
+
if (action === "toggle-auto-update") {
|
|
34
|
+
actions.toggleAutoUpdate(marketplace.name, !marketplace.autoUpdate);
|
|
35
|
+
} else if (action === "update") {
|
|
30
36
|
actions.updateMarketplace(marketplace.name);
|
|
31
37
|
} else {
|
|
32
38
|
actions.removeMarketplace(marketplace.name);
|
|
@@ -55,6 +61,15 @@ export const MarketplaceDetail: React.FC = () => {
|
|
|
55
61
|
<Text>Source: {JSON.stringify(marketplace.source)}</Text>
|
|
56
62
|
</Box>
|
|
57
63
|
|
|
64
|
+
<Box marginBottom={1}>
|
|
65
|
+
<Text>
|
|
66
|
+
Auto-update:{" "}
|
|
67
|
+
<Text color={marketplace.autoUpdate ? "green" : "red"}>
|
|
68
|
+
{marketplace.autoUpdate ? "Enabled" : "Disabled"}
|
|
69
|
+
</Text>
|
|
70
|
+
</Text>
|
|
71
|
+
</Box>
|
|
72
|
+
|
|
58
73
|
{state.isLoading && (
|
|
59
74
|
<Box marginBottom={1}>
|
|
60
75
|
<Text color="yellow">⌛ Processing operation...</Text>
|
|
@@ -10,9 +10,10 @@ import { PluginDetail } from "./PluginDetail.js";
|
|
|
10
10
|
import { MarketplaceAddForm } from "./MarketplaceAddForm.js";
|
|
11
11
|
import { PluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
12
12
|
|
|
13
|
-
export const PluginManagerShell: React.FC<{
|
|
14
|
-
children
|
|
15
|
-
|
|
13
|
+
export const PluginManagerShell: React.FC<{
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
}> = ({ children, onCancel }) => {
|
|
16
17
|
const pluginManager = usePluginManager();
|
|
17
18
|
const { state, actions, discoverablePlugins } = pluginManager;
|
|
18
19
|
|
|
@@ -62,6 +63,8 @@ export const PluginManagerShell: React.FC<{ children?: React.ReactNode }> = ({
|
|
|
62
63
|
state.currentView === "ADD_MARKETPLACE"
|
|
63
64
|
) {
|
|
64
65
|
setView("MARKETPLACES");
|
|
66
|
+
} else {
|
|
67
|
+
onCancel?.();
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
});
|
|
@@ -43,6 +43,7 @@ export interface PluginManagerContextType {
|
|
|
43
43
|
) => Promise<void>;
|
|
44
44
|
uninstallPlugin: (name: string, marketplace: string) => Promise<void>;
|
|
45
45
|
updatePlugin: (name: string, marketplace: string) => Promise<void>;
|
|
46
|
+
toggleAutoUpdate: (name: string, enabled: boolean) => Promise<void>;
|
|
46
47
|
refresh: () => Promise<void>;
|
|
47
48
|
clearPluginFeedback: () => void;
|
|
48
49
|
};
|
|
@@ -38,4 +38,10 @@ export const AVAILABLE_COMMANDS: SlashCommand[] = [
|
|
|
38
38
|
description: "Show agent status and configuration",
|
|
39
39
|
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
id: "plugin",
|
|
43
|
+
name: "plugin",
|
|
44
|
+
description: "View and manage plugins",
|
|
45
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
46
|
+
},
|
|
41
47
|
];
|
package/src/contexts/useChat.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
Agent,
|
|
22
22
|
AgentCallbacks,
|
|
23
23
|
type ToolPermissionContext,
|
|
24
|
+
OPERATION_CANCELLED_BY_USER,
|
|
24
25
|
} from "wave-agent-sdk";
|
|
25
26
|
import { logger } from "../utils/logger.js";
|
|
26
27
|
import { displayUsageSummary } from "../utils/usageSummary.js";
|
|
@@ -317,7 +318,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
317
318
|
// If confirmation was cancelled or failed, deny the operation
|
|
318
319
|
return {
|
|
319
320
|
behavior: "deny",
|
|
320
|
-
message:
|
|
321
|
+
message: OPERATION_CANCELLED_BY_USER,
|
|
321
322
|
};
|
|
322
323
|
}
|
|
323
324
|
};
|
|
@@ -372,6 +373,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
372
373
|
tools,
|
|
373
374
|
workdir,
|
|
374
375
|
worktreeSession,
|
|
376
|
+
model,
|
|
375
377
|
]);
|
|
376
378
|
|
|
377
379
|
// Cleanup on unmount
|
|
@@ -142,6 +142,10 @@ export const useInputManager = (
|
|
|
142
142
|
callbacksRef.current.onStatusCommandStateChange?.(state.showStatusCommand);
|
|
143
143
|
}, [state.showStatusCommand]);
|
|
144
144
|
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
callbacksRef.current.onPluginManagerStateChange?.(state.showPluginManager);
|
|
147
|
+
}, [state.showPluginManager]);
|
|
148
|
+
|
|
145
149
|
useEffect(() => {
|
|
146
150
|
callbacksRef.current.onImagesStateChange?.(state.attachedImages);
|
|
147
151
|
}, [state.attachedImages]);
|
|
@@ -291,6 +295,10 @@ export const useInputManager = (
|
|
|
291
295
|
dispatch({ type: "SET_SHOW_STATUS_COMMAND", payload: show });
|
|
292
296
|
}, []);
|
|
293
297
|
|
|
298
|
+
const setShowPluginManager = useCallback((show: boolean) => {
|
|
299
|
+
dispatch({ type: "SET_SHOW_PLUGIN_MANAGER", payload: show });
|
|
300
|
+
}, []);
|
|
301
|
+
|
|
294
302
|
const setPermissionMode = useCallback((mode: PermissionMode) => {
|
|
295
303
|
dispatch({ type: "SET_PERMISSION_MODE", payload: mode });
|
|
296
304
|
callbacksRef.current.onPermissionModeChange?.(mode);
|
|
@@ -384,6 +392,7 @@ export const useInputManager = (
|
|
|
384
392
|
showRewindManager: state.showRewindManager,
|
|
385
393
|
showHelp: state.showHelp,
|
|
386
394
|
showStatusCommand: state.showStatusCommand,
|
|
395
|
+
showPluginManager: state.showPluginManager,
|
|
387
396
|
permissionMode: state.permissionMode,
|
|
388
397
|
attachedImages: state.attachedImages,
|
|
389
398
|
isManagerReady: true,
|
|
@@ -423,6 +432,7 @@ export const useInputManager = (
|
|
|
423
432
|
setShowRewindManager,
|
|
424
433
|
setShowHelp,
|
|
425
434
|
setShowStatusCommand,
|
|
435
|
+
setShowPluginManager,
|
|
426
436
|
setPermissionMode,
|
|
427
437
|
|
|
428
438
|
// Image management
|
|
@@ -126,7 +126,7 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
126
126
|
error: error instanceof Error ? error.message : String(error),
|
|
127
127
|
}));
|
|
128
128
|
}
|
|
129
|
-
}, [pluginCore]);
|
|
129
|
+
}, [pluginCore, clearPluginFeedback]);
|
|
130
130
|
|
|
131
131
|
useEffect(() => {
|
|
132
132
|
refresh();
|
|
@@ -279,6 +279,30 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
279
279
|
[pluginCore, refresh, clearPluginFeedback, setSuccessMessage],
|
|
280
280
|
);
|
|
281
281
|
|
|
282
|
+
const toggleAutoUpdate = useCallback(
|
|
283
|
+
async (name: string, enabled: boolean) => {
|
|
284
|
+
clearPluginFeedback();
|
|
285
|
+
setState((prev: PluginManagerState) => ({
|
|
286
|
+
...prev,
|
|
287
|
+
isLoading: true,
|
|
288
|
+
}));
|
|
289
|
+
try {
|
|
290
|
+
await pluginCore.toggleAutoUpdate(name, enabled);
|
|
291
|
+
await refresh();
|
|
292
|
+
setSuccessMessage(
|
|
293
|
+
`Auto-update for '${name}' ${enabled ? "enabled" : "disabled"}`,
|
|
294
|
+
);
|
|
295
|
+
} catch (error) {
|
|
296
|
+
setState((prev: PluginManagerState) => ({
|
|
297
|
+
...prev,
|
|
298
|
+
isLoading: false,
|
|
299
|
+
error: error instanceof Error ? error.message : String(error),
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
[pluginCore, refresh, clearPluginFeedback, setSuccessMessage],
|
|
304
|
+
);
|
|
305
|
+
|
|
282
306
|
return {
|
|
283
307
|
state,
|
|
284
308
|
marketplaces,
|
|
@@ -293,6 +317,7 @@ export function usePluginManager(): PluginManagerContextType {
|
|
|
293
317
|
installPlugin,
|
|
294
318
|
uninstallPlugin,
|
|
295
319
|
updatePlugin,
|
|
320
|
+
toggleAutoUpdate,
|
|
296
321
|
refresh,
|
|
297
322
|
clearPluginFeedback,
|
|
298
323
|
},
|
package/src/index.ts
CHANGED
|
@@ -70,165 +70,135 @@ export async function main() {
|
|
|
70
70
|
type: "string",
|
|
71
71
|
global: false,
|
|
72
72
|
})
|
|
73
|
-
.command(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
)
|
|
93
|
-
.command(
|
|
94
|
-
"marketplace",
|
|
95
|
-
"Manage plugin marketplaces",
|
|
96
|
-
(yargs) => {
|
|
97
|
-
return yargs
|
|
98
|
-
.help()
|
|
99
|
-
.command(
|
|
100
|
-
"add <input>",
|
|
101
|
-
"Add a plugin marketplace (local path, owner/repo, or Git URL)",
|
|
102
|
-
(yargs) => {
|
|
103
|
-
return yargs.positional("input", {
|
|
104
|
-
describe:
|
|
105
|
-
"Path to local marketplace, GitHub owner/repo, or full Git URL (with optional #ref)",
|
|
106
|
-
type: "string",
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
async (argv) => {
|
|
110
|
-
const { addMarketplaceCommand } = await import(
|
|
111
|
-
"./commands/plugin/marketplace.js"
|
|
112
|
-
);
|
|
113
|
-
await addMarketplaceCommand(argv as { input: string });
|
|
114
|
-
},
|
|
115
|
-
)
|
|
116
|
-
.command(
|
|
117
|
-
"update [name]",
|
|
118
|
-
"Update registered marketplace(s)",
|
|
119
|
-
(yargs) => {
|
|
120
|
-
return yargs.positional("name", {
|
|
121
|
-
describe: "Name of the marketplace to update",
|
|
122
|
-
type: "string",
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
async (argv) => {
|
|
126
|
-
const { updateMarketplaceCommand } = await import(
|
|
127
|
-
"./commands/plugin/marketplace.js"
|
|
128
|
-
);
|
|
129
|
-
await updateMarketplaceCommand(argv as { name?: string });
|
|
130
|
-
},
|
|
131
|
-
)
|
|
132
|
-
.command(
|
|
133
|
-
"list",
|
|
134
|
-
"List registered marketplaces",
|
|
135
|
-
{},
|
|
136
|
-
async () => {
|
|
137
|
-
const { listMarketplacesCommand } = await import(
|
|
138
|
-
"./commands/plugin/marketplace.js"
|
|
139
|
-
);
|
|
140
|
-
await listMarketplacesCommand();
|
|
141
|
-
},
|
|
142
|
-
)
|
|
143
|
-
.demandCommand(1, "Please specify a marketplace subcommand");
|
|
144
|
-
},
|
|
145
|
-
() => {},
|
|
146
|
-
)
|
|
147
|
-
.command(
|
|
148
|
-
"install <plugin>",
|
|
149
|
-
"Install a plugin from a marketplace",
|
|
150
|
-
(yargs) => {
|
|
151
|
-
return yargs
|
|
152
|
-
.positional("plugin", {
|
|
153
|
-
describe: "Plugin to install (format: name@marketplace)",
|
|
154
|
-
type: "string",
|
|
155
|
-
})
|
|
156
|
-
.option("scope", {
|
|
157
|
-
alias: "s",
|
|
158
|
-
describe: "Scope to enable the plugin in",
|
|
159
|
-
choices: ["user", "project", "local"],
|
|
160
|
-
type: "string",
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
async (argv) => {
|
|
164
|
-
const { installPluginCommand } = await import(
|
|
165
|
-
"./commands/plugin/install.js"
|
|
166
|
-
);
|
|
167
|
-
await installPluginCommand(
|
|
168
|
-
argv as {
|
|
169
|
-
plugin: string;
|
|
170
|
-
scope?: Scope;
|
|
73
|
+
.command("plugin", "Manage plugins and marketplaces", (yargs) => {
|
|
74
|
+
return yargs
|
|
75
|
+
.help()
|
|
76
|
+
.command(
|
|
77
|
+
"marketplace",
|
|
78
|
+
"Manage plugin marketplaces",
|
|
79
|
+
(yargs) => {
|
|
80
|
+
return yargs
|
|
81
|
+
.help()
|
|
82
|
+
.command(
|
|
83
|
+
"add <input>",
|
|
84
|
+
"Add a plugin marketplace (local path, owner/repo, or Git URL)",
|
|
85
|
+
(yargs) => {
|
|
86
|
+
return yargs.positional("input", {
|
|
87
|
+
describe:
|
|
88
|
+
"Path to local marketplace, GitHub owner/repo, or full Git URL (with optional #ref)",
|
|
89
|
+
type: "string",
|
|
90
|
+
});
|
|
171
91
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
92
|
+
async (argv) => {
|
|
93
|
+
const { addMarketplaceCommand } = await import(
|
|
94
|
+
"./commands/plugin/marketplace.js"
|
|
95
|
+
);
|
|
96
|
+
await addMarketplaceCommand(argv as { input: string });
|
|
97
|
+
},
|
|
98
|
+
)
|
|
99
|
+
.command(
|
|
100
|
+
"update [name]",
|
|
101
|
+
"Update registered marketplace(s)",
|
|
102
|
+
(yargs) => {
|
|
103
|
+
return yargs.positional("name", {
|
|
104
|
+
describe: "Name of the marketplace to update",
|
|
105
|
+
type: "string",
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
async (argv) => {
|
|
109
|
+
const { updateMarketplaceCommand } = await import(
|
|
110
|
+
"./commands/plugin/marketplace.js"
|
|
111
|
+
);
|
|
112
|
+
await updateMarketplaceCommand(argv as { name?: string });
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
.command(
|
|
116
|
+
"list",
|
|
117
|
+
"List registered marketplaces",
|
|
118
|
+
{},
|
|
119
|
+
async () => {
|
|
120
|
+
const { listMarketplacesCommand } = await import(
|
|
121
|
+
"./commands/plugin/marketplace.js"
|
|
122
|
+
);
|
|
123
|
+
await listMarketplacesCommand();
|
|
124
|
+
},
|
|
125
|
+
)
|
|
126
|
+
.demandCommand(1, "Please specify a marketplace subcommand");
|
|
127
|
+
},
|
|
128
|
+
() => {},
|
|
129
|
+
)
|
|
130
|
+
.command(
|
|
131
|
+
"install <plugin>",
|
|
132
|
+
"Install a plugin from a marketplace",
|
|
133
|
+
(yargs) => {
|
|
134
|
+
return yargs
|
|
135
|
+
.positional("plugin", {
|
|
136
|
+
describe: "Plugin to install (format: name@marketplace)",
|
|
192
137
|
type: "string",
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"
|
|
198
|
-
);
|
|
199
|
-
await uninstallPluginCommand(argv as { plugin: string });
|
|
200
|
-
},
|
|
201
|
-
)
|
|
202
|
-
.command(
|
|
203
|
-
"update <plugin>",
|
|
204
|
-
"Update a plugin (uninstall followed by install)",
|
|
205
|
-
(yargs) => {
|
|
206
|
-
return yargs.positional("plugin", {
|
|
207
|
-
describe: "Plugin to update (format: name@marketplace)",
|
|
138
|
+
})
|
|
139
|
+
.option("scope", {
|
|
140
|
+
alias: "s",
|
|
141
|
+
describe: "Scope to enable the plugin in",
|
|
142
|
+
choices: ["user", "project", "local"],
|
|
208
143
|
type: "string",
|
|
209
144
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
145
|
+
},
|
|
146
|
+
async (argv) => {
|
|
147
|
+
const { installPluginCommand } = await import(
|
|
148
|
+
"./commands/plugin/install.js"
|
|
149
|
+
);
|
|
150
|
+
await installPluginCommand(
|
|
151
|
+
argv as {
|
|
152
|
+
plugin: string;
|
|
153
|
+
scope?: Scope;
|
|
154
|
+
},
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
)
|
|
158
|
+
.command(
|
|
159
|
+
"list",
|
|
160
|
+
"List all available plugins from marketplaces",
|
|
161
|
+
{},
|
|
162
|
+
async () => {
|
|
163
|
+
const { listPluginsCommand } = await import(
|
|
164
|
+
"./commands/plugin/list.js"
|
|
165
|
+
);
|
|
166
|
+
await listPluginsCommand();
|
|
167
|
+
},
|
|
168
|
+
)
|
|
169
|
+
.command(
|
|
170
|
+
"uninstall <plugin>",
|
|
171
|
+
"Uninstall a plugin",
|
|
172
|
+
(yargs) => {
|
|
173
|
+
return yargs.positional("plugin", {
|
|
174
|
+
describe: "Plugin to uninstall (format: name@marketplace)",
|
|
175
|
+
type: "string",
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
async (argv) => {
|
|
179
|
+
const { uninstallPluginCommand } = await import(
|
|
180
|
+
"./commands/plugin/uninstall.js"
|
|
181
|
+
);
|
|
182
|
+
await uninstallPluginCommand(argv as { plugin: string });
|
|
183
|
+
},
|
|
184
|
+
)
|
|
185
|
+
.command(
|
|
186
|
+
"update <plugin>",
|
|
187
|
+
"Update a plugin (uninstall followed by install)",
|
|
188
|
+
(yargs) => {
|
|
189
|
+
return yargs.positional("plugin", {
|
|
190
|
+
describe: "Plugin to update (format: name@marketplace)",
|
|
191
|
+
type: "string",
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
async (argv) => {
|
|
195
|
+
const { updatePluginCommand } = await import(
|
|
196
|
+
"./commands/plugin/update.js"
|
|
197
|
+
);
|
|
198
|
+
await updatePluginCommand(argv as { plugin: string });
|
|
199
|
+
},
|
|
200
|
+
);
|
|
201
|
+
})
|
|
232
202
|
.version()
|
|
233
203
|
.alias("v", "version")
|
|
234
204
|
.example("$0", "Start CLI with default settings")
|
|
@@ -63,6 +63,7 @@ export const handleSubmit = async (
|
|
|
63
63
|
contentWithPlaceholders,
|
|
64
64
|
callbacks.sessionId,
|
|
65
65
|
state.longTextMap,
|
|
66
|
+
callbacks.workdir,
|
|
66
67
|
).catch((err: unknown) => {
|
|
67
68
|
callbacks.logger?.error("Failed to save prompt history", err);
|
|
68
69
|
});
|
|
@@ -285,7 +286,6 @@ export const handlePasteInput = (
|
|
|
285
286
|
char = "!";
|
|
286
287
|
}
|
|
287
288
|
|
|
288
|
-
dispatch({ type: "RESET_HISTORY_NAVIGATION" });
|
|
289
289
|
dispatch({ type: "INSERT_TEXT", payload: char });
|
|
290
290
|
|
|
291
291
|
processSelectorInput(state, dispatch, char);
|
|
@@ -342,6 +342,8 @@ export const handleCommandSelect = (
|
|
|
342
342
|
dispatch({ type: "SET_SHOW_HELP", payload: true });
|
|
343
343
|
} else if (command === "status") {
|
|
344
344
|
dispatch({ type: "SET_SHOW_STATUS_COMMAND", payload: true });
|
|
345
|
+
} else if (command === "plugin") {
|
|
346
|
+
dispatch({ type: "SET_SHOW_PLUGIN_MANAGER", payload: true });
|
|
345
347
|
}
|
|
346
348
|
}
|
|
347
349
|
})();
|
|
@@ -458,8 +460,12 @@ export const handleSelectorInput = (
|
|
|
458
460
|
return true;
|
|
459
461
|
}
|
|
460
462
|
|
|
461
|
-
if (input === " "
|
|
462
|
-
|
|
463
|
+
if (input === " ") {
|
|
464
|
+
if (state.showFileSelector) {
|
|
465
|
+
dispatch({ type: "CANCEL_FILE_SELECTOR" });
|
|
466
|
+
} else if (state.showCommandSelector) {
|
|
467
|
+
dispatch({ type: "CANCEL_COMMAND_SELECTOR" });
|
|
468
|
+
}
|
|
463
469
|
}
|
|
464
470
|
|
|
465
471
|
if (
|
|
@@ -511,9 +517,26 @@ export const handleNormalInput = async (
|
|
|
511
517
|
|
|
512
518
|
if (key.upArrow) {
|
|
513
519
|
if (state.history.length === 0) {
|
|
514
|
-
|
|
515
|
-
callbacks.sessionId
|
|
516
|
-
|
|
520
|
+
let sessionIds: string[] | undefined = callbacks.sessionId
|
|
521
|
+
? [callbacks.sessionId]
|
|
522
|
+
: undefined;
|
|
523
|
+
|
|
524
|
+
if (callbacks.getFullMessageThread) {
|
|
525
|
+
try {
|
|
526
|
+
const thread = await callbacks.getFullMessageThread();
|
|
527
|
+
sessionIds = thread.sessionIds;
|
|
528
|
+
} catch (error) {
|
|
529
|
+
callbacks.logger?.error(
|
|
530
|
+
"Failed to fetch ancestor session IDs",
|
|
531
|
+
error,
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const history = await PromptHistoryManager.getHistory({
|
|
537
|
+
sessionId: sessionIds,
|
|
538
|
+
workdir: callbacks.workdir,
|
|
539
|
+
});
|
|
517
540
|
dispatch({ type: "SET_HISTORY_ENTRIES", payload: history });
|
|
518
541
|
}
|
|
519
542
|
dispatch({ type: "NAVIGATE_HISTORY", payload: "up" });
|
|
@@ -536,7 +559,6 @@ export const handleNormalInput = async (
|
|
|
536
559
|
const newInputText = beforeCursor + afterCursor;
|
|
537
560
|
|
|
538
561
|
dispatch({ type: "DELETE_CHAR" });
|
|
539
|
-
dispatch({ type: "RESET_HISTORY_NAVIGATION" });
|
|
540
562
|
|
|
541
563
|
checkForAtDeletion(state, dispatch, newCursorPosition);
|
|
542
564
|
checkForSlashDeletion(state, dispatch, newCursorPosition);
|
|
@@ -657,7 +679,8 @@ export const handleInput = async (
|
|
|
657
679
|
state.showMcpManager ||
|
|
658
680
|
state.showRewindManager ||
|
|
659
681
|
state.showHelp ||
|
|
660
|
-
state.showStatusCommand
|
|
682
|
+
state.showStatusCommand ||
|
|
683
|
+
state.showPluginManager
|
|
661
684
|
)
|
|
662
685
|
) {
|
|
663
686
|
callbacks.onAbortMessage?.();
|
|
@@ -678,14 +701,16 @@ export const handleInput = async (
|
|
|
678
701
|
state.showMcpManager ||
|
|
679
702
|
state.showRewindManager ||
|
|
680
703
|
state.showHelp ||
|
|
681
|
-
state.showStatusCommand
|
|
704
|
+
state.showStatusCommand ||
|
|
705
|
+
state.showPluginManager
|
|
682
706
|
) {
|
|
683
707
|
if (
|
|
684
708
|
state.showBackgroundTaskManager ||
|
|
685
709
|
state.showMcpManager ||
|
|
686
710
|
state.showRewindManager ||
|
|
687
711
|
state.showHelp ||
|
|
688
|
-
state.showStatusCommand
|
|
712
|
+
state.showStatusCommand ||
|
|
713
|
+
state.showPluginManager
|
|
689
714
|
) {
|
|
690
715
|
return true;
|
|
691
716
|
}
|