ai-sdk-provider-claude-code 3.4.3 → 3.4.4

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
@@ -1794,11 +1794,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
1794
1794
  const toolName = typeof toolBlock.name === "string" && toolBlock.name.length > 0 ? toolBlock.name : _ClaudeCodeLanguageModel.UNKNOWN_TOOL_NAME;
1795
1795
  hasReceivedStreamEvents = true;
1796
1796
  if (textPartId) {
1797
+ const closedTextId = textPartId;
1797
1798
  controller.enqueue({
1798
1799
  type: "text-end",
1799
- id: textPartId
1800
+ id: closedTextId
1800
1801
  });
1801
1802
  textPartId = void 0;
1803
+ for (const [idx, blockTextId] of textBlocksByIndex) {
1804
+ if (blockTextId === closedTextId) {
1805
+ textBlocksByIndex.delete(idx);
1806
+ break;
1807
+ }
1808
+ }
1802
1809
  }
1803
1810
  toolBlocksByIndex.set(blockIndex, toolId);
1804
1811
  toolInputAccumulators.set(toolId, "");
@@ -1857,11 +1864,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
1857
1864
  const blockIndex = "index" in event ? event.index : -1;
1858
1865
  hasReceivedStreamEvents = true;
1859
1866
  if (textPartId) {
1867
+ const closedTextId = textPartId;
1860
1868
  controller.enqueue({
1861
1869
  type: "text-end",
1862
- id: textPartId
1870
+ id: closedTextId
1863
1871
  });
1864
1872
  textPartId = void 0;
1873
+ for (const [idx, blockTextId] of textBlocksByIndex) {
1874
+ if (blockTextId === closedTextId) {
1875
+ textBlocksByIndex.delete(idx);
1876
+ break;
1877
+ }
1878
+ }
1865
1879
  }
1866
1880
  const reasoningPartId = generateId();
1867
1881
  reasoningBlocksByIndex.set(blockIndex, reasoningPartId);
@@ -1972,11 +1986,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
1972
1986
  const content = message.message.content;
1973
1987
  const tools = this.extractToolUses(content);
1974
1988
  if (textPartId && tools.length > 0) {
1989
+ const closedTextId = textPartId;
1975
1990
  controller.enqueue({
1976
1991
  type: "text-end",
1977
- id: textPartId
1992
+ id: closedTextId
1978
1993
  });
1979
1994
  textPartId = void 0;
1995
+ for (const [idx, blockTextId] of textBlocksByIndex) {
1996
+ if (blockTextId === closedTextId) {
1997
+ textBlocksByIndex.delete(idx);
1998
+ break;
1999
+ }
2000
+ }
1980
2001
  }
1981
2002
  for (const tool3 of tools) {
1982
2003
  const toolId = tool3.id;