@yourgpt/copilot-sdk 2.1.5-alpha.3 → 2.1.5-alpha.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 (106) hide show
  1. package/dist/{MessageTree-CoIt_4nB.d.cts → MessageTree-Clhiv_k2.d.ts} +5 -4
  2. package/dist/{MessageTree-CzaN9Eul.d.ts → MessageTree-Dt9qfJ55.d.cts} +5 -4
  3. package/dist/{ThreadManager-BEAECB7Y.d.ts → ThreadManager-D7KwT2FJ.d.ts} +3 -1
  4. package/dist/{ThreadManager-Cw5fwyCN.d.cts → ThreadManager-DK46fVl3.d.cts} +3 -1
  5. package/dist/{chunk-NUXLAZOE.cjs → chunk-3ZDRX7J2.cjs} +2 -2
  6. package/dist/{chunk-NUXLAZOE.cjs.map → chunk-3ZDRX7J2.cjs.map} +1 -1
  7. package/dist/{chunk-RKGRQRZU.js → chunk-533K2Z7C.js} +4 -4
  8. package/dist/{chunk-RKGRQRZU.js.map → chunk-533K2Z7C.js.map} +1 -1
  9. package/dist/chunk-5EGBIQYS.cjs +292 -0
  10. package/dist/chunk-5EGBIQYS.cjs.map +1 -0
  11. package/dist/chunk-5UGWLGFS.cjs +2039 -0
  12. package/dist/chunk-5UGWLGFS.cjs.map +1 -0
  13. package/dist/{chunk-3AONOZLY.js → chunk-AIVXGTWS.js} +2 -2
  14. package/dist/chunk-AIVXGTWS.js.map +1 -0
  15. package/dist/{chunk-LLM7AHMO.js → chunk-DDZLRCVX.js} +2 -2
  16. package/dist/{chunk-LLM7AHMO.js.map → chunk-DDZLRCVX.js.map} +1 -1
  17. package/dist/{chunk-PT2TOHG5.js → chunk-DH6EO6NW.js} +1337 -3049
  18. package/dist/chunk-DH6EO6NW.js.map +1 -0
  19. package/dist/{chunk-WIXFZUEZ.cjs → chunk-KGYDGK3U.cjs} +84 -30
  20. package/dist/chunk-KGYDGK3U.cjs.map +1 -0
  21. package/dist/{chunk-TCPAT3WG.cjs → chunk-LHLVTGIP.cjs} +1339 -3101
  22. package/dist/chunk-LHLVTGIP.cjs.map +1 -0
  23. package/dist/{chunk-TPB7XED6.cjs → chunk-TPDMBDQX.cjs} +2 -2
  24. package/dist/chunk-TPDMBDQX.cjs.map +1 -0
  25. package/dist/chunk-TXQ37MAO.js +287 -0
  26. package/dist/chunk-TXQ37MAO.js.map +1 -0
  27. package/dist/{chunk-MDS23G2S.cjs → chunk-Y2A6AMGO.cjs} +10 -10
  28. package/dist/{chunk-MDS23G2S.cjs.map → chunk-Y2A6AMGO.cjs.map} +1 -1
  29. package/dist/{chunk-WZ2TOZ7M.js → chunk-YLZCTR4O.js} +65 -11
  30. package/dist/chunk-YLZCTR4O.js.map +1 -0
  31. package/dist/chunk-ZAOTYA5L.js +1983 -0
  32. package/dist/chunk-ZAOTYA5L.js.map +1 -0
  33. package/dist/core/index.cjs +93 -93
  34. package/dist/core/index.d.cts +7 -7
  35. package/dist/core/index.d.ts +7 -7
  36. package/dist/core/index.js +5 -5
  37. package/dist/experimental/index.cjs +644 -0
  38. package/dist/experimental/index.cjs.map +1 -0
  39. package/dist/experimental/index.d.cts +924 -0
  40. package/dist/experimental/index.d.ts +924 -0
  41. package/dist/experimental/index.js +611 -0
  42. package/dist/experimental/index.js.map +1 -0
  43. package/dist/{index-D7169xuR.d.ts → index-D8zza1Q8.d.ts} +1 -1
  44. package/dist/{index-CzJB8Ddo.d.cts → index-DCVjTdIZ.d.cts} +1 -1
  45. package/dist/mcp/index.d.cts +3 -3
  46. package/dist/mcp/index.d.ts +3 -3
  47. package/dist/react/index.cjs +136 -123
  48. package/dist/react/index.d.cts +178 -12
  49. package/dist/react/index.d.ts +178 -12
  50. package/dist/react/index.js +7 -6
  51. package/dist/styles.css +45 -0
  52. package/dist/tools/anthropic/index.cjs +3 -3
  53. package/dist/tools/anthropic/index.d.cts +1 -1
  54. package/dist/tools/anthropic/index.d.ts +1 -1
  55. package/dist/tools/anthropic/index.js +2 -2
  56. package/dist/tools/brave/index.cjs +6 -6
  57. package/dist/tools/brave/index.d.cts +1 -1
  58. package/dist/tools/brave/index.d.ts +1 -1
  59. package/dist/tools/brave/index.js +3 -3
  60. package/dist/tools/exa/index.cjs +6 -6
  61. package/dist/tools/exa/index.d.cts +1 -1
  62. package/dist/tools/exa/index.d.ts +1 -1
  63. package/dist/tools/exa/index.js +3 -3
  64. package/dist/tools/google/index.cjs +6 -6
  65. package/dist/tools/google/index.d.cts +1 -1
  66. package/dist/tools/google/index.d.ts +1 -1
  67. package/dist/tools/google/index.js +4 -4
  68. package/dist/tools/openai/index.cjs +6 -6
  69. package/dist/tools/openai/index.d.cts +1 -1
  70. package/dist/tools/openai/index.d.ts +1 -1
  71. package/dist/tools/openai/index.js +3 -3
  72. package/dist/tools/searxng/index.cjs +6 -6
  73. package/dist/tools/searxng/index.d.cts +1 -1
  74. package/dist/tools/searxng/index.d.ts +1 -1
  75. package/dist/tools/searxng/index.js +3 -3
  76. package/dist/tools/serper/index.cjs +6 -6
  77. package/dist/tools/serper/index.d.cts +1 -1
  78. package/dist/tools/serper/index.d.ts +1 -1
  79. package/dist/tools/serper/index.js +3 -3
  80. package/dist/tools/tavily/index.cjs +6 -6
  81. package/dist/tools/tavily/index.d.cts +1 -1
  82. package/dist/tools/tavily/index.d.ts +1 -1
  83. package/dist/tools/tavily/index.js +3 -3
  84. package/dist/tools/web-search/index.cjs +7 -7
  85. package/dist/tools/web-search/index.d.cts +2 -2
  86. package/dist/tools/web-search/index.d.ts +2 -2
  87. package/dist/tools/web-search/index.js +4 -4
  88. package/dist/{tools-tmksfhUo.d.cts → tools-DcS6Aeao.d.cts} +7 -3
  89. package/dist/{tools-tmksfhUo.d.ts → tools-DcS6Aeao.d.ts} +7 -3
  90. package/dist/{types-BqwW3Baj.d.ts → types-BUYni9B8.d.ts} +1 -1
  91. package/dist/{types-BLw7mxtW.d.cts → types-Cvg4DUoc.d.cts} +1 -1
  92. package/dist/{types-BeFBBZ5i.d.ts → types-waEqyE4K.d.cts} +5 -0
  93. package/dist/{types-BeFBBZ5i.d.cts → types-waEqyE4K.d.ts} +5 -0
  94. package/dist/ui/index.cjs +354 -524
  95. package/dist/ui/index.cjs.map +1 -1
  96. package/dist/ui/index.d.cts +22 -4
  97. package/dist/ui/index.d.ts +22 -4
  98. package/dist/ui/index.js +197 -372
  99. package/dist/ui/index.js.map +1 -1
  100. package/package.json +6 -1
  101. package/dist/chunk-3AONOZLY.js.map +0 -1
  102. package/dist/chunk-PT2TOHG5.js.map +0 -1
  103. package/dist/chunk-TCPAT3WG.cjs.map +0 -1
  104. package/dist/chunk-TPB7XED6.cjs.map +0 -1
  105. package/dist/chunk-WIXFZUEZ.cjs.map +0 -1
  106. package/dist/chunk-WZ2TOZ7M.js.map +0 -1
