wave-agent-sdk 0.6.1 → 0.6.3

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 (73) hide show
  1. package/dist/agent.d.ts +0 -5
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +3 -67
  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/managers/aiManager.d.ts.map +1 -1
  8. package/dist/managers/aiManager.js +9 -25
  9. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  10. package/dist/managers/backgroundTaskManager.js +4 -0
  11. package/dist/managers/messageManager.d.ts +0 -18
  12. package/dist/managers/messageManager.d.ts.map +1 -1
  13. package/dist/managers/messageManager.js +1 -36
  14. package/dist/managers/reversionManager.d.ts.map +1 -1
  15. package/dist/managers/reversionManager.js +23 -2
  16. package/dist/managers/slashCommandManager.js +1 -1
  17. package/dist/managers/subagentManager.d.ts +4 -14
  18. package/dist/managers/subagentManager.d.ts.map +1 -1
  19. package/dist/managers/subagentManager.js +35 -109
  20. package/dist/{constants/prompts.d.ts → prompts/index.d.ts} +7 -8
  21. package/dist/prompts/index.d.ts.map +1 -0
  22. package/dist/{constants/prompts.js → prompts/index.js} +127 -11
  23. package/dist/services/aiService.js +1 -1
  24. package/dist/services/taskManager.d.ts +5 -1
  25. package/dist/services/taskManager.d.ts.map +1 -1
  26. package/dist/services/taskManager.js +6 -0
  27. package/dist/tools/bashTool.d.ts.map +1 -1
  28. package/dist/tools/bashTool.js +34 -29
  29. package/dist/tools/exitPlanMode.js +1 -1
  30. package/dist/tools/taskManagementTools.d.ts.map +1 -1
  31. package/dist/tools/taskManagementTools.js +8 -0
  32. package/dist/tools/taskTool.d.ts.map +1 -1
  33. package/dist/tools/taskTool.js +32 -2
  34. package/dist/tools/types.d.ts +2 -0
  35. package/dist/tools/types.d.ts.map +1 -1
  36. package/dist/types/messaging.d.ts +1 -11
  37. package/dist/types/messaging.d.ts.map +1 -1
  38. package/dist/types/processes.d.ts +5 -0
  39. package/dist/types/processes.d.ts.map +1 -1
  40. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  41. package/dist/utils/builtinSubagents.js +28 -50
  42. package/dist/utils/editUtils.d.ts.map +1 -1
  43. package/dist/utils/editUtils.js +2 -2
  44. package/dist/utils/gitUtils.d.ts +7 -0
  45. package/dist/utils/gitUtils.d.ts.map +1 -0
  46. package/dist/utils/gitUtils.js +24 -0
  47. package/dist/utils/messageOperations.d.ts +1 -23
  48. package/dist/utils/messageOperations.d.ts.map +1 -1
  49. package/dist/utils/messageOperations.js +0 -49
  50. package/package.json +1 -1
  51. package/src/agent.ts +3 -89
  52. package/src/constants/subagents.ts +4 -0
  53. package/src/managers/aiManager.ts +9 -25
  54. package/src/managers/backgroundTaskManager.ts +5 -0
  55. package/src/managers/messageManager.ts +0 -80
  56. package/src/managers/reversionManager.ts +26 -2
  57. package/src/managers/slashCommandManager.ts +1 -1
  58. package/src/managers/subagentManager.ts +42 -145
  59. package/src/{constants/prompts.ts → prompts/index.ts} +136 -13
  60. package/src/services/aiService.ts +1 -1
  61. package/src/services/taskManager.ts +8 -1
  62. package/src/tools/bashTool.ts +35 -30
  63. package/src/tools/exitPlanMode.ts +1 -1
  64. package/src/tools/taskManagementTools.ts +18 -0
  65. package/src/tools/taskTool.ts +39 -1
  66. package/src/tools/types.ts +2 -0
  67. package/src/types/messaging.ts +0 -12
  68. package/src/types/processes.ts +5 -0
  69. package/src/utils/builtinSubagents.ts +41 -51
  70. package/src/utils/editUtils.ts +2 -6
  71. package/src/utils/gitUtils.ts +24 -0
  72. package/src/utils/messageOperations.ts +1 -93
  73. package/dist/constants/prompts.d.ts.map +0 -1
