@gram-ai/elements 1.27.4 → 1.27.5

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 (277) hide show
  1. package/README.md +72 -60
  2. package/README.typedoc.md +6 -6
  3. package/bin/cli.js +74 -74
  4. package/dist/compat-shims-CO9JXXV4.cjs.map +1 -1
  5. package/dist/{compat-shims-BPJ7Q68c.js → compat-shims-DxtUrORi.js} +4 -2
  6. package/dist/compat-shims-DxtUrORi.js.map +1 -0
  7. package/dist/components/ShareButton/index.d.ts +2 -2
  8. package/dist/components/assistant-ui/message-feedback.d.ts +1 -1
  9. package/dist/components/assistant-ui/tooltip-icon-button.d.ts +2 -2
  10. package/dist/components/ui/avatar.d.ts +2 -2
  11. package/dist/components/ui/button.d.ts +1 -1
  12. package/dist/components/ui/calendar.d.ts +1 -1
  13. package/dist/components/ui/collapsible.d.ts +1 -1
  14. package/dist/components/ui/dialog.d.ts +4 -4
  15. package/dist/components/ui/popover.d.ts +2 -2
  16. package/dist/components/ui/skeleton.d.ts +1 -1
  17. package/dist/components/ui/time-range-picker.d.ts +1 -1
  18. package/dist/components/ui/tool-ui.d.ts +7 -7
  19. package/dist/components/ui/tooltip.d.ts +2 -2
  20. package/dist/contexts/ConnectionStatusContext.d.ts +1 -1
  21. package/dist/elements.cjs +1 -1
  22. package/dist/elements.js +2 -2
  23. package/dist/hooks/useDensity.d.ts +73 -73
  24. package/dist/hooks/useMCPTools.d.ts +1 -1
  25. package/dist/hooks/useRadius.d.ts +1 -1
  26. package/dist/{index-BpJstUh1.cjs → index-C4bFBGfl.cjs} +4 -4
  27. package/dist/{index-BpJstUh1.cjs.map → index-C4bFBGfl.cjs.map} +1 -1
  28. package/dist/{index-CUitXazZ.js → index-D93pV0_o.js} +55 -55
  29. package/dist/{index-CUitXazZ.js.map → index-D93pV0_o.js.map} +1 -1
  30. package/dist/{index-D0bAYNQy.js → index-DuCQRbcQ.js} +279 -265
  31. package/dist/index-DuCQRbcQ.js.map +1 -0
  32. package/dist/{index-KSX4Qjip.cjs → index-y_PNN5vK.cjs} +10 -10
  33. package/dist/index-y_PNN5vK.cjs.map +1 -0
  34. package/dist/lib/cassette.d.ts +4 -4
  35. package/dist/lib/errorTracking.d.ts +1 -1
  36. package/dist/lib/messageConverter.d.ts +1 -1
  37. package/dist/lib/models.d.ts +1 -1
  38. package/dist/plugins/chart/ui/bar-chart.d.ts +1 -1
  39. package/dist/plugins/generative-ui/ui/accordion-wrapper.d.ts +2 -2
  40. package/dist/plugins/generative-ui/ui/accordion.d.ts +1 -1
  41. package/dist/plugins/generative-ui/ui/action-button.d.ts +2 -2
  42. package/dist/plugins/generative-ui/ui/alert-wrapper.d.ts +1 -1
  43. package/dist/plugins/generative-ui/ui/alert.d.ts +4 -4
  44. package/dist/plugins/generative-ui/ui/avatar.d.ts +5 -5
  45. package/dist/plugins/generative-ui/ui/badge.d.ts +2 -2
  46. package/dist/plugins/generative-ui/ui/button-wrapper.d.ts +2 -2
  47. package/dist/plugins/generative-ui/ui/button.d.ts +2 -2
  48. package/dist/plugins/generative-ui/ui/card-wrapper.d.ts +2 -2
  49. package/dist/plugins/generative-ui/ui/card.d.ts +8 -8
  50. package/dist/plugins/generative-ui/ui/checkbox.d.ts +1 -1
  51. package/dist/plugins/generative-ui/ui/data-table.d.ts +2 -2
  52. package/dist/plugins/generative-ui/ui/dialog.d.ts +3 -3
  53. package/dist/plugins/generative-ui/ui/dropdown-menu.d.ts +3 -3
  54. package/dist/plugins/generative-ui/ui/grid.d.ts +3 -3
  55. package/dist/plugins/generative-ui/ui/input-wrapper.d.ts +1 -1
  56. package/dist/plugins/generative-ui/ui/input.d.ts +2 -2
  57. package/dist/plugins/generative-ui/ui/label.d.ts +1 -1
  58. package/dist/plugins/generative-ui/ui/metric.d.ts +3 -3
  59. package/dist/plugins/generative-ui/ui/pagination.d.ts +6 -6
  60. package/dist/plugins/generative-ui/ui/popover.d.ts +4 -4
  61. package/dist/plugins/generative-ui/ui/progress.d.ts +2 -2
  62. package/dist/plugins/generative-ui/ui/radio-group.d.ts +1 -1
  63. package/dist/plugins/generative-ui/ui/select.d.ts +2 -2
  64. package/dist/plugins/generative-ui/ui/separator.d.ts +1 -1
  65. package/dist/plugins/generative-ui/ui/skeleton.d.ts +1 -1
  66. package/dist/plugins/generative-ui/ui/stack.d.ts +6 -6
  67. package/dist/plugins/generative-ui/ui/switch.d.ts +2 -2
  68. package/dist/plugins/generative-ui/ui/table.d.ts +9 -9
  69. package/dist/plugins/generative-ui/ui/tabs-wrapper.d.ts +1 -1
  70. package/dist/plugins/generative-ui/ui/tabs.d.ts +1 -1
  71. package/dist/plugins/generative-ui/ui/text.d.ts +3 -3
  72. package/dist/plugins/generative-ui/ui/textarea.d.ts +2 -2
  73. package/dist/plugins/generative-ui/ui/tooltip.d.ts +1 -1
  74. package/dist/plugins.cjs +1 -1
  75. package/dist/plugins.js +1 -1
  76. package/dist/{profiler-BFkhZRxj.js → profiler-FpBY9eRv.js} +2 -2
  77. package/dist/{profiler-BFkhZRxj.js.map → profiler-FpBY9eRv.js.map} +1 -1
  78. package/dist/{profiler-CyzxBxVz.cjs → profiler-_mthyjvo.cjs} +2 -2
  79. package/dist/{profiler-CyzxBxVz.cjs.map → profiler-_mthyjvo.cjs.map} +1 -1
  80. package/dist/react-shim.js +1 -1
  81. package/dist/server/express.cjs.map +1 -1
  82. package/dist/server/express.js.map +1 -1
  83. package/dist/{startRecording-Dq92sEHf.cjs → startRecording-NJcpiHw-.cjs} +2 -2
  84. package/dist/{startRecording-Dq92sEHf.cjs.map → startRecording-NJcpiHw-.cjs.map} +1 -1
  85. package/dist/{startRecording-C-PPAs_Z.js → startRecording-r5MXQ2Dm.js} +2 -2
  86. package/dist/{startRecording-C-PPAs_Z.js.map → startRecording-r5MXQ2Dm.js.map} +1 -1
  87. package/dist/types/index.d.ts +2 -2
  88. package/package.json +1 -5
  89. package/src/compat-plugin.ts +14 -14
  90. package/src/compat-shims.ts +33 -31
  91. package/src/compat.test.ts +48 -48
  92. package/src/compat.ts +6 -6
  93. package/src/components/Chat/index.tsx +17 -17
  94. package/src/components/Chat/stories/Charts.stories.tsx +98 -98
  95. package/src/components/Chat/stories/Composer.stories.tsx +15 -15
  96. package/src/components/Chat/stories/ConnectionConfiguration.stories.tsx +44 -44
  97. package/src/components/Chat/stories/CustomComponents.stories.tsx +17 -17
  98. package/src/components/Chat/stories/Density.stories.tsx +20 -20
  99. package/src/components/Chat/stories/ErrorBoundary.stories.tsx +47 -47
  100. package/src/components/Chat/stories/FrontendTools.stories.tsx +39 -39
  101. package/src/components/Chat/stories/GenerativeUI.stories.tsx +48 -48
  102. package/src/components/Chat/stories/MessageFeedback.stories.tsx +52 -52
  103. package/src/components/Chat/stories/Modal.stories.tsx +28 -28
  104. package/src/components/Chat/stories/Model.stories.tsx +11 -11
  105. package/src/components/Chat/stories/Radius.stories.tsx +20 -20
  106. package/src/components/Chat/stories/Sidecar.stories.tsx +13 -13
  107. package/src/components/Chat/stories/StyleIsolation.stories.tsx +11 -11
  108. package/src/components/Chat/stories/Theme.stories.tsx +25 -25
  109. package/src/components/Chat/stories/Thread.stories.tsx +25 -25
  110. package/src/components/Chat/stories/ToolApproval.stories.tsx +55 -55
  111. package/src/components/Chat/stories/ToolMentions.stories.tsx +17 -17
  112. package/src/components/Chat/stories/Tools.stories.tsx +88 -88
  113. package/src/components/Chat/stories/Variants.stories.tsx +32 -32
  114. package/src/components/Chat/stories/Welcome.stories.tsx +14 -14
  115. package/src/components/ChatHistory.tsx +7 -7
  116. package/src/components/FrontendTools/index.tsx +5 -5
  117. package/src/components/Replay.stories.tsx +157 -157
  118. package/src/components/Replay.tsx +76 -73
  119. package/src/components/ShadowRoot.tsx +40 -40
  120. package/src/components/ShareButton/index.tsx +32 -32
  121. package/src/components/assistant-ui/assistant-modal.tsx +92 -87
  122. package/src/components/assistant-ui/assistant-sidecar.tsx +35 -35
  123. package/src/components/assistant-ui/attachment.tsx +80 -80
  124. package/src/components/assistant-ui/connection-status-indicator.tsx +33 -33
  125. package/src/components/assistant-ui/error-boundary.tsx +34 -34
  126. package/src/components/assistant-ui/follow-on-suggestions.tsx +26 -26
  127. package/src/components/assistant-ui/markdown-text.tsx +69 -69
  128. package/src/components/assistant-ui/mentioned-tools-badges.tsx +38 -38
  129. package/src/components/assistant-ui/message-feedback.tsx +57 -50
  130. package/src/components/assistant-ui/reasoning.tsx +83 -83
  131. package/src/components/assistant-ui/thread-list.tsx +45 -45
  132. package/src/components/assistant-ui/thread.tsx +278 -278
  133. package/src/components/assistant-ui/tool-fallback.tsx +37 -37
  134. package/src/components/assistant-ui/tool-group.tsx +26 -26
  135. package/src/components/assistant-ui/tool-mention-autocomplete.tsx +122 -122
  136. package/src/components/assistant-ui/tooltip-icon-button.tsx +18 -18
  137. package/src/components/ui/avatar.tsx +12 -12
  138. package/src/components/ui/button.tsx +12 -12
  139. package/src/components/ui/buttonVariants.ts +17 -17
  140. package/src/components/ui/calendar.tsx +106 -106
  141. package/src/components/ui/charts.stories.tsx +56 -56
  142. package/src/components/ui/collapsible.tsx +5 -5
  143. package/src/components/ui/dialog.tsx +30 -30
  144. package/src/components/ui/generative-ui.stories.tsx +200 -200
  145. package/src/components/ui/generative-ui.tsx +26 -26
  146. package/src/components/ui/popover.tsx +14 -14
  147. package/src/components/ui/skeleton.tsx +5 -5
  148. package/src/components/ui/time-range-picker.stories.tsx +80 -80
  149. package/src/components/ui/time-range-picker.tsx +245 -244
  150. package/src/components/ui/tool-ui.stories.tsx +37 -37
  151. package/src/components/ui/tool-ui.tsx +221 -215
  152. package/src/components/ui/tooltip.tsx +15 -15
  153. package/src/constants/tailwind.ts +1 -1
  154. package/src/contexts/ChatIdContext.tsx +7 -7
  155. package/src/contexts/ConnectionStatusContext.tsx +64 -64
  156. package/src/contexts/ElementsProvider.tsx +214 -213
  157. package/src/contexts/ReplayContext.ts +3 -3
  158. package/src/contexts/ToolApprovalContext.tsx +54 -54
  159. package/src/contexts/ToolExecutionContext.tsx +34 -34
  160. package/src/contexts/contexts.ts +7 -7
  161. package/src/contexts/portal-container-context.ts +2 -2
  162. package/src/contexts/portal-container.tsx +7 -7
  163. package/src/embedded.ts +1 -1
  164. package/src/global.css +25 -25
  165. package/src/hooks/useAuth.ts +72 -72
  166. package/src/hooks/useDensity.ts +79 -79
  167. package/src/hooks/useElements.ts +6 -6
  168. package/src/hooks/useExpanded.ts +12 -12
  169. package/src/hooks/useFollowOnSuggestions.ts +83 -83
  170. package/src/hooks/useGramThreadListAdapter.tsx +99 -99
  171. package/src/hooks/useMCPTools.ts +47 -47
  172. package/src/hooks/useModel.ts +14 -14
  173. package/src/hooks/usePluginComponents.ts +11 -11
  174. package/src/hooks/usePortalContainer.ts +5 -5
  175. package/src/hooks/useRadius.ts +23 -23
  176. package/src/hooks/useRecordCassette.ts +34 -34
  177. package/src/hooks/useSession.ts +11 -11
  178. package/src/hooks/useThemeProps.ts +13 -13
  179. package/src/hooks/useThreadId.ts +4 -4
  180. package/src/hooks/useToolApproval.ts +7 -7
  181. package/src/hooks/useToolMentions.ts +40 -40
  182. package/src/index.ts +26 -26
  183. package/src/lib/api.test.ts +61 -61
  184. package/src/lib/api.ts +4 -3
  185. package/src/lib/auth.ts +13 -13
  186. package/src/lib/cassette.ts +84 -84
  187. package/src/lib/easing.ts +1 -1
  188. package/src/lib/errorTracking.config.ts +5 -5
  189. package/src/lib/errorTracking.ts +29 -29
  190. package/src/lib/generative-ui.ts +7 -7
  191. package/src/lib/humanize.ts +3 -3
  192. package/src/lib/messageConverter.test.ts +130 -127
  193. package/src/lib/messageConverter.ts +196 -196
  194. package/src/lib/models.ts +21 -20
  195. package/src/lib/token.test.ts +56 -56
  196. package/src/lib/token.ts +14 -14
  197. package/src/lib/tool-mentions.ts +45 -45
  198. package/src/lib/tools.ts +66 -62
  199. package/src/lib/utils.ts +5 -5
  200. package/src/lib.d.ts +1 -1
  201. package/src/plugins/README.md +5 -5
  202. package/src/plugins/chart/catalog.ts +18 -18
  203. package/src/plugins/chart/chart.test.ts +31 -31
  204. package/src/plugins/chart/component.tsx +34 -34
  205. package/src/plugins/chart/index.ts +4 -4
  206. package/src/plugins/chart/ui/area-chart.tsx +42 -42
  207. package/src/plugins/chart/ui/bar-chart.tsx +46 -46
  208. package/src/plugins/chart/ui/donut-chart.tsx +48 -48
  209. package/src/plugins/chart/ui/index.ts +7 -7
  210. package/src/plugins/chart/ui/line-chart.tsx +43 -43
  211. package/src/plugins/chart/ui/pie-chart.tsx +44 -44
  212. package/src/plugins/chart/ui/radar-chart.tsx +33 -33
  213. package/src/plugins/chart/ui/scatter-chart.tsx +43 -43
  214. package/src/plugins/components/MacOSWindowFrame.tsx +15 -15
  215. package/src/plugins/components/PluginLoadingState.tsx +10 -10
  216. package/src/plugins/components/index.ts +1 -1
  217. package/src/plugins/generative-ui/catalog.ts +54 -54
  218. package/src/plugins/generative-ui/component.tsx +85 -85
  219. package/src/plugins/generative-ui/index.ts +4 -4
  220. package/src/plugins/generative-ui/ui/accordion-wrapper.tsx +16 -16
  221. package/src/plugins/generative-ui/ui/accordion.tsx +16 -16
  222. package/src/plugins/generative-ui/ui/action-button.tsx +28 -28
  223. package/src/plugins/generative-ui/ui/alert-wrapper.tsx +8 -8
  224. package/src/plugins/generative-ui/ui/alert.tsx +20 -20
  225. package/src/plugins/generative-ui/ui/avatar-wrapper.tsx +7 -7
  226. package/src/plugins/generative-ui/ui/avatar.tsx +30 -30
  227. package/src/plugins/generative-ui/ui/badge.tsx +22 -22
  228. package/src/plugins/generative-ui/ui/button-wrapper.tsx +12 -12
  229. package/src/plugins/generative-ui/ui/button.tsx +28 -28
  230. package/src/plugins/generative-ui/ui/card-wrapper.tsx +8 -8
  231. package/src/plugins/generative-ui/ui/card.tsx +27 -27
  232. package/src/plugins/generative-ui/ui/checkbox-wrapper.tsx +9 -9
  233. package/src/plugins/generative-ui/ui/checkbox.tsx +9 -9
  234. package/src/plugins/generative-ui/ui/data-table.tsx +8 -8
  235. package/src/plugins/generative-ui/ui/dialog.tsx +31 -31
  236. package/src/plugins/generative-ui/ui/dropdown-menu.tsx +44 -44
  237. package/src/plugins/generative-ui/ui/grid.tsx +12 -12
  238. package/src/plugins/generative-ui/ui/index.ts +40 -40
  239. package/src/plugins/generative-ui/ui/input-wrapper.tsx +11 -11
  240. package/src/plugins/generative-ui/ui/input.tsx +9 -9
  241. package/src/plugins/generative-ui/ui/label.tsx +8 -8
  242. package/src/plugins/generative-ui/ui/list.tsx +11 -11
  243. package/src/plugins/generative-ui/ui/metric.tsx +23 -23
  244. package/src/plugins/generative-ui/ui/pagination.tsx +28 -28
  245. package/src/plugins/generative-ui/ui/popover.tsx +21 -21
  246. package/src/plugins/generative-ui/ui/progress.tsx +13 -13
  247. package/src/plugins/generative-ui/ui/radio-group.tsx +12 -12
  248. package/src/plugins/generative-ui/ui/select-wrapper.tsx +7 -7
  249. package/src/plugins/generative-ui/ui/select.tsx +37 -37
  250. package/src/plugins/generative-ui/ui/separator.tsx +9 -9
  251. package/src/plugins/generative-ui/ui/skeleton-wrapper.tsx +10 -10
  252. package/src/plugins/generative-ui/ui/skeleton.tsx +5 -5
  253. package/src/plugins/generative-ui/ui/stack.tsx +28 -28
  254. package/src/plugins/generative-ui/ui/switch.tsx +11 -11
  255. package/src/plugins/generative-ui/ui/table.tsx +32 -32
  256. package/src/plugins/generative-ui/ui/tabs-wrapper.tsx +11 -11
  257. package/src/plugins/generative-ui/ui/tabs.tsx +26 -26
  258. package/src/plugins/generative-ui/ui/text.tsx +12 -12
  259. package/src/plugins/generative-ui/ui/textarea.tsx +7 -7
  260. package/src/plugins/generative-ui/ui/tooltip.tsx +12 -12
  261. package/src/plugins/index.ts +7 -7
  262. package/src/react-shim.ts +6 -6
  263. package/src/server/bun.ts +12 -12
  264. package/src/server/core.ts +25 -25
  265. package/src/server/express.ts +17 -15
  266. package/src/server/fastify.ts +14 -14
  267. package/src/server/hono.ts +9 -9
  268. package/src/server/nextjs.ts +12 -12
  269. package/src/server/tanstack-start.ts +12 -12
  270. package/src/server.ts +27 -27
  271. package/src/storybook.d.ts +4 -4
  272. package/src/types/index.ts +122 -122
  273. package/src/types/plugins.ts +7 -7
  274. package/src/vite-env.d.ts +12 -12
  275. package/dist/compat-shims-BPJ7Q68c.js.map +0 -1
  276. package/dist/index-D0bAYNQy.js.map +0 -1
  277. package/dist/index-KSX4Qjip.cjs.map +0 -1
