@invergent/agent-chat-react 2.19.0 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { cn, __publicField } from './chunk-47MF6JUW.js';
2
2
  import { createContext, memo, useRef, useEffect, useCallback, useMemo, useState, useLayoutEffect, lazy, useContext, Fragment as Fragment$1, Suspense, useSyncExternalStore, useId, Children } from 'react';
3
3
  import { Button } from '@invergent/ui-sdk/button';
4
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@invergent/ui-sdk/dropdown-menu';
5
+ import { Toggle, FilterPill } from '@invergent/ui-sdk/toggle';
4
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
7
  import { ConfirmDialog } from '@invergent/ui-sdk/confirm-dialog';
6
8
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@invergent/ui-sdk/dialog';
7
- import { ChevronDownIcon, AlertTriangle, ChevronDown, ChevronRight as ChevronRight$1, RefreshCw, CreditCard, File as File$1, FileImage, FileAudio, FileVideo, FileText, FileCode, FileArchive, FileSpreadsheet, PlugZapIcon, ChevronRightIcon, ArrowLeftIcon, Loader2Icon, InboxIcon, Loader2, AlertCircle, Pause, Play, Ban, TargetIcon, CalendarClockIcon, UsersIcon, Pen, Eraser, Type, MousePointer2, Hand, Maximize2, Undo2, Redo2, CheckIcon, CopyIcon, DownloadIcon, Maximize2Icon, LaptopIcon, MessageSquareIcon, UploadIcon, RefreshCwIcon, AlertCircleIcon, ExternalLinkIcon, ClipboardCheckIcon, ShieldAlertIcon, TimerIcon, CircleDotIcon, ChevronLeftIcon, Trash2Icon, SquareIcon, ArrowDownIcon, FileIcon, TrashIcon, FileTextIcon, Minimize2Icon, XIcon, Clock, ArrowRight, ListTreeIcon, PenLineIcon, PaperclipIcon, CloudIcon, HardDriveIcon, IdCardIcon, PlusIcon, TerminalIcon, SparklesIcon, ClockIcon, ShrinkIcon, FolderOpenIcon, FolderIcon, ImageIcon, CircleDot, XCircle, CheckCircle2, GlobeIcon, SearchIcon, ZapIcon, PanelTopIcon, ArrowUpIcon, ThumbsUpIcon, ThumbsDownIcon, FileCodeIcon, CodeIcon, FileArchiveIcon, FileVideoIcon, FileAudioIcon, FileImageIcon, FileChartLineIcon, FileSpreadsheetIcon, BookOpenIcon, GitBranchIcon, ActivityIcon, EyeIcon, LibraryIcon, ListTodoIcon, XCircleIcon, CheckCircle2Icon, Code, CircleCheckIcon, CircleXIcon, SkullIcon, CheckCircleIcon, CircleIcon } from 'lucide-react';
9
+ import { ChevronDownIcon, AlertTriangle, ChevronDown, ChevronRight as ChevronRight$1, RefreshCw, CreditCard, File as File$1, FileImage, FileAudio, FileVideo, FileText, FileCode, FileArchive, FileSpreadsheet, PlugZapIcon, ChevronRightIcon, ArrowLeftIcon, Loader2Icon, InboxIcon, Loader2, AlertCircle, Pause, Play, Ban, TargetIcon, CalendarClockIcon, Pen, Eraser, Type, MousePointer2, Hand, Maximize2, Undo2, Redo2, CheckIcon, CopyIcon, DownloadIcon, Maximize2Icon, LaptopIcon, MessageSquareIcon, UploadIcon, RefreshCwIcon, AlertCircleIcon, ExternalLinkIcon, ClipboardCheckIcon, ShieldAlertIcon, TimerIcon, CircleDotIcon, ChevronLeftIcon, Trash2Icon, SquareIcon, ArrowDownIcon, FileIcon, TrashIcon, FileTextIcon, Minimize2Icon, XIcon, Clock, ArrowRight, MinusIcon, PlusIcon, ListTreeIcon, PenLineIcon, PaperclipIcon, CloudIcon, HardDriveIcon, IdCardIcon, TerminalIcon, SparklesIcon, ClockIcon, ShrinkIcon, FolderOpenIcon, FolderIcon, ImageIcon, CircleDot, XCircle, CheckCircle2, GlobeIcon, SearchIcon, ZapIcon, PanelTopIcon, ArrowUpIcon, ThumbsUpIcon, ThumbsDownIcon, FileCodeIcon, CodeIcon, FileArchiveIcon, FileVideoIcon, FileAudioIcon, FileImageIcon, FileChartLineIcon, FileSpreadsheetIcon, BookOpenIcon, GitBranchIcon, ActivityIcon, EyeIcon, LibraryIcon, ListTodoIcon, XCircleIcon, CheckCircle2Icon, Code, CircleCheckIcon, CircleXIcon, SkullIcon, CheckCircleIcon, CircleIcon } from 'lucide-react';
8
10
  import { StickToBottom, useStickToBottomContext } from 'use-stick-to-bottom';
9
- import { cva } from 'class-variance-authority';
10
- import { Progress as Progress$1, Dialog as Dialog$1, Slot } from 'radix-ui';
11
- import '@invergent/ui-sdk/separator';
11
+ import { ButtonGroup } from '@invergent/ui-sdk/button-group';
12
12
  import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@invergent/ui-sdk/tooltip';
13
13
  import { cjk } from '@streamdown/cjk';
14
14
  import { code } from '@streamdown/code';
@@ -18,29 +18,46 @@ import { defaultRehypePlugins, Streamdown } from 'streamdown';
18
18
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
19
19
  import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@invergent/ui-sdk/collapsible';
20
20
  import { ThinkingOrb } from 'thinking-orbs';
21
+ import { Timeline, TimelineItem, TimelineHeader, TimelineSeparator, TimelineIndicator, TimelineContent } from '@invergent/ui-sdk/timeline';
22
+ import { CollapsibleHeader } from '@invergent/ui-sdk/collapsible-header';
21
23
  import { ScrollArea } from '@invergent/ui-sdk/scroll-area';
22
24
  import '@invergent/ui-sdk/select';
23
25
  import { createHighlighter } from 'shiki';
24
26
  import { Tabs, TabsList, TabsTrigger, TabsContent } from '@invergent/ui-sdk/tabs';
25
- import { Badge } from '@invergent/ui-sdk/badge';
27
+ import { TagPill, TonePill, TONE, Chip } from '@invergent/ui-sdk/chip';
28
+ import { TextLink } from '@invergent/ui-sdk/text-link';
26
29
  import { diffLines, diffWordsWithSpace } from 'diff';
27
30
  import AnsiImport from 'ansi-to-react';
28
31
  import { Textarea } from '@invergent/ui-sdk/textarea';
32
+ import { ChoiceCard, choiceCardVariants } from '@invergent/ui-sdk/choice-card';
29
33
  import { Input } from '@invergent/ui-sdk/input';
30
- import { Command as Command$1 } from 'cmdk';
34
+ import { Command, CommandList, CommandGroup, CommandItem, CommandEmpty } from '@invergent/ui-sdk/command';
35
+ import '@invergent/ui-sdk/hover-card';
31
36
  import { InputGroupButton, InputGroup, InputGroupTextarea, InputGroupAddon } from '@invergent/ui-sdk/input-group';
32
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@invergent/ui-sdk/dropdown-menu';
33
37
  import { Spinner } from '@invergent/ui-sdk/spinner';
34
38
  import { nanoid } from 'nanoid';
35
39
  import { BrandBeam } from '@invergent/ui-sdk/brand-beam';
36
40
  export { BrandBeam } from '@invergent/ui-sdk/brand-beam';
41
+ import { ProgressBar } from '@invergent/ui-sdk/progress-bar';
37
42
  import 'tokenlens';
38
- import { Popover, PopoverAnchor, PopoverTrigger, PopoverContent } from '@invergent/ui-sdk/popover';
43
+ import { Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions } from '@invergent/ui-sdk/item';
44
+ import { Popover, PopoverAnchor, PopoverContent } from '@invergent/ui-sdk/popover';
45
+ import { ResponsivePanel } from '@invergent/ui-sdk/responsive-panel';
46
+ import { Command as Command$1 } from 'cmdk';
39
47
  import { Skeleton } from '@invergent/ui-sdk/skeleton';
48
+ import { ListRow, listRowVariants } from '@invergent/ui-sdk/list-row';
49
+ import { Alert, AlertTitle, AlertDescription, AlertAction } from '@invergent/ui-sdk/alert';
40
50
  import { Checkbox } from '@invergent/ui-sdk/checkbox';
41
51
  import { Label } from '@invergent/ui-sdk/label';
52
+ import { SegmentedControl } from '@invergent/ui-sdk/segmented-control';
53
+ import { RabbitMark, RABBIT_MARK_BOX, RABBIT_MARK_PATH } from '@invergent/ui-sdk/rabbit-mark';
54
+ import { ViewSwitch, ToggleGroup, ToggleGroupItem } from '@invergent/ui-sdk/toggle-group';
42
55
  import { useTheme } from 'next-themes';
56
+ import { EmptyState } from '@invergent/ui-sdk/empty-state';
57
+ import { SectionLabel } from '@invergent/ui-sdk/section-label';
58
+ import { CONTROL_FIELD, CONTROL_OPTION } from '@invergent/ui-sdk/control-styles';
43
59
  import { formatDistanceToNow } from 'date-fns';
60
+ import { Badge } from '@invergent/ui-sdk/badge';
44
61
  import { Card, CardContent, CardHeader, CardTitle, CardAction } from '@invergent/ui-sdk/card';
45
62
 
46
63
  var AgentChatAdapterContext = createContext(null);
@@ -174,7 +191,6 @@ function BrowserShell({
174
191
  const [frame, setFrame] = useState(null);
175
192
  const [tabs, setTabs] = useState([]);
176
193
  const [nav, setNav] = useState({ url: "", title: "" });
177
- const [menuOpen, setMenuOpen] = useState(false);
178
194
  const [address, setAddress] = useState("");
179
195
  const editingRef = useRef(false);
180
196
  useEffect(() => {
@@ -329,15 +345,14 @@ function BrowserShell({
329
345
  }
330
346
  ),
331
347
  (onToggleControl || hasControl) && /* @__PURE__ */ jsx(
332
- Button,
348
+ Toggle,
333
349
  {
334
- type: "button",
335
- variant: hasControl ? "default" : "ghost",
336
- size: "icon-xs",
350
+ size: "sm",
337
351
  "data-testid": "browser-shell-control",
338
352
  "aria-label": hasControl ? "Return control" : "Take control",
339
- "aria-pressed": hasControl,
340
- onClick: onToggleControl,
353
+ pressed: hasControl,
354
+ onPressedChange: () => onToggleControl?.(),
355
+ className: "size-7 min-h-11 min-w-11 px-0 pointer-fine:min-h-0 pointer-fine:min-w-0",
341
356
  children: /* @__PURE__ */ jsx(Pointer, {})
342
357
  }
343
358
  ),
@@ -386,51 +401,12 @@ function BrowserShell({
386
401
  ]
387
402
  }
388
403
  ),
389
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
390
- /* @__PURE__ */ jsx(
391
- Button,
392
- {
393
- type: "button",
394
- variant: "ghost",
395
- size: "icon-xs",
396
- "aria-label": "More",
397
- onClick: () => setMenuOpen((open) => !open),
398
- children: /* @__PURE__ */ jsx(Ellipsis, {})
399
- }
400
- ),
401
- menuOpen && /* @__PURE__ */ jsxs(
402
- "div",
403
- {
404
- "data-testid": "browser-shell-menu",
405
- className: "absolute right-0 top-8 z-10 min-w-36 rounded-md border border-line bg-card py-1 text-xs shadow-md",
406
- children: [
407
- onMaximize && /* @__PURE__ */ jsx(
408
- "button",
409
- {
410
- type: "button",
411
- className: "block w-full px-3 py-1.5 text-left hover:bg-secondary",
412
- onClick: () => {
413
- setMenuOpen(false);
414
- onMaximize();
415
- },
416
- children: "Maximize"
417
- }
418
- ),
419
- onClose && /* @__PURE__ */ jsx(
420
- "button",
421
- {
422
- type: "button",
423
- className: "block w-full px-3 py-1.5 text-left hover:bg-secondary",
424
- onClick: () => {
425
- setMenuOpen(false);
426
- onClose();
427
- },
428
- children: "Close browser"
429
- }
430
- )
431
- ]
432
- }
433
- )
404
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
405
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": "More", children: /* @__PURE__ */ jsx(Ellipsis, {}) }) }),
406
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { "data-testid": "browser-shell-menu", align: "end", children: [
407
+ onMaximize && /* @__PURE__ */ jsx(DropdownMenuItem, { onSelect: onMaximize, children: "Maximize" }),
408
+ onClose && /* @__PURE__ */ jsx(DropdownMenuItem, { onSelect: onClose, children: "Close browser" })
409
+ ] })
434
410
  ] })
435
411
  ] }),
436
412
  showTabs && /* @__PURE__ */ jsx(
@@ -867,36 +843,6 @@ var ConversationScrollButton = ({
867
843
  }
868
844
  );
869
845
  };
