@flamingo-stack/openframe-frontend-core 0.0.429-snapshot.20260715222543 → 0.0.429

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.
Files changed (108) hide show
  1. package/dist/{chunk-KDVGC6EG.cjs → chunk-2LJA3ABH.cjs} +37 -37
  2. package/dist/{chunk-KDVGC6EG.cjs.map → chunk-2LJA3ABH.cjs.map} +1 -1
  3. package/dist/{chunk-3XWBE3SM.js → chunk-2WJ25MTA.js} +4 -4
  4. package/dist/{chunk-3AWPRVFM.js → chunk-4VODJPTB.js} +2 -2
  5. package/dist/{chunk-TYANQCZA.js → chunk-62L7S7HQ.js} +166 -269
  6. package/dist/chunk-62L7S7HQ.js.map +1 -0
  7. package/dist/{chunk-FYMD7CCA.cjs → chunk-7MJTM6QT.cjs} +7 -7
  8. package/dist/{chunk-FYMD7CCA.cjs.map → chunk-7MJTM6QT.cjs.map} +1 -1
  9. package/dist/{chunk-A6JKKKIF.js → chunk-7PA4B6SD.js} +4 -4
  10. package/dist/{chunk-TDITU4KW.js → chunk-B3FBMRHQ.js} +2 -2
  11. package/dist/{chunk-CTY37UUO.cjs → chunk-B3Y47C2U.cjs} +59 -59
  12. package/dist/{chunk-CTY37UUO.cjs.map → chunk-B3Y47C2U.cjs.map} +1 -1
  13. package/dist/{chunk-WQN4B6CM.cjs → chunk-BN3V465H.cjs} +15 -15
  14. package/dist/{chunk-WQN4B6CM.cjs.map → chunk-BN3V465H.cjs.map} +1 -1
  15. package/dist/{chunk-WQR7H56P.cjs → chunk-CCL6JEMS.cjs} +62 -62
  16. package/dist/{chunk-WQR7H56P.cjs.map → chunk-CCL6JEMS.cjs.map} +1 -1
  17. package/dist/{chunk-CJOFXDTK.cjs → chunk-CRGH6TV6.cjs} +26 -26
  18. package/dist/{chunk-CJOFXDTK.cjs.map → chunk-CRGH6TV6.cjs.map} +1 -1
  19. package/dist/{chunk-Q7SYPXUX.cjs → chunk-E4PKZNR7.cjs} +11 -11
  20. package/dist/{chunk-Q7SYPXUX.cjs.map → chunk-E4PKZNR7.cjs.map} +1 -1
  21. package/dist/{chunk-ZUP2ZKS6.cjs → chunk-GGJUXN6Z.cjs} +9 -9
  22. package/dist/{chunk-ZUP2ZKS6.cjs.map → chunk-GGJUXN6Z.cjs.map} +1 -1
  23. package/dist/{chunk-2ELINEWQ.js → chunk-GMR5AA3C.js} +2 -2
  24. package/dist/{chunk-AY5TBDWZ.js → chunk-KHKB5RY2.js} +2 -2
  25. package/dist/{chunk-S7UXICHB.js → chunk-MAYEJ3NY.js} +2 -2
  26. package/dist/{chunk-NZBQGODM.js → chunk-NYISC4Z3.js} +2 -2
  27. package/dist/{chunk-D4K53CES.cjs → chunk-OLGFIDZY.cjs} +26 -26
  28. package/dist/{chunk-D4K53CES.cjs.map → chunk-OLGFIDZY.cjs.map} +1 -1
  29. package/dist/{chunk-3OKVH6FW.js → chunk-RTOVYU4D.js} +4 -4
  30. package/dist/{chunk-67LZDLIO.js → chunk-TJ4HJ3KX.js} +2 -2
  31. package/dist/{chunk-FL4IOCYH.cjs → chunk-WXKFFVGC.cjs} +5 -5
  32. package/dist/{chunk-FL4IOCYH.cjs.map → chunk-WXKFFVGC.cjs.map} +1 -1
  33. package/dist/{chunk-PP5KNHMK.cjs → chunk-XDBD6BJN.cjs} +215 -318
  34. package/dist/chunk-XDBD6BJN.cjs.map +1 -0
  35. package/dist/{chunk-IMOJWQDR.js → chunk-Y2TW664W.js} +4 -4
  36. package/dist/{chunk-374KFDET.cjs → chunk-YGITDP6O.cjs} +31 -31
  37. package/dist/{chunk-374KFDET.cjs.map → chunk-YGITDP6O.cjs.map} +1 -1
  38. package/dist/components/case-studies/index.cjs +8 -8
  39. package/dist/components/case-studies/index.js +2 -2
  40. package/dist/components/chat/hooks/index.d.ts +0 -1
  41. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  42. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +1 -10
  43. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  44. package/dist/components/chat/index.cjs +2 -12
  45. package/dist/components/chat/index.cjs.map +1 -1
  46. package/dist/components/chat/index.js +1 -11
  47. package/dist/components/chat/utils/index.d.ts +0 -1
  48. package/dist/components/chat/utils/index.d.ts.map +1 -1
  49. package/dist/components/contact/index.cjs +3 -3
  50. package/dist/components/contact/index.js +2 -2
  51. package/dist/components/docs/index.cjs +5 -5
  52. package/dist/components/docs/index.js +4 -4
  53. package/dist/components/embeds/index.cjs +3 -3
  54. package/dist/components/embeds/index.js +2 -2
  55. package/dist/components/faq/index.cjs +3 -3
  56. package/dist/components/faq/index.js +2 -2
  57. package/dist/components/features/board/index.d.ts +2 -2
  58. package/dist/components/features/board/index.d.ts.map +1 -1
  59. package/dist/components/features/board/ticket-card.d.ts +2 -22
  60. package/dist/components/features/board/ticket-card.d.ts.map +1 -1
  61. package/dist/components/features/index.cjs +2 -6
  62. package/dist/components/features/index.cjs.map +1 -1
  63. package/dist/components/features/index.js +1 -5
  64. package/dist/components/help-center-pages/index.cjs +20 -20
  65. package/dist/components/help-center-pages/index.js +11 -11
  66. package/dist/components/index.cjs +128 -142
  67. package/dist/components/index.cjs.map +1 -1
  68. package/dist/components/index.js +9 -23
  69. package/dist/components/index.js.map +1 -1
  70. package/dist/components/navigation/index.cjs +2 -2
  71. package/dist/components/navigation/index.js +1 -1
  72. package/dist/components/onboarding-guides/index.cjs +5 -5
  73. package/dist/components/onboarding-guides/index.js +4 -4
  74. package/dist/components/related-content/index.cjs +3 -3
  75. package/dist/components/related-content/index.js +2 -2
  76. package/dist/components/tickets/index.cjs +5 -5
  77. package/dist/components/tickets/index.js +4 -4
  78. package/dist/components/ui/index.cjs +2 -12
  79. package/dist/components/ui/index.cjs.map +1 -1
  80. package/dist/components/ui/index.js +1 -11
  81. package/dist/index.cjs +2 -16
  82. package/dist/index.cjs.map +1 -1
  83. package/dist/index.js +1 -15
  84. package/package.json +1 -1
  85. package/src/components/chat/hooks/index.ts +0 -1
  86. package/src/components/chat/hooks/use-nats-chat-adapter.ts +0 -23
  87. package/src/components/chat/utils/index.ts +0 -2
  88. package/src/components/features/board/index.ts +2 -2
  89. package/src/components/features/board/ticket-card.tsx +64 -108
  90. package/dist/chunk-PP5KNHMK.cjs.map +0 -1
  91. package/dist/chunk-TYANQCZA.js.map +0 -1
  92. package/dist/components/chat/hooks/use-scripted-stream.d.ts +0 -3
  93. package/dist/components/chat/hooks/use-scripted-stream.d.ts.map +0 -1
  94. package/dist/components/chat/utils/scripted-stream.d.ts +0 -38
  95. package/dist/components/chat/utils/scripted-stream.d.ts.map +0 -1
  96. package/src/components/chat/hooks/use-scripted-stream.ts +0 -69
  97. package/src/components/chat/utils/scripted-stream.ts +0 -111
  98. /package/dist/{chunk-3XWBE3SM.js.map → chunk-2WJ25MTA.js.map} +0 -0
  99. /package/dist/{chunk-3AWPRVFM.js.map → chunk-4VODJPTB.js.map} +0 -0
  100. /package/dist/{chunk-A6JKKKIF.js.map → chunk-7PA4B6SD.js.map} +0 -0
  101. /package/dist/{chunk-TDITU4KW.js.map → chunk-B3FBMRHQ.js.map} +0 -0
  102. /package/dist/{chunk-2ELINEWQ.js.map → chunk-GMR5AA3C.js.map} +0 -0
  103. /package/dist/{chunk-AY5TBDWZ.js.map → chunk-KHKB5RY2.js.map} +0 -0
  104. /package/dist/{chunk-S7UXICHB.js.map → chunk-MAYEJ3NY.js.map} +0 -0
  105. /package/dist/{chunk-NZBQGODM.js.map → chunk-NYISC4Z3.js.map} +0 -0
  106. /package/dist/{chunk-3OKVH6FW.js.map → chunk-RTOVYU4D.js.map} +0 -0
  107. /package/dist/{chunk-67LZDLIO.js.map → chunk-TJ4HJ3KX.js.map} +0 -0
  108. /package/dist/{chunk-IMOJWQDR.js.map → chunk-Y2TW664W.js.map} +0 -0
