@inf-monkeys-tech/monkeys-design 1.0.76 → 1.0.77

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
@@ -19,6 +19,7 @@ import * as SwitchPrimitive from '@radix-ui/react-switch';
19
19
  import * as TabsPrimitive from '@radix-ui/react-tabs';
20
20
  import { cva } from 'class-variance-authority';
21
21
  import * as SelectPrimitive from '@radix-ui/react-select';
22
+ import { resolveAgentWorkbenchSidebarConfig } from '@inf-monkeys-tech/monkeys';
22
23
  import { useSensors, useSensor, PointerSensor, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
23
24
  import { toast as toast$1, Toaster } from 'sonner';
24
25
 
@@ -18457,7 +18458,8 @@ function SessionActions({
18457
18458
  }
18458
18459
  function AgentWorkbenchSidebar({
18459
18460
  viewModel,
18460
- navigationMode = "agents-and-sessions",
18461
+ navigationMode,
18462
+ config,
18461
18463
  header,
18462
18464
  headerActions,
18463
18465
  footer,
@@ -18467,7 +18469,11 @@ function AgentWorkbenchSidebar({
18467
18469
  }) {
18468
18470
  const { locale } = useMonkeysLocale();
18469
18471
  const messages = useMonkeysLocaleMessages().agentWorkbench.navigation;
18470
- const sessionsOnly = navigationMode === "sessions-only";
18472
+ const resolvedConfig = useMemo(() => resolveAgentWorkbenchSidebarConfig(config), [config]);
18473
+ const visibleSections = useMemo(() => new Set(resolvedConfig.visibleSections), [resolvedConfig.visibleSections]);
18474
+ const sessionsOnly = navigationMode === "sessions-only" || navigationMode === void 0 && resolvedConfig.navigationMode !== "default";
18475
+ const showAgents = visibleSections.has("agents") && !sessionsOnly;
18476
+ const showSessions = visibleSections.has("sessions");
18471
18477
  const searchRef = useRef(null);
18472
18478
  const renameInputRef = useRef(null);
18473
18479
  const [editingSessionId, setEditingSessionId] = useState();
@@ -18567,7 +18573,7 @@ function AgentWorkbenchSidebar({
18567
18573
  return /* @__PURE__ */ jsx(
18568
18574
  Tabs,
18569
18575
  {
18570
- value: sessionsOnly ? "sessions" : viewModel.activeTab,
18576
+ value: sessionsOnly || !showAgents ? "sessions" : viewModel.activeTab,
18571
18577
  onValueChange: (value) => {
18572
18578
  if (!sessionsOnly && (value === "agents" || value === "sessions")) onIntent?.({ type: "change-tab", tab: value });
18573
18579
  },
@@ -18575,9 +18581,10 @@ function AgentWorkbenchSidebar({
18575
18581
  children: /* @__PURE__ */ jsxs(
18576
18582
  AgentWorkbenchSidebarContainer,
18577
18583
  {
18584
+ "data-sidebar-width-percent": resolvedConfig.widthPercent,
18578
18585
  "aria-label": messages.tabsLabel,
18579
- header,
18580
- search: /* @__PURE__ */ jsxs(InputGroup, { className: cn2("h-10 rounded-lg bg-card", classNames?.search), children: [
18586
+ header: visibleSections.has("header") ? header : void 0,
18587
+ search: visibleSections.has("search") ? /* @__PURE__ */ jsxs(InputGroup, { className: cn2("h-10 rounded-lg bg-card", classNames?.search), children: [
18581
18588
  /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Search, { className: "size-4", "aria-hidden": "true" }) }),
18582
18589
  /* @__PURE__ */ jsx(
18583
18590
  InputGroupInput,
@@ -18597,15 +18604,15 @@ function AgentWorkbenchSidebar({
18597
18604
  }
18598
18605
  ),
18599
18606
  viewModel.searchQuery ? /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx(InputGroupButton, { size: "icon-xs", "aria-label": messages.clearSearch, onClick: () => onIntent?.({ type: "change-search", query: "" }), children: /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" }) }) }) : /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx("kbd", { className: "border border-border px-1.5 py-0.5 text-[10px]", children: "Ctrl K" }) })
18600
- ] }),
18601
- actions: !sessionsOnly || headerActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
18602
- !sessionsOnly ? /* @__PURE__ */ jsxs(TabsList, { className: cn2("grid min-w-0 flex-1 grid-cols-2 text-foreground", classNames?.tabs), "aria-label": messages.tabsLabel, children: [
18607
+ ] }) : void 0,
18608
+ actions: showAgents && showSessions || headerActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
18609
+ showAgents && showSessions ? /* @__PURE__ */ jsxs(TabsList, { className: cn2("grid min-w-0 flex-1 grid-cols-2 text-foreground", classNames?.tabs), "aria-label": messages.tabsLabel, children: [
18603
18610
  /* @__PURE__ */ jsx(TabsTrigger, { value: "agents", children: messages.agents }),
18604
18611
  /* @__PURE__ */ jsx(TabsTrigger, { value: "sessions", children: messages.sessions })
18605
18612
  ] }) : null,
18606
18613
  headerActions ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center", children: headerActions }) : null
18607
18614
  ] }) : void 0,
18608
- footer: !sessionsOnly && viewModel.capabilities.manageAgentSettings || footer ? /* @__PURE__ */ jsxs("div", { className: cn2("border-t border-border p-4", classNames?.footer), children: [
18615
+ footer: visibleSections.has("footer") && (!sessionsOnly && viewModel.capabilities.manageAgentSettings || footer) ? /* @__PURE__ */ jsxs("div", { className: cn2("border-t border-border p-4", classNames?.footer), children: [
18609
18616
  !sessionsOnly && viewModel.capabilities.manageAgentSettings ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", className: "h-10 w-full justify-start gap-2 px-3 text-sm", onClick: () => onIntent?.({ type: "open-agent-settings" }), children: [
18610
18617
  /* @__PURE__ */ jsx(Settings, { className: "size-4", "aria-hidden": "true" }),
18611
18618
  messages.settings
@@ -18616,7 +18623,7 @@ function AgentWorkbenchSidebar({
18616
18623
  className,
18617
18624
  classNames: { root: classNames?.root, body: "flex min-h-0 flex-1 flex-col p-0" },
18618
18625
  children: [
18619
- !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: [
18626
+ showAgents ? /* @__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: [
18620
18627
  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: [
18621
18628
  /* @__PURE__ */ jsx(Plus, { className: "size-4", "aria-hidden": "true" }),
18622
18629
  messages.newAgent
@@ -18664,8 +18671,8 @@ function AgentWorkbenchSidebar({
18664
18671
  item.id
18665
18672
  )) })
18666
18673
  ] }) : null,
18667
- /* @__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: [
18668
- 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: [
18674
+ showSessions ? /* @__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: [
18675
+ visibleSections.has("new-session") && 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: [
18669
18676
  /* @__PURE__ */ jsx(SquarePen, { className: "size-4", "aria-hidden": "true" }),
18670
18677
  messages.newSession
18671
18678
  ] }) : null,
@@ -18685,7 +18692,7 @@ function AgentWorkbenchSidebar({
18685
18692
  ] }),
18686
18693
  renderSessionItems(items)
18687
18694
  ] }, id)) }) : !sessionsOnly ? renderSessionItems(sessions) : null
18688
- ] })
18695
+ ] }) : null
18689
18696
  ]
18690
18697
  }