870
- var buttonGroupVariants = cva(
871
- "group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 *:data-[slot=input]:px-4 has-[>[data-variant=outline]]:*:data-[slot=input-group]:border-border has-[>[data-variant=outline]]:*:data-[slot=input-group]:px-2.5 has-[>[data-variant=outline]]:*:data-[slot=select-trigger]:border-border has-[>[data-variant=outline]]:*:[[role=combobox]]:px-2.5 has-[>[data-variant=outline]]:[&>[data-slot=input-group]:has(:focus-visible)]:border-ring has-[>[data-variant=outline]]:[&>[data-slot=select-trigger]:focus-visible]:border-ring has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-none [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-variant=outline]]:[&>input]:border-border has-[>[data-variant=outline]]:[&>input:focus-visible]:border-ring",
872
- {
873
- variants: {
874
- orientation: {
875
- horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-none!",
876
- vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-none!"
877
- }
878
- },
879
- defaultVariants: {
880
- orientation: "horizontal"
881
- }
882
- }
883
- );
884
- function ButtonGroup({
885
- className,
886
- orientation,
887
- ...props
888
- }) {
889
- return /* @__PURE__ */ jsx(
890
- "div",
891
- {
892
- role: "group",
893
- "data-slot": "button-group",
894
- "data-orientation": orientation,
895
- className: cn(buttonGroupVariants({ orientation }), className),
896
- ...props
897
- }
898
- );
899
- }
900
846
  var streamdownRehypePlugins = Object.entries(defaultRehypePlugins).map(([name, plugin]) => {
901
847
  if (name !== "harden" || !Array.isArray(plugin)) return plugin;
902
848
  const [harden, options] = plugin;
@@ -1203,128 +1149,6 @@ var ReasoningContent = memo(
1203
1149
  Reasoning.displayName = "Reasoning";
1204
1150
  ReasoningTrigger.displayName = "ReasoningTrigger";
1205
1151
  ReasoningContent.displayName = "ReasoningContent";
1206
- var TimelineContext = createContext(
1207
- void 0
1208
- );
1209
- var useTimeline = () => {
1210
- const context = useContext(TimelineContext);
1211
- if (!context) {
1212
- throw new Error("useTimeline must be used within a Timeline");
1213
- }
1214
- return context;
1215
- };
1216
- function Timeline({
1217
- defaultValue = 1,
1218
- value,
1219
- onValueChange,
1220
- orientation = "vertical",
1221
- className,
1222
- children,
1223
- ...props
1224
- }) {
1225
- const [activeStep, setInternalStep] = useState(defaultValue);
1226
- const setActiveStep = useCallback(
1227
- (step) => {
1228
- if (value === void 0) {
1229
- setInternalStep(step);
1230
- }
1231
- onValueChange?.(step);
1232
- },
1233
- [value, onValueChange]
1234
- );
1235
- const currentStep = value ?? activeStep;
1236
- return /* @__PURE__ */ jsx(
1237
- TimelineContext.Provider,
1238
- {
1239
- value: { activeStep: currentStep, setActiveStep },
1240
- children: /* @__PURE__ */ jsx(
1241
- "div",
1242
- {
1243
- className: cn(
1244
- "group/timeline flex flex-col",
1245
- className
1246
- ),
1247
- "data-orientation": orientation,
1248
- "data-slot": "timeline",
1249
- ...props,
1250
- children
1251
- }
1252
- )
1253
- }
1254
- );
1255
- }
1256
- function TimelineContent({
1257
- className,
1258
- ...props
1259
- }) {
1260
- return /* @__PURE__ */ jsx(
1261
- "div",
1262
- {
1263
- className: cn("text-foreground text-sm min-w-0 overflow-hidden", className),
1264
- "data-slot": "timeline-content",
1265
- ...props
1266
- }
1267
- );
1268
- }
1269
- function TimelineHeader({
1270
- className,
1271
- ...props
1272
- }) {
1273
- return /* @__PURE__ */ jsx("div", { className: cn(className), "data-slot": "timeline-header", ...props });
1274
- }
1275
- function TimelineIndicator({
1276
- asChild = false,
1277
- className,
1278
- children,
1279
- ...props
1280
- }) {
1281
- const Comp = asChild ? Slot.Root : "div";
1282
- return /* @__PURE__ */ jsx(
1283
- Comp,
1284
- {
1285
- "aria-hidden": "true",
1286
- className: cn(
1287
- "border-primary/20 group-data-completed/timeline-item:border-primary absolute size-4 rounded-full border-2 top-1.25 -left-6 -translate-x-1/2",
1288
- className
1289
- ),
1290
- "data-slot": "timeline-indicator",
1291
- ...props,
1292
- children
1293
- }
1294
- );
1295
- }
1296
- function TimelineItem({ step, className, ...props }) {
1297
- const { activeStep } = useTimeline();
1298
- return /* @__PURE__ */ jsx(
1299
- "div",
1300
- {
1301
- className: cn(
1302
- "group/timeline-item has-[+[data-completed]]:**:data-[slot=timeline-separator]:bg-primary relative flex flex-col gap-0.5 ms-8 not-last:pb-6",
1303
- className
1304
- ),
1305
- "data-completed": step <= activeStep || void 0,
1306
- "data-slot": "timeline-item",
1307
- ...props
1308
- }
1309
- );
1310
- }
1311
- function TimelineSeparator({
1312
- className,
1313
- ...props
1314
- }) {
1315
- return /* @__PURE__ */ jsx(
1316
- "div",
1317
- {
1318
- "aria-hidden": "true",
1319
- className: cn(
1320
- "bg-primary/10 absolute self-start group-last/timeline-item:hidden -left-6 h-[calc(100%-1rem-0.25rem)] w-0.5 -translate-x-1/2 translate-y-4.5",
1321
- className
1322
- ),
1323
- "data-slot": "timeline-separator",
1324
- ...props
1325
- }
1326
- );
1327
- }
1328
1152
 
1329
1153
  // src/runtime/orb-state.ts
1330
1154
  var ORB_STATE_LABELS = {
@@ -1645,10 +1469,11 @@ function toolErrorSummary(result, max = 180) {
1645
1469
  function CopyButton({ text }) {
1646
1470
  const [copied, setCopied] = useState(false);
1647
1471
  return /* @__PURE__ */ jsx(
1648
- "button",
1472
+ Button,
1649
1473
  {
1650
- type: "button",
1651
- className: "shrink-0 p-0.5 rounded opacity-0 group-hover/in:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",
1474
+ variant: "ghost",
1475
+ size: "icon-xs",
1476
+ className: "opacity-0 text-muted-foreground hover:text-foreground group-hover/in:opacity-100 focus-visible:opacity-100",
1652
1477
  onClick: (e) => {
1653
1478
  e.stopPropagation();
1654
1479
  void navigator.clipboard.writeText(text).then(() => {
@@ -1710,18 +1535,7 @@ function TerminalCollapsible({ command, output, isRunning, hasError }) {
1710
1535
  onOpenChange: setIsOpen,
1711
1536
  className: "not-prose w-full",
1712
1537
  children: [
1713
- /* @__PURE__ */ jsxs(CollapsibleTrigger, { className: "group/trigger flex w-fit items-center gap-2 text-sm transition-colors", children: [
1714
- /* @__PURE__ */ jsx("span", { className: "text-left", children: isRunning ? /* @__PURE__ */ jsx(Shimmer, { as: "span", duration: 1, children: "Running command..." }) : hasError ? /* @__PURE__ */ jsx("span", { className: "font-semibold text-destructive", children: "Command failed" }) : /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: "Command" }) }),
1715
- /* @__PURE__ */ jsx(
1716
- ChevronDownIcon,
1717
- {
1718
- className: cn(
1719
- "size-4 shrink-0 transition-transform",
1720
- isOpen ? "rotate-180" : "rotate-0"
1721
- )
1722
- }
1723
- )
1724
- ] }),
1538
+ /* @__PURE__ */ jsx(CollapsibleHeader, { className: "-ml-2 w-fit max-w-full", children: isRunning ? /* @__PURE__ */ jsx(Shimmer, { as: "span", duration: 1, children: "Running command..." }) : hasError ? /* @__PURE__ */ jsx("span", { className: "font-medium text-destructive", children: "Command failed" }) : /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: "Command" }) }),
1725
1539
  /* @__PURE__ */ jsx(
1726
1540
  CollapsibleContent,
1727
1541
  {
@@ -1845,28 +1659,13 @@ var QueueList = ({
1845
1659
  children,
1846
1660
  className,
1847
1661
  ...props
1848
- }) => /* @__PURE__ */ jsx(ScrollArea, { className: cn("mt-2 -mb-1", className), ...props, children: /* @__PURE__ */ jsx("div", { className: "max-h-40 pr-4", children: /* @__PURE__ */ jsx("ul", { children }) }) });
1662
+ }) => /* @__PURE__ */ jsx(ScrollArea, { className, ...props, children: /* @__PURE__ */ jsx("div", { className: "max-h-40 pr-4", children: /* @__PURE__ */ jsx("ul", { children }) }) });
1849
1663
  var QueueSection = ({
1850
1664
  className,
1851
1665
  defaultOpen = true,
1852
1666
  ...props
1853
1667
  }) => /* @__PURE__ */ jsx(Collapsible, { className: cn(className), defaultOpen, ...props });
1854
- var QueueSectionTrigger = ({
1855
- children,
1856
- className,
1857
- ...props
1858
- }) => /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
1859
- "button",
1860
- {
1861
- className: cn(
1862
- "group flex w-full items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-left font-medium text-muted-foreground text-sm transition-colors hover:bg-muted",
1863
- className
1864
- ),
1865
- type: "button",
1866
- ...props,
1867
- children
1868
- }
1869
- ) });
1668
+ var QueueSectionTrigger = (props) => /* @__PURE__ */ jsx(CollapsibleHeader, { variant: "section", ...props });
1870
1669
  var QueueSectionLabel = ({
1871
1670
  count,
1872
1671
  label,
@@ -1874,7 +1673,6 @@ var QueueSectionLabel = ({
1874
1673
  className,
1875
1674
  ...props
1876
1675
  }) => /* @__PURE__ */ jsxs("span", { className: cn("flex items-center gap-2", className), ...props, children: [
1877
- /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 transition-transform group-data-[state=closed]:-rotate-90" }),
1878
1676
  icon,
1879
1677
  /* @__PURE__ */ jsxs("span", { children: [
1880
1678
  count,
@@ -1885,12 +1683,18 @@ var QueueSectionLabel = ({
1885
1683
  var QueueSectionContent = ({
1886
1684
  className,
1887
1685
  ...props
1888
- }) => /* @__PURE__ */ jsx(CollapsibleContent, { className: cn(className), ...props });
1686
+ }) => /* @__PURE__ */ jsx(
1687
+ CollapsibleContent,
1688
+ {
1689
+ className: cn("border-t border-foreground/[0.08] p-1.5", className),
1690
+ ...props
1691
+ }
1692
+ );
1889
1693
  var Queue = ({ className, ...props }) => /* @__PURE__ */ jsx(
1890
1694
  "div",
1891
1695
  {
1892
1696
  className: cn(
1893
- "flex flex-col gap-2 rounded-xl border border-border bg-background px-3 pt-2 pb-2 shadow-xs",
1697
+ "flex flex-col overflow-hidden rounded-[10px] border border-foreground/[0.08] bg-background",
1894
1698
  className
1895
1699
  ),
1896
1700
  ...props
@@ -2228,7 +2032,7 @@ var CodeBlockCopyButton = ({
2228
2032
  );
2229
2033
  };
2230
2034
  var statusLabels = {
2231
- "approval-requested": "Awaiting Approval",
2035
+ "approval-requested": "Awaiting approval",
2232
2036
  "approval-responded": "Responded",
2233
2037
  "input-available": "Running",
2234
2038
  "input-streaming": "Pending",
@@ -2236,16 +2040,25 @@ var statusLabels = {
2236
2040
  "output-denied": "Denied",
2237
2041
  "output-error": "Error"
2238
2042
  };
2043
+ var statusTones = {
2044
+ "approval-requested": "warn",
2045
+ "approval-responded": "muted",
2046
+ "input-available": "muted",
2047
+ "input-streaming": "muted",
2048
+ "output-available": "ok",
2049
+ "output-denied": "warn",
2050
+ "output-error": "bad"
2051
+ };
2239
2052
  var statusIcons = {
2240
- "approval-requested": /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 text-yellow-600" }),
2241
- "approval-responded": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-blue-600" }),
2242
- "input-available": /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 animate-pulse" }),
2243
- "input-streaming": /* @__PURE__ */ jsx(CircleIcon, { className: "size-4" }),
2244
- "output-available": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-green-600" }),
2245
- "output-denied": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-orange-600" }),
2246
- "output-error": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-red-600" })
2053
+ "approval-requested": /* @__PURE__ */ jsx(ClockIcon, { className: "size-3" }),
2054
+ "approval-responded": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-3" }),
2055
+ "input-available": /* @__PURE__ */ jsx(ClockIcon, { className: "size-3 animate-pulse" }),
2056
+ "input-streaming": /* @__PURE__ */ jsx(CircleIcon, { className: "size-3" }),
2057
+ "output-available": /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-3" }),
2058
+ "output-denied": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-3" }),
2059
+ "output-error": /* @__PURE__ */ jsx(XCircleIcon, { className: "size-3" })
2247
2060
  };
2248
- var getStatusBadge = (status) => /* @__PURE__ */ jsxs(Badge, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
2061
+ var getStatusBadge = (status) => /* @__PURE__ */ jsxs(TonePill, { tone: statusTones[status], children: [
2249
2062
  statusIcons[status],
2250
2063
  statusLabels[status]
2251
2064
  ] });
@@ -2253,7 +2066,7 @@ var Sandbox = ({ className, ...props }) => /* @__PURE__ */ jsx(
2253
2066
  Collapsible,
2254
2067
  {
2255
2068
  className: cn(
2256
- "not-prose group mb-4 w-full overflow-hidden rounded-md border border-foreground/20",
2069
+ "not-prose mb-4 w-full overflow-hidden rounded-[10px] border border-foreground/[0.08]",
2257
2070
  className
2258
2071
  ),
2259
2072
  defaultOpen: true,
@@ -2265,22 +2078,17 @@ var SandboxHeader = ({
2265
2078
  title,
2266
2079
  state,
2267
2080
  ...props
2268
- }) => /* @__PURE__ */ jsxs(
2269
- CollapsibleTrigger,
2081
+ }) => /* @__PURE__ */ jsx(
2082
+ CollapsibleHeader,
2270
2083
  {
2271
- className: cn(
2272
- "flex w-full items-center justify-between gap-4 p-3",
2273
- className
2274
- ),
2084
+ variant: "section",
2085
+ icon: Code,
2086
+ className,
2275
2087
  ...props,
2276
- children: [
2277
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2278
- /* @__PURE__ */ jsx(Code, { className: "size-4 text-muted-foreground" }),
2279
- /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: title }),
2280
- getStatusBadge(state)
2281
- ] }),
2282
- /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
2283
- ]
2088
+ children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
2089
+ title,
2090
+ getStatusBadge(state)
2091
+ ] })
2284
2092
  }
2285
2093
  );
2286
2094
  var SandboxContent = ({
@@ -2304,7 +2112,7 @@ var SandboxTabsBar = ({
2304
2112
  "div",
2305
2113
  {
2306
2114
  className: cn(
2307
- "flex w-full items-center border-border border-t border-b",
2115
+ "flex w-full items-center border-foreground/[0.08] border-t border-b px-2 py-1.5",
2308
2116
  className
2309
2117
  ),
2310
2118
  ...props
@@ -2313,26 +2121,11 @@ var SandboxTabsBar = ({
2313
2121
  var SandboxTabsList = ({
2314
2122
  className,
2315
2123
  ...props
2316
- }) => /* @__PURE__ */ jsx(
2317
- TabsList,
2318
- {
2319
- className: cn("h-auto rounded-none border-0 bg-transparent p-0", className),
2320
- ...props
2321
- }
2322
- );
2124
+ }) => /* @__PURE__ */ jsx(TabsList, { variant: "line", className, ...props });
2323
2125
  var SandboxTabsTrigger = ({
2324
2126
  className,
2325
2127
  ...props
2326
- }) => /* @__PURE__ */ jsx(
2327
- TabsTrigger,
2328
- {
2329
- className: cn(
2330
- "rounded-none border-0 border-transparent border-b-2 px-4 py-2 font-medium text-muted-foreground text-sm transition-colors data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none",
2331
- className
2332
- ),
2333
- ...props
2334
- }
2335
- );
2128
+ }) => /* @__PURE__ */ jsx(TabsTrigger, { className, ...props });
2336
2129
  var SandboxTabContent = ({
2337
2130
  className,
2338
2131
  ...props
@@ -2783,11 +2576,12 @@ function CollapsedBlock({
2783
2576
  return /* @__PURE__ */ jsxs("div", { className: "flex text-sm leading-5 bg-muted/30 border-y border-border/30", children: [
2784
2577
  /* @__PURE__ */ jsx("span", { className: "w-10 shrink-0" }),
2785
2578
  /* @__PURE__ */ jsxs(
2786
- "button",
2579
+ Button,
2787
2580
  {
2788
- type: "button",
2581
+ variant: "ghost",
2582
+ size: "xs",
2789
2583
  onClick: onExpand,
2790
- className: "flex-1 text-left px-3 py-0.5 text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors cursor-pointer",
2584
+ className: "flex-1 justify-start rounded-none font-normal text-muted-foreground hover:text-foreground",
2791
2585
  children: [
2792
2586
  "\u2195 ",
2793
2587
  count,
@@ -2929,15 +2723,7 @@ function FileNameWithTooltip({
2929
2723
  const display = displayPath(filePath);
2930
2724
  const name = fileName(filePath);
2931
2725
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
2932
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: onFileSelect ? /* @__PURE__ */ jsx(
2933
- "button",
2934
- {
2935
- type: "button",
2936
- onClick: () => onFileSelect(filePath),
2937
- className: "text-primary hover:underline truncate text-left cursor-pointer underline",
2938
- children: name
2939
- }
2940
- ) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground truncate", children: name }) }),
2726
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: onFileSelect ? /* @__PURE__ */ jsx(TextLink, { size: "inline", asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onFileSelect(filePath), className: "truncate text-left", children: name }) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground truncate", children: name }) }),
2941
2727
  /* @__PURE__ */ jsx(TooltipContent, { side: "top", children: display })
2942
2728
  ] });
2943
2729
  }
@@ -3355,17 +3141,14 @@ function truncateCommand(cmd, max = 80) {
3355
3141
  }
3356
3142
  function StatusBadge({ status, exitCode }) {
3357
3143
  if (status === "running") {
3358
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-emerald-600 dark:text-emerald-400", children: [
3144
+ return /* @__PURE__ */ jsxs(TonePill, { tone: "ok", children: [
3359
3145
  /* @__PURE__ */ jsx(CircleDotIcon, { className: "size-3 animate-pulse" }),
3360
3146
  "running"
3361
3147
  ] });
3362
3148
  }
3363
3149
  if (status === "exited") {
3364
3150
  const ok = exitCode === 0;
3365
- return /* @__PURE__ */ jsxs("span", { className: cn(
3366
- "inline-flex items-center gap-1 text-xs font-medium",
3367
- ok ? "text-muted-foreground" : "text-red-500 dark:text-red-400"
3368
- ), children: [
3151
+ return /* @__PURE__ */ jsxs(TonePill, { tone: ok ? "muted" : "bad", children: [
3369
3152
  ok ? /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-3" }) : /* @__PURE__ */ jsx(CircleXIcon, { className: "size-3" }),
3370
3153
  "exited(",
3371
3154
  exitCode ?? "?",
@@ -3373,24 +3156,24 @@ function StatusBadge({ status, exitCode }) {
3373
3156
  ] });
3374
3157
  }
3375
3158
  if (status === "killed") {
3376
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-orange-500 dark:text-orange-400", children: [
3159
+ return /* @__PURE__ */ jsxs(TonePill, { tone: "bad", children: [
3377
3160
  /* @__PURE__ */ jsx(SkullIcon, { className: "size-3" }),
3378
3161
  "killed"
3379
3162
  ] });
3380
3163
  }
3381
3164
  if (status === "timeout") {
3382
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-amber-500 dark:text-amber-400", children: [
3165
+ return /* @__PURE__ */ jsxs(TonePill, { tone: "warn", children: [
3383
3166
  /* @__PURE__ */ jsx(ClockIcon, { className: "size-3" }),
3384
3167
  "timeout"
3385
3168
  ] });
3386
3169
  }
3387
3170
  if (status === "interrupted") {
3388
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-amber-500 dark:text-amber-400", children: [
3171
+ return /* @__PURE__ */ jsxs(TonePill, { tone: "warn", children: [
3389
3172
  /* @__PURE__ */ jsx(CircleXIcon, { className: "size-3" }),
3390
3173
  "interrupted"
3391
3174
  ] });
3392
3175
  }
3393
- return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-muted-foreground", children: status });
3176
+ return /* @__PURE__ */ jsx(TonePill, { children: status });
3394
3177
  }
3395
3178
  function ProcessListView({ processes }) {
3396
3179
  if (processes.length === 0) {
@@ -3662,36 +3445,16 @@ function ExpertToolBlock({ tc }) {
3662
3445
  const question = args.question ?? args.prompt ?? "";
3663
3446
  const result = parseExpertResult(tc.result);
3664
3447
  const failed = Boolean(result?.error);
3665
- return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
3666
- /* @__PURE__ */ jsxs(
3667
- "button",
3668
- {
3669
- type: "button",
3670
- onClick: () => setExpanded(!expanded),
3671
- className: cn(
3672
- "flex w-fit max-w-full items-center gap-1.5 rounded-md px-0 py-0.5",
3673
- "text-sm text-muted-foreground hover:text-foreground transition-colors"
3674
- ),
3675
- children: [
3676
- /* @__PURE__ */ jsx(
3677
- ChevronRightIcon,
3678
- {
3679
- className: cn(
3680
- "size-3 shrink-0 transition-transform duration-150",
3681
- expanded && "rotate-90"
3682
- )
3683
- }
3684
- ),
3685
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: "Consulted expert" }),
3686
- expertName && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
3687
- "\xB7 ",
3688
- expertName
3689
- ] }),
3690
- failed && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "\xB7 failed" })
3691
- ]
3692
- }
3693
- ),
3694
- expanded && /* @__PURE__ */ jsxs("div", { className: "ml-6 mt-0.5 space-y-1.5 text-sm", children: [
3448
+ return /* @__PURE__ */ jsxs(Collapsible, { open: expanded, onOpenChange: setExpanded, className: "space-y-1", children: [
3449
+ /* @__PURE__ */ jsx(CollapsibleHeader, { className: "-ml-2 w-fit max-w-full", children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
3450
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 font-medium text-foreground", children: "Consulted expert" }),
3451
+ expertName && /* @__PURE__ */ jsxs("span", { className: "truncate text-muted-foreground", children: [
3452
+ "\xB7 ",
3453
+ expertName
3454
+ ] }),
3455
+ failed && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-red-500", children: "\xB7 failed" })
3456
+ ] }) }),
3457
+ /* @__PURE__ */ jsxs(CollapsibleContent, { className: "ml-6 mt-0.5 space-y-1.5 text-sm", children: [
3695
3458
  question && /* @__PURE__ */ jsx(ExpertDetail, { label: "Question", content: question }),
3696
3459
  result?.summary && /* @__PURE__ */ jsx(
3697
3460
  ExpertDetail,
@@ -4049,25 +3812,20 @@ function QuickReply({
4049
3812
  disabled,
4050
3813
  onSelect
4051
3814
  }) {
4052
- return /* @__PURE__ */ jsxs(
4053
- "button",
4054
- {
4055
- type: "button",
4056
- disabled,
4057
- onClick: onSelect,
4058
- className: cn(
4059
- "border border-border bg-background text-left text-foreground transition-colors",
4060
- "hover:border-foreground/30 hover:bg-muted",
4061
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4062
- "disabled:cursor-not-allowed disabled:opacity-50",
4063
- stacked ? "rounded-md px-3 py-2" : "rounded-full px-3.5 py-1.5 text-sm"
4064
- ),
4065
- children: [
4066
- /* @__PURE__ */ jsx("span", { className: cn("block", stacked && "text-sm"), children: choice.label }),
4067
- stacked && choice.description && /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: choice.description })
4068
- ]
4069
- }
4070
- );
3815
+ if (stacked) {
3816
+ return /* @__PURE__ */ jsx(
3817
+ ChoiceCard,
3818
+ {
3819
+ size: "sm",
3820
+ selected: false,
3821
+ title: choice.label,
3822
+ description: choice.description,
3823
+ disabled,
3824
+ onClick: onSelect
3825
+ }
3826
+ );
3827
+ }
3828
+ return /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled, onClick: onSelect, children: choice.label });
4071
3829
  }
4072
3830
  function BatchAsk({
4073
3831
  tc,
@@ -4183,74 +3941,68 @@ function BatchAsk({
4183
3941
  role: "group",
4184
3942
  "aria-label": "Questions for the user",
4185
3943
  children: [
4186
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border px-3 pt-2", children: [
4187
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 overflow-x-auto text-sm", children: questions.map((_, i) => {
4188
- const isActive = i === active;
4189
- const answered = answers[i] !== null;
4190
- return /* @__PURE__ */ jsxs(
4191
- "button",
4192
- {
4193
- type: "button",
4194
- onClick: () => setActive(i),
4195
- className: cn(
4196
- "relative pb-2 transition-colors whitespace-nowrap",
4197
- isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground"
4198
- ),
4199
- children: [
4200
- /* @__PURE__ */ jsxs("span", { children: [
4201
- "Question ",
4202
- i + 1
4203
- ] }),
4204
- answered && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[10px] text-emerald-500", children: "\u25CF" }),
4205
- isActive && /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 bottom-0 h-px bg-foreground" })
4206
- ]
4207
- },
4208
- i
4209
- );
4210
- }) }),
4211
- /* @__PURE__ */ jsx(
4212
- Button,
4213
- {
4214
- type: "button",
4215
- variant: "ghost",
4216
- size: "icon-xs",
4217
- onClick: handleCancel,
4218
- className: "ml-2",
4219
- "aria-label": "Cancel clarification and stop chat",
4220
- title: "Esc \u2014 cancel and stop the chat",
4221
- children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" })
4222
- }
4223
- )
4224
- ] }),
4225
- /* @__PURE__ */ jsx("div", { className: "px-3 pt-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: current.prompt }) }),
4226
- /* @__PURE__ */ jsxs("div", { className: "mt-3 px-1 pb-2", children: [
4227
- (current.choices ?? []).map((choice, i) => /* @__PURE__ */ jsx(
4228
- ChoiceRow,
4229
- {
4230
- choice,
4231
- selected: currentSel.index === i,
4232
- onSelect: () => selectChoice(i)
4233
- },
4234
- i
4235
- )),
4236
- (current.allow_other ?? true) && /* @__PURE__ */ jsx(
4237
- OtherRow,
4238
- {
4239
- selected: currentSel.index >= OTHER_INDEX_OFFSET,
4240
- value: currentSel.other,
4241
- onSelect: () => updateSelection({ index: OTHER_INDEX_OFFSET }),
4242
- onChange: (v) => updateSelection({ index: OTHER_INDEX_OFFSET, other: v }),
4243
- onCommit: () => {
4244
- if (allAnswered) void handleSubmit();
4245
- else advance();
4246
- }
4247
- }
4248
- )
4249
- ] }),
4250
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-border px-3 py-2", children: [
4251
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 text-xs text-muted-foreground", children: [
4252
- /* @__PURE__ */ jsxs("span", { className: "mr-2 tabular-nums", children: [
4253
- answeredCount,
3944
+ /* @__PURE__ */ jsxs(
3945
+ Tabs,
3946
+ {
3947
+ value: String(active),
3948
+ onValueChange: (value) => setActive(Number(value)),
3949
+ className: "gap-0",
3950
+ children: [
3951
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
3952
+ /* @__PURE__ */ jsx(TabsList, { variant: "line", className: "no-scrollbar max-w-full overflow-x-auto", children: questions.map((_, i) => /* @__PURE__ */ jsxs(TabsTrigger, { value: String(i), children: [
3953
+ "Question ",
3954
+ i + 1,
3955
+ answers[i] !== null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-emerald-500", children: "\u25CF" })
3956
+ ] }, i)) }),
3957
+ /* @__PURE__ */ jsx(
3958
+ Button,
3959
+ {
3960
+ type: "button",
3961
+ variant: "ghost",
3962
+ size: "icon-xs",
3963
+ onClick: handleCancel,
3964
+ "aria-label": "Cancel clarification and stop chat",
3965
+ title: "Esc \u2014 cancel and stop the chat",
3966
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" })
3967
+ }
3968
+ )
3969
+ ] }),
3970
+ /* @__PURE__ */ jsxs(TabsContent, { value: String(active), children: [
3971
+ /* @__PURE__ */ jsx("div", { className: "px-3 pt-3", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: current.prompt }) }),
3972
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-col gap-1.5 px-3 pb-3", children: [
3973
+ (current.choices ?? []).map((choice, i) => /* @__PURE__ */ jsx(
3974
+ ChoiceCard,
3975
+ {
3976
+ size: "sm",
3977
+ selected: currentSel.index === i,
3978
+ title: choice.label,
3979
+ description: choice.description,
3980
+ onClick: () => selectChoice(i)
3981
+ },
3982
+ i
3983
+ )),
3984
+ (current.allow_other ?? true) && /* @__PURE__ */ jsx(
3985
+ OtherRow,
3986
+ {
3987
+ selected: currentSel.index >= OTHER_INDEX_OFFSET,
3988
+ value: currentSel.other,
3989
+ onSelect: () => updateSelection({ index: OTHER_INDEX_OFFSET }),
3990
+ onChange: (v) => updateSelection({ index: OTHER_INDEX_OFFSET, other: v }),
3991
+ onCommit: () => {
3992
+ if (allAnswered) void handleSubmit();
3993
+ else advance();
3994
+ }
3995
+ }
3996
+ )
3997
+ ] })
3998
+ ] })
3999
+ ]
4000
+ }
4001
+ ),
4002
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-border px-3 py-2", children: [
4003
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 text-xs text-muted-foreground", children: [
4004
+ /* @__PURE__ */ jsxs("span", { className: "mr-2 tabular-nums", children: [
4005
+ answeredCount,
4254
4006
  " of ",
4255
4007
  questions.length,
4256
4008
  " answered"
@@ -4273,30 +4025,6 @@ function BatchAsk({
4273
4025
  }
4274
4026
  );
4275
4027
  }
4276
- function ChoiceRow({
4277
- choice,
4278
- selected,
4279
- onSelect
4280
- }) {
4281
- return /* @__PURE__ */ jsxs(
4282
- "button",
4283
- {
4284
- type: "button",
4285
- onClick: onSelect,
4286
- className: cn(
4287
- "flex w-full items-start gap-3 rounded px-2 py-1.5 text-left transition-colors",
4288
- selected ? "bg-muted" : "hover:bg-muted/40"
4289
- ),
4290
- children: [
4291
- /* @__PURE__ */ jsx(Radio, { selected }),
4292
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
4293
- /* @__PURE__ */ jsx("div", { className: "text-sm text-foreground", children: choice.label }),
4294
- choice.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: choice.description })
4295
- ] })
4296
- ]
4297
- }
4298
- );
4299
- }
4300
4028
  function OtherRow({
4301
4029
  selected,
4302
4030
  value,
@@ -4308,55 +4036,33 @@ function OtherRow({
4308
4036
  "div",
4309
4037
  {
4310
4038
  className: cn(
4311
- "flex items-start gap-3 rounded px-2 py-1.5 transition-colors",
4312
- selected ? "bg-muted" : "hover:bg-muted/40"
4039
+ choiceCardVariants({ size: "sm", selected }),
4040
+ "cursor-pointer flex-col gap-1.5 sm:gap-1.5"
4313
4041
  ),
4042
+ onClick: onSelect,
4314
4043
  children: [
4044
+ /* @__PURE__ */ jsx("span", { className: "text-[14px] font-medium text-foreground sm:text-[13px]", children: "Other" }),
4315
4045
  /* @__PURE__ */ jsx(
4316
- "button",
4046
+ Input,
4317
4047
  {
4318
- type: "button",
4319
- onClick: onSelect,
4320
- className: "flex shrink-0 items-center pt-0.5",
4321
- "aria-label": "Choose Other",
4322
- children: /* @__PURE__ */ jsx(Radio, { selected })
4048
+ "aria-label": "Other answer",
4049
+ placeholder: "Type your answer\u2026",
4050
+ value,
4051
+ onFocus: onSelect,
4052
+ onChange: (e) => onChange(e.target.value),
4053
+ onKeyDown: (e) => {
4054
+ if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && value.trim()) {
4055
+ e.preventDefault();
4056
+ onCommit();
4057
+ }
4058
+ },
4059
+ className: "h-8 text-[13px]"
4323
4060
  }
4324
- ),
4325
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
4326
- /* @__PURE__ */ jsx("div", { className: "text-sm text-foreground", children: "Other" }),
4327
- /* @__PURE__ */ jsx(
4328
- Input,
4329
- {
4330
- placeholder: "Type your answer\u2026",
4331
- value,
4332
- onFocus: onSelect,
4333
- onChange: (e) => onChange(e.target.value),
4334
- onKeyDown: (e) => {
4335
- if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && value.trim()) {
4336
- e.preventDefault();
4337
- onCommit();
4338
- }
4339
- },
4340
- className: "mt-0.5 h-7 px-0 text-xs"
4341
- }
4342
- )
4343
- ] })
4061
+ )
4344
4062
  ]
4345
4063
  }
4346
4064
  );
4347
4065
  }
4348
- function Radio({ selected }) {
4349
- return /* @__PURE__ */ jsx(
4350
- "span",
4351
- {
4352
- "aria-hidden": true,
4353
- className: cn(
4354
- "mt-[3px] size-3.5 shrink-0 rounded-full border",
4355
- selected ? "border-foreground bg-foreground" : "border-muted-foreground/60 bg-transparent"
4356
- )
4357
- }
4358
- );
4359
- }
4360
4066
  function BatchAskLocked({
4361
4067
  tc,
4362
4068
  questions,
@@ -4469,28 +4175,17 @@ function MemoryToolBlock({ tc }) {
4469
4175
  const targetLabel = TARGET_LABEL[target] ?? target;
4470
4176
  const failed = result?.success === false || !!result?.error;
4471
4177
  return /* @__PURE__ */ jsxs(Collapsible, { open: isOpen, onOpenChange: setIsOpen, className: "not-prose w-full", children: [
4472
- /* @__PURE__ */ jsxs(CollapsibleTrigger, { className: "group/trigger flex w-fit items-center gap-2 text-sm transition-colors", children: [
4473
- /* @__PURE__ */ jsxs("span", { className: "text-left", children: [
4474
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: verb }),
4178
+ /* @__PURE__ */ jsx(CollapsibleHeader, { className: "-ml-2 w-fit max-w-full", children: /* @__PURE__ */ jsxs("span", { children: [
4179
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: verb }),
4180
+ " ",
4181
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
4182
+ prep,
4475
4183
  " ",
4476
- /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
4477
- prep,
4478
- " ",
4479
- targetLabel
4480
- ] }),
4481
- result?.usage && !failed && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 ml-1.5 text-xs", children: result.usage }),
4482
- failed && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1.5", children: "\xB7 failed" })
4184
+ targetLabel
4483
4185
  ] }),
4484
- /* @__PURE__ */ jsx(
4485
- ChevronDownIcon,
4486
- {
4487
- className: cn(
4488
- "size-4 shrink-0 transition-transform",
4489
- isOpen ? "rotate-180" : "rotate-0"
4490
- )
4491
- }
4492
- )
4493
- ] }),
4186
+ result?.usage && !failed && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 ml-1.5 text-xs", children: result.usage }),
4187
+ failed && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1.5", children: "\xB7 failed" })
4188
+ ] }) }),
4494
4189
  /* @__PURE__ */ jsx(
4495
4190
  CollapsibleContent,
4496
4191
  {
@@ -4629,35 +4324,14 @@ function StatusIcon({ tc }) {
4629
4324
  return /* @__PURE__ */ jsx(CheckCircle2Icon, { className: "size-3.5 text-emerald-500" });
4630
4325
  }
4631
4326
  function DefaultToolBlock({ tc }) {
4632
- const [expanded, setExpanded] = useState(false);
4633
4327
  const summary = toolSummary(tc);
4634
- return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border/60 bg-muted/20 overflow-hidden", children: [
4635
- /* @__PURE__ */ jsxs(
4636
- "button",
4637
- {
4638
- type: "button",
4639
- onClick: () => setExpanded(!expanded),
4640
- className: cn(
4641
- "flex w-full items-center gap-2 px-3 py-2",
4642
- "text-sm hover:bg-muted/40 transition-colors cursor-pointer"
4643
- ),
4644
- children: [
4645
- /* @__PURE__ */ jsx(StatusIcon, { tc }),
4646
- /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: toolLabel(tc.toolName) }),
4647
- summary && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70 truncate text-xs flex-1 text-left", children: summary }),
4648
- /* @__PURE__ */ jsx(
4649
- ChevronRightIcon,
4650
- {
4651
- className: cn(
4652
- "size-3.5 shrink-0 text-muted-foreground/50 transition-transform duration-150 ml-auto",
4653
- expanded && "rotate-90"
4654
- )
4655
- }
4656
- )
4657
- ]
4658
- }
4659
- ),
4660
- expanded && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-3 py-2 space-y-2", children: [
4328
+ return /* @__PURE__ */ jsxs(Collapsible, { className: "overflow-hidden rounded-[10px] border border-foreground/[0.08]", children: [
4329
+ /* @__PURE__ */ jsx(CollapsibleHeader, { variant: "section", children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
4330
+ /* @__PURE__ */ jsx(StatusIcon, { tc }),
4331
+ /* @__PURE__ */ jsx("span", { className: "shrink-0", children: toolLabel(tc.toolName) }),
4332
+ summary && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-xs font-normal text-muted-foreground/70", children: summary })
4333
+ ] }) }),
4334
+ /* @__PURE__ */ jsxs(CollapsibleContent, { className: "space-y-2 border-t border-foreground/[0.08] px-3 py-2", children: [
4661
4335
  /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground font-mono whitespace-pre-wrap break-all", children: formatArgs(tc.args) }),
4662
4336
  tc.result && /* @__PURE__ */ jsxs("pre", { className: "overflow-x-auto rounded-md bg-muted/50 px-3 py-2 text-xs font-mono whitespace-pre-wrap break-all max-h-48 overflow-y-auto", children: [
4663
4337
  /* @__PURE__ */ jsx("span", { className: "text-emerald-600 dark:text-emerald-400 font-semibold", children: "Result" }),
@@ -4728,18 +4402,7 @@ function CodeRunToolBlock({
4728
4402
  onOpenChange: setIsOpen,
4729
4403
  className: "not-prose w-full",
4730
4404
  children: [
4731
- /* @__PURE__ */ jsxs(CollapsibleTrigger, { className: "group/trigger flex w-fit items-center gap-2 text-sm transition-colors", children: [
4732
- /* @__PURE__ */ jsx("span", { className: "text-left", children: isRunning ? /* @__PURE__ */ jsx(Shimmer, { as: "span", duration: 1, children: `Running ${label}...` }) : hasError ? /* @__PURE__ */ jsx("span", { className: "font-semibold text-destructive", children: `${label} failed` }) : /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: `Ran ${label}` }) }),
4733
- /* @__PURE__ */ jsx(
4734
- ChevronDownIcon,
4735
- {
4736
- className: cn(
4737
- "size-4 shrink-0 transition-transform",
4738
- isOpen ? "rotate-180" : "rotate-0"
4739
- )
4740
- }
4741
- )
4742
- ] }),
4405
+ /* @__PURE__ */ jsx(CollapsibleHeader, { className: "-ml-2 w-fit max-w-full", children: isRunning ? /* @__PURE__ */ jsx(Shimmer, { as: "span", duration: 1, children: `Running ${label}...` }) : hasError ? /* @__PURE__ */ jsx("span", { className: "font-medium text-destructive", children: `${label} failed` }) : /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: `Ran ${label}` }) }),
4743
4406
  /* @__PURE__ */ jsx(
4744
4407
  CollapsibleContent,
4745
4408
  {
@@ -5417,88 +5080,6 @@ function renderInlineMarkdown(text) {
5417
5080
  }
5418
5081
  });
5419
5082
  }
5420
- function Command({
5421
- className,
5422
- ...props
5423
- }) {
5424
- return /* @__PURE__ */ jsx(
5425
- Command$1,
5426
- {
5427
- "data-slot": "command",
5428
- className: cn(
5429
- "flex size-full flex-col overflow-hidden bg-popover text-popover-foreground",
5430
- className
5431
- ),
5432
- ...props
5433
- }
5434
- );
5435
- }
5436
- function CommandList({
5437
- className,
5438
- ...props
5439
- }) {
5440
- return /* @__PURE__ */ jsx(
5441
- Command$1.List,
5442
- {
5443
- "data-slot": "command-list",
5444
- className: cn(
5445
- "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
5446
- className
5447
- ),
5448
- ...props
5449
- }
5450
- );
5451
- }
5452
- function CommandEmpty({
5453
- className,
5454
- ...props
5455
- }) {
5456
- return /* @__PURE__ */ jsx(
5457
- Command$1.Empty,
5458
- {
5459
- "data-slot": "command-empty",
5460
- className: cn("py-6 text-center text-sm", className),
5461
- ...props
5462
- }
5463
- );
5464
- }
5465
- function CommandGroup({
5466
- className,
5467
- ...props
5468
- }) {
5469
- return /* @__PURE__ */ jsx(
5470
- Command$1.Group,
5471
- {
5472
- "data-slot": "command-group",
5473
- className: cn(
5474
- "overflow-hidden p-1.5 text-foreground **:[[cmdk-group-heading]]:mb-1 **:[[cmdk-group-heading]]:rounded-sm **:[[cmdk-group-heading]]:bg-orange-100 **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-semibold **:[[cmdk-group-heading]]:tracking-wider **:[[cmdk-group-heading]]:text-foreground dark:**:[[cmdk-group-heading]]:bg-orange-400/40 dark:**:[[cmdk-group-heading]]:text-foreground/90",
5475
- className
5476
- ),
5477
- ...props
5478
- }
5479
- );
5480
- }
5481
- function CommandItem({
5482
- className,
5483
- children,
5484
- ...props
5485
- }) {
5486
- return /* @__PURE__ */ jsxs(
5487
- Command$1.Item,
5488
- {
5489
- "data-slot": "command-item",
5490
- className: cn(
5491
- "group/command-item relative flex cursor-default items-center gap-2 rounded-none px-3 py-2 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-muted data-[selected=true]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[selected=true]:*:[svg]:text-foreground",
5492
- className
5493
- ),
5494
- ...props,
5495
- children: [
5496
- children,
5497
- /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })
5498
- ]
5499
- }
5500
- );
5501
- }
5502
5083
  var convertBlobUrlToDataUrl = async (url) => {
5503
5084
  try {
5504
5085
  const response = await fetch(url);
@@ -6203,31 +5784,6 @@ function splitComposerFiles(files) {
6203
5784
  }
6204
5785
  return { images, pending };
6205
5786
  }
6206
- function Progress({
6207
- className,
6208
- value,
6209
- ...props
6210
- }) {
6211
- return /* @__PURE__ */ jsx(
6212
- Progress$1.Root,
6213
- {
6214
- "data-slot": "progress",
6215
- className: cn(
6216
- "relative flex h-0.5 w-full items-center overflow-x-hidden rounded-none bg-muted",
6217
- className
6218
- ),
6219
- ...props,
6220
- children: /* @__PURE__ */ jsx(
6221
- Progress$1.Indicator,
6222
- {
6223
- "data-slot": "progress-indicator",
6224
- className: "size-full flex-1 bg-primary transition-all",
6225
- style: { transform: `translateX(-${100 - (value || 0)}%)` }
6226
- }
6227
- )
6228
- }
6229
- );
6230
- }
6231
5787
  var PERCENT_MAX = 100;
6232
5788
  var NEARLY_FULL = 0.9;
6233
5789
  var ICON_RADIUS = 10;
@@ -6342,20 +5898,9 @@ var ContextContentHeader = ({
6342
5898
  ] })
6343
5899
  ] }),
6344
5900
  /* @__PURE__ */ jsx(
6345
- Progress,
5901
+ ProgressBar,
6346
5902
  {
6347
- className: cn(
6348
- // The primitive only clips its x-axis, which leaves the fill's
6349
- // square end poking out of the pill at both ends.
6350
- "h-1 overflow-hidden rounded-full bg-muted",
6351
- // Amber, not `bg-primary`: primary is the host app's colour, and
6352
- // the two hosts disagree — the agent web app is amber, Studio is
6353
- // near-black — so the same bar came out black beside a Send
6354
- // button the composer hardcodes amber. This is the composer's
6355
- // own accent, so it reads the same wherever it is embedded.
6356
- "[&>[data-slot=progress-indicator]]:bg-amber-500",
6357
- nearlyFull && "[&>[data-slot=progress-indicator]]:bg-destructive"
6358
- ),
5903
+ color: nearlyFull ? "var(--destructive)" : "var(--color-amber-500)",
6359
5904
  value: usedPercent * PERCENT_MAX
6360
5905
  }
6361
5906
  )
@@ -6366,230 +5911,38 @@ var ContextContentBody = ({
6366
5911
  className,
6367
5912
  ...props
6368
5913
  }) => /* @__PURE__ */ jsx("div", { className: cn("w-full space-y-1.5 px-3 py-2.5", className), ...props, children });
6369
- var itemVariants = cva(
6370
- "group/item flex w-full flex-wrap items-center rounded-none border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",
6371
- {
6372
- variants: {
6373
- variant: {
6374
- default: "border-transparent",
6375
- outline: "border-border",
6376
- muted: "border-transparent bg-muted/50"
6377
- },
6378
- size: {
6379
- default: "gap-3.5 px-4 py-3.5",
6380
- sm: "gap-3.5 px-3.5 py-3",
6381
- xs: "gap-2.5 px-3 py-2.5 in-data-[slot=dropdown-menu-content]:p-0"
6382
- }
6383
- },
6384
- defaultVariants: {
6385
- variant: "default",
6386
- size: "default"
6387
- }
6388
- }
6389
- );
6390
- function Item({
6391
- className,
6392
- variant = "default",
6393
- size: size2 = "default",
6394
- asChild = false,
6395
- ...props
6396
- }) {
6397
- const Comp = asChild ? Slot.Root : "div";
6398
- return /* @__PURE__ */ jsx(
6399
- Comp,
6400
- {
6401
- "data-slot": "item",
6402
- "data-variant": variant,
6403
- "data-size": size2,
6404
- className: cn(itemVariants({ variant, size: size2, className })),
6405
- ...props
6406
- }
6407
- );
6408
- }
6409
- var itemMediaVariants = cva(
6410
- "flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
6411
- {
6412
- variants: {
6413
- variant: {
6414
- default: "bg-transparent",
6415
- icon: "[&_svg:not([class*='size-'])]:size-4",
6416
- image: "size-10 overflow-hidden rounded-none group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 group-data-[size=xs]/item:rounded-none [&_img]:size-full [&_img]:object-cover"
6417
- }
6418
- },
6419
- defaultVariants: {
6420
- variant: "default"
6421
- }
6422
- }
6423
- );
6424
- function ItemMedia({
6425
- className,
6426
- variant = "default",
6427
- ...props
5914
+ var SEARCH_PLACEHOLDER = {
5915
+ commands: "Search commands\u2026",
5916
+ skills: "Search skills\u2026",
5917
+ scheduled: "Search scheduled tasks\u2026",
5918
+ all: "Type a command or search\u2026"
5919
+ };
5920
+ var NAV_HINT = "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc dismiss";
5921
+ var SEARCH_HINT = {
5922
+ commands: NAV_HINT,
5923
+ skills: "Esc dismiss",
5924
+ scheduled: NAV_HINT,
5925
+ all: NAV_HINT
5926
+ };
5927
+ var NAME_COLUMNS = "grid-cols-[120px_minmax(0,1fr)] sm:grid-cols-[200px_minmax(0,1fr)]";
5928
+ var ROW_CLASS = `grid ${NAME_COLUMNS} min-h-11 items-center gap-4 rounded-[10px] px-3 py-1.5 data-[selected=true]:bg-accent [&_svg]:hidden`;
5929
+ function ComposerCommandMenu({
5930
+ menuMode,
5931
+ searchQuery,
5932
+ onSearchChange,
5933
+ skillsLoading,
5934
+ builtinCommands,
5935
+ adapterCommands,
5936
+ scheduledExamples,
5937
+ onCommandSelect,
5938
+ onEscapeDismiss
6428
5939
  }) {
5940
+ const controlledSearch = menuMode === "commands" || menuMode === "all";
5941
+ const showCommands = menuMode === "commands" || menuMode === "all";
5942
+ const showSkills = menuMode === "skills" || menuMode === "all";
5943
+ const skillsUnattached = menuMode === "skills" && !skillsLoading && adapterCommands.length === 0;
6429
5944
  return /* @__PURE__ */ jsx(
6430
- "div",
6431
- {
6432
- "data-slot": "item-media",
6433
- "data-variant": variant,
6434
- className: cn(itemMediaVariants({ variant, className })),
6435
- ...props
6436
- }
6437
- );
6438
- }
6439
- function ItemContent({ className, ...props }) {
6440
- return /* @__PURE__ */ jsx(
6441
- "div",
6442
- {
6443
- "data-slot": "item-content",
6444
- className: cn(
6445
- "flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none",
6446
- className
6447
- ),
6448
- ...props
6449
- }
6450
- );
6451
- }
6452
- function ItemTitle({ className, ...props }) {
6453
- return /* @__PURE__ */ jsx(
6454
- "div",
6455
- {
6456
- "data-slot": "item-title",
6457
- className: cn(
6458
- "line-clamp-1 flex w-fit items-center gap-2 text-xs leading-snug font-semibold uppercase underline-offset-4",
6459
- className
6460
- ),
6461
- ...props
6462
- }
6463
- );
6464
- }
6465
- function ItemDescription({ className, ...props }) {
6466
- return /* @__PURE__ */ jsx(
6467
- "p",
6468
- {
6469
- "data-slot": "item-description",
6470
- className: cn(
6471
- "line-clamp-2 text-left text-sm leading-relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
6472
- className
6473
- ),
6474
- ...props
6475
- }
6476
- );
6477
- }
6478
- function ItemActions({ className, ...props }) {
6479
- return /* @__PURE__ */ jsx(
6480
- "div",
6481
- {
6482
- "data-slot": "item-actions",
6483
- className: cn("flex items-center gap-2", className),
6484
- ...props
6485
- }
6486
- );
6487
- }
6488
- var MOBILE_QUERY = "(max-width: 767px)";
6489
- function subscribe(onChange) {
6490
- const mql = window.matchMedia(MOBILE_QUERY);
6491
- mql.addEventListener("change", onChange);
6492
- return () => mql.removeEventListener("change", onChange);
6493
- }
6494
- function useIsMobile() {
6495
- return useSyncExternalStore(
6496
- subscribe,
6497
- () => window.matchMedia(MOBILE_QUERY).matches,
6498
- // No viewport when server-rendered; assume desktop, as the SDK does.
6499
- () => false
6500
- );
6501
- }
6502
- function ResponsivePanel({
6503
- open,
6504
- onOpenChange,
6505
- trigger,
6506
- title,
6507
- children,
6508
- align = "start",
6509
- popoverClassName
6510
- }) {
6511
- const isMobile = useIsMobile();
6512
- if (!isMobile) {
6513
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange, children: [
6514
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: trigger }),
6515
- /* @__PURE__ */ jsx(
6516
- PopoverContent,
6517
- {
6518
- side: "top",
6519
- align,
6520
- className: cn("w-64 overflow-hidden rounded-xl p-1", popoverClassName),
6521
- children
6522
- }
6523
- )
6524
- ] });
6525
- }
6526
- return /* @__PURE__ */ jsxs(Dialog$1.Root, { open, onOpenChange, children: [
6527
- /* @__PURE__ */ jsx(Dialog$1.Trigger, { asChild: true, children: trigger }),
6528
- /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
6529
- /* @__PURE__ */ jsx(
6530
- Dialog$1.Overlay,
6531
- {
6532
- "data-slot": "responsive-panel-overlay",
6533
- className: "fixed inset-0 z-50 bg-black/40 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0"
6534
- }
6535
- ),
6536
- /* @__PURE__ */ jsxs(
6537
- Dialog$1.Content,
6538
- {
6539
- "data-slot": "responsive-panel-sheet",
6540
- "aria-describedby": void 0,
6541
- className: cn(
6542
- "fixed inset-x-0 bottom-0 z-50 flex max-h-[80svh] flex-col overflow-hidden rounded-t-2xl border-t border-border bg-popover pb-[env(safe-area-inset-bottom)] text-popover-foreground shadow-lg",
6543
- "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom"
6544
- ),
6545
- children: [
6546
- /* @__PURE__ */ jsx(Dialog$1.Title, { className: "sr-only", children: title }),
6547
- /* @__PURE__ */ jsx(
6548
- "div",
6549
- {
6550
- "aria-hidden": "true",
6551
- className: "mx-auto mt-2.5 mb-1 h-1 w-9 shrink-0 rounded-full bg-muted-foreground/30"
6552
- }
6553
- ),
6554
- /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-1", children })
6555
- ]
6556
- }
6557
- )
6558
- ] })
6559
- ] });
6560
- }
6561
- var SEARCH_PLACEHOLDER = {
6562
- commands: "Search commands\u2026",
6563
- skills: "Search skills\u2026",
6564
- scheduled: "Search scheduled tasks\u2026",
6565
- all: "Type a command or search\u2026"
6566
- };
6567
- var NAV_HINT = "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc dismiss";
6568
- var SEARCH_HINT = {
6569
- commands: NAV_HINT,
6570
- skills: "Esc dismiss",
6571
- scheduled: NAV_HINT,
6572
- all: NAV_HINT
6573
- };
6574
- var NAME_COLUMNS = "grid-cols-[120px_minmax(0,1fr)] sm:grid-cols-[200px_minmax(0,1fr)]";
6575
- var ROW_CLASS = `grid ${NAME_COLUMNS} min-h-11 items-center gap-4 rounded-[10px] px-3 py-1.5 data-[selected=true]:bg-accent [&_svg]:hidden`;
6576
- function ComposerCommandMenu({
6577
- menuMode,
6578
- searchQuery,
6579
- onSearchChange,
6580
- skillsLoading,
6581
- builtinCommands,
6582
- adapterCommands,
6583
- scheduledExamples,
6584
- onCommandSelect,
6585
- onEscapeDismiss
6586
- }) {
6587
- const controlledSearch = menuMode === "commands" || menuMode === "all";
6588
- const showCommands = menuMode === "commands" || menuMode === "all";
6589
- const showSkills = menuMode === "skills" || menuMode === "all";
6590
- const skillsUnattached = menuMode === "skills" && !skillsLoading && adapterCommands.length === 0;
6591
- return /* @__PURE__ */ jsx(
6592
- PopoverContent,
5945
+ PopoverContent,
6593
5946
  {
6594
5947
  side: "top",
6595
5948
  align: "start",
@@ -7689,50 +7042,36 @@ function ResearchSourcesPanel({
7689
7042
  }, []);
7690
7043
  if (sources.length === 0) return null;
7691
7044
  return /* @__PURE__ */ jsxs(
7692
- "div",
7045
+ Collapsible,
7693
7046
  {
7694
7047
  ref: rootRef,
7695
- className: "rounded-md border border-line bg-card",
7048
+ open: expanded,
7049
+ onOpenChange: setExpanded,
7050
+ className: "rounded-[10px] border border-foreground/[0.08] bg-card",
7696
7051
  children: [
7697
- /* @__PURE__ */ jsxs(
7698
- "button",
7699
- {
7700
- type: "button",
7701
- onClick: () => setExpanded((prev) => !prev),
7702
- "aria-expanded": expanded,
7703
- className: "flex w-full items-center gap-1.5 px-2 py-1.5 text-left hover:bg-muted/40",
7704
- children: [
7705
- /* @__PURE__ */ jsx(
7706
- ChevronRightIcon,
7707
- {
7708
- className: cn(
7709
- "size-3 shrink-0 text-muted-foreground transition-transform duration-150",
7710
- expanded && "rotate-90"
7711
- )
7712
- }
7713
- ),
7714
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-semibold uppercase tracking-widest text-muted-foreground", children: [
7715
- "Sources \xB7 ",
7716
- sources.length
7717
- ] })
7718
- ]
7719
- }
7720
- ),
7721
- expanded && /* @__PURE__ */ jsx("ul", { className: "max-h-35 overflow-y-auto border-t border-line py-1", children: sources.map((s) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
7722
- "a",
7052
+ /* @__PURE__ */ jsxs(CollapsibleHeader, { variant: "section", children: [
7053
+ "Sources \xB7 ",
7054
+ sources.length
7055
+ ] }),
7056
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("ul", { className: "max-h-35 overflow-y-auto border-t border-foreground/[0.08] p-1", children: sources.map((s) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
7057
+ ListRow,
7723
7058
  {
7724
- id: `source-${s.sourceId}`,
7725
- href: s.url,
7726
- target: "_blank",
7727
- rel: "noreferrer",
7728
- className: "group flex items-baseline gap-2 px-2 py-1 hover:bg-muted/60",
7729
- children: [
7730
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] font-semibold text-primary tabular-nums", children: s.sourceId }),
7731
- /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-foreground group-hover:underline", children: s.title || s.url }),
7732
- /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 truncate text-[10px] text-muted-foreground max-w-[40%]", children: hostname2(s.url) })
7733
- ]
7059
+ asChild: true,
7060
+ size: "sm",
7061
+ label: s.title || s.url,
7062
+ meta: /* @__PURE__ */ jsx("span", { className: "block max-w-40 truncate", children: hostname2(s.url) }),
7063
+ children: /* @__PURE__ */ jsx(
7064
+ "a",
7065
+ {
7066
+ id: `source-${s.sourceId}`,
7067
+ href: s.url,
7068
+ target: "_blank",
7069
+ rel: "noreferrer",
7070
+ children: /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[12px] font-medium text-amber-500 tabular-nums", children: s.sourceId })
7071
+ }
7072
+ )
7734
7073
  }
7735
- ) }, s.sourceId)) })
7074
+ ) }, s.sourceId)) }) })
7736
7075
  ]
