@morphllm/morphsdk 0.2.60 → 0.2.62

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 (105) hide show
  1. package/dist/{chunk-YV75OQTE.js → chunk-3M4DOG6N.js} +2 -26
  2. package/dist/chunk-3M4DOG6N.js.map +1 -0
  3. package/dist/{chunk-ILJ3J5IA.js → chunk-44GS4GJJ.js} +3 -3
  4. package/dist/{chunk-TPP2UGQP.js → chunk-563RLKFC.js} +21 -7
  5. package/dist/chunk-563RLKFC.js.map +1 -0
  6. package/dist/chunk-5FUTL2UF.js +22 -0
  7. package/dist/{chunk-IUG2FHNN.js → chunk-BHNJEBQJ.js} +2 -2
  8. package/dist/{chunk-6N6ZYZYD.js → chunk-GZ7TJ7UB.js} +3 -3
  9. package/dist/{chunk-QZNGKOCZ.js → chunk-IXNSTNS7.js} +2 -2
  10. package/dist/{chunk-ZO4PPFCZ.js → chunk-JNOZPU44.js} +2 -2
  11. package/dist/{chunk-4VGOBA2J.js → chunk-LHKFRPUO.js} +3 -3
  12. package/dist/{chunk-5QIWYEHJ.js → chunk-PKPJWARB.js} +2 -2
  13. package/dist/{chunk-374N3GIA.js → chunk-S3RCM32V.js} +3 -3
  14. package/dist/{chunk-FN4EP3WY.js → chunk-XWSKUQVQ.js} +8 -8
  15. package/dist/{chunk-2CASO3ZO.js → chunk-Y7CPJGLU.js} +2 -2
  16. package/dist/{chunk-3IQIT6MC.js → chunk-Z75HCPIE.js} +3 -3
  17. package/dist/client.cjs +33 -31
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.js +13 -13
  20. package/dist/git/client.js +1 -1
  21. package/dist/git/config.js +1 -1
  22. package/dist/git/index.js +1 -1
  23. package/dist/index.cjs +33 -31
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.js +14 -14
  26. package/dist/lib-GEPX5Y3T.js +14 -0
  27. package/dist/lib-GEPX5Y3T.js.map +1 -0
  28. package/dist/modelrouter/core.js +1 -1
  29. package/dist/modelrouter/index.js +1 -1
  30. package/dist/tools/browser/anthropic.js +1 -1
  31. package/dist/tools/browser/core.js +1 -1
  32. package/dist/tools/browser/index.js +1 -1
  33. package/dist/tools/browser/live.js +1 -1
  34. package/dist/tools/browser/openai.js +1 -1
  35. package/dist/tools/browser/prompts.js +1 -1
  36. package/dist/tools/browser/vercel.js +1 -1
  37. package/dist/tools/codebase_search/anthropic.js +1 -1
  38. package/dist/tools/codebase_search/core.js +1 -1
  39. package/dist/tools/codebase_search/index.js +1 -1
  40. package/dist/tools/codebase_search/openai.js +1 -1
  41. package/dist/tools/codebase_search/prompts.js +1 -1
  42. package/dist/tools/codebase_search/vercel.js +1 -1
  43. package/dist/tools/fastapply/anthropic.js +2 -2
  44. package/dist/tools/fastapply/core.js +1 -1
  45. package/dist/tools/fastapply/index.js +4 -4
  46. package/dist/tools/fastapply/openai.js +2 -2
  47. package/dist/tools/fastapply/prompts.js +1 -1
  48. package/dist/tools/fastapply/vercel.js +2 -2
  49. package/dist/tools/index.js +4 -4
  50. package/dist/tools/utils/resilience.js +1 -1
  51. package/dist/tools/warp_grep/agent/config.js +1 -1
  52. package/dist/tools/warp_grep/agent/formatter.js +1 -1
  53. package/dist/tools/warp_grep/agent/parser.cjs +1 -25
  54. package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
  55. package/dist/tools/warp_grep/agent/parser.js +2 -2
  56. package/dist/tools/warp_grep/agent/prompt.js +1 -1
  57. package/dist/tools/warp_grep/agent/runner.cjs +1 -25
  58. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  59. package/dist/tools/warp_grep/agent/runner.js +3 -3
  60. package/dist/tools/warp_grep/anthropic.cjs +33 -31
  61. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  62. package/dist/tools/warp_grep/anthropic.js +7 -7
  63. package/dist/tools/warp_grep/client.cjs +33 -31
  64. package/dist/tools/warp_grep/client.cjs.map +1 -1
  65. package/dist/tools/warp_grep/client.js +6 -6
  66. package/dist/tools/warp_grep/gemini.cjs +33 -31
  67. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  68. package/dist/tools/warp_grep/gemini.js +7 -7
  69. package/dist/tools/warp_grep/harness.cjs +33 -31
  70. package/dist/tools/warp_grep/harness.cjs.map +1 -1
  71. package/dist/tools/warp_grep/harness.js +4 -4
  72. package/dist/tools/warp_grep/index.cjs +33 -31
  73. package/dist/tools/warp_grep/index.cjs.map +1 -1
  74. package/dist/tools/warp_grep/index.js +10 -10
  75. package/dist/tools/warp_grep/openai.cjs +33 -31
  76. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  77. package/dist/tools/warp_grep/openai.js +7 -7
  78. package/dist/tools/warp_grep/providers/local.cjs +32 -6
  79. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  80. package/dist/tools/warp_grep/providers/local.js +3 -3
  81. package/dist/tools/warp_grep/providers/remote.js +1 -1
  82. package/dist/tools/warp_grep/utils/files.js +1 -1
  83. package/dist/tools/warp_grep/utils/paths.js +1 -1
  84. package/dist/tools/warp_grep/utils/ripgrep.cjs +42 -6
  85. package/dist/tools/warp_grep/utils/ripgrep.cjs.map +1 -1
  86. package/dist/tools/warp_grep/utils/ripgrep.js +2 -2
  87. package/dist/tools/warp_grep/vercel.cjs +33 -31
  88. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  89. package/dist/tools/warp_grep/vercel.js +7 -7
  90. package/package.json +5 -3
  91. package/dist/chunk-PZ5AY32C.js +0 -10
  92. package/dist/chunk-TPP2UGQP.js.map +0 -1
  93. package/dist/chunk-YV75OQTE.js.map +0 -1
  94. /package/dist/{chunk-ILJ3J5IA.js.map → chunk-44GS4GJJ.js.map} +0 -0
  95. /package/dist/{chunk-PZ5AY32C.js.map → chunk-5FUTL2UF.js.map} +0 -0
  96. /package/dist/{chunk-IUG2FHNN.js.map → chunk-BHNJEBQJ.js.map} +0 -0
  97. /package/dist/{chunk-6N6ZYZYD.js.map → chunk-GZ7TJ7UB.js.map} +0 -0
  98. /package/dist/{chunk-QZNGKOCZ.js.map → chunk-IXNSTNS7.js.map} +0 -0
  99. /package/dist/{chunk-ZO4PPFCZ.js.map → chunk-JNOZPU44.js.map} +0 -0
  100. /package/dist/{chunk-4VGOBA2J.js.map → chunk-LHKFRPUO.js.map} +0 -0
  101. /package/dist/{chunk-5QIWYEHJ.js.map → chunk-PKPJWARB.js.map} +0 -0
  102. /package/dist/{chunk-374N3GIA.js.map → chunk-S3RCM32V.js.map} +0 -0
  103. /package/dist/{chunk-FN4EP3WY.js.map → chunk-XWSKUQVQ.js.map} +0 -0
  104. /package/dist/{chunk-2CASO3ZO.js.map → chunk-Y7CPJGLU.js.map} +0 -0
  105. /package/dist/{chunk-3IQIT6MC.js.map → chunk-Z75HCPIE.js.map} +0 -0