@@ -34607,13 +34607,43 @@ var PRIORITY_COLOR_CLASS = {
34607
34607
  };
34608
34608
  var MAX_VISIBLE_TAGS = 2;
34609
34609
  var MAX_VISIBLE_ASSIGNEES = 3;
34610
- var TICKET_CARD_SHELL = "relative flex flex-col gap-[var(--spacing-system-sf)] rounded-md border border-ods-border bg-ods-bg p-[var(--spacing-system-sf)] select-none text-left";
34611
- function TicketCardBody({ ticket, columnColor, renderAssignSlot, onApprove, onReject }) {
34610
+ function TicketCard({
34611
+ ticket,
34612
+ columnId,
34613
+ columnColor,
34614
+ href,
34615
+ isOverlay = false,
34616
+ dragDisabled,
34617
+ approved = false,
34618
+ renderAssignSlot,
34619
+ onApprove,
34620
+ onReject
34621
+ }) {
34622
+ const sortableData = React103.useMemo(
34623
+ () => ({ columnId, type: "ticket" }),
34624
+ [columnId]
34625
+ );
34626
+ const sortable = useSortable({
34627
+ id: ticket.id,
34628
+ data: sortableData,
34629
+ disabled: dragDisabled
34630
+ });
34612
34631
  const showNewMessage = !!ticket.hasNewMessage && !!columnColor;
34613
34632
  const newMessageTextColor = columnColor ? getReadableTextColor(columnColor) : void 0;
34633
+ const style = isOverlay ? {} : {
34634
+ transform: CSS.Transform.toString(sortable.transform),
34635
+ transition: sortable.transition
34636
+ };
34637
+ if (showNewMessage) style.borderColor = columnColor;
34614
34638
  const showDeviceRow = !!(ticket.deviceHostnames?.length || ticket.organizationName);
34615
- const deviceText = [ticket.deviceHostnames?.join(", "), ticket.organizationName].filter(Boolean).join(", ");
34616
- const hasRightSection = !!(ticket.priority || ticket.assignees?.length || renderAssignSlot);
34639
+ const deviceText = [
34640
+ ticket.deviceHostnames?.join(", "),
34641
+ ticket.organizationName
34642
+ ].filter(Boolean).join(", ");
34643
+ const handleClick = (e) => {
34644
+ if (sortable.isDragging) e.preventDefault();
34645
+ };
34646
+ const hasRightSection = !!(approved || ticket.priority || ticket.assignees?.length || renderAssignSlot);
34617
34647
  const rightSection = hasRightSection ? /* @__PURE__ */ jsxs206("div", { className: "pointer-events-auto flex shrink-0 items-center gap-[var(--spacing-system-xsf)]", children: [
34618
34648
  ticket.priority && /* @__PURE__ */ jsx267(
34619
34649
  Flag02Icon,
@@ -34622,6 +34652,15 @@ function TicketCardBody({ ticket, columnColor, renderAssignSlot, onApprove, onRe
34622
34652
  "aria-label": `Priority: ${ticket.priority}`
34623
34653
  }
34624
34654
  ),
34655
+ approved && /* @__PURE__ */ jsx267(
34656
+ CheckCircleIcon,
34657
+ {
34658
+ size: 20,
34659
+ color: "var(--ods-attention-green-success)",
34660
+ className: "shrink-0",
34661
+ "aria-label": "Approved"
34662
+ }
34663
+ ),
34625
34664
  renderAssignSlot ? renderAssignSlot(ticket) : ticket.assignees?.length ? /* @__PURE__ */ jsxs206("div", { className: "flex -space-x-2", children: [
34626
34665
  ticket.assignees.slice(0, MAX_VISIBLE_ASSIGNEES).map((a) => /* @__PURE__ */ jsx267(
34627
34666
  SquareAvatar,
@@ -34642,7 +34681,7 @@ function TicketCardBody({ ticket, columnColor, renderAssignSlot, onApprove, onRe
34642
34681
  ] }) : null;
34643
34682
  const timestampLabel = ticket.createdAt ? formatTicketRelativeTime(ticket.createdAt) : null;
34644
34683
  const tooltipLabel = ticket.createdAt ? formatTicketFullTimestamp(ticket.createdAt) : null;
34645
- return /* @__PURE__ */ jsxs206(Fragment47, { children: [
34684
+ const body = /* @__PURE__ */ jsxs206(Fragment47, { children: [
34646
34685
  /* @__PURE__ */ jsxs206("div", { className: "flex items-start gap-[var(--spacing-system-sf)]", children: [
34647
34686
  /* @__PURE__ */ jsxs206("div", { className: "flex min-w-0 flex-1 flex-col gap-[var(--spacing-system-zero)]", title: ticket.title, children: [
34648
34687
  /* @__PURE__ */ jsx267("p", { className: "text-h3 truncate text-ods-text-primary", children: ticket.title }),
@@ -34667,55 +34706,17 @@ function TicketCardBody({ ticket, columnColor, renderAssignSlot, onApprove, onRe
34667
34706
  style: { backgroundColor: columnColor, color: newMessageTextColor }
34668
34707
  }
34669
34708
  ),
34670
- ticket.pendingApproval && /* @__PURE__ */ jsx267(BoardTicketApproval, { pendingApproval: ticket.pendingApproval, onApprove, onReject })
34709
+ ticket.pendingApproval && /* @__PURE__ */ jsx267(
34710
+ BoardTicketApproval,
34711
+ {
34712
+ pendingApproval: ticket.pendingApproval,
34713
+ onApprove: onApprove ? (requestId) => onApprove(ticket.id, requestId) : void 0,
34714
+ onReject: onReject ? (requestId) => onReject(ticket.id, requestId) : void 0
34715
+ }
34716
+ )
34671
34717
  ] });
34672
- }
34673
- function TicketCardView({ className, ...bodyProps }) {
34674
- const { ticket, columnColor } = bodyProps;
34675
- const showNewMessage = !!ticket.hasNewMessage && !!columnColor;
34676
- return /* @__PURE__ */ jsx267(
34677
- "div",
34678
- {
34679
- className: cn(TICKET_CARD_SHELL, className),
34680
- style: showNewMessage ? { borderColor: columnColor } : void 0,
34681
- children: /* @__PURE__ */ jsx267("div", { className: "relative z-10 flex flex-col gap-[var(--spacing-system-sf)]", children: /* @__PURE__ */ jsx267(TicketCardBody, { ...bodyProps }) })
34682
- }
34683
- );
34684
- }
34685
- function TicketCard({
34686
- ticket,
34687
- columnId,
34688
- columnColor,
34689
- href,
34690
- isOverlay = false,
34691
- dragDisabled,
34692
- renderAssignSlot,
34693
- onApprove,
34694
- onReject
34695
- }) {
34696
- const sortableData = React103.useMemo(() => ({ columnId, type: "ticket" }), [columnId]);
34697
- const sortable = useSortable({ id: ticket.id, data: sortableData, disabled: dragDisabled });
34698
- const showNewMessage = !!ticket.hasNewMessage && !!columnColor;
34699
- const style = isOverlay ? {} : {
34700
- transform: CSS.Transform.toString(sortable.transform),
34701
- transition: sortable.transition
34702
- };
34703
- if (showNewMessage) style.borderColor = columnColor;
34704
- const handleClick = (e) => {
34705
- if (sortable.isDragging) e.preventDefault();
34706
- };
34707
- const body = /* @__PURE__ */ jsx267(
34708
- TicketCardBody,
34709
- {
34710
- ticket,
34711
- columnColor,
34712
- renderAssignSlot,
34713
- onApprove: onApprove ? (requestId) => onApprove(ticket.id, requestId) : void 0,
34714
- onReject: onReject ? (requestId) => onReject(ticket.id, requestId) : void 0
34715
- }
34716
- );
34717
34718
  const cardClasses = cn(
34718
- TICKET_CARD_SHELL,
34719
+ "relative flex flex-col gap-[var(--spacing-system-sf)] rounded-md border border-ods-border bg-ods-bg p-[var(--spacing-system-sf)] select-none text-left",
34719
34720
  !dragDisabled && "cursor-pointer",
34720
34721
  sortable.isDragging && !isOverlay && "opacity-40",
34721
34722
  isOverlay && "rotate-1 shadow-card-hover"
@@ -35859,7 +35860,7 @@ function SlidingSidebar({ config }) {
35859
35860
  const [mounted, setMounted] = useState85(false);
35860
35861
  const headerHeight = useHeaderHeight();
35861
35862
  const asideRef = useRef46(null);
35862
- const prefersReducedMotion2 = useReducedMotion();
35863
+ const prefersReducedMotion = useReducedMotion();
35863
35864
  usePreventScroll4({ isDisabled: !config.isOpen });
35864
35865
  useFocusTrap(asideRef, config.isOpen, { onEscape: config.onClose, contain: false });
35865
35866
  useEffect65(() => {
@@ -36002,7 +36003,7 @@ function SlidingSidebar({ config }) {
36002
36003
  animate: {
36003
36004
  x: config.isOpen ? 0 : config.position === "right" ? "100%" : "-100%"
36004
36005
  },
36005
- transition: prefersReducedMotion2 ? { duration: 0 } : {
36006
+ transition: prefersReducedMotion ? { duration: 0 } : {
36006
36007
  type: "spring",
36007
36008
  damping: 25,
36008
36009
  stiffness: 300,
@@ -47086,43 +47087,8 @@ function useChunkCatchup({
47086
47087
  };
47087
47088
  }
47088
47089
 
47089
- // src/components/chat/hooks/use-scripted-stream.ts
47090
- import { useEffect as useEffect77, useState as useState105 } from "react";
47091
- var EMPTY_FRAME = { messages: [], phase: "idle", typing: false, delayMs: 0 };
47092
- function prefersReducedMotion() {
47093
- return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
47094
- }
47095
- function useScriptedStream(frames, resetKey, enabled = true) {
47096
- const [index, setIndex] = useState105(0);
47097
- const [reducedMotion, setReducedMotion] = useState105(false);
47098
- const [prevKey, setPrevKey] = useState105(resetKey);
47099
- if (resetKey !== prevKey) {
47100
- setPrevKey(resetKey);
47101
- setIndex(0);
47102
- }
47103
- useEffect77(() => {
47104
- setReducedMotion(prefersReducedMotion());
47105
- const mq = window.matchMedia?.("(prefers-reduced-motion: reduce)");
47106
- if (!mq) return;
47107
- const onChange = () => setReducedMotion(mq.matches);
47108
- mq.addEventListener("change", onChange);
47109
- return () => mq.removeEventListener("change", onChange);
47110
- }, []);
47111
- const playing = enabled && !reducedMotion && frames.length > 0;
47112
- const lastIndex = Math.max(0, frames.length - 1);
47113
- useEffect77(() => {
47114
- if (!playing || index >= lastIndex) return;
47115
- const current = frames[Math.min(index, lastIndex)] ?? EMPTY_FRAME;
47116
- const t = setTimeout(() => setIndex((i) => Math.min(i + 1, lastIndex)), current.delayMs);
47117
- return () => clearTimeout(t);
47118
- }, [index, frames, playing, lastIndex]);
47119
- if (frames.length === 0) return EMPTY_FRAME;
47120
- if (!playing) return frames[lastIndex];
47121
- return frames[Math.min(index, lastIndex)] ?? EMPTY_FRAME;
47122
- }
47123
-
47124
47090
  // src/components/chat/hooks/use-jetstream-dialog-subscription.ts
47125
- import { useEffect as useEffect78, useRef as useRef64, useState as useState106 } from "react";
47091
+ import { useEffect as useEffect77, useRef as useRef64, useState as useState105 } from "react";
47126
47092
  var DEFAULT_INACTIVE_THRESHOLD_MS = 5 * 6e4;
47127
47093
  var DEFAULT_STREAM_NAME = "CHAT_CHUNKS";
47128
47094
  function useJetStreamDialogSubscription({
@@ -47141,57 +47107,57 @@ function useJetStreamDialogSubscription({
47141
47107
  reconnectionBackoff,
47142
47108
  inactiveThresholdMs
47143
47109
  }) {
47144
- const [isConnected, setIsConnected] = useState106(false);
47145
- const [isSubscribed, setIsSubscribed] = useState106(false);
47146
- const [reconnectionCount, setReconnectionCount] = useState106(0);
47147
- const [currentStreamSeq, setCurrentStreamSeq] = useState106(null);
47110
+ const [isConnected, setIsConnected] = useState105(false);
47111
+ const [isSubscribed, setIsSubscribed] = useState105(false);
47112
+ const [reconnectionCount, setReconnectionCount] = useState105(0);
47113
+ const [currentStreamSeq, setCurrentStreamSeq] = useState105(null);
47148
47114
  const clientRef = useRef64(null);
47149
47115
  const subscriptionRef = useRef64(null);
47150
47116
  const highestStreamSeqRef = useRef64(null);
47151
47117
  const onEventRef = useRef64(onEvent);
47152
- useEffect78(() => {
47118
+ useEffect77(() => {
47153
47119
  onEventRef.current = onEvent;
47154
47120
  }, [onEvent]);
47155
47121
  const onConnectRef = useRef64(onConnect);
47156
- useEffect78(() => {
47122
+ useEffect77(() => {
47157
47123
  onConnectRef.current = onConnect;
47158
47124
  }, [onConnect]);
47159
47125
  const onDisconnectRef = useRef64(onDisconnect);
47160
- useEffect78(() => {
47126
+ useEffect77(() => {
47161
47127
  onDisconnectRef.current = onDisconnect;
47162
47128
  }, [onDisconnect]);
47163
47129
  const onSubscribedRef = useRef64(onSubscribed);
47164
- useEffect78(() => {
47130
+ useEffect77(() => {
47165
47131
  onSubscribedRef.current = onSubscribed;
47166
47132
  }, [onSubscribed]);
47167
47133
  const onBeforeReconnectRef = useRef64(onBeforeReconnect);
47168
- useEffect78(() => {
47134
+ useEffect77(() => {
47169
47135
  onBeforeReconnectRef.current = onBeforeReconnect;
47170
47136
  }, [onBeforeReconnect]);
47171
47137
  const getNatsWsUrlRef = useRef64(getNatsWsUrl);
47172
- useEffect78(() => {
47138
+ useEffect77(() => {
47173
47139
  getNatsWsUrlRef.current = getNatsWsUrl;
47174
47140
  }, [getNatsWsUrl]);
47175
47141
  const reconnectionBackoffRef = useRef64(reconnectionBackoff);
47176
- useEffect78(() => {
47142
+ useEffect77(() => {
47177
47143
  reconnectionBackoffRef.current = reconnectionBackoff;
47178
47144
  }, [reconnectionBackoff]);
47179
47145
  const optStartSeqRef = useRef64(optStartSeq);
47180
- useEffect78(() => {
47146
+ useEffect77(() => {
47181
47147
  optStartSeqRef.current = optStartSeq;
47182
47148
  }, [optStartSeq]);
47183
47149
  const inactiveThresholdRef = useRef64(inactiveThresholdMs);
47184
- useEffect78(() => {
47150
+ useEffect77(() => {
47185
47151
  inactiveThresholdRef.current = inactiveThresholdMs;
47186
47152
  }, [inactiveThresholdMs]);
47187
47153
  const hadConnectionBeforeRef = useRef64(false);
47188
47154
  const clientConfigRef = useRef64(clientConfig);
47189
- useEffect78(() => {
47155
+ useEffect77(() => {
47190
47156
  clientConfigRef.current = clientConfig;
47191
47157
  }, [clientConfig]);
47192
47158
  const currentWsUrlRef = useRef64("");
47193
47159
  const wsUrl = getNatsWsUrl();
47194
- useEffect78(() => {
47160
+ useEffect77(() => {
47195
47161
  if (!enabled || !wsUrl) {
47196
47162
  if (currentWsUrlRef.current && clientRef.current) {
47197
47163
  releaseClient(currentWsUrlRef.current);
@@ -47272,7 +47238,7 @@ function useJetStreamDialogSubscription({
47272
47238
  }
47273
47239
  };
47274
47240
  }, [enabled, wsUrl]);
47275
- useEffect78(() => {
47241
+ useEffect77(() => {
47276
47242
  if (!enabled || !dialogId || !isConnected) {
47277
47243
  if (subscriptionRef.current) {
47278
47244
  try {
@@ -47355,7 +47321,7 @@ function useJetStreamDialogSubscription({
47355
47321
  setIsSubscribed(false);
47356
47322
  };
47357
47323
  }, [enabled, dialogId, isConnected, streamName, topic, reconnectionCount]);
47358
- useEffect78(() => {
47324
+ useEffect77(() => {
47359
47325
  highestStreamSeqRef.current = null;
47360
47326
  setCurrentStreamSeq(null);
47361
47327
  }, [dialogId]);
@@ -47363,7 +47329,7 @@ function useJetStreamDialogSubscription({
47363
47329
  }
47364
47330
 
47365
47331
  // src/components/chat/hooks/use-nats-dialog-subscription.ts
47366
- import { useEffect as useEffect79, useRef as useRef65, useState as useState107 } from "react";
47332
+ import { useEffect as useEffect78, useRef as useRef65, useState as useState106 } from "react";
47367
47333
  function useNatsDialogSubscription({
47368
47334
  enabled,
47369
47335
  dialogId,
@@ -47377,47 +47343,47 @@ function useNatsDialogSubscription({
47377
47343
  clientConfig = {},
47378
47344
  reconnectionBackoff
47379
47345
  }) {
47380
- const [isConnected, setIsConnected] = useState107(false);
47381
- const [isSubscribed, setIsSubscribed] = useState107(false);
47382
- const [reconnectionCount, setReconnectionCount] = useState107(0);
47346
+ const [isConnected, setIsConnected] = useState106(false);
47347
+ const [isSubscribed, setIsSubscribed] = useState106(false);
47348
+ const [reconnectionCount, setReconnectionCount] = useState106(0);
47383
47349
  const clientRef = useRef65(null);
47384
47350
  const subscriptionRefs = useRef65(/* @__PURE__ */ new Map());
47385
47351
  const onEventRef = useRef65(onEvent);
47386
- useEffect79(() => {
47352
+ useEffect78(() => {
47387
47353
  onEventRef.current = onEvent;
47388
47354
  }, [onEvent]);
47389
47355
  const onConnectRef = useRef65(onConnect);
47390
- useEffect79(() => {
47356
+ useEffect78(() => {
47391
47357
  onConnectRef.current = onConnect;
47392
47358
  }, [onConnect]);
47393
47359
  const onDisconnectRef = useRef65(onDisconnect);
47394
- useEffect79(() => {
47360
+ useEffect78(() => {
47395
47361
  onDisconnectRef.current = onDisconnect;
47396
47362
  }, [onDisconnect]);
47397
47363
  const onSubscribedRef = useRef65(onSubscribed);
47398
- useEffect79(() => {
47364
+ useEffect78(() => {
47399
47365
  onSubscribedRef.current = onSubscribed;
47400
47366
  }, [onSubscribed]);
47401
47367
  const onBeforeReconnectRef = useRef65(onBeforeReconnect);
47402
- useEffect79(() => {
47368
+ useEffect78(() => {
47403
47369
  onBeforeReconnectRef.current = onBeforeReconnect;
47404
47370
  }, [onBeforeReconnect]);
47405
47371
  const hadConnectionBeforeRef = useRef65(false);
47406
47372
  const getNatsWsUrlRef = useRef65(getNatsWsUrl);
47407
- useEffect79(() => {
47373
+ useEffect78(() => {
47408
47374
  getNatsWsUrlRef.current = getNatsWsUrl;
47409
47375
  }, [getNatsWsUrl]);
47410
47376
  const reconnectionBackoffRef = useRef65(reconnectionBackoff);
47411
- useEffect79(() => {
47377
+ useEffect78(() => {
47412
47378
  reconnectionBackoffRef.current = reconnectionBackoff;
47413
47379
  }, [reconnectionBackoff]);
47414
47380
  const clientConfigRef = useRef65(clientConfig);
47415
- useEffect79(() => {
47381
+ useEffect78(() => {
47416
47382
  clientConfigRef.current = clientConfig;
47417
47383
  }, [clientConfig]);
47418
47384
  const currentWsUrlRef = useRef65("");
47419
47385
  const wsUrl = getNatsWsUrl();
47420
- useEffect79(() => {
47386
+ useEffect78(() => {
47421
47387
  if (!enabled || !wsUrl) {
47422
47388
  if (currentWsUrlRef.current && clientRef.current) {
47423
47389
  releaseClient(currentWsUrlRef.current);
@@ -47501,12 +47467,12 @@ function useNatsDialogSubscription({
47501
47467
  const topicsKey = topics.join(",");
47502
47468
  const lastSubscribedDialogIdRef = useRef65(null);
47503
47469
  const isConnectedRef = useRef65(isConnected);
47504
- useEffect79(() => {
47470
+ useEffect78(() => {
47505
47471
  isConnectedRef.current = isConnected;
47506
47472
  }, [isConnected]);
47507
47473
  const currentDialogIdRef = useRef65(null);
47508
47474
  const abortControllerRef = useRef65(null);
47509
- useEffect79(() => {
47475
+ useEffect78(() => {
47510
47476
  currentDialogIdRef.current = dialogId;
47511
47477
  if (!enabled || !dialogId) {
47512
47478
  if (subscriptionRefs.current.size > 0) {
@@ -47587,7 +47553,7 @@ function useNatsDialogSubscription({
47587
47553
  abortControllerRef.current = null;
47588
47554
  };
47589
47555
  }, [enabled, dialogId, topicsKey, topics]);
47590
- useEffect79(() => {
47556
+ useEffect78(() => {
47591
47557
  if (!enabled || !currentDialogIdRef.current || !isConnected) {
47592
47558
  return;
47593
47559
  }
@@ -47637,7 +47603,7 @@ function buildNatsWsUrl(apiBaseUrl, options) {
47637
47603
  }
47638
47604
 
47639
47605
  // src/components/chat/hooks/use-realtime-chunk-processor.ts
47640
- import { useCallback as useCallback46, useRef as useRef66, useEffect as useEffect80 } from "react";
47606
+ import { useCallback as useCallback46, useRef as useRef66, useEffect as useEffect79 } from "react";
47641
47607
 
47642
47608
  // src/components/chat/utils/chunk-parser.ts
47643
47609
  function normalizeToolCalls(raw) {
@@ -48295,7 +48261,7 @@ function useRealtimeChunkProcessor(options) {
48295
48261
  })
48296
48262
  );
48297
48263
  const hasInitializedWithData = useRef66(false);
48298
- useEffect80(() => {
48264
+ useEffect79(() => {
48299
48265
  if (initialState && !hasInitializedWithData.current) {
48300
48266
  accumulatorRef.current.initializeWithState(initialState);
48301
48267
  if (initialState.escalatedApprovals) {
@@ -48313,7 +48279,7 @@ function useRealtimeChunkProcessor(options) {
48313
48279
  const directModeFlagRef = useRef66(isDirectMode);
48314
48280
  const sawDirectMessageRef = useRef66(false);
48315
48281
  const directTeardownFiredRef = useRef66(false);
48316
- useEffect80(() => {
48282
+ useEffect79(() => {
48317
48283
  directModeFlagRef.current = isDirectMode;
48318
48284
  }, [isDirectMode]);
48319
48285
  const pendingEscalatedRef = useRef66(/* @__PURE__ */ new Map());
@@ -48580,7 +48546,7 @@ function useRealtimeChunkProcessor(options) {
48580
48546
  }
48581
48547
 
48582
48548
  // src/components/chat/hooks/use-slash-commands.ts
48583
- import { useEffect as useEffect81, useState as useState108 } from "react";
48549
+ import { useEffect as useEffect80, useState as useState107 } from "react";
48584
48550
  import { useQuery as useQuery2 } from "@tanstack/react-query";
48585
48551
  async function fetchSlashCommands(prefix, signal, commandsUrl) {
48586
48552
  try {
@@ -48597,9 +48563,9 @@ async function fetchSlashCommands(prefix, signal, commandsUrl) {
48597
48563
  }
48598
48564
  }
48599
48565
  function useSlashCommands(prefix, commandsUrl) {
48600
- const [commands, setCommands] = useState108([]);
48601
- const [loading, setLoading] = useState108(false);
48602
- useEffect81(() => {
48566
+ const [commands, setCommands] = useState107([]);
48567
+ const [loading, setLoading] = useState107(false);
48568
+ useEffect80(() => {
48603
48569
  if (prefix == null) {
48604
48570
  setCommands([]);
48605
48571
  return;
@@ -48705,7 +48671,7 @@ function useEmptyStateConfig(emptyStateUrl, options) {
48705
48671
  }
48706
48672
 
48707
48673
  // src/components/chat/hooks/use-chat-attachments.ts
48708
- import { useCallback as useCallback47, useMemo as useMemo41, useRef as useRef67, useState as useState109 } from "react";
48674
+ import { useCallback as useCallback47, useMemo as useMemo41, useRef as useRef67, useState as useState108 } from "react";
48709
48675
  import { fileTypeFromBlob } from "file-type";
48710
48676
  var CHAT_ATTACHMENTS_BUCKET = "chat-attachments";
48711
48677
  var CHAT_ATTACHMENTS_FOLDER = "chat";
@@ -48781,7 +48747,7 @@ function uploadWithProgress(url, file, token, onProgress, signal) {
48781
48747
  function useChatAttachments() {
48782
48748
  const runtime = useRequiredChatRuntime();
48783
48749
  const uploadUrlEndpoint = runtime.endpoints.attachmentUploadUrl;
48784
- const [attachments, setAttachments] = useState109([]);
48750
+ const [attachments, setAttachments] = useState108([]);
48785
48751
  const controllersRef = useRef67(/* @__PURE__ */ new Map());
48786
48752
  const updateOne = useCallback47((id, patch) => {
48787
48753
  setAttachments((prev) => prev.map((a) => a.id === id ? { ...a, ...patch } : a));
@@ -48948,16 +48914,16 @@ function useChatAttachments() {
48948
48914
  }
48949
48915
 
48950
48916
  // src/components/chat/hooks/use-chat-attachment-image-gallery.tsx
48951
- import { useCallback as useCallback48, useEffect as useEffect82, useRef as useRef68, useState as useState110 } from "react";
48917
+ import { useCallback as useCallback48, useEffect as useEffect81, useRef as useRef68, useState as useState109 } from "react";
48952
48918
  import { jsx as jsx358 } from "react/jsx-runtime";
48953
48919
  var CLOSED = { isOpen: false, images: [], initialIndex: 0 };
48954
48920
  function useChatAttachmentImageGallery() {
48955
48921
  const runtime = useRequiredChatRuntime();
48956
48922
  const viewUrlPrefix = runtime.endpoints.attachmentViewUrlPrefix;
48957
48923
  const panelRef = useRef68(null);
48958
- const [state, setState] = useState110(CLOSED);
48924
+ const [state, setState] = useState109(CLOSED);
48959
48925
  const handleClose = useCallback48(() => setState(CLOSED), []);
48960
- useEffect82(() => {
48926
+ useEffect81(() => {
48961
48927
  const root = panelRef.current;
48962
48928
  if (!root) return;
48963
48929
  const onClick = (ev) => {
@@ -49003,7 +48969,7 @@ function absolutize(prefix) {
49003
48969
  }
49004
48970
 
49005
48971
  // src/components/chat/hooks/use-chat-identity.ts
49006
- import { createContext as createContext12, createElement as createElement2, useContext as useContext12, useEffect as useEffect83, useState as useState111 } from "react";
48972
+ import { createContext as createContext12, createElement as createElement2, useContext as useContext12, useEffect as useEffect82, useState as useState110 } from "react";
49007
48973
  var ANON_DEFAULTS = {
49008
48974
  authTier: "anon",
49009
48975
  source: null,
@@ -49014,9 +48980,9 @@ function useResolveChatIdentity(enabled) {
49014
48980
  const runtime = useRequiredChatRuntime();
49015
48981
  const url = runtime.endpoints.identityUrl;
49016
48982
  const proxyEmail = getEmbedProxyAuth()?.email ?? null;
49017
- const [data, setData] = useState111(ANON_DEFAULTS);
49018
- const [isLoading, setIsLoading] = useState111(enabled);
49019
- useEffect83(() => {
48983
+ const [data, setData] = useState110(ANON_DEFAULTS);
48984
+ const [isLoading, setIsLoading] = useState110(enabled);
48985
+ useEffect82(() => {
49020
48986
  if (!enabled) return;
49021
48987
  let cancelled = false;
49022
48988
  const ctrl = new AbortController();
@@ -49058,11 +49024,11 @@ function useChatIdentity() {
49058
49024
  }
49059
49025
 
49060
49026
  // src/components/chat/hooks/use-close-on-navigation.ts
49061
- import { useEffect as useEffect84, useRef as useRef69 } from "react";
49027
+ import { useEffect as useEffect83, useRef as useRef69 } from "react";
49062
49028
  function useCloseOnNavigation(close, pathname) {
49063
49029
  const prevPathnameRef = useRef69(null);
49064
49030
  const initializedRef = useRef69(false);
49065
- useEffect84(() => {
49031
+ useEffect83(() => {
49066
49032
  if (!initializedRef.current) {
49067
49033
  initializedRef.current = true;
49068
49034
  prevPathnameRef.current = pathname;
@@ -49076,13 +49042,13 @@ function useCloseOnNavigation(close, pathname) {
49076
49042
  }
49077
49043
 
49078
49044
  // src/components/chat/hooks/use-chat.ts
49079
- import { useState as useState113, useCallback as useCallback50, useEffect as useEffect85, useRef as useRef71 } from "react";
49045
+ import { useState as useState112, useCallback as useCallback50, useEffect as useEffect84, useRef as useRef71 } from "react";
49080
49046
 
49081
49047
  // src/components/chat/hooks/use-sse.ts
49082
- import { useState as useState112, useCallback as useCallback49, useRef as useRef70 } from "react";
49048
+ import { useState as useState111, useCallback as useCallback49, useRef as useRef70 } from "react";
49083
49049
  function useSSE({ useMock = true, debugMode = false, streamFn } = {}) {
49084
- const [isStreaming, setIsStreaming] = useState112(false);
49085
- const [error, setError] = useState112(null);
49050
+ const [isStreaming, setIsStreaming] = useState111(false);
49051
+ const [error, setError] = useState111(null);
49086
49052
  const abortControllerRef = useRef70(null);
49087
49053
  const fallbackStream = useCallback49(async function* () {
49088
49054
  throw new Error(
@@ -49149,12 +49115,12 @@ function useChat({
49149
49115
  initialMessages,
49150
49116
  onMessagesChange
49151
49117
  } = {}) {
49152
- const [messages, setMessages] = useState113(() => initialMessages ?? []);
49153
- const [isTyping, setIsTyping] = useState113(false);
49118
+ const [messages, setMessages] = useState112(() => initialMessages ?? []);
49119
+ const [isTyping, setIsTyping] = useState112(false);
49154
49120
  const currentAssistantSegmentsRef = useRef71([]);
49155
49121
  const onMessagesChangeRef = useRef71(onMessagesChange);
49156
49122
  onMessagesChangeRef.current = onMessagesChange;
49157
- useEffect85(() => {
49123
+ useEffect84(() => {
49158
49124
  onMessagesChangeRef.current?.(messages);
49159
49125
  }, [messages]);
49160
49126
  const {
@@ -49443,7 +49409,7 @@ function useChat({
49443
49409
  }
49444
49410
 
49445
49411
  // src/components/chat/hooks/use-sse-chat-adapter.ts
49446
- import { useState as useState114, useEffect as useEffect86, useCallback as useCallback51, useMemo as useMemo42, useRef as useRef72 } from "react";
49412
+ import { useState as useState113, useEffect as useEffect85, useCallback as useCallback51, useMemo as useMemo42, useRef as useRef72 } from "react";
49447
49413
  function createEmptyTurnMeta() {
49448
49414
  return {
49449
49415
  provider: null,
@@ -49778,8 +49744,8 @@ function useSseChatAdapter(options, runtimeOptions = {}) {
49778
49744
  const metaMapRef = useRef72(/* @__PURE__ */ new Map());
49779
49745
  const messagesRef = useRef72(persistedRef.current.messages);
49780
49746
  const sendCountRef = useRef72(persistedRef.current.sendCount);
49781
- const [streamingPhase, setStreamingPhase] = useState114("idle");
49782
- const [metaTick, setMetaTick] = useState114(0);
49747
+ const [streamingPhase, setStreamingPhase] = useState113("idle");
49748
+ const [metaTick, setMetaTick] = useState113(0);
49783
49749
  const bumpMetaTick = useCallback51(() => setMetaTick((t) => t + 1), []);
49784
49750
  const streamFn = useMemo42(
49785
49751
  () => createDocStreamFn(
@@ -49967,7 +49933,7 @@ function useSseChatAdapter(options, runtimeOptions = {}) {
49967
49933
  }
49968
49934
  }
49969
49935
  }, [chatClearMessages, source, bumpMetaTick]);
49970
- useEffect86(() => {
49936
+ useEffect85(() => {
49971
49937
  if (!isTyping && !isStreaming && streamingPhase !== "idle") {
49972
49938
  setStreamingPhase("idle");
49973
49939
  }
@@ -50049,10 +50015,10 @@ var noopRejectRequest = async (_id, _reason) => {
50049
50015
  // src/components/chat/hooks/use-nats-chat-adapter.ts
50050
50016
  import {
50051
50017
  useCallback as useCallback52,
50052
- useEffect as useEffect87,
50018
+ useEffect as useEffect86,
50053
50019
  useMemo as useMemo43,
50054
50020
  useRef as useRef73,
50055
- useState as useState115
50021
+ useState as useState114
50056
50022
  } from "react";
50057
50023
 
50058
50024
  // src/components/chat/utils/process-historical-messages.ts
@@ -50515,14 +50481,6 @@ function mapProcessedToUnified(processed) {
50515
50481
  }
50516
50482
  return out;
50517
50483
  }
50518
- function historicalToUnified(messages, options = {}) {
50519
- const { messages: processed } = processHistoricalMessagesWithErrors(messages, options);
50520
- const byId = new Map(processed.map((p) => [p.id, p]));
50521
- return mapProcessedToUnified(processed).map((u) => {
50522
- const p = byId.get(u.id);
50523
- return p ? { ...u, name: p.name, avatar: p.avatar ?? null, authorType: p.authorType, timestamp: p.timestamp } : u;
50524
- });
50525
- }
50526
50484
  function useNatsChatAdapter(config, options = {}) {
50527
50485
  const { active = true } = options;
50528
50486
  const {
@@ -50550,26 +50508,26 @@ function useNatsChatAdapter(config, options = {}) {
50550
50508
  modelLabel = null
50551
50509
  } = config;
50552
50510
  const isManagedMode = fetchDialogs !== void 0;
50553
- const [internalDialogId, setInternalDialogId] = useState115(null);
50511
+ const [internalDialogId, setInternalDialogId] = useState114(null);
50554
50512
  const dialogId = isManagedMode ? internalDialogId : controlledDialogId !== void 0 ? controlledDialogId : null;
50555
- const [messages, setMessages] = useState115([]);
50556
- const [streamingPhase, setStreamingPhase] = useState115("idle");
50513
+ const [messages, setMessages] = useState114([]);
50514
+ const [streamingPhase, setStreamingPhase] = useState114("idle");
50557
50515
  const streamingPhaseRef = useRef73(streamingPhase);
50558
50516
  streamingPhaseRef.current = streamingPhase;
50559
50517
  const suppressAgentBusyRef = useRef73(false);
50560
- const [approvalStatuses, setApprovalStatuses] = useState115({});
50561
- const [dialogs, setDialogs] = useState115([]);
50562
- const [dialogsNextCursor, setDialogsNextCursor] = useState115(null);
50563
- const [isDialogsLoading, setIsDialogsLoading] = useState115(false);
50564
- const [dialogsError, setDialogsError] = useState115(false);
50565
- const [isCreatingDialog, setIsCreatingDialog] = useState115(false);
50566
- const [messagesNextCursor, setMessagesNextCursor] = useState115(null);
50567
- const [isMessagesLoading, setIsMessagesLoading] = useState115(false);
50568
- const [dialogTokenUsage, setDialogTokenUsage] = useState115(
50518
+ const [approvalStatuses, setApprovalStatuses] = useState114({});
50519
+ const [dialogs, setDialogs] = useState114([]);
50520
+ const [dialogsNextCursor, setDialogsNextCursor] = useState114(null);
50521
+ const [isDialogsLoading, setIsDialogsLoading] = useState114(false);
50522
+ const [dialogsError, setDialogsError] = useState114(false);
50523
+ const [isCreatingDialog, setIsCreatingDialog] = useState114(false);
50524
+ const [messagesNextCursor, setMessagesNextCursor] = useState114(null);
50525
+ const [isMessagesLoading, setIsMessagesLoading] = useState114(false);
50526
+ const [dialogTokenUsage, setDialogTokenUsage] = useState114(
50569
50527
  null
50570
50528
  );
50571
- const [liveModel, setLiveModel] = useState115(null);
50572
- const [connectionState, setConnectionState] = useState115("connecting");
50529
+ const [liveModel, setLiveModel] = useState114(null);
50530
+ const [connectionState, setConnectionState] = useState114("connecting");
50573
50531
  const handleApprove = useCallback52(
50574
50532
  async (requestId) => {
50575
50533
  if (!approveRequestCallback) return;
@@ -50729,7 +50687,7 @@ function useNatsChatAdapter(config, options = {}) {
50729
50687
  ]
50730
50688
  );
50731
50689
  const prevDialogIdRef = useRef73(void 0);
50732
- useEffect87(() => {
50690
+ useEffect86(() => {
50733
50691
  if (prevDialogIdRef.current === dialogId) return;
50734
50692
  prevDialogIdRef.current = dialogId;
50735
50693
  historyLoadSeqRef.current += 1;
@@ -50743,7 +50701,7 @@ function useNatsChatAdapter(config, options = {}) {
50743
50701
  if (!active || !dialogId) return;
50744
50702
  void loadDialogHistory(dialogId);
50745
50703
  }, [active, dialogId, loadDialogHistory, resetAccumulator]);
50746
- useEffect87(() => {
50704
+ useEffect86(() => {
50747
50705
  if (!active || !dialogId) return;
50748
50706
  suppressAgentBusyRef.current = true;
50749
50707
  resetChunkTracking();
@@ -50768,7 +50726,7 @@ function useNatsChatAdapter(config, options = {}) {
50768
50726
  setConnectionState("connected");
50769
50727
  }
50770
50728
  });
50771
- useEffect87(() => {
50729
+ useEffect86(() => {
50772
50730
  if (!active || !dialogId) {
50773
50731
  setConnectionState("connected");
50774
50732
  return;
@@ -50807,7 +50765,7 @@ function useNatsChatAdapter(config, options = {}) {
50807
50765
  const reloadDialogs = useCallback52(() => {
50808
50766
  void loadDialogsPage();
50809
50767
  }, [loadDialogsPage]);
50810
- useEffect87(() => {
50768
+ useEffect86(() => {
50811
50769
  if (!fetchDialogs) return;
50812
50770
  if (!active) return;
50813
50771
  if (initialDialogsLoadedRef.current) return;
@@ -51386,62 +51344,8 @@ function chatChipClass({ tone, density = "chip", extra }) {
51386
51344
  return extra ? `${base} ${extra}` : base;
51387
51345
  }
51388
51346
 
51389
- // src/components/chat/utils/scripted-stream.ts
51390
- function normalizeHistoricalMessageData(md) {
51391
- return Array.isArray(md) ? md : md ? [md] : [];
51392
- }
51393
- function isHistoricalUserTurn(m) {
51394
- return !!m.owner;
51395
- }
51396
- var isTextSegment = (d) => d?.type === "TEXT" && typeof d.text === "string";
51397
- var THINK_MS = 550;
51398
- var TOKEN_MS = 55;
51399
- var USER_MS = 480;
51400
- var SEGMENT_MS = 340;
51401
- var POST_MS = 240;
51402
- function tokenize(text) {
51403
- return text.match(/\s*\S+\s*/g) ?? (text ? [text] : []);
51404
- }
51405
- function buildStreamFrames(messages) {
51406
- const frames = [];
51407
- const revealed = [];
51408
- const push = (msgs, phase, typing, delayMs) => frames.push({ messages: msgs.slice(), phase, typing, delayMs });
51409
- messages.forEach((msg) => {
51410
- if (isHistoricalUserTurn(msg)) {
51411
- revealed.push(msg);
51412
- push(revealed, "idle", false, USER_MS);
51413
- return;
51414
- }
51415
- if (revealed.length > 0) push(revealed, "thinking", true, THINK_MS);
51416
- const segs = normalizeHistoricalMessageData(msg.messageData);
51417
- const built = [];
51418
- const emit = () => push([...revealed, { ...msg, messageData: [...built] }], "streaming", false, 0);
51419
- segs.forEach((seg) => {
51420
- if (isTextSegment(seg)) {
51421
- const tokens = tokenize(seg.text);
51422
- let acc = "";
51423
- built.push({ ...seg, text: "" });
51424
- tokens.forEach((tok) => {
51425
- acc += tok;
51426
- built[built.length - 1] = { ...seg, text: acc };
51427
- push([...revealed, { ...msg, messageData: [...built] }], "streaming", false, TOKEN_MS);
51428
- });
51429
- built[built.length - 1] = { ...seg };
51430
- } else {
51431
- built.push(seg);
51432
- emit();
51433
- frames[frames.length - 1].delayMs = SEGMENT_MS;
51434
- }
51435
- });
51436
- revealed.push(msg);
51437
- push(revealed, "idle", false, POST_MS);
51438
- });
51439
- if (frames.length === 0) push(revealed, "idle", false, 0);
51440
- return frames;
51441
- }
51442
-
51443
51347
  // src/components/chat/embeddable-chat.tsx
51444
- import { useCallback as useCallback55, useEffect as useEffect88, useMemo as useMemo46, useRef as useRef75, useState as useState117 } from "react";
51348
+ import { useCallback as useCallback55, useEffect as useEffect87, useMemo as useMemo46, useRef as useRef75, useState as useState116 } from "react";
51445
51349
  import * as DialogPrimitive4 from "@radix-ui/react-dialog";
51446
51350
  import { usePreventScroll as usePreventScroll6 } from "@react-aria/overlays";
51447
51351
  import { isIOS } from "@react-aria/utils";
@@ -51522,7 +51426,7 @@ init_button2();
51522
51426
  import { FileText as FileText8, MessageSquare as MessageSquare3 } from "lucide-react";
51523
51427
 
51524
51428
  // src/components/chat/hooks/use-chat-dialog-manager.ts
51525
- import { useCallback as useCallback54, useMemo as useMemo45, useState as useState116 } from "react";
51429
+ import { useCallback as useCallback54, useMemo as useMemo45, useState as useState115 } from "react";
51526
51430
  function useChatDialogManager({
51527
51431
  dialogs,
51528
51432
  activeDialogId,
@@ -51533,8 +51437,8 @@ function useChatDialogManager({
51533
51437
  fetchArchivedDialogs,
51534
51438
  unarchiveDialog
51535
51439
  }) {
51536
- const [renameTarget, setRenameTarget] = useState116(null);
51537
- const [archiveTarget, setArchiveTarget] = useState116(null);
51440
+ const [renameTarget, setRenameTarget] = useState115(null);
51441
+ const [archiveTarget, setArchiveTarget] = useState115(null);
51538
51442
  const handleConfirmRename = useCallback54(
51539
51443
  (name) => {
51540
51444
  if (renameTarget) void renameDialog(renameTarget.id, name);
@@ -51557,10 +51461,10 @@ function useChatDialogManager({
51557
51461
  }
51558
51462
  setArchiveTarget(null);
51559
51463
  }, [archiveTarget, archiveDialog, activeDialogId, clearMessages]);
51560
- const [archiveOpen, setArchiveOpen] = useState116(false);
51561
- const [archivedDialogs, setArchivedDialogs] = useState116([]);
51562
- const [archivedCursor, setArchivedCursor] = useState116(null);
51563
- const [archivedLoading, setArchivedLoading] = useState116(false);
51464
+ const [archiveOpen, setArchiveOpen] = useState115(false);
51465
+ const [archivedDialogs, setArchivedDialogs] = useState115([]);
51466
+ const [archivedCursor, setArchivedCursor] = useState115(null);
51467
+ const [archivedLoading, setArchivedLoading] = useState115(false);
51564
51468
  const loadArchivedPage = useCallback54(
51565
51469
  async (cursor) => {
51566
51470
  if (!fetchArchivedDialogs) return;
@@ -51586,10 +51490,10 @@ function useChatDialogManager({
51586
51490
  void loadArchivedPage();
51587
51491
  }, [loadArchivedPage]);
51588
51492
  const closeArchive = useCallback54(() => setArchiveOpen(false), []);
51589
- const [viewingArchivedId, setViewingArchivedId] = useState116(
51493
+ const [viewingArchivedId, setViewingArchivedId] = useState115(
51590
51494
  null
51591
51495
  );
51592
- const [openingDialogId, setOpeningDialogId] = useState116(null);
51496
+ const [openingDialogId, setOpeningDialogId] = useState115(null);
51593
51497
  const handleSelectDialog = useCallback54(
51594
51498
  (id) => {
51595
51499
  setViewingArchivedId(null);
@@ -51608,7 +51512,7 @@ function useChatDialogManager({
51608
51512
  },
51609
51513
  [selectDialog]
51610
51514
  );
51611
- const [restoreTarget, setRestoreTarget] = useState116(null);
51515
+ const [restoreTarget, setRestoreTarget] = useState115(null);
51612
51516
  const handleConfirmRestore = useCallback54(async () => {
51613
51517
  if (restoreTarget) {
51614
51518
  try {
@@ -51860,7 +51764,7 @@ function SourceChips({
51860
51764
  onClose,
51861
51765
  onDiscuss
51862
51766
  }) {
51863
- const [expanded, setExpanded] = useState117(false);
51767
+ const [expanded, setExpanded] = useState116(false);
51864
51768
  if (cited.length === 0) {
51865
51769
  const fallback = uncited.slice(0, FALLBACK_TOP_RETRIEVED);
51866
51770
  if (fallback.length === 0) return null;
@@ -51966,7 +51870,7 @@ function EmbeddableChatInner({
51966
51870
  const commandsUrl = runtime.endpoints.commandsUrl;
51967
51871
  const { attachmentsEnabled, user: identityUser } = useChatIdentity();
51968
51872
  const viewUrlPrefix = runtime.endpoints.attachmentViewUrlPrefix;
51969
- useEffect88(() => {
51873
+ useEffect87(() => {
51970
51874
  if (process.env.NODE_ENV !== "production") {
51971
51875
  const hasOpen = open !== void 0;
51972
51876
  const hasHandler = onOpenChange !== void 0;
@@ -51982,13 +51886,13 @@ function EmbeddableChatInner({
51982
51886
  defaultProp: defaultOpen ?? false,
51983
51887
  onChange: onOpenChange
51984
51888
  });
51985
- const [autoFocusInput] = useState117(() => {
51889
+ const [autoFocusInput] = useState116(() => {
51986
51890
  if (typeof window === "undefined") return false;
51987
51891
  return !window.matchMedia("(pointer: coarse)").matches;
51988
51892
  });
51989
51893
  usePreventScroll6({ isDisabled: !isOpen || shellLess });
51990
51894
  const navigatingAwayRef = useRef75(false);
51991
- useEffect88(() => {
51895
+ useEffect87(() => {
51992
51896
  if (!isOpen) return;
51993
51897
  if (shellLess) return;
51994
51898
  if (typeof window === "undefined") return;
@@ -52015,7 +51919,7 @@ function EmbeddableChatInner({
52015
51919
  };
52016
51920
  }, [isOpen, shellLess]);
52017
51921
  const chatInputRef = useRef75(null);
52018
- const [quickActionPreview, setQuickActionPreview] = useState117(null);
51922
+ const [quickActionPreview, setQuickActionPreview] = useState116(null);
52019
51923
  const slashCommandsProp = useMemo46(
52020
51924
  () => ({
52021
51925
  fetchCommands: (prefix, signal) => fetchSlashCommands(prefix, signal, commandsUrl),
@@ -52058,7 +51962,7 @@ function EmbeddableChatInner({
52058
51962
  }, [mingoState, mingoDialogCapabilities, effectiveModes]);
52059
51963
  const hasMingoMode = !!effectiveModes.mingo || !!mingoState;
52060
51964
  const initialActiveMode = controlledActiveMode ?? defaultActiveMode ?? (effectiveModes.guide ? "guide" : "mingo");
52061
- const [uncontrolledActiveMode, setUncontrolledActiveMode] = useState117(initialActiveMode);
51965
+ const [uncontrolledActiveMode, setUncontrolledActiveMode] = useState116(initialActiveMode);
52062
51966
  const activeMode = controlledActiveMode ?? uncontrolledActiveMode;
52063
51967
  const handleActiveModeChange = useCallback55(
52064
51968
  (next) => {
@@ -52119,7 +52023,7 @@ function EmbeddableChatInner({
52119
52023
  loadMoreMessages
52120
52024
  } = useUnifiedChat({ modes: effectiveModes, activeMode, mingoStateOverride: mingoState });
52121
52025
  const guidePromptSentRef = useRef75(false);
52122
- useEffect88(() => {
52026
+ useEffect87(() => {
52123
52027
  if (!guidePendingPrompt) {
52124
52028
  guidePromptSentRef.current = false;
52125
52029
  return;
@@ -52140,15 +52044,15 @@ function EmbeddableChatInner({
52140
52044
  const { panelRef: galleryPanelRef, modal: galleryModal } = useChatAttachmentImageGallery();
52141
52045
  const contextMaxItems = contextPicker?.maxItems ?? 10;
52142
52046
  const contextPickerForMode = activeMode === "mingo" ? contextPicker : void 0;
52143
- const [contextItems, setContextItems] = useState117([]);
52144
- const [contextPickerOpen, setContextPickerOpen] = useState117(false);
52145
- const [mentionQuery, setMentionQuery] = useState117(null);
52047
+ const [contextItems, setContextItems] = useState116([]);
52048
+ const [contextPickerOpen, setContextPickerOpen] = useState116(false);
52049
+ const [mentionQuery, setMentionQuery] = useState116(null);
52146
52050
  const mentionActiveRef = useRef75(false);
52147
- useEffect88(() => {
52051
+ useEffect87(() => {
52148
52052
  mentionActiveRef.current = mentionQuery !== null;
52149
52053
  }, [mentionQuery]);
52150
52054
  const mentionKeysRef = useRef75(/* @__PURE__ */ new Set());
52151
- useEffect88(() => {
52055
+ useEffect87(() => {
52152
52056
  setContextItems([]);
52153
52057
  setMentionQuery(null);
52154
52058
  mentionKeysRef.current.clear();
@@ -52369,7 +52273,7 @@ function EmbeddableChatInner({
52369
52273
  });
52370
52274
  const handleOpen = useCallback55(() => setIsOpen(true), [setIsOpen]);
52371
52275
  useCloseOnNavigation(handleNavigationClose, null);
52372
- useEffect88(() => {
52276
+ useEffect87(() => {
52373
52277
  const handler = (e) => {
52374
52278
  const detail = e.detail;
52375
52279
  if (!detail || detail.source !== source) return;
@@ -52379,7 +52283,7 @@ function EmbeddableChatInner({
52379
52283
  window.addEventListener("ask-ai:open-with-ref", handler);
52380
52284
  return () => window.removeEventListener("ask-ai:open-with-ref", handler);
52381
52285
  }, [source, discussRef, setIsOpen]);
52382
- useEffect88(() => {
52286
+ useEffect87(() => {
52383
52287
  const handler = (e) => {
52384
52288
  const detail = e.detail;
52385
52289
  if (!detail || detail.source !== source) return;
@@ -52396,7 +52300,7 @@ function EmbeddableChatInner({
52396
52300
  const contentViewKey = hasConversation ? "conversation" : activeMode;
52397
52301
  const isGuideEmpty = !hasConversation && activeMode === "guide";
52398
52302
  const isQuickActionEmpty = !hasConversation && (activeMode === "guide" || activeMode === "mingo");
52399
- useEffect88(() => {
52303
+ useEffect87(() => {
52400
52304
  if (!isQuickActionEmpty) setQuickActionPreview(null);
52401
52305
  }, [isQuickActionEmpty]);
52402
52306
  const guideCanReturnToMingo = isGuideEmpty && hasMingoMode;
@@ -52438,7 +52342,7 @@ function EmbeddableChatInner({
52438
52342
  const uncited = sources.filter((s) => !seenOrder.has(s.index));
52439
52343
  return { cited, uncited };
52440
52344
  }, [lastAssistantMsg, chatLoading]);
52441
- const [portalHost, setPortalHost] = useState117(null);
52345
+ const [portalHost, setPortalHost] = useState116(null);
52442
52346
  const body = /* @__PURE__ */ jsxs286(PortalContainerContext.Provider, { value: portalHost, children: [
52443
52347
  /* @__PURE__ */ jsx361(
52444
52348
  "div",
@@ -53294,7 +53198,6 @@ export {
53294
53198
  normalizeContent2 as normalizeContent,
53295
53199
  NETWORK_CONFIG,
53296
53200
  useChunkCatchup,
53297
- useScriptedStream,
53298
53201
  useJetStreamDialogSubscription,
53299
53202
  useNatsDialogSubscription,
53300
53203
  buildNatsWsUrl,
@@ -53333,7 +53236,6 @@ export {
53333
53236
  extractErrorMessages,
53334
53237
  processHistoricalMessagesWithErrors,
53335
53238
  mapProcessedToUnified,
53336
- historicalToUnified,
53337
53239
  useNatsChatAdapter,
53338
53240
  useUnifiedChat,
53339
53241
  extractIncompleteMessageState,
@@ -53345,9 +53247,6 @@ export {
53345
53247
  CHIP_ACTION_BUTTON_CLASS,
53346
53248
  chatChipClass,
53347
53249
  clickupTaskUrl,
53348
- normalizeHistoricalMessageData,
53349
- isHistoricalUserTurn,
53350
- buildStreamFrames,
53351
53250
  EmbeddableChat,
53352
53251
  FilterCheckboxItem,
53353
53252
  TagKeyValueFilter,
@@ -53647,8 +53546,6 @@ export {
53647
53546
  BoardColumnHeader,
53648
53547
  tintOnDark,
53649
53548
  BoardTicketApproval,
53650
- TicketCardBody,
53651
- TicketCardView,
53652
53549
  TicketCard,
53653
53550
  TicketCardSkeleton,
53654
53551
  BoardColumn,
@@ -53749,4 +53646,4 @@ export {
53749
53646
  LogsList,
53750
53647
  assets
53751
53648
  };
53752
- //# sourceMappingURL=chunk-TYANQCZA.js.map
53649
+ //# sourceMappingURL=chunk-62L7S7HQ.js.map