7737
7076
  }
7738
7077
  );
@@ -8246,24 +7585,26 @@ function ArtifactHtml({
8246
7585
  ),
8247
7586
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
8248
7587
  spec.caption ? /* @__PURE__ */ jsx("span", { children: spec.caption }) : /* @__PURE__ */ jsx("span", {}),
8249
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 ", children: [
7588
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
8250
7589
  /* @__PURE__ */ jsx(
8251
- "button",
7590
+ Button,
8252
7591
  {
8253
- type: "button",
7592
+ variant: "ghost",
7593
+ size: "icon-xs",
8254
7594
  onClick: () => setZoom((z) => clamp4(z - ZOOM_STEP)),
8255
7595
  disabled: zoom <= MIN_ZOOM,
8256
- className: "hover:text-foreground disabled:opacity-40 cursor-pointer",
7596
+ className: "text-muted-foreground hover:text-foreground",
8257
7597
  "aria-label": "zoom out",
8258
- children: "\u2212"
7598
+ children: /* @__PURE__ */ jsx(MinusIcon, {})
8259
7599
  }
8260
7600
  ),
8261
7601
  /* @__PURE__ */ jsxs(
8262
- "button",
7602
+ Button,
8263
7603
  {
8264
- type: "button",
7604
+ variant: "ghost",
7605
+ size: "xs",
8265
7606
  onClick: () => setZoom(1),
8266
- className: "tabular-nums hover:text-foreground",
7607
+ className: "font-normal tabular-nums text-muted-foreground hover:text-foreground",
8267
7608
  "aria-label": "reset zoom",
8268
7609
  children: [
8269
7610
  Math.round(zoom * 100),
@@ -8272,25 +7613,27 @@ function ArtifactHtml({
8272
7613
  }
8273
7614
  ),
8274
7615
  /* @__PURE__ */ jsx(
8275
- "button",
7616
+ Button,
8276
7617
  {
8277
- type: "button",
7618
+ variant: "ghost",
7619
+ size: "icon-xs",
8278
7620
  onClick: () => setZoom((z) => clamp4(z + ZOOM_STEP)),
8279
7621
  disabled: zoom >= MAX_ZOOM,
8280
- className: "hover:text-foreground disabled:opacity-40",
7622
+ className: "text-muted-foreground hover:text-foreground",
8281
7623
  "aria-label": "zoom in",
8282
- children: "+"
7624
+ children: /* @__PURE__ */ jsx(PlusIcon, {})
8283
7625
  }
8284
7626
  ),
8285
7627
  !fill && /* @__PURE__ */ jsxs(Fragment, { children: [
8286
- /* @__PURE__ */ jsx("span", { className: "text-border", children: "|" }),
7628
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "h-4 w-px bg-border" }),
8287
7629
  /* @__PURE__ */ jsx(
8288
- "button",
7630
+ Button,
8289
7631
  {
8290
- type: "button",
7632
+ variant: "ghost",
7633
+ size: "xs",
8291
7634
  onClick: () => setExpanded((v) => !v),
8292
- className: "hover:text-foreground",
8293
- children: expanded ? "collapse" : "expand"
7635
+ className: "font-normal text-muted-foreground hover:text-foreground",
7636
+ children: expanded ? "Collapse" : "Expand"
8294
7637
  }
8295
7638
  )
8296
7639
  ] })
@@ -8678,61 +8021,50 @@ var ErrorMessage = memo(function ErrorMessage2({
8678
8021
  setRetryPending(false);
8679
8022
  }
8680
8023
  };
8681
- return /* @__PURE__ */ jsxs(
8682
- "div",
8683
- {
8684
- role: "alert",
8685
- className: cn(
8686
- "flex w-full gap-3 rounded-none border-l-4 border-destructive bg-destructive/5 p-4",
8687
- className
8688
- ),
8689
- children: [
8690
- /* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-destructive" }),
8691
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
8692
- /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-destructive", children: errorInfo.title }),
8693
- errorInfo.detail && /* @__PURE__ */ jsxs(
8694
- "button",
8695
- {
8696
- type: "button",
8697
- onClick: () => setDetailOpen((open) => !open),
8698
- className: "flex items-center gap-1 self-start text-xs text-muted-foreground hover:text-foreground",
8699
- "aria-expanded": detailOpen,
8700
- children: [
8701
- detailOpen ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" }) : /* @__PURE__ */ jsx(ChevronRight$1, { className: "size-3" }),
8702
- detailOpen ? "Hide details" : "Show details"
8703
- ]
8704
- }
8705
- ),
8706
- detailOpen && errorInfo.detail && /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded-none border border-destructive/20 bg-background p-2 font-mono text-xs whitespace-pre-wrap wrap-break-word text-muted-foreground", children: errorInfo.detail }),
8707
- (showRetry || onDismiss) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 pt-1", children: [
8708
- showRetry && /* @__PURE__ */ jsxs(
8709
- Button,
8710
- {
8711
- size: "xs",
8712
- variant: "secondary",
8713
- onClick: handleRetry,
8714
- disabled: retryPending,
8715
- children: [
8716
- /* @__PURE__ */ jsx(
8717
- RefreshCw,
8718
- {
8719
- className: cn("size-3", retryPending && "animate-spin")
8720
- }
8721
- ),
8722
- retryPending ? "Retrying\u2026" : "Retry"
8723
- ]
8724
- }
8725
- ),
8726
- onDismiss && /* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: onDismiss, children: "Dismiss" })
8727
- ] }),
8728
- retryError && /* @__PURE__ */ jsxs("div", { className: "pt-1 text-xs text-destructive", role: "status", children: [
8729
- "Retry failed: ",
8730
- retryError
8731
- ] })
8732
- ] })
8733
- ]
8734
- }
8735
- );
8024
+ return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: cn("gap-y-2", className), children: [
8025
+ /* @__PURE__ */ jsx(AlertTriangle, {}),
8026
+ /* @__PURE__ */ jsx(AlertTitle, { children: errorInfo.title }),
8027
+ /* @__PURE__ */ jsxs(AlertDescription, { className: "flex min-w-0 flex-col items-start gap-2", children: [
8028
+ errorInfo.detail && /* @__PURE__ */ jsx(TextLink, { variant: "muted", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs(
8029
+ "button",
8030
+ {
8031
+ type: "button",
8032
+ onClick: () => setDetailOpen((open) => !open),
8033
+ "aria-expanded": detailOpen,
8034
+ children: [
8035
+ detailOpen ? /* @__PURE__ */ jsx(ChevronDown, {}) : /* @__PURE__ */ jsx(ChevronRight$1, {}),
8036
+ detailOpen ? "Hide details" : "Show details"
8037
+ ]
8038
+ }
8039
+ ) }),
8040
+ detailOpen && errorInfo.detail && /* @__PURE__ */ jsx("pre", { className: "w-full overflow-x-auto rounded-[6px] border border-destructive/20 bg-background p-2 font-mono text-xs whitespace-pre-wrap wrap-break-word text-muted-foreground", children: errorInfo.detail }),
8041
+ (showRetry || onDismiss) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 pt-1", children: [
8042
+ showRetry && /* @__PURE__ */ jsxs(
8043
+ Button,
8044
+ {
8045
+ size: "xs",
8046
+ variant: "secondary",
8047
+ onClick: handleRetry,
8048
+ disabled: retryPending,
8049
+ children: [
8050
+ /* @__PURE__ */ jsx(
8051
+ RefreshCw,
8052
+ {
8053
+ className: cn("size-3", retryPending && "animate-spin")
8054
+ }
8055
+ ),
8056
+ retryPending ? "Retrying\u2026" : "Retry"
8057
+ ]
8058
+ }
8059
+ ),
8060
+ onDismiss && /* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: onDismiss, children: "Dismiss" })
8061
+ ] }),
8062
+ retryError && /* @__PURE__ */ jsxs("div", { className: "pt-1 text-xs text-destructive", role: "status", children: [
8063
+ "Retry failed: ",
8064
+ retryError
8065
+ ] })
8066
+ ] })
8067
+ ] });
8736
8068
  });