@@ -96,33 +96,9 @@ function parseNestedXmlTools(text) {
96
96
  return tools;
97
97
  }
98
98
  function preprocessText(text) {
99
- let processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "");
99
+ const processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "").replace(/<\/?tool_call>/gi, "");
100
100
  const nestedTools = parseNestedXmlTools(processed);
101
- const openingTagRegex = /<tool_call>|<tool>/gi;
102
- const closingTagRegex = /<\/tool_call>|<\/tool>/gi;
103
- const openingMatches = processed.match(openingTagRegex) || [];
104
- const closingMatches = processed.match(closingTagRegex) || [];
105
- if (openingMatches.length > closingMatches.length) {
106
- const lastClosingMatch = /<\/tool_call>|<\/tool>/gi;
107
- let lastClosingIndex = -1;
108
- let match;
109
- while ((match = lastClosingMatch.exec(processed)) !== null) {
110
- lastClosingIndex = match.index + match[0].length;
111
- }
112
- if (lastClosingIndex > 0) {
113
- processed = processed.slice(0, lastClosingIndex);
114
- }
115
- }
116
101
  const toolCallLines = [];
117
- const toolTagRegex = /<tool_call>([\s\S]*?)<\/tool_call>|<tool>([\s\S]*?)<\/tool>/gi;
118
- let tagMatch;
119
- while ((tagMatch = toolTagRegex.exec(processed)) !== null) {
120
- const content = (tagMatch[1] || tagMatch[2] || "").trim();
121
- if (content) {
122
- const lines = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l);
123
- toolCallLines.push(...lines);
124
- }
125
- }
126
102
  const allLines = processed.split(/\r?\n/).map((l) => l.trim());
