wave-agent-sdk 0.2.1 → 0.5.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 (194) hide show
  1. package/dist/agent.d.ts +66 -20
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +156 -83
  4. package/dist/constants/prompts.d.ts +7 -2
  5. package/dist/constants/prompts.d.ts.map +1 -1
  6. package/dist/constants/prompts.js +41 -5
  7. package/dist/constants/tools.d.ts +2 -2
  8. package/dist/constants/tools.js +2 -2
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/managers/MemoryRuleManager.d.ts.map +1 -1
  13. package/dist/managers/MemoryRuleManager.js +16 -2
  14. package/dist/managers/aiManager.d.ts +14 -4
  15. package/dist/managers/aiManager.d.ts.map +1 -1
  16. package/dist/managers/aiManager.js +61 -9
  17. package/dist/managers/backgroundBashManager.d.ts.map +1 -1
  18. package/dist/managers/backgroundBashManager.js +1 -0
  19. package/dist/managers/backgroundTaskManager.d.ts +35 -0
  20. package/dist/managers/backgroundTaskManager.d.ts.map +1 -0
  21. package/dist/managers/backgroundTaskManager.js +249 -0
  22. package/dist/managers/bashManager.d.ts.map +1 -1
  23. package/dist/managers/bashManager.js +0 -3
  24. package/dist/managers/foregroundTaskManager.d.ts +9 -0
  25. package/dist/managers/foregroundTaskManager.d.ts.map +1 -0
  26. package/dist/managers/foregroundTaskManager.js +20 -0
  27. package/dist/managers/liveConfigManager.d.ts +1 -1
  28. package/dist/managers/liveConfigManager.d.ts.map +1 -1
  29. package/dist/managers/lspManager.d.ts.map +1 -1
  30. package/dist/managers/lspManager.js +3 -1
  31. package/dist/managers/messageManager.d.ts +34 -4
  32. package/dist/managers/messageManager.d.ts.map +1 -1
  33. package/dist/managers/messageManager.js +104 -13
  34. package/dist/managers/permissionManager.d.ts.map +1 -1
  35. package/dist/managers/permissionManager.js +11 -13
  36. package/dist/managers/pluginManager.d.ts.map +1 -1
  37. package/dist/managers/pluginManager.js +3 -2
  38. package/dist/managers/pluginScopeManager.d.ts +13 -2
  39. package/dist/managers/pluginScopeManager.d.ts.map +1 -1
  40. package/dist/managers/pluginScopeManager.js +38 -0
  41. package/dist/managers/reversionManager.d.ts +39 -0
  42. package/dist/managers/reversionManager.d.ts.map +1 -0
  43. package/dist/managers/reversionManager.js +118 -0
  44. package/dist/managers/slashCommandManager.d.ts +4 -1
  45. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  46. package/dist/managers/slashCommandManager.js +16 -6
  47. package/dist/managers/subagentManager.d.ts +13 -2
  48. package/dist/managers/subagentManager.d.ts.map +1 -1
  49. package/dist/managers/subagentManager.js +144 -35
  50. package/dist/managers/toolManager.d.ts +11 -1
  51. package/dist/managers/toolManager.d.ts.map +1 -1
  52. package/dist/managers/toolManager.js +11 -3
  53. package/dist/services/GitService.d.ts.map +1 -1
  54. package/dist/services/GitService.js +6 -2
  55. package/dist/services/MarketplaceService.d.ts +14 -1
  56. package/dist/services/MarketplaceService.d.ts.map +1 -1
  57. package/dist/services/MarketplaceService.js +72 -4
  58. package/dist/services/MemoryRuleService.d.ts +1 -1
  59. package/dist/services/MemoryRuleService.d.ts.map +1 -1
  60. package/dist/services/MemoryRuleService.js +13 -2
  61. package/dist/services/aiService.js +1 -1
  62. package/dist/services/configurationService.d.ts +18 -2
  63. package/dist/services/configurationService.d.ts.map +1 -1
  64. package/dist/services/configurationService.js +62 -0
  65. package/dist/services/fileWatcher.d.ts +0 -5
  66. package/dist/services/fileWatcher.d.ts.map +1 -1
  67. package/dist/services/fileWatcher.js +0 -11
  68. package/dist/services/memory.js +1 -1
  69. package/dist/services/pluginLoader.d.ts.map +1 -1
  70. package/dist/services/pluginLoader.js +6 -1
  71. package/dist/services/reversionService.d.ts +24 -0
  72. package/dist/services/reversionService.d.ts.map +1 -0
  73. package/dist/services/reversionService.js +76 -0
  74. package/dist/services/session.d.ts +7 -0
  75. package/dist/services/session.d.ts.map +1 -1
  76. package/dist/services/session.js +126 -3
  77. package/dist/tools/bashTool.d.ts +0 -8
  78. package/dist/tools/bashTool.d.ts.map +1 -1
  79. package/dist/tools/bashTool.js +52 -174
  80. package/dist/tools/deleteFileTool.d.ts.map +1 -1
  81. package/dist/tools/deleteFileTool.js +9 -0
  82. package/dist/tools/editTool.d.ts.map +1 -1
  83. package/dist/tools/editTool.js +15 -4
  84. package/dist/tools/multiEditTool.d.ts.map +1 -1
  85. package/dist/tools/multiEditTool.js +16 -5
  86. package/dist/tools/taskOutputTool.d.ts +3 -0
  87. package/dist/tools/taskOutputTool.d.ts.map +1 -0
  88. package/dist/tools/taskOutputTool.js +149 -0
  89. package/dist/tools/taskStopTool.d.ts +3 -0
  90. package/dist/tools/taskStopTool.d.ts.map +1 -0
  91. package/dist/tools/taskStopTool.js +65 -0
  92. package/dist/tools/taskTool.d.ts.map +1 -1
  93. package/dist/tools/taskTool.js +105 -63
  94. package/dist/tools/types.d.ts +7 -0
  95. package/dist/tools/types.d.ts.map +1 -1
  96. package/dist/tools/writeTool.d.ts.map +1 -1
  97. package/dist/tools/writeTool.js +9 -0
  98. package/dist/types/commands.d.ts +1 -0
  99. package/dist/types/commands.d.ts.map +1 -1
  100. package/dist/types/configuration.d.ts +3 -0
  101. package/dist/types/configuration.d.ts.map +1 -1
  102. package/dist/types/environment.d.ts +2 -1
  103. package/dist/types/environment.d.ts.map +1 -1
  104. package/dist/types/environment.js +0 -6
  105. package/dist/types/history.d.ts +5 -0
  106. package/dist/types/history.d.ts.map +1 -0
  107. package/dist/types/history.js +1 -0
  108. package/dist/types/index.d.ts +1 -0
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/index.js +1 -0
  111. package/dist/types/marketplace.d.ts +4 -0
  112. package/dist/types/marketplace.d.ts.map +1 -1
  113. package/dist/types/messaging.d.ts +7 -1
  114. package/dist/types/messaging.d.ts.map +1 -1
  115. package/dist/types/processes.d.ts +24 -4
  116. package/dist/types/processes.d.ts.map +1 -1
  117. package/dist/types/reversion.d.ts +29 -0
  118. package/dist/types/reversion.d.ts.map +1 -0
  119. package/dist/types/reversion.js +1 -0
  120. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  121. package/dist/utils/builtinSubagents.js +16 -0
  122. package/dist/utils/constants.d.ts +2 -2
  123. package/dist/utils/constants.d.ts.map +1 -1
  124. package/dist/utils/constants.js +2 -2
  125. package/dist/utils/editUtils.d.ts +4 -9
  126. package/dist/utils/editUtils.d.ts.map +1 -1
  127. package/dist/utils/editUtils.js +54 -55
  128. package/dist/utils/messageOperations.d.ts +3 -1
  129. package/dist/utils/messageOperations.d.ts.map +1 -1
  130. package/dist/utils/messageOperations.js +8 -1
  131. package/dist/utils/openaiClient.d.ts.map +1 -1
  132. package/dist/utils/openaiClient.js +56 -26
  133. package/dist/utils/promptHistory.d.ts +20 -0
  134. package/dist/utils/promptHistory.d.ts.map +1 -0
  135. package/dist/utils/promptHistory.js +117 -0
  136. package/package.json +5 -3
  137. package/src/agent.ts +193 -109
  138. package/src/constants/prompts.ts +45 -5
  139. package/src/constants/tools.ts +2 -2
  140. package/src/index.ts +1 -1
  141. package/src/managers/MemoryRuleManager.ts +18 -2
  142. package/src/managers/aiManager.ts +87 -18
  143. package/src/managers/backgroundBashManager.ts +1 -0
  144. package/src/managers/backgroundTaskManager.ts +306 -0
  145. package/src/managers/bashManager.ts +0 -4
  146. package/src/managers/foregroundTaskManager.ts +26 -0
  147. package/src/managers/liveConfigManager.ts +2 -1
  148. package/src/managers/lspManager.ts +3 -1
  149. package/src/managers/messageManager.ts +136 -18
  150. package/src/managers/permissionManager.ts +11 -13
  151. package/src/managers/pluginManager.ts +4 -3
  152. package/src/managers/pluginScopeManager.ts +57 -8
  153. package/src/managers/reversionManager.ts +152 -0
  154. package/src/managers/slashCommandManager.ts +30 -7
  155. package/src/managers/subagentManager.ts +176 -31
  156. package/src/managers/toolManager.ts +23 -4
  157. package/src/services/GitService.ts +6 -2
  158. package/src/services/MarketplaceService.ts +100 -4
  159. package/src/services/MemoryRuleService.ts +18 -6
  160. package/src/services/aiService.ts +1 -1
  161. package/src/services/configurationService.ts +79 -1
  162. package/src/services/fileWatcher.ts +0 -13
  163. package/src/services/memory.ts +1 -1
  164. package/src/services/pluginLoader.ts +7 -1
  165. package/src/services/reversionService.ts +94 -0
  166. package/src/services/session.ts +161 -3
  167. package/src/tools/bashTool.ts +73 -200
  168. package/src/tools/deleteFileTool.ts +15 -0
  169. package/src/tools/editTool.ts +20 -10
  170. package/src/tools/multiEditTool.ts +21 -11
  171. package/src/tools/taskOutputTool.ts +174 -0
  172. package/src/tools/taskStopTool.ts +72 -0
  173. package/src/tools/taskTool.ts +130 -74
  174. package/src/tools/types.ts +7 -0
  175. package/src/tools/writeTool.ts +14 -0
  176. package/src/types/commands.ts +3 -0
  177. package/src/types/configuration.ts +4 -0
  178. package/src/types/environment.ts +3 -1
  179. package/src/types/history.ts +4 -0
  180. package/src/types/index.ts +1 -0
  181. package/src/types/marketplace.ts +5 -0
  182. package/src/types/messaging.ts +9 -1
  183. package/src/types/processes.ts +33 -4
  184. package/src/types/reversion.ts +29 -0
  185. package/src/utils/builtinSubagents.ts +18 -0
  186. package/src/utils/constants.ts +2 -2
  187. package/src/utils/editUtils.ts +66 -58
  188. package/src/utils/messageOperations.ts +10 -0
  189. package/src/utils/openaiClient.ts +69 -35
  190. package/src/utils/promptHistory.ts +133 -0
  191. package/dist/utils/bashHistory.d.ts +0 -50
  192. package/dist/utils/bashHistory.d.ts.map +0 -1
  193. package/dist/utils/bashHistory.js +0 -256
  194. package/src/utils/bashHistory.ts +0 -320