8737
8069
  function parseRequestedTokens(detail) {
8738
8070
  const m = detail.match(/["']?requested["']?\s*[:=]\s*(\d+)/);
@@ -8745,34 +8077,24 @@ var InsufficientCreditsCard = memo(function InsufficientCreditsCard2({
8745
8077
  }) {
8746
8078
  const { onOpenBilling } = useAgentChatAdapterContext();
8747
8079
  const requested = parseRequestedTokens(detail);
8748
- return /* @__PURE__ */ jsxs(
8749
- "div",
8750
- {
8751
- role: "alert",
8752
- className: cn(
8753
- "flex w-full gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 p-4",
8754
- className
8755
- ),
8756
- children: [
8757
- /* @__PURE__ */ jsx(CreditCard, { className: "mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400" }),
8758
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
8759
- /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-foreground", children: "You're out of credits" }),
8760
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
8761
- "This run was blocked by the token-credit limit",
8762
- requested ? ` (it needed ~${requested.toLocaleString()} tokens)` : "",
8763
- ". Buy additional credits or upgrade your plan to keep your agents running."
8764
- ] }),
8765
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 pt-1", children: [
8766
- onOpenBilling && /* @__PURE__ */ jsxs(Button, { size: "sm", onClick: onOpenBilling, children: [
8767
- /* @__PURE__ */ jsx(CreditCard, { className: "size-4" }),
8768
- "Go to Billing"
8769
- ] }),
8770
- onDismiss && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onDismiss, children: "Dismiss" })
8771
- ] })
8772
- ] })
8773
- ]
8774
- }
8775
- );
8080
+ return /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: cn("gap-y-2", className), children: [
8081
+ /* @__PURE__ */ jsx(CreditCard, {}),
8082
+ /* @__PURE__ */ jsx(AlertTitle, { children: "You're out of credits" }),
8083
+ /* @__PURE__ */ jsxs(AlertDescription, { className: "flex flex-col items-start gap-2", children: [
8084
+ /* @__PURE__ */ jsxs("p", { children: [
8085
+ "This run was blocked by the token-credit limit",
8086
+ requested ? ` (it needed ~${requested.toLocaleString()} tokens)` : "",
8087
+ ". Buy additional credits or upgrade your plan to keep your agents running."
8088
+ ] }),
8089
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 pt-1", children: [
8090
+ onOpenBilling && /* @__PURE__ */ jsxs(Button, { size: "sm", onClick: onOpenBilling, children: [
8091
+ /* @__PURE__ */ jsx(CreditCard, { className: "size-4" }),
8092
+ "Go to Billing"
8093
+ ] }),
8094
+ onDismiss && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onDismiss, children: "Dismiss" })
8095
+ ] })
8096
+ ] })
8097
+ ] });
8776
8098
  });
8777
8099
  var DOCUMENT = { icon: FileTextIcon, kind: "Document" };
8778
8100
  var SPREADSHEET = { icon: FileSpreadsheetIcon, kind: "Spreadsheet" };
@@ -9081,15 +8403,7 @@ function WorkerCard({ worker }) {
9081
8403
  return (
9082
8404
  // A long name is cut, its mark never.
9083
8405
  /* @__PURE__ */ jsxs("li", { className: "flex min-w-0 max-w-full", title: file.label, children: [
9084
- file.kind === "file" && onFileSelect ? /* @__PURE__ */ jsx(
9085
- "button",
9086
- {
9087
- type: "button",
9088
- className: "min-w-0 truncate underline",
9089
- onClick: () => onFileSelect(file.ref),
9090
- children: /* @__PURE__ */ jsx("bdi", { children: file.label })
9091
- }
9092
- ) : /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ jsx("bdi", { children: file.label }) }),
8406
+ file.kind === "file" && onFileSelect ? /* @__PURE__ */ jsx(TextLink, { variant: "muted", size: "inline", asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: "min-w-0 truncate", onClick: () => onFileSelect(file.ref), children: /* @__PURE__ */ jsx("bdi", { children: file.label }) }) }) : /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ jsx("bdi", { children: file.label }) }),
9093
8407
  mark && /* @__PURE__ */ jsx("span", { "data-mark": landing, className: "shrink-0 whitespace-pre text-muted-foreground", children: ` \xB7 ${mark}` })
9094
8408
  ] }, `${file.kind}:${file.ref}`)
9095
8409
  );
@@ -9937,7 +9251,7 @@ function useElapsedSeconds(since) {
9937
9251
  function formatElapsed(seconds) {
9938
9252
  return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
9939
9253
  }
9940
- function CommandGroup2({ commands, live }) {
9254
+ function CommandGroup3({ commands, live }) {
9941
9255
  const [chosen, setChosen] = useState(null);
9942
9256
  const open = chosen ?? live !== void 0;
9943
9257
  const elapsed = useElapsedSeconds(live ? (commands[0]?.message ?? live).createdAt : void 0);
@@ -10025,7 +9339,7 @@ function IterationGroup({
10025
9339
  return /* @__PURE__ */ jsx("p", { className: "py-0.5 text-sm text-muted-foreground", children: reasoningTokenLabel(message, false) });
10026
9340
  }
10027
9341
  const commands = iterationCommands(message);
10028
- return commands.length === 1 ? /* @__PURE__ */ jsx(CommandRow, { label: commands[0].label, calls: commands[0].calls }) : /* @__PURE__ */ jsx(CommandGroup2, { commands });
9342
+ return commands.length === 1 ? /* @__PURE__ */ jsx(CommandRow, { label: commands[0].label, calls: commands[0].calls }) : /* @__PURE__ */ jsx(CommandGroup3, { commands });
10029
9343
  }
10030
9344
  function deriveFileArtifactsFromMessages(messages) {
10031
9345
  const terminalCommands = [];
@@ -10100,10 +9414,10 @@ function SimpleAssistantGroup({
10100
9414
  const endRun = (live) => {
10101
9415
  const key = (run[0]?.message ?? live)?.id;
10102
9416
  if (live && (run.length > 0 || liveCommands(live).length > 0)) {
10103
- rows.push(/* @__PURE__ */ jsx(CommandGroup2, { commands: run, live }, key));
9417
+ rows.push(/* @__PURE__ */ jsx(CommandGroup3, { commands: run, live }, key));
10104
9418
  } else {
10105
9419
  if (run.length > 1) {
10106
- rows.push(/* @__PURE__ */ jsx(CommandGroup2, { commands: run }, key));
9420
+ rows.push(/* @__PURE__ */ jsx(CommandGroup3, { commands: run }, key));
10107
9421
  } else if (run.length === 1) {
10108
9422
  rows.push(
10109
9423
  /* @__PURE__ */ jsx(CommandRow, { label: run[0].label, calls: run[0].calls }, run[0].key)
@@ -10250,34 +9564,30 @@ function AssistantGroup({
10250
9564
  }
10251
9565
  function RetryBanner({ indicator }) {
10252
9566
  const [open, setOpen] = useState(false);
10253
- return /* @__PURE__ */ jsxs(
10254
- "div",
10255
- {
10256
- role: "status",
10257
- className: "flex flex-col gap-1 border-l-2 border-amber-500 bg-amber-500/5 px-3 py-2 text-xs",
10258
- children: [
10259
- /* @__PURE__ */ jsxs(
10260
- "button",
10261
- {
10262
- type: "button",
10263
- onClick: () => setOpen((prev) => !prev),
10264
- className: "flex items-center gap-2 text-left text-amber-600 hover:text-amber-700",
10265
- "aria-expanded": open,
10266
- children: [
10267
- /* @__PURE__ */ jsx(AlertTriangle, { className: "size-3 shrink-0" }),
10268
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate font-medium", children: indicator.title }),
10269
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-foreground/60", children: [
10270
- "attempt ",
10271
- indicator.attempt
10272
- ] }),
10273
- indicator.detail && (open ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" }) : /* @__PURE__ */ jsx(ChevronRight$1, { className: "size-3" }))
10274
- ]
10275
- }
10276
- ),
10277
- open && indicator.detail && /* @__PURE__ */ jsx("pre", { className: "mt-1 overflow-x-auto rounded-none bg-background p-2 font-mono text-[11px] whitespace-pre-wrap wrap-break-word text-foreground/60", children: indicator.detail })
10278
- ]
10279
- }
10280
- );
9567
+ return /* @__PURE__ */ jsxs(Alert, { variant: "warning", role: "status", children: [
9568
+ /* @__PURE__ */ jsx(AlertTriangle, {}),
9569
+ /* @__PURE__ */ jsxs(AlertTitle, { className: "flex min-w-0 items-center gap-2 font-medium", children: [
9570
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: indicator.title }),
9571
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[11.5px] font-normal opacity-70", children: [
9572
+ "attempt ",
9573
+ indicator.attempt
9574
+ ] })
9575
+ ] }),
9576
+ indicator.detail && /* @__PURE__ */ jsx(AlertAction, { children: /* @__PURE__ */ jsxs(
9577
+ Button,
9578
+ {
9579
+ variant: "ghost",
9580
+ size: "xs",
9581
+ onClick: () => setOpen((prev) => !prev),
9582
+ "aria-expanded": open,
9583
+ children: [
9584
+ open ? "Hide details" : "Details",
9585
+ open ? /* @__PURE__ */ jsx(ChevronDown, {}) : /* @__PURE__ */ jsx(ChevronRight$1, {})
9586
+ ]
9587
+ }
9588
+ ) }),
9589
+ open && indicator.detail && /* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("pre", { className: "mt-1 overflow-x-auto rounded-[6px] bg-background p-2 font-mono text-[11px] whitespace-pre-wrap wrap-break-word text-foreground/60", children: indicator.detail }) })
9590
+ ] });
10281
9591
  }
10282
9592
  function WorkingOnItIndicator({ activity }) {
10283
9593
  return /* @__PURE__ */ jsx(Message, { from: "assistant", children: /* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(OrbShimmerLabel, { state: activity.state, label: activity.label }) }) });
@@ -13553,26 +12863,6 @@ function mapSelected(doc, edit) {
13553
12863
  objects: doc.objects.map((o) => o.selected ? edit(o) : o)
13554
12864
  };
13555
12865
  }
13556
- var RABBIT_MARK_PATH = "M49.71,46.83c0,.23.02.45.07.67,2.1.49,4.16,1.07,6.18,1.74.58-.64.94-1.48.94-2.42,0-1.98-1.61-3.59-3.59-3.59s-3.59,1.61-3.59,3.59M33.95,78.3c3.1-5.1,6.72-8.89,11.64-12.21.61-.42,1.24-.8,1.88-1.17.44-.25.61-.66.58-1.05,0-.53-.49-.91-.93-1.12-1.34-.62-2.72-1.5-4.06-2.54-1.57-1.22-3.01-2.59-4.36-4.06-.95-1.04-2.02-2.38-3-3.81-.81-1.18-.63-2.77.43-3.73,1.1-1,2.26-1.92,3.48-2.76.36-.25.72-.49,1.1-.73,2.43-1.55,5.05-2.79,7.79-3.7,3.23-1.07,6.62-1.66,10.03-1.74.59-.35,1.19-.69,1.8-1.01,1.66-.88,3.38-1.62,5.17-2.21,1.58-.54,3.2-.95,4.85-1.24,3.28-.59,6.64-.7,9.95-.32,1.23.14,2.45.34,3.68.62,2.87.64,5.59,1.62,8.09,2.9.54.27.71.95.36,1.45-1.58,2.22-3.46,4.25-5.5,6.05-3.01,2.65-6.51,4.75-10.26,6.17-2.32.88-4.75,1.53-7.22,1.91-.62.1-.78.9-.24,1.22,0,0,.01,0,.02.01,6.97,4.05,13.1,9.22,18.36,15.32.72.83,1.42,1.68,2.1,2.53,3.36,4.22,6.23,8.82,8.56,13.68,1.8,3.73,3.27,7.63,4.39,11.62.73,2.6,1.34,5.24,1.76,7.91.11.76-.87,1.16-1.3.53-1.15-1.69-2.31-3.35-3.61-4.93-1.2-1.46-2.46-2.86-3.75-4.24-5.44-5.8-11.84-10.7-18.84-14.48-7.32-3.94-15.09-6.38-23.44-6.53-2.23-.04-4.46.08-6.68.3-4.05.43-8.02,1.28-11.93,2.4-.03,0-.05.01-.08.02,0,0-.01,0-.02,0-.07.02-.14.03-.21.03-.53,0-.91-.6-.61-1.09M50.95,12.97c-1.31,1.16-2.2,2.71-2.9,4.29-1.66,3.74-2.85,7.74-3.52,11.77-.32,1.92-.56,3.87-1.28,5.69-.17.44-.37.87-.6,1.28-1.18,2.1-3.37,3.19-5.6,3.86-4.96,1.47-10.14,1.97-15.25,2.65-2.37.31-8.03,1.12-7.34,4.69.46,2.36,2.26,4.16,4.08,5.6,2.66,2.11,5.44,4.09,8.33,5.88,1.87,1.15,3.85,2.11,5.6,3.44,1.74,1.33,3.15,3.05,3.58,5.25.22,1.16-.18,2.35-1,3.2-1.57,1.63-3,3.41-4.25,5.29-1.32,2.1-2.38,4.35-3.25,6.65-.59,1.44.97,2.98,2.41,2.37.53-.21,1.07-.41,1.61-.61,2.26-.82,4.68.73,4.93,3.12.17,1.61.38,3.17.63,4.57.46,2.57,3.14,3.63,5.32,1.41,2.84-2.88,4.66-6.31,7.84-8.86,2.53-2.03,6.26-4.17,9.71-3.59,3.17.56,6.27,1.52,9.23,2.85,5.32,2.32,10.36,5.29,14.95,8.86,9.17,7.1,16.56,16.51,21.27,27.1.93,2.07,4.03,1.44,4.1-.83.55-17.71-5.72-35.46-17.11-49.01-2.87-3.42-6.07-6.65-9.59-9.44-.88-.8-1.54-1.7-1.38-2.93.38-2.97,2-4.32,4.04-5.85,2.51-1.89,5.02-3.85,7.16-6.21.03-.03.06-.06.09-.1,1.24-1.37,2.38-2.83,3.4-4.37,1.2-1.81.6-4.26-1.3-5.31,0,0-.96-.52-1.45-.76-2.72-1.34-5.61-2.36-8.6-3.03-2.76-.62-5.58-.93-8.38-.93-2.38,0-4.76.22-7.09.67-1.96.37-3.97-.31-5.25-1.84-.28-.34-.54-.69-.79-1.04-.58-.84-1.09-1.71-1.63-2.58-1.29-2.06-1.87-3.63-2.89-5.84-1.06-2.29-1.85-4.73-3.26-6.86-.73-1.11-1.53-1.54-2.32-1.54s-1.54.41-2.24,1.02";
13557
- var RABBIT_MARK_BOX = {
13558
- x: 14.4021,
13559
- y: 11.93,
13560
- h: 109.058
13561
- };
13562
- function RabbitMark({ className }) {
13563
- return /* @__PURE__ */ jsx(
13564
- "svg",
13565
- {
13566
- className,
13567
- viewBox: "14.4021 11.93 95.1813 109.058",
13568
- fill: "currentColor",
13569
- "aria-hidden": "true",
13570
- children: /* @__PURE__ */ jsx("path", { d: RABBIT_MARK_PATH })
13571
- }
13572
- );
13573
- }
13574
-
13575
- // src/components/whiteboard/render.ts
13576
12866
  var TEXT_GLYPH_ADVANCE = 0.6;
13577
12867
  var AGENT_COLOR = "#2563eb";
13578
12868
  var TEXT_COLOR = "#111827";
@@ -15070,6 +14360,8 @@ var TOOLS = [
15070
14360
  { id: "select", label: "Select", Icon: MousePointer2 },
15071
14361
  { id: "pan", label: "Pan", Icon: Hand }
15072
14362
  ];
14363
+ var TOOL_ITEM = "size-9 px-0 pointer-coarse:size-11";
14364
+ var SWATCH_ITEM = "size-7 px-0 pointer-coarse:size-11";
15073
14365
  function ToolRail({
15074
14366
  tool,
15075
14367
  onToolChange,
@@ -15087,66 +14379,66 @@ function ToolRail({
15087
14379
  return /* @__PURE__ */ jsxs(
15088
14380
  "div",
15089
14381
  {
15090
- className: "flex flex-col gap-1 rounded-lg border bg-background p-1",
14382
+ className: "flex flex-col items-center gap-1 rounded-lg border bg-background p-1",
15091
14383
  role: "toolbar",
15092
14384
  "aria-label": "Whiteboard tools",
15093
14385
  "aria-orientation": "vertical",
15094
14386
  children: [
15095
- TOOLS.map(({ id, label, Icon }) => /* @__PURE__ */ jsx(
15096
- Button,
14387
+ /* @__PURE__ */ jsx(
14388
+ ToggleGroup,
15097
14389
  {
15098
- type: "button",
15099
- size: "icon",
15100
- variant: tool === id ? "default" : "ghost",
15101
- "aria-label": label,
15102
- "aria-pressed": tool === id,
14390
+ type: "single",
14391
+ orientation: "vertical",
14392
+ "aria-label": "Tool",
14393
+ value: tool,
14394
+ onValueChange: (next) => {
14395
+ if (next) onToolChange(next);
14396
+ },
15103
14397
  disabled,
15104
- onClick: () => onToolChange(id),
15105
- children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
15106
- },
15107
- id
15108
- )),
15109
- /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
15110
- INK_COLORS.map((c) => /* @__PURE__ */ jsx(
15111
- "button",
14398
+ children: TOOLS.map(({ id, label, Icon }) => /* @__PURE__ */ jsx(ToggleGroupItem, { value: id, "aria-label": label, className: TOOL_ITEM, children: /* @__PURE__ */ jsx(Icon, { className: "size-4" }) }, id))
14399
+ }
14400
+ ),
14401
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px w-full bg-border" }),
14402
+ /* @__PURE__ */ jsx(
14403
+ ToggleGroup,
15112
14404
  {
15113
- type: "button",
15114
- "aria-label": `Colour ${c}`,
15115
- "aria-pressed": color === c,
14405
+ type: "single",
14406
+ variant: "outline",
14407
+ size: "sm",
14408
+ orientation: "vertical",
14409
+ "aria-label": "Colour",
14410
+ value: color,
14411
+ onValueChange: (next) => {
14412
+ if (next) onColorChange(next);
14413
+ },
15116
14414
  disabled,
15117
- onClick: () => onColorChange(c),
15118
- className: cn(
15119
- "mx-auto size-5 rounded-full border-2",
15120
- color === c ? "border-foreground" : "border-transparent"
15121
- ),
15122
- style: { backgroundColor: c }
15123
- },
15124
- c
15125
- )),
15126
- /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
15127
- INK_WIDTHS.map((w) => /* @__PURE__ */ jsx(
15128
- "button",
14415
+ children: INK_COLORS.map((c) => /* @__PURE__ */ jsx(ToggleGroupItem, { value: c, "aria-label": `Colour ${c}`, className: SWATCH_ITEM, children: /* @__PURE__ */ jsx("span", { className: "size-5 rounded-full", style: { backgroundColor: c } }) }, c))
14416
+ }
14417
+ ),
14418
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px w-full bg-border" }),
14419
+ /* @__PURE__ */ jsx(
14420
+ ToggleGroup,
15129
14421
  {
15130
- type: "button",
15131
- "aria-label": `Width ${w}`,
15132
- "aria-pressed": width === w,
14422
+ type: "single",
14423
+ variant: "outline",
14424
+ size: "sm",
14425
+ orientation: "vertical",
14426
+ "aria-label": "Width",
14427
+ value: String(width),
14428
+ onValueChange: (next) => {
14429
+ if (next) onWidthChange(Number(next));
14430
+ },
15133
14431
  disabled,
15134
- onClick: () => onWidthChange(w),
15135
- className: cn(
15136
- "mx-auto flex size-6 items-center justify-center rounded",
15137
- width === w ? "bg-accent" : ""
15138
- ),
15139
- children: /* @__PURE__ */ jsx(
14432
+ children: INK_WIDTHS.map((w) => /* @__PURE__ */ jsx(ToggleGroupItem, { value: String(w), "aria-label": `Width ${w}`, className: SWATCH_ITEM, children: /* @__PURE__ */ jsx(
15140
14433
  "span",
15141
14434
  {
15142
14435
  className: "rounded-full bg-foreground",
15143
14436
  style: { width: w + 2, height: w + 2 }
15144
14437
  }
15145
- )
15146
- },
15147
- w
15148
- )),
15149
- /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
14438
+ ) }, w))
14439
+ }
14440
+ ),
14441
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px w-full bg-border" }),
15150
14442
  /* @__PURE__ */ jsx(
15151
14443
  Button,
15152
14444
  {
@@ -15200,6 +14492,13 @@ var VIEW_MODE_LABELS = {
15200
14492
  expert: "Advanced",
15201
14493
  whiteboard: "Whiteboard"
15202
14494
  };
14495
+ var VIEW_MODE_SEGMENTS2 = ["simple", "expert", "whiteboard"].map(
14496
+ (mode) => ({
14497
+ value: mode,
14498
+ label: VIEW_MODE_LABELS[mode],
14499
+ ariaLabel: `${VIEW_MODE_LABELS[mode]} view`
14500
+ })
14501
+ );
15203
14502
  function AgentWhiteboard(props) {
15204
14503
  const runtime = useAgentChatRuntime({
15205
14504
  adapter: props.adapter,
@@ -16070,21 +15369,15 @@ function WhiteboardSurface({
16070
15369
  children: "New board"
16071
15370
  }
16072
15371
  ) : null,
16073
- viewMode && onViewModeChange && hasAnswer ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-full border p-0.5", children: ["simple", "expert", "whiteboard"].map((mode) => /* @__PURE__ */ jsx(
16074
- "button",
15372
+ viewMode && onViewModeChange && hasAnswer ? /* @__PURE__ */ jsx(
15373
+ SegmentedControl,
16075
15374
  {
16076
- type: "button",
16077
- "aria-label": `${VIEW_MODE_LABELS[mode]} view`,
16078
- "aria-pressed": viewMode === mode,
16079
- className: cn(
16080
- "rounded-full px-3 py-1 text-xs",
16081
- viewMode === mode ? "bg-background font-medium shadow-sm" : "text-muted-foreground"
16082
- ),
16083
- onClick: () => onViewModeChange(mode),
16084
- children: VIEW_MODE_LABELS[mode]
16085
- },
16086
- mode
16087
- )) }) : null
15375
+ "aria-label": "View",
15376
+ segments: VIEW_MODE_SEGMENTS2,
15377
+ value: viewMode,
15378
+ onChange: onViewModeChange
15379
+ }
15380
+ ) : null
16088
15381
  ] })
16089
15382
  ] });
16090
15383
  }
@@ -16470,46 +15763,37 @@ function FileTreeFolder({
16470
15763
  onSelect?.(path);
16471
15764
  }, [onSelect, path]);
16472
15765
  return /* @__PURE__ */ jsx(Collapsible, { onOpenChange: handleOpenChange, open: isExpanded, children: /* @__PURE__ */ jsxs("div", { className: cn("", className), role: "treeitem", tabIndex: 0, ...props, children: [
16473
- /* @__PURE__ */ jsxs(
16474
- "div",
16475
- {
16476
- className: cn(
16477
- "flex h-9 w-full items-center gap-2 rounded-lg px-2 text-left transition-colors hover:bg-accent",
16478
- isSelected && "bg-accent"
16479
- ),
16480
- children: [
16481
- /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
16482
- "button",
15766
+ /* @__PURE__ */ jsxs("div", { className: listRowVariants({ size: "sm", active: isSelected }), children: [
15767
+ /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
15768
+ "button",
15769
+ {
15770
+ className: "flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0",
15771
+ type: "button",
15772
+ "aria-label": isExpanded ? `Collapse ${name}` : `Expand ${name}`,
15773
+ children: /* @__PURE__ */ jsx(
15774
+ ChevronRightIcon,
16483
15775
  {
16484
- className: "flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0",
16485
- type: "button",
16486
- "aria-label": isExpanded ? `Collapse ${name}` : `Expand ${name}`,
16487
- children: /* @__PURE__ */ jsx(
16488
- ChevronRightIcon,
16489
- {
16490
- className: cn(
16491
- "size-4 shrink-0 text-muted-foreground transition-transform",
16492
- isExpanded && "rotate-90"
16493
- )
16494
- }
15776
+ className: cn(
15777
+ "size-4 shrink-0 text-muted-foreground transition-transform",
15778
+ isExpanded && "rotate-90"
16495
15779
  )
16496
15780
  }
16497
- ) }),
16498
- /* @__PURE__ */ jsxs(
16499
- "button",
16500
- {
16501
- className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 border-none bg-transparent p-0 text-left",
16502
- onClick: handleSelect,
16503
- type: "button",
16504
- children: [
16505
- /* @__PURE__ */ jsx(FileTreeIcon, { children: isExpanded ? /* @__PURE__ */ jsx(FolderOpenIcon, { className: "size-4.5 text-muted-foreground", strokeWidth: 1.8 }) : /* @__PURE__ */ jsx(FolderIcon, { className: "size-4.5 text-muted-foreground", strokeWidth: 1.8 }) }),
16506
- /* @__PURE__ */ jsx(FileTreeName, { children: name })
16507
- ]
16508
- }
16509
15781
  )
16510
- ]
16511
- }
16512
- ),
15782
+ }
15783
+ ) }),
15784
+ /* @__PURE__ */ jsxs(
15785
+ "button",
15786
+ {
15787
+ className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 border-none bg-transparent p-0 text-left",
15788
+ onClick: handleSelect,
15789
+ type: "button",
15790
+ children: [
15791
+ /* @__PURE__ */ jsx(FileTreeIcon, { children: isExpanded ? /* @__PURE__ */ jsx(FolderOpenIcon, { className: "size-4.5 text-muted-foreground", strokeWidth: 1.8 }) : /* @__PURE__ */ jsx(FolderIcon, { className: "size-4.5 text-muted-foreground", strokeWidth: 1.8 }) }),
15792
+ /* @__PURE__ */ jsx(FileTreeName, { children: name })
15793
+ ]
15794
+ }
15795
+ )
15796
+ ] }),
16513
15797
  /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "pl-5", children }) })
16514
15798
  ] }) });
