@gram-ai/elements 1.34.0 → 1.36.0

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 (238) hide show
  1. package/dist/compat-shims-CO9JXXV4.cjs.map +1 -1
  2. package/dist/compat-shims-DxtUrORi.js.map +1 -1
  3. package/dist/compat-shims.d.ts +9 -8
  4. package/dist/components/Chat/index.d.ts +2 -1
  5. package/dist/components/ChatHistory.d.ts +1 -1
  6. package/dist/components/FrontendTools/index.d.ts +1 -1
  7. package/dist/components/Replay.d.ts +1 -1
  8. package/dist/components/Replay.stories.d.ts +2 -2
  9. package/dist/components/ShadowRoot.d.ts +1 -1
  10. package/dist/components/ShareButton/index.d.ts +1 -1
  11. package/dist/components/assistant-ui/thinking-indicator.d.ts +8 -0
  12. package/dist/components/ui/avatar.d.ts +3 -3
  13. package/dist/components/ui/button.d.ts +2 -2
  14. package/dist/components/ui/buttonVariants.d.ts +2 -2
  15. package/dist/components/ui/calendar.d.ts +2 -1
  16. package/dist/components/ui/collapsible.d.ts +3 -3
  17. package/dist/components/ui/dialog.d.ts +10 -10
  18. package/dist/components/ui/popover.d.ts +4 -4
  19. package/dist/components/ui/skeleton.d.ts +1 -1
  20. package/dist/components/ui/time-range-picker.d.ts +2 -1
  21. package/dist/components/ui/tool-ui.d.ts +9 -7
  22. package/dist/components/ui/tooltip.d.ts +4 -4
  23. package/dist/contexts/ConnectionStatusContext.d.ts +1 -1
  24. package/dist/contexts/ElementsProvider.d.ts +1 -1
  25. package/dist/contexts/ToolApprovalContext.d.ts +2 -2
  26. package/dist/contexts/ToolExecutionContext.d.ts +1 -1
  27. package/dist/contexts/portal-container.d.ts +1 -1
  28. package/dist/elements.cjs +1 -1
  29. package/dist/elements.css +1 -1
  30. package/dist/elements.js +2 -2
  31. package/dist/hooks/useDensity.d.ts +1 -1
  32. package/dist/hooks/useElements.d.ts +2 -1
  33. package/dist/hooks/useGramThreadListAdapter.d.ts +13 -0
  34. package/dist/hooks/useRadius.d.ts +1 -1
  35. package/dist/hooks/useThemeProps.d.ts +1 -1
  36. package/dist/hooks/useToolApproval.d.ts +2 -1
  37. package/dist/index-7fTI_vaV.cjs +194 -0
  38. package/dist/index-7fTI_vaV.cjs.map +1 -0
  39. package/dist/{index-B5lZrrO2.js → index-Bv-yE4G1.js} +2919 -2806
  40. package/dist/index-Bv-yE4G1.js.map +1 -0
  41. package/dist/{index-BFU6NvbL.js → index-BziIHO9O.js} +9621 -9308
  42. package/dist/index-BziIHO9O.js.map +1 -0
  43. package/dist/{index-C08dvTEo.cjs → index-CGBkMd0d.cjs} +48 -48
  44. package/dist/index-CGBkMd0d.cjs.map +1 -0
  45. package/dist/lib/errorTracking.d.ts +1 -1
  46. package/dist/lib/tools.d.ts +11 -10
  47. package/dist/plugins/generative-ui/catalog.d.ts +3 -3
  48. package/dist/plugins/generative-ui/ui/accordion-wrapper.d.ts +2 -2
  49. package/dist/plugins/generative-ui/ui/accordion.d.ts +4 -4
  50. package/dist/plugins/generative-ui/ui/action-button.d.ts +1 -1
  51. package/dist/plugins/generative-ui/ui/alert-wrapper.d.ts +2 -1
  52. package/dist/plugins/generative-ui/ui/alert.d.ts +3 -3
  53. package/dist/plugins/generative-ui/ui/avatar-wrapper.d.ts +2 -1
  54. package/dist/plugins/generative-ui/ui/avatar.d.ts +6 -6
  55. package/dist/plugins/generative-ui/ui/badge.d.ts +2 -2
  56. package/dist/plugins/generative-ui/ui/button-wrapper.d.ts +2 -1
  57. package/dist/plugins/generative-ui/ui/button.d.ts +3 -3
  58. package/dist/plugins/generative-ui/ui/card-wrapper.d.ts +1 -1
  59. package/dist/plugins/generative-ui/ui/card.d.ts +7 -7
  60. package/dist/plugins/generative-ui/ui/checkbox-wrapper.d.ts +2 -1
  61. package/dist/plugins/generative-ui/ui/checkbox.d.ts +1 -1
  62. package/dist/plugins/generative-ui/ui/data-table.d.ts +1 -1
  63. package/dist/plugins/generative-ui/ui/dialog.d.ts +10 -10
  64. package/dist/plugins/generative-ui/ui/dropdown-menu.d.ts +15 -15
  65. package/dist/plugins/generative-ui/ui/grid.d.ts +1 -1
  66. package/dist/plugins/generative-ui/ui/index.d.ts +57 -40
  67. package/dist/plugins/generative-ui/ui/input-wrapper.d.ts +2 -1
  68. package/dist/plugins/generative-ui/ui/input.d.ts +1 -1
  69. package/dist/plugins/generative-ui/ui/label.d.ts +1 -1
  70. package/dist/plugins/generative-ui/ui/list.d.ts +2 -1
  71. package/dist/plugins/generative-ui/ui/metric.d.ts +1 -1
  72. package/dist/plugins/generative-ui/ui/pagination.d.ts +7 -7
  73. package/dist/plugins/generative-ui/ui/popover.d.ts +7 -7
  74. package/dist/plugins/generative-ui/ui/progress.d.ts +1 -1
  75. package/dist/plugins/generative-ui/ui/radio-group.d.ts +2 -2
  76. package/dist/plugins/generative-ui/ui/select-wrapper.d.ts +2 -1
  77. package/dist/plugins/generative-ui/ui/select.d.ts +10 -10
  78. package/dist/plugins/generative-ui/ui/separator.d.ts +1 -1
  79. package/dist/plugins/generative-ui/ui/skeleton-wrapper.d.ts +2 -1
  80. package/dist/plugins/generative-ui/ui/skeleton.d.ts +1 -1
  81. package/dist/plugins/generative-ui/ui/stack.d.ts +1 -1
  82. package/dist/plugins/generative-ui/ui/switch.d.ts +1 -1
  83. package/dist/plugins/generative-ui/ui/table.d.ts +8 -8
  84. package/dist/plugins/generative-ui/ui/tabs-wrapper.d.ts +2 -2
  85. package/dist/plugins/generative-ui/ui/tabs.d.ts +4 -4
  86. package/dist/plugins/generative-ui/ui/text.d.ts +1 -1
  87. package/dist/plugins/generative-ui/ui/textarea.d.ts +1 -1
  88. package/dist/plugins/generative-ui/ui/tooltip.d.ts +4 -4
  89. package/dist/plugins.cjs +1 -1
  90. package/dist/plugins.js +1 -1
  91. package/dist/{profiler-BRnyr1GA.cjs → profiler-DuJEf_S6.cjs} +2 -2
  92. package/dist/{profiler-BRnyr1GA.cjs.map → profiler-DuJEf_S6.cjs.map} +1 -1
  93. package/dist/{profiler-KLSTpp6I.js → profiler-xLXOPfmj.js} +2 -2
  94. package/dist/{profiler-KLSTpp6I.js.map → profiler-xLXOPfmj.js.map} +1 -1
  95. package/dist/react-shim.cjs.map +1 -1
  96. package/dist/react-shim.d.ts +1 -1
  97. package/dist/react-shim.js +1 -4
  98. package/dist/react-shim.js.map +1 -1
  99. package/dist/server/bun.cjs.map +1 -1
  100. package/dist/server/bun.js.map +1 -1
  101. package/dist/server/express.cjs.map +1 -1
  102. package/dist/server/express.js.map +1 -1
  103. package/dist/server/fastify.cjs.map +1 -1
  104. package/dist/server/fastify.js.map +1 -1
  105. package/dist/server/hono.cjs.map +1 -1
  106. package/dist/server/hono.js.map +1 -1
  107. package/dist/server/nextjs.cjs.map +1 -1
  108. package/dist/server/nextjs.js.map +1 -1
  109. package/dist/server/tanstack-start.cjs.map +1 -1
  110. package/dist/server/tanstack-start.js.map +1 -1
  111. package/dist/{startRecording-CKx-YWbq.cjs → startRecording-C2XF9-Ol.cjs} +2 -2
  112. package/dist/{startRecording-CKx-YWbq.cjs.map → startRecording-C2XF9-Ol.cjs.map} +1 -1
  113. package/dist/{startRecording-BfxB1xxR.js → startRecording-qKnXr4lw.js} +2 -2
  114. package/dist/{startRecording-BfxB1xxR.js.map → startRecording-qKnXr4lw.js.map} +1 -1
  115. package/dist/types/index.d.ts +29 -3
  116. package/package.json +8 -11
  117. package/src/compat-shims.ts +16 -2
  118. package/src/components/Chat/index.tsx +4 -1
  119. package/src/components/Chat/stories/FrontendTools.stories.tsx +1 -1
  120. package/src/components/Chat/stories/ToolApproval.stories.tsx +2 -2
  121. package/src/components/Chat/stories/Tools.stories.tsx +13 -5
  122. package/src/components/ChatHistory.tsx +3 -1
  123. package/src/components/FrontendTools/index.tsx +1 -1
  124. package/src/components/MessageContent.tsx +1 -0
  125. package/src/components/Replay.stories.tsx +2 -3
  126. package/src/components/Replay.tsx +17 -10
  127. package/src/components/ShadowRoot.tsx +2 -2
  128. package/src/components/ShareButton/index.tsx +4 -2
  129. package/src/components/assistant-ui/assistant-modal.tsx +5 -3
  130. package/src/components/assistant-ui/attachment.tsx +1 -1
  131. package/src/components/assistant-ui/error-boundary.tsx +1 -1
  132. package/src/components/assistant-ui/markdown-text.tsx +1 -1
  133. package/src/components/assistant-ui/thinking-indicator.tsx +175 -0
  134. package/src/components/assistant-ui/thread.tsx +251 -27
  135. package/src/components/assistant-ui/tool-fallback.tsx +8 -8
  136. package/src/components/assistant-ui/tool-group.tsx +4 -13
  137. package/src/components/assistant-ui/tool-mention-autocomplete.tsx +1 -1
  138. package/src/components/ui/avatar.tsx +3 -3
  139. package/src/components/ui/calendar.tsx +1 -1
  140. package/src/components/ui/collapsible.tsx +7 -3
  141. package/src/components/ui/dialog.tsx +18 -10
  142. package/src/components/ui/generative-ui.tsx +9 -4
  143. package/src/components/ui/popover.tsx +4 -4
  144. package/src/components/ui/skeleton.tsx +4 -1
  145. package/src/components/ui/time-range-picker.stories.tsx +164 -154
  146. package/src/components/ui/time-range-picker.tsx +11 -5
  147. package/src/components/ui/tool-ui.tsx +68 -40
  148. package/src/components/ui/tooltip.tsx +4 -4
  149. package/src/contexts/ChatIdContext.tsx +1 -1
  150. package/src/contexts/ConnectionStatusContext.tsx +6 -5
  151. package/src/contexts/ElementsProvider.tsx +64 -41
  152. package/src/contexts/ReplayContext.ts +1 -1
  153. package/src/contexts/ToolApprovalContext.tsx +5 -1
  154. package/src/contexts/ToolExecutionContext.tsx +1 -1
  155. package/src/contexts/portal-container.tsx +1 -1
  156. package/src/global.css +55 -16
  157. package/src/hooks/useAuth.ts +2 -1
  158. package/src/hooks/useDensity.ts +1 -1
  159. package/src/hooks/useElements.ts +2 -1
  160. package/src/hooks/useFollowOnSuggestions.ts +3 -6
  161. package/src/hooks/useGramThreadListAdapter.tsx +50 -3
  162. package/src/hooks/useMCPTools.ts +2 -2
  163. package/src/hooks/useModel.ts +1 -3
  164. package/src/hooks/usePluginComponents.ts +3 -1
  165. package/src/hooks/useRadius.ts +1 -1
  166. package/src/hooks/useSession.ts +3 -1
  167. package/src/hooks/useThemeProps.ts +5 -5
  168. package/src/hooks/useToolApproval.ts +2 -1
  169. package/src/lib/cassette.ts +20 -8
  170. package/src/lib/errorTracking.ts +1 -4
  171. package/src/lib/messageConverter.test.ts +11 -13
  172. package/src/lib/messageConverter.ts +13 -4
  173. package/src/lib/token.ts +2 -5
  174. package/src/lib/tool-mentions.ts +5 -2
  175. package/src/lib/tools.byte-cap.test.ts +1 -1
  176. package/src/lib/tools.test.ts +1 -1
  177. package/src/lib/tools.ts +15 -5
  178. package/src/lib/utils.ts +2 -2
  179. package/src/lib.d.ts +8 -1
  180. package/src/plugins/chart/chart.test.ts +3 -4
  181. package/src/plugins/chart/component.tsx +7 -6
  182. package/src/plugins/chart/ui/area-chart.tsx +1 -1
  183. package/src/plugins/chart/ui/line-chart.tsx +1 -1
  184. package/src/plugins/generative-ui/ui/accordion-wrapper.tsx +2 -2
  185. package/src/plugins/generative-ui/ui/accordion.tsx +4 -4
  186. package/src/plugins/generative-ui/ui/action-button.tsx +4 -2
  187. package/src/plugins/generative-ui/ui/alert-wrapper.tsx +1 -1
  188. package/src/plugins/generative-ui/ui/alert.tsx +7 -3
  189. package/src/plugins/generative-ui/ui/avatar-wrapper.tsx +5 -1
  190. package/src/plugins/generative-ui/ui/avatar.tsx +12 -6
  191. package/src/plugins/generative-ui/ui/badge.tsx +1 -1
  192. package/src/plugins/generative-ui/ui/button-wrapper.tsx +1 -1
  193. package/src/plugins/generative-ui/ui/button.tsx +1 -1
  194. package/src/plugins/generative-ui/ui/card-wrapper.tsx +1 -1
  195. package/src/plugins/generative-ui/ui/card.tsx +28 -7
  196. package/src/plugins/generative-ui/ui/checkbox-wrapper.tsx +1 -1
  197. package/src/plugins/generative-ui/ui/checkbox.tsx +1 -1
  198. package/src/plugins/generative-ui/ui/data-table.tsx +1 -1
  199. package/src/plugins/generative-ui/ui/dialog.tsx +15 -10
  200. package/src/plugins/generative-ui/ui/dropdown-menu.tsx +33 -15
  201. package/src/plugins/generative-ui/ui/grid.tsx +1 -1
  202. package/src/plugins/generative-ui/ui/index.ts +154 -40
  203. package/src/plugins/generative-ui/ui/input-wrapper.tsx +1 -1
  204. package/src/plugins/generative-ui/ui/input.tsx +5 -1
  205. package/src/plugins/generative-ui/ui/label.tsx +1 -1
  206. package/src/plugins/generative-ui/ui/list.tsx +5 -1
  207. package/src/plugins/generative-ui/ui/metric.tsx +2 -1
  208. package/src/plugins/generative-ui/ui/pagination.tsx +12 -7
  209. package/src/plugins/generative-ui/ui/popover.tsx +13 -7
  210. package/src/plugins/generative-ui/ui/progress.tsx +1 -1
  211. package/src/plugins/generative-ui/ui/radio-group.tsx +2 -2
  212. package/src/plugins/generative-ui/ui/select-wrapper.tsx +1 -1
  213. package/src/plugins/generative-ui/ui/select.tsx +14 -10
  214. package/src/plugins/generative-ui/ui/separator.tsx +1 -1
  215. package/src/plugins/generative-ui/ui/skeleton-wrapper.tsx +1 -1
  216. package/src/plugins/generative-ui/ui/skeleton.tsx +4 -1
  217. package/src/plugins/generative-ui/ui/stack.tsx +1 -1
  218. package/src/plugins/generative-ui/ui/switch.tsx +1 -1
  219. package/src/plugins/generative-ui/ui/table.tsx +29 -8
  220. package/src/plugins/generative-ui/ui/tabs-wrapper.tsx +5 -2
  221. package/src/plugins/generative-ui/ui/tabs.tsx +4 -4
  222. package/src/plugins/generative-ui/ui/text.tsx +1 -1
  223. package/src/plugins/generative-ui/ui/textarea.tsx +4 -1
  224. package/src/plugins/generative-ui/ui/tooltip.tsx +4 -4
  225. package/src/react-shim.ts +9 -4
  226. package/src/server/bun.ts +1 -1
  227. package/src/server/express.ts +1 -1
  228. package/src/server/fastify.ts +1 -1
  229. package/src/server/hono.ts +1 -1
  230. package/src/server/nextjs.ts +1 -1
  231. package/src/server/tanstack-start.ts +1 -1
  232. package/src/storybook.d.ts +5 -0
  233. package/src/types/index.ts +39 -3
  234. package/dist/index-B5lZrrO2.js.map +0 -1
  235. package/dist/index-BFU6NvbL.js.map +0 -1
  236. package/dist/index-C08dvTEo.cjs.map +0 -1
  237. package/dist/index-DzZ1-jQY.cjs +0 -194
  238. package/dist/index-DzZ1-jQY.cjs.map +0 -1
