@morphllm/morphsdk 0.2.76 → 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 (64) 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-XREWLWLA.js → chunk-4VMIPD4G.js} +4 -4
  6. package/dist/{chunk-RRWN62VU.js → chunk-B3UC7UVA.js} +4 -4
  7. package/dist/{chunk-RRWN62VU.js.map → chunk-B3UC7UVA.js.map} +1 -1
  8. package/dist/{chunk-Q5AHGIQO.js → chunk-FMLHRJDF.js} +3 -1
  9. package/dist/{chunk-Q5AHGIQO.js.map → chunk-FMLHRJDF.js.map} +1 -1
  10. package/dist/{chunk-G2EJHZSA.js → chunk-NTTQJM6O.js} +3 -3
  11. package/dist/{chunk-P2LHXSMG.js → chunk-OFMDENAQ.js} +2 -2
  12. package/dist/{chunk-26QXQFLZ.js → chunk-PHJQ4N3T.js} +8 -3
  13. package/dist/chunk-PHJQ4N3T.js.map +1 -0
  14. package/dist/{chunk-KILYNOE4.js → chunk-X6A64F2F.js} +5 -5
  15. package/dist/{chunk-RK2MR3N2.js → chunk-Z2HDXUH7.js} +3 -3
  16. package/dist/client.cjs +56 -12
  17. package/dist/client.cjs.map +1 -1
  18. package/dist/client.js +10 -10
  19. package/dist/index.cjs +56 -12
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +10 -10
  22. package/dist/tools/warp_grep/agent/prompt.cjs +2 -0
  23. package/dist/tools/warp_grep/agent/prompt.cjs.map +1 -1
  24. package/dist/tools/warp_grep/agent/prompt.d.ts +1 -1
  25. package/dist/tools/warp_grep/agent/prompt.js +1 -1
  26. package/dist/tools/warp_grep/agent/runner.cjs +36 -5
  27. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  28. package/dist/tools/warp_grep/agent/runner.js +3 -3
  29. package/dist/tools/warp_grep/anthropic.cjs +56 -12
  30. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  31. package/dist/tools/warp_grep/anthropic.js +7 -7
  32. package/dist/tools/warp_grep/client.cjs +56 -12
  33. package/dist/tools/warp_grep/client.cjs.map +1 -1
  34. package/dist/tools/warp_grep/client.js +6 -6
  35. package/dist/tools/warp_grep/gemini.cjs +56 -12
  36. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  37. package/dist/tools/warp_grep/gemini.js +6 -6
  38. package/dist/tools/warp_grep/harness.cjs +52 -14
  39. package/dist/tools/warp_grep/harness.cjs.map +1 -1
  40. package/dist/tools/warp_grep/harness.js +3 -3
  41. package/dist/tools/warp_grep/index.cjs +60 -17
  42. package/dist/tools/warp_grep/index.cjs.map +1 -1
  43. package/dist/tools/warp_grep/index.js +6 -6
  44. package/dist/tools/warp_grep/openai.cjs +56 -12
  45. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  46. package/dist/tools/warp_grep/openai.js +7 -7
  47. package/dist/tools/warp_grep/providers/local.cjs +13 -5
  48. package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
  49. package/dist/tools/warp_grep/providers/local.js +1 -1
  50. package/dist/tools/warp_grep/providers/remote.cjs +7 -2
  51. package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
  52. package/dist/tools/warp_grep/providers/remote.js +1 -1
  53. package/dist/tools/warp_grep/vercel.cjs +56 -12
  54. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  55. package/dist/tools/warp_grep/vercel.js +7 -7
  56. package/package.json +1 -1
  57. package/dist/chunk-26QXQFLZ.js.map +0 -1
  58. package/dist/chunk-DCIUCDWJ.js.map +0 -1
  59. package/dist/chunk-HBIDSKIQ.js.map +0 -1
  60. /package/dist/{chunk-XREWLWLA.js.map → chunk-4VMIPD4G.js.map} +0 -0
  61. /package/dist/{chunk-G2EJHZSA.js.map → chunk-NTTQJM6O.js.map} +0 -0
  62. /package/dist/{chunk-P2LHXSMG.js.map → chunk-OFMDENAQ.js.map} +0 -0
  63. /package/dist/{chunk-KILYNOE4.js.map → chunk-X6A64F2F.js.map} +0 -0
  64. /package/dist/{chunk-RK2MR3N2.js.map → chunk-Z2HDXUH7.js.map} +0 -0