package/dist/ui/index.js CHANGED
@@ -1,11 +1,15 @@
1
- import { useCopilot, useThreadManager } from '../chunk-PT2TOHG5.js';
2
- import { createServerAdapter } from '../chunk-WZ2TOZ7M.js';
1
+ import { useThreadManager } from '../chunk-ZAOTYA5L.js';
3
2
  import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
3
+ import { cn, Loader, TextShimmerLoader } from '../chunk-TXQ37MAO.js';
4
+ export { Loader, cn } from '../chunk-TXQ37MAO.js';
5
+ import { useCopilot } from '../chunk-DH6EO6NW.js';
6
+ import { createServerAdapter } from '../chunk-YLZCTR4O.js';
4
7
  import '../chunk-EWVQWTNV.js';
5
8
  import '../chunk-VNLLW3ZI.js';
6
- import '../chunk-RKGRQRZU.js';
7
- import '../chunk-3AONOZLY.js';
8
- import '../chunk-LLM7AHMO.js';
9
+ import '../chunk-533K2Z7C.js';
10
+ import '../chunk-AIVXGTWS.js';
11
+ import '../chunk-DDZLRCVX.js';
12
+ import '../chunk-53UGJNHN.js';
9
13
  import '../chunk-RQ74USYU.js';
10
14
  import '../chunk-7W7QLZNC.js';
11
15
  import '../chunk-CEOMTQTP.js';
@@ -13,15 +17,12 @@ import '../chunk-PPFHA6IL.js';
13
17
  import '../chunk-DABZYCVX.js';
14
18
  import '../chunk-MNDGIW47.js';
15
19
  import '../chunk-VD74IPKB.js';
16
- import '../chunk-53UGJNHN.js';
17
20
  import '../chunk-DGUM43GV.js';
18
- import { clsx } from 'clsx';
19
- import { twMerge } from 'tailwind-merge';
20
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
21
21
  import * as React19 from 'react';
22
22
  import React19__default, { memo, createContext, useState, useRef, useId, useCallback, useMemo, useLayoutEffect, useContext, useEffect } from 'react';
23
23
  import { Streamdown } from 'streamdown';
24
24
  import { code } from '@streamdown/code';
25
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
26
  import { Slot } from '@radix-ui/react-slot';
26
27
  import { cva } from 'class-variance-authority';
27
28
  import { StickToBottom as StickToBottom$1, useStickToBottomContext } from 'use-stick-to-bottom';
@@ -31,284 +32,6 @@ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
31
32
  import { Globe, ChevronUp, ChevronDown, ExternalLink } from 'lucide-react';
32
33
  import { Popover as Popover$1 } from '@base-ui/react/popover';
33
34
 
