wave-agent-sdk 0.5.0 → 0.6.2

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 (169) hide show
  1. package/dist/agent.d.ts +14 -11
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +64 -151
  4. package/dist/constants/subagents.d.ts +5 -0
  5. package/dist/constants/subagents.d.ts.map +1 -0
  6. package/dist/constants/subagents.js +4 -0
  7. package/dist/constants/tools.d.ts +4 -1
  8. package/dist/constants/tools.d.ts.map +1 -1
  9. package/dist/constants/tools.js +4 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/managers/aiManager.d.ts +2 -5
  14. package/dist/managers/aiManager.d.ts.map +1 -1
  15. package/dist/managers/aiManager.js +43 -48
  16. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  17. package/dist/managers/backgroundTaskManager.js +63 -53
  18. package/dist/managers/foregroundTaskManager.d.ts.map +1 -1
  19. package/dist/managers/foregroundTaskManager.js +3 -2
  20. package/dist/managers/mcpManager.d.ts.map +1 -1
  21. package/dist/managers/messageManager.d.ts +13 -27
  22. package/dist/managers/messageManager.d.ts.map +1 -1
  23. package/dist/managers/messageManager.js +94 -89
  24. package/dist/managers/permissionManager.d.ts.map +1 -1
  25. package/dist/managers/permissionManager.js +25 -15
  26. package/dist/managers/planManager.d.ts +1 -1
  27. package/dist/managers/planManager.d.ts.map +1 -1
  28. package/dist/managers/planManager.js +2 -2
  29. package/dist/managers/reversionManager.d.ts.map +1 -1
  30. package/dist/managers/reversionManager.js +23 -2
  31. package/dist/managers/slashCommandManager.d.ts +3 -0
  32. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  33. package/dist/managers/slashCommandManager.js +8 -3
  34. package/dist/managers/subagentManager.d.ts +8 -14
  35. package/dist/managers/subagentManager.d.ts.map +1 -1
  36. package/dist/managers/subagentManager.js +46 -112
  37. package/dist/managers/toolManager.d.ts +11 -0
  38. package/dist/managers/toolManager.d.ts.map +1 -1
  39. package/dist/managers/toolManager.js +20 -2
  40. package/dist/{constants/prompts.d.ts → prompts/index.d.ts} +17 -15
  41. package/dist/prompts/index.d.ts.map +1 -0
  42. package/dist/prompts/index.js +309 -0
  43. package/dist/services/aiService.d.ts +0 -1
  44. package/dist/services/aiService.d.ts.map +1 -1
  45. package/dist/services/aiService.js +4 -140
  46. package/dist/services/memory.d.ts +0 -3
  47. package/dist/services/memory.d.ts.map +1 -1
  48. package/dist/services/memory.js +0 -59
  49. package/dist/services/session.d.ts +15 -1
  50. package/dist/services/session.d.ts.map +1 -1
  51. package/dist/services/session.js +57 -1
  52. package/dist/services/taskManager.d.ts +25 -0
  53. package/dist/services/taskManager.d.ts.map +1 -0
  54. package/dist/services/taskManager.js +164 -0
  55. package/dist/tools/askUserQuestion.d.ts.map +1 -1
  56. package/dist/tools/askUserQuestion.js +39 -25
  57. package/dist/tools/bashTool.d.ts.map +1 -1
  58. package/dist/tools/bashTool.js +13 -11
  59. package/dist/tools/editTool.d.ts.map +1 -1
  60. package/dist/tools/editTool.js +2 -1
  61. package/dist/tools/exitPlanMode.d.ts.map +1 -1
  62. package/dist/tools/exitPlanMode.js +26 -2
  63. package/dist/tools/globTool.d.ts.map +1 -1
  64. package/dist/tools/globTool.js +8 -2
  65. package/dist/tools/grepTool.d.ts.map +1 -1
  66. package/dist/tools/grepTool.js +17 -6
  67. package/dist/tools/lsTool.d.ts.map +1 -1
  68. package/dist/tools/lsTool.js +3 -1
  69. package/dist/tools/readTool.d.ts.map +1 -1
  70. package/dist/tools/readTool.js +16 -1
  71. package/dist/tools/taskManagementTools.d.ts +6 -0
  72. package/dist/tools/taskManagementTools.d.ts.map +1 -0
  73. package/dist/tools/taskManagementTools.js +461 -0
  74. package/dist/tools/taskOutputTool.d.ts.map +1 -1
  75. package/dist/tools/taskOutputTool.js +32 -8
  76. package/dist/tools/taskStopTool.d.ts.map +1 -1
  77. package/dist/tools/taskStopTool.js +7 -1
  78. package/dist/tools/taskTool.d.ts.map +1 -1
  79. package/dist/tools/taskTool.js +37 -2
  80. package/dist/tools/types.d.ts +11 -0
  81. package/dist/tools/types.d.ts.map +1 -1
  82. package/dist/tools/writeTool.d.ts.map +1 -1
  83. package/dist/tools/writeTool.js +9 -1
  84. package/dist/types/index.d.ts +1 -0
  85. package/dist/types/index.d.ts.map +1 -1
  86. package/dist/types/index.js +1 -0
  87. package/dist/types/messaging.d.ts +2 -18
  88. package/dist/types/messaging.d.ts.map +1 -1
  89. package/dist/types/processes.d.ts +16 -6
  90. package/dist/types/processes.d.ts.map +1 -1
  91. package/dist/types/tasks.d.ts +13 -0
  92. package/dist/types/tasks.d.ts.map +1 -0
  93. package/dist/types/tasks.js +1 -0
  94. package/dist/types/tools.d.ts +4 -1
  95. package/dist/types/tools.d.ts.map +1 -1
  96. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  97. package/dist/utils/builtinSubagents.js +59 -44
  98. package/dist/utils/cacheControlUtils.d.ts.map +1 -1
  99. package/dist/utils/cacheControlUtils.js +18 -12
  100. package/dist/utils/constants.d.ts +0 -4
  101. package/dist/utils/constants.d.ts.map +1 -1
  102. package/dist/utils/constants.js +0 -4
  103. package/dist/utils/convertMessagesForAPI.js +2 -2
  104. package/dist/utils/editUtils.d.ts.map +1 -1
  105. package/dist/utils/editUtils.js +2 -2
  106. package/dist/utils/gitUtils.d.ts +7 -0
  107. package/dist/utils/gitUtils.d.ts.map +1 -0
  108. package/dist/utils/gitUtils.js +24 -0
  109. package/dist/utils/messageOperations.d.ts +3 -58
  110. package/dist/utils/messageOperations.d.ts.map +1 -1
  111. package/dist/utils/messageOperations.js +4 -146
  112. package/dist/utils/nameGenerator.d.ts +1 -1
  113. package/dist/utils/nameGenerator.d.ts.map +1 -1
  114. package/dist/utils/nameGenerator.js +19 -3
  115. package/package.json +1 -1
  116. package/src/agent.ts +86 -183
  117. package/src/constants/subagents.ts +4 -0
  118. package/src/constants/tools.ts +4 -1
  119. package/src/index.ts +1 -0
  120. package/src/managers/aiManager.ts +63 -70
  121. package/src/managers/backgroundTaskManager.ts +58 -54
  122. package/src/managers/foregroundTaskManager.ts +3 -2
  123. package/src/managers/mcpManager.ts +6 -3
  124. package/src/managers/messageManager.ts +126 -142
  125. package/src/managers/permissionManager.ts +32 -21
  126. package/src/managers/planManager.ts +2 -2
  127. package/src/managers/reversionManager.ts +26 -2
  128. package/src/managers/slashCommandManager.ts +12 -3
  129. package/src/managers/subagentManager.ts +60 -144
  130. package/src/managers/toolManager.ts +32 -2
  131. package/src/prompts/index.ts +366 -0
  132. package/src/services/aiService.ts +3 -145
  133. package/src/services/memory.ts +0 -72
  134. package/src/services/session.ts +73 -0
  135. package/src/services/taskManager.ts +195 -0
  136. package/src/tools/askUserQuestion.ts +51 -29
  137. package/src/tools/bashTool.ts +15 -17
  138. package/src/tools/editTool.ts +3 -1
  139. package/src/tools/exitPlanMode.ts +27 -3
  140. package/src/tools/globTool.ts +10 -2
  141. package/src/tools/grepTool.ts +17 -6
  142. package/src/tools/lsTool.ts +3 -1
  143. package/src/tools/readTool.ts +17 -1
  144. package/src/tools/taskManagementTools.ts +516 -0
  145. package/src/tools/taskOutputTool.ts +34 -12
  146. package/src/tools/taskStopTool.ts +7 -1
  147. package/src/tools/taskTool.ts +45 -1
  148. package/src/tools/types.ts +12 -0
  149. package/src/tools/writeTool.ts +9 -2
  150. package/src/types/index.ts +1 -0
  151. package/src/types/messaging.ts +1 -21
  152. package/src/types/processes.ts +18 -7
  153. package/src/types/tasks.ts +13 -0
  154. package/src/types/tools.ts +4 -1
  155. package/src/utils/builtinSubagents.ts +81 -45
  156. package/src/utils/cacheControlUtils.ts +26 -18
  157. package/src/utils/constants.ts +0 -5
  158. package/src/utils/convertMessagesForAPI.ts +2 -2
  159. package/src/utils/editUtils.ts +2 -6
  160. package/src/utils/gitUtils.ts +24 -0
  161. package/src/utils/messageOperations.ts +6 -229
  162. package/src/utils/nameGenerator.ts +20 -3
  163. package/dist/constants/prompts.d.ts.map +0 -1
  164. package/dist/constants/prompts.js +0 -118
  165. package/dist/tools/todoWriteTool.d.ts +0 -6
  166. package/dist/tools/todoWriteTool.d.ts.map +0 -1
  167. package/dist/tools/todoWriteTool.js +0 -220
  168. package/src/constants/prompts.ts +0 -155
  169. package/src/tools/todoWriteTool.ts +0 -257