@@ -14,8 +14,11 @@ export class SubagentManager {
14
14
  this.getGatewayConfig = options.getGatewayConfig;
15
15
  this.getModelConfig = options.getModelConfig;
16
16
  this.getMaxInputTokens = options.getMaxInputTokens;
17
+ this.getLanguage = options.getLanguage;
17
18
  this.hookManager = options.hookManager;
18
19
  this.onUsageAdded = options.onUsageAdded;
20
+ this.backgroundTaskManager = options.backgroundTaskManager;
21
+ this.memoryRuleManager = options.memoryRuleManager;
19
22
  }
20
23
  /**
21
24
  * Initialize the SubagentManager by loading and caching configurations
@@ -52,7 +55,7 @@ export class SubagentManager {
52
55
  /**
53
56
  * Create a new subagent instance with isolated managers
54
57
  */
55
- async createInstance(configuration, parameters) {
58
+ async createInstance(configuration, parameters, runInBackground) {
56
59
  if (!this.parentToolManager) {
57
60
  throw new Error("SubagentManager not properly initialized - call initialize() first");
58
61
  }
@@ -65,6 +68,7 @@ export class SubagentManager {
65
68
  logger: this.logger,
66
69
  sessionType: "subagent",
67
70
  subagentType: parameters.subagent_type,
71
+ memoryRuleManager: this.memoryRuleManager,
68
72
  });
69
73
  // Use the parent tool manager directly - tool restrictions will be handled by allowedTools parameter
70
74
  const toolManager = this.parentToolManager;
@@ -101,6 +105,7 @@ export class SubagentManager {
101
105
  };
102
106
  },
