@chatsdk-dev/elements 0.0.1

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 +43 -0
  2. package/dist/chunk-2LHKM7RD.js +14 -0
  3. package/dist/chunk-5UMYP6MD.js +10 -0
  4. package/dist/chunk-AP4MG32M.js +36 -0
  5. package/dist/chunk-CFM57HOS.js +358 -0
  6. package/dist/chunk-EGIUE7H2.js +37 -0
  7. package/dist/chunk-M5OONVIO.js +90 -0
  8. package/dist/chunk-MXTBCHYC.js +31 -0
  9. package/dist/chunk-NIC3MOMY.js +55 -0
  10. package/dist/chunk-QTRMNIG3.js +83 -0
  11. package/dist/chunk-R7G3RQLU.js +36 -0
  12. package/dist/chunk-RJG5D2TM.js +113 -0
  13. package/dist/chunk-SLJNKQ2G.js +125 -0
  14. package/dist/chunk-TDEFIW2L.js +9 -0
  15. package/dist/chunk-TDP6D7U7.js +551 -0
  16. package/dist/chunk-V2ITXC65.js +24 -0
  17. package/dist/chunk-VS55HRUS.js +16 -0
  18. package/dist/chunk-VYDYCGJL.js +25 -0
  19. package/dist/chunk-X5YUF2YM.js +113 -0
  20. package/dist/chunk-YX46JVQN.js +78 -0
  21. package/dist/chunk-YXAMLTTT.js +16 -0
  22. package/dist/chunk-YXFVHSY4.js +51 -0
  23. package/dist/chunk-ZCSZX3OI.js +4 -0
  24. package/dist/common/use-copy-to-clipboard.d.ts +3 -0
  25. package/dist/common/use-copy-to-clipboard.js +33 -0
  26. package/dist/common/utilts.d.ts +8 -0
  27. package/dist/common/utilts.js +28 -0
  28. package/dist/components/ai-elements/actions.d.ts +13 -0
  29. package/dist/components/ai-elements/actions.js +42 -0
  30. package/dist/components/ai-elements/agent.d.ts +31 -0
  31. package/dist/components/ai-elements/agent.js +77 -0
  32. package/dist/components/ai-elements/artifact.d.ts +27 -0
  33. package/dist/components/ai-elements/artifact.js +108 -0
  34. package/dist/components/ai-elements/attachments.d.ts +57 -0
  35. package/dist/components/ai-elements/attachments.js +258 -0
  36. package/dist/components/ai-elements/audio-player.d.ts +33 -0
  37. package/dist/components/ai-elements/audio-player.js +199 -0
  38. package/dist/components/ai-elements/canvas.d.ts +10 -0
  39. package/dist/components/ai-elements/canvas.js +24 -0
  40. package/dist/components/ai-elements/chain-of-thought.d.ts +34 -0
  41. package/dist/components/ai-elements/chain-of-thought.js +159 -0
  42. package/dist/components/ai-elements/checkpoint.d.ts +16 -0
  43. package/dist/components/ai-elements/checkpoint.js +47 -0
  44. package/dist/components/ai-elements/code-block.d.ts +48 -0
  45. package/dist/components/ai-elements/code-block.js +1 -0
  46. package/dist/components/ai-elements/commit.d.ts +68 -0
  47. package/dist/components/ai-elements/commit.js +314 -0
  48. package/dist/components/ai-elements/confirmation.d.ts +52 -0
  49. package/dist/components/ai-elements/confirmation.js +76 -0
  50. package/dist/components/ai-elements/connection.d.ts +5 -0
  51. package/dist/components/ai-elements/connection.js +34 -0
  52. package/dist/components/ai-elements/context.d.ts +36 -0
  53. package/dist/components/ai-elements/context.js +320 -0
  54. package/dist/components/ai-elements/controls.d.ts +8 -0
  55. package/dist/components/ai-elements/controls.js +17 -0
  56. package/dist/components/ai-elements/conversation.d.ts +27 -0
  57. package/dist/components/ai-elements/conversation.js +119 -0
  58. package/dist/components/ai-elements/edge.d.ts +9 -0
  59. package/dist/components/ai-elements/edge.js +111 -0
  60. package/dist/components/ai-elements/environment-variables.d.ts +42 -0
  61. package/dist/components/ai-elements/environment-variables.js +208 -0
  62. package/dist/components/ai-elements/file-tree.d.ts +30 -0
  63. package/dist/components/ai-elements/file-tree.js +212 -0
  64. package/dist/components/ai-elements/image.d.ts +10 -0
  65. package/dist/components/ai-elements/image.js +23 -0
  66. package/dist/components/ai-elements/inline-citation.d.ts +42 -0
  67. package/dist/components/ai-elements/inline-citation.js +203 -0
  68. package/dist/components/ai-elements/jsx-preview.d.ts +33 -0
  69. package/dist/components/ai-elements/jsx-preview.js +206 -0
  70. package/dist/components/ai-elements/loader.d.ts +9 -0
  71. package/dist/components/ai-elements/loader.js +115 -0
  72. package/dist/components/ai-elements/message.d.ts +42 -0
  73. package/dist/components/ai-elements/message.js +259 -0
  74. package/dist/components/ai-elements/mic-selector.d.ts +49 -0
  75. package/dist/components/ai-elements/mic-selector.js +252 -0
  76. package/dist/components/ai-elements/model-selector.d.ts +39 -0
  77. package/dist/components/ai-elements/model-selector.js +73 -0
  78. package/dist/components/ai-elements/node.d.ts +25 -0
  79. package/dist/components/ai-elements/node.js +41 -0
  80. package/dist/components/ai-elements/open-in-chat.d.ts +32 -0
  81. package/dist/components/ai-elements/open-in-chat.js +366 -0
  82. package/dist/components/ai-elements/package-info.d.ts +32 -0
  83. package/dist/components/ai-elements/package-info.js +162 -0
  84. package/dist/components/ai-elements/panel.d.ts +8 -0
  85. package/dist/components/ai-elements/panel.js +17 -0
  86. package/dist/components/ai-elements/persona.d.ts +50 -0
  87. package/dist/components/ai-elements/persona.js +209 -0
  88. package/dist/components/ai-elements/plan.d.ts +29 -0
  89. package/dist/components/ai-elements/plan.js +95 -0
  90. package/dist/components/ai-elements/prompt-input.d.ts +153 -0
  91. package/dist/components/ai-elements/prompt-input.js +939 -0
  92. package/dist/components/ai-elements/queue.d.ts +65 -0
  93. package/dist/components/ai-elements/queue.js +179 -0
  94. package/dist/components/ai-elements/reasoning.d.ts +30 -0
  95. package/dist/components/ai-elements/reasoning.js +161 -0
  96. package/dist/components/ai-elements/response.d.ts +9 -0
  97. package/dist/components/ai-elements/response.js +33 -0
  98. package/dist/components/ai-elements/sandbox.d.ts +28 -0
  99. package/dist/components/ai-elements/sandbox.js +98 -0
  100. package/dist/components/ai-elements/schema-display.d.ts +58 -0
  101. package/dist/components/ai-elements/schema-display.js +313 -0
  102. package/dist/components/ai-elements/shimmer.d.ts +14 -0
  103. package/dist/components/ai-elements/shimmer.js +1 -0
  104. package/dist/components/ai-elements/snippet.d.ts +22 -0
  105. package/dist/components/ai-elements/snippet.js +90 -0
  106. package/dist/components/ai-elements/sources.d.ts +16 -0
  107. package/dist/components/ai-elements/sources.js +62 -0
  108. package/dist/components/ai-elements/speech-input.d.ts +57 -0
  109. package/dist/components/ai-elements/speech-input.js +206 -0
  110. package/dist/components/ai-elements/stack-trace.d.ts +42 -0
  111. package/dist/components/ai-elements/stack-trace.js +377 -0
  112. package/dist/components/ai-elements/suggestion.d.ts +14 -0
  113. package/dist/components/ai-elements/suggestion.js +41 -0
  114. package/dist/components/ai-elements/task.d.ts +18 -0
  115. package/dist/components/ai-elements/task.js +60 -0
  116. package/dist/components/ai-elements/terminal.d.ts +31 -0
  117. package/dist/components/ai-elements/terminal.js +203 -0
  118. package/dist/components/ai-elements/test-results.d.ts +61 -0
  119. package/dist/components/ai-elements/test-results.js +349 -0
  120. package/dist/components/ai-elements/tool.d.ts +35 -0
  121. package/dist/components/ai-elements/tool.js +2 -0
  122. package/dist/components/ai-elements/toolbar.d.ts +8 -0
  123. package/dist/components/ai-elements/toolbar.js +18 -0
  124. package/dist/components/ai-elements/transcription.d.ts +19 -0
  125. package/dist/components/ai-elements/transcription.js +90 -0
  126. package/dist/components/ai-elements/voice-selector.d.ts +66 -0
  127. package/dist/components/ai-elements/voice-selector.js +332 -0
  128. package/dist/components/ai-elements/web-preview.d.ts +38 -0
  129. package/dist/components/ai-elements/web-preview.js +214 -0
  130. package/dist/components/info-card.d.ts +14 -0
  131. package/dist/components/info-card.js +1 -0
  132. package/dist/components/responsive-alert-dialog.d.ts +19 -0
  133. package/dist/components/responsive-alert-dialog.js +1 -0
  134. package/dist/components/responsive-dialog.d.ts +14 -0
  135. package/dist/components/responsive-dialog.js +1 -0
  136. package/dist/config-IcWUmjwj.d.ts +239 -0
  137. package/dist/features/chat/chat-card.d.ts +5 -0
  138. package/dist/features/chat/chat-card.js +14 -0
  139. package/dist/features/chat/chat-element/chat-element.d.ts +8 -0
  140. package/dist/features/chat/chat-element/chat-element.js +14 -0
  141. package/dist/features/chat/chat-element/use-chat.d.ts +21 -0
  142. package/dist/features/chat/chat-element/use-chat.js +14 -0
  143. package/dist/features/chat/chat-element/use-initial-messages.d.ts +20 -0
  144. package/dist/features/chat/chat-element/use-initial-messages.js +14 -0
  145. package/dist/features/chat/chat-header/chat-header.d.ts +8 -0
  146. package/dist/features/chat/chat-header/chat-header.js +14 -0
  147. package/dist/features/chat/chat-header/chat-menu.d.ts +5 -0
  148. package/dist/features/chat/chat-header/chat-menu.js +2 -0
  149. package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -0
  150. package/dist/features/chat/chat-history/chat-history-empty.js +1 -0
  151. package/dist/features/chat/chat-history/chat-history.d.ts +5 -0
  152. package/dist/features/chat/chat-history/chat-history.js +14 -0
  153. package/dist/features/chat/chat-message.d.ts +10 -0
  154. package/dist/features/chat/chat-message.js +1 -0
  155. package/dist/features/chat/chat-molecule.d.ts +35 -0
  156. package/dist/features/chat/chat-molecule.js +14 -0
  157. package/dist/features/chat/chat-prompt-input.d.ts +16 -0
  158. package/dist/features/chat/chat-prompt-input.js +14 -0
  159. package/dist/features/chat/chat.context.d.ts +26 -0
  160. package/dist/features/chat/chat.context.js +13 -0
  161. package/dist/features/chat/index.d.ts +14 -0
  162. package/dist/features/chat/index.js +14 -0
  163. package/dist/features/chat/queries/query-keys.d.ts +8 -0
  164. package/dist/features/chat/queries/query-keys.js +1 -0
  165. package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +29 -0
  166. package/dist/features/chat/queries/use-create-conversation-mutation.js +38 -0
  167. package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -0
  168. package/dist/features/chat/queries/use-get-chat-query.js +14 -0
  169. package/dist/features/chat/queries/use-get-conversation-query.d.ts +62 -0
  170. package/dist/features/chat/queries/use-get-conversation-query.js +14 -0
  171. package/dist/features/chat/queries/use-list-conversations-query.d.ts +29 -0
  172. package/dist/features/chat/queries/use-list-conversations-query.js +14 -0
  173. package/dist/features/chat/store.d.ts +13 -0
  174. package/dist/features/chat/store.js +1 -0
  175. package/dist/features/chat/utils.d.ts +5 -0
  176. package/dist/features/chat/utils.js +1 -0
  177. package/dist/features/data-fetching/use-api-client.d.ts +5 -0
  178. package/dist/features/data-fetching/use-api-client.js +14 -0
  179. package/dist/features/logger/logger.d.ts +9 -0
  180. package/dist/features/logger/logger.js +1 -0
  181. package/dist/features/molecule/chatsdk-provider.d.ts +19 -0
  182. package/dist/features/molecule/chatsdk-provider.js +26 -0
  183. package/dist/features/molecule/constants.d.ts +3 -0
  184. package/dist/features/molecule/constants.js +1 -0
  185. package/dist/features/molecule/molecule-provider.d.ts +39 -0
  186. package/dist/features/molecule/molecule-provider.js +1 -0
  187. package/dist/features/molecule/store.d.ts +53 -0
  188. package/dist/features/molecule/store.js +3 -0
  189. package/dist/features/molecule/types/api.d.ts +8 -0
  190. package/dist/features/molecule/types/api.js +1 -0
  191. package/dist/features/molecule/types/callbacks.d.ts +22 -0
  192. package/dist/features/molecule/types/callbacks.js +1 -0
  193. package/dist/features/molecule/types/config.d.ts +10 -0
  194. package/dist/features/molecule/types/config.js +1 -0
  195. package/dist/features/molecule/types/context.d.ts +11 -0
  196. package/dist/features/molecule/types/context.js +1 -0
  197. package/dist/features/molecule/types/locale.d.ts +9 -0
  198. package/dist/features/molecule/types/locale.js +1 -0
  199. package/dist/features/molecule/types/theme.d.ts +38 -0
  200. package/dist/features/molecule/types/theme.js +1 -0
  201. package/dist/features/molecule/types/translations.d.ts +10 -0
  202. package/dist/features/molecule/types/translations.js +1 -0
  203. package/dist/features/molecule/use-merge-global-config.d.ts +22 -0
  204. package/dist/features/molecule/use-merge-global-config.js +5 -0
  205. package/dist/features/molecule/use-molecule-config.d.ts +41 -0
  206. package/dist/features/molecule/use-molecule-config.js +6 -0
  207. package/dist/features/molecule/utils.d.ts +10 -0
  208. package/dist/features/molecule/utils.js +1 -0
  209. package/dist/i18n/config.d.ts +61 -0
  210. package/dist/i18n/config.js +1 -0
  211. package/dist/i18n/i18next.d.ts +11 -0
  212. package/dist/i18n/i18next.js +2 -0
  213. package/dist/i18n/utils.d.ts +11 -0
  214. package/dist/i18n/utils.js +6 -0
  215. package/dist/index.d.ts +20 -0
  216. package/dist/index.js +20 -0
  217. package/dist/styles.css +6811 -0
  218. package/package.json +123 -0
