@mcp-use/agent 2.0.25-canary.0 → 2.0.25-canary.2

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/index.js CHANGED
@@ -2590,11 +2590,14 @@ async function* streamNativeAgent(driver, options) {
2590
2590
  });
2591
2591
  }
2592
2592
  async function* streamNativeAgentSteps(driver, options) {
2593
- let finalText = "";
2593
+ let turnText = "";
2594
+ let turnRequestedTools = false;
2594
2595
  const pendingSteps = /* @__PURE__ */ new Map();
2595
2596
  for await (const ev of streamNativeAgent(driver, options)) {
2596
2597
  if (ev.type === "text-delta") {
2597
- finalText += ev.delta;
2598
+ turnText += ev.delta;
2599
+ } else if (ev.type === "tool-call-start") {
2600
+ turnRequestedTools = true;
2598
2601
  } else if (ev.type === "tool-call-ready") {
2599
2602
  const pendingStep = {
2600
2603
  action: {
@@ -2607,6 +2610,8 @@ async function* streamNativeAgentSteps(driver, options) {
2607
2610
  pendingSteps.set(ev.toolCallId, pendingStep);
2608
2611
  yield pendingStep;
2609
2612
  } else if (ev.type === "tool-result") {
2613
+ turnText = "";
2614
+ turnRequestedTools = false;
2610
2615
  const pendingStep = pendingSteps.get(ev.toolCallId);
2611
2616
  if (!pendingStep) continue;
2612
2617
  const observation = typeof ev.result === "string" ? ev.result : JSON.stringify(ev.result ?? "");
@@ -2619,7 +2624,7 @@ async function* streamNativeAgentSteps(driver, options) {
2619
2624
  throw new Error(ev.message);
2620
2625
  }
2621
2626
  }
2622
- return finalText;
2627
+ return turnRequestedTools ? "" : turnText;
2623
2628
  }
2624
2629
  async function runNativeAgent(driver, options) {
2625
2630
  const result = await runToolLoopNonStreaming({
@@ -2706,7 +2711,7 @@ function providerConfigFromOptions(provider, model, config) {
2706
2711
  }
2707
2712
 
2708
2713
  // src/version.ts
2709
- var VERSION = "2.0.25-canary.0";
2714
+ var VERSION = "2.0.25-canary.2";
2710
2715
  function getPackageVersion() {
2711
2716
  return VERSION;
2712
2717
  }