@@ -318,6 +318,8 @@ I think I have a rough idea, but this is my last turn so I must call the finish
318
318
  No commentary outside \`<think>\`. No explanations after tool calls.
319
319
  </output_format>
320
320
 
321
+ use as all 8 tool calls to be optimal
322
+
321
323
  <finishing_requirements>
322
324
  When calling \`finish\`:
323
325
  - Include the import section (typically lines 1-20) of each file
@@ -605,10 +607,25 @@ async function toolGrep(provider, args) {
605
607
  }
606
608
 
607
609
  // tools/warp_grep/agent/tools/read.ts
610
+ function isValidRange(start, end) {
611
+ return typeof start === "number" && typeof end === "number" && Number.isFinite(start) && Number.isFinite(end) && start > 0 && end >= start;
612
+ }
608
613
  async function toolRead(provider, args) {
609
- if (args.lines && args.lines.length > 0) {
614
+ if (args.lines && Array.isArray(args.lines) && args.lines.length > 0) {
615
+ const validRanges = [];
616
+ for (const range of args.lines) {
617
+ if (Array.isArray(range) && range.length >= 2 && isValidRange(range[0], range[1])) {
618
+ validRanges.push([range[0], range[1]]);
619
+ }
620
+ }
621
+ if (validRanges.length === 0) {
622
+ const res2 = await provider.read({ path: args.path });
623
+ if (res2.error) return res2.error;
624
+ if (!res2.lines.length) return "(empty file)";
625
+ return res2.lines.join("\n");
626
+ }
610
627
  const chunks = [];
611
- for (const [start, end] of args.lines) {
628
+ for (const [start, end] of validRanges) {
612
629
  const res2 = await provider.read({ path: args.path, start, end });
613
630
  if (res2.error) return res2.error;
614
631
  chunks.push(res2.lines.join("\n"));
@@ -644,14 +661,28 @@ async function toolListDirectory(provider, args) {
644
661
  }
645
662
 
646
663
  // tools/warp_grep/agent/tools/finish.ts
664
+ function isValidRange2(range) {
665
+ 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];
666
+ }
667
+ function extractValidRanges(lines) {
668
+ if (!Array.isArray(lines)) return null;
669
+ const valid = [];
670
+ for (const range of lines) {
671
+ if (isValidRange2(range)) {
672
+ valid.push([range[0], range[1]]);
673
+ }
674
+ }
675
+ return valid.length > 0 ? valid : null;
676
+ }
647
677
  async function readFinishFiles(repoRoot, files, reader) {
648
678
  const out = [];
649
679
  for (const f of files) {
650
- if (f.lines === "*") {
680
+ const validRanges = f.lines === "*" ? null : extractValidRanges(f.lines);
681
+ if (f.lines === "*" || !validRanges) {
651
682
  const lines = await reader(f.path);
652
683
  out.push({ path: f.path, ranges: "*", content: lines.join("\n") });
653
684
  } else {
654
- const ranges = mergeRanges(f.lines);
685
+ const ranges = mergeRanges(validRanges);
655
686
  const chunks = [];
656
687
  for (const [s, e] of ranges) {
657
688
  const lines = await reader(f.path, s, e);
@@ -1059,7 +1090,7 @@ async function runWarpGrep(config) {
1059
1090
  }
1060
1091
  const parts = ["Relevant context found:"];
1061
1092
  for (const f of finishMeta.files) {
1062
- const ranges = f.lines === "*" ? "*" : f.lines.map(([s, e]) => `${s}-${e}`).join(", ");
1093
+ const ranges = f.lines === "*" ? "*" : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(", ") : "*";
1063
1094
  parts.push(`- ${f.path}: ${ranges}`);
1064
1095
  }
1065
1096
  const payload = parts.join("\n");
@@ -1419,11 +1450,19 @@ Details: ${res.stderr}` : ""}`
1419
1450
  };
1420
1451
  }
1421
1452
  const total = lines.length;
1422
- let s = params.start ?? 1;
1423
- let e = Math.min(params.end ?? total, total);
1424
- if (s > total && total > 0) {
1425
- s = 1;
1426
- e = total;
1453
+ const rawStart = params.start;
1454
+ const rawEnd = params.end;
1455
+ let s = 1;
1456
+ let e = total;
1457
+ const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
1458
+ const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
1459
+ if (startValid && endValid) {
1460
+ s = rawStart ?? 1;
1461
+ e = Math.min(rawEnd ?? total, total);
1462
+ if (s > total && total > 0 || s > e) {
1463
+ s = 1;
1464
+ e = total;
1465
+ }
1427
1466
  }
1428
1467
  const out = [];
1429
1468
  for (let i = s; i <= e; i += 1) {
@@ -1599,8 +1638,13 @@ var RemoteCommandsProvider = class {
1599
1638
  * Read file and add line numbers
1600
1639
  */
1601
1640
  async read(params) {
1602
- const start = params.start ?? 1;
1603
- const end = params.end ?? 1e6;
1641
+ const rawStart = params.start;
1642
+ const rawEnd = params.end;
1643
+ const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
1644
+ const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
1645
+ const rangeValid = startValid && endValid && (rawStart === void 0 || rawEnd === void 0 || rawStart <= rawEnd);
1646
+ const start = rangeValid && rawStart !== void 0 ? rawStart : 1;
1647
+ const end = rangeValid && rawEnd !== void 0 ? rawEnd : 1e6;
1604
1648
  try {
1605
1649
  const stdout = await this.commands.read(params.path, start, end);
1606
1650
  const contentLines = (stdout || "").split("\n");