wave-agent-sdk 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/agent.d.ts +7 -2
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +58 -74
  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 +134 -54
  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 +59 -48
  16. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  17. package/dist/managers/backgroundTaskManager.js +59 -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 +7 -3
  22. package/dist/managers/messageManager.d.ts.map +1 -1
  23. package/dist/managers/messageManager.js +28 -24
  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/subagentManager.d.ts +4 -0
  30. package/dist/managers/subagentManager.d.ts.map +1 -1
  31. package/dist/managers/subagentManager.js +22 -14
  32. package/dist/managers/toolManager.d.ts +11 -0
  33. package/dist/managers/toolManager.d.ts.map +1 -1
  34. package/dist/managers/toolManager.js +20 -2
  35. package/dist/services/aiService.d.ts +0 -1
  36. package/dist/services/aiService.d.ts.map +1 -1
  37. package/dist/services/aiService.js +4 -140
  38. package/dist/services/memory.d.ts +0 -3
  39. package/dist/services/memory.d.ts.map +1 -1
  40. package/dist/services/memory.js +0 -59
  41. package/dist/services/session.d.ts +3 -1
  42. package/dist/services/session.d.ts.map +1 -1
  43. package/dist/services/session.js +16 -1
  44. package/dist/services/taskManager.d.ts +21 -0
  45. package/dist/services/taskManager.d.ts.map +1 -0
  46. package/dist/services/taskManager.js +158 -0
  47. package/dist/tools/askUserQuestion.d.ts.map +1 -1
  48. package/dist/tools/askUserQuestion.js +39 -25
  49. package/dist/tools/bashTool.d.ts.map +1 -1
  50. package/dist/tools/bashTool.js +7 -9
  51. package/dist/tools/editTool.d.ts.map +1 -1
  52. package/dist/tools/editTool.js +2 -1
  53. package/dist/tools/exitPlanMode.d.ts.map +1 -1
  54. package/dist/tools/exitPlanMode.js +25 -1
  55. package/dist/tools/globTool.d.ts.map +1 -1
  56. package/dist/tools/globTool.js +8 -2
  57. package/dist/tools/grepTool.d.ts.map +1 -1
  58. package/dist/tools/grepTool.js +17 -6
  59. package/dist/tools/lsTool.d.ts.map +1 -1
  60. package/dist/tools/lsTool.js +3 -1
  61. package/dist/tools/readTool.d.ts.map +1 -1
  62. package/dist/tools/readTool.js +16 -1
  63. package/dist/tools/taskManagementTools.d.ts +6 -0
  64. package/dist/tools/taskManagementTools.d.ts.map +1 -0
  65. package/dist/tools/taskManagementTools.js +453 -0
  66. package/dist/tools/taskOutputTool.d.ts.map +1 -1
  67. package/dist/tools/taskOutputTool.js +32 -8
  68. package/dist/tools/taskStopTool.d.ts.map +1 -1
  69. package/dist/tools/taskStopTool.js +7 -1
  70. package/dist/tools/taskTool.d.ts.map +1 -1
  71. package/dist/tools/taskTool.js +6 -1
  72. package/dist/tools/types.d.ts +9 -0
  73. package/dist/tools/types.d.ts.map +1 -1
  74. package/dist/tools/writeTool.d.ts.map +1 -1
  75. package/dist/tools/writeTool.js +9 -1
  76. package/dist/types/index.d.ts +1 -0
  77. package/dist/types/index.d.ts.map +1 -1
  78. package/dist/types/index.js +1 -0
  79. package/dist/types/messaging.d.ts +2 -8
  80. package/dist/types/messaging.d.ts.map +1 -1
  81. package/dist/types/processes.d.ts +11 -6
  82. package/dist/types/processes.d.ts.map +1 -1
  83. package/dist/types/tasks.d.ts +13 -0
  84. package/dist/types/tasks.d.ts.map +1 -0
  85. package/dist/types/tasks.js +1 -0
  86. package/dist/types/tools.d.ts +4 -1
  87. package/dist/types/tools.d.ts.map +1 -1
  88. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  89. package/dist/utils/builtinSubagents.js +38 -1
  90. package/dist/utils/cacheControlUtils.d.ts.map +1 -1
  91. package/dist/utils/cacheControlUtils.js +18 -12
  92. package/dist/utils/constants.d.ts +0 -4
  93. package/dist/utils/constants.d.ts.map +1 -1
  94. package/dist/utils/constants.js +0 -4
  95. package/dist/utils/convertMessagesForAPI.js +2 -2
  96. package/dist/utils/messageOperations.d.ts +2 -30
  97. package/dist/utils/messageOperations.d.ts.map +1 -1
  98. package/dist/utils/messageOperations.js +4 -79
  99. package/dist/utils/nameGenerator.d.ts +1 -1
  100. package/dist/utils/nameGenerator.d.ts.map +1 -1
  101. package/dist/utils/nameGenerator.js +19 -3
  102. package/package.json +1 -1
  103. package/src/agent.ts +79 -84
  104. package/src/constants/prompts.ts +161 -65
  105. package/src/constants/tools.ts +4 -1
  106. package/src/index.ts +1 -0
  107. package/src/managers/aiManager.ts +79 -70
  108. package/src/managers/backgroundTaskManager.ts +53 -54
  109. package/src/managers/foregroundTaskManager.ts +3 -2
  110. package/src/managers/mcpManager.ts +6 -3
  111. package/src/managers/messageManager.ts +37 -26
  112. package/src/managers/permissionManager.ts +32 -21
  113. package/src/managers/planManager.ts +2 -2
  114. package/src/managers/subagentManager.ts +33 -14
  115. package/src/managers/toolManager.ts +32 -2
  116. package/src/services/aiService.ts +3 -145
  117. package/src/services/memory.ts +0 -72
  118. package/src/services/session.ts +21 -0
  119. package/src/services/taskManager.ts +188 -0
  120. package/src/tools/askUserQuestion.ts +51 -29
  121. package/src/tools/bashTool.ts +9 -15
  122. package/src/tools/editTool.ts +3 -1
  123. package/src/tools/exitPlanMode.ts +26 -2
  124. package/src/tools/globTool.ts +10 -2
  125. package/src/tools/grepTool.ts +17 -6
  126. package/src/tools/lsTool.ts +3 -1
  127. package/src/tools/readTool.ts +17 -1
  128. package/src/tools/taskManagementTools.ts +498 -0
  129. package/src/tools/taskOutputTool.ts +34 -12
  130. package/src/tools/taskStopTool.ts +7 -1
  131. package/src/tools/taskTool.ts +7 -1
  132. package/src/tools/types.ts +10 -0
  133. package/src/tools/writeTool.ts +9 -2
  134. package/src/types/index.ts +1 -0
  135. package/src/types/messaging.ts +1 -9
  136. package/src/types/processes.ts +13 -7
  137. package/src/types/tasks.ts +13 -0
  138. package/src/types/tools.ts +4 -1
  139. package/src/utils/builtinSubagents.ts +47 -1
  140. package/src/utils/cacheControlUtils.ts +26 -18
  141. package/src/utils/constants.ts +0 -5
  142. package/src/utils/convertMessagesForAPI.ts +2 -2
  143. package/src/utils/messageOperations.ts +5 -116
  144. package/src/utils/nameGenerator.ts +20 -3
  145. package/dist/tools/todoWriteTool.d.ts +0 -6
  146. package/dist/tools/todoWriteTool.d.ts.map +0 -1
  147. package/dist/tools/todoWriteTool.js +0 -220
  148. package/src/tools/todoWriteTool.ts +0 -257