@@ -8,7 +8,7 @@ export class SubagentManager {
8
8
  this.cachedConfigurations = null;
9
9
  this.workdir = options.workdir;
10
10
  this.parentToolManager = options.parentToolManager;
11
- this.parentMessageManager = options.parentMessageManager;
11
+ this.taskManager = options.taskManager;
12
12
  this.callbacks = options.callbacks; // Store SubagentManagerCallbacks
13
13
  this.logger = options.logger;
14
14
  this.getGatewayConfig = options.getGatewayConfig;
@@ -55,7 +55,7 @@ export class SubagentManager {
55
55
  /**
56
56
  * Create a new subagent instance with isolated managers
57
57
  */
58
- async createInstance(configuration, parameters, runInBackground) {
58
+ async createInstance(configuration, parameters, runInBackground, onUpdate) {
59
59
  if (!this.parentToolManager) {
60
60
  throw new Error("SubagentManager not properly initialized - call initialize() first");
61
61
  }
@@ -76,6 +76,7 @@ export class SubagentManager {
76
76
  const aiManager = new AIManager({
77
77
  messageManager,
78
78
  toolManager,
79
+ taskManager: this.taskManager,
79
80
  logger: this.logger,
80
81
  workdir: this.workdir,
81
82
  systemPrompt: configuration.systemPrompt,
@@ -118,11 +119,11 @@ export class SubagentManager {
118
119
  toolManager,
119
120
  status: "initializing",
120
121
  messages: [],
122
+ lastTools: [], // Initialize lastTools
121
123
  subagentType: parameters.subagent_type, // Store the subagent type
124
+ onUpdate,
122
125
  };
123
126
  this.instances.set(subagentId, instance);
124
- // Create subagent block in parent message manager
125
- this.parentMessageManager.addSubagentBlock(subagentId, configuration.name, messageManager.getSessionId(), configuration, "active", parameters, runInBackground);
126
127
  return instance;
127
128
  }
128
129
  /**
@@ -139,9 +140,6 @@ export class SubagentManager {
139
140
  }
140
141
  // Set status to active and update parent
141
142
  this.updateInstanceStatus(instance.subagentId, "active");
142
- this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
143
- status: "active",
144
- });
145
143
  if (runInBackground && this.backgroundTaskManager) {
146
144
  const taskId = this.backgroundTaskManager.generateId();
147
145
  const startTime = Date.now();
@@ -153,6 +151,11 @@ export class SubagentManager {
153
151
  description: instance.configuration.description,
154
152
  stdout: "",
155
153
  stderr: "",
154
+ subagentId: instance.subagentId,
155
+ onStop: () => {
156
+ instance.aiManager.abortAIMessage();
157
+ this.cleanupInstance(instance.subagentId);
158
+ },
156
159
  });
157
160
  instance.backgroundTaskId = taskId;
158
161
  // Execute in background
@@ -184,9 +187,6 @@ export class SubagentManager {
184
187
  }
185
188
  catch (error) {
186
189
  this.updateInstanceStatus(instance.subagentId, "error");
187
- this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
188
- status: "error",
189
- });
190
190
  throw error;
191
191
  }
192
192
  }
@@ -208,35 +208,30 @@ export class SubagentManager {
208
208
  description: instance.configuration.description,
209
209
  stdout: "",
210
210
  stderr: "",
211
+ subagentId: instance.subagentId,
212
+ onStop: () => {
213
+ instance.aiManager.abortAIMessage();
214
+ this.cleanupInstance(instance.subagentId);
215
+ },
211
216
  });
212
217
  instance.backgroundTaskId = taskId;
213
- // Update parent message manager to reflect background status
214
- this.parentMessageManager.updateSubagentBlock(subagentId, {
215
- runInBackground: true,
216
- });
217
218
  return taskId;
218
219
  }
219
220
  async internalExecute(instance, prompt, abortSignal) {
220
221
  // Set up consolidated abort handler to prevent listener accumulation
221
222
  let abortCleanup;
222
- if (abortSignal) {
223
+ // Only link to parent abort signal if NOT running in background
224
+ if (abortSignal && !instance.backgroundTaskId) {
223
225
  abortCleanup = addConsolidatedAbortListener(abortSignal, [
224
226
  () => {
225
227
  // Update status to aborted
226
- // Only update status if it's NOT a background task
227
- if (!instance.backgroundTaskId) {
228
- this.updateInstanceStatus(instance.subagentId, "aborted");
229
- this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
230
- status: "aborted",
231
- });
232
- }
228
+ this.updateInstanceStatus(instance.subagentId, "aborted");
229
+ // Cleanup instance immediately on abort
230
+ this.cleanupInstance(instance.subagentId);
233
231
  },
234
232
  () => {
235
233
  // Abort the AI execution
236
- // Only abort if it's NOT a background task
237
- if (!instance.backgroundTaskId) {
238
- instance.aiManager.abortAIMessage();
239
- }
234
+ instance.aiManager.abortAIMessage();
240
235
  },
241
236
  ]);
242
237
  }
@@ -276,8 +271,6 @@ export class SubagentManager {
276
271
  model: resolvedModel,
277
272
  });
278
273
  // 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
274
  if (abortSignal && !instance.backgroundTaskId) {
282
275
  await Promise.race([
283
276
  executeAI,
@@ -300,9 +293,6 @@ export class SubagentManager {
300
293
  const response = textBlocks.map((block) => block.content).join("\n");
301
294
  // Update status to completed and update parent
302
295
  this.updateInstanceStatus(instance.subagentId, "completed");
303
- this.parentMessageManager.updateSubagentBlock(instance.subagentId, {
304
- status: "completed",
305
- });
306
296
  // If this was transitioned to background, update the background task
307
297
  if (instance.backgroundTaskId && this.backgroundTaskManager) {
308
298
  const task = this.backgroundTaskManager.getTask(instance.backgroundTaskId);
@@ -387,82 +377,6 @@ export class SubagentManager {
387
377
  cleanup() {
388
378
  this.instances.clear();
389
379
  }
390
- /**
391
- * Restore subagent instances from saved session data
392
- * This method is called during agent initialization to restore previous subagent states
393
- */
394
- async restoreSubagentSessions(subagentSessions) {
395
- for (const { sessionData, subagentId, configuration } of subagentSessions) {
396
- try {
397
- // Use the configuration from the SubagentBlock
398
- // Create the subagent instance without executing - just restore the state
399
- // Create MessageManager for the restored subagent
400
- const subagentCallbacks = this.createSubagentCallbacks(subagentId);
401
- const messageManager = new MessageManager({
402
- callbacks: subagentCallbacks,
403
- workdir: this.workdir,
404
- logger: this.logger,
405
- sessionType: "subagent",
406
- subagentType: configuration.name, // Use configuration name for restored sessions
407
- memoryRuleManager: this.memoryRuleManager,
408
- });
409
- // Use the parent tool manager
410
- const toolManager = this.parentToolManager;
411
- // Determine model to use
412
- let modelToUse;
413
- const parentModelConfig = this.getModelConfig();
414
- if (!configuration.model || configuration.model === "inherit") {
415
- modelToUse = parentModelConfig.agentModel;
416
- }
417
- else if (configuration.model === "fastModel") {
418
- modelToUse = parentModelConfig.fastModel;
419
- }
420
- else {
421
- modelToUse = configuration.model;
422
- }
423
- // Create AIManager for the restored subagent
424
- const aiManager = new AIManager({
425
- messageManager,
426
- toolManager,
427
- logger: this.logger,
428
- workdir: this.workdir,
429
- systemPrompt: configuration.systemPrompt,
430
- subagentType: configuration.name, // Use configuration name as subagent type for restored instances
431
- hookManager: this.hookManager,
432
- permissionManager: this.parentToolManager.getPermissionManager(),
433
- getGatewayConfig: this.getGatewayConfig,
434
- getModelConfig: () => ({
435
- ...parentModelConfig,
436
- agentModel: modelToUse,
437
- }),
438
- getMaxInputTokens: this.getMaxInputTokens,
439
- getLanguage: this.getLanguage,
440
- callbacks: {
441
- onUsageAdded: this.onUsageAdded,
442
- },
443
- });
444
- // Create restored instance
445
- const instance = {
446
- subagentId,
447
- configuration,
448
- aiManager,
449
- messageManager,
450
- toolManager,
451
- status: "completed", // Restored sessions are considered completed
452
- messages: sessionData.messages,
453
- subagentType: configuration.name, // Use configuration name as subagent type for restored instances
454
- };
455
- // IMPORTANT: Store instance in map BEFORE calling setMessages
456
- // This ensures the callback can find the instance
457
- this.instances.set(subagentId, instance);
458
- messageManager.initializeFromSession(sessionData);
459
- }
460
- catch (error) {
461
- this.logger?.warn(`Failed to restore subagent session ${subagentId}:`, error);
462
- // Continue with other sessions even if one fails
463
- }
464
- }
465
- }
466
380
  /**
467
381
  * Create subagent callbacks for a specific subagent ID
468
382
  * Extracted to reuse in both create and restore flows
@@ -494,6 +408,19 @@ export class SubagentManager {
494
408
  }
495
409
  },
496
410
  onToolBlockUpdated: (params) => {
411
+ // Track last two tool names when a tool starts running
412
+ if (params.stage === "running" && params.name) {
413
+ const instance = this.instances.get(subagentId);
414
+ if (instance) {
415
+ // Add to lastTools if it's different from the last one or we want to show duplicates
416
+ // Based on "ToolA, ToolB" requirement, we'll just keep the last two
417
+ instance.lastTools.push(params.name);
418
+ if (instance.lastTools.length > 2) {
419
+ instance.lastTools.shift();
420
+ }
421
+ instance.onUpdate?.();
422
+ }
423
+ }
497
424
  // Forward tool block updates to parent via SubagentManager callbacks
498
425
  if (this.callbacks?.onSubagentToolBlockUpdated) {
499
426
  this.callbacks.onSubagentToolBlockUpdated(subagentId, params);
@@ -504,17 +431,24 @@ export class SubagentManager {
504
431
  const instance = this.instances.get(subagentId);
505
432
  if (instance) {
506
433
  instance.messages = messages;
434
+ // Trigger the onUpdate callback if provided
435
+ instance.onUpdate?.();
507
436
  // Forward subagent message changes to parent via callbacks
508
437
  if (this.callbacks?.onSubagentMessagesChange) {
509
438
  this.callbacks.onSubagentMessagesChange(subagentId, messages);
510
439
  }
511
440
  }
512
441
  },
513
- onSessionIdChange: (newSessionId) => {
514
- // Update the subagent block with the new session ID
515
- this.parentMessageManager.updateSubagentBlock(subagentId, {
516
- sessionId: newSessionId,
517
- });
442
+ onLatestTotalTokensChange: (tokens) => {
443
+ const instance = this.instances.get(subagentId);
444
+ if (instance) {
445
+ // Trigger the onUpdate callback if provided
446
+ instance.onUpdate?.();
447
+ }
448
+ // Forward latest total tokens to parent via SubagentManager callbacks
449
+ if (this.callbacks?.onSubagentLatestTotalTokensChange) {
450
+ this.callbacks.onSubagentLatestTotalTokensChange(subagentId, tokens);
451
+ }
518
452
  },
519
453
  };
520
454
  }
@@ -14,6 +14,8 @@ export interface ToolManagerOptions {
14
14
  permissionManager?: PermissionManager;
15
15
  /** Foreground task manager for backgrounding tasks */
16
16
  foregroundTaskManager?: import("../types/processes.js").IForegroundTaskManager;
17
+ /** Task manager for task management */
18
+ taskManager?: import("../services/taskManager.js").TaskManager;
17
19
  /** Reversion manager for file snapshots */
18
20
  reversionManager?: ReversionManager;
19
21
  /** Background task manager for background execution */
@@ -37,6 +39,7 @@ declare class ToolManager {
37
39
  private permissionManager?;
38
40
  private foregroundTaskManager?;
39
41
  private reversionManager?;
42
+ private taskManager?;
40
43
  private backgroundTaskManager?;
41
44
  private permissionMode?;
42
45
  private canUseToolCallback?;
@@ -88,6 +91,10 @@ declare class ToolManager {
88
91
  execute(name: string, args: Record<string, unknown>, context: ToolContext): Promise<ToolResult>;
89
92
  list(): ToolPlugin[];
90
93
  getToolsConfig(): ChatCompletionFunctionTool[];
94
+ /**
95
+ * Get the list of registered tool plugins
96
+ */
97
+ getTools(): ToolPlugin[];
91
98
  /**
92
99
  * Get the current permission mode
93
100
  */
@@ -101,6 +108,10 @@ declare class ToolManager {
101
108
  * Get the permission manager
102
109
  */
103
110
  getPermissionManager(): PermissionManager | undefined;
111
+ /**
112
+ * Get the task manager
113
+ */
114
+ getTaskManager(): import("../services/taskManager.js").TaskManager | undefined;
104
115
  }
105
116
  export { ToolManager };
106
117
  //# sourceMappingURL=toolManager.d.ts.map
@@ -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;AAmB7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,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AAU,EAAE;IAMpB,cAAc,IAAI,0BAA0B,EAAE;IAmB9C;;OAEG;IACI,QAAQ,IAAI,UAAU,EAAE;IAI/B;;OAEG;IACI,iBAAiB,IAAI,cAAc;IAS1C;;;OAGG;IACI,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAIpD;;OAEG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAI5D;;OAEG;IACI,cAAc,IACjB,OAAO,4BAA4B,EAAE,WAAW,GAChD,SAAS;CAGd;AAGD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -12,10 +12,10 @@ import { globTool } from "../tools/globTool.js";
12
12
  import { grepTool } from "../tools/grepTool.js";
13
13
  import { lsTool } from "../tools/lsTool.js";
14
14
  import { readTool } from "../tools/readTool.js";
15
- import { todoWriteTool } from "../tools/todoWriteTool.js";
16
15
  import { lspTool } from "../tools/lspTool.js";
17
16
  import { createTaskTool } from "../tools/taskTool.js";
18
17
  import { createSkillTool } from "../tools/skillTool.js";
18
+ import { taskCreateTool, taskGetTool, taskUpdateTool, taskListTool, } from "../tools/taskManagementTools.js";
19
19
  /**
20
20
  * Tool Manager
21
21
  *
@@ -29,6 +29,7 @@ class ToolManager {
29
29
  this.lspManager = options.lspManager;
30
30
  this.logger = options.logger;
31
31
  this.permissionManager = options.permissionManager;
32
+ this.taskManager = options.taskManager;
32
33
  this.foregroundTaskManager = options.foregroundTaskManager;
33
34
  this.reversionManager = options.reversionManager;
34
35
  this.backgroundTaskManager = options.backgroundTaskManager;
@@ -80,8 +81,11 @@ class ToolManager {
80
81
  grepTool,
81
82
  lsTool,
82
83
  readTool,
83
- todoWriteTool,
84
84
  lspTool,
85
+ taskCreateTool,
86
+ taskGetTool,
87
+ taskUpdateTool,
88
+ taskListTool,
85
89
  ];
86
90
  for (const tool of builtInTools) {
87
91
  this.tools.set(tool.name, tool);
@@ -120,11 +124,13 @@ class ToolManager {
120
124
  permissionMode: effectivePermissionMode,
121
125
  canUseToolCallback: this.canUseToolCallback,
122
126
  permissionManager: this.permissionManager,
127
+ taskManager: this.taskManager,
123
128
  reversionManager: this.reversionManager,
124
129
  backgroundTaskManager: this.backgroundTaskManager,
125
130
  foregroundTaskManager: this.foregroundTaskManager,
126
131
  mcpManager: this.mcpManager,
127
132
  lspManager: this.lspManager,
133
+ sessionId: context.sessionId,
128
134
  };
129
135
  this.logger?.debug("Executing tool with enhanced context", {
130
136
  toolName: name,
@@ -185,6 +191,12 @@ class ToolManager {
185
191
  const mcpToolsConfig = this.mcpManager.getMcpToolsConfig();
186
192
  return [...builtInToolsConfig, ...mcpToolsConfig];
187
193
  }
194
+ /**
195
+ * Get the list of registered tool plugins
196
+ */
197
+ getTools() {
198
+ return Array.from(this.tools.values());
199
+ }
188
200
  /**
189
201
  * Get the current permission mode
190
202
  */
@@ -207,6 +219,12 @@ class ToolManager {
207
219
  getPermissionManager() {
208
220
  return this.permissionManager;
209
221
  }
222
+ /**
223
+ * Get the task manager
224
+ */
225
+ getTaskManager() {
226
+ return this.taskManager;
227
+ }
210
228
  }
211
229
  // Export tool registry class and types
212
230
  export { ToolManager };
@@ -1,20 +1,22 @@
1
+ import { ToolPlugin } from "../tools/types.js";
1
2
  export declare const BASE_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task\u2014three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused `_vars`, re-exporting types, adding `// removed` comments for removed code, etc. If something is unused, delete it completely.\n\n# Tool usage policy\n- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency.\n- However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.\n- If the user specifies that they want you to run tools \"in parallel\", you MUST send a single message with multiple tool use content blocks.";
2
- export declare const TASK_MANAGEMENT_POLICY = "\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.";
3
- export declare const ASK_USER_POLICY = "\n# Asking questions as you work\nYou have access to the AskUserQuestion tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.";
4
- export declare const SUBAGENT_POLICY = "\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n- VERY IMPORTANT: When exploring the codebase to gather context or to answer a question that is not a needle query for a specific file/class/function, it is CRITICAL that you use the Task tool with subagent_type=Explore instead of running search commands directly.";
5
- export declare const FILE_TOOL_POLICY_PREFIX = "\n- Use specialized tools instead of bash commands when possible, as this provides a better user experience. For file operations, use dedicated tools:";
6
- export declare const READ_FILE_POLICY = " Read for reading files instead of cat/head/tail";
7
- export declare const EDIT_FILE_POLICY = " Edit/MultiEdit for editing instead of sed/awk";
8
- export declare const WRITE_FILE_POLICY = " Write for creating files instead of cat with heredoc or echo redirection";
9
- export declare const SEARCH_FILE_POLICY = " LS/Glob/Grep for searching and listing files instead of find/ls/grep";
10
- export declare const BASH_POLICY = "\n- Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead.\n- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.";
3
+ export declare const TASK_MANAGEMENT_POLICY = "\n# Task Management\nYou have access to the TaskCreate, TaskGet, TaskUpdate, and TaskList tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\nIt is critical that you mark tasks as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.";
4
+ export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
11
5
  export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task\u2014three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused `_vars`, re-exporting types, adding `// removed` comments for removed code, etc. If something is unused, delete it completely.\n\n# Tool usage policy\n- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency.\n- However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.\n- If the user specifies that they want you to run tools \"in parallel\", you MUST send a single message with multiple tool use content blocks.";
6
+ export declare const BASH_SUBAGENT_SYSTEM_PROMPT = "You are a command execution specialist. Your role is to execute bash commands efficiently and safely.\n\nGuidelines:\n- Execute commands precisely as instructed\n- For git operations, follow git safety protocols\n- Report command output clearly and concisely\n- If a command fails, explain the error and suggest solutions\n- Use command chaining (&&) for dependent operations\n- Quote paths with spaces properly\n- For clear communication, avoid using emojis\n\nComplete the requested operations efficiently.";
12
7
  export declare const GENERAL_PURPOSE_SYSTEM_PROMPT = "You are an agent. Given the user's message, you should use the tools available to complete the task. Do what has been asked; nothing more, nothing less. When you complete the task simply respond with a detailed writeup.\n\nYour strengths:\n- Searching for code, configurations, and patterns across large codebases\n- Analyzing multiple files to understand system architecture\n- Investigating complex questions that require exploring many files\n- Performing multi-step research tasks\n\nGuidelines:\n- For file searches: Use Grep or Glob when you need to search broadly. Use Read when you know the specific file path.\n- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.\n- Be thorough: Check multiple locations, consider different naming conventions, look for related files.\n- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested.\n- In your final response always share relevant file names and code snippets. Any file paths you return in your response MUST be absolute. Do NOT use relative paths.\n- For clear communication, avoid using emojis.";
8
+ export declare const EXPLORE_SUBAGENT_SYSTEM_PROMPT = "You are a file search specialist. You excel at thoroughly navigating and exploring codebases.\n\t\n\t=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===\n\tThis is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:\n\t- Creating new files (no Write, touch, or file creation of any kind)\n\t- Modifying existing files (no Edit operations)\n\t- Deleting files (no rm or deletion)\n\t- Moving or copying files (no mv or cp)\n\t- Creating temporary files anywhere, including /tmp\n\t- Using redirect operators (>, >>, |) or heredocs to write to files\n\t- Running ANY commands that change system state\n\t\n\tYour role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.\n\t\n\tYour strengths:\n\t- Rapidly finding files using glob patterns\n\t- Searching code and text with powerful regex patterns\n\t- Reading and analyzing file contents\n\t- Using Language Server Protocol (LSP) for deep code intelligence (definitions, references, etc.)\n\t\n\tGuidelines:\n\t- Use Glob for broad file pattern matching\n\t- Use Grep for searching file contents with regex\n\t- Use Read when you know the specific file path you need to read\n\t- Use LSP for code intelligence features like finding definitions, references, implementations, and symbols. This is especially useful for understanding complex code relationships.\n\t- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)\n\t- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification\n\t- Adapt your search approach based on the thoroughness level specified by the caller\n\t- Return file paths as absolute paths in your final response\n\t- For clear communication, avoid using emojis\n\t- Communicate your final report directly as a regular message - do NOT attempt to create files\n\t\n\tNOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:\n\t- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations\n\t- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files\n\t\n\tComplete the user's search request efficiently and report your findings clearly.";
9
+ export declare const PLAN_SUBAGENT_SYSTEM_PROMPT = "You are a software architect and planning specialist. Your role is to explore the codebase and design implementation plans.\n\n=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===\nThis is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:\n- Creating new files (no Write, touch, or file creation of any kind)\n- Modifying existing files (no Edit operations)\n- Deleting files (no rm or deletion)\n- Moving or copying files (no mv or cp)\n- Creating temporary files anywhere, including /tmp\n- Using redirect operators (>, >>, |) or heredocs to write to files\n- Running ANY commands that change system state\n\nYour role is EXCLUSIVELY to explore the codebase and design implementation plans. You do NOT have access to file editing tools - attempting to edit files will fail.\n\nYou will be provided with a set of requirements and optionally a perspective on how to approach the design process.\n\n## Your Process\n\n1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.\n\n2. **Explore Thoroughly**:\n - Read any files provided to you in the initial prompt\n - Find existing patterns and conventions using Glob, Grep, and Read\n - Understand the current architecture\n - Identify similar features as reference\n - Trace through relevant code paths\n - Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)\n - NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification\n\n3. **Design Solution**:\n - Create implementation approach based on your assigned perspective\n - Consider trade-offs and architectural decisions\n - Follow existing patterns where appropriate\n\n4. **Detail the Plan**:\n - Provide step-by-step implementation strategy\n - Identify dependencies and sequencing\n - Anticipate potential challenges\n\n## Required Output\n\nEnd your response with:\n\n### Critical Files for Implementation\nList 3-5 files most critical for implementing this plan:\n- path/to/file1.ts - [Brief reason: e.g., \"Core logic to modify\"]\n- path/to/file2.ts - [Brief reason: e.g., \"Interfaces to implement\"]\n- path/to/file3.ts - [Brief reason: e.g., \"Pattern to follow\"]\n\nREMEMBER: You can ONLY explore and plan. You CANNOT and MUST NOT write, edit, or modify any files. You do NOT have access to file editing tools.";
13
10
  export declare const INIT_PROMPT = "Please analyze this codebase and create a AGENTS.md file, which will be given to future instances of Agent to operate in this repository.\n\nWhat to add:\n1. Commands that will be commonly used, such as how to build, lint, and run tests. Include the necessary commands to develop in this codebase, such as how to run a single test.\n2. High-level code architecture and structure so that future instances can be productive more quickly. Focus on the \"big picture\" architecture that requires reading multiple files to understand.\n\nUsage notes:\n- If there's already a AGENTS.md, suggest improvements to it.\n- When you make the initial AGENTS.md, do not repeat yourself and do not include obvious instructions like \"Provide helpful error messages to users\", \"Write unit tests for all new utilities\", \"Never include sensitive information (API keys, tokens) in code or commits\".\n- Avoid listing every component or file structure that can be easily discovered.\n- Don't include generic development practices.\n- If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.\n- If there is a README.md, make sure to include the important parts.\n- Do not make up information such as \"Common Development Tasks\", \"Tips for Development\", \"Support and Documentation\" unless this is expressly included in other files that you read.\n- Be sure to prefix the file with the following text:\n\n```\n# AGENTS.md\n\nThis file provides guidance to Agent when working with code in this repository.\n```";
14
- export declare function buildSystemPrompt(basePrompt: string, tools: {
15
- name?: string;
16
- function?: {
17
- name: string;
11
+ export declare const COMPRESS_MESSAGES_SYSTEM_PROMPT = "You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:\n1. Task Overview\nThe user's core request and success criteria\nAny clarifications or constraints they specified\n2. Current State\nWhat has been completed so far\nFiles created, modified, or analyzed (with paths if relevant)\nKey outputs or artifacts produced\n3. Important Discoveries\nTechnical constraints or requirements uncovered\nDecisions made and their rationale\nErrors encountered and how they were resolved\nWhat approaches were tried that didn't work (and why)\n4. Next Steps\nSpecific actions needed to complete the task\nAny blockers or open questions to resolve\nPriority order if multiple steps remain\n5. Context to Preserve\nUser preferences or style requirements\nDomain-specific details that aren't obvious\nAny promises made to the user\nBe concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.\nWrap your summary in <summary></summary> tags.";
12
+ export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
13
+ workdir?: string;
14
+ memory?: string;
15
+ language?: string;
16
+ isSubagent?: boolean;
17
+ planMode?: {
18
+ planFilePath: string;
19
+ planExists: boolean;
18
20
  };
19
- }[]): string;
20
- //# sourceMappingURL=prompts.d.ts.map
21
+ }): string;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAqB/C,eAAO,MAAM,kBAAkB,ksFAe8G,CAAC;AAE9I,eAAO,MAAM,sBAAsB,moBAImH,CAAC;AAEvJ,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,ksFAAqB,CAAC;AAExD,eAAO,MAAM,2BAA2B,igBAWO,CAAC;AAEhD,eAAO,MAAM,6BAA6B,izCAeK,CAAC;AAEhD,eAAO,MAAM,8BAA8B,21EAoCuC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,25EAiDyG,CAAC;AAElJ,eAAO,MAAM,WAAW,kkDAoBjB,CAAC;AAER,eAAO,MAAM,+BAA+B,20CAsBG,CAAC;AAEhD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;CACE,GACL,MAAM,CAmDR"}