@mcp-use/agent 2.0.24 → 2.0.25-canary.1
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
|
@@ -2163,12 +2163,15 @@ async function* streamResponsesTurn(params) {
|
|
|
2163
2163
|
const callId = typeof item.call_id === "string" ? item.call_id : `call_${nextIndex}`;
|
|
2164
2164
|
const name = typeof item.name === "string" ? item.name : "";
|
|
2165
2165
|
const idx = nextIndex++;
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2166
|
+
if (typeof item.id === "string") {
|
|
2167
|
+
callBuffers.set(item.id, {
|
|
2168
|
+
index: idx,
|
|
2169
|
+
callId,
|
|
2170
|
+
name,
|
|
2171
|
+
argsJson: "",
|
|
2172
|
+
started: true
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2172
2175
|
yield {
|
|
2173
2176
|
type: "tool-call-start",
|
|
2174
2177
|
index: idx,
|
|
@@ -2179,15 +2182,15 @@ async function* streamResponsesTurn(params) {
|
|
|
2179
2182
|
continue;
|
|
2180
2183
|
}
|
|
2181
2184
|
if (type === "response.function_call_arguments.delta") {
|
|
2182
|
-
const
|
|
2185
|
+
const itemId = typeof parsed.item_id === "string" ? parsed.item_id : "";
|
|
2183
2186
|
const delta = typeof parsed.delta === "string" ? parsed.delta : "";
|
|
2184
|
-
const buf = callBuffers.get(
|
|
2187
|
+
const buf = callBuffers.get(itemId);
|
|
2185
2188
|
if (buf && delta.length > 0) {
|
|
2186
2189
|
buf.argsJson += delta;
|
|
2187
2190
|
yield {
|
|
2188
2191
|
type: "tool-call-args-delta",
|
|
2189
2192
|
index: buf.index,
|
|
2190
|
-
toolCallId: callId,
|
|
2193
|
+
toolCallId: buf.callId,
|
|
2191
2194
|
toolName: buf.name,
|
|
2192
2195
|
argsDelta: delta
|
|
2193
2196
|
};
|
|
@@ -2195,15 +2198,15 @@ async function* streamResponsesTurn(params) {
|
|
|
2195
2198
|
continue;
|
|
2196
2199
|
}
|
|
2197
2200
|
if (type === "response.function_call_arguments.done") {
|
|
2198
|
-
const
|
|
2201
|
+
const itemId = typeof parsed.item_id === "string" ? parsed.item_id : "";
|
|
2199
2202
|
const argsRaw = typeof parsed.arguments === "string" ? parsed.arguments : "";
|
|
2200
|
-
const buf = callBuffers.get(
|
|
2203
|
+
const buf = callBuffers.get(itemId);
|
|
2201
2204
|
if (buf) {
|
|
2202
2205
|
if (argsRaw) buf.argsJson = argsRaw;
|
|
2203
2206
|
yield {
|
|
2204
2207
|
type: "tool-call-ready",
|
|
2205
2208
|
index: buf.index,
|
|
2206
|
-
toolCallId: callId,
|
|
2209
|
+
toolCallId: buf.callId,
|
|
2207
2210
|
toolName: buf.name,
|
|
2208
2211
|
args: parseArgs(buf.argsJson || argsRaw)
|
|
2209
2212
|
};
|
|
@@ -2587,11 +2590,14 @@ async function* streamNativeAgent(driver, options) {
|
|
|
2587
2590
|
});
|
|
2588
2591
|
}
|
|
2589
2592
|
async function* streamNativeAgentSteps(driver, options) {
|
|
2590
|
-
let
|
|
2593
|
+
let turnText = "";
|
|
2594
|
+
let turnRequestedTools = false;
|
|
2591
2595
|
const pendingSteps = /* @__PURE__ */ new Map();
|
|
2592
2596
|
for await (const ev of streamNativeAgent(driver, options)) {
|
|
2593
2597
|
if (ev.type === "text-delta") {
|
|
2594
|
-
|
|
2598
|
+
turnText += ev.delta;
|
|
2599
|
+
} else if (ev.type === "tool-call-start") {
|
|
2600
|
+
turnRequestedTools = true;
|
|
2595
2601
|
} else if (ev.type === "tool-call-ready") {
|
|
2596
2602
|
const pendingStep = {
|
|
2597
2603
|
action: {
|
|
@@ -2604,6 +2610,8 @@ async function* streamNativeAgentSteps(driver, options) {
|
|
|
2604
2610
|
pendingSteps.set(ev.toolCallId, pendingStep);
|
|
2605
2611
|
yield pendingStep;
|
|
2606
2612
|
} else if (ev.type === "tool-result") {
|
|
2613
|
+
turnText = "";
|
|
2614
|
+
turnRequestedTools = false;
|
|
2607
2615
|
const pendingStep = pendingSteps.get(ev.toolCallId);
|
|
2608
2616
|
if (!pendingStep) continue;
|
|
2609
2617
|
const observation = typeof ev.result === "string" ? ev.result : JSON.stringify(ev.result ?? "");
|
|
@@ -2616,7 +2624,7 @@ async function* streamNativeAgentSteps(driver, options) {
|
|
|
2616
2624
|
throw new Error(ev.message);
|
|
2617
2625
|
}
|
|
2618
2626
|
}
|
|
2619
|
-
return
|
|
2627
|
+
return turnRequestedTools ? "" : turnText;
|
|
2620
2628
|
}
|
|
2621
2629
|
async function runNativeAgent(driver, options) {
|
|
2622
2630
|
const result = await runToolLoopNonStreaming({
|
|
@@ -2703,7 +2711,7 @@ function providerConfigFromOptions(provider, model, config) {
|
|
|
2703
2711
|
}
|
|
2704
2712
|
|
|
2705
2713
|
// src/version.ts
|
|
2706
|
-
var VERSION = "2.0.
|
|
2714
|
+
var VERSION = "2.0.25-canary.1";
|
|
2707
2715
|
function getPackageVersion() {
|
|
2708
2716
|
return VERSION;
|
|
2709
2717
|
}
|