@@ -1,32 +1,32 @@
1
- import { MODELS } from '@/lib/models'
2
- import type { FrontendTool } from '@/lib/tools'
1
+ import { MODELS } from "@/lib/models";
2
+ import type { FrontendTool } from "@/lib/tools";
3
3
  import {
4
4
  ImageMessagePartComponent,
5
5
  ReasoningGroupComponent,
6
6
  ReasoningMessagePartComponent,
7
7
  TextMessagePartComponent,
8
8
  ToolCallMessagePartComponent,
9
- } from '@assistant-ui/react'
10
- import { LanguageModel } from 'ai'
9
+ } from "@assistant-ui/react";
10
+ import { LanguageModel } from "ai";
11
11
  import {
12
12
  ComponentType,
13
13
  Dispatch,
14
14
  PropsWithChildren,
15
15
  SetStateAction,
16
16
  type ReactNode,
17
- } from 'react'
18
- import type { Plugin } from './plugins'
17
+ } from "react";
18
+ import type { Plugin } from "./plugins";
19
19
 
20
20
  /**
21
21
  * Function to retrieve the session token from the backend endpoint.
22
22
  * Override this if you have mounted your session endpoint at a different path.
23
23
  */
24
- export type GetSessionFn = (init: { projectSlug: string }) => Promise<string>
24
+ export type GetSessionFn = (init: { projectSlug: string }) => Promise<string>;
25
25
 
