@iota-uz/sdk 0.4.14 → 0.4.16

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.
@@ -903,8 +903,10 @@ interface AssistantTurnViewProps {
903
903
  hideActions?: boolean;
904
904
  /** Hide timestamp */
905
905
  hideTimestamp?: boolean;
906
+ /** Whether regenerate action should be available */
907
+ allowRegenerate?: boolean;
906
908
  }
907
- declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
909
+ declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, allowRegenerate, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
908
910
 
909
911
  interface TurnBubbleClassNames {
910
912
  /** Root container */
@@ -903,8 +903,10 @@ interface AssistantTurnViewProps {
903
903
  hideActions?: boolean;
904
904
  /** Hide timestamp */
905
905
  hideTimestamp?: boolean;
906
+ /** Whether regenerate action should be available */
907
+ allowRegenerate?: boolean;
906
908
  }
907
- declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
909
+ declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, allowRegenerate, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
908
910
 
909
911
  interface TurnBubbleClassNames {
910
912
  /** Root container */
@@ -2184,11 +2184,12 @@ function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }) {
2184
2184
  actionsSlot && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: actionsSlot })
2185
2185
  ] }) });
2186
2186
  }
2187
+ const resolvedSessionTitle = session.title?.trim() || t("BiChat.Chat.NewChat");
2187
2188
  return /* @__PURE__ */ jsx("header", { className: "bichat-header border-b border-gray-200 dark:border-gray-700 px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2188
2189
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2189
2190
  BackButton,
2190
2191
  Logo,
2191
- /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children: session.title }),
2192
+ /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children: resolvedSessionTitle }),
2192
2193
  session.pinned && /* @__PURE__ */ jsx(
2193
2194
  "svg",
2194
2195
  {
@@ -4230,7 +4231,8 @@ function AssistantTurnView({
4230
4231
  classNames,
4231
4232
  hideAvatar,
4232
4233
  hideActions,
4233
- hideTimestamp
4234
+ hideTimestamp,
4235
+ allowRegenerate = true
4234
4236
  }) {
4235
4237
  const { debugMode } = useChatSession();
4236
4238
  const { handleCopy, handleRegenerate, pendingQuestion, sendMessage, loading } = useChatMessaging();
@@ -4259,7 +4261,7 @@ function AssistantTurnView({
4259
4261
  slots,
4260
4262
  classNames,
4261
4263
  onCopy: handleCopy,
4262
- onRegenerate: handleRegenerate,
4264
+ onRegenerate: allowRegenerate ? handleRegenerate : void 0,
4263
4265
  onSendMessage: sendMessage,
4264
4266
  sendDisabled: loading || isStreaming,
4265
4267
  hideAvatar,
@@ -4775,8 +4777,8 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
4775
4777
  isLastTurn: index === turns.length - 1,
4776
4778
  renderUserTurn,
4777
4779
  renderAssistantTurn,
4778
- userTurnProps: readOnly ? { hideActions: true, allowEdit: false } : { allowEdit: index === turns.length - 1 },
4779
- assistantTurnProps: readOnly ? { hideActions: true } : void 0
4780
+ userTurnProps: readOnly ? { allowEdit: false } : { allowEdit: index === turns.length - 1 },
4781
+ assistantTurnProps: readOnly ? { allowRegenerate: false } : void 0
4780
4782
  },
4781
4783
  turn.id
4782
4784
  )),
@@ -6918,11 +6920,15 @@ function ChatSessionCore({
6918
6920
  setRestoring(true);
6919
6921
  try {
6920
6922
  await dataSource.unarchiveSession(session.id);
6923
+ retryFetchSession();
6924
+ window.dispatchEvent(new CustomEvent("bichat:sessions-updated", {
6925
+ detail: { reason: "restored", sessionId: session.id }
6926
+ }));
6921
6927
  onSessionRestored?.(session.id);
6922
6928
  } finally {
6923
6929
  setRestoring(false);
6924
6930
  }
6925
- }, [dataSource, session?.id, onSessionRestored]);
6931
+ }, [dataSource, onSessionRestored, retryFetchSession, session?.id]);
6926
6932
  const [artifactsPanelExpanded, setArtifactsPanelExpanded] = useState(
6927
6933
  artifactsPanelDefaultExpanded
6928
6934
  );
