@morphllm/morphsdk 0.2.125 → 0.2.127

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 (219) hide show
  1. package/dist/{chunk-DGYWACHC.js → chunk-3ZA7Y66U.js} +2 -2
  2. package/dist/{chunk-5L3TPS6A.js → chunk-6DRIR7AI.js} +5 -4
  3. package/dist/chunk-6DRIR7AI.js.map +1 -0
  4. package/dist/{chunk-G5YJDK5S.js → chunk-ADHGSV2D.js} +2 -2
  5. package/dist/{chunk-5PNMAWLC.js → chunk-DKODF3YG.js} +2 -2
  6. package/dist/{chunk-5PNMAWLC.js.map → chunk-DKODF3YG.js.map} +1 -1
  7. package/dist/{chunk-BQO3WODX.js → chunk-DS7YL4V3.js} +8 -13
  8. package/dist/chunk-DS7YL4V3.js.map +1 -0
  9. package/dist/{chunk-FEQJCZJQ.js → chunk-EGOCFCAH.js} +2 -2
  10. package/dist/{chunk-TFK4UOUE.js → chunk-EL6CCK7C.js} +6 -6
  11. package/dist/{chunk-IB4MEIQG.js → chunk-GDCVK6SP.js} +2 -2
  12. package/dist/{chunk-UGSV5LPO.js → chunk-GVF4Q75N.js} +2 -2
  13. package/dist/{chunk-TS3E6IRI.js → chunk-GWKCMFD6.js} +2 -2
  14. package/dist/{chunk-WZAZFW77.js → chunk-HZK5TEUK.js} +1 -1
  15. package/dist/{chunk-EF7ZYLA2.js → chunk-HZOTLGJH.js} +19 -12
  16. package/dist/chunk-HZOTLGJH.js.map +1 -0
  17. package/dist/{chunk-3MLWXJTJ.js → chunk-K2FXHDX2.js} +15 -10
  18. package/dist/chunk-K2FXHDX2.js.map +1 -0
  19. package/dist/{chunk-FAZO2LNY.js → chunk-K6YSD3DR.js} +2 -2
  20. package/dist/{chunk-ACHEU2V3.js → chunk-LX34ZO3N.js} +2 -2
  21. package/dist/{chunk-OFQRY3RM.js → chunk-LXBIP5FI.js} +18 -23
  22. package/dist/chunk-LXBIP5FI.js.map +1 -0
  23. package/dist/{chunk-F6HNFC2H.js → chunk-MJHAVXFK.js} +2 -2
  24. package/dist/{chunk-PUGSTXLO.js → chunk-NF2QWJDY.js} +6 -7
  25. package/dist/chunk-NF2QWJDY.js.map +1 -0
  26. package/dist/{chunk-6TH3VNCF.js → chunk-NQQS5BZZ.js} +3 -3
  27. package/dist/{chunk-V3HLOZK2.js → chunk-QLBRTLEI.js} +1 -1
  28. package/dist/{chunk-V3HLOZK2.js.map → chunk-QLBRTLEI.js.map} +1 -1
  29. package/dist/{chunk-57PXQ6IS.js → chunk-QOE522DB.js} +15 -15
  30. package/dist/chunk-QRXG5CAZ.js +27 -0
  31. package/dist/chunk-QRXG5CAZ.js.map +1 -0
  32. package/dist/{chunk-7RTJCQWB.js → chunk-QUULFOWB.js} +10 -5
  33. package/dist/chunk-QUULFOWB.js.map +1 -0
  34. package/dist/{chunk-33CP5QCC.js → chunk-R5IFI552.js} +3 -3
  35. package/dist/{chunk-33CP5QCC.js.map → chunk-R5IFI552.js.map} +1 -1
  36. package/dist/{chunk-IRNUW2DB.js → chunk-REJNS3OW.js} +8 -13
  37. package/dist/chunk-REJNS3OW.js.map +1 -0
  38. package/dist/{chunk-2S7ZQFIB.js → chunk-U73OIAJC.js} +2 -2
  39. package/dist/{chunk-OQGX4RZP.js → chunk-UAQ7UWZB.js} +2 -2
  40. package/dist/chunk-VCKJ22DX.js +131 -0
  41. package/dist/chunk-VCKJ22DX.js.map +1 -0
  42. package/dist/{chunk-2MK64KK4.js → chunk-YTUQEDWH.js} +2 -2
  43. package/dist/{chunk-H6KT7IXW.js → chunk-ZVAXTR2V.js} +2 -2
  44. package/dist/{chunk-BGL35LL6.js → chunk-ZYD2SEQK.js} +2 -2
  45. package/dist/{client-JHPwle1Z.d.ts → client-CNYzlN_6.d.ts} +6 -7
  46. package/dist/client.cjs +166 -579
  47. package/dist/client.cjs.map +1 -1
  48. package/dist/client.d.ts +1 -2
  49. package/dist/client.js +27 -28
  50. package/dist/edge.cjs +2 -2
  51. package/dist/edge.cjs.map +1 -1
  52. package/dist/edge.js +4 -4
  53. package/dist/{finish-pPJfB0uO.d.ts → finish-DBKuo8yj.d.ts} +2 -0
  54. package/dist/index.cjs +166 -579
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.ts +1 -2
  57. package/dist/index.js +29 -30
  58. package/dist/modelrouter/core.cjs +2 -2
  59. package/dist/modelrouter/core.cjs.map +1 -1
  60. package/dist/modelrouter/core.js +3 -3
  61. package/dist/modelrouter/index.cjs +2 -2
  62. package/dist/modelrouter/index.cjs.map +1 -1
  63. package/dist/modelrouter/index.js +3 -3
  64. package/dist/tools/browser/anthropic.cjs +2 -2
  65. package/dist/tools/browser/anthropic.cjs.map +1 -1
  66. package/dist/tools/browser/anthropic.js +5 -5
  67. package/dist/tools/browser/core.cjs +2 -2
  68. package/dist/tools/browser/core.cjs.map +1 -1
  69. package/dist/tools/browser/core.js +4 -4
  70. package/dist/tools/browser/index.cjs +2 -2
  71. package/dist/tools/browser/index.cjs.map +1 -1
  72. package/dist/tools/browser/index.js +7 -7
  73. package/dist/tools/browser/openai.cjs +2 -2
  74. package/dist/tools/browser/openai.cjs.map +1 -1
  75. package/dist/tools/browser/openai.js +5 -5
  76. package/dist/tools/browser/profiles/core.cjs +2 -2
  77. package/dist/tools/browser/profiles/core.cjs.map +1 -1
  78. package/dist/tools/browser/profiles/core.js +3 -3
  79. package/dist/tools/browser/profiles/index.cjs +2 -2
  80. package/dist/tools/browser/profiles/index.cjs.map +1 -1
  81. package/dist/tools/browser/profiles/index.js +3 -3
  82. package/dist/tools/browser/vercel.cjs +2 -2
  83. package/dist/tools/browser/vercel.cjs.map +1 -1
  84. package/dist/tools/browser/vercel.js +5 -5
  85. package/dist/tools/codebase_search/anthropic.cjs +2 -2
  86. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  87. package/dist/tools/codebase_search/anthropic.js +4 -4
  88. package/dist/tools/codebase_search/core.cjs +2 -2
  89. package/dist/tools/codebase_search/core.cjs.map +1 -1
  90. package/dist/tools/codebase_search/core.js +3 -3
  91. package/dist/tools/codebase_search/index.cjs +2 -2
  92. package/dist/tools/codebase_search/index.cjs.map +1 -1
  93. package/dist/tools/codebase_search/index.js +6 -6
  94. package/dist/tools/codebase_search/openai.cjs +2 -2
  95. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  96. package/dist/tools/codebase_search/openai.js +4 -4
  97. package/dist/tools/codebase_search/vercel.cjs +2 -2
  98. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  99. package/dist/tools/codebase_search/vercel.js +4 -4
  100. package/dist/tools/fastapply/anthropic.cjs +2 -2
  101. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  102. package/dist/tools/fastapply/anthropic.js +4 -4
  103. package/dist/tools/fastapply/apply.cjs +2 -2
  104. package/dist/tools/fastapply/apply.cjs.map +1 -1
  105. package/dist/tools/fastapply/apply.js +2 -2
  106. package/dist/tools/fastapply/core.cjs +2 -2
  107. package/dist/tools/fastapply/core.cjs.map +1 -1
  108. package/dist/tools/fastapply/core.js +3 -3
  109. package/dist/tools/fastapply/index.cjs +2 -2
  110. package/dist/tools/fastapply/index.cjs.map +1 -1
  111. package/dist/tools/fastapply/index.js +6 -6
  112. package/dist/tools/fastapply/openai.cjs +2 -2
  113. package/dist/tools/fastapply/openai.cjs.map +1 -1
  114. package/dist/tools/fastapply/openai.js +4 -4
  115. package/dist/tools/fastapply/vercel.cjs +2 -2
  116. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  117. package/dist/tools/fastapply/vercel.js +4 -4
  118. package/dist/tools/index.cjs +2 -2
  119. package/dist/tools/index.cjs.map +1 -1
  120. package/dist/tools/index.js +6 -6
  121. package/dist/tools/utils/resilience.cjs +2 -2
  122. package/dist/tools/utils/resilience.cjs.map +1 -1
  123. package/dist/tools/utils/resilience.js +2 -2
  124. package/dist/tools/warp_grep/agent/config.cjs +1 -1
  125. package/dist/tools/warp_grep/agent/config.cjs.map +1 -1
  126. package/dist/tools/warp_grep/agent/config.d.ts +1 -1
  127. package/dist/tools/warp_grep/agent/config.js +1 -1
  128. package/dist/tools/warp_grep/agent/formatter.cjs +3 -74
  129. package/dist/tools/warp_grep/agent/formatter.cjs.map +1 -1
  130. package/dist/tools/warp_grep/agent/formatter.d.ts +1 -5
  131. package/dist/tools/warp_grep/agent/formatter.js +1 -1
  132. package/dist/tools/warp_grep/agent/parser.cjs +91 -242
  133. package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
  134. package/dist/tools/warp_grep/agent/parser.d.ts +0 -8
  135. package/dist/tools/warp_grep/agent/parser.js +1 -1
  136. package/dist/tools/warp_grep/agent/runner.cjs +122 -543
  137. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  138. package/dist/tools/warp_grep/agent/runner.js +6 -7
  139. package/dist/tools/warp_grep/agent/types.cjs.map +1 -1
  140. package/dist/tools/warp_grep/agent/types.d.ts +2 -0
  141. package/dist/tools/warp_grep/anthropic.cjs +152 -570
  142. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  143. package/dist/tools/warp_grep/anthropic.d.ts +2 -4
  144. package/dist/tools/warp_grep/anthropic.js +11 -15
  145. package/dist/tools/warp_grep/client.cjs +143 -558
  146. package/dist/tools/warp_grep/client.cjs.map +1 -1
  147. package/dist/tools/warp_grep/client.js +9 -10
  148. package/dist/tools/warp_grep/gemini.cjs +152 -570
  149. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  150. package/dist/tools/warp_grep/gemini.d.ts +2 -4
  151. package/dist/tools/warp_grep/gemini.js +18 -23
  152. package/dist/tools/warp_grep/gemini.js.map +1 -1
  153. package/dist/tools/warp_grep/harness.cjs +124 -540
  154. package/dist/tools/warp_grep/harness.cjs.map +1 -1
  155. package/dist/tools/warp_grep/harness.d.ts +4 -5
  156. package/dist/tools/warp_grep/harness.js +5 -11
  157. package/dist/tools/warp_grep/harness.js.map +1 -1
  158. package/dist/tools/warp_grep/index.cjs +147 -565
  159. package/dist/tools/warp_grep/index.cjs.map +1 -1
  160. package/dist/tools/warp_grep/index.d.ts +7 -4
  161. package/dist/tools/warp_grep/index.js +14 -20
  162. package/dist/tools/warp_grep/openai.cjs +152 -570
  163. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  164. package/dist/tools/warp_grep/openai.d.ts +2 -4
  165. package/dist/tools/warp_grep/openai.js +11 -15
  166. package/dist/tools/warp_grep/providers/local.cjs +17 -10
  167. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  168. package/dist/tools/warp_grep/providers/local.d.ts +6 -1
  169. package/dist/tools/warp_grep/providers/local.js +2 -2
  170. package/dist/tools/warp_grep/providers/remote.cjs +4 -5
  171. package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
  172. package/dist/tools/warp_grep/providers/remote.js +2 -2
  173. package/dist/tools/warp_grep/providers/types.cjs.map +1 -1
  174. package/dist/tools/warp_grep/providers/types.d.ts +2 -0
  175. package/dist/tools/warp_grep/vercel.cjs +151 -563
  176. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  177. package/dist/tools/warp_grep/vercel.d.ts +2 -2
  178. package/dist/tools/warp_grep/vercel.js +11 -15
  179. package/dist/version.cjs +2 -2
  180. package/dist/version.cjs.map +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +2 -2
  183. package/dist/chunk-3MLWXJTJ.js.map +0 -1
  184. package/dist/chunk-5L3TPS6A.js.map +0 -1
  185. package/dist/chunk-7RTJCQWB.js.map +0 -1
  186. package/dist/chunk-APP75CBN.js +0 -98
  187. package/dist/chunk-APP75CBN.js.map +0 -1
  188. package/dist/chunk-BQO3WODX.js.map +0 -1
  189. package/dist/chunk-EF7ZYLA2.js.map +0 -1
  190. package/dist/chunk-FMLHRJDF.js +0 -207
  191. package/dist/chunk-FMLHRJDF.js.map +0 -1
  192. package/dist/chunk-GHGJAQSJ.js +0 -282
  193. package/dist/chunk-GHGJAQSJ.js.map +0 -1
  194. package/dist/chunk-IRNUW2DB.js.map +0 -1
  195. package/dist/chunk-OFQRY3RM.js.map +0 -1
  196. package/dist/chunk-PUGSTXLO.js.map +0 -1
  197. package/dist/tools/warp_grep/agent/prompt.cjs +0 -232
  198. package/dist/tools/warp_grep/agent/prompt.cjs.map +0 -1
  199. package/dist/tools/warp_grep/agent/prompt.d.ts +0 -4
  200. package/dist/tools/warp_grep/agent/prompt.js +0 -10
  201. package/dist/tools/warp_grep/agent/prompt.js.map +0 -1
  202. /package/dist/{chunk-DGYWACHC.js.map → chunk-3ZA7Y66U.js.map} +0 -0
  203. /package/dist/{chunk-G5YJDK5S.js.map → chunk-ADHGSV2D.js.map} +0 -0
  204. /package/dist/{chunk-FEQJCZJQ.js.map → chunk-EGOCFCAH.js.map} +0 -0
  205. /package/dist/{chunk-TFK4UOUE.js.map → chunk-EL6CCK7C.js.map} +0 -0
  206. /package/dist/{chunk-IB4MEIQG.js.map → chunk-GDCVK6SP.js.map} +0 -0
  207. /package/dist/{chunk-UGSV5LPO.js.map → chunk-GVF4Q75N.js.map} +0 -0
  208. /package/dist/{chunk-TS3E6IRI.js.map → chunk-GWKCMFD6.js.map} +0 -0
  209. /package/dist/{chunk-WZAZFW77.js.map → chunk-HZK5TEUK.js.map} +0 -0
  210. /package/dist/{chunk-FAZO2LNY.js.map → chunk-K6YSD3DR.js.map} +0 -0
  211. /package/dist/{chunk-ACHEU2V3.js.map → chunk-LX34ZO3N.js.map} +0 -0
  212. /package/dist/{chunk-F6HNFC2H.js.map → chunk-MJHAVXFK.js.map} +0 -0
  213. /package/dist/{chunk-6TH3VNCF.js.map → chunk-NQQS5BZZ.js.map} +0 -0
  214. /package/dist/{chunk-57PXQ6IS.js.map → chunk-QOE522DB.js.map} +0 -0
  215. /package/dist/{chunk-2S7ZQFIB.js.map → chunk-U73OIAJC.js.map} +0 -0
  216. /package/dist/{chunk-OQGX4RZP.js.map → chunk-UAQ7UWZB.js.map} +0 -0
  217. /package/dist/{chunk-2MK64KK4.js.map → chunk-YTUQEDWH.js.map} +0 -0
  218. /package/dist/{chunk-H6KT7IXW.js.map → chunk-ZVAXTR2V.js.map} +0 -0
  219. /package/dist/{chunk-BGL35LL6.js.map → chunk-ZYD2SEQK.js.map} +0 -0