103
107
  getMaxInputTokens: this.getMaxInputTokens,
108
+ getLanguage: this.getLanguage,
104
109
  callbacks: {
105
110
  onUsageAdded: this.onUsageAdded,
106
111
  },
@@ -117,7 +122,7 @@ export class SubagentManager {
117
122
  };
118
123
  this.instances.set(subagentId, instance);
119
124
  // Create subagent block in parent message manager
120
- this.parentMessageManager.addSubagentBlock(subagentId, configuration.name, messageManager.getSessionId(), configuration, "active", parameters);
125
+ this.parentMessageManager.addSubagentBlock(subagentId, configuration.name, messageManager.getSessionId(), configuration, "active", parameters, runInBackground);
121
126
  return instance;
122
127
  }
123
128
  /**
@@ -126,7 +131,7 @@ export class SubagentManager {
126
131
  * IMPORTANT: This method automatically filters out the Task tool from allowedTools
127
132
  * to prevent subagents from spawning other subagents (infinite recursion protection)
128
133
  */
129
- async executeTask(instance, prompt, abortSignal) {
134
+ async executeTask(instance, prompt, abortSignal, runInBackground) {
130
135
  try {
131
136
  // Check if already aborted before starting
132
137
  if (abortSignal?.aborted) {
@@ -137,23 +142,105 @@ export class SubagentManager {
137
142
  this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
138
143
  status: "active",
139
144
  });
140
- // Set up consolidated abort handler to prevent listener accumulation
141
- let abortCleanup;
142
- if (abortSignal) {
143
- abortCleanup = addConsolidatedAbortListener(abortSignal, [
144
- () => {
145
- // Update status to aborted
145
+ if (runInBackground && this.backgroundTaskManager) {
146
+ const taskId = this.backgroundTaskManager.generateId();
147
+ const startTime = Date.now();
148
+ this.backgroundTaskManager.addTask({
149
+ id: taskId,
150
+ type: "subagent",
151
+ status: "running",
152
+ startTime,
153
+ description: instance.configuration.description,
154
+ stdout: "",
155
+ stderr: "",
156
+ });
157
+ instance.backgroundTaskId = taskId;
158
+ // Execute in background
159
+ (async () => {
160
+ try {
161
+ const result = await this.internalExecute(instance, prompt, abortSignal);
162
+ const task = this.backgroundTaskManager?.getTask(taskId);
163
+ if (task) {
164
+ task.status = "completed";
165
+ task.stdout = result;
166
+ task.endTime = Date.now();
167
+ task.runtime = task.endTime - startTime;
168
+ }
169
+ }
170
+ catch (error) {
171
+ const task = this.backgroundTaskManager?.getTask(taskId);
172
+ if (task) {
173
+ task.status = "failed";
174
+ task.stderr =
175
+ error instanceof Error ? error.message : String(error);
176
+ task.endTime = Date.now();
177
+ task.runtime = task.endTime - startTime;
178
+ }
179
+ }
180
+ })();
181
+ return taskId;
182
+ }
183
+ return await this.internalExecute(instance, prompt, abortSignal);
184
+ }
185
+ catch (error) {
186
+ this.updateInstanceStatus(instance.subagentId, "error");
187
+ this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
188
+ status: "error",
189
+ });
190
+ throw error;
191
+ }
192
+ }
193
+ async backgroundInstance(subagentId) {
194
+ const instance = this.instances.get(subagentId);
195
+ if (!instance) {
196
+ throw new Error(`Subagent instance ${subagentId} not found`);
197
+ }
198
+ if (!this.backgroundTaskManager) {
199
+ throw new Error("BackgroundTaskManager not available");
200
+ }
201
+ const taskId = this.backgroundTaskManager.generateId();
202
+ const startTime = Date.now();
203
+ this.backgroundTaskManager.addTask({
204
+ id: taskId,
205
+ type: "subagent",
206
+ status: "running",
207
+ startTime,
208
+ description: instance.configuration.description,
209
+ stdout: "",
210
+ stderr: "",
211
+ });
212
+ instance.backgroundTaskId = taskId;
213
+ // Update parent message manager to reflect background status
214
+ this.parentMessageManager.updateSubagentBlock(subagentId, {
215
+ runInBackground: true,
216
+ });
217
+ return taskId;
218
+ }
219
+ async internalExecute(instance, prompt, abortSignal) {
220
+ // Set up consolidated abort handler to prevent listener accumulation
221
+ let abortCleanup;
222
+ if (abortSignal) {
223
+ abortCleanup = addConsolidatedAbortListener(abortSignal, [
224
+ () => {
225
+ // Update status to aborted
226
+ // Only update status if it's NOT a background task
227
+ if (!instance.backgroundTaskId) {
146
228
  this.updateInstanceStatus(instance.subagentId, "aborted");
147
229
  this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
148
230
  status: "aborted",
149
231
  });
150
- },
151
- () => {
152
- // Abort the AI execution
232
+ }
233
+ },
234
+ () => {
235
+ // Abort the AI execution
236
+ // Only abort if it's NOT a background task
237
+ if (!instance.backgroundTaskId) {
153
238
  instance.aiManager.abortAIMessage();
154
- },
155
- ]);
156
- }
239
+ }
240
+ },
241
+ ]);
242
+ }
243
+ try {
157
244
  // Add the user's prompt as a message
158
245
  instance.messageManager.addUserMessage({ content: prompt });
159
246
  // Create allowed tools list - always exclude Task tool to prevent subagent recursion
@@ -188,23 +275,17 @@ export class SubagentManager {
188
275
  tools: allowedTools,
189
276
  model: resolvedModel,
190
277
  });
