@morphllm/morphsdk 0.2.45 → 0.2.47

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 (128) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-TVFGHXPE.js → chunk-3FTAIJBH.js} +4 -4
  3. package/dist/{chunk-ZRLEAPZV.js → chunk-76DJEQEP.js} +4 -4
  4. package/dist/{chunk-W3XLPMV3.js → chunk-7HS6YXA3.js} +21 -5
  5. package/dist/{chunk-W3XLPMV3.js.map → chunk-7HS6YXA3.js.map} +1 -1
  6. package/dist/chunk-BLXC5R4W.js +82 -0
  7. package/dist/chunk-BLXC5R4W.js.map +1 -0
  8. package/dist/chunk-FA6UGPVL.js +105 -0
  9. package/dist/chunk-FA6UGPVL.js.map +1 -0
  10. package/dist/{chunk-PEGZVGG4.js → chunk-G4AWE5A2.js} +4 -4
  11. package/dist/{chunk-OUEJ6XEO.js → chunk-GJU7UOFL.js} +4 -4
  12. package/dist/{chunk-Q7PDN7TS.js → chunk-GZMUGMOZ.js} +1 -1
  13. package/dist/{chunk-Q7PDN7TS.js.map → chunk-GZMUGMOZ.js.map} +1 -1
  14. package/dist/chunk-JYBVRF72.js +1 -0
  15. package/dist/chunk-OOZSGWSK.js +70 -0
  16. package/dist/chunk-OOZSGWSK.js.map +1 -0
  17. package/dist/{chunk-GDR65N2J.js → chunk-OXHGFHEU.js} +53 -26
  18. package/dist/chunk-OXHGFHEU.js.map +1 -0
  19. package/dist/{chunk-VBBJGWHY.js → chunk-P2XKFWFD.js} +2 -2
  20. package/dist/chunk-RAKREIXE.js +76 -0
  21. package/dist/chunk-RAKREIXE.js.map +1 -0
  22. package/dist/chunk-SDI2FI6G.js +283 -0
  23. package/dist/chunk-SDI2FI6G.js.map +1 -0
  24. package/dist/{chunk-GTOXMAF2.js → chunk-SWQPIKPY.js} +44 -3
  25. package/dist/chunk-SWQPIKPY.js.map +1 -0
  26. package/dist/chunk-TJIUA27P.js +94 -0
  27. package/dist/chunk-TJIUA27P.js.map +1 -0
  28. package/dist/{chunk-O5DA5V5S.js → chunk-UBX7QYBD.js} +4 -4
  29. package/dist/{chunk-UYBIKZPM.js → chunk-UCWTZSW5.js} +3 -3
  30. package/dist/{chunk-X4CQ6D3G.js → chunk-UIZT3KVJ.js} +4 -4
  31. package/dist/chunk-WETRQJGU.js +129 -0
  32. package/dist/chunk-WETRQJGU.js.map +1 -0
  33. package/dist/{chunk-RSLIOCOE.js → chunk-XQIVYQD6.js} +3 -2
  34. package/dist/chunk-XQIVYQD6.js.map +1 -0
  35. package/dist/client-BGctTHu9.d.ts +318 -0
  36. package/dist/client.cjs +1886 -44
  37. package/dist/client.cjs.map +1 -1
  38. package/dist/client.d.ts +14 -110
  39. package/dist/client.js +28 -3
  40. package/dist/core-DxiUwyBe.d.ts +156 -0
  41. package/dist/git/client.cjs +52 -25
  42. package/dist/git/client.cjs.map +1 -1
  43. package/dist/git/client.d.ts +17 -8
  44. package/dist/git/client.js +1 -1
  45. package/dist/git/index.cjs +52 -25
  46. package/dist/git/index.cjs.map +1 -1
  47. package/dist/git/index.d.ts +1 -1
  48. package/dist/git/index.js +2 -2
  49. package/dist/git/types.cjs.map +1 -1
  50. package/dist/git/types.d.ts +20 -2
  51. package/dist/index.cjs +1965 -46
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.ts +8 -1
  54. package/dist/index.js +47 -5
  55. package/dist/tools/codebase_search/anthropic.js +2 -2
  56. package/dist/tools/codebase_search/index.js +9 -9
  57. package/dist/tools/codebase_search/openai.js +2 -2
  58. package/dist/tools/codebase_search/vercel.js +2 -2
  59. package/dist/tools/fastapply/anthropic.js +2 -2
  60. package/dist/tools/fastapply/index.js +7 -7
  61. package/dist/tools/fastapply/openai.js +2 -2
  62. package/dist/tools/fastapply/vercel.js +2 -2
  63. package/dist/tools/index.js +7 -7
  64. package/dist/tools/warp_grep/agent/config.cjs +80 -1
  65. package/dist/tools/warp_grep/agent/config.cjs.map +1 -1
  66. package/dist/tools/warp_grep/agent/config.js +1 -1
  67. package/dist/tools/warp_grep/agent/parser.cjs +43 -2
  68. package/dist/tools/warp_grep/agent/parser.cjs.map +1 -1
  69. package/dist/tools/warp_grep/agent/parser.js +1 -1
  70. package/dist/tools/warp_grep/agent/prompt.cjs +89 -45
  71. package/dist/tools/warp_grep/agent/prompt.cjs.map +1 -1
  72. package/dist/tools/warp_grep/agent/prompt.d.ts +1 -1
  73. package/dist/tools/warp_grep/agent/prompt.js +1 -1
  74. package/dist/tools/warp_grep/agent/runner.cjs +229 -49
  75. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  76. package/dist/tools/warp_grep/agent/runner.js +4 -4
  77. package/dist/tools/warp_grep/agent/types.js +0 -1
  78. package/dist/tools/warp_grep/anthropic.cjs +313 -84
  79. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  80. package/dist/tools/warp_grep/anthropic.d.ts +75 -12
  81. package/dist/tools/warp_grep/anthropic.js +22 -9
  82. package/dist/tools/warp_grep/index.cjs +417 -127
  83. package/dist/tools/warp_grep/index.cjs.map +1 -1
  84. package/dist/tools/warp_grep/index.d.ts +17 -4
  85. package/dist/tools/warp_grep/index.js +30 -22
  86. package/dist/tools/warp_grep/openai.cjs +316 -84
  87. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  88. package/dist/tools/warp_grep/openai.d.ts +73 -29
  89. package/dist/tools/warp_grep/openai.js +22 -9
  90. package/dist/tools/warp_grep/providers/command.cjs +80 -1
  91. package/dist/tools/warp_grep/providers/command.cjs.map +1 -1
  92. package/dist/tools/warp_grep/providers/command.js +2 -2
  93. package/dist/tools/warp_grep/providers/local.cjs +82 -2
  94. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  95. package/dist/tools/warp_grep/providers/local.js +3 -3
  96. package/dist/tools/warp_grep/utils/ripgrep.cjs +2 -1
  97. package/dist/tools/warp_grep/utils/ripgrep.cjs.map +1 -1
  98. package/dist/tools/warp_grep/utils/ripgrep.js +1 -1
  99. package/dist/tools/warp_grep/vercel.cjs +293 -58
  100. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  101. package/dist/tools/warp_grep/vercel.d.ts +40 -19
  102. package/dist/tools/warp_grep/vercel.js +18 -9
  103. package/package.json +2 -1
  104. package/dist/chunk-AFEPUNAO.js +0 -15
  105. package/dist/chunk-AFEPUNAO.js.map +0 -1
  106. package/dist/chunk-GDR65N2J.js.map +0 -1
  107. package/dist/chunk-GTOXMAF2.js.map +0 -1
  108. package/dist/chunk-HKZB23U7.js +0 -85
  109. package/dist/chunk-HKZB23U7.js.map +0 -1
  110. package/dist/chunk-IQHKEIQX.js +0 -54
  111. package/dist/chunk-IQHKEIQX.js.map +0 -1
  112. package/dist/chunk-JKFVDM62.js +0 -45
  113. package/dist/chunk-JKFVDM62.js.map +0 -1
  114. package/dist/chunk-K6FQZZ2E.js +0 -104
  115. package/dist/chunk-K6FQZZ2E.js.map +0 -1
  116. package/dist/chunk-KL4YVZRF.js +0 -57
  117. package/dist/chunk-KL4YVZRF.js.map +0 -1
  118. package/dist/chunk-RSLIOCOE.js.map +0 -1
  119. package/dist/chunk-XYPMN4A3.js +0 -1
  120. /package/dist/{chunk-TVFGHXPE.js.map → chunk-3FTAIJBH.js.map} +0 -0
  121. /package/dist/{chunk-ZRLEAPZV.js.map → chunk-76DJEQEP.js.map} +0 -0
  122. /package/dist/{chunk-PEGZVGG4.js.map → chunk-G4AWE5A2.js.map} +0 -0
  123. /package/dist/{chunk-OUEJ6XEO.js.map → chunk-GJU7UOFL.js.map} +0 -0
  124. /package/dist/{chunk-XYPMN4A3.js.map → chunk-JYBVRF72.js.map} +0 -0
  125. /package/dist/{chunk-VBBJGWHY.js.map → chunk-P2XKFWFD.js.map} +0 -0
  126. /package/dist/{chunk-O5DA5V5S.js.map → chunk-UBX7QYBD.js.map} +0 -0
  127. /package/dist/{chunk-UYBIKZPM.js.map → chunk-UCWTZSW5.js.map} +0 -0
  128. /package/dist/{chunk-X4CQ6D3G.js.map → chunk-UIZT3KVJ.js.map} +0 -0
