@zenmux/rosetta-ai 0.17.0 → 0.18.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.
@@ -230,8 +230,11 @@ class MessagesToChatCompletionConverter {
230
230
  state.id = chunk.id;
231
231
  state.model = chunk.model;
232
232
  const delta = choice.delta;
233
- // First chunk with role - emit message_start
234
- if (!state.messageStarted && delta.role === "assistant") {
233
+ // Emit message_start on the first chunk that carries a choice. Do not gate
234
+ // on delta.role === "assistant": some OpenAI-compatible providers omit role
235
+ // on the first delta (or send it late), and gating would yield content
236
+ // blocks with no preceding message_start, producing a malformed stream.
237
+ if (!state.messageStarted) {
235
238
  state.messageStarted = true;
236
239
  events.push({
237
240
  type: "message_start",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenmux/rosetta-ai",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Universal translator between AI provider protocols",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",