package/dist/client.cjs CHANGED
@@ -36,7 +36,7 @@ var init_package = __esm({
36
36
  "package.json"() {
37
37
  package_default = {
38
38
  name: "@morphllm/morphsdk",
39
- version: "0.2.125",
39
+ version: "0.2.127",
40
40
  description: "TypeScript SDK and CLI for Morph Fast Apply integration",
41
41
  type: "module",
42
42
  main: "./dist/index.cjs",
@@ -178,7 +178,7 @@ var init_package = __esm({
178
178
  "!dist/**/*.test.*"
179
179
  ],
180
180
  scripts: {
181
- build: "tsup version.ts index.ts edge.ts client.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/prompt.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
181
+ build: "tsup version.ts index.ts edge.ts client.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
182
182
  prepare: "npm run build",
183
183
  typecheck: "tsc --noEmit",
184
184
  lint: "eslint .",
@@ -490,7 +490,7 @@ var init_config = __esm({
490
490
  ".*"
491
491
  ];
492
492
  DEFAULT_EXCLUDES = (process.env.MORPH_WARP_GREP_EXCLUDE || "").split(",").map((s) => s.trim()).filter(Boolean).concat(BUILTIN_EXCLUDES);
493
- DEFAULT_MODEL = "morph-warp-grep-v1";
493
+ DEFAULT_MODEL = "morph-warp-grep-v2";
494
494
  }
495
495
  });
496
496
 
@@ -645,7 +645,8 @@ var local_exports = {};
645
645
  __export(local_exports, {
646
646
  LocalRipgrepProvider: () => LocalRipgrepProvider
647
647
  });
648
- function shouldSkip2(name) {
648
+ function shouldSkip2(name, allowNames) {
649
+ if (allowNames?.has(name)) return false;
649
650
  if (SKIP_NAMES2.has(name)) return true;
650
651
  if (name.startsWith(".")) return true;
651
652
  for (const ext of SKIP_EXTENSIONS2) {
@@ -740,10 +741,14 @@ var init_local = __esm({
740
741
  ".js.map"
741
742
  ]);
742
743
  LocalRipgrepProvider = class {
743
- constructor(repoRoot, excludes = DEFAULT_EXCLUDES) {
744
+ constructor(repoRoot, excludes = DEFAULT_EXCLUDES, options) {
744
745
  this.repoRoot = repoRoot;
745
746
  this.excludes = excludes;
747
+ if (options?.allowNames?.length) {
748
+ this.allowNames = new Set(options.allowNames);
749
+ }
746
750
  }
751
+ allowNames;
747
752
  async grep(params) {
748
753
  let abs;
749
754
  try {
@@ -757,6 +762,7 @@ var init_local = __esm({
757
762
  const stat = await import_promises2.default.stat(abs).catch(() => null);
758
763
  if (!stat) return { lines: [] };
759
764
  const targetArg = abs === import_path5.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
765
+ const contextLines = params.context_lines !== void 0 ? String(params.context_lines) : "1";
760
766
  const args = [
761
767
  "--no-config",
762
768
  "--no-heading",
@@ -766,9 +772,10 @@ var init_local = __esm({
766
772
  "--trim",
767
773
  "--max-columns=400",
768
774
  "-C",
769
- "1",
775
+ contextLines,
776
+ ...params.case_sensitive === false ? ["--ignore-case"] : [],
770
777
  ...params.glob ? ["--glob", params.glob] : [],
771
- ...this.excludes.flatMap((e) => ["-g", `!${e}`]),
778
+ ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
772
779
  params.pattern,
773
780
  targetArg || "."
774
781
  ];
@@ -793,10 +800,9 @@ Details: ${res.stderr}` : ""}`
793
800
  }
794
801
  const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
795
802
  if (lines.length > AGENT_CONFIG.MAX_OUTPUT_LINES) {
796
- return {
797
- lines: [],
798
- error: "query not specific enough, tool tried to return too much context and failed"
799
- };
803
+ const truncated = lines.slice(0, AGENT_CONFIG.MAX_OUTPUT_LINES);
804
+ truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);
805
+ return { lines: truncated };
800
806
  }
801
807
  return { lines };
802
808
  }
@@ -870,7 +876,7 @@ Details: ${res.stderr}` : ""}`
870
876
  }
871
877
  if (out.length > AGENT_CONFIG.MAX_READ_LINES) {
872
878
  const truncated = out.slice(0, AGENT_CONFIG.MAX_READ_LINES);
873
- truncated.push(`... [truncated: showing ${AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines]`);
879
+ truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines)`);
874
880
  return { lines: truncated };
875
881
  }
876
882
  return { lines: out };
@@ -890,6 +896,7 @@ Details: ${res.stderr}` : ""}`
890
896
  const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
891
897
  const regex = params.pattern ? new RegExp(params.pattern) : null;
892
898
  const repoRoot = this.repoRoot;
899
+ const allowNames = this.allowNames;
893
900
  const results = [];
894
901
  let timedOut = false;
895
902
  const startTime = Date.now();
@@ -907,7 +914,7 @@ Details: ${res.stderr}` : ""}`
907
914
  }
908
915
  for (const entry of entries) {
909
916
  if (timedOut || results.length >= maxResults) break;
910
- if (shouldSkip2(entry.name)) continue;
917
+ if (shouldSkip2(entry.name, allowNames)) continue;
911
918
  if (regex && !regex.test(entry.name)) continue;
912
919
  const full = import_path5.default.join(dir, entry.name);
913
920
  const isDir = entry.isDirectory();
@@ -2470,483 +2477,130 @@ async function checkHealth(config = {}) {
2470
2477
  // tools/warp_grep/agent/runner.ts
2471
2478
  init_config();
2472
2479
 
2473
- // tools/warp_grep/agent/prompt.ts
2474
- var SYSTEM_PROMPT = `You are a code search agent. Your task is to find all relevant code for a given search_string.
2475
-
2476
- ### workflow
2477
- You have exactly 4 turns. The 4th turn MUST be a \`finish\` call. Each turn allows up to 8 parallel tool calls.
2478
-
2479
- - Turn 1: Map the territory OR dive deep (based on search_string specificity)
2480
- - Turn 2-3: Refine based on findings
2481
- - Turn 4: MUST call \`finish\` with all relevant code locations
2482
- - You MAY call \`finish\` early if confident\u2014but never before at least 1 search turn.
2483
- - The user strongly prefers if you can call the finish tool early, but you must be correct
2484
-
2485
- Remember, if the task feels easy to you, it is strongly desirable to call 'finish' early using fewer turns, but quality over speed
2486
-
2487
- ### tools
2488
- Tool calls use nested XML elements:
2489
- \`\`\`xml
2490
- <tool_name>
2491
- <parameter>value</parameter>
2492
- </tool_name>
2493
- \`\`\`
2494
-
2495
- ### \`list_directory\`
2496
- Directory tree view. Shows structure of a path, optionally filtered by regex pattern.
2497
-
2498
- Elements:
2499
- - \`<path>\` (required): Directory path to list (use \`.\` for repo root)
2500
- - \`<pattern>\` (optional): Regex to filter results
2501
-
2502
- Examples:
2503
- \`\`\`
2504
- <list_directory>
2505
- <path>src/services</path>
2506
- </list_directory>
2507
-
2508
- <list_directory>
2509
- <path>lib/utils</path>
2510
- <pattern>.*\\.(ts|js)$</pattern>
2511
- </list_directory>
2512
- \`\`\`
2513
-
2514
- ### \`read\`
2515
- Read file contents. Supports multiple line ranges.
2516
- - Returns numbered lines for easy reference
2517
- - ALWAYS include import statements (usually lines 1-20). Better to over-include than miss context.
2518
-
2519
- Elements:
2520
- - \`<path>\` (required): File path to read
2521
- - \`<lines>\` (optional): Line ranges like "1-50,75-80,100-120" (omit to read entire file)
2522
-
2523
- Examples:
2524
- \`\`\`
2525
- <read>
2526
- <path>src/main.py</path>
2527
- </read>
2528
-
2529
- <read>
2530
- <path>src/auth.py</path>
2531
- <lines>1-20,45-80,150-200</lines>
2532
- </read>
2533
- \`\`\`
2534
-
2535
- ### \`grep\`
2536
- Search for pattern matches across files. Returns matches with 1 line of context above and below.
2537
- - Match lines use \`:\` separator \u2192 \`filepath:linenum:content\`
2538
- - Context lines use \`-\` separator \u2192 \`filepath-linenum-content\`
2539
-
2540
- Elements:
2541
- - \`<pattern>\` (required): Search pattern (regex). Use \`(a|b)\` for OR patterns.
2542
- - \`<sub_dir>\` (optional): Subdirectory to search in (defaults to \`.\`)
2543
- - \`<glob>\` (optional): File pattern filter like \`*.py\` or \`*.{ts,tsx}\`
2544
-
2545
- Examples:
2546
- \`\`\`
2547
- <grep>
2548
- <pattern>(authenticate|authorize|login)</pattern>
2549
- <sub_dir>src/auth/</sub_dir>
2550
- </grep>
2551
-
2552
- <grep>
2553
- <pattern>class.*(Service|Controller)</pattern>
2554
- <glob>*.{ts,js}</glob>
2555
- </grep>
2556
-
2557
- <grep>
2558
- <pattern>(DB_HOST|DATABASE_URL|connection)</pattern>
2559
- <glob>*.{py,yaml,env}</glob>
2560
- <sub_dir>lib/</sub_dir>
2561
- </grep>
2562
- \`\`\`
2563
-
2564
- ### \`finish\`
2565
- Submit final answer with all relevant code locations. Uses nested \`<file>\` elements.
2566
-
2567
- File elements:
2568
- - \`<path>\` (required): File path
2569
- - \`<lines>\` (optional): Line ranges like "1-50,75-80" (\`*\` for entire file)
2570
-
2571
- ALWAYS include import statements (usually lines 1-20). Better to over-include than miss context.
2572
-
2573
- Examples:
2574
- \`\`\`
2575
- <finish>
2576
- <file>
2577
- <path>src/auth.py</path>
2578
- <lines>1-15,25-50,75-80</lines>
2579
- </file>
2580
- <file>
2581
- <path>src/models/user.py</path>
2582
- <lines>*</lines>
2583
- </file>
2584
- </finish>
2585
- \`\`\`
2586
- </tools>
2587
-
2588
- <strategy>
2589
- **Before your first tool call, classify the search_string:**
2590
-
2591
- | Search_string Type | Round 1 Strategy | Early Finish? |
2592
- |------------|------------------|---------------|
2593
- | **Specific** (function name, error string, unique identifier) | 8 parallel greps on likely paths | Often by round 2 |
2594
- | **Conceptual** (how does X work, where is Y handled) | list_directory + 2-3 broad greps | Rarely early |
2595
- | **Exploratory** (find all tests, list API endpoints) | list_directory at multiple depths | Usually needs 3 rounds |
2596
-
2597
- **Parallel call patterns:**
2598
- - **Shotgun grep**: Same pattern, 8 different directories\u2014fast coverage
2599
- - **Variant grep**: 8 pattern variations (synonyms, naming conventions)\u2014catches inconsistent codebases
2600
- - **Funnel**: 1 list_directory + 7 greps\u2014orient and search simultaneously
2601
- - **Deep read**: 8 reads on files you already identified\u2014gather full context fast
2602
-
2603
- **Tool call expectations:**
2604
- - Low quality tool calls are ones that give back sparse information. This either means they are not well thought out and are not educated guesses OR, they are too broad and give back too many results.
2605
- - High quality tool calls strike a balance between complexity in the tool call to exclude results we know we don't want, and how wide the search space is so that we don't miss anything. It is ok to start off with wider search spaces, but is imperative that you use your intuition from there on out and seek high quality tool calls only.
2606
- - You are not starting blind, you have some information about root level repo structure going in, so use that to prevent making trivial repo wide queries.
2607
- - The grep tool shows you which file path and line numbers the pattern was found in, use this information smartly when trying to read the file.
2608
- </strategy>
2609
-
2610
- <output_format>
2611
- EVERY response MUST follow this exact format:
2612
-
2613
- 1. First, wrap your reasoning in \`<think>...</think>\` tags containing:
2614
- - Search_string classification (specific/conceptual/exploratory)
2615
- - Confidence estimate (can I finish in 1-2 rounds?)
2616
- - This round's parallel strategy
2617
- - What signals would let me finish early?
2618
-
2619
- 2. Then, output up to 8 tool calls using nested XML elements.
2620
-
2621
- Example:
2622
- \`\`\`
2623
- <think>
2624
- This is a specific search_string about authentication. I'll grep for auth-related patterns.
2625
- High confidence I can finish in 2 rounds if I find the auth module. I have already been shown the repo's structure at root
2626
- Strategy: Shotgun grep across likely directories.
2627
- </think>
2628
- <grep>
2629
- <pattern>(authenticate|login|session)</pattern>
2630
- <sub_dir>src/auth/</sub_dir>
2631
- </grep>
2632
- <grep>
2633
- <pattern>(middleware|interceptor)</pattern>
2634
- <glob>*.{ts,js}</glob>
2635
- </grep>
2636
- <list_directory>
2637
- <path>src/auth</path>
2638
- </list_directory>
2639
- \`\`\`
2640
-
2641
- Finishing example:
2642
- \`\`\`
2643
- <think>
2644
- I think I have a rough idea, but this is my last turn so I must call the finish tool regardless.
2645
- </think>
2646
- <finish>
2647
- <file>
2648
- <path>src/auth/login.py</path>
2649
- <lines>1-50</lines>
2650
- </file>
2651
- <file>
2652
- <path>src/middleware/session.py</path>
2653
- <lines>10-80</lines>
2654
- </file>
2655
- </finish>
2656
- \`\`\`
2657
-
2658
- No commentary outside \`<think>\`. No explanations after tool calls.
2659
- </output_format>
2660
-
2661
- use as all 8 tool calls to be optimal
2662
-
2663
- <finishing_requirements>
2664
- When calling \`finish\`:
2665
- - Include the import section (typically lines 1-20) of each file
2666
- - Include all function/class definitions that are relevant
2667
- - Include any type definitions, interfaces, or constants used
2668
- - Better to over-include than leave the user missing context
2669
- - If unsure about boundaries, include more rather than less
2670
- </finishing_requirements>`;
2671
- function getSystemPrompt() {
2672
- return SYSTEM_PROMPT;
2673
- }
2674
-
2675
2480
  // tools/warp_grep/agent/parser.ts
2676
- var VALID_COMMANDS = ["list_directory", "grep", "read", "finish"];
2481
+ var VALID_COMMANDS = ["list_directory", "ripgrep", "read", "finish"];
2677
2482
  function isValidCommand(name) {
2678
2483
  return VALID_COMMANDS.includes(name);
2679
2484
  }
2680
- function getXmlElementText(xml, tagName) {
2681
- const regex = new RegExp(`<${tagName}>([\\s\\S]*?)</${tagName}>`, "i");
2682
- const match = xml.match(regex);
2683
- return match ? match[1].trim() : null;
2684
- }
2685
- function parseNestedXmlTools(text) {
2485
+ function parseQwen3ToolCalls(text) {
2686
2486
  const tools = [];
2687
- const toolRegex = /<([a-z_][a-z0-9_]*)>([\s\S]*?)<\/\1>/gi;
2487
+ const toolCallRegex = /<tool_call>\s*<function=([a-z_][a-z0-9_]*)>([\s\S]*?)<\/function>\s*<\/tool_call>/gi;
2688
2488
  let match;
2689
- while ((match = toolRegex.exec(text)) !== null) {
2690
- const rawToolName = match[1].toLowerCase();
2691
- const content = match[2];
2692
- if (!isValidCommand(rawToolName)) continue;
2693
- const toolName = rawToolName;
2694
- if (toolName === "list_directory") {
2695
- const path5 = getXmlElementText(content, "path");
2696
- const pattern = getXmlElementText(content, "pattern");
2697
- if (path5) {
2698
- tools.push({ name: "list_directory", arguments: { path: path5, pattern } });
2489
+ while ((match = toolCallRegex.exec(text)) !== null) {
2490
+ const funcName = match[1].toLowerCase();
2491
+ const body = match[2];
2492
+ if (!isValidCommand(funcName)) continue;
2493
+ const params = {};
2494
+ const paramRegex = /<parameter=([a-z_][a-z0-9_]*)>([\s\S]*?)<\/parameter>/gi;
2495
+ let paramMatch;
2496
+ while ((paramMatch = paramRegex.exec(body)) !== null) {
2497
+ params[paramMatch[1].toLowerCase()] = paramMatch[2].trim();
2498
+ }
2499
+ if (funcName === "ripgrep") {
2500
+ const pattern = params.pattern;
2501
+ if (!pattern) continue;
2502
+ const args = {
2503
+ pattern,
2504
+ path: params.path || ".",
2505
+ ...params.glob && { glob: params.glob },
2506
+ ...params.context_lines && { context_lines: parseInt(params.context_lines, 10) },
2507
+ ...params.case_sensitive && { case_sensitive: params.case_sensitive === "true" }
2508
+ };
2509
+ tools.push({ name: "grep", arguments: args });
2510
+ } else if (funcName === "list_directory") {
2511
+ const command = params.command;
2512
+ const directPath = params.path;
2513
+ let dirPath = directPath || ".";
2514
+ if (!directPath && command) {
2515
+ const tokens = command.trim().split(/\s+/);
2516
+ const pathTokens = tokens.slice(1).filter((t) => !t.startsWith("-") && !t.startsWith("|") && !t.startsWith("\\("));
2517
+ if (pathTokens.length > 0) {
2518
+ dirPath = pathTokens[0];
2519
+ }
2699
2520
  }
2700
- } else if (toolName === "grep") {
2701
- const pattern = getXmlElementText(content, "pattern");
2702
- const subDir = getXmlElementText(content, "sub_dir");
2703
- const glob = getXmlElementText(content, "glob");
2704
- if (pattern) {
2705
- tools.push({
2706
- name: "grep",
2707
- arguments: {
2708
- pattern,
2709
- path: subDir || ".",
2710
- ...glob && { glob }
2521
+ tools.push({ name: "list_directory", arguments: { path: dirPath, pattern: params.pattern || null } });
2522
+ } else if (funcName === "read") {
2523
+ const filePath = params.path;
2524
+ if (!filePath) continue;
2525
+ const args = { path: filePath };
2526
+ const linesStr = params.lines;
2527
+ if (linesStr) {
2528
+ const ranges = [];
2529
+ for (const rangeStr of linesStr.split(",")) {
2530
+ const trimmed = rangeStr.trim();
2531
+ if (!trimmed) continue;
2532
+ const [s, e] = trimmed.split("-").map((v) => parseInt(v.trim(), 10));
2533
+ if (Number.isFinite(s) && Number.isFinite(e)) {
2534
+ ranges.push([s, e]);
2535
+ } else if (Number.isFinite(s)) {
2536
+ ranges.push([s, s]);
2711
2537
  }
2712
- });
2538
+ }
2539
+ if (ranges.length === 1) {
2540
+ args.start = ranges[0][0];
2541
+ args.end = ranges[0][1];
2542
+ } else if (ranges.length > 1) {
2543
+ args.lines = ranges;
2544
+ }
2545
+ }
2546
+ tools.push({ name: "read", arguments: args });
2547
+ } else if (funcName === "finish") {
2548
+ if (params.result && !params.files) {
2549
+ tools.push({ name: "finish", arguments: { files: [], textResult: params.result } });
2550
+ continue;
2551
+ }
2552
+ const filesStr = params.files;
2553
+ if (!filesStr) {
2554
+ tools.push({ name: "finish", arguments: { files: [], textResult: "No relevant code found." } });
2555
+ continue;
2713
2556
  }
2714
- } else if (toolName === "read") {
2715
- const path5 = getXmlElementText(content, "path");
2716
- const linesStr = getXmlElementText(content, "lines");
2717
- if (path5) {
2718
- const args = { path: path5 };
2719
- if (linesStr) {
2557
+ const files = [];
2558
+ for (const line of filesStr.split("\n")) {
2559
+ const trimmed = line.trim();
2560
+ if (!trimmed) continue;
2561
+ const colonIdx = trimmed.indexOf(":");
2562
+ if (colonIdx === -1) {
2563
+ files.push({ path: trimmed, lines: "*" });
2564
+ } else {
2565
+ const filePath = trimmed.slice(0, colonIdx);
2566
+ const rangesPart = trimmed.slice(colonIdx + 1);
2720
2567
  const ranges = [];
2721
- for (const rangeStr of linesStr.split(",")) {
2722
- const trimmed = rangeStr.trim();
2723
- if (!trimmed) continue;
2724
- const [s, e] = trimmed.split("-").map((v) => parseInt(v.trim(), 10));
2568
+ for (const rangeStr of rangesPart.split(",")) {
2569
+ const rt = rangeStr.trim();
2570
+ if (!rt || rt === "*") {
2571
+ files.push({ path: filePath, lines: "*" });
2572
+ break;
2573
+ }
2574
+ const [s, e] = rt.split("-").map((v) => parseInt(v.trim(), 10));
2725
2575
  if (Number.isFinite(s) && Number.isFinite(e)) {
2726
2576
  ranges.push([s, e]);
2727
2577
  } else if (Number.isFinite(s)) {
2728
2578
  ranges.push([s, s]);
2729
2579
  }
2730
2580
  }
2731
- if (ranges.length === 1) {
2732
- args.start = ranges[0][0];
2733
- args.end = ranges[0][1];
2734
- } else if (ranges.length > 1) {
2735
- args.lines = ranges;
2736
- }
2737
- }
2738
- tools.push({ name: "read", arguments: args });
2739
- }
2740
- } else if (toolName === "finish") {
2741
- const fileRegex = /<file>([\s\S]*?)<\/file>/gi;
2742
- const files = [];
2743
- let fileMatch;
2744
- while ((fileMatch = fileRegex.exec(content)) !== null) {
2745
- const fileContent = fileMatch[1];
2746
- const filePath = getXmlElementText(fileContent, "path");
2747
- const linesStr = getXmlElementText(fileContent, "lines");
2748
- if (filePath) {
2749
- if (!linesStr || linesStr.trim() === "*") {
2581
+ if (ranges.length > 0) {
2582
+ files.push({ path: filePath, lines: ranges });
2583
+ } else if (!files.some((f) => f.path === filePath)) {
2750
2584
  files.push({ path: filePath, lines: "*" });
2751
- } else {
2752
- const ranges = [];
2753
- for (const rangeStr of linesStr.split(",")) {
2754
- const [s, e] = rangeStr.split("-").map((v) => parseInt(v.trim(), 10));
2755
- if (Number.isFinite(s) && Number.isFinite(e)) {
2756
- ranges.push([s, e]);
2757
- }
2758
- }
2759
- if (ranges.length > 0) {
2760
- files.push({ path: filePath, lines: ranges });
2761
- } else {
2762
- files.push({ path: filePath, lines: "*" });
2763
- }
2764
2585
  }
2765
2586
  }
2766
2587
  }
2767
2588
  if (files.length > 0) {
2768
2589
  tools.push({ name: "finish", arguments: { files } });
2769
2590
  } else {
2770
- const raw = content.replace(/<[^>]*>/g, "").trim();
2771
- const textResult = !raw || raw === "*" ? "No relevant code found." : raw;
2772
- tools.push({ name: "finish", arguments: { files: [], textResult } });
2591
+ tools.push({ name: "finish", arguments: { files: [], textResult: filesStr } });
2773
2592
  }
2774
2593
  }
2775
2594
  }
2776
- if (tools.length === 0) {
2777
- const fnFinishMatch = text.match(/<function=finish>([\s\S]*?)<\/function>/i);
2778
- if (fnFinishMatch) {
2779
- const inner = fnFinishMatch[1];
2780
- const paramMatch = inner.match(/<parameter=result>([\s\S]*?)<\/parameter>/i);
2781
- const raw = (paramMatch ? paramMatch[1] : inner).trim();
2782
- const textResult = !raw || raw === "*" ? "No relevant code found." : raw;
2783
- tools.push({ name: "finish", arguments: { files: [], textResult } });
2784
- }
2785
- }
2786
2595
  return tools;
2787
2596
  }
2788
- function preprocessText(text) {
2789
- const processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "").replace(/<\/?tool_call>/gi, "");
2790
- const nestedTools = parseNestedXmlTools(processed);
2791
- const toolCallLines = [];
2792
- const allLines = processed.split(/\r?\n/).map((l) => l.trim());
2793
- for (const line of allLines) {
2794
- if (!line) continue;
2795
- if (line.startsWith("<")) continue;
2796
- const firstWord = line.split(/\s/)[0];
2797
- if (VALID_COMMANDS.includes(firstWord)) {
2798
- if (!toolCallLines.includes(line)) {
2799
- toolCallLines.push(line);
2800
- }
2801
- }
2802
- }
2803
- return { lines: toolCallLines, nestedTools };
2804
- }
2805
2597
  var LLMResponseParser = class {
2806
- finishSpecSplitRe = /,(?=[^,\s]+:)/;
2807
2598
  parse(text) {
2808
2599
  if (typeof text !== "string") {
2809
2600
  throw new TypeError("Command text must be a string.");
2810
2601
  }
2811
- const { lines, nestedTools } = preprocessText(text);
2812
- const commands = [...nestedTools];
2813
- let finishAccumulator = null;
2814
- lines.forEach((line) => {
2815
- if (!line || line.startsWith("#")) return;
2816
- const parts = this.splitLine(line);
2817
- if (parts.length === 0) return;
2818
- const cmd = parts[0];
2819
- switch (cmd) {
2820
- case "list_directory":
2821
- this.handleListDirectory(parts, line, commands);
2822
- break;
2823
- case "grep":
2824
- this.handleGrep(parts, line, commands);
2825
- break;
2826
- case "read":
2827
- this.handleRead(parts, line, commands);
2828
- break;
2829
- case "finish":
2830
- finishAccumulator = this.handleFinish(parts, line, commands, finishAccumulator);
2831
- break;
2832
- default:
2833
- break;
2834
- }
2835
- });
2836
- if (finishAccumulator) {
2837
- const map = finishAccumulator;
2838
- const entries = [...map.entries()];
2839
- const filesPayload = entries.map(([path5, ranges]) => ({
2840
- path: path5,
2841
- lines: [...ranges].sort((a, b) => a[0] - b[0])
2842
- }));
2843
- commands.push({ name: "finish", arguments: { files: filesPayload } });
2844
- }
2845
- return commands;
2846
- }
2847
- splitLine(line) {
2848
- const parts = [];
2849
- let current = "";
2850
- let inSingle = false;
2851
- for (let i = 0; i < line.length; i++) {
2852
- const ch = line[i];
2853
- if (ch === "'" && line[i - 1] !== "\\") {
2854
- inSingle = !inSingle;
2855
- current += ch;
2856
- } else if (!inSingle && /\s/.test(ch)) {
2857
- if (current) {
2858
- parts.push(current);
2859
- current = "";
2860
- }
2861
- } else {
2862
- current += ch;
2863
- }
2864
- }
2865
- if (current) parts.push(current);
2866
- return parts;
2867
- }
2868
- /** Helper to create a _skip tool call with an error message */
2869
- skip(message) {
2870
- return { name: "_skip", arguments: { message } };
2871
- }
2872
- handleListDirectory(parts, rawLine, commands) {
2873
- if (parts.length < 2) {
2874
- commands.push(this.skip(
2875
- `[SKIPPED] Your command "${rawLine}" is missing a path. Correct format: list_directory <path> [pattern]. Example: list_directory src/`
2876
- ));
2877
- return;
2878
- }
2879
- const path5 = parts[1];
2880
- const pattern = parts[2]?.replace(/^"|"$/g, "") ?? null;
2881
- commands.push({ name: "list_directory", arguments: { path: path5, pattern } });
2882
- }
2883
- handleGrep(parts, rawLine, commands) {
2884
- if (parts.length < 3) {
2885
- commands.push(this.skip(
2886
- `[SKIPPED] Your command "${rawLine}" is missing arguments. Correct format: grep '<pattern>' <path>. Example: grep 'TODO' src/`
2887
- ));
2888
- return;
2889
- }
2890
- let pat = parts[1];
2891
- if (pat.startsWith("'") && pat.endsWith("'")) {
2892
- pat = pat.slice(1, -1);
2893
- }
2894
- if (!pat) {
2895
- commands.push(this.skip(
2896
- `[SKIPPED] Your command "${rawLine}" has an empty pattern. Provide a non-empty search pattern. Example: grep 'function' src/`
2897
- ));
2898
- return;
2899
- }
2900
- commands.push({ name: "grep", arguments: { pattern: pat, path: parts[2] } });
2901
- }
2902
- handleRead(parts, rawLine, commands) {
2903
- if (parts.length < 2) {
2904
- commands.push(this.skip(
2905
- `[SKIPPED] Your command "${rawLine}" is missing a path. Correct format: read <path> or read <path>:<start>-<end>. Example: read src/index.ts:1-50`
2906
- ));
2907
- return;
2908
- }
2909
- const spec = parts[1];
2910
- const rangeIdx = spec.indexOf(":");
2911
- if (rangeIdx === -1) {
2912
- commands.push({ name: "read", arguments: { path: spec } });
2913
- return;
2914
- }
2915
- const filePath = spec.slice(0, rangeIdx);
2916
- const range = spec.slice(rangeIdx + 1);
2917
- const [s, e] = range.split("-").map((v) => parseInt(v, 10));
2918
- if (!Number.isFinite(s) || !Number.isFinite(e)) {
2919
- commands.push({ name: "read", arguments: { path: filePath } });
2920
- return;
2921
- }
2922
- commands.push({ name: "read", arguments: { path: filePath, start: s, end: e } });
2923
- }
2924
- handleFinish(parts, rawLine, commands, acc) {
2925
- const map = acc ?? /* @__PURE__ */ new Map();
2926
- const args = parts.slice(1);
2927
- for (const token of args) {
2928
- const [filePath, rangesText] = token.split(":", 2);
2929
- if (!filePath || !rangesText) {
2930
- commands.push(this.skip(
2931
- `[SKIPPED] Invalid finish token "${token}". Correct format: finish <path>:<start>-<end>. Example: finish src/index.ts:1-50`
2932
- ));
2933
- continue;
2934
- }
2935
- const rangeSpecs = rangesText.split(",").filter(Boolean);
2936
- for (const spec of rangeSpecs) {
2937
- const [s, e] = spec.split("-").map((v) => parseInt(v, 10));
2938
- if (!Number.isFinite(s) || !Number.isFinite(e) || e < s) {
2939
- commands.push(this.skip(
2940
- `[SKIPPED] Invalid range "${spec}" in "${token}". Ranges must be <start>-<end> where start <= end. Example: 1-50`
2941
- ));
2942
- continue;
2943
- }
2944
- const arr = map.get(filePath) ?? [];
2945
- arr.push([s, e]);
2946
- map.set(filePath, arr);
2947
- }
2948
- }
2949
- return map;
2602
+ const withoutThink = text.replace(/<think>[\s\S]*?<\/think>/gi, "");
2603
+ return parseQwen3ToolCalls(withoutThink);
2950
2604
  }
2951
2605
  };
2952
2606
 
@@ -3016,14 +2670,12 @@ async function toolListDirectory(provider, args) {
3016
2670
  }
3017
2671
  const { entries: list } = await getListRecursive(initialDepth);
3018
2672
  if (!list.length) return "empty";
3019
- if (list.length >= maxResults) {
3020
- return "query not specific enough, tool called tried to return too much context and failed";
3021
- }
3022
- return list.map((e) => {
2673
+ const tree = list.map((e) => {
3023
2674
  const indent = " ".repeat(e.depth);
3024
2675
  const name = e.type === "dir" ? `${e.name}/` : e.name;
3025
2676
  return `${indent}${name}`;
3026
2677
  }).join("\n");
2678
+ return tree;
3027
2679
  }
3028
2680
 
3029
2681
  // tools/warp_grep/agent/tools/finish.ts
@@ -3086,90 +2738,19 @@ function mergeRanges(ranges) {
3086
2738
 
3087
2739
  // tools/warp_grep/agent/formatter.ts
3088
2740
  var ToolOutputFormatter = class {
3089
- format(toolName, args, output, options = {}) {
2741
+ format(toolName, _args, output, options = {}) {
3090
2742
  const name = (toolName ?? "").trim();
3091
2743
  if (!name) {
3092
2744
  return "";
3093
2745
  }
3094
2746
  const payload = output?.toString?.()?.trim?.() ?? "";
3095
2747
  const isError = Boolean(options.isError);
3096
- const safeArgs = args ?? {};
3097
2748
  if (!payload && !isError) {
3098
2749
  return "";
3099
2750
  }
3100
- switch (name) {
3101
- case "read":
3102
- return this.formatRead(safeArgs, payload, isError);
3103
- case "list_directory":
3104
- return this.formatListDirectory(safeArgs, payload, isError);
3105
- case "grep":
3106
- return this.formatGrep(safeArgs, payload, isError);
3107
- default:
3108
- return payload ? `<tool_output>
3109
- ${payload}
3110
- </tool_output>` : "";
3111
- }
3112
- }
3113
- formatRead(args, payload, isError) {
3114
- if (isError) {
3115
- return payload;
3116
- }
3117
- const path5 = this.asString(args.path) || "...";
3118
- const start = args.start;
3119
- const end = args.end;
3120
- const linesArray = args.lines;
3121
- const attributes = [`path="${path5}"`];
3122
- if (linesArray && linesArray.length > 0) {
3123
- const rangeStr = linesArray.map(([s, e]) => `${s}-${e}`).join(",");
3124
- attributes.push(`lines="${rangeStr}"`);
3125
- } else if (start !== void 0 && end !== void 0) {
3126
- attributes.push(`lines="${start}-${end}"`);
3127
- }
3128
- return `<read ${attributes.join(" ")}>
3129
- ${payload}
3130
- </read>`;
3131
- }
3132
- formatListDirectory(args, payload, isError) {
3133
- const path5 = this.asString(args.path) || ".";
3134
- const pattern = this.asString(args.pattern);
3135
- const attributes = [`path="${path5}"`];
3136
- if (pattern) {
3137
- attributes.push(`pattern="${pattern}"`);
3138
- }
3139
- if (isError) {
3140
- attributes.push('status="error"');
3141
- }
3142
- return `<list_directory ${attributes.join(" ")}>
3143
- ${payload}
3144
- </list_directory>`;
3145
- }
3146
- formatGrep(args, payload, isError) {
3147
- const pattern = this.asString(args.pattern);
3148
- const subDir = this.asString(args.path);
3149
- const glob = this.asString(args.glob);
3150
- const attributes = [];
3151
- if (pattern !== void 0) {
3152
- attributes.push(`pattern="${pattern}"`);
3153
- }
3154
- if (subDir !== void 0) {
3155
- attributes.push(`sub_dir="${subDir}"`);
3156
- }
3157
- if (glob !== void 0) {
3158
- attributes.push(`glob="${glob}"`);
3159
- }
3160
- if (isError) {
3161
- attributes.push('status="error"');
3162
- }
3163
- const attrText = attributes.length ? ` ${attributes.join(" ")}` : "";
3164
- return `<grep${attrText}>
2751
+ return `<tool_response>
3165
2752
  ${payload}
3166
- </grep>`;
3167
- }
3168
- asString(value) {
3169
- if (value === null || value === void 0) {
3170
- return void 0;
3171
- }
3172
- return String(value);
2753
+ </tool_response>`;
3173
2754
  }
3174
2755
  };
3175
2756
  var sharedFormatter = new ToolOutputFormatter();
@@ -3198,12 +2779,15 @@ function calculateContextBudget(messages) {
3198
2779
  const maxK = Math.round(maxChars / 1e3);
3199
2780
  return `<context_budget>${percent}% (${usedK}K/${maxK}K chars)</context_budget>`;
3200
2781
  }
3201
- async function buildInitialState(repoRoot, query, provider) {
2782
+ async function buildInitialState(repoRoot, query, provider, options) {
2783
+ const budget = calculateContextBudget([]);
2784
+ const turnTag = `Turn 0/${AGENT_CONFIG.MAX_TURNS}`;
2785
+ const treeDepth = options?.query_type === "node_modules" ? 1 : 2;
3202
2786
  try {
3203
2787
  const entries = await provider.listDirectory({
3204
2788
  path: ".",
3205
2789
  maxResults: AGENT_CONFIG.MAX_OUTPUT_LINES,
3206
- maxDepth: 2
2790
+ maxDepth: treeDepth
3207
2791
  });
3208
2792
  const treeLines = entries.map((e) => {
3209
2793
  const indent = " ".repeat(e.depth);
@@ -3219,7 +2803,9 @@ ${treeOutput}
3219
2803
 
3220
2804
  <search_string>
3221
2805
  ${query}
3222
- </search_string>`;
2806
+ </search_string>
2807
+ ${budget}
2808
+ ${turnTag}`;
3223
2809
  } catch {
3224
2810
  const repoName = import_path2.default.basename(repoRoot);
3225
2811
  return `<repo_structure>
@@ -3228,7 +2814,9 @@ ${repoName}/
3228
2814
 
3229
2815
  <search_string>
3230
2816
  ${query}
3231
- </search_string>`;
2817
+ </search_string>
2818
+ ${budget}
2819
+ ${turnTag}`;
3232
2820
  }
3233
2821
  }
3234
2822
  function enforceContextLimit(messages, maxChars = AGENT_CONFIG.MAX_CONTEXT_CHARS) {
@@ -3316,14 +2904,13 @@ async function runWarpGrep(config) {
3316
2904
  const timeoutMs = config.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
3317
2905
  const timings = { turns: [], timeout_ms: timeoutMs };
3318
2906
  const repoRoot = import_path3.default.resolve(config.repoRoot || process.cwd());
2907
+ const model = config.model || DEFAULT_MODEL;
3319
2908
  const messages = [];
3320
- messages.push({ role: "system", content: getSystemPrompt() });
2909
+ const maxTurns = AGENT_CONFIG.MAX_TURNS;
3321
2910
  const initialStateStart = Date.now();
3322
- const initialState = await buildInitialState(repoRoot, config.query, config.provider);
2911
+ const initialState = await buildInitialState(repoRoot, config.query, config.provider, { query_type: config.query_type });
3323
2912
  timings.initial_state_ms = Date.now() - initialStateStart;
3324
2913
  messages.push({ role: "user", content: initialState });
3325
- const maxTurns = AGENT_CONFIG.MAX_TURNS;
3326
- const model = config.model || DEFAULT_MODEL;
3327
2914
  const provider = config.provider;
3328
2915
  const errors = [];
3329
2916
  let finishMeta;
@@ -3373,7 +2960,7 @@ async function runWarpGrep(config) {
3373
2960
  const args = c.arguments ?? {};
3374
2961
  allPromises.push(
3375
2962
  toolGrep(provider, args).then(
3376
- ({ output }) => formatAgentToolOutput("grep", args, output, { isError: false }),
2963
+ ({ output }) => formatAgentToolOutput("grep", args, output),
3377
2964
  (err) => formatAgentToolOutput("grep", args, String(err), { isError: true })
3378
2965
  )
3379
2966
  );
@@ -3382,7 +2969,7 @@ async function runWarpGrep(config) {
3382
2969
  const args = c.arguments ?? {};
3383
2970
  allPromises.push(
3384
2971
  toolListDirectory(provider, args).then(
3385
- (p) => formatAgentToolOutput("list_directory", args, p, { isError: false }),
2972
+ (p) => formatAgentToolOutput("list_directory", args, p),
3386
2973
  (err) => formatAgentToolOutput("list_directory", args, String(err), { isError: true })
3387
2974
  )
3388
2975
  );
@@ -3391,7 +2978,7 @@ async function runWarpGrep(config) {
3391
2978
  const args = c.arguments ?? {};
3392
2979
  allPromises.push(
3393
2980
  toolRead(provider, args).then(
3394
- (p) => formatAgentToolOutput("read", args, p, { isError: false }),
2981
+ (p) => formatAgentToolOutput("read", args, p),
3395
2982
  (err) => formatAgentToolOutput("read", args, String(err), { isError: true })
3396
2983
  )
3397
2984
  );
@@ -3475,14 +3062,13 @@ async function* runWarpGrepStreaming(config) {
3475
3062
  const timeoutMs = config.timeout ?? AGENT_CONFIG.TIMEOUT_MS;
3476
3063
  const timings = { turns: [], timeout_ms: timeoutMs };
3477
3064
  const repoRoot = import_path3.default.resolve(config.repoRoot || process.cwd());
3065
+ const model = config.model || DEFAULT_MODEL;
3478
3066
  const messages = [];
3479
- messages.push({ role: "system", content: getSystemPrompt() });
3067
+ const maxTurns = AGENT_CONFIG.MAX_TURNS;
3480
3068
  const initialStateStart = Date.now();
3481
- const initialState = await buildInitialState(repoRoot, config.query, config.provider);
3069
+ const initialState = await buildInitialState(repoRoot, config.query, config.provider, { query_type: config.query_type });
3482
3070
  timings.initial_state_ms = Date.now() - initialStateStart;
3483
3071
  messages.push({ role: "user", content: initialState });
3484
- const maxTurns = AGENT_CONFIG.MAX_TURNS;
3485
- const model = config.model || DEFAULT_MODEL;
3486
3072
  const provider = config.provider;
3487
3073
  const errors = [];
3488
3074
  let finishMeta;
@@ -3539,7 +3125,7 @@ async function* runWarpGrepStreaming(config) {
3539
3125
  const args = c.arguments ?? {};
3540
3126
  allPromises.push(
3541
3127
  toolGrep(provider, args).then(
3542
- ({ output }) => formatAgentToolOutput("grep", args, output, { isError: false }),
3128
+ ({ output }) => formatAgentToolOutput("grep", args, output),
3543
3129
  (err) => formatAgentToolOutput("grep", args, String(err), { isError: true })
3544
3130
  )
3545
3131
  );
@@ -3548,7 +3134,7 @@ async function* runWarpGrepStreaming(config) {
3548
3134
  const args = c.arguments ?? {};
3549
3135
  allPromises.push(
3550
3136
  toolListDirectory(provider, args).then(
3551
- (p) => formatAgentToolOutput("list_directory", args, p, { isError: false }),
3137
+ (p) => formatAgentToolOutput("list_directory", args, p),
3552
3138
  (err) => formatAgentToolOutput("list_directory", args, String(err), { isError: true })
3553
3139
  )
3554
3140
  );
@@ -3557,7 +3143,7 @@ async function* runWarpGrepStreaming(config) {
3557
3143
  const args = c.arguments ?? {};
3558
3144
  allPromises.push(
3559
3145
  toolRead(provider, args).then(
3560
- (p) => formatAgentToolOutput("read", args, p, { isError: false }),
3146
+ (p) => formatAgentToolOutput("read", args, p),
3561
3147
  (err) => formatAgentToolOutput("read", args, String(err), { isError: true })
3562
3148
  )
3563
3149
  );
@@ -3735,10 +3321,9 @@ var RemoteCommandsProvider = class {
3735
3321
  const stdout = await this.commands.grep(params.pattern, params.path, params.glob);
3736
3322
  const lines = (stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
3737
3323
  if (lines.length > AGENT_CONFIG.MAX_OUTPUT_LINES) {
3738
- return {
3739
- lines: [],
3740
- error: "Query not specific enough - too many results returned. Try a more specific pattern."
3741
- };
3324
+ const truncated = lines.slice(0, AGENT_CONFIG.MAX_OUTPUT_LINES);
3325
+ truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);
3326
+ return { lines: truncated };
3742
3327
  }
3743
3328
  return { lines };
3744
3329
  } catch (error) {
@@ -3768,7 +3353,7 @@ var RemoteCommandsProvider = class {
3768
3353
  const lines = contentLines.map((content, idx) => `${start + idx}|${content}`);
3769
3354
  if (lines.length > AGENT_CONFIG.MAX_READ_LINES) {
3770
3355
  const truncated = lines.slice(0, AGENT_CONFIG.MAX_READ_LINES);
3771
- truncated.push(`... [truncated: showing ${AGENT_CONFIG.MAX_READ_LINES} of ${lines.length} lines]`);
3356
+ truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_READ_LINES} of ${lines.length} lines)`);
3772
3357
  return { lines: truncated };
3773
3358
  }
3774
3359
  return { lines };
@@ -5282,15 +4867,16 @@ var RawRouter = class extends BaseRouter {
5282
4867
  var WARP_GREP_TOOL_NAME = "warpgrep_codebase_search";
5283
4868
  var WARP_GREP_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase to gather context, and the task does not involve a single file or function which is provided by name, you should ALWAYS use the warpgrep codebase search tool first instead of running search commands. When the task requires exploration beyond a single known file, invoke warpgrep first with a natural-language query describing the target functionality, bug, or architectural concern. Warp Grep is a fast and accurate tool that can search for all relevant context in a codebase. Keep queries action-oriented (e.g., "Find where billing invoices are generated and emailed"), and after reviewing the summarized results, you may verify important findings with other search tools or direct file reads to ensure completeness. Warp Grep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task requires exploration beyond a single known file, ALWAYS default to warpgrep codebase search before other search mechanisms.';
5284
4869
  var GITHUB_WARP_GREP_SEARCH_TOOL_NAME = "warpgrep_github_search";
5285
- var GITHUB_WARP_GREP_SEARCH_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase of a public GitHub repository (not your local workspace), use warpgrep_github_search instead of warpgrep_codebase_search. ONLY use this tool when the task requires understanding code in an external repo, and invoke warpgrep_github_search with a GitHub URL or owner/repo shorthand (e.g., vercel/next.js) and a natural-language query describing the target functionality, bug, or architectural concern. DO NOT use this tool when the task requires understanding code in your local workspace. Use warpgrep_codebase_search instead.Useful when you suspect a library or framework is being used in a way that is not documented, or if you suspect an update or a bug in the library or framework.WarpGrep searches GitHub repos the same way it searches local codebases: fast and accurate. Keep queries action-oriented (e.g., "Find where how the new use workflow directive works"), and after reviewing the results, you may verify important findings with other tools or direct file reads. WarpGrep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task involves exploring code in an external public repo, ALWAYS use warpgrep_github_search.';
4870
+ var GITHUB_WARP_GREP_SEARCH_DESCRIPTION = 'IMPORTANT: If you need to explore the codebase of a public GitHub repository (not your local workspace), use warpgrep_github_search instead of warpgrep_codebase_search. ONLY use this tool when the task requires understanding code in an external repo, and invoke warpgrep_github_search with a natural-language query describing the target functionality, bug, or architectural concern. DO NOT use this tool when the task requires understanding code in your local workspace. Use warpgrep_codebase_search instead.Useful when you suspect a library or framework is being used in a way that is not documented, or if you suspect an update or a bug in the library or framework.WarpGrep searches GitHub repos the same way it searches local codebases: fast and accurate. Keep queries action-oriented (e.g., "Find where how the new use workflow directive works"), and after reviewing the results, you may verify important findings with other tools or direct file reads. WarpGrep can be used for query types like: find function responsible for <small feature>; find code that does <description>; find code path for <big feature>; Where does <minimal error message> come from?; or any query of that type. When a task involves exploring code in an external public repo, ALWAYS use warpgrep_github_search. You must provide either a github_url or owner_repo parameter (at least one is required).';
5286
4871
  var GITHUB_WARP_GREP_SEARCH_INPUT_SCHEMA = {
5287
4872
  type: "object",
5288
4873
  properties: {
5289
4874
  query: { type: "string", description: "Natural language search query describing what to find in the repository" },
5290
- github: { type: "string", description: 'owner/repo shorthand (ex: "vercel/next.js" for "https://github.com/vercel/next.js")' },
4875
+ github_url: { type: "string", description: 'GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.' },
4876
+ owner_repo: { type: "string", description: 'Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.' },
5291
4877
  branch: { type: "string", description: "Branch to search (defaults to the repository default branch)" }
5292
4878
  },
5293
- required: ["query", "github"]
4879
+ required: ["query"]
5294
4880
  };
5295
4881
  var GITHUB_SEARCH_TOOL_NAME = GITHUB_WARP_GREP_SEARCH_TOOL_NAME;
5296
4882
  var GITHUB_SEARCH_DESCRIPTION = GITHUB_WARP_GREP_SEARCH_DESCRIPTION;
@@ -5319,9 +4905,6 @@ function createWarpGrepTool(config) {
5319
4905
  },
5320
4906
  formatResult: (result) => {
5321
4907
  return formatResult(result);
5322
- },
5323
- getSystemPrompt: () => {
5324
- return getSystemPrompt();
5325
4908
  }
5326
4909
  });
5327
4910
  }
@@ -5337,13 +4920,14 @@ function createGitHubSearchTool(config) {
5337
4920
  };
5338
4921
  return Object.assign(tool4, {
5339
4922
  execute: async (input) => {
5340
- return client.searchGitHub(input);
4923
+ const github = input.github_url || input.owner_repo;
4924
+ if (!github) {
4925
+ throw new Error("Please provide github search url or owner/repo id");
4926
+ }
4927
+ return client.searchGitHub({ query: input.query, github, branch: input.branch });
5341
4928
  },
5342
4929
  formatResult: (result) => {
5343
4930
  return formatResult(result);
5344
- },
5345
- getSystemPrompt: () => {
5346
- return getSystemPrompt();
5347
4931
  }
5348
4932
  });
5349
4933
  }
@@ -5516,7 +5100,7 @@ var editFileTool = {
5516
5100
  async function execute(input, config) {
5517
5101
  return executeEditFile(input, config);
5518
5102
  }
5519
- function getSystemPrompt2() {
5103
+ function getSystemPrompt() {
5520
5104
  return EDIT_FILE_SYSTEM_PROMPT;
5521
5105
  }
5522
5106
  function formatResult3(result) {
@@ -5545,7 +5129,7 @@ function createEditFileTool(config = {}) {
5545
5129
  return formatResult3(result);
5546
5130
  },
5547
5131
  getSystemPrompt: () => {
5548
- return getSystemPrompt2();
5132
+ return getSystemPrompt();
5549
5133
  }
5550
5134
  });
5551
5135
  }
@@ -5625,9 +5209,6 @@ function createWarpGrepTool2(config) {
5625
5209
  },
5626
5210
  formatResult: (result) => {
5627
5211
  return formatResult(result);
5628
- },
5629
- getSystemPrompt: () => {
5630
- return getSystemPrompt();
5631
5212
  }
5632
5213
  });
5633
5214
  }
@@ -5640,13 +5221,14 @@ function createGitHubSearchTool2(config) {
5640
5221
  };
5641
5222
  return Object.assign(tool4, {
5642
5223
  execute: async (input) => {
5643
- return client.searchGitHub(input);
5224
+ const github = input.github_url || input.owner_repo;
5225
+ if (!github) {
5226
+ throw new Error("Please provide github search url or owner/repo id");
5227
+ }
5228
+ return client.searchGitHub({ query: input.query, github, branch: input.branch });
5644
5229
  },
5645
5230
  formatResult: (result) => {
5646
5231
  return formatResult(result);
5647
- },
5648
- getSystemPrompt: () => {
5649
- return getSystemPrompt();
5650
5232
  }
5651
5233
  });
5652
5234
  }
@@ -5866,11 +5448,16 @@ function createGitHubSearchTool3(config) {
5866
5448
  description: GITHUB_SEARCH_DESCRIPTION,
5867
5449
  inputSchema: import_zod.z.object({
5868
5450
  query: import_zod.z.string().describe("Natural language search query"),
5869
- github: import_zod.z.string().describe('GitHub URL or "owner/repo" shorthand'),
5451
+ github_url: import_zod.z.string().optional().describe('GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.'),
5452
+ owner_repo: import_zod.z.string().optional().describe('Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.'),
5870
5453
  branch: import_zod.z.string().optional().describe("Branch to search (defaults to repo default branch)")
5871
5454
  }),
5872
5455
  execute: async (params) => {
5873
- const result = await client.searchGitHub(params);
5456
+ const github = params.github_url || params.owner_repo;
5457
+ if (!github) {
5458
+ throw new Error("Please provide github search url or owner/repo id");
5459
+ }
5460
+ const result = await client.searchGitHub({ query: params.query, github, branch: params.branch });
5874
5461
  if (!result.success) {
5875
5462
  throw new Error(`GitHub search failed: ${result.error}`);
5876
5463
  }