@@ -7420,7 +7426,11 @@ var EditableText = forwardRef(
7420
7426
  "div",
7421
7427
  {
7422
7428
  className: "flex items-center gap-2 flex-1",
7423
- onClick: (e) => e.preventDefault(),
7429
+ onClick: (e) => {
7430
+ e.preventDefault();
7431
+ e.stopPropagation();
7432
+ },
7433
+ onPointerDown: (e) => e.stopPropagation(),
7424
7434
  children: /* @__PURE__ */ jsx(
7425
7435
  "input",
7426
7436
  {
@@ -7432,6 +7442,8 @@ var EditableText = forwardRef(
7432
7442
  onBlur: handleBlur,
7433
7443
  maxLength,
7434
7444
  placeholder: resolvedPlaceholder,
7445
+ onClick: (e) => e.stopPropagation(),
7446
+ onPointerDown: (e) => e.stopPropagation(),
7435
7447
  className: `flex-1 px-2 py-1 ${sizeClass} bg-white dark:bg-gray-700 border border-primary-500 dark:border-primary-600 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:focus-visible:ring-primary-600/30 text-gray-900 dark:text-white ${inputClassName}`,
7436
7448
  "aria-label": t("BiChat.EditableText.AriaLabel")
7437
7449
  }
@@ -7892,8 +7904,8 @@ function ConfirmModalBase({
7892
7904
  isDanger = false
7893
7905
  }) {
7894
7906
  const { t } = useTranslation();
7895
- const resolvedConfirmText = confirmText ?? t("BiChat.Common.Confirm");
7896
- const resolvedCancelText = cancelText ?? t("BiChat.Common.Cancel");
7907
+ const resolvedConfirmText = confirmText?.trim() ? confirmText : t("BiChat.Common.Confirm");
7908
+ const resolvedCancelText = cancelText?.trim() ? cancelText : t("BiChat.Common.Cancel");
7897
7909
  return /* @__PURE__ */ jsxs(Dialog, { open: isOpen, onClose: onCancel, className: "relative z-40", children: [
7898
7910
  /* @__PURE__ */ jsx(DialogBackdrop, { className: "fixed inset-0 bg-black/40 dark:bg-black/60 backdrop-blur-sm transition-opacity duration-200" }),
7899
7911
  /* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs(DialogPanel, { className: "bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/30 max-w-sm w-full overflow-hidden", children: [
@@ -8355,7 +8367,7 @@ var SessionItem = memo(
8355
8367
  useEffect(() => {
8356
8368
  setIsTouch("ontouchend" in document);
8357
8369
  }, []);
8358
- const isTitleGenerating = !session.title || session.title === t("BiChat.Chat.NewChat");
8370
+ const isTitleGenerating = !session.title?.trim();
8359
8371
  const displayTitle = isTitleGenerating ? t("BiChat.Common.Generating") : session.title ?? t("BiChat.Common.Untitled");
8360
8372
  const { handlers: longPressHandlers } = useLongPress({
8361
8373
  delay: 500,
@@ -8867,116 +8879,124 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
8867
8879
  });
8868
8880
  return Array.from(userMap.values());
8869
8881
  }, [chats, users, dataSource.listUsers]);
8870
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
8871
- /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 space-y-3 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
8872
- /* @__PURE__ */ jsx(
8873
- MemoizedUserFilter,
8874
- {
8875
- users: derivedUsers,
8876
- selectedUser,
8877
- onUserChange: setSelectedUser,
8878
- loading: usersLoading || fetching && chats.length === 0
8879
- }
8880
- ),
8881
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
8882
- /* @__PURE__ */ jsx(
8883
- "input",
8884
- {
8885
- type: "checkbox",
8886
- checked: includeArchived,
8887
- onChange: (e) => setIncludeArchived(e.target.checked),
8888
- className: "\n w-4 h-4 rounded border-gray-300 dark:border-gray-600\n text-primary-600 focus:ring-primary-500 focus:ring-offset-0\n bg-white dark:bg-gray-800\n cursor-pointer\n "
8889
- }
8890
- ),
8891
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-700 dark:text-gray-300 flex items-center gap-1.5", children: [
8892
- /* @__PURE__ */ jsx(Archive, { size: 16, className: "w-4 h-4" }),
8893
- t("BiChat.AllChats.IncludeArchived")
8894
- ] })
8895
- ] }),
8896
- totalCount > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("BiChat.AllChats.ChatFound", { count: totalCount }) : t("BiChat.AllChats.ChatsFound", { count: totalCount }) })
8897
- ] }),
8898
- /* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("BiChat.AllChats.OrganizationChats"), children: [
8899
- fetching && chats.length === 0 ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsx(Fragment, { children: chats.length > 0 ? /* @__PURE__ */ jsxs(
8900
- motion.div,
8901
- {
8902
- className: "space-y-1 mt-2",
8903
- variants: staggerContainerVariants,
8904
- initial: "hidden",
8905
- animate: "visible",
8906
- role: "list",
8907
- "aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
8908
- children: [
8909
- chats.map((chat) => /* @__PURE__ */ jsx(
8910
- motion.div,
8882
+ return /* @__PURE__ */ jsxs(
8883
+ "div",
8884
+ {
8885
+ className: "flex flex-col h-full overflow-hidden",
8886
+ onClick: (e) => e.stopPropagation(),
8887
+ onPointerDown: (e) => e.stopPropagation(),
8888
+ children: [
8889
+ /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 space-y-3 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
8890
+ /* @__PURE__ */ jsx(
8891
+ MemoizedUserFilter,
8892
+ {
8893
+ users: derivedUsers,
8894
+ selectedUser,
8895
+ onUserChange: setSelectedUser,
8896
+ loading: usersLoading || fetching && chats.length === 0
8897
+ }
8898
+ ),
8899
+ /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
8900
+ /* @__PURE__ */ jsx(
8901
+ "input",
8911
8902
  {
8912
- initial: { opacity: 0, y: -10 },
8913
- animate: { opacity: 1, y: 0 },
8914
- exit: { opacity: 0, y: -10 },
8915
- children: /* @__PURE__ */ jsx(
8916
- "div",
8903
+ type: "checkbox",
8904
+ checked: includeArchived,
8905
+ onChange: (e) => setIncludeArchived(e.target.checked),
8906
+ className: "\n w-4 h-4 rounded border-gray-300 dark:border-gray-600\n text-primary-600 focus:ring-primary-500 focus:ring-offset-0\n bg-white dark:bg-gray-800\n cursor-pointer\n "
8907
+ }
8908
+ ),
8909
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-700 dark:text-gray-300 flex items-center gap-1.5", children: [
8910
+ /* @__PURE__ */ jsx(Archive, { size: 16, className: "w-4 h-4" }),
8911
+ t("BiChat.AllChats.IncludeArchived")
8912
+ ] })
8913
+ ] }),
8914
+ totalCount > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("BiChat.AllChats.ChatFound", { count: totalCount }) : t("BiChat.AllChats.ChatsFound", { count: totalCount }) })
8915
+ ] }),
8916
+ /* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("BiChat.AllChats.OrganizationChats"), children: [
8917
+ fetching && chats.length === 0 ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsx(Fragment, { children: chats.length > 0 ? /* @__PURE__ */ jsxs(
8918
+ motion.div,
8919
+ {
8920
+ className: "space-y-1 mt-2",
8921
+ variants: staggerContainerVariants,
8922
+ initial: "hidden",
8923
+ animate: "visible",
8924
+ role: "list",
8925
+ "aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
8926
+ children: [
8927
+ chats.map((chat) => /* @__PURE__ */ jsx(
8928
+ motion.div,
8917
8929
  {
8918
- role: "link",
8919
- tabIndex: 0,
8920
- onClick: () => onSessionSelect(chat.id),
8921
- onKeyDown: (e) => {
8922
- if (e.key === "Enter" || e.key === " ") {
8923
- e.preventDefault();
8924
- onSessionSelect(chat.id);
8925
- }
8926
- },
8927
- className: `
8930
+ initial: { opacity: 0, y: -10 },
8931
+ animate: { opacity: 1, y: 0 },
8932
+ exit: { opacity: 0, y: -10 },
8933
+ children: /* @__PURE__ */ jsx(
8934
+ "div",
8935
+ {
8936
+ role: "link",
8937
+ tabIndex: 0,
8938
+ onClick: () => onSessionSelect(chat.id),
8939
+ onKeyDown: (e) => {
8940
+ if (e.key === "Enter" || e.key === " ") {
8941
+ e.preventDefault();
8942
+ onSessionSelect(chat.id);
8943
+ }
8944
+ },
8945
+ className: `
8928
8946
  block px-3 py-2 rounded-lg transition-smooth group cursor-pointer
8929
8947
  ${chat.id === activeSessionId ? "bg-primary-50/50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 border-l-4 border-primary-400 dark:border-primary-600" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 border-l-4 border-transparent"}
8930
8948
  `,
8931
- "aria-current": chat.id === activeSessionId ? "page" : void 0,
8932
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
8933
- /* @__PURE__ */ jsx(
8934
- MemoizedUserAvatar,
8935
- {
8936
- firstName: chat.owner.firstName,
8937
- lastName: chat.owner.lastName,
8938
- initials: chat.owner.initials,
8939
- size: "sm"
8940
- }
8941
- ),
8942
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
8943
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("BiChat.Common.Untitled") }),
8944
- /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: [
8945
- chat.owner.firstName,
8946
- " ",
8947
- chat.owner.lastName
8948
- ] }),
8949
- chat.status === "archived" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 mt-1 px-2 py-0.5 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-full text-xs", children: [
8950
- /* @__PURE__ */ jsx(Archive, { size: 12, className: "w-3 h-3" }),
8951
- t("BiChat.Chat.Archived")
8949
+ "aria-current": chat.id === activeSessionId ? "page" : void 0,
8950
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
8951
+ /* @__PURE__ */ jsx(
8952
+ MemoizedUserAvatar,
8953
+ {
8954
+ firstName: chat.owner.firstName,
8955
+ lastName: chat.owner.lastName,
8956
+ initials: chat.owner.initials,
8957
+ size: "sm"
8958
+ }
8959
+ ),
8960
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
8961
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("BiChat.Common.Untitled") }),
8962
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: [
8963
+ chat.owner.firstName,
8964
+ " ",
8965
+ chat.owner.lastName
8966
+ ] }),
8967
+ chat.status === "archived" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 mt-1 px-2 py-0.5 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-full text-xs", children: [
8968
+ /* @__PURE__ */ jsx(Archive, { size: 12, className: "w-3 h-3" }),
8969
+ t("BiChat.Chat.Archived")
8970
+ ] })
8971
+ ] })
8952
8972
  ] })
8953
- ] })
8954
- ] })
8973
+ }
8974
+ )
8975
+ },
8976
+ chat.id
8977
+ )),
8978
+ hasMore && /* @__PURE__ */ jsx("div", { ref: loadMoreRef, className: "py-4 text-center", children: fetching ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 2 }) : /* @__PURE__ */ jsx(
8979
+ "button",
8980
+ {
8981
+ onClick: handleLoadMore,
8982
+ className: "text-sm text-primary-600 dark:text-primary-400 hover:underline",
8983
+ children: t("BiChat.AllChats.LoadMore")
8955
8984
  }
8956
- )
8957
- },
8958
- chat.id
8959
- )),
8960
- hasMore && /* @__PURE__ */ jsx("div", { ref: loadMoreRef, className: "py-4 text-center", children: fetching ? /* @__PURE__ */ jsx(SessionSkeleton, { count: 2 }) : /* @__PURE__ */ jsx(
8961
- "button",
8962
- {
8963
- onClick: handleLoadMore,
8964
- className: "text-sm text-primary-600 dark:text-primary-400 hover:underline",
8965
- children: t("BiChat.AllChats.LoadMore")
8966
- }
8967
- ) })
8968
- ]
8969
- }
8970
- ) : /* @__PURE__ */ jsx(
8971
- MemoizedEmptyState,
8972
- {
8973
- title: t("BiChat.AllChats.NoChatsFound"),
8974
- description: selectedUser ? t("BiChat.AllChats.NoChatsFromUser", { firstName: selectedUser.firstName, lastName: selectedUser.lastName }) : includeArchived ? t("BiChat.AllChats.NoChatsInOrg") : t("BiChat.AllChats.NoActiveChatsInOrg")
8975
- }
8976
- ) }),
8977
- error && /* @__PURE__ */ jsx("div", { className: "mx-2 mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 dark:text-red-400", children: error }) })
8978
- ] })
8979
- ] });
8985
+ ) })
8986
+ ]
8987
+ }
8988
+ ) : /* @__PURE__ */ jsx(
8989
+ MemoizedEmptyState,
8990
+ {
8991
+ title: t("BiChat.AllChats.NoChatsFound"),
8992
+ description: selectedUser ? t("BiChat.AllChats.NoChatsFromUser", { firstName: selectedUser.firstName, lastName: selectedUser.lastName }) : includeArchived ? t("BiChat.AllChats.NoChatsInOrg") : t("BiChat.AllChats.NoActiveChatsInOrg")
8993
+ }
8994
+ ) }),
8995
+ error && /* @__PURE__ */ jsx("div", { className: "mx-2 mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 dark:text-red-400", children: error }) })
8996
+ ] })
8997
+ ]
8998
+ }
8999
+ );
8980
9000
  }
8981
9001
 
8982
9002
  // ui/src/bichat/components/Sidebar.tsx
@@ -9160,12 +9180,13 @@ function Sidebar2({
9160
9180
  const shouldReduceMotion = useReducedMotion();
9161
9181
  const sessionListRef = useRef(null);
9162
9182
  const searchContainerRef = useRef(null);
9183
+ const refreshForActiveSessionRef = useRef(null);
9163
9184
  const { isCollapsed, toggle, collapse } = useSidebarCollapse();
9164
9185
  const collapsible = !onClose;
9165
9186
  const handleSidebarClick = useCallback(
9166
9187
  (e) => {
9167
9188
  if (!collapsible) return;
9168
- const interactive = 'a, button, input, summary, [role="button"]';
9189
+ const interactive = 'a, button, input, textarea, select, summary, label, [role="button"], [role="link"], [contenteditable="true"], [data-no-sidebar-toggle]';
9169
9190
  if (e.target.closest(interactive)) return;
9170
9191
  toggle();
9171
9192
  },
@@ -9222,6 +9243,24 @@ function Sidebar2({
9222
9243
  useEffect(() => {
9223
9244
  fetchSessions();
9224
9245
  }, [fetchSessions, refreshKey]);
9246
+ useEffect(() => {
9247
+ if (!activeSessionId) {
9248
+ refreshForActiveSessionRef.current = null;
9249
+ return;
9250
+ }
9251
+ if (loading) return;
9252
+ const hasActiveSession = sessions.some((session) => session.id === activeSessionId);
9253
+ if (hasActiveSession) {
9254
+ if (refreshForActiveSessionRef.current === activeSessionId) {
9255
+ refreshForActiveSessionRef.current = null;
9256
+ }
9257
+ return;
9258
+ }
9259
+ if (refreshForActiveSessionRef.current !== activeSessionId) {
9260
+ refreshForActiveSessionRef.current = activeSessionId;
9261
+ setRefreshKey((k) => k + 1);
9262
+ }
9263
+ }, [activeSessionId, loading, sessions]);
9225
9264
  const hasPlaceholderTitles = useMemo(() => {
9226
9265
  const newChatLabel = t("BiChat.Chat.NewChat");
9227
9266
  return Array.isArray(sessions) && sessions.some((s) => s && (!s.title || s.title === newChatLabel));
@@ -9254,6 +9293,9 @@ function Sidebar2({
9254
9293
  try {
9255
9294
  await dataSource.archiveSession(sessionToArchive);
9256
9295
  setRefreshKey((k) => k + 1);
9296
+ window.dispatchEvent(new CustomEvent("bichat:sessions-updated", {
9297
+ detail: { reason: "archived", sessionId: sessionToArchive }
9298
+ }));
9257
9299
  if (wasCurrentSession) {
9258
9300
  onSessionSelect("");
9259
9301
  }