@@ -83,6 +83,9 @@ Usage notes:
83
83
  },
84
84
  },
85
85
  },
86
+ prompt: () => `
87
+ - 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
+ - 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.`,
86
89
  execute: async (args, context) => {
87
90
  const command = args.command;
88
91
  const runInBackground = args.run_in_background;
@@ -179,8 +182,9 @@ Usage notes:
179
182
  const taskId = backgroundTaskManager.adoptProcess(child, command, outputBuffer, errorBuffer);
180
183
  resolve({
181
184
  success: true,
182
- content: `Command moved to background with ID: ${taskId}. Use TaskOutput tool with task_id="${taskId}" to monitor output.`,
185
+ content: `Command moved to background with ID: ${taskId}.`,
183
186
  shortResult: `Process ${taskId} backgrounded`,
187
+ isManuallyBackgrounded: true,
184
188
  });
185
189
  }
186
190
  else {
@@ -247,17 +251,11 @@ Usage notes:
247
251
  // Handle abort signal from context
248
252
  if (context?.abortSignal) {
249
253
  if (context.abortSignal.aborted) {
250
- if (!isBackgrounded) {
251
- handleAbort();
252
- }
254
+ handleAbort();
253
255
  return;
254
256
  }
255
257
  // Use { once: true } to prevent listener accumulation on signal reuse
256
- context.abortSignal.addEventListener("abort", () => {
257
- if (!isBackgrounded) {
258
- handleAbort();
259
- }
260
- }, {
258
+ context.abortSignal.addEventListener("abort", () => handleAbort(), {
261
259
  once: true,
262
260
  });
263
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editTool.d.ts","sourceRoot":"","sources":["../../src/tools/editTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgBtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAiNtB,CAAC"}
1
+ {"version":3,"file":"editTool.d.ts","sourceRoot":"","sources":["../../src/tools/editTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgBtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAmNtB,CAAC"}
@@ -16,11 +16,12 @@ function formatCompactParams(args, context) {
16
16
  export const editTool = {
17
17
  name: EDIT_TOOL_NAME,
18
18
  formatCompactParams,
19
+ prompt: () => `Performs exact string replacements in files. \n\nUsage:\n- You must use your \`${READ_TOOL_NAME}\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from read_file tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`. \n- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`,
19
20
  config: {
20
21
  type: "function",
21
22
  function: {
22
23
  name: EDIT_TOOL_NAME,
23
- description: `Performs exact string replacements in files. \n\nUsage:\n- You must use your \`${READ_TOOL_NAME}\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from read_file tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`. \n- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`,
24
+ description: "A tool for editing files",
24
25
  parameters: {
25
26
  type: "object",
26
27
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAoF9B,CAAC"}
1
+ {"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,UA4G9B,CAAC"}
@@ -10,7 +10,7 @@ export const exitPlanModeTool = {
10
10
  type: "function",
11
11
  function: {
12
12
  name: EXIT_PLAN_MODE_TOOL_NAME,
13
- description: "Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval. This tool will read the plan from the file specified in the system message and present it to the user for confirmation. You should have already written your plan to that file before calling this tool.",
13
+ description: "Prompts the user to exit plan mode and start coding",
14
14
  parameters: {
15
15
  type: "object",
16
16
  properties: {},
@@ -19,6 +19,30 @@ export const exitPlanModeTool = {
19
19
  },
20
20
  },
21
21
  },
22
+ prompt: () => `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
23
+
24
+ ## How This Tool Works
25
+ - You should have already written your plan to the plan file specified in the plan mode system message
26
+ - This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
27
+ - This tool simply signals that you're done planning and ready for the user to review and approve
28
+ - The user will see the contents of your plan file when they review it
29
+
30
+ ## When to Use This Tool
31
+ IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
32
+
33
+ ## Before Using This Tool
34
+ Ensure your plan is complete and unambiguous:
35
+ - If you have unresolved questions about requirements or approach, use AskUserQuestion first (in earlier phases)
36
+ - Once your plan is finalized, use THIS tool to request approval
37
+
38
+ **Important:** Do NOT use AskUserQuestion to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan.
39
+
40
+ ## Examples
41
+
42
+ 1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
43
+ 2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
44
+ 3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.
45
+ `,
22
46
  execute: async (_args, context) => {
23
47
  try {
24
48
  if (!context.permissionManager) {
@@ -1 +1 @@
1
- {"version":3,"file":"globTool.d.ts","sourceRoot":"","sources":["../../src/tools/globTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAKtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA4HtB,CAAC"}
1
+ {"version":3,"file":"globTool.d.ts","sourceRoot":"","sources":["../../src/tools/globTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAKtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAoItB,CAAC"}
@@ -2,7 +2,7 @@ import { glob } from "glob";
2
2
  import { stat } from "fs/promises";
3
3
  import { resolvePath, getDisplayPath } from "../utils/path.js";
4
4
  import { getGlobIgnorePatterns } from "../utils/fileFilter.js";
5
- import { GLOB_TOOL_NAME, TASK_TOOL_NAME } from "../constants/tools.js";
5
+ import { GLOB_TOOL_NAME } from "../constants/tools.js";
6
6
  /**
7
7
  * Glob Tool Plugin - Fast file pattern matching
8
8
  */
@@ -12,7 +12,7 @@ export const globTool = {
12
12
  type: "function",
13
13
  function: {
14
14
  name: GLOB_TOOL_NAME,
15
- description: `- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like "**/*.js" or "src/**/*.ts"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the ${TASK_TOOL_NAME} tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.`,
15
+ description: "Fast file pattern matching tool that works with any codebase size",
16
16
  parameters: {
17
17
  type: "object",
18
18
  properties: {
@@ -29,6 +29,12 @@ export const globTool = {
29
29
  },
30
30
  },
31
31
  },
32
+ prompt: () => `- Fast file pattern matching tool that works with any codebase size
33
+ - Supports glob patterns like "**/*.js" or "src/**/*.ts"
34
+ - Returns matching file paths sorted by modification time
35
+ - Use this tool when you need to find files by name patterns
36
+ - When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
37
+ - You can call multiple tools in a single response. It is always better to speculatively perform multiple searches in parallel if they are potentially useful.`,
32
38
  execute: async (args, context) => {
33
39
  const pattern = args.pattern;
34
40
  const searchPath = args.path;
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.ts","sourceRoot":"","sources":["../../src/tools/grepTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAWtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA4QtB,CAAC"}
1
+ {"version":3,"file":"grepTool.d.ts","sourceRoot":"","sources":["../../src/tools/grepTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAWtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAuRtB,CAAC"}
@@ -12,7 +12,7 @@ export const grepTool = {
12
12
  type: "function",
13
13
  function: {
14
14
  name: GREP_TOOL_NAME,
15
- description: `A powerful search tool built on ripgrep\n\n Usage:\n - ALWAYS use ${GREP_TOOL_NAME} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${BASH_TOOL_NAME} command. The ${GREP_TOOL_NAME} tool has been optimized for correct permissions and access.\n - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")\n - Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")\n - Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts\n - Use ${TASK_TOOL_NAME} tool for open-ended searches requiring multiple rounds\n - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)\n - Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\``,
15
+ description: "A powerful search tool built on ripgrep",
16
16
  parameters: {
17
17
  type: "object",
18
18
  properties: {
@@ -47,7 +47,7 @@ export const grepTool = {
47
47
  },
48
48
  "-n": {
49
49
  type: "boolean",
50
- description: 'Show line numbers in output (rg -n). Requires output_mode: "content", ignored otherwise.',
50
+ description: 'Show line numbers in output (rg -n). Requires output_mode: "content", ignored otherwise. Defaults to true.',
51
51
  },
52
52
  "-i": {
53
53
  type: "boolean",
@@ -59,7 +59,7 @@ export const grepTool = {
59
59
  },
60
60
  head_limit: {
61
61
  type: "number",
62
- description: 'Limit output to first N lines/entries, equivalent to "| head -N". Works across all output modes: content (limits output lines), files_with_matches (limits file paths), count (limits count entries). Defaults to 100 to prevent excessive token usage.',
62
+ description: 'Limit output to first N lines/entries, equivalent to "| head -N". Works across all output modes: content (limits output lines), files_with_matches (limits file paths), count (limits count entries). Defaults to 0 (unlimited).',
63
63
  },
64
64
  multiline: {
65
65
  type: "boolean",
@@ -70,6 +70,17 @@ export const grepTool = {
70
70
  },
71
71
  },
72
72
  },
73
+ prompt: () => `A powerful search tool built on ripgrep
74
+
75
+ Usage:
76
+ - ALWAYS use ${GREP_TOOL_NAME} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${BASH_TOOL_NAME} command. The ${GREP_TOOL_NAME} tool has been optimized for correct permissions and access.
77
+ - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
78
+ - Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
79
+ - Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
80
+ - Use ${TASK_TOOL_NAME} tool for open-ended searches requiring multiple rounds
81
+ - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
82
+ - Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
83
+ `,
73
84
  execute: async (args, context) => {
74
85
  const pattern = args.pattern;
75
86
  const searchPath = args.path;
@@ -78,7 +89,7 @@ export const grepTool = {
78
89
  const contextBefore = args["-B"];
79
90
  const contextAfter = args["-A"];
80
91
  const contextAround = args["-C"];
81
- const showLineNumbers = args["-n"];
92
+ const showLineNumbers = args["-n"] !== false;
82
93
  const caseInsensitive = args["-i"];
83
94
  const fileType = args.type;
84
95
  const headLimit = args.head_limit;
@@ -181,8 +192,8 @@ export const grepTool = {
181
192
  let finalOutput = output;
182
193
  let lines = output.split("\n");
183
194
  // Set default head_limit if not specified to prevent excessive token usage
184
- const effectiveHeadLimit = headLimit || 100;
185
- if (lines.length > effectiveHeadLimit) {
195
+ const effectiveHeadLimit = headLimit || 0;
196
+ if (effectiveHeadLimit > 0 && lines.length > effectiveHeadLimit) {
186
197
  lines = lines.slice(0, effectiveHeadLimit);
187
198
  finalOutput = lines.join("\n");
188
199
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lsTool.d.ts","sourceRoot":"","sources":["../../src/tools/lsTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAQtE;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,UAmMpB,CAAC"}
1
+ {"version":3,"file":"lsTool.d.ts","sourceRoot":"","sources":["../../src/tools/lsTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAQtE;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,UAqMpB,CAAC"}
@@ -12,7 +12,7 @@ export const lsTool = {
12
12
  type: "function",
13
13
  function: {
14
14
  name: LS_TOOL_NAME,
15
- description: `Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the ${GLOB_TOOL_NAME} and ${GREP_TOOL_NAME} tools, if you know which directories to search.`,
15
+ description: "Lists files and directories in a given path.",
16
16
  parameters: {
17
17
  type: "object",
18
18
  properties: {
@@ -32,6 +32,8 @@ export const lsTool = {
32
32
  },
33
33
  },
34
34
  },
35
+ prompt: () => `
36
+ Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the ${GLOB_TOOL_NAME} and ${GREP_TOOL_NAME} tools, if you know which directories to search.`,
35
37
  execute: async (args, context) => {
36
38
  const targetPath = args.path;
37
39
  const ignorePatterns = args.ignore;
@@ -1 +1 @@
1
- {"version":3,"file":"readTool.d.ts","sourceRoot":"","sources":["../../src/tools/readTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AA6HtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAkNtB,CAAC"}
1
+ {"version":3,"file":"readTool.d.ts","sourceRoot":"","sources":["../../src/tools/readTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AA6HtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAkOtB,CAAC"}
@@ -113,11 +113,26 @@ async function processImageFile(filePath, context) {
113
113
  */
114
114
  export const readTool = {
115
115
  name: READ_TOOL_NAME,
116
+ prompt: () => `Reads a file from the local filesystem. You can access any file directly by using this tool.
117
+ Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
118
+
119
+ Usage:
120
+ - The file_path parameter must be an absolute path, not a relative path
121
+ - By default, it reads up to 2000 lines starting from the beginning of the file
122
+ - You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
123
+ - Any lines longer than 2000 characters will be truncated
124
+ - Results are returned using cat -n format, with line numbers starting at 1
125
+ - This tool allows Agent to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Agent is a multimodal LLM.
126
+ - This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
127
+ - You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
128
+ - You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png
129
+ - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
130
+ - Binary document formats (PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX) are not supported and will return an error.`,
116
131
  config: {
117
132
  type: "function",
118
133
  function: {
119
134
  name: READ_TOOL_NAME,
120
- description: `Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The file_path parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool allows Agent to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Agent is a multimodal LLM.\n- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.\n- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png\n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n- Binary document formats (PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX) are not supported and will return an error.`,
135
+ description: "Read a file from the local filesystem.",
121
136
  parameters: {
122
137
  type: "object",
123
138
  properties: {
@@ -0,0 +1,6 @@
1
+ import { ToolPlugin } from "./types.js";
2
+ export declare const taskCreateTool: ToolPlugin;
3
+ export declare const taskGetTool: ToolPlugin;
4
+ export declare const taskUpdateTool: ToolPlugin;
5
+ export declare const taskListTool: ToolPlugin;
6
+ //# sourceMappingURL=taskManagementTools.d.ts.map
@@ -0,0 +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"}