26
- type ServerUrl = string
26
+ type ServerUrl = string;
27
27
 
28
- export const VARIANTS = ['widget', 'sidecar', 'standalone'] as const
29
- export type Variant = (typeof VARIANTS)[number]
28
+ export const VARIANTS = ["widget", "sidecar", "standalone"] as const;
29
+ export type Variant = (typeof VARIANTS)[number];
30
30
 
31
31
  /**
32
32
  * The top level configuration object for the Elements library.
@@ -42,14 +42,14 @@ export interface ElementsConfig {
42
42
  /**
43
43
  * The system prompt to use for the Elements library.
44
44
  */
45
- systemPrompt?: string
45
+ systemPrompt?: string;
46
46
 
47
47
  /**
48
48
  * Any plugins to use for the Elements library.
49
49
  *
50
50
  * @default import { recommended } from '@gram-ai/elements/plugins'
51
51
  */
52
- plugins?: Plugin[]
52
+ plugins?: Plugin[];
53
53
 
54
54
  /**
55
55
  * Override the default components used by the Elements library.
@@ -76,7 +76,7 @@ export interface ElementsConfig {
76
76
  * },
77
77
  * }
78
78
  */
79
- components?: ComponentOverrides
79
+ components?: ComponentOverrides;
80
80
 
