@eshal-bot/chat-widget 0.1.99 → 0.1.100

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.
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-BHNeh4MK.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-BOARafNH.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -7880,6 +7880,13 @@
7880
7880
  TEXT_CHUNK: 'text_chunk',
7881
7881
  PROCESSING_END: 'processing_end',
7882
7882
  COMPLETE: 'complete',
7883
+ // EV-2872: suggestion chips delivered AFTER `complete` on the same
7884
+ // stream (the backend no longer blocks the composer unlock on chip
7885
+ // generation). Carries a `prompts` array; attaches to the last
7886
+ // assistant message. Wire value matches @eshal/shared's
7887
+ // StreamEventType.FOLLOW_UP_PROMPTS (the frontend's ChatService.ts
7888
+ // already handled it).
7889
+ FOLLOW_UP_PROMPTS: 'follow_up_prompts',
7883
7890
  ERROR: 'error',
7884
7891
  HUMAN_DECISION_REQUIRED: 'human_decision_required'
7885
7892
  };
@@ -8322,6 +8329,26 @@
8322
8329
  updateFinalMessage(setMessages, finalContent, metadata);
8323
8330
  break;
8324
8331
  }
8332
+ case StreamEventType.FOLLOW_UP_PROMPTS:
8333
+ {
8334
+ // EV-2872: trailing chips chunk - arrives after COMPLETE. Attach to
8335
+ // the finalized assistant message (same shape updateFinalMessage
8336
+ // stores from the complete chunk).
8337
+ const latePrompts = Array.isArray(streamEvent.prompts) ? streamEvent.prompts : [];
8338
+ if (latePrompts.length > 0) {
8339
+ setMessages(prev => {
8340
+ const updated = [...(prev || [])];
8341
+ const lastMsg = updated[updated.length - 1];
8342
+ if (lastMsg && lastMsg.role === 'assistant') {
8343
+ updated[updated.length - 1] = _objectSpread2(_objectSpread2({}, lastMsg), {}, {
8344
+ prompts: normalizePrompts(latePrompts)
8345
+ });
8346
+ }
8347
+ return updated;
8348
+ });
8349
+ }
8350
+ break;
8351
+ }
8325
8352
  case StreamEventType.ERROR:
8326
8353
  addErrorMessage(setMessages, streamEvent.error || 'Unknown error occurred');
8327
8354
  break;
@@ -8464,6 +8491,32 @@
8464
8491
  continue;
8465
8492
  }
8466
8493
 
8494
+ // EV-2872: trailing chips chunk. The backend now emits `complete`
8495
+ // WITHOUT waiting for suggestion-chip generation (the composer
8496
+ // unlocks at last-token time) and delivers the chips afterwards
8497
+ // as their own {type:'follow_up_prompts'} chunk on the same
8498
+ // stream. Attach them to the already-finalized assistant
8499
+ // message. Turns where chip generation timed out simply never
8500
+ // send this chunk.
8501
+ if (parsed.type === 'follow_up_prompts') {
8502
+ const latePrompts = Array.isArray(parsed.prompts) ? parsed.prompts : [];
8503
+ if (latePrompts.length > 0) {
8504
+ setMessages(prev => {
8505
+ const updated = [...(prev || [])];
8506
+ const lastMsg = updated[updated.length - 1];
8507
+ if (lastMsg && lastMsg.role === 'assistant') {
8508
+ // Same storage shape updateFinalMessage uses on the
8509
+ // complete chunk: message.prompts, normalized.
8510
+ updated[updated.length - 1] = _objectSpread2(_objectSpread2({}, lastMsg), {}, {
8511
+ prompts: normalizePrompts(latePrompts)
8512
+ });
8513
+ }
8514
+ return updated;
8515
+ });
8516
+ }
8517
+ continue;
8518
+ }
8519
+
8467
8520
  // Handle text_chunk events
8468
8521
  if (parsed.type === 'text_chunk') {
8469
8522
  var _parsed$choices2;