wave-agent-sdk 0.4.0 → 0.6.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.
Files changed (190) hide show
  1. package/dist/agent.d.ts +42 -11
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +114 -115
  4. package/dist/constants/prompts.d.ts +18 -14
  5. package/dist/constants/prompts.d.ts.map +1 -1
  6. package/dist/constants/prompts.js +130 -54
  7. package/dist/constants/tools.d.ts +6 -3
  8. package/dist/constants/tools.d.ts.map +1 -1
  9. package/dist/constants/tools.js +6 -3
  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/MemoryRuleManager.js +1 -1
  14. package/dist/managers/aiManager.d.ts +5 -3
  15. package/dist/managers/aiManager.d.ts.map +1 -1
  16. package/dist/managers/aiManager.js +57 -20
  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 +255 -0
  22. package/dist/managers/foregroundTaskManager.d.ts +9 -0
  23. package/dist/managers/foregroundTaskManager.d.ts.map +1 -0
  24. package/dist/managers/foregroundTaskManager.js +21 -0
  25. package/dist/managers/liveConfigManager.d.ts +1 -1
  26. package/dist/managers/lspManager.d.ts.map +1 -1
  27. package/dist/managers/lspManager.js +3 -1
  28. package/dist/managers/mcpManager.d.ts.map +1 -1
  29. package/dist/managers/messageManager.d.ts +26 -12
  30. package/dist/managers/messageManager.d.ts.map +1 -1
  31. package/dist/managers/messageManager.js +138 -64
  32. package/dist/managers/permissionManager.d.ts.map +1 -1
  33. package/dist/managers/permissionManager.js +26 -22
  34. package/dist/managers/planManager.d.ts +1 -1
  35. package/dist/managers/planManager.d.ts.map +1 -1
  36. package/dist/managers/planManager.js +2 -2
  37. package/dist/managers/pluginManager.d.ts.map +1 -1
  38. package/dist/managers/pluginManager.js +3 -2
  39. package/dist/managers/slashCommandManager.d.ts +6 -0
  40. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  41. package/dist/managers/slashCommandManager.js +8 -2
  42. package/dist/managers/subagentManager.d.ts +15 -2
  43. package/dist/managers/subagentManager.d.ts.map +1 -1
  44. package/dist/managers/subagentManager.js +153 -39
  45. package/dist/managers/toolManager.d.ts +18 -1
  46. package/dist/managers/toolManager.d.ts.map +1 -1
  47. package/dist/managers/toolManager.js +29 -5
  48. package/dist/services/GitService.d.ts.map +1 -1
  49. package/dist/services/GitService.js +6 -2
  50. package/dist/services/MarketplaceService.d.ts +2 -2
  51. package/dist/services/MarketplaceService.d.ts.map +1 -1
  52. package/dist/services/MarketplaceService.js +18 -11
  53. package/dist/services/MemoryRuleService.d.ts +1 -1
  54. package/dist/services/MemoryRuleService.d.ts.map +1 -1
  55. package/dist/services/MemoryRuleService.js +13 -2
  56. package/dist/services/aiService.d.ts +0 -1
  57. package/dist/services/aiService.d.ts.map +1 -1
  58. package/dist/services/aiService.js +4 -140
  59. package/dist/services/memory.d.ts +0 -3
  60. package/dist/services/memory.d.ts.map +1 -1
  61. package/dist/services/memory.js +1 -60
  62. package/dist/services/session.d.ts +15 -1
  63. package/dist/services/session.d.ts.map +1 -1
  64. package/dist/services/session.js +57 -1
  65. package/dist/services/taskManager.d.ts +21 -0
  66. package/dist/services/taskManager.d.ts.map +1 -0
  67. package/dist/services/taskManager.js +158 -0
  68. package/dist/tools/askUserQuestion.d.ts.map +1 -1
  69. package/dist/tools/askUserQuestion.js +39 -25
  70. package/dist/tools/bashTool.d.ts +0 -8
  71. package/dist/tools/bashTool.d.ts.map +1 -1
  72. package/dist/tools/bashTool.js +48 -172
  73. package/dist/tools/editTool.d.ts.map +1 -1
  74. package/dist/tools/editTool.js +8 -6
  75. package/dist/tools/exitPlanMode.d.ts.map +1 -1
  76. package/dist/tools/exitPlanMode.js +25 -1
  77. package/dist/tools/globTool.d.ts.map +1 -1
  78. package/dist/tools/globTool.js +8 -2
  79. package/dist/tools/grepTool.d.ts.map +1 -1
  80. package/dist/tools/grepTool.js +17 -6
  81. package/dist/tools/lsTool.d.ts.map +1 -1
  82. package/dist/tools/lsTool.js +3 -1
  83. package/dist/tools/multiEditTool.d.ts.map +1 -1
  84. package/dist/tools/multiEditTool.js +7 -6
  85. package/dist/tools/readTool.d.ts.map +1 -1
  86. package/dist/tools/readTool.js +16 -1
  87. package/dist/tools/taskManagementTools.d.ts +6 -0
  88. package/dist/tools/taskManagementTools.d.ts.map +1 -0
  89. package/dist/tools/taskManagementTools.js +453 -0
  90. package/dist/tools/taskOutputTool.d.ts +3 -0
  91. package/dist/tools/taskOutputTool.d.ts.map +1 -0
  92. package/dist/tools/taskOutputTool.js +173 -0
  93. package/dist/tools/taskStopTool.d.ts +3 -0
  94. package/dist/tools/taskStopTool.d.ts.map +1 -0
  95. package/dist/tools/taskStopTool.js +71 -0
  96. package/dist/tools/taskTool.d.ts.map +1 -1
  97. package/dist/tools/taskTool.js +110 -63
  98. package/dist/tools/types.d.ts +12 -0
  99. package/dist/tools/types.d.ts.map +1 -1
  100. package/dist/tools/writeTool.d.ts.map +1 -1
  101. package/dist/tools/writeTool.js +9 -1
  102. package/dist/types/index.d.ts +1 -0
  103. package/dist/types/index.d.ts.map +1 -1
  104. package/dist/types/index.js +1 -0
  105. package/dist/types/marketplace.d.ts +1 -0
  106. package/dist/types/marketplace.d.ts.map +1 -1
  107. package/dist/types/messaging.d.ts +3 -8
  108. package/dist/types/messaging.d.ts.map +1 -1
  109. package/dist/types/processes.d.ts +29 -4
  110. package/dist/types/processes.d.ts.map +1 -1
  111. package/dist/types/tasks.d.ts +13 -0
  112. package/dist/types/tasks.d.ts.map +1 -0
  113. package/dist/types/tasks.js +1 -0
  114. package/dist/types/tools.d.ts +4 -1
  115. package/dist/types/tools.d.ts.map +1 -1
  116. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  117. package/dist/utils/builtinSubagents.js +38 -1
  118. package/dist/utils/cacheControlUtils.d.ts.map +1 -1
  119. package/dist/utils/cacheControlUtils.js +18 -12
  120. package/dist/utils/constants.d.ts +0 -4
  121. package/dist/utils/constants.d.ts.map +1 -1
  122. package/dist/utils/constants.js +0 -4
  123. package/dist/utils/convertMessagesForAPI.js +2 -2
  124. package/dist/utils/editUtils.d.ts +2 -11
  125. package/dist/utils/editUtils.d.ts.map +1 -1
  126. package/dist/utils/editUtils.js +52 -79
  127. package/dist/utils/messageOperations.d.ts +5 -36
  128. package/dist/utils/messageOperations.d.ts.map +1 -1
  129. package/dist/utils/messageOperations.js +9 -98
  130. package/dist/utils/nameGenerator.d.ts +1 -1
  131. package/dist/utils/nameGenerator.d.ts.map +1 -1
  132. package/dist/utils/nameGenerator.js +19 -3
  133. package/package.json +5 -5
  134. package/src/agent.ts +157 -134
  135. package/src/constants/prompts.ts +156 -65
  136. package/src/constants/tools.ts +6 -3
  137. package/src/index.ts +1 -0
  138. package/src/managers/MemoryRuleManager.ts +1 -1
  139. package/src/managers/aiManager.ts +77 -35
  140. package/src/managers/backgroundBashManager.ts +1 -0
  141. package/src/managers/backgroundTaskManager.ts +305 -0
  142. package/src/managers/foregroundTaskManager.ts +27 -0
  143. package/src/managers/lspManager.ts +3 -1
  144. package/src/managers/mcpManager.ts +6 -3
  145. package/src/managers/messageManager.ts +185 -75
  146. package/src/managers/permissionManager.ts +33 -28
  147. package/src/managers/planManager.ts +2 -2
  148. package/src/managers/pluginManager.ts +4 -3
  149. package/src/managers/slashCommandManager.ts +15 -2
  150. package/src/managers/subagentManager.ts +194 -35
  151. package/src/managers/toolManager.ts +48 -6
  152. package/src/services/GitService.ts +6 -2
  153. package/src/services/MarketplaceService.ts +30 -12
  154. package/src/services/MemoryRuleService.ts +18 -6
  155. package/src/services/aiService.ts +3 -145
  156. package/src/services/memory.ts +1 -73
  157. package/src/services/session.ts +73 -0
  158. package/src/services/taskManager.ts +188 -0
  159. package/src/tools/askUserQuestion.ts +51 -29
  160. package/src/tools/bashTool.ts +63 -196
  161. package/src/tools/editTool.ts +9 -18
  162. package/src/tools/exitPlanMode.ts +26 -2
  163. package/src/tools/globTool.ts +10 -2
  164. package/src/tools/grepTool.ts +17 -6
  165. package/src/tools/lsTool.ts +3 -1
  166. package/src/tools/multiEditTool.ts +7 -18
  167. package/src/tools/readTool.ts +17 -1
  168. package/src/tools/taskManagementTools.ts +498 -0
  169. package/src/tools/taskOutputTool.ts +196 -0
  170. package/src/tools/taskStopTool.ts +78 -0
  171. package/src/tools/taskTool.ts +136 -74
  172. package/src/tools/types.ts +13 -0
  173. package/src/tools/writeTool.ts +9 -2
  174. package/src/types/index.ts +1 -0
  175. package/src/types/marketplace.ts +1 -0
  176. package/src/types/messaging.ts +2 -9
  177. package/src/types/processes.ts +39 -4
  178. package/src/types/tasks.ts +13 -0
  179. package/src/types/tools.ts +4 -1
  180. package/src/utils/builtinSubagents.ts +47 -1
  181. package/src/utils/cacheControlUtils.ts +26 -18
  182. package/src/utils/constants.ts +0 -5
  183. package/src/utils/convertMessagesForAPI.ts +2 -2
  184. package/src/utils/editUtils.ts +65 -103
  185. package/src/utils/messageOperations.ts +12 -136
  186. package/src/utils/nameGenerator.ts +20 -3
  187. package/dist/tools/todoWriteTool.d.ts +0 -6
  188. package/dist/tools/todoWriteTool.d.ts.map +0 -1
  189. package/dist/tools/todoWriteTool.js +0 -220
  190. package/src/tools/todoWriteTool.ts +0 -257
