@morphllm/morphsdk 0.2.114 → 0.2.115

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 (48) hide show
  1. package/dist/{chunk-ALTKGCG5.js → chunk-CM75JPVD.js} +2 -2
  2. package/dist/{chunk-FL4ZBHK2.js → chunk-GQUNK324.js} +2 -2
  3. package/dist/{chunk-23R562QJ.js → chunk-NTDAIKZI.js} +9 -4
  4. package/dist/chunk-NTDAIKZI.js.map +1 -0
  5. package/dist/{chunk-YY7NZLAI.js → chunk-RBTL6EJG.js} +11 -3
  6. package/dist/chunk-RBTL6EJG.js.map +1 -0
  7. package/dist/{chunk-HI35Y6EZ.js → chunk-SYZ75S3S.js} +18 -5
  8. package/dist/chunk-SYZ75S3S.js.map +1 -0
  9. package/dist/{chunk-3U7AWFBN.js → chunk-TZBDXZFC.js} +5 -5
  10. package/dist/{client-Bm_umdno.d.ts → client-D7iO2TbA.d.ts} +7 -0
  11. package/dist/client.cjs +30 -6
  12. package/dist/client.cjs.map +1 -1
  13. package/dist/client.d.ts +1 -1
  14. package/dist/client.js +6 -6
  15. package/dist/index.cjs +30 -6
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +6 -6
  19. package/dist/tools/warp_grep/agent/runner.cjs +10 -2
  20. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  21. package/dist/tools/warp_grep/agent/runner.js +1 -1
  22. package/dist/tools/warp_grep/anthropic.cjs +8 -2
  23. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  24. package/dist/tools/warp_grep/anthropic.js +3 -3
  25. package/dist/tools/warp_grep/client.cjs +18 -4
  26. package/dist/tools/warp_grep/client.cjs.map +1 -1
  27. package/dist/tools/warp_grep/client.d.ts +7 -1
  28. package/dist/tools/warp_grep/client.js +4 -2
  29. package/dist/tools/warp_grep/gemini.cjs +8 -2
  30. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  31. package/dist/tools/warp_grep/gemini.js +2 -2
  32. package/dist/tools/warp_grep/index.cjs +16 -4
  33. package/dist/tools/warp_grep/index.cjs.map +1 -1
  34. package/dist/tools/warp_grep/index.js +2 -2
  35. package/dist/tools/warp_grep/openai.cjs +8 -2
  36. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  37. package/dist/tools/warp_grep/openai.js +3 -3
  38. package/dist/tools/warp_grep/vercel.cjs +216 -4
  39. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  40. package/dist/tools/warp_grep/vercel.d.ts +7 -0
  41. package/dist/tools/warp_grep/vercel.js +3 -3
  42. package/package.json +6 -1
  43. package/dist/chunk-23R562QJ.js.map +0 -1
  44. package/dist/chunk-HI35Y6EZ.js.map +0 -1
  45. package/dist/chunk-YY7NZLAI.js.map +0 -1
  46. /package/dist/{chunk-ALTKGCG5.js.map → chunk-CM75JPVD.js.map} +0 -0
  47. /package/dist/{chunk-FL4ZBHK2.js.map → chunk-GQUNK324.js.map} +0 -0
  48. /package/dist/{chunk-3U7AWFBN.js.map → chunk-TZBDXZFC.js.map} +0 -0
package/dist/client.d.ts CHANGED
@@ -3,7 +3,7 @@ import './tools/fastapply/core.js';
3
3
  import './tools/codebase_search/core.js';
4
4
  import './tools/browser/core.js';
5
5
  import './tools/warp_grep/client.js';
6
- export { M as MorphClient, a as MorphClientConfig } from './client-Bm_umdno.js';
6
+ export { M as MorphClient, a as MorphClientConfig } from './client-D7iO2TbA.js';
7
7
  import './git/client.js';
8
8
  import './modelrouter/core.js';
9
9
  import './tools/fastapply/types.js';
package/dist/client.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  MorphClient
3
- } from "./chunk-3U7AWFBN.js";
4
- import "./chunk-FL4ZBHK2.js";
5
- import "./chunk-HI35Y6EZ.js";
6
- import "./chunk-ALTKGCG5.js";
3
+ } from "./chunk-TZBDXZFC.js";
4
+ import "./chunk-GQUNK324.js";
5
+ import "./chunk-SYZ75S3S.js";
6
+ import "./chunk-CM75JPVD.js";
7
7
  import "./chunk-KW7OEGZK.js";
8
- import "./chunk-23R562QJ.js";
9
- import "./chunk-YY7NZLAI.js";
8
+ import "./chunk-NTDAIKZI.js";
9
+ import "./chunk-RBTL6EJG.js";
10
10
  import "./chunk-PUGSTXLO.js";
11
11
  import "./chunk-3MLWXJTJ.js";
12
12
  import "./chunk-SNGGSPYJ.js";
package/dist/index.cjs CHANGED
@@ -3082,17 +3082,21 @@ async function runWarpGrep(config) {
3082
3082
  retryConfig: config.retryConfig,
3083
3083
  timeout: timeoutMs
3084
3084
  }).catch((e) => {
3085
- errors.push({ message: e instanceof Error ? e.message : String(e) });
3085
+ const errMsg = e instanceof Error ? e.message : String(e);
3086
+ console.error(`[warp_grep] Morph API call failed on turn ${turn}:`, errMsg);
3087
+ errors.push({ message: errMsg });
3086
3088
  return "";
3087
3089
  });
