@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
package/dist/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-62OVBE6G.js";
|
|
4
|
+
import "./chunk-GENFEPHG.js";
|
|
5
|
+
import "./chunk-3JVHMOYJ.js";
|
|
6
|
+
import "./chunk-5JARN2NG.js";
|
|
7
7
|
import "./chunk-KW7OEGZK.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./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";
|
package/dist/index.cjs
CHANGED
|
@@ -3033,27 +3033,41 @@ async function callModel(messages, model, options = {}) {
|
|
|
3033
3033
|
maxRetries: options.retryConfig?.maxRetries,
|
|
3034
3034
|
timeout: timeoutMs
|
|
3035
3035
|
});
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
data
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3036
|
+
const MAX_EMPTY_RETRIES = 1;
|
|
3037
|
+
for (let attempt = 0; attempt <= MAX_EMPTY_RETRIES; attempt++) {
|
|
3038
|
+
let data;
|
|
3039
|
+
try {
|
|
3040
|
+
data = await client.chat.completions.create({
|
|
3041
|
+
model,
|
|
3042
|
+
temperature: 0,
|
|
3043
|
+
max_tokens: 1024,
|
|
3044
|
+
messages
|
|
3045
|
+
});
|
|
3046
|
+
} catch (error) {
|
|
3047
|
+
if (error instanceof import_openai2.default.APIError && error.status === 404) {
|
|
3048
|
+
throw new Error(
|
|
3049
|
+
"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"
|
|
3050
|
+
);
|
|
3051
|
+
}
|
|
3052
|
+
throw error;
|
|
3053
|
+
}
|
|
3054
|
+
const choice = data?.choices?.[0];
|
|
3055
|
+
const content = choice?.message?.content;
|
|
3056
|
+
if (content && typeof content === "string") {
|
|
3057
|
+
return content;
|
|
3058
|
+
}
|
|
3059
|
+
if (attempt === MAX_EMPTY_RETRIES) {
|
|
3060
|
+
const finishReason = choice?.finish_reason ?? "unknown";
|
|
3061
|
+
const hasToolCalls = Array.isArray(choice?.message?.tool_calls) && choice.message.tool_calls.length > 0;
|
|
3062
|
+
const choicesLen = data?.choices?.length ?? 0;
|
|
3063
|
+
const contentType = content === null ? "null" : content === void 0 ? "undefined" : typeof content;
|
|
3046
3064
|
throw new Error(
|
|
3047
|
-
|
|
3065
|
+
`Invalid response from model: content=${contentType}, finish_reason=${finishReason}, has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`
|
|
3048
3066
|
);
|
|
3049
3067
|
}
|
|
3050
|
-
|
|
3051
|
-
}
|
|
3052
|
-
const content = data?.choices?.[0]?.message?.content;
|
|
3053
|
-
if (!content || typeof content !== "string") {
|
|
3054
|
-
throw new Error("Invalid response from model");
|
|
3068
|
+
await new Promise((resolve2) => setTimeout(resolve2, 200));
|
|
3055
3069
|
}
|
|
3056
|
-
|
|
3070
|
+
throw new Error("Invalid response from model");
|
|
3057
3071
|
}
|
|
3058
3072
|
async function runWarpGrep(config) {
|
|
3059
3073
|
const totalStart = Date.now();
|