@@ -5,13 +5,54 @@ var LLMResponseParseError = class extends Error {
5
5
  this.name = "LLMResponseParseError";
6
6
  }
7
7
  };
8
+ var VALID_COMMANDS = ["analyse", "grep", "read", "finish"];
9
+ function preprocessText(text) {
10
+ let processed = text.replace(/<think>[\s\S]*?<\/think>/gi, "");
11
+ const openingTagRegex = /<tool_call>|<tool>/gi;
12
+ const closingTagRegex = /<\/tool_call>|<\/tool>/gi;
13
+ const openingMatches = processed.match(openingTagRegex) || [];
14
+ const closingMatches = processed.match(closingTagRegex) || [];
15
+ if (openingMatches.length > closingMatches.length) {
16
+ const lastClosingMatch = /<\/tool_call>|<\/tool>/gi;
17
+ let lastClosingIndex = -1;
18
+ let match;
19
+ while ((match = lastClosingMatch.exec(processed)) !== null) {
20
+ lastClosingIndex = match.index + match[0].length;
21
+ }
22
+ if (lastClosingIndex > 0) {
23
+ processed = processed.slice(0, lastClosingIndex);
24
+ }
25
+ }
26
+ const toolCallLines = [];
27
+ const toolTagRegex = /<tool_call>([\s\S]*?)<\/tool_call>|<tool>([\s\S]*?)<\/tool>/gi;
28
+ let tagMatch;
29
+ while ((tagMatch = toolTagRegex.exec(processed)) !== null) {
30
+ const content = (tagMatch[1] || tagMatch[2] || "").trim();
31
+ if (content) {
32
+ const lines = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l);
33
+ toolCallLines.push(...lines);
34
+ }
35
+ }
36
+ const allLines = processed.split(/\r?\n/).map((l) => l.trim());
37
+ for (const line of allLines) {
38
+ if (!line) continue;
39
+ if (line.startsWith("<")) continue;
40
+ const firstWord = line.split(/\s/)[0];
41
+ if (VALID_COMMANDS.includes(firstWord)) {
42
+ if (!toolCallLines.includes(line)) {
43
+ toolCallLines.push(line);
44
+ }
45
+ }
46
+ }
47
+ return toolCallLines;
48
+ }
8
49
  var LLMResponseParser = class {
9
50
  finishSpecSplitRe = /,(?=[^,\s]+:)/;
10
51
  parse(text) {
11
52
  if (typeof text !== "string") {
12
53
  throw new TypeError("Command text must be a string.");
13
54
  }
14
- const lines = text.split(/\r?\n/).map((l) => l.trim());
55
+ const lines = preprocessText(text);
15
56
  const commands = [];
16
57
  let finishAccumulator = null;
17
58
  lines.forEach((line, idx) => {
@@ -34,7 +75,7 @@ var LLMResponseParser = class {
34
75
  finishAccumulator = this.handleFinish(parts, ctx, finishAccumulator);
35
76
  break;
36
77
  default:
37
- throw new LLMResponseParseError(`Line ${ctx.lineNumber}: Unsupported command '${cmd}'`);
78
+ break;
38
79
  }
39
80
  });
40
81
  if (finishAccumulator) {
@@ -137,4 +178,4 @@ export {
137
178
  LLMResponseParseError,
138
179
  LLMResponseParser
139
180
  };
140
- //# sourceMappingURL=chunk-GTOXMAF2.js.map
181
+ //# sourceMappingURL=chunk-SWQPIKPY.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\nexport class LLMResponseParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'LLMResponseParseError';\n }\n}\n\ntype LineContext = { lineNumber: number; raw: string };\n\n// Valid tool command names\nconst VALID_COMMANDS = ['analyse', 'grep', 'read', 'finish'];\n\n/**\n * Preprocesses text to handle XML tags:\n * 1. Removes <think>...</think> blocks entirely\n * 2. Extracts content from <tool>...</tool> or <tool_call>...</tool_call> tags\n * 3. Passes through raw tool calls (lines starting with valid commands)\n * 4. Discards unclosed <tool...> tags\n */\nfunction preprocessText(text: string): string[] {\n // Step 1: Remove <think>...</think> blocks (including multiline)\n let processed = text.replace(/<think>[\\s\\S]*?<\\/think>/gi, '');\n \n // Step 2: Check for unclosed <tool or <tool_call tags and discard them\n // Find all opening tags and their positions\n const openingTagRegex = /<tool_call>|<tool>/gi;\n const closingTagRegex = /<\\/tool_call>|<\\/tool>/gi;\n \n // Count opening and closing tags\n const openingMatches = processed.match(openingTagRegex) || [];\n const closingMatches = processed.match(closingTagRegex) || [];\n \n // If there are more opening than closing tags, we have unclosed tags\n // In that case, only process complete tag pairs\n if (openingMatches.length > closingMatches.length) {\n // Remove any content after the last complete closing tag\n const lastClosingMatch = /<\\/tool_call>|<\\/tool>/gi;\n let lastClosingIndex = -1;\n let match;\n while ((match = lastClosingMatch.exec(processed)) !== null) {\n lastClosingIndex = match.index + match[0].length;\n }\n if (lastClosingIndex > 0) {\n processed = processed.slice(0, lastClosingIndex);\n }\n }\n \n // Step 3: Extract content from <tool_call>...</tool_call> and <tool>...</tool> tags\n const toolCallLines: string[] = [];\n const toolTagRegex = /<tool_call>([\\s\\S]*?)<\\/tool_call>|<tool>([\\s\\S]*?)<\\/tool>/gi;\n let tagMatch;\n \n while ((tagMatch = toolTagRegex.exec(processed)) !== null) {\n const content = (tagMatch[1] || tagMatch[2] || '').trim();\n if (content) {\n // Split content by newlines in case there are multiple tool calls in one tag\n const lines = content.split(/\\r?\\n/).map(l => l.trim()).filter(l => l);\n toolCallLines.push(...lines);\n }\n }\n \n // Step 4: Also extract raw tool calls (lines starting with valid commands)\n // This provides backwards compatibility\n const allLines = processed.split(/\\r?\\n/).map(l => l.trim());\n for (const line of allLines) {\n if (!line) continue;\n \n // Skip lines that are inside XML tags (already processed above)\n if (line.startsWith('<')) continue;\n \n // Check if line starts with a valid command\n const firstWord = line.split(/\\s/)[0];\n if (VALID_COMMANDS.includes(firstWord)) {\n // Avoid duplicates\n if (!toolCallLines.includes(line)) {\n toolCallLines.push(line);\n }\n }\n }\n \n return toolCallLines;\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 = preprocessText(text);\n \n const commands: ToolCall[] = [];\n let finishAccumulator: Map<string, number[][]> | null = null;\n\n lines.forEach((line, idx) => {\n if (!line || line.startsWith('#')) return;\n const ctx: LineContext = { lineNumber: idx + 1, raw: line };\n const parts = this.splitLine(line, ctx);\n if (parts.length === 0) return;\n const cmd = parts[0];\n switch (cmd) {\n case 'analyse':\n this.handleAnalyse(parts, ctx, commands);\n break;\n case 'grep':\n this.handleGrep(parts, ctx, commands);\n break;\n case 'read':\n this.handleRead(parts, ctx, commands);\n break;\n case 'finish':\n finishAccumulator = this.handleFinish(parts, ctx, finishAccumulator);\n break;\n default:\n // Silently ignore unknown commands after preprocessing\n // (they might be remnants of XML or other content)\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, ctx: LineContext): string[] {\n try {\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 } catch {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: Unable to parse line.`);\n }\n }\n\n private handleAnalyse(parts: string[], ctx: LineContext, commands: ToolCall[]) {\n // analyse <path> [pattern]\n if (parts.length < 2) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: analyse requires <path>`);\n }\n const path = parts[1];\n const pattern = parts[2]?.replace(/^\"|\"$/g, '') ?? null;\n commands.push({ name: 'analyse', arguments: { path, pattern } });\n }\n\n // no glob tool in MCP\n\n private handleGrep(parts: string[], ctx: LineContext, commands: ToolCall[]) {\n // grep '<pattern>' <path>\n if (parts.length < 3) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: grep requires '<pattern>' and <path>`);\n }\n const pat = parts[1];\n if (!pat.startsWith(\"'\") || !pat.endsWith(\"'\")) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: grep pattern must be single-quoted`);\n }\n commands.push({ name: 'grep', arguments: { pattern: pat.slice(1, -1), path: parts[2] } });\n }\n\n private handleRead(parts: string[], ctx: LineContext, commands: ToolCall[]) {\n // read <path>[:start-end]\n if (parts.length < 2) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: read requires <path> or <path>:<start-end>`);\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 path = spec.slice(0, rangeIdx);\n const range = spec.slice(rangeIdx + 1);\n const [s, e] = range.split('-').map(v => parseInt(v, 10));\n if (!Number.isFinite(s) || !Number.isFinite(e)) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: invalid read range '${range}'`);\n }\n commands.push({ name: 'read', arguments: { path, start: s, end: e } });\n }\n\n private handleFinish(parts: string[], ctx: LineContext, 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 [path, rangesText] = token.split(':', 2);\n if (!path || !rangesText) {\n throw new LLMResponseParseError(`Line ${ctx.lineNumber}: invalid finish token '${token}'`);\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 throw new LLMResponseParseError(`Line ${ctx.lineNumber}: invalid range '${spec}'`);\n }\n const arr = map.get(path) ?? [];\n arr.push([s, e]);\n map.set(path, arr);\n }\n }\n return map;\n }\n}\n"],"mappings":";AAGO,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC/C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,S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AG,EAAE,OAAO,OAAO;AACvD,iBAAW,QAAQ,YAAY;AAC7B,cAAM,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI,OAAK,SAAS,GAAG,EAAE,CAAC;AACvD,YAAI,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,KAAK,IAAI,GAAG;AACvD,gBAAM,IAAI,sBAAsB,QAAQ,IAAI,UAAU,oBAAoB,IAAI,GAAG;AAAA,QACnF;AACA,cAAM,MAAM,IAAI,IAAI,IAAI,KAAK,CAAC;AAC9B,YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACf,YAAI,IAAI,MAAM,GAAG;AAAA,MACnB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,94 @@
1
+ // tools/warp_grep/agent/config.ts
2
+ var AGENT_CONFIG = {
3
+ // Give the model freedom; failsafe cap to prevent infinite loops
4
+ MAX_ROUNDS: 10,
5
+ TIMEOUT_MS: 3e4
6
+ };
7
+ var BUILTIN_EXCLUDES = [
8
+ // Version control
9
+ ".git",
10
+ ".svn",
11
+ ".hg",
12
+ ".bzr",
13
+ // Dependencies
14
+ "node_modules",
15
+ "bower_components",
16
+ ".pnpm",
17
+ ".yarn",
18
+ "vendor",
19
+ "packages",
20
+ "Pods",
21
+ ".bundle",
22
+ // Python
23
+ "__pycache__",
24
+ ".pytest_cache",
25
+ ".mypy_cache",
26
+ ".ruff_cache",
27
+ ".venv",
28
+ "venv",
29
+ ".tox",
30
+ ".nox",
31
+ ".eggs",
32
+ "*.egg-info",
33
+ // Build outputs
34
+ "dist",
35
+ "build",
36
+ "out",
37
+ "output",
38
+ "target",
39
+ "_build",
40
+ ".next",
41
+ ".nuxt",
42
+ ".output",
43
+ ".vercel",
44
+ ".netlify",
45
+ // Cache directories
46
+ ".cache",
47
+ ".parcel-cache",
48
+ ".turbo",
49
+ ".nx",
50
+ ".gradle",
51
+ // IDE/Editor
52
+ ".idea",
53
+ ".vscode",
54
+ ".vs",
55
+ // Coverage
56
+ "coverage",
57
+ ".coverage",
58
+ "htmlcov",
59
+ ".nyc_output",
60
+ // Temporary
61
+ "tmp",
62
+ "temp",
63
+ ".tmp",
64
+ ".temp",
65
+ // Lock files
66
+ "package-lock.json",
67
+ "yarn.lock",
68
+ "pnpm-lock.yaml",
69
+ "bun.lockb",
70
+ "Cargo.lock",
71
+ "Gemfile.lock",
72
+ "poetry.lock",
73
+ // Binary/minified
74
+ "*.min.js",
75
+ "*.min.css",
76
+ "*.bundle.js",
77
+ "*.wasm",
78
+ "*.so",
79
+ "*.dll",
80
+ "*.pyc",
81
+ "*.map",
82
+ "*.js.map",
83
+ // Hidden directories catch-all
84
+ ".*"
85
+ ];
86
+ var DEFAULT_EXCLUDES = (process.env.MORPH_WARP_GREP_EXCLUDE || "").split(",").map((s) => s.trim()).filter(Boolean).concat(BUILTIN_EXCLUDES);
87
+ var DEFAULT_MODEL = "morph-warp-grep";
88
+
89
+ export {
90
+ AGENT_CONFIG,
91
+ DEFAULT_EXCLUDES,
92
+ DEFAULT_MODEL
93
+ };
94
+ //# sourceMappingURL=chunk-TJIUA27P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/agent/config.ts"],"sourcesContent":["// Agent configuration defaults for morph-warp-grep\n// Hard-coded: SDK does not expose control over rounds or timeout.\nexport const AGENT_CONFIG = {\n // Give the model freedom; failsafe cap to prevent infinite loops\n MAX_ROUNDS: 10,\n TIMEOUT_MS: 30000,\n};\n\n/**\n * Comprehensive exclusion list for directories and files\n * These patterns are used with ripgrep's -g flag\n */\nconst BUILTIN_EXCLUDES = [\n // Version control\n '.git', '.svn', '.hg', '.bzr',\n \n // Dependencies\n 'node_modules', 'bower_components', '.pnpm', '.yarn',\n 'vendor', 'packages', 'Pods', '.bundle',\n \n // Python\n '__pycache__', '.pytest_cache', '.mypy_cache', '.ruff_cache',\n '.venv', 'venv', '.tox', '.nox', '.eggs', '*.egg-info',\n \n // Build outputs\n 'dist', 'build', 'out', 'output', 'target', '_build',\n '.next', '.nuxt', '.output', '.vercel', '.netlify',\n \n // Cache directories\n '.cache', '.parcel-cache', '.turbo', '.nx', '.gradle',\n \n // IDE/Editor\n '.idea', '.vscode', '.vs',\n \n // Coverage\n 'coverage', '.coverage', 'htmlcov', '.nyc_output',\n \n // Temporary\n 'tmp', 'temp', '.tmp', '.temp',\n \n // Lock files\n 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb',\n 'Cargo.lock', 'Gemfile.lock', 'poetry.lock',\n \n // Binary/minified\n '*.min.js', '*.min.css', '*.bundle.js',\n '*.wasm', '*.so', '*.dll', '*.pyc',\n '*.map', '*.js.map',\n \n // Hidden directories catch-all\n '.*',\n];\n\nexport const DEFAULT_EXCLUDES = (process.env.MORPH_WARP_GREP_EXCLUDE || '')\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n .concat(BUILTIN_EXCLUDES);\n\nexport const DEFAULT_MODEL = 'morph-warp-grep';\n\n\n"],"mappings":";AAEO,IAAM,eAAe;AAAA;AAAA,EAE1B,YAAY;AAAA,EACZ,YAAY;AACd;AAMA,IAAM,mBAAmB;AAAA;AAAA,EAEvB;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAO;AAAA;AAAA,EAGvB;AAAA,EAAgB;AAAA,EAAoB;AAAA,EAAS;AAAA,EAC7C;AAAA,EAAU;AAAA,EAAY;AAAA,EAAQ;AAAA;AAAA,EAG9B;AAAA,EAAe;AAAA,EAAiB;AAAA,EAAe;AAAA,EAC/C;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAS;AAAA;AAAA,EAG1C;AAAA,EAAQ;AAAA,EAAS;AAAA,EAAO;AAAA,EAAU;AAAA,EAAU;AAAA,EAC5C;AAAA,EAAS;AAAA,EAAS;AAAA,EAAW;AAAA,EAAW;AAAA;AAAA,EAGxC;AAAA,EAAU;AAAA,EAAiB;AAAA,EAAU;AAAA,EAAO;AAAA;AAAA,EAG5C;AAAA,EAAS;AAAA,EAAW;AAAA;AAAA,EAGpB;AAAA,EAAY;AAAA,EAAa;AAAA,EAAW;AAAA;AAAA,EAGpC;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAQ;AAAA;AAAA,EAGvB;AAAA,EAAqB;AAAA,EAAa;AAAA,EAAkB;AAAA,EACpD;AAAA,EAAc;AAAA,EAAgB;AAAA;AAAA,EAG9B;AAAA,EAAY;AAAA,EAAa;AAAA,EACzB;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAS;AAAA,EAC3B;AAAA,EAAS;AAAA;AAAA,EAGT;AACF;AAEO,IAAM,oBAAoB,QAAQ,IAAI,2BAA2B,IACrE,MAAM,GAAG,EACT,IAAI,OAAK,EAAE,KAAK,CAAC,EACjB,OAAO,OAAO,EACd,OAAO,gBAAgB;AAEnB,IAAM,gBAAgB;","names":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- CODEBASE_SEARCH_DESCRIPTION
3
- } from "./chunk-YQMPVJ2L.js";
4
1
  import {
5
2
  executeCodebaseSearch
6
3
  } from "./chunk-WM77HRKO.js";
4
+ import {
5
+ CODEBASE_SEARCH_DESCRIPTION
6
+ } from "./chunk-YQMPVJ2L.js";
7
7
 
8
8
  // tools/codebase_search/vercel.ts
9
9
  import { tool } from "ai";
@@ -55,4 +55,4 @@ export {
55
55
  getSystemPrompt,
56
56
  vercel_default
57
57
  };
58
- //# sourceMappingURL=chunk-O5DA5V5S.js.map
58
+ //# sourceMappingURL=chunk-UBX7QYBD.js.map
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-SMGZ6A64.js";
10
10
  import {
11
11
  runRipgrep
12
- } from "./chunk-RSLIOCOE.js";
12
+ } from "./chunk-XQIVYQD6.js";
13
13
  import {
14
14
  DEFAULT_EXCLUDES
15
- } from "./chunk-AFEPUNAO.js";
15
+ } from "./chunk-TJIUA27P.js";
16
16
 