@@ -0,0 +1,113 @@
1
+ import { CodeBlock } from './chunk-CFM57HOS.js';
2
+ import { Badge } from '@chatsdk-dev/ui/components/badge';
3
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@chatsdk-dev/ui/components/collapsible';
4
+ import { cn } from '@chatsdk-dev/ui/lib/utils';
5
+ import { WrenchIcon, ChevronDownIcon, XCircleIcon, CheckCircleIcon, CircleIcon, ClockIcon } from 'lucide-react';
6
+ import { isValidElement } from 'react';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ var Tool = ({ className, ...props }) => /* @__PURE__ */ jsx(
10
+ Collapsible,
11
+ {
12
+ className: cn("group not-prose mb-4 w-full rounded-md border", className),
13
+ ...props
14
+ }
15
+ );
16
+ var statusLabels = {
17
+ "approval-requested": "Awaiting Approval",
18
+ "approval-responded": "Responded",
19
+ "input-available": "Running",
20
+ "input-streaming": "Pending",
21
+ "output-available": "Completed",
22
+ "output-denied": "Denied",
23
+ "output-error": "Error"
24
+ };
25
+ var statusIcons = {
26
+ "approval-requested": /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 text-yellow-600" }),
27
+ "approval-responded": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-blue-600" }),
28
+ "input-available": /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 animate-pulse" }),
29
+ "input-streaming": /* @__PURE__ */ jsx(CircleIcon, { className: "size-4" }),
30
+ "output-available": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-green-600" }),
31
+ "output-denied": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-orange-600" }),
32
+ "output-error": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-red-600" })
33
+ };
34
+ var getStatusBadge = (status) => /* @__PURE__ */ jsxs(Badge, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
35
+ statusIcons[status],
36
+ statusLabels[status]
37
+ ] });
38
+ var ToolHeader = ({
39
+ className,
40
+ title,
41
+ type,
42
+ state,
43
+ toolName,
44
+ ...props
45
+ }) => {
46
+ const derivedName = type === "dynamic-tool" ? toolName : type.split("-").slice(1).join("-");
47
+ return /* @__PURE__ */ jsxs(
48
+ CollapsibleTrigger,
49
+ {
50
+ className: cn(
51
+ "flex w-full items-center justify-between gap-4 p-3",
52
+ className
53
+ ),
54
+ ...props,
55
+ children: [
56
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
57
+ /* @__PURE__ */ jsx(WrenchIcon, { className: "size-4 text-muted-foreground" }),
58
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: title ?? derivedName }),
59
+ getStatusBadge(state)
60
+ ] }),
61
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsx(
67
+ CollapsibleContent,
68
+ {
69
+ className: cn(
70
+ "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-4 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
71
+ className
72
+ ),
73
+ ...props
74
+ }
75
+ );
76
+ var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-2 overflow-hidden", className), ...props, children: [
77
+ /* @__PURE__ */ jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: "Parameters" }),
78
+ /* @__PURE__ */ jsx("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ jsx(CodeBlock, { code: JSON.stringify(input, null, 2), language: "json" }) })
79
+ ] });
80
+ var ToolOutput = ({
81
+ className,
82
+ output,
83
+ errorText,
84
+ ...props
85
+ }) => {
86
+ if (!(output || errorText)) {
87
+ return null;
88
+ }
89
+ let Output = /* @__PURE__ */ jsx("div", { children: output });
90
+ if (typeof output === "object" && !isValidElement(output)) {
91
+ Output = /* @__PURE__ */ jsx(CodeBlock, { code: JSON.stringify(output, null, 2), language: "json" });
92
+ } else if (typeof output === "string") {
93
+ Output = /* @__PURE__ */ jsx(CodeBlock, { code: output, language: "json" });
94
+ }
95
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), ...props, children: [
96
+ /* @__PURE__ */ jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: errorText ? "Error" : "Result" }),
97
+ /* @__PURE__ */ jsxs(
98
+ "div",
99
+ {
100
+ className: cn(
101
+ "overflow-x-auto rounded-md text-xs [&_table]:w-full",
102
+ errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"
103
+ ),
104
+ children: [
105
+ errorText && /* @__PURE__ */ jsx("div", { children: errorText }),
106
+ Output
107
+ ]
108
+ }
109
+ )
110
+ ] });
111
+ };
112
+
113
+ export { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput, getStatusBadge };
@@ -0,0 +1,78 @@
1
+ import { deepMerge } from './chunk-RJG5D2TM.js';
2
+ import { LOCAL_STORAGE_PREFIX } from './chunk-ZCSZX3OI.js';
3
+ import { create } from 'zustand';
4
+ import { persist, createJSONStorage } from 'zustand/middleware';
5
+
6
+ var defaultInitialState = {
7
+ context: { actor: { id: crypto.randomUUID() } },
8
+ api: {
9
+ version: "v1",
10
+ baseUrl: "/api/proxy",
11
+ credentials: "include"
12
+ },
13
+ locale: { language: "en" }
14
+ };
15
+ var createChatSDKStore = (customInitialState) => {
16
+ const initialState = { ...defaultInitialState, ...customInitialState };
17
+ return create()(
18
+ persist(
19
+ (set) => ({
20
+ ...initialState,
21
+ setContext: (context) => set((state) => ({
22
+ ...state,
23
+ context: deepMerge({ ...state.context, ...context })
24
+ })),
25
+ setLogger: (logger) => set((state) => ({ ...state, logger })),
26
+ setTheme: (theme) => set((state) => ({ ...state, theme: { ...state.theme, ...theme } })),
27
+ setApi: (api) => set((state) => ({
28
+ ...state,
29
+ api: {
30
+ ...state.api,
31
+ ...api,
32
+ headers: state.api?.headers || api?.headers ? { ...state.api?.headers, ...api?.headers } : void 0
33
+ }
34
+ })),
35
+ setTranslations: (translations, merge = true) => set((state) => ({
36
+ ...state,
37
+ translations: merge ? { ...state.translations, ...translations } : translations
38
+ })),
39
+ setLocale: (locale) => {
40
+ set((state) => ({ ...state, locale }));
41
+ },
42
+ setConfig: (newConfig, merge = true) => {
43
+ set((state) => {
44
+ const config = merge ? state : initialState;
45
+ return {
46
+ ...config,
47
+ ...newConfig,
48
+ api: { ...config.api, ...newConfig.api },
49
+ context: deepMerge({
50
+ ...config.context,
51
+ ...newConfig.context
52
+ }),
53
+ theme: { ...config.theme, ...newConfig.theme },
54
+ translations: {
55
+ ...config.translations,
56
+ ...newConfig.translations
57
+ }
58
+ };
59
+ });
60
+ },
61
+ reset: (config) => {
62
+ set({ ...initialState, theme: {}, ...config });
63
+ },
64
+ setOptions: (options) => set((state) => ({ ...state, options }))
65
+ }),
66
+ {
67
+ partialize: (state) => {
68
+ return { context: { actor: state.context?.actor } };
69
+ },
70
+ name: LOCAL_STORAGE_PREFIX + "elements-store",
71
+ storage: createJSONStorage(() => localStorage)
72
+ }
73
+ )
74
+ );
75
+ };
76
+ var useChatSDKStore = createChatSDKStore();
77
+
78
+ export { createChatSDKStore, useChatSDKStore };
@@ -0,0 +1,16 @@
1
+ import { FolderCode } from 'lucide-react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription } from '@chatsdk-dev/ui/components/empty';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+
6
+ // src/features/chat/chat-history/chat-history-empty.tsx
7
+ function ChatHistoryEmpty() {
8
+ const { t } = useTranslation("chat", { keyPrefix: "history.empty" });
9
+ return /* @__PURE__ */ jsx(Empty, { className: "w-full h-full hover:bg-blue pb-32", children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [
10
+ /* @__PURE__ */ jsx(EmptyMedia, { className: "size-8", variant: "icon", children: /* @__PURE__ */ jsx(FolderCode, { className: "size-4.5" }) }),
11
+ /* @__PURE__ */ jsx(EmptyTitle, { children: t("title") }),
12
+ /* @__PURE__ */ jsx(EmptyDescription, { children: t("description") })
13
+ ] }) });
14
+ }
15
+
16
+ export { ChatHistoryEmpty };
@@ -0,0 +1,51 @@
1
+ import { cloneElement } from 'react';
2
+ import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@chatsdk-dev/ui/components/dialog';
3
+ import { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerFooter } from '@chatsdk-dev/ui/components/drawer';
4
+ import { useBreakpoint } from '@chatsdk-dev/ui/hooks/use-breakpoint';
5
+ import { useControllableState } from '@chatsdk-dev/ui/hooks/use-controllable-state';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ // src/components/responsive-dialog.tsx
9
+ function ResponsiveDialog({
10
+ open,
11
+ onOpenChange,
12
+ trigger,
13
+ children,
14
+ title,
15
+ description,
16
+ footer
17
+ }) {
18
+ const [openState, setOpenState] = useControllableState({
19
+ value: open,
20
+ defaultValue: false,
21
+ onChange: onOpenChange
22
+ });
23
+ const sm = useBreakpoint("sm");
24
+ if (sm) {
25
+ const renderTrigger = trigger ? (triggerProps) => cloneElement(trigger, triggerProps) : void 0;
26
+ return /* @__PURE__ */ jsxs(Dialog, { open: openState, onOpenChange: setOpenState, children: [
27
+ trigger && /* @__PURE__ */ jsx(DialogTrigger, { render: renderTrigger }),
28
+ /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-106 px-6", children: [
29
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
30
+ /* @__PURE__ */ jsx(DialogTitle, { children: title }),
31
+ /* @__PURE__ */ jsx(DialogDescription, { children: description })
32
+ ] }),
33
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto min-h-0 -mx-6 px-6 pb-1", children }),
34
+ footer && /* @__PURE__ */ jsx(DialogFooter, { children: footer })
35
+ ] })
36
+ ] });
37
+ }
38
+ return /* @__PURE__ */ jsxs(Drawer, { open: openState, onOpenChange: setOpenState, children: [
39
+ /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
40
+ /* @__PURE__ */ jsxs(DrawerContent, { className: "p-6", children: [
41
+ /* @__PURE__ */ jsxs(DrawerHeader, { className: "text-left", children: [
42
+ /* @__PURE__ */ jsx(DrawerTitle, { children: title }),
43
+ /* @__PURE__ */ jsx(DrawerDescription, { children: description })
44
+ ] }),
45
+ /* @__PURE__ */ jsx("div", { className: "overflow-y-auto -mx-6 px-6 pb-1", children }),
46
+ footer && /* @__PURE__ */ jsx(DrawerFooter, { children: footer })
47
+ ] })
48
+ ] });
49
+ }
50
+
51
+ export { ResponsiveDialog };
@@ -0,0 +1,4 @@
1
+ // src/features/molecule/constants.ts
2
+ var LOCAL_STORAGE_PREFIX = "chatsdk-";
3
+
4
+ export { LOCAL_STORAGE_PREFIX };
@@ -0,0 +1,3 @@
1
+ declare function useCopyToClipboard(): readonly [string | null, (value: string) => void];
2
+
3
+ export { useCopyToClipboard };
@@ -0,0 +1,33 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ // src/common/use-copy-to-clipboard.ts
4
+ function oldSchoolCopy(text) {
5
+ const tempTextArea = document.createElement("textarea");
6
+ tempTextArea.value = text;
7
+ document.body.appendChild(tempTextArea);
8
+ tempTextArea.select();
9
+ document.execCommand("copy");
10
+ document.body.removeChild(tempTextArea);
11
+ }
12
+ function useCopyToClipboard() {
13
+ const [state, setState] = useState(null);
14
+ const copyToClipboard = useCallback((value) => {
15
+ const handleCopy = async () => {
16
+ try {
17
+ if (navigator?.clipboard?.writeText) {
18
+ await navigator.clipboard.writeText(value);
19
+ setState(value);
20
+ } else {
21
+ throw new Error("writeText not supported");
22
+ }
23
+ } catch (error) {
24
+ oldSchoolCopy(value);
25
+ setState(value);
26
+ }
27
+ };
28
+ handleCopy();
29
+ }, []);
30
+ return [state, copyToClipboard];
31
+ }
32
+
33
+ export { useCopyToClipboard };
@@ -0,0 +1,8 @@
1
+ interface FormatRelativeTimeParams {
2
+ date: number | Date;
3
+ now?: Date;
4
+ locale?: string;
5
+ }
6
+ declare function renderRelativeTime({ date, now, locale, }: FormatRelativeTimeParams): string;
7
+
8
+ export { renderRelativeTime };
@@ -0,0 +1,28 @@
1
+ // src/common/utilts.ts
2
+ function renderRelativeTime({
3
+ date,
4
+ now,
5
+ locale
6
+ }) {
7
+ const _date = date instanceof Date ? date : new Date(date);
8
+ const _now = now ?? /* @__PURE__ */ new Date();
9
+ const diffMs = _date.getTime() - _now.getTime();
10
+ const diffSec = Math.round(diffMs / 1e3);
11
+ const diffMin = Math.round(diffSec / 60);
12
+ const diffHr = Math.round(diffMin / 60);
13
+ const diffDay = Math.round(diffHr / 24);
14
+ const diffWeek = Math.round(diffDay / 7);
15
+ const diffMonth = Math.round(diffDay / 30);
16
+ const diffYear = Math.round(diffDay / 365);
17
+ const _locale = locale ?? "en";
18
+ const rtf = new Intl.RelativeTimeFormat(_locale, { numeric: "auto" });
19
+ if (Math.abs(diffSec) < 60) return rtf.format(diffSec, "second");
20
+ if (Math.abs(diffMin) < 60) return rtf.format(diffMin, "minute");
21
+ if (Math.abs(diffHr) < 24) return rtf.format(diffHr, "hour");
22
+ if (Math.abs(diffDay) < 7) return rtf.format(diffDay, "day");
23
+ if (Math.abs(diffWeek) < 4) return rtf.format(diffWeek, "week");
24
+ if (Math.abs(diffMonth) < 12) return rtf.format(diffMonth, "month");
25
+ return rtf.format(diffYear, "year");
26
+ }
27
+
28
+ export { renderRelativeTime };
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+ import { ButtonProps } from '@chatsdk-dev/ui/components/button';
4
+
5
+ type ActionsProps = ComponentProps<"div">;
6
+ declare const Actions: ({ className, children, ...props }: ActionsProps) => react_jsx_runtime.JSX.Element;
7
+ type ActionProps = ButtonProps & {
8
+ tooltip?: string;
9
+ label?: string;
10
+ };
11
+ declare const Action: ({ tooltip, children, label, className, variant, size, ...props }: ActionProps) => react_jsx_runtime.JSX.Element;
12
+
13
+ export { Action, type ActionProps, Actions, type ActionsProps };
@@ -0,0 +1,42 @@
1
+ import { Button } from '@chatsdk-dev/ui/components/button';
2
+ import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@chatsdk-dev/ui/components/tooltip';
3
+ import { cn } from '@chatsdk-dev/ui/lib/utils';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+
6
+ var Actions = ({ className, children, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-", className), ...props, children });
7
+ var Action = ({
8
+ tooltip,
9
+ children,
10
+ label,
11
+ className,
12
+ variant = "ghost",
13
+ size = "sm",
14
+ ...props
15
+ }) => {
16
+ const button = /* @__PURE__ */ jsxs(
17
+ Button,
18
+ {
19
+ className: cn(
20
+ "size-9 p-1.5 bg-transparent text-muted-foreground hover:text-foreground hover:bg-transparent relative",
21
+ className
22
+ ),
23
+ size,
24
+ type: "button",
25
+ variant,
26
+ ...props,
27
+ children: [
28
+ children,
29
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: label || tooltip })
30
+ ]
31
+ }
32
+ );
33
+ if (tooltip) {
34
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
35
+ /* @__PURE__ */ jsx(TooltipTrigger, { children: button }),
36
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip }) })
37
+ ] }) });
38
+ }
39
+ return button;
40
+ };
41
+
42
+ export { Action, Actions };
@@ -0,0 +1,31 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { AccordionItem, Accordion } from '@chatsdk-dev/ui/components/accordion';
5
+ import { Tool } from 'ai';
6
+
7
+ type AgentProps = ComponentProps<"div">;
8
+ declare const Agent: react.MemoExoticComponent<({ className, ...props }: AgentProps) => react_jsx_runtime.JSX.Element>;
9
+ type AgentHeaderProps = ComponentProps<"div"> & {
10
+ name: string;
11
+ model?: string;
12
+ };
13
+ declare const AgentHeader: react.MemoExoticComponent<({ className, name, model, ...props }: AgentHeaderProps) => react_jsx_runtime.JSX.Element>;
14
+ type AgentContentProps = ComponentProps<"div">;
15
+ declare const AgentContent: react.MemoExoticComponent<({ className, ...props }: AgentContentProps) => react_jsx_runtime.JSX.Element>;
16
+ type AgentInstructionsProps = ComponentProps<"div"> & {
17
+ children: string;
18
+ };
19
+ declare const AgentInstructions: react.MemoExoticComponent<({ className, children, ...props }: AgentInstructionsProps) => react_jsx_runtime.JSX.Element>;
20
+ type AgentToolsProps = ComponentProps<typeof Accordion>;
21
+ declare const AgentTools: react.MemoExoticComponent<({ className, ...props }: AgentToolsProps) => react_jsx_runtime.JSX.Element>;
22
+ type AgentToolProps = ComponentProps<typeof AccordionItem> & {
23
+ tool: Tool;
24
+ };
25
+ declare const AgentTool: react.MemoExoticComponent<({ className, tool, value, ...props }: AgentToolProps) => react_jsx_runtime.JSX.Element>;
26
+ type AgentOutputProps = ComponentProps<"div"> & {
27
+ schema: string;
28
+ };
29
+ declare const AgentOutput: react.MemoExoticComponent<({ className, schema, ...props }: AgentOutputProps) => react_jsx_runtime.JSX.Element>;
30
+
31
+ export { Agent, AgentContent, type AgentContentProps, AgentHeader, type AgentHeaderProps, AgentInstructions, type AgentInstructionsProps, AgentOutput, type AgentOutputProps, type AgentProps, AgentTool, type AgentToolProps, AgentTools, type AgentToolsProps };
@@ -0,0 +1,77 @@
1
+ import { CodeBlock } from '../../chunk-CFM57HOS.js';
2
+ import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@chatsdk-dev/ui/components/accordion';
3
+ import { Badge } from '@chatsdk-dev/ui/components/badge';
4
+ import { cn } from '@chatsdk-dev/ui/lib/utils';
5
+ import { BotIcon } from 'lucide-react';
6
+ import { memo } from 'react';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ var Agent = memo(({ className, ...props }) => /* @__PURE__ */ jsx(
10
+ "div",
11
+ {
12
+ className: cn("not-prose w-full rounded-md border", className),
13
+ ...props
14
+ }
15
+ ));
16
+ var AgentHeader = memo(
17
+ ({ className, name, model, ...props }) => /* @__PURE__ */ jsx(
18
+ "div",
19
+ {
20
+ className: cn(
21
+ "flex w-full items-center justify-between gap-4 p-3",
22
+ className
23
+ ),
24
+ ...props,
25
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
26
+ /* @__PURE__ */ jsx(BotIcon, { className: "size-4 text-muted-foreground" }),
27
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: name }),
28
+ model && /* @__PURE__ */ jsx(Badge, { className: "font-mono text-xs", variant: "secondary", children: model })
29
+ ] })
30
+ }
31
+ )
32
+ );
33
+ var AgentContent = memo(
34
+ ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("space-y-4 p-4 pt-0", className), ...props })
35
+ );
36
+ var AgentInstructions = memo(
37
+ ({ className, children, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), ...props, children: [
38
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Instructions" }),
39
+ /* @__PURE__ */ jsx("div", { className: "rounded-md bg-muted/50 p-3 text-muted-foreground text-sm", children: /* @__PURE__ */ jsx("p", { children }) })
40
+ ] })
41
+ );
42
+ var AgentTools = memo(({ className, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
43
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Tools" }),
44
+ /* @__PURE__ */ jsx(Accordion, { className: "rounded-md border", ...props })
45
+ ] }));
46
+ var AgentTool = memo(
47
+ ({ className, tool, value, ...props }) => {
48
+ const schema = "jsonSchema" in tool && tool.jsonSchema ? tool.jsonSchema : tool.inputSchema;
49
+ return /* @__PURE__ */ jsxs(
50
+ AccordionItem,
51
+ {
52
+ className: cn("border-b last:border-b-0", className),
53
+ value,
54
+ ...props,
55
+ children: [
56
+ /* @__PURE__ */ jsx(AccordionTrigger, { className: "px-3 py-2 text-sm hover:no-underline", children: tool.description ?? "No description" }),
57
+ /* @__PURE__ */ jsx(AccordionContent, { className: "px-3 pb-3", children: /* @__PURE__ */ jsx("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ jsx(CodeBlock, { code: JSON.stringify(schema, null, 2), language: "json" }) }) })
58
+ ]
59
+ }
60
+ );
61
+ }
62
+ );
63
+ var AgentOutput = memo(
64
+ ({ className, schema, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), ...props, children: [
65
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Output Schema" }),
66
+ /* @__PURE__ */ jsx("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ jsx(CodeBlock, { code: schema, language: "typescript" }) })
67
+ ] })
68
+ );
69
+ Agent.displayName = "Agent";
70
+ AgentHeader.displayName = "AgentHeader";
71
+ AgentContent.displayName = "AgentContent";
72
+ AgentInstructions.displayName = "AgentInstructions";
73
+ AgentTools.displayName = "AgentTools";
74
+ AgentTool.displayName = "AgentTool";
75
+ AgentOutput.displayName = "AgentOutput";
76
+
77
+ export { Agent, AgentContent, AgentHeader, AgentInstructions, AgentOutput, AgentTool, AgentTools };
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Button } from '@chatsdk-dev/ui/components/button';
3
+ import { LucideIcon } from 'lucide-react';
4
+ import { HTMLAttributes, ComponentProps } from 'react';
5
+
6
+ type ArtifactProps = HTMLAttributes<HTMLDivElement>;
7
+ declare const Artifact: ({ className, ...props }: ArtifactProps) => react_jsx_runtime.JSX.Element;
8
+ type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
9
+ declare const ArtifactHeader: ({ className, ...props }: ArtifactHeaderProps) => react_jsx_runtime.JSX.Element;
10
+ type ArtifactCloseProps = ComponentProps<typeof Button>;
11
+ declare const ArtifactClose: ({ className, children, size, variant, ...props }: ArtifactCloseProps) => react_jsx_runtime.JSX.Element;
12
+ type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
13
+ declare const ArtifactTitle: ({ className, ...props }: ArtifactTitleProps) => react_jsx_runtime.JSX.Element;
14
+ type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
15
+ declare const ArtifactDescription: ({ className, ...props }: ArtifactDescriptionProps) => react_jsx_runtime.JSX.Element;
16
+ type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
17
+ declare const ArtifactActions: ({ className, ...props }: ArtifactActionsProps) => react_jsx_runtime.JSX.Element;
18
+ type ArtifactActionProps = ComponentProps<typeof Button> & {
19
+ tooltip?: string;
20
+ label?: string;
21
+ icon?: LucideIcon;
22
+ };
23
+ declare const ArtifactAction: ({ tooltip, label, icon: Icon, children, className, size, variant, ...props }: ArtifactActionProps) => react_jsx_runtime.JSX.Element;
24
+ type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
25
+ declare const ArtifactContent: ({ className, ...props }: ArtifactContentProps) => react_jsx_runtime.JSX.Element;
26
+
27
+ export { Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps };
@@ -0,0 +1,108 @@
1
+ import { Button } from '@chatsdk-dev/ui/components/button';
2
+ import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@chatsdk-dev/ui/components/tooltip';
3
+ import { cn } from '@chatsdk-dev/ui/lib/utils';
4
+ import { XIcon } from 'lucide-react';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx(
8
+ "div",
9
+ {
10
+ className: cn(
11
+ "flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
12
+ className
13
+ ),
14
+ ...props
15
+ }
16
+ );
17
+ var ArtifactHeader = ({
18
+ className,
19
+ ...props
20
+ }) => /* @__PURE__ */ jsx(
21
+ "div",
22
+ {
23
+ className: cn(
24
+ "flex items-center justify-between border-b bg-muted/50 px-4 py-3",
25
+ className
26
+ ),
27
+ ...props
28
+ }
29
+ );
30
+ var ArtifactClose = ({
31
+ className,
32
+ children,
33
+ size = "sm",
34
+ variant = "ghost",
35
+ ...props
36
+ }) => /* @__PURE__ */ jsxs(
37
+ Button,
38
+ {
39
+ className: cn(
40
+ "size-8 p-0 text-muted-foreground hover:text-foreground",
41
+ className
42
+ ),
43
+ size,
44
+ type: "button",
45
+ variant,
46
+ ...props,
47
+ children: [
48
+ children ?? /* @__PURE__ */ jsx(XIcon, { className: "size-4" }),
49
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
50
+ ]
51
+ }
52
+ );
53
+ var ArtifactTitle = ({ className, ...props }) => /* @__PURE__ */ jsx(
54
+ "p",
55
+ {
56
+ className: cn("font-medium text-foreground text-sm", className),
57
+ ...props
58
+ }
59
+ );
60
+ var ArtifactDescription = ({
61
+ className,
62
+ ...props
63
+ }) => /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground text-sm", className), ...props });
64
+ var ArtifactActions = ({
65
+ className,
66
+ ...props
67
+ }) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-1", className), ...props });
68
+ var ArtifactAction = ({
69
+ tooltip,
70
+ label,
71
+ icon: Icon,
72
+ children,
73
+ className,
74
+ size = "sm",
75
+ variant = "ghost",
76
+ ...props
77
+ }) => {
78
+ const button = /* @__PURE__ */ jsxs(
79
+ Button,
80
+ {
81
+ className: cn(
82
+ "size-8 p-0 text-muted-foreground hover:text-foreground",
83
+ className
84
+ ),
85
+ size,
86
+ type: "button",
87
+ variant,
88
+ ...props,
89
+ children: [
90
+ Icon ? /* @__PURE__ */ jsx(Icon, { className: "size-4" }) : children,
91
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: label || tooltip })
92
+ ]
93
+ }
94
+ );
95
+ if (tooltip) {
96
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
97
+ /* @__PURE__ */ jsx(TooltipTrigger, { render: button }),
98
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip }) })
99
+ ] }) });
100
+ }
101
+ return button;
102
+ };
103
+ var ArtifactContent = ({
104
+ className,
105
+ ...props
106
+ }) => /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto p-4", className), ...props });
107
+
108
+ export { Artifact, ArtifactAction, ArtifactActions, ArtifactClose, ArtifactContent, ArtifactDescription, ArtifactHeader, ArtifactTitle };