18691
18698
  )
@@ -18743,7 +18750,8 @@ function AgentWorkbenchExploreCardMedia({
18743
18750
  }
18744
18751
  function AgentWorkbenchExploreSidebar({
18745
18752
  sessions,
18746
- groups,
18753
+ groups: configuredGroups,
18754
+ config,
18747
18755
  labels,
18748
18756
  selectedSessionId,
18749
18757
  searchQuery = "",
@@ -18760,8 +18768,15 @@ function AgentWorkbenchExploreSidebar({
18760
18768
  }) {
18761
18769
  const navigationMessages = useMonkeysLocaleMessages().agentWorkbench.navigation;
18762
18770
  const searchRef = useRef(null);
18771
+ const resolvedConfig = useMemo(() => resolveAgentWorkbenchSidebarConfig(config), [config]);
18772
+ const visibleSections = useMemo(
18773
+ () => new Set(resolvedConfig.visibleSections),
18774
+ [resolvedConfig.visibleSections]
18775
+ );
18776
+ const groups = configuredGroups?.length ? configuredGroups : resolvedConfig.groups;
18777
+ const resolvedDefaultGroupId = defaultGroupId ?? resolvedConfig.defaultGroupId;
18763
18778
  const [activeGroupId, setActiveGroupId] = useState(
18764
- defaultGroupId ?? groups[0]?.id ?? ""
18779
+ resolvedDefaultGroupId ?? groups[0]?.id ?? ""
18765
18780
  );
18766
18781
  const activeGroup = groups.find((group) => group.id === activeGroupId) ?? groups[0];
18767
18782
  const normalizedQuery = searchQuery.trim().toLocaleLowerCase();
@@ -18774,8 +18789,8 @@ function AgentWorkbenchExploreSidebar({
18774
18789
  );
18775
18790
  useEffect(() => {
18776
18791
  if (groups.some((group) => group.id === activeGroupId)) return;
18777
- setActiveGroupId(defaultGroupId ?? groups[0]?.id ?? "");
18778
- }, [activeGroupId, defaultGroupId, groups]);
18792
+ setActiveGroupId(resolvedDefaultGroupId ?? groups[0]?.id ?? "");
18793
+ }, [activeGroupId, groups, resolvedDefaultGroupId]);
18779
18794
  useEffect(() => {
18780
18795
  const handleShortcut = (event) => {
18781
18796
  if (!(event.ctrlKey || event.metaKey) || event.key.toLocaleLowerCase() !== "k")
@@ -18791,8 +18806,8 @@ function AgentWorkbenchExploreSidebar({
18791
18806
  setActiveGroupId(groupId);
18792
18807
  onIntent?.({ type: "change-group", groupId });
18793
18808
  };
18794
- const state = error ? "error" : loading && sessions.length === 0 ? "loading" : filteredSessions.length === 0 && !draftVisible ? "empty" : "ready";
18795
- const groupNavigation = activeGroup ? /* @__PURE__ */ jsx("div", { className: "border-t border-border px-4 pb-4 pt-3", children: /* @__PURE__ */ jsxs(Tabs, { value: activeGroup.id, onValueChange: changeGroup, children: [
18809
+ const state = !visibleSections.has("sessions") ? "ready" : error ? "error" : loading && sessions.length === 0 ? "loading" : filteredSessions.length === 0 && !draftVisible ? "empty" : "ready";
18810
+ const groupNavigation = visibleSections.has("groups") && activeGroup ? /* @__PURE__ */ jsx("div", { className: "border-t border-border px-4 pb-4 pt-3", children: /* @__PURE__ */ jsxs(Tabs, { value: activeGroup.id, onValueChange: changeGroup, children: [
18796
18811
  /* @__PURE__ */ jsx(
18797
18812
  TabsList,
18798
18813
  {
@@ -18826,9 +18841,10 @@ function AgentWorkbenchExploreSidebar({
18826
18841
  AgentWorkbenchSidebarContainer,
18827
18842
  {
18828
18843
  "data-sidebar-style": "explore",
18844
+ "data-sidebar-width-percent": resolvedConfig.widthPercent,
18829
18845
  "aria-label": labels.navigation,
18830
- header,
18831
- search: /* @__PURE__ */ jsxs(InputGroup, { className: "h-12 rounded-[var(--radius)] border-border bg-card text-foreground", children: [
18846
+ header: visibleSections.has("header") ? header : void 0,
18847
+ search: visibleSections.has("search") ? /* @__PURE__ */ jsxs(InputGroup, { className: "h-12 rounded-[var(--radius)] border-border bg-card text-foreground", children: [
18832
18848
  /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Search, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }) }),
18833
18849
  /* @__PURE__ */ jsx(
18834
18850
  InputGroupInput,
@@ -18843,8 +18859,8 @@ function AgentWorkbenchExploreSidebar({
18843
18859
  }
18844
18860
  ),
18845
18861
  /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx("kbd", { className: "rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-muted-foreground", children: "Ctrl K" }) })
18846
- ] }),
18847
- primaryAction: /* @__PURE__ */ jsxs(
18862
+ ] }) : void 0,
18863
+ primaryAction: visibleSections.has("new-session") ? /* @__PURE__ */ jsxs(
18848
18864
  Button,
18849
18865
  {
18850
18866
  type: "button",
@@ -18855,9 +18871,9 @@ function AgentWorkbenchExploreSidebar({
18855
18871
  labels.newSession
18856
18872
  ]
18857
18873
  }
18858
- ),
18874
+ ) : void 0,
18859
18875
  groups: groupNavigation,
18860
- footer,
18876
+ footer: visibleSections.has("footer") ? footer : void 0,
18861
18877
  status: state,
18862
18878
  loadingState: /* @__PURE__ */ jsx("div", { className: "flex h-24 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx(Loader2, { className: "size-5 animate-spin" }) }),
18863
18879
  emptyState: /* @__PURE__ */ jsx("div", { className: "px-3 py-8 text-center text-sm text-muted-foreground", children: normalizedQuery ? labels.noResults : labels.emptySessions }),
@@ -18872,7 +18888,7 @@ function AgentWorkbenchExploreSidebar({
18872
18888
  bodyProps: { "data-agent-workbench-session-scroll-region": "" },
18873
18889
  className,
18874
18890
  classNames: { body: "min-h-[160px] flex-[0_1_280px] px-4 pb-3" },
18875
- children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
18891
+ children: visibleSections.has("sessions") ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
18876
18892
  draftVisible ? /* @__PURE__ */ jsx(
18877
18893
  "button",
18878
18894
  {
@@ -18930,7 +18946,7 @@ function AgentWorkbenchExploreSidebar({
18930
18946
  },
18931
18947
  session.id
18932
18948
  ))
18933
- ] })
18949
+ ] }) : null
18934
18950
  }
18935
18951
  );
18936
18952
  }