@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.
Files changed (41) hide show
  1. package/dist/{chunk-SYZ75S3S.js → chunk-3JVHMOYJ.js} +2 -2
  2. package/dist/{chunk-CM75JPVD.js → chunk-5JARN2NG.js} +2 -2
  3. package/dist/{chunk-TZBDXZFC.js → chunk-62OVBE6G.js} +5 -5
  4. package/dist/{chunk-GQUNK324.js → chunk-GENFEPHG.js} +2 -2
  5. package/dist/{chunk-NTDAIKZI.js → chunk-OVNPKTEG.js} +2 -2
  6. package/dist/{chunk-RBTL6EJG.js → chunk-RBOCP2MX.js} +32 -18
  7. package/dist/chunk-RBOCP2MX.js.map +1 -0
  8. package/dist/client.cjs +31 -17
  9. package/dist/client.cjs.map +1 -1
  10. package/dist/client.js +6 -6
  11. package/dist/index.cjs +31 -17
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.js +6 -6
  14. package/dist/tools/warp_grep/agent/runner.cjs +31 -17
  15. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  16. package/dist/tools/warp_grep/agent/runner.js +1 -1
  17. package/dist/tools/warp_grep/anthropic.cjs +31 -17
  18. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  19. package/dist/tools/warp_grep/anthropic.js +3 -3
  20. package/dist/tools/warp_grep/client.cjs +31 -17
  21. package/dist/tools/warp_grep/client.cjs.map +1 -1
  22. package/dist/tools/warp_grep/client.js +2 -2
  23. package/dist/tools/warp_grep/gemini.cjs +31 -17
  24. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  25. package/dist/tools/warp_grep/gemini.js +2 -2
  26. package/dist/tools/warp_grep/index.cjs +31 -17
  27. package/dist/tools/warp_grep/index.cjs.map +1 -1
  28. package/dist/tools/warp_grep/index.js +2 -2
  29. package/dist/tools/warp_grep/openai.cjs +31 -17
  30. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  31. package/dist/tools/warp_grep/openai.js +3 -3
  32. package/dist/tools/warp_grep/vercel.cjs +31 -17
  33. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  34. package/dist/tools/warp_grep/vercel.js +3 -3
  35. package/package.json +1 -1
  36. package/dist/chunk-RBTL6EJG.js.map +0 -1
  37. /package/dist/{chunk-SYZ75S3S.js.map → chunk-3JVHMOYJ.js.map} +0 -0
  38. /package/dist/{chunk-CM75JPVD.js.map → chunk-5JARN2NG.js.map} +0 -0
  39. /package/dist/{chunk-TZBDXZFC.js.map → chunk-62OVBE6G.js.map} +0 -0
  40. /package/dist/{chunk-GQUNK324.js.map → chunk-GENFEPHG.js.map} +0 -0
  41. /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-TZBDXZFC.js";
4
- import "./chunk-GQUNK324.js";
5
- import "./chunk-SYZ75S3S.js";
6
- import "./chunk-CM75JPVD.js";
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-NTDAIKZI.js";
9
- import "./chunk-RBTL6EJG.js";
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
- let data;
3037
- try {
3038
- data = await client.chat.completions.create({
3039
- model,
3040
- temperature: 0,
3041
- max_tokens: 1024,
3042
- messages
3043
- });
3044
- } catch (error) {
3045
- if (error instanceof import_openai2.default.APIError && error.status === 404) {
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
- "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"
3065
+ `Invalid response from model: content=${contentType}, finish_reason=${finishReason}, has_tool_calls=${hasToolCalls}, choices_length=${choicesLen}`
3048
3066
  );
3049
3067
  }
3050
- throw error;
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
- return content;
3070
+ throw new Error("Invalid response from model");
3057
3071
  }
3058
3072
  async function runWarpGrep(config) {
3059
3073
  const totalStart = Date.now();