@morphllm/morphsdk 0.2.146 → 0.2.148

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 (205) hide show
  1. package/dist/{chunk-FYO46OT6.js → chunk-33CVSDM6.js} +2 -2
  2. package/dist/{chunk-SJYAKVSS.js → chunk-44WJK4MN.js} +2 -2
  3. package/dist/{chunk-SJYAKVSS.js.map → chunk-44WJK4MN.js.map} +1 -1
  4. package/dist/{chunk-GJUB3ECP.js → chunk-4FLNLA2D.js} +2 -2
  5. package/dist/{chunk-E4YKEKGW.js → chunk-4K36ATXI.js} +2 -2
  6. package/dist/{chunk-V73GO5AJ.js → chunk-4ZA4INTU.js} +2 -2
  7. package/dist/{chunk-T564HFSH.js → chunk-5R5FVUAL.js} +1 -1
  8. package/dist/{chunk-FBOJJ3UY.js → chunk-6MVJ5J6H.js} +17 -17
  9. package/dist/{chunk-UVNENJ6H.js → chunk-7PZKCKIH.js} +3 -3
  10. package/dist/{chunk-NF2QWJDY.js → chunk-B3AKP3RA.js} +31 -2
  11. package/dist/chunk-B3AKP3RA.js.map +1 -0
  12. package/dist/chunk-CMSHXALI.js +60 -0
  13. package/dist/chunk-CMSHXALI.js.map +1 -0
  14. package/dist/{chunk-I7SFRYTX.js → chunk-DMYFFSLS.js} +2 -2
  15. package/dist/{chunk-Q36MNOFA.js → chunk-E5K4VHMA.js} +2 -2
  16. package/dist/{chunk-OV57JBMB.js → chunk-EGUJNHMV.js} +2 -2
  17. package/dist/{chunk-E45FW5EK.js → chunk-ELU34VFH.js} +2 -2
  18. package/dist/{chunk-BDHKL3MT.js → chunk-F6OUFO25.js} +2 -2
  19. package/dist/{chunk-QRSWXP4K.js → chunk-H6TH3F4V.js} +2 -2
  20. package/dist/{chunk-FIVYDIHX.js → chunk-HYRHI2UL.js} +1 -1
  21. package/dist/{chunk-DKODF3YG.js → chunk-I3J46TSB.js} +5 -4
  22. package/dist/chunk-I3J46TSB.js.map +1 -0
  23. package/dist/{chunk-J2HIK4GB.js → chunk-IL7OLRJP.js} +2 -2
  24. package/dist/{chunk-JSWNBCGS.js → chunk-LJM3R7UZ.js} +2 -2
  25. package/dist/{chunk-NKUSUSVI.js → chunk-N67TYW2Z.js} +3 -3
  26. package/dist/chunk-OBXWT7NJ.js +401 -0
  27. package/dist/chunk-OBXWT7NJ.js.map +1 -0
  28. package/dist/{chunk-MMBQKN4G.js → chunk-OHYA6SUF.js} +2 -2
  29. package/dist/{chunk-EU7OLX4Z.js → chunk-RH2JB76E.js} +2 -2
  30. package/dist/{chunk-KYKRRF7E.js → chunk-SID7EXWK.js} +2 -2
  31. package/dist/{chunk-YIETFYCL.js → chunk-T7HF2TDQ.js} +75 -48
  32. package/dist/chunk-T7HF2TDQ.js.map +1 -0
  33. package/dist/{chunk-VZ6VYRQB.js → chunk-TSUTRT4Q.js} +2 -2
  34. package/dist/{chunk-UYPWKQKV.js → chunk-TVUYMM4J.js} +2 -2
  35. package/dist/{chunk-HZOTLGJH.js → chunk-XNBQJSLI.js} +42 -2
  36. package/dist/chunk-XNBQJSLI.js.map +1 -0
  37. package/dist/{chunk-BIQ7234U.js → chunk-XT7JQAXV.js} +2 -2
  38. package/dist/{chunk-4PBUB77N.js → chunk-YWJHOYEM.js} +2 -2
  39. package/dist/client.cjs +439 -446
  40. package/dist/client.cjs.map +1 -1
  41. package/dist/client.js +26 -27
  42. package/dist/edge.cjs +1 -1
  43. package/dist/edge.cjs.map +1 -1
  44. package/dist/edge.js +4 -4
  45. package/dist/{finish-DBKuo8yj.d.ts → finish-Ddj1MPGt.d.ts} +1 -1
  46. package/dist/index.cjs +458 -446
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.js +29 -29
  49. package/dist/modelrouter/core.cjs +1 -1
  50. package/dist/modelrouter/core.cjs.map +1 -1
  51. package/dist/modelrouter/core.js +3 -3
  52. package/dist/modelrouter/index.cjs +1 -1
  53. package/dist/modelrouter/index.cjs.map +1 -1
  54. package/dist/modelrouter/index.js +3 -3
  55. package/dist/subagents/anthropic.cjs +435 -442
  56. package/dist/subagents/anthropic.cjs.map +1 -1
  57. package/dist/subagents/anthropic.js +8 -9
  58. package/dist/subagents/vercel.cjs +435 -442
  59. package/dist/subagents/vercel.cjs.map +1 -1
  60. package/dist/subagents/vercel.js +8 -9
  61. package/dist/tools/browser/anthropic.cjs +1 -1
  62. package/dist/tools/browser/anthropic.cjs.map +1 -1
  63. package/dist/tools/browser/anthropic.js +5 -5
  64. package/dist/tools/browser/core.cjs +1 -1
  65. package/dist/tools/browser/core.cjs.map +1 -1
  66. package/dist/tools/browser/core.js +4 -4
  67. package/dist/tools/browser/index.cjs +1 -1
  68. package/dist/tools/browser/index.cjs.map +1 -1
  69. package/dist/tools/browser/index.js +7 -7
  70. package/dist/tools/browser/openai.cjs +1 -1
  71. package/dist/tools/browser/openai.cjs.map +1 -1
  72. package/dist/tools/browser/openai.js +5 -5
  73. package/dist/tools/browser/profiles/core.cjs +1 -1
  74. package/dist/tools/browser/profiles/core.cjs.map +1 -1
  75. package/dist/tools/browser/profiles/core.js +3 -3
  76. package/dist/tools/browser/profiles/index.cjs +1 -1
  77. package/dist/tools/browser/profiles/index.cjs.map +1 -1
  78. package/dist/tools/browser/profiles/index.js +3 -3
  79. package/dist/tools/browser/vercel.cjs +1 -1
  80. package/dist/tools/browser/vercel.cjs.map +1 -1
  81. package/dist/tools/browser/vercel.js +5 -5
  82. package/dist/tools/codebase_search/anthropic.cjs +1 -1
  83. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  84. package/dist/tools/codebase_search/anthropic.js +4 -4
  85. package/dist/tools/codebase_search/core.cjs +1 -1
  86. package/dist/tools/codebase_search/core.cjs.map +1 -1
  87. package/dist/tools/codebase_search/core.js +3 -3
  88. package/dist/tools/codebase_search/index.cjs +1 -1
  89. package/dist/tools/codebase_search/index.cjs.map +1 -1
  90. package/dist/tools/codebase_search/index.js +6 -6
  91. package/dist/tools/codebase_search/openai.cjs +1 -1
  92. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  93. package/dist/tools/codebase_search/openai.js +4 -4
  94. package/dist/tools/codebase_search/vercel.cjs +1 -1
  95. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  96. package/dist/tools/codebase_search/vercel.js +4 -4
  97. package/dist/tools/fastapply/anthropic.cjs +1 -1
  98. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  99. package/dist/tools/fastapply/anthropic.js +4 -4
  100. package/dist/tools/fastapply/apply.cjs +1 -1
  101. package/dist/tools/fastapply/apply.cjs.map +1 -1
  102. package/dist/tools/fastapply/apply.js +2 -2
  103. package/dist/tools/fastapply/core.cjs +1 -1
  104. package/dist/tools/fastapply/core.cjs.map +1 -1
  105. package/dist/tools/fastapply/core.js +3 -3
  106. package/dist/tools/fastapply/index.cjs +1 -1
  107. package/dist/tools/fastapply/index.cjs.map +1 -1
  108. package/dist/tools/fastapply/index.js +6 -6
  109. package/dist/tools/fastapply/openai.cjs +1 -1
  110. package/dist/tools/fastapply/openai.cjs.map +1 -1
  111. package/dist/tools/fastapply/openai.js +4 -4
  112. package/dist/tools/fastapply/vercel.cjs +1 -1
  113. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  114. package/dist/tools/fastapply/vercel.js +4 -4
  115. package/dist/tools/index.cjs +1 -1
  116. package/dist/tools/index.cjs.map +1 -1
  117. package/dist/tools/index.js +6 -6
  118. package/dist/tools/utils/resilience.cjs +1 -1
  119. package/dist/tools/utils/resilience.cjs.map +1 -1
  120. package/dist/tools/utils/resilience.js +2 -2
  121. package/dist/tools/warp_grep/agent/config.cjs +4 -3
  122. package/dist/tools/warp_grep/agent/config.cjs.map +1 -1
  123. package/dist/tools/warp_grep/agent/config.d.ts +2 -1
  124. package/dist/tools/warp_grep/agent/config.js +1 -1
  125. package/dist/tools/warp_grep/agent/parser.cjs +52 -121
  126. package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
  127. package/dist/tools/warp_grep/agent/parser.d.ts +12 -5
  128. package/dist/tools/warp_grep/agent/parser.js +7 -3
  129. package/dist/tools/warp_grep/agent/runner.cjs +348 -424
  130. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  131. package/dist/tools/warp_grep/agent/runner.d.ts +6 -3
  132. package/dist/tools/warp_grep/agent/runner.js +5 -6
  133. package/dist/tools/warp_grep/agent/types.cjs.map +1 -1
  134. package/dist/tools/warp_grep/agent/types.d.ts +22 -3
  135. package/dist/tools/warp_grep/anthropic.cjs +435 -442
  136. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  137. package/dist/tools/warp_grep/anthropic.js +8 -9
  138. package/dist/tools/warp_grep/client.cjs +435 -442
  139. package/dist/tools/warp_grep/client.cjs.map +1 -1
  140. package/dist/tools/warp_grep/client.js +7 -8
  141. package/dist/tools/warp_grep/gemini.cjs +435 -442
  142. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  143. package/dist/tools/warp_grep/gemini.js +7 -8
  144. package/dist/tools/warp_grep/gemini.js.map +1 -1
  145. package/dist/tools/warp_grep/harness.cjs +168 -180
  146. package/dist/tools/warp_grep/harness.cjs.map +1 -1
  147. package/dist/tools/warp_grep/harness.d.ts +17 -38
  148. package/dist/tools/warp_grep/harness.js +15 -14
  149. package/dist/tools/warp_grep/harness.js.map +1 -1
  150. package/dist/tools/warp_grep/index.cjs +454 -442
  151. package/dist/tools/warp_grep/index.cjs.map +1 -1
  152. package/dist/tools/warp_grep/index.d.ts +1 -1
  153. package/dist/tools/warp_grep/index.js +10 -10
  154. package/dist/tools/warp_grep/openai.cjs +435 -442
  155. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  156. package/dist/tools/warp_grep/openai.js +8 -9
  157. package/dist/tools/warp_grep/providers/local.cjs +43 -2
  158. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  159. package/dist/tools/warp_grep/providers/local.d.ts +5 -1
  160. package/dist/tools/warp_grep/providers/local.js +2 -2
  161. package/dist/tools/warp_grep/providers/remote.cjs +32 -2
  162. package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
  163. package/dist/tools/warp_grep/providers/remote.d.ts +9 -1
  164. package/dist/tools/warp_grep/providers/remote.js +2 -2
  165. package/dist/tools/warp_grep/providers/types.cjs.map +1 -1
  166. package/dist/tools/warp_grep/providers/types.d.ts +14 -1
  167. package/dist/tools/warp_grep/vercel.cjs +435 -442
  168. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  169. package/dist/tools/warp_grep/vercel.js +8 -9
  170. package/dist/version.cjs +1 -1
  171. package/dist/version.cjs.map +1 -1
  172. package/dist/version.js +1 -1
  173. package/package.json +1 -1
  174. package/dist/chunk-DKODF3YG.js.map +0 -1
  175. package/dist/chunk-EUHNJMWL.js +0 -409
  176. package/dist/chunk-EUHNJMWL.js.map +0 -1
  177. package/dist/chunk-HZOTLGJH.js.map +0 -1
  178. package/dist/chunk-NF2QWJDY.js.map +0 -1
  179. package/dist/chunk-VCKJ22DX.js +0 -131
  180. package/dist/chunk-VCKJ22DX.js.map +0 -1
  181. package/dist/chunk-YIETFYCL.js.map +0 -1
  182. /package/dist/{chunk-FYO46OT6.js.map → chunk-33CVSDM6.js.map} +0 -0
  183. /package/dist/{chunk-GJUB3ECP.js.map → chunk-4FLNLA2D.js.map} +0 -0
  184. /package/dist/{chunk-E4YKEKGW.js.map → chunk-4K36ATXI.js.map} +0 -0
  185. /package/dist/{chunk-V73GO5AJ.js.map → chunk-4ZA4INTU.js.map} +0 -0
  186. /package/dist/{chunk-T564HFSH.js.map → chunk-5R5FVUAL.js.map} +0 -0
  187. /package/dist/{chunk-FBOJJ3UY.js.map → chunk-6MVJ5J6H.js.map} +0 -0
  188. /package/dist/{chunk-UVNENJ6H.js.map → chunk-7PZKCKIH.js.map} +0 -0
  189. /package/dist/{chunk-I7SFRYTX.js.map → chunk-DMYFFSLS.js.map} +0 -0
  190. /package/dist/{chunk-Q36MNOFA.js.map → chunk-E5K4VHMA.js.map} +0 -0
  191. /package/dist/{chunk-OV57JBMB.js.map → chunk-EGUJNHMV.js.map} +0 -0
  192. /package/dist/{chunk-E45FW5EK.js.map → chunk-ELU34VFH.js.map} +0 -0
  193. /package/dist/{chunk-BDHKL3MT.js.map → chunk-F6OUFO25.js.map} +0 -0
  194. /package/dist/{chunk-QRSWXP4K.js.map → chunk-H6TH3F4V.js.map} +0 -0
  195. /package/dist/{chunk-FIVYDIHX.js.map → chunk-HYRHI2UL.js.map} +0 -0
  196. /package/dist/{chunk-J2HIK4GB.js.map → chunk-IL7OLRJP.js.map} +0 -0
  197. /package/dist/{chunk-JSWNBCGS.js.map → chunk-LJM3R7UZ.js.map} +0 -0
  198. /package/dist/{chunk-NKUSUSVI.js.map → chunk-N67TYW2Z.js.map} +0 -0
  199. /package/dist/{chunk-MMBQKN4G.js.map → chunk-OHYA6SUF.js.map} +0 -0
  200. /package/dist/{chunk-EU7OLX4Z.js.map → chunk-RH2JB76E.js.map} +0 -0
  201. /package/dist/{chunk-KYKRRF7E.js.map → chunk-SID7EXWK.js.map} +0 -0
  202. /package/dist/{chunk-VZ6VYRQB.js.map → chunk-TSUTRT4Q.js.map} +0 -0
  203. /package/dist/{chunk-UYPWKQKV.js.map → chunk-TVUYMM4J.js.map} +0 -0
  204. /package/dist/{chunk-BIQ7234U.js.map → chunk-XT7JQAXV.js.map} +0 -0
  205. /package/dist/{chunk-4PBUB77N.js.map → chunk-YWJHOYEM.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AGENT_CONFIG
3
- } from "./chunk-DKODF3YG.js";
3
+ } from "./chunk-I3J46TSB.js";
4
4
 