191
- try {
192
- // If we have an abort signal, race against it using utilities to prevent listener accumulation
193
- if (abortSignal) {
194
- await Promise.race([
195
- executeAI,
196
- createAbortPromise(abortSignal, "Task was aborted"),
197
- ]);
198
- }
199
- else {
200
- await executeAI;
201
- }
278
+ // If we have an abort signal, race against it using utilities to prevent listener accumulation
279
+ // BUT: If this is a background task, we DON'T want to race against the abort signal
280
+ // because the abort signal (Esc) should only stop the tool watching the task, not the task itself.
281
+ if (abortSignal && !instance.backgroundTaskId) {
282
+ await Promise.race([
283
+ executeAI,
284
+ createAbortPromise(abortSignal, "Task was aborted"),
285
+ ]);
202
286
  }
203
- finally {
204
- // Clean up abort listeners to prevent memory leaks
205
- if (abortCleanup) {
206
- abortCleanup();
207
- }
287
+ else {
288
+ await executeAI;
208
289
  }
209
290
  // Get the latest messages to extract the response
210
291
  const messages = instance.messageManager.getMessages();
@@ -222,15 +303,41 @@ export class SubagentManager {
222
303
  this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
223
304
  status: "completed",
224
305
  });
306
+ // If this was transitioned to background, update the background task
307
+ if (instance.backgroundTaskId && this.backgroundTaskManager) {
308
+ const task = this.backgroundTaskManager.getTask(instance.backgroundTaskId);
309
+ if (task) {
310
+ task.status = "completed";
311
+ task.stdout = response || "Task completed with no text response";
312
+ task.endTime = Date.now();
313
+ if (task.startTime) {
314
+ task.runtime = task.endTime - task.startTime;
315
+ }
316
+ }
317
+ }
225
318
  return response || "Task completed with no text response";
226
319
  }
