@morphllm/morphsdk 0.2.47 → 0.2.48

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 (41) hide show
  1. package/dist/{chunk-SDI2FI6G.js → chunk-AJ6X4STK.js} +5 -5
  2. package/dist/{chunk-UCWTZSW5.js → chunk-KM6V456Q.js} +2 -2
  3. package/dist/{chunk-BLXC5R4W.js → chunk-NHOPUGBN.js} +3 -3
  4. package/dist/chunk-TPP2UGQP.js +65 -0
  5. package/dist/chunk-TPP2UGQP.js.map +1 -0
  6. package/dist/{chunk-FA6UGPVL.js → chunk-WI23KSNI.js} +2 -2
  7. package/dist/{chunk-OOZSGWSK.js → chunk-YQVSMU24.js} +3 -3
  8. package/dist/{chunk-RAKREIXE.js → chunk-ZGK6OGK3.js} +3 -3
  9. package/dist/client.cjs +41 -3
  10. package/dist/client.cjs.map +1 -1
  11. package/dist/client.js +7 -7
  12. package/dist/index.cjs +41 -3
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +7 -7
  15. package/dist/tools/warp_grep/anthropic.cjs +41 -3
  16. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  17. package/dist/tools/warp_grep/anthropic.js +4 -4
  18. package/dist/tools/warp_grep/index.cjs +41 -3
  19. package/dist/tools/warp_grep/index.cjs.map +1 -1
  20. package/dist/tools/warp_grep/index.js +6 -6
  21. package/dist/tools/warp_grep/openai.cjs +41 -3
  22. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  23. package/dist/tools/warp_grep/openai.js +4 -4
  24. package/dist/tools/warp_grep/providers/local.cjs +41 -3
  25. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  26. package/dist/tools/warp_grep/providers/local.js +2 -2
  27. package/dist/tools/warp_grep/utils/ripgrep.cjs +41 -3
  28. package/dist/tools/warp_grep/utils/ripgrep.cjs.map +1 -1
  29. package/dist/tools/warp_grep/utils/ripgrep.js +1 -1
  30. package/dist/tools/warp_grep/vercel.cjs +41 -3
  31. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  32. package/dist/tools/warp_grep/vercel.js +4 -4
  33. package/package.json +1 -1
  34. package/dist/chunk-XQIVYQD6.js +0 -27
  35. package/dist/chunk-XQIVYQD6.js.map +0 -1
  36. /package/dist/{chunk-SDI2FI6G.js.map → chunk-AJ6X4STK.js.map} +0 -0
  37. /package/dist/{chunk-UCWTZSW5.js.map → chunk-KM6V456Q.js.map} +0 -0
  38. /package/dist/{chunk-BLXC5R4W.js.map → chunk-NHOPUGBN.js.map} +0 -0
  39. /package/dist/{chunk-FA6UGPVL.js.map → chunk-WI23KSNI.js.map} +0 -0
  40. /package/dist/{chunk-OOZSGWSK.js.map → chunk-YQVSMU24.js.map} +0 -0
  41. /package/dist/{chunk-RAKREIXE.js.map → chunk-ZGK6OGK3.js.map} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createMorphWarpGrepTool as createMorphWarpGrepTool2
3
- } from "./chunk-RAKREIXE.js";
3
+ } from "./chunk-ZGK6OGK3.js";
4
4
  import {
5
5
  createMorphWarpGrepTool
6
- } from "./chunk-BLXC5R4W.js";
6
+ } from "./chunk-NHOPUGBN.js";
7
7
  import {
8
8
  createMorphWarpGrepTool as createMorphWarpGrepTool3
9
- } from "./chunk-OOZSGWSK.js";
9
+ } from "./chunk-YQVSMU24.js";
10
10
  import {
11
11
  WarpGrepClient
12
- } from "./chunk-FA6UGPVL.js";
12
+ } from "./chunk-WI23KSNI.js";
13
13
  import {
14
14
  createCodebaseSearchTool as createCodebaseSearchTool3
15
15
  } from "./chunk-UBX7QYBD.js";
@@ -280,4 +280,4 @@ export {
280
280
  VercelToolFactory,
281
281
  MorphClient
282
282
  };
283
- //# sourceMappingURL=chunk-SDI2FI6G.js.map
283
+ //# sourceMappingURL=chunk-AJ6X4STK.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-SMGZ6A64.js";
10
10
  import {
11
11
  runRipgrep
12
- } from "./chunk-XQIVYQD6.js";
12
+ } from "./chunk-TPP2UGQP.js";
13
13
  import {
14
14
  DEFAULT_EXCLUDES
15
15
  } from "./chunk-TJIUA27P.js";
@@ -132,4 +132,4 @@ var LocalRipgrepProvider = class {
132
132
  export {
133
133
  LocalRipgrepProvider
134
134
  };
135
- //# sourceMappingURL=chunk-UCWTZSW5.js.map
135
+ //# sourceMappingURL=chunk-KM6V456Q.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WARP_GREP_DESCRIPTION,
3
3
  formatResult
4
- } from "./chunk-FA6UGPVL.js";
4
+ } from "./chunk-WI23KSNI.js";
5
5
  import {
6
6
  runWarpGrep
7
7
  } from "./chunk-7HS6YXA3.js";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-WETRQJGU.js";
