@openrouter/ai-sdk-provider 1.0.0-beta.5 → 1.0.0-beta.6

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.
@@ -1550,21 +1550,6 @@ var OpenRouterChatLanguageModel = class {
1550
1550
  return;
1551
1551
  }
1552
1552
  const delta = choice.delta;
1553
- if (delta.content != null) {
1554
- if (!textStarted) {
1555
- textId = openrouterResponseId || generateId();
1556
- controller.enqueue({
1557
- type: "text-start",
1558
- id: textId
1559
- });
1560
- textStarted = true;
1561
- }
1562
- controller.enqueue({
1563
- type: "text-delta",
1564
- delta: delta.content,
1565
- id: textId || generateId()
1566
- });
1567
- }
1568
1553
  const emitReasoningChunk = (chunkText) => {
1569
1554
  if (!reasoningStarted) {
1570
1555
  reasoningId = openrouterResponseId || generateId();
@@ -1580,9 +1565,6 @@ var OpenRouterChatLanguageModel = class {
1580
1565
  id: reasoningId || generateId()
1581
1566
  });
1582
1567
  };
1583
- if (delta.reasoning != null) {
1584
- emitReasoningChunk(delta.reasoning);
1585
- }
1586
1568
  if (delta.reasoning_details && delta.reasoning_details.length > 0) {
1587
1569
  for (const detail of delta.reasoning_details) {
1588
1570
  switch (detail.type) {
@@ -1610,6 +1592,23 @@ var OpenRouterChatLanguageModel = class {
1610
1592
  }
1611
1593
  }
1612
1594
  }
1595
+ } else if (delta.reasoning != null) {
1596
+ emitReasoningChunk(delta.reasoning);
1597
+ }
1598
+ if (delta.content != null) {
1599
+ if (!textStarted) {
1600
+ textId = openrouterResponseId || generateId();
1601
+ controller.enqueue({
1602
+ type: "text-start",
1603
+ id: textId
1604
+ });
1605
+ textStarted = true;
1606
+ }
1607
+ controller.enqueue({
1608
+ type: "text-delta",
1609
+ delta: delta.content,
1610
+ id: textId || generateId()
1611
+ });
1613
1612
  }
1614
1613
  if (delta.tool_calls != null) {
1615
1614
  for (const toolCallDelta of delta.tool_calls) {
@@ -1709,7 +1708,7 @@ var OpenRouterChatLanguageModel = class {
1709
1708
  var _a16;
1710
1709
  if (finishReason === "tool-calls") {
1711
1710
  for (const toolCall of toolCalls) {
1712
- if (!toolCall.sent) {
1711
+ if (toolCall && !toolCall.sent) {
1713
1712
  controller.enqueue({
1714
1713
  type: "tool-call",
1715
1714
  toolCallId: (_a16 = toolCall.id) != null ? _a16 : generateId(),