@aintela/chat 0.2.15

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 (218) hide show
  1. package/README.md +161 -0
  2. package/dist/ClientMessage-EKgfuTp8.js +40 -0
  3. package/dist/ClientMessage-EKgfuTp8.js.map +1 -0
  4. package/dist/Memory-DjLZqgbF.js +84 -0
  5. package/dist/Memory-DjLZqgbF.js.map +1 -0
  6. package/dist/Prompt-DZb7OaPp.js +37 -0
  7. package/dist/Prompt-DZb7OaPp.js.map +1 -0
  8. package/dist/artifactHtmlHandler-CMQJf1cX.js +41 -0
  9. package/dist/artifactHtmlHandler-CMQJf1cX.js.map +1 -0
  10. package/dist/auth-CcTgInbY.js +524 -0
  11. package/dist/auth-CcTgInbY.js.map +1 -0
  12. package/dist/components.d.ts +2 -0
  13. package/dist/components.js +14159 -0
  14. package/dist/components.js.map +1 -0
  15. package/dist/environmentUtils-BaKw5_VD.js +462 -0
  16. package/dist/environmentUtils-BaKw5_VD.js.map +1 -0
  17. package/dist/hooks.d.ts +2 -0
  18. package/dist/hooks.js +9 -0
  19. package/dist/hooks.js.map +1 -0
  20. package/dist/httpArtifactService-BAR60Gu1.js +1802 -0
  21. package/dist/httpArtifactService-BAR60Gu1.js.map +1 -0
  22. package/dist/httpSessionService-5Kr__oQL.js +279 -0
  23. package/dist/httpSessionService-5Kr__oQL.js.map +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +226 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/interfaces.d.ts +2 -0
  28. package/dist/interfaces.js +11 -0
  29. package/dist/interfaces.js.map +1 -0
  30. package/dist/models.d.ts +2 -0
  31. package/dist/models.js +54 -0
  32. package/dist/models.js.map +1 -0
  33. package/dist/serializer-DyHZxlAG.js +1276 -0
  34. package/dist/serializer-DyHZxlAG.js.map +1 -0
  35. package/dist/services.d.ts +2 -0
  36. package/dist/services.js +16 -0
  37. package/dist/services.js.map +1 -0
  38. package/dist/sortable-table-DgQHxWIh.js +819 -0
  39. package/dist/sortable-table-DgQHxWIh.js.map +1 -0
  40. package/dist/src/ErrorBondary.d.ts +10 -0
  41. package/dist/src/components/AiChat/AiChat.d.ts +3 -0
  42. package/dist/src/components/AiChat/AiChatContext.d.ts +76 -0
  43. package/dist/src/components/AiChat/AiChatDrawer.d.ts +3 -0
  44. package/dist/src/components/AiChat/AiChatFloating.d.ts +3 -0
  45. package/dist/src/components/AiChat/AiChatProvider.d.ts +7 -0
  46. package/dist/src/components/AiChat/AiChatSessionStore.d.ts +1 -0
  47. package/dist/src/components/AiChat/AiChatTypes.d.ts +227 -0
  48. package/dist/src/components/AiChat/ChatPane/AlertDialog.d.ts +12 -0
  49. package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +25 -0
  50. package/dist/src/components/AiChat/ChatPane/ChatPane.d.ts +7 -0
  51. package/dist/src/components/AiChat/ChatPane/ConnectionState.d.ts +2 -0
  52. package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +12 -0
  53. package/dist/src/components/AiChat/ChatPane/Event.d.ts +6 -0
  54. package/dist/src/components/AiChat/ChatPane/FloatingConnectionStatus.d.ts +8 -0
  55. package/dist/src/components/AiChat/ChatPane/FriendlyPartDisplay.d.ts +13 -0
  56. package/dist/src/components/AiChat/ChatPane/LastPrompts.d.ts +9 -0
  57. package/dist/src/components/AiChat/ChatPane/Message.d.ts +11 -0
  58. package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +16 -0
  59. package/dist/src/components/AiChat/ChatPane/MessageNonTextDisplay.d.ts +16 -0
  60. package/dist/src/components/AiChat/ChatPane/MessagePart.d.ts +15 -0
  61. package/dist/src/components/AiChat/ChatPane/MessagePersona.d.ts +13 -0
  62. package/dist/src/components/AiChat/ChatPane/MessageUser.d.ts +8 -0
  63. package/dist/src/components/AiChat/ChatPane/ModelSelector.d.ts +11 -0
  64. package/dist/src/components/AiChat/ChatPane/Prompt.d.ts +9 -0
  65. package/dist/src/components/AiChat/ChatPane/SessionDataDialog.d.ts +7 -0
  66. package/dist/src/components/AiChat/ChatPane/StickyQuestionHeader.d.ts +7 -0
  67. package/dist/src/components/AiChat/ChatPane/StreamStatistics.d.ts +32 -0
  68. package/dist/src/components/AiChat/ChatPane/SubAgentBox.d.ts +9 -0
  69. package/dist/src/components/AiChat/ChatPane/TaskList.d.ts +6 -0
  70. package/dist/src/components/AiChat/ChatPane/friendlyToolConfig.d.ts +11 -0
  71. package/dist/src/components/AiChat/ChatPane/parts/AskUserPart.d.ts +8 -0
  72. package/dist/src/components/AiChat/ChatPane/parts/BoxedPart.d.ts +4 -0
  73. package/dist/src/components/AiChat/ChatPane/parts/FunctionPart.d.ts +4 -0
  74. package/dist/src/components/AiChat/ChatPane/parts/SuspendedPart.d.ts +4 -0
  75. package/dist/src/components/AiChat/ChatPane/parts/TextPart.d.ts +4 -0
  76. package/dist/src/components/AiChat/ChatPane/parts/ThoughtPart.d.ts +4 -0
  77. package/dist/src/components/AiChat/ChatPane/parts/UiToolDispatcher.d.ts +16 -0
  78. package/dist/src/components/AiChat/ChatPane/parts/WaitingPart.d.ts +4 -0
  79. package/dist/src/components/AiChat/ChatPane/parts/index.d.ts +20 -0
  80. package/dist/src/components/AiChat/ChatPane/parts/index.test.d.ts +1 -0
  81. package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +22 -0
  82. package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +121 -0
  83. package/dist/src/components/AiChat/index.d.ts +13 -0
  84. package/dist/src/components/AiChat/sessionStateManagerService.d.ts +47 -0
  85. package/dist/src/components/AiChat/stateConfiguration.d.ts +80 -0
  86. package/dist/src/components/Library/ArtifactRender.d.ts +18 -0
  87. package/dist/src/components/Library/DelayTextComponent.d.ts +9 -0
  88. package/dist/src/components/Library/LinearBackgroundProgress.d.ts +8 -0
  89. package/dist/src/components/Library/LinearProgressBarWithMarkers.d.ts +14 -0
  90. package/dist/src/components/Library/LoadingDots.d.ts +8 -0
  91. package/dist/src/components/Library/MarkdowmExtended.d.ts +32 -0
  92. package/dist/src/components/Library/VizLibrary/Skeletons/ChartSkeleton.d.ts +3 -0
  93. package/dist/src/components/Library/VizLibrary/Skeletons/IFrameSkeleton.d.ts +3 -0
  94. package/dist/src/components/Library/VizLibrary/Skeletons/MetricGroupSkeleton.d.ts +8 -0
  95. package/dist/src/components/Library/VizLibrary/Skeletons/MetricSkeleton.d.ts +7 -0
  96. package/dist/src/components/Library/VizLibrary/Skeletons/TableSkeleton.d.ts +7 -0
  97. package/dist/src/components/Library/VizLibrary/index.d.ts +5 -0
  98. package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +33 -0
  99. package/dist/src/components/LlmResponseRender/GeneratingVisualization.d.ts +13 -0
  100. package/dist/src/components/LlmResponseRender/LiveJsxBlock.d.ts +55 -0
  101. package/dist/src/components/LlmResponseRender/LlmResponseRender.d.ts +29 -0
  102. package/dist/src/components/LlmResponseRender/index.d.ts +6 -0
  103. package/dist/src/components/LlmResponseRender/jsxScope.d.ts +41 -0
  104. package/dist/src/components/LlmResponseRender/liveTsxConfig.d.ts +18 -0
  105. package/dist/src/components/LlmResponseRender/parseBlocks.d.ts +39 -0
  106. package/dist/src/components/Stopwatch.d.ts +12 -0
  107. package/dist/src/components/index.d.ts +30 -0
  108. package/dist/src/components/v2/AgentActivityV2.d.ts +32 -0
  109. package/dist/src/components/v2/AiChatFloatingV2.d.ts +3 -0
  110. package/dist/src/components/v2/AiChatV2Pane.d.ts +20 -0
  111. package/dist/src/components/v2/AppBarV2.d.ts +38 -0
  112. package/dist/src/components/v2/AppRailV2.d.ts +21 -0
  113. package/dist/src/components/v2/AppShellV2.d.ts +13 -0
  114. package/dist/src/components/v2/ChatsHistoryV2.d.ts +47 -0
  115. package/dist/src/components/v2/LastPromptsV2.d.ts +6 -0
  116. package/dist/src/components/v2/MobileDrawerV2.d.ts +43 -0
  117. package/dist/src/components/v2/PromptV2.d.ts +164 -0
  118. package/dist/src/components/v2/RunProgressPanelV2.d.ts +28 -0
  119. package/dist/src/components/v2/RunProgressStripV2.d.ts +2 -0
  120. package/dist/src/components/v2/Sparkline.d.ts +10 -0
  121. package/dist/src/components/v2/SubAgentBoxV2.d.ts +15 -0
  122. package/dist/src/components/v2/TaskListV2.d.ts +8 -0
  123. package/dist/src/components/v2/icons.d.ts +42 -0
  124. package/dist/src/components/v2/index.d.ts +34 -0
  125. package/dist/src/components/v2/styles.d.ts +6 -0
  126. package/dist/src/components/v2/toolCategories.d.ts +18 -0
  127. package/dist/src/components/v2/useResponsiveLayout.d.ts +9 -0
  128. package/dist/src/hooks/index.d.ts +4 -0
  129. package/dist/src/hooks/useChatSessions.d.ts +68 -0
  130. package/dist/src/hooks/useContainerWidth.d.ts +2 -0
  131. package/dist/src/hooks/useIntervalHook.d.ts +2 -0
  132. package/dist/src/index.d.ts +7 -0
  133. package/dist/src/interfaces/IHeartbeatPort.d.ts +4 -0
  134. package/dist/src/interfaces/INotificationPort.d.ts +4 -0
  135. package/dist/src/interfaces/index.d.ts +4 -0
  136. package/dist/src/interfaces/memoryService.d.ts +37 -0
  137. package/dist/src/interfaces/schedulingService.d.ts +64 -0
  138. package/dist/src/models/Agent.d.ts +32 -0
  139. package/dist/src/models/Artifact.d.ts +21 -0
  140. package/dist/src/models/ArtifactData.d.ts +30 -0
  141. package/dist/src/models/ChatSession.d.ts +57 -0
  142. package/dist/src/models/ClientMessage.d.ts +38 -0
  143. package/dist/src/models/Customer.d.ts +7 -0
  144. package/dist/src/models/EndMessageData.d.ts +6 -0
  145. package/dist/src/models/IAbiContext.d.ts +8 -0
  146. package/dist/src/models/IDBStorable.d.ts +14 -0
  147. package/dist/src/models/Interaction.d.ts +36 -0
  148. package/dist/src/models/InteractionPart.d.ts +69 -0
  149. package/dist/src/models/LlmSession.d.ts +10 -0
  150. package/dist/src/models/Memory.d.ts +48 -0
  151. package/dist/src/models/Notification.d.ts +11 -0
  152. package/dist/src/models/Prompt.d.ts +20 -0
  153. package/dist/src/models/SendMessageResponse.d.ts +21 -0
  154. package/dist/src/models/ServerEvent.d.ts +130 -0
  155. package/dist/src/models/connectionState.d.ts +9 -0
  156. package/dist/src/models/contexts.d.ts +33 -0
  157. package/dist/src/models/enums.d.ts +333 -0
  158. package/dist/src/models/index.d.ts +36 -0
  159. package/dist/src/models/semanticKernelModel/index.d.ts +2 -0
  160. package/dist/src/models/semanticKernelModel/init.d.ts +1 -0
  161. package/dist/src/models/semanticKernelModel/models.d.ts +208 -0
  162. package/dist/src/models/semanticKernelModel/serializer.d.ts +40 -0
  163. package/dist/src/models/serverReponse.d.ts +5 -0
  164. package/dist/src/models/subAgentModel.d.ts +48 -0
  165. package/dist/src/models/todoListModel.d.ts +18 -0
  166. package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +163 -0
  167. package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +75 -0
  168. package/dist/src/services/artifactHtmlHandler.d.ts +6 -0
  169. package/dist/src/services/eventBusService.d.ts +119 -0
  170. package/dist/src/services/httpArtifactService.d.ts +25 -0
  171. package/dist/src/services/httpSessionService.d.ts +31 -0
  172. package/dist/src/services/index.d.ts +16 -0
  173. package/dist/src/services/interactionService.d.ts +28 -0
  174. package/dist/src/services/interactionService.test.d.ts +1 -0
  175. package/dist/src/services/interfaces/artifactService.d.ts +13 -0
  176. package/dist/src/services/servers/AgentGatewayService.d.ts +167 -0
  177. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +44 -0
  178. package/dist/src/services/servers/agentGatewayWSAsync.test.d.ts +1 -0
  179. package/dist/src/services/servers/sessionService/ISessionService.d.ts +20 -0
  180. package/dist/src/services/sessionEventDecoder.d.ts +22 -0
  181. package/dist/src/services/sessionEventDecoder.test.d.ts +1 -0
  182. package/dist/src/services/storageService.d.ts +73 -0
  183. package/dist/src/themes/index.d.ts +3 -0
  184. package/dist/src/themes/v2-chart-palette.d.ts +1 -0
  185. package/dist/src/themes/v2.d.ts +71 -0
  186. package/dist/src/utils/auth.d.ts +9 -0
  187. package/dist/src/utils/envOverrides.d.ts +23 -0
  188. package/dist/src/utils/envUtils.d.ts +13 -0
  189. package/dist/src/utils/environmentUtils.d.ts +43 -0
  190. package/dist/src/utils/fileUtils.d.ts +6 -0
  191. package/dist/src/utils/getAgentArtifactsBaseUrl.d.ts +1 -0
  192. package/dist/src/utils/getAgentBaseUrl.d.ts +1 -0
  193. package/dist/src/utils/getDotNetBaseUrl.d.ts +5 -0
  194. package/dist/src/utils/index.d.ts +17 -0
  195. package/dist/src/utils/interactionIdChecker.d.ts +27 -0
  196. package/dist/src/utils/jsonDetector.d.ts +50 -0
  197. package/dist/src/utils/jsonUtils.d.ts +1 -0
  198. package/dist/src/utils/materialIconsList.d.ts +42 -0
  199. package/dist/src/utils/materialIconsSvg.d.ts +51 -0
  200. package/dist/src/utils/objectUtils.d.ts +31 -0
  201. package/dist/src/utils/parseArtifact.d.ts +3 -0
  202. package/dist/src/utils/sessionWindowParameters.d.ts +3 -0
  203. package/dist/src/utils/sortable-table.d.ts +31 -0
  204. package/dist/src/utils/stringUtils.d.ts +8 -0
  205. package/dist/src/utils/uriUtils.d.ts +39 -0
  206. package/dist/src/utils/urlParser.d.ts +8 -0
  207. package/dist/style.css +94 -0
  208. package/dist/tests/fakes/fakeWebSocket.d.ts +32 -0
  209. package/dist/tests/fakes/makeGateway.d.ts +24 -0
  210. package/dist/tests/fixtures.d.ts +73 -0
  211. package/dist/useChatSessions-DttlifVk.js +107 -0
  212. package/dist/useChatSessions-DttlifVk.js.map +1 -0
  213. package/dist/useContainerWidth-Df2PmSoC.js +52 -0
  214. package/dist/useContainerWidth-Df2PmSoC.js.map +1 -0
  215. package/dist/utils.d.ts +2 -0
  216. package/dist/utils.js +49 -0
  217. package/dist/utils.js.map +1 -0
  218. package/package.json +127 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Material Icons List
