@ateam-ai-mobile/core 0.1.38 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as zustand from 'zustand';
2
+ import { UseBoundStore, StoreApi } from 'zustand';
2
3
 
3
4
  /**
4
5
  * Storage adapter contracts. The core is platform-agnostic (no Expo, no
@@ -847,6 +848,8 @@ interface Message {
847
848
  chainId?: string;
848
849
  /** Turn variant. 'notification' = proactive/system-initiated. */
849
850
  kind?: 'notification' | string;
851
+ /** A side chat's own message this phone sent that the server has not saved yet (see chat/sideChat.ts). */
852
+ local?: boolean;
850
853
  }
851
854
 
852
855
  interface ChatState {
@@ -886,6 +889,54 @@ declare function setClientDeclarationProvider(fn: (() => ClientDeclaration | nul
886
889
  /** Tear down the live connection (env/auth switch, SDK unmount). */
887
890
  declare function closeChatStream(): void;
888
891
 
892
+ interface SideChatState {
893
+ pageId: string;
894
+ messages: Message[];
895
+ /** A turn of this chat is running: Send waits (the web window does the same). */
896
+ loading: boolean;
897
+ loaded: boolean;
898
+ load: () => Promise<void>;
899
+ send: (text: string) => Promise<boolean>;
900
+ }
901
+ type SideChatStore = UseBoundStore<StoreApi<SideChatState>>;
902
+ /** The side chat for this page in the current workspace; reopened chats keep a running turn. */
903
+ declare function getSideChatStore(pageId: string): SideChatStore;
904
+ /** Forget every side chat (sign-out, workspace or environment switch). */
905
+ declare function clearSideChats(): void;
906
+
907
+ /**
908
+ * Side chat — the pure rules (no imports of the SDK, so they run under plain node tests).
909
+ *
910
+ * A builder's page asks for a side chat with the widget message `open-side-chat`. The look it may give the chat is
911
+ * cleaned here (same limits and shape as the web host: ai-dev-assistant packages/widget-surface/src/sideChatOptions.js),
912
+ * and the chat's saved turns are merged with the messages this phone sent that the server has not saved yet.
913
+ */
914
+
915
+ declare const SIDE_CHAT_LIMITS: {
916
+ readonly title: 60;
917
+ readonly header: 40;
918
+ readonly welcome: 200;
919
+ readonly placeholder: 60;
920
+ };
921
+ interface SideChatOptions {
922
+ title: string;
923
+ header: string;
924
+ welcome: string;
925
+ placeholder: string;
926
+ accent: string | null;
927
+ side: 'left' | 'right';
928
+ }
929
+ /** What the page asked for, cleaned: plain text cut to a length, one hex color, `left`/`right`. A widget is not trusted with markup. */
930
+ declare function sideChatOptions(payload: unknown): SideChatOptions;
931
+ /** The words in the TOPIC tag: the title the page gave, else the last part of its page id ("mcp:crm:deal-board" → "Deal Board"). */
932
+ declare function topicLabel(pageId: string, title?: string): string;
933
+ /**
934
+ * The chat's messages: the server's saved turns (oldest first), then this phone's own messages of a turn the server does
935
+ * not hold yet. A local message carries `chainId`; it is dropped once a saved message of that chain is there. A local
936
+ * message with no chain (a send that never started, an error) stays. So a turn is drawn once.
937
+ */
938
+ declare function mergeSideChatHistory(saved: Message[], current: Message[]): Message[];
939
+
889
940
  /**
890
941
  * What the phone's chat bubble is handed for a reply: the blocks of a conversation turn as ONE flat string, and that string
891
942
  * split back into what the bubble draws. Pure and import-free, so a test runs it in node (it used to sit in store.ts).
@@ -1564,4 +1615,4 @@ interface AcsKvStorage {
1564
1615
  }
1565
1616
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1566
1617
 
1567
- export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, CHART_BLOCK_CLOSE, CHART_BLOCK_OPEN, COMPARISON_BLOCK_CLOSE, COMPARISON_BLOCK_OPEN, type ChannelPrefs, type ChartSeries, type ChartView, type ComparisonOption, type ComparisonRow, type ComparisonView, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramFlow, type DiagramStatus, type DiagramStep, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type LauncherPlace, type LauncherPlaces, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, TIMELINE_BLOCK_CLOSE, TIMELINE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TimelineDay, type TimelineEvent, type TimelineView, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, VISUALS, type VisualKind, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, chartAsText, chartScale, chartView, closeChatStream, colors, comparisonAsText, comparisonView, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramFlow, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fetchLauncherPlaces, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, isVisualKind, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, numText, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, recordWidgetOpen, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, timelineAsText, timelineView, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt, visualViewOf };
1618
+ export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, CHART_BLOCK_CLOSE, CHART_BLOCK_OPEN, COMPARISON_BLOCK_CLOSE, COMPARISON_BLOCK_OPEN, type ChannelPrefs, type ChartSeries, type ChartView, type ComparisonOption, type ComparisonRow, type ComparisonView, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramFlow, type DiagramStatus, type DiagramStep, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type LauncherPlace, type LauncherPlaces, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, SIDE_CHAT_LIMITS, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, type SideChatOptions, type SideChatState, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, TIMELINE_BLOCK_CLOSE, TIMELINE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TimelineDay, type TimelineEvent, type TimelineView, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, VISUALS, type VisualKind, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, chartAsText, chartScale, chartView, clearSideChats, closeChatStream, colors, comparisonAsText, comparisonView, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramFlow, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fetchLauncherPlaces, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getSideChatStore, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, isVisualKind, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, mergeSideChatHistory, nestByMaster, notifyAcsWsForeground, notifyAppForeground, numText, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, recordWidgetOpen, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, sideChatOptions, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, timelineAsText, timelineView, topicLabel, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt, visualViewOf };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as zustand from 'zustand';
2
+ import { UseBoundStore, StoreApi } from 'zustand';
2
3
 
3
4
  /**
4
5
  * Storage adapter contracts. The core is platform-agnostic (no Expo, no
@@ -847,6 +848,8 @@ interface Message {
847
848
  chainId?: string;
848
849
  /** Turn variant. 'notification' = proactive/system-initiated. */
849
850
  kind?: 'notification' | string;
851
+ /** A side chat's own message this phone sent that the server has not saved yet (see chat/sideChat.ts). */
852
+ local?: boolean;
850
853
  }
851
854
 
852
855
  interface ChatState {
@@ -886,6 +889,54 @@ declare function setClientDeclarationProvider(fn: (() => ClientDeclaration | nul
886
889
  /** Tear down the live connection (env/auth switch, SDK unmount). */
887
890
  declare function closeChatStream(): void;
888
891
 
892
+ interface SideChatState {
893
+ pageId: string;
894
+ messages: Message[];
895
+ /** A turn of this chat is running: Send waits (the web window does the same). */
896
+ loading: boolean;
897
+ loaded: boolean;
898
+ load: () => Promise<void>;
899
+ send: (text: string) => Promise<boolean>;
900
+ }
901
+ type SideChatStore = UseBoundStore<StoreApi<SideChatState>>;
902
+ /** The side chat for this page in the current workspace; reopened chats keep a running turn. */
903
+ declare function getSideChatStore(pageId: string): SideChatStore;
904
+ /** Forget every side chat (sign-out, workspace or environment switch). */
905
+ declare function clearSideChats(): void;
906
+
907
+ /**
908
+ * Side chat — the pure rules (no imports of the SDK, so they run under plain node tests).
909
+ *
910
+ * A builder's page asks for a side chat with the widget message `open-side-chat`. The look it may give the chat is
911
+ * cleaned here (same limits and shape as the web host: ai-dev-assistant packages/widget-surface/src/sideChatOptions.js),
912
+ * and the chat's saved turns are merged with the messages this phone sent that the server has not saved yet.
913
+ */
914
+
915
+ declare const SIDE_CHAT_LIMITS: {
916
+ readonly title: 60;
917
+ readonly header: 40;
918
+ readonly welcome: 200;
919
+ readonly placeholder: 60;
920
+ };
921
+ interface SideChatOptions {
922
+ title: string;
923
+ header: string;
924
+ welcome: string;
925
+ placeholder: string;
926
+ accent: string | null;
927
+ side: 'left' | 'right';
928
+ }
929
+ /** What the page asked for, cleaned: plain text cut to a length, one hex color, `left`/`right`. A widget is not trusted with markup. */
930
+ declare function sideChatOptions(payload: unknown): SideChatOptions;
931
+ /** The words in the TOPIC tag: the title the page gave, else the last part of its page id ("mcp:crm:deal-board" → "Deal Board"). */
932
+ declare function topicLabel(pageId: string, title?: string): string;
933
+ /**
934
+ * The chat's messages: the server's saved turns (oldest first), then this phone's own messages of a turn the server does
935
+ * not hold yet. A local message carries `chainId`; it is dropped once a saved message of that chain is there. A local
936
+ * message with no chain (a send that never started, an error) stays. So a turn is drawn once.
937
+ */
938
+ declare function mergeSideChatHistory(saved: Message[], current: Message[]): Message[];
939
+
889
940
  /**
890
941
  * What the phone's chat bubble is handed for a reply: the blocks of a conversation turn as ONE flat string, and that string
891
942
  * split back into what the bubble draws. Pure and import-free, so a test runs it in node (it used to sit in store.ts).
@@ -1564,4 +1615,4 @@ interface AcsKvStorage {
1564
1615
  }
1565
1616
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1566
1617
 
1567
- export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, CHART_BLOCK_CLOSE, CHART_BLOCK_OPEN, COMPARISON_BLOCK_CLOSE, COMPARISON_BLOCK_OPEN, type ChannelPrefs, type ChartSeries, type ChartView, type ComparisonOption, type ComparisonRow, type ComparisonView, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramFlow, type DiagramStatus, type DiagramStep, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type LauncherPlace, type LauncherPlaces, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, TIMELINE_BLOCK_CLOSE, TIMELINE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TimelineDay, type TimelineEvent, type TimelineView, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, VISUALS, type VisualKind, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, chartAsText, chartScale, chartView, closeChatStream, colors, comparisonAsText, comparisonView, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramFlow, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fetchLauncherPlaces, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, isVisualKind, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, numText, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, recordWidgetOpen, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, timelineAsText, timelineView, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt, visualViewOf };
1618
+ export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, CHART_BLOCK_CLOSE, CHART_BLOCK_OPEN, COMPARISON_BLOCK_CLOSE, COMPARISON_BLOCK_OPEN, type ChannelPrefs, type ChartSeries, type ChartView, type ComparisonOption, type ComparisonRow, type ComparisonView, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramFlow, type DiagramStatus, type DiagramStep, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type LauncherPlace, type LauncherPlaces, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, SIDE_CHAT_LIMITS, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, type SideChatOptions, type SideChatState, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, TIMELINE_BLOCK_CLOSE, TIMELINE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TimelineDay, type TimelineEvent, type TimelineView, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, VISUALS, type VisualKind, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, chartAsText, chartScale, chartView, clearSideChats, closeChatStream, colors, comparisonAsText, comparisonView, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramFlow, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fetchLauncherPlaces, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getSideChatStore, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, isVisualKind, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, mergeSideChatHistory, nestByMaster, notifyAcsWsForeground, notifyAppForeground, numText, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, recordWidgetOpen, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, sideChatOptions, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, timelineAsText, timelineView, topicLabel, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt, visualViewOf };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ __export(index_exports, {
32
32
  MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
33
33
  MAX_INLINE_ATTACHMENT_BYTES: () => MAX_INLINE_ATTACHMENT_BYTES,
34
34
  PluginCommandEmitter: () => PluginCommandEmitter,
35
+ SIDE_CHAT_LIMITS: () => SIDE_CHAT_LIMITS,
35
36
  TABLE_BLOCK_CLOSE: () => TABLE_BLOCK_CLOSE,
36
37
  TABLE_BLOCK_OPEN: () => TABLE_BLOCK_OPEN,
37
38
  TIMELINE_BLOCK_CLOSE: () => TIMELINE_BLOCK_CLOSE,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  chartAsText: () => chartAsText,
47
48
  chartScale: () => chartScale,
48
49
  chartView: () => chartView,
50
+ clearSideChats: () => clearSideChats,
49
51
  closeChatStream: () => closeChatStream,
50
52
  colors: () => colors,
51
53
  comparisonAsText: () => comparisonAsText,
@@ -72,6 +74,7 @@ __export(index_exports, {
72
74
  getNotifPrefs: () => getPrefs,
73
75
  getNotifTelegramBotInfo: () => getTelegramBotInfo,
74
76
  getSession: () => getSession,
77
+ getSideChatStore: () => getSideChatStore,
75
78
  getTenant: () => getTenant,
76
79
  getToken: () => getToken,
77
80
  getUser: () => getUser,
@@ -91,6 +94,7 @@ __export(index_exports, {
91
94
  listSurface: () => listSurface,
92
95
  mcpFetch: () => mcpFetch,
93
96
  mcpToolCall: () => mcpToolCall,
97
+ mergeSideChatHistory: () => mergeSideChatHistory,
94
98
  nestByMaster: () => nestByMaster,
95
99
  notifyAcsWsForeground: () => notifyAcsWsForeground,
96
100
  notifyAppForeground: () => notifyAppForeground,
@@ -123,6 +127,7 @@ __export(index_exports, {
123
127
  setHomeActionOrder: () => setHomeActionOrder,
124
128
  setNotifPrefs: () => setPrefs,
125
129
  setOrder: () => setOrder,
130
+ sideChatOptions: () => sideChatOptions,
126
131
  signInWithApple: () => signInWithApple,
127
132
  signInWithGoogle: () => signInWithGoogle,
128
133
  spacing: () => spacing,
@@ -131,6 +136,7 @@ __export(index_exports, {
131
136
  tenantFromToken: () => tenantFromToken,
132
137
  timelineAsText: () => timelineAsText,
133
138
  timelineView: () => timelineView,
139
+ topicLabel: () => topicLabel,
134
140
  unlinkNotifChannel: () => unlinkChannel,
135
141
  unregisterPushDevice: () => unregisterDevice,
136
142
  unwrapMcpResult: () => unwrapMcpResult,
@@ -254,8 +260,8 @@ async function apiFetch(path, options = {}) {
254
260
  notifyAuthFailure();
255
261
  throw new Error("Session expired");
256
262
  }
257
- const text = await retryRes.text().catch(() => "");
258
- throw new Error(`API ${retryRes.status}: ${text}`);
263
+ const text2 = await retryRes.text().catch(() => "");
264
+ throw new Error(`API ${retryRes.status}: ${text2}`);
259
265
  }
260
266
  if (outcome.ok === "auth_failed") {
261
267
  console.warn(`[adas] refresh auth_failed on ${path} (${outcome.reason}) \u2014 auth failure`);
@@ -265,8 +271,8 @@ async function apiFetch(path, options = {}) {
265
271
  throw new Error(`API 401: refresh transient (${outcome.reason})`);
266
272
  }
267
273
  if (!res.ok) {
268
- const text = await res.text();
269
- throw new Error(`API ${res.status}: ${text}`);
274
+ const text2 = await res.text();
275
+ throw new Error(`API ${res.status}: ${text2}`);
270
276
  }
271
277
  return res.json();
272
278
  }
@@ -296,8 +302,8 @@ async function connectorCall(connectorId, tool, args = {}) {
296
302
  }
297
303
  );
298
304
  if (!res.ok) {
299
- const text = await res.text();
300
- return { ok: false, result: null, error: `HTTP ${res.status}: ${text}` };
305
+ const text2 = await res.text();
306
+ return { ok: false, result: null, error: `HTTP ${res.status}: ${text2}` };
301
307
  }
302
308
  const data = await res.json();
303
309
  if (data.ok !== void 0) return data;
@@ -313,8 +319,8 @@ async function mcpFetch(body) {
313
319
  body: typeof body === "string" ? body : JSON.stringify(body)
314
320
  });
315
321
  if (!res.ok) {
316
- const text = await res.text();
317
- throw new Error(`MCP fetch failed: HTTP ${res.status}: ${text}`);
322
+ const text2 = await res.text();
323
+ throw new Error(`MCP fetch failed: HTTP ${res.status}: ${text2}`);
318
324
  }
319
325
  return res.json();
320
326
  }
@@ -1293,30 +1299,30 @@ async function postJson(path, body, jwt) {
1293
1299
  },
1294
1300
  body: JSON.stringify(body)
1295
1301
  });
1296
- const text = await res.text();
1302
+ const text2 = await res.text();
1297
1303
  let parsed = null;
1298
1304
  try {
1299
- parsed = JSON.parse(text);
1305
+ parsed = JSON.parse(text2);
1300
1306
  } catch {
1301
1307
  }
1302
1308
  if (!res.ok || parsed?.ok === false) {
1303
1309
  if (parsed?.error) throw new Error(parsed.error);
1304
- throw new Error(cleanErrorMessage(res.status, text, `consumer-auth ${path} failed`));
1310
+ throw new Error(cleanErrorMessage(res.status, text2, `consumer-auth ${path} failed`));
1305
1311
  }
1306
1312
  return parsed;
1307
1313
  }
1308
1314
  async function fetchConsumerConfig() {
1309
1315
  const url = `${getConsumerAuthApiUrl()}/platform/consumer/config?tenant=${encodeURIComponent(getTenant())}`;
1310
1316
  const res = await fetch(url);
1311
- const text = await res.text();
1317
+ const text2 = await res.text();
1312
1318
  let data = null;
1313
1319
  try {
1314
- data = JSON.parse(text);
1320
+ data = JSON.parse(text2);
1315
1321
  } catch {
1316
1322
  }
1317
1323
  if (!res.ok || !data?.ok) {
1318
1324
  if (data?.error) throw new Error(data.error);
1319
- throw new Error(cleanErrorMessage(res.status, text, "Failed to load sign-in config"));
1325
+ throw new Error(cleanErrorMessage(res.status, text2, "Failed to load sign-in config"));
1320
1326
  }
1321
1327
  return data;
1322
1328
  }
@@ -1338,16 +1344,16 @@ async function exchangeHandoff(code) {
1338
1344
  async function previewInvite(code) {
1339
1345
  const url = `${getConsumerAuthApiUrl()}/platform/consumer/invite/${encodeURIComponent(code)}`;
1340
1346
  const res = await fetch(url);
1341
- const text = await res.text();
1347
+ const text2 = await res.text();
1342
1348
  let data = null;
1343
1349
  try {
1344
- data = JSON.parse(text);
1350
+ data = JSON.parse(text2);
1345
1351
  } catch {
1346
1352
  }
1347
1353
  if (res.status === 404) throw new Error("This invite is invalid or has expired.");
1348
1354
  if (!res.ok || !data?.ok) {
1349
1355
  if (data?.error) throw new Error(data.error);
1350
- throw new Error(cleanErrorMessage(res.status, text, "Could not load invite"));
1356
+ throw new Error(cleanErrorMessage(res.status, text2, "Could not load invite"));
1351
1357
  }
1352
1358
  return data;
1353
1359
  }
@@ -1627,7 +1633,7 @@ var COMPARISON_BLOCK_CLOSE = "\uE109";
1627
1633
  var TIMELINE_BLOCK_OPEN = "\uE10A";
1628
1634
  var TIMELINE_BLOCK_CLOSE = "\uE10B";
1629
1635
  var SENTINEL_CHARS = /[\uE100-\uE10B]/g;
1630
- var clean = (text) => text.replace(SENTINEL_CHARS, "");
1636
+ var clean = (text2) => text2.replace(SENTINEL_CHARS, "");
1631
1637
  function renderTableShape(content) {
1632
1638
  if (!content || typeof content !== "object") return null;
1633
1639
  const cols = Array.isArray(content.columns) ? content.columns : null;
@@ -1648,14 +1654,14 @@ function diagramView(content) {
1648
1654
  kept[i + 1] = 0;
1649
1655
  if (!s || typeof s !== "object") return;
1650
1656
  const title = str(s.title);
1651
- const text = str(s.text);
1652
- if (!title && !text) return;
1657
+ const text2 = str(s.text);
1658
+ if (!title && !text2) return;
1653
1659
  const badges = [];
1654
1660
  for (const b of Array.isArray(s.badges) ? s.badges : []) {
1655
1661
  const bt = str(b && typeof b === "object" ? b.text : b);
1656
1662
  if (bt) badges.push({ text: bt, status: statusOf(b && b.status) });
1657
1663
  }
1658
- steps.push({ title: title || text, text: title ? text : "", status: statusOf(s.status), badges, decision: s.kind === "decision" || s.decision === true, next: null });
1664
+ steps.push({ title: title || text2, text: title ? text2 : "", status: statusOf(s.status), badges, decision: s.kind === "decision" || s.decision === true, next: null });
1659
1665
  rawNext.push(Array.isArray(s.next) ? s.next : null);
1660
1666
  kept[i + 1] = steps.length;
1661
1667
  });
@@ -1831,10 +1837,10 @@ function blocksToText(blocks) {
1831
1837
  if (!blocks || blocks.length === 0) return "";
1832
1838
  return blocks.map((b) => {
1833
1839
  if (!b || typeof b !== "object") return "";
1834
- const text = blockText(b);
1835
- if (!text) return "";
1836
- if (text.startsWith(TABLE_BLOCK_OPEN) || Object.values(VISUALS).some((v) => text.startsWith(v.open))) return text;
1837
- return b.meta?.display === "folded" ? `${DETAILS_BLOCK_OPEN}${encodeURIComponent(text)}${DETAILS_BLOCK_CLOSE}` : text;
1840
+ const text2 = blockText(b);
1841
+ if (!text2) return "";
1842
+ if (text2.startsWith(TABLE_BLOCK_OPEN) || Object.values(VISUALS).some((v) => text2.startsWith(v.open))) return text2;
1843
+ return b.meta?.display === "folded" ? `${DETAILS_BLOCK_OPEN}${encodeURIComponent(text2)}${DETAILS_BLOCK_CLOSE}` : text2;
1838
1844
  }).filter(Boolean).join("\n\n");
1839
1845
  }
1840
1846
  var PAIRS = [
@@ -2180,11 +2186,11 @@ var useChatStore = (0, import_zustand4.create)((set, get) => ({
2180
2186
  // Send message via Core API
2181
2187
  // POST /api/chat { goal } → { jobId } → stream → fetch turn result
2182
2188
  // -----------------------------------------------------------------------
2183
- sendMessage: async (text, skillSlug, attachments) => {
2189
+ sendMessage: async (text2, skillSlug, attachments) => {
2184
2190
  const userMsg = {
2185
2191
  id: `user-${Date.now()}`,
2186
2192
  role: "user",
2187
- content: text,
2193
+ content: text2,
2188
2194
  timestamp: /* @__PURE__ */ new Date(),
2189
2195
  ...attachments?.length ? {
2190
2196
  attachments: attachments.map((a) => ({
@@ -2201,7 +2207,7 @@ var useChatStore = (0, import_zustand4.create)((set, get) => ({
2201
2207
  try {
2202
2208
  const actor = getUser();
2203
2209
  const body = {
2204
- goal: text,
2210
+ goal: text2,
2205
2211
  // Opt in to the Chain Additions router (attach/cancel/new while a
2206
2212
  // chain runs). Backend ignores it where not applicable — safe to send.
2207
2213
  chainRouting: true,
@@ -2228,11 +2234,11 @@ var useChatStore = (0, import_zustand4.create)((set, get) => ({
2228
2234
  if (!res.ok) {
2229
2235
  let errMsg = `Server error (${res.status})`;
2230
2236
  try {
2231
- const text2 = await res.text();
2232
- if (text2.startsWith("<") || text2.startsWith("<!")) {
2237
+ const text3 = await res.text();
2238
+ if (text3.startsWith("<") || text3.startsWith("<!")) {
2233
2239
  errMsg = res.status === 502 ? "Server is temporarily unavailable. Please try again." : `Server error (${res.status})`;
2234
2240
  } else {
2235
- const parsed = JSON.parse(text2);
2241
+ const parsed = JSON.parse(text3);
2236
2242
  errMsg = parsed.error || errMsg;
2237
2243
  }
2238
2244
  } catch {
@@ -2515,12 +2521,12 @@ async function fetchTurnResult(jobId, jobSnap) {
2515
2521
  const turn = items[0];
2516
2522
  if (turn?.assistant || turn?.turn?.assistant) {
2517
2523
  const assistant = turn.assistant || turn.turn?.assistant;
2518
- const text = blocksToText(assistant.blocks);
2524
+ const text2 = blocksToText(assistant.blocks);
2519
2525
  const actions = Array.isArray(assistant.actions) && assistant.actions.length ? assistant.actions : void 0;
2520
- if (text) {
2526
+ if (text2) {
2521
2527
  updateJobProgress(jobId, {
2522
2528
  status,
2523
- resultMessage: text,
2529
+ resultMessage: text2,
2524
2530
  ...actions ? { resultActions: actions } : {}
2525
2531
  });
2526
2532
  return;
@@ -2573,6 +2579,181 @@ async function pollJob(jobId, token) {
2573
2579
  }
2574
2580
  }
2575
2581
 
2582
+ // src/chat/sideChat.ts
2583
+ var import_zustand5 = require("zustand");
2584
+
2585
+ // src/chat/sideChatPure.ts
2586
+ var SIDE_CHAT_LIMITS = { title: 60, header: 40, welcome: 200, placeholder: 60 };
2587
+ var HEX = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
2588
+ var text = (v, max) => typeof v === "string" ? v.replace(/\s+/g, " ").trim().slice(0, max) : "";
2589
+ function sideChatOptions(payload) {
2590
+ const p = payload && typeof payload === "object" ? payload : {};
2591
+ return {
2592
+ title: text(p.title, SIDE_CHAT_LIMITS.title),
2593
+ header: text(p.header, SIDE_CHAT_LIMITS.header),
2594
+ welcome: text(p.welcome, SIDE_CHAT_LIMITS.welcome),
2595
+ placeholder: text(p.placeholder, SIDE_CHAT_LIMITS.placeholder),
2596
+ accent: typeof p.accent === "string" && HEX.test(p.accent.trim()) ? p.accent.trim() : null,
2597
+ side: p.side === "left" ? "left" : "right"
2598
+ };
2599
+ }
2600
+ var SHORT = /* @__PURE__ */ new Set(["ui", "ai", "mcp", "api", "crm", "sms", "pa"]);
2601
+ var nameOf = (slug) => slug.split(/[-_]+/).filter(Boolean).map((w) => SHORT.has(w.toLowerCase()) ? w.toUpperCase() : w[0].toUpperCase() + w.slice(1)).join(" ");
2602
+ function topicLabel(pageId, title) {
2603
+ if (title) return title;
2604
+ const last = String(pageId || "").split(":").pop() || "";
2605
+ return nameOf(last) || "Side chat";
2606
+ }
2607
+ function mergeSideChatHistory(saved, current) {
2608
+ const savedChains = new Set(saved.map((m) => m.chainId).filter(Boolean));
2609
+ const keep = current.filter((m) => m.local && !(m.chainId && savedChains.has(m.chainId)));
2610
+ return [...saved, ...keep];
2611
+ }
2612
+
2613
+ // src/chat/sideChat.ts
2614
+ var HISTORY_TURNS = 20;
2615
+ var stores = /* @__PURE__ */ new Map();
2616
+ function getSideChatStore(pageId) {
2617
+ const key = `${getTenant()}\0${pageId}`;
2618
+ let s = stores.get(key);
2619
+ if (!s) {
2620
+ s = createSideChatStore(pageId);
2621
+ stores.set(key, s);
2622
+ }
2623
+ return s;
2624
+ }
2625
+ function clearSideChats() {
2626
+ stores.clear();
2627
+ }
2628
+ function turnToMessages(turn) {
2629
+ const out = [];
2630
+ const chainId = typeof turn?.chainId === "string" ? turn.chainId : void 0;
2631
+ const base = turn?.jobId || turn?.chainId || `${turn?.startedAt || Date.now()}`;
2632
+ const userText = blocksToText(turn?.user?.blocks);
2633
+ const userAtts = blocksToAttachments(turn?.user?.blocks);
2634
+ if (userText || userAtts) {
2635
+ out.push({ id: `user-${base}`, role: "user", content: userText || "", timestamp: new Date(turn.startedAt || Date.now()), ...userAtts ? { attachments: userAtts } : {}, ...chainId ? { chainId } : {} });
2636
+ }
2637
+ const answer = blocksToText(turn?.assistant?.blocks);
2638
+ const actions = Array.isArray(turn?.assistant?.actions) && turn.assistant.actions.length ? turn.assistant.actions : void 0;
2639
+ if (answer || actions) {
2640
+ out.push({ id: `bot-${base}`, role: "assistant", content: answer || "", timestamp: new Date(turn.finishedAt || turn.startedAt || Date.now()), skillSlug: turn.skillSlug, ...actions ? { actions } : {}, ...chainId ? { chainId } : {} });
2641
+ } else if (turn?.status === "failed") {
2642
+ out.push({ id: `err-${base}`, role: "system", content: turn.failReason || "This turn failed.", timestamp: new Date(turn.finishedAt || turn.startedAt || Date.now()), ...chainId ? { chainId } : {} });
2643
+ }
2644
+ return out;
2645
+ }
2646
+ function createSideChatStore(pageId) {
2647
+ return (0, import_zustand5.create)((set, get) => {
2648
+ const local = (m) => ({ ...m, local: true });
2649
+ const patchJob = (jobId, p) => set((s) => ({ messages: s.messages.map((m) => m.jobProgress?.jobId === jobId ? { ...m, jobProgress: { ...m.jobProgress, ...p } } : m) }));
2650
+ async function follow(jobId, chainId) {
2651
+ let ended = null;
2652
+ for (let i = 0; !ended; i++) {
2653
+ if (i > 0) await new Promise((r) => setTimeout(r, i < 120 ? 1500 : 5e3));
2654
+ if (!get().messages.some((m) => m.jobProgress?.jobId === jobId)) return;
2655
+ try {
2656
+ const res = await fetch(`${getCoreApiUrl()}/api/job/${encodeURIComponent(jobId)}/status`, { headers: coreHeaders() });
2657
+ if (!res.ok) {
2658
+ if (res.status === 404) break;
2659
+ continue;
2660
+ }
2661
+ const snap = await res.json();
2662
+ const handoff = snap?.isHandoff || snap?.state?.handoffTransfer;
2663
+ if (isTerminalSnapshot(snap) && !(normalizeJobStatus(snap) === "done" && handoff)) ended = snap;
2664
+ else patchJob(jobId, snapshotToProgress(snap, jobId));
2665
+ } catch {
2666
+ }
2667
+ }
2668
+ for (let t = 0; t < 5; t++) {
2669
+ await get().load();
2670
+ if (!get().messages.some((m) => m.jobProgress?.jobId === jobId)) {
2671
+ set({ loading: false });
2672
+ return;
2673
+ }
2674
+ await new Promise((r) => setTimeout(r, 800));
2675
+ }
2676
+ const failed = ended ? normalizeJobStatus(ended) === "error" : false;
2677
+ const fallback = ended?.result?.message || ended?.state?.finalReply || (failed ? "Something went wrong. Please try again." : "Done.");
2678
+ set((s) => ({
2679
+ loading: false,
2680
+ messages: s.messages.map((m) => m.jobProgress?.jobId === jobId ? { ...m, id: `done-${jobId}`, content: fallback, jobProgress: { ...m.jobProgress, status: failed ? "error" : "done" }, chainId } : m)
2681
+ }));
2682
+ }
2683
+ return {
2684
+ pageId,
2685
+ messages: [],
2686
+ loading: false,
2687
+ loaded: false,
2688
+ load: async () => {
2689
+ try {
2690
+ const res = await fetch(`${getCoreApiUrl()}/api/conversation?topic=${encodeURIComponent(pageId)}&page_size=${HISTORY_TURNS}`, { headers: coreHeaders() });
2691
+ if (!res.ok) {
2692
+ set({ loaded: true });
2693
+ return;
2694
+ }
2695
+ const json = await res.json();
2696
+ const items = Array.isArray(json?.items) ? [...json.items].reverse() : [];
2697
+ const seen = /* @__PURE__ */ new Set();
2698
+ const saved = items.filter((t) => {
2699
+ const k = t?.jobId;
2700
+ if (!k) return true;
2701
+ if (seen.has(k)) return false;
2702
+ seen.add(k);
2703
+ return true;
2704
+ }).flatMap(turnToMessages);
2705
+ set((s) => ({ messages: mergeSideChatHistory(saved, s.messages), loaded: true }));
2706
+ } catch {
2707
+ set({ loaded: true });
2708
+ }
2709
+ },
2710
+ send: async (text2) => {
2711
+ const t = text2.trim();
2712
+ if (!t || get().loading) return false;
2713
+ const echo = local({ id: `user-${Date.now()}`, role: "user", content: t, timestamp: /* @__PURE__ */ new Date() });
2714
+ set((s) => ({ messages: [...s.messages, echo], loading: true }));
2715
+ const fail = (msg) => set((s) => ({ loading: false, messages: [...s.messages, local({ id: `error-${Date.now()}`, role: "system", content: msg, timestamp: /* @__PURE__ */ new Date() })] }));
2716
+ try {
2717
+ const actor = getUser();
2718
+ const res = await fetch(`${getCoreApiUrl()}/api/chat`, {
2719
+ method: "POST",
2720
+ headers: coreHeaders(),
2721
+ body: JSON.stringify({
2722
+ goal: t,
2723
+ triggerContext: {
2724
+ channel: "mobile",
2725
+ replyContext: { chatId: actor?.actorId || "unknown" },
2726
+ pageContext: { page: pageId, chat: "page" }
2727
+ }
2728
+ })
2729
+ });
2730
+ const json = await res.json().catch(() => null);
2731
+ const jobId = json?.jobId || json?.id;
2732
+ if (!res.ok || !jobId) {
2733
+ fail(json?.error || `Could not start (${res.status}).`);
2734
+ return false;
2735
+ }
2736
+ const chainId = json.job?.chainId || jobId;
2737
+ const bubble = local({
2738
+ id: `job-${jobId}`,
2739
+ role: "assistant",
2740
+ content: "Working on it...",
2741
+ timestamp: /* @__PURE__ */ new Date(),
2742
+ chainId,
2743
+ jobProgress: { jobId, actorId: actor?.actorId, status: "running", subStatus: "Starting...", chainStartedAt: Date.now() }
2744
+ });
2745
+ set((s) => ({ messages: [...s.messages.map((m) => m.id === echo.id ? { ...m, chainId } : m), bubble] }));
2746
+ void follow(jobId, chainId);
2747
+ return true;
2748
+ } catch (e) {
2749
+ fail(`Request failed: ${e?.message || e}`);
2750
+ return false;
2751
+ }
2752
+ }
2753
+ };
2754
+ });
2755
+ }
2756
+
2576
2757
  // src/api/tenants.ts
2577
2758
  function nestByMaster(tenants) {
2578
2759
  const ids = new Set(tenants.map((t) => t.id));
@@ -2640,6 +2821,7 @@ async function switchTenant(targetTenantId) {
2640
2821
  await onSession(session);
2641
2822
  closeChatStream();
2642
2823
  useChatStore.getState().clearChat();
2824
+ clearSideChats();
2643
2825
  return session;
2644
2826
  }
2645
2827
 
@@ -2756,6 +2938,7 @@ var borderRadius = {
2756
2938
  MAX_ATTACHMENT_BYTES,
2757
2939
  MAX_INLINE_ATTACHMENT_BYTES,
2758
2940
  PluginCommandEmitter,
2941
+ SIDE_CHAT_LIMITS,
2759
2942
  TABLE_BLOCK_CLOSE,
2760
2943
  TABLE_BLOCK_OPEN,
2761
2944
  TIMELINE_BLOCK_CLOSE,
@@ -2770,6 +2953,7 @@ var borderRadius = {
2770
2953
  chartAsText,
2771
2954
  chartScale,
2772
2955
  chartView,
2956
+ clearSideChats,
2773
2957
  closeChatStream,
2774
2958
  colors,
2775
2959
  comparisonAsText,
@@ -2796,6 +2980,7 @@ var borderRadius = {
2796
2980
  getNotifPrefs,
2797
2981
  getNotifTelegramBotInfo,
2798
2982
  getSession,
2983
+ getSideChatStore,
2799
2984
  getTenant,
2800
2985
  getToken,
2801
2986
  getUser,
@@ -2815,6 +3000,7 @@ var borderRadius = {
2815
3000
  listSurface,
2816
3001
  mcpFetch,
2817
3002
  mcpToolCall,
3003
+ mergeSideChatHistory,
2818
3004
  nestByMaster,
2819
3005
  notifyAcsWsForeground,
2820
3006
  notifyAppForeground,
@@ -2847,6 +3033,7 @@ var borderRadius = {
2847
3033
  setHomeActionOrder,
2848
3034
  setNotifPrefs,
2849
3035
  setOrder,
3036
+ sideChatOptions,
2850
3037
  signInWithApple,
2851
3038
  signInWithGoogle,
2852
3039
  spacing,
@@ -2855,6 +3042,7 @@ var borderRadius = {
2855
3042
  tenantFromToken,
2856
3043
  timelineAsText,
2857
3044
  timelineView,
3045
+ topicLabel,
2858
3046
  unlinkNotifChannel,
2859
3047
  unregisterPushDevice,
2860
3048
  unwrapMcpResult,