127
103
  for (const line of allLines) {
128
104
  if (!line) continue;
@@ -287,4 +263,4 @@ var LLMResponseParser = class {
287
263
  export {
288
264
  LLMResponseParser
289
265
  };
290
- //# sourceMappingURL=chunk-YV75OQTE.js.map
266
+ //# sourceMappingURL=chunk-3M4DOG6N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/agent/parser.ts"],"sourcesContent":["// Parses assistant lines into structured tool calls\nimport type { ToolCall } from './types.js';\n\nconst VALID_COMMANDS = ['list_directory', 'grep', 'read', 'finish'] as const;\ntype ValidCommand = typeof VALID_COMMANDS[number];\n\nfunction isValidCommand(name: string): name is ValidCommand {\n return VALID_COMMANDS.includes(name as ValidCommand);\n}\n\nfunction getXmlElementText(xml: string, tagName: string): string | null {\n const regex = new RegExp(`<${tagName}>([\\\\s\\\\S]*?)</${tagName}>`, 'i');\n const match = xml.match(regex);\n return match ? match[1].trim() : null;\n}\n\nfunction parseNestedXmlTools(text: string): ToolCall[] {\n const tools: ToolCall[] = [];\n \n // Match any XML tool tags. Unknown tools are silently ignored for forward-compatibility:\n // if we add new tools (e.g. <search>) to the model, old clients won't break.\n const toolRegex = /<([a-z_][a-z0-9_]*)>([\\s\\S]*?)<\\/\\1>/gi;\n let match;\n \n while ((match = toolRegex.exec(text)) !== null) {\n const rawToolName = match[1].toLowerCase();\n const content = match[2];\n \n // Skip unknown tools silently - enables forward compatibility\n if (!isValidCommand(rawToolName)) continue;\n \n const toolName = rawToolName;\n \n if (toolName === 'list_directory') {\n const path = getXmlElementText(content, 'path');\n const pattern = getXmlElementText(content, 'pattern');\n if (path) {\n tools.push({ name: 'list_directory', arguments: { path, pattern } });\n }\n } else if (toolName === 'grep') {\n const pattern = getXmlElementText(content, 'pattern');\n const subDir = getXmlElementText(content, 'sub_dir');\n const glob = getXmlElementText(content, 'glob');\n if (pattern) {\n tools.push({ \n name: 'grep', \n arguments: { \n pattern, \n path: subDir || '.', \n ...(glob && { glob }) \n } \n });\n }\n } else if (toolName === 'read') {\n const path = getXmlElementText(content, 'path');\n const linesStr = getXmlElementText(content, 'lines');\n if (path) {\n const args: Record<string, unknown> = { path };\n if (linesStr) {\n const ranges: Array<[number, number]> = [];\n for (const rangeStr of linesStr.split(',')) {\n const trimmed = rangeStr.trim();\n if (!trimmed) continue;\n const [s, e] = trimmed.split('-').map(v => parseInt(v.trim(), 10));\n if (Number.isFinite(s) && Number.isFinite(e)) {\n ranges.push([s, e]);\n } else if (Number.isFinite(s)) {\n // Single line like \"100\"\n ranges.push([s, s]);\n }\n }\n if (ranges.length === 1) {\n args.start = ranges[0][0];\n args.end = ranges[0][1];\n } else if (ranges.length > 1) {\n args.lines = ranges;\n }\n }\n tools.push({ name: 'read', arguments: args });\n }\n } else if (toolName === 'finish') {\n // Parse nested <file> elements\n const fileRegex = /<file>([\\s\\S]*?)<\\/file>/gi;\n const files: Array<{ path: string; lines: Array<[number, number]> }> = [];\n let fileMatch;\n \n while ((fileMatch = fileRegex.exec(content)) !== null) {\n const fileContent = fileMatch[1];\n const filePath = getXmlElementText(fileContent, 'path');\n const linesStr = getXmlElementText(fileContent, 'lines');\n \n if (filePath && linesStr) {\n const ranges: Array<[number, number]> = [];\n for (const rangeStr of linesStr.split(',')) {\n if (rangeStr.trim() === '*') {\n ranges.push([1, 999999]); // Entire file\n } else {\n const [s, e] = rangeStr.split('-').map(v => parseInt(v.trim(), 10));\n if (Number.isFinite(s) && Number.isFinite(e)) {\n ranges.push([s, e]);\n }\n }\n }\n if (ranges.length > 0) {\n files.push({ path: filePath, lines: ranges });\n }\n }\n }\n \n if (files.length > 0) {\n tools.push({ name: 'finish', arguments: { files } });\n }\n }\n }\n \n return tools;\n}\n\nfunction preprocessText(text: string): { lines: string[]; nestedTools: ToolCall[] } {\n // Strip <think> blocks (reasoning) and <tool_call> wrappers (model hallucination).\n // NOTE: Only strip exact <tool_call> tags - NOT <tool> or <tool_xyz> which could be valid future tools.\n const processed = text\n .replace(/<think>[\\s\\S]*?<\\/think>/gi, '')\n .replace(/<\\/?tool_call>/gi, '');\n const nestedTools = parseNestedXmlTools(processed);\n \n // Extract raw line-based tool calls (legacy format: `grep 'pattern' path`)\n const toolCallLines: string[] = [];\n const allLines = processed.split(/\\r?\\n/).map(l => l.trim());\n for (const line of allLines) {\n if (!line) continue;\n if (line.startsWith('<')) continue;\n \n const firstWord = line.split(/\\s/)[0];\n if (VALID_COMMANDS.includes(firstWord as ValidCommand)) {\n if (!toolCallLines.includes(line)) {\n toolCallLines.push(line);\n }\n }\n }\n \n return { lines: toolCallLines, nestedTools };\n}\n\nexport class LLMResponseParser {\n private readonly finishSpecSplitRe = /,(?=[^,\\s]+:)/;\n\n parse(text: string): ToolCall[] {\n if (typeof text !== 'string') {\n throw new TypeError('Command text must be a string.');\n }\n \n // Preprocess to handle XML tags\n const { lines, nestedTools } = preprocessText(text);\n \n // Start with nested XML tools (new format)\n const commands: ToolCall[] = [...nestedTools];\n let finishAccumulator: Map<string, number[][]> | null = null;\n\n lines.forEach((line) => {\n if (!line || line.startsWith('#')) return;\n const parts = this.splitLine(line);\n if (parts.length === 0) return;\n const cmd = parts[0];\n \n switch (cmd) {\n case 'list_directory':\n this.handleListDirectory(parts, line, commands);\n break;\n case 'grep':\n this.handleGrep(parts, line, commands);\n break;\n case 'read':\n this.handleRead(parts, line, commands);\n break;\n case 'finish':\n finishAccumulator = this.handleFinish(parts, line, commands, finishAccumulator);\n break;\n default:\n // Silently ignore unknown commands\n break;\n }\n });\n\n if (finishAccumulator) {\n const map = finishAccumulator as Map<string, number[][]>;\n const entries = [...map.entries()];\n const filesPayload = entries.map(([path, ranges]) => ({\n path,\n lines: [...ranges].sort((a, b) => a[0] - b[0]) as Array<[number, number]>,\n }));\n commands.push({ name: 'finish', arguments: { files: filesPayload } });\n }\n return commands;\n }\n\n private splitLine(line: string): string[] {\n // Split by whitespace but keep quoted blocks as one\n const parts: string[] = [];\n let current = '';\n let inSingle = false;\n for (let i = 0; i < line.length; i++) {\n const ch = line[i];\n if (ch === \"'\" && line[i - 1] !== '\\\\') {\n inSingle = !inSingle;\n current += ch;\n } else if (!inSingle && /\\s/.test(ch)) {\n if (current) {\n parts.push(current);\n current = '';\n }\n } else {\n current += ch;\n }\n }\n if (current) parts.push(current);\n return parts;\n }\n\n /** Helper to create a _skip tool call with an error message */\n private skip(message: string): ToolCall {\n return { name: '_skip', arguments: { message } };\n }\n\n private handleListDirectory(parts: string[], rawLine: string, commands: ToolCall[]) {\n // list_directory <path> [pattern]\n if (parts.length < 2) {\n commands.push(this.skip(\n `[SKIPPED] Your command \"${rawLine}\" is missing a path. ` +\n `Correct format: list_directory <path> [pattern]. Example: list_directory src/`\n ));\n return;\n }\n const path = parts[1];\n const pattern = parts[2]?.replace(/^\"|\"$/g, '') ?? null;\n commands.push({ name: 'list_directory', arguments: { path, pattern } });\n }\n\n private handleGrep(parts: string[], rawLine: string, commands: ToolCall[]) {\n // grep '<pattern>' <path>\n if (parts.length < 3) {\n commands.push(this.skip(\n `[SKIPPED] Your command \"${rawLine}\" is missing arguments. ` +\n `Correct format: grep '<pattern>' <path>. Example: grep 'TODO' src/`\n ));\n return;\n }\n let pat = parts[1];\n // Be lenient: accept unquoted patterns by treating the first arg as the pattern\n if (pat.startsWith(\"'\") && pat.endsWith(\"'\")) {\n pat = pat.slice(1, -1);\n }\n // If pattern is empty after processing, skip\n if (!pat) {\n commands.push(this.skip(\n `[SKIPPED] Your command \"${rawLine}\" has an empty pattern. ` +\n `Provide a non-empty search pattern. Example: grep 'function' src/`\n ));\n return;\n }\n commands.push({ name: 'grep', arguments: { pattern: pat, path: parts[2] } });\n }\n\n private handleRead(parts: string[], rawLine: string, commands: ToolCall[]) {\n // read <path>[:start-end]\n if (parts.length < 2) {\n commands.push(this.skip(\n `[SKIPPED] Your command \"${rawLine}\" is missing a path. ` +\n `Correct format: read <path> or read <path>:<start>-<end>. Example: read src/index.ts:1-50`\n ));\n return;\n }\n const spec = parts[1];\n const rangeIdx = spec.indexOf(':');\n if (rangeIdx === -1) {\n commands.push({ name: 'read', arguments: { path: spec } });\n return;\n }\n const filePath = spec.slice(0, rangeIdx);\n const range = spec.slice(rangeIdx + 1);\n const [s, e] = range.split('-').map(v => parseInt(v, 10));\n // If range is invalid, fallback to reading the whole file\n if (!Number.isFinite(s) || !Number.isFinite(e)) {\n commands.push({ name: 'read', arguments: { path: filePath } });\n return;\n }\n commands.push({ name: 'read', arguments: { path: filePath, start: s, end: e } });\n }\n\n private handleFinish(parts: string[], rawLine: string, commands: ToolCall[], acc: Map<string, number[][]> | null) {\n // finish file1:1-10,20-30 file2:5-7\n const map = acc ?? new Map<string, number[][]>();\n const args = parts.slice(1);\n for (const token of args) {\n const [filePath, rangesText] = token.split(':', 2);\n if (!filePath || !rangesText) {\n // Skip this malformed token, continue processing others\n commands.push(this.skip(\n `[SKIPPED] Invalid finish token \"${token}\". ` +\n `Correct format: finish <path>:<start>-<end>. Example: finish src/index.ts:1-50`\n ));\n continue;\n }\n const rangeSpecs = rangesText.split(',').filter(Boolean);\n for (const spec of rangeSpecs) {\n const [s, e] = spec.split('-').map(v => parseInt(v, 10));\n if (!Number.isFinite(s) || !Number.isFinite(e) || e < s) {\n // Skip this invalid range, continue with others\n commands.push(this.skip(\n `[SKIPPED] Invalid range \"${spec}\" in \"${token}\". ` +\n `Ranges must be <start>-<end> where start <= end. Example: 1-50`\n ));\n continue;\n }\n const arr = map.get(filePath) ?? [];\n arr.push([s, e]);\n map.set(filePath, arr);\n }\n }\n return map;\n }\n}\n"],"mappings":";AAGA,IAAM,iBAAiB,CAAC,kBAAkB,QAAQ,QAAQ,QAAQ;AAGlE,SAAS,eAAe,MAAoC;AAC1D,SAAO,eAAe,SAAS,IAAoB;AACrD;AAEA,SAA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AA4B,IAAI,SAAS,KAAK;AAAA,UAEhD,CAAC;AACD;AAAA,QACF;AACA,cAAM,MAAM,IAAI,IAAI,QAAQ,KAAK,CAAC;AAClC,YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACf,YAAI,IAAI,UAAU,GAAG;AAAA,MACvB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  executeToolCall,
7
7
  formatResult
8
- } from "./chunk-374N3GIA.js";
8
+ } from "./chunk-S3RCM32V.js";
9
9
  import {
10
10
  getSystemPrompt
11
11
  } from "./chunk-Q5AHGIQO.js";