17
17
  // tools/warp_grep/providers/local.ts
18
18
  import fs from "fs/promises";
@@ -132,4 +132,4 @@ var LocalRipgrepProvider = class {
132
132
  export {
133
133
  LocalRipgrepProvider
134
134
  };
135
- //# sourceMappingURL=chunk-UYBIKZPM.js.map
135
+ //# sourceMappingURL=chunk-UCWTZSW5.js.map
@@ -1,10 +1,10 @@
1
+ import {
2
+ executeEditFile
3
+ } from "./chunk-64PMM72R.js";
1
4
  import {
2
5
  EDIT_FILE_SYSTEM_PROMPT,
3
6
  EDIT_FILE_TOOL_DESCRIPTION
4
7
  } from "./chunk-63WE2C5R.js";
5
- import {
6
- executeEditFile
7
- } from "./chunk-64PMM72R.js";
8
8
  import {
9
9
  __export
10
10
  } from "./chunk-PZ5AY32C.js";
@@ -86,4 +86,4 @@ export {
86
86
  vercel_default,
87
87
  vercel_exports
88
88
  };
89
- //# sourceMappingURL=chunk-X4CQ6D3G.js.map
89
+ //# sourceMappingURL=chunk-UIZT3KVJ.js.map
@@ -0,0 +1,129 @@
1
+ // tools/warp_grep/agent/prompt.ts
2
+ var SYSTEM_PROMPT = `You are a code search agent. Your task is to find all relevant code for a given query.
3
+
4
+ <workflow>
5
+ You have exactly 4 turns. The 4th turn MUST be a \`finish\` call. Each turn allows up to 8 parallel tool calls.
6
+
7
+ - Turn 1: Map the territory OR dive deep (based on query specificity)
8
+ - Turn 2-3: Refine based on findings
9
+ - Turn 4: MUST call \`finish\` with all relevant code locations
10
+ - You MAY call \`finish\` early if confident\u2014but never before at least 1 search turn.
11
+
12
+ Remember, if the task feels easy to you, it is strongly desirable to call \`finish\` early using fewer turns, but quality over speed.
13
+ </workflow>
14
+
15
+ <tools>
16
+ ### \`analyse <path> [pattern]\`
17
+ Directory tree or file search. Shows structure of a path, optionally filtered by regex pattern.
18
+ - \`path\`: Required. Directory or file path (use \`.\` for repo root)
19
+ - \`pattern\`: Optional regex to filter results
20
+
21
+ Examples:
22
+ \`\`\`
23
+ analyse .
24
+ analyse src/api
25
+ analyse . ".*\\.ts$"
26
+ analyse src "test.*"
27
+ \`\`\`
28
+
29
+ ### \`read <path>[:start-end]\`
30
+ Read file contents. Line range is 1-based, inclusive.
31
+ - Returns numbered lines for easy reference
32
+ - Omit range to read entire file
33
+
34
+ Examples:
35
+ \`\`\`
36
+ read src/main.py
37
+ read src/db/conn.py:10-50
38
+ read package.json:1-20
39
+ \`\`\`
40
+
41
+ ### \`grep '<pattern>' <path>\`
42
+ Ripgrep search. Finds pattern matches across files.
43
+ - \`'<pattern>'\`: Required. Regex pattern wrapped in single quotes
44
+ - \`<path>\`: Required. Directory or file to search (use \`.\` for repo root)
45
+
46
+ Examples:
47
+ \`\`\`
48
+ grep 'class.*Service' src/
49
+ grep 'def authenticate' .
50
+ grep 'import.*from' src/components/
51
+ grep 'TODO' .
52
+ \`\`\`
53
+
54
+ ### \`finish <file1:ranges> [file2:ranges ...]\`
55
+ Submit final answer with all relevant code locations.
56
+ - Include generous line ranges\u2014don't be stingy with context
57
+ - Ranges are comma-separated: \`file.py:10-30,50-60\`
58
+ - ALWAYS include import statements at the top of files (usually lines 1-20)
59
+ - If code spans multiple files, include ALL of them
60
+ - Small files can be returned in full
61
+
62
+ Examples:
63
+ \`\`\`
64
+ finish src/auth.py:1-15,25-50,75-80 src/models/user.py:1-10,20-45
65
+ finish src/index.ts:1-100
66
+ \`\`\`
67
+ </tools>
68
+
69
+ <strategy>
70
+ **Before your first tool call, classify the query:**
71
+
72
+ | Query Type | Turn 1 Strategy | Early Finish? |
73
+ |------------|-----------------|---------------|
74
+ | **Specific** (function name, error string, unique identifier) | 8 parallel greps on likely paths | Often by turn 2 |
75
+ | **Conceptual** (how does X work, where is Y handled) | analyse + 2-3 broad greps | Rarely early |
76
+ | **Exploratory** (find all tests, list API endpoints) | analyse at multiple depths | Usually needs 3 turns |
77
+
78
+ **Parallel call patterns:**
79
+ - **Shotgun grep**: Same pattern, 8 different directories\u2014fast coverage
80
+ - **Variant grep**: 8 pattern variations (synonyms, naming conventions)\u2014catches inconsistent codebases
81
+ - **Funnel**: 1 analyse + 7 greps\u2014orient and search simultaneously
82
+ - **Deep read**: 8 reads on files you already identified\u2014gather full context fast
83
+ </strategy>
84
+
85
+ <output_format>
86
+ EVERY response MUST follow this exact format:
87
+
88
+ 1. First, wrap your reasoning in \`<think>...</think>\` tags containing:
89
+ - Query classification (specific/conceptual/exploratory)
90
+ - Confidence estimate (can I finish in 1-2 turns?)
91
+ - This turn's parallel strategy
92
+ - What signals would let me finish early?
93
+
94
+ 2. Then, output tool calls wrapped in \`<tool_call>...</tool_call>\` tags, one per line.
95
+
96
+ Example:
97
+ \`\`\`
98
+ <think>
99
+ This is a specific query about authentication. I'll grep for auth-related patterns.
100
+ High confidence I can finish in 2 turns if I find the auth module.
101
+ Strategy: Shotgun grep across likely directories.
102
+ </think>
103
+ <tool_call>grep 'authenticate' src/</tool_call>
104
+ <tool_call>grep 'login' src/</tool_call>
105
+ <tool_call>analyse src/auth</tool_call>
106
+ \`\`\`
107
+
108
+ No commentary outside \`<think>\`. No explanations after tool calls.
109
+ </output_format>
110
+
111
+ <finishing_requirements>
112
+ When calling \`finish\`:
113
+ - Include the import section (typically lines 1-20) of each file
114
+ - Include all function/class definitions that are relevant
115
+ - Include any type definitions, interfaces, or constants used
116
+ - Better to over-include than leave the user missing context
117
+ - If unsure about boundaries, include more rather than less
118
+ </finishing_requirements>
119
+
120
+ Begin your exploration now to find code relevant to the query.`;
121
+ function getSystemPrompt() {
122
+ return SYSTEM_PROMPT;
123
+ }
124
+
125
+ export {
126
+ SYSTEM_PROMPT,
127
+ getSystemPrompt
128
+ };
129
+ //# sourceMappingURL=chunk-WETRQJGU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/agent/prompt.ts"],"sourcesContent":["export const SYSTEM_PROMPT = `You are a code search agent. Your task is to find all relevant code for a given query.\n\n<workflow>\nYou have exactly 4 turns. The 4th turn MUST be a \\`finish\\` call. Each turn allows up to 8 parallel tool calls.\n\n- Turn 1: Map the territory OR dive deep (based on query specificity)\n- Turn 2-3: Refine based on findings\n- Turn 4: MUST call \\`finish\\` with all relevant code locations\n- You MAY call \\`finish\\` early if confident—but never before at least 1 search turn.\n\nRemember, if the task feels easy to you, it is strongly desirable to call \\`finish\\` early using fewer turns, but quality over speed.\n</workflow>\n\n<tools>\n### \\`analyse <path> [pattern]\\`\nDirectory tree or file search. Shows structure of a path, optionally filtered by regex pattern.\n- \\`path\\`: Required. Directory or file path (use \\`.\\` for repo root)\n- \\`pattern\\`: Optional regex to filter results\n\nExamples:\n\\`\\`\\`\nanalyse .\nanalyse src/api\nanalyse . \".*\\\\.ts$\"\nanalyse src \"test.*\"\n\\`\\`\\`\n\n### \\`read <path>[:start-end]\\`\nRead file contents. Line range is 1-based, inclusive.\n- Returns numbered lines for easy reference\n- Omit range to read entire file\n\nExamples:\n\\`\\`\\`\nread src/main.py\nread src/db/conn.py:10-50\nread package.json:1-20\n\\`\\`\\`\n\n### \\`grep '<pattern>' <path>\\`\nRipgrep search. Finds pattern matches across files.\n- \\`'<pattern>'\\`: Required. Regex pattern wrapped in single quotes\n- \\`<path>\\`: Required. Directory or file to search (use \\`.\\` for repo root)\n\nExamples:\n\\`\\`\\`\ngrep 'class.*Service' src/\ngrep 'def authenticate' .\ngrep 'import.*from' src/components/\ngrep 'TODO' .\n\\`\\`\\`\n\n### \\`finish <file1:ranges> [file2:ranges ...]\\`\nSubmit final answer with all relevant code locations.\n- Include generous line ranges—don't be stingy with context\n- Ranges are comma-separated: \\`file.py:10-30,50-60\\`\n- ALWAYS include import statements at the top of files (usually lines 1-20)\n- If code spans multiple files, include ALL of them\n- Small files can be returned in full\n\nExamples:\n\\`\\`\\`\nfinish src/auth.py:1-15,25-50,75-80 src/models/user.py:1-10,20-45\nfinish src/index.ts:1-100\n\\`\\`\\`\n</tools>\n\n<strategy>\n**Before your first tool call, classify the query:**\n\n| Query Type | Turn 1 Strategy | Early Finish? |\n|------------|-----------------|---------------|\n| **Specific** (function name, error string, unique identifier) | 8 parallel greps on likely paths | Often by turn 2 |\n| **Conceptual** (how does X work, where is Y handled) | analyse + 2-3 broad greps | Rarely early |\n| **Exploratory** (find all tests, list API endpoints) | analyse at multiple depths | Usually needs 3 turns |\n\n**Parallel call patterns:**\n- **Shotgun grep**: Same pattern, 8 different directories—fast coverage\n- **Variant grep**: 8 pattern variations (synonyms, naming conventions)—catches inconsistent codebases\n- **Funnel**: 1 analyse + 7 greps—orient and search simultaneously\n- **Deep read**: 8 reads on files you already identified—gather full context fast\n</strategy>\n\n<output_format>\nEVERY response MUST follow this exact format:\n\n1. First, wrap your reasoning in \\`<think>...</think>\\` tags containing:\n - Query classification (specific/conceptual/exploratory)\n - Confidence estimate (can I finish in 1-2 turns?)\n - This turn's parallel strategy\n - What signals would let me finish early?\n\n2. Then, output tool calls wrapped in \\`<tool_call>...</tool_call>\\` tags, one per line.\n\nExample:\n\\`\\`\\`\n<think>\nThis is a specific query about authentication. I'll grep for auth-related patterns.\nHigh confidence I can finish in 2 turns if I find the auth module.\nStrategy: Shotgun grep across likely directories.\n</think>\n<tool_call>grep 'authenticate' src/</tool_call>\n<tool_call>grep 'login' src/</tool_call>\n<tool_call>analyse src/auth</tool_call>\n\\`\\`\\`\n\nNo commentary outside \\`<think>\\`. No explanations after tool calls.\n</output_format>\n\n<finishing_requirements>\nWhen calling \\`finish\\`:\n- Include the import section (typically lines 1-20) of each file\n- Include all function/class definitions that are relevant\n- Include any type definitions, interfaces, or constants used\n- Better to over-include than leave the user missing context\n- If unsure about boundaries, include more rather than less\n</finishing_requirements>\n\nBegin your exploration now to find code relevant to the query.`;\n\nexport function getSystemPrompt(): string {\n\treturn SYSTEM_PROMPT;\n}\n"],"mappings":";AAAO,IAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwHtB,SAAS,kBAA0B;AACzC,SAAO;AACR;","names":[]}
@@ -1,8 +1,9 @@
1
1
  // tools/warp_grep/utils/ripgrep.ts
2
2
  import { spawn } from "child_process";
3
+ import { rgPath } from "@vscode/ripgrep";
3
4
  function runRipgrep(args, opts) {
4
5
  return new Promise((resolve) => {
5
- const child = spawn("rg", args, {
6
+ const child = spawn(rgPath, args, {
6
7
  cwd: opts?.cwd,
7
8
  env: { ...process.env, ...opts?.env || {} },
8
9
  stdio: ["ignore", "pipe", "pipe"]
@@ -23,4 +24,4 @@ function runRipgrep(args, opts) {
23
24
  export {
24
25
  runRipgrep
25
26
  };
26
- //# sourceMappingURL=chunk-RSLIOCOE.js.map
27
+ //# sourceMappingURL=chunk-XQIVYQD6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/warp_grep/utils/ripgrep.ts"],"sourcesContent":["import { spawn } from 'child_process';\nimport { rgPath } from '@vscode/ripgrep';\n\nexport type ExecResult = { stdout: string; stderr: string; exitCode: number };\n\nexport function runRipgrep(args: string[], opts?: { cwd?: string; env?: NodeJS.ProcessEnv }): Promise<ExecResult> {\n return new Promise((resolve) => {\n const child = spawn(rgPath, 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 (rg). Ensure it is installed.', exitCode: -1 });\n });\n });\n}\n\n\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,cAAc;AAIhB,SAAS,WAAW,MAAgB,MAAuE;AAChH,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,QAAQ,MAAM,QAAQ,MAAM;AAAA,MAChC,KAAK,MAAM;AAAA,MACX,KAAK,EAAE,GAAG,QAAQ,KAAK,GAAI,MAAM,OAAO,CAAC,EAAG;AAAA,MAC5C,OAAO,CAAC,UAAU,QAAQ,MAAM;AAAA,IAClC,CAAC;AACD,QAAI,SAAS;AACb,QAAI,SAAS;AACb,UAAM,OAAO,GAAG,QAAQ,CAAC,MAAO,UAAU,EAAE,SAAS,CAAE;AACvD,UAAM,OAAO,GAAG,QAAQ,CAAC,MAAO,UAAU,EAAE,SAAS,CAAE;AACvD,UAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,cAAQ,EAAE,QAAQ,QAAQ,UAAU,OAAO,SAAS,WAAW,OAAO,GAAG,CAAC;AAAA,IAC5E,CAAC;AACD,UAAM,GAAG,SAAS,MAAM;AACtB,cAAQ,EAAE,QAAQ,IAAI,QAAQ,yDAAyD,UAAU,GAAG,CAAC;AAAA,IACvG,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}