11
11
  import {
12
12
  LocalRipgrepProvider
13
- } from "./chunk-UCWTZSW5.js";
13
+ } from "./chunk-KM6V456Q.js";
14
14
 
15
15
  // tools/warp_grep/openai.ts
16
16
  var TOOL_PARAMETERS = {
@@ -79,4 +79,4 @@ export {
79
79
  createMorphWarpGrepTool,
80
80
  openai_default
81
81
  };
82
- //# sourceMappingURL=chunk-BLXC5R4W.js.map
82
+ //# sourceMappingURL=chunk-NHOPUGBN.js.map
@@ -0,0 +1,65 @@
1
+ // tools/warp_grep/utils/ripgrep.ts
2
+ import { spawn } from "child_process";
3
+ import { rgPath } from "@vscode/ripgrep";
4
+ var resolvedRgPath = null;
5
+ var rgPathChecked = false;
6
+ function spawnRg(rgBinary, args, opts) {
7
+ return new Promise((resolve) => {
8
+ const child = spawn(rgBinary, args, {
9
+ cwd: opts?.cwd,
10
+ env: { ...process.env, ...opts?.env || {} },
11
+ stdio: ["ignore", "pipe", "pipe"]
12
+ });
13
+ let stdout = "";
14
+ let stderr = "";
15
+ child.stdout.on("data", (d) => stdout += d.toString());
16
+ child.stderr.on("data", (d) => stderr += d.toString());
17
+ child.on("close", (code) => {
18
+ resolve({ stdout, stderr, exitCode: typeof code === "number" ? code : -1 });
19
+ });
20
+ child.on("error", () => {
21
+ resolve({ stdout: "", stderr: "Failed to spawn ripgrep.", exitCode: -1 });
22
+ });
23
+ });
24
+ }
25
+ function isBinaryFailure(result) {
26
+ if (result.exitCode === -1) return true;
27
+ if (result.stderr.includes("jemalloc") || result.stderr.includes("Unsupported system page size")) return true;
28
+ if (result.exitCode === 134) return true;
29
+ return false;
30
+ }
31
+ async function runRipgrep(args, opts) {
32
+ if (rgPathChecked && resolvedRgPath) {
33
+ return spawnRg(resolvedRgPath, args, opts);
34
+ }
35
+ if (!rgPathChecked) {
36
+ const result = await spawnRg(rgPath, args, opts);
37
+ if (!isBinaryFailure(result)) {
38
+ resolvedRgPath = rgPath;
39
+ rgPathChecked = true;
40
+ return result;
41
+ }
42
+ const fallbackResult = await spawnRg("rg", args, opts);
43
+ if (!isBinaryFailure(fallbackResult)) {
44
+ resolvedRgPath = "rg";
45
+ rgPathChecked = true;
46
+ return fallbackResult;
47
+ }
48
+ rgPathChecked = true;
49
+ return {
50
+ stdout: "",
51
+ stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
52
+ exitCode: -1
53
+ };
54
+ }
55
+ return {
56
+ stdout: "",
57
+ stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
58
+ exitCode: -1
59
+ };
60
+ }
61
+
62
+ export {
63
+ runRipgrep
64
+ };
65
+ //# sourceMappingURL=chunk-TPP2UGQP.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\n// Cache the working ripgrep path to avoid repeated fallback checks\nlet resolvedRgPath: string | null = null;\nlet rgPathChecked = false;\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 // Spawn error\n if (result.exitCode === -1) return true;\n // jemalloc page size issue (common on ARM64 with non-standard page sizes)\n if (result.stderr.includes('jemalloc') || result.stderr.includes('Unsupported system page size')) return true;\n // SIGABRT (134 = 128 + 6)\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\n if (!rgPathChecked) {\n const result = await spawnRg(rgPath, args, opts);\n \n if (!isBinaryFailure(result)) {\n // Bundled binary works, cache it\n resolvedRgPath = rgPath;\n rgPathChecked = true;\n return result;\n }\n\n // Bundled binary failed, try system rg\n const fallbackResult = await spawnRg('rg', args, opts);\n \n if (!isBinaryFailure(fallbackResult)) {\n // System rg works, cache it\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\n\n"],"mapp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,uBAAiB;AACjB,sBAAgB;AAChB,aAAO;AAAA,IACT;AAGA,UAAM,iBAAiB,MAAM,QAAQ,MAAM,MAAM,IAAI;AAErD,QAAI,CAAC,gBAAgB,cAAc,GAAG;AAEpC,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":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7HS6YXA3.js";
4
4
  import {
5
5
  LocalRipgrepProvider
6
- } from "./chunk-UCWTZSW5.js";
6
+ } from "./chunk-KM6V456Q.js";
7
7
 
8
8
  // tools/warp_grep/core.ts
