@flytedan/flytebot-design-system 0.71.3 → 0.71.4

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.js CHANGED
@@ -12439,6 +12439,8 @@ function useChatEngine(opts) {
12439
12439
  const serverCount = React70.useRef(0);
12440
12440
  const serverIds = React70.useRef(/* @__PURE__ */ new Set());
12441
12441
  const liveTurn = React70.useRef(null);
12442
+ const lastTurnOwn = React70.useRef(/* @__PURE__ */ new Set());
12443
+ const retired = React70.useRef(/* @__PURE__ */ new Set());
12442
12444
  const threadRef = React70.useRef(null);
12443
12445
  const mounted = React70.useRef(true);
12444
12446
  React70.useEffect(() => {
@@ -12487,7 +12489,7 @@ function useChatEngine(opts) {
12487
12489
  const ids = new Set(server.map((m) => m.id));
12488
12490
  serverCount.current = server.length;
12489
12491
  serverIds.current = ids;
12490
- const next = [...server.filter((m) => !ownIds.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
12492
+ const next = [...server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
12491
12493
  commit(turn && progress ? next.map((m) => m.id === turn.holderId ? foldProgress(m, progress) : m) : next);
12492
12494
  }
12493
12495
  function foldProgress(holder, progress) {
@@ -12706,6 +12708,8 @@ function useChatEngine(opts) {
12706
12708
  commit(listRef.current.filter((m) => m.id !== holderId));
12707
12709
  }
12708
12710
  } finally {
12711
+ const known = liveTurn.current.known;
12712
+ lastTurnOwn.current = new Set([...serverIds.current].filter((id2) => !known.has(id2)));
12709
12713
  liveTurn.current = null;
12710
12714
  abortRef.current = null;
12711
12715
  busyRef.current = false;
@@ -12767,6 +12771,7 @@ function useChatEngine(opts) {
12767
12771
  const turn = list[at];
12768
12772
  commit(list.slice(0, at));
12769
12773
  serverCount.current = Math.max(0, serverCount.current - 1);
12774
+ lastTurnOwn.current.forEach((id) => retired.current.add(id));
12770
12775
  stoppedRef.current = false;
12771
12776
  queueRef.current = [{ id: uid("q"), text: turn.text || "", attachments: turn.attachments }].concat(queueRef.current);
12772
12777
  setQueue(queueRef.current.slice());