34
- function cn(...inputs) {
35
- return twMerge(clsx(inputs));
36
- }
37
- function DotsLoader({
38
- className,
39
- size = "md"
40
- }) {
41
- const dotSizes = {
42
- sm: "h-1 w-1",
43
- md: "h-1.5 w-1.5",
44
- lg: "h-2 w-2"
45
- };
46
- const containerSizes = {
47
- sm: "h-4",
48
- md: "h-5",
49
- lg: "h-6"
50
- };
51
- return /* @__PURE__ */ jsxs(
52
- "div",
53
- {
54
- className: cn(
55
- "flex items-center translate-y-[-2px] space-x-1",
56
- containerSizes[size],
57
- className
58
- ),
59
- children: [
60
- [...Array(3)].map((_, i) => /* @__PURE__ */ jsx(
61
- "div",
62
- {
63
- className: cn(
64
- "bg-primary csdk-loader-bounce-dots rounded-full",
65
- dotSizes[size]
66
- ),
67
- style: {
68
- animationDelay: `${i * 160}ms`
69
- }
70
- },
71
- i
72
- )),
73
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
74
- ]
75
- }
76
- );
77
- }
78
- function TypingLoader({
79
- className,
80
- size = "md"
81
- }) {
82
- const dotSizes = {
83
- sm: "h-1 w-1",
84
- md: "h-1.5 w-1.5",
85
- lg: "h-2 w-2"
86
- };
87
- const containerSizes = {
88
- sm: "h-4",
89
- md: "h-5",
90
- lg: "h-6"
91
- };
92
- return /* @__PURE__ */ jsxs(
93
- "div",
94
- {
95
- className: cn(
96
- "flex items-center space-x-1",
97
- containerSizes[size],
98
- className
99
- ),
100
- children: [
101
- [...Array(3)].map((_, i) => /* @__PURE__ */ jsx(
102
- "div",
103
- {
104
- className: cn(
105
- "bg-primary csdk-loader-typing rounded-full",
106
- dotSizes[size]
107
- ),
108
- style: {
109
- animationDelay: `${i * 250}ms`
110
- }
111
- },
112
- i
113
- )),
114
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
115
- ]
116
- }
117
- );
118
- }
119
- function WaveLoader({
120
- className,
121
- size = "md"
122
- }) {
123
- const barWidths = {
124
- sm: "w-0.5",
125
- md: "w-0.5",
126
- lg: "w-1"
127
- };
128
- const containerSizes = {
129
- sm: "h-4",
130
- md: "h-5",
131
- lg: "h-6"
132
- };
133
- const heights = {
134
- sm: ["6px", "9px", "12px", "9px", "6px"],
135
- md: ["8px", "12px", "16px", "12px", "8px"],
136
- lg: ["10px", "15px", "20px", "15px", "10px"]
137
- };
138
- return /* @__PURE__ */ jsxs(
139
- "div",
140
- {
141
- className: cn(
142
- "flex items-center gap-0.5",
143
- containerSizes[size],
144
- className
145
- ),
146
- children: [
147
- [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
148
- "div",
149
- {
150
- className: cn(
151
- "bg-primary csdk-loader-wave rounded-full",
152
- barWidths[size]
153
- ),
154
- style: {
155
- animationDelay: `${i * 100}ms`,
156
- height: heights[size][i]
157
- }
158
- },
159
- i
160
- )),
161
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
162
- ]
163
- }
164
- );
165
- }
166
- function TerminalLoader({
167
- className,
168
- size = "md"
169
- }) {
170
- const cursorSizes = {
171
- sm: "h-3 w-1.5",
172
- md: "h-4 w-2",
173
- lg: "h-5 w-2.5"
174
- };
175
- const textSizes = {
176
- sm: "text-xs",
177
- md: "text-sm",
178
- lg: "text-base"
179
- };
180
- const containerSizes = {
181
- sm: "h-4",
182
- md: "h-5",
183
- lg: "h-6"
184
- };
185
- return /* @__PURE__ */ jsxs(
186
- "div",
187
- {
188
- className: cn(
189
- "flex items-center space-x-1",
190
- containerSizes[size],
191
- className
192
- ),
193
- children: [
194
- /* @__PURE__ */ jsx("span", { className: cn("text-primary font-mono", textSizes[size]), children: ">" }),
195
- /* @__PURE__ */ jsx("div", { className: cn("bg-primary csdk-loader-blink", cursorSizes[size]) }),
196
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
197
- ]
198
- }
199
- );
200
- }
201
- function TextBlinkLoader({
202
- text = "Thinking",
203
- className,
204
- size = "md"
205
- }) {
206
- const textSizes = {
207
- sm: "text-xs",
208
- md: "text-sm",
209
- lg: "text-base"
210
- };
211
- return /* @__PURE__ */ jsx(
212
- "div",
213
- {
214
- className: cn(
215
- "csdk-loader-text-blink font-medium",
216
- textSizes[size],
217
- className
218
- ),
219
- children: text
220
- }
221
- );
222
- }
223
- function TextShimmerLoader({
224
- text = "Thinking",
225
- className,
226
- size = "md"
227
- }) {
228
- const textSizes = {
229
- sm: "text-xs",
230
- md: "text-sm",
231
- lg: "text-base"
232
- };
233
- return /* @__PURE__ */ jsx(
234
- "div",
235
- {
236
- className: cn(
237
- "bg-[linear-gradient(to_right,var(--muted-foreground)_40%,var(--foreground)_60%,var(--muted-foreground)_80%)]",
238
- "bg-[length:200%_auto] bg-clip-text font-medium text-transparent",
239
- "csdk-loader-shimmer",
240
- textSizes[size],
241
- className
242
- ),
243
- children: text
244
- }
245
- );
246
- }
247
- function TextDotsLoader({
248
- className,
249
- text = "Thinking",
250
- size = "md"
251
- }) {
252
- const textSizes = {
253
- sm: "text-xs",
254
- md: "text-sm",
255
- lg: "text-base"
256
- };
257
- return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center", className), children: [
258
- /* @__PURE__ */ jsx("span", { className: cn("text-primary font-medium", textSizes[size]), children: text }),
259
- /* @__PURE__ */ jsxs("span", { className: "inline-flex", children: [
260
- /* @__PURE__ */ jsx(
261
- "span",
262
- {
263
- className: "text-primary csdk-loader-loading-dots",
264
- style: { animationDelay: "0.2s" },
265
- children: "."
266
- }
267
- ),
268
- /* @__PURE__ */ jsx(
269
- "span",
270
- {
271
- className: "text-primary csdk-loader-loading-dots",
272
- style: { animationDelay: "0.4s" },
273
- children: "."
274
- }
275
- ),
276
- /* @__PURE__ */ jsx(
277
- "span",
278
- {
279
- className: "text-primary csdk-loader-loading-dots",
280
- style: { animationDelay: "0.6s" },
281
- children: "."
282
- }
283
- )
284
- ] })
285
- ] });
286
- }
287
- function Loader({
288
- variant = "typing",
289
- size = "md",
290
- text,
291
- className
292
- }) {
293
- switch (variant) {
294
- case "dots":
295
- return /* @__PURE__ */ jsx(DotsLoader, { size, className });
296
- case "typing":
297
- return /* @__PURE__ */ jsx(TypingLoader, { size, className });
298
- case "wave":
299
- return /* @__PURE__ */ jsx(WaveLoader, { size, className });
300
- case "terminal":
301
- return /* @__PURE__ */ jsx(TerminalLoader, { size, className });
302
- case "text-blink":
303
- return /* @__PURE__ */ jsx(TextBlinkLoader, { text, size, className });
304
- case "text-shimmer":
305
- return /* @__PURE__ */ jsx(TextShimmerLoader, { text, size, className });
306
- case "loading-dots":
307
- return /* @__PURE__ */ jsx(TextDotsLoader, { text, size, className });
308
- default:
309
- return /* @__PURE__ */ jsx(TypingLoader, { size, className });
310
- }
311
- }
312
35
  var createHeading = (Tag) => {
313
36
  const HeadingComponent = ({
314
37
  children,
@@ -718,9 +441,9 @@ var MessageContent = ({
718
441
  ...props
719
442
  }) => {
720
443
  const classNames = cn(
721
- "csdk-message-content rounded-lg p-2 break-words whitespace-normal max-w-full leading-relaxed overflow-x-auto overflow-y-hidden",
444
+ "csdk-message-content rounded-lg p-2 break-words whitespace-normal max-w-full overflow-x-auto overflow-y-hidden",
722
445
  // Typography - simple Tailwind utilities (no prose)
723
- "[&_p]:my-1 [&_p]:leading-relaxed",
446
+ "[&_p]:my-1 ",
724
447
  "[&_ul]:my-1 [&_ul]:pl-4 [&_ul]:list-disc [&_ul]:list-outside",
725
448
  "[&_ol]:my-1 [&_ol]:pl-4 [&_ol]:list-decimal [&_ol]:list-outside",
726
449
  "[&_li]:my-0.5 [&_li]:pl-0",
@@ -2424,7 +2147,10 @@ function Confirmation({
2424
2147
  "div",
2425
2148
  {
2426
2149
  className: cn(
2427
- "confirmation rounded-lg border bg-card text-card-foreground",
2150
+ "csdk-confirm-card",
2151
+ "confirmation rounded-2xl overflow-hidden",
2152
+ "border border-border/60",
2153
+ "bg-card text-card-foreground shadow-sm",
2428
2154
  className
2429
2155
  ),
2430
2156
  children
@@ -2439,7 +2165,7 @@ function ConfirmationPending({
2439
2165
  }) {
2440
2166
  const { state } = useConfirmationContext();
2441
2167
  if (state !== "pending") return null;
2442
- return /* @__PURE__ */ jsx("div", { className: cn("p-4", className), children });
2168
+ return /* @__PURE__ */ jsx("div", { className: cn("pl-5 pr-4 pt-4 pb-3", className), children });
2443
2169
  }
2444
2170
  function ConfirmationApproved({
2445
2171
  children,
@@ -2451,11 +2177,14 @@ function ConfirmationApproved({
2451
2177
  "div",
2452
2178
  {
2453
2179
  className: cn(
2454
- "flex items-center gap-2 px-4 py-2 text-sm text-green-600 dark:text-green-400",
2180
+ "csdk-confirm-result",
2181
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2182
+ "rounded-2xl border border-green-200/60 dark:border-green-800/40",
2183
+ "bg-green-50/80 dark:bg-green-950/20 text-green-700 dark:text-green-400",
2455
2184
  className
2456
2185
  ),
2457
2186
  children: [
2458
- /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }),
2187
+ /* @__PURE__ */ jsx(CheckIcon, { className: "h-3.5 w-3.5 shrink-0" }),
2459
2188
  children || /* @__PURE__ */ jsx("span", { children: "Approved" })
2460
2189
  ]
2461
2190
  }
@@ -2471,11 +2200,14 @@ function ConfirmationRejected({
2471
2200
  "div",
2472
2201
  {
2473
2202
  className: cn(
2474
- "flex items-center gap-2 px-4 py-2 text-sm text-red-600 dark:text-red-400",
2203
+ "csdk-confirm-result",
2204
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2205
+ "rounded-2xl border border-red-200/60 dark:border-red-800/40",
2206
+ "bg-red-50/80 dark:bg-red-950/20 text-red-700 dark:text-red-400",
2475
2207
  className
2476
2208
  ),
2477
2209
  children: [
2478
- /* @__PURE__ */ jsx(XIcon2, { className: "h-4 w-4" }),
2210
+ /* @__PURE__ */ jsx(XIcon2, { className: "h-3.5 w-3.5 shrink-0" }),
2479
2211
  children || /* @__PURE__ */ jsx("span", { children: "Rejected" })
2480
2212
  ]
2481
2213
  }
@@ -2487,8 +2219,8 @@ function ConfirmationMessage({
2487
2219
  }) {
2488
2220
  const { message } = useConfirmationContext();
2489
2221
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3", className), children: [
2490
- /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "mt-0.5 h-5 w-5 flex-shrink-0 text-amber-500" }),
2491
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: children || message || "This action requires your approval." })
2222
+ /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-amber-100 dark:bg-amber-950/50 ring-1 ring-amber-200/60 dark:ring-amber-800/40", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "h-4 w-4 text-amber-600 dark:text-amber-400" }) }),
2223
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 pt-0.5 text-sm text-foreground leading-snug", children: children || message || "This action requires your approval." })
2492
2224
  ] });
2493
2225
  }
2494
2226
  function ConfirmationActions({
@@ -2501,9 +2233,39 @@ function ConfirmationActions({
2501
2233
  if (children) {
2502
2234
  return /* @__PURE__ */ jsx("div", { className: cn("mt-3 flex justify-end gap-2", className), children });
2503
2235
  }
2504
- return /* @__PURE__ */ jsxs("div", { className: cn("mt-3 flex justify-end gap-2", className), children: [
2505
- /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onReject, children: rejectLabel }),
2506
- /* @__PURE__ */ jsx(Button, { variant: "default", size: "sm", onClick: onApprove, children: approveLabel })
2236
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2237
+ /* @__PURE__ */ jsx("div", { className: "mx-0 border-t border-border/40 mt-3" }),
2238
+ /* @__PURE__ */ jsxs("div", { className: cn("flex justify-end gap-2 pt-3", className), children: [
2239
+ /* @__PURE__ */ jsx(
2240
+ "button",
2241
+ {
2242
+ type: "button",
2243
+ onClick: onReject,
2244
+ className: cn(
2245
+ "csdk-confirm-btn",
2246
+ "px-4 py-1.5 text-sm font-medium rounded-xl",
2247
+ "border border-border/80 bg-transparent text-muted-foreground",
2248
+ "hover:bg-muted/80 hover:text-foreground hover:border-border"
2249
+ ),
2250
+ children: rejectLabel
2251
+ }
2252
+ ),
2253
+ /* @__PURE__ */ jsx(
2254
+ "button",
2255
+ {
2256
+ type: "button",
2257
+ onClick: onApprove,
2258
+ className: cn(
2259
+ "csdk-confirm-btn",
2260
+ "px-4 py-1.5 text-sm font-medium rounded-xl",
2261
+ "bg-primary text-primary-foreground",
2262
+ "hover:bg-primary/90",
2263
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
2264
+ ),
2265
+ children: approveLabel
2266
+ }
2267
+ )
2268
+ ] })
2507
2269
  ] });
2508
2270
  }
2509
2271
  function SimpleConfirmation({
@@ -2582,9 +2344,9 @@ function PermissionConfirmation({
2582
2344
  {
2583
2345
  className: cn(
2584
2346
  "csdk-confirm-result",
2585
- "inline-flex items-center gap-2 px-3 py-1.5 text-sm",
2586
- "rounded-2xl border border-green-200/70 dark:border-green-900/40",
2587
- "bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
2347
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2348
+ "rounded-2xl border border-green-200/60 dark:border-green-800/40",
2349
+ "bg-green-50/80 dark:bg-green-950/20 text-green-700 dark:text-green-400",
2588
2350
  className
2589
2351
  ),
2590
2352
  children: [
@@ -2600,9 +2362,9 @@ function PermissionConfirmation({
2600
2362
  {
2601
2363
  className: cn(
2602
2364
  "csdk-confirm-result",
2603
- "inline-flex items-center gap-2 px-3 py-1.5 text-sm",
2604
- "rounded-2xl border border-red-200/70 dark:border-red-900/40",
2605
- "bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
2365
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2366
+ "rounded-2xl border border-red-200/60 dark:border-red-800/40",
2367
+ "bg-red-50/80 dark:bg-red-950/20 text-red-700 dark:text-red-400",
2606
2368
  className
2607
2369
  ),
2608
2370
  children: [
@@ -2617,18 +2379,21 @@ function PermissionConfirmation({
2617
2379
  {
2618
2380
  className: cn(
2619
2381
  "csdk-confirm-card",
2620
- "w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
2382
+ "w-full rounded-2xl overflow-hidden",
2383
+ "border border-border/60",
2384
+ "bg-card text-card-foreground shadow-sm",
2621
2385
  className
2622
2386
  ),
2623
2387
  children: [
2624
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4", children: [
2625
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-xl bg-amber-100 dark:bg-amber-950/50", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
2388
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4 pb-3", children: [
2389
+ /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-muted", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "h-4 w-4 text-amber-600 dark:text-amber-400" }) }),
2626
2390
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 pt-0.5", children: [
2627
- toolName && /* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold uppercase tracking-widest text-muted-foreground mb-1", children: toolName }),
2391
+ toolName && /* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold uppercase tracking-widest text-amber-600/80 dark:text-amber-400/70 mb-1", children: toolName }),
2628
2392
  /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground leading-snug", children: message || "This tool requires your approval to execute." })
2629
2393
  ] })
2630
2394
  ] }),
2631
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
2395
+ /* @__PURE__ */ jsx("div", { className: "mx-4 border-t border-border/40" }),
2396
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 py-3", children: [
2632
2397
  /* @__PURE__ */ jsx(
2633
2398
  "button",
2634
2399
  {
@@ -2637,8 +2402,8 @@ function PermissionConfirmation({
2637
2402
  className: cn(
2638
2403
  "csdk-confirm-btn",
2639
2404
  "px-4 py-1.5 text-sm font-medium rounded-xl",
2640
- "border border-border bg-transparent text-muted-foreground",
2641
- "hover:bg-muted/60 hover:text-foreground"
2405
+ "border border-border/80 bg-transparent text-muted-foreground",
2406
+ "hover:bg-muted/80 hover:text-foreground hover:border-border"
2642
2407
  ),
2643
2408
  children: "Deny"
2644
2409
  }
@@ -2652,7 +2417,8 @@ function PermissionConfirmation({
2652
2417
  "csdk-confirm-btn",
2653
2418
  "px-4 py-1.5 text-sm font-medium rounded-xl",
2654
2419
  "bg-primary text-primary-foreground",
2655
- "hover:opacity-90"
2420
+ "hover:bg-primary/90",
2421
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
2656
2422
  ),
2657
2423
  children: "Allow"
2658
2424
  }
@@ -2681,9 +2447,9 @@ function CompactPermissionConfirmation({
2681
2447
  {
2682
2448
  className: cn(
2683
2449
  "csdk-confirm-result",
2684
- "inline-flex items-center gap-2 px-3 py-1.5 text-sm",
2685
- "rounded-2xl border border-green-200/70 dark:border-green-900/40",
2686
- "bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
2450
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2451
+ "rounded-2xl border border-green-200/60 dark:border-green-800/40",
2452
+ "bg-green-50/80 dark:bg-green-950/20 text-green-700 dark:text-green-400",
2687
2453
  className
2688
2454
  ),
2689
2455
  children: [
@@ -2699,9 +2465,9 @@ function CompactPermissionConfirmation({
2699
2465
  {
2700
2466
  className: cn(
2701
2467
  "csdk-confirm-result",
2702
- "inline-flex items-center gap-2 px-3 py-1.5 text-sm",
2703
- "rounded-2xl border border-red-200/70 dark:border-red-900/40",
2704
- "bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
2468
+ "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium",
2469
+ "rounded-2xl border border-red-200/60 dark:border-red-800/40",
2470
+ "bg-red-50/80 dark:bg-red-950/20 text-red-700 dark:text-red-400",
2705
2471
  className
2706
2472
  ),
2707
2473
  children: [
@@ -2716,15 +2482,18 @@ function CompactPermissionConfirmation({
2716
2482
  {
2717
2483
  className: cn(
2718
2484
  "csdk-confirm-card",
2719
- "w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
2485
+ "w-full rounded-2xl overflow-hidden",
2486
+ "border border-border/60",
2487
+ "bg-card text-card-foreground shadow-sm",
2720
2488
  className
2721
2489
  ),
2722
2490
  children: [
2723
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4", children: [
2724
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-xl bg-amber-100 dark:bg-amber-950/50", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
2491
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4 pb-3", children: [
2492
+ /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-muted", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "h-4 w-4 text-amber-600 dark:text-amber-400" }) }),
2725
2493
  /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 pt-0.5 text-sm text-foreground leading-snug", children: message || "This action requires your approval." })
2726
2494
  ] }),
2727
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
2495
+ /* @__PURE__ */ jsx("div", { className: "mx-4 border-t border-border/40" }),
2496
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 py-3", children: [
2728
2497
  /* @__PURE__ */ jsx(
2729
2498
  "button",
2730
2499
  {
@@ -2733,8 +2502,8 @@ function CompactPermissionConfirmation({
2733
2502
  className: cn(
2734
2503
  "csdk-confirm-btn",
2735
2504
  "px-4 py-1.5 text-sm font-medium rounded-xl",
2736
- "border border-border bg-transparent text-muted-foreground",
2737
- "hover:bg-muted/60 hover:text-foreground"
2505
+ "border border-border/80 bg-transparent text-muted-foreground",
2506
+ "hover:bg-muted/80 hover:text-foreground hover:border-border"
2738
2507
  ),
2739
2508
  children: "Deny"
2740
2509
  }
@@ -2748,7 +2517,8 @@ function CompactPermissionConfirmation({
2748
2517
  "csdk-confirm-btn",
2749
2518
  "px-4 py-1.5 text-sm font-medium rounded-xl",
2750
2519
  "bg-primary text-primary-foreground",
2751
- "hover:opacity-90"
2520
+ "hover:bg-primary/90",
2521
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
2752
2522
  ),
2753
2523
  children: "Allow"
2754
2524
  }
@@ -2930,12 +2700,12 @@ function DevLogger({
2930
2700
  isOpen && /* @__PURE__ */ jsx(
2931
2701
  "div",
2932
2702
  {
2933
- className: "fixed inset-0 z-[10000] flex items-center justify-center bg-black/50",
2703
+ className: "csdk-devlogger-backdrop fixed inset-0 z-[10000] flex items-center justify-center bg-black/50",
2934
2704
  onClick: () => setIsOpen(false),
2935
2705
  children: /* @__PURE__ */ jsxs(
2936
2706
  "div",
2937
2707
  {
2938
- className: "bg-background border rounded-lg shadow-xl w-[600px] max-h-[80vh] overflow-hidden",
2708
+ className: "csdk-devlogger-modal bg-background border rounded-lg shadow-xl w-[600px] max-h-[80vh] overflow-hidden",
2939
2709
  onClick: (e) => e.stopPropagation(),
2940
2710
  children: [
2941
2711
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b bg-muted/50", children: [
@@ -3398,7 +3168,7 @@ function ModelSelector({
3398
3168
  "div",
3399
3169
  {
3400
3170
  className: cn(
3401
- "absolute z-50 top-full left-0 right-0 mt-1",
3171
+ "csdk-model-dropdown absolute z-50 top-full left-0 right-0 mt-1",
3402
3172
  "max-h-[300px] overflow-auto",
3403
3173
  "rounded-md border bg-popover text-popover-foreground shadow-md",
3404
3174
  "animate-in fade-in-0 zoom-in-95"
@@ -4258,7 +4028,7 @@ function MCPUIFrame({
4258
4028
  "data-testid": testId,
4259
4029
  children: [
4260
4030
  resource.metadata?.title && /* @__PURE__ */ jsx("div", { className: "border-b bg-muted/50 px-3 py-1.5 text-xs font-medium text-muted-foreground", children: resource.metadata.title }),
4261
- showLoading && isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "md" }) }),
4031
+ showLoading && isLoading && /* @__PURE__ */ jsx("div", { className: "csdk-mcp-loading absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "md" }) }),
4262
4032
  /* @__PURE__ */ jsx(
4263
4033
  "iframe",
4264
4034
  {
@@ -4332,13 +4102,11 @@ function MessageActionsProvider({
4332
4102
  (role) => registry[role] ?? [],
4333
4103
  [registry]
4334
4104
  );
4335
- return /* @__PURE__ */ jsx(
4336
- MessageActionsContext.Provider,
4337
- {
4338
- value: { getActions, registerActions, clearActions },
4339
- children
4340
- }
4105
+ const contextValue = useMemo(
4106
+ () => ({ getActions, registerActions, clearActions }),
4107
+ [getActions, registerActions, clearActions]
4341
4108
  );
4109
+ return /* @__PURE__ */ jsx(MessageActionsContext.Provider, { value: contextValue, children });
4342
4110
  }
4343
4111
  function useMessageActionsContext() {
4344
4112
  return useContext(MessageActionsContext);
@@ -4464,6 +4232,8 @@ function Action({
4464
4232
  Action.displayName = "Action";
4465
4233
  function MessageActions2({ role, children }) {
4466
4234
  const ctx = useMessageActionsContext();
4235
+ const ctxRef = useRef(ctx);
4236
+ ctxRef.current = ctx;
4467
4237
  const actions = useMemo(() => {
4468
4238
  const result = [];
4469
4239
  React19__default.Children.forEach(children, (child) => {
@@ -4522,10 +4292,11 @@ function MessageActions2({ role, children }) {
4522
4292
  return result;
4523
4293
  }, [children]);
4524
4294
  useLayoutEffect(() => {
4525
- if (!ctx) return;
4526
- ctx.registerActions(role, actions);
4527
- return () => ctx.clearActions(role);
4528
- }, [ctx, role, actions]);
4295
+ const c = ctxRef.current;
4296
+ if (!c) return;
4297
+ c.registerActions(role, actions);
4298
+ return () => c.clearActions(role);
4299
+ }, [role, actions]);
4529
4300
  return null;
4530
4301
  }
4531
4302
  function FloatingActions({
@@ -4741,7 +4512,9 @@ function DefaultMessage({
4741
4512
  return /* @__PURE__ */ jsxs(
4742
4513
  Message,
4743
4514
  {
4744
- className: cn("flex gap-2 group/user-msg group/message justify-end"),
4515
+ className: cn(
4516
+ "csdk-message csdk-user-message flex gap-2 group/user-msg group/message justify-end"
4517
+ ),
4745
4518
  children: [
4746
4519
  /* @__PURE__ */ jsx("div", { className: "flex flex-col items-end max-w-[80%] min-w-0", children: isEditing ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 w-full min-w-[200px]", children: [
4747
4520
  /* @__PURE__ */ jsx(
@@ -4904,7 +4677,7 @@ function DefaultMessage({
4904
4677
  result: exec.result,
4905
4678
  error: exec.error
4906
4679
  }));
4907
- return /* @__PURE__ */ jsxs(Message, { className: "flex gap-2 group/message", children: [
4680
+ return /* @__PURE__ */ jsxs(Message, { className: "csdk-message csdk-assistant-message flex gap-2 group/message", children: [
4908
4681
  /* @__PURE__ */ jsx(
4909
4682
  MessageAvatar,
4910
4683
  {
@@ -4983,10 +4756,10 @@ function DefaultMessage({
4983
4756
  exec.id
4984
4757
  );
4985
4758
  }
4986
- if (fallbackToolRenderer) {
4987
- const FallbackRenderer = fallbackToolRenderer;
4759
+ const Renderer = toolRenderers?.[exec.name];
4760
+ if (Renderer) {
4988
4761
  return /* @__PURE__ */ jsx(
4989
- FallbackRenderer,
4762
+ Renderer,
4990
4763
  {
4991
4764
  execution: {
4992
4765
  id: exec.id,
@@ -4995,16 +4768,17 @@ function DefaultMessage({
4995
4768
  status: exec.status,
4996
4769
  result: exec.result,
4997
4770
  error: exec.error,
4771
+ approvalStatus: exec.approvalStatus,
4998
4772
  source: exec.source
4999
4773
  }
5000
4774
  },
5001
4775
  exec.id
5002
4776
  );
5003
4777
  }
5004
- const Renderer = toolRenderers?.[exec.name];
5005
- if (Renderer) {
4778
+ if (fallbackToolRenderer) {
4779
+ const FallbackRenderer = fallbackToolRenderer;
5006
4780
  return /* @__PURE__ */ jsx(
5007
- Renderer,
4781
+ FallbackRenderer,
5008
4782
  {
5009
4783
  execution: {
5010
4784
  id: exec.id,
@@ -5013,7 +4787,6 @@ function DefaultMessage({
5013
4787
  status: exec.status,
5014
4788
  result: exec.result,
5015
4789
  error: exec.error,
5016
- approvalStatus: exec.approvalStatus,
5017
4790
  source: exec.source
5018
4791
  }
5019
4792
  },
@@ -5163,7 +4936,7 @@ function AttachmentPreview({ attachment }) {
5163
4936
  expanded && /* @__PURE__ */ jsx(
5164
4937
  "div",
5165
4938
  {
5166
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80",
4939
+ className: "csdk-image-backdrop fixed inset-0 z-50 flex items-center justify-center bg-black/80",
5167
4940
  onClick: () => setExpanded(false),
5168
4941
  children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-[90vw] max-h-[90vh]", children: [
5169
4942
  /* @__PURE__ */ jsx(
@@ -5178,7 +4951,7 @@ function AttachmentPreview({ attachment }) {
5178
4951
  "button",
5179
4952
  {
5180
4953
  type: "button",
5181
- className: "absolute top-2 right-2 bg-white/90 rounded-full p-2 hover:bg-white transition-colors",
4954
+ className: "csdk-image-close absolute top-2 right-2 bg-white/90 rounded-full p-2 hover:bg-white transition-colors",
5182
4955
  onClick: (e) => {
5183
4956
  e.stopPropagation();
5184
4957
  setExpanded(false);
@@ -5444,8 +5217,8 @@ function ChatWelcome({
5444
5217
  ),
5445
5218
  /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground truncate w-full text-center mt-1", children: att.file.name.length > 10 ? att.file.name.slice(0, 8) + "..." : att.file.name })
5446
5219
  ] }),
5447
- att.status === "processing" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/80 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "sm" }) }),
5448
- att.status === "error" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-destructive/20 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-destructive text-xs", children: "Error" }) }),
5220
+ att.status === "processing" && /* @__PURE__ */ jsx("div", { className: "csdk-attachment-loading absolute inset-0 bg-background/80 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "sm" }) }),
5221
+ att.status === "error" && /* @__PURE__ */ jsx("div", { className: "csdk-attachment-error absolute inset-0 bg-destructive/20 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-destructive text-xs", children: "Error" }) }),
5449
5222
  /* @__PURE__ */ jsx(
5450
5223
  "button",
5451
5224
  {
@@ -5825,6 +5598,7 @@ function ChatComponent({
5825
5598
  // Custom rendering
5826
5599
  messageView,
5827
5600
  renderMessage,
5601
+ wrapMessage,
5828
5602
  renderInput,
5829
5603
  renderHeader,
5830
5604
  // Avatar grouping
@@ -6006,6 +5780,11 @@ function ChatComponent({
6006
5780
  Home,
6007
5781
  ChatView
6008
5782
  );
5783
+ const layoutTypes = [HomeView, Home, ChatView, Header, Footer];
5784
+ const behaviorChildren = React19__default.Children.toArray(children).filter(
5785
+ (child) => React19__default.isValidElement(child) && // eslint-disable-next-line @typescript-eslint/no-explicit-any
5786
+ !layoutTypes.includes(child.type)
5787
+ );
6009
5788
  const chatViewElement = findCompoundChild(children, ChatView);
6010
5789
  const chatViewNeedsDefault = chatViewElement && (!chatViewElement.props.children || chatViewHasOnlyLayoutChildren(chatViewElement));
6011
5790
  const showDefaultWelcome = view === "home" && !hasCustomHome && welcome !== false;
@@ -6064,7 +5843,7 @@ function ChatComponent({
6064
5843
  onDragLeave: handleDragLeave,
6065
5844
  onDrop: handleDrop,
6066
5845
  children: [
6067
- isDragging && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-50 bg-primary/10 border-2 border-dashed border-primary flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "text-primary font-medium text-lg", children: "Drop files here" }) }),
5846
+ isDragging && /* @__PURE__ */ jsx("div", { className: "csdk-dropzone-overlay absolute inset-0 z-50 bg-primary/10 border-2 border-dashed border-primary flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "text-primary font-medium text-lg", children: "Drop files here" }) }),
6068
5847
  showHeader && (renderHeader ? renderHeader() : /* @__PURE__ */ jsx(
6069
5848
  ChatHeader,
6070
5849
  {
@@ -6077,6 +5856,7 @@ function ChatComponent({
6077
5856
  }
6078
5857
  )),
6079
5858
  rootHeader,
5859
+ behaviorChildren.length > 0 && behaviorChildren,
6080
5860
  hasCustomLayout && viewChildren,
6081
5861
  showDefaultWelcome ? (
6082
5862
  /* Default Welcome Screen (centered input) */
@@ -6163,7 +5943,10 @@ function ChatComponent({
6163
5943
  onSendMessage?.(question);
6164
5944
  }
6165
5945
  };
6166
- return renderMessage ? /* @__PURE__ */ jsx(React19__default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id) : /* @__PURE__ */ jsx(
5946
+ if (renderMessage) {
5947
+ return /* @__PURE__ */ jsx(React19__default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id);
5948
+ }
5949
+ const defaultMsg = /* @__PURE__ */ jsx(
6167
5950
  DefaultMessage,
6168
5951
  {
6169
5952
  message: messageWithExecutions,
@@ -6194,6 +5977,11 @@ function ChatComponent({
6194
5977
  },
6195
5978
  message.id
6196
5979
  );
5980
+ return wrapMessage ? /* @__PURE__ */ jsx(React19__default.Fragment, { children: wrapMessage(
5981
+ defaultMsg,
5982
+ messageWithExecutions,
5983
+ index
5984
+ ) }, message.id) : defaultMsg;
6197
5985
  });
6198
5986
  return messageView?.children ? messageView.children({ messages, messageElements }) : messageElements;
6199
5987
  })(),
@@ -6219,7 +6007,7 @@ function ChatComponent({
6219
6007
  ]
6220
6008
  }
6221
6009
  ),
6222
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 pointer-events-none z-10 flex items-end justify-end p-4", children: /* @__PURE__ */ jsx(ScrollButton, { className: "shadow-md pointer-events-auto" }) })
6010
+ /* @__PURE__ */ jsx("div", { className: "csdk-scroll-btn-layer absolute inset-0 pointer-events-none z-10 flex items-end justify-end p-4", children: /* @__PURE__ */ jsx(ScrollButton, { className: "shadow-md pointer-events-auto" }) })
6223
6011
  ]
6224
6012
  }
6225
6013
  ) }),
@@ -6261,8 +6049,8 @@ function ChatComponent({
6261
6049
  ),
6262
6050
  /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground truncate w-full text-center mt-1", children: att.file.name.length > 10 ? att.file.name.slice(0, 8) + "..." : att.file.name })
6263
6051
  ] }),
6264
- att.status === "processing" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/80 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "sm" }) }),
6265
- att.status === "error" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-destructive/20 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-destructive text-xs", children: "Error" }) }),
6052
+ att.status === "processing" && /* @__PURE__ */ jsx("div", { className: "csdk-attachment-loading absolute inset-0 bg-background/80 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader, { variant: "dots", size: "sm" }) }),
6053
+ att.status === "error" && /* @__PURE__ */ jsx("div", { className: "csdk-attachment-error absolute inset-0 bg-destructive/20 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-destructive text-xs", children: "Error" }) }),
6266
6054
  /* @__PURE__ */ jsx(
6267
6055
  "button",
6268
6056
  {
@@ -6551,7 +6339,14 @@ function useInternalThreadManager(config = {}) {
6551
6339
  clearCurrentThread,
6552
6340
  refreshThreads
6553
6341
  } = threadManager;
6554
- const { messages, setMessages, status, isLoading, getAllMessages } = useCopilot();
6342
+ const {
6343
+ messages,
6344
+ setMessages,
6345
+ status,
6346
+ isLoading,
6347
+ getAllMessages,
6348
+ switchBranch
6349
+ } = useCopilot();
6555
6350
  const isLoadingMessagesRef = useRef(false);
6556
6351
  const savingToThreadRef = useRef(null);
6557
6352
  const lastSavedSnapshotRef = useRef("");
@@ -6594,11 +6389,17 @@ function useInternalThreadManager(config = {}) {
6594
6389
  toolCallId: m.tool_call_id,
6595
6390
  parentId: m.parent_id,
6596
6391
  childrenIds: m.children_ids,
6597
- attachments: m.metadata?.attachments
6392
+ attachments: m.metadata?.attachments,
6393
+ thinking: m.metadata?.thinking,
6394
+ // Preserve full metadata including citations, toolCallsHidden, toolExecutions, etc.
6395
+ metadata: m.metadata
6598
6396
  }));
6599
6397
  lastSavedSnapshotRef.current = getMessageSnapshot(uiMessages);
6600
6398
  savingToThreadRef.current = threadId;
6601
6399
  setMessages(uiMessages);
6400
+ if (thread.activeLeafId) {
6401
+ switchBranch(thread.activeLeafId);
6402
+ }
6602
6403
  } else {
6603
6404
  lastSavedSnapshotRef.current = "";
6604
6405
  savingToThreadRef.current = threadId;
@@ -6609,7 +6410,13 @@ function useInternalThreadManager(config = {}) {
6609
6410
  isLoadingMessagesRef.current = false;
6610
6411
  });
6611
6412
  },
6612
- [switchThread, setMessages, getMessageSnapshot, onThreadChange]
6413
+ [
6414
+ switchThread,
6415
+ setMessages,
6416
+ switchBranch,
6417
+ getMessageSnapshot,
6418
+ onThreadChange
6419
+ ]
6613
6420
  );
6614
6421
  const handleNewThread = useCallback(async () => {
6615
6422
  isLoadingMessagesRef.current = true;
@@ -6647,6 +6454,9 @@ function useInternalThreadManager(config = {}) {
6647
6454
  lastSavedSnapshotRef.current = getMessageSnapshot(uiMessages);
6648
6455
  savingToThreadRef.current = currentThread.id;
6649
6456
  setMessages(uiMessages);
6457
+ if (currentThread.activeLeafId) {
6458
+ switchBranch(currentThread.activeLeafId);
6459
+ }
6650
6460
  } else {
6651
6461
  lastSavedSnapshotRef.current = "";
6652
6462
  savingToThreadRef.current = currentThread.id;
@@ -6655,7 +6465,15 @@ function useInternalThreadManager(config = {}) {
6655
6465
  requestAnimationFrame(() => {
6656
6466
  isLoadingMessagesRef.current = false;
6657
6467
  });
6658
- }, [enabled, adapter, currentThread, setMessages, getMessageSnapshot, onThreadChange]);
6468
+ }, [
6469
+ enabled,
6470
+ adapter,
6471
+ currentThread,
6472
+ setMessages,
6473
+ switchBranch,
6474
+ getMessageSnapshot,
6475
+ onThreadChange
6476
+ ]);
6659
6477
  useEffect(() => {
6660
6478
  if (!enabled) return;
6661
6479
  if (isLoadingMessagesRef.current) {
@@ -6675,9 +6493,10 @@ function useInternalThreadManager(config = {}) {
6675
6493
  const coreMessages = convertToCore(
6676
6494
  allUIMessages.length > 0 ? allUIMessages : messages
6677
6495
  );
6496
+ const activeLeafId = messages[messages.length - 1]?.id;
6678
6497
  if (!currentThreadId && !savingToThreadRef.current) {
6679
6498
  savingToThreadRef.current = "creating";
6680
- createThread({ messages: coreMessages }).then((thread) => {
6499
+ createThread({ messages: coreMessages, activeLeafId }).then((thread) => {
6681
6500
  lastSavedSnapshotRef.current = currentSnapshot;
6682
6501
  savingToThreadRef.current = thread.id;
6683
6502
  onThreadChange?.(thread.id);
@@ -6687,7 +6506,7 @@ function useInternalThreadManager(config = {}) {
6687
6506
  if (savingToThreadRef.current && savingToThreadRef.current !== currentThreadId) {
6688
6507
  return;
6689
6508
  }
6690
- updateCurrentThread({ messages: coreMessages });
6509
+ updateCurrentThread({ messages: coreMessages, activeLeafId });
6691
6510
  lastSavedSnapshotRef.current = currentSnapshot;
6692
6511
  }, [
6693
6512
  enabled,
@@ -6765,6 +6584,7 @@ function CopilotChatBase(props) {
6765
6584
  classNames,
6766
6585
  header,
6767
6586
  children,
6587
+ allowEdit = false,
6768
6588
  ...chatProps
6769
6589
  } = props;
6770
6590
  const persistenceConfig = parsePersistenceConfig(persistence, onThreadChange);
@@ -6825,7 +6645,7 @@ function CopilotChatBase(props) {
6825
6645
  } catch {
6826
6646
  return {
6827
6647
  ...exec,
6828
- result: { success: true, message: resultContent }
6648
+ result: { success: false, message: resultContent }
6829
6649
  };
6830
6650
  }
6831
6651
  }
@@ -6842,7 +6662,7 @@ function CopilotChatBase(props) {
6842
6662
  try {
6843
6663
  result = JSON.parse(resultContent);
6844
6664
  } catch {
6845
- result = { success: true, message: resultContent };
6665
+ result = { success: false, message: resultContent };
6846
6666
  }
6847
6667
  }
6848
6668
  let args = {};
@@ -6863,8 +6683,7 @@ function CopilotChatBase(props) {
6863
6683
  args,
6864
6684
  status: result ? "completed" : "pending",
6865
6685
  result,
6866
- timestamp: Date.now(),
6867
- // Historical - use current time
6686
+ timestamp: m.createdAt instanceof Date ? m.createdAt.getTime() : Date.now(),
6868
6687
  hidden
6869
6688
  };
6870
6689
  }
@@ -6997,7 +6816,7 @@ function CopilotChatBase(props) {
6997
6816
  isThreadBusy: isBusy,
6998
6817
  getBranchInfo,
6999
6818
  onSwitchBranch: switchBranch,
7000
- onEditMessage: editMessage,
6819
+ onEditMessage: allowEdit ? editMessage : void 0,
7001
6820
  children
7002
6821
  }
7003
6822
  );
@@ -7016,8 +6835,14 @@ var CopilotChat = Object.assign(CopilotChatBase, {
7016
6835
  Suggestions: Chat.Suggestions,
7017
6836
  BackButton: Chat.BackButton,
7018
6837
  // Navigation: start new chat
7019
- ThreadPicker: Chat.ThreadPicker
6838
+ ThreadPicker: Chat.ThreadPicker,
7020
6839
  // Thread switching
6840
+ // Message actions compound components (alpha)
6841
+ MessageActions: Chat.MessageActions,
6842
+ CopyAction: Chat.CopyAction,
6843
+ EditAction: Chat.EditAction,
6844
+ FeedbackAction: Chat.FeedbackAction,
6845
+ Action: Chat.Action
7021
6846
  });
7022
6847
  var ConnectedChat = CopilotChat;
7023
6848
  function YourGPTLogo({ className }) {
@@ -7098,6 +6923,6 @@ var ChatPrimitives = {
7098
6923
  Loader
7099
6924
  };
7100
6925
 
7101
- export { AlertTriangleIcon, BotIcon, BranchNavigator, Button, CapabilityBadge, CapabilityList, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, ChatPrimitives, ChatWelcome, CheckIcon, ChevronDownIcon2 as ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, CitationBadge, CitationSuperscript, CloseIcon, CodeBlock, CompactPermissionConfirmation, Confirmation, ConfirmationActions, ConfirmationApproved, ConfirmationMessage, ConfirmationPending, ConfirmationRejected, ConnectedChat, CopilotChat, CopilotUIProvider, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, FeedbackBar, FollowUpQuestions, InlineToolSteps, Loader, MCPUIFrame, MCPUIFrameList, Markdown, MessageAvatar, MessageContent, Message as MessagePrimitive, MessageWithCitations, ModelSelector, PermissionConfirmation, PoweredBy, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, Reasoning, ReasoningContent, ReasoningTrigger, RefreshIcon, ScrollButton, SearchAnswer, SearchResults, SearchResultsWithAnswer, SendIcon, SimpleConfirmation, SimpleModelSelector, SimpleReasoning, SimpleSource, Source, SourceContent, SourceGroup, SourcePill, SourceTrigger, SourcesBar, SourcesCollapsible, SourcesList, StopIcon, ThreadCard, ThreadList, ThreadPicker, ThumbsDownIcon2 as ThumbsDownIcon, ThumbsUpIcon2 as ThumbsUpIcon, ToolExecutionMessage, ToolStep, ToolSteps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserIcon, XIcon2 as XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useChatContainer, useCopilotChatContext, useCopilotUI };
6926
+ export { AlertTriangleIcon, BotIcon, BranchNavigator, Button, CapabilityBadge, CapabilityList, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, ChatPrimitives, ChatWelcome, CheckIcon, ChevronDownIcon2 as ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, CitationBadge, CitationSuperscript, CloseIcon, CodeBlock, CompactPermissionConfirmation, Confirmation, ConfirmationActions, ConfirmationApproved, ConfirmationMessage, ConfirmationPending, ConfirmationRejected, ConnectedChat, CopilotChat, CopilotUIProvider, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, FeedbackBar, FollowUpQuestions, InlineToolSteps, MCPUIFrame, MCPUIFrameList, Markdown, MessageAvatar, MessageContent, Message as MessagePrimitive, MessageWithCitations, ModelSelector, PermissionConfirmation, PoweredBy, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, Reasoning, ReasoningContent, ReasoningTrigger, RefreshIcon, ScrollButton, SearchAnswer, SearchResults, SearchResultsWithAnswer, SendIcon, SimpleConfirmation, SimpleModelSelector, SimpleReasoning, SimpleSource, Source, SourceContent, SourceGroup, SourcePill, SourceTrigger, SourcesBar, SourcesCollapsible, SourcesList, StopIcon, ThreadCard, ThreadList, ThreadPicker, ThumbsDownIcon2 as ThumbsDownIcon, ThumbsUpIcon2 as ThumbsUpIcon, ToolExecutionMessage, ToolStep, ToolSteps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserIcon, XIcon2 as XIcon, annotationsToCitations, parseFollowUps, resultsToCitations, useChatContainer, useCopilotChatContext, useCopilotUI };
7102
6927
  //# sourceMappingURL=index.js.map
7103
6928
  //# sourceMappingURL=index.js.map