16515
15799
  }
@@ -16538,8 +15822,8 @@ function FileTreeFile({
16538
15822
  "div",
16539
15823
  {
16540
15824
  className: cn(
16541
- "group flex h-9 cursor-pointer items-center gap-2 rounded-lg px-2 transition-colors hover:bg-accent",
16542
- isSelected && "bg-accent",
15825
+ listRowVariants({ size: "sm", active: isSelected }),
15826
+ "group cursor-pointer",
16543
15827
  className
16544
15828
  ),
16545
15829
  onClick: handleClick,
@@ -16576,14 +15860,14 @@ function forgetChatFiles() {
16576
15860
  chats.clear();
16577
15861
  changed();
16578
15862
  }
16579
- function subscribe2(listener) {
15863
+ function subscribe(listener) {
16580
15864
  listeners.add(listener);
16581
15865
  return () => {
16582
15866
  listeners.delete(listener);
16583
15867
  };
16584
15868
  }
16585
15869
  function useChatFiles(chat) {
16586
- return useSyncExternalStore(subscribe2, () => chat === null ? NONE : chats.get(chat) ?? NONE);
15870
+ return useSyncExternalStore(subscribe, () => chat === null ? NONE : chats.get(chat) ?? NONE);
16587
15871
  }
16588
15872
  var SKELETON_WIDTHS2 = [75, 60, 90, 65, 80, 70, 85, 55];
16589
15873
  var NO_ENTRIES = [];
@@ -16662,22 +15946,32 @@ function RenderEntries({
16662
15946
  entry.size != null && /* @__PURE__ */ jsx("span", { className: "ml-1 shrink-0 text-xs text-muted-foreground/60", children: formatFileSize(entry.size) }),
16663
15947
  /* @__PURE__ */ jsxs("div", { className: "ml-1 flex shrink-0 items-center gap-0 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100", children: [
16664
15948
  /* @__PURE__ */ jsx(
16665
- "a",
15949
+ Button,
16666
15950
  {
16667
- href: downloadUrlFor(entry.path),
16668
- download: fileName2,
16669
- className: "rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
16670
- onClick: (event) => event.stopPropagation(),
16671
- title: "Download",
16672
- "aria-label": `Download ${fileName2}`,
16673
- children: /* @__PURE__ */ jsx(DownloadIcon, { className: "size-5" })
15951
+ asChild: true,
15952
+ variant: "ghost",
15953
+ size: "icon-xs",
15954
+ className: "text-muted-foreground hover:text-foreground",
15955
+ children: /* @__PURE__ */ jsx(
15956
+ "a",
15957
+ {
15958
+ href: downloadUrlFor(entry.path),
15959
+ download: fileName2,
15960
+ onClick: (event) => event.stopPropagation(),
15961
+ title: "Download",
15962
+ "aria-label": `Download ${fileName2}`,
15963
+ children: /* @__PURE__ */ jsx(DownloadIcon, { className: "size-5" })
15964
+ }
15965
+ )
16674
15966
  }
16675
15967
  ),
16676
15968
  /* @__PURE__ */ jsx(
16677
- "button",
15969
+ Button,
16678
15970
  {
16679
15971
  type: "button",
16680
- className: "rounded p-0.5 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
15972
+ variant: "ghost",
15973
+ size: "icon-xs",
15974
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
16681
15975
  onClick: (event) => {
16682
15976
  event.stopPropagation();
16683
15977
  onDelete(entry.path);
@@ -16891,7 +16185,7 @@ function WorkspacePanel({
16891
16185
  type: "button",
16892
16186
  variant: "ghost",
16893
16187
  size: "icon-sm",
16894
- className: "rounded-xl text-foreground/80 md:size-11",
16188
+ className: "text-foreground/80 md:size-11",
16895
16189
  onClick: () => fileInputRef.current?.click(),
16896
16190
  disabled: disabled || !sessionId || uploading,
16897
16191
  "aria-label": "Upload files",
@@ -16907,7 +16201,7 @@ function WorkspacePanel({
16907
16201
  type: "button",
16908
16202
  variant: "ghost",
16909
16203
  size: "icon-sm",
16910
- className: "rounded-xl text-foreground/80 md:size-11",
16204
+ className: "text-foreground/80 md:size-11",
16911
16205
  onClick: () => void fetchTree(),
16912
16206
  disabled: !sessionId || loading,
16913
16207
  "aria-label": "Refresh workspace",
@@ -16955,24 +16249,28 @@ function WorkspacePanel({
16955
16249
  /* @__PURE__ */ jsx(AlertCircleIcon, { className: "mt-0.5 size-4 shrink-0" }),
16956
16250
  /* @__PURE__ */ jsx("span", { children: error })
16957
16251
  ] }),
16958
- !loading && !error && entries.length === 0 && /* @__PURE__ */ jsxs("div", { className: "px-4 py-8 text-center text-sm text-faint", children: [
16959
- /* @__PURE__ */ jsx("p", { children: "No workspace files" }),
16960
- /* @__PURE__ */ jsxs(
16961
- Button,
16962
- {
16963
- type: "button",
16964
- variant: "outline",
16965
- size: "sm",
16966
- className: "mt-3 gap-1.5",
16967
- onClick: () => fileInputRef.current?.click(),
16968
- disabled: disabled || !sessionId,
16969
- children: [
16970
- /* @__PURE__ */ jsx(UploadIcon, { className: "size-3.5" }),
16971
- "Upload files"
16972
- ]
16973
- }
16974
- )
16975
- ] }),
16252
+ !loading && !error && entries.length === 0 && /* @__PURE__ */ jsx(
16253
+ EmptyState,
16254
+ {
16255
+ className: "px-4 py-8",
16256
+ logoClassName: "size-9",
16257
+ title: "No workspace files",
16258
+ action: /* @__PURE__ */ jsxs(
16259
+ Button,
16260
+ {
16261
+ type: "button",
16262
+ variant: "outline",
16263
+ size: "sm",
16264
+ onClick: () => fileInputRef.current?.click(),
16265
+ disabled: disabled || !sessionId,
16266
+ children: [
16267
+ /* @__PURE__ */ jsx(UploadIcon, { className: "size-3.5" }),
16268
+ "Upload files"
16269
+ ]
16270
+ }
16271
+ )
16272
+ }
16273
+ ),
16976
16274
  entries.length > 0 && /* @__PURE__ */ jsx(
16977
16275
  FileTree,
16978
16276
  {
@@ -17031,27 +16329,34 @@ function ConfirmDialog2({
17031
16329
  onOpenChange: (nextOpen) => {
17032
16330
  if (!nextOpen && !loading) onCancel();
17033
16331
  },
17034
- children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
17035
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
17036
- /* @__PURE__ */ jsx(DialogTitle, { children: title }),
17037
- /* @__PURE__ */ jsx(DialogDescription, { children: description })
17038
- ] }),
17039
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
17040
- /* @__PURE__ */ jsx(Button, { variant: "outline", disabled: loading, onClick: onCancel, children: "Cancel" }),
17041
- /* @__PURE__ */ jsxs(
17042
- Button,
17043
- {
17044
- variant: "destructive",
17045
- disabled: loading,
17046
- onClick: onConfirm,
17047
- children: [
17048
- loading && /* @__PURE__ */ jsx(Loader2Icon, { className: "mr-1.5 size-3.5 animate-spin" }),
17049
- confirmLabel
17050
- ]
17051
- }
17052
- )
17053
- ] })
17054
- ] })
16332
+ children: /* @__PURE__ */ jsxs(
16333
+ DialogContent,
16334
+ {
16335
+ showCloseButton: false,
16336
+ className: "gap-3.5 px-6 pt-6 pb-5 sm:max-w-[430px]",
16337
+ children: [
16338
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
16339
+ /* @__PURE__ */ jsx(DialogTitle, { children: title }),
16340
+ /* @__PURE__ */ jsx(DialogDescription, { children: description })
16341
+ ] }),
16342
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "pt-1.5", children: [
16343
+ /* @__PURE__ */ jsx(Button, { variant: "outline", disabled: loading, onClick: onCancel, children: "Cancel" }),
16344
+ /* @__PURE__ */ jsxs(
16345
+ Button,
16346
+ {
16347
+ variant: "destructive",
16348
+ disabled: loading,
16349
+ onClick: onConfirm,
16350
+ children: [
16351
+ loading && /* @__PURE__ */ jsx(Loader2Icon, { className: "mr-1.5 size-3.5 animate-spin" }),
16352
+ confirmLabel
16353
+ ]
16354
+ }
16355
+ )
16356
+ ] })
16357
+ ]
16358
+ }
16359
+ )
17055
16360
  }
17056
16361
  );
17057
16362
  }
@@ -17313,21 +16618,19 @@ function AgentChat({
17313
16618
  "div",
17314
16619
  {
17315
16620
  "data-testid": "mobile-pane-toggle",
17316
- className: "md:hidden flex shrink-0 border-b border-line bg-card",
17317
- children: mobilePanes.map((pane) => /* @__PURE__ */ jsx(
17318
- "button",
16621
+ className: "md:hidden flex shrink-0 justify-center border-b border-line bg-card px-3 py-2",
16622
+ children: /* @__PURE__ */ jsx(
16623
+ SegmentedControl,
17319
16624
  {
17320
- type: "button",
17321
- onClick: () => setMobileView(pane),
17322
- "aria-pressed": activeMobilePane === pane,
17323
- className: cn(
17324
- "flex-1 min-h-11 px-4 py-3 text-sm font-medium border-b-2 -mb-px transition-colors",
17325
- activeMobilePane === pane ? "border-primary text-foreground" : "border-transparent text-subtle hover:text-foreground"
17326
- ),
17327
- children: MOBILE_PANE_LABELS[pane]
17328
- },
17329
- pane
17330
- ))
16625
+ "aria-label": "Show",
16626
+ segments: mobilePanes.map((pane) => ({
16627
+ value: pane,
16628
+ label: MOBILE_PANE_LABELS[pane]
16629
+ })),
16630
+ value: activeMobilePane,
16631
+ onChange: setMobileView
16632
+ }
16633
+ )
17331
16634
  }
17332
16635
  ),
17333
16636
  /* @__PURE__ */ jsx(
@@ -17764,35 +17067,26 @@ function IntegrationsPage({ agentId, adapter, onBack }) {
17764
17067
  }
17765
17068
  };
17766
17069
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-3xl flex-col gap-6 p-6", children: [
17767
- /* @__PURE__ */ jsxs(
17768
- "button",
17769
- {
17770
- type: "button",
17771
- onClick: onBack,
17772
- className: "-mx-2 inline-flex min-h-11 w-fit items-center gap-1.5 rounded-lg px-2 text-sm text-muted-foreground pointer-fine:mx-0 pointer-fine:min-h-0 pointer-fine:px-0 pointer-fine:hover:text-foreground",
17773
- children: [
17774
- /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "h-4 w-4" }),
17775
- "Back"
17776
- ]
17777
- }
17778
- ),
17070
+ /* @__PURE__ */ jsx(TextLink, { asChild: true, variant: "muted", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: onBack, children: [
17071
+ /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-4" }),
17072
+ "Back"
17073
+ ] }) }),
17779
17074
  /* @__PURE__ */ jsxs("div", { children: [
17780
17075
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Integrations" }),
17781
17076
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Connect third-party services to enhance your agent's capabilities" })
17782
17077
  ] }),
17783
17078
  /* @__PURE__ */ jsx(
17784
- "input",
17079
+ Input,
17785
17080
  {
17786
17081
  type: "search",
17787
17082
  value: query,
17788
17083
  onChange: (e) => setQuery(e.target.value),
17789
- placeholder: "Search integrations...",
17790
- className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"
17084
+ placeholder: "Search integrations..."
17791
17085
  }
17792
17086
  ),
17793
17087
  error && /* @__PURE__ */ jsx("div", { role: "alert", className: "text-xs text-red-500", children: error }),
17794
17088
  grouped.map(([category, items]) => /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", children: [
17795
- /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold uppercase tracking-wide text-muted-foreground/70", children: category }),
17089
+ /* @__PURE__ */ jsx(SectionLabel, { label: category, role: "heading", "aria-level": 2, className: "pl-0" }),
17796
17090
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: items.map((r) => /* @__PURE__ */ jsx(
17797
17091
  ToolkitRow,
17798
17092
  {
@@ -17815,53 +17109,73 @@ function ToolkitRow({
17815
17109
  const [open, setOpen] = useState(false);
17816
17110
  const [broken, setBroken] = useState(false);
17817
17111
  const name = row.name ?? titleCase(row.toolkit);
17818
- return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border p-3", children: [
17819
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
17820
- /* @__PURE__ */ jsxs(
17821
- "button",
17822
- {
17823
- type: "button",
17824
- "aria-label": open ? "Collapse" : "Expand",
17825
- "aria-expanded": open,
17826
- onClick: () => setOpen((v) => !v),
17827
- className: "flex min-w-0 flex-1 items-center gap-2 text-left",
17828
- children: [
17829
- open ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/60" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/60" }),
17830
- broken || !row.logo ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-5 w-5 items-center justify-center rounded bg-muted text-sm font-semibold uppercase", children: name.charAt(0) }) : /* @__PURE__ */ jsx(
17831
- "img",
17112
+ return (
17113
+ // A boxed disclosure: the header names the toolkit and opens its
17114
+ // description; Connect sits beside it, outside the trigger, since a
17115
+ // button cannot hold another.
17116
+ /* @__PURE__ */ jsxs(
17117
+ Collapsible,
17118
+ {
17119
+ open,
17120
+ onOpenChange: setOpen,
17121
+ className: "rounded-[10px] border border-foreground/[0.08]",
17122
+ children: [
17123
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pr-3", children: [
17124
+ /* @__PURE__ */ jsx(
17125
+ CollapsibleHeader,
17832
17126
  {
17833
- src: row.logo,
17834
- alt: name,
17835
- className: "h-5 w-5 rounded object-contain",
17836
- onError: () => setBroken(true)
17127
+ variant: "section",
17128
+ "aria-label": open ? "Collapse" : "Expand",
17129
+ className: "min-w-0 flex-1",
17130
+ children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
17131
+ broken || !row.logo ? /* @__PURE__ */ jsx("span", { className: "inline-flex size-5 shrink-0 items-center justify-center rounded bg-muted text-sm font-semibold uppercase", children: name.charAt(0) }) : /* @__PURE__ */ jsx(
17132
+ "img",
17133
+ {
17134
+ src: row.logo,
17135
+ alt: name,
17136
+ className: "size-5 shrink-0 rounded object-contain",
17137
+ onError: () => setBroken(true)
17138
+ }
17139
+ ),
17140
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: name })
17141
+ ] })
17837
17142
  }
17838
17143
  ),
17839
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-foreground", children: name })
17840
- ]
17841
- }
17842
- ),
17843
- /* @__PURE__ */ jsx(
17844
- Button,
17845
- {
17846
- type: "button",
17847
- variant: "outline",
17848
- size: "xs",
17849
- disabled: busy,
17850
- onClick: row.connected ? onDisconnect : onConnect,
17851
- className: "ml-auto min-w-[6rem]",
17852
- children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
17853
- /* @__PURE__ */ jsx(Loader2Icon, { className: "h-3.5 w-3.5 animate-spin" }),
17854
- row.connected ? "Disconnecting" : "Connecting"
17855
- ] }) : row.connected ? "Disconnect" : "Connect"
17856
- }
17857
- )
17858
- ] }),
17859
- open && /* @__PURE__ */ jsxs("div", { className: "mt-2 pl-7 text-sm text-muted-foreground", children: [
17860
- row.description && /* @__PURE__ */ jsx("p", { children: row.description }),
17861
- /* @__PURE__ */ jsx("span", { className: "mt-1 inline-block rounded bg-primary/10 px-1.5 py-0.5 text-sm font-semibold text-primary", children: row.auth_mode === "api_key" ? "API Key" : "OAuth" })
17862
- ] })
17863
- ] });
17144
+ /* @__PURE__ */ jsx(
17145
+ Button,
17146
+ {
17147
+ type: "button",
17148
+ variant: "outline",
17149
+ size: "xs",
17150
+ disabled: busy,
17151
+ onClick: row.connected ? onDisconnect : onConnect,
17152
+ className: "min-w-[6rem]",
17153
+ children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
17154
+ /* @__PURE__ */ jsx(Loader2Icon, { className: "size-3.5 animate-spin" }),
17155
+ row.connected ? "Disconnecting" : "Connecting"
17156
+ ] }) : row.connected ? "Disconnect" : "Connect"
17157
+ }
17158
+ )
17159
+ ] }),
17160
+ /* @__PURE__ */ jsxs(CollapsibleContent, { className: "border-t border-foreground/[0.08] px-3 py-2.5 text-[13px] text-muted-foreground", children: [
17161
+ row.description && /* @__PURE__ */ jsx("p", { children: row.description }),
17162
+ /* @__PURE__ */ jsx(
17163
+ TagPill,
17164
+ {
17165
+ label: row.auth_mode === "api_key" ? "API key" : "OAuth",
17166
+ className: "mt-1.5"
17167
+ }
17168
+ )
17169
+ ] })
17170
+ ]
17171
+ }
17172
+ )
17173
+ );
17864
17174
  }
