@morphllm/morphsdk 0.2.54 → 0.2.56

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 (47) hide show
  1. package/dist/{chunk-4HOUN5TW.js → chunk-4ZHDBKBY.js} +3 -3
  2. package/dist/chunk-7OQOOB3R.js +1 -0
  3. package/dist/{chunk-FB3E5BRY.js → chunk-GJURLQ3L.js} +3 -3
  4. package/dist/{chunk-D5ZSGQT4.js → chunk-QVRXBAMM.js} +2 -2
  5. package/dist/{chunk-IFVROB4L.js → chunk-SALJ2K6S.js} +9 -10
  6. package/dist/chunk-SALJ2K6S.js.map +1 -0
  7. package/dist/{chunk-PYTBBWL6.js → chunk-UIRJE422.js} +3 -3
  8. package/dist/{chunk-KVMZPOUT.js → chunk-WSSSSBWU.js} +5 -5
  9. package/dist/client.cjs +12 -13
  10. package/dist/client.cjs.map +1 -1
  11. package/dist/client.js +7 -7
  12. package/dist/index.cjs +12 -80
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +0 -1
  15. package/dist/index.js +8 -12
  16. package/dist/tools/warp_grep/agent/runner.cjs +5 -6
  17. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  18. package/dist/tools/warp_grep/agent/runner.js +2 -2
  19. package/dist/tools/warp_grep/anthropic.cjs +12 -13
  20. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  21. package/dist/tools/warp_grep/anthropic.js +4 -4
  22. package/dist/tools/warp_grep/index.cjs +12 -80
  23. package/dist/tools/warp_grep/index.cjs.map +1 -1
  24. package/dist/tools/warp_grep/index.d.ts +0 -1
  25. package/dist/tools/warp_grep/index.js +7 -11
  26. package/dist/tools/warp_grep/openai.cjs +12 -13
  27. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  28. package/dist/tools/warp_grep/openai.js +4 -4
  29. package/dist/tools/warp_grep/vercel.cjs +12 -13
  30. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  31. package/dist/tools/warp_grep/vercel.js +4 -4
  32. package/package.json +2 -2
  33. package/dist/chunk-IFVROB4L.js.map +0 -1
  34. package/dist/chunk-JYBVRF72.js +0 -1
  35. package/dist/chunk-P2XKFWFD.js +0 -73
  36. package/dist/chunk-P2XKFWFD.js.map +0 -1
  37. package/dist/tools/warp_grep/providers/command.cjs +0 -177
  38. package/dist/tools/warp_grep/providers/command.cjs.map +0 -1
  39. package/dist/tools/warp_grep/providers/command.d.ts +0 -48
  40. package/dist/tools/warp_grep/providers/command.js +0 -9
  41. package/dist/tools/warp_grep/providers/command.js.map +0 -1
  42. /package/dist/{chunk-4HOUN5TW.js.map → chunk-4ZHDBKBY.js.map} +0 -0
  43. /package/dist/{chunk-JYBVRF72.js.map → chunk-7OQOOB3R.js.map} +0 -0
  44. /package/dist/{chunk-FB3E5BRY.js.map → chunk-GJURLQ3L.js.map} +0 -0
  45. /package/dist/{chunk-D5ZSGQT4.js.map → chunk-QVRXBAMM.js.map} +0 -0
  46. /package/dist/{chunk-PYTBBWL6.js.map → chunk-UIRJE422.js.map} +0 -0
  47. /package/dist/{chunk-KVMZPOUT.js.map → chunk-WSSSSBWU.js.map} +0 -0
package/dist/client.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-KVMZPOUT.js";
4
- import "./chunk-FB3E5BRY.js";
5
- import "./chunk-4HOUN5TW.js";
6
- import "./chunk-PYTBBWL6.js";
7
- import "./chunk-D5ZSGQT4.js";
8
- import "./chunk-IFVROB4L.js";
9
- import "./chunk-EK7OQPWD.js";
3
+ } from "./chunk-WSSSSBWU.js";
4
+ import "./chunk-GJURLQ3L.js";
5
+ import "./chunk-4ZHDBKBY.js";
6
+ import "./chunk-UIRJE422.js";
7
+ import "./chunk-QVRXBAMM.js";
8
+ import "./chunk-SALJ2K6S.js";
10
9
  import "./chunk-HQO45BAJ.js";
11
10
  import "./chunk-LVPVVLTI.js";
12
11
  import "./chunk-WETRQJGU.js";
@@ -15,6 +14,7 @@ import "./chunk-G2RSY56Q.js";
15
14
  import "./chunk-SMGZ6A64.js";
16
15
  import "./chunk-TPP2UGQP.js";
17
16
  import "./chunk-73RQWOQC.js";
17
+ import "./chunk-EK7OQPWD.js";
18
18
  import "./chunk-TJIUA27P.js";
19
19
  import "./chunk-TICMYDII.js";