12
12
  import {
13
13
  __export
14
- } from "./chunk-PZ5AY32C.js";
14
+ } from "./chunk-5FUTL2UF.js";
15
15
 
16
16
  // tools/warp_grep/gemini.ts
17
17
  var gemini_exports = {};
@@ -69,4 +69,4 @@ export {
69
69
  gemini_default,
70
70
  gemini_exports
71
71
  };
72
- //# sourceMappingURL=chunk-ILJ3J5IA.js.map
72
+ //# sourceMappingURL=chunk-44GS4GJJ.js.map
@@ -1,8 +1,19 @@
1
1
  // tools/warp_grep/utils/ripgrep.ts
2
2
  import { spawn } from "child_process";
3
- import { rgPath } from "@vscode/ripgrep";
4
3
  var resolvedRgPath = null;
5
4
  var rgPathChecked = false;
5
+ var bundledRgPath = null;
6
+ async function getBundledRgPath() {
7
+ if (bundledRgPath !== null) return bundledRgPath;
8
+ try {
9
+ const module = await import("./lib-GEPX5Y3T.js");
10
+ bundledRgPath = module.rgPath;
11
+ return bundledRgPath;
12
+ } catch {
13
+ bundledRgPath = "";
14
+ return null;
15
+ }
16
+ }
6
17
  function spawnRg(rgBinary, args, opts) {
7
18
  return new Promise((resolve) => {
8
19
  const child = spawn(rgBinary, args, {
@@ -33,11 +44,14 @@ async function runRipgrep(args, opts) {
33
44
  return spawnRg(resolvedRgPath, args, opts);
34
45
  }
35
46
  if (!rgPathChecked) {
36
- const result = await spawnRg(rgPath, args, opts);
37
- if (!isBinaryFailure(result)) {
38
- resolvedRgPath = rgPath;
39
- rgPathChecked = true;
40
- return result;
47
+ const bundledPath = await getBundledRgPath();
48
+ if (bundledPath) {
49
+ const result = await spawnRg(bundledPath, args, opts);
50
+ if (!isBinaryFailure(result)) {
51
+ resolvedRgPath = bundledPath;
52
+ rgPathChecked = true;
53
+ return result;
54
+ }
41
55
  }
42
56
  const fallbackResult = await spawnRg("rg", args, opts);
43
57
  if (!isBinaryFailure(fallbackResult)) {
@@ -62,4 +76,4 @@ async function runRipgrep(args, opts) {
62
76
  export {
63
77
  runRipgrep
64
78
  };
65
- //# sourceMappingURL=chunk-TPP2UGQP.js.map
79
+ //# sourceMappingURL=chunk-563RLKFC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/utils/ripgrep.ts"],"sourcesContent":["import { spawn } from 'child_process';\n\nexport type ExecResult = { stdout: string; stderr: string; exitCode: number };\n\n// Cache the working ripgrep path to avoid repeated fallback checks\nlet resolvedRgPath: string | null = null;\nlet rgPathChecked = false;\n\n// Lazily load the bundled ripgrep path (optional dependency)\nlet bundledRgPath: string | null = null;\nasync function getBundledRgPath(): Promise<string | null> {\n if (bundledRgPath !== null) return bundledRgPath;\n try {\n const module = await import('@vscode/ripgrep');\n bundledRgPath = module.rgPath;\n return bundledRgPath;\n } catch {\n bundledRgPath = '';\n return null;\n }\n}\n\nfunction spawnRg(rgBinary: string, args: string[], opts?: { cwd?: string; env?: NodeJS.ProcessEnv }): Promise<ExecResult> {\n return new Promise((resolve) => {\n const child = spawn(rgBinary, args, {\n cwd: opts?.cwd,\n env: { ...process.env, ...(opts?.env || {}) },\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => (stdout += d.toString()));\n child.stderr.on('data', (d) => (stderr += d.toString()));\n child.on('close', (code) => {\n resolve({ stdout, stderr, exitCode: typeof code === 'number' ? code : -1 });\n });\n child.on('error', () => {\n resolve({ stdout: '', stderr: 'Failed to spawn ripgrep.', exitCode: -1 });\n });\n });\n}\n\n// Check if a result indicates a binary compatibility failure (not a normal rg error)\nfunction isBinaryFailure(result: ExecResult): boolean {\n if (result.exitCode === -1) return true;\n if (result.stderr.includes('jemalloc') || result.stderr.includes('Unsupported system page size')) return true;\n if (result.exitCode === 134) return true;\n return false;\n}\n\nexport async function runRipgrep(args: string[], opts?: { cwd?: string; env?: NodeJS.ProcessEnv }): Promise<ExecResult> {\n // If we've already determined the working path, use it\n if (rgPathChecked && resolvedRgPath) {\n return spawnRg(resolvedRgPath, args, opts);\n }\n\n // First attempt: bundled ripgrep (if available)\n if (!rgPathChecked) {\n const bundledPath = await getBundledRgPath();\n \n if (bundledPath) {\n const result = await spawnRg(bundledPath, args, opts);\n \n if (!isBinaryFailure(result)) {\n resolvedRgPath = bundledPath;\n rgPathChecked = true;\n return result;\n }\n }\n\n // Bundled binary not available or failed, try system rg\n const fallbackResult = await spawnRg('rg', args, opts);\n \n if (!isBinaryFailure(fallbackResult)) {\n resolvedRgPath = 'rg';\n rgPathChecked = true;\n return fallbackResult;\n }\n\n // Neither works, mark as checked and return the original error\n rgPathChecked = true;\n return { \n stdout: '', \n stderr: 'Failed to spawn ripgrep. Neither bundled nor system rg is available.', \n exitCode: -1 \n };\n }\n\n // rgPathChecked is true but resolvedRgPath is null - no working rg found\n return { \n stdout: '', \n stderr: 'Failed to spawn ripgrep. Neither bundled nor system rg is available.', \n exitCode: -1 \n };\n}\n"],"mappings":";AAAA,SAAS,aAAa;AAKtB,IAAI,iBAAgC;AACpC,IAAI,gBAAgB;AAGpB,IAAI,gBAA+B;AACnC,eAAe,mBAA2C;AACxD,MAAI,kBAAkB,KAAM,QAAO;AACnC,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,mBAAiB;AAC7C,oBAAgB,OAAO;AACvB,WAAO;AAAA,EACT,QAAQ;AACN,oBAAgB;AAChB,WAAO;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,UAAkB,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UAAM,iBAAiB,MAAM,QAAQ,MAAM,MAAM,IAAI;AAErD,QAAI,CAAC,gBAAgB,cAAc,GAAG;AACpC,uBAAiB;AACjB,sBAAgB;AAChB,aAAO;AAAA,IACT;AAGA,oBAAgB;AAChB,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,EACF;AAGA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AACF;","names":[]}
@@ -0,0 +1,22 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+ var __commonJS = (cb, mod) => function __require2() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+
17
+ export {
18
+ __require,
19
+ __commonJS,
20
+ __export
21
+ };
22
+ //# sourceMappingURL=chunk-5FUTL2UF.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-63WE2C5R.js";
8
8
  import {
9
9
  __export
10
- } from "./chunk-PZ5AY32C.js";
10
+ } from "./chunk-5FUTL2UF.js";
11
11
 
12
12
  // tools/fastapply/anthropic.ts
13
13
  var anthropic_exports = {};
@@ -91,4 +91,4 @@ export {
91
91
  getSystemPrompt,
92
92
  anthropic_exports
93
93
  };
94
- //# sourceMappingURL=chunk-IUG2FHNN.js.map
94
+ //# sourceMappingURL=chunk-BHNJEBQJ.js.map
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  executeToolCall,
7
7
  formatResult
8
- } from "./chunk-374N3GIA.js";
8
+ } from "./chunk-S3RCM32V.js";
9
9
  import {
10
10
  getSystemPrompt
11
11
  } from "./chunk-Q5AHGIQO.js";
12
12
  import {
13
13
  __export
14
- } from "./chunk-PZ5AY32C.js";
14
+ } from "./chunk-5FUTL2UF.js";
15
15
 
16
16
  // tools/warp_grep/openai.ts
17
17
  var openai_exports = {};
@@ -71,4 +71,4 @@ export {
71
71
  openai_default,
72
72
  openai_exports
73
73
  };
74
- //# sourceMappingURL=chunk-6N6ZYZYD.js.map
74
+ //# sourceMappingURL=chunk-GZ7TJ7UB.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-63WE2C5R.js";
8
8
  import {
9
9
  __export
10
- } from "./chunk-PZ5AY32C.js";
10
+ } from "./chunk-5FUTL2UF.js";
11
11
 
12
12
  // tools/fastapply/vercel.ts
13
13
  var vercel_exports = {};
@@ -86,4 +86,4 @@ export {
86
86
  vercel_default,
87
87
  vercel_exports
88
88
  };
89
- //# sourceMappingURL=chunk-QZNGKOCZ.js.map
89
+ //# sourceMappingURL=chunk-IXNSTNS7.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-SMGZ6A64.js";
10
10
  import {
11
11
  runRipgrep
12
- } from "./chunk-TPP2UGQP.js";
12
+ } from "./chunk-563RLKFC.js";
13
13
  import {
14
14
  AGENT_CONFIG,
15
15
  DEFAULT_EXCLUDES
@@ -186,4 +186,4 @@ Details: ${res.stderr}` : ""}`
186
186
  export {
187
187
  LocalRipgrepProvider
188
188
  };
189
- //# sourceMappingURL=chunk-ZO4PPFCZ.js.map
189
+ //# sourceMappingURL=chunk-JNOZPU44.js.map
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  executeToolCall,
6
6
  formatResult
7
- } from "./chunk-374N3GIA.js";
7
+ } from "./chunk-S3RCM32V.js";
8
8
  import {
9
9
  getSystemPrompt
10
10
  } from "./chunk-Q5AHGIQO.js";
11
11
  import {
12
12
  __export
13
- } from "./chunk-PZ5AY32C.js";
13
+ } from "./chunk-5FUTL2UF.js";
14
14
 
15
15
  // tools/warp_grep/vercel.ts
16
16
  var vercel_exports = {};
@@ -54,4 +54,4 @@ export {
54
54
  vercel_default,
55
55
  vercel_exports
56
56
  };
57
- //# sourceMappingURL=chunk-4VGOBA2J.js.map
57
+ //# sourceMappingURL=chunk-LHKFRPUO.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-63WE2C5R.js";
8
8
  import {
9
9
  __export
10
- } from "./chunk-PZ5AY32C.js";
10
+ } from "./chunk-5FUTL2UF.js";
11
11
 