227
320
  catch (error) {
228
- this.updateInstanceStatus(instance.subagentId, "error");
229
- this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
230
- status: "error",
231
- });
321
+ // If this was transitioned to background, update the background task with error
322
+ if (instance.backgroundTaskId && this.backgroundTaskManager) {
323
+ const task = this.backgroundTaskManager.getTask(instance.backgroundTaskId);
324
+ if (task) {
325
+ task.status = "failed";
326
+ task.stderr = error instanceof Error ? error.message : String(error);
327
+ task.endTime = Date.now();
328
+ if (task.startTime) {
329
+ task.runtime = task.endTime - task.startTime;
330
+ }
331
+ }
332
+ }
232
333
  throw error;
233
334
  }
335
+ finally {
336
+ // Clean up abort listeners to prevent memory leaks
337
+ if (abortCleanup) {
338
+ abortCleanup();
339
+ }
340
+ }
234
341
  }
235
342
  /**
236
343
  * Get instance by subagent ID
@@ -297,6 +404,7 @@ export class SubagentManager {
297
404
  logger: this.logger,
298
405
  sessionType: "subagent",
299
406
  subagentType: configuration.name, // Use configuration name for restored sessions
407
+ memoryRuleManager: this.memoryRuleManager,
300
408
  });
301
409
  // Use the parent tool manager
302
410
  const toolManager = this.parentToolManager;
@@ -328,6 +436,7 @@ export class SubagentManager {
328
436
  agentModel: modelToUse,
329
437
  }),
330
438
  getMaxInputTokens: this.getMaxInputTokens,
439
+ getLanguage: this.getLanguage,
331
440
  callbacks: {
332
441
  onUsageAdded: this.onUsageAdded,
333
442
  },
@@ -5,12 +5,19 @@ import { ChatCompletionFunctionTool } from "openai/resources.js";
5
5
  import type { Logger, PermissionMode, PermissionCallback, ILspManager } from "../types/index.js";
6
6
  import type { SubagentManager } from "./subagentManager.js";
7
7
  import type { SkillManager } from "./skillManager.js";
8
+ import { ReversionManager } from "./reversionManager.js";
8
9
  export interface ToolManagerOptions {
9
10
  mcpManager: McpManager;
10
11
  lspManager?: ILspManager;
11
12
  logger?: Logger;
12
- /** Optional permission manager for handling tool permission checks */
13
+ /** Permission manager for handling tool permission checks */
13
14
  permissionManager?: PermissionManager;
15
+ /** Foreground task manager for backgrounding tasks */
16
+ foregroundTaskManager?: import("../types/processes.js").IForegroundTaskManager;
17
+ /** Reversion manager for file snapshots */
18
+ reversionManager?: ReversionManager;
19
+ /** Background task manager for background execution */
20
+ backgroundTaskManager?: import("./backgroundTaskManager.js").BackgroundTaskManager;
14
21
  /** Permission mode for tool execution (defaults to "default") */
15
22
  permissionMode?: PermissionMode;
16
23
  /** Custom permission callback for tool usage */