3088
3090
  turnMetrics.morph_api_ms = Date.now() - modelCallStart;
3089
3091
  if (!assistantContent) {
3092
+ console.error(`[warp_grep] Empty response from Morph API on turn ${turn}. Errors so far:`, errors);
3090
3093
  timings.turns.push(turnMetrics);
3091
3094
  break;
3092
3095
  }
3093
3096
  messages.push({ role: "assistant", content: assistantContent });
3094
3097
  const toolCalls = parser.parse(assistantContent);
3095
3098
  if (toolCalls.length === 0) {
3099
+ console.error(`[warp_grep] No tool calls parsed on turn ${turn}. Assistant content (first 500 chars):`, assistantContent.slice(0, 500));
3096
3100
  errors.push({ message: "No tool calls produced by the model. Your MCP is likely out of date! Update it by running: rm -rf ~/.npm/_npx && npm cache clean --force && npx -y @morphllm/morphmcp@latest" });
3097
3101
  terminationReason = "terminated";
3098
3102
  timings.turns.push(turnMetrics);
@@ -3225,17 +3229,21 @@ async function* runWarpGrepStreaming(config) {
3225
3229
  retryConfig: config.retryConfig,
3226
3230
  timeout: timeoutMs
3227
3231
  }).catch((e) => {
3228
- errors.push({ message: e instanceof Error ? e.message : String(e) });
3232
+ const errMsg = e instanceof Error ? e.message : String(e);
3233
+ console.error(`[warp_grep:stream] Morph API call failed on turn ${turn}:`, errMsg);
3234
+ errors.push({ message: errMsg });
3229
3235
  return "";
3230
3236
  });
3231
3237
  turnMetrics.morph_api_ms = Date.now() - modelCallStart;
3232
3238
  if (!assistantContent) {
3239
+ console.error(`[warp_grep:stream] Empty response from Morph API on turn ${turn}. Errors so far:`, errors);
3233
3240
  timings.turns.push(turnMetrics);
3234
3241
  break;
3235
3242
  }
3236
3243
  messages.push({ role: "assistant", content: assistantContent });
3237
3244
  const toolCalls = parser.parse(assistantContent);
3238
3245
  if (toolCalls.length === 0) {
3246
+ console.error(`[warp_grep:stream] No tool calls parsed on turn ${turn}. Assistant content (first 500 chars):`, assistantContent.slice(0, 500));
3239
3247
  errors.push({ message: "No tool calls produced by the model. Your MCP is likely out of date! Update it by running: rm -rf ~/.npm/_npx && npm cache clean --force && npx -y @morphllm/morphmcp@latest" });
3240
3248
  terminationReason = "terminated";
3241
3249
  timings.turns.push(turnMetrics);
@@ -3582,7 +3590,9 @@ async function executeToolCall(input, config) {
3582
3590
  });
3583
3591
  const finish = result.finish;
3584
3592
  if (result.terminationReason !== "completed" || !finish?.metadata) {
3585
- return { success: false, error: "Search did not complete" };
3593
+ const errorDetails = result.errors?.map((e) => e.message).join("; ") || "unknown reason";
3594
+ console.error(`[warp_grep] executeToolCall failed. Reason: ${result.terminationReason}. Errors: ${errorDetails}. Turns: ${result.timings?.turns?.length ?? 0}`);
3595
+ return { success: false, error: `Search did not complete: ${errorDetails}` };
3586
3596
  }
3587
3597
  const contexts = (finish.resolved ?? []).map((r) => ({
3588
3598
  file: r.path,
@@ -3594,7 +3604,9 @@ async function executeToolCall(input, config) {
3594
3604
  function processAgentResult(result) {
3595
3605
  const finish = result.finish;
3596
3606
  if (result.terminationReason !== "completed" || !finish?.metadata) {
3597
- return { success: false, error: "Search did not complete" };
3607
+ const errorDetails = result.errors?.map((e) => e.message).join("; ") || "unknown reason";
3608
+ console.error(`[warp_grep] processAgentResult failed. Reason: ${result.terminationReason}. Errors: ${errorDetails}. Turns: ${result.timings?.turns?.length ?? 0}`);
3609
+ return { success: false, error: `Search did not complete: ${errorDetails}` };
3598
3610
  }
3599
3611
  const contexts = (finish.resolved ?? []).map((r) => ({
3600
3612
  file: r.path,
@@ -5227,14 +5239,26 @@ function createWarpGrepTool3(config) {
5227
5239
  description: config.description ?? WARP_GREP_DESCRIPTION,
5228
5240
  inputSchema: schema,
5229
5241
  execute: async (params) => {
5230
- const result = await executeToolCall(params, config);
5242
+ const steps = [];
5243
+ const generator = executeToolCallStreaming(params, config);
5244
+ let result;
5245
+ for (; ; ) {
5246
+ const { value, done } = await generator.next();
5247
+ if (done) {
5248
+ result = value;
5249
+ break;
5250
+ }
5251
+ steps.push(value);
5252
+ }
5231
5253
  if (!result.success) {
5232
5254
  throw new Error(`Failed to search codebase: ${result.error}`);
5233
5255
  }
5256
+ const allToolCalls = steps.flatMap((s) => s.toolCalls);
5234
5257
  return {
5235
5258
  success: true,
5236
5259
  contexts: result.contexts,
5237
- summary: result.summary
5260
+ summary: result.summary,
5261
+ progress: allToolCalls.length > 0 ? { turn: steps.length, toolCalls: allToolCalls } : void 0
5238
5262
  };
5239
5263
  }
5240
5264
  });