@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
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
execute,
|
|
4
4
|
openai_default,
|
|
5
5
|
warpGrepTool
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-GENFEPHG.js";
|
|
7
7
|
import "../../chunk-KW7OEGZK.js";
|
|
8
8
|
import {
|
|
9
9
|
formatResult
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
} from "../../chunk-OVNPKTEG.js";
|
|
11
|
+
import "../../chunk-RBOCP2MX.js";
|
|
12
12
|
import "../../chunk-PUGSTXLO.js";
|
|
13
13
|
import "../../chunk-3MLWXJTJ.js";
|
|
14
14
|
import "../../chunk-SNGGSPYJ.js";
|
|
@@ -1370,27 +1370,41 @@ async function callModel(messages, model, options = {}) {
|
|
|
1370
1370
|
maxRetries: options.retryConfig?.maxRetries,
|
|
1371
1371
|
timeout: timeoutMs
|
|
1372
1372
|
});
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
data
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1373
|
+
const MAX_EMPTY_RETRIES = 1;
|
|
1374
|
+
for (let attempt = 0; attempt <= MAX_EMPTY_RETRIES; attempt++) {
|
|
1375
|
+
let data;
|
|
1376
|
+
try {
|
|
1377
|
+
data = await client.chat.completions.create({
|
|
1378
|
+
model,
|
|
1379
|
+
temperature: 0,
|
|
1380
|
+
max_tokens: 1024,
|
|
1381
|
+
messages
|
|
1382
|
+
});
|
|
1383
|
+
} catch (error) {
|
|
1384
|
+
if (error instanceof import_openai.default.APIError && error.status === 404) {
|
|
1385
|
+
throw new Error(
|
|
1386
|
+
"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"
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
throw error;
|
|
1390
|
+
}
|
|
1391
|
+
const choice = data?.choices?.[0];
|
|
1392
|
+
const content = choice?.message?.content;
|
|
1393
|
+
if (content && typeof content === "string") {
|
|
1394
|
+
return content;
|
|
1395
|
+
}
|
|
1396
|
+
if (attempt === MAX_EMPTY_RETRIES) {
|
|
1397
|
+
const finishReason = choice?.finish_reason ?? "unknown";
|
|
1398
|
+
const hasToolCalls = Array.isArray(choice?.message?.tool_calls) && choice.message.tool_calls.length > 0;
|
|
1399
|
+
const choicesLen = data?.choices?.length ?? 0;
|
|
1400
|
+
const contentType = content === null ? "null" : content === void 0 ? "undefined" : typeof content;
|
|
1383
1401
|
throw new Error(
|
|
1384
|
-
|
|
1402
|
+
`Invalid response from model: content=${contentType}, finish_reason=${finishReason}, has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`
|
|
1385
1403
|
);
|
|
1386
1404
|
}
|
|
1387
|
-
|
|
1388
|
-
}
|
|
1389
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
1390
|
-
if (!content || typeof content !== "string") {
|
|
1391
|
-
throw new Error("Invalid response from model");
|
|
1405
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
1392
1406
|
}
|
|
1393
|
-
|
|
1407
|
+
throw new Error("Invalid response from model");
|
|
1394
1408
|
}
|
|
1395
1409
|
async function runWarpGrep(config) {
|
|
1396
1410
|
const totalStart = Date.now();
|