@@ -28,6 +35,9 @@ declare class ToolManager {
28
35
  private lspManager?;
29
36
  private logger?;
30
37
  private permissionManager?;
38
+ private foregroundTaskManager?;
39
+ private reversionManager?;
40
+ private backgroundTaskManager?;
31
41
  private permissionMode?;
32
42
  private canUseToolCallback?;
33
43
  constructor(options: ToolManagerOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"toolManager.d.ts","sourceRoot":"","sources":["../../src/managers/toolManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiB7E,OAAO,EAAE,UAAU,E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AAE,cAAc,GAAG,IAAI;IAIpD;;OAEG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;CAG7D;AAGD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,6 @@
1
- import { bashTool, bashOutputTool, killBashTool } from "../tools/bashTool.js";
1
+ import { bashTool } from "../tools/bashTool.js";
2
+ import { taskOutputTool } from "../tools/taskOutputTool.js";
3
+ import { taskStopTool } from "../tools/taskStopTool.js";
2
4
  import { deleteFileTool } from "../tools/deleteFileTool.js";
3
5
  import { editTool } from "../tools/editTool.js";
4
6
  import { multiEditTool } from "../tools/multiEditTool.js";
@@ -27,6 +29,9 @@ class ToolManager {
27
29
  this.lspManager = options.lspManager;
28
30
  this.logger = options.logger;
29
31
  this.permissionManager = options.permissionManager;
32
+ this.foregroundTaskManager = options.foregroundTaskManager;
33
+ this.reversionManager = options.reversionManager;
34
+ this.backgroundTaskManager = options.backgroundTaskManager;
30
35
  // Store CLI permission mode, let PermissionManager resolve effective mode
31
36
  this.permissionMode = options.permissionMode;
32
37
  this.canUseToolCallback = options.canUseToolCallback;
@@ -63,8 +68,8 @@ class ToolManager {
63
68
  initializeBuiltInTools(deps) {
64
69
  const builtInTools = [
65
70
  bashTool,
66
- bashOutputTool,
67
- killBashTool,
71
+ taskOutputTool,
72
+ taskStopTool,
68
73
  deleteFileTool,
69
74
  editTool,
70
75
  multiEditTool,
@@ -115,6 +120,9 @@ class ToolManager {
115
120
  permissionMode: effectivePermissionMode,
116
121
  canUseToolCallback: this.canUseToolCallback,
117
122
  permissionManager: this.permissionManager,
123
+ reversionManager: this.reversionManager,
124
+ backgroundTaskManager: this.backgroundTaskManager,
125
+ foregroundTaskManager: this.foregroundTaskManager,
118
126
  mcpManager: this.mcpManager,
119
127
  lspManager: this.lspManager,
120
128
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GitService.d.ts","sourceRoot":"","sources":["../../src/services/GitService.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IACrB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IA0BhB;;OAEG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7C,OAAO,CAAC,cAAc;CA6BvB"}
1
+ {"version":3,"file":"GitService.d.ts","sourceRoot":"","sources":["../../src/services/GitService.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IACrB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IA4BhB;;OAEG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7C,OAAO,CAAC,cAAc;CA6BvB"}
@@ -31,7 +31,9 @@ export class GitService {
31
31
  }
32
32
  try {
33
33
  const refArgs = ref ? `-b "${ref}"` : "--depth 1";
34
- await execAsync(`LC_ALL=C git clone ${refArgs} "${url}" "${targetPath}"`);
34
+ await execAsync(`git clone ${refArgs} "${url}" "${targetPath}"`, {
35
+ env: { ...process.env, LC_ALL: "C" },
36
+ });
35
37
  }
36
38
  catch (error) {
37
39
  throw this.handleGitError(urlOrRepo, error);
@@ -45,7 +47,9 @@ export class GitService {
45
47
  throw new Error("Git is not installed or not found in PATH. Please install Git to use Git/GitHub marketplaces.");
46
48
  }
47
49
  try {
48
- await execAsync(`LC_ALL=C git -C "${targetPath}" pull`);
50
+ await execAsync(`git -C "${targetPath}" pull`, {
51
+ env: { ...process.env, LC_ALL: "C" },
52
+ });
49
53
  }
50
54
  catch (error) {
51
55
  throw this.handleGitError(targetPath, error);
@@ -13,6 +13,7 @@ export declare class MarketplaceService {
13
13
  private cacheDir;
14
14
  private marketplacesDir;
15
15
  private gitService;
16
+ private static readonly BUILTIN_MARKETPLACE;
16
17
  constructor();
17
18
  /**
18
19
  * Ensures the required directory structure exists in ~/.wave/plugins
@@ -50,6 +51,10 @@ export declare class MarketplaceService {
50
51
  * Lists all registered marketplaces
51
52
  */
52
53
  listMarketplaces(): Promise<KnownMarketplace[]>;
54
+ /**
55
+ * Removes a marketplace by name
56
+ */
57
+ removeMarketplace(name: string): Promise<void>;
53
58
  /**
54
59
  * Updates a specific marketplace or all marketplaces
55
60
  */
@@ -57,6 +62,14 @@ export declare class MarketplaceService {
57
62
  /**
58
63
  * Installs a plugin from a marketplace
59
64
  */
60
- installPlugin(pluginAtMarketplace: string): Promise<InstalledPlugin>;
65
+ installPlugin(pluginAtMarketplace: string, projectPath?: string): Promise<InstalledPlugin>;
66
+ /**
67
+ * Uninstalls a plugin
68
+ */
69
+ uninstallPlugin(pluginAtMarketplace: string, projectPath?: string): Promise<void>;
70
+ /**
71
+ * Updates a plugin (uninstall followed by install)
72
+ */
73
+ updatePlugin(pluginAtMarketplace: string): Promise<InstalledPlugin>;
61
74
  }
62
75
  //# sourceMappingURL=MarketplaceService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarketplaceService.d.ts","sourceRoot":"","sources":["../../src/services/MarketplaceService.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAGjC;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UA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+35,14 @@ export class MarketplaceService {
35
35
  */
36
36
  async getKnownMarketplaces() {
37
37
  if (!existsSync(this.knownMarketplacesPath)) {
38
- return { marketplaces: [] };
38
+ return {
39
+ marketplaces: [
40
+ {
41
+ ...MarketplaceService.BUILTIN_MARKETPLACE,
42
+ isBuiltin: true,
43
+ },
44
+ ],
45
+ };
39
46
  }
40
47
  try {
41
48
  const content = await fs.readFile(this.knownMarketplacesPath, "utf-8");
@@ -178,6 +185,9 @@ export class MarketplaceService {
178
185
  else {
179
186
  registry.marketplaces.push(marketplace);
180
187
  }
188
+ // Ensure builtin is included if we are creating the file for the first time
189
+ // and it hasn't been explicitly removed yet.
190
+ // (getKnownMarketplaces already handles the default injection)
181
191
  await this.saveKnownMarketplaces(registry);
182
192
  return marketplace;
183
193
  }
@@ -186,7 +196,22 @@ export class MarketplaceService {
186
196
  */
187
197
  async listMarketplaces() {
188
198
  const registry = await this.getKnownMarketplaces();
189
- return registry.marketplaces;
199
+ return registry.marketplaces.map((m) => ({
200
+ ...m,
201
+ isBuiltin: m.name === MarketplaceService.BUILTIN_MARKETPLACE.name,
202
+ }));
203
+ }
204
+ /**
205
+ * Removes a marketplace by name
206
+ */
207
+ async removeMarketplace(name) {
208
+ const registry = await this.getKnownMarketplaces();
209
+ const initialCount = registry.marketplaces.length;
210
+ registry.marketplaces = registry.marketplaces.filter((m) => m.name !== name);
211
+ if (registry.marketplaces.length === initialCount) {
212
+ throw new Error(`Marketplace ${name} not found`);
213
+ }
214
+ await this.saveKnownMarketplaces(registry);
190
215
  }
191
216
  /**
192
217
  * Updates a specific marketplace or all marketplaces
@@ -228,7 +253,7 @@ export class MarketplaceService {
228
253
  /**
229
254
  * Installs a plugin from a marketplace
230
255
  */
231
- async installPlugin(pluginAtMarketplace) {
256
+ async installPlugin(pluginAtMarketplace, projectPath) {
232
257
  const [pluginName, marketplaceName] = pluginAtMarketplace.split("@");
233
258
  if (!pluginName || !marketplaceName) {
234
259
  throw new Error("Invalid plugin format. Use name@marketplace");
@@ -290,12 +315,15 @@ export class MarketplaceService {
290
315
  await fs.mkdir(path.dirname(cachePath), { recursive: true });
291
316
  await fs.rename(tmpPluginDir, cachePath);
292
317
  const installedRegistry = await this.getInstalledPlugins();
293
- const existingIndex = installedRegistry.plugins.findIndex((p) => p.name === pluginName && p.marketplace === marketplaceName);
318
+ const existingIndex = installedRegistry.plugins.findIndex((p) => p.name === pluginName &&
319
+ p.marketplace === marketplaceName &&
320
+ p.projectPath === projectPath);
294
321
  const installedPlugin = {
295
322
  name: pluginName,
296
323
  marketplace: marketplaceName,
297
324
  version,
298
325
  cachePath,
326
+ projectPath,
299
327
  };
300
328
  if (existingIndex >= 0) {
301
329
  installedRegistry.plugins[existingIndex] = installedPlugin;
@@ -317,4 +345,44 @@ export class MarketplaceService {
317
345
  throw new Error(`Failed to install plugin ${pluginName}: ${error instanceof Error ? error.message : String(error)}`);
318
346
  }
319
347
  }
348
+ /**
349
+ * Uninstalls a plugin
350
+ */
351
+ async uninstallPlugin(pluginAtMarketplace, projectPath) {
352
+ const [pluginName, marketplaceName] = pluginAtMarketplace.split("@");
353
+ if (!pluginName || !marketplaceName) {
354
+ throw new Error("Invalid plugin format. Use name@marketplace");
355
+ }
356
+ const installedRegistry = await this.getInstalledPlugins();
357
+ const pluginIndex = installedRegistry.plugins.findIndex((p) => p.name === pluginName &&
358
+ p.marketplace === marketplaceName &&
359
+ p.projectPath === projectPath);
360
+ if (pluginIndex === -1) {
361
+ throw new Error(`Plugin ${pluginName}@${marketplaceName} is not installed${projectPath ? ` for project ${projectPath}` : ""}`);
362
+ }
363
+ const pluginToRemove = installedRegistry.plugins[pluginIndex];
364
+ // Remove from registry first
365
+ installedRegistry.plugins.splice(pluginIndex, 1);
366
+ await this.saveInstalledPlugins(installedRegistry);
367
+ // Check if any other project is still using this same cache path
368
+ const isStillReferenced = installedRegistry.plugins.some((p) => p.cachePath === pluginToRemove.cachePath);
369
+ // Only remove cached files if no other references exist
370
+ if (!isStillReferenced && existsSync(pluginToRemove.cachePath)) {
371
+ await fs.rm(pluginToRemove.cachePath, { recursive: true, force: true });
372
+ }
373
+ }
374
+ /**
375
+ * Updates a plugin (uninstall followed by install)
376
+ */
377
+ async updatePlugin(pluginAtMarketplace) {
378
+ await this.uninstallPlugin(pluginAtMarketplace);
379
+ return this.installPlugin(pluginAtMarketplace);
380
+ }
320
381
  }
382
+ MarketplaceService.BUILTIN_MARKETPLACE = {
383
+ name: "wave-plugins-official",
384
+ source: {
385
+ source: "github",
386
+ repo: "netease-lcap/wave-plugins-official",
387
+ },
388
+ };
@@ -7,6 +7,6 @@ export declare class MemoryRuleService {
7
7
  /**
8
8
  * Determines if a rule matches any of the given file paths using minimatch.
9
9
  */
10
- isRuleActive(rule: MemoryRule, filesInContext: string[]): boolean;
10
+ isRuleActive(rule: MemoryRule, filesInContext: string[], workdir?: string): boolean;
11
11
  }
12
12
  //# sourceMappingURL=MemoryRuleService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryRuleService.d.ts","sourceRoot":"","sources":["../../src/services/MemoryRuleService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,SAAS,CACP,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,GAAG,MAAM,GACzB,UAAU;IAgCb;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO;CAWlE"}
1
+ {"version":3,"file":"MemoryRuleService.d.ts","sourceRoot":"","sources":["../../src/services/MemoryRuleService.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,SAAS,CACP,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,GAAG,MAAM,GACzB,UAAU;IAgCb;;OAEG;IACH,YAAY,CACV,IAAI,EAAE,UAAU,EAChB,cAAc,EAAE,MAAM,EAAE,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO;CAkBX"}
@@ -1,4 +1,5 @@
1
1
  import { minimatch } from "minimatch";
2
+ import * as path from "node:path";
2
3
  import { parseFrontmatter } from "../utils/markdownParser.js";
3
4
  export class MemoryRuleService {
4
5
  /**
@@ -35,10 +36,20 @@ export class MemoryRuleService {
35
36
  /**
36
37
  * Determines if a rule matches any of the given file paths using minimatch.
37
38
  */
38
- isRuleActive(rule, filesInContext) {
39
+ isRuleActive(rule, filesInContext, workdir) {
39
40
  if (!rule.metadata.paths || rule.metadata.paths.length === 0) {
40
41
  return true;
41
42
  }
42
- return filesInContext.some((filePath) => rule.metadata.paths.some((pattern) => minimatch(filePath, pattern, { dot: true })));
43
+ return filesInContext.some((filePath) => {
44
+ // Normalize path relative to workdir if it's an absolute path
45
+ let normalizedPath = filePath;
46
+ if (workdir && path.isAbsolute(filePath)) {
47
+ normalizedPath = path.relative(workdir, filePath);
48
+ }
49
+ return rule.metadata.paths.some((pattern) => {
50
+ const isMatch = minimatch(normalizedPath, pattern, { dot: true });
51
+ return isMatch;
52
+ });
53
+ });
43
54
  }
44
55
  }
@@ -48,7 +48,7 @@ function getModelConfig(modelName, baseConfig = {}) {
48
48
  // gpt-5-codex model sets temperature to undefined
49
49
  config.temperature = undefined;
50
50
  }
51
- if (modelName.startsWith("gemini-3")) {
51
+ if (modelName.startsWith("gemini-3-flash")) {
52
52
  config.vertexai = {
53
53
  thinking_config: {
54
54
  thinking_level: "minimal",
@@ -4,7 +4,7 @@
4
4
  * Centralized service for loading, validating, and managing Wave configuration files.
5
5
  * Replaces distributed configuration logic previously embedded in hook.ts.
6
6
  */
7
- import type { ConfigurationLoadResult, ValidationResult, ConfigurationPaths, WaveConfiguration } from "../types/configuration.js";
7
+ import type { ConfigurationLoadResult, ValidationResult, ConfigurationPaths, WaveConfiguration, Scope } from "../types/configuration.js";
8
8
  import { type EnvironmentValidationResult, type MergedEnvironmentContext, type EnvironmentMergeOptions } from "../types/environment.js";
9
9
  import { GatewayConfig, ModelConfig, PermissionMode } from "../types/index.js";
10
10
  import { ClientOptions } from "openai";
@@ -70,6 +70,13 @@ export declare class ConfigurationService {
70
70
  * @returns Resolved token limit
71
71
  */
72
72
  resolveMaxInputTokens(constructorLimit?: number): number;
73
+ /**
74
+ * Resolves preferred language with fallbacks
75
+ * Resolution priority: options > settings.json > undefined
76
+ * @param constructorLanguage - Language from constructor (optional)
77
+ * @returns Resolved language or undefined
78
+ */
79
+ resolveLanguage(constructorLanguage?: string): string | undefined;
73
80
  /**
74
81
  * Resolves max output tokens with fallbacks
75
82
  * Resolution priority: options > env (from settings.json) > process.env > default
@@ -88,11 +95,20 @@ export declare class ConfigurationService {
88
95
  /**
89
96
  * Update the enabled state of a plugin in the specified scope
90
97
  */
91
- updateEnabledPlugin(workdir: string, scope: "user" | "project" | "local", pluginId: string, enabled: boolean): Promise<void>;
98
+ updateEnabledPlugin(workdir: string, scope: Scope, pluginId: string, enabled: boolean): Promise<void>;
99
+ /**
100
+ * Remove a plugin from the enabled plugins in the specified scope
101
+ */
102
+ removeEnabledPlugin(workdir: string, scope: Scope, pluginId: string): Promise<void>;
92
103
  /**
93
104
  * Get merged enabled plugins from all scopes
94
105
  */
95
106
  getMergedEnabledPlugins(workdir: string): Record<string, boolean>;
107
+ /**
108
+ * Load Wave configuration from a JSON file
109
+ * Supports both hooks and environment variables with proper validation
110
+ */
111
+ loadWaveConfigFromFile(filePath: string): WaveConfiguration | null;
96
112
  }
97
113
  /**
98
114
  * Validate environment variable configuration
@@ -1 +1 @@
1
- {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAk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wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAE1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAyH1B"}
1
+ {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACf,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,GAAG,CAA8B;IAIzC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IAiFnC;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IA2IlE;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAwC7D;;OAEG;IACH,uBAAuB,IAAI,iBAAiB,GAAG,IAAI;IAInD;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAIrD;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQ5C;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,E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