17175
+ var MODES = [
17176
+ { value: "oauth", label: "Subscription" },
17177
+ { value: "api_key", label: "API key" }
17178
+ ];
17865
17179
  var PROVIDERS = [
17866
17180
  {
17867
17181
  key: "claude",
@@ -17910,18 +17224,10 @@ function CodingAgentsPanel({ agentId, adapter, onBack }) {
17910
17224
  }, [connections]);
17911
17225
  if (!supported) return null;
17912
17226
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-3xl flex-col gap-6 p-6", children: [
17913
- onBack && /* @__PURE__ */ jsxs(
17914
- "button",
17915
- {
17916
- type: "button",
17917
- onClick: onBack,
17918
- className: "-mx-2 inline-flex min-h-11 w-fit items-center gap-1.5 rounded-lg px-2 text-sm text-muted-foreground pointer-fine:mx-0 pointer-fine:min-h-0 pointer-fine:px-0 pointer-fine:hover:text-foreground",
17919
- children: [
17920
- /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "h-4 w-4" }),
17921
- "Back"
17922
- ]
17923
- }
17924
- ),
17227
+ onBack && /* @__PURE__ */ jsx(TextLink, { asChild: true, variant: "muted", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: onBack, children: [
17228
+ /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-4" }),
17229
+ "Back"
17230
+ ] }) }),
17925
17231
  /* @__PURE__ */ jsxs("div", { children: [
17926
17232
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Coding agents" }),
17927
17233
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Connect your Claude or ChatGPT plan so the agent can run `/code` on your behalf without separate API billing." })
@@ -18000,40 +17306,21 @@ function ProviderCard({
18000
17306
  return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3 rounded-lg border border-border p-4", children: [
18001
17307
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
18002
17308
  /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold text-foreground", children: meta.name }),
18003
- /* @__PURE__ */ jsx(
18004
- "span",
18005
- {
18006
- className: `inline-flex items-center rounded px-1.5 py-0.5 text-xs font-semibold ${connected ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`,
18007
- children: connected ? `Connected${connection?.auth_mode === "api_key" ? " (API key)" : ""}` : "Not connected"
18008
- }
18009
- )
18010
- ] }),
18011
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1 text-xs", children: [
18012
- /* @__PURE__ */ jsx(
18013
- "button",
18014
- {
18015
- type: "button",
18016
- onClick: () => {
18017
- setMode("oauth");
18018
- setError(null);
18019
- },
18020
- className: `rounded-md border px-2 py-1 ${mode === "oauth" ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-accent"}`,
18021
- children: "Subscription"
18022
- }
18023
- ),
18024
- /* @__PURE__ */ jsx(
18025
- "button",
18026
- {
18027
- type: "button",
18028
- onClick: () => {
18029
- setMode("api_key");
18030
- setError(null);
18031
- },
18032
- className: `rounded-md border px-2 py-1 ${mode === "api_key" ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-accent"}`,
18033
- children: "API key"
18034
- }
18035
- )
17309
+ /* @__PURE__ */ jsx(TonePill, { tone: connected ? "ok" : "muted", children: connected ? `Connected${connection?.auth_mode === "api_key" ? " (API key)" : ""}` : "Not connected" })
18036
17310
  ] }),
17311
+ /* @__PURE__ */ jsx(
17312
+ SegmentedControl,
17313
+ {
17314
+ "aria-label": "Credential type",
17315
+ segments: MODES,
17316
+ value: mode,
17317
+ onChange: (next) => {
17318
+ setMode(next);
17319
+ setError(null);
17320
+ },
17321
+ className: "self-start"
17322
+ }
17323
+ ),
18037
17324
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: instructions }),
18038
17325
  /* @__PURE__ */ jsx(
18039
17326
  "textarea",
@@ -18045,7 +17332,7 @@ function ProviderCard({
18045
17332
  autoComplete: "off",
18046
17333
  rows: mode === "oauth" && meta.provider === "openai" ? 4 : 2,
18047
17334
  "aria-label": `${meta.name} credential`,
18048
- className: "w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-xs [-webkit-text-security:disc]"
17335
+ className: cn(CONTROL_FIELD, "resize-y font-mono [-webkit-text-security:disc]")
18049
17336
  }
18050
17337
  ),
18051
17338
  error && /* @__PURE__ */ jsx("div", { role: "alert", className: "text-xs text-red-500", children: error }),
@@ -18170,21 +17457,27 @@ function kindIcon(kind) {
18170
17457
  }
18171
17458
  var VIEWS = {
18172
17459
  active: {
17460
+ label: "Active",
18173
17461
  statuses: ["pending"],
18174
17462
  kinds: ["input_required", "action_required", "governance_gate"],
18175
17463
  empty: "Nothing needs you right now"
18176
17464
  },
18177
17465
  updates: {
17466
+ label: "Updates",
18178
17467
  statuses: ["pending"],
18179
17468
  kinds: ["task_complete", "progress_checkin"],
18180
17469
  empty: "No news from your agent"
18181
17470
  },
18182
17471
  history: {
17472
+ label: "History",
18183
17473
  statuses: ["acknowledged", "responded", "expired"],
18184
17474
  empty: "No history yet"
18185
17475
  }
18186
17476
  };
18187
- var VIEW_NAMES = Object.keys(VIEWS);
17477
+ var VIEW_OPTIONS = Object.keys(VIEWS).map((id) => ({
17478
+ id,
17479
+ label: VIEWS[id].label
17480
+ }));
18188
17481
  function belongsToView(item, view) {
18189
17482
  const kinds = VIEWS[view].kinds;
18190
17483
  return VIEWS[view].statuses.includes(item.status) && (kinds === void 0 || kinds.includes(item.kind));
@@ -18208,7 +17501,6 @@ function InboxBody({ body, muted }) {
18208
17501
  }
18209
17502
  );
18210
17503
  }
18211
- var FIELD_CLASS = "h-9 w-full border border-line bg-background px-2 text-sm text-foreground outline-none focus:border-primary disabled:opacity-50";
18212
17504
  function errorMessage(error, fallback) {
18213
17505
  return error instanceof Error && error.message ? error.message : fallback;
18214
17506
  }
@@ -18268,7 +17560,7 @@ function QuestionInput({
18268
17560
  "select",
18269
17561
  {
18270
17562
  "aria-label": prompt,
18271
- className: FIELD_CLASS,
17563
+ className: CONTROL_FIELD,
18272
17564
  disabled,
18273
17565
  value: useOther ? OTHER_OPTION : pickedIndex >= 0 ? String(pickedIndex) : "",
18274
17566
  onChange: (event) => {
@@ -18281,9 +17573,17 @@ function QuestionInput({
18281
17573
  if (choice) onPickChoice(choice.label);
18282
17574
  },
18283
17575
  children: [
18284
- /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select" }),
18285
- choices.map((choice, index) => /* @__PURE__ */ jsx("option", { value: String(index), children: choice.label }, choice.label)),
18286
- allowOther && /* @__PURE__ */ jsx("option", { value: OTHER_OPTION, children: "Other" })
17576
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true, className: CONTROL_OPTION, children: "Select" }),
17577
+ choices.map((choice, index) => /* @__PURE__ */ jsx(
17578
+ "option",
17579
+ {
17580
+ value: String(index),
17581
+ className: CONTROL_OPTION,
17582
+ children: choice.label
17583
+ },
17584
+ choice.label
17585
+ )),
17586
+ allowOther && /* @__PURE__ */ jsx("option", { value: OTHER_OPTION, className: CONTROL_OPTION, children: "Other" })
18287
17587
  ]
18288
17588
  }
18289
17589
  ),
@@ -18291,7 +17591,7 @@ function QuestionInput({
18291
17591
  "input",
18292
17592
  {
18293
17593
  "aria-label": `${prompt} (other)`,
18294
- className: FIELD_CLASS,
17594
+ className: CONTROL_FIELD,
18295
17595
  placeholder: "Type your answer\u2026",
18296
17596
  disabled,
18297
17597
  value: typed,
@@ -18304,7 +17604,7 @@ function QuestionInput({
18304
17604
  "input",
18305
17605
  {
18306
17606
  "aria-label": prompt,
18307
- className: FIELD_CLASS,
17607
+ className: CONTROL_FIELD,
18308
17608
  disabled,
18309
17609
  value: typed,
18310
17610
  onChange: (event) => onType(event.target.value)
@@ -18669,18 +17969,10 @@ function InboxDetail({
18669
17969
  }) {
18670
17970
  const Icon = kindIcon(item.kind);
18671
17971
  return /* @__PURE__ */ jsxs("section", { className: "min-w-0 flex-1 overflow-y-auto p-4 md:p-6", children: [
18672
- onBack && /* @__PURE__ */ jsxs(
18673
- "button",
18674
- {
18675
- type: "button",
18676
- onClick: onBack,
18677
- className: "-ml-2 mb-2 inline-flex min-h-11 items-center gap-1.5 px-2 text-sm font-medium text-muted-foreground md:hidden",
18678
- children: [
18679
- /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4" }),
18680
- "Inbox"
18681
- ]
18682
- }
18683
- ),
17972
+ onBack && /* @__PURE__ */ jsx(TextLink, { variant: "muted", asChild: true, className: "mb-2 md:hidden", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: onBack, children: [
17973
+ /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
17974
+ "Inbox"
17975
+ ] }) }),
18684
17976
  /* @__PURE__ */ jsxs("div", { className: "mb-5 flex min-w-0 items-start gap-3", children: [
18685
17977
  /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex size-8 shrink-0 items-center justify-center border border-line text-muted-foreground", children: /* @__PURE__ */ jsx(Icon, { className: "size-4" }) }),
18686
17978
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
@@ -18870,54 +18162,43 @@ function InboxPanel({
18870
18162
  /* @__PURE__ */ jsx(InboxIcon, { className: "size-4 text-muted-foreground" }),
18871
18163
  /* @__PURE__ */ jsx("h1", { className: "font-semibold", children: title })
18872
18164
  ] }),
18873
- /* @__PURE__ */ jsx("div", { className: "flex gap-1 border-b border-line px-2 py-2", children: VIEW_NAMES.map((value) => /* @__PURE__ */ jsx(
18874
- "button",
18165
+ /* @__PURE__ */ jsx("div", { className: "border-b border-line px-2 py-2", children: /* @__PURE__ */ jsx(
18166
+ ViewSwitch,
18875
18167
  {
18876
- type: "button",
18877
- onClick: () => selectView(value),
18878
- className: cn(
18879
- "px-2 py-1 text-xs capitalize transition-colors",
18880
- view === value ? "bg-line font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
18881
- ),
18882
- children: value
18883
- },
18884
- value
18885
- )) }),
18168
+ label: "Inbox view",
18169
+ views: VIEW_OPTIONS,
18170
+ value: view,
18171
+ onChange: selectView
18172
+ }
18173
+ ) }),
18886
18174
  /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
18887
18175
  error && items.length === 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2 px-4 py-3", children: [
18888
18176
  /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error }),
18889
18177
  /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", onClick: () => void load(null), children: "Try again" })
18890
18178
  ] }),
18891
- items.length === 0 && !error && !loading && /* @__PURE__ */ jsx("div", { className: "px-4 py-8 text-sm text-muted-foreground", children: VIEWS[view].empty }),
18892
- items.map((item) => {
18893
- const Icon = kindIcon(item.kind);
18894
- const selected = item.id === selectedItemId;
18895
- return /* @__PURE__ */ jsxs(
18896
- "button",
18897
- {
18898
- type: "button",
18899
- "aria-label": `Open inbox item ${item.title}`,
18900
- className: cn(
18901
- "flex w-full min-w-0 gap-3 border-l-2 px-3 py-3 text-left transition-colors hover:bg-input",
18902
- selected ? "border-l-primary bg-line text-foreground" : "border-l-transparent text-subtle",
18903
- !item.readAt && "font-medium text-foreground"
18904
- ),
18905
- onClick: () => void selectItem(item.id),
18906
- children: [
18907
- /* @__PURE__ */ jsx(Icon, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }),
18908
- /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
18909
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center justify-between gap-2", children: [
18910
- /* @__PURE__ */ jsx("span", { className: "truncate text-xs uppercase tracking-wide text-muted-foreground", children: kindLabel(item.kind) }),
18911
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: formatRelative(item.createdAt) })
18912
- ] }),
18913
- /* @__PURE__ */ jsx("span", { className: "mt-1 block truncate text-sm", children: item.title }),
18914
- /* @__PURE__ */ jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: statusLabel(item.status) })
18915
- ] })
18916
- ]
18917
- },
18918
- item.id
18919
- );
18920
- }),
18179
+ items.length === 0 && !error && !loading && /* @__PURE__ */ jsx(EmptyState, { className: "px-4 py-10", title: VIEWS[view].empty }),
18180
+ items.map((item) => /* @__PURE__ */ jsx(
18181
+ ListRow,
18182
+ {
18183
+ size: "lg",
18184
+ icon: kindIcon(item.kind),
18185
+ label: item.title,
18186
+ description: `${kindLabel(item.kind)} \xB7 ${statusLabel(item.status)}`,
18187
+ meta: formatRelative(item.createdAt),
18188
+ isActive: item.id === selectedItemId,
18189
+ badge: !item.readAt && /* @__PURE__ */ jsx(
18190
+ "span",
18191
+ {
18192
+ "aria-label": "Unread",
18193
+ title: "Unread",
18194
+ className: "size-[7px] shrink-0 rounded-full bg-amber-500"
18195
+ }
18196
+ ),
18197
+ "aria-label": `Open inbox item ${item.title}`,
18198
+ onClick: () => void selectItem(item.id)
18199
+ },
18200
+ item.id
18201
+ )),
18921
18202
  nextCursor && /* @__PURE__ */ jsx(
18922
18203
  Button,
18923
18204
  {
@@ -18995,12 +18276,12 @@ function useInboxUnreadCount(adapter) {
18995
18276
  }, [listInbox, openInboxStream, refetch]);
18996
18277
  return { unreadCount, hasLoaded, error };
18997
18278
  }
18998
- var CATEGORY_BADGE_CLASS = {
18999
- spawn: "border-primary/30 bg-primary/10 text-primary",
19000
- output: "border-foreground/20 bg-foreground/5 text-foreground/80",
19001
- done: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600",
19002
- verdict: "border-amber-500/30 bg-amber-500/10 text-amber-600",
19003
- system: "border-border bg-muted text-muted-foreground"
18279
+ var CATEGORY_TONE = {
18280
+ spawn: "warn",
18281
+ output: "muted",
18282
+ done: "ok",
18283
+ verdict: "warn",
18284
+ system: "muted"
19004
18285
  };
19005
18286
  function MissionActivityTab({ feed }) {
19006
18287
  const [filter, setFilter] = useState("all");
@@ -19010,15 +18291,15 @@ function MissionActivityTab({ feed }) {
19010
18291
  return newestFirst.filter((e) => missionEventCategory(e.type) === filter);
19011
18292
  }, [feed.events, filter]);
19012
18293
  if (feed.events.length === 0) {
19013
- return /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-sm text-muted-foreground/60", children: "No mission activity yet." });
18294
+ return /* @__PURE__ */ jsx(EmptyState, { className: "py-8", title: "No mission activity yet" });
19014
18295
  }
19015
18296
  return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
19016
18297
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: ["all", ...MISSION_EVENT_CATEGORIES].map((cat) => /* @__PURE__ */ jsx(
19017
- "button",
18298
+ FilterPill,
19018
18299
  {
19019
- type: "button",
18300
+ on: filter === cat,
19020
18301
  onClick: () => setFilter(cat),
19021
- className: `rounded-full border px-2.5 py-0.5 font-mono text-[10px] uppercase tracking-wide transition-colors ${filter === cat ? "border-foreground bg-foreground text-background" : "border-border/60 bg-background text-muted-foreground hover:bg-muted/40"}`,
18302
+ className: "capitalize",
19022
18303
  children: cat
19023
18304
  },
19024
18305
  cat
@@ -19036,28 +18317,18 @@ function ActivityRow({
19036
18317
  /* @__PURE__ */ jsx("span", { className: "w-20 shrink-0 font-mono text-[10px] text-muted-foreground/60", children: formatMissionTimestamp(event.createdAt) }),
19037
18318
  /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
19038
18319
  /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
19039
- /* @__PURE__ */ jsx(
19040
- "span",
19041
- {
19042
- className: `shrink-0 rounded border px-1.5 font-mono uppercase ${CATEGORY_BADGE_CLASS[category]}`,
19043
- children: category
19044
- }
19045
- ),
18320
+ /* @__PURE__ */ jsx(TonePill, { tone: CATEGORY_TONE[category], className: "capitalize", children: category }),
19046
18321
  /* @__PURE__ */ jsx("p", { className: "shrink-0 text-xs text-foreground font-mono", children: missionEventActorLabel(event, feed.sessions) }),
19047
- taskId ? /* @__PURE__ */ jsx("p", { className: "shrink-0 rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground/70", children: taskId.slice(0, 8) }) : null
18322
+ taskId ? /* @__PURE__ */ jsx(TagPill, { label: taskId.slice(0, 8), className: "font-mono" }) : null
19048
18323
  ] }),
19049
18324
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-foreground/80", children: renderInlineMarkdown(missionEventSummary(event)) }) })
19050
18325
  ] })
19051
18326
  ] });
19052
18327
  }