9
9
  var WarpGrepClient = class {
@@ -102,4 +102,4 @@ export {
102
102
  formatResult,
103
103
  WARP_GREP_DESCRIPTION
104
104
  };
105
- //# sourceMappingURL=chunk-FA6UGPVL.js.map
105
+ //# sourceMappingURL=chunk-WI23KSNI.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  WARP_GREP_DESCRIPTION
3
- } from "./chunk-FA6UGPVL.js";
3
+ } from "./chunk-WI23KSNI.js";
4
4
  import {
5
5
  runWarpGrep
6
6
  } from "./chunk-7HS6YXA3.js";
7
7
  import {
8
8
  LocalRipgrepProvider
9
- } from "./chunk-UCWTZSW5.js";
9
+ } from "./chunk-KM6V456Q.js";
10
10
 
11
11
  // tools/warp_grep/vercel.ts
12
12
  import { tool } from "ai";
@@ -67,4 +67,4 @@ export {
67
67
  execute,
68
68
  createMorphWarpGrepTool
69
69
  };
70
- //# sourceMappingURL=chunk-OOZSGWSK.js.map
70
+ //# sourceMappingURL=chunk-YQVSMU24.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WARP_GREP_DESCRIPTION,
3
3
  formatResult
4
- } from "./chunk-FA6UGPVL.js";
4
+ } from "./chunk-WI23KSNI.js";
5
5
  import {
6
6
  runWarpGrep
7
7
  } from "./chunk-7HS6YXA3.js";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-WETRQJGU.js";
11
11
  import {
12
12
  LocalRipgrepProvider
13
- } from "./chunk-UCWTZSW5.js";
13
+ } from "./chunk-KM6V456Q.js";
14
14
 
15
15
  // tools/warp_grep/anthropic.ts
16
16
  var INPUT_SCHEMA = {
@@ -73,4 +73,4 @@ export {
73
73
  createMorphWarpGrepTool,
74
74
  anthropic_default
75
75
  };
76
- //# sourceMappingURL=chunk-RAKREIXE.js.map
76
+ //# sourceMappingURL=chunk-ZGK6OGK3.js.map
package/dist/client.cjs CHANGED
@@ -1707,9 +1707,11 @@ var import_path4 = __toESM(require("path"), 1);
1707
1707
  // tools/warp_grep/utils/ripgrep.ts
1708
1708
  var import_child_process = require("child_process");
1709
1709
  var import_ripgrep = require("@vscode/ripgrep");
1710
- function runRipgrep(args, opts) {
1710
+ var resolvedRgPath = null;
1711
+ var rgPathChecked = false;
1712
+ function spawnRg(rgBinary, args, opts) {
1711
1713
  return new Promise((resolve2) => {
1712
- const child = (0, import_child_process.spawn)(import_ripgrep.rgPath, args, {
1714
+ const child = (0, import_child_process.spawn)(rgBinary, args, {
1713
1715
  cwd: opts?.cwd,
1714
1716
  env: { ...process.env, ...opts?.env || {} },
1715
1717
  stdio: ["ignore", "pipe", "pipe"]
@@ -1722,10 +1724,46 @@ function runRipgrep(args, opts) {
1722
1724
  resolve2({ stdout, stderr, exitCode: typeof code === "number" ? code : -1 });
1723
1725
  });
1724
1726
  child.on("error", () => {
1725
- resolve2({ stdout: "", stderr: "Failed to spawn ripgrep (rg). Ensure it is installed.", exitCode: -1 });
1727
+ resolve2({ stdout: "", stderr: "Failed to spawn ripgrep.", exitCode: -1 });
1726
1728
  });
1727
1729
  });
1728
1730
  }
1731
+ function isBinaryFailure(result) {
1732
+ if (result.exitCode === -1) return true;
1733
+ if (result.stderr.includes("jemalloc") || result.stderr.includes("Unsupported system page size")) return true;
1734
+ if (result.exitCode === 134) return true;
1735
+ return false;
1736
+ }
1737
+ async function runRipgrep(args, opts) {
1738
+ if (rgPathChecked && resolvedRgPath) {
1739
+ return spawnRg(resolvedRgPath, args, opts);
1740
+ }
1741
+ if (!rgPathChecked) {
1742
+ const result = await spawnRg(import_ripgrep.rgPath, args, opts);
1743
+ if (!isBinaryFailure(result)) {
1744
+ resolvedRgPath = import_ripgrep.rgPath;
1745
+ rgPathChecked = true;
1746
+ return result;
1747
+ }
1748
+ const fallbackResult = await spawnRg("rg", args, opts);
1749
+ if (!isBinaryFailure(fallbackResult)) {
1750
+ resolvedRgPath = "rg";
1751
+ rgPathChecked = true;
1752
+ return fallbackResult;
1753
+ }
1754
+ rgPathChecked = true;
1755
+ return {
1756
+ stdout: "",
1757
+ stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
1758
+ exitCode: -1
1759
+ };
1760
+ }
1761
+ return {
1762
+ stdout: "",
1763
+ stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
1764
+ exitCode: -1
1765
+ };
1766
+ }
1729
1767
 
1730
1768
  // tools/warp_grep/utils/paths.ts
1731
1769
  var import_fs = __toESM(require("fs"), 1);