12
12
  // tools/fastapply/openai.ts
13
13
  var openai_exports = {};
@@ -103,4 +103,4 @@ export {
103
103
  openai_default,
104
104
  openai_exports
105
105
  };
106
- //# sourceMappingURL=chunk-5QIWYEHJ.js.map
106
+ //# sourceMappingURL=chunk-PKPJWARB.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  runWarpGrep
3
- } from "./chunk-2CASO3ZO.js";
3
+ } from "./chunk-Y7CPJGLU.js";
4
4
  import {
5
5
  RemoteCommandsProvider
6
6
  } from "./chunk-527P5X2E.js";
7
7
  import {
8
8
  LocalRipgrepProvider
9
- } from "./chunk-ZO4PPFCZ.js";
9
+ } from "./chunk-JNOZPU44.js";
10
10
 
11
11
  // tools/warp_grep/client.ts
12
12
  var WarpGrepClient = class {
@@ -115,4 +115,4 @@ export {
115
115
  executeToolCall,
116
116
  formatResult
117
117
  };
118
- //# sourceMappingURL=chunk-374N3GIA.js.map
118
+ //# sourceMappingURL=chunk-S3RCM32V.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createWarpGrepTool as createWarpGrepTool2
3
- } from "./chunk-3IQIT6MC.js";
3
+ } from "./chunk-Z75HCPIE.js";
4
4
  import {
5
5
  createWarpGrepTool
6
- } from "./chunk-6N6ZYZYD.js";
6
+ } from "./chunk-GZ7TJ7UB.js";
7
7
  import {
8
8
  createWarpGrepTool as createWarpGrepTool3
9
- } from "./chunk-4VGOBA2J.js";
9
+ } from "./chunk-LHKFRPUO.js";
10
10
  import {
11
11
  WarpGrepClient
12
- } from "./chunk-374N3GIA.js";
12
+ } from "./chunk-S3RCM32V.js";
13
13
  import {
14
14
  createCodebaseSearchTool as createCodebaseSearchTool3
15
15
  } from "./chunk-UBX7QYBD.js";