@@ -7,13 +7,13 @@ import { cn } from "@/lib/utils";
7
7
 
8
8
  function Popover({
9
9
  ...props
10
- }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
10
+ }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element {
11
11
  return <PopoverPrimitive.Root data-slot="popover" {...props} />;
12
12
  }
13
13
 
14
14
  function PopoverTrigger({
15
15
  ...props
16
- }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
16
+ }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element {
17
17
  return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
18
18
  }
19
19
 
@@ -22,7 +22,7 @@ function PopoverContent({
22
22
  align = "center",
23
23
  sideOffset = 4,
24
24
  ...props
25
- }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
25
+ }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element {
26
26
  return (
27
27
  <PopoverPrimitive.Portal>
28
28
  <PopoverPrimitive.Content
@@ -41,11 +41,14 @@ function PopoverContent({
41
41
 
42
42
  function PopoverAnchor({
43
43
  ...props
44
- }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
44
+ }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element {
45
45
  return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
46
46
  }
47
47
 
48
- function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
48
+ function PopoverHeader({
49
+ className,
50
+ ...props
51
+ }: React.ComponentProps<"div">): React.JSX.Element {
49
52
  return (
50
53
  <div
51
54
  data-slot="popover-header"
@@ -55,7 +58,10 @@ function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
55
58
  );
56
59
  }
57
60
 
58
- function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
61
+ function PopoverTitle({
62
+ className,
63
+ ...props
64
+ }: React.ComponentProps<"h2">): React.JSX.Element {
59
65
  return (
60
66
  <div
61
67
  data-slot="popover-title"
@@ -68,7 +74,7 @@ function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
68
74
  function PopoverDescription({
69
75
  className,
70
76
  ...props
71
- }: React.ComponentProps<"p">) {
77
+ }: React.ComponentProps<"p">): React.JSX.Element {
72
78
  return (
73
79
  <p
74
80
  data-slot="popover-description"
@@ -21,7 +21,7 @@ function Progress({
21
21
  label,
22
22
  max = 100,
23
23
  ...props
24
- }: ProgressProps) {
24
+ }: ProgressProps): React.JSX.Element {
25
25
  const percentage =
26
26
  value != null && max > 0
27
27
  ? Math.min(100, Math.max(0, (value / max) * 100))
@@ -9,7 +9,7 @@ import { cn } from "@/lib/utils";
9
9
  function RadioGroup({
10
10
  className,
11
11
  ...props
12
- }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
12
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element {
13
13
  return (
14
14
  <RadioGroupPrimitive.Root
15
15
  data-slot="radio-group"
@@ -22,7 +22,7 @@ function RadioGroup({
22
22
  function RadioGroupItem({
23
23
  className,
24
24
  ...props
25
- }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
25
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element {
26
26
  return (
27
27
  <RadioGroupPrimitive.Item
28
28
  data-slot="radio-group-item"
@@ -23,7 +23,7 @@ export function SelectWrapper({
23
23
  placeholder,
24
24
  valuePath,
25
25
  options,
26
- }: SelectWrapperProps) {
26
+ }: SelectWrapperProps): React.JSX.Element {
27
27
  return (
28
28
  <Select name={valuePath}>
29
29
  <SelectTrigger data-value-path={valuePath}>
@@ -8,19 +8,19 @@ import { cn } from "@/lib/utils";
8
8
 
9
9
  function Select({
10
10
  ...props
11
- }: React.ComponentProps<typeof SelectPrimitive.Root>) {
11
+ }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element {
12
12
  return <SelectPrimitive.Root data-slot="select" {...props} />;
13
13
  }
14
14
 
15
15
  function SelectGroup({
16
16
  ...props
17
- }: React.ComponentProps<typeof SelectPrimitive.Group>) {
17
+ }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element {
18
18
  return <SelectPrimitive.Group data-slot="select-group" {...props} />;
19
19
  }
20
20
 
21
21
  function SelectValue({
22
22
  ...props
23
- }: React.ComponentProps<typeof SelectPrimitive.Value>) {
23
+ }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element {
24
24
  return <SelectPrimitive.Value data-slot="select-value" {...props} />;
25
25
  }
26
26
 
@@ -31,7 +31,7 @@ function SelectTrigger({
31
31
  ...props
32
32
  }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
33
33
  size?: "sm" | "default";
34
- }) {
34
+ }): React.JSX.Element {
35
35
  return (
36
36
  <SelectPrimitive.Trigger
37
37
  data-slot="select-trigger"
@@ -56,7 +56,7 @@ function SelectContent({
56
56
  position = "item-aligned",
57
57
  align = "center",
58
58
  ...props
59
- }: React.ComponentProps<typeof SelectPrimitive.Content>) {
59
+ }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element {
60
60
  return (
61
61
  <SelectPrimitive.Portal>
62
62
  <SelectPrimitive.Content
@@ -90,7 +90,7 @@ function SelectContent({
90
90
  function SelectLabel({
91
91
  className,
92
92
  ...props
93
- }: React.ComponentProps<typeof SelectPrimitive.Label>) {
93
+ }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element {
94
94
  return (
95
95
  <SelectPrimitive.Label
96
96
  data-slot="select-label"
@@ -104,7 +104,7 @@ function SelectItem({
104
104
  className,
105
105
  children,
106
106
  ...props
107
- }: React.ComponentProps<typeof SelectPrimitive.Item>) {
107
+ }: React.ComponentProps<typeof SelectPrimitive.Item>): React.JSX.Element {
108
108
  return (
109
109
  <SelectPrimitive.Item
110
110
  data-slot="select-item"
@@ -130,7 +130,7 @@ function SelectItem({
130
130
  function SelectSeparator({
131
131
  className,
132
132
  ...props
133
- }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
133
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>): React.JSX.Element {
134
134
  return (
135
135
  <SelectPrimitive.Separator
136
136
  data-slot="select-separator"
@@ -143,7 +143,9 @@ function SelectSeparator({
143
143
  function SelectScrollUpButton({
144
144
  className,
145
145
  ...props
146
- }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
146
+ }: React.ComponentProps<
147
+ typeof SelectPrimitive.ScrollUpButton
148
+ >): React.JSX.Element {
147
149
  return (
148
150
  <SelectPrimitive.ScrollUpButton
149
151
  data-slot="select-scroll-up-button"
@@ -161,7 +163,9 @@ function SelectScrollUpButton({
161
163
  function SelectScrollDownButton({
162
164
  className,
163
165
  ...props
164
- }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
166
+ }: React.ComponentProps<
167
+ typeof SelectPrimitive.ScrollDownButton
168
+ >): React.JSX.Element {
165
169
  return (
166
170
  <SelectPrimitive.ScrollDownButton
167
171
  data-slot="select-scroll-down-button"
@@ -10,7 +10,7 @@ function Separator({
10
10
  orientation = "horizontal",
11
11
  decorative = true,
12
12
  ...props
13
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>): React.JSX.Element {
14
14
  return (
15
15
  <SeparatorPrimitive.Root
16
16
  data-slot="separator"
@@ -17,7 +17,7 @@ export function SkeletonWrapper({
17
17
  width,
18
18
  height,
19
19
  className,
20
- }: SkeletonWrapperProps) {
20
+ }: SkeletonWrapperProps): React.JSX.Element {
21
21
  return (
22
22
  <Skeleton
23
23
  className={cn(className)}
@@ -1,6 +1,9 @@
1
1
  import { cn } from "@/lib/utils";
2
2
 
3
- function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }: React.ComponentProps<"div">): React.JSX.Element {
4
7
  return (
5
8
  <div
6
9
  data-slot="skeleton"
@@ -36,7 +36,7 @@ export function Stack({
36
36
  justify,
37
37
  className,
38
38
  ...props
39
- }: StackProps) {
39
+ }: StackProps): React.JSX.Element {
40
40
  return (
41
41
  <div
42
42
  data-slot="stack"
@@ -11,7 +11,7 @@ function Switch({
11
11
  ...props
12
12
  }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
13
13
  size?: "sm" | "default";
14
- }) {
14
+ }): React.JSX.Element {
15
15
  return (
16
16
  <SwitchPrimitive.Root
17
17
  data-slot="switch"
@@ -4,7 +4,10 @@ import * as React from "react";
4
4
 
5
5
  import { cn } from "@/lib/utils";
6
6
 
7
- function Table({ className, ...props }: React.ComponentProps<"table">) {
7
+ function Table({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<"table">): React.JSX.Element {
8
11
  return (
9
12
  <div
10
13
  data-slot="table-container"
@@ -19,7 +22,10 @@ function Table({ className, ...props }: React.ComponentProps<"table">) {
19
22
  );
20
23
  }
21
24
 
22
- function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
25
+ function TableHeader({
26
+ className,
27
+ ...props
28
+ }: React.ComponentProps<"thead">): React.JSX.Element {
23
29
  return (
24
30
  <thead
25
31
  data-slot="table-header"
@@ -29,7 +35,10 @@ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
29
35
  );
30
36
  }
31
37
 
32
- function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
38
+ function TableBody({
39
+ className,
40
+ ...props
41
+ }: React.ComponentProps<"tbody">): React.JSX.Element {
33
42
  return (
34
43
  <tbody
35
44
  data-slot="table-body"
@@ -39,7 +48,10 @@ function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
39
48
  );
40
49
  }
41
50
 
42
- function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
51
+ function TableFooter({
52
+ className,
53
+ ...props
54
+ }: React.ComponentProps<"tfoot">): React.JSX.Element {
43
55
  return (
44
56
  <tfoot
45
57
  data-slot="table-footer"
@@ -52,7 +64,10 @@ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
52
64
  );
53
65
  }
54
66
 
55
- function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
67
+ function TableRow({
68
+ className,
69
+ ...props
70
+ }: React.ComponentProps<"tr">): React.JSX.Element {
56
71
  return (
57
72
  <tr
58
73
  data-slot="table-row"
@@ -65,7 +80,10 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
65
80
  );
66
81
  }
67
82
 
68
- function TableHead({ className, ...props }: React.ComponentProps<"th">) {
83
+ function TableHead({
84
+ className,
85
+ ...props
86
+ }: React.ComponentProps<"th">): React.JSX.Element {
69
87
  return (
70
88
  <th
71
89
  data-slot="table-head"
@@ -78,7 +96,10 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
78
96
  );
79
97
  }
80
98
 
81
- function TableCell({ className, ...props }: React.ComponentProps<"td">) {
99
+ function TableCell({
100
+ className,
101
+ ...props
102
+ }: React.ComponentProps<"td">): React.JSX.Element {
82
103
  return (
83
104
  <td
84
105
  data-slot="table-cell"
@@ -94,7 +115,7 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
94
115
  function TableCaption({
95
116
  className,
96
117
  ...props
97
- }: React.ComponentProps<"caption">) {
118
+ }: React.ComponentProps<"caption">): React.JSX.Element {
98
119
  return (
99
120
  <caption
100
121
  data-slot="table-caption"
@@ -21,7 +21,7 @@ export function TabsWrapper({
21
21
  defaultValue,
22
22
  tabs,
23
23
  children,
24
- }: TabsWrapperProps) {
24
+ }: TabsWrapperProps): React.JSX.Element {
25
25
  const defaultTab = defaultValue ?? tabs[0]?.value;
26
26
 
27
27
  return (
@@ -46,6 +46,9 @@ export interface TabContentWrapperProps {
46
46
  /**
47
47
  * TabContent wrapper - passes through to TabsContent.
48
48
  */
49
- export function TabContentWrapper({ value, children }: TabContentWrapperProps) {
49
+ export function TabContentWrapper({
50
+ value,
51
+ children,
52
+ }: TabContentWrapperProps): React.JSX.Element {
50
53
  return <TabsContentPrimitive value={value}>{children}</TabsContentPrimitive>;
51
54
  }
@@ -10,7 +10,7 @@ function Tabs({
10
10
  className,
11
11
  orientation = "horizontal",
12
12
  ...props
13
- }: React.ComponentProps<typeof TabsPrimitive.Root>) {
13
+ }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element {
14
14
  return (
15
15
  <TabsPrimitive.Root
16
16
  data-slot="tabs"
@@ -45,7 +45,7 @@ function TabsList({
45
45
  variant = "default",
46
46
  ...props
47
47
  }: React.ComponentProps<typeof TabsPrimitive.List> &
48
- VariantProps<typeof tabsListVariants>) {
48
+ VariantProps<typeof tabsListVariants>): React.JSX.Element {
49
49
  return (
50
50
  <TabsPrimitive.List
51
51
  data-slot="tabs-list"
@@ -59,7 +59,7 @@ function TabsList({
59
59
  function TabsTrigger({
60
60
  className,
61
61
  ...props
62
- }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
62
+ }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element {
63
63
  return (
64
64
  <TabsPrimitive.Trigger
65
65
  data-slot="tabs-trigger"
@@ -78,7 +78,7 @@ function TabsTrigger({
78
78
  function TabsContent({
79
79
  className,
80
80
  ...props
81
- }: React.ComponentProps<typeof TabsPrimitive.Content>) {
81
+ }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element {
82
82
  return (
83
83
  <TabsPrimitive.Content
84
84
  data-slot="tabs-content"
@@ -20,7 +20,7 @@ export function Text({
20
20
  className,
21
21
  children,
22
22
  ...props
23
- }: TextProps) {
23
+ }: TextProps): React.JSX.Element {
24
24
  return (
25
25
  <span
26
26
  data-slot="text"
@@ -2,7 +2,10 @@ import * as React from "react";
2
2
 
3
3
  import { cn } from "@/lib/utils";
4
4
 
5
- function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
5
+ function Textarea({
6
+ className,
7
+ ...props
8
+ }: React.ComponentProps<"textarea">): React.JSX.Element {
6
9
  return (
7
10
  <textarea
8
11
  data-slot="textarea"
@@ -8,7 +8,7 @@ import { cn } from "@/lib/utils";
8
8
  function TooltipProvider({
9
9
  delayDuration = 0,
10
10
  ...props
11
- }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
11
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element {
12
12
  return (
13
13
  <TooltipPrimitive.Provider
14
14
  data-slot="tooltip-provider"
@@ -20,13 +20,13 @@ function TooltipProvider({
20
20
 
21
21
  function Tooltip({
22
22
  ...props
23
- }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
23
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element {
24
24
  return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
25
25
  }
26
26
 
27
27
  function TooltipTrigger({
28
28
  ...props
29
- }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
29
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element {
30
30
  return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
31
31
  }
32
32
 
@@ -35,7 +35,7 @@ function TooltipContent({
35
35
  sideOffset = 0,
36
36
  children,
37
37
  ...props
38
- }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
38
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element {
39
39
  return (
40
40
  <TooltipPrimitive.Portal>
41
41
  <TooltipPrimitive.Content
package/src/react-shim.ts CHANGED
@@ -10,10 +10,15 @@ import { createShims } from "./compat-shims";
10
10
 
11
11
  const Shimmed = { ...ReactOriginal, ...createShims(ReactOriginal) };
12
12
 
13
- // React internals required by react-dom
14
- export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- (ReactOriginal as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
13
+ // React internals required by react-dom. Not part of React's public types;
14
+ // declared here as an opaque escape hatch so consuming code can re-export the
15
+ // same symbol react-dom looks up at runtime.
16
+ interface ReactInternals {
17
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?: unknown;
18
+ }
19
+ export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = (
20
+ ReactOriginal as ReactInternals
21
+ ).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
17
22
 
18
23
  export const {
19
24
  Children,
package/src/server/bun.ts CHANGED
@@ -33,7 +33,7 @@ export function createBunHandler(
33
33
  | ((
34
34
  request: Request,
35
35
  ) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
36
- ) {
36
+ ): (request: Request) => Promise<Response> {
37
37
  return async (request: Request) => {
38
38
  const projectSlug = request.headers.get("gram-project");
39
39
 
@@ -34,7 +34,7 @@ export function createExpressHandler(
34
34
  | ((
35
35
  req: Request,
36
36
  ) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
37
- ) {
37
+ ): (req: Request, res: Response) => Promise<void> {
38
38
  return async (req: Request, res: Response) => {
39
39
  const projectSlug = Array.isArray(req.headers["gram-project"])
40
40
  ? req.headers["gram-project"][0]
@@ -33,7 +33,7 @@ export function createFastifyHandler(
33
33
  | ((
34
34
  request: FastifyRequest,
35
35
  ) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
36
- ) {
36
+ ): (request: FastifyRequest, reply: FastifyReply) => Promise<void> {
37
37
  return async (request: FastifyRequest, reply: FastifyReply) => {
38
38
  const projectSlug = Array.isArray(request.headers["gram-project"])
39
39
  ? request.headers["gram-project"][0]
@@ -31,7 +31,7 @@ export function createHonoHandler(
31
31
  options:
32
32
  | SessionHandlerOptions
33
33
  | ((c: Context) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
34
- ) {
34
+ ): (c: Context) => Promise<Response> {
35
35
  return async (c: Context) => {
36
36
  const projectSlug = c.req.header("gram-project");
37
37
 
@@ -28,7 +28,7 @@ export function createNextHandler(
28
28
  | ((
29
29
  request: Request,
30
30
  ) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
31
- ) {
31
+ ): (request: Request) => Promise<Response> {
32
32
  return async (request: Request) => {
33
33
  const projectSlug = request.headers.get("gram-project");
34
34
 
@@ -47,7 +47,7 @@ export function createTanStackStartHandler(
47
47
  | ((
48
48
  request: Request,
49
49
  ) => SessionHandlerOptions | Promise<SessionHandlerOptions>),
50
- ) {
50
+ ): (request: Request) => Promise<Response> {
51
51
  return async (request: Request) => {
52
52
  const projectSlug = request.headers.get("gram-project");
53
53
 
@@ -15,6 +15,11 @@ export interface ElementsParameters {
15
15
  * Use this to override specific config values per-story.
16
16
  */
17
17
  config?: Partial<ElementsConfig>;
18
+ /**
19
+ * When true, the global ElementsProvider decorator is skipped — useful for
20
+ * stories that render their own provider (e.g. `<Replay>`).
21
+ */
22
+ skipProvider?: boolean;
18
23
  }
19
24
 
20
25
  declare module "storybook/internal/csf" {
@@ -1,6 +1,7 @@
1
+ import type { GramChatMessage } from "@/lib/messageConverter";
1
2
  import { MODELS } from "@/lib/models";
2
- import type { FrontendTool } from "@/lib/tools";
3
3
  import {
4
+ AssistantTool,
4
5
  ImageMessagePartComponent,
5
6
  ReasoningGroupComponent,
6
7
  ReasoningMessagePartComponent,
@@ -662,8 +663,15 @@ export type ToolsFilter =
662
663
  | string[]
663
664
  | (({ toolName }: { toolName: string }) => boolean);
664
665
 
665
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
666
- export type FrontendTools = Record<string, FrontendTool<any, any>>;
666
+ // FrontendTools holds heterogeneous, user-defined tools. Each entry was made by
667
+ // `defineFrontendTool<TArgs, TResult>` with its own narrow generics, but
668
+ // assistant-ui's `AssistantToolProps<TArgs, TResult>` is invariant in both
669
+ // parameters (input position in `execute`, output position in `streamCall`), so
670
+ // no single `FrontendTool<...>` parameterisation can stand in for an arbitrary
671
+ // one. The SDK addresses this on its own `AssistantTool` shape with
672
+ // `unstable_tool: AssistantToolProps<any, any>`; we mirror that here for the
673
+ // record's value type.
674
+ export type FrontendTools = Record<string, AssistantTool>;
667
675
 
668
676
  /**
669
677
  * ToolsConfig is used to configure tool support in the Elements library.
@@ -842,6 +850,12 @@ export interface ContextCompactionConfig {
842
850
  }
843
851
 
844
852
  export interface WelcomeConfig {
853
+ /**
854
+ * Optional logo image URL shown above the title on the empty-thread welcome
855
+ * screen.
856
+ */
857
+ logo?: string;
858
+
845
859
  /**
846
860
  * The welcome message to display when the thread is empty.
847
861
  */
@@ -1075,6 +1089,26 @@ export interface HistoryConfig {
1075
1089
  */
1076
1090
  deferThreadIdMinting?: boolean;
1077
1091
 
1092
+ /**
1093
+ * Optional hook to transform or drop each persisted message before it is
1094
+ * rendered from history. Return a (possibly rewritten) message to render it,
1095
+ * or `null` to omit it entirely. Elements applies this to every message
1096
+ * returned by `chat.load` before conversion.
1097
+ *
1098
+ * Use this to keep product- or backend-specific transcript conventions out of
1099
+ * the library — e.g. stripping a server-injected framing block from a turn's
1100
+ * text, or hiding system events that carry no user-facing content. Elements
1101
+ * itself stays agnostic to any such convention.
1102
+ *
1103
+ * @example
1104
+ * // Strip a server-injected framing block and hide framing-only turns.
1105
+ * transformChatMessage: (msg) => {
1106
+ * const cleaned = stripFraming(msg);
1107
+ * return isFramingOnly(cleaned) ? null : cleaned;
1108
+ * }
1109
+ */
1110
+ transformChatMessage?: (message: GramChatMessage) => GramChatMessage | null;
1111
+
1078
1112
  /**
1079
1113
  * Whether to show the thread list sidebar/panel.
1080
1114
  * Only applicable for widget and sidecar variants.
@@ -1116,4 +1150,6 @@ export type ElementsContextType = {
1116
1150
  setIsOpen: (isOpen: boolean) => void;
1117
1151
  plugins: Plugin[];
1118
1152
  mcpTools: Record<string, unknown> | undefined;
1153
+ /** True while the MCP tool list is actively being fetched. */
1154
+ mcpToolsLoading: boolean;
1119
1155
  };