19053
- function verdictToneClass(result) {
19054
- if (result === "satisfied") {
19055
- return "border-emerald-500/30 bg-emerald-500/5 text-emerald-700 dark:text-emerald-400";
19056
- }
19057
- if (result === "failed" || result === "blocked") {
19058
- return "border-destructive/30 bg-destructive/5 text-destructive";
19059
- }
19060
- return "border-amber-500/30 bg-amber-500/5 text-amber-700 dark:text-amber-400";
18328
+ function missionVerdictTone(result) {
18329
+ if (result === "satisfied") return "ok";
18330
+ if (result === "failed" || result === "blocked") return "bad";
18331
+ return "warn";
19061
18332
  }
19062
18333
  function MissionMetadataTab({ mission }) {
19063
18334
  const rows = [
@@ -19108,7 +18379,7 @@ function MissionMetadataTab({ mission }) {
19108
18379
  mission.lastEvaluationResult ? /* @__PURE__ */ jsxs(
19109
18380
  "section",
19110
18381
  {
19111
- className: `space-y-2 rounded-md border p-4 ${verdictToneClass(mission.lastEvaluationResult)}`,
18382
+ className: `space-y-2 rounded-[10px] p-4 ${TONE[missionVerdictTone(mission.lastEvaluationResult)]}`,
19112
18383
  children: [
19113
18384
  /* @__PURE__ */ jsxs("div", { className: "font-mono text-[10px] uppercase tracking-widest", children: [
19114
18385
  "Last verdict \u2014 ",
@@ -19121,7 +18392,7 @@ function MissionMetadataTab({ mission }) {
19121
18392
  }
19122
18393
  ) : null,
19123
18394
  /* @__PURE__ */ jsxs("section", { children: [
19124
- /* @__PURE__ */ jsx("div", { className: "mb-2 font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: "Identifiers" }),
18395
+ /* @__PURE__ */ jsx(SectionLabel, { label: "Identifiers", className: "mb-2 pl-0" }),
19125
18396
  /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs", children: rows.map((r) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
19126
18397
  /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground/70", children: r.label }),
19127
18398
  /* @__PURE__ */ jsx("dd", { className: "break-all text-foreground/90", children: r.value })
@@ -19141,22 +18412,11 @@ function compareNodes(a, b) {
19141
18412
  }
19142
18413
  return pa.length - pb.length;
19143
18414
  }
19144
- function statusToneClass(status) {
19145
- switch (status) {
19146
- case "merged":
19147
- return "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400";
19148
- case "done":
19149
- return "border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-400";
19150
- case "running":
19151
- return "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400";
19152
- case "failed":
19153
- return "border-destructive/30 bg-destructive/10 text-destructive";
19154
- case "pruned":
19155
- return "border-border bg-muted/40 text-muted-foreground/70 line-through";
19156
- default:
19157
- return "border-border bg-muted/30 text-muted-foreground/80";
19158
- }
19159
- }
18415
+ var IDEA_STATUS_TONE = {
18416
+ merged: "ok",
18417
+ running: "warn",
18418
+ failed: "bad"
18419
+ };
19160
18420
  function fmtScore(n) {
19161
18421
  if (n === null || n === void 0) return "\u2014";
19162
18422
  return n.toFixed(3).replace(/\.?0+$/, "") || "0";
@@ -19252,9 +18512,10 @@ function IdeaRow({
19252
18512
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
19253
18513
  /* @__PURE__ */ jsx("code", { className: "shrink-0 text-[11px] text-muted-foreground/60", children: node.nodeKey }),
19254
18514
  /* @__PURE__ */ jsx(
19255
- "span",
18515
+ TonePill,
19256
18516
  {
19257
- className: `shrink-0 rounded border px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wider ${statusToneClass(node.status)}`,
18517
+ tone: IDEA_STATUS_TONE[node.status] ?? "muted",
18518
+ className: node.status === "pruned" ? "capitalize line-through" : "capitalize",
19258
18519
  children: node.status
19259
18520
  }
19260
18521
  ),
@@ -19287,13 +18548,14 @@ function MissionResearchTab({ research }) {
19287
18548
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
19288
18549
  /* @__PURE__ */ jsx(RunHeader, { run }),
19289
18550
  /* @__PURE__ */ jsxs("section", { children: [
19290
- /* @__PURE__ */ jsxs("div", { className: "mb-2 font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: [
19291
- "Idea Tree \xB7 ",
19292
- sorted.length,
19293
- " node",
19294
- sorted.length === 1 ? "" : "s"
19295
- ] }),
19296
- sorted.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60", children: "No hypotheses yet." }) : /* @__PURE__ */ jsx("ul", { className: "rounded-md border", children: sorted.map((n) => /* @__PURE__ */ jsx(
18551
+ /* @__PURE__ */ jsx(
18552
+ SectionLabel,
18553
+ {
18554
+ label: `Idea tree \xB7 ${sorted.length} node${sorted.length === 1 ? "" : "s"}`,
18555
+ className: "mb-2 pl-0"
18556
+ }
18557
+ ),
18558
+ sorted.length === 0 ? /* @__PURE__ */ jsx(EmptyState, { className: "py-8", title: "No hypotheses yet" }) : /* @__PURE__ */ jsx("ul", { className: "rounded-md border", children: sorted.map((n) => /* @__PURE__ */ jsx(
19297
18559
  IdeaRow,
19298
18560
  {
19299
18561
  node: n,
@@ -19305,27 +18567,30 @@ function MissionResearchTab({ research }) {
19305
18567
  ] })
19306
18568
  ] });
19307
18569
  }
19308
- var TASK_STATUS_BADGE_CLASS = {
19309
- running: "border-primary/30 bg-primary/10 text-primary",
19310
- blocked: "border-amber-500/30 bg-amber-500/10 text-amber-600",
19311
- done: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600",
19312
- failed: "border-destructive/30 bg-destructive/10 text-destructive",
19313
- cancelled: "border-border bg-muted text-muted-foreground"
18570
+ var TASK_STATUS_TONE = {
18571
+ running: "warn",
18572
+ blocked: "warn",
18573
+ done: "ok",
18574
+ failed: "bad",
18575
+ active: "warn",
18576
+ completed: "ok"
19314
18577
  };
19315
- function statusBadgeClass(status) {
19316
- return TASK_STATUS_BADGE_CLASS[status] ?? "border-foreground/20 bg-foreground/5 text-foreground/70";
18578
+ function missionTaskStatusTone(status) {
18579
+ return TASK_STATUS_TONE[status] ?? "muted";
19317
18580
  }
19318
18581
  function TaskChip({
19319
18582
  task,
19320
18583
  onSelect
19321
18584
  }) {
19322
18585
  return /* @__PURE__ */ jsxs(
19323
- "button",
18586
+ Button,
19324
18587
  {
19325
18588
  type: "button",
18589
+ variant: "outline",
18590
+ size: "xs",
19326
18591
  "data-task-chip": true,
19327
18592
  onClick: () => onSelect(task.id),
19328
- className: "inline-flex max-w-full items-center gap-1.5 rounded-full border border-border/60 bg-background px-2.5 py-1 text-xs hover:bg-muted/40",
18593
+ className: "max-w-full",
19329
18594
  children: [
19330
18595
  /* @__PURE__ */ jsx(
19331
18596
  "span",
@@ -19333,8 +18598,8 @@ function TaskChip({
19333
18598
  className: `size-1.5 shrink-0 rounded-full ${missionTaskStatusDotClass(task.status)}`
19334
18599
  }
19335
18600
  ),
19336
- /* @__PURE__ */ jsx("span", { className: "truncate text-foreground/85", children: missionTaskTitle(task.goal, 40) }),
19337
- /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[9px] text-muted-foreground/60", children: task.id.slice(0, 8) })
18601
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: missionTaskTitle(task.goal, 40) }),
18602
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[10px] text-muted-foreground", children: task.id.slice(0, 8) })
19338
18603
  ]
19339
18604
  }
19340
18605
  );
@@ -19347,27 +18612,22 @@ function TaskRailRow({
19347
18612
  const preview = stripMissionControlMarkup(
19348
18613
  task.status === "done" && task.result ? task.result : task.goal
19349
18614
  );
19350
- return /* @__PURE__ */ jsxs(
19351
- "button",
18615
+ return /* @__PURE__ */ jsx(
18616
+ ListRow,
19352
18617
  {
19353
- type: "button",
18618
+ asChild: true,
18619
+ size: "sm",
18620
+ isActive: selected,
18621
+ label: task.goal,
18622
+ description: [task.agentDefName, preview].filter(Boolean).join(" \xB7 "),
19354
18623
  onClick: () => onSelect(task.id),
19355
- className: `w-full rounded-md border px-3 py-2 text-left text-sm transition-colors ${selected ? "border-primary/40 bg-primary/5" : "border-transparent hover:bg-muted/40"}`,
19356
- children: [
19357
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
19358
- /* @__PURE__ */ jsx(
19359
- "span",
19360
- {
19361
- className: `size-2 shrink-0 rounded-full ${missionTaskStatusDotClass(task.status)}`
19362
- }
19363
- ),
19364
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground/90", children: task.goal })
19365
- ] }),
19366
- /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-col gap-2 pl-4", children: [
19367
- task.agentDefName ? /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs font-mono text-muted-foreground", children: task.agentDefName }) : null,
19368
- /* @__PURE__ */ jsx("span", { className: "line-clamp-2 min-w-0 flex-1 text-xs text-muted-foreground/70", children: preview })
19369
- ] })
19370
- ]
18624
+ className: "cursor-pointer",
18625
+ children: /* @__PURE__ */ jsx("button", { type: "button", children: /* @__PURE__ */ jsx(
18626
+ "span",
18627
+ {
18628
+ className: `size-2 shrink-0 rounded-full ${missionTaskStatusDotClass(task.status)}`
18629
+ }
18630
+ ) })
19371
18631
  }
19372
18632
  );
19373
18633
  }
@@ -19396,17 +18656,12 @@ function MissionTasksTab({
19396
18656
  return outputs.length > 0 ? outputs[outputs.length - 1] : null;
19397
18657
  }, [selected, taskEvents]);
19398
18658
  if (tasks.length === 0) {
19399
- return /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-sm text-muted-foreground/60", children: "No tasks spawned yet." });
18659
+ return /* @__PURE__ */ jsx(EmptyState, { className: "py-8", title: "No tasks spawned yet" });
19400
18660
  }
19401
18661
  return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 gap-4", children: [
19402
18662
  /* @__PURE__ */ jsx("div", { className: "w-72 shrink-0 space-y-4 overflow-y-auto pr-1", children: groups.map((group) => /* @__PURE__ */ jsxs("div", { children: [
19403
- /* @__PURE__ */ jsxs("div", { className: "mb-1 px-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: [
19404
- group.label,
19405
- " (",
19406
- group.tasks.length,
19407
- ")"
19408
- ] }),
19409
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: group.tasks.map((t) => /* @__PURE__ */ jsx(
18663
+ /* @__PURE__ */ jsx(SectionLabel, { label: `${group.label} (${group.tasks.length})` }),
18664
+ /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: group.tasks.map((t) => /* @__PURE__ */ jsx(
19410
18665
  TaskRailRow,
19411
18666
  {
19412
18667
  task: t,
@@ -19459,14 +18714,7 @@ function TaskDetail({
19459
18714
  /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[10px] text-muted-foreground/60", children: task.id.slice(0, 8) })
19460
18715
  ] }),
19461
18716
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
19462
- /* @__PURE__ */ jsx(
19463
- Badge,
19464
- {
19465
- variant: "destructive",
19466
- className: `font-mono text-sm uppercase tracking-wide ${statusBadgeClass(task.status)}`,
19467
- children: task.status
19468
- }
19469
- ),
18717
+ /* @__PURE__ */ jsx(TonePill, { tone: missionTaskStatusTone(task.status), className: "capitalize", children: task.status }),
19470
18718
  task.agentDefName ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: task.agentDefName }) : null,
19471
18719
  task.attemptCount > 1 ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
19472
18720
  "attempts ",
@@ -19482,30 +18730,26 @@ function TaskDetail({
19482
18730
  ] }),
19483
18731
  /* @__PURE__ */ jsx(OutcomeCard, { outcome }),
19484
18732
  parents.length > 0 || children.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
19485
- /* @__PURE__ */ jsx("div", { className: "font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: "Dependencies" }),
18733
+ /* @__PURE__ */ jsx(SectionLabel, { label: "Dependencies", className: "pl-0" }),
19486
18734
  parents.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
19487
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-[10px] uppercase text-muted-foreground/50", children: "Depends on" }),
18735
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-[12px] text-subtle", children: "Depends on" }),
19488
18736
  parents.map((p) => /* @__PURE__ */ jsx(TaskChip, { task: p, onSelect }, p.id))
19489
18737
  ] }) : null,
19490
18738
  children.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
19491
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-[10px] uppercase text-muted-foreground/50", children: "Blocks" }),
18739
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-[12px] text-subtle", children: "Blocks" }),
19492
18740
  children.map((c) => /* @__PURE__ */ jsx(TaskChip, { task: c, onSelect }, c.id))
19493
18741
  ] }) : null
19494
18742
  ] }) : null,
19495
18743
  /* @__PURE__ */ jsxs("div", { children: [
19496
- /* @__PURE__ */ jsx("div", { className: "mb-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: "Brief" }),
18744
+ /* @__PURE__ */ jsx(SectionLabel, { label: "Brief", className: "mb-1 pl-0" }),
19497
18745
  /* @__PURE__ */ jsx(MessageResponse, { className: "text-sm leading-relaxed text-foreground/90", children: task.goal })
19498
18746
  ] }),
19499
- task.resultMetadata ? /* @__PURE__ */ jsxs("details", { children: [
19500
- /* @__PURE__ */ jsx("summary", { className: "cursor-pointer font-mono text-[10px] uppercase tracking-widest text-muted-foreground/70", children: "Result metadata" }),
19501
- /* @__PURE__ */ jsx("pre", { className: "mt-1 max-h-64 overflow-auto whitespace-pre-wrap rounded bg-muted/30 px-2 py-1.5 text-[11px] text-foreground/90", children: JSON.stringify(task.resultMetadata, null, 2) })
18747
+ task.resultMetadata ? /* @__PURE__ */ jsxs(Collapsible, { className: "rounded-[10px] border border-foreground/[0.08]", children: [
18748
+ /* @__PURE__ */ jsx(CollapsibleHeader, { variant: "section", children: "Result metadata" }),
18749
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap border-t border-foreground/[0.08] px-3 py-2 text-[11px] text-foreground/90", children: JSON.stringify(task.resultMetadata, null, 2) }) })
19502
18750
  ] }) : null,
19503
18751
  eventsSupported && taskEvents.length > 0 ? /* @__PURE__ */ jsxs("div", { children: [
19504
- /* @__PURE__ */ jsxs("div", { className: "mb-2 font-mono font-semibold uppercase text-muted-foreground", children: [
19505
- "History (",
19506
- taskEvents.length,
19507
- ")"
19508
- ] }),
18752
+ /* @__PURE__ */ jsx(SectionLabel, { label: `History (${taskEvents.length})`, className: "mb-2 pl-0" }),
19509
18753
  /* @__PURE__ */ jsx("ol", { className: "space-y-3", children: taskEvents.map((e) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3 text-xs", children: [
19510
18754
  /* @__PURE__ */ jsx("span", { className: "w-16 shrink-0 font-mono text-[10px] text-muted-foreground/60", children: formatMissionTimestamp(e.createdAt) }),
19511
18755
  /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -19628,11 +18872,6 @@ function OutcomeCard({ outcome }) {
19628
18872
  }
19629
18873
  );
19630
18874
  }
19631
- var MISSION_WORKER_KIND_BADGE_CLASS = {
19632
- task: "border-primary/40 bg-primary/10 text-primary uppercase tracking-wide text-[10px]",
19633
- worker: "border-foreground/30 bg-foreground/5 text-foreground/80 uppercase tracking-wide text-[10px]",
19634
- delegation: "border-foreground/20 bg-foreground/[0.03] text-foreground/60 uppercase tracking-wide text-[10px]"
19635
- };
19636
18875
  var MISSION_WORKER_KIND_TOOLTIP = {
19637
18876
  task: "Durable Task row created by spawn_task. Retried by the dispatcher; survives across coordinator wakes.",
19638
18877
  worker: "Async one-shot session spawned by spawn_worker. Durable session, no retry/DAG.",
@@ -19644,7 +18883,13 @@ function MissionWorkersTab({
19644
18883
  onOpenTranscript
19645
18884
  }) {
19646
18885
  if (workers.length === 0) {
19647
- return /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-sm text-muted-foreground/60", children: "No workers attached to this mission right now." });
18886
+ return /* @__PURE__ */ jsx(
18887
+ EmptyState,
18888
+ {
18889
+ className: "py-8",
18890
+ title: "No workers attached to this mission right now"
18891
+ }
18892
+ );
19648
18893
  }
19649
18894
  return /* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-2", children: workers.map((w) => /* @__PURE__ */ jsx(
19650
18895
  WorkerCard2,
@@ -19674,18 +18919,11 @@ function WorkerCard2({
19674
18919
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
19675
18920
  /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold text-foreground", children: worker.agentDefName ?? "worker" }),
19676
18921
  /* @__PURE__ */ jsxs(Tooltip, { children: [
19677
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
19678
- Badge,
19679
- {
19680
- variant: "outline",
19681
- className: `mt-1 ${MISSION_WORKER_KIND_BADGE_CLASS[worker.kind]}`,
19682
- children: worker.kind
19683
- }
19684
- ) }),
18922
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Chip, { size: "sm", className: "mt-1 capitalize", children: worker.kind }) }),
19685
18923
  /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: MISSION_WORKER_KIND_TOOLTIP[worker.kind] })
19686
18924
  ] })
19687
18925
  ] }),
19688
- /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[10px] uppercase tracking-wider text-muted-foreground/70", children: statusLabel2 })
18926
+ /* @__PURE__ */ jsx(TonePill, { tone: missionTaskStatusTone(statusLabel2), className: "capitalize", children: statusLabel2 })
19689
18927
  ] }),
19690
18928
  counts ? /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-6", children: [
19691
18929
  /* @__PURE__ */ jsxs("div", { children: [
@@ -19710,13 +18948,13 @@ function WorkerCard2({
19710
18948
  ] }),
19711
18949
  /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-foreground/80", children: deriveMissionWorkerActivityLabel(worker) }),
19712
18950
  /* @__PURE__ */ jsx(
19713
- "a",
18951
+ TextLink,
19714
18952
  {
18953
+ size: "sm",
19715
18954
  href: worker.transcriptUrl,
19716
18955
  target: "_blank",
19717
18956
  rel: "noreferrer",
19718
18957
  onClick: onTranscriptClick,
19719
- className: "inline-block text-xs text-primary hover:underline",
19720
18958
  children: "View session"
19721
18959
  }
19722
18960
  )
@@ -19787,8 +19025,15 @@ function useMissionEvents(input) {
19787
19025
  var DEFAULT_POLL_INTERVAL_MS = 5e3;
19788
19026
  function CountBadge({ n }) {
19789
19027
  if (n === 0) return null;
19790
- return /* @__PURE__ */ jsx("span", { className: "ml-1 rounded bg-muted px-1 py-px text-[9px] text-muted-foreground/70", children: n });
19791
- }
19028
+ return /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: n });
19029
+ }
19030
+ var MISSION_STATUS_TONE = {
19031
+ active: "warn",
19032
+ paused: "warn",
19033
+ satisfied: "ok",
19034
+ failed: "bad",
19035
+ cancelled: "bad"
19036
+ };
19792
19037
  var INITIAL_STATE = {
19793
19038
  mission: null,
19794
19039
  tasks: [],
@@ -19948,7 +19193,6 @@ function MissionDashboard({
19948
19193
  setBusy(false);
19949
19194
  }
19950
19195
  };
19951
- const statusTone = mission.status === "satisfied" ? "border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400" : mission.status === "failed" || mission.status === "cancelled" ? "border-destructive/40 bg-destructive/10 text-destructive" : mission.status === "paused" ? "border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-400" : "border-primary/40 bg-primary/10 text-primary";
19952
19196
  const isActive = ACTIVE_MISSION_STATUSES.has(mission.status);
19953
19197
  const iterationPct = mission.maxIterations > 0 ? Math.min(100, mission.iteration / mission.maxIterations * 100) : 0;
19954
19198
  return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-1 flex-col overflow-hidden bg-muted/30", children: [
@@ -19956,9 +19200,10 @@ function MissionDashboard({
19956
19200
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
19957
19201
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
19958
19202
  /* @__PURE__ */ jsx(
19959
- "span",
19203
+ TonePill,
19960
19204
  {
19961
- className: `rounded-md border px-2 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-wider ${statusTone}`,
19205
+ tone: MISSION_STATUS_TONE[mission.status] ?? "muted",
19206
+ className: "capitalize",
19962
19207
  children: mission.status
19963
19208
  }
19964
19209
  ),
@@ -19970,9 +19215,9 @@ function MissionDashboard({
19970
19215
  ] }),
19971
19216
  /* @__PURE__ */ jsx("span", { className: "ml-1 text-[10px] uppercase tracking-wider text-muted-foreground/60", children: "iterations" })
19972
19217
  ] }),
19973
- mission.lastEvaluationResult ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground/70", children: [
19974
- /* @__PURE__ */ jsx("span", { className: "opacity-70", children: "last verdict" }),
19975
- /* @__PURE__ */ jsx("span", { className: "rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-primary", children: mission.lastEvaluationResult })
19218
+ mission.lastEvaluationResult ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[12px] text-muted-foreground", children: [
19219
+ /* @__PURE__ */ jsx("span", { children: "Last verdict" }),
19220
+ /* @__PURE__ */ jsx(TonePill, { tone: missionVerdictTone(mission.lastEvaluationResult), children: mission.lastEvaluationResult })
19976
19221
  ] }) : null
19977
19222
  ] }),
19978
19223
  /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-wrap items-center gap-2", children: [
@@ -20034,10 +19279,10 @@ function MissionDashboard({
20034
19279
  ] })
20035
19280
  ] }),
20036
19281
  /* @__PURE__ */ jsx(
20037
- Progress,
19282
+ ProgressBar,
20038
19283
  {
20039
19284
  value: iterationPct,
20040
- className: `h-1 ${isActive ? "" : "opacity-40"}`
19285
+ className: isActive ? void 0 : "opacity-40"
20041
19286
  }
20042
19287
  ),
20043
19288
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -20115,11 +19360,10 @@ function MissionDashboard({
20115
19360
  ] }),
20116
19361
  /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
20117
19362
  /* @__PURE__ */ jsx(
20118
- "input",
19363
+ Checkbox,
20119
19364
  {
20120
- type: "checkbox",
20121
19365
  checked: cancelCascade,
20122
- onChange: (e) => setCancelCascade(e.target.checked)
19366
+ onCheckedChange: (checked) => setCancelCascade(checked === true)
20123
19367
  }
20124
19368
  ),
20125
19369
  /* @__PURE__ */ jsxs("span", { children: [
@@ -20174,6 +19418,12 @@ function sortMissions(items) {
20174
19418
  return (a.updatedAt ?? "") > (b.updatedAt ?? "") ? -1 : 1;
20175
19419
  });
20176
19420
  }
19421
+ function missionTone(status) {
19422
+ if (status === "active") return "ok";
19423
+ if (status === "paused" || status === "blocked") return "warn";
19424
+ if (status === "failed" || status === "max_iterations_reached") return "bad";
19425
+ return "muted";
19426
+ }
20177
19427
  function MissionRow({
20178
19428
  mission,
20179
19429
  onOpen,
@@ -20204,81 +19454,79 @@ function MissionRow({
20204
19454
  e.preventDefault();
20205
19455
  openMission();
20206
19456
  };
20207
- return /* @__PURE__ */ jsxs(
20208
- "div",
19457
+ return /* @__PURE__ */ jsx(
19458
+ ListRow,
20209
19459
  {
20210
- className: cn(
20211
- "group flex min-w-0 items-start gap-2 border-l-2 border-l-transparent px-3 py-2 text-sm transition-colors cursor-pointer hover:border-l-primary hover:bg-input",
20212
- "min-h-11 md:min-h-0"
20213
- ),
20214
- onClick: openMission,
20215
- onKeyDown: handleRowKeyDown,
20216
- role: "button",
20217
- tabIndex: 0,
20218
- "aria-label": `Open mission ${description}`,
20219
- title: "Open mission dashboard",
20220
- children: [
20221
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex size-5 shrink-0 items-center justify-center text-faint", children: /* @__PURE__ */ jsx(TargetIcon, { className: "size-3.5" }) }),
20222
- /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-start gap-2", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
20223
- /* @__PURE__ */ jsx("div", { className: "truncate text-foreground", children: description }),
20224
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsx(
20225
- Badge,
20226
- {
20227
- variant: isActive ? "default" : "secondary",
20228
- className: "shrink-0",
20229
- children: mission.status
20230
- }
20231
- ) }),
20232
- meta.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-0.5 space-y-0.5 text-xs text-faint", children: meta.map((line) => /* @__PURE__ */ jsx("div", { className: "truncate", children: line }, line)) })
20233
- ] }) }) }),
20234
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
20235
- isActive && canMutate.pause && /* @__PURE__ */ jsx(
20236
- "button",
20237
- {
20238
- type: "button",
20239
- className: "rounded p-2 md:p-1 text-faint opacity-100 md:opacity-70 transition-all hover:bg-line hover:text-foreground disabled:pointer-events-none disabled:opacity-40 md:group-hover:opacity-100",
20240
- onClick: (e) => {
20241
- stopActionClick(e);
20242
- onPause(mission.id);
20243
- },
20244
- "aria-label": "Pause mission",
20245
- title: "Pause mission",
20246
- disabled: busy,
20247
- children: /* @__PURE__ */ jsx(Pause, { className: "size-3.5" })
20248
- }
20249
- ),
20250
- isPaused && canMutate.resume && /* @__PURE__ */ jsx(
20251
- "button",
20252
- {
20253
- type: "button",
20254
- className: "rounded p-2 md:p-1 text-faint opacity-100 md:opacity-70 transition-all hover:bg-line hover:text-foreground disabled:pointer-events-none disabled:opacity-40 md:group-hover:opacity-100",
20255
- onClick: (e) => {
20256
- stopActionClick(e);
20257
- onResume(mission.id);
20258
- },
20259
- "aria-label": "Resume mission",
20260
- title: "Resume mission",
20261
- disabled: busy,
20262
- children: /* @__PURE__ */ jsx(Play, { className: "size-3.5" })
20263
- }
20264
- ),
20265
- (isActive || isPaused) && canMutate.cancel && /* @__PURE__ */ jsx(
20266
- "button",
20267
- {
20268
- type: "button",
20269
- className: "rounded p-2 md:p-1 text-faint opacity-100 md:opacity-70 transition-all hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-40 md:group-hover:opacity-100",
20270
- onClick: (e) => {
20271
- stopActionClick(e);
20272
- onCancel(mission.id);
20273
- },
20274
- "aria-label": "Cancel mission",
20275
- title: "Cancel mission",
20276
- disabled: busy,
20277
- children: /* @__PURE__ */ jsx(Ban, { className: "size-3.5" })
20278
- }
20279
- )
20280
- ] })
20281
- ]
19460
+ asChild: true,
19461
+ size: "sm",
19462
+ icon: TargetIcon,
19463
+ label: description,
19464
+ description: /* @__PURE__ */ jsxs(Fragment, { children: [
19465
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex", children: /* @__PURE__ */ jsx(TonePill, { tone: missionTone(mission.status), children: mission.status }) }),
19466
+ meta.map((line) => /* @__PURE__ */ jsx("span", { className: "mt-0.5 block truncate", children: line }, line))
19467
+ ] }),
19468
+ className: "cursor-pointer items-start",
19469
+ trailing: /* @__PURE__ */ jsxs(Fragment, { children: [
19470
+ isActive && canMutate.pause && /* @__PURE__ */ jsx(
19471
+ Button,
19472
+ {
19473
+ variant: "ghost",
19474
+ size: "icon-xs",
19475
+ className: "text-muted-foreground hover:text-foreground md:opacity-70 md:group-hover/list-row:opacity-100",
19476
+ onClick: (e) => {
19477
+ stopActionClick(e);
19478
+ onPause(mission.id);
19479
+ },
19480
+ "aria-label": "Pause mission",
19481
+ title: "Pause mission",
19482
+ disabled: busy,
19483
+ children: /* @__PURE__ */ jsx(Pause, { className: "size-3.5" })
19484
+ }
19485
+ ),
19486
+ isPaused && canMutate.resume && /* @__PURE__ */ jsx(
19487
+ Button,
19488
+ {
19489
+ variant: "ghost",
19490
+ size: "icon-xs",
19491
+ className: "text-muted-foreground hover:text-foreground md:opacity-70 md:group-hover/list-row:opacity-100",
19492
+ onClick: (e) => {
19493
+ stopActionClick(e);
19494
+ onResume(mission.id);
19495
+ },
19496
+ "aria-label": "Resume mission",
19497
+ title: "Resume mission",
19498
+ disabled: busy,
19499
+ children: /* @__PURE__ */ jsx(Play, { className: "size-3.5" })
19500
+ }
19501
+ ),
19502
+ (isActive || isPaused) && canMutate.cancel && /* @__PURE__ */ jsx(
19503
+ Button,
19504
+ {
19505
+ variant: "ghost",
19506
+ size: "icon-xs",
19507
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive md:opacity-70 md:group-hover/list-row:opacity-100",
19508
+ onClick: (e) => {
19509
+ stopActionClick(e);
19510
+ onCancel(mission.id);
19511
+ },
19512
+ "aria-label": "Cancel mission",
19513
+ title: "Cancel mission",
19514
+ disabled: busy,
19515
+ children: /* @__PURE__ */ jsx(Ban, { className: "size-3.5" })
19516
+ }
19517
+ )
19518
+ ] }),
19519
+ children: /* @__PURE__ */ jsx(
19520
+ "div",
19521
+ {
19522
+ onClick: openMission,
19523
+ onKeyDown: handleRowKeyDown,
19524
+ role: "button",
19525
+ tabIndex: 0,
19526
+ "aria-label": `Open mission ${description}`,
19527
+ title: "Open mission dashboard"
19528
+ }
19529
+ )
20282
19530
  }
