@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.
- package/dist/{chunk-DCIUCDWJ.js → chunk-467MCW5R.js} +38 -10
- package/dist/chunk-467MCW5R.js.map +1 -0
- package/dist/{chunk-HBIDSKIQ.js → chunk-4NI25AKV.js} +14 -6
- package/dist/chunk-4NI25AKV.js.map +1 -0
- package/dist/{chunk-5PGRBWJX.js → chunk-4VMIPD4G.js} +4 -4
- package/dist/{chunk-6OII5QOW.js → chunk-B3UC7UVA.js} +3 -3
- package/dist/{chunk-6OII5QOW.js.map → chunk-B3UC7UVA.js.map} +1 -1
- package/dist/{chunk-QL5SMQ73.js → chunk-NTTQJM6O.js} +2 -2
- package/dist/{chunk-ND7IFSMR.js → chunk-OFMDENAQ.js} +2 -2
- package/dist/{chunk-26QXQFLZ.js → chunk-PHJQ4N3T.js} +8 -3
- package/dist/chunk-PHJQ4N3T.js.map +1 -0
- package/dist/{chunk-LM62QCGS.js → chunk-X6A64F2F.js} +5 -5
- package/dist/{chunk-4R3ALD5C.js → chunk-Z2HDXUH7.js} +2 -2
- package/dist/client.cjs +54 -12
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +9 -9
- package/dist/index.cjs +54 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -9
- package/dist/tools/warp_grep/agent/runner.cjs +34 -5
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +2 -2
- package/dist/tools/warp_grep/anthropic.cjs +54 -12
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +6 -6
- package/dist/tools/warp_grep/client.cjs +54 -12
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +5 -5
- package/dist/tools/warp_grep/gemini.cjs +54 -12
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +5 -5
- package/dist/tools/warp_grep/harness.cjs +50 -14
- package/dist/tools/warp_grep/harness.cjs.map +1 -1
- package/dist/tools/warp_grep/harness.js +2 -2
- package/dist/tools/warp_grep/index.cjs +58 -17
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +5 -5
- package/dist/tools/warp_grep/openai.cjs +54 -12
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +6 -6
- package/dist/tools/warp_grep/providers/local.cjs +13 -5
- package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/local.js +1 -1
- package/dist/tools/warp_grep/providers/remote.cjs +7 -2
- package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/remote.js +1 -1
- package/dist/tools/warp_grep/vercel.cjs +54 -12
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-26QXQFLZ.js.map +0 -1
- package/dist/chunk-DCIUCDWJ.js.map +0 -1
- package/dist/chunk-HBIDSKIQ.js.map +0 -1
- /package/dist/{chunk-5PGRBWJX.js.map → chunk-4VMIPD4G.js.map} +0 -0
- /package/dist/{chunk-QL5SMQ73.js.map → chunk-NTTQJM6O.js.map} +0 -0
- /package/dist/{chunk-ND7IFSMR.js.map → chunk-OFMDENAQ.js.map} +0 -0
- /package/dist/{chunk-LM62QCGS.js.map → chunk-X6A64F2F.js.map} +0 -0
- /package/dist/{chunk-4R3ALD5C.js.map → chunk-Z2HDXUH7.js.map} +0 -0
|
@@ -10,20 +10,20 @@ import {
|
|
|
10
10
|
executeToolCall,
|
|
11
11
|
executeWarpGrep,
|
|
12
12
|
formatResult
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-4VMIPD4G.js";
|
|
14
14
|
import {
|
|
15
15
|
runWarpGrep
|
|
16
|
-
} from "../../chunk-
|
|
16
|
+
} from "../../chunk-B3UC7UVA.js";
|
|
17
17
|
import {
|
|
18
18
|
RemoteCommandsProvider
|
|
19
|
-
} from "../../chunk-
|
|
19
|
+
} from "../../chunk-PHJQ4N3T.js";
|
|
20
20
|
import {
|
|
21
21
|
normalizeFinishFiles,
|
|
22
22
|
readFinishFiles,
|
|
23
23
|
toolGrep,
|
|
24
24
|
toolListDirectory,
|
|
25
25
|
toolRead
|
|
26
|
-
} from "../../chunk-
|
|
26
|
+
} from "../../chunk-467MCW5R.js";
|
|
27
27
|
import "../../chunk-APP75CBN.js";
|
|
28
28
|
import "../../chunk-5QRN3JNB.js";
|
|
29
29
|
import {
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
} from "../../chunk-FMLHRJDF.js";
|
|
33
33
|
import {
|
|
34
34
|
LocalRipgrepProvider
|
|
35
|
-
} from "../../chunk-
|
|
35
|
+
} from "../../chunk-4NI25AKV.js";
|
|
36
36
|
import "../../chunk-G2RSY56Q.js";
|
|
37
37
|
import {
|
|
38
38
|
fixPathRepetition
|
|
@@ -608,10 +608,25 @@ async function toolGrep(provider, args) {
|
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
// tools/warp_grep/agent/tools/read.ts
|
|
611
|
+
function isValidRange(start, end) {
|
|
612
|
+
return typeof start === "number" && typeof end === "number" && Number.isFinite(start) && Number.isFinite(end) && start > 0 && end >= start;
|
|
613
|
+
}
|
|
611
614
|
async function toolRead(provider, args) {
|
|
612
|
-
if (args.lines && args.lines.length > 0) {
|
|
615
|
+
if (args.lines && Array.isArray(args.lines) && args.lines.length > 0) {
|
|
616
|
+
const validRanges = [];
|
|
617
|
+
for (const range of args.lines) {
|
|
618
|
+
if (Array.isArray(range) && range.length >= 2 && isValidRange(range[0], range[1])) {
|
|
619
|
+
validRanges.push([range[0], range[1]]);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
if (validRanges.length === 0) {
|
|
623
|
+
const res2 = await provider.read({ path: args.path });
|
|
624
|
+
if (res2.error) return res2.error;
|
|
625
|
+
if (!res2.lines.length) return "(empty file)";
|
|
626
|
+
return res2.lines.join("\n");
|
|
627
|
+
}
|
|
613
628
|
const chunks = [];
|
|
614
|
-
for (const [start, end] of
|
|
629
|
+
for (const [start, end] of validRanges) {
|
|
615
630
|
const res2 = await provider.read({ path: args.path, start, end });
|
|
616
631
|
if (res2.error) return res2.error;
|
|
617
632
|
chunks.push(res2.lines.join("\n"));
|
|
@@ -647,14 +662,28 @@ async function toolListDirectory(provider, args) {
|
|
|
647
662
|
}
|
|
648
663
|
|
|
649
664
|
// tools/warp_grep/agent/tools/finish.ts
|
|
665
|
+
function isValidRange2(range) {
|
|
666
|
+
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];
|
|
667
|
+
}
|
|
668
|
+
function extractValidRanges(lines) {
|
|
669
|
+
if (!Array.isArray(lines)) return null;
|
|
670
|
+
const valid = [];
|
|
671
|
+
for (const range of lines) {
|
|
672
|
+
if (isValidRange2(range)) {
|
|
673
|
+
valid.push([range[0], range[1]]);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return valid.length > 0 ? valid : null;
|
|
677
|
+
}
|
|
650
678
|
async function readFinishFiles(repoRoot, files, reader) {
|
|
651
679
|
const out = [];
|
|
652
680
|
for (const f of files) {
|
|
653
|
-
|
|
681
|
+
const validRanges = f.lines === "*" ? null : extractValidRanges(f.lines);
|
|
682
|
+
if (f.lines === "*" || !validRanges) {
|
|
654
683
|
const lines = await reader(f.path);
|
|
655
684
|
out.push({ path: f.path, ranges: "*", content: lines.join("\n") });
|
|
656
685
|
} else {
|
|
657
|
-
const ranges = mergeRanges(
|
|
686
|
+
const ranges = mergeRanges(validRanges);
|
|
658
687
|
const chunks = [];
|
|
659
688
|
for (const [s, e] of ranges) {
|
|
660
689
|
const lines = await reader(f.path, s, e);
|
|
@@ -1062,7 +1091,7 @@ async function runWarpGrep(config) {
|
|
|
1062
1091
|
}
|
|
1063
1092
|
const parts = ["Relevant context found:"];
|
|
1064
1093
|
for (const f of finishMeta.files) {
|
|
1065
|
-
const ranges = f.lines === "*" ? "*" : f.lines.map(([s, e]) => `${s}-${e}`).join(", ");
|
|
1094
|
+
const ranges = f.lines === "*" ? "*" : Array.isArray(f.lines) ? f.lines.map(([s, e]) => `${s}-${e}`).join(", ") : "*";
|
|
1066
1095
|
parts.push(`- ${f.path}: ${ranges}`);
|
|
1067
1096
|
}
|
|
1068
1097
|
const payload = parts.join("\n");
|
|
@@ -1422,11 +1451,19 @@ Details: ${res.stderr}` : ""}`
|
|
|
1422
1451
|
};
|
|
1423
1452
|
}
|
|
1424
1453
|
const total = lines.length;
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1454
|
+
const rawStart = params.start;
|
|
1455
|
+
const rawEnd = params.end;
|
|
1456
|
+
let s = 1;
|
|
1457
|
+
let e = total;
|
|
1458
|
+
const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
|
|
1459
|
+
const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
|
|
1460
|
+
if (startValid && endValid) {
|
|
1461
|
+
s = rawStart ?? 1;
|
|
1462
|
+
e = Math.min(rawEnd ?? total, total);
|
|
1463
|
+
if (s > total && total > 0 || s > e) {
|
|
1464
|
+
s = 1;
|
|
1465
|
+
e = total;
|
|
1466
|
+
}
|
|
1430
1467
|
}
|
|
1431
1468
|
const out = [];
|
|
1432
1469
|
for (let i = s; i <= e; i += 1) {
|
|
@@ -1602,8 +1639,13 @@ var RemoteCommandsProvider = class {
|
|
|
1602
1639
|
* Read file and add line numbers
|
|
1603
1640
|
*/
|
|
1604
1641
|
async read(params) {
|
|
1605
|
-
const
|
|
1606
|
-
const
|
|
1642
|
+
const rawStart = params.start;
|
|
1643
|
+
const rawEnd = params.end;
|
|
1644
|
+
const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
|
|
1645
|
+
const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
|
|
1646
|
+
const rangeValid = startValid && endValid && (rawStart === void 0 || rawEnd === void 0 || rawStart <= rawEnd);
|
|
1647
|
+
const start = rangeValid && rawStart !== void 0 ? rawStart : 1;
|
|
1648
|
+
const end = rangeValid && rawEnd !== void 0 ? rawEnd : 1e6;
|
|
1607
1649
|
try {
|
|
1608
1650
|
const stdout = await this.commands.read(params.path, start, end);
|
|
1609
1651
|
const contentLines = (stdout || "").split("\n");
|