@inf-monkeys-tech/monkeys-design 1.0.62 → 1.0.63

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.mjs CHANGED
@@ -4,7 +4,7 @@ import * as React4 from 'react';
4
4
  import React4__default, { forwardRef, useMemo, useId, useRef, useState, useEffect, createElement, createContext, useCallback, useContext, Children, isValidElement, Fragment as Fragment$1, useLayoutEffect } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import * as PopoverPrimitive from '@radix-ui/react-popover';
7
- import { ChevronDown, Search, Circle, Check, ChevronRight, ChevronUp, X, Plus, Pin, SquarePen, Blocks, MessageSquare, Bot, Settings, Loader2, TerminalSquare, Clock3, FileOutput, Download, RefreshCw, CheckCircle2, XCircle, CircleStop, AlertCircle, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2, Image, Ellipsis, Pencil, Trash2 } from 'lucide-react';
7
+ import { ChevronDown, Search, Circle, Check, ChevronRight, ChevronUp, X, Plus, Pin, SquarePen, Blocks, MessageSquare, Bot, Settings, AlertCircle, RefreshCw, Loader2, TerminalSquare, Clock3, FileOutput, Download, CheckCircle2, XCircle, CircleStop, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2, Image, Ellipsis, Pencil, Trash2 } from 'lucide-react';
8
8
  import { twMerge } from 'tailwind-merge';
9
9
  import * as DropdownMenu2 from '@radix-ui/react-dropdown-menu';
10
10
  import * as ContextMenu from '@radix-ui/react-context-menu';