81
81
  /**
82
82
  * The project slug to use for the Elements library.
@@ -88,7 +88,7 @@ export interface ElementsConfig {
88
88
  * projectSlug: 'your-project-slug',
89
89
  * }
90
90
  */
91
- projectSlug: string
91
+ projectSlug: string;
92
92
 
93
93
  /**
94
94
  * The Gram Server URL to use for the Elements library.
@@ -101,7 +101,7 @@ export interface ElementsConfig {
101
101
  * mcp: 'https://app.getgram.ai/mcp/your-mcp-slug',
102
102
  * }
103
103
  */
104
- mcp?: ServerUrl
104
+ mcp?: ServerUrl;
105
105
 
106
106
  /**
107
107
  * Custom environment variable overrides for the Elements library.
@@ -109,14 +109,14 @@ export interface ElementsConfig {
109
109
  *
110
110
  * For more documentation on passing through different kinds of environment variables, including bearer tokens, see the [Gram documentation](https://www.speakeasy.com/docs/gram/host-mcp/public-private-servers#pass-through-authentication).
111
111
  */
112
- environment?: Record<string, unknown>
112
+ environment?: Record<string, unknown>;
113
113
 
114
114
  /**
115
115
  * The environment slug to use for resolving secrets.
116
116
  * When specified, this is sent as the Gram-Environment header to select
117
117
  * which environment's secrets to use for tool execution.
118
118
  */