5
5
  // tools/warp_grep/agent/tools/grep.ts
6
6
  async function toolGrep(provider, args) {
@@ -50,29 +50,42 @@ async function toolRead(provider, args) {
50
50
  }
51
51
 
52
52
  // tools/warp_grep/agent/tools/list_directory.ts
53
- async function toolListDirectory(provider, args) {
54
- const maxResults = args.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;
55
- const initialDepth = args.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
56
- async function getListRecursive(currentDepth) {
57
- const entries = await provider.listDirectory({
58
- path: args.path,
59
- pattern: args.pattern ?? null,
60
- maxResults,
61
- maxDepth: currentDepth
62
- });
63
- if (entries.length >= maxResults && currentDepth > 0) {
64
- return getListRecursive(currentDepth - 1);
65
- }
66
- return { entries };
53
+ import path from "path";
54
+ async function toolListDirectory(provider, args, repoRoot) {
55
+ const maxResults = args.maxResults ?? AGENT_CONFIG.MAX_LIST_RESULTS;
56
+ const maxDepth = args.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
57
+ const entries = await provider.listDirectory({
58
+ path: args.path,
59
+ pattern: args.pattern ?? null,
60
+ maxResults,
61
+ maxDepth
62
+ });
63
+ if (!entries.length) return "empty";
64
+ if (repoRoot) {
65
+ const absRoot = path.resolve(repoRoot);
66
+ const lines = entries.map((e) => path.join(absRoot, e.path));
67
+ return lines.join("\n");
67
68
  }
68
- const { entries: list } = await getListRecursive(initialDepth);
69
- if (!list.length) return "empty";
70
- const tree = list.map((e) => {
71
- const indent = " ".repeat(e.depth);
72
- const name = e.type === "dir" ? `${e.name}/` : e.name;
73
- return `${indent}${name}`;
74
- }).join("\n");
75
- return tree;
69
+ return entries.map((e) => e.path).join("\n");
70
+ }
71
+
72
+ // tools/warp_grep/agent/tools/glob.ts
73
+ async function toolGlob(provider, args) {
74
+ const res = await provider.glob(args);
75
+ if (res.error) {
76
+ return res.error;
77
+ }
78
+ if (!res.files.length) {
79
+ return "no matches";
80
+ }
81
+ const header = `Found ${res.totalFound} file(s) matching "${args.pattern}" within ${res.searchDir}, sorted by modification time (newest first):`;
82
+ const body = res.files.join("\n");
83
+ const truncated = res.totalFound > res.files.length ? `
84
+ [${res.totalFound - res.files.length} files truncated]` : "";
85
+ return `${header}
86
+ ---
87
+ ${body}
88
+ ---${truncated}`;
76
89
  }
77
90
 
78
91
  // tools/warp_grep/agent/tools/finish.ts
@@ -142,8 +155,19 @@ function mergeRanges(ranges) {
142
155
  }
143
156
 
144
157
  // tools/warp_grep/agent/helpers.ts
145
- import path from "path";
158
+ import path2 from "path";
146
159
  var TRUNCATED_MARKER = "[truncated for context limit]";
160
+ function getMessageSize(m) {
161
+ if (m.role === "tool") return m.content.length;
162
+ if (m.role === "assistant") {
163
+ let size = typeof m.content === "string" ? m.content.length : 0;
164
+ if (m.tool_calls) {
165
+ size += m.tool_calls.reduce((s, tc) => s + tc.function.name.length + tc.function.arguments.length, 0);
166
+ }
167
+ return size;
168
+ }
169
+ return m.content.length;
170
+ }
147
171
  function formatTurnMessage(turnsUsed, maxTurns) {
148
172
  const turnsRemaining = maxTurns - turnsUsed;
149
173
  if (turnsRemaining === 1) {
@@ -154,33 +178,30 @@ You have used ${turnsUsed} turns, you only have 1 turn remaining. You have run o
154
178
  You have used ${turnsUsed} turn${turnsUsed === 1 ? "" : "s"} and have ${turnsRemaining} remaining`;
155
179
  }
156
180
  function calculateContextBudget(messages) {
157
- const totalChars = messages.reduce((sum, m) => sum + m.content.length, 0);
181
+ const totalChars = messages.reduce((sum, m) => sum + getMessageSize(m), 0);
158
182
  const maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS;
159
- const percent = Math.round(totalChars / maxChars * 100);
160
- const usedK = Math.round(totalChars / 1e3);
161
- const maxK = Math.round(maxChars / 1e3);
162
- return `<context_budget>${percent}% (${usedK}K/${maxK}K chars used)</context_budget>`;
183
+ const percent = Math.floor(totalChars / maxChars * 100);
184
+ const usedK = Math.floor(totalChars / 1e3);
185
+ const maxK = Math.floor(maxChars / 1e3);
186
+ return `<context_budget>${percent}% (${usedK}K/${maxK}K chars)</context_budget>`;
163
187
  }
164
188
  async function buildInitialState(repoRoot, searchTerm, provider, options) {
165
189
  const budget = calculateContextBudget([]);
166
- const turnTag = `Turn 0/${AGENT_CONFIG.MAX_TURNS}`;
190
+ const turnTag = `You have used 0 turns and have ${AGENT_CONFIG.MAX_TURNS} remaining`;
167
191
  const treeDepth = options?.search_type === "node_modules" ? 1 : 2;
192
+ const absRoot = path2.resolve(repoRoot);
168
193
  try {
169
194
  const entries = await provider.listDirectory({
170
195
  path: ".",
171
196
  maxResults: AGENT_CONFIG.MAX_OUTPUT_LINES,
172
197
  maxDepth: treeDepth
173
198
  });
174
- const treeLines = entries.map((e) => {
175
- const indent = " ".repeat(e.depth);
176
- const name = e.type === "dir" ? `${e.name}/` : e.name;
177
- return `${indent}${name}`;
178
- });
179
- const repoName = path.basename(repoRoot);
180
- const treeOutput = treeLines.length > 0 ? `${repoName}/
181
- ${treeLines.join("\n")}` : `${repoName}/`;
199
+ const lines = [absRoot];
200
+ for (const e of entries) {
201
+ lines.push(path2.join(absRoot, e.path));
202
+ }
182
203
  return `<repo_structure>
183
- ${treeOutput}
204
+ ${lines.join("\n")}
184
205
  </repo_structure>
185
206
 
186
207
  <search_string>
@@ -189,9 +210,8 @@ ${searchTerm}
189
210
  ${budget}
190
211
  ${turnTag}`;
191
212
  } catch {
192
- const repoName = path.basename(repoRoot);
193
213
  return `<repo_structure>
194
- ${repoName}/
214
+ ${absRoot}
195
215
  </repo_structure>
196
216
 
197
217
  <search_string>
@@ -210,26 +230,32 @@ function formatListDirectoryTree(entries) {
210
230
  }).join("\n");
211
231
  }
212
232
  function enforceContextLimit(messages, maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS) {
213
- const getTotalChars = () => messages.reduce((sum, m) => sum + m.content.length, 0);
233
+ const getTotalChars = () => messages.reduce((sum, m) => sum + getMessageSize(m), 0);
214
234
  if (getTotalChars() <= maxChars) {
215
235
  return messages;
216
236
  }
217
- const userIndices = [];
237
+ const truncatableIndices = [];
218
238
  let firstUserSkipped = false;
219
239
  for (let i = 0; i < messages.length; i++) {
220
- if (messages[i].role === "user") {
240
+ const m = messages[i];
241
+ if (m.role === "tool") {
242
+ truncatableIndices.push(i);
243
+ } else if (m.role === "user") {
221
244
  if (!firstUserSkipped) {
222
245
  firstUserSkipped = true;
223
246
  continue;
224
247
  }
225
- userIndices.push(i);
248
+ truncatableIndices.push(i);
226
249
  }
227
250
  }
228
- for (const idx of userIndices) {
251
+ for (const idx of truncatableIndices) {
229
252
  if (getTotalChars() <= maxChars) {
230
253
  break;
231
254
  }
232
- if (messages[idx].content !== TRUNCATED_MARKER) {
255
+ const m = messages[idx];
256
+ if (m.role === "tool" && m.content !== TRUNCATED_MARKER) {
257
+ messages[idx] = { role: "tool", tool_call_id: m.tool_call_id, content: TRUNCATED_MARKER };
258
+ } else if (m.role === "user" && m.content !== TRUNCATED_MARKER) {
233
259
  messages[idx] = { role: "user", content: TRUNCATED_MARKER };
234
260
  }
235
261
  }
@@ -240,6 +266,7 @@ export {
240
266
  toolGrep,
241
267
  toolRead,
242
268
  toolListDirectory,
269
+ toolGlob,
243
270
  normalizeFinishFiles,
244
271
  readFinishFiles,
245
272
  formatTurnMessage,
@@ -248,4 +275,4 @@ export {
248
275
  formatListDirectoryTree,
249
276
  enforceContextLimit
250
277
  };
251
- //# sourceMappingURL=chunk-YIETFYCL.js.map
278
+ //# sourceMappingURL=chunk-T7HF2TDQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/agent/tools/grep.ts","../tools/warp_grep/agent/tools/read.ts","../tools/warp_grep/agent/tools/list_directory.ts","../tools/warp_grep/agent/tools/glob.ts","../tools/warp_grep/agent/tools/finish.ts","../tools/warp_grep/agent/helpers.ts"],"sourcesContent":["import type { WarpGrepProvider } from '../../providers/types.js';\n\nexport async function toolGrep(\n provider: WarpGrepProvider,\n args: { pattern: string; path: string; glob?: string; context_lines?: number; case_sensitive?: boolean }\n): Promise<{ output: string }> {\n const res = await provider.grep(args);\n \n // Return errors as output - let the model see and handle them\n if (res.error) {\n return { output: res.error };\n }\n \n if (!res.lines.length) {\n return { output: 'no matches' };\n }\n \n return { output: res.lines.join('\\n') };\n}\n\n","import type { WarpGrepProvider } from '../../providers/types.js';\n\nfunction isValidRange(start: unknown, end: unknown): boolean {\n return (\n typeof start === 'number' &&\n typeof end === 'number' &&\n Number.isFinite(start) &&\n Number.isFinite(end) &&\n start > 0 &&\n end >= start\n );\n}\n\nexport async function toolRead(\n provider: WarpGrepProvider,\n args: { path: string; start?: number; end?: number; lines?: Array<[number, number]> }\n): Promise<string> {\n if (args.lines && Array.isArray(args.lines) && args.lines.length > 0) {\n const validRanges: Array<[number, number]> = [];\n for (const range of args.lines) {\n if (Array.isArray(range) && range.length >= 2 && isValidRange(range[0], range[1])) {\n validRanges.push([range[0], range[1]]);\n }\n }\n \n if (validRanges.length === 0) {\n const res = await provider.read({ path: args.path });\n if (res.error) return res.error;\n if (!res.lines.length) return '(empty file)';\n return res.lines.join('\\n');\n }\n \n const chunks: string[] = [];\n for (const [start, end] of validRanges) {\n const res = await provider.read({ path: args.path, start, end });\n if (res.error) return res.error;\n chunks.push(res.lines.join('\\n'));\n }\n if (chunks.every(c => c === '')) return '(empty file)';\n return chunks.join('\\n...\\n');\n }\n\n const res = await provider.read({ path: args.path, start: args.start, end: args.end });\n if (res.error) {\n return res.error;\n }\n if (!res.lines.length) return '(empty file)';\n return res.lines.join('\\n');\n}\n\n","import type { WarpGrepProvider } from '../../providers/types.js';\nimport { AGENT_CONFIG } from '../config.js';\nimport path from 'path';\n\nexport async function toolListDirectory(\n provider: WarpGrepProvider,\n args: { path: string; pattern?: string | null; maxResults?: number; maxDepth?: number },\n repoRoot?: string,\n): Promise<string> {\n\n const maxResults = args.maxResults ?? AGENT_CONFIG.MAX_LIST_RESULTS;\n const maxDepth = args.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;\n\n const entries = await provider.listDirectory({\n path: args.path,\n pattern: args.pattern ?? null,\n maxResults,\n maxDepth,\n });\n\n if (!entries.length) return 'empty';\n\n // Flat absolute paths (matches training format)\n // If repoRoot is available, convert relative paths to absolute\n if (repoRoot) {\n const absRoot = path.resolve(repoRoot);\n const lines = entries.map(e => path.join(absRoot, e.path));\n return lines.join('\\n');\n }\n\n // Fallback: return relative paths if repoRoot not available\n return entries.map(e => e.path).join('\\n');\n}\n","import type { WarpGrepProvider } from '../../providers/types.js';\n\nexport async function toolGlob(\n provider: WarpGrepProvider,\n args: { pattern: string; path?: string }\n): Promise<string> {\n const res = await provider.glob(args);\n\n if (res.error) {\n return res.error;\n }\n\n if (!res.files.length) {\n return 'no matches';\n }\n\n // Match training output format exactly\n const header = `Found ${res.totalFound} file(s) matching \"${args.pattern}\" within ${res.searchDir}, sorted by modification time (newest first):`;\n const body = res.files.join('\\n');\n const truncated = res.totalFound > res.files.length\n ? `\\n[${res.totalFound - res.files.length} files truncated]`\n : '';\n return `${header}\\n---\\n${body}\\n---${truncated}`;\n}\n","import type { FinishFileSpec } from '../types.js';\n\nfunction isValidRange(range: unknown): range is [number, number] {\n return (\n Array.isArray(range) &&\n range.length >= 2 &&\n typeof range[0] === 'number' &&\n typeof range[1] === 'number' &&\n Number.isFinite(range[0]) &&\n Number.isFinite(range[1]) &&\n range[0] > 0 &&\n range[1] >= range[0]\n );\n}\n\nfunction extractValidRanges(lines: unknown): Array<[number, number]> | null {\n if (!Array.isArray(lines)) return null;\n const valid: Array<[number, number]> = [];\n for (const range of lines) {\n if (isValidRange(range)) {\n valid.push([range[0], range[1]]);\n }\n }\n return valid.length > 0 ? valid : null;\n}\n\nexport function normalizeFinishFiles(files: FinishFileSpec[]): FinishFileSpec[] {\n return files.map((f) => {\n if (f.lines === '*') return { path: f.path, lines: '*' };\n const validRanges = extractValidRanges(f.lines);\n if (!validRanges) return { path: f.path, lines: '*' };\n return { path: f.path, lines: mergeRanges(validRanges) };\n });\n}\n\nexport async function readFinishFiles(\n repoRoot: string,\n files: FinishFileSpec[],\n reader: (path: string, start?: number, end?: number) => Promise<string[]>\n): Promise<{ path: string; ranges: '*' | Array<[number, number]>; content: string }[]> {\n const out: { path: string; ranges: '*' | Array<[number, number]>; content: string }[] = [];\n for (const f of files) {\n const validRanges = f.lines === '*' ? null : extractValidRanges(f.lines);\n if (f.lines === '*' || !validRanges) {\n const lines = await reader(f.path);\n out.push({ path: f.path, ranges: '*', content: lines.join('\\n') });\n } else {\n const ranges = mergeRanges(validRanges);\n const chunks: string[] = [];\n for (let i = 0; i < ranges.length; i++) {\n const [s, e] = ranges[i];\n if (i === 0 && s > 1) {\n chunks.push(`// ... existing code, block starting at line ${s} ...`);\n } else if (i > 0) {\n chunks.push(`// ... existing code, block starting at line ${s} ...`);\n }\n const lines = await reader(f.path, s, e);\n chunks.push(lines.join('\\n'));\n }\n out.push({ path: f.path, ranges, content: chunks.join('\\n') });\n }\n }\n return out;\n}\n\nfunction mergeRanges(ranges: Array<[number, number]>): Array<[number, number]> {\n if (!ranges.length) return [];\n const sorted = [...ranges].sort((a, b) => a[0] - b[0]);\n const merged: Array<[number, number]> = [];\n let [cs, ce] = sorted[0];\n for (let i = 1; i < sorted.length; i++) {\n const [s, e] = sorted[i];\n if (s <= ce + 1) {\n ce = Math.max(ce, e);\n } else {\n merged.push([cs, ce]);\n cs = s;\n ce = e;\n }\n }\n merged.push([cs, ce]);\n return merged;\n}\n\n","/**\n * Shared helper functions for warp-grep agent loop.\n * Used by both the internal runner and exported for harness users.\n */\n\nimport path from 'path';\nimport { AGENT_CONFIG } from './config.js';\nimport type { ChatMessage } from './types.js';\nimport type { WarpGrepProvider, ListDirectoryEntry } from '../providers/types.js';\n\nconst TRUNCATED_MARKER = '[truncated for context limit]';\n\n/**\n * Get the character size of a ChatMessage (handles all message types).\n */\nfunction getMessageSize(m: ChatMessage): number {\n if (m.role === 'tool') return m.content.length;\n if (m.role === 'assistant') {\n let size = typeof m.content === 'string' ? m.content.length : 0;\n if (m.tool_calls) {\n size += m.tool_calls.reduce((s, tc) => s + tc.function.name.length + tc.function.arguments.length, 0);\n }\n return size;\n }\n // system or user\n return (m as { content: string }).content.length;\n}\n\n/**\n * Format the turn counter message shown to the model.\n */\nexport function formatTurnMessage(turnsUsed: number, maxTurns: number): string {\n const turnsRemaining = maxTurns - turnsUsed;\n if (turnsRemaining === 1) {\n return `\\nYou have used ${turnsUsed} turns, you only have 1 turn remaining. You have run out of turns to explore the code base and MUST call the finish tool now`;\n }\n return `\\nYou have used ${turnsUsed} turn${turnsUsed === 1 ? '' : 's'} and have ${turnsRemaining} remaining`;\n}\n\n/**\n * Calculate and format the context budget indicator.\n */\nexport function calculateContextBudget(messages: ChatMessage[]): string {\n const totalChars = messages.reduce((sum, m) => sum + getMessageSize(m), 0);\n const maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS;\n const percent = Math.floor((totalChars / maxChars) * 100);\n const usedK = Math.floor(totalChars / 1000);\n const maxK = Math.floor(maxChars / 1000);\n return `<context_budget>${percent}% (${usedK}K/${maxK}K chars)</context_budget>`;\n}\n\n/**\n * Build the initial state message containing repo structure and search term.\n */\nexport async function buildInitialState(\n repoRoot: string,\n searchTerm: string,\n provider: WarpGrepProvider,\n options?: { search_type?: string },\n): Promise<string> {\n const budget = calculateContextBudget([]);\n const turnTag = `You have used 0 turns and have ${AGENT_CONFIG.MAX_TURNS} remaining`;\n const treeDepth = options?.search_type === 'node_modules' ? 1 : 2;\n\n const absRoot = path.resolve(repoRoot);\n\n try {\n const entries = await provider.listDirectory({\n path: '.',\n maxResults: AGENT_CONFIG.MAX_OUTPUT_LINES,\n maxDepth: treeDepth,\n });\n\n // Flat list of absolute paths (matches training format)\n // First line is the repo root, then one absolute path per entry\n const lines = [absRoot];\n for (const e of entries) {\n lines.push(path.join(absRoot, e.path));\n }\n\n return `<repo_structure>\\n${lines.join('\\n')}\\n</repo_structure>\\n\\n<search_string>\\n${searchTerm}\\n</search_string>\\n${budget}\\n${turnTag}`;\n } catch {\n return `<repo_structure>\\n${absRoot}\\n</repo_structure>\\n\\n<search_string>\\n${searchTerm}\\n</search_string>\\n${budget}\\n${turnTag}`;\n }\n}\n\n/**\n * Format directory entries as an indented tree string.\n */\nexport function formatListDirectoryTree(entries: ListDirectoryEntry[]): string {\n if (!entries.length) return 'empty';\n return entries\n .map((e) => {\n const indent = ' '.repeat(e.depth);\n const name = e.type === 'dir' ? `${e.name}/` : e.name;\n return `${indent}${name}`;\n })\n .join('\\n');\n}\n\n/**\n * Enforce hard context limit by truncating tool result messages.\n * Preserves the first user message (initial query) and all assistant messages.\n * Truncates tool/user messages from oldest to newest until under the threshold.\n *\n * @param messages - The conversation messages array (mutated in place)\n * @param maxChars - Maximum total character count (defaults to AGENT_CONFIG.MAX_CONTEXT_CHARS)\n * @returns The same messages array, truncated if necessary\n */\nexport function enforceContextLimit(\n messages: ChatMessage[],\n maxChars: number = AGENT_CONFIG.MAX_CONTEXT_CHARS\n): ChatMessage[] {\n const getTotalChars = () => messages.reduce((sum, m) => sum + getMessageSize(m), 0);\n\n if (getTotalChars() <= maxChars) {\n return messages;\n }\n\n // Find indices of truncatable messages (tool results and non-first user messages)\n const truncatableIndices: number[] = [];\n let firstUserSkipped = false;\n for (let i = 0; i < messages.length; i++) {\n const m = messages[i];\n if (m.role === 'tool') {\n truncatableIndices.push(i);\n } else if (m.role === 'user') {\n if (!firstUserSkipped) {\n firstUserSkipped = true;\n continue; // Skip first user message (contains the search query)\n }\n truncatableIndices.push(i);\n }\n }\n\n // Truncate from oldest to newest until under limit\n for (const idx of truncatableIndices) {\n if (getTotalChars() <= maxChars) {\n break;\n }\n const m = messages[idx];\n if (m.role === 'tool' && m.content !== TRUNCATED_MARKER) {\n messages[idx] = { role: 'tool', tool_call_id: m.tool_call_id, content: TRUNCATED_MARKER };\n } else if (m.role === 'user' && (m as { content: string }).content !== TRUNCATED_MARKER) {\n messages[idx] = { role: 'user', content: TRUNCATED_MARKER };\n }\n }\n\n return messages;\n}\n"],"mappings":";;;;;AAEA,eAAsB,SACpB,UACA,MAC6B;AAC7B,QAAM,MAAM,MAAM,SAAS,KAAK,IAAI;AAGpC,MAAI,IAAI,OAAO;AACb,WAAO,EAAE,QAAQ,IAAI,MAAM;AAAA,EAC7B;AAEA,MAAI,CAAC,IAAI,MAAM,QAAQ;AACrB,WAAO,EAAE,QAAQ,aAAa;AAAA,EAChC;AAEA,SAAO,EAAE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B;AACvD,eAAS,GAAG,IAAI,EAAE,MAAM,QAAQ,cAAc,EAAE,cAAc,SAAS,iBAAiB;AAAA,IAC1F,WAAW,EAAE,SAAS,UAAW,EAA0B,YAAY,kBAAkB;AACvF,eAAS,GAAG,IAAI,EAAE,MAAM,QAAQ,SAAS,iBAAiB;AAAA,IAC5D;AAAA,EACF;AAEA,SAAO;AACT;","names":["res","isValidRange","path","path"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WarpGrepClient,
3
3
  formatResult
4
- } from "./chunk-NKUSUSVI.js";
4
+ } from "./chunk-N67TYW2Z.js";
5
5
  import {
6
6
  CODEBASE_SEARCH_TOOL,
7
7
  SEND_MESSAGE_TOOL,
@@ -262,4 +262,4 @@ function deduplicateContexts(contexts) {
262
262
  export {
263
263
  createExploreSubagent
264
264
  };
265
- //# sourceMappingURL=chunk-VZ6VYRQB.js.map
265
+ //# sourceMappingURL=chunk-TSUTRT4Q.js.map
@@ -14,7 +14,7 @@ import {
14
14
  executeToolCall,
15
15
  formatGitHubReadFileResult,
16
16
  formatResult
17
- } from "./chunk-NKUSUSVI.js";
17
+ } from "./chunk-N67TYW2Z.js";
18
18
 
19
19
  // tools/warp_grep/anthropic.ts
20
20
  var INPUT_SCHEMA = {
@@ -90,4 +90,4 @@ export {
90
90
  createGitHubSearchTool,
91
91
  createGitHubReadFileTool
92
92
  };
93
- //# sourceMappingURL=chunk-UYPWKQKV.js.map
93
+ //# sourceMappingURL=chunk-TVUYMM4J.js.map
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AGENT_CONFIG,
16
16
  DEFAULT_EXCLUDES
17
- } from "./chunk-DKODF3YG.js";
17
+ } from "./chunk-I3J46TSB.js";
18
18
 
19
19
  // tools/warp_grep/providers/local.ts
20
20
  import fs from "fs/promises";
@@ -296,9 +296,49 @@ Details: ${res.stderr}` : ""}`
296
296
  await walk(abs, 0);
297
297
  return results;
298
298
  }
299
+ async glob(params) {
300
+ let abs;
301
+ try {
302
+ abs = params.path ? resolveUnderRepo(this.repoRoot, params.path) : this.repoRoot;
303
+ } catch (err) {
304
+ return { files: [], searchDir: this.repoRoot, totalFound: 0, error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}` };
305
+ }
306
+ const stat = await fs.stat(abs).catch(() => null);
307
+ if (!stat || !stat.isDirectory()) {
308
+ return { files: [], searchDir: abs, totalFound: 0, error: `[PATH ERROR] Directory not found: ${params.path || "."}` };
309
+ }
310
+ const targetArg = abs === path.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
311
+ const args = [
312
+ "--no-config",
313
+ "--files",
314
+ "--color=never",
315
+ "-g",
316
+ params.pattern,
317
+ ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
318
+ targetArg || "."
319
+ ];
320
+ const res = await runRipgrep(args, { cwd: this.repoRoot });
321
+ if (res.exitCode === -1) {
322
+ return { files: [], searchDir: abs, totalFound: 0, error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required for glob search.` };
323
+ }
324
+ if (res.exitCode !== 0 && res.exitCode !== 1) {
325
+ return { files: [], searchDir: abs, totalFound: 0, error: `[GLOB ERROR] glob failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}` };
326
+ }
327
+ const absRoot = path.resolve(this.repoRoot);
328
+ const relFiles = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
329
+ const absFiles = relFiles.map((f) => path.resolve(absRoot, f));
330
+ const withMtime = [];
331
+ for (const f of absFiles) {
332
+ const s = await fs.stat(f).catch(() => null);
333
+ withMtime.push({ file: f, mtime: s?.mtimeMs ?? 0 });
334
+ }
335
+ withMtime.sort((a, b) => b.mtime - a.mtime);
336
+ const totalFound = withMtime.length;
337
+ return { files: withMtime.slice(0, 100).map((f) => f.file), searchDir: abs, totalFound };
338
+ }
299
339
  };
300
340
 
301
341
  export {
302
342
  LocalRipgrepProvider
303
343
  };
304
- //# sourceMappingURL=chunk-HZOTLGJH.js.map
344
+ //# sourceMappingURL=chunk-XNBQJSLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/providers/local.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport fssync from 'fs';\nimport path from 'path';\nimport { runRipgrep } from '../utils/ripgrep.js';\nimport { ensureWithinRepo, resolveUnderRepo, toRepoRelative, isSymlink, isTextualFile, fixPathRepetition } from '../utils/paths.js';\nimport type { WarpGrepProvider, GrepResult, ReadResult, GlobResult, ListDirectoryEntry } from './types.js';\nimport { readAllLines } from '../utils/files.js';\nimport { DEFAULT_EXCLUDES, AGENT_CONFIG } from '../agent/config.js';\n\n/**\n * Directories/files to always skip (exact name match)\n */\nconst SKIP_NAMES = new Set([\n // Version control\n '.git', '.svn', '.hg', '.bzr',\n // Dependencies\n 'node_modules', 'bower_components', '.pnpm', '.yarn',\n 'vendor', 'Pods', '.bundle',\n // Python\n '__pycache__', '.pytest_cache', '.mypy_cache', '.ruff_cache',\n '.venv', 'venv', '.tox', '.nox', '.eggs',\n // Build outputs\n 'dist', 'build', 'out', 'output', 'target', '_build',\n '.next', '.nuxt', '.output', '.vercel', '.netlify',\n // Cache\n '.cache', '.parcel-cache', '.turbo', '.nx', '.gradle',\n // IDE\n '.idea', '.vscode', '.vs',\n // Coverage\n 'coverage', '.coverage', 'htmlcov', '.nyc_output',\n // Temp\n 'tmp', 'temp', '.tmp', '.temp',\n // Lock files\n 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb',\n 'Cargo.lock', 'Gemfile.lock', 'poetry.lock',\n]);\n\n/**\n * File extensions to skip\n */\n\nconst SKIP_EXTENSIONS = new Set([\n '.min.js', '.min.css', '.bundle.js',\n '.wasm', '.so', '.dll', '.pyc',\n '.map', '.js.map',\n]);\n\n/**\n * Check if a filename should be skipped\n */\nfunction shouldSkip(name: string, allowNames?: Set<string>): boolean {\n // Allow explicitly permitted names through\n if (allowNames?.has(name)) return false;\n\n // Skip exact name matches\n if (SKIP_NAMES.has(name)) return true;\n\n // Skip hidden files/directories (start with .)\n if (name.startsWith('.')) return true;\n\n // Skip files with certain extensions\n for (const ext of SKIP_EXTENSIONS) {\n if (name.endsWith(ext)) return true;\n }\n\n return false;\n}\n\nexport class LocalRipgrepProvider implements WarpGrepProvider {\n private readonly allowNames?: Set<string>;\n\n constructor(\n private readonly repoRoot: string,\n private readonly excludes: string[] = DEFAULT_EXCLUDES,\n options?: { allowNames?: string[] },\n ) {\n if (options?.allowNames?.length) {\n this.allowNames = new Set(options.allowNames);\n }\n }\n\n async grep(params: { pattern: string; path: string; glob?: string; context_lines?: number; case_sensitive?: boolean }): Promise<GrepResult> {\n let abs: string;\n try {\n abs = resolveUnderRepo(this.repoRoot, params.path);\n } catch (err) {\n return {\n lines: [],\n error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`,\n };\n }\n const stat = await fs.stat(abs).catch(() => null);\n if (!stat) return { lines: [] };\n const targetArg = abs === path.resolve(this.repoRoot) ? '.' : toRepoRelative(this.repoRoot, abs);\n const contextLines = params.context_lines !== undefined ? String(params.context_lines) : '1';\n const args = [\n '--no-config',\n '--no-heading',\n '--with-filename',\n '--line-number',\n '--color=never',\n '--trim',\n '--max-columns=400',\n '-C', contextLines,\n ...(params.case_sensitive === false ? ['--ignore-case'] : []),\n ...(params.glob ? ['--glob', params.glob] : []),\n ...this.excludes.filter(e => !this.allowNames?.has(e)).flatMap((e) => ['-g', `!${e}`]),\n params.pattern,\n targetArg || '.',\n ];\n const res = await runRipgrep(args, { cwd: this.repoRoot });\n \n // Gracefully handle ripgrep not being available\n if (res.exitCode === -1) {\n return {\n lines: [],\n error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required but failed to execute. Please install it:\\n` +\n ` • macOS: brew install ripgrep\\n` +\n ` • Ubuntu/Debian: apt install ripgrep\\n` +\n ` • Windows: choco install ripgrep\\n` +\n ` • Or visit: https://github.com/BurntSushi/ripgrep#installation\\n` +\n `Exit code: ${res.exitCode}${res.stderr ? `\\nDetails: ${res.stderr}` : ''}`,\n };\n }\n \n // Handle other ripgrep errors gracefully\n if (res.exitCode !== 0 && res.exitCode !== 1) {\n return {\n lines: [],\n error: `[RIPGREP ERROR] grep failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ''}`,\n };\n }\n \n const lines = (res.stdout || '')\n .trim()\n .split(/\\r?\\n/)\n .filter((l) => l.length > 0);\n if (lines.length > AGENT_CONFIG.MAX_OUTPUT_LINES) {\n const truncated = lines.slice(0, AGENT_CONFIG.MAX_OUTPUT_LINES);\n truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);\n return { lines: truncated };\n }\n \n return { lines };\n }\n\n async read(params: { path: string; start?: number; end?: number }): Promise<ReadResult> {\n let abs: string;\n try {\n abs = resolveUnderRepo(this.repoRoot, params.path);\n } catch (err) {\n return {\n lines: [],\n error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`,\n };\n }\n let stat = await fs.stat(abs).catch(() => null);\n\n // Handle duplicate path segments from model predictions\n if (!stat || !stat.isFile()) {\n const fixedPath = fixPathRepetition(abs);\n if (fixedPath) {\n const fixedStat = await fs.stat(fixedPath).catch(() => null);\n if (fixedStat?.isFile()) {\n abs = fixedPath;\n stat = fixedStat;\n }\n }\n }\n\n // Gracefully handle file not found / not a file\n if (!stat || !stat.isFile()) {\n return {\n lines: [],\n error: `[FILE NOT FOUND] You tried to read \"${params.path}\" but there is no file at this path. ` +\n `Double-check the path exists and is spelled correctly.`,\n };\n }\n \n // Gracefully handle symlinks\n if (isSymlink(abs)) {\n return {\n lines: [],\n error: `[SYMLINK] You tried to read \"${params.path}\" but this is a symlink. ` +\n `Try reading the actual file it points to instead.`,\n };\n }\n \n // Gracefully handle non-text or too-large files\n if (!isTextualFile(abs)) {\n return {\n lines: [],\n error: `[UNREADABLE FILE] You tried to read \"${params.path}\" but this file is either too large ` +\n `or not a text file, so it cannot be read. Try a different file.`,\n };\n }\n \n let lines: string[];\n try {\n lines = await readAllLines(abs);\n } catch (err) {\n return {\n lines: [],\n error: `[READ ERROR] Failed to read \"${params.path}\": ${err instanceof Error ? err.message : String(err)}`,\n };\n }\n const total = lines.length;\n const rawStart = params.start;\n const rawEnd = params.end;\n \n let s = 1;\n let e = total;\n \n const startValid = rawStart === undefined || (Number.isFinite(rawStart) && rawStart > 0);\n const endValid = rawEnd === undefined || (Number.isFinite(rawEnd) && rawEnd > 0);\n \n if (startValid && endValid) {\n s = rawStart ?? 1;\n e = Math.min(rawEnd ?? total, total);\n if ((s > total && total > 0) || (s > e)) {\n s = 1;\n e = total;\n }\n }\n const out: string[] = [];\n for (let i = s; i <= e; i += 1) {\n const content = lines[i - 1] ?? '';\n out.push(`${i}|${content}`);\n }\n if (out.length > AGENT_CONFIG.MAX_READ_LINES) {\n const truncated = out.slice(0, AGENT_CONFIG.MAX_READ_LINES);\n truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines)`);\n return { lines: truncated };\n }\n \n return { lines: out };\n }\n\n async listDirectory(params: { path: string; pattern?: string | null; maxResults?: number; maxDepth?: number }): Promise<ListDirectoryEntry[]> {\n let abs: string;\n try {\n abs = resolveUnderRepo(this.repoRoot, params.path);\n } catch {\n // Path outside repo - return empty (graceful failure)\n return [];\n }\n const stat = await fs.stat(abs).catch(() => null);\n if (!stat || !stat.isDirectory()) {\n return [];\n }\n const maxResults = params.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;\n const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;\n const regex = params.pattern ? new RegExp(params.pattern) : null;\n const repoRoot = this.repoRoot;\n const allowNames = this.allowNames;\n\n const results: ListDirectoryEntry[] = [];\n let timedOut = false;\n const startTime = Date.now();\n\n async function walk(dir: string, depth: number) {\n if (Date.now() - startTime > AGENT_CONFIG.LIST_TIMEOUT_MS) {\n timedOut = true;\n return;\n }\n if (depth > maxDepth || results.length >= maxResults) return;\n let entries: import('fs').Dirent[];\n try {\n entries = await fs.readdir(dir, { withFileTypes: true });\n } catch {\n return; // skip unreadable directories (ENOENT, EACCES, etc.)\n }\n for (const entry of entries) {\n if (timedOut || results.length >= maxResults) break;\n\n // Simple name-based filtering - skip junk dirs/files\n if (shouldSkip(entry.name, allowNames)) continue;\n \n // Apply user-provided pattern filter\n if (regex && !regex.test(entry.name)) continue;\n \n const full = path.join(dir, entry.name);\n const isDir = entry.isDirectory();\n \n results.push({\n name: entry.name,\n path: toRepoRelative(repoRoot, full),\n type: isDir ? 'dir' : 'file',\n depth,\n });\n if (isDir) {\n await walk(full, depth + 1);\n }\n }\n }\n await walk(abs, 0);\n return results;\n }\n\n async glob(params: { pattern: string; path?: string }): Promise<GlobResult> {\n let abs: string;\n try {\n abs = params.path ? resolveUnderRepo(this.repoRoot, params.path) : this.repoRoot;\n } catch (err) {\n return { files: [], searchDir: this.repoRoot, totalFound: 0, error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}` };\n }\n const stat = await fs.stat(abs).catch(() => null);\n if (!stat || !stat.isDirectory()) {\n return { files: [], searchDir: abs, totalFound: 0, error: `[PATH ERROR] Directory not found: ${params.path || '.'}` };\n }\n\n const targetArg = abs === path.resolve(this.repoRoot) ? '.' : toRepoRelative(this.repoRoot, abs);\n const args = [\n '--no-config',\n '--files',\n '--color=never',\n '-g', params.pattern,\n ...this.excludes.filter(e => !this.allowNames?.has(e)).flatMap(e => ['-g', `!${e}`]),\n targetArg || '.',\n ];\n\n const res = await runRipgrep(args, { cwd: this.repoRoot });\n if (res.exitCode === -1) {\n return { files: [], searchDir: abs, totalFound: 0, error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required for glob search.` };\n }\n if (res.exitCode !== 0 && res.exitCode !== 1) {\n return { files: [], searchDir: abs, totalFound: 0, error: `[GLOB ERROR] glob failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ''}` };\n }\n\n // Convert to absolute paths\n const absRoot = path.resolve(this.repoRoot);\n const relFiles = (res.stdout || '').trim().split(/\\r?\\n/).filter(l => l.length > 0);\n const absFiles = relFiles.map(f => path.resolve(absRoot, f));\n\n // Sort by mtime descending (newest first), matching training format\n const withMtime: Array<{ file: string; mtime: number }> = [];\n for (const f of absFiles) {\n const s = await fs.stat(f).catch(() => null);\n withMtime.push({ file: f, mtime: s?.mtimeMs ?? 0 });\n }\n withMtime.sort((a, b) => b.mtime - a.mtime);\n\n const totalFound = withMtime.length;\n return { files: withMtime.slice(0, 100).map(f => f.file), searchDir: abs, totalFound };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAEf,OAAO,UAAU;AAUjB,IAAM,aAAa,oBAAI,IAAI;AAAA;AAAA,EAEzB;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAO;AAAA;AAAA,EAEvB;AAAA,EAAgB;AAAA,EAAoB;AAAA,EAAS;AAAA,EAC7C;AAAA,EAAU;AAAA,EAAQ;AAAA;AAAA,EAElB;AAAA,EAAe;AAAA,EAAiB;AAAA,EAAe;AAAA,EAC/C;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA;AAAA,EAEjC;AAAA,EAAQ;AAAA,EAAS;AAAA,EAAO;AAAA,EAAU;AAAA,EAAU;AAAA,EAC5C;AAAA,EAAS;AAAA,EAAS;AAAA,EAAW;AAAA,EAAW;AAAA;AAAA,EAExC;AAAA,EAAU;AAAA,EAAiB;AAAA,EAAU;AAAA,EAAO;AAAA;AAAA,EAE5C;AAAA,EAAS;AAAA,EAAW;AAAA;AAAA,EAEpB;AAAA,EAAY;AAAA,EAAa;AAAA,EAAW;AAAA;AAAA,EAEpC;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAQ;AAAA;AAAA,EAEvB;AAAA,EAAqB;AAAA,EAAa;AAAA,EAAkB;AAAA,EACpD;AAAA,EAAc;AAAA,EAAgB;AAChC,CAAC;AAMD,IAAM,kBAAkB,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,MAAM,EAAE,QAAQ,EAAE,KAAK;AAE1C,UAAM,aAAa,UAAU;AAC7B,WAAO,EAAE,OAAO,UAAU,MAAM,GAAG,GAAG,EAAE,IAAI,OAAK,EAAE,IAAI,GAAG,WAAW,KAAK,WAAW;AAAA,EACvF;AACF;","names":[]}
@@ -14,7 +14,7 @@ import {
14
14
  executeToolCall,
15
15
  formatGitHubReadFileResult,
16
16
  formatResult
17
- } from "./chunk-NKUSUSVI.js";
17
+ } from "./chunk-N67TYW2Z.js";
18
18
 
19
19
  // tools/warp_grep/openai.ts
20
20
  var TOOL_PARAMETERS = {
@@ -104,4 +104,4 @@ export {
104
104
  createGitHubReadFileTool,
105
105
  openai_default
106
106
  };
107
- //# sourceMappingURL=chunk-BIQ7234U.js.map
107
+ //# sourceMappingURL=chunk-XT7JQAXV.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WarpGrepClient,
3
3
  formatResult
4
- } from "./chunk-NKUSUSVI.js";
4
+ } from "./chunk-N67TYW2Z.js";
5
5
  import {
6
6
  CODEBASE_SEARCH_TOOL,
7
7
  SEND_MESSAGE_TOOL,
@@ -285,4 +285,4 @@ function deduplicateContexts(contexts) {
285
285
  export {
286
286
  createExploreSubagent
287
287
  };
288
- //# sourceMappingURL=chunk-4PBUB77N.js.map
288
+ //# sourceMappingURL=chunk-YWJHOYEM.js.map