@morphllm/morphsdk 0.2.80 → 0.2.81

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 (58) hide show
  1. package/dist/{chunk-DCIUCDWJ.js → chunk-467MCW5R.js} +38 -10
  2. package/dist/chunk-467MCW5R.js.map +1 -0
  3. package/dist/{chunk-HBIDSKIQ.js → chunk-4NI25AKV.js} +14 -6
  4. package/dist/chunk-4NI25AKV.js.map +1 -0
  5. package/dist/{chunk-5PGRBWJX.js → chunk-4VMIPD4G.js} +4 -4
  6. package/dist/{chunk-6OII5QOW.js → chunk-B3UC7UVA.js} +3 -3
  7. package/dist/{chunk-6OII5QOW.js.map → chunk-B3UC7UVA.js.map} +1 -1
  8. package/dist/{chunk-QL5SMQ73.js → chunk-NTTQJM6O.js} +2 -2
  9. package/dist/{chunk-ND7IFSMR.js → chunk-OFMDENAQ.js} +2 -2
  10. package/dist/{chunk-26QXQFLZ.js → chunk-PHJQ4N3T.js} +8 -3
  11. package/dist/chunk-PHJQ4N3T.js.map +1 -0
  12. package/dist/{chunk-LM62QCGS.js → chunk-X6A64F2F.js} +5 -5
  13. package/dist/{chunk-4R3ALD5C.js → chunk-Z2HDXUH7.js} +2 -2
  14. package/dist/client.cjs +54 -12
  15. package/dist/client.cjs.map +1 -1
  16. package/dist/client.js +9 -9
  17. package/dist/index.cjs +54 -12
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.js +9 -9
  20. package/dist/tools/warp_grep/agent/runner.cjs +34 -5
  21. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  22. package/dist/tools/warp_grep/agent/runner.js +2 -2
  23. package/dist/tools/warp_grep/anthropic.cjs +54 -12
  24. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  25. package/dist/tools/warp_grep/anthropic.js +6 -6
  26. package/dist/tools/warp_grep/client.cjs +54 -12
  27. package/dist/tools/warp_grep/client.cjs.map +1 -1
  28. package/dist/tools/warp_grep/client.js +5 -5
  29. package/dist/tools/warp_grep/gemini.cjs +54 -12
  30. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  31. package/dist/tools/warp_grep/gemini.js +5 -5
  32. package/dist/tools/warp_grep/harness.cjs +50 -14
  33. package/dist/tools/warp_grep/harness.cjs.map +1 -1
  34. package/dist/tools/warp_grep/harness.js +2 -2
  35. package/dist/tools/warp_grep/index.cjs +58 -17
  36. package/dist/tools/warp_grep/index.cjs.map +1 -1
  37. package/dist/tools/warp_grep/index.js +5 -5
  38. package/dist/tools/warp_grep/openai.cjs +54 -12
  39. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  40. package/dist/tools/warp_grep/openai.js +6 -6
  41. package/dist/tools/warp_grep/providers/local.cjs +13 -5
  42. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  43. package/dist/tools/warp_grep/providers/local.js +1 -1
  44. package/dist/tools/warp_grep/providers/remote.cjs +7 -2
  45. package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
  46. package/dist/tools/warp_grep/providers/remote.js +1 -1
  47. package/dist/tools/warp_grep/vercel.cjs +54 -12
  48. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  49. package/dist/tools/warp_grep/vercel.js +6 -6
  50. package/package.json +1 -1
  51. package/dist/chunk-26QXQFLZ.js.map +0 -1
  52. package/dist/chunk-DCIUCDWJ.js.map +0 -1
  53. package/dist/chunk-HBIDSKIQ.js.map +0 -1
  54. /package/dist/{chunk-5PGRBWJX.js.map → chunk-4VMIPD4G.js.map} +0 -0
  55. /package/dist/{chunk-QL5SMQ73.js.map → chunk-NTTQJM6O.js.map} +0 -0
  56. /package/dist/{chunk-ND7IFSMR.js.map → chunk-OFMDENAQ.js.map} +0 -0
  57. /package/dist/{chunk-LM62QCGS.js.map → chunk-X6A64F2F.js.map} +0 -0
  58. /package/dist/{chunk-4R3ALD5C.js.map → chunk-Z2HDXUH7.js.map} +0 -0
package/dist/client.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-LM62QCGS.js";
4
- import "./chunk-4R3ALD5C.js";
5
- import "./chunk-QL5SMQ73.js";
6
- import "./chunk-ND7IFSMR.js";
3
+ } from "./chunk-X6A64F2F.js";
4
+ import "./chunk-Z2HDXUH7.js";
5
+ import "./chunk-NTTQJM6O.js";
6
+ import "./chunk-OFMDENAQ.js";
7
7
  import "./chunk-KW7OEGZK.js";
8
- import "./chunk-5PGRBWJX.js";
9
- import "./chunk-6OII5QOW.js";
10
- import "./chunk-26QXQFLZ.js";
11
- import "./chunk-DCIUCDWJ.js";
8
+ import "./chunk-4VMIPD4G.js";
9
+ import "./chunk-B3UC7UVA.js";
10
+ import "./chunk-PHJQ4N3T.js";
11
+ import "./chunk-467MCW5R.js";
12
12
  import "./chunk-APP75CBN.js";
13
13
  import "./chunk-5QRN3JNB.js";
14
14
  import "./chunk-FMLHRJDF.js";
15
- import "./chunk-HBIDSKIQ.js";
15
+ import "./chunk-4NI25AKV.js";
16
16
  import "./chunk-G2RSY56Q.js";
17
17
  import "./chunk-YPKNMYD4.js";