@@ -24,13 +24,13 @@ import {
24
24
  } from "./chunk-WM77HRKO.js";
25
25
  import {
26
26
  createEditFileTool as createEditFileTool2
27
- } from "./chunk-IUG2FHNN.js";
27
+ } from "./chunk-BHNJEBQJ.js";
28
28
  import {
29
29
  createEditFileTool
30
- } from "./chunk-5QIWYEHJ.js";
30
+ } from "./chunk-PKPJWARB.js";
31
31
  import {
32
32
  createEditFileTool as createEditFileTool3
33
- } from "./chunk-QZNGKOCZ.js";
33
+ } from "./chunk-IXNSTNS7.js";
34
34
  import {
35
35
  FastApplyClient
36
36
  } from "./chunk-CKTA4AXM.js";
@@ -280,4 +280,4 @@ export {
280
280
  VercelToolFactory,
281
281
  MorphClient
282
282
  };
283
- //# sourceMappingURL=chunk-FN4EP3WY.js.map
283
+ //# sourceMappingURL=chunk-XWSKUQVQ.js.map
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-APP75CBN.js";
14
14
  import {
15
15
  LLMResponseParser
16
- } from "./chunk-YV75OQTE.js";
16
+ } from "./chunk-3M4DOG6N.js";
17
17
  import {
18
18
  getSystemPrompt
19
19
  } from "./chunk-Q5AHGIQO.js";
