@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 CHANGED
@@ -5311,9 +5311,10 @@ exports.EventProcessor = class _EventProcessor {
5311
5311
  ].filter((b) => b.type === "tool_use");
5312
5312
  const block = (data.id ? blocks.find((b) => b.id === data.id) : void 0) ?? [
5313
5313
  ...blocks
5314
- ].reverse().find((b) => b.name === data.name && !b.label);
5314
+ ].reverse().find((b) => b.name === data.name && !b.labelled);
5315
5315
  if (!block) return;
5316
5316
  block.label = String(data.label);
5317
+ block.labelled = true;
5317
5318
  this.sendDelta(channel, {
5318
5319
  type: "tool_label",
5319
5320
  stepId: block.id,
@@ -5442,20 +5443,24 @@ exports.EventProcessor = class _EventProcessor {
5442
5443
  /**
5443
5444
  * Process content stream blocks (universal for all channels)
5444
5445
  */
5445
- processContentStream(acc, channel, blocks, onPartial) {
5446
+ processContentStream(acc, channel, blocks, onPartial, titles) {
5446
5447
  const state = acc.channels.get(channel);
5447
5448
  for (const block of blocks) {
5448
5449
  if (block.type === "tool_use" || block.type === "tool_call") {
5449
5450
  if (state.currentBlock) {
5450
5451
  state.contentChain.push(state.currentBlock);
5451
5452
  }
5453
+ const title = titles?.[String(block.name)];
5452
5454
  state.currentBlock = {
5453
5455
  index: state.contentChain.length,
5454
5456
  type: "tool_use",
5455
5457
  name: block.name,
5456
5458
  id: block.id,
5457
5459
  input: block.input || "",
5458
- output: ""
5460
+ output: "",
5461
+ ...typeof title === "string" && title ? {
5462
+ label: title
5463
+ } : {}
5459
5464
  };
5460
5465
  state.pendingToolBlocks.push(state.currentBlock);
5461
5466
  this.sendDelta(channel, {
@@ -5615,7 +5620,7 @@ exports.EventProcessor = class _EventProcessor {
5615
5620
  blocks.push(...this.toolCallChunksToBlocks(chunk.tool_call_chunks));
5616
5621
  }
5617
5622
  if (blocks.length > 0) {
5618
- this.processContentStream(acc, channel, blocks, onPartial);
5623
+ this.processContentStream(acc, channel, blocks, onPartial, event.metadata?.tool_titles);
5619
5624
  }
5620
5625
  return;
5621
5626
  }