@agents24/chat-react 0.5.3 → 0.5.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.
- package/README.md +8 -2
- package/compatibility.json +9 -9
- package/dist/runtime/index.cjs +114 -11
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +112 -11
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/use-agent-chat-runtime.d.ts +10 -0
- package/dist/scaffold/app.d.ts +1 -0
- package/dist/scaffold/components/chat/chat-composer.d.ts +8 -1
- package/dist/scaffold/components/chat/chat-shell.d.ts +3 -1
- package/dist/scaffold/index.cjs +365 -233
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.js +348 -216
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +4 -2
- package/dist/ui/index.cjs +6 -2
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +6 -2
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/scaffold/src/app.tsx +2 -1
- package/scaffold/src/chat.css +13 -1
- package/scaffold/src/components/chat/chat-composer.tsx +65 -9
- package/scaffold/src/components/chat/chat-shell.tsx +14 -4
- package/scaffold/src/components/ui/button.tsx +1 -1
- package/scaffold/src/components/ui/dropdown-menu.tsx +1 -1
- package/scaffold/src/components/ui/sidebar.tsx +4 -4
package/dist/scaffold/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var import_runtime2 = require("@agents24/chat-react/runtime");
|
|
|
46
46
|
var import_lucide_react12 = require("lucide-react");
|
|
47
47
|
|
|
48
48
|
// scaffold/src/components/chat/chat-composer.tsx
|
|
49
|
-
var
|
|
49
|
+
var import_lucide_react3 = require("lucide-react");
|
|
50
50
|
var React2 = __toESM(require("react"), 1);
|
|
51
51
|
var import_ui = require("@agents24/chat-react/ui");
|
|
52
52
|
var import_runtime = require("@agents24/chat-react/runtime");
|
|
@@ -65,7 +65,7 @@ function cn(...inputs) {
|
|
|
65
65
|
// scaffold/src/components/ui/button.tsx
|
|
66
66
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
67
67
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
68
|
-
"group/button inline-flex shrink-0 items-center justify-center rounded-4xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none
|
|
68
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-4xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
69
69
|
{
|
|
70
70
|
variants: {
|
|
71
71
|
variant: {
|
|
@@ -113,9 +113,9 @@ function Button({
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
// scaffold/src/components/ui/
|
|
117
|
-
var import_lucide_react = require("lucide-react");
|
|
116
|
+
// scaffold/src/components/ui/dropdown-menu.tsx
|
|
118
117
|
var import_radix_ui2 = require("radix-ui");
|
|
118
|
+
var import_lucide_react = require("lucide-react");
|
|
119
119
|
|
|
120
120
|
// scaffold/src/components/theme-provider.tsx
|
|
121
121
|
var React = __toESM(require("react"), 1);
|
|
@@ -185,21 +185,196 @@ function useThemePortalContainer() {
|
|
|
185
185
|
return useTheme().portalContainer;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
// scaffold/src/components/ui/
|
|
188
|
+
// scaffold/src/components/ui/dropdown-menu.tsx
|
|
189
189
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
190
|
+
function DropdownMenu({
|
|
191
|
+
...props
|
|
192
|
+
}) {
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.DropdownMenu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
194
|
+
}
|
|
195
|
+
function DropdownMenuTrigger({
|
|
196
|
+
...props
|
|
197
|
+
}) {
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
199
|
+
import_radix_ui2.DropdownMenu.Trigger,
|
|
200
|
+
{
|
|
201
|
+
"data-slot": "dropdown-menu-trigger",
|
|
202
|
+
...props
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
function DropdownMenuContent({
|
|
207
|
+
className,
|
|
208
|
+
align = "start",
|
|
209
|
+
sideOffset = 4,
|
|
210
|
+
...props
|
|
211
|
+
}) {
|
|
212
|
+
const themeContainer = useThemePortalContainer();
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.DropdownMenu.Portal, { container: themeContainer || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
214
|
+
import_radix_ui2.DropdownMenu.Content,
|
|
215
|
+
{
|
|
216
|
+
"data-slot": "dropdown-menu-content",
|
|
217
|
+
sideOffset,
|
|
218
|
+
align,
|
|
219
|
+
className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-48 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-3xl bg-popover p-1.5 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
220
|
+
...props
|
|
221
|
+
}
|
|
222
|
+
) });
|
|
223
|
+
}
|
|
224
|
+
function DropdownMenuItem({
|
|
225
|
+
className,
|
|
226
|
+
inset,
|
|
227
|
+
variant = "default",
|
|
228
|
+
...props
|
|
229
|
+
}) {
|
|
230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
231
|
+
import_radix_ui2.DropdownMenu.Item,
|
|
232
|
+
{
|
|
233
|
+
"data-slot": "dropdown-menu-item",
|
|
234
|
+
"data-inset": inset,
|
|
235
|
+
"data-variant": variant,
|
|
236
|
+
className: cn(
|
|
237
|
+
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
238
|
+
className
|
|
239
|
+
),
|
|
240
|
+
...props
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
function DropdownMenuRadioGroup({
|
|
245
|
+
...props
|
|
246
|
+
}) {
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
248
|
+
import_radix_ui2.DropdownMenu.RadioGroup,
|
|
249
|
+
{
|
|
250
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
251
|
+
...props
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function DropdownMenuRadioItem({
|
|
256
|
+
className,
|
|
257
|
+
children,
|
|
258
|
+
inset,
|
|
259
|
+
...props
|
|
260
|
+
}) {
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
262
|
+
import_radix_ui2.DropdownMenu.RadioItem,
|
|
263
|
+
{
|
|
264
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
265
|
+
"data-inset": inset,
|
|
266
|
+
className: cn(
|
|
267
|
+
"relative flex cursor-default items-center gap-2.5 rounded-2xl py-2 pr-8 pl-3 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
268
|
+
className
|
|
269
|
+
),
|
|
270
|
+
...props,
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
273
|
+
"span",
|
|
274
|
+
{
|
|
275
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
276
|
+
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
278
|
+
import_lucide_react.CheckIcon,
|
|
279
|
+
{}
|
|
280
|
+
) })
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
children
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function DropdownMenuLabel({
|
|
289
|
+
className,
|
|
290
|
+
inset,
|
|
291
|
+
...props
|
|
292
|
+
}) {
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
294
|
+
import_radix_ui2.DropdownMenu.Label,
|
|
295
|
+
{
|
|
296
|
+
"data-slot": "dropdown-menu-label",
|
|
297
|
+
"data-inset": inset,
|
|
298
|
+
className: cn(
|
|
299
|
+
"px-3 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5",
|
|
300
|
+
className
|
|
301
|
+
),
|
|
302
|
+
...props
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
function DropdownMenuSeparator({
|
|
307
|
+
className,
|
|
308
|
+
...props
|
|
309
|
+
}) {
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
311
|
+
import_radix_ui2.DropdownMenu.Separator,
|
|
312
|
+
{
|
|
313
|
+
"data-slot": "dropdown-menu-separator",
|
|
314
|
+
className: cn("-mx-1.5 my-1.5 h-px bg-border/50", className),
|
|
315
|
+
...props
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function DropdownMenuSub({
|
|
320
|
+
...props
|
|
321
|
+
}) {
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui2.DropdownMenu.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
323
|
+
}
|
|
324
|
+
function DropdownMenuSubTrigger({
|
|
325
|
+
className,
|
|
326
|
+
inset,
|
|
327
|
+
children,
|
|
328
|
+
...props
|
|
329
|
+
}) {
|
|
330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
331
|
+
import_radix_ui2.DropdownMenu.SubTrigger,
|
|
332
|
+
{
|
|
333
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
334
|
+
"data-inset": inset,
|
|
335
|
+
className: cn(
|
|
336
|
+
"flex cursor-default items-center gap-2 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
337
|
+
className
|
|
338
|
+
),
|
|
339
|
+
...props,
|
|
340
|
+
children: [
|
|
341
|
+
children,
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ChevronRightIcon, { className: "ml-auto" })
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
function DropdownMenuSubContent({
|
|
348
|
+
className,
|
|
349
|
+
...props
|
|
350
|
+
}) {
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
352
|
+
import_radix_ui2.DropdownMenu.SubContent,
|
|
353
|
+
{
|
|
354
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
355
|
+
className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-36 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-3xl bg-popover p-1.5 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
356
|
+
...props
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// scaffold/src/components/ui/select.tsx
|
|
362
|
+
var import_lucide_react2 = require("lucide-react");
|
|
363
|
+
var import_radix_ui3 = require("radix-ui");
|
|
364
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
190
365
|
function Select(props) {
|
|
191
|
-
return /* @__PURE__ */ (0,
|
|
366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.Root, { "data-slot": "select", ...props });
|
|
192
367
|
}
|
|
193
368
|
function SelectValue(props) {
|
|
194
|
-
return /* @__PURE__ */ (0,
|
|
369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.Value, { "data-slot": "select-value", ...props });
|
|
195
370
|
}
|
|
196
371
|
function SelectTrigger({
|
|
197
372
|
children,
|
|
198
373
|
className,
|
|
199
374
|
...props
|
|
200
375
|
}) {
|
|
201
|
-
return /* @__PURE__ */ (0,
|
|
202
|
-
|
|
376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
377
|
+
import_radix_ui3.Select.Trigger,
|
|
203
378
|
{
|
|
204
379
|
className: cn(
|
|
205
380
|
"flex h-8 w-full items-center justify-between gap-2 rounded-lg bg-transparent px-2.5 text-xs text-foreground outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:min-w-0 [&>span]:truncate",
|
|
@@ -209,7 +384,7 @@ function SelectTrigger({
|
|
|
209
384
|
...props,
|
|
210
385
|
children: [
|
|
211
386
|
children,
|
|
212
|
-
/* @__PURE__ */ (0,
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.ChevronDownIcon, { className: "size-3.5 shrink-0 text-muted-foreground" }) })
|
|
213
388
|
]
|
|
214
389
|
}
|
|
215
390
|
);
|
|
@@ -222,8 +397,8 @@ function SelectContent({
|
|
|
222
397
|
...props
|
|
223
398
|
}) {
|
|
224
399
|
const container = useThemePortalContainer();
|
|
225
|
-
return /* @__PURE__ */ (0,
|
|
226
|
-
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.Portal, { container: container || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
401
|
+
import_radix_ui3.Select.Content,
|
|
227
402
|
{
|
|
228
403
|
align,
|
|
229
404
|
className: cn(
|
|
@@ -234,7 +409,7 @@ function SelectContent({
|
|
|
234
409
|
position: "popper",
|
|
235
410
|
sideOffset,
|
|
236
411
|
...props,
|
|
237
|
-
children: /* @__PURE__ */ (0,
|
|
412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.Viewport, { className: "max-h-60 overflow-y-auto p-0.5", children })
|
|
238
413
|
}
|
|
239
414
|
) });
|
|
240
415
|
}
|
|
@@ -243,8 +418,8 @@ function SelectItem({
|
|
|
243
418
|
className,
|
|
244
419
|
...props
|
|
245
420
|
}) {
|
|
246
|
-
return /* @__PURE__ */ (0,
|
|
247
|
-
|
|
421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
422
|
+
import_radix_ui3.Select.Item,
|
|
248
423
|
{
|
|
249
424
|
className: cn(
|
|
250
425
|
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pr-8 pl-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
@@ -253,17 +428,17 @@ function SelectItem({
|
|
|
253
428
|
"data-slot": "select-item",
|
|
254
429
|
...props,
|
|
255
430
|
children: [
|
|
256
|
-
/* @__PURE__ */ (0,
|
|
257
|
-
/* @__PURE__ */ (0,
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.ItemText, { className: "min-w-0 truncate", children }),
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui3.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.CheckIcon, { className: "size-3.5" }) }) })
|
|
258
433
|
]
|
|
259
434
|
}
|
|
260
435
|
);
|
|
261
436
|
}
|
|
262
437
|
|
|
263
438
|
// scaffold/src/components/ui/textarea.tsx
|
|
264
|
-
var
|
|
439
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
265
440
|
function Textarea({ className, ...props }) {
|
|
266
|
-
return /* @__PURE__ */ (0,
|
|
441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
267
442
|
"textarea",
|
|
268
443
|
{
|
|
269
444
|
"data-slot": "textarea",
|
|
@@ -277,13 +452,13 @@ function Textarea({ className, ...props }) {
|
|
|
277
452
|
}
|
|
278
453
|
|
|
279
454
|
// scaffold/src/components/ui/tooltip.tsx
|
|
280
|
-
var
|
|
281
|
-
var
|
|
455
|
+
var import_radix_ui4 = require("radix-ui");
|
|
456
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
282
457
|
function TooltipProvider({ children }) {
|
|
283
458
|
return children;
|
|
284
459
|
}
|
|
285
460
|
function Tooltip({ className, ...props }) {
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
287
462
|
"span",
|
|
288
463
|
{
|
|
289
464
|
"data-slot": "tooltip",
|
|
@@ -296,7 +471,7 @@ function TooltipTrigger({
|
|
|
296
471
|
asChild: _asChild,
|
|
297
472
|
...props
|
|
298
473
|
}) {
|
|
299
|
-
return /* @__PURE__ */ (0,
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui4.Slot.Root, { "data-slot": "tooltip-trigger", ...props });
|
|
300
475
|
}
|
|
301
476
|
function TooltipContent({
|
|
302
477
|
className,
|
|
@@ -305,7 +480,7 @@ function TooltipContent({
|
|
|
305
480
|
sideOffset: _sideOffset,
|
|
306
481
|
...props
|
|
307
482
|
}) {
|
|
308
|
-
return /* @__PURE__ */ (0,
|
|
483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
309
484
|
"span",
|
|
310
485
|
{
|
|
311
486
|
role: "tooltip",
|
|
@@ -325,17 +500,21 @@ function TooltipContent({
|
|
|
325
500
|
}
|
|
326
501
|
|
|
327
502
|
// scaffold/src/components/chat/chat-composer.tsx
|
|
328
|
-
var
|
|
503
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
329
504
|
function ChatComposer({
|
|
330
505
|
inputContract,
|
|
331
506
|
disabled,
|
|
332
507
|
contextWindow,
|
|
508
|
+
focusKey,
|
|
333
509
|
forceExpanded = false,
|
|
334
510
|
isCancelling = false,
|
|
335
511
|
isRunning,
|
|
512
|
+
agentId,
|
|
513
|
+
agents,
|
|
336
514
|
modelId,
|
|
337
515
|
models,
|
|
338
516
|
onModelChange,
|
|
517
|
+
onAgentChange,
|
|
339
518
|
onStop,
|
|
340
519
|
onSubmit,
|
|
341
520
|
utilityRow = "inline"
|
|
@@ -350,6 +529,11 @@ function ChatComposer({
|
|
|
350
529
|
const attachmentMimeTypes = (0, import_runtime.inputMimeTypes)(inputContract);
|
|
351
530
|
const allowAttachments = attachmentMimeTypes.length > 0;
|
|
352
531
|
const recordingAllowed = inputContract.modalities.audio.recording_enabled;
|
|
532
|
+
React2.useEffect(() => {
|
|
533
|
+
if (disabled || isRunning) return;
|
|
534
|
+
const frame = window.requestAnimationFrame(() => textareaRef.current?.focus({ preventScroll: true }));
|
|
535
|
+
return () => window.cancelAnimationFrame(frame);
|
|
536
|
+
}, [disabled, focusKey, isRunning]);
|
|
353
537
|
const addRecording = React2.useCallback((file) => {
|
|
354
538
|
draftRevisionRef.current += 1;
|
|
355
539
|
setFiles((current) => [...current, file]);
|
|
@@ -361,18 +545,43 @@ function ChatComposer({
|
|
|
361
545
|
text,
|
|
362
546
|
files.map((file) => ({ data: file, mediaType: file.type }))
|
|
363
547
|
);
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
548
|
+
const selectedAgent = agents.find((item) => item.id === agentId);
|
|
549
|
+
const selectedModel = models.find((item) => item.id === modelId);
|
|
550
|
+
const modelSelector = models.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-fit max-w-40", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Select, { disabled: disabled || isRunning, onValueChange: onModelChange, value: modelId || void 0, children: [
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectTrigger, { "aria-label": "Runtime model", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectValue, { placeholder: "Model" }) }),
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectContent, { align: "start", children: models.map((model) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectItem, { value: model.id, children: model.label }, model.id)) })
|
|
553
|
+
] }) }) : null;
|
|
554
|
+
const runtimeSelector = agents.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu, { children: [
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
556
|
+
Button,
|
|
557
|
+
{
|
|
558
|
+
variant: "ghost",
|
|
559
|
+
className: "h-8 max-w-64 gap-1.5 bg-transparent px-2.5 text-xs font-normal hover:bg-muted/40 disabled:opacity-100",
|
|
560
|
+
disabled: disabled || isRunning,
|
|
561
|
+
"aria-label": "Runtime configuration",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "truncate", children: [selectedAgent?.label, selectedModel?.label].filter(Boolean).join(" \xB7 ") || "Runtime" }),
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDown, { className: "size-3.5 text-muted-foreground" })
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
) }),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuContent, { align: "start", className: "w-64 rounded-lg", children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuSub, { children: [
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuSubTrigger, { className: "rounded-lg", children: [
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Agent" }),
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-auto max-w-32 truncate text-muted-foreground", children: selectedAgent?.label })
|
|
573
|
+
] }),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSubContent, { className: "w-56 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuRadioGroup, { value: agentId || void 0, onValueChange: onAgentChange, children: agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuRadioItem, { className: "rounded-lg", value: agent.id, children: agent.label }, agent.id)) }) })
|
|
575
|
+
] }),
|
|
576
|
+
models.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuSub, { children: [
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuSubTrigger, { className: "rounded-lg", children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Model" }),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-auto max-w-32 truncate text-muted-foreground", children: selectedModel?.label })
|
|
580
|
+
] }),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSubContent, { className: "max-h-64 w-56 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuRadioGroup, { value: modelId || void 0, onValueChange: onModelChange, children: models.map((model) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuRadioItem, { className: "rounded-lg", value: model.id, children: model.label }, model.id)) }) })
|
|
582
|
+
] }) : null
|
|
583
|
+
] })
|
|
584
|
+
] }) : modelSelector;
|
|
376
585
|
const hasContextWindow = Number.isFinite(Number(contextWindow?.max_tokens)) && Number(contextWindow?.max_tokens) > 0;
|
|
377
586
|
const showUtilityRow = utilityRow === "below";
|
|
378
587
|
const submit = async () => {
|
|
@@ -397,21 +606,21 @@ function ChatComposer({
|
|
|
397
606
|
submittingRef.current = false;
|
|
398
607
|
}
|
|
399
608
|
};
|
|
400
|
-
return /* @__PURE__ */ (0,
|
|
609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
401
610
|
"div",
|
|
402
611
|
{
|
|
403
612
|
className: "mx-auto w-full max-w-3xl px-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:px-6",
|
|
404
613
|
"data-agents24-chat-composer": "",
|
|
405
614
|
children: [
|
|
406
|
-
allowAttachments && files.length > 0 && /* @__PURE__ */ (0,
|
|
407
|
-
/* @__PURE__ */ (0,
|
|
408
|
-
/* @__PURE__ */ (0,
|
|
615
|
+
allowAttachments && files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-2 flex min-w-0 gap-2 overflow-x-auto", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex max-w-48 items-center gap-2 border bg-card px-2 py-1 text-xs", children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "truncate", children: file.name }),
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Remove ${file.name}`, onClick: () => {
|
|
409
618
|
draftRevisionRef.current += 1;
|
|
410
619
|
setFiles((current) => current.filter((_, itemIndex) => itemIndex !== index));
|
|
411
|
-
}, children: /* @__PURE__ */ (0,
|
|
620
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.X, {}) })
|
|
412
621
|
] }, `${file.name}-${index}`)) }),
|
|
413
|
-
attachmentError || recorder.error ? /* @__PURE__ */ (0,
|
|
414
|
-
/* @__PURE__ */ (0,
|
|
622
|
+
attachmentError || recorder.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mb-2 text-xs text-destructive", role: "alert", children: attachmentError || recorder.error }) : null,
|
|
623
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
415
624
|
"div",
|
|
416
625
|
{
|
|
417
626
|
"data-expanded": isExpanded || void 0,
|
|
@@ -420,8 +629,8 @@ function ChatComposer({
|
|
|
420
629
|
isExpanded ? "p-2" : "p-1.5"
|
|
421
630
|
),
|
|
422
631
|
children: [
|
|
423
|
-
allowAttachments ? /* @__PURE__ */ (0,
|
|
424
|
-
/* @__PURE__ */ (0,
|
|
632
|
+
allowAttachments ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
425
634
|
"input",
|
|
426
635
|
{
|
|
427
636
|
ref: inputRef,
|
|
@@ -441,9 +650,9 @@ function ChatComposer({
|
|
|
441
650
|
}
|
|
442
651
|
}
|
|
443
652
|
),
|
|
444
|
-
/* @__PURE__ */ (0,
|
|
445
|
-
] }) : /* @__PURE__ */ (0,
|
|
446
|
-
/* @__PURE__ */ (0,
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "agents24-composer-attach flex min-w-0 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground", variant: "ghost", size: "icon", "aria-label": "Attach files", disabled: disabled || isRunning, onClick: () => inputRef.current?.click(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": true, children: "+" }) }) })
|
|
654
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", className: "agents24-composer-attach" }),
|
|
655
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
447
656
|
Textarea,
|
|
448
657
|
{
|
|
449
658
|
ref: textareaRef,
|
|
@@ -468,10 +677,10 @@ function ChatComposer({
|
|
|
468
677
|
}
|
|
469
678
|
}
|
|
470
679
|
),
|
|
471
|
-
/* @__PURE__ */ (0,
|
|
472
|
-
utilityRow === "inline" ? /* @__PURE__ */ (0,
|
|
473
|
-
utilityRow === "inline" ?
|
|
474
|
-
recordingAllowed ? /* @__PURE__ */ (0,
|
|
680
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "agents24-composer-actions flex items-center gap-1", children: [
|
|
681
|
+
utilityRow === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui.AgentChatContextStatus, { contextWindow }) : null,
|
|
682
|
+
utilityRow === "inline" ? runtimeSelector : null,
|
|
683
|
+
recordingAllowed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
475
684
|
Button,
|
|
476
685
|
{
|
|
477
686
|
variant: recorder.isRecording ? "default" : "ghost",
|
|
@@ -482,35 +691,35 @@ function ChatComposer({
|
|
|
482
691
|
if (recorder.isRecording) recorder.stop();
|
|
483
692
|
else void recorder.start();
|
|
484
693
|
},
|
|
485
|
-
children: recorder.isRecording ? /* @__PURE__ */ (0,
|
|
694
|
+
children: recorder.isRecording ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Square, { className: "fill-current" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Mic, {})
|
|
486
695
|
}
|
|
487
696
|
) : null,
|
|
488
|
-
isRunning ? /* @__PURE__ */ (0,
|
|
697
|
+
isRunning ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
489
698
|
Button,
|
|
490
699
|
{
|
|
491
700
|
size: "icon",
|
|
492
701
|
"aria-label": isCancelling ? "Cancelling response" : "Stop response",
|
|
493
702
|
disabled: disabled || isCancelling,
|
|
494
703
|
onClick: onStop,
|
|
495
|
-
children: isCancelling ? /* @__PURE__ */ (0,
|
|
704
|
+
children: isCancelling ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.LoaderCircle, { className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Square, { className: "fill-current" })
|
|
496
705
|
}
|
|
497
|
-
) : validationError ? /* @__PURE__ */ (0,
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
499
|
-
/* @__PURE__ */ (0,
|
|
500
|
-
] }) : /* @__PURE__ */ (0,
|
|
706
|
+
) : validationError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Tooltip, { tabIndex: 0, children: [
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": "Send message", disabled: true, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) }) }),
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipContent, { children: validationError })
|
|
709
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": "Send message", disabled, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) })
|
|
501
710
|
] })
|
|
502
711
|
]
|
|
503
712
|
}
|
|
504
713
|
),
|
|
505
|
-
showUtilityRow ? /* @__PURE__ */ (0,
|
|
714
|
+
showUtilityRow ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
506
715
|
"div",
|
|
507
716
|
{
|
|
508
|
-
"aria-hidden": !
|
|
717
|
+
"aria-hidden": !runtimeSelector && !hasContextWindow ? "true" : void 0,
|
|
509
718
|
className: "mt-2 flex min-h-8 items-center justify-between gap-2 px-1",
|
|
510
719
|
"data-agents24-chat-composer-utility": "",
|
|
511
720
|
children: [
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
513
|
-
/* @__PURE__ */ (0,
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-w-0", children: runtimeSelector }),
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui.AgentChatContextStatus, { contextWindow })
|
|
514
723
|
]
|
|
515
724
|
}
|
|
516
725
|
) : null
|
|
@@ -526,17 +735,17 @@ var import_ui3 = require("@agents24/chat-react/ui");
|
|
|
526
735
|
var import_ui2 = require("@agents24/chat-react/ui");
|
|
527
736
|
|
|
528
737
|
// scaffold/src/components/chat/collapsible-user-message.tsx
|
|
529
|
-
var
|
|
738
|
+
var import_lucide_react4 = require("lucide-react");
|
|
530
739
|
var React3 = __toESM(require("react"), 1);
|
|
531
|
-
var
|
|
740
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
532
741
|
var collapseThreshold = 360;
|
|
533
742
|
function CollapsibleUserMessage({ content }) {
|
|
534
743
|
const [expanded, setExpanded] = React3.useState(false);
|
|
535
744
|
const contentId = React3.useId();
|
|
536
745
|
const collapsible = content.length > collapseThreshold;
|
|
537
|
-
const Icon = expanded ?
|
|
538
|
-
return /* @__PURE__ */ (0,
|
|
539
|
-
/* @__PURE__ */ (0,
|
|
746
|
+
const Icon = expanded ? import_lucide_react4.ChevronUp : import_lucide_react4.ChevronDown;
|
|
747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
540
749
|
"div",
|
|
541
750
|
{
|
|
542
751
|
id: contentId,
|
|
@@ -544,7 +753,7 @@ function CollapsibleUserMessage({ content }) {
|
|
|
544
753
|
children: content
|
|
545
754
|
}
|
|
546
755
|
),
|
|
547
|
-
collapsible && /* @__PURE__ */ (0,
|
|
756
|
+
collapsible && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
548
757
|
Button,
|
|
549
758
|
{
|
|
550
759
|
variant: "ghost",
|
|
@@ -556,7 +765,7 @@ function CollapsibleUserMessage({ content }) {
|
|
|
556
765
|
onClick: () => setExpanded((value) => !value),
|
|
557
766
|
children: [
|
|
558
767
|
expanded ? "Show less" : "Show more",
|
|
559
|
-
/* @__PURE__ */ (0,
|
|
768
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, {})
|
|
560
769
|
]
|
|
561
770
|
}
|
|
562
771
|
)
|
|
@@ -567,27 +776,27 @@ function CollapsibleUserMessage({ content }) {
|
|
|
567
776
|
var React4 = __toESM(require("react"), 1);
|
|
568
777
|
|
|
569
778
|
// scaffold/src/components/ui/dialog.tsx
|
|
570
|
-
var
|
|
571
|
-
var
|
|
572
|
-
var
|
|
779
|
+
var import_radix_ui5 = require("radix-ui");
|
|
780
|
+
var import_lucide_react5 = require("lucide-react");
|
|
781
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
573
782
|
function Dialog({
|
|
574
783
|
...props
|
|
575
784
|
}) {
|
|
576
|
-
return /* @__PURE__ */ (0,
|
|
785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
577
786
|
}
|
|
578
787
|
function DialogPortal({
|
|
579
788
|
container,
|
|
580
789
|
...props
|
|
581
790
|
}) {
|
|
582
791
|
const themeContainer = useThemePortalContainer();
|
|
583
|
-
return /* @__PURE__ */ (0,
|
|
792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Dialog.Portal, { container: container || themeContainer || void 0, "data-slot": "dialog-portal", ...props });
|
|
584
793
|
}
|
|
585
794
|
function DialogOverlay({
|
|
586
795
|
className,
|
|
587
796
|
...props
|
|
588
797
|
}) {
|
|
589
|
-
return /* @__PURE__ */ (0,
|
|
590
|
-
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
799
|
+
import_radix_ui5.Dialog.Overlay,
|
|
591
800
|
{
|
|
592
801
|
"data-slot": "dialog-overlay",
|
|
593
802
|
className: cn(
|
|
@@ -604,10 +813,10 @@ function DialogContent({
|
|
|
604
813
|
showCloseButton = true,
|
|
605
814
|
...props
|
|
606
815
|
}) {
|
|
607
|
-
return /* @__PURE__ */ (0,
|
|
608
|
-
/* @__PURE__ */ (0,
|
|
609
|
-
/* @__PURE__ */ (0,
|
|
610
|
-
|
|
816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPortal, { children: [
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogOverlay, {}),
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
819
|
+
import_radix_ui5.Dialog.Content,
|
|
611
820
|
{
|
|
612
821
|
"data-slot": "dialog-content",
|
|
613
822
|
className: cn(
|
|
@@ -617,18 +826,18 @@ function DialogContent({
|
|
|
617
826
|
...props,
|
|
618
827
|
children: [
|
|
619
828
|
children,
|
|
620
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
829
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Dialog.Close, { "data-slot": "dialog-close", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
621
830
|
Button,
|
|
622
831
|
{
|
|
623
832
|
variant: "ghost",
|
|
624
833
|
className: "absolute top-4 right-4 bg-secondary",
|
|
625
834
|
size: "icon-sm",
|
|
626
835
|
children: [
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
628
|
-
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
837
|
+
import_lucide_react5.XIcon,
|
|
629
838
|
{}
|
|
630
839
|
),
|
|
631
|
-
/* @__PURE__ */ (0,
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sr-only", children: "Close" })
|
|
632
841
|
]
|
|
633
842
|
}
|
|
634
843
|
) })
|
|
@@ -638,7 +847,7 @@ function DialogContent({
|
|
|
638
847
|
] });
|
|
639
848
|
}
|
|
640
849
|
function DialogHeader({ className, ...props }) {
|
|
641
|
-
return /* @__PURE__ */ (0,
|
|
850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
642
851
|
"div",
|
|
643
852
|
{
|
|
644
853
|
"data-slot": "dialog-header",
|
|
@@ -653,7 +862,7 @@ function DialogFooter({
|
|
|
653
862
|
children,
|
|
654
863
|
...props
|
|
655
864
|
}) {
|
|
656
|
-
return /* @__PURE__ */ (0,
|
|
865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
657
866
|
"div",
|
|
658
867
|
{
|
|
659
868
|
"data-slot": "dialog-footer",
|
|
@@ -664,7 +873,7 @@ function DialogFooter({
|
|
|
664
873
|
...props,
|
|
665
874
|
children: [
|
|
666
875
|
children,
|
|
667
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
876
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "outline", children: "Close" }) })
|
|
668
877
|
]
|
|
669
878
|
}
|
|
670
879
|
);
|
|
@@ -673,8 +882,8 @@ function DialogTitle({
|
|
|
673
882
|
className,
|
|
674
883
|
...props
|
|
675
884
|
}) {
|
|
676
|
-
return /* @__PURE__ */ (0,
|
|
677
|
-
|
|
885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
886
|
+
import_radix_ui5.Dialog.Title,
|
|
678
887
|
{
|
|
679
888
|
"data-slot": "dialog-title",
|
|
680
889
|
className: cn(
|
|
@@ -689,8 +898,8 @@ function DialogDescription({
|
|
|
689
898
|
className,
|
|
690
899
|
...props
|
|
691
900
|
}) {
|
|
692
|
-
return /* @__PURE__ */ (0,
|
|
693
|
-
|
|
901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
902
|
+
import_radix_ui5.Dialog.Description,
|
|
694
903
|
{
|
|
695
904
|
"data-slot": "dialog-description",
|
|
696
905
|
className: cn(
|
|
@@ -703,7 +912,7 @@ function DialogDescription({
|
|
|
703
912
|
}
|
|
704
913
|
|
|
705
914
|
// scaffold/src/components/chat/external-link-dialog.tsx
|
|
706
|
-
var
|
|
915
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
707
916
|
function ExternalLinkDialog({ isOpen, onClose, onConfirm, url }) {
|
|
708
917
|
const [copied, setCopied] = React4.useState(false);
|
|
709
918
|
React4.useEffect(() => {
|
|
@@ -717,29 +926,29 @@ function ExternalLinkDialog({ isOpen, onClose, onConfirm, url }) {
|
|
|
717
926
|
onConfirm();
|
|
718
927
|
onClose();
|
|
719
928
|
};
|
|
720
|
-
return /* @__PURE__ */ (0,
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog, { open: isOpen, onOpenChange: (open) => {
|
|
721
930
|
if (!open) onClose();
|
|
722
|
-
}, children: /* @__PURE__ */ (0,
|
|
723
|
-
/* @__PURE__ */ (0,
|
|
724
|
-
/* @__PURE__ */ (0,
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
931
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogContent, { className: "max-h-[calc(100dvh-2rem)] min-w-0 overflow-hidden sm:max-w-md", children: [
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogHeader, { children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitle, { children: "Open external link?" }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogDescription, { children: "You\u2019re about to visit an external website." })
|
|
726
935
|
] }),
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
729
|
-
/* @__PURE__ */ (0,
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-h-32 overflow-auto rounded-md bg-muted p-3 font-mono text-xs wrap-break-word", children: url }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogFooter, { children: [
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { variant: "outline", onClick: () => void copyUrl(), children: copied ? "Copied" : "Copy link" }),
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { onClick: openUrl, children: "Open link" })
|
|
731
940
|
] })
|
|
732
941
|
] }) });
|
|
733
942
|
}
|
|
734
943
|
|
|
735
944
|
// scaffold/src/components/chat/message-parts.tsx
|
|
736
|
-
var
|
|
945
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
737
946
|
var linkSafety = {
|
|
738
947
|
enabled: true,
|
|
739
|
-
renderModal: (props) => /* @__PURE__ */ (0,
|
|
948
|
+
renderModal: (props) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ExternalLinkDialog, { ...props })
|
|
740
949
|
};
|
|
741
950
|
function ScaffoldTimeline(props) {
|
|
742
|
-
return /* @__PURE__ */ (0,
|
|
951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
743
952
|
import_ui2.AgentResponseTimeline,
|
|
744
953
|
{
|
|
745
954
|
...props,
|
|
@@ -758,7 +967,7 @@ function MessageParts({
|
|
|
758
967
|
Timeline = ScaffoldTimeline
|
|
759
968
|
}) {
|
|
760
969
|
if (message.role === "assistant") {
|
|
761
|
-
return /* @__PURE__ */ (0,
|
|
970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
762
971
|
Timeline,
|
|
763
972
|
{
|
|
764
973
|
getHitlActionState,
|
|
@@ -773,8 +982,8 @@ function MessageParts({
|
|
|
773
982
|
}
|
|
774
983
|
const text = message.parts.filter((part) => part.kind === "text").map((part) => part.kind === "text" ? part.text : "").join("") || message.content;
|
|
775
984
|
const supportingParts = message.parts.filter((part) => part.kind !== "text" && part.kind !== "data");
|
|
776
|
-
return /* @__PURE__ */ (0,
|
|
777
|
-
supportingParts.map((part) => /* @__PURE__ */ (0,
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
986
|
+
supportingParts.map((part) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
778
987
|
import_ui2.AgentChatPart,
|
|
779
988
|
{
|
|
780
989
|
getHitlActionState,
|
|
@@ -786,14 +995,14 @@ function MessageParts({
|
|
|
786
995
|
},
|
|
787
996
|
part.id
|
|
788
997
|
)),
|
|
789
|
-
text ? /* @__PURE__ */ (0,
|
|
998
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CollapsibleUserMessage, { content: text }) : null
|
|
790
999
|
] });
|
|
791
1000
|
}
|
|
792
1001
|
|
|
793
1002
|
// scaffold/src/components/ui/bubble.tsx
|
|
794
1003
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
795
|
-
var
|
|
796
|
-
var
|
|
1004
|
+
var import_radix_ui6 = require("radix-ui");
|
|
1005
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
797
1006
|
var bubbleVariants = (0, import_class_variance_authority2.cva)(
|
|
798
1007
|
"group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
|
|
799
1008
|
{
|
|
@@ -819,7 +1028,7 @@ function Bubble({
|
|
|
819
1028
|
className,
|
|
820
1029
|
...props
|
|
821
1030
|
}) {
|
|
822
|
-
return /* @__PURE__ */ (0,
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
823
1032
|
"div",
|
|
824
1033
|
{
|
|
825
1034
|
"data-slot": "bubble",
|
|
@@ -835,8 +1044,8 @@ function BubbleContent({
|
|
|
835
1044
|
className,
|
|
836
1045
|
...props
|
|
837
1046
|
}) {
|
|
838
|
-
const Comp = asChild ?
|
|
839
|
-
return /* @__PURE__ */ (0,
|
|
1047
|
+
const Comp = asChild ? import_radix_ui6.Slot.Root : "div";
|
|
1048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
840
1049
|
Comp,
|
|
841
1050
|
{
|
|
842
1051
|
"data-slot": "bubble-content",
|
|
@@ -869,13 +1078,13 @@ var bubbleReactionsVariants = (0, import_class_variance_authority2.cva)(
|
|
|
869
1078
|
);
|
|
870
1079
|
|
|
871
1080
|
// scaffold/src/components/ui/message.tsx
|
|
872
|
-
var
|
|
1081
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
873
1082
|
function Message({
|
|
874
1083
|
className,
|
|
875
1084
|
align = "start",
|
|
876
1085
|
...props
|
|
877
1086
|
}) {
|
|
878
|
-
return /* @__PURE__ */ (0,
|
|
1087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
879
1088
|
"div",
|
|
880
1089
|
{
|
|
881
1090
|
"data-slot": "message",
|
|
@@ -889,7 +1098,7 @@ function Message({
|
|
|
889
1098
|
);
|
|
890
1099
|
}
|
|
891
1100
|
function MessageContent({ className, ...props }) {
|
|
892
|
-
return /* @__PURE__ */ (0,
|
|
1101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
893
1102
|
"div",
|
|
894
1103
|
{
|
|
895
1104
|
"data-slot": "message-content",
|
|
@@ -902,7 +1111,7 @@ function MessageContent({ className, ...props }) {
|
|
|
902
1111
|
);
|
|
903
1112
|
}
|
|
904
1113
|
function MessageFooter({ className, ...props }) {
|
|
905
|
-
return /* @__PURE__ */ (0,
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
906
1115
|
"div",
|
|
907
1116
|
{
|
|
908
1117
|
"data-slot": "message-footer",
|
|
@@ -916,7 +1125,7 @@ function MessageFooter({ className, ...props }) {
|
|
|
916
1125
|
}
|
|
917
1126
|
|
|
918
1127
|
// scaffold/src/components/chat/chat-message.tsx
|
|
919
|
-
var
|
|
1128
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
920
1129
|
function ChatMessage({
|
|
921
1130
|
allowFeedback,
|
|
922
1131
|
getHitlActionState,
|
|
@@ -928,15 +1137,15 @@ function ChatMessage({
|
|
|
928
1137
|
Timeline
|
|
929
1138
|
}) {
|
|
930
1139
|
const isUser = message.role === "user";
|
|
931
|
-
return /* @__PURE__ */ (0,
|
|
932
|
-
isUser && message.attachments?.length ? /* @__PURE__ */ (0,
|
|
1140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Message, { align: isUser ? "end" : "start", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MessageContent, { children: [
|
|
1141
|
+
isUser && message.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui3.ChatAttachments, { className: "mb-2 justify-end", children: message.attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
933
1142
|
import_ui3.ChatAttachment,
|
|
934
1143
|
{
|
|
935
1144
|
data: attachment
|
|
936
1145
|
},
|
|
937
1146
|
String(attachment.id || attachment.url || attachment.filename || index)
|
|
938
1147
|
)) }) : null,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Bubble, { variant: isUser ? "secondary" : "ghost", align: isUser ? "end" : "start", className: isUser ? "max-w-[min(75%,42rem)]" : "max-w-full overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BubbleContent, { className: isUser ? "px-4 py-2.5" : "w-full overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
940
1149
|
MessageParts,
|
|
941
1150
|
{
|
|
942
1151
|
getHitlActionState,
|
|
@@ -946,7 +1155,7 @@ function ChatMessage({
|
|
|
946
1155
|
Timeline
|
|
947
1156
|
}
|
|
948
1157
|
) }) }),
|
|
949
|
-
!isUser && message.isFinal !== false && /* @__PURE__ */ (0,
|
|
1158
|
+
!isUser && message.isFinal !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageFooter, { className: "gap-1 opacity-70 transition-opacity group-hover/message:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
950
1159
|
import_ui3.AgentChatDefaultActions,
|
|
951
1160
|
{
|
|
952
1161
|
handlers: {
|
|
@@ -964,13 +1173,13 @@ function ChatMessage({
|
|
|
964
1173
|
}
|
|
965
1174
|
|
|
966
1175
|
// scaffold/src/components/chat/theme-menu.tsx
|
|
967
|
-
var
|
|
1176
|
+
var import_lucide_react6 = require("lucide-react");
|
|
968
1177
|
var React5 = __toESM(require("react"), 1);
|
|
969
|
-
var
|
|
1178
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
970
1179
|
var options = [
|
|
971
|
-
{ value: "system", label: "System", icon:
|
|
972
|
-
{ value: "light", label: "Light", icon:
|
|
973
|
-
{ value: "dark", label: "Dark", icon:
|
|
1180
|
+
{ value: "system", label: "System", icon: import_lucide_react6.Laptop },
|
|
1181
|
+
{ value: "light", label: "Light", icon: import_lucide_react6.Sun },
|
|
1182
|
+
{ value: "dark", label: "Dark", icon: import_lucide_react6.Moon }
|
|
974
1183
|
];
|
|
975
1184
|
function ThemeMenu() {
|
|
976
1185
|
const { appearance, setAppearance } = useTheme();
|
|
@@ -978,7 +1187,7 @@ function ThemeMenu() {
|
|
|
978
1187
|
const rootRef = React5.useRef(null);
|
|
979
1188
|
const firstItemRef = React5.useRef(null);
|
|
980
1189
|
const menuId = React5.useId();
|
|
981
|
-
const ActiveIcon = options.find((item) => item.value === appearance)?.icon ??
|
|
1190
|
+
const ActiveIcon = options.find((item) => item.value === appearance)?.icon ?? import_lucide_react6.Laptop;
|
|
982
1191
|
React5.useEffect(() => {
|
|
983
1192
|
if (!open) return;
|
|
984
1193
|
firstItemRef.current?.focus();
|
|
@@ -996,8 +1205,8 @@ function ThemeMenu() {
|
|
|
996
1205
|
};
|
|
997
1206
|
}, [open]);
|
|
998
1207
|
const label = appearance === "system" ? "System" : appearance === "light" ? "Light" : "Dark";
|
|
999
|
-
return /* @__PURE__ */ (0,
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: rootRef, className: "relative", children: [
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1001
1210
|
Button,
|
|
1002
1211
|
{
|
|
1003
1212
|
"aria-controls": menuId,
|
|
@@ -1007,16 +1216,16 @@ function ThemeMenu() {
|
|
|
1007
1216
|
onClick: () => setOpen((value) => !value),
|
|
1008
1217
|
size: "icon-sm",
|
|
1009
1218
|
variant: "ghost",
|
|
1010
|
-
children: /* @__PURE__ */ (0,
|
|
1219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ActiveIcon, {})
|
|
1011
1220
|
}
|
|
1012
1221
|
),
|
|
1013
|
-
open ? /* @__PURE__ */ (0,
|
|
1222
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1014
1223
|
"div",
|
|
1015
1224
|
{
|
|
1016
1225
|
id: menuId,
|
|
1017
1226
|
className: "absolute end-0 top-full z-50 mt-1 flex min-w-44 flex-col rounded-xl border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1018
1227
|
role: "menu",
|
|
1019
|
-
children: options.map(({ value, label: optionLabel, icon: Icon }, index) => /* @__PURE__ */ (0,
|
|
1228
|
+
children: options.map(({ value, label: optionLabel, icon: Icon }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1020
1229
|
Button,
|
|
1021
1230
|
{
|
|
1022
1231
|
ref: index === 0 ? firstItemRef : void 0,
|
|
@@ -1030,7 +1239,7 @@ function ThemeMenu() {
|
|
|
1030
1239
|
size: "sm",
|
|
1031
1240
|
variant: "ghost",
|
|
1032
1241
|
children: [
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, {}),
|
|
1034
1243
|
" ",
|
|
1035
1244
|
optionLabel
|
|
1036
1245
|
]
|
|
@@ -1049,96 +1258,6 @@ var import_lucide_react10 = require("lucide-react");
|
|
|
1049
1258
|
// scaffold/src/components/chat/identity-control.tsx
|
|
1050
1259
|
var import_lucide_react9 = require("lucide-react");
|
|
1051
1260
|
|
|
1052
|
-
// scaffold/src/components/ui/dropdown-menu.tsx
|
|
1053
|
-
var import_radix_ui6 = require("radix-ui");
|
|
1054
|
-
var import_lucide_react6 = require("lucide-react");
|
|
1055
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1056
|
-
function DropdownMenu({
|
|
1057
|
-
...props
|
|
1058
|
-
}) {
|
|
1059
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_radix_ui6.DropdownMenu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
1060
|
-
}
|
|
1061
|
-
function DropdownMenuTrigger({
|
|
1062
|
-
...props
|
|
1063
|
-
}) {
|
|
1064
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1065
|
-
import_radix_ui6.DropdownMenu.Trigger,
|
|
1066
|
-
{
|
|
1067
|
-
"data-slot": "dropdown-menu-trigger",
|
|
1068
|
-
...props
|
|
1069
|
-
}
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
|
-
function DropdownMenuContent({
|
|
1073
|
-
className,
|
|
1074
|
-
align = "start",
|
|
1075
|
-
sideOffset = 4,
|
|
1076
|
-
...props
|
|
1077
|
-
}) {
|
|
1078
|
-
const themeContainer = useThemePortalContainer();
|
|
1079
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_radix_ui6.DropdownMenu.Portal, { container: themeContainer || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1080
|
-
import_radix_ui6.DropdownMenu.Content,
|
|
1081
|
-
{
|
|
1082
|
-
"data-slot": "dropdown-menu-content",
|
|
1083
|
-
sideOffset,
|
|
1084
|
-
align,
|
|
1085
|
-
className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-48 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-3xl bg-popover p-1.5 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
1086
|
-
...props
|
|
1087
|
-
}
|
|
1088
|
-
) });
|
|
1089
|
-
}
|
|
1090
|
-
function DropdownMenuItem({
|
|
1091
|
-
className,
|
|
1092
|
-
inset,
|
|
1093
|
-
variant = "default",
|
|
1094
|
-
...props
|
|
1095
|
-
}) {
|
|
1096
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1097
|
-
import_radix_ui6.DropdownMenu.Item,
|
|
1098
|
-
{
|
|
1099
|
-
"data-slot": "dropdown-menu-item",
|
|
1100
|
-
"data-inset": inset,
|
|
1101
|
-
"data-variant": variant,
|
|
1102
|
-
className: cn(
|
|
1103
|
-
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
1104
|
-
className
|
|
1105
|
-
),
|
|
1106
|
-
...props
|
|
1107
|
-
}
|
|
1108
|
-
);
|
|
1109
|
-
}
|
|
1110
|
-
function DropdownMenuLabel({
|
|
1111
|
-
className,
|
|
1112
|
-
inset,
|
|
1113
|
-
...props
|
|
1114
|
-
}) {
|
|
1115
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1116
|
-
import_radix_ui6.DropdownMenu.Label,
|
|
1117
|
-
{
|
|
1118
|
-
"data-slot": "dropdown-menu-label",
|
|
1119
|
-
"data-inset": inset,
|
|
1120
|
-
className: cn(
|
|
1121
|
-
"px-3 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5",
|
|
1122
|
-
className
|
|
1123
|
-
),
|
|
1124
|
-
...props
|
|
1125
|
-
}
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
function DropdownMenuSeparator({
|
|
1129
|
-
className,
|
|
1130
|
-
...props
|
|
1131
|
-
}) {
|
|
1132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1133
|
-
import_radix_ui6.DropdownMenu.Separator,
|
|
1134
|
-
{
|
|
1135
|
-
"data-slot": "dropdown-menu-separator",
|
|
1136
|
-
className: cn("-mx-1.5 my-1.5 h-px bg-border/50", className),
|
|
1137
|
-
...props
|
|
1138
|
-
}
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
1261
|
// scaffold/src/components/ui/sidebar.tsx
|
|
1143
1262
|
var React7 = __toESM(require("react"), 1);
|
|
1144
1263
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
@@ -1607,7 +1726,7 @@ function SidebarMenuItem({ className, ...props }) {
|
|
|
1607
1726
|
);
|
|
1608
1727
|
}
|
|
1609
1728
|
var sidebarMenuButtonVariants = (0, import_class_variance_authority3.cva)(
|
|
1610
|
-
"peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-xl px-3 py-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
|
|
1729
|
+
"peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-xl px-3 py-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
|
|
1611
1730
|
{
|
|
1612
1731
|
variants: {
|
|
1613
1732
|
variant: {
|
|
@@ -1683,7 +1802,7 @@ function SidebarMenuAction({
|
|
|
1683
1802
|
"data-sidebar": "menu-action",
|
|
1684
1803
|
className: cn(
|
|
1685
1804
|
"absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-xl p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-2 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1686
|
-
showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
|
|
1805
|
+
showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
|
|
1687
1806
|
className
|
|
1688
1807
|
),
|
|
1689
1808
|
...props
|
|
@@ -2056,7 +2175,8 @@ function OperationErrorNotice({ runtime }) {
|
|
|
2056
2175
|
function ChatShell({
|
|
2057
2176
|
components,
|
|
2058
2177
|
identity,
|
|
2059
|
-
runtime
|
|
2178
|
+
runtime,
|
|
2179
|
+
sidebar
|
|
2060
2180
|
}) {
|
|
2061
2181
|
const { controller } = runtime;
|
|
2062
2182
|
const isRunning = controller.runState === "streaming" || controller.runState === "reconnecting" || controller.runState === "paused" || controller.runState === "cancelling" || runtime.isSubmitting;
|
|
@@ -2072,7 +2192,7 @@ function ChatShell({
|
|
|
2072
2192
|
"data-agents24-chat-layout": "",
|
|
2073
2193
|
children: [
|
|
2074
2194
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PersistentSidebarTrigger, {}),
|
|
2075
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2195
|
+
sidebar || /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2076
2196
|
ThreadSidebar,
|
|
2077
2197
|
{
|
|
2078
2198
|
activeThreadId: controller.activeThreadId,
|
|
@@ -2115,10 +2235,16 @@ function ChatShell({
|
|
|
2115
2235
|
{
|
|
2116
2236
|
inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
|
|
2117
2237
|
contextWindow: runtime.contextWindow,
|
|
2118
|
-
disabled: runtime.isBootstrapping,
|
|
2238
|
+
disabled: runtime.isBootstrapping || runtime.isChangingAgent,
|
|
2239
|
+
focusKey: controller.activeThreadId,
|
|
2119
2240
|
forceExpanded: true,
|
|
2120
2241
|
isCancelling,
|
|
2121
2242
|
isRunning,
|
|
2243
|
+
agentId: runtime.agentId,
|
|
2244
|
+
agents: runtime.agents,
|
|
2245
|
+
onAgentChange: (agentId) => {
|
|
2246
|
+
void runtime.changeAgent(agentId);
|
|
2247
|
+
},
|
|
2122
2248
|
onStop: () => {
|
|
2123
2249
|
void controller.cancelRun().catch(() => void 0);
|
|
2124
2250
|
},
|
|
@@ -2203,9 +2329,15 @@ function ChatShell({
|
|
|
2203
2329
|
{
|
|
2204
2330
|
inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
|
|
2205
2331
|
contextWindow: runtime.contextWindow,
|
|
2206
|
-
disabled: runtime.isBootstrapping || hasBlockingError,
|
|
2332
|
+
disabled: runtime.isBootstrapping || runtime.isChangingAgent || hasBlockingError,
|
|
2333
|
+
focusKey: controller.activeThreadId,
|
|
2207
2334
|
isCancelling,
|
|
2208
2335
|
isRunning,
|
|
2336
|
+
agentId: runtime.agentId,
|
|
2337
|
+
agents: runtime.agents,
|
|
2338
|
+
onAgentChange: (agentId) => {
|
|
2339
|
+
void runtime.changeAgent(agentId);
|
|
2340
|
+
},
|
|
2209
2341
|
onStop: () => {
|
|
2210
2342
|
void controller.cancelRun().catch(() => void 0);
|
|
2211
2343
|
},
|
|
@@ -2248,7 +2380,7 @@ function RuntimeChat({
|
|
|
2248
2380
|
...props,
|
|
2249
2381
|
mcpRedirectUri: props.mcpRedirectUri || (typeof window === "undefined" ? void 0 : window.location.href)
|
|
2250
2382
|
});
|
|
2251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatShell, { components, identity, runtime });
|
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatShell, { components, identity, runtime, sidebar: props.sidebar });
|
|
2252
2384
|
}
|
|
2253
2385
|
function App(props) {
|
|
2254
2386
|
const identity = props.identity || GUEST_CHAT_IDENTITY;
|