@@ -193,4 +193,4 @@ async function runWarpGrep(config) {
193
193
  export {
194
194
  runWarpGrep
195
195
  };
196
- //# sourceMappingURL=chunk-2CASO3ZO.js.map
196
+ //# sourceMappingURL=chunk-Y7CPJGLU.js.map
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  executeToolCall,
7
7
  formatResult
8
- } from "./chunk-374N3GIA.js";
8
+ } from "./chunk-S3RCM32V.js";
9
9
  import {
10
10
  getSystemPrompt
11
11
  } from "./chunk-Q5AHGIQO.js";
12
12
  import {
13
13
  __export
14
- } from "./chunk-PZ5AY32C.js";
14
+ } from "./chunk-5FUTL2UF.js";
15
15
 
16
16
  // tools/warp_grep/anthropic.ts
17
17
  var anthropic_exports = {};
@@ -62,4 +62,4 @@ export {
62
62
  createWarpGrepTool,
63
63
  anthropic_exports
64
64
  };
65
- //# sourceMappingURL=chunk-3IQIT6MC.js.map
65
+ //# sourceMappingURL=chunk-Z75HCPIE.js.map
package/dist/client.cjs CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,6 +30,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
30
  ));
28
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
32
 
33
+ // node_modules/@vscode/ripgrep/lib/index.js
34
+ var require_lib = __commonJS({
35
+ "node_modules/@vscode/ripgrep/lib/index.js"(exports2, module2) {
36
+ "use strict";
37
+ var path5 = require("path");
38
+ module2.exports.rgPath = path5.join(__dirname, `../bin/rg${process.platform === "win32" ? ".exe" : ""}`);
39
+ }
40
+ });
41
+
30
42
  // client.ts
