@flytedan/flytebot-design-system 0.71.4 → 0.71.5

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.cjs CHANGED
@@ -13655,18 +13655,24 @@ function useChatEngine(opts) {
13655
13655
  const server = data && data.messages || [];
13656
13656
  const turn = liveTurn.current;
13657
13657
  const ownIds = /* @__PURE__ */ new Set();
13658
- let progress;
13658
+ const ownAssistants = [];
13659
13659
  if (turn) {
13660
13660
  for (const m of server) {
13661
13661
  if (turn.known.has(m.id)) continue;
13662
13662
  ownIds.add(m.id);
13663
- if (m.role === "assistant") progress = m;
13663
+ if (m.role === "assistant") ownAssistants.push(m);
13664
13664
  }
13665
13665
  }
13666
+ const progress = ownAssistants.pop();
13667
+ const cards = ownAssistants;
13666
13668
  const ids = new Set(server.map((m) => m.id));
13667
13669
  serverCount.current = server.length;
13668
13670
  serverIds.current = ids;
13669
- const next = [...server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
13671
+ const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
13672
+ const local = listRef.current.filter((m) => !ids.has(m.id));
13673
+ const at = local.findIndex((m) => m.id === turn?.holderId);
13674
+ const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
13675
+ const next = [...settled, ...tail];
13670
13676
  commit(turn && progress ? next.map((m) => m.id === turn.holderId ? foldProgress(m, progress) : m) : next);
13671
13677
  }
13672
13678
  function foldProgress(holder, progress) {