@copilotkit/aimock 1.38.0 → 1.39.0
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +23 -2
- package/dist/agui-handler.cjs +20 -18
- package/dist/agui-handler.cjs.map +1 -1
- package/dist/agui-handler.d.cts +8 -1
- package/dist/agui-handler.d.cts.map +1 -1
- package/dist/agui-handler.d.ts +8 -1
- package/dist/agui-handler.d.ts.map +1 -1
- package/dist/agui-handler.js +20 -18
- package/dist/agui-handler.js.map +1 -1
- package/dist/agui-stub.d.cts +2 -2
- package/dist/agui-stub.d.ts +2 -2
- package/dist/agui-types.d.cts +19 -1
- package/dist/agui-types.d.cts.map +1 -1
- package/dist/agui-types.d.ts +19 -1
- package/dist/agui-types.d.ts.map +1 -1
- package/dist/aimock-cli.cjs +1 -1
- package/dist/aimock-cli.cjs.map +1 -1
- package/dist/aimock-cli.js +1 -1
- package/dist/aimock-cli.js.map +1 -1
- package/dist/cli.cjs +10 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +10 -10
- package/dist/cli.js.map +1 -1
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/llmock.cjs +23 -9
- package/dist/llmock.cjs.map +1 -1
- package/dist/llmock.d.cts +22 -0
- package/dist/llmock.d.cts.map +1 -1
- package/dist/llmock.d.ts +22 -0
- package/dist/llmock.d.ts.map +1 -1
- package/dist/llmock.js +25 -11
- package/dist/llmock.js.map +1 -1
- package/dist/openrouter-video.cjs.map +1 -1
- package/dist/openrouter-video.js.map +1 -1
- package/dist/server.cjs +34 -17
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +6 -1
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +6 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +34 -18
- package/dist/server.js.map +1 -1
- package/dist/stream-collapse.cjs +77 -0
- package/dist/stream-collapse.cjs.map +1 -1
- package/dist/stream-collapse.d.cts.map +1 -1
- package/dist/stream-collapse.d.ts.map +1 -1
- package/dist/stream-collapse.js +77 -0
- package/dist/stream-collapse.js.map +1 -1
- package/dist/vector-types.d.ts.map +1 -1
- package/dist/ws-gemini-live.cjs +41 -6
- package/dist/ws-gemini-live.cjs.map +1 -1
- package/dist/ws-gemini-live.js +41 -6
- package/dist/ws-gemini-live.js.map +1 -1
- package/package.json +3 -2
package/dist/stream-collapse.js
CHANGED
|
@@ -290,9 +290,86 @@ function collapseOpenAISSE(rawBody) {
|
|
|
290
290
|
continue;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
+
if (item?.type === "function_call" && typeof parsed.output_index === "number") {
|
|
294
|
+
const entry = toolCallMap.get(parsed.output_index);
|
|
295
|
+
if (entry) {
|
|
296
|
+
if (!entry.id && typeof item.call_id === "string") entry.id = item.call_id;
|
|
297
|
+
if (!entry.name && typeof item.name === "string") entry.name = item.name;
|
|
298
|
+
if (entry.arguments === "" && typeof item.arguments === "string") entry.arguments = item.arguments;
|
|
299
|
+
} else {
|
|
300
|
+
const created = {
|
|
301
|
+
id: typeof item.call_id === "string" ? item.call_id : "",
|
|
302
|
+
name: typeof item.name === "string" ? item.name : "",
|
|
303
|
+
arguments: typeof item.arguments === "string" ? item.arguments : ""
|
|
304
|
+
};
|
|
305
|
+
toolCallMap.set(parsed.output_index, created);
|
|
306
|
+
orderAtoms.push({
|
|
307
|
+
kind: "toolCall",
|
|
308
|
+
ref: created
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (parsed.type === "response.output_item.added") {
|
|
315
|
+
const item = parsed.item;
|
|
316
|
+
if (item?.type === "function_call" && typeof parsed.output_index === "number") {
|
|
317
|
+
if (!toolCallMap.has(parsed.output_index)) {
|
|
318
|
+
const created = {
|
|
319
|
+
id: typeof item.call_id === "string" ? item.call_id : "",
|
|
320
|
+
name: typeof item.name === "string" ? item.name : "",
|
|
321
|
+
arguments: ""
|
|
322
|
+
};
|
|
323
|
+
toolCallMap.set(parsed.output_index, created);
|
|
324
|
+
orderAtoms.push({
|
|
325
|
+
kind: "toolCall",
|
|
326
|
+
ref: created
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (parsed.type === "response.function_call_arguments.delta" && typeof parsed.delta === "string" && typeof parsed.output_index === "number") {
|
|
333
|
+
let entry = toolCallMap.get(parsed.output_index);
|
|
334
|
+
if (!entry) {
|
|
335
|
+
entry = {
|
|
336
|
+
id: "",
|
|
337
|
+
name: "",
|
|
338
|
+
arguments: ""
|
|
339
|
+
};
|
|
340
|
+
toolCallMap.set(parsed.output_index, entry);
|
|
341
|
+
orderAtoms.push({
|
|
342
|
+
kind: "toolCall",
|
|
343
|
+
ref: entry
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
entry.arguments += parsed.delta;
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
if (parsed.type === "response.function_call_arguments.done" && typeof parsed.output_index === "number") {
|
|
350
|
+
const entry = toolCallMap.get(parsed.output_index);
|
|
351
|
+
if (entry) {
|
|
352
|
+
if (entry.arguments === "" && typeof parsed.arguments === "string") entry.arguments = parsed.arguments;
|
|
353
|
+
} else if (typeof parsed.arguments === "string") {
|
|
354
|
+
const created = {
|
|
355
|
+
id: "",
|
|
356
|
+
name: "",
|
|
357
|
+
arguments: parsed.arguments
|
|
358
|
+
};
|
|
359
|
+
toolCallMap.set(parsed.output_index, created);
|
|
360
|
+
orderAtoms.push({
|
|
361
|
+
kind: "toolCall",
|
|
362
|
+
ref: created
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
continue;
|
|
293
366
|
}
|
|
294
367
|
if (parsed.type === "response.output_text.delta" && typeof parsed.delta === "string") {
|
|
295
368
|
content += parsed.delta;
|
|
369
|
+
if (parsed.delta.length > 0) orderAtoms.push({
|
|
370
|
+
kind: "text",
|
|
371
|
+
text: parsed.delta
|
|
372
|
+
});
|
|
296
373
|
continue;
|
|
297
374
|
}
|
|
298
375
|
if (typeof parsed.type === "string" && parsed.type.startsWith("response.")) continue;
|