package/dist/agent.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { type MessageManagerCallbacks } from "./managers/messageManager.js";
2
2
  import { type SubagentManagerCallbacks } from "./managers/subagentManager.js";
3
3
  import { type McpManagerCallbacks } from "./managers/mcpManager.js";
4
- import { type BackgroundBashManagerCallbacks } from "./managers/backgroundBashManager.js";
4
+ import { type BackgroundTaskManagerCallbacks } from "./managers/backgroundTaskManager.js";
5
5
  import type { SlashCommand, CustomSlashCommand, ILspManager, PluginConfig } from "./types/index.js";
6
- import type { Message, Logger, McpServerStatus, GatewayConfig, ModelConfig, Usage, PermissionMode, PermissionCallback } from "./types/index.js";
6
+ import type { Message, Logger, McpServerStatus, GatewayConfig, ModelConfig, Usage, PermissionMode, PermissionCallback, BackgroundTask, ForegroundTask } from "./types/index.js";
7
7
  import { ClientOptions } from "openai";
8
8
  /**
9
9
  * Configuration options for Agent instances
@@ -44,14 +44,18 @@ export interface AgentOptions {
44
44
  /**Optional local plugins to load */
45
45
  plugins?: PluginConfig[];
46
46
  }
47
- export interface AgentCallbacks extends MessageManagerCallbacks, BackgroundBashManagerCallbacks, McpManagerCallbacks, SubagentManagerCallbacks {
47
+ export interface AgentCallbacks extends MessageManagerCallbacks, BackgroundTaskManagerCallbacks, McpManagerCallbacks, SubagentManagerCallbacks {
48
+ onTasksChange?: (tasks: BackgroundTask[]) => void;
49
+ onSessionTasksChange?: (tasks: import("./types/tasks.js").Task[]) => void;
48
50
  onPermissionModeChange?: (mode: PermissionMode) => void;
51
+ onSubagentLatestTotalTokensChange?: (subagentId: string, tokens: number) => void;
52
+ onBackgroundCurrentTask?: () => void;
49
53
  }
50
54
  export declare class Agent {
51
55
  private messageManager;
52
56
  private aiManager;
53
57
  private bashManager;
54
- private backgroundBashManager;
58
+ private backgroundTaskManager;
55
59
  private logger?;
56
60
  private toolManager;
57
61
  private mcpManager;
@@ -66,6 +70,8 @@ export declare class Agent {
66
70
  private reversionManager;
67
71
  private memoryRuleManager;
68
72
  private liveConfigManager;
73
+ private taskManager;
74
+ private foregroundTaskManager;
69
75
  private configurationService;
70
76
  private workdir;
71
77
  private systemPrompt?;
@@ -103,7 +109,6 @@ export declare class Agent {
103
109
  */
104
110
  private addUsage;
105
111
  get latestTotalTokens(): number;
106
- get userInputHistory(): string[];
107
112
  /** Get working directory */
108
113
  get workingDirectory(): string;
109
114
  /** Get project memory content */
@@ -111,7 +116,7 @@ export declare class Agent {
111
116
  /** Get user memory content */
112
117
  get userMemory(): string;
113
118
  /** Get combined memory content (project + user + modular rules) */
114
- get combinedMemory(): string;
119
+ getCombinedMemory(): Promise<string>;
115
120
  /** Get AI loading status */
116
121
  get isLoading(): boolean;
117
122
  /** Get message compression status */
@@ -126,6 +131,14 @@ export declare class Agent {
126
131
  } | null;
127
132
  /** Kill background bash shell */
128
133
  killBackgroundShell(id: string): boolean;
134
+ /** Get background task output */
135
+ getBackgroundTaskOutput(id: string, filter?: string): {
136
+ stdout: string;
137
+ stderr: string;
138
+ status: string;
139
+ } | null;
140
+ /** Stop background task */
141
+ stopBackgroundTask(id: string): boolean;
129
142
  /**
130
143
  * Static async factory method for creating Agent instances
131
144
  *
@@ -188,16 +201,25 @@ export declare class Agent {
188
201
  abortAIMessage(): void;
189
202
  /** Execute bash command */
190
203
  executeBashCommand(command: string): Promise<void>;
191
- /** Clear messages and input history */
192
204
  clearMessages(): void;
193
205
  /** Unified interrupt method, interrupts both AI messages and command execution */
194
206
  abortMessage(): void;
195
- /** Add to input history */
196
- private addToInputHistory;
197
207
  /** Interrupt bash command execution */
198
208
  abortBashCommand(): void;
199
209
  /** Interrupt slash command execution */
200
210
  abortSlashCommand(): void;
211
+ /**
212
+ * Register a foreground task that can be backgrounded
213
+ */
214
+ registerForegroundTask(task: ForegroundTask): void;
215
+ /**
216
+ * Unregister a foreground task
217
+ */
218
+ unregisterForegroundTask(id: string): void;
219
+ /**
220
+ * Background the current foreground task
221
+ */
222
+ backgroundCurrentTask(): Promise<void>;
201
223
  /** Destroy managers, clean up resources */
202
224
  destroy(): Promise<void>;
203
225
  /**
@@ -239,8 +261,6 @@ export declare class Agent {
239
261
  path: string;
240
262
  mimeType: string;
241
263
  }>): Promise<void>;
242
- /** Save memory to project or user memory file */
243
- saveMemory(message: string, type: "project" | "user"): Promise<void>;
244
264
  /** Get all MCP server status */
245
265
  getMcpServers(): McpServerStatus[];
246
266
  /** Connect MCP server */
@@ -275,6 +295,13 @@ export declare class Agent {
275
295
  * @param index - The index of the user message to truncate to.
276
296
  */
277
297
  truncateHistory(index: number): Promise<void>;
298
+ /**
299
+ * Get the full message thread including parent sessions
300
+ */
301
+ getFullMessageThread(): Promise<{
302
+ messages: Message[];
303
+ sessionIds: string[];
304
+ }>;
278
305
  /**
279
306
  * Get the current plan file path (for testing and UI)
280
307
  */
@@ -297,5 +324,9 @@ export declare class Agent {
297
324
  * @param mode - The current effective permission mode
298
325
  */
299
326
  private handlePlanModeTransition;
327
+ /**
328
+ * Get the current task list ID
329
+ */
330
+ get taskListId(): string;
300
331
  }
301
332
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGhF,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,eAAe,EACf,aAAa,EACb,WAAW,EACX,KAAK,EACL,cAAc,EACd,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAE3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,aAAa,CAAC,OA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B;IACtB,oBAAoB,IAAI,IAAI;IAInC,iCAAiC;IAC1B,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI1E,8BAA8B;IACvB,iBAAiB,IAAI,kBAAkB,EAAE;IAIhD;;OAEG;IACI,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAIxD;;OAEG;IACI,iBAAiB,IAAI,cAAc;IAI1C;;;OAGG;IACI,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IASpD;;;OAGG;IACU,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D;;OAEG;IACU,oBAAoB,IAAI,OAAO,CAAC;QAC3C,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IAIF;;OAEG;IACI,eAAe,IAAI,MAAM,GAAG,SAAS;IAI5C;;OAEG;IACI,eAAe,IAAI,MAAM,EAAE;IAIlC;;OAEG;IACU,eAAe,CAC1B,OAAO,EAAE,OAAO,wBAAwB,EAAE,qBAAqB,GAC9D,OAAO,CAAC,OAAO,wBAAwB,EAAE,kBAAkB,CAAC;IAI/D;;;OAGG;IACU,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC3D;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;OAEG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;CACF"}
package/dist/agent.js CHANGED
@@ -1,12 +1,12 @@
1
+ import { ForegroundTaskManager } from "./managers/foregroundTaskManager.js";
1
2
  import { MessageManager, } from "./managers/messageManager.js";
2
3
  import { AIManager } from "./managers/aiManager.js";
3
4
  import { ToolManager } from "./managers/toolManager.js";
4
5
  import { SubagentManager, } from "./managers/subagentManager.js";
5
- import * as memory from "./services/memory.js";
6
6
  import { McpManager } from "./managers/mcpManager.js";
7
7
  import { LspManager } from "./managers/lspManager.js";
8
8
  import { BashManager } from "./managers/bashManager.js";
9
- import { BackgroundBashManager, } from "./managers/backgroundBashManager.js";
9
+ import { BackgroundTaskManager, } from "./managers/backgroundTaskManager.js";
10
10
  import { SlashCommandManager } from "./managers/slashCommandManager.js";
11
11
  import { PluginManager } from "./managers/pluginManager.js";
12
12
  import { HookManager } from "./managers/hookManager.js";
@@ -18,6 +18,7 @@ import { MemoryRuleManager } from "./managers/MemoryRuleManager.js";
18
18
  import { LiveConfigManager } from "./managers/liveConfigManager.js";
19
19
  import { configValidator } from "./utils/configValidator.js";
20
20
  import { SkillManager } from "./managers/skillManager.js";
21
+ import { TaskManager } from "./services/taskManager.js";
21
22
  import { loadSessionFromJsonl, handleSessionRestoration, } from "./services/session.js";
22
23
  import { setGlobalLogger } from "./utils/globalLogger.js";
23
24
  import { ConfigurationService } from "./services/configurationService.js";
@@ -63,8 +64,47 @@ export class Agent {
63
64
  this.stream = stream; // Save streaming mode flag
64
65
  // Store options for dynamic configuration resolution
65
66
  this.options = options;
66
- this.backgroundBashManager = new BackgroundBashManager({
67
- callbacks,
67
+ this.foregroundTaskManager = new ForegroundTaskManager();
68
+ // Initialize memory rule manager
69
+ this.memoryRuleManager = new MemoryRuleManager({
70
+ workdir: this.workdir,
71
+ });
72
+ // Initialize MessageManager
73
+ this.messageManager = new MessageManager({
74
+ callbacks: {
75
+ ...callbacks,
76
+ onSessionIdChange: (sessionId) => {
77
+ // When session ID changes (e.g. due to compression),
78
+ // we update the task manager to use the root session ID
79
+ // to ensure the task list remains consistent.
80
+ this.taskManager.setTaskListId(this.messageManager.getRootSessionId());
81
+ callbacks.onSessionIdChange?.(sessionId);
82
+ },
83
+ onSubagentTaskStopRequested: (subagentId) => {
84
+ this.backgroundTaskManager.stopTask(subagentId);
85
+ },
86
+ },
87
+ workdir: this.workdir,
88
+ logger: this.logger,
89
+ memoryRuleManager: this.memoryRuleManager,
90
+ });
91
+ // Resolve taskListId once during construction to ensure stability
92
+ const resolvedTaskListId = this.configurationService.getEnvironmentVars().WAVE_TASK_LIST_ID ||
93
+ process.env.WAVE_TASK_LIST_ID ||
94
+ this.messageManager.getRootSessionId();
95
+ this.taskManager = new TaskManager(resolvedTaskListId);
96
+ this.taskManager.on("tasksChange", async () => {
97
+ const tasks = await this.taskManager.listTasks();
98
+ this.options.callbacks?.onSessionTasksChange?.(tasks);
99
+ });
100
+ // Initialize BackgroundTaskManager
101
+ this.backgroundTaskManager = new BackgroundTaskManager({
102
+ callbacks: {
103
+ ...callbacks,
104
+ onTasksChange: (tasks) => {
105
+ callbacks.onTasksChange?.(tasks);
106
+ },
107
+ },
68
108
  workdir: this.workdir,
69
109
  });
70
110
  this.mcpManager = new McpManager({ callbacks, logger: this.logger }); // Initialize MCP manager
@@ -88,18 +128,8 @@ export class Agent {
88
128
  logger: this.logger,
89
129
  workdir: this.workdir,
90
130
  });
91
- // Initialize MessageManager
92
- this.messageManager = new MessageManager({
93
- callbacks,
94
- workdir: this.workdir,
95
- logger: this.logger,
96
- });
97
- // Initialize ReversionManager
131
+ // ReversionManager depends on MessageManager
98
132
  this.reversionManager = new ReversionManager(new ReversionService(this.messageManager.getTranscriptPath()));
99
- // Initialize memory rule manager
100
- this.memoryRuleManager = new MemoryRuleManager({
101
- workdir: this.workdir,
102
- });
103
133
  // Create a wrapper for canUseTool that triggers notification hooks
104
134
  const canUseToolWithNotification = options.canUseTool
105
135
  ? async (context) => {
@@ -146,6 +176,9 @@ export class Agent {
146
176
  reversionManager: this.reversionManager,
147
177
  permissionMode: options.permissionMode, // Let PermissionManager handle defaultMode resolution
148
178
  canUseToolCallback: canUseToolWithNotification,
179
+ taskManager: this.taskManager,
180
+ backgroundTaskManager: this.backgroundTaskManager,
181
+ foregroundTaskManager: this.foregroundTaskManager,
149
182
  }); // Initialize tool registry with permission support
150
183
  this.liveConfigManager = new LiveConfigManager({
151
184
  workdir: this.workdir,
@@ -167,6 +200,7 @@ export class Agent {
167
200
  onSubagentAssistantReasoningUpdated: callbacks.onSubagentAssistantReasoningUpdated,
168
201
  onSubagentToolBlockUpdated: callbacks.onSubagentToolBlockUpdated,
169
202
  onSubagentMessagesChange: callbacks.onSubagentMessagesChange,
203
+ onSubagentLatestTotalTokensChange: callbacks.onSubagentLatestTotalTokensChange,
170
204
  }, // Pass subagent callbacks for forwarding
171
205
  logger: this.logger,
172
206
  getGatewayConfig: () => this.getGatewayConfig(),
@@ -175,13 +209,17 @@ export class Agent {
175
209
  getLanguage: () => this.getLanguage(),
176
210
  hookManager: this.hookManager,
177
211
  onUsageAdded: (usage) => this.addUsage(usage),
212
+ backgroundTaskManager: this.backgroundTaskManager,
213
+ taskManager: this.taskManager,
214
+ memoryRuleManager: this.memoryRuleManager,
178
215
  });
179
216
  // Initialize AI manager with resolved configuration
180
217
  this.aiManager = new AIManager({
181
218
  messageManager: this.messageManager,
182
219
  toolManager: this.toolManager,
220
+ taskManager: this.taskManager,
183
221
  logger: this.logger,
184
- backgroundBashManager: this.backgroundBashManager,
222
+ backgroundTaskManager: this.backgroundTaskManager,
185
223
  hookManager: this.hookManager,
186
224
  permissionManager: this.permissionManager,
187
225
  callbacks: {
@@ -204,6 +242,8 @@ export class Agent {
204
242
  this.slashCommandManager = new SlashCommandManager({
205
243
  messageManager: this.messageManager,
206
244
  aiManager: this.aiManager,
245
+ backgroundTaskManager: this.backgroundTaskManager,
246
+ taskManager: this.taskManager,
207
247
  workdir: this.workdir,
208
248
  logger: this.logger,
209
249
  });
@@ -266,9 +306,6 @@ export class Agent {
266
306
  get latestTotalTokens() {
267
307
  return this.messageManager.getlatestTotalTokens();
268
308
  }
269
- get userInputHistory() {
270
- return this.messageManager.getUserInputHistory();
271
- }
272
309
  /** Get working directory */
273
310
  get workingDirectory() {
274
311
  return this.workdir;
@@ -282,31 +319,8 @@ export class Agent {
282
319
  return this._userMemoryContent;
283
320
  }
284
321
  /** Get combined memory content (project + user + modular rules) */
285
- get combinedMemory() {
286
- let combined = "";
287
- if (this._projectMemoryContent.trim()) {
288
- combined += this._projectMemoryContent;
289
- }
290
- if (this._userMemoryContent.trim()) {
291
- if (combined) {
292
- combined += "\n\n";
293
- }
294
- combined += this._userMemoryContent;
295
- }
296
- // Add modular memory rules
297
- const filesInContext = this.messageManager.getFilesInContext();
298
- const activeRules = this.memoryRuleManager.getActiveRules(filesInContext);
299
- if (activeRules.length > 0) {
300
- this.logger?.debug(`Active modular rules (${activeRules.length}): ${activeRules.map((r) => r.id).join(", ")}`);
301
- if (combined) {
302
- combined += "\n\n";
303
- }
304
- combined += activeRules.map((r) => r.content).join("\n\n");
305
- }
306
- else {
307
- this.logger?.debug("No active modular rules for current context");
308
- }
309
- return combined;
322
+ async getCombinedMemory() {
323
+ return this.messageManager.getCombinedMemory();
310
324
  }
311
325
  /** Get AI loading status */
312
326
  get isLoading() {
@@ -322,11 +336,19 @@ export class Agent {
322
336
  }
323
337
  /** Get background bash shell output */
324
338
  getBackgroundShellOutput(id, filter) {
325
- return this.backgroundBashManager.getOutput(id, filter);
339
+ return this.backgroundTaskManager.getOutput(id, filter);
326
340
  }
327
341
  /** Kill background bash shell */
328
342
  killBackgroundShell(id) {
329
- return this.backgroundBashManager.killShell(id);
343
+ return this.backgroundTaskManager.stopTask(id);
344
+ }
345
+ /** Get background task output */
346
+ getBackgroundTaskOutput(id, filter) {
347
+ return this.backgroundTaskManager.getOutput(id, filter);
348
+ }
349
+ /** Stop background task */
350
+ stopBackgroundTask(id) {
351
+ return this.backgroundTaskManager.stopTask(id);
330
352
  }
331
353
  /**
332
354
  * Static async factory method for creating Agent instances
@@ -529,8 +551,14 @@ export class Agent {
529
551
  this.rebuildUsageFromMessages(sessionToRestore?.messages || []);
530
552
  // After main session is restored, restore any associated subagent sessions
531
553
  await this.restoreSubagentSessions(sessionToRestore?.messages || []);
532
- if (sessionToRestore)
554
+ if (sessionToRestore) {
533
555
  this.messageManager.initializeFromSession(sessionToRestore);
556
+ // Update task manager with the root session ID to ensure continuity across compressions
557
+ this.taskManager.setTaskListId(sessionToRestore.rootSessionId || sessionToRestore.id);
558
+ // After session is initialized, load tasks for the session
559
+ const tasks = await this.taskManager.listTasks();
560
+ this.options.callbacks?.onSessionTasksChange?.(tasks);
561
+ }
534
562
  }
535
563
  }
536
564
  /**
@@ -622,17 +650,19 @@ export class Agent {
622
650
  await this.restoreSubagentSessions(sessionData.messages);
623
651
  // 6. Initialize session state last
624
652
  this.messageManager.initializeFromSession(sessionData);
653
+ // Update task manager with the root session ID to ensure continuity across compressions
654
+ this.taskManager.setTaskListId(sessionData.rootSessionId || sessionData.id);
655
+ // 7. Load tasks for the restored session
656
+ const tasks = await this.taskManager.listTasks();
657
+ this.options.callbacks?.onSessionTasksChange?.(tasks);
625
658
  }
626
659
  abortAIMessage() {
627
660
  this.aiManager.abortAIMessage();
628
661
  }
629
662
  /** Execute bash command */
630
663
  async executeBashCommand(command) {
631
- // Add user message to history (but not displayed in UI)
632
- this.addToInputHistory(`!${command}`);
633
664
  await this.bashManager?.executeCommand(command);
634
665
  }
635
- /** Clear messages and input history */
636
666
  clearMessages() {
637
667
  this.messageManager.clearMessages();
638
668
  }
@@ -642,10 +672,6 @@ export class Agent {
642
672
  this.abortBashCommand();
643
673
  this.abortSlashCommand();
644
674
  }
645
- /** Add to input history */
646
- addToInputHistory(input) {
647
- this.messageManager.addToInputHistory(input);
648
- }
649
675
  /** Interrupt bash command execution */
650
676
  abortBashCommand() {
651
677
  this.bashManager?.abortCommand();
@@ -654,14 +680,33 @@ export class Agent {
654
680
  abortSlashCommand() {
655
681
  this.slashCommandManager.abortCurrentCommand();
656
682
  }
683
+ /**
684
+ * Register a foreground task that can be backgrounded
685
+ */
686
+ registerForegroundTask(task) {
687
+ this.foregroundTaskManager.registerForegroundTask(task);
688
+ }
689
+ /**
690
+ * Unregister a foreground task
691
+ */
692
+ unregisterForegroundTask(id) {
693
+ this.foregroundTaskManager.unregisterForegroundTask(id);
694
+ }
695
+ /**
696
+ * Background the current foreground task
697
+ */
698
+ async backgroundCurrentTask() {
699
+ await this.foregroundTaskManager.backgroundCurrentTask();
700
+ this.options.callbacks?.onBackgroundCurrentTask?.();
701
+ }
657
702
  /** Destroy managers, clean up resources */
658
703
  async destroy() {
659
704
  await this.messageManager.saveSession();
660
705
  this.abortAIMessage(); // This will abort tools including Task tool (subagents)
661
706
  this.abortBashCommand();
662
707
  this.abortSlashCommand();
663
- // Cleanup background bash manager
664
- this.backgroundBashManager.cleanup();
708
+ // Cleanup background task manager
709
+ this.backgroundTaskManager.cleanup();
665
710
  // Cleanup MCP connections
666
711
  await this.mcpManager.cleanup();
667
712
  // Cleanup LSP connections
@@ -730,16 +775,12 @@ export class Agent {
730
775
  if (isValid && commandId !== undefined) {
731
776
  // Execute valid slash command
732
777
  await this.slashCommandManager.executeCommand(commandId, args);
733
- // Add slash command to history
734
- this.addToInputHistory(command);
735
778
  return;
736
779
  }
737
780
  // If command doesn't exist, continue as normal message processing
738
781
  // Don't add to history, let normal message processing logic below handle it
739
782
  }
740
783
  // Handle normal AI message
741
- // Add user message to history
742
- this.addToInputHistory(content);
743
784
  // Add user message first, will automatically sync to UI
744
785
  this.messageManager.addUserMessage({
745
786
  content,
@@ -783,60 +824,6 @@ export class Agent {
783
824
  // Loading state will be automatically updated by the useEffect that watches messages
784
825
  }
785
826
  }
786
- /** Save memory to project or user memory file */
787
- async saveMemory(message, type) {
788
- try {
789
- // Ensure the message starts with # for memory functions
790
- const formattedMessage = message.startsWith("#")
791
- ? message
792
- : `#${message}`;
793
- if (type === "project") {
794
- await memory.addMemory(formattedMessage, this.workdir);
795
- // Update internal state after successful save
796
- this._projectMemoryContent = await memory.readMemoryFile(this.workdir);
797
- }
798
- else {
799
- await memory.addUserMemory(formattedMessage);
800
- // Update internal state after successful save
801
- this._userMemoryContent = await memory.getUserMemoryContent();
802
- }
803
- // Add successful MemoryBlock to the last assistant message
804
- const memoryText = message.substring(1).trim();
805
- const typeLabel = type === "project" ? "Project Memory" : "User Memory";
806
- const storagePath = "AGENTS.md";
807
- const messages = this.messageManager.getMessages();
808
- const lastMessage = messages[messages.length - 1];
809
- if (lastMessage && lastMessage.role === "assistant") {
810
- lastMessage.blocks.push({
811
- type: "memory",
812
- content: `${typeLabel}: ${memoryText}`,
813
- isSuccess: true,
814
- memoryType: type,
815
- storagePath,
816
- });
817
- this.messageManager.setMessages(messages);
818
- }
819
- }
820
- catch (error) {
821
- // Add failed MemoryBlock to the last assistant message
822
- const memoryText = message.substring(1).trim();
823
- const typeLabel = type === "project" ? "Project Memory" : "User Memory";
824
- const storagePath = "AGENTS.md";
825
- const errorMessage = error instanceof Error ? error.message : String(error);
826
- const messages = this.messageManager.getMessages();
827
- const lastMessage = messages[messages.length - 1];
828
- if (lastMessage && lastMessage.role === "assistant") {
829
- lastMessage.blocks.push({
830
- type: "memory",
831
- content: `${typeLabel}: ${memoryText} - Error: ${errorMessage}`,
832
- isSuccess: false,
833
- memoryType: type,
834
- storagePath,
835
- });
836
- this.messageManager.setMessages(messages);
837
- }
838
- }
839
- }
840
827
  // ========== MCP Management Methods ==========
841
828
  /** Get all MCP server status */
842
829
  getMcpServers() {
@@ -900,6 +887,12 @@ export class Agent {
900
887
  async truncateHistory(index) {
901
888
  await this.messageManager.truncateHistory(index, this.reversionManager);
902
889
  }
890
+ /**
891
+ * Get the full message thread including parent sessions
892
+ */
893
+ async getFullMessageThread() {
894
+ return this.messageManager.getFullMessageThread();
895
+ }
903
896
  /**
904
897
  * Get the current plan file path (for testing and UI)
905
898
  */
@@ -958,7 +951,7 @@ export class Agent {
958
951
  handlePlanModeTransition(mode) {
959
952
  if (mode === "plan") {
960
953
  this.planManager
961
- .getOrGeneratePlanFilePath()
954
+ .getOrGeneratePlanFilePath(this.messageManager.getRootSessionId())
962
955
  .then(({ path }) => {
963
956
  this.logger?.debug("Plan file path generated", { path });
964
957
  this.permissionManager.setPlanFilePath(path);
@@ -971,4 +964,10 @@ export class Agent {
971
964
  this.permissionManager.setPlanFilePath(undefined);
972
965
  }
973
966
  }
967
+ /**
968
+ * Get the current task list ID
969
+ */
970
+ get taskListId() {
971
+ return this.taskManager.getTaskListId();
972
+ }
974
973
  }
@@ -1,20 +1,24 @@
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): 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 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
9
  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;
10
+ 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.";
11
+ export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
12
+ workdir?: string;
13
+ isGitRepo?: string;
14
+ platform?: string;
15
+ osVersion?: string;
16
+ today?: string;
17
+ memory?: string;
18
+ language?: string;
19
+ planMode?: {
20
+ planFilePath: string;
21
+ planExists: boolean;
18
22
  };
19
- }[]): string;
23
+ }): string;
20
24
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/constants/prompts.ts"],"names":[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