119
- gramEnvironment?: string
119
+ gramEnvironment?: string;
120
120
 
121
121
  /**
122
122
  * The layout variant for the chat interface.
@@ -127,7 +127,7 @@ export interface ElementsConfig {
127
127
  *
128
128
  * @default 'widget'
129
129
  */
130
- variant?: Variant
130
+ variant?: Variant;
131
131
 
132
132
  /**
133
133
  * LLM model configuration.
@@ -140,7 +140,7 @@ export interface ElementsConfig {
140
140
  * },
141
141
  * }
142
142
  */
143
- model?: ModelConfig
143
+ model?: ModelConfig;
144
144
 
145
145
  /**
146
146
  * Visual appearance configuration options.
@@ -155,7 +155,7 @@ export interface ElementsConfig {
155
155
  * },
156
156
  * }
157
157
  */
158
- theme?: ThemeConfig
158
+ theme?: ThemeConfig;
159
159
 
160
160
  /**
161
161
  * The configuration for the welcome message and initial suggestions.
@@ -171,7 +171,7 @@ export interface ElementsConfig {
171
171
  * },
172
172
  * }
173
173
  */
174
- welcome?: WelcomeConfig
174
+ welcome?: WelcomeConfig;
175
175
 
176
176
  /**
177
177
  * The configuration for the composer.
@@ -183,7 +183,7 @@ export interface ElementsConfig {
183
183
  * },
184
184
  * }
185
185
  */
186
- composer?: ComposerConfig
186
+ composer?: ComposerConfig;
187
187
 
188
188
  /**
189
189
  * Optional property to override the LLM provider. If you override the model,
@@ -205,7 +205,7 @@ export interface ElementsConfig {
205
205
  * }
206
206
  * ```
207
207
  */
208
- languageModel?: LanguageModel
208
+ languageModel?: LanguageModel;
209
209
 
210
210
  /**
211
211
  * The configuration for the modal window.
@@ -227,7 +227,7 @@ export interface ElementsConfig {
227
227
  * },
228
228
  * }
229
229
  */
230
- modal?: ModalConfig
230
+ modal?: ModalConfig;
231
231
 
232
232
  /**
233
233
  * The configuration for the sidecar panel.
@@ -248,7 +248,7 @@ export interface ElementsConfig {
248
248
  * },
249
249
  * }
250
250
  */
251
- sidecar?: SidecarConfig
251
+ sidecar?: SidecarConfig;
252
252
 
253
253
  /**
254
254
  * The configuration for the tools.
@@ -266,7 +266,7 @@ export interface ElementsConfig {
266
266
  * },
267
267
  * }
268
268
  */
269
- tools?: ToolsConfig
269
+ tools?: ToolsConfig;
270
270
 
271
271
  /**
272
272
  * Configuration for chat history and thread persistence.
@@ -280,7 +280,7 @@ export interface ElementsConfig {
280
280
  * },
281
281
  * }
282
282
  */
283
- history?: HistoryConfig
283
+ history?: HistoryConfig;
284
284
 
285
285
  /**
286
286
  * The API configuration to use for the Elements library.
@@ -294,7 +294,7 @@ export interface ElementsConfig {
294
294
  * },
295
295
  * }
296
296
  */
297
- api?: ApiConfig
297
+ api?: ApiConfig;
298
298
 
299
299
  /**
300
300
  * Error tracking configuration.
@@ -307,7 +307,7 @@ export interface ElementsConfig {
307
307
  * },
308
308
  * }
309
309
  */
310
- errorTracking?: ErrorTrackingConfigOption
310
+ errorTracking?: ErrorTrackingConfigOption;
311
311
 
312
312
  /**
313
313
  * Configuration for the chat thread display and behavior.
@@ -320,7 +320,7 @@ export interface ElementsConfig {
320
320
  * },
321
321
  * }
322
322
  */
323
- thread?: ThreadConfig
323
+ thread?: ThreadConfig;
324
324
  }
325
325
 
326
326
  /**
@@ -331,7 +331,7 @@ export interface ErrorTrackingConfigOption {
331
331
  * Set to false to disable error reporting.
332
332
  * @default true
333
333
  */
334
- enabled?: boolean
334
+ enabled?: boolean;
335
335
  }
336
336
 
337
337
  /**
@@ -348,7 +348,7 @@ export type BaseApiConfig = {
348
348
  * },
349
349
  * }
350
350
  */
351
- url?: string
351
+ url?: string;
352
352
 
353
353
  /**
354
354
  * Additional headers to send with the API request.
@@ -360,8 +360,8 @@ export type BaseApiConfig = {
360
360
  * },
361
361
  * }
362
362
  */