3
+ *
4
+ * This file contains a curated list of 200 Material Icons for use with
5
+ * the Material Icons font: <i className="material-icons">icon_name</i>
6
+ *
7
+ * Each icon has:
8
+ * - iconName: lowercase snake_case name for use in the material-icons class
9
+ * - friendlyName: Human-readable display name
10
+ */
11
+ export interface MaterialIcon {
12
+ iconName: string;
13
+ friendlyName: string;
14
+ }
15
+ /**
16
+ * Curated list of 200 Material Icons
17
+ */
18
+ export declare const materialIcons: MaterialIcon[];
19
+ /**
20
+ * Get an icon by its snake_case name
21
+ */
22
+ export declare function getIconByName(iconName: string): MaterialIcon | undefined;
23
+ /**
24
+ * Search icons by friendly name (case-insensitive partial match)
25
+ */
26
+ export declare function searchIcons(query: string): MaterialIcon[];
27
+ /**
28
+ * Icons grouped by category for easier browsing
29
+ */
30
+ export declare const iconCategories: {
31
+ action: MaterialIcon[];
32
+ navigation: MaterialIcon[];
33
+ communication: MaterialIcon[];
34
+ content: MaterialIcon[];
35
+ status: MaterialIcon[];
36
+ device: MaterialIcon[];
37
+ time: MaterialIcon[];
38
+ location: MaterialIcon[];
39
+ social: MaterialIcon[];
40
+ editor: MaterialIcon[];
41
+ };
42
+ export default materialIcons;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Material Icons SVG Definitions
3
+ * Maps Material Icons names to their SVG path definitions
4
+ */
5
+ export interface MaterialIconSvg {
6
+ name: string;
7
+ viewBox: string;
8
+ svg: string;
9
+ }
10
+ /**
11
+ * Material Icons SVG mapping
12
+ * Sources: Google Material Design Icons
13
+ */
14
+ export declare const MATERIAL_ICONS_SVG: Record<string, MaterialIconSvg>;
15
+ /**
16
+ * Downloads an icon SVG from Google's Material Icons CDN
17
+ * @param iconName - Name of the Material Icon
18
+ * @returns SVG content or null if not found
19
+ */
20
+ export declare function downloadMaterialIconSvg(iconName: string): Promise<string | null>;
21
+ /**
22
+ * Gets SVG content for an icon (from cache or downloads from Google)
23
+ * @param iconName - Name of the Material Icon
24
+ * @returns SVG path data or null if not found
25
+ */
26
+ export declare function getMaterialIconSvg(iconName: string): Promise<MaterialIconSvg | null>;
27
+ /**
28
+ * Creates an SVG element from Material Icon data
29
+ * @param iconData - The icon SVG data
30
+ * @param className - CSS class for the SVG (default: 'material-icons-svg')
31
+ * @param style - Inline styles for the SVG
32
+ * @returns Complete SVG element string
33
+ */
34
+ export declare function createSvgElement(iconData: MaterialIconSvg, className?: string, style?: string): string;
35
+ /**
36
+ * Transforms Material Icons <i> tags to SVG elements
37
+ * @param html - HTML string containing <i class="material-icons"> elements
38
+ * @returns HTML with icons replaced by SVG elements
39
+ */
40
+ export declare function transformMaterialIconsToSvg(html: string): Promise<string>;
41
+ /**
42
+ * Adds a new icon to the SVG mapping
43
+ * @param iconName - Name of the icon
44
+ * @param svgData - SVG data for the icon
45
+ */
46
+ export declare function addMaterialIconSvg(iconName: string, svgData: MaterialIconSvg): void;
47
+ /**
48
+ * Gets a list of all available icon names
49
+ * @returns Array of available icon names
50
+ */
51
+ export declare function getAvailableIconNames(): string[];
@@ -0,0 +1,31 @@
1
+ export declare function dateReviver(_key: any, value: any): any;
2
+ /**
3
+ * Utility functions for object operations
4
+ */
5
+ /**
6
+ * Returns the first property name that has a non-null value
7
+ * @param obj - The object to search through
8
+ * @returns The property name or null if all properties are null
9
+ */
10
+ export declare function findFirstNonNullProperty<T extends Record<string, any>>(obj: T): keyof T | null;
11
+ /**
12
+ * Returns the first property name and value that is not null
13
+ * @param obj - The object to search through
14
+ * @returns Object with property name and value, or null if all properties are null
15
+ */
16
+ export declare function findFirstNonNullPropertyWithValue<T extends Record<string, any>>(obj: T): {
17
+ key: keyof T;
18
+ value: any;
19
+ } | null;
20
+ /**
21
+ * Returns all property names that have non-null values
22
+ * @param obj - The object to search through
23
+ * @returns Array of property names with non-null values
24
+ */
25
+ export declare function findAllNonNullNonEmptyProperties<T extends Record<string, any>>(obj: T): (keyof T)[];
26
+ /**
27
+ * Returns an object with only the non-null properties
28
+ * @param obj - The object to filter
29
+ * @returns New object with only non-null properties
30
+ */
31
+ export declare function filterNonNullProperties<T extends Record<string, any>>(obj: T): Partial<T>;
@@ -0,0 +1,3 @@
1
+ import { ArtifactData } from '../models/ArtifactData';
2
+ import { ArtifactJson } from './jsonDetector';
3
+ export declare function parseArtifactFromJson(json: ArtifactJson, interactionId: string): ArtifactData | null;
@@ -0,0 +1,3 @@
1
+ import { AgentContext, User } from '../models/contexts';
2
+ export declare const setEbiContextData: (window: any, user: User, context?: AgentContext | null, sessionId?: string | null) => void;
3
+ export declare const setEbiContextSessionId: (sessionId: string) => void;
@@ -0,0 +1,31 @@
1
+ import { parseRawNumber } from './stringUtils';
2
+ import { Theme } from '@mui/material';
3
+ export interface SortableTableOptions {
4
+ theme?: Theme
5
+ sortableClass?: string;
6
+ activeSortClass?: string;
7
+ ascendingClass?: string;
8
+ descendingClass?: string;
9
+ unsortedIcon?: string;
10
+ ascendingIcon?: string;
11
+ descendingIcon?: string;
12
+ sortOnFirstClick?: boolean;
13
+ customSorters?: Record<number, (a: any, b: any, direction: string) => number>;
14
+ excludeColumns?: number[];
15
+ preserveExistingIcons?: boolean;
16
+ enableResizing?: boolean;
17
+ enableReordering?: boolean;
18
+ resizableClass?: string;
19
+ draggableClass?: string;
20
+ dragPlaceholderClass?: string;
21
+ dragOverClass?: string;
22
+ }
23
+
24
+ export declare class SortableTable {
25
+ constructor(options?: SortableTableOptions);
26
+ init(container?: HTMLElement | Element | string | null): void;
27
+ destroy(): void;
28
+ refresh(): void;
29
+ }
30
+
31
+ export default SortableTable;
@@ -0,0 +1,8 @@
1
+ export declare const chunkArray: (char: string[], size: number) => string[][];
2
+ export declare const splitBigLinesWithSpaces: (content: string) => string;
3
+ export declare function parseRawNumber(text: string): number;
4
+ export declare function parseKnownNumbers(text?: string): {
5
+ prefix?: string;
6
+ suffix?: string;
7
+ number?: number;
8
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * URI encoding detection and utility functions
3
+ */
4
+ /**
5
+ * Checks if a string is likely URI encoded
6
+ * @param str - The string to check
7
+ * @returns True if the string appears to be URI encoded
8
+ */
9
+ export declare function isUriEncoded(str: string): boolean;
10
+ /**
11
+ * Decodes a URI encoded string
12
+ * @param encodedString - The URI encoded string
13
+ * @returns The decoded string
14
+ */
15
+ export declare function decodeUri(encodedString: string): string;
16
+ /**
17
+ * Encodes a string for URI usage
18
+ * @param string - The string to encode
19
+ * @returns The URI encoded string
20
+ */
21
+ export declare function encodeUri(string: string): string;
22
+ /**
23
+ * Checks if a string is a valid URI
24
+ * @param uri - The URI string to validate
25
+ * @returns True if the string is a valid URI
26
+ */
27
+ export declare function isValidUri(uri: string): boolean;
28
+ /**
29
+ * Extracts and decodes URI parameters from a query string
30
+ * @param queryString - The query string (with or without leading ?)
31
+ * @returns Object with decoded parameters
32
+ */
33
+ export declare function parseUriParams(queryString: string): Record<string, string>;
34
+ /**
35
+ * Checks if a string contains JavaScript code
36
+ * @param str - The string to check
37
+ * @returns True if the string appears to contain JavaScript code
38
+ */
39
+ export declare function containsJavaScriptCode(str: string): boolean;
@@ -0,0 +1,8 @@
1
+ export declare const parseAndValidateArtifactUrl: (url: string) => string | null;
2
+ export type LinkAction = 'Export' | 'Question' | 'OpenDashboard' | 'URL';
3
+ export declare const extractLinkAction: (link: string, sessionId: string, content: string | null) => {
4
+ action: LinkAction;
5
+ url: string | null;
6
+ question: string | null;
7
+ parameter: string | null;
8
+ };
package/dist/style.css ADDED
@@ -0,0 +1,94 @@
1
+ /* v2 layout fonts + global resets, scoped to .v2-app so the v1 dashboard-app
2
+ keeps its own typography untouched. Inter + JetBrains Mono ship via Google
3
+ Fonts (matches the design reference). */
4
+
5
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
6
+
7
+ /* Material icon fonts. The agent generates `<i class="material-icons">name</i>`
8
+ and `<span class="material-symbols-outlined">name</span>` inline in chat
9
+ content (table sort glyphs, callouts, etc); without the font face loaded
10
+ browsers render the literal ligature name as text. Both legacy Material
11
+ Icons and the newer Material Symbols Outlined are imported so any
12
+ agent-generated markup resolves. */
13
+ @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
14
+ @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');
15
+
16
+ /* The Symbols family @import ships the @font-face but not the helper class,
17
+ so define it explicitly. Material Icons (legacy) already includes its own
18
+ `.material-icons` rule via the icon-family stylesheet above. */
19
+ .material-symbols-outlined {
20
+ font-family: 'Material Symbols Outlined';
21
+ font-weight: normal;
22
+ font-style: normal;
23
+ font-size: 24px;
24
+ line-height: 1;
25
+ letter-spacing: normal;
26
+ text-transform: none;
27
+ display: inline-block;
28
+ white-space: nowrap;
29
+ word-wrap: normal;
30
+ direction: ltr;
31
+ font-feature-settings: 'liga';
32
+ -webkit-font-feature-settings: 'liga';
33
+ -webkit-font-smoothing: antialiased;
34
+ }
35
+
36
+ .v2-app {
37
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
38
+ background: #0a0a0b;
39
+ color: #ececef;
40
+ -webkit-font-smoothing: antialiased;
41
+ -moz-osx-font-smoothing: grayscale;
42
+ }
43
+
44
+ .v2-app *,
45
+ .v2-app *::before,
46
+ .v2-app *::after {
47
+ box-sizing: border-box;
48
+ }
49
+
50
+ /* Tabular numerics for KPI / metric values */
51
+ .v2-app .v2-tnum {
52
+ font-feature-settings: 'tnum';
53
+ }
54
+
55
+ /* Mono helper for SQL previews, durations, etc. */
56
+ .v2-app .v2-mono {
57
+ font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
58
+ }
59
+
60
+ /* GridCard category accents now default to the v2 amber-uniform palette
61
+ at `:root` (see `GridLayout.css`). Legacy v1 dashboard-app re-binds
62
+ them via `.v1-app`. No `.v2-app` override needed — v2 inherits the
63
+ defaults. */
64
+
65
+ /* Slim scrollbars in v2 panes. The corner + button rules suppress the
66
+ default light-gray squares that some browsers paint where horizontal
67
+ and vertical scrollbars meet (and at the ends of the track). */
68
+ .v2-app *::-webkit-scrollbar {
69
+ width: 8px;
70
+ height: 8px;
71
+ }
72
+ .v2-app *::-webkit-scrollbar-thumb {
73
+ background: #26262d;
74
+ border-radius: 4px;
75
+ }
76
+ .v2-app *::-webkit-scrollbar-thumb:hover {
77
+ background: #2d2d36;
78
+ }
79
+ .v2-app *::-webkit-scrollbar-track {
80
+ background: transparent;
81
+ }
82
+ .v2-app *::-webkit-scrollbar-corner {
83
+ background: transparent;
84
+ }
85
+ .v2-app *::-webkit-scrollbar-button {
86
+ display: none;
87
+ width: 0;
88
+ height: 0;
89
+ }
90
+ /* Firefox */
91
+ .v2-app * {
92
+ scrollbar-width: thin;
93
+ scrollbar-color: #26262d transparent;
94
+ }
@@ -0,0 +1,32 @@
1
+ import { ServerEvent } from '../../src/models/ServerEvent';
2
+ import { IMessage, IWebSocketConnection } from '../../src/services/WebSocketConnection/webSocketConnection';
3
+ import { InteractionStatistics } from '../../src/models/semanticKernelModel/models';
4
+ export declare class FakeWebSocketConnection implements IWebSocketConnection {
5
+ onEvent?: (event: MessageEvent | ServerEvent) => Promise<void>;
6
+ onError?: (error: string) => void;
7
+ onOpen?: () => void;
8
+ onFirstToken?: (interactionId: string) => void;
9
+ onSuspended?: () => void;
10
+ onClose?: (code: number, reason: string) => void;
11
+ onNewPacket?: (stats: InteractionStatistics) => void;
12
+ onPong?: (sessionId: string) => void;
13
+ onReconnecting?: never;
14
+ onReconnected?: (sessionId: string) => void;
15
+ onRewindLost?: never;
16
+ readonly recordedSends: IMessage[];
17
+ sessionIdToReturn: string;
18
+ private connected;
19
+ connect(_sessionId?: string): Promise<string>;
20
+ sendMessage(message: IMessage): void;
21
+ suspendStream(): void;
22
+ disconnect(): void;
23
+ closeStream(): void;
24
+ isConnected(): boolean;
25
+ /**
26
+ * Drive an event through `onEvent` *and await it*. Use this when the
27
+ * next assertion depends on the merger having finished (the gateway's
28
+ * merge path is fully synchronous after the await, but if onEvent
29
+ * ever grows an internal async hop the test stays correct).
30
+ */
31
+ deliver(event: ServerEvent): Promise<void>;
32
+ }
@@ -0,0 +1,24 @@
1
+ import { AiChatStore } from '../../src/components/AiChat/stateConfiguration';
2
+ import { EventBusService } from '../../src/services/eventBusService';
3
+ import { AgentGatewayWSAsync } from '../../src/services/servers/AgentGatewayWSAsync';
4
+ import { BasicNotification } from '../../src/models/Notification';
5
+ import { INotificationPort } from '../../src/interfaces/INotificationPort';
6
+ import { FakeWebSocketConnection } from './fakeWebSocket';
7
+ export interface FakeNotificationCapture extends INotificationPort {
8
+ /** Every notification the gateway pushed during the test. */
9
+ readonly notifications: BasicNotification[];
10
+ }
11
+ export interface MakeGatewayHandle {
12
+ gateway: AgentGatewayWSAsync;
13
+ ws: FakeWebSocketConnection;
14
+ notifications: FakeNotificationCapture;
15
+ bus: EventBusService;
16
+ sessionStore: AiChatStore;
17
+ }
18
+ /**
19
+ * Build a fully-wired AgentGatewayWSAsync for tests. The `ws` field is
20
+ * the fake socket — call `await ws.deliver(serverEvent)` to drive the
21
+ * inbound stream. The `notifications` field is the captured array of
22
+ * everything pushed to the notification port during the test.
23
+ */
24
+ export declare function makeGateway(): MakeGatewayHandle;
@@ -0,0 +1,73 @@
1
+ import { Interaction } from '../src/models/Interaction';
2
+ import { InteractionPart } from '../src/models/InteractionPart';
3
+ import { Artifact } from '../src/models/Artifact';
4
+ import { ServerEvent, FunctionDetails, ServerEvent as ServerEventType } from '../src/models/ServerEvent';
5
+ import { LlmArtifact } from '../src/models/semanticKernelModel/models';
6
+ import { EventBusService } from '../src/services/eventBusService';
7
+ import { InteractionService } from '../src/services/interactionService';
8
+ export declare const fixedNow: Date;
9
+ export declare function part(overrides: Partial<InteractionPart>): InteractionPart;
10
+ export declare function functionDetails(overrides: Partial<FunctionDetails> & {
11
+ id: string;
12
+ }): FunctionDetails;
13
+ export declare function event(opts: {
14
+ parts: InteractionPart[];
15
+ partial?: boolean;
16
+ turn_complete?: boolean;
17
+ asyncFinalResponse?: boolean;
18
+ llmArtifacts?: LlmArtifact[];
19
+ }): ServerEvent;
20
+ export declare function makeInteraction(overrides?: Partial<Interaction>): Interaction;
21
+ export declare function artifact(overrides: Partial<Artifact> & {
22
+ id: string;
23
+ }): Artifact;
24
+ export declare function llmArtifact(a: Artifact): LlmArtifact;
25
+ export declare function makeService(interaction?: Interaction): {
26
+ service: InteractionService;
27
+ bus: EventBusService;
28
+ emitSpy: import('vitest').Mock<(functionDetails: FunctionDetails) => void>;
29
+ };
30
+ export declare function serverEvent(opts: {
31
+ interactionId: string;
32
+ parts: InteractionPart[];
33
+ partial?: boolean;
34
+ turn_complete?: boolean;
35
+ asyncFinalResponse?: boolean;
36
+ author?: 'main' | 'tool' | 'system';
37
+ llmArtifacts?: LlmArtifact[];
38
+ subAgentId?: string;
39
+ subAgentName?: string;
40
+ }): ServerEventType;
41
+ /**
42
+ * A sub-agent text event. Same shape as `partialTextEvent` but carries
43
+ * the `subAgentId` / `subAgentName` that routes the event through
44
+ * `handleSubAgentEvent` (separate Interaction tree from the main turn).
45
+ */
46
+ export declare function subAgentTextEvent(interactionId: string, opts: {
47
+ subAgentId: string;
48
+ subAgentName?: string;
49
+ text: string;
50
+ partial?: boolean;
51
+ turn_complete?: boolean;
52
+ }): ServerEventType;
53
+ export declare function partialThoughtEvent(interactionId: string, text: string): ServerEventType;
54
+ export declare function partialTextEvent(interactionId: string, text: string): ServerEventType;
55
+ export declare function partialFunctionCallEvent(interactionId: string, opts: {
56
+ callId: string;
57
+ name: string;
58
+ text: string;
59
+ }): ServerEventType;
60
+ export declare function functionCallEvent(interactionId: string, opts: {
61
+ callId: string;
62
+ name: string;
63
+ args: unknown;
64
+ start: Date;
65
+ }): ServerEventType;
66
+ export declare function functionResponseEvent(interactionId: string, opts: {
67
+ callId: string;
68
+ name: string;
69
+ args?: unknown;
70
+ response: unknown;
71
+ end: Date;
72
+ }): ServerEventType;
73
+ export declare function turnCompleteEvent(interactionId: string): ServerEventType;
@@ -0,0 +1,107 @@
1
+ var L = Object.defineProperty;
2
+ var d = (e, t) => L(e, "name", { value: t, configurable: !0 });
3
+ import { useMemo as h, useState as v, useCallback as g, useEffect as C } from "react";
4
+ import { H } from "./httpSessionService-5Kr__oQL.js";
5
+ const w = 6e4, y = 60 * w, l = 24 * y;
6
+ function k(e) {
7
+ if (!e) return;
8
+ if (e instanceof Date) return e;
9
+ const t = new Date(e);
10
+ return Number.isNaN(t.getTime()) ? void 0 : t;
11
+ }
12
+ d(k, "toDate");
13
+ function N(e) {
14
+ if (!e) return "";
15
+ const t = Date.now() - e.getTime();
16
+ return t < w ? "now" : t < y ? `${Math.floor(t / w)}m` : t < l ? `${Math.floor(t / y)}h` : t < 7 * l ? `${Math.floor(t / l)}d` : e.toLocaleDateString(void 0, { month: "short", day: "numeric" });
17
+ }
18
+ d(N, "formatTimeLabel");
19
+ function U() {
20
+ const e = /* @__PURE__ */ new Date();
21
+ return e.setHours(0, 0, 0, 0), e;
22
+ }
23
+ d(U, "startOfToday");
24
+ function x(e) {
25
+ const t = U(), s = new Date(t.getTime() - l), i = new Date(t.getTime() - 7 * l), m = new Date(t.getTime() - 30 * l), o = [
26
+ ["Today", []],
27
+ ["Yesterday", []],
28
+ ["This Week", []],
29
+ ["This Month", []],
30
+ ["Older", []]
31
+ ];
32
+ for (const n of e) {
33
+ const c = n.updatedAt;
34
+ if (!c) {
35
+ o[4][1].push(n);
36
+ continue;
37
+ }
38
+ c >= t ? o[0][1].push(n) : c >= s ? o[1][1].push(n) : c >= i ? o[2][1].push(n) : c >= m ? o[3][1].push(n) : o[4][1].push(n);
39
+ }
40
+ return o.filter(([, n]) => n.length > 0).map(([n, c]) => ({ label: n, items: c }));
41
+ }
42
+ d(x, "groupByTime");
43
+ function B(e, t) {
44
+ const s = k(e.updatedAt) ?? k(e.created);
45
+ return { ...{
46
+ id: e.id ?? e.browserScopeId ?? "",
47
+ title: e.overview || e.userDescription || "(untitled chat)",
48
+ snippet: e.lastQuestion ?? void 0,
49
+ timeLabel: N(s),
50
+ kind: e.agentType,
51
+ updatedAt: s,
52
+ raw: e
53
+ }, ...(t == null ? void 0 : t(e)) ?? {} };
54
+ }
55
+ d(B, "buildItem");
56
+ function Y(e) {
57
+ const t = h(() => new H(e.serverBaseUrl, e.accessToken), [e.accessToken, e.serverBaseUrl]), { sessionService: s, liveSession: i, decorate: m } = {
58
+ sessionService: t,
59
+ liveSession: e.liveSession,
60
+ decorate: e.decorate
61
+ }, [o, n] = v([]), [c, T] = v(!0), [M, b] = v(null), u = g(async () => {
62
+ T(!0), b(null);
63
+ try {
64
+ const r = await s.getAllSessions();
65
+ n(r);
66
+ } catch (r) {
67
+ b(r instanceof Error ? r : new Error(String(r)));
68
+ } finally {
69
+ T(!1);
70
+ }
71
+ }, [s]);
72
+ C(() => {
73
+ u();
74
+ }, [u]);
75
+ const S = h(() => {
76
+ if (!(i != null && i.id)) return o;
77
+ const r = o.findIndex((f) => f.id === i.id);
78
+ if (r === -1) return [i, ...o];
79
+ const a = o.slice();
80
+ return a[r] = i, a;
81
+ }, [o, i]), D = h(
82
+ () => S.map((r) => B(r, m)),
83
+ [S, m]
84
+ ), A = h(() => x(D), [D]), E = g(async (r, a) => {
85
+ n(
86
+ (f) => f.map((p) => p.id === r ? { ...p, overview: a } : p)
87
+ );
88
+ try {
89
+ await s.patchSession(r, { overview: a });
90
+ } catch (f) {
91
+ console.error("[useChatSessions] rename failed; refreshing to roll back:", f), u();
92
+ }
93
+ }, [s, u]), I = g(async (r) => {
94
+ n((a) => a.filter((f) => f.id !== r));
95
+ try {
96
+ await s.removeSession(r);
97
+ } catch (a) {
98
+ console.error("[useChatSessions] remove failed; refreshing to roll back:", a), u();
99
+ }
100
+ }, [s, u]);
101
+ return { sessions: S, groups: A, isLoading: c, error: M, refresh: u, rename: E, remove: I };
102
+ }
103
+ d(Y, "useChatSessions");
104
+ export {
105
+ Y as u
106
+ };
107
+ //# sourceMappingURL=useChatSessions-DttlifVk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatSessions-DttlifVk.js","sources":["../src/hooks/useChatSessions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { ChatSession } from '@lib/models/ChatSession';\nimport type { ISessionService } from '@lib/services/servers/sessionService/ISessionService';\nimport { HttpSessionService } from '../services';\n\n/**\n * One row in a session-picker UI. `raw` is the original ChatSession the\n * server returned; everything else is a derived label the hook computed\n * (and the host's `decorate` callback may have overridden).\n */\nexport interface ChatSessionListItem {\n id: string;\n title: string;\n snippet?: string;\n /** Compact relative-time label (\"now\", \"5m\", \"2h\", \"Mar 14\"). */\n timeLabel?: string;\n /** Optional per-row tag — host-supplied via the `decorate` callback. */\n kind?: string;\n updatedAt?: Date;\n raw: ChatSession;\n}\n\n/**\n * Sessions bucketed by recency. The order of `label` reflects display\n * order top-down (\"Today\" first, \"Older\" last).\n */\nexport interface ChatSessionGroup {\n label: string;\n items: ChatSessionListItem[];\n}\n\nexport interface UseChatSessionsOptions {\n sessionService?: ISessionService;\n /**\n * If provided, the live (current) session is merged into the list —\n * replacing an existing entry by id, or prepended if not yet on the\n * server. Lets a \"New chat\" row appear instantly without waiting for\n * the server roundtrip.\n */\n liveSession?: ChatSession | null;\n\n accessToken: string,\n serverBaseUrl: string,\n /**\n * Per-row override hook. Whatever fields you return are merged on top\n * of the hook's computed item — typical use is adding a `kind` tag for\n * application-specific session types (`'chat' | 'composer' | ...`) the\n * library doesn't know about.\n */\n decorate?: (session: ChatSession) => Partial<ChatSessionListItem>;\n}\n\nexport interface UseChatSessionsResult {\n /** Flat list (live session merged in, server order preserved). */\n sessions: ChatSession[];\n /** Same data bucketed by recency. */\n groups: ChatSessionGroup[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Optimistic rename — patches local state immediately, rolls back on failure. */\n rename: (id: string, title: string) => Promise<void>;\n /** Optimistic remove — drops from local state immediately, rolls back on failure. */\n remove: (id: string) => Promise<void>;\n}\n\nconst MINUTE_MS = 60_000;\nconst HOUR_MS = 60 * MINUTE_MS;\nconst DAY_MS = 24 * HOUR_MS;\n\nfunction toDate(value: Date | string | undefined | null): Date | undefined {\n if (!value) return undefined;\n if (value instanceof Date) return value;\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nfunction formatTimeLabel(date: Date | undefined): string {\n if (!date) return '';\n const diff = Date.now() - date.getTime();\n if (diff < MINUTE_MS) return 'now';\n if (diff < HOUR_MS) return `${Math.floor(diff / MINUTE_MS)}m`;\n if (diff < DAY_MS) return `${Math.floor(diff / HOUR_MS)}h`;\n if (diff < 7 * DAY_MS) return `${Math.floor(diff / DAY_MS)}d`;\n return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction startOfToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nfunction groupByTime(items: ChatSessionListItem[]): ChatSessionGroup[] {\n const today = startOfToday();\n const yesterday = new Date(today.getTime() - DAY_MS);\n const weekAgo = new Date(today.getTime() - 7 * DAY_MS);\n const monthAgo = new Date(today.getTime() - 30 * DAY_MS);\n\n // Insertion-ordered map preserves the bucket display order.\n const buckets: Array<[string, ChatSessionListItem[]]> = [\n ['Today', []],\n ['Yesterday', []],\n ['This Week', []],\n ['This Month', []],\n ['Older', []],\n ];\n\n for (const item of items) {\n const u = item.updatedAt;\n if (!u) { buckets[4][1].push(item); continue; }\n if (u >= today) buckets[0][1].push(item);\n else if (u >= yesterday) buckets[1][1].push(item);\n else if (u >= weekAgo) buckets[2][1].push(item);\n else if (u >= monthAgo) buckets[3][1].push(item);\n else buckets[4][1].push(item);\n }\n\n return buckets\n .filter(([, list]) => list.length > 0)\n .map(([label, list]) => ({ label, items: list }));\n}\n\nfunction buildItem(\n session: ChatSession,\n decorate?: (s: ChatSession) => Partial<ChatSessionListItem>,\n): ChatSessionListItem {\n const updatedAt = toDate(session.updatedAt) ?? toDate(session.created);\n const base: ChatSessionListItem = {\n id: session.id ?? session.browserScopeId ?? '',\n title: session.overview || session.userDescription || '(untitled chat)',\n snippet: session.lastQuestion ?? undefined,\n timeLabel: formatTimeLabel(updatedAt),\n kind: session.agentType as string | undefined,\n updatedAt,\n raw: session,\n };\n return { ...base, ...(decorate?.(session) ?? {}) };\n}\n\n/**\n * Fetch + organise the user's chat sessions for a picker UI. Backend-agnostic\n * — the host injects an `ISessionService` so the same hook drives an HTTP\n * client, an in-memory fake, or whatever else.\n *\n * Replaces the duplicated `useEffect(async () => sessionService.getAllSessions())`\n * + grouping logic that lived in DataExplorerViewV2 and MobileSessionsList,\n * and consolidates the optimistic rename/delete pattern.\n */\nexport function useChatSessions(opts: UseChatSessionsOptions): UseChatSessionsResult {\n\n const defaultSessionService = useMemo(() => {\n return new HttpSessionService(opts.serverBaseUrl, opts.accessToken);\n }, [opts.accessToken, opts.serverBaseUrl]);\n\n const { sessionService, liveSession, decorate } = {\n sessionService: defaultSessionService,\n liveSession: opts.liveSession,\n decorate: opts.decorate\n };\n const [sessions, setSessions] = useState<ChatSession[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n\n const refresh = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n try {\n const list = await sessionService.getAllSessions();\n setSessions(list);\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [sessionService]);\n\n useEffect(() => { void refresh(); }, [refresh]);\n\n const merged = useMemo(() => {\n if (!liveSession?.id) return sessions;\n const idx = sessions.findIndex(s => s.id === liveSession.id);\n if (idx === -1) return [liveSession, ...sessions];\n const copy = sessions.slice();\n copy[idx] = liveSession;\n return copy;\n }, [sessions, liveSession]);\n\n const items = useMemo(\n () => merged.map(s => buildItem(s, decorate)),\n [merged, decorate],\n );\n\n const groups = useMemo(() => groupByTime(items), [items]);\n\n const rename = useCallback(async (id: string, title: string) => {\n setSessions(current =>\n current.map(s => (s.id === id ? { ...s, overview: title } : s)),\n );\n try {\n await sessionService.patchSession(id, { overview: title });\n } catch (err) {\n console.error('[useChatSessions] rename failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n const remove = useCallback(async (id: string) => {\n setSessions(current => current.filter(s => s.id !== id));\n try {\n await sessionService.removeSession(id);\n } catch (err) {\n console.error('[useChatSessions] remove failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n return { sessions: merged, groups, isLoading, error, refresh, rename, remove };\n}\n"],"names":["MINUTE_MS","HOUR_MS","DAY_MS","toDate","value","d","__name","formatTimeLabel","date","diff","startOfToday","groupByTime","items","today","yesterday","weekAgo","monthAgo","buckets","item","u","list","label","buildItem","session","decorate","updatedAt","useChatSessions","opts","defaultSessionService","useMemo","HttpSessionService","sessionService","liveSession","sessions","setSessions","useState","isLoading","setIsLoading","error","setError","refresh","useCallback","err","useEffect","merged","idx","s","copy","groups","rename","id","title","current","remove"],"mappings":";;;;AAkEA,MAAMA,IAAY,KACZC,IAAU,KAAKD,GACfE,IAAS,KAAKD;AAEpB,SAASE,EAAOC,GAA2D;AACvE,MAAI,CAACA,EAAO;AACZ,MAAIA,aAAiB,KAAM,QAAOA;AAClC,QAAMC,IAAI,IAAI,KAAKD,CAAK;AACxB,SAAO,OAAO,MAAMC,EAAE,QAAA,CAAS,IAAI,SAAYA;AACnD;AALSC,EAAAH,GAAA;AAOT,SAASI,EAAgBC,GAAgC;AACrD,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAO,KAAK,IAAA,IAAQD,EAAK,QAAA;AAC/B,SAAIC,IAAOT,IAAkB,QACzBS,IAAOR,IAAgB,GAAG,KAAK,MAAMQ,IAAOT,CAAS,CAAC,MACtDS,IAAOP,IAAe,GAAG,KAAK,MAAMO,IAAOR,CAAO,CAAC,MACnDQ,IAAO,IAAIP,IAAe,GAAG,KAAK,MAAMO,IAAOP,CAAM,CAAC,MACnDM,EAAK,mBAAmB,QAAW,EAAE,OAAO,SAAS,KAAK,WAAW;AAChF;AARSF,EAAAC,GAAA;AAUT,SAASG,IAAqB;AAC1B,QAAML,wBAAQ,K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O,EAAE,UAAUI,GAAQ,QAAAI,GAAQ,WAAAZ,GAAW,OAAAE,GAAO,SAAAE,GAAS,QAAAS,GAAQ,QAAAI,EAAA;AAC1E;AAtEgB/C,EAAAoB,GAAA;"}
@@ -0,0 +1,52 @@
1
+ var R = Object.defineProperty;
2
+ var u = (t, e) => R(t, "name", { value: e, configurable: !0 });
3
+ import { useRef as g, useState as d, useEffect as h } from "react";
4
+ function I(t, e) {
5
+ const s = g(t), [o, i] = d(null);
6
+ return h(() => {
7
+ s.current = t;
8
+ }, [t]), h(() => {
9
+ function n() {
10
+ s.current();
11
+ }
12
+ if (u(n, "tick"), e !== null) {
13
+ const r = setInterval(n, e);
14
+ return i(r), () => {
15
+ clearInterval(r);
16
+ };
17
+ }
18
+ }, [e]), o;
19
+ }
20
+ u(I, "useInterval");
21
+ function C(t, e, s = 0) {
22
+ const [o, i] = d(s);
23
+ return h(() => {
24
+ const n = t.current;
25
+ if (!n) return;
26
+ const r = new ResizeObserver((v) => {
27
+ const c = v[0];
28
+ c && i(c.contentRect.width);
29
+ });
30
+ return r.observe(n), i(n.getBoundingClientRect().width), () => r.disconnect();
31
+ }, [t, e]), o;
32
+ }
33
+ u(C, "useContainerWidth");
34
+ function W(t, e, s = 0, o = 0) {
35
+ const [i, n] = d(s), [r, v] = d(o);
36
+ return h(() => {
37
+ const c = t.current;
38
+ if (!c) return;
39
+ const f = new ResizeObserver((l) => {
40
+ const a = l[0];
41
+ a && (v(a.contentRect.height), n(a.contentRect.width));
42
+ });
43
+ return f.observe(c), n(c.getBoundingClientRect().width), () => f.disconnect();
44
+ }, [t, e]), [i, r];
45
+ }
46
+ u(W, "useContainerRectangle");
47
+ export {
48
+ C as a,
49
+ I as b,
50
+ W as u
51
+ };
52
+ //# sourceMappingURL=useContainerWidth-Df2PmSoC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContainerWidth-Df2PmSoC.js","sources":["../src/hooks/useIntervalHook.ts","../src/hooks/useContainerWidth.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\n// Custom useInterval hook\nfunction useInterval(callback: () => void, delay: number) {\n const savedCallback = useRef(callback);\n const [intervalId, setIntervalId] = useState<NodeJS.Timeout | null>(null)\n\n // Remember the latest callback.\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== null) {\n const id = setInterval(tick, delay);\n setIntervalId(id)\n return () => {\n\n clearInterval(id); // Cleanup function\n }\n }\n }, [delay]);\n\n return intervalId;\n}\n\nexport default useInterval","import { useState, useEffect } from \"react\";\n\nexport function useContainerWidth(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0) {\n const [width, setWidth] = useState(initialWidth);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return width;\n}\n\nexport function useContainerRectangle(ref: React.RefObject<HTMLElement | null>, renderId: string, initialWidth = 0, initialHeight = 0) {\n const [width, setWidth] = useState(initialWidth);\n const [height, setHeight] = useState(initialHeight);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) {\n setHeight(entry.contentRect.height);\n setWidth(entry.contentRect.width);\n }\n });\n\n observer.observe(el);\n setWidth(el.getBoundingClientRect().width);\n\n return () => observer.disconnect();\n }, [ref, renderId]);\n\n return [width, height];\n}"],"names":["useInterval","callback","delay","savedCallback","useRef","intervalId","setIntervalId","useState","useEffect","tick","__name","id","useContainerWidth","ref","renderId","initialWidth","width","setWidth","el","observer","entries","entry","useContainerRectangle","initialHeight","height","setHeight"],"mappings":";;;AAGA,SAASA,EAAYC,GAAsBC,GAAe;AACtD,QAAMC,IAAgBC,EAAOH,CAA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