@morphllm/morphsdk 0.2.115 → 0.2.117
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-SITZC3U6.js → chunk-5IVVJMMX.js} +2 -2
- package/dist/{chunk-CM75JPVD.js → chunk-5JARN2NG.js} +2 -2
- package/dist/{chunk-TZBDXZFC.js → chunk-C3LJORIT.js} +6 -6
- package/dist/{chunk-QOEZARHG.js → chunk-EAT5W3SH.js} +2 -2
- package/dist/{chunk-GQUNK324.js → chunk-GENFEPHG.js} +2 -2
- package/dist/{chunk-NTDAIKZI.js → chunk-OVNPKTEG.js} +2 -2
- package/dist/{chunk-25APYVON.js → chunk-PR44LEQQ.js} +2 -2
- package/dist/{chunk-RBTL6EJG.js → chunk-RBOCP2MX.js} +32 -18
- package/dist/chunk-RBOCP2MX.js.map +1 -0
- package/dist/{chunk-Q6Y4R236.js → chunk-YTYCHRQ2.js} +7 -9
- package/dist/{chunk-Q6Y4R236.js.map → chunk-YTYCHRQ2.js.map} +1 -1
- package/dist/{chunk-4IOC2D5Y.js → chunk-ZYPLV3HP.js} +2 -2
- package/dist/client.cjs +37 -25
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +8 -8
- package/dist/index.cjs +37 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/tools/browser/anthropic.js +3 -3
- package/dist/tools/browser/core.cjs +6 -8
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +2 -2
- package/dist/tools/browser/index.cjs +6 -8
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +5 -5
- package/dist/tools/browser/live.cjs +6 -8
- package/dist/tools/browser/live.cjs.map +1 -1
- package/dist/tools/browser/live.js +1 -1
- package/dist/tools/browser/openai.js +3 -3
- package/dist/tools/browser/vercel.js +3 -3
- 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-SITZC3U6.js.map → chunk-5IVVJMMX.js.map} +0 -0
- /package/dist/{chunk-CM75JPVD.js.map → chunk-5JARN2NG.js.map} +0 -0
- /package/dist/{chunk-TZBDXZFC.js.map → chunk-C3LJORIT.js.map} +0 -0
- /package/dist/{chunk-QOEZARHG.js.map → chunk-EAT5W3SH.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
- /package/dist/{chunk-25APYVON.js.map → chunk-PR44LEQQ.js.map} +0 -0
- /package/dist/{chunk-4IOC2D5Y.js.map → chunk-ZYPLV3HP.js.map} +0 -0
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
executeToolCall,
|
|
7
7
|
formatResult
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-OVNPKTEG.js";
|
|
9
|
+
import "../../chunk-RBOCP2MX.js";
|
|
10
10
|
import "../../chunk-PUGSTXLO.js";
|
|
11
11
|
import "../../chunk-3MLWXJTJ.js";
|
|
12
12
|
import "../../chunk-SNGGSPYJ.js";
|
|
@@ -1390,27 +1390,41 @@ async function callModel(messages, model, options = {}) {
|
|
|
1390
1390
|
maxRetries: options.retryConfig?.maxRetries,
|
|
1391
1391
|
timeout: timeoutMs
|
|
1392
1392
|
});
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
data
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1393
|
+
const MAX_EMPTY_RETRIES = 1;
|
|
1394
|
+
for (let attempt = 0; attempt <= MAX_EMPTY_RETRIES; attempt++) {
|
|
1395
|
+
let data;
|
|
1396
|
+
try {
|
|
1397
|
+
data = await client.chat.completions.create({
|
|
1398
|
+
model,
|
|
1399
|
+
temperature: 0,
|
|
1400
|
+
max_tokens: 1024,
|
|
1401
|
+
messages
|
|
1402
|
+
});
|
|
1403
|
+
} catch (error) {
|
|
1404
|
+
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1405
|
+
throw new Error(
|
|
1406
|
+
"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"
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
throw error;
|
|
1410
|
+
}
|
|
1411
|
+
const choice = data?.choices?.[0];
|
|
1412
|
+
const content = choice?.message?.content;
|
|
1413
|
+
if (content && typeof content === "string") {
|
|
1414
|
+
return content;
|
|
1415
|
+
}
|
|
1416
|
+
if (attempt === MAX_EMPTY_RETRIES) {
|
|
1417
|
+
const finishReason = choice?.finish_reason ?? "unknown";
|
|
1418
|
+
const hasToolCalls = Array.isArray(choice?.message?.tool_calls) && choice.message.tool_calls.length > 0;
|
|
1419
|
+
const choicesLen = data?.choices?.length ?? 0;
|
|
1420
|
+
const contentType = content === null ? "null" : content === void 0 ? "undefined" : typeof content;
|
|
1403
1421
|
throw new Error(
|
|
1404
|
-
|
|
1422
|
+
`Invalid response from model: content=${contentType}, finish_reason=${finishReason}, has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`
|
|
1405
1423
|
);
|
|
1406
1424
|
}
|
|
1407
|
-
|
|
1408
|
-
}
|
|
1409
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
1410
|
-
if (!content || typeof content !== "string") {
|
|
1411
|
-
throw new Error("Invalid response from model");
|
|
1425
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
1412
1426
|
}
|
|
1413
|
-
|
|
1427
|
+
throw new Error("Invalid response from model");
|
|
1414
1428
|
}
|
|
1415
1429
|
async function runWarpGrep(config) {
|
|
1416
1430
|
const totalStart = Date.now();
|