20283
19531
  );
20284
19532
  }
@@ -20298,7 +19546,6 @@ function MissionsPanel({
20298
19546
  const [error, setError] = useState(null);
20299
19547
  const [hasEverLoaded, setHasEverLoaded] = useState(false);
20300
19548
  const [busyMissionId, setBusyMissionId] = useState(null);
20301
- const [collapsed, setCollapsed] = useState(false);
20302
19549
  const mounted = useRef(true);
20303
19550
  const requestId = useRef(0);
20304
19551
  const lastFingerprint = useRef("");
@@ -20416,44 +19663,31 @@ function MissionsPanel({
20416
19663
  );
20417
19664
  if (!hasEverLoaded) return null;
20418
19665
  if (!adapter.listMissions) return null;
20419
- const showBody = hideHeader || !collapsed;
20420
19666
  const canMutate = {
20421
19667
  pause: Boolean(adapter.pauseMission),
20422
19668
  resume: Boolean(adapter.resumeMission),
20423
19669
  cancel: Boolean(adapter.cancelMission)
20424
19670
  };
20425
- return /* @__PURE__ */ jsxs("section", { className: "min-w-0 border-t border-line", children: [
20426
- !hideHeader && /* @__PURE__ */ jsxs(
20427
- "button",
20428
- {
20429
- type: "button",
20430
- className: "flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs font-semibold uppercase tracking-wide text-foreground transition-colors hover:bg-input",
20431
- onClick: () => setCollapsed((c) => !c),
20432
- "aria-expanded": !collapsed,
20433
- children: [
20434
- /* @__PURE__ */ jsx(TargetIcon, { className: "size-3.5" }),
20435
- /* @__PURE__ */ jsx("span", { className: "truncate", children: title }),
20436
- activeCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "ml-auto", children: activeCount }),
20437
- collapsed ? /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3.5 shrink-0 text-faint" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5 shrink-0 text-faint" })
20438
- ]
20439
- }
20440
- ),
20441
- showBody && error && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs text-destructive", children: error }),
20442
- showBody && !error && items.length === 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs text-faint", children: "No missions" }),
20443
- showBody && !error && items.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("pb-2", hideHeader && "pt-1"), children: items.map((mission) => /* @__PURE__ */ jsx(
20444
- MissionRow,
20445
- {
20446
- mission,
20447
- busy: busyMissionId === mission.id,
20448
- canMutate,
20449
- onOpen: handleOpen,
20450
- onPause: handlePause,
20451
- onResume: handleResume,
20452
- onCancel: handleCancel
20453
- },
20454
- mission.id
20455
- )) })
20456
- ] });
19671
+ const body = error ? /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-destructive", children: error }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-faint", children: "No missions" }) : /* @__PURE__ */ jsx("div", { children: items.map((mission) => /* @__PURE__ */ jsx(
19672
+ MissionRow,
19673
+ {
19674
+ mission,
19675
+ busy: busyMissionId === mission.id,
19676
+ canMutate,
19677
+ onOpen: handleOpen,
19678
+ onPause: handlePause,
19679
+ onResume: handleResume,
19680
+ onCancel: handleCancel
19681
+ },
19682
+ mission.id
19683
+ )) });
19684
+ return /* @__PURE__ */ jsx("section", { className: "min-w-0 border-t border-line p-1", children: hideHeader ? body : /* @__PURE__ */ jsxs(Collapsible, { defaultOpen: true, children: [
19685
+ /* @__PURE__ */ jsxs(CollapsibleHeader, { icon: TargetIcon, children: [
19686
+ title,
19687
+ activeCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "ml-1.5", children: activeCount })
19688
+ ] }),
19689
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: body })
19690
+ ] }) });
20457
19691
  }
20458
19692
  var CITATION_RE = /\[(S\d+(?:\s*,\s*S\d+)*)\]/g;
20459
19693
  function splitCitations(text) {
@@ -20486,17 +19720,15 @@ function CitationText({
20486
19720
  return /* @__PURE__ */ jsx("span", { children: seg.value }, i);
20487
19721
  }
20488
19722
  const src = byId.get(seg.value);
20489
- return /* @__PURE__ */ jsx(
19723
+ return /* @__PURE__ */ jsx(Badge, { asChild: true, className: "mx-0.5 cursor-pointer hover:bg-foreground/[0.12]", children: /* @__PURE__ */ jsx(
20490
19724
  "button",
20491
19725
  {
20492
19726
  type: "button",
20493
19727
  title: src ? `${src.title} \u2014 ${src.url}` : seg.value,
20494
19728
  onClick: () => onCitationClick?.(seg.value),
20495
- className: "mx-0.5 inline-flex items-center rounded-sm bg-muted px-1 text-[10px] font-semibold text-primary hover:bg-primary/10",
20496
19729
  children: seg.value
20497
- },
20498
- i
20499
- );
19730
+ }
19731
+ ) }, i);
20500
19732
  }) });
20501
19733
  }
20502
19734
  var DEFAULT_LIMIT2 = 50;
@@ -20536,6 +19768,11 @@ function scheduleDisplay(item) {
20536
19768
  if (item.kind === "dynamic_loop") return null;
20537
19769
  return item.scheduleDisplay;
20538
19770
  }
19771
+ function statusTone(status) {
19772
+ if (status === "paused") return "warn";
19773
+ if (status === "failed") return "bad";
19774
+ return "muted";
19775
+ }
20539
19776
  function sortScheduledWork(items) {
20540
19777
  return [...items].sort((a, b) => {
20541
19778
  if (a.status === "active" && b.status !== "active") return -1;
@@ -20582,73 +19819,74 @@ function ScheduledWorkRow({
20582
19819
  const stopActionClick = (e) => {
20583
19820
  e.stopPropagation();
20584
19821
  };
20585
- return /* @__PURE__ */ jsxs(
20586
- "div",
19822
+ return /* @__PURE__ */ jsx(
19823
+ ListRow,
20587
19824
  {
20588
- className: cn(
20589
- "group flex min-w-0 items-start gap-2 border-l-2 border-l-transparent px-3 py-2 text-sm transition-colors hover:border-l-primary hover:bg-input",
20590
- "min-h-11 md:min-h-0",
20591
- lastSessionId && "cursor-pointer"
20592
- ),
20593
- onClick: openLastRun,
20594
- onKeyDown: handleRowKeyDown,
20595
- role: lastSessionId ? "button" : void 0,
20596
- tabIndex: lastSessionId ? 0 : void 0,
20597
- "aria-label": lastSessionId ? `Open last run for ${title}` : void 0,
20598
- title: lastSessionId ? "Open last run" : void 0,
20599
- children: [
20600
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex size-5 shrink-0 items-center justify-center text-faint", children: /* @__PURE__ */ jsx(CalendarClockIcon, { className: "size-3.5" }) }),
20601
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
20602
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [
20603
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
20604
- /* @__PURE__ */ jsx("div", { className: "truncate text-foreground", children: title }),
20605
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "shrink-0", children: formatKind(item.kind) }) }),
20606
- meta.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-0.5 space-y-0.5 text-xs text-faint", children: meta.map((line) => /* @__PURE__ */ jsx("div", { className: "truncate", children: line }, line)) })
20607
- ] }),
20608
- statusText && /* @__PURE__ */ jsx(Badge, { variant: "destructive", className: "shrink-0", children: statusText })
20609
- ] }),
20610
- item.lastError && /* @__PURE__ */ jsx("div", { className: "mt-1 line-clamp-2 text-xs text-destructive", children: item.lastError })
19825
+ asChild: true,
19826
+ size: "sm",
19827
+ icon: CalendarClockIcon,
19828
+ label: title,
19829
+ description: /* @__PURE__ */ jsxs(Fragment, { children: [
19830
+ /* @__PURE__ */ jsxs("span", { className: "mt-0.5 flex gap-1", children: [
19831
+ /* @__PURE__ */ jsx(TonePill, { children: formatKind(item.kind) }),
19832
+ statusText && /* @__PURE__ */ jsx(TonePill, { tone: statusTone(statusText), children: statusText })
20611
19833
  ] }),
20612
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
20613
- showRunNow && /* @__PURE__ */ jsx(
20614
- "button",
20615
- {
20616
- type: "button",
20617
- className: "rounded p-2 md:p-1 text-faint opacity-100 md:opacity-70 transition-all hover:bg-line hover:text-foreground disabled:pointer-events-none disabled:opacity-40 md:group-hover:opacity-100",
20618
- onClick: (e) => {
20619
- stopActionClick(e);
20620
- onRunNow(item.id);
20621
- },
20622
- "aria-label": "Run schedule now",
20623
- title: "Run schedule now",
20624
- disabled,
20625
- children: /* @__PURE__ */ jsx(CalendarClockIcon, { className: "size-3.5" })
20626
- }
20627
- ),
20628
- canCancel && isActive && /* @__PURE__ */ jsx(
20629
- "button",
20630
- {
20631
- type: "button",
20632
- className: "rounded p-2 md:p-1 text-faint opacity-100 md:opacity-70 transition-all hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-40 md:group-hover:opacity-100",
20633
- onClick: (e) => {
20634
- stopActionClick(e);
20635
- onCancel(item.id);
20636
- },
20637
- "aria-label": "Cancel schedule",
20638
- title: "Cancel schedule",
20639
- disabled,
20640
- children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-3.5" })
20641
- }
20642
- )
20643
- ] })
20644
- ]
19834
+ meta.map((line) => /* @__PURE__ */ jsx("span", { className: "mt-0.5 block truncate", children: line }, line)),
19835
+ item.lastError && /* @__PURE__ */ jsx("span", { className: "mt-1 line-clamp-2 whitespace-normal text-destructive", children: item.lastError })
19836
+ ] }),
19837
+ className: cn("items-start", lastSessionId && "cursor-pointer"),
19838
+ trailing: /* @__PURE__ */ jsxs(Fragment, { children: [
19839
+ showRunNow && /* @__PURE__ */ jsx(
19840
+ Button,
19841
+ {
19842
+ variant: "ghost",
19843
+ size: "icon-xs",
19844
+ className: "text-muted-foreground hover:text-foreground md:opacity-70 md:group-hover/list-row:opacity-100",
19845
+ onClick: (e) => {
19846
+ stopActionClick(e);
19847
+ onRunNow(item.id);
19848
+ },
19849
+ "aria-label": "Run schedule now",
19850
+ title: "Run schedule now",
19851
+ disabled,
19852
+ children: /* @__PURE__ */ jsx(CalendarClockIcon, { className: "size-3.5" })
19853
+ }
19854
+ ),
19855
+ canCancel && isActive && /* @__PURE__ */ jsx(
19856
+ Button,
19857
+ {
19858
+ variant: "ghost",
19859
+ size: "icon-xs",
19860
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive md:opacity-70 md:group-hover/list-row:opacity-100",
19861
+ onClick: (e) => {
19862
+ stopActionClick(e);
19863
+ onCancel(item.id);
19864
+ },
19865
+ "aria-label": "Cancel schedule",
19866
+ title: "Cancel schedule",
19867
+ disabled,
19868
+ children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-3.5" })
19869
+ }
19870
+ )
19871
+ ] }),
19872
+ children: /* @__PURE__ */ jsx(
19873
+ "div",
19874
+ {
19875
+ onClick: openLastRun,
19876
+ onKeyDown: handleRowKeyDown,
19877
+ role: lastSessionId ? "button" : void 0,
19878
+ tabIndex: lastSessionId ? 0 : void 0,
19879
+ "aria-label": lastSessionId ? `Open last run for ${title}` : void 0,
19880
+ title: lastSessionId ? "Open last run" : void 0
19881
+ }
19882
+ )
20645
19883
  }
20646
19884
  );
20647
19885
  }
20648
19886
  function ScheduledWorkPanel({
20649
19887
  adapter,
20650
19888
  agentId,
20651
- title = "Scheduled Work",
19889
+ title = "Scheduled work",
20652
19890
  limit = DEFAULT_LIMIT2,
20653
19891
  status = "active",
20654
19892
  hideHeader = false,
@@ -20661,7 +19899,6 @@ function ScheduledWorkPanel({
20661
19899
  const [error, setError] = useState(null);
20662
19900
  const [hasEverLoaded, setHasEverLoaded] = useState(false);
20663
19901
  const [actionScheduleId, setActionScheduleId] = useState(null);
20664
- const [collapsed, setCollapsed] = useState(false);
20665
19902
  const mounted = useRef(true);
20666
19903
  const requestId = useRef(0);
20667
19904
  const lastFingerprint = useRef("");
@@ -20767,39 +20004,26 @@ function ScheduledWorkPanel({
20767
20004
  );
20768
20005
  if (!hasEverLoaded) return null;
20769
20006
  if (!adapter.listScheduledWork) return null;
20770
- const showBody = hideHeader || !collapsed;
20771
- return /* @__PURE__ */ jsxs("section", { className: "min-w-0 border-t border-line", children: [
20772
- !hideHeader && /* @__PURE__ */ jsxs(
20773
- "button",
20774
- {
20775
- type: "button",
20776
- className: "flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs font-semibold uppercase tracking-wide text-foreground transition-colors hover:bg-input",
20777
- onClick: () => setCollapsed((current) => !current),
20778
- "aria-expanded": !collapsed,
20779
- children: [
20780
- /* @__PURE__ */ jsx(CalendarClockIcon, { className: "size-3.5" }),
20781
- /* @__PURE__ */ jsx("span", { className: "truncate", children: title }),
20782
- activeCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "ml-auto", children: activeCount }),
20783
- collapsed ? /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3.5 shrink-0 text-faint" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5 shrink-0 text-faint" })
20784
- ]
20785
- }
20786
- ),
20787
- showBody && error && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs text-destructive", children: error }),
20788
- showBody && !error && items.length === 0 && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs text-faint", children: "No scheduled work" }),
20789
- showBody && !error && items.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("pb-2", hideHeader && "pt-1"), children: items.map((item) => /* @__PURE__ */ jsx(
20790
- ScheduledWorkRow,
20791
- {
20792
- item,
20793
- canRunNow: Boolean(adapter.runScheduledWorkNow),
20794
- canCancel: Boolean(adapter.cancelScheduledWork),
20795
- actionScheduleId,
20796
- onOpenLastRun: handleOpenLastRun,
20797
- onRunNow: handleRunNow,
20798
- onCancel: handleCancel
20799
- },
20800
- item.id
20801
- )) })
20802
- ] });
20007
+ const body = error ? /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-destructive", children: error }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-faint", children: "No scheduled work" }) : /* @__PURE__ */ jsx("div", { children: items.map((item) => /* @__PURE__ */ jsx(
20008
+ ScheduledWorkRow,
20009
+ {
20010
+ item,
20011
+ canRunNow: Boolean(adapter.runScheduledWorkNow),
20012
+ canCancel: Boolean(adapter.cancelScheduledWork),
20013
+ actionScheduleId,
20014
+ onOpenLastRun: handleOpenLastRun,
20015
+ onRunNow: handleRunNow,
20016
+ onCancel: handleCancel
20017
+ },
20018
+ item.id
20019
+ )) });
20020
+ return /* @__PURE__ */ jsx("section", { className: "min-w-0 border-t border-line p-1", children: hideHeader ? body : /* @__PURE__ */ jsxs(Collapsible, { defaultOpen: true, children: [
20021
+ /* @__PURE__ */ jsxs(CollapsibleHeader, { icon: CalendarClockIcon, children: [
20022
+ title,
20023
+ activeCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "ml-1.5", children: activeCount })
20024
+ ] }),
20025
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: body })
20026
+ ] }) });
20803
20027
  }
20804
20028
  var POLL_INTERVAL_ACTIVE_MS = 4e3;
20805
20029
  var POLL_INTERVAL_IDLE_MS = 3e4;
@@ -20903,15 +20127,6 @@ function fallbackSessionTitle(entry) {
20903
20127
  if (entry.runKind === "scheduled") return "Scheduled run";
20904
20128
  return "New session";
20905
20129
  }
20906
- function rowStateClass(isActive, isInActiveGroup) {
20907
- if (isActive) {
20908
- return "bg-faint/30 dark:bg-[#1e2840] text-foreground border-l-primary";
20909
- }
20910
- if (isInActiveGroup) {
20911
- return "bg-line/70 dark:bg-line/60 text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
20912
- }
20913
- return "bg-transparent text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
20914
- }
20915
20130
  function TreeNodeRow({
20916
20131
  entry,
20917
20132
  depth,
@@ -20938,77 +20153,85 @@ function TreeNodeRow({
20938
20153
  if (hasChildren) setExpanded(isInActiveGroup);
20939
20154
  }, [isInActiveGroup, hasChildren]);
20940
20155
  return /* @__PURE__ */ jsxs(Fragment, { children: [
20941
- /* @__PURE__ */ jsxs(
20942
- "div",
20156
+ /* @__PURE__ */ jsx(
20157
+ ListRow,
20943
20158
  {
20944
- role: "button",
20945
- tabIndex: 0,
20946
- onClick: () => onSelect(entry.id),
20947
- onKeyDown: (e) => {
20948
- if (e.key === "Enter" || e.key === " ") onSelect(entry.id);
20949
- },
20159
+ asChild: true,
20160
+ size: "sm",
20161
+ label: title,
20162
+ description: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1", children: [
20163
+ entry.computer && // A chat on a folder of the user's computer, in every list of chats, the browser's too.
20164
+ /* @__PURE__ */ jsxs("span", { "data-testid": "session-computer", title: `On ${entry.computer}`, className: "inline-flex min-w-0 max-w-[50%] items-center gap-1", children: [
20165
+ /* @__PURE__ */ jsx(LaptopIcon, { className: "w-3 h-3 shrink-0", "aria-hidden": "true" }),
20166
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: entry.computer })
20167
+ ] }),
20168
+ entry.computer && subtitle && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\xB7" }),
20169
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle })
20170
+ ] }),
20171
+ isActive,
20950
20172
  className: cn(
20951
- "group flex items-center gap-2 w-full py-2 pr-2 text-left cursor-pointer transition-colors border-l-2",
20952
- "min-h-11 md:min-h-0",
20953
- rowStateClass(isActive, isInActiveGroup)
20173
+ "cursor-pointer",
20174
+ !isActive && isInActiveGroup && "bg-foreground/[0.03]"
20954
20175
  ),
20955
20176
  style: { paddingLeft: `${depth * 12 + 12}px` },
20956
- children: [
20957
- hasChildren ? /* @__PURE__ */ jsx(
20958
- "button",
20959
- {
20960
- type: "button",
20961
- className: "p-2 md:p-0.5 rounded hover:bg-line shrink-0",
20962
- onClick: (e) => {
20963
- e.stopPropagation();
20964
- setExpanded(!expanded);
20965
- },
20966
- "aria-label": expanded ? "Collapse" : "Expand",
20967
- "aria-expanded": expanded,
20968
- children: expanded ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-3.5 h-3.5" })
20969
- }
20970
- ) : /* @__PURE__ */ jsx("span", { className: "w-4 h-4 shrink-0" }),
20971
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
20972
- /* @__PURE__ */ jsx("div", { className: "text-sm truncate", children: title }),
20973
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-faint min-w-0", children: [
20974
- entry.computer && // A chat on a folder of the user's computer, in every list of chats, the browser's too.
20975
- /* @__PURE__ */ jsxs("span", { "data-testid": "session-computer", title: `On ${entry.computer}`, className: "inline-flex min-w-0 max-w-[50%] items-center gap-1", children: [
20976
- /* @__PURE__ */ jsx(LaptopIcon, { className: "w-3 h-3 shrink-0", "aria-hidden": "true" }),
20977
- /* @__PURE__ */ jsx("span", { className: "truncate", children: entry.computer })
20978
- ] }),
20979
- entry.computer && subtitle && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\xB7" }),
20980
- /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle })
20981
- ] })
20982
- ] }),
20177
+ trailing: /* @__PURE__ */ jsxs(Fragment, { children: [
20983
20178
  isRunning && canStop && isChildSession && /* @__PURE__ */ jsx(
20984
- "button",
20179
+ Button,
20985
20180
  {
20986
- type: "button",
20987
- className: "p-2 md:p-1 rounded opacity-100 md:opacity-0 md:group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-all",
20181
+ variant: "ghost",
20182
+ size: "icon-xs",
20183
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive md:opacity-0 md:group-hover/list-row:opacity-100 md:focus-visible:opacity-100",
20988
20184
  onClick: (e) => {
20989
20185
  e.stopPropagation();
20990
20186
  onStop(entry.id);
20991
20187
  },
20992
20188
  "aria-label": "Stop child session",
20993
20189
  title: "Stop child session",
20994
- children: /* @__PURE__ */ jsx(SquareIcon, { className: "w-3 h-3", fill: "currentColor" })
20190
+ children: /* @__PURE__ */ jsx(SquareIcon, { fill: "currentColor" })
20995
20191
  }
20996
20192
  ),
20997
20193
  canDelete && /* @__PURE__ */ jsx(
20998
- "button",
20194
+ Button,
20999
20195
  {
21000
- type: "button",
21001
- className: "p-2 md:p-1 rounded opacity-60 md:opacity-50 md:group-hover:opacity-100 md:focus-visible:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-all",
20196
+ variant: "ghost",
20197
+ size: "icon-xs",
20198
+ className: "text-muted-foreground opacity-60 hover:bg-destructive/10 hover:text-destructive md:opacity-50 md:group-hover/list-row:opacity-100 md:focus-visible:opacity-100",
21002
20199
  onClick: (e) => {
21003
20200
  e.stopPropagation();
21004
20201
  onDelete(entry.id);
21005
20202
  },
21006
20203
  "aria-label": "Delete session",
21007
20204
  title: "Delete session",
21008
- children: /* @__PURE__ */ jsx(Trash2Icon, { className: "w-3 h-3" })
20205
+ children: /* @__PURE__ */ jsx(Trash2Icon, {})
21009
20206
  }
21010
20207
  )
21011
- ]
20208
+ ] }),
20209
+ children: /* @__PURE__ */ jsx(
20210
+ "div",
20211
+ {
20212
+ role: "button",
20213
+ tabIndex: 0,
20214
+ onClick: () => onSelect(entry.id),
20215
+ onKeyDown: (e) => {
20216
+ if (e.key === "Enter" || e.key === " ") onSelect(entry.id);
20217
+ },
20218
+ children: hasChildren ? /* @__PURE__ */ jsx(
20219
+ Button,
20220
+ {
20221
+ variant: "ghost",
20222
+ size: "icon-xs",
20223
+ className: "size-5",
20224
+ onClick: (e) => {
20225
+ e.stopPropagation();
20226
+ setExpanded(!expanded);
20227
+ },
20228
+ "aria-label": expanded ? "Collapse" : "Expand",
20229
+ "aria-expanded": expanded,
20230
+ children: expanded ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3.5" })
20231
+ }
20232
+ ) : /* @__PURE__ */ jsx("span", { className: "size-5 shrink-0" })
20233
+ }
20234
+ )
21012
20235
  }
21013
20236
  ),
21014
20237
  hasChildren && expanded && entry.children.map((child) => /* @__PURE__ */ jsx(
@@ -21206,11 +20429,15 @@ function SessionTreePanel({
21206
20429
  const topLevel = hideRoot ? roots.flatMap((r) => r.children) : roots;
21207
20430
  if (topLevel.length === 0) return null;
21208
20431
  return /* @__PURE__ */ jsxs(Fragment, { children: [
21209
- !hideHeader && /* @__PURE__ */ jsxs("div", { className: "border-t border-line flex items-center gap-1.5 px-3 py-2 text-xs font-semibold uppercase tracking-wide", children: [
21210
- /* @__PURE__ */ jsx(UsersIcon, { className: "w-3.5 h-3.5" }),
21211
- /* @__PURE__ */ jsx("span", { children: title }),
21212
- runningCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "h-4 px-1.5 text-[10px] ml-auto", children: runningCount })
21213
- ] }),
20432
+ !hideHeader && /* @__PURE__ */ jsx(
20433
+ SectionLabel,
20434
+ {
20435
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [
20436
+ title,
20437
+ runningCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "ml-1.5", children: runningCount })
20438
+ ] })
20439
+ }
20440
+ ),
21214
20441
  error && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs text-destructive", children: error }),
21215
20442
  !error && /* @__PURE__ */ jsx("div", { className: "px-1 pb-2", children: topLevel.map((entry) => /* @__PURE__ */ jsx(
21216
20443
  TreeNodeRow,