20
20
  import "./chunk-NDZO5IPV.js";
package/dist/index.cjs CHANGED
@@ -34,7 +34,6 @@ __export(index_exports, {
34
34
  AnthropicToolFactory: () => AnthropicToolFactory,
35
35
  BrowserClient: () => BrowserClient,
36
36
  CodebaseSearchClient: () => CodebaseSearchClient,
37
- CommandExecProvider: () => CommandExecProvider,
38
37
  FastApplyClient: () => FastApplyClient,
39
38
  GeminiRouter: () => GeminiRouter,
40
39
  LocalRipgrepProvider: () => LocalRipgrepProvider,
@@ -1610,13 +1609,12 @@ function mergeRanges(ranges) {
1610
1609
 
1611
1610
  // tools/warp_grep/agent/runner.ts
1612
1611
  var import_path2 = __toESM(require("path"), 1);
1613
- var import_promises2 = __toESM(require("fs/promises"), 1);
1614
1612
  var parser = new LLMResponseParser();
1615
- async function buildInitialState(repoRoot, query) {
1613
+ async function buildInitialState(repoRoot, query, provider) {
1616
1614
  try {
1617
- const entries = await import_promises2.default.readdir(repoRoot, { withFileTypes: true });
1618
- const dirs = entries.filter((e) => e.isDirectory()).map((d) => d.name).slice(0, 50);
1619
- const files = entries.filter((e) => e.isFile()).map((f) => f.name).slice(0, 50);
1615
+ const entries = await provider.analyse({ path: ".", maxResults: 100 });
1616
+ const dirs = entries.filter((e) => e.type === "dir").map((d) => d.name).slice(0, 50);
1617
+ const files = entries.filter((e) => e.type === "file").map((f) => f.name).slice(0, 50);
1620
1618
  const parts = [
1621
1619
  `<repo_root>${repoRoot}</repo_root>`,
1622
1620
  `<top_dirs>${dirs.join(", ")}</top_dirs>`,
@@ -1665,7 +1663,7 @@ async function runWarpGrep(config) {
1665
1663
  messages.push(systemMessage);
1666
1664
  const queryContent = `<query>${config.query}</query>`;
1667
1665
  messages.push({ role: "user", content: queryContent });
1668
- const initialState = await buildInitialState(repoRoot, config.query);
1666
+ const initialState = await buildInitialState(repoRoot, config.query, config.provider);
1669
1667
  messages.push({ role: "user", content: initialState });
1670
1668
  const maxRounds = AGENT_CONFIG.MAX_ROUNDS;
1671
1669
  const model = config.model || DEFAULT_MODEL;
@@ -1808,7 +1806,7 @@ async function runWarpGrep(config) {
1808
1806
  }
1809
1807
 
1810
1808
  // tools/warp_grep/providers/local.ts
1811
- var import_promises4 = __toESM(require("fs/promises"), 1);
1809
+ var import_promises3 = __toESM(require("fs/promises"), 1);
1812
1810
  var import_path4 = __toESM(require("path"), 1);
1813
1811
 
1814
1812
  // tools/warp_grep/utils/ripgrep.ts
@@ -1918,9 +1916,9 @@ function isTextualFile(filePath, maxBytes = 2e6) {
1918
1916
  }
1919
1917
 
1920
1918
  // tools/warp_grep/utils/files.ts
1921
- var import_promises3 = __toESM(require("fs/promises"), 1);
1919
+ var import_promises2 = __toESM(require("fs/promises"), 1);
1922
1920
  async function readAllLines(filePath) {
1923
- const content = await import_promises3.default.readFile(filePath, "utf8");
1921
+ const content = await import_promises2.default.readFile(filePath, "utf8");
1924
1922
  return content.split(/\r?\n/);
1925
1923
  }
1926
1924
 
@@ -1932,7 +1930,7 @@ var LocalRipgrepProvider = class {
1932
1930
  }
1933
1931
  async grep(params) {
1934
1932
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1935
- const stat = await import_promises4.default.stat(abs).catch(() => null);
1933
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
1936
1934
  if (!stat) return { lines: [] };
1937
1935
  const targetArg = abs === import_path4.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
1938
1936
  const args = [
@@ -1990,7 +1988,7 @@ Details: ${res.stderr}` : ""}`
1990
1988
  }
1991
1989
  async read(params) {
1992
1990
  const abs = resolveUnderRepo(this.repoRoot, params.path);
1993
- const stat = await import_promises4.default.stat(abs).catch(() => null);
1991
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
1994
1992
  if (!stat || !stat.isFile()) {
1995
1993
  return {
1996
1994
  lines: [],
@@ -2026,7 +2024,7 @@ Details: ${res.stderr}` : ""}`
2026
2024
  }
2027
2025
  async analyse(params) {
2028
2026
  const abs = resolveUnderRepo(this.repoRoot, params.path);
2029
- const stat = await import_promises4.default.stat(abs).catch(() => null);
2027
+ const stat = await import_promises3.default.stat(abs).catch(() => null);
2030
2028
  if (!stat || !stat.isDirectory()) {
2031
2029
  return [];
2032
2030
  }
@@ -2036,7 +2034,7 @@ Details: ${res.stderr}` : ""}`
2036
2034
  const results = [];
2037
2035
  async function walk(dir, depth) {
2038
2036
  if (depth > maxDepth || results.length >= maxResults) return;
2039
- const entries = await import_promises4.default.readdir(dir, { withFileTypes: true });
2037
+ const entries = await import_promises3.default.readdir(dir, { withFileTypes: true });
2040
2038
  for (const entry of entries) {
2041
2039
  const full = import_path4.default.join(dir, entry.name);
2042
2040
  const rel = toRepoRelative(abs, full).replace(/^[.][/\\]?/, "");
@@ -3698,78 +3696,12 @@ var MorphClient = class {
3698
3696
  this.vercel = new VercelToolFactory(config);
3699
3697
  }
3700
3698
  };
3701
-
3702
- // tools/warp_grep/providers/command.ts
3703
- var CommandExecProvider = class {
3704
- constructor(opts) {
3705
- this.opts = opts;
3706
- }
3707
- map(path4) {
3708
- return this.opts.pathMap ? this.opts.pathMap(path4) : path4;
3709
- }
3710
- async grep(params) {
3711
- const remotePath = this.map(params.path);
3712
- const args = [
3713
- "--no-config",
3714
- "--no-heading",
3715
- "--with-filename",
3716
- "--line-number",
3717
- "--color=never",
3718
- "--trim",
3719
- "--max-columns=400",
3720
- ...(this.opts.excludes ?? DEFAULT_EXCLUDES).flatMap((e) => ["-g", `!${e}`]),
3721
- params.pattern,
3722
- remotePath || "."
3723
- ];
3724
- const res = await this.opts.run("rg", args, { cwd: this.opts.cwd, env: this.opts.env });
3725
- if (res.exitCode === -1) throw new Error(res.stderr || "ripgrep execution failed");
3726
- if (res.exitCode !== 0 && res.exitCode !== 1) throw new Error(res.stderr || `ripgrep failed (${res.exitCode})`);
3727
- const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
3728
- return { lines };
3729
- }
3730
- async glob(params) {
3731
- const remotePath = this.map(params.path);
3732
- const args = [
3733
- "--no-config",
3734
- "--files",
3735
- "-g",
3736
- params.pattern,
3737
- ...(this.opts.excludes ?? DEFAULT_EXCLUDES).flatMap((e) => ["-g", `!${e}`]),
3738
- remotePath || "."
3739
- ];
3740
- const res = await this.opts.run("rg", args, { cwd: this.opts.cwd, env: this.opts.env });
3741
- if (res.exitCode === -1) throw new Error(res.stderr || "ripgrep execution failed");
3742
- const files = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
3743
- return { files };
3744
- }
3745
- async read(params) {
3746
- const remotePath = this.map(params.path);
3747
- const rc = this.opts.readCommand ? this.opts.readCommand(remotePath, params.start, params.end) : { cmd: "sed", args: ["-n", `${params.start ?? 1},${params.end ?? 1e6}p`, remotePath] };
3748
- const res = await this.opts.run(rc.cmd, rc.args, { cwd: this.opts.cwd, env: this.opts.env });
3749
- if (res.exitCode !== 0) throw new Error(res.stderr || `read failed (${res.exitCode})`);
3750
- const text = res.stdout || "";
3751
- const lines = text.split(/\r?\n/).map((line, idx) => `${(params.start ?? 1) + idx}|${line}`);
3752
- return { lines: lines.filter((l) => l !== `${(params.start ?? 1) + (lines.length - 1)}|`) };
3753
- }
3754
- async analyse(params) {
3755
- const target = this.map(params.path);
3756
- const pattern = params.pattern ?? "*";
3757
- const files = await this.glob({ pattern, path: target }).catch(() => ({ files: [] }));
3758
- return files.files.slice(0, params.maxResults ?? 100).map((f) => ({
3759
- name: f.split("/").pop() || f,
3760
- path: f,
3761
- type: f.endsWith("/") ? "dir" : "file",
3762
- depth: 0
3763
- }));
3764
- }
3765
- };
3766
3699
  // Annotate the CommonJS export names for ESM import in node:
3767
3700
  0 && (module.exports = {
3768
3701
  AnthropicRouter,
3769
3702
  AnthropicToolFactory,
3770
3703
  BrowserClient,
3771
3704
  CodebaseSearchClient,
3772
- CommandExecProvider,
3773
3705
  FastApplyClient,
3774
3706
  GeminiRouter,
3775
3707
  LocalRipgrepProvider,