@@ -2857,6 +2857,9 @@ var HSL_SEMANTIC_ALIASES = {
2857
2857
  "semantic.color.border": "--border",
2858
2858
  "semantic.color.input": "--input",
2859
2859
  "semantic.color.ring": "--ring",
2860
+ "semantic.color.media-surface": "--media-surface",
2861
+ "semantic.color.media-foreground": "--media-foreground",
2862
+ "semantic.color.media-overlay": "--media-overlay",
2860
2863
  "semantic.color.radar-canvas": "--radar-canvas",
2861
2864
  "semantic.color.radar-panel": "--radar-panel",
2862
2865
  "semantic.color.radar-border": "--radar-border",
@@ -18324,7 +18327,7 @@ function CollectionState({
18324
18327
  }
18325
18328
  if (status === "error") {
18326
18329
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 px-3 py-8 text-center", children: [
18327
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", role: "alert", children: error }),
18330
+ /* @__PURE__ */ jsx("p", { className: "max-w-full break-words text-sm text-muted-foreground", role: "alert", children: error }),
18328
18331
  /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "gap-1.5 px-0 text-sm text-primary hover:text-primary", onClick: onRetry, children: [
18329
18332
  /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5", "aria-hidden": "true" }),
18330
18333
  messages.retry
@@ -18428,7 +18431,7 @@ function AgentWorkbenchSidebar({
18428
18431
  };
18429
18432
  const renderSessionItems = (items) => /* @__PURE__ */ jsx("div", { className: "space-y-1", children: items.map((item) => {
18430
18433
  const percent = item.contextUsage && item.contextUsage.maxTokens > 0 ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
18431
- return /* @__PURE__ */ jsxs("div", { "aria-current": item.id === viewModel.selectedSessionItem ? "page" : void 0, className: cn2("group flex w-full items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted", classNames?.item), children: [
18434
+ return /* @__PURE__ */ jsxs("div", { "aria-current": item.id === viewModel.selectedSessionItem ? "page" : void 0, className: cn2("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted", classNames?.item), children: [
18432
18435
  editingSessionId === item.id ? /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
18433
18436
  /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(SessionAvatar, { item }) }),
18434
18437
  /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
@@ -18457,14 +18460,14 @@ function AgentWorkbenchSidebar({
18457
18460
  ),
18458
18461
  /* @__PURE__ */ jsx(SessionMeta, { item, locale })
18459
18462
  ] })
18460
- ] }) : /* @__PURE__ */ jsxs("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-3 text-left", onClick: () => onIntent?.({ type: "select-session", sessionId: item.id }), children: [
18463
+ ] }) : /* @__PURE__ */ jsxs("button", { type: "button", title: item.title, className: "flex min-w-0 flex-1 items-center gap-3 text-left", onClick: () => onIntent?.({ type: "select-session", sessionId: item.id }), children: [
18461
18464
  /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(SessionAvatar, { item }) }),
18462
18465
  /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
18463
18466
  /* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-medium", children: item.title }),
18464
18467
  /* @__PURE__ */ jsx(SessionMeta, { item, locale })
18465
18468
  ] })
18466
18469
  ] }),
18467
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
18470
+ /* @__PURE__ */ jsxs("span", { "data-agent-workbench-item-actions": true, className: "flex shrink-0 items-center gap-1", children: [
18468
18471
  percent !== void 0 && item.status === "idle" ? /* @__PURE__ */ jsxs("span", { className: "text-xs text-foreground", "aria-label": messages.contextUsage({ percent }), children: [
18469
18472
  percent,
18470
18473
  "%"
@@ -18516,7 +18519,7 @@ function AgentWorkbenchSidebar({
18516
18519
  headerActions ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center", children: headerActions }) : null
18517
18520
  ] }) : null
18518
18521
  ] }),
18519
- !sessionsOnly ? /* @__PURE__ */ jsxs(TabsContent, { value: "agents", className: cn2("mt-0 min-h-0 flex-1 overflow-y-auto px-4 pb-4", classNames?.body), children: [
18522
+ !sessionsOnly ? /* @__PURE__ */ jsxs(TabsContent, { value: "agents", "data-agent-workbench-scroll-region": true, className: cn2("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4", classNames?.body), children: [
18520
18523
  viewModel.capabilities.createAgent ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", className: "mb-3 h-9 w-full justify-start gap-2 px-3 text-sm", onClick: () => onIntent?.({ type: "create-agent" }), children: [
18521
18524
  /* @__PURE__ */ jsx(Plus, { className: "size-4", "aria-hidden": "true" }),
18522
18525
  messages.newAgent
@@ -18527,16 +18530,16 @@ function AgentWorkbenchSidebar({
18527
18530
  "div",
18528
18531
  {
18529
18532
  "aria-current": item.id === viewModel.selectedAgentItem ? "page" : void 0,
18530
- className: cn2("group flex w-full items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted", classNames?.item),
18533
+ className: cn2("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted", classNames?.item),
18531
18534
  children: [
18532
- /* @__PURE__ */ jsxs("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-3 text-left", onClick: () => onIntent?.({ type: "select-agent", itemId: item.id }), children: [
18535
+ /* @__PURE__ */ jsxs("button", { type: "button", title: item.name, className: "flex min-w-0 flex-1 items-center gap-3 text-left", onClick: () => onIntent?.({ type: "select-agent", itemId: item.id }), children: [
18533
18536
  /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(ItemAvatar, { item }) }),
18534
18537
  /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
18535
18538
  /* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-medium", children: item.name }),
18536
18539
  /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-foreground/80", children: item.description || messages.noDescription })
18537
18540
  ] })
18538
18541
  ] }),
18539
- item.builtIn ? /* @__PURE__ */ jsx("span", { className: "rounded-full bg-muted px-1.5 py-1 text-[10px] text-foreground", children: messages.builtIn }) : null,
18542
+ item.builtIn ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full bg-muted px-1.5 py-1 text-[10px] text-foreground", children: messages.builtIn }) : null,
18540
18543
  viewModel.capabilities.pinAgents ? /* @__PURE__ */ jsx(
18541
18544
  Button,
18542
18545
  {
@@ -18564,7 +18567,7 @@ function AgentWorkbenchSidebar({
18564
18567
  item.id
18565
18568
  )) })
18566
18569
  ] }) : null,
18567
- /* @__PURE__ */ jsxs(TabsContent, { value: "sessions", className: cn2("mt-0 min-h-0 flex-1 overflow-y-auto px-4 pb-4", classNames?.body), children: [
18570
+ /* @__PURE__ */ jsxs(TabsContent, { value: "sessions", "data-agent-workbench-scroll-region": true, className: cn2("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4", classNames?.body), children: [
18568
18571
  viewModel.capabilities.createSession ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", className: "h-9 w-full justify-start gap-2 px-3 text-sm", onClick: () => onIntent?.({ type: "create-session" }), children: [
18569
18572
  /* @__PURE__ */ jsx(SquarePen, { className: "size-4", "aria-hidden": "true" }),
18570
18573
  messages.newSession
@@ -18580,8 +18583,8 @@ function AgentWorkbenchSidebar({
18580
18583
  { id: "agent", label: messages.agents, icon: Bot, items: agentSessions }
18581
18584
  ].map(({ id, label, icon: Icon2, items }) => /* @__PURE__ */ jsxs("details", { open: true, "aria-label": label, children: [
18582
18585
  /* @__PURE__ */ jsxs("summary", { className: "flex h-9 cursor-pointer list-none items-center gap-2 rounded-md px-3 text-sm font-semibold hover:bg-muted", children: [
18583
- /* @__PURE__ */ jsx(Icon2, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
18584
- label
18586
+ /* @__PURE__ */ jsx(Icon2, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
18587
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: label })
18585
18588
  ] }),
18586
18589
  renderSessionItems(items)
18587
18590
  ] }, id)) }) : !sessionsOnly ? renderSessionItems(sessions) : null
@@ -18610,7 +18613,7 @@ function AgentWorkbenchExploreCardMedia({
18610
18613
  "span",
18611
18614
  {
18612
18615
  className: cn2(
18613
- isLogo ? "flex size-full items-center justify-center bg-[var(--monkeys-color-card-dark)] p-5" : "block size-full",
18616
+ isLogo ? "flex size-full items-center justify-center bg-[hsl(var(--monkeys-color-media-surface))] p-5" : "block size-full",
18614
18617
  className
18615
18618
  ),
18616
18619
  children: /* @__PURE__ */ jsx(
@@ -18628,10 +18631,19 @@ function AgentWorkbenchExploreCardMedia({
18628
18631
  )
18629
18632
  }
18630
18633
  ),
18631
- showLabel ? /* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent px-3 pb-2.5 pt-8 text-white", children: [
18632
- /* @__PURE__ */ jsx("span", { className: "block text-base font-semibold leading-tight", children: item.title }),
18633
- item.subtitle ? /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-[11px] leading-tight text-white/75", children: item.subtitle }) : null
18634
- ] }) : null
18634
+ showLabel ? /* @__PURE__ */ jsxs(
18635
+ "span",
18636
+ {
18637
+ className: "pointer-events-none absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-8 text-[hsl(var(--monkeys-color-media-foreground))]",
18638
+ style: {
18639
+ backgroundImage: "linear-gradient(to top, hsl(var(--monkeys-color-media-overlay) / 0.8), hsl(var(--monkeys-color-media-overlay) / 0.3), transparent)"
18640
+ },
18641
+ children: [
18642
+ /* @__PURE__ */ jsx("span", { className: "block text-base font-semibold leading-tight", children: item.title }),
18643
+ item.subtitle ? /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-[11px] leading-tight opacity-75", children: item.subtitle }) : null
18644
+ ]
18645
+ }
18646
+ ) : null
18635
18647
  ] });
18636
18648
  }
18637
18649
  function AgentWorkbenchExploreSidebar({
@@ -18641,6 +18653,7 @@ function AgentWorkbenchExploreSidebar({
18641
18653
  selectedSessionId,
18642
18654
  searchQuery = "",
18643
18655
  loading = false,
18656
+ error,
18644
18657
  showDraftSession = !selectedSessionId,
18645
18658
  defaultGroupId,
18646
18659
  className,
@@ -18719,34 +18732,59 @@ function AgentWorkbenchExploreSidebar({
18719
18732
  }
18720
18733
  )
18721
18734
  ] }),
18722
- /* @__PURE__ */ jsx("div", { className: "min-h-[160px] flex-[0_1_280px] overflow-y-auto px-4 pb-3", children: loading && sessions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex h-24 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx(Loader2, { className: "size-5 animate-spin" }) }) : filteredSessions.length === 0 && !draftVisible ? /* @__PURE__ */ jsx("div", { className: "px-3 py-8 text-center text-sm text-muted-foreground", children: normalizedQuery ? labels.noResults : labels.emptySessions }) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
18723
- draftVisible ? /* @__PURE__ */ jsx(
18724
- "button",
18725
- {
18726
- type: "button",
18727
- "aria-current": "page",
18728
- className: "block h-10 w-full truncate rounded-[var(--radius)] border border-primary bg-primary/10 px-3 text-left text-sm font-semibold text-foreground",
18729
- onClick: () => onIntent?.({ type: "create-session" }),
18730
- children: labels.draftSession
18731
- }
18732
- ) : null,
18733
- filteredSessions.map((session) => /* @__PURE__ */ jsx(
18734
- "button",
18735
- {
18736
- type: "button",
18737
- "aria-current": session.id === selectedSessionId ? "page" : void 0,
18738
- className: "block h-10 w-full truncate rounded-[var(--radius)] border border-transparent bg-muted/60 px-3 text-left text-sm font-semibold text-foreground transition hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-primary/10",
18739
- onClick: () => onIntent?.({ type: "select-session", sessionId: session.id }),
18740
- children: session.title
18741
- },
18742
- session.id
18743
- ))
18744
- ] }) }),
18745
- activeGroup ? /* @__PURE__ */ jsxs("div", { className: "shrink-0 border-t border-border px-4 pb-4 pt-3", children: [
18746
- /* @__PURE__ */ jsx(Tabs, { value: activeGroup.id, onValueChange: changeGroup, children: /* @__PURE__ */ jsx(
18735
+ /* @__PURE__ */ jsx(
18736
+ "div",
18737
+ {
18738
+ "data-agent-workbench-session-scroll-region": true,
18739
+ className: "min-h-[160px] flex-[0_1_280px] overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-3",
18740
+ children: error ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-24 flex-col items-center justify-center gap-2 px-3 py-6 text-center", role: "alert", children: [
18741
+ /* @__PURE__ */ jsx(AlertCircle, { className: "size-5 shrink-0 text-destructive-text", "aria-hidden": "true" }),
18742
+ /* @__PURE__ */ jsx("p", { className: "max-w-full break-words text-sm text-muted-foreground", children: error }),
18743
+ labels.retry ? /* @__PURE__ */ jsxs(
18744
+ Button,
18745
+ {
18746
+ type: "button",
18747
+ variant: "ghost",
18748
+ size: "sm",
18749
+ className: "gap-1.5 text-primary",
18750
+ onClick: () => onIntent?.({ type: "retry-sessions" }),
18751
+ children: [
18752
+ /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5", "aria-hidden": "true" }),
18753
+ labels.retry
18754
+ ]
18755
+ }
18756
+ ) : null
18757
+ ] }) : loading && sessions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex h-24 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx(Loader2, { className: "size-5 animate-spin" }) }) : filteredSessions.length === 0 && !draftVisible ? /* @__PURE__ */ jsx("div", { className: "px-3 py-8 text-center text-sm text-muted-foreground", children: normalizedQuery ? labels.noResults : labels.emptySessions }) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
18758
+ draftVisible ? /* @__PURE__ */ jsx(
18759
+ "button",
18760
+ {
18761
+ type: "button",
18762
+ "aria-current": "page",
18763
+ className: "block h-10 w-full min-w-0 truncate rounded-[var(--radius)] border border-primary bg-primary/10 px-3 text-left text-sm font-semibold text-foreground",
18764
+ onClick: () => onIntent?.({ type: "create-session" }),
18765
+ children: labels.draftSession
18766
+ }
18767
+ ) : null,
18768
+ filteredSessions.map((session) => /* @__PURE__ */ jsx(
18769
+ "button",
18770
+ {
18771
+ type: "button",
18772
+ title: session.title,
18773
+ "aria-current": session.id === selectedSessionId ? "page" : void 0,
18774
+ className: "block h-10 w-full min-w-0 truncate rounded-[var(--radius)] border border-transparent bg-muted/60 px-3 text-left text-sm font-semibold text-foreground transition hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-primary/10",
18775
+ onClick: () => onIntent?.({ type: "select-session", sessionId: session.id }),
18776
+ children: session.title
18777
+ },
18778
+ session.id
18779
+ ))
18780
+ ] })
18781
+ }
18782
+ ),
18783
+ activeGroup ? /* @__PURE__ */ jsx("div", { className: "shrink-0 border-t border-border px-4 pb-4 pt-3", children: /* @__PURE__ */ jsxs(Tabs, { value: activeGroup.id, onValueChange: changeGroup, children: [
18784
+ /* @__PURE__ */ jsx(
18747
18785
  TabsList,
18748
18786
  {
18749
- className: "grid h-10 w-full rounded-[var(--radius)] bg-muted p-0.5 text-muted-foreground",
18787
+ className: "grid h-10 w-full rounded-[var(--radius)] bg-muted p-0.5 text-foreground",
18750
18788
  style: {
18751
18789
  gridTemplateColumns: `repeat(${groups.length}, minmax(0, 1fr))`
18752
18790
  },
@@ -18754,30 +18792,30 @@ function AgentWorkbenchExploreSidebar({
18754
18792
  TabsTrigger,
18755
18793
  {
18756
18794
  value: group.id,
18757
- className: "rounded-md text-sm font-semibold text-muted-foreground data-[state=active]:border data-[state=active]:border-border data-[state=active]:bg-background data-[state=active]:text-foreground",
18795
+ className: "rounded-md text-sm font-semibold text-foreground data-[state=active]:border data-[state=active]:border-border data-[state=active]:bg-background",
18758
18796
  children: group.label
18759
18797
  },
18760
18798
  group.id
18761
18799
  ))
18762
18800
  }
18763
- ) }),
18764
- /* @__PURE__ */ jsx("div", { className: "mt-3 grid grid-cols-2 gap-2", children: activeGroup.items.map((item) => /* @__PURE__ */ jsx(
18801
+ ),
18802
+ groups.map((group) => /* @__PURE__ */ jsx(TabsContent, { value: group.id, className: "mt-3", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: group.items.map((item) => /* @__PURE__ */ jsx(
18765
18803
  "button",
18766
18804
  {
18767
18805
  type: "button",
18768
18806
  "aria-label": item.title,
18769
18807
  className: "group relative aspect-[1.27] overflow-hidden rounded-[var(--radius)] border border-border bg-card text-left transition hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18770
- style: Number.isFinite(activeGroup.itemAspectRatio) && Number(activeGroup.itemAspectRatio) > 0 ? { aspectRatio: activeGroup.itemAspectRatio } : void 0,
18808
+ style: Number.isFinite(group.itemAspectRatio) && Number(group.itemAspectRatio) > 0 ? { aspectRatio: group.itemAspectRatio } : void 0,
18771
18809
  onClick: () => onIntent?.({
18772
18810
  type: "select-item",
18773
- groupId: activeGroup.id,
18811
+ groupId: group.id,
18774
18812
  item
18775
18813
  }),
18776
- children: renderItemMedia?.(item, activeGroup) ?? /* @__PURE__ */ jsx(AgentWorkbenchExploreCardMedia, { item })
18814
+ children: renderItemMedia?.(item, group) ?? /* @__PURE__ */ jsx(AgentWorkbenchExploreCardMedia, { item })
18777
18815
  },
18778
18816
  item.id
18779
- )) })
18780
- ] }) : null
18817
+ )) }) }, group.id))
18818
+ ] }) }) : null
18781
18819
  ]
18782
18820
  }
18783
18821
  );