wave-code 0.6.5 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/commands/plugin/disable.d.ts.map +1 -1
- package/dist/commands/plugin/disable.js +3 -10
- package/dist/commands/plugin/enable.d.ts.map +1 -1
- package/dist/commands/plugin/enable.js +3 -10
- package/dist/commands/plugin/install.d.ts.map +1 -1
- package/dist/commands/plugin/install.js +4 -11
- package/dist/commands/plugin/list.d.ts.map +1 -1
- package/dist/commands/plugin/list.js +5 -39
- package/dist/commands/plugin/marketplace.js +9 -9
- package/dist/commands/plugin/uninstall.d.ts.map +1 -1
- package/dist/commands/plugin/uninstall.js +4 -17
- package/dist/commands/plugin/update.js +3 -3
- package/dist/components/App.d.ts +1 -0
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +4 -4
- package/dist/components/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/components/BackgroundTaskManager.js +34 -18
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +28 -15
- package/dist/components/ConfirmationDetails.d.ts +1 -0
- package/dist/components/ConfirmationDetails.d.ts.map +1 -1
- package/dist/components/ConfirmationDetails.js +7 -14
- package/dist/components/ConfirmationSelector.d.ts +1 -0
- package/dist/components/ConfirmationSelector.d.ts.map +1 -1
- package/dist/components/ConfirmationSelector.js +164 -117
- package/dist/components/DiffDisplay.d.ts +1 -0
- package/dist/components/DiffDisplay.d.ts.map +1 -1
- package/dist/components/DiffDisplay.js +94 -36
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +26 -20
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +3 -1
- package/dist/components/McpManager.d.ts.map +1 -1
- package/dist/components/McpManager.js +49 -52
- package/dist/components/MessageBlockItem.d.ts +9 -0
- package/dist/components/MessageBlockItem.d.ts.map +1 -0
- package/dist/components/MessageBlockItem.js +11 -0
- package/dist/components/MessageList.d.ts +2 -4
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +28 -23
- package/dist/components/PluginDetail.d.ts.map +1 -1
- package/dist/components/PluginDetail.js +19 -22
- package/dist/components/SessionSelector.d.ts.map +1 -1
- package/dist/components/SessionSelector.js +8 -5
- package/dist/components/TaskList.d.ts.map +1 -1
- package/dist/components/TaskList.js +2 -5
- package/dist/components/ToolDisplay.d.ts.map +1 -1
- package/dist/components/ToolDisplay.js +1 -1
- package/dist/contexts/useChat.d.ts +1 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +20 -3
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +20 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/print-cli.d.ts +1 -0
- package/dist/print-cli.d.ts.map +1 -1
- package/dist/print-cli.js +2 -1
- package/dist/utils/highlightUtils.d.ts +2 -0
- package/dist/utils/highlightUtils.d.ts.map +1 -0
- package/dist/utils/highlightUtils.js +69 -0
- package/dist/utils/toolParameterTransforms.d.ts +2 -6
- package/dist/utils/toolParameterTransforms.d.ts.map +1 -1
- package/dist/utils/toolParameterTransforms.js +10 -14
- package/package.json +4 -2
- package/src/cli.tsx +3 -0
- package/src/commands/plugin/disable.ts +3 -17
- package/src/commands/plugin/enable.ts +3 -17
- package/src/commands/plugin/install.ts +4 -18
- package/src/commands/plugin/list.ts +5 -55
- package/src/commands/plugin/marketplace.ts +9 -9
- package/src/commands/plugin/uninstall.ts +4 -26
- package/src/commands/plugin/update.ts +3 -3
- package/src/components/App.tsx +10 -2
- package/src/components/BackgroundTaskManager.tsx +69 -44
- package/src/components/ChatInterface.tsx +35 -23
- package/src/components/ConfirmationDetails.tsx +13 -15
- package/src/components/ConfirmationSelector.tsx +207 -128
- package/src/components/DiffDisplay.tsx +164 -75
- package/src/components/HistorySearch.tsx +31 -25
- package/src/components/Markdown.tsx +3 -1
- package/src/components/McpManager.tsx +51 -59
- package/src/components/MessageBlockItem.tsx +83 -0
- package/src/components/MessageList.tsx +55 -52
- package/src/components/PluginDetail.tsx +30 -31
- package/src/components/SessionSelector.tsx +8 -5
- package/src/components/TaskList.tsx +2 -5
- package/src/components/ToolDisplay.tsx +5 -1
- package/src/contexts/useChat.tsx +22 -2
- package/src/hooks/usePluginManager.ts +21 -57
- package/src/index.ts +17 -0
- package/src/print-cli.ts +3 -0
- package/src/utils/highlightUtils.ts +76 -0
- package/src/utils/toolParameterTransforms.ts +11 -20
- package/dist/components/MessageItem.d.ts +0 -8
- package/dist/components/MessageItem.d.ts.map +0 -1
- package/dist/components/MessageItem.js +0 -13
- package/src/components/MessageItem.tsx +0 -81
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { PluginCore, } from "wave-agent-sdk";
|
|
3
3
|
export function usePluginManager() {
|
|
4
4
|
const [state, setState] = useState({
|
|
5
5
|
currentView: "DISCOVER",
|
|
@@ -11,17 +11,7 @@ export function usePluginManager() {
|
|
|
11
11
|
const [marketplaces, setMarketplaces] = useState([]);
|
|
12
12
|
const [installedPlugins, setInstalledPlugins] = useState([]);
|
|
13
13
|
const [discoverablePlugins, setDiscoverablePlugins] = useState([]);
|
|
14
|
-
const
|
|
15
|
-
const configurationService = useMemo(() => new ConfigurationService(), []);
|
|
16
|
-
const pluginManager = useMemo(() => new PluginManager({
|
|
17
|
-
workdir: process.cwd(),
|
|
18
|
-
configurationService,
|
|
19
|
-
}), [configurationService]);
|
|
20
|
-
const pluginScopeManager = useMemo(() => new PluginScopeManager({
|
|
21
|
-
workdir: process.cwd(),
|
|
22
|
-
configurationService,
|
|
23
|
-
pluginManager,
|
|
24
|
-
}), [configurationService, pluginManager]);
|
|
14
|
+
const pluginCore = useMemo(() => new PluginCore(), []);
|
|
25
15
|
const refresh = useCallback(async () => {
|
|
26
16
|
setState((prev) => ({
|
|
27
17
|
...prev,
|
|
@@ -30,9 +20,9 @@ export function usePluginManager() {
|
|
|
30
20
|
}));
|
|
31
21
|
try {
|
|
32
22
|
const [mks, installed, enabledMap] = await Promise.all([
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Promise.resolve(
|
|
23
|
+
pluginCore.listMarketplaces(),
|
|
24
|
+
pluginCore.getInstalledPlugins(),
|
|
25
|
+
Promise.resolve(pluginCore.getMergedEnabledPlugins()),
|
|
36
26
|
]);
|
|
37
27
|
setMarketplaces(mks);
|
|
38
28
|
const allInstalledWithEnabled = installed.plugins.map((p) => {
|
|
@@ -40,7 +30,7 @@ export function usePluginManager() {
|
|
|
40
30
|
return {
|
|
41
31
|
...p,
|
|
42
32
|
enabled: !!enabledMap[pluginId],
|
|
43
|
-
scope:
|
|
33
|
+
scope: pluginCore.findPluginScope(pluginId) || undefined,
|
|
44
34
|
};
|
|
45
35
|
});
|
|
46
36
|
// Only show enabled plugins in the "Installed" view
|
|
@@ -48,7 +38,7 @@ export function usePluginManager() {
|
|
|
48
38
|
const allDiscoverable = [];
|
|
49
39
|
for (const mk of mks) {
|
|
50
40
|
try {
|
|
51
|
-
const manifest = await
|
|
41
|
+
const manifest = await pluginCore.loadMarketplaceManifest(pluginCore.getMarketplacePath(mk));
|
|
52
42
|
manifest.plugins.forEach((p) => {
|
|
53
43
|
const pluginId = `${p.name}@${mk.name}`;
|
|
54
44
|
const isInstalled = installed.plugins.find((ip) => ip.name === p.name && ip.marketplace === mk.name);
|
|
@@ -77,7 +67,7 @@ export function usePluginManager() {
|
|
|
77
67
|
error: error instanceof Error ? error.message : String(error),
|
|
78
68
|
}));
|
|
79
69
|
}
|
|
80
|
-
}, [
|
|
70
|
+
}, [pluginCore]);
|
|
81
71
|
useEffect(() => {
|
|
82
72
|
refresh();
|
|
83
73
|
}, [refresh]);
|
|
@@ -94,7 +84,7 @@ export function usePluginManager() {
|
|
|
94
84
|
error: null,
|
|
95
85
|
}));
|
|
96
86
|
try {
|
|
97
|
-
await
|
|
87
|
+
await pluginCore.addMarketplace(source);
|
|
98
88
|
await refresh();
|
|
99
89
|
}
|
|
100
90
|
catch (error) {
|
|
@@ -104,7 +94,7 @@ export function usePluginManager() {
|
|
|
104
94
|
error: error instanceof Error ? error.message : String(error),
|
|
105
95
|
}));
|
|
106
96
|
}
|
|
107
|
-
}, [
|
|
97
|
+
}, [pluginCore, refresh]);
|
|
108
98
|
const removeMarketplace = useCallback(async (name) => {
|
|
109
99
|
setState((prev) => ({
|
|
110
100
|
...prev,
|
|
@@ -112,7 +102,7 @@ export function usePluginManager() {
|
|
|
112
102
|
error: null,
|
|
113
103
|
}));
|
|
114
104
|
try {
|
|
115
|
-
await
|
|
105
|
+
await pluginCore.removeMarketplace(name);
|
|
116
106
|
await refresh();
|
|
117
107
|
}
|
|
118
108
|
catch (error) {
|
|
@@ -122,7 +112,7 @@ export function usePluginManager() {
|
|
|
122
112
|
error: error instanceof Error ? error.message : String(error),
|
|
123
113
|
}));
|
|
124
114
|
}
|
|
125
|
-
}, [
|
|
115
|
+
}, [pluginCore, refresh]);
|
|
126
116
|
const updateMarketplace = useCallback(async (name) => {
|
|
127
117
|
setState((prev) => ({
|
|
128
118
|
...prev,
|
|
@@ -130,7 +120,7 @@ export function usePluginManager() {
|
|
|
130
120
|
error: null,
|
|
131
121
|
}));
|
|
132
122
|
try {
|
|
133
|
-
await
|
|
123
|
+
await pluginCore.updateMarketplace(name);
|
|
134
124
|
await refresh();
|
|
135
125
|
}
|
|
136
126
|
catch (error) {
|
|
@@ -140,7 +130,7 @@ export function usePluginManager() {
|
|
|
140
130
|
error: error instanceof Error ? error.message : String(error),
|
|
141
131
|
}));
|
|
142
132
|
}
|
|
143
|
-
}, [
|
|
133
|
+
}, [pluginCore, refresh]);
|
|
144
134
|
const installPlugin = useCallback(async (name, marketplace, scope = "project") => {
|
|
145
135
|
setState((prev) => ({
|
|
146
136
|
...prev,
|
|
@@ -149,9 +139,7 @@ export function usePluginManager() {
|
|
|
149
139
|
}));
|
|
150
140
|
try {
|
|
151
141
|
const pluginId = `${name}@${marketplace}`;
|
|
152
|
-
|
|
153
|
-
await marketplaceService.installPlugin(pluginId, workdir);
|
|
154
|
-
await pluginScopeManager.enablePlugin(scope, pluginId);
|
|
142
|
+
await pluginCore.installPlugin(pluginId, scope);
|
|
155
143
|
await refresh();
|
|
156
144
|
}
|
|
157
145
|
catch (error) {
|
|
@@ -161,7 +149,7 @@ export function usePluginManager() {
|
|
|
161
149
|
error: error instanceof Error ? error.message : String(error),
|
|
162
150
|
}));
|
|
163
151
|
}
|
|
164
|
-
}, [
|
|
152
|
+
}, [pluginCore, refresh]);
|
|
165
153
|
const uninstallPlugin = useCallback(async (name, marketplace) => {
|
|
166
154
|
setState((prev) => ({
|
|
167
155
|
...prev,
|
|
@@ -170,14 +158,7 @@ export function usePluginManager() {
|
|
|
170
158
|
}));
|
|
171
159
|
try {
|
|
172
160
|
const pluginId = `${name}@${marketplace}`;
|
|
173
|
-
|
|
174
|
-
// 1. Remove from global registry and potentially clean up cache
|
|
175
|
-
await marketplaceService.uninstallPlugin(pluginId, workdir);
|
|
176
|
-
// 2. Find the scope where it's currently enabled and remove it from there
|
|
177
|
-
const scope = pluginScopeManager.findPluginScope(pluginId);
|
|
178
|
-
if (scope) {
|
|
179
|
-
await configurationService.removeEnabledPlugin(workdir, scope, pluginId);
|
|
180
|
-
}
|
|
161
|
+
await pluginCore.uninstallPlugin(pluginId);
|
|
181
162
|
await refresh();
|
|
182
163
|
}
|
|
183
164
|
catch (error) {
|
|
@@ -187,7 +168,7 @@ export function usePluginManager() {
|
|
|
187
168
|
error: error instanceof Error ? error.message : String(error),
|
|
188
169
|
}));
|
|
189
170
|
}
|
|
190
|
-
}, [
|
|
171
|
+
}, [pluginCore, refresh]);
|
|
191
172
|
const updatePlugin = useCallback(async (name, marketplace) => {
|
|
192
173
|
setState((prev) => ({
|
|
193
174
|
...prev,
|
|
@@ -196,7 +177,7 @@ export function usePluginManager() {
|
|
|
196
177
|
}));
|
|
197
178
|
try {
|
|
198
179
|
const pluginId = `${name}@${marketplace}`;
|
|
199
|
-
await
|
|
180
|
+
await pluginCore.updatePlugin(pluginId);
|
|
200
181
|
await refresh();
|
|
201
182
|
}
|
|
202
183
|
catch (error) {
|
|
@@ -206,7 +187,7 @@ export function usePluginManager() {
|
|
|
206
187
|
error: error instanceof Error ? error.message : String(error),
|
|
207
188
|
}));
|
|
208
189
|
}
|
|
209
|
-
}, [
|
|
190
|
+
}, [pluginCore, refresh]);
|
|
210
191
|
return {
|
|
211
192
|
state,
|
|
212
193
|
marketplaces,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,IAAI,kBAmRzB;AAGD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,11 @@ export async function main() {
|
|
|
39
39
|
type: "array",
|
|
40
40
|
string: true,
|
|
41
41
|
global: false,
|
|
42
|
+
})
|
|
43
|
+
.option("tools", {
|
|
44
|
+
description: 'Specify a comma-separated list of tools to enable (e.g., \'Bash,Read,Write\'). Use "" to disable all, "default" for all.',
|
|
45
|
+
type: "string",
|
|
46
|
+
global: false,
|
|
42
47
|
})
|
|
43
48
|
.command("plugin", "Manage plugins and marketplaces", (yargs) => {
|
|
44
49
|
return yargs
|
|
@@ -136,6 +141,14 @@ export async function main() {
|
|
|
136
141
|
.recommendCommands()
|
|
137
142
|
.strict()
|
|
138
143
|
.parseAsync();
|
|
144
|
+
const parseTools = (tools) => {
|
|
145
|
+
if (tools === undefined || tools === "default")
|
|
146
|
+
return undefined;
|
|
147
|
+
if (tools === "")
|
|
148
|
+
return [];
|
|
149
|
+
return tools.split(",").map((t) => t.trim());
|
|
150
|
+
};
|
|
151
|
+
const tools = parseTools(argv.tools);
|
|
139
152
|
// Handle restore session command
|
|
140
153
|
if (argv.restore === "" ||
|
|
141
154
|
(process.argv.includes("-r") && argv.restore === undefined) ||
|
|
@@ -151,6 +164,7 @@ export async function main() {
|
|
|
151
164
|
restoreSessionId: selectedSessionId,
|
|
152
165
|
bypassPermissions: argv.dangerouslySkipPermissions,
|
|
153
166
|
pluginDirs: argv.pluginDir,
|
|
167
|
+
tools,
|
|
154
168
|
});
|
|
155
169
|
}
|
|
156
170
|
// Handle print mode directly
|
|
@@ -163,6 +177,7 @@ export async function main() {
|
|
|
163
177
|
showStats: argv.showStats,
|
|
164
178
|
bypassPermissions: argv.dangerouslySkipPermissions,
|
|
165
179
|
pluginDirs: argv.pluginDir,
|
|
180
|
+
tools,
|
|
166
181
|
});
|
|
167
182
|
}
|
|
168
183
|
await startCli({
|
|
@@ -170,6 +185,7 @@ export async function main() {
|
|
|
170
185
|
continueLastSession: argv.continue,
|
|
171
186
|
bypassPermissions: argv.dangerouslySkipPermissions,
|
|
172
187
|
pluginDirs: argv.pluginDir,
|
|
188
|
+
tools,
|
|
173
189
|
});
|
|
174
190
|
}
|
|
175
191
|
catch (error) {
|
package/dist/print-cli.d.ts
CHANGED
package/dist/print-cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-cli.d.ts","sourceRoot":"","sources":["../src/print-cli.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"print-cli.d.ts","sourceRoot":"","sources":["../src/print-cli.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAgBD,wBAAsB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAgK3E"}
|
package/dist/print-cli.js
CHANGED
|
@@ -13,7 +13,7 @@ function displayTimingInfo(startTime, showStats) {
|
|
|
13
13
|
}
|
|
14
14
|
export async function startPrintCli(options) {
|
|
15
15
|
const startTime = new Date();
|
|
16
|
-
const { restoreSessionId, continueLastSession, message, showStats = false, bypassPermissions, pluginDirs, } = options;
|
|
16
|
+
const { restoreSessionId, continueLastSession, message, showStats = false, bypassPermissions, pluginDirs, tools, } = options;
|
|
17
17
|
if ((!message || message.trim() === "") &&
|
|
18
18
|
!continueLastSession &&
|
|
19
19
|
!restoreSessionId) {
|
|
@@ -97,6 +97,7 @@ export async function startPrintCli(options) {
|
|
|
97
97
|
continueLastSession,
|
|
98
98
|
permissionMode: bypassPermissions ? "bypassPermissions" : undefined,
|
|
99
99
|
plugins: pluginDirs?.map((path) => ({ type: "local", path })),
|
|
100
|
+
tools,
|
|
100
101
|
// 保持流式模式以获得更好的命令行用户体验
|
|
101
102
|
});
|
|
102
103
|
// Send message if provided and not empty
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightUtils.d.ts","sourceRoot":"","sources":["../../src/utils/highlightUtils.ts"],"names":[],"mappings":"AA6DA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAcvE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import hljs from 'highlight.js';
|
|
2
|
+
import { parse, HTMLElement, TextNode } from 'node-html-parser';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
const theme = {
|
|
5
|
+
'hljs-keyword': chalk.blue,
|
|
6
|
+
'hljs-built_in': chalk.cyan,
|
|
7
|
+
'hljs-type': chalk.cyan,
|
|
8
|
+
'hljs-literal': chalk.magenta,
|
|
9
|
+
'hljs-number': chalk.magenta,
|
|
10
|
+
'hljs-operator': chalk.white,
|
|
11
|
+
'hljs-punctuation': chalk.white,
|
|
12
|
+
'hljs-property': chalk.yellow,
|
|
13
|
+
'hljs-attr': chalk.yellow,
|
|
14
|
+
'hljs-variable': chalk.white,
|
|
15
|
+
'hljs-template-variable': chalk.white,
|
|
16
|
+
'hljs-string': chalk.green,
|
|
17
|
+
'hljs-char': chalk.green,
|
|
18
|
+
'hljs-comment': chalk.gray,
|
|
19
|
+
'hljs-doctag': chalk.gray,
|
|
20
|
+
'hljs-function': chalk.yellow,
|
|
21
|
+
'hljs-title': chalk.yellow,
|
|
22
|
+
'hljs-params': chalk.white,
|
|
23
|
+
'hljs-tag': chalk.blue,
|
|
24
|
+
'hljs-name': chalk.blue,
|
|
25
|
+
'hljs-selector-tag': chalk.blue,
|
|
26
|
+
'hljs-selector-id': chalk.blue,
|
|
27
|
+
'hljs-selector-class': chalk.blue,
|
|
28
|
+
'hljs-selector-attr': chalk.blue,
|
|
29
|
+
'hljs-selector-pseudo': chalk.blue,
|
|
30
|
+
'hljs-subst': chalk.white,
|
|
31
|
+
'hljs-section': chalk.blue.bold,
|
|
32
|
+
'hljs-bullet': chalk.magenta,
|
|
33
|
+
'hljs-emphasis': chalk.italic,
|
|
34
|
+
'hljs-strong': chalk.bold,
|
|
35
|
+
'hljs-addition': chalk.green,
|
|
36
|
+
'hljs-deletion': chalk.red,
|
|
37
|
+
'hljs-link': chalk.blue.underline,
|
|
38
|
+
};
|
|
39
|
+
function nodeToAnsi(node) {
|
|
40
|
+
if (node instanceof TextNode) {
|
|
41
|
+
return node.text;
|
|
42
|
+
}
|
|
43
|
+
if (node instanceof HTMLElement) {
|
|
44
|
+
const content = node.childNodes.map(nodeToAnsi).join('');
|
|
45
|
+
const classes = node.getAttribute('class')?.split(/\s+/) || [];
|
|
46
|
+
for (const className of classes) {
|
|
47
|
+
if (theme[className]) {
|
|
48
|
+
return theme[className](content);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return content;
|
|
52
|
+
}
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
export function highlightToAnsi(code, language) {
|
|
56
|
+
if (!code) {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const highlighted = language
|
|
61
|
+
? hljs.highlight(code, { language }).value
|
|
62
|
+
: hljs.highlightAuto(code).value;
|
|
63
|
+
const root = parse(highlighted);
|
|
64
|
+
return root.childNodes.map(nodeToAnsi).join('');
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return code;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Tool parameter transformation utilities for UI rendering
|
|
3
3
|
* Forces type judgment based on tool name using type assertions
|
|
4
4
|
*/
|
|
5
|
-
import { type Change, type WriteToolParameters, type EditToolParameters
|
|
5
|
+
import { type Change, type WriteToolParameters, type EditToolParameters } from "wave-agent-sdk";
|
|
6
6
|
/**
|
|
7
7
|
* Transform Write tool parameters to changes
|
|
8
8
|
*/
|
|
@@ -11,13 +11,9 @@ export declare function transformWriteParameters(parameters: WriteToolParameters
|
|
|
11
11
|
* Transform Edit tool parameters to changes
|
|
12
12
|
*/
|
|
13
13
|
export declare function transformEditParameters(parameters: EditToolParameters): Change[];
|
|
14
|
-
/**
|
|
15
|
-
* Transform MultiEdit tool parameters to changes
|
|
16
|
-
*/
|
|
17
|
-
export declare function transformMultiEditParameters(parameters: MultiEditToolParameters): Change[];
|
|
18
14
|
/**
|
|
19
15
|
* Transform tool block parameters into standardized Change[] array for diff display
|
|
20
16
|
* Forces type judgment based on tool name using type assertions
|
|
21
17
|
*/
|
|
22
|
-
export declare function transformToolBlockToChanges(toolName: string, parameters: string): Change[];
|
|
18
|
+
export declare function transformToolBlockToChanges(toolName: string, parameters: string, startLineNumber?: number): Change[];
|
|
23
19
|
//# sourceMappingURL=toolParameterTransforms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolParameterTransforms.d.ts","sourceRoot":"","sources":["../../src/utils/toolParameterTransforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"toolParameterTransforms.d.ts","sourceRoot":"","sources":["../../src/utils/toolParameterTransforms.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAmBxB;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,mBAAmB,GAC9B,MAAM,EAAE,CAOV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kBAAkB,GAC7B,MAAM,EAAE,CAOV;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,EAAE,CA8BV"}
|
|
@@ -40,35 +40,31 @@ export function transformEditParameters(parameters) {
|
|
|
40
40
|
},
|
|
41
41
|
];
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Transform MultiEdit tool parameters to changes
|
|
45
|
-
*/
|
|
46
|
-
export function transformMultiEditParameters(parameters) {
|
|
47
|
-
return parameters.edits.map((edit) => ({
|
|
48
|
-
oldContent: edit.old_string,
|
|
49
|
-
newContent: edit.new_string,
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
43
|
/**
|
|
53
44
|
* Transform tool block parameters into standardized Change[] array for diff display
|
|
54
45
|
* Forces type judgment based on tool name using type assertions
|
|
55
46
|
*/
|
|
56
|
-
export function transformToolBlockToChanges(toolName, parameters) {
|
|
47
|
+
export function transformToolBlockToChanges(toolName, parameters, startLineNumber) {
|
|
57
48
|
try {
|
|
58
49
|
if (!toolName) {
|
|
59
50
|
return [];
|
|
60
51
|
}
|
|
61
52
|
const parsedParams = parseToolParameters(parameters);
|
|
53
|
+
let changes = [];
|
|
62
54
|
switch (toolName) {
|
|
63
55
|
case "Write":
|
|
64
|
-
|
|
56
|
+
changes = transformWriteParameters(parsedParams);
|
|
57
|
+
break;
|
|
65
58
|
case "Edit":
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return transformMultiEditParameters(parsedParams);
|
|
59
|
+
changes = transformEditParameters(parsedParams);
|
|
60
|
+
break;
|
|
69
61
|
default:
|
|
70
62
|
return [];
|
|
71
63
|
}
|
|
64
|
+
if (changes.length > 0 && startLineNumber !== undefined) {
|
|
65
|
+
changes[0].startLineNumber = startLineNumber;
|
|
66
|
+
}
|
|
67
|
+
return changes;
|
|
72
68
|
}
|
|
73
69
|
catch (error) {
|
|
74
70
|
logger.warn("Failed to transform tool block to changes:", error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "CLI-based code assistant powered by AI, built with React and Ink",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,12 +32,14 @@
|
|
|
32
32
|
"chalk": "^5.6.2",
|
|
33
33
|
"diff": "^8.0.2",
|
|
34
34
|
"glob": "^13.0.0",
|
|
35
|
+
"highlight.js": "^11.11.1",
|
|
35
36
|
"ink": "^6.7.0",
|
|
36
37
|
"marked": "^17.0.2",
|
|
38
|
+
"node-html-parser": "^7.0.2",
|
|
37
39
|
"react": "^19.2.4",
|
|
38
40
|
"react-dom": "19.2.4",
|
|
39
41
|
"yargs": "^17.7.2",
|
|
40
|
-
"wave-agent-sdk": "0.
|
|
42
|
+
"wave-agent-sdk": "0.7.1"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@types/react": "^19.1.8",
|
package/src/cli.tsx
CHANGED
|
@@ -8,6 +8,7 @@ export interface CliOptions {
|
|
|
8
8
|
continueLastSession?: boolean;
|
|
9
9
|
bypassPermissions?: boolean;
|
|
10
10
|
pluginDirs?: string[];
|
|
11
|
+
tools?: string[];
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export async function startCli(options: CliOptions): Promise<void> {
|
|
@@ -16,6 +17,7 @@ export async function startCli(options: CliOptions): Promise<void> {
|
|
|
16
17
|
continueLastSession,
|
|
17
18
|
bypassPermissions,
|
|
18
19
|
pluginDirs,
|
|
20
|
+
tools,
|
|
19
21
|
} = options;
|
|
20
22
|
|
|
21
23
|
// Continue with ink-based UI for normal mode
|
|
@@ -72,6 +74,7 @@ export async function startCli(options: CliOptions): Promise<void> {
|
|
|
72
74
|
continueLastSession={continueLastSession}
|
|
73
75
|
bypassPermissions={bypassPermissions}
|
|
74
76
|
pluginDirs={pluginDirs}
|
|
77
|
+
tools={tools}
|
|
75
78
|
/>,
|
|
76
79
|
);
|
|
77
80
|
|
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigurationService,
|
|
3
|
-
PluginManager,
|
|
4
|
-
PluginScopeManager,
|
|
5
|
-
Scope,
|
|
6
|
-
} from "wave-agent-sdk";
|
|
1
|
+
import { PluginCore, Scope } from "wave-agent-sdk";
|
|
7
2
|
|
|
8
3
|
export async function disablePluginCommand(argv: {
|
|
9
4
|
plugin: string;
|
|
10
5
|
scope?: Scope;
|
|
11
6
|
}) {
|
|
12
7
|
const workdir = process.cwd();
|
|
13
|
-
const
|
|
14
|
-
const pluginManager = new PluginManager({ workdir });
|
|
15
|
-
const scopeManager = new PluginScopeManager({
|
|
16
|
-
workdir,
|
|
17
|
-
configurationService,
|
|
18
|
-
pluginManager,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const scope =
|
|
22
|
-
argv.scope || scopeManager.findPluginScope(argv.plugin) || "user";
|
|
8
|
+
const pluginCore = new PluginCore(workdir);
|
|
23
9
|
|
|
24
10
|
try {
|
|
25
|
-
await
|
|
11
|
+
const scope = await pluginCore.disablePlugin(argv.plugin, argv.scope);
|
|
26
12
|
console.log(
|
|
27
13
|
`Successfully disabled plugin: ${argv.plugin} in ${scope} scope`,
|
|
28
14
|
);
|
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigurationService,
|
|
3
|
-
PluginManager,
|
|
4
|
-
PluginScopeManager,
|
|
5
|
-
Scope,
|
|
6
|
-
} from "wave-agent-sdk";
|
|
1
|
+
import { PluginCore, Scope } from "wave-agent-sdk";
|
|
7
2
|
|
|
8
3
|
export async function enablePluginCommand(argv: {
|
|
9
4
|
plugin: string;
|
|
10
5
|
scope?: Scope;
|
|
11
6
|
}) {
|
|
12
7
|
const workdir = process.cwd();
|
|
13
|
-
const
|
|
14
|
-
const pluginManager = new PluginManager({ workdir });
|
|
15
|
-
const scopeManager = new PluginScopeManager({
|
|
16
|
-
workdir,
|
|
17
|
-
configurationService,
|
|
18
|
-
pluginManager,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const scope =
|
|
22
|
-
argv.scope || scopeManager.findPluginScope(argv.plugin) || "user";
|
|
8
|
+
const pluginCore = new PluginCore(workdir);
|
|
23
9
|
|
|
24
10
|
try {
|
|
25
|
-
await
|
|
11
|
+
const scope = await pluginCore.enablePlugin(argv.plugin, argv.scope);
|
|
26
12
|
console.log(
|
|
27
13
|
`Successfully enabled plugin: ${argv.plugin} in ${scope} scope`,
|
|
28
14
|
);
|
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarketplaceService,
|
|
3
|
-
ConfigurationService,
|
|
4
|
-
PluginManager,
|
|
5
|
-
PluginScopeManager,
|
|
6
|
-
Scope,
|
|
7
|
-
} from "wave-agent-sdk";
|
|
1
|
+
import { PluginCore, Scope } from "wave-agent-sdk";
|
|
8
2
|
|
|
9
3
|
export async function installPluginCommand(argv: {
|
|
10
4
|
plugin: string;
|
|
11
5
|
scope?: Scope;
|
|
12
6
|
}) {
|
|
13
|
-
const marketplaceService = new MarketplaceService();
|
|
14
7
|
const workdir = process.cwd();
|
|
8
|
+
const pluginCore = new PluginCore(workdir);
|
|
15
9
|
|
|
16
10
|
try {
|
|
17
|
-
const installed = await
|
|
11
|
+
const installed = await pluginCore.installPlugin(argv.plugin);
|
|
18
12
|
console.log(
|
|
19
13
|
`Successfully installed plugin: ${installed.name} v${installed.version} from ${installed.marketplace}`,
|
|
20
14
|
);
|
|
21
15
|
console.log(`Cache path: ${installed.cachePath}`);
|
|
22
16
|
|
|
23
17
|
if (argv.scope) {
|
|
24
|
-
const configurationService = new ConfigurationService();
|
|
25
|
-
const pluginManager = new PluginManager({ workdir });
|
|
26
|
-
const scopeManager = new PluginScopeManager({
|
|
27
|
-
workdir,
|
|
28
|
-
configurationService,
|
|
29
|
-
pluginManager,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
18
|
const pluginId = `${installed.name}@${installed.marketplace}`;
|
|
33
|
-
await
|
|
19
|
+
await pluginCore.enablePlugin(pluginId, argv.scope);
|
|
34
20
|
console.log(`Plugin ${pluginId} enabled in ${argv.scope} scope`);
|
|
35
21
|
}
|
|
36
22
|
|
|
@@ -1,66 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MarketplaceService,
|
|
3
|
-
ConfigurationService,
|
|
4
|
-
PluginScopeManager,
|
|
5
|
-
PluginManager,
|
|
6
|
-
} from "wave-agent-sdk";
|
|
1
|
+
import { PluginCore } from "wave-agent-sdk";
|
|
7
2
|
|
|
8
3
|
export async function listPluginsCommand() {
|
|
9
|
-
const
|
|
10
|
-
const marketplaceService = new MarketplaceService();
|
|
11
|
-
const workdir = process.cwd();
|
|
12
|
-
const pluginManager = new PluginManager({
|
|
13
|
-
workdir,
|
|
14
|
-
configurationService,
|
|
15
|
-
});
|
|
16
|
-
const pluginScopeManager = new PluginScopeManager({
|
|
17
|
-
workdir,
|
|
18
|
-
configurationService,
|
|
19
|
-
pluginManager,
|
|
20
|
-
});
|
|
4
|
+
const pluginCore = new PluginCore(process.cwd());
|
|
21
5
|
|
|
22
6
|
try {
|
|
23
|
-
const
|
|
24
|
-
const marketplaces = await marketplaceService.listMarketplaces();
|
|
25
|
-
const mergedEnabled = configurationService.getMergedEnabledPlugins(workdir);
|
|
7
|
+
const { plugins, mergedEnabled } = await pluginCore.listPlugins();
|
|
26
8
|
|
|
27
|
-
|
|
28
|
-
const allMarketplacePlugins: {
|
|
29
|
-
name: string;
|
|
30
|
-
marketplace: string;
|
|
31
|
-
installed: boolean;
|
|
32
|
-
version?: string;
|
|
33
|
-
scope?: string;
|
|
34
|
-
}[] = [];
|
|
35
|
-
|
|
36
|
-
for (const m of marketplaces) {
|
|
37
|
-
try {
|
|
38
|
-
const manifest = await marketplaceService.loadMarketplaceManifest(
|
|
39
|
-
marketplaceService.getMarketplacePath(m),
|
|
40
|
-
);
|
|
41
|
-
manifest.plugins.forEach((p) => {
|
|
42
|
-
const pluginId = `${p.name}@${m.name}`;
|
|
43
|
-
const installed = installedPlugins.plugins.find(
|
|
44
|
-
(ip) => ip.name === p.name && ip.marketplace === m.name,
|
|
45
|
-
);
|
|
46
|
-
allMarketplacePlugins.push({
|
|
47
|
-
name: p.name,
|
|
48
|
-
marketplace: m.name,
|
|
49
|
-
installed: !!installed,
|
|
50
|
-
version: installed?.version,
|
|
51
|
-
scope: pluginScopeManager.findPluginScope(pluginId) || undefined,
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
} catch {
|
|
55
|
-
// Skip marketplaces that fail to load
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (allMarketplacePlugins.length === 0) {
|
|
9
|
+
if (plugins.length === 0) {
|
|
60
10
|
console.log("No plugins found in registered marketplaces.");
|
|
61
11
|
} else {
|
|
62
12
|
console.log("Plugins:");
|
|
63
|
-
|
|
13
|
+
plugins.forEach((p) => {
|
|
64
14
|
const pluginId = `${p.name}@${p.marketplace}`;
|
|
65
15
|
const isEnabled = mergedEnabled[pluginId] !== false;
|
|
66
16
|
const status = p.installed
|