31
43
  var client_exports = {};
32
44
  __export(client_exports, {
@@ -1335,33 +1347,9 @@ function parseNestedXmlTools(text) {
1335
1347
  return tools;
1336
1348
  }
1337
1349
  function preprocessText(text) {
1338
- let processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "");
1350
+ const processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "").replace(/<\/?tool_call>/gi, "");
1339
1351
  const nestedTools = parseNestedXmlTools(processed);
1340
- const openingTagRegex = /<tool_call>|<tool>/gi;
1341
- const closingTagRegex = /<\/tool_call>|<\/tool>/gi;
1342
- const openingMatches = processed.match(openingTagRegex) || [];
1343
- const closingMatches = processed.match(closingTagRegex) || [];
1344
- if (openingMatches.length > closingMatches.length) {
1345
- const lastClosingMatch = /<\/tool_call>|<\/tool>/gi;
1346
- let lastClosingIndex = -1;
1347
- let match;
1348
- while ((match = lastClosingMatch.exec(processed)) !== null) {
1349
- lastClosingIndex = match.index + match[0].length;
1350
- }
1351
- if (lastClosingIndex > 0) {
1352
- processed = processed.slice(0, lastClosingIndex);
1353
- }
1354
- }
1355
1352
  const toolCallLines = [];
1356
- const toolTagRegex = /<tool_call>([\s\S]*?)<\/tool_call>|<tool>([\s\S]*?)<\/tool>/gi;
1357
- let tagMatch;
1358
- while ((tagMatch = toolTagRegex.exec(processed)) !== null) {
1359
- const content = (tagMatch[1] || tagMatch[2] || "").trim();
1360
- if (content) {
1361
- const lines = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l);
1362
- toolCallLines.push(...lines);
1363
- }
1364
- }
1365
1353
  const allLines = processed.split(/\r?\n/).map((l) => l.trim());
1366
1354
  for (const line of allLines) {
1367
1355
  if (!line) continue;
@@ -1950,9 +1938,20 @@ var import_path5 = __toESM(require("path"), 1);
1950
1938
 
1951
1939
  // tools/warp_grep/utils/ripgrep.ts
1952
1940
  var import_child_process = require("child_process");
1953
- var import_ripgrep = require("@vscode/ripgrep");
1954
1941
  var resolvedRgPath = null;
1955
1942
  var rgPathChecked = false;
1943
+ var bundledRgPath = null;
1944
+ async function getBundledRgPath() {
1945
+ if (bundledRgPath !== null) return bundledRgPath;
1946
+ try {
1947
+ const module2 = await Promise.resolve().then(() => __toESM(require_lib(), 1));
1948
+ bundledRgPath = module2.rgPath;
1949
+ return bundledRgPath;
1950
+ } catch {
1951
+ bundledRgPath = "";
1952
+ return null;
1953
+ }
1954
+ }
1956
1955
  function spawnRg(rgBinary, args, opts) {
1957
1956
  return new Promise((resolve2) => {
1958
1957
  const child = (0, import_child_process.spawn)(rgBinary, args, {
@@ -1983,11 +1982,14 @@ async function runRipgrep(args, opts) {
1983
1982
  return spawnRg(resolvedRgPath, args, opts);
1984
1983
  }
1985
1984
  if (!rgPathChecked) {
1986
- const result = await spawnRg(import_ripgrep.rgPath, args, opts);
1987
- if (!isBinaryFailure(result)) {
1988
- resolvedRgPath = import_ripgrep.rgPath;
1989
- rgPathChecked = true;
1990
- return result;
1985
+ const bundledPath = await getBundledRgPath();
1986
+ if (bundledPath) {
1987
+ const result = await spawnRg(bundledPath, args, opts);
1988
+ if (!isBinaryFailure(result)) {
1989
+ resolvedRgPath = bundledPath;
1990
+ rgPathChecked = true;
1991
+ return result;
1992
+ }
1991
1993
  }
1992
1994
  const fallbackResult = await spawnRg("rg", args, opts);
1993
1995
  if (!isBinaryFailure(fallbackResult)) {