@flutchai/flutch-sdk 0.7.13 → 0.7.14
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.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5281,9 +5281,10 @@ var EventProcessor = class _EventProcessor {
|
|
|
5281
5281
|
].filter((b) => b.type === "tool_use");
|
|
5282
5282
|
const block = (data.id ? blocks.find((b) => b.id === data.id) : void 0) ?? [
|
|
5283
5283
|
...blocks
|
|
5284
|
-
].reverse().find((b) => b.name === data.name && !b.
|
|
5284
|
+
].reverse().find((b) => b.name === data.name && !b.labelled);
|
|
5285
5285
|
if (!block) return;
|
|
5286
5286
|
block.label = String(data.label);
|
|
5287
|
+
block.labelled = true;
|
|
5287
5288
|
this.sendDelta(channel, {
|
|
5288
5289
|
type: "tool_label",
|
|
5289
5290
|
stepId: block.id,
|
|
@@ -5412,20 +5413,24 @@ var EventProcessor = class _EventProcessor {
|
|
|
5412
5413
|
/**
|
|
5413
5414
|
* Process content stream blocks (universal for all channels)
|
|
5414
5415
|
*/
|
|
5415
|
-
processContentStream(acc, channel, blocks, onPartial) {
|
|
5416
|
+
processContentStream(acc, channel, blocks, onPartial, titles) {
|
|
5416
5417
|
const state = acc.channels.get(channel);
|
|
5417
5418
|
for (const block of blocks) {
|
|
5418
5419
|
if (block.type === "tool_use" || block.type === "tool_call") {
|
|
5419
5420
|
if (state.currentBlock) {
|
|
5420
5421
|
state.contentChain.push(state.currentBlock);
|
|
5421
5422
|
}
|
|
5423
|
+
const title = titles?.[String(block.name)];
|
|
5422
5424
|
state.currentBlock = {
|
|
5423
5425
|
index: state.contentChain.length,
|
|
5424
5426
|
type: "tool_use",
|
|
5425
5427
|
name: block.name,
|
|
5426
5428
|
id: block.id,
|
|
5427
5429
|
input: block.input || "",
|
|
5428
|
-
output: ""
|
|
5430
|
+
output: "",
|
|
5431
|
+
...typeof title === "string" && title ? {
|
|
5432
|
+
label: title
|
|
5433
|
+
} : {}
|
|
5429
5434
|
};
|
|
5430
5435
|
state.pendingToolBlocks.push(state.currentBlock);
|
|
5431
5436
|
this.sendDelta(channel, {
|
|
@@ -5585,7 +5590,7 @@ var EventProcessor = class _EventProcessor {
|
|
|
5585
5590
|
blocks.push(...this.toolCallChunksToBlocks(chunk.tool_call_chunks));
|
|
5586
5591
|
}
|
|
5587
5592
|
if (blocks.length > 0) {
|
|
5588
|
-
this.processContentStream(acc, channel, blocks, onPartial);
|
|
5593
|
+
this.processContentStream(acc, channel, blocks, onPartial, event.metadata?.tool_titles);
|
|
5589
5594
|
}
|
|
5590
5595
|
return;
|
|
5591
5596
|
}
|