@flamingo-stack/openframe-frontend-core 0.0.447 → 0.0.448-snapshot.20260718005900
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/{chunk-FR6NVZVM.cjs → chunk-47AMTR2S.cjs} +11 -11
- package/dist/{chunk-FR6NVZVM.cjs.map → chunk-47AMTR2S.cjs.map} +1 -1
- package/dist/{chunk-G7QSLGMI.js → chunk-4IMXFDRI.js} +2 -2
- package/dist/{chunk-ITJMUH4Q.cjs → chunk-4S4RR7XC.cjs} +31 -31
- package/dist/{chunk-ITJMUH4Q.cjs.map → chunk-4S4RR7XC.cjs.map} +1 -1
- package/dist/{chunk-YCSNDUDE.js → chunk-5SJGFLL2.js} +138 -43
- package/dist/chunk-5SJGFLL2.js.map +1 -0
- package/dist/{chunk-XUS75SQW.cjs → chunk-6TS4AIDX.cjs} +15 -15
- package/dist/{chunk-XUS75SQW.cjs.map → chunk-6TS4AIDX.cjs.map} +1 -1
- package/dist/{chunk-EZMM2OMP.cjs → chunk-AZKVNRZP.cjs} +26 -26
- package/dist/{chunk-EZMM2OMP.cjs.map → chunk-AZKVNRZP.cjs.map} +1 -1
- package/dist/{chunk-3GBLPPSW.js → chunk-BSBWBQ7M.js} +4 -4
- package/dist/{chunk-E6HKLQ3Q.cjs → chunk-DJP5HYFG.cjs} +7 -7
- package/dist/{chunk-E6HKLQ3Q.cjs.map → chunk-DJP5HYFG.cjs.map} +1 -1
- package/dist/{chunk-PF6CKZIH.cjs → chunk-DRKQNXSZ.cjs} +5 -5
- package/dist/{chunk-PF6CKZIH.cjs.map → chunk-DRKQNXSZ.cjs.map} +1 -1
- package/dist/{chunk-S7VMUDUB.cjs → chunk-EOFENGSZ.cjs} +9 -9
- package/dist/{chunk-S7VMUDUB.cjs.map → chunk-EOFENGSZ.cjs.map} +1 -1
- package/dist/{chunk-RNXMP7GB.cjs → chunk-H56AEHFC.cjs} +138 -43
- package/dist/chunk-H56AEHFC.cjs.map +1 -0
- package/dist/{chunk-5BJJRPDH.js → chunk-HQ7S6JG5.js} +2 -2
- package/dist/{chunk-TMZYFYSS.js → chunk-JAASDJOF.js} +4 -4
- package/dist/{chunk-2PNWAAU4.cjs → chunk-KKJRBMG3.cjs} +59 -59
- package/dist/{chunk-2PNWAAU4.cjs.map → chunk-KKJRBMG3.cjs.map} +1 -1
- package/dist/{chunk-KYLOPUIH.cjs → chunk-LQTX7EJS.cjs} +26 -26
- package/dist/{chunk-KYLOPUIH.cjs.map → chunk-LQTX7EJS.cjs.map} +1 -1
- package/dist/{chunk-4ONE3HQP.js → chunk-LWT6G75Q.js} +2 -2
- package/dist/{chunk-SHC5NFOH.js → chunk-MWRFPLNB.js} +2 -2
- package/dist/{chunk-ZYB3BYBA.js → chunk-NPBTNWRA.js} +2 -2
- package/dist/{chunk-6TAIXSF5.js → chunk-UNQVTGVG.js} +2 -2
- package/dist/{chunk-WMOF3WQT.js → chunk-VSWFYFIG.js} +4 -4
- package/dist/{chunk-WLU37UZO.cjs → chunk-WYPROXL4.cjs} +62 -62
- package/dist/{chunk-WLU37UZO.cjs.map → chunk-WYPROXL4.cjs.map} +1 -1
- package/dist/{chunk-X4XHW3OV.cjs → chunk-X754WDWO.cjs} +37 -37
- package/dist/{chunk-X4XHW3OV.cjs.map → chunk-X754WDWO.cjs.map} +1 -1
- package/dist/{chunk-D2NLNBLH.js → chunk-XLFAFH2B.js} +2 -2
- package/dist/{chunk-ZQVEB6KT.js → chunk-YSNMV53O.js} +4 -4
- package/dist/components/case-studies/index.cjs +8 -8
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/chat/index.js +1 -1
- package/dist/components/chat/types/message.types.d.ts +13 -0
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/utils/history-merge.d.ts +14 -4
- package/dist/components/chat/utils/history-merge.d.ts.map +1 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +5 -5
- package/dist/components/docs/index.js +4 -4
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/cards-strip.d.ts +2 -1
- package/dist/components/features/cards-strip.d.ts.map +1 -1
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/help-center-pages/index.cjs +20 -20
- package/dist/components/help-center-pages/index.js +11 -11
- package/dist/components/index.cjs +129 -129
- package/dist/components/index.js +9 -9
- package/dist/components/navigation/index.cjs +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +5 -5
- package/dist/components/tickets/index.js +4 -4
- package/dist/components/ui/index.cjs +2 -2
- package/dist/components/ui/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/types/message.types.ts +13 -0
- package/src/components/chat/utils/__tests__/history-merge.test.ts +301 -0
- package/src/components/chat/utils/__tests__/process-historical-messages-approvals.test.ts +35 -0
- package/src/components/chat/utils/history-merge.ts +157 -14
- package/src/components/chat/utils/process-historical-messages.ts +45 -6
- package/src/components/features/cards-strip.tsx +126 -40
- package/src/stories/CardsStrip.stories.tsx +5 -3
- package/dist/chunk-RNXMP7GB.cjs.map +0 -1
- package/dist/chunk-YCSNDUDE.js.map +0 -1
- /package/dist/{chunk-G7QSLGMI.js.map → chunk-4IMXFDRI.js.map} +0 -0
- /package/dist/{chunk-3GBLPPSW.js.map → chunk-BSBWBQ7M.js.map} +0 -0
- /package/dist/{chunk-5BJJRPDH.js.map → chunk-HQ7S6JG5.js.map} +0 -0
- /package/dist/{chunk-TMZYFYSS.js.map → chunk-JAASDJOF.js.map} +0 -0
- /package/dist/{chunk-4ONE3HQP.js.map → chunk-LWT6G75Q.js.map} +0 -0
- /package/dist/{chunk-SHC5NFOH.js.map → chunk-MWRFPLNB.js.map} +0 -0
- /package/dist/{chunk-ZYB3BYBA.js.map → chunk-NPBTNWRA.js.map} +0 -0
- /package/dist/{chunk-6TAIXSF5.js.map → chunk-UNQVTGVG.js.map} +0 -0
- /package/dist/{chunk-WMOF3WQT.js.map → chunk-VSWFYFIG.js.map} +0 -0
- /package/dist/{chunk-D2NLNBLH.js.map → chunk-XLFAFH2B.js.map} +0 -0
- /package/dist/{chunk-ZQVEB6KT.js.map → chunk-YSNMV53O.js.map} +0 -0
|
@@ -10943,6 +10943,63 @@ var CHEVRON_SUPPRESS_MS = 4e3;
|
|
|
10943
10943
|
var USER_SCROLL_SUPPRESS_MS = 3e3;
|
|
10944
10944
|
var STRIP_CELL_MAX_WIDTH = "90vw";
|
|
10945
10945
|
var EMPTY_CHILDREN = [];
|
|
10946
|
+
var CLONE_FOCUSABLE_SELECTOR = 'a[href],button,input,select,textarea,iframe,summary,audio[controls],video[controls],[tabindex],[contenteditable]:not([contenteditable="false"])';
|
|
10947
|
+
function useSuppressCloneFocus(active) {
|
|
10948
|
+
const ref = useRef14(null);
|
|
10949
|
+
useEffect19(() => {
|
|
10950
|
+
const root = ref.current;
|
|
10951
|
+
if (!root || !active) return;
|
|
10952
|
+
const suppress = () => {
|
|
10953
|
+
root.querySelectorAll(CLONE_FOCUSABLE_SELECTOR).forEach((el) => {
|
|
10954
|
+
if (el.getAttribute("tabindex") !== "-1") el.setAttribute("tabindex", "-1");
|
|
10955
|
+
});
|
|
10956
|
+
};
|
|
10957
|
+
suppress();
|
|
10958
|
+
const mo = new MutationObserver(suppress);
|
|
10959
|
+
mo.observe(root, {
|
|
10960
|
+
childList: true,
|
|
10961
|
+
subtree: true,
|
|
10962
|
+
attributes: true,
|
|
10963
|
+
attributeFilter: ["href", "tabindex", "contenteditable", "controls"]
|
|
10964
|
+
});
|
|
10965
|
+
return () => mo.disconnect();
|
|
10966
|
+
}, [active]);
|
|
10967
|
+
return ref;
|
|
10968
|
+
}
|
|
10969
|
+
function ManagedCell({
|
|
10970
|
+
item,
|
|
10971
|
+
ctx,
|
|
10972
|
+
cardWidthMobile,
|
|
10973
|
+
cardWidthDesktop
|
|
10974
|
+
}) {
|
|
10975
|
+
const hintedWidth = React35.isValidElement(item) ? item.props["data-strip-cell-width"] : void 0;
|
|
10976
|
+
const desktopWidth = typeof hintedWidth === "number" ? hintedWidth : cardWidthDesktop;
|
|
10977
|
+
const cloneRef = useSuppressCloneFocus(ctx.isClone);
|
|
10978
|
+
return /* @__PURE__ */ jsx78(
|
|
10979
|
+
"div",
|
|
10980
|
+
{
|
|
10981
|
+
className: "shrink-0 self-stretch",
|
|
10982
|
+
style: { width: ctx.isMobile ? cardWidthMobile : desktopWidth, maxWidth: STRIP_CELL_MAX_WIDTH },
|
|
10983
|
+
"data-strip-card-key": ctx.cardKey,
|
|
10984
|
+
onPointerEnter: ctx.isTouch ? void 0 : () => ctx.onActivate(ctx.cardKey),
|
|
10985
|
+
onPointerLeave: ctx.isTouch ? void 0 : () => ctx.onDeactivate(ctx.cardKey),
|
|
10986
|
+
onFocus: () => ctx.onActivate(ctx.cardKey),
|
|
10987
|
+
onBlur: (e) => {
|
|
10988
|
+
if (e.currentTarget.contains(e.relatedTarget)) return;
|
|
10989
|
+
ctx.onDeactivate(ctx.cardKey);
|
|
10990
|
+
},
|
|
10991
|
+
children: /* @__PURE__ */ jsx78(
|
|
10992
|
+
"div",
|
|
10993
|
+
{
|
|
10994
|
+
ref: cloneRef,
|
|
10995
|
+
className: "h-full [&>*]:h-full [&>a>*]:h-full",
|
|
10996
|
+
"aria-hidden": ctx.isClone || void 0,
|
|
10997
|
+
children: item
|
|
10998
|
+
}
|
|
10999
|
+
)
|
|
11000
|
+
}
|
|
11001
|
+
);
|
|
11002
|
+
}
|
|
10946
11003
|
function CardsStrip(props) {
|
|
10947
11004
|
const {
|
|
10948
11005
|
title,
|
|
@@ -11229,36 +11286,14 @@ function CardsStrip(props) {
|
|
|
11229
11286
|
if (!childrenMode) {
|
|
11230
11287
|
return props.renderCard(item, ctx);
|
|
11231
11288
|
}
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
{
|
|
11241
|
-
className: "shrink-0 self-stretch",
|
|
11242
|
-
style: { width: ctx.isMobile ? cardWidthMobile : desktopWidth, maxWidth: STRIP_CELL_MAX_WIDTH },
|
|
11243
|
-
"data-strip-card-key": ctx.cardKey,
|
|
11244
|
-
onPointerEnter: ctx.isTouch ? void 0 : () => ctx.onActivate(ctx.cardKey),
|
|
11245
|
-
onPointerLeave: ctx.isTouch ? void 0 : () => ctx.onDeactivate(ctx.cardKey),
|
|
11246
|
-
onFocus: () => ctx.onActivate(ctx.cardKey),
|
|
11247
|
-
onBlur: (e) => {
|
|
11248
|
-
if (e.currentTarget.contains(e.relatedTarget)) return;
|
|
11249
|
-
ctx.onDeactivate(ctx.cardKey);
|
|
11250
|
-
},
|
|
11251
|
-
children: /* @__PURE__ */ jsx78(
|
|
11252
|
-
"div",
|
|
11253
|
-
{
|
|
11254
|
-
className: "h-full [&>*]:h-full [&>a>*]:h-full",
|
|
11255
|
-
"aria-hidden": ctx.isClone || void 0,
|
|
11256
|
-
inert: ctx.isClone || void 0,
|
|
11257
|
-
children: item
|
|
11258
|
-
}
|
|
11259
|
-
)
|
|
11260
|
-
}
|
|
11261
|
-
)
|
|
11289
|
+
return /* @__PURE__ */ jsx78(
|
|
11290
|
+
ManagedCell,
|
|
11291
|
+
{
|
|
11292
|
+
item,
|
|
11293
|
+
ctx,
|
|
11294
|
+
cardWidthMobile,
|
|
11295
|
+
cardWidthDesktop
|
|
11296
|
+
}
|
|
11262
11297
|
);
|
|
11263
11298
|
};
|
|
11264
11299
|
if (items.length === 0) return null;
|
|
@@ -50242,7 +50277,8 @@ function pushStandaloneMessages(processedMessages, msg, messageDataArray) {
|
|
|
50242
50277
|
content: "",
|
|
50243
50278
|
name: data.text,
|
|
50244
50279
|
authorType: "system",
|
|
50245
|
-
timestamp: new Date(msg.createdAt)
|
|
50280
|
+
timestamp: new Date(msg.createdAt),
|
|
50281
|
+
...typeof msg.lastChunkStreamSeq === "number" ? { streamSeq: msg.lastChunkStreamSeq } : {}
|
|
50246
50282
|
});
|
|
50247
50283
|
}
|
|
50248
50284
|
});
|
|
@@ -50272,6 +50308,7 @@ function processHistoricalMessages(messages, options = {}) {
|
|
|
50272
50308
|
let currentAssistantId = null;
|
|
50273
50309
|
let currentAssistantTimestamp = null;
|
|
50274
50310
|
let lastAssistantId = null;
|
|
50311
|
+
let currentAssistantStreamSeq;
|
|
50275
50312
|
const flushAssistantMessage = () => {
|
|
50276
50313
|
const idToUse = lastAssistantId || currentAssistantId;
|
|
50277
50314
|
if (idToUse && accumulator.hasContent()) {
|
|
@@ -50283,13 +50320,15 @@ function processHistoricalMessages(messages, options = {}) {
|
|
|
50283
50320
|
assistantType,
|
|
50284
50321
|
authorType: assistantType,
|
|
50285
50322
|
timestamp: currentAssistantTimestamp || /* @__PURE__ */ new Date(),
|
|
50286
|
-
avatar: assistantAvatar
|
|
50323
|
+
avatar: assistantAvatar,
|
|
50324
|
+
...currentAssistantStreamSeq !== void 0 ? { streamSeq: currentAssistantStreamSeq } : {}
|
|
50287
50325
|
});
|
|
50288
50326
|
accumulator.resetSegments();
|
|
50289
|
-
currentAssistantId = null;
|
|
50290
|
-
currentAssistantTimestamp = null;
|
|
50291
|
-
lastAssistantId = null;
|
|
50292
50327
|
}
|
|
50328
|
+
currentAssistantId = null;
|
|
50329
|
+
currentAssistantTimestamp = null;
|
|
50330
|
+
lastAssistantId = null;
|
|
50331
|
+
currentAssistantStreamSeq = void 0;
|
|
50293
50332
|
};
|
|
50294
50333
|
messages.forEach((msg, index) => {
|
|
50295
50334
|
if (chatTypeFilter && msg.chatType !== chatTypeFilter) return;
|
|
@@ -50318,7 +50357,8 @@ function processHistoricalMessages(messages, options = {}) {
|
|
|
50318
50357
|
avatar: getOwnerAvatar(msg.owner),
|
|
50319
50358
|
authorType: userAuthorType,
|
|
50320
50359
|
timestamp: new Date(msg.createdAt),
|
|
50321
|
-
...contextItems && contextItems.length > 0 ? { contextItems } : {}
|
|
50360
|
+
...contextItems && contextItems.length > 0 ? { contextItems } : {},
|
|
50361
|
+
...typeof msg.lastChunkStreamSeq === "number" ? { streamSeq: msg.lastChunkStreamSeq } : {}
|
|
50322
50362
|
});
|
|
50323
50363
|
}
|
|
50324
50364
|
});
|
|
@@ -50328,6 +50368,9 @@ function processHistoricalMessages(messages, options = {}) {
|
|
|
50328
50368
|
currentAssistantTimestamp = new Date(msg.createdAt);
|
|
50329
50369
|
}
|
|
50330
50370
|
lastAssistantId = msg.id;
|
|
50371
|
+
if (typeof msg.lastChunkStreamSeq === "number") {
|
|
50372
|
+
currentAssistantStreamSeq = currentAssistantStreamSeq === void 0 ? msg.lastChunkStreamSeq : Math.max(currentAssistantStreamSeq, msg.lastChunkStreamSeq);
|
|
50373
|
+
}
|
|
50331
50374
|
messageDataArray.forEach((data) => {
|
|
50332
50375
|
processMessageData(
|
|
50333
50376
|
data,
|
|
@@ -50566,6 +50609,7 @@ function processHistoricalMessagesWithErrors(messages, options = {}) {
|
|
|
50566
50609
|
let currentAssistantId = null;
|
|
50567
50610
|
let currentAssistantTimestamp = null;
|
|
50568
50611
|
let lastAssistantId = null;
|
|
50612
|
+
let currentAssistantStreamSeq;
|
|
50569
50613
|
const flushAssistantMessage = () => {
|
|
50570
50614
|
const idToUse = lastAssistantId || currentAssistantId;
|
|
50571
50615
|
if (idToUse && accumulator.hasContent()) {
|
|
@@ -50577,13 +50621,15 @@ function processHistoricalMessagesWithErrors(messages, options = {}) {
|
|
|
50577
50621
|
assistantType,
|
|
50578
50622
|
authorType: assistantType,
|
|
50579
50623
|
timestamp: currentAssistantTimestamp || /* @__PURE__ */ new Date(),
|
|
50580
|
-
avatar: assistantAvatar
|
|
50624
|
+
avatar: assistantAvatar,
|
|
50625
|
+
...currentAssistantStreamSeq !== void 0 ? { streamSeq: currentAssistantStreamSeq } : {}
|
|
50581
50626
|
});
|
|
50582
50627
|
accumulator.resetSegments();
|
|
50583
|
-
currentAssistantId = null;
|
|
50584
|
-
currentAssistantTimestamp = null;
|
|
50585
|
-
lastAssistantId = null;
|
|
50586
50628
|
}
|
|
50629
|
+
currentAssistantId = null;
|
|
50630
|
+
currentAssistantTimestamp = null;
|
|
50631
|
+
lastAssistantId = null;
|
|
50632
|
+
currentAssistantStreamSeq = void 0;
|
|
50587
50633
|
};
|
|
50588
50634
|
messages.forEach((msg, index) => {
|
|
50589
50635
|
if (chatTypeFilter && msg.chatType !== chatTypeFilter) return;
|
|
@@ -50612,7 +50658,8 @@ function processHistoricalMessagesWithErrors(messages, options = {}) {
|
|
|
50612
50658
|
avatar: getOwnerAvatar(msg.owner),
|
|
50613
50659
|
authorType: userAuthorType,
|
|
50614
50660
|
timestamp: new Date(msg.createdAt),
|
|
50615
|
-
...contextItems && contextItems.length > 0 ? { contextItems } : {}
|
|
50661
|
+
...contextItems && contextItems.length > 0 ? { contextItems } : {},
|
|
50662
|
+
...typeof msg.lastChunkStreamSeq === "number" ? { streamSeq: msg.lastChunkStreamSeq } : {}
|
|
50616
50663
|
});
|
|
50617
50664
|
}
|
|
50618
50665
|
});
|
|
@@ -50622,6 +50669,9 @@ function processHistoricalMessagesWithErrors(messages, options = {}) {
|
|
|
50622
50669
|
currentAssistantTimestamp = new Date(msg.createdAt);
|
|
50623
50670
|
}
|
|
50624
50671
|
lastAssistantId = msg.id;
|
|
50672
|
+
if (typeof msg.lastChunkStreamSeq === "number") {
|
|
50673
|
+
currentAssistantStreamSeq = currentAssistantStreamSeq === void 0 ? msg.lastChunkStreamSeq : Math.max(currentAssistantStreamSeq, msg.lastChunkStreamSeq);
|
|
50674
|
+
}
|
|
50625
50675
|
messageDataArray.forEach((data) => {
|
|
50626
50676
|
processMessageData(
|
|
50627
50677
|
data,
|
|
@@ -51798,6 +51848,15 @@ function mergeHistoryWithRealtime(input) {
|
|
|
51798
51848
|
const processedIds = new Set(processedHistory.map((m) => m.id));
|
|
51799
51849
|
const seqCoverageKnown = realtimeSeenStreamSeq > 0 && historyMaxStreamSeq > 0;
|
|
51800
51850
|
const historyCoversRealtime = seqCoverageKnown ? historyMaxStreamSeq >= realtimeSeenStreamSeq : null;
|
|
51851
|
+
const historyMaxSeqByRole = /* @__PURE__ */ new Map();
|
|
51852
|
+
let anyHistoryRowSeq = false;
|
|
51853
|
+
for (const pm of processedHistory) {
|
|
51854
|
+
if (typeof pm.streamSeq === "number") {
|
|
51855
|
+
anyHistoryRowSeq = true;
|
|
51856
|
+
const prev = historyMaxSeqByRole.get(pm.role) ?? 0;
|
|
51857
|
+
if (pm.streamSeq > prev) historyMaxSeqByRole.set(pm.role, pm.streamSeq);
|
|
51858
|
+
}
|
|
51859
|
+
}
|
|
51801
51860
|
const trailing = processedHistory[processedHistory.length - 1];
|
|
51802
51861
|
const historyTrailingAssistant = trailing?.role === "assistant" ? trailing : null;
|
|
51803
51862
|
const historyBatchId = historyTrailingAssistant && Array.isArray(historyTrailingAssistant.content) ? historyTrailingAssistant.content.find((s) => s.type === "approval_batch")?.data?.approvalRequestId ?? null : null;
|
|
@@ -51822,8 +51881,26 @@ function mergeHistoryWithRealtime(input) {
|
|
|
51822
51881
|
}
|
|
51823
51882
|
}
|
|
51824
51883
|
}
|
|
51884
|
+
if (historyTrailingAssistant && Array.isArray(historyTrailingAssistant.content) && processedToUse[processedToUse.length - 1] === historyTrailingAssistant && !pinnedSyntheticIds.has(historyTrailingAssistant.id)) {
|
|
51885
|
+
const persistedSize = historyTrailingAssistant.content.length;
|
|
51886
|
+
const persistedSeq = historyTrailingAssistant.streamSeq ?? 0;
|
|
51887
|
+
const richerTwin = existingMessages.find(
|
|
51888
|
+
(m) => m !== historyTrailingAssistant && m.id === historyTrailingAssistant.id && m.role === "assistant" && Array.isArray(m.content) && (m.content.length > persistedSize || m.content.length === persistedSize && typeof m.streamSeq === "number" && m.streamSeq > persistedSeq)
|
|
51889
|
+
);
|
|
51890
|
+
if (richerTwin) {
|
|
51891
|
+
processedToUse = processedToUse.slice(0, -1);
|
|
51892
|
+
pinnedSyntheticIds.add(richerTwin.id);
|
|
51893
|
+
}
|
|
51894
|
+
}
|
|
51825
51895
|
const lastProcessed = processedToUse[processedToUse.length - 1];
|
|
51826
51896
|
const trailingAssistantText = lastProcessed && lastProcessed.role === "assistant" ? assistantAnswerText(lastProcessed.content) : "";
|
|
51897
|
+
const persistedUserContentCounts = /* @__PURE__ */ new Map();
|
|
51898
|
+
for (const pm of processedToUse) {
|
|
51899
|
+
if (pm.role === "user" && typeof pm.content === "string") {
|
|
51900
|
+
persistedUserContentCounts.set(pm.content, (persistedUserContentCounts.get(pm.content) ?? 0) + 1);
|
|
51901
|
+
}
|
|
51902
|
+
}
|
|
51903
|
+
const seenUserSyntheticByContent = /* @__PURE__ */ new Map();
|
|
51827
51904
|
const realtimeMessages = existingMessages.filter((m) => {
|
|
51828
51905
|
if (pinnedSyntheticIds.has(m.id)) return true;
|
|
51829
51906
|
if (droppedSyntheticIds.has(m.id)) return false;
|
|
@@ -51837,7 +51914,25 @@ function mergeHistoryWithRealtime(input) {
|
|
|
51837
51914
|
if (m.role === "assistant" && trailingAssistantText && assistantAnswerText(m.content) === trailingAssistantText) {
|
|
51838
51915
|
return false;
|
|
51839
51916
|
}
|
|
51840
|
-
|
|
51917
|
+
if (m.role === "user" && m.id.startsWith("user-") && typeof m.content === "string") {
|
|
51918
|
+
const seen = (seenUserSyntheticByContent.get(m.content) ?? 0) + 1;
|
|
51919
|
+
seenUserSyntheticByContent.set(m.content, seen);
|
|
51920
|
+
if ((persistedUserContentCounts.get(m.content) ?? 0) < seen) return true;
|
|
51921
|
+
if (typeof m.streamSeq !== "number" || historyMaxStreamSeq <= 0) return false;
|
|
51922
|
+
if (historyMaxStreamSeq >= m.streamSeq) return false;
|
|
51923
|
+
const lastPersisted = processedToUse[processedToUse.length - 1];
|
|
51924
|
+
if (lastPersisted && lastPersisted.role === "user" && lastPersisted.content === m.content) return false;
|
|
51925
|
+
return true;
|
|
51926
|
+
}
|
|
51927
|
+
let covered;
|
|
51928
|
+
if (typeof m.streamSeq === "number" && anyHistoryRowSeq) {
|
|
51929
|
+
const roleMax = historyMaxSeqByRole.get(m.role) ?? 0;
|
|
51930
|
+
covered = roleMax > 0 && roleMax >= m.streamSeq;
|
|
51931
|
+
} else if (typeof m.streamSeq === "number" && historyMaxStreamSeq > 0) {
|
|
51932
|
+
covered = historyMaxStreamSeq >= m.streamSeq;
|
|
51933
|
+
} else {
|
|
51934
|
+
covered = historyCoversRealtime !== null ? historyCoversRealtime : (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
|
|
51935
|
+
}
|
|
51841
51936
|
if (covered) return false;
|
|
51842
51937
|
}
|
|
51843
51938
|
return true;
|
|
@@ -54564,4 +54659,4 @@ export {
|
|
|
54564
54659
|
LogsList,
|
|
54565
54660
|
assets
|
|
54566
54661
|
};
|
|
54567
|
-
//# sourceMappingURL=chunk-
|
|
54662
|
+
//# sourceMappingURL=chunk-5SJGFLL2.js.map
|