@dbx-tools/genie 0.1.25 → 0.1.26

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/src/chat.js CHANGED
@@ -185,8 +185,25 @@ export async function* genieEventChat(space_id, content, options) {
185
185
  // as the grouping key for every event in this turn). The first
186
186
  // snapshot is the earliest point that id exists.
187
187
  let questionEmitted = false;
188
- for await (const message of genieChat(space_id, content, options)) {
189
- yield { type: "message", message };
188
+ for await (const rawMessage of genieChat(space_id, content, options)) {
189
+ // Normalize `message_id` from the legacy `id` field when Genie's
190
+ // wire response only populates one of them. The SDK schema marks
191
+ // both as required, but in practice the `startConversation` /
192
+ // `createMessage` inner `message` payload sometimes ships only
193
+ // `id` while the new `message_id` field lands undefined. Every
194
+ // downstream event detector keys grouping off `message_id`; the
195
+ // fallback keeps one Genie turn's events from splitting across
196
+ // an anon group + the real-id group when subscribers bucket by
197
+ // `message_id` (see `summarizeProgress` in the demo UI).
198
+ const message = rawMessage.message_id
199
+ ? rawMessage
200
+ : { ...rawMessage, message_id: rawMessage.id };
201
+ yield {
202
+ type: "message",
203
+ space_id: message.space_id,
204
+ message_id: message.message_id,
205
+ message,
206
+ };
190
207
  if (!questionEmitted) {
191
208
  yield {
192
209
  type: "question",