363
- headers?: Record<string, string>
364
- }
363
+ headers?: Record<string, string>;
364
+ };
365
365
 
366
366
  /**
367
367
  * @deprecated Use `{ session: mySessionFn }` instead. Will be removed in a future major version.
@@ -382,8 +382,8 @@ export type SessionAuthConfig = {
382
382
  * },
383
383
  * }
384
384
  */
385
- sessionFn: GetSessionFn
386
- }
385
+ sessionFn: GetSessionFn;
386
+ };
387
387
 
388
388
  /**
389
389
  * @deprecated Use `{ session: 'your-token' }` instead. Will be removed in a future major version.
@@ -401,18 +401,18 @@ export type StaticSessionAuthConfig = {
401
401
  * },
402
402
  * }
403
403
  */
404
- sessionToken: string
405
- }
404
+ sessionToken: string;
405
+ };
406
406
 
407
407
  export type DangerousApiKeyAuthConfig = {
408
408
  /** WARNING: Exposes API key in browser. Dev/testing only. */
409
- dangerousApiKey: string
410
- }
409
+ dangerousApiKey: string;
410
+ };
411
411
 
412
412
  export type UnifiedSessionAuthConfig = {
413
413
  /** String = static token (shows expiry warning). Function = dynamic fetcher. */
414
- session: string | GetSessionFn
415
- }
414
+ session: string | GetSessionFn;
415
+ };
416
416
 
417
417
  /**
418
418
  * API configuration - base URL, session auth (static token or fetcher function),
@@ -426,7 +426,7 @@ export type ApiConfig =
426
426
  | (BaseApiConfig & UnifiedSessionAuthConfig)
427
427
  | (BaseApiConfig & DangerousApiKeyAuthConfig)
428
428
  | (BaseApiConfig & SessionAuthConfig)
429
- | (BaseApiConfig & StaticSessionAuthConfig)
429
+ | (BaseApiConfig & StaticSessionAuthConfig);
430
430
 
431
431
  /**
432
432
  * The LLM model to use for the Elements library.
@@ -438,7 +438,7 @@ export type ApiConfig =
438
438
  * },
439
439
  * }
440
440
  */
441
- export type Model = (typeof MODELS)[number]
441
+ export type Model = (typeof MODELS)[number];
442
442
 
443
443
  /**
444
444
  * ModelConfig is used to configure model support in the Elements library.
@@ -448,21 +448,21 @@ export interface ModelConfig {
448
448
  /**
449
449
  * Whether to show the model picker in the composer.
450
450
  */
451
- showModelPicker?: boolean
451
+ showModelPicker?: boolean;
452
452
 
453
453
  /**
454
454
  * The default model to use for the Elements library.
455
455
  */
456
- defaultModel?: Model
456
+ defaultModel?: Model;
457
457
  }
458
458
 
459
- export const DENSITIES = ['compact', 'normal', 'spacious'] as const
460
- export type Density = (typeof DENSITIES)[number]
461
- export const COLOR_SCHEMES = ['light', 'dark', 'system'] as const
462
- export type ColorScheme = (typeof COLOR_SCHEMES)[number]
459
+ export const DENSITIES = ["compact", "normal", "spacious"] as const;
460
+ export type Density = (typeof DENSITIES)[number];
461
+ export const COLOR_SCHEMES = ["light", "dark", "system"] as const;
462
+ export type ColorScheme = (typeof COLOR_SCHEMES)[number];
463
463
 
464
- export const RADII = ['round', 'soft', 'sharp'] as const
465
- export type Radius = (typeof RADII)[number]
464
+ export const RADII = ["round", "soft", "sharp"] as const;
465
+ export type Radius = (typeof RADII)[number];
466
466
 
467
467
  /**
468
468
  * ThemeConfig provides visual appearance customization options.
@@ -482,7 +482,7 @@ export interface ThemeConfig {
482
482
  * The color scheme to use for the UI.
483
483
  * @default 'light'
484
484
  */
485
- colorScheme?: ColorScheme
485
+ colorScheme?: ColorScheme;
486
486
 
487
487
  /**
488
488
  * Determines the overall spacing of the UI.
@@ -491,7 +491,7 @@ export interface ThemeConfig {
491
491
  * - `spacious`: Increased padding and margins for airy layouts
492
492
  * @default 'normal'
493
493
  */
494
- density?: Density
494
+ density?: Density;
495
495
 
496
496
  /**
497
497
  * Determines the overall roundness of the UI.
@@ -500,69 +500,69 @@ export interface ThemeConfig {
500
500
  * - `sharp`: Minimal border radius
501
501
  * @default 'soft'
502
502
  */
503
- radius?: Radius
503
+ radius?: Radius;
504
504
  }
505
505
 
506
506
  export interface ComponentOverrides {
507
507
  /**
508
508
  * The component to use for the composer (the input area where users type messages)
509
509
  */
510
- Composer?: ComponentType
510
+ Composer?: ComponentType;
511
511
  /**
512
512
  * The component to use for the user message.
513
513
  */
514
- UserMessage?: ComponentType
514
+ UserMessage?: ComponentType;
515
515
  /**
516
516
  * The component to use for the edit composer (inline message editor)
517
517
  */
518
- EditComposer?: ComponentType
518
+ EditComposer?: ComponentType;
519
519
  /**
520
520
  * The component to use for the assistant message (messages generated by the LLM).
521
521
  *
522
522
  * Note: if you override this, the Text component will not be used.
523
523
  */
524
- AssistantMessage?: ComponentType
524
+ AssistantMessage?: ComponentType;
525
525
  /**
526
526
  * The component to use for the thread welcome.
527
527
  */
528
- ThreadWelcome?: ComponentType
528
+ ThreadWelcome?: ComponentType;
529
529
 
530
530
  // MessagePrimitive.Parts components
531
531
  /**
532
532
  * The component to use for the text message.
533
533
  */
534
- Text?: TextMessagePartComponent
534
+ Text?: TextMessagePartComponent;
535
535
  /**
536
536
  * The component to use for the image message.
537
537
  */
538
- Image?: ImageMessagePartComponent
538
+ Image?: ImageMessagePartComponent;
539
539
  /**
540
540
  * The component to use for the tool fallback (default UI shown when a tool returns a result).
541
541
  */
542
- ToolFallback?: ToolCallMessagePartComponent
542
+ ToolFallback?: ToolCallMessagePartComponent;
543
543
  /**
544
544
  * The component to use for the reasoning message.
545
545
  */
546
- Reasoning?: ReasoningMessagePartComponent
546
+ Reasoning?: ReasoningMessagePartComponent;
547
547
  /**
548
548
  * The component to use for the reasoning group.
549
549
  */
550
- ReasoningGroup?: ReasoningGroupComponent
550
+ ReasoningGroup?: ReasoningGroupComponent;
551
551
 
552
552
  /**
553
553
  * The component to use for the tool group (a group of tool calls returned by the LLM in a single message).
554
554
  */
555
555
  ToolGroup?: ComponentType<
556
556
  PropsWithChildren<{ startIndex: number; endIndex: number }>
557
- >
557
+ >;
558
558
  }