18
18
  import "./chunk-TPP2UGQP.js";
package/dist/index.cjs CHANGED
@@ -1569,10 +1569,25 @@ async function toolGrep(provider, args) {
1569
1569
  }
1570
1570
 
1571
1571
  // tools/warp_grep/agent/tools/read.ts
1572
+ function isValidRange(start, end) {
1573
+ return typeof start === "number" && typeof end === "number" && Number.isFinite(start) && Number.isFinite(end) && start > 0 && end >= start;
1574
+ }
1572
1575
  async function toolRead(provider, args) {
1573
- if (args.lines && args.lines.length > 0) {
1576
+ if (args.lines && Array.isArray(args.lines) && args.lines.length > 0) {
1577
+ const validRanges = [];
1578
+ for (const range of args.lines) {
1579
+ if (Array.isArray(range) && range.length >= 2 && isValidRange(range[0], range[1])) {
1580
+ validRanges.push([range[0], range[1]]);
1581
+ }
1582
+ }
1583
+ if (validRanges.length === 0) {
1584
+ const res2 = await provider.read({ path: args.path });
1585
+ if (res2.error) return res2.error;
1586
+ if (!res2.lines.length) return "(empty file)";
1587
+ return res2.lines.join("\n");
1588
+ }
1574
1589
  const chunks = [];
1575
- for (const [start, end] of args.lines) {
1590
+ for (const [start, end] of validRanges) {
1576
1591
  const res2 = await provider.read({ path: args.path, start, end });
1577
1592
  if (res2.error) return res2.error;
1578
1593
  chunks.push(res2.lines.join("\n"));
@@ -1608,14 +1623,28 @@ async function toolListDirectory(provider, args) {
1608
1623
  }
1609
1624
 
1610
1625
  // tools/warp_grep/agent/tools/finish.ts
1626
+ function isValidRange2(range) {
1627
+ return Array.isArray(range) && range.length >= 2 && typeof range[0] === "number" && typeof range[1] === "number" && Number.isFinite(range[0]) && Number.isFinite(range[1]) && range[0] > 0 && range[1] >= range[0];
1628
+ }
1629
+ function extractValidRanges(lines) {
1630
+ if (!Array.isArray(lines)) return null;
1631
+ const valid = [];
1632
+ for (const range of lines) {
1633
+ if (isValidRange2(range)) {
1634
+ valid.push([range[0], range[1]]);
1635
+ }
1636
+ }
1637
+ return valid.length > 0 ? valid : null;
1638
+ }
1611
1639
  async function readFinishFiles(repoRoot, files, reader) {
1612
1640
  const out = [];
1613
1641
  for (const f of files) {
1614
- if (f.lines === "*") {
1642
+ const validRanges = f.lines === "*" ? null : extractValidRanges(f.lines);
1643
+ if (f.lines === "*" || !validRanges) {
1615
1644
  const lines = await reader(f.path);
1616
1645
  out.push({ path: f.path, ranges: "*", content: lines.join("\n") });
1617
1646
  } else {
1618
- const ranges = mergeRanges(f.lines);
1647
+ const ranges = mergeRanges(validRanges);
1619
1648
  const chunks = [];
1620
1649
  for (const [s, e] of ranges) {
1621
1650
  const lines = await reader(f.path, s, e);
@@ -1949,7 +1978,7 @@ async function runWarpGrep(config) {
1949
1978
  }
1950
1979
  const parts = ["Relevant context found:"];
1951
1980
  for (const f of finishMeta.files) {
1952
- const ranges = f.lines === "*" ? "*" : f.lines.map(([s, e]) => `${s}-${e}`).join(", ");
1981
+ const ranges = f.lines === "*" ? "*" : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(", ") : "*";
1953
1982
  parts.push(`- ${f.path}: ${ranges}`);
1954
1983
  }
1955
1984
  const payload = parts.join("\n");
@@ -2309,11 +2338,19 @@ Details: ${res.stderr}` : ""}`
2309
2338
  };
2310
2339
  }
2311
2340
  const total = lines.length;
2312
- let s = params.start ?? 1;
2313
- let e = Math.min(params.end ?? total, total);
2314
- if (s > total && total > 0) {
2315
- s = 1;
2316
- e = total;
2341
+ const rawStart = params.start;
2342
+ const rawEnd = params.end;
2343
+ let s = 1;
2344
+ let e = total;
2345
+ const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
2346
+ const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
2347
+ if (startValid && endValid) {
2348
+ s = rawStart ?? 1;
2349
+ e = Math.min(rawEnd ?? total, total);
2350
+ if (s > total && total > 0 || s > e) {
2351
+ s = 1;
2352
+ e = total;
2353
+ }
2317
2354
  }
2318
2355
  const out = [];
2319
2356
  for (let i = s; i <= e; i += 1) {
@@ -2489,8 +2526,13 @@ var RemoteCommandsProvider = class {
2489
2526
  * Read file and add line numbers
2490
2527
  */
2491
2528
  async read(params) {
2492
- const start = params.start ?? 1;
2493
- const end = params.end ?? 1e6;
2529
+ const rawStart = params.start;
2530
+ const rawEnd = params.end;
2531
+ const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
2532
+ const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
2533
+ const rangeValid = startValid && endValid && (rawStart === void 0 || rawEnd === void 0 || rawStart <= rawEnd);
2534
+ const start = rangeValid && rawStart !== void 0 ? rawStart : 1;
2535
+ const end = rangeValid && rawEnd !== void 0 ? rawEnd : 1e6;
2494
2536
  try {
2495
2537
  const stdout = await this.commands.read(params.path, start, end);
2496
2538
  const contentLines = (stdout || "").split("\n");