@morphllm/morphsdk 0.2.115 → 0.2.116
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-SYZ75S3S.js → chunk-3JVHMOYJ.js} +2 -2
- package/dist/{chunk-CM75JPVD.js → chunk-5JARN2NG.js} +2 -2
- package/dist/{chunk-TZBDXZFC.js → chunk-62OVBE6G.js} +5 -5
- package/dist/{chunk-GQUNK324.js → chunk-GENFEPHG.js} +2 -2
- package/dist/{chunk-NTDAIKZI.js → chunk-OVNPKTEG.js} +2 -2
- package/dist/{chunk-RBTL6EJG.js → chunk-RBOCP2MX.js} +32 -18
- package/dist/chunk-RBOCP2MX.js.map +1 -0
- package/dist/client.cjs +31 -17
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +6 -6
- package/dist/index.cjs +31 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/tools/warp_grep/agent/runner.cjs +31 -17
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +1 -1
- package/dist/tools/warp_grep/anthropic.cjs +31 -17
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +3 -3
- package/dist/tools/warp_grep/client.cjs +31 -17
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +2 -2
- package/dist/tools/warp_grep/gemini.cjs +31 -17
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +2 -2
- package/dist/tools/warp_grep/index.cjs +31 -17
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +2 -2
- package/dist/tools/warp_grep/openai.cjs +31 -17
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +3 -3
- package/dist/tools/warp_grep/vercel.cjs +31 -17
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-RBTL6EJG.js.map +0 -1
- /package/dist/{chunk-SYZ75S3S.js.map → chunk-3JVHMOYJ.js.map} +0 -0
- /package/dist/{chunk-CM75JPVD.js.map → chunk-5JARN2NG.js.map} +0 -0
- /package/dist/{chunk-TZBDXZFC.js.map → chunk-62OVBE6G.js.map} +0 -0
- /package/dist/{chunk-GQUNK324.js.map → chunk-GENFEPHG.js.map} +0 -0
- /package/dist/{chunk-NTDAIKZI.js.map → chunk-OVNPKTEG.js.map} +0 -0
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
createWarpGrepTool,
|
|
3
3
|
execute,
|
|
4
4
|
warpGrepTool
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-5JARN2NG.js";
|
|
6
6
|
import "../../chunk-KW7OEGZK.js";
|
|
7
7
|
import {
|
|
8
8
|
formatResult
|
|
9
|
-
} from "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-OVNPKTEG.js";
|
|
10
|
+
import "../../chunk-RBOCP2MX.js";
|
|
11
11
|
import "../../chunk-PUGSTXLO.js";
|
|
12
12
|
import "../../chunk-3MLWXJTJ.js";
|
|
13
13
|
import "../../chunk-SNGGSPYJ.js";
|
|
@@ -1367,27 +1367,41 @@ async function callModel(messages, model, options = {}) {
|
|
|
1367
1367
|
maxRetries: options.retryConfig?.maxRetries,
|
|
1368
1368
|
timeout: timeoutMs
|
|
1369
1369
|
});
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
data
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1370
|
+
const MAX_EMPTY_RETRIES = 1;
|
|
1371
|
+
for (let attempt = 0; attempt <= MAX_EMPTY_RETRIES; attempt++) {
|
|
1372
|
+
let data;
|
|
1373
|
+
try {
|
|
1374
|
+
data = await client.chat.completions.create({
|
|
1375
|
+
model,
|
|
1376
|
+
temperature: 0,
|
|
1377
|
+
max_tokens: 1024,
|
|
1378
|
+
messages
|
|
1379
|
+
});
|
|
1380
|
+
} catch (error) {
|
|
1381
|
+
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1382
|
+
throw new Error(
|
|
1383
|
+
"The endpoint you are trying to call is likely deprecated. Please update with: npm cache clean --force && npx -y @morphllm/morphmcp@latest or visit: https://morphllm.com/mcp"
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
throw error;
|
|
1387
|
+
}
|
|
1388
|
+
const choice = data?.choices?.[0];
|
|
1389
|
+
const content = choice?.message?.content;
|
|
1390
|
+
if (content && typeof content === "string") {
|
|
1391
|
+
return content;
|
|
1392
|
+
}
|
|
1393
|
+
if (attempt === MAX_EMPTY_RETRIES) {
|
|
1394
|
+
const finishReason = choice?.finish_reason ?? "unknown";
|
|
1395
|
+
const hasToolCalls = Array.isArray(choice?.message?.tool_calls) && choice.message.tool_calls.length > 0;
|
|
1396
|
+
const choicesLen = data?.choices?.length ?? 0;
|
|
1397
|
+
const contentType = content === null ? "null" : content === void 0 ? "undefined" : typeof content;
|
|
1380
1398
|
throw new Error(
|
|
1381
|
-
|
|
1399
|
+
`Invalid response from model: content=${contentType}, finish_reason=${finishReason}, has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`
|
|
1382
1400
|
);
|
|
1383
1401
|
}
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1386
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
1387
|
-
if (!content || typeof content !== "string") {
|
|
1388
|
-
throw new Error("Invalid response from model");
|
|
1402
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
1389
1403
|
}
|
|
1390
|
-
|
|
1404
|
+
throw new Error("Invalid response from model");
|
|
1391
1405
|
}
|
|
1392
1406
|
async function runWarpGrep(config) {
|
|
1393
1407
|
const totalStart = Date.now();
|