559
559
 
560
560
  export type ToolsFilter =
561
561
  | string[]
562
- | (({ toolName }: { toolName: string }) => boolean)
562
+ | (({ toolName }: { toolName: string }) => boolean);
563
563
 
564
564
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
565
- export type FrontendTools = Record<string, FrontendTool<any, any>>
565
+ export type FrontendTools = Record<string, FrontendTool<any, any>>;
566
566
 
567
567
  /**
568
568
  * ToolsConfig is used to configure tool support in the Elements library.
@@ -583,7 +583,7 @@ export interface ToolsConfig {
583
583
  * Whether individual tool calls within a group should be expanded by default.
584
584
  * @default false
585
585
  */
586
- expandToolGroupsByDefault?: boolean
586
+ expandToolGroupsByDefault?: boolean;
587
587
 
588
588
  /**
589
589
  * `components` can be used to override the default components used by the
@@ -602,7 +602,7 @@ export interface ToolsConfig {
602
602
  */
603
603
  components?:
604
604
  | Record<string, ToolCallMessagePartComponent | undefined>
605
- | undefined
605
+ | undefined;
606
606
 
607
607
  /**
608
608
  * The frontend tools to use for the Elements library.
@@ -653,7 +653,7 @@ export interface ToolsConfig {
653
653
  * }
654
654
  * ```
655
655
  */
656
- frontendTools?: FrontendTools
656
+ frontendTools?: FrontendTools;
657
657
 
658
658
  /**
659
659
  * List of tool names that require confirmation from the end user before
@@ -677,7 +677,7 @@ export interface ToolsConfig {
677
677
  * }
678
678
  * ```
679
679
  */
680
- toolsRequiringApproval?: ToolsFilter
680
+ toolsRequiringApproval?: ToolsFilter;
681
681
 
682
682
  /**
683
683
  * List of MCP tool names to expose to the chat.
@@ -689,91 +689,91 @@ export interface ToolsConfig {
689
689
  * toolsToInclude: ['get_current_weather', 'get_current_time'],
690
690
  * }
691
691
  */
692
- toolsToInclude?: ToolsFilter
692
+ toolsToInclude?: ToolsFilter;
693
693
  }
694
694
 
695
695
  export interface WelcomeConfig {
696
696
  /**
697
697
  * The welcome message to display when the thread is empty.
698
698
  */
699
- title?: string
699
+ title?: string;
700
700
 
701
701
  /**
702
702
  * The subtitle to display when the thread is empty.
703
703
  */
704
- subtitle?: string
704
+ subtitle?: string;
705
705
 
706
706
  /**
707
707
  * The suggestions to display when the thread is empty.
708
708
  */
709
- suggestions?: Suggestion[]
709
+ suggestions?: Suggestion[];
710
710
  }
711
711
 
712
712
  export interface Suggestion {
713
713
  /** Suggestion heading */
714
- title: string
714
+ title: string;
715
715
  /** Suggestion subheading */
716
- label: string
716
+ label: string;
717
717
  /** The prompt sent when the suggestion is clicked */
718
- prompt: string
718
+ prompt: string;
719
719
  }
720
720
 
721
721
  export interface Dimensions {
722
- default: Dimension
722
+ default: Dimension;
723
723
  expanded?: {
724
- width: number | string
725
- height: number | string
726
- }
724
+ width: number | string;
725
+ height: number | string;
726
+ };
727
727
  }
728
728
 
729
729
  export interface Dimension {
730
- width: number | string
731
- height: number | string
732
- maxHeight?: number | string
730
+ width: number | string;
731
+ height: number | string;
732
+ maxHeight?: number | string;
733
733
  }
734
734
 
735
735
  interface ExpandableConfig {
736
736
  /**
737
737
  * Whether the modal or sidecar can be expanded
738
738
  */
739
- expandable?: boolean
739
+ expandable?: boolean;
740
740
 
741
741
  /**
742
742
  * Whether the modal or sidecar should be expanded by default.
743
743
  * @default false
744
744
  */
745
- defaultExpanded?: boolean
745
+ defaultExpanded?: boolean;
746
746
 
747
747
  /**
748
748
  * The dimensions for the modal or sidecar window.
749
749
  */
750
- dimensions?: Dimensions
750
+ dimensions?: Dimensions;
751
751
  }
752
752
 
753
753
  export type ModalTriggerPosition =
754
- | 'bottom-right'
755
- | 'bottom-left'
756
- | 'top-right'
757
- | 'top-left'
754
+ | "bottom-right"
755
+ | "bottom-left"
756
+ | "top-right"
757
+ | "top-left";
758
758
 