@@ -13,7 +13,33 @@ export const bashTool = {
13
13
  type: "function",
14
14
  function: {
15
15
  name: BASH_TOOL_NAME,
16
- description: `Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
16
+ description: "Run shell command",
17
+ parameters: {
18
+ type: "object",
19
+ properties: {
20
+ command: {
21
+ type: "string",
22
+ description: "The command to execute",
23
+ },
24
+ timeout: {
25
+ type: "number",
26
+ description: "Optional timeout in milliseconds (max 600000)",
27
+ },
28
+ description: {
29
+ type: "string",
30
+ description: "Clear, concise description of what this command does in 5-10 words.",
31
+ },
32
+ run_in_background: {
33
+ type: "boolean",
34
+ description: `Set to true to run this command in the background. Use ${TASK_OUTPUT_TOOL_NAME} to read the output later.`,
35
+ },
36
+ },
37
+ required: ["command"],
38
+ },
39
+ },
40
+ },
41
+ prompt: () => `
42
+ Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
17
43
 
18
44
  IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
19
45
 
@@ -58,32 +84,7 @@ Usage notes:
58
84
  <bad-example>
59
85
  cd /foo/bar && pytest tests
60
86
  </bad-example>
61
- `,
62
- parameters: {
63
- type: "object",
64
- properties: {
65
- command: {
66
- type: "string",
67
- description: "The command to execute",
68
- },
69
- timeout: {
70
- type: "number",
71
- description: "Optional timeout in milliseconds (max 600000)",
72
- },
73
- description: {
74
- type: "string",
75
- description: "Clear, concise description of what this command does in 5-10 words.",
76
- },
77
- run_in_background: {
78
- type: "boolean",
79
- description: `Set to true to run this command in the background. Use ${TASK_OUTPUT_TOOL_NAME} to read the output later.`,
80
- },
81
- },
82
- required: ["command"],
83
- },
84
- },
85
- },
86
- prompt: () => `
87
+
87
88
  - 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.
88
89
  - 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 in parallel.`,
89
90
  execute: async (args, context) => {
@@ -261,12 +262,16 @@ Usage notes:
261
262
  }
262
263
  child.stdout?.on("data", (data) => {
263
264
  if (!isAborted && !isBackgrounded) {
264
- outputBuffer += stripAnsiColors(data.toString());
265
+ const chunk = stripAnsiColors(data.toString());
266
+ outputBuffer += chunk;
267
+ context.onShortResultUpdate?.(chunk.trim().split("\n").pop() || "");
265
268
  }
266
269
  });
267
270
  child.stderr?.on("data", (data) => {
268
271
  if (!isAborted && !isBackgrounded) {
269
- errorBuffer += stripAnsiColors(data.toString());
272
+ const chunk = stripAnsiColors(data.toString());
273
+ errorBuffer += chunk;
274
+ context.onShortResultUpdate?.(chunk.trim().split("\n").pop() || "");
270
275
  }
271
276
  });
272
277
  child.on("exit", (code) => {
@@ -77,7 +77,7 @@ Ensure your plan is complete and unambiguous:
77
77
  if (permissionResult.behavior === "deny") {
78
78
  return {
79
79
  success: false,
80
- content: permissionResult.message || "Plan rejected by user",
80
+ content: `User feedback: ${permissionResult.message || "Plan rejected by user"}. Please update your proposal accordingly.`,
81
81
  error: permissionResult.message ? undefined : "Plan rejected by user",
82
82
  };
83
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"taskManagementTools.d.ts","sourceRoot":"","sources":["../../src/tools/taskManagementTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AASjE,eAAO,MAAM,cAAc,EAAE,UAiH5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAyDzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAsP5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAkE1B,CAAC"}
1
+ {"version":3,"file":"taskManagementTools.d.ts","sourceRoot":"","sources":["../../src/tools/taskManagementTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AASjE,eAAO,MAAM,cAAc,EAAE,UA0H5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAyDzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UA+P5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAkE1B,CAAC"}
@@ -102,6 +102,10 @@ NOTE that you should not use this tool if there is only one trivial task to do.
102
102
  metadata: args.metadata || {},
103
103
  };
104
104
  const taskId = await taskManager.createTask(task);
105
+ if (context.reversionManager && context.messageId) {
106
+ const taskPath = taskManager.getTaskPath(taskId);
107
+ await context.reversionManager.recordSnapshot(context.messageId, taskPath, "create");
108
+ }
105
109
  return {
106
110
  success: true,
107
111
  content: `Task created with ID: ${taskId}`,
@@ -304,6 +308,10 @@ Set up task dependencies:
304
308
  content: `Task with ID ${taskId} not found.`,
305
309
  };
306
310
  }
311
+ if (context.reversionManager && context.messageId) {
312
+ const taskPath = taskManager.getTaskPath(taskId);
313
+ await context.reversionManager.recordSnapshot(context.messageId, taskPath, "modify");
314
+ }
307
315
  const updatedFields = [];
308
316
  const updatedTask = {
309
317
  ...existingTask,
@@ -1 +1 @@
1
- {"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,GAAG,UAAU,CAmM3E"}
1
+ {"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,GAAG,UAAU,CAwO3E"}
@@ -1,3 +1,4 @@
1
+ import { EXPLORE_SUBAGENT_TYPE } from "../constants/subagents.js";
1
2
  import { TASK_TOOL_NAME } from "../constants/tools.js";
2
3
  /**
3
4
  * Create a task tool plugin that uses the provided SubagentManager
@@ -51,7 +52,7 @@ export function createTaskTool(subagentManager) {
51
52
  prompt: () => `
52
53
  - When doing file search, prefer to use the ${TASK_TOOL_NAME} tool in order to reduce context usage.
53
54
  - You should proactively use the ${TASK_TOOL_NAME} tool with specialized agents when the task at hand matches the agent's description.
54
- - 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_NAME} tool with subagent_type=Explore instead of running search commands directly.`,
55
+ - 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_NAME} tool with subagent_type=${EXPLORE_SUBAGENT_TYPE} instead of running search commands directly.`,
55
56
  execute: async (args, context) => {
56
57
  return new Promise((resolve) => {
57
58
  (async () => {
@@ -98,12 +99,39 @@ export function createTaskTool(subagentManager) {
98
99
  shortResult: "Subagent not found",
99
100
  });
100
101
  }
102
+ // Set up callback to update shortResult with tool names, tool count and tokens
103
+ const updateShortResult = () => {
104
+ const messages = instance.messageManager.getMessages();
105
+ const tokens = instance.messageManager.getlatestTotalTokens();
106
+ const lastTools = instance.lastTools;
107
+ // Count tool blocks in messages
108
+ let toolCount = 0;
109
+ messages.forEach((msg) => {
110
+ msg.blocks.forEach((block) => {
111
+ if (block.type === "tool") {
112
+ toolCount++;
113
+ }
114
+ });
115
+ });
116
+ let shortResult = "";
117
+ if (lastTools.length > 0) {
118
+ shortResult += `${lastTools.join(", ")} `;
119
+ }
120
+ shortResult += `(${toolCount} tools`;
121
+ if (tokens > 0) {
122
+ shortResult += ` | ${tokens.toLocaleString()} tokens`;
123
+ }
124
+ shortResult += ")";
125
+ context.onShortResultUpdate?.(shortResult);
126
+ };
101
127
  // Create subagent instance and execute task
102
128
  const instance = await subagentManager.createInstance(configuration, {
103
129
  description,
104
130
  prompt,
105
131
  subagent_type,
106
- }, run_in_background);
132
+ }, run_in_background, updateShortResult);
133
+ // Initial update
134
+ updateShortResult();
107
135
  let isBackgrounded = false;
108
136
  // Register for backgrounding if not already in background
109
137
  if (!run_in_background && context.foregroundTaskManager) {
@@ -133,6 +161,8 @@ export function createTaskTool(subagentManager) {
133
161
  shortResult: `Task started in background: ${result}`,
134
162
  });
135
163
  }
164
+ // Cleanup subagent instance after task completion
165
+ subagentManager.cleanupInstance(instance.subagentId);
136
166
  return resolve({
137
167
  success: true,
138
168
  content: result,
@@ -50,5 +50,7 @@ export interface ToolContext {
50
50
  taskManager: import("../services/taskManager.js").TaskManager;
51
51
  /** Current session ID */
52
52
  sessionId?: string;
53
+ /** Callback to update the short result of the current tool block */
54
+ onShortResultUpdate?: (shortResult: string) => void;
53
55
  }
54
56
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAA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AAU,CAAC,EAAE,OAAO,2BAA2B,EAAE,UAAU,CAAC;IAC5D,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,iBAAiB,EAAE,WAAW,CAAC;IACnD,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,OAAO,iCAAiC,EAAE,gBAAgB,CAAC;IAC9E,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,OAAO,uBAAuB,EAAE,sBAAsB,CAAC;IAC/E,gDAAgD;IAChD,WAAW,EAAE,OAAO,4BAA4B,EAAE,WAAW,CAAC;IAC9D,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD"}
@@ -3,7 +3,6 @@
3
3
  * Dependencies: Core (Usage)
4
4
  */
5
5
  import type { Usage } from "./core.js";
6
- import type { SubagentConfiguration } from "../utils/subagentParser.js";
7
6
  export declare enum MessageSource {
8
7
  USER = "user",
9
8
  HOOK = "hook"
@@ -15,7 +14,7 @@ export interface Message {
15
14
  usage?: Usage;
16
15
  additionalFields?: Record<string, unknown>;
17
16
  }
18
- export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | CommandOutputBlock | CompressBlock | SubagentBlock | ReasoningBlock | FileHistoryBlock;
17
+ export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | CommandOutputBlock | CompressBlock | ReasoningBlock | FileHistoryBlock;
19
18
  export interface TextBlock {
20
19
  type: "text";
21
20
  content: string;
@@ -67,15 +66,6 @@ export interface CompressBlock {
67
66
  content: string;
68
67
  sessionId: string;
69
68
  }
70
- export interface SubagentBlock {
71
- type: "subagent";
72
- subagentId: string;
73
- subagentName: string;
74
- status: "active" | "completed" | "error" | "aborted";
75
- sessionId: string;
76
- configuration: SubagentConfiguration;
77
- runInBackground?: boolean;
78
- }
79
69
  export interface ReasoningBlock {
80
70
  type: "reasoning";
81
71
  content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/types/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;QAEb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAA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;OAMG;IACH,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,OAAO,gBAAgB,EAAE,YAAY,EAAE,CAAC;CACpD"}
@@ -22,6 +22,11 @@ export interface BackgroundTaskBase {
22
22
  * This allows tasks to define their own cleanup/abortion logic.
23
23
  */
24
24
  onStop?: () => void | Promise<void>;
25
+ /**
26
+ * Optional subagent ID associated with this task.
27
+ * Used for cleanup when the task is stopped.
28
+ */
29
+ subagentId?: string;
25
30
  }
26
31
  export interface BackgroundShell extends BackgroundTaskBase {
27
32
  type: "shell";
@@ -1 +1 @@
1
- {"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../src/types/processes.ts"],"names":[],"mappings":"AA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E,MAAM,GAAG,IAAI,CAAC;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"builtinSubagents.d.ts","sourceRoot":"","sources":["../../src/utils/builtinSubagents.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,EAAE,CAQ7D"}
1
+ {"version":3,"file":"builtinSubagents.d.ts","sourceRoot":"","sources":["../../src/utils/builtinSubagents.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,EAAE,CAQ7D"}
@@ -1,5 +1,6 @@
1
- import { BASH_SUBAGENT_SYSTEM_PROMPT, GENERAL_PURPOSE_SYSTEM_PROMPT, PLAN_SUBAGENT_SYSTEM_PROMPT, } from "../constants/prompts.js";
2
- import { BASH_TOOL_NAME } from "../constants/tools.js";
1
+ import { BASH_SUBAGENT_TYPE, EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, } from "../constants/subagents.js";
2
+ import { BASH_SUBAGENT_SYSTEM_PROMPT, GENERAL_PURPOSE_SYSTEM_PROMPT, PLAN_SUBAGENT_SYSTEM_PROMPT, EXPLORE_SUBAGENT_SYSTEM_PROMPT, } from "../prompts/index.js";
3
+ import { BASH_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, LS_TOOL_NAME, LSP_TOOL_NAME, } from "../constants/tools.js";
3
4
  /**
4
5
  * Get all built-in subagent configurations
5
6
  * Built-in subagents have priority 3 (lowest) and can be overridden by user/project configs
@@ -19,12 +20,12 @@ export function getBuiltinSubagents() {
19
20
  */
20
21
  function createBashSubagent() {
21
22
  return {
22
- name: "Bash",
23
+ name: BASH_SUBAGENT_TYPE,
23
24
  description: "Command execution specialist for running bash commands. Use this for git operations, command execution, and other terminal tasks.",
24
25
  systemPrompt: BASH_SUBAGENT_SYSTEM_PROMPT,
25
26
  tools: [BASH_TOOL_NAME],
26
27
  model: "inherit",
27
- filePath: "<builtin:Bash>",
28
+ filePath: `<builtin:${BASH_SUBAGENT_TYPE}>`,
28
29
  scope: "builtin",
29
30
  priority: 3,
30
31
  };
@@ -35,10 +36,10 @@ function createBashSubagent() {
35
36
  */
36
37
  function createGeneralPurposeSubagent() {
37
38
  return {
38
- name: "general-purpose",
39
+ name: GENERAL_PURPOSE_SUBAGENT_TYPE,
39
40
  description: "General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.",
40
41
  systemPrompt: GENERAL_PURPOSE_SYSTEM_PROMPT,
41
- filePath: "<builtin:general-purpose>",
42
+ filePath: `<builtin:${GENERAL_PURPOSE_SUBAGENT_TYPE}>`,
42
43
  scope: "builtin",
43
44
  priority: 3,
44
45
  };
@@ -48,52 +49,22 @@ function createGeneralPurposeSubagent() {
48
49
  * Specialized for codebase exploration and file search tasks
49
50
  */
50
51
  function createExploreSubagent() {
51
- const systemPrompt = `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
52
-
53
- === CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
54
- This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
55
- - Creating new files (no Write, touch, or file creation of any kind)
56
- - Modifying existing files (no Edit operations)
57
- - Deleting files (no rm or deletion)
58
- - Moving or copying files (no mv or cp)
59
- - Creating temporary files anywhere, including /tmp
60
- - Using redirect operators (>, >>, |) or heredocs to write to files
61
- - Running ANY commands that change system state
62
-
63
- Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
64
-
65
- Your strengths:
66
- - Rapidly finding files using glob patterns
67
- - Searching code and text with powerful regex patterns
68
- - Reading and analyzing file contents
69
- - Using Language Server Protocol (LSP) for deep code intelligence (definitions, references, etc.)
70
-
71
- Guidelines:
72
- - Use Glob for broad file pattern matching
73
- - Use Grep for searching file contents with regex
74
- - Use Read when you know the specific file path you need to read
75
- - Use LSP for code intelligence features like finding definitions, references, implementations, and symbols. This is especially useful for understanding complex code relationships.
76
- - Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
77
- - NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
78
- - Adapt your search approach based on the thoroughness level specified by the caller
79
- - Return file paths as absolute paths in your final response
80
- - For clear communication, avoid using emojis
81
- - Communicate your final report directly as a regular message - do NOT attempt to create files
82
-
83
- NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
84
- - Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
85
- - Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
86
-
87
- Complete the user's search request efficiently and report your findings clearly.`;
88
52
  // Define allowed tools for read-only operations
89
- const allowedTools = ["Glob", "Grep", "Read", "Bash", "LS", "LSP"];
53
+ const allowedTools = [
54
+ GLOB_TOOL_NAME,
55
+ GREP_TOOL_NAME,
56
+ READ_TOOL_NAME,
57
+ BASH_TOOL_NAME,
58
+ LS_TOOL_NAME,
59
+ LSP_TOOL_NAME,
60
+ ];
90
61
  return {
91
- name: "Explore",
62
+ name: EXPLORE_SUBAGENT_TYPE,
92
63
  description: 'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',
93
- systemPrompt,
64
+ systemPrompt: EXPLORE_SUBAGENT_SYSTEM_PROMPT,
94
65
  tools: allowedTools,
95
66
  model: "fastModel", // Special value that will use parent's fastModel
96
- filePath: "<builtin:Explore>",
67
+ filePath: `<builtin:${EXPLORE_SUBAGENT_TYPE}>`,
97
68
  scope: "builtin",
98
69
  priority: 3, // Lowest priority - can be overridden by user configs
99
70
  };
@@ -104,14 +75,21 @@ Complete the user's search request efficiently and report your findings clearly.
104
75
  */
105
76
  function createPlanSubagent() {
106
77
  // Define allowed tools for read-only operations
107
- const allowedTools = ["Glob", "Grep", "Read", "Bash", "LS", "LSP"];
78
+ const allowedTools = [
79
+ GLOB_TOOL_NAME,
80
+ GREP_TOOL_NAME,
81
+ READ_TOOL_NAME,
82
+ BASH_TOOL_NAME,
83
+ LS_TOOL_NAME,
84
+ LSP_TOOL_NAME,
85
+ ];
108
86
  return {
109
- name: "Plan",
87
+ name: PLAN_SUBAGENT_TYPE,
110
88
  description: "Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.",
111
89
  systemPrompt: PLAN_SUBAGENT_SYSTEM_PROMPT,
112
90
  tools: allowedTools,
113
91
  model: "inherit", // Uses parent agent's model
114
- filePath: "<builtin:Plan>",
92
+ filePath: `<builtin:${PLAN_SUBAGENT_TYPE}>`,
115
93
  scope: "builtin",
116
94
  priority: 3, // Lowest priority - can be overridden by user configs
117
95
  };
@@ -1 +1 @@
1
- {"version":3,"file":"editUtils.d.ts","sourceRoot":"","sources":["../../src/utils/editUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAwER"}
1
+ {"version":3,"file":"editUtils.d.ts","sourceRoot":"","sources":["../../src/utils/editUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,CAoER"}
@@ -60,8 +60,8 @@ export function analyzeEditMismatch(content, searchString) {
60
60
  reportLines.push(`${lineNum.toString().padStart(4)} | ${actualLine}`);
61
61
  }
62
62
  else {
63
- reportLines.push(`${lineNum.toString().padStart(4)} | - ${expectedLine} (expected)`);
64
- reportLines.push(`${lineNum.toString().padStart(4)} | + ${actualLine} (actual)`);
63
+ reportLines.push(`${lineNum.toString().padStart(4)} | - ${expectedLine}`);
64
+ reportLines.push(`${lineNum.toString().padStart(4)} | + ${actualLine}`);
65
65
  }
66
66
  }
67
67
  return reportLines.join("\n");
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check if a directory is a git repository
3
+ * @param dirPath Directory path
4
+ * @returns "Yes" if it's a git repository, "No" otherwise
5
+ */
6
+ export declare function isGitRepository(dirPath: string): string;
7
+ //# sourceMappingURL=gitUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitUtils.d.ts","sourceRoot":"","sources":["../../src/utils/gitUtils.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAevD"}
@@ -0,0 +1,24 @@
1
+ import * as path from "node:path";
2
+ import * as fsSync from "node:fs";
3
+ /**
4
+ * Check if a directory is a git repository
5
+ * @param dirPath Directory path
6
+ * @returns "Yes" if it's a git repository, "No" otherwise
7
+ */
8
+ export function isGitRepository(dirPath) {
9
+ try {
10
+ // Check if .git directory exists in current directory or any parent directory
11
+ let currentPath = path.resolve(dirPath);
12
+ while (currentPath !== path.dirname(currentPath)) {
13
+ const gitPath = path.join(currentPath, ".git");
14
+ if (fsSync.existsSync(gitPath)) {
15
+ return "Yes";
16
+ }
17
+ currentPath = path.dirname(currentPath);
18
+ }
19
+ return "No";
20
+ }
21
+ catch {
22
+ return "No";
23
+ }
24
+ }
@@ -1,6 +1,5 @@
1
1
  import type { Message, Usage } from "../types/index.js";
2
2
  import { MessageSource } from "../types/index.js";
3
- import type { SubagentConfiguration } from "./subagentParser.js";
4
3
  import { ChatCompletionMessageFunctionToolCall } from "openai/resources.js";
5
4
  export interface UserMessageParams {
6
5
  content: string;
@@ -17,7 +16,7 @@ export interface AddUserMessageParams extends UserMessageParams {
17
16
  export interface UpdateToolBlockParams {
18
17
  messages: Message[];
19
18
  id: string;
20
- parameters: string;
19
+ parameters?: string;
21
20
  result?: string;
22
21
  success?: boolean;
23
22
  error?: string;
@@ -71,27 +70,6 @@ export declare const addErrorBlockToMessage: ({ messages, error, }: AddErrorBloc
71
70
  export declare const addCommandOutputMessage: ({ messages, command, }: AddCommandOutputParams) => Message[];
72
71
  export declare const updateCommandOutputInMessage: ({ messages, command, output, }: UpdateCommandOutputParams) => Message[];
73
72
  export declare const completeCommandInMessage: ({ messages, command, exitCode, }: CompleteCommandParams) => Message[];
74
- export interface AddSubagentBlockParams {
75
- messages: Message[];
76
- subagentId: string;
77
- subagentName: string;
78
- status: "active" | "completed" | "error" | "aborted";
79
- sessionId: string;
80
- configuration: SubagentConfiguration;
81
- runInBackground?: boolean;
82
- }
83
- export interface UpdateSubagentBlockParams {
84
- messages: Message[];
85
- subagentId: string;
86
- status: "active" | "completed" | "error" | "aborted";
87
- sessionId?: string;
88
- }
89
- export declare const addSubagentBlockToMessage: ({ messages, subagentId, subagentName, status, sessionId, configuration, runInBackground, }: AddSubagentBlockParams) => Message[];
90
- export declare const updateSubagentBlockInMessage: (messages: Message[], subagentId: string, updates: Partial<{
91
- status: "active" | "completed" | "error" | "aborted";
92
- sessionId: string;
93
- runInBackground: boolean;
94
- }>) => Message[];
95
73
  /**
96
74
  * Removes the last user message from the messages array
97
75
  * Used for hook error handling when the user prompt needs to be erased
@@ -1 +1 @@
1
- {"version":3,"file":"messageOperations.d.ts","sourceRoot":"","sources":["../../src/utils/messageOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OA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,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,KAAG,MAmCxD,CAAC;AAGF,eAAO,MAAM,wBAAwB,GAAI,8DAMtC,oBAAoB,KAAG,OAAO,EA2BhC,CAAC;AAGF,eAAO,MAAM,6BAA6B,GACxC,UAAU,OAAO,EAAE,EACnB,UAAU,MAAM,EAChB,YAAY,qCAAqC,EAAE,EACnD,QAAQ,KAAK,EACb,mBAAmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzC,OAAO,EA+BT,CAAC;AAGF,eAAO,MAAM,wBAAwB,GAAI,iJActC,qBAAqB,KAAG,OAAO,EAiDjC,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,sBAGpC,mBAAmB,KAAG,OAAO,EA+B/B,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAI,wBAGrC,sBAAsB,KAAG,OAAO,EAelC,CAAC;AAGF,eAAO,MAAM,4BAA4B,GAAI,gCAI1C,yBAAyB,KAAG,OAAO,EAmBrC,CAAC;AAGF,eAAO,MAAM,wBAAwB,GAAI,kCAItC,qBAAqB,KAAG,OAAO,EAoBjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,OAAO,EAAE,KAAG,OAAO,EAalE,CAAC"}
@@ -235,55 +235,6 @@ export const completeCommandInMessage = ({ messages, command, exitCode, }) => {
235
235
  }
236
236
  return newMessages;
237
237
  };
238
- export const addSubagentBlockToMessage = ({ messages, subagentId, subagentName, status, sessionId, configuration, runInBackground, }) => {
239
- const newMessages = [...messages];
240
- // Find the last assistant message or create one
241
- let lastAssistantMessage = newMessages[newMessages.length - 1];
242
- if (!lastAssistantMessage || lastAssistantMessage.role !== "assistant") {
243
- // Create new assistant message if the last message is not from assistant
244
- lastAssistantMessage = {
245
- id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
246
- role: "assistant",
247
- blocks: [],
248
- };
249
- newMessages.push(lastAssistantMessage);
250
- }
251
- // Add subagent block
252
- lastAssistantMessage.blocks.push({
253
- type: "subagent",
254
- subagentId,
255
- subagentName,
256
- status,
257
- sessionId,
258
- configuration,
259
- runInBackground,
260
- });
261
- return newMessages;
262
- };
263
- export const updateSubagentBlockInMessage = (messages, subagentId, updates) => {
264
- const newMessages = [...messages];
265
- // Find and update the subagent block
266
- for (let i = newMessages.length - 1; i >= 0; i--) {
267
- const message = newMessages[i];
268
- if (message.role === "assistant") {
269
- for (const block of message.blocks) {
270
- if (block.type === "subagent" && block.subagentId === subagentId) {
271
- if (updates.status !== undefined) {
272
- block.status = updates.status;
273
- }
274
- if (updates.sessionId !== undefined) {
275
- block.sessionId = updates.sessionId;
276
- }
277
- if (updates.runInBackground !== undefined) {
278
- block.runInBackground = updates.runInBackground;
279
- }
280
- return newMessages;
281
- }
282
- }
283
- }
284
- }
285
- return newMessages;
286
- };
287
238
  /**
288
239
  * Removes the last user message from the messages array
289
240
  * Used for hook error handling when the user prompt needs to be erased
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-agent-sdk",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "SDK for building AI-powered development tools and agents",
5
5
  "keywords": [
6
6
  "ai",