@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.cjs
CHANGED
|
@@ -291,9 +291,86 @@ function collapseOpenAISSE(rawBody) {
|
|
|
291
291
|
continue;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
if (item?.type === "function_call" && typeof parsed.output_index === "number") {
|
|
295
|
+
const entry = toolCallMap.get(parsed.output_index);
|
|
296
|
+
if (entry) {
|
|
297
|
+
if (!entry.id && typeof item.call_id === "string") entry.id = item.call_id;
|
|
298
|
+
if (!entry.name && typeof item.name === "string") entry.name = item.name;
|
|
299
|
+
if (entry.arguments === "" && typeof item.arguments === "string") entry.arguments = item.arguments;
|
|
300
|
+
} else {
|
|
301
|
+
const created = {
|
|
302
|
+
id: typeof item.call_id === "string" ? item.call_id : "",
|
|
303
|
+
name: typeof item.name === "string" ? item.name : "",
|
|
304
|
+
arguments: typeof item.arguments === "string" ? item.arguments : ""
|
|
305
|
+
};
|
|
306
|
+
toolCallMap.set(parsed.output_index, created);
|
|
307
|
+
orderAtoms.push({
|
|
308
|
+
kind: "toolCall",
|
|
309
|
+
ref: created
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (parsed.type === "response.output_item.added") {
|
|
316
|
+
const item = parsed.item;
|
|
317
|
+
if (item?.type === "function_call" && typeof parsed.output_index === "number") {
|
|
318
|
+
if (!toolCallMap.has(parsed.output_index)) {
|
|
319
|
+
const created = {
|
|
320
|
+
id: typeof item.call_id === "string" ? item.call_id : "",
|
|
321
|
+
name: typeof item.name === "string" ? item.name : "",
|
|
322
|
+
arguments: ""
|
|
323
|
+
};
|
|
324
|
+
toolCallMap.set(parsed.output_index, created);
|
|
325
|
+
orderAtoms.push({
|
|
326
|
+
kind: "toolCall",
|
|
327
|
+
ref: created
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (parsed.type === "response.function_call_arguments.delta" && typeof parsed.delta === "string" && typeof parsed.output_index === "number") {
|
|
334
|
+
let entry = toolCallMap.get(parsed.output_index);
|
|
335
|
+
if (!entry) {
|
|
336
|
+
entry = {
|
|
337
|
+
id: "",
|
|
338
|
+
name: "",
|
|
339
|
+
arguments: ""
|
|
340
|
+
};
|
|
341
|
+
toolCallMap.set(parsed.output_index, entry);
|
|
342
|
+
orderAtoms.push({
|
|
343
|
+
kind: "toolCall",
|
|
344
|
+
ref: entry
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
entry.arguments += parsed.delta;
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (parsed.type === "response.function_call_arguments.done" && typeof parsed.output_index === "number") {
|
|
351
|
+
const entry = toolCallMap.get(parsed.output_index);
|
|
352
|
+
if (entry) {
|
|
353
|
+
if (entry.arguments === "" && typeof parsed.arguments === "string") entry.arguments = parsed.arguments;
|
|
354
|
+
} else if (typeof parsed.arguments === "string") {
|
|
355
|
+
const created = {
|
|
356
|
+
id: "",
|
|
357
|
+
name: "",
|
|
358
|
+
arguments: parsed.arguments
|
|
359
|
+
};
|
|
360
|
+
toolCallMap.set(parsed.output_index, created);
|
|
361
|
+
orderAtoms.push({
|
|
362
|
+
kind: "toolCall",
|
|
363
|
+
ref: created
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
continue;
|
|
294
367
|
}
|
|
295
368
|
if (parsed.type === "response.output_text.delta" && typeof parsed.delta === "string") {
|
|
296
369
|
content += parsed.delta;
|
|
370
|
+
if (parsed.delta.length > 0) orderAtoms.push({
|
|
371
|
+
kind: "text",
|
|
372
|
+
text: parsed.delta
|
|
373
|
+
});
|
|
297
374
|
continue;
|
|
298
375
|
}
|
|
299
376
|
if (typeof parsed.type === "string" && parsed.type.startsWith("response.")) continue;
|