759
759
  export interface ModalConfig extends ExpandableConfig {
760
760
  /**
761
761
  * Whether to open the modal window by default.
762
762
  */
763
- defaultOpen?: boolean
763
+ defaultOpen?: boolean;
764
764
 
765
765
  /**
766
766
  * The title displayed in the modal header.
767
767
  * @default 'Chat'
768
768
  */
769
- title?: string
769
+ title?: string;
770
770
 
771
771
  /**
772
772
  * The position of the modal trigger
773
773
  *
774
774
  * @default 'bottom-right'
775
775
  */
776
- position?: ModalTriggerPosition
776
+ position?: ModalTriggerPosition;
777
777
 
778
778
  /**
779
779
  * The icon to use for the modal window.
@@ -795,7 +795,7 @@ export interface ModalConfig extends ExpandableConfig {
795
795
  * }
796
796
  * ```
797
797
  */
798
- icon?: (state: 'open' | 'closed' | undefined) => ReactNode
798
+ icon?: (state: "open" | "closed" | undefined) => ReactNode;
799
799
  }
800
800
 
801
801
  export interface ComposerConfig {
@@ -803,7 +803,7 @@ export interface ComposerConfig {
803
803
  * The placeholder text for the composer input.
804
804
  * @default 'Send a message...'
805
805
  */
806
- placeholder?: string
806
+ placeholder?: string;
807
807
 
808
808
  /**
809
809
  * Configuration for file attachments in the composer.
@@ -812,14 +812,14 @@ export interface ComposerConfig {
812
812
  * Or provide an object for fine-grained control.
813
813
  * @default true
814
814
  */
815
- attachments?: boolean | AttachmentsConfig
815
+ attachments?: boolean | AttachmentsConfig;
816
816
 
817
817
  /**
818
818
  * Configuration for @tool mentions in the composer.
819
819
  * Set to `false` to disable, `true` for defaults, or an object for fine-grained control.
820
820
  * @default true
821
821
  */
822
- toolMentions?: boolean | ToolMentionsConfig
822
+ toolMentions?: boolean | ToolMentionsConfig;
823
823
  }
824
824
 
825
825
  /**
@@ -832,27 +832,27 @@ export interface AttachmentsConfig {
832
832
  * Accepted file types. Can be MIME types or file extensions.
833
833
  * @example ['image/*', '.pdf', '.docx']
834
834
  */
835
- accept?: string[]
835
+ accept?: string[];
836
836
 
837
837
  /**
838
838
  * Maximum number of files that can be attached at once.
839
839
  * @default 10
840
840
  */
841
- maxCount?: number
841
+ maxCount?: number;
842
842
 
843
843
  /**
844
844
  * Maximum file size in bytes.
845
845
  * @default 104857600 (100MB)
846
846
  */
847
- maxSize?: number
847
+ maxSize?: number;
848
848
  }
849
849
 
850
850
  export interface ToolMentionsConfig {
851
851
  /** @default true */
852
- enabled?: boolean
852
+ enabled?: boolean;
853
853
  /** @default 10 */
854
- maxSuggestions?: number
855
- placeholder?: string
854
+ maxSuggestions?: number;
855
+ placeholder?: string;
856
856
  }
857
857
 
858
858
  export interface SidecarConfig extends ExpandableConfig {
@@ -860,7 +860,7 @@ export interface SidecarConfig extends ExpandableConfig {
860
860
  * The title displayed in the sidecar header.
861
861
  * @default 'Chat'
862
862
  */
863
- title?: string
863
+ title?: string;
864
864
  }
865
865
 
866
866
  /**
@@ -880,14 +880,14 @@ export interface ThreadConfig {
880
880
  * When enabled, users can mark conversations as resolved or provide feedback.
881
881
  * @default true
882
882
  */
883
- showFeedback?: boolean
883
+ showFeedback?: boolean;
884
884
 
885
885
  /**
886
886
  * Whether to show AI-generated follow-up question suggestions after each assistant response.
887
887
  * When enabled, suggestions appear below the assistant's message to help guide the conversation.
888
888
  * @default true
889
889
  */
890
- followUpSuggestions?: boolean
890
+ followUpSuggestions?: boolean;
891
891
  }
892
892
 
893
893
  /**
@@ -908,7 +908,7 @@ export interface HistoryConfig {
908
908
  * When true, threads will be saved and can be loaded from the thread list.
909
909
  * @default false
910
910
  */
911
- enabled: boolean
911
+ enabled: boolean;
912
912
 
913
913
  /**
914
914
  * Whether to show the thread list sidebar/panel.
@@ -916,7 +916,7 @@ export interface HistoryConfig {
916
916
  * Only applies when history is enabled.
917
917
  * @default true when history.enabled is true
918
918
  */
919
- showThreadList?: boolean
919
+ showThreadList?: boolean;
920
920
 
921
921
  /**
922
922
  * Initial thread ID to load when the component mounts.
@@ -935,20 +935,20 @@ export interface HistoryConfig {
935
935
  * },
936
936
  * }}>
937
937
  */
938
- initialThreadId?: string
938
+ initialThreadId?: string;
939
939
  }
940
940
 
941
941
  /**
942
942
  * @internal
943
943
  */
944
944
  export type ElementsContextType = {
945
- config: ElementsConfig
946
- setModel: (model: Model) => void
947
- model: Model
948
- isExpanded: boolean
949
- setIsExpanded: Dispatch<SetStateAction<boolean>>
950
- isOpen: boolean
951
- setIsOpen: (isOpen: boolean) => void
952
- plugins: Plugin[]
953
- mcpTools: Record<string, unknown> | undefined
954
- }
945
+ config: ElementsConfig;
946
+ setModel: (model: Model) => void;
947
+ model: Model;
948
+ isExpanded: boolean;
949
+ setIsExpanded: Dispatch<SetStateAction<boolean>>;
950
+ isOpen: boolean;
951
+ setIsOpen: (isOpen: boolean) => void;
952
+ plugins: Plugin[];
953
+ mcpTools: Record<string, unknown> | undefined;
954
+ };