@inf-monkeys-tech/monkeys-design 1.0.88 → 1.0.92-canary.285.1.d23f71b

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.
@@ -1,5 +1,5 @@
1
- import { L as AgentWorkbenchAppearanceOptions, d as AgentWorkbenchApprovalIntent, e as AgentWorkbenchArtifactIntent } from '../../details-model-06b1a44badc2.mjs';
2
- export { A as AgentWorkbenchActivity, a as AgentWorkbenchActivityClassNames, b as AgentWorkbenchActivityModel, c as AgentWorkbenchActivityProps, M as AgentWorkbenchAppearance, N as AgentWorkbenchAppearanceProvider, O as AgentWorkbenchAppearanceProviderProps, P as AgentWorkbenchApproval, Q as AgentWorkbenchApprovalData, R as AgentWorkbenchApprovalProps, S as AgentWorkbenchDensity, f as AgentWorkbenchDetailsIntent, g as AgentWorkbenchDetailsModel, h as AgentWorkbenchDetailsState, i as AgentWorkbenchDetailsTab, j as AgentWorkbenchEventOf, T as AgentWorkbenchExploreCardMedia, U as AgentWorkbenchExploreCardMediaProps, k as AgentWorkbenchExploreGroup, l as AgentWorkbenchExploreItem, V as AgentWorkbenchExploreMediaTreatment, W as AgentWorkbenchExploreMediaVariant, m as AgentWorkbenchExploreSidebar, n as AgentWorkbenchExploreSidebarIntent, o as AgentWorkbenchExploreSidebarLabels, p as AgentWorkbenchExploreSidebarProps, q as AgentWorkbenchShell, r as AgentWorkbenchShellClassNames, s as AgentWorkbenchShellProps, t as AgentWorkbenchSidebar, u as AgentWorkbenchSidebarClassNames, v as AgentWorkbenchSidebarContainer, w as AgentWorkbenchSidebarContainerBodyProps, x as AgentWorkbenchSidebarContainerClassNames, y as AgentWorkbenchSidebarContainerProps, z as AgentWorkbenchSidebarIntent, B as AgentWorkbenchSidebarProps, X as AgentWorkbenchSurface, Y as AgentWorkbenchSurfaceLevel, Z as AgentWorkbenchSurfaceProps, C as AgentWorkbenchTaskDetails, D as AgentWorkbenchTaskDetailsClassNames, E as AgentWorkbenchTaskDetailsProps, F as AgentWorkbenchTerminalModel, G as AgentWorkbenchTool, H as AgentWorkbenchToolClassNames, I as AgentWorkbenchToolProps, _ as AgentWorkbenchVariant, J as createAgentWorkbenchActivityModel, K as createAgentWorkbenchDetailsModel, $ as resolveAgentWorkbenchAppearance } from '../../details-model-06b1a44badc2.mjs';
1
+ import { R as AgentWorkbenchAppearanceOptions, e as AgentWorkbenchApprovalIntent, f as AgentWorkbenchArtifactIntent } from '../../details-model-f46aa2190c52.mjs';
2
+ export { A as AGENT_WORKBENCH_SHELL_BREAKPOINTS, a as AgentWorkbenchActivity, b as AgentWorkbenchActivityClassNames, c as AgentWorkbenchActivityModel, d as AgentWorkbenchActivityProps, S as AgentWorkbenchAppearance, T as AgentWorkbenchAppearanceProvider, U as AgentWorkbenchAppearanceProviderProps, V as AgentWorkbenchApproval, W as AgentWorkbenchApprovalData, X as AgentWorkbenchApprovalProps, Y as AgentWorkbenchDensity, g as AgentWorkbenchDetailsIntent, h as AgentWorkbenchDetailsModel, i as AgentWorkbenchDetailsState, j as AgentWorkbenchDetailsTab, k as AgentWorkbenchEventOf, Z as AgentWorkbenchExploreCardMedia, _ as AgentWorkbenchExploreCardMediaProps, l as AgentWorkbenchExploreGroup, m as AgentWorkbenchExploreItem, $ as AgentWorkbenchExploreMediaTreatment, a0 as AgentWorkbenchExploreMediaVariant, n as AgentWorkbenchExploreSidebar, o as AgentWorkbenchExploreSidebarIntent, p as AgentWorkbenchExploreSidebarLabels, q as AgentWorkbenchExploreSidebarProps, r as AgentWorkbenchShell, s as AgentWorkbenchShellBreakpoints, t as AgentWorkbenchShellClassNames, u as AgentWorkbenchShellLabels, v as AgentWorkbenchShellLayout, w as AgentWorkbenchShellMeasurement, x as AgentWorkbenchShellProps, y as AgentWorkbenchSidebar, z as AgentWorkbenchSidebarClassNames, B as AgentWorkbenchSidebarContainer, C as AgentWorkbenchSidebarContainerBodyProps, D as AgentWorkbenchSidebarContainerClassNames, E as AgentWorkbenchSidebarContainerProps, F as AgentWorkbenchSidebarIntent, G as AgentWorkbenchSidebarProps, a1 as AgentWorkbenchSurface, a2 as AgentWorkbenchSurfaceLevel, a3 as AgentWorkbenchSurfaceProps, H as AgentWorkbenchTaskDetails, I as AgentWorkbenchTaskDetailsClassNames, J as AgentWorkbenchTaskDetailsProps, K as AgentWorkbenchTerminalModel, L as AgentWorkbenchTool, M as AgentWorkbenchToolClassNames, N as AgentWorkbenchToolProps, a4 as AgentWorkbenchVariant, O as createAgentWorkbenchActivityModel, P as createAgentWorkbenchDetailsModel, a5 as resolveAgentWorkbenchAppearance, Q as resolveAgentWorkbenchShellLayout } from '../../details-model-f46aa2190c52.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { AgentWorkbenchComposerViewModel, AgentSessionPermissionProfile, AgentWorkbenchQuickStartViewModel, AgentSessionViewModel, AgentSessionEvent } from '@inf-monkeys-tech/monkeys';
5
5
  export { AgentWorkbenchQuickStartCategory, AgentWorkbenchQuickStartIcon, AgentWorkbenchQuickStartSection, AgentWorkbenchQuickStartTemplate, AgentWorkbenchQuickStartViewModel } from '@inf-monkeys-tech/monkeys';
@@ -1,5 +1,5 @@
1
- import { L as AgentWorkbenchAppearanceOptions, d as AgentWorkbenchApprovalIntent, e as AgentWorkbenchArtifactIntent } from '../../details-model-06b1a44badc2.js';
2
- export { A as AgentWorkbenchActivity, a as AgentWorkbenchActivityClassNames, b as AgentWorkbenchActivityModel, c as AgentWorkbenchActivityProps, M as AgentWorkbenchAppearance, N as AgentWorkbenchAppearanceProvider, O as AgentWorkbenchAppearanceProviderProps, P as AgentWorkbenchApproval, Q as AgentWorkbenchApprovalData, R as AgentWorkbenchApprovalProps, S as AgentWorkbenchDensity, f as AgentWorkbenchDetailsIntent, g as AgentWorkbenchDetailsModel, h as AgentWorkbenchDetailsState, i as AgentWorkbenchDetailsTab, j as AgentWorkbenchEventOf, T as AgentWorkbenchExploreCardMedia, U as AgentWorkbenchExploreCardMediaProps, k as AgentWorkbenchExploreGroup, l as AgentWorkbenchExploreItem, V as AgentWorkbenchExploreMediaTreatment, W as AgentWorkbenchExploreMediaVariant, m as AgentWorkbenchExploreSidebar, n as AgentWorkbenchExploreSidebarIntent, o as AgentWorkbenchExploreSidebarLabels, p as AgentWorkbenchExploreSidebarProps, q as AgentWorkbenchShell, r as AgentWorkbenchShellClassNames, s as AgentWorkbenchShellProps, t as AgentWorkbenchSidebar, u as AgentWorkbenchSidebarClassNames, v as AgentWorkbenchSidebarContainer, w as AgentWorkbenchSidebarContainerBodyProps, x as AgentWorkbenchSidebarContainerClassNames, y as AgentWorkbenchSidebarContainerProps, z as AgentWorkbenchSidebarIntent, B as AgentWorkbenchSidebarProps, X as AgentWorkbenchSurface, Y as AgentWorkbenchSurfaceLevel, Z as AgentWorkbenchSurfaceProps, C as AgentWorkbenchTaskDetails, D as AgentWorkbenchTaskDetailsClassNames, E as AgentWorkbenchTaskDetailsProps, F as AgentWorkbenchTerminalModel, G as AgentWorkbenchTool, H as AgentWorkbenchToolClassNames, I as AgentWorkbenchToolProps, _ as AgentWorkbenchVariant, J as createAgentWorkbenchActivityModel, K as createAgentWorkbenchDetailsModel, $ as resolveAgentWorkbenchAppearance } from '../../details-model-06b1a44badc2.js';
1
+ import { R as AgentWorkbenchAppearanceOptions, e as AgentWorkbenchApprovalIntent, f as AgentWorkbenchArtifactIntent } from '../../details-model-f46aa2190c52.js';
2
+ export { A as AGENT_WORKBENCH_SHELL_BREAKPOINTS, a as AgentWorkbenchActivity, b as AgentWorkbenchActivityClassNames, c as AgentWorkbenchActivityModel, d as AgentWorkbenchActivityProps, S as AgentWorkbenchAppearance, T as AgentWorkbenchAppearanceProvider, U as AgentWorkbenchAppearanceProviderProps, V as AgentWorkbenchApproval, W as AgentWorkbenchApprovalData, X as AgentWorkbenchApprovalProps, Y as AgentWorkbenchDensity, g as AgentWorkbenchDetailsIntent, h as AgentWorkbenchDetailsModel, i as AgentWorkbenchDetailsState, j as AgentWorkbenchDetailsTab, k as AgentWorkbenchEventOf, Z as AgentWorkbenchExploreCardMedia, _ as AgentWorkbenchExploreCardMediaProps, l as AgentWorkbenchExploreGroup, m as AgentWorkbenchExploreItem, $ as AgentWorkbenchExploreMediaTreatment, a0 as AgentWorkbenchExploreMediaVariant, n as AgentWorkbenchExploreSidebar, o as AgentWorkbenchExploreSidebarIntent, p as AgentWorkbenchExploreSidebarLabels, q as AgentWorkbenchExploreSidebarProps, r as AgentWorkbenchShell, s as AgentWorkbenchShellBreakpoints, t as AgentWorkbenchShellClassNames, u as AgentWorkbenchShellLabels, v as AgentWorkbenchShellLayout, w as AgentWorkbenchShellMeasurement, x as AgentWorkbenchShellProps, y as AgentWorkbenchSidebar, z as AgentWorkbenchSidebarClassNames, B as AgentWorkbenchSidebarContainer, C as AgentWorkbenchSidebarContainerBodyProps, D as AgentWorkbenchSidebarContainerClassNames, E as AgentWorkbenchSidebarContainerProps, F as AgentWorkbenchSidebarIntent, G as AgentWorkbenchSidebarProps, a1 as AgentWorkbenchSurface, a2 as AgentWorkbenchSurfaceLevel, a3 as AgentWorkbenchSurfaceProps, H as AgentWorkbenchTaskDetails, I as AgentWorkbenchTaskDetailsClassNames, J as AgentWorkbenchTaskDetailsProps, K as AgentWorkbenchTerminalModel, L as AgentWorkbenchTool, M as AgentWorkbenchToolClassNames, N as AgentWorkbenchToolProps, a4 as AgentWorkbenchVariant, O as createAgentWorkbenchActivityModel, P as createAgentWorkbenchDetailsModel, a5 as resolveAgentWorkbenchAppearance, Q as resolveAgentWorkbenchShellLayout } from '../../details-model-f46aa2190c52.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { AgentWorkbenchComposerViewModel, AgentSessionPermissionProfile, AgentWorkbenchQuickStartViewModel, AgentSessionViewModel, AgentSessionEvent } from '@inf-monkeys-tech/monkeys';
5
5
  export { AgentWorkbenchQuickStartCategory, AgentWorkbenchQuickStartIcon, AgentWorkbenchQuickStartSection, AgentWorkbenchQuickStartTemplate, AgentWorkbenchQuickStartViewModel } from '@inf-monkeys-tech/monkeys';
@@ -15,6 +15,7 @@ var TabsPrimitive = require('@radix-ui/react-tabs');
15
15
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
16
16
  var classVarianceAuthority = require('class-variance-authority');
17
17
  var SelectPrimitive = require('@radix-ui/react-select');
18
+ var DialogPrimitive = require('@radix-ui/react-dialog');
18
19
  var monkeys = require('@inf-monkeys-tech/monkeys');
19
20
  var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
20
21
  var core = require('@dnd-kit/core');
@@ -49,6 +50,7 @@ var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive)
49
50
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
50
51
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
51
52
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
53
+ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
52
54
  var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
53
55
 
54
56
  // src/components/agent-workbench/appearance.tsx
@@ -1066,6 +1068,53 @@ var SelectSeparator = React5__namespace.forwardRef(
1066
1068
  ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })
1067
1069
  );
1068
1070
  SelectSeparator.displayName = "SelectSeparator";
1071
+ var Sheet = DialogPrimitive__namespace.Root;
1072
+ var SheetPortal = DialogPrimitive__namespace.Portal;
1073
+ var SheetOverlay = React5__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1074
+ DialogPrimitive__namespace.Overlay,
1075
+ {
1076
+ ref,
1077
+ className: cn(
1078
+ "theme-overlay-backdrop fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1079
+ className
1080
+ ),
1081
+ ...props
1082
+ }
1083
+ ));
1084
+ SheetOverlay.displayName = "SheetOverlay";
1085
+ var sideClassNames = {
1086
+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1087
+ right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
1088
+ bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1089
+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm"
1090
+ };
1091
+ var SheetContent = React5__namespace.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1092
+ /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
1093
+ /* @__PURE__ */ jsxRuntime.jsxs(
1094
+ DialogPrimitive__namespace.Content,
1095
+ {
1096
+ ref,
1097
+ className: cn(
1098
+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
1099
+ sideClassNames[side],
1100
+ className
1101
+ ),
1102
+ ...props,
1103
+ children: [
1104
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
1105
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { "aria-hidden": "true", className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18M6 6l12 12" }) }),
1106
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1107
+ ] }),
1108
+ children
1109
+ ]
1110
+ }
1111
+ )
1112
+ ] }));
1113
+ SheetContent.displayName = "SheetContent";
1114
+ var SheetTitle = React5__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Title, { ref, className: cn("text-lg font-semibold text-foreground", className), ...props }));
1115
+ SheetTitle.displayName = "SheetTitle";
1116
+ var SheetDescription = React5__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
1117
+ SheetDescription.displayName = "SheetDescription";
1069
1118
  function ComposerSelect({
1070
1119
  value,
1071
1120
  label,
@@ -4411,17 +4460,72 @@ var AgentWorkbenchThreadShell = React5.forwardRef(function AgentWorkbenchThreadS
4411
4460
  }
4412
4461
  );
4413
4462
  });
4463
+ var AGENT_WORKBENCH_SHELL_BREAKPOINTS = Object.freeze({
4464
+ mobile: 768,
4465
+ drawer: 1200,
4466
+ compact: 1440,
4467
+ lowHeight: 768
4468
+ });
4469
+ function resolveAgentWorkbenchShellLayout(width, breakpoints = AGENT_WORKBENCH_SHELL_BREAKPOINTS) {
4470
+ if (width < breakpoints.mobile) return "mobile";
4471
+ if (width < breakpoints.drawer) return "drawer";
4472
+ if (width < breakpoints.compact) return "compact";
4473
+ return "wide";
4474
+ }
4475
+ var OVERLAY_EVENT = "monkeys-agent-workbench-overlay-open";
4414
4476
  function cssSize(value) {
4415
4477
  return typeof value === "number" ? `${value}px` : value;
4416
4478
  }
4479
+ function clamp(value, min, max) {
4480
+ return Math.min(Math.max(value, min), Math.max(min, max));
4481
+ }
4482
+ function initialMeasuredSize() {
4483
+ if (typeof window === "undefined") return { width: 1440, height: 900 };
4484
+ return {
4485
+ width: window.visualViewport?.width ?? window.innerWidth,
4486
+ height: window.visualViewport?.height ?? window.innerHeight
4487
+ };
4488
+ }
4489
+ function readStoredWidths(storageKey) {
4490
+ if (!storageKey || typeof window === "undefined") return {};
4491
+ try {
4492
+ const value = JSON.parse(window.localStorage.getItem(storageKey) ?? "{}");
4493
+ return typeof value === "object" && value !== null ? value : {};
4494
+ } catch {
4495
+ return {};
4496
+ }
4497
+ }
4498
+ function writeStoredWidths(storageKey, widths) {
4499
+ if (!storageKey || typeof window === "undefined") return;
4500
+ window.localStorage.setItem(storageKey, JSON.stringify(widths));
4501
+ }
4417
4502
  function AgentWorkbenchShell({
4418
4503
  sidebar,
4419
4504
  children,
4420
4505
  details,
4421
4506
  sidebarOpen = true,
4422
4507
  detailsOpen = true,
4508
+ onDetailsOpenChange,
4423
4509
  sidebarWidth = 280,
4424
4510
  detailsWidth = 360,
4511
+ sidebarMinWidth = 240,
4512
+ sidebarMaxWidth = 400,
4513
+ detailsMinWidth = 320,
4514
+ detailsMaxWidth = 720,
4515
+ mainMinWidth = 600,
4516
+ responsive = false,
4517
+ responsiveMeasurement = "container",
4518
+ responsiveWidth,
4519
+ responsiveHeight,
4520
+ breakpoints = AGENT_WORKBENCH_SHELL_BREAKPOINTS,
4521
+ onLayoutChange,
4522
+ showResponsiveControls = true,
4523
+ overlayGroupId,
4524
+ resizable = false,
4525
+ widthStorageKey,
4526
+ onSidebarWidthChange,
4527
+ onDetailsWidthChange,
4528
+ labels,
4425
4529
  variant,
4426
4530
  density,
4427
4531
  className,
@@ -4430,33 +4534,270 @@ function AgentWorkbenchShell({
4430
4534
  ...rootProps
4431
4535
  }) {
4432
4536
  const appearance = useAgentWorkbenchAppearance({ variant, density });
4537
+ const rootRef = React5.useRef(null);
4538
+ const sidebarReturnFocusRef = React5.useRef(null);
4539
+ const detailsReturnFocusRef = React5.useRef(null);
4540
+ const shellId = React5.useId();
4541
+ const [measuredSize, setMeasuredSize] = React5.useState(initialMeasuredSize);
4542
+ const storedWidths = React5.useMemo(
4543
+ () => readStoredWidths(widthStorageKey),
4544
+ [widthStorageKey]
4545
+ );
4546
+ const [sidebarPixelWidth, setSidebarPixelWidth] = React5.useState(
4547
+ () => typeof sidebarWidth === "number" ? storedWidths.sidebar ?? sidebarWidth : 280
4548
+ );
4549
+ const [detailsPixelWidth, setDetailsPixelWidth] = React5.useState(
4550
+ () => typeof detailsWidth === "number" ? storedWidths.details ?? detailsWidth : 360
4551
+ );
4552
+ const [sidebarOverlayOpen, setSidebarOverlayOpen] = React5.useState(false);
4553
+ const [detailsOverlayOpen, setDetailsOverlayOpen] = React5.useState(false);
4554
+ const rememberReturnFocus = React5.useCallback(
4555
+ (region, candidate = document.activeElement) => {
4556
+ if (!(candidate instanceof HTMLElement) || candidate === document.body || candidate === document.documentElement) {
4557
+ return;
4558
+ }
4559
+ const targetRef = region === "sidebar" ? sidebarReturnFocusRef : detailsReturnFocusRef;
4560
+ targetRef.current = candidate;
4561
+ },
4562
+ []
4563
+ );
4564
+ const restoreReturnFocus = React5.useCallback((region) => {
4565
+ const targetRef = region === "sidebar" ? sidebarReturnFocusRef : detailsReturnFocusRef;
4566
+ const target = targetRef.current;
4567
+ targetRef.current = null;
4568
+ if (!target?.isConnected) return;
4569
+ window.requestAnimationFrame(() => {
4570
+ if (target.isConnected) target.focus();
4571
+ });
4572
+ }, []);
4573
+ React5.useEffect(() => {
4574
+ if (typeof sidebarWidth === "number") {
4575
+ setSidebarPixelWidth(storedWidths.sidebar ?? sidebarWidth);
4576
+ }
4577
+ }, [sidebarWidth, storedWidths.sidebar]);
4578
+ React5.useEffect(() => {
4579
+ if (typeof detailsWidth === "number") {
4580
+ setDetailsPixelWidth(storedWidths.details ?? detailsWidth);
4581
+ }
4582
+ }, [detailsWidth, storedWidths.details]);
4583
+ React5.useEffect(() => {
4584
+ if (!responsive) return void 0;
4585
+ const updateViewport = () => {
4586
+ const viewport = initialMeasuredSize();
4587
+ setMeasuredSize({
4588
+ width: responsiveWidth ?? viewport.width,
4589
+ height: responsiveHeight ?? viewport.height
4590
+ });
4591
+ };
4592
+ if (responsiveMeasurement === "viewport" || responsiveWidth !== void 0 || responsiveHeight !== void 0) {
4593
+ updateViewport();
4594
+ if (responsiveWidth !== void 0 && responsiveHeight !== void 0) {
4595
+ return void 0;
4596
+ }
4597
+ window.addEventListener("resize", updateViewport);
4598
+ window.visualViewport?.addEventListener("resize", updateViewport);
4599
+ return () => {
4600
+ window.removeEventListener("resize", updateViewport);
4601
+ window.visualViewport?.removeEventListener("resize", updateViewport);
4602
+ };
4603
+ }
4604
+ const root = rootRef.current;
4605
+ if (!root) return void 0;
4606
+ const updateContainer = () => {
4607
+ const rect = root.getBoundingClientRect();
4608
+ setMeasuredSize({ width: rect.width, height: rect.height });
4609
+ };
4610
+ updateContainer();
4611
+ if (typeof ResizeObserver === "undefined") {
4612
+ window.addEventListener("resize", updateContainer);
4613
+ return () => window.removeEventListener("resize", updateContainer);
4614
+ }
4615
+ const observer = new ResizeObserver(updateContainer);
4616
+ observer.observe(root);
4617
+ return () => observer.disconnect();
4618
+ }, [responsive, responsiveHeight, responsiveMeasurement, responsiveWidth]);
4619
+ const layout = responsive ? resolveAgentWorkbenchShellLayout(
4620
+ responsiveWidth ?? measuredSize.width,
4621
+ breakpoints
4622
+ ) : "wide";
4623
+ const lowHeight = responsive && (responsiveHeight ?? measuredSize.height) <= breakpoints.lowHeight;
4624
+ React5.useEffect(() => onLayoutChange?.(layout), [layout, onLayoutChange]);
4433
4625
  const hasSidebar = sidebar !== void 0 && sidebarOpen;
4434
4626
  const hasDetails = details !== void 0 && detailsOpen;
4627
+ const inlineSidebar = hasSidebar && (layout === "wide" || layout === "compact");
4628
+ const inlineDetails = hasDetails && layout === "wide";
4629
+ const resolvedSidebarMax = Math.max(
4630
+ sidebarMinWidth,
4631
+ Math.min(
4632
+ sidebarMaxWidth,
4633
+ layout === "compact" ? 320 : sidebarMaxWidth,
4634
+ measuredSize.width - (inlineDetails ? detailsPixelWidth : 0) - mainMinWidth
4635
+ )
4636
+ );
4637
+ const resolvedDetailsMax = Math.max(
4638
+ detailsMinWidth,
4639
+ Math.min(
4640
+ detailsMaxWidth,
4641
+ measuredSize.width - (inlineSidebar ? sidebarPixelWidth : 0) - mainMinWidth
4642
+ )
4643
+ );
4644
+ const resolvedSidebarWidth = typeof sidebarWidth === "number" ? clamp(sidebarPixelWidth, sidebarMinWidth, resolvedSidebarMax) : sidebarWidth;
4645
+ const resolvedDetailsWidth = typeof detailsWidth === "number" ? clamp(detailsPixelWidth, detailsMinWidth, resolvedDetailsMax) : detailsWidth;
4646
+ const requestOverlay = React5.useCallback(
4647
+ (region) => {
4648
+ if (!overlayGroupId || typeof window === "undefined") return;
4649
+ window.dispatchEvent(
4650
+ new CustomEvent(OVERLAY_EVENT, {
4651
+ detail: { groupId: overlayGroupId, ownerId: shellId, region }
4652
+ })
4653
+ );
4654
+ },
4655
+ [overlayGroupId, shellId]
4656
+ );
4657
+ React5.useEffect(() => {
4658
+ if (!overlayGroupId || typeof window === "undefined") return void 0;
4659
+ const handleOverlayOpen = (event) => {
4660
+ const detail = event.detail;
4661
+ if (detail?.groupId !== overlayGroupId || detail?.ownerId === shellId)
4662
+ return;
4663
+ setSidebarOverlayOpen(false);
4664
+ setDetailsOverlayOpen((open) => {
4665
+ if (open) onDetailsOpenChange?.(false);
4666
+ return false;
4667
+ });
4668
+ };
4669
+ window.addEventListener(OVERLAY_EVENT, handleOverlayOpen);
4670
+ return () => window.removeEventListener(OVERLAY_EVENT, handleOverlayOpen);
4671
+ }, [onDetailsOpenChange, overlayGroupId, shellId]);
4672
+ React5.useEffect(() => {
4673
+ if (inlineSidebar || !hasSidebar) setSidebarOverlayOpen(false);
4674
+ }, [hasSidebar, inlineSidebar]);
4675
+ React5.useEffect(() => {
4676
+ if (inlineDetails || !hasDetails) {
4677
+ setDetailsOverlayOpen(false);
4678
+ return;
4679
+ }
4680
+ rememberReturnFocus("details");
4681
+ requestOverlay("details");
4682
+ setDetailsOverlayOpen(true);
4683
+ }, [hasDetails, inlineDetails, rememberReturnFocus, requestOverlay]);
4684
+ const persistWidths = React5.useCallback(
4685
+ (sidebarValue, detailsValue) => {
4686
+ writeStoredWidths(widthStorageKey, {
4687
+ sidebar: sidebarValue,
4688
+ details: detailsValue
4689
+ });
4690
+ },
4691
+ [widthStorageKey]
4692
+ );
4693
+ const updateRegionWidth = React5.useCallback(
4694
+ (region, value) => {
4695
+ if (region === "sidebar") {
4696
+ const next2 = clamp(value, sidebarMinWidth, resolvedSidebarMax);
4697
+ setSidebarPixelWidth(next2);
4698
+ onSidebarWidthChange?.(next2);
4699
+ return next2;
4700
+ }
4701
+ const next = clamp(value, detailsMinWidth, resolvedDetailsMax);
4702
+ setDetailsPixelWidth(next);
4703
+ onDetailsWidthChange?.(next);
4704
+ return next;
4705
+ },
4706
+ [
4707
+ detailsMinWidth,
4708
+ onDetailsWidthChange,
4709
+ onSidebarWidthChange,
4710
+ resolvedDetailsMax,
4711
+ resolvedSidebarMax,
4712
+ sidebarMinWidth
4713
+ ]
4714
+ );
4715
+ const beginResize = React5.useCallback(
4716
+ (region, event) => {
4717
+ if (!resizable || event.button !== 0) return;
4718
+ event.preventDefault();
4719
+ const startX = event.clientX;
4720
+ const startWidth = region === "sidebar" ? sidebarPixelWidth : detailsPixelWidth;
4721
+ let latestWidth = startWidth;
4722
+ const previousCursor = document.body.style.cursor;
4723
+ const previousUserSelect = document.body.style.userSelect;
4724
+ document.body.style.cursor = "col-resize";
4725
+ document.body.style.userSelect = "none";
4726
+ const handleMove = (pointerEvent) => {
4727
+ const delta = pointerEvent.clientX - startX;
4728
+ latestWidth = updateRegionWidth(
4729
+ region,
4730
+ startWidth + (region === "sidebar" ? delta : -delta)
4731
+ );
4732
+ };
4733
+ const handleUp = () => {
4734
+ document.body.style.cursor = previousCursor;
4735
+ document.body.style.userSelect = previousUserSelect;
4736
+ window.removeEventListener("pointermove", handleMove);
4737
+ window.removeEventListener("pointerup", handleUp);
4738
+ persistWidths(
4739
+ region === "sidebar" ? latestWidth : sidebarPixelWidth,
4740
+ region === "details" ? latestWidth : detailsPixelWidth
4741
+ );
4742
+ };
4743
+ window.addEventListener("pointermove", handleMove);
4744
+ window.addEventListener("pointerup", handleUp, { once: true });
4745
+ },
4746
+ [
4747
+ detailsPixelWidth,
4748
+ persistWidths,
4749
+ resizable,
4750
+ sidebarPixelWidth,
4751
+ updateRegionWidth
4752
+ ]
4753
+ );
4754
+ const resizeWithKeyboard = React5.useCallback(
4755
+ (region, direction) => {
4756
+ const current = region === "sidebar" ? sidebarPixelWidth : detailsPixelWidth;
4757
+ const next = updateRegionWidth(region, current + direction * 16);
4758
+ persistWidths(
4759
+ region === "sidebar" ? next : sidebarPixelWidth,
4760
+ region === "details" ? next : detailsPixelWidth
4761
+ );
4762
+ },
4763
+ [detailsPixelWidth, persistWidths, sidebarPixelWidth, updateRegionWidth]
4764
+ );
4435
4765
  const shellStyle = {
4436
- "--agent-workbench-sidebar-width": hasSidebar ? cssSize(sidebarWidth) : "0px",
4437
- "--agent-workbench-details-width": hasDetails ? cssSize(detailsWidth) : "0px",
4438
- gridTemplateColumns: hasSidebar && hasDetails ? "var(--agent-workbench-sidebar-width) minmax(0, 1fr) var(--agent-workbench-details-width)" : hasSidebar ? "var(--agent-workbench-sidebar-width) minmax(0, 1fr)" : hasDetails ? "minmax(0, 1fr) var(--agent-workbench-details-width)" : "minmax(0, 1fr)",
4766
+ "--agent-workbench-sidebar-width": inlineSidebar ? cssSize(resolvedSidebarWidth) : "0px",
4767
+ "--agent-workbench-details-width": inlineDetails ? cssSize(resolvedDetailsWidth) : "0px",
4768
+ gridTemplateColumns: inlineSidebar && inlineDetails ? "var(--agent-workbench-sidebar-width) minmax(0, 1fr) var(--agent-workbench-details-width)" : inlineSidebar ? "var(--agent-workbench-sidebar-width) minmax(0, 1fr)" : inlineDetails ? "minmax(0, 1fr) var(--agent-workbench-details-width)" : "minmax(0, 1fr)",
4439
4769
  ...style
4440
4770
  };
4771
+ const sidebarOverlay = hasSidebar && !inlineSidebar;
4772
+ const detailsOverlay = hasDetails && !inlineDetails;
4773
+ const showControls = responsive && showResponsiveControls && (sidebarOverlay || detailsOverlay);
4774
+ const mobilePanel = layout === "mobile";
4775
+ const controlSize = mobilePanel ? "size-11" : "size-9";
4776
+ const panelCloseClass = mobilePanel ? "[&>button]:flex [&>button]:size-11 [&>button]:items-center [&>button]:justify-center" : "";
4441
4777
  return /* @__PURE__ */ jsxRuntime.jsxs(
4442
4778
  "div",
4443
4779
  {
4444
4780
  ...rootProps,
4781
+ ref: rootRef,
4445
4782
  role: rootProps.role ?? "region",
4446
4783
  "aria-label": rootProps["aria-label"] ?? "Agent workbench",
4447
4784
  "data-agent-workbench-shell": "true",
4448
4785
  "data-agent-workbench-variant": appearance.variant,
4449
4786
  "data-agent-workbench-density": appearance.density,
4787
+ "data-agent-workbench-layout": layout,
4788
+ "data-agent-workbench-low-height": lowHeight ? "true" : "false",
4450
4789
  "data-sidebar-open": hasSidebar ? "true" : "false",
4790
+ "data-sidebar-presentation": inlineSidebar ? "inline" : sidebarOverlay ? "overlay" : "hidden",
4451
4791
  "data-details-open": hasDetails ? "true" : "false",
4792
+ "data-details-presentation": inlineDetails ? "inline" : detailsOverlay ? "overlay" : "hidden",
4452
4793
  className: cn2(
4453
- "grid size-full min-h-0 min-w-0 overflow-hidden bg-background text-foreground",
4794
+ "relative grid size-full min-h-0 min-w-0 overflow-hidden bg-background text-foreground",
4454
4795
  classNames?.root,
4455
4796
  className
4456
4797
  ),
4457
4798
  style: shellStyle,
4458
4799
  children: [
4459
- hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
4800
+ inlineSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
4460
4801
  "div",
4461
4802
  {
4462
4803
  "data-agent-workbench-region": "sidebar",
@@ -4467,18 +4808,69 @@ function AgentWorkbenchShell({
4467
4808
  children: sidebar
4468
4809
  }
4469
4810
  ) : null,
4470
- /* @__PURE__ */ jsxRuntime.jsx(
4811
+ /* @__PURE__ */ jsxRuntime.jsxs(
4471
4812
  "div",
4472
4813
  {
4473
4814
  "data-agent-workbench-region": "main",
4474
4815
  className: cn2(
4475
- "min-h-0 min-w-0 overflow-hidden bg-background",
4816
+ "flex min-h-0 min-w-0 flex-col overflow-hidden bg-background",
4476
4817
  classNames?.main
4477
4818
  ),
4478
- children
4819
+ children: [
4820
+ showControls ? /* @__PURE__ */ jsxRuntime.jsxs(
4821
+ "div",
4822
+ {
4823
+ "data-agent-workbench-responsive-controls": "true",
4824
+ className: cn2(
4825
+ "flex min-h-11 shrink-0 items-center gap-1 border-b border-border bg-background px-2",
4826
+ lowHeight && "min-h-10",
4827
+ classNames?.controls
4828
+ ),
4829
+ children: [
4830
+ sidebarOverlay ? /* @__PURE__ */ jsxRuntime.jsx(
4831
+ "button",
4832
+ {
4833
+ type: "button",
4834
+ className: cn2(
4835
+ "inline-flex items-center justify-center rounded-[var(--radius)] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4836
+ controlSize
4837
+ ),
4838
+ "aria-label": labels?.openSidebar ?? "Open navigation",
4839
+ "aria-expanded": sidebarOverlayOpen,
4840
+ onClick: (event) => {
4841
+ rememberReturnFocus("sidebar", event.currentTarget);
4842
+ requestOverlay("sidebar");
4843
+ setSidebarOverlayOpen(true);
4844
+ },
4845
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, { className: "size-5", "aria-hidden": "true" })
4846
+ }
4847
+ ) : null,
4848
+ detailsOverlay && details ? /* @__PURE__ */ jsxRuntime.jsx(
4849
+ "button",
4850
+ {
4851
+ type: "button",
4852
+ className: cn2(
4853
+ "ml-auto inline-flex items-center justify-center rounded-[var(--radius)] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4854
+ controlSize
4855
+ ),
4856
+ "aria-label": labels?.openDetails ?? "Open details",
4857
+ "aria-expanded": detailsOverlayOpen,
4858
+ onClick: (event) => {
4859
+ rememberReturnFocus("details", event.currentTarget);
4860
+ requestOverlay("details");
4861
+ setDetailsOverlayOpen(true);
4862
+ },
4863
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRight, { className: "size-5", "aria-hidden": "true" })
4864
+ }
4865
+ ) : null
4866
+ ]
4867
+ }
4868
+ ) : null,
4869
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children })
4870
+ ]
4479
4871
  }
4480
4872
  ),
4481
- hasDetails ? /* @__PURE__ */ jsxRuntime.jsx(
4873
+ inlineDetails ? /* @__PURE__ */ jsxRuntime.jsx(
4482
4874
  "div",
4483
4875
  {
4484
4876
  "data-agent-workbench-region": "details",
@@ -4488,6 +4880,106 @@ function AgentWorkbenchShell({
4488
4880
  ),
4489
4881
  children: details
4490
4882
  }
4883
+ ) : null,
4884
+ resizable && inlineSidebar && typeof sidebarWidth === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
4885
+ "button",
4886
+ {
4887
+ type: "button",
4888
+ role: "separator",
4889
+ "aria-orientation": "vertical",
4890
+ "aria-label": labels?.resizeSidebar ?? "Resize navigation",
4891
+ "aria-valuemin": sidebarMinWidth,
4892
+ "aria-valuemax": resolvedSidebarMax,
4893
+ "aria-valuenow": Number(resolvedSidebarWidth),
4894
+ className: cn2(
4895
+ "absolute inset-y-0 z-20 w-2 -translate-x-1/2 cursor-col-resize touch-none bg-transparent outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-colors hover:after:bg-primary focus-visible:after:w-0.5 focus-visible:after:bg-ring",
4896
+ classNames?.resizeHandle
4897
+ ),
4898
+ style: { left: "var(--agent-workbench-sidebar-width)" },
4899
+ onPointerDown: (event) => beginResize("sidebar", event),
4900
+ onKeyDown: (event) => {
4901
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
4902
+ event.preventDefault();
4903
+ resizeWithKeyboard("sidebar", event.key === "ArrowRight" ? 1 : -1);
4904
+ }
4905
+ }
4906
+ ) : null,
4907
+ resizable && inlineDetails && typeof detailsWidth === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
4908
+ "button",
4909
+ {
4910
+ type: "button",
4911
+ role: "separator",
4912
+ "aria-orientation": "vertical",
4913
+ "aria-label": labels?.resizeDetails ?? "Resize details",
4914
+ "aria-valuemin": detailsMinWidth,
4915
+ "aria-valuemax": resolvedDetailsMax,
4916
+ "aria-valuenow": Number(resolvedDetailsWidth),
4917
+ className: cn2(
4918
+ "absolute inset-y-0 right-[var(--agent-workbench-details-width)] z-20 w-2 translate-x-1/2 cursor-col-resize touch-none bg-transparent outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-colors hover:after:bg-primary focus-visible:after:w-0.5 focus-visible:after:bg-ring",
4919
+ classNames?.resizeHandle
4920
+ ),
4921
+ onPointerDown: (event) => beginResize("details", event),
4922
+ onKeyDown: (event) => {
4923
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
4924
+ event.preventDefault();
4925
+ resizeWithKeyboard("details", event.key === "ArrowLeft" ? 1 : -1);
4926
+ }
4927
+ }
4928
+ ) : null,
4929
+ sidebarOverlay ? /* @__PURE__ */ jsxRuntime.jsx(
4930
+ Sheet,
4931
+ {
4932
+ open: sidebarOverlayOpen,
4933
+ onOpenChange: (open) => {
4934
+ setSidebarOverlayOpen(open);
4935
+ if (!open) restoreReturnFocus("sidebar");
4936
+ },
4937
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4938
+ SheetContent,
4939
+ {
4940
+ side: "left",
4941
+ className: cn2(
4942
+ "flex h-dvh flex-col gap-0 overflow-hidden bg-card p-0 text-card-foreground",
4943
+ mobilePanel ? "inset-0 size-dvw !max-w-none border-0" : "w-[min(360px,90vw)] !max-w-none",
4944
+ panelCloseClass,
4945
+ classNames?.sidebarOverlay
4946
+ ),
4947
+ children: [
4948
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: "sr-only", children: labels?.sidebar ?? "Navigation" }),
4949
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: sidebar })
4950
+ ]
4951
+ }
4952
+ )
4953
+ }
4954
+ ) : null,
4955
+ detailsOverlay ? /* @__PURE__ */ jsxRuntime.jsx(
4956
+ Sheet,
4957
+ {
4958
+ open: detailsOverlayOpen,
4959
+ onOpenChange: (open) => {
4960
+ setDetailsOverlayOpen(open);
4961
+ if (!open) {
4962
+ restoreReturnFocus("details");
4963
+ onDetailsOpenChange?.(false);
4964
+ }
4965
+ },
4966
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4967
+ SheetContent,
4968
+ {
4969
+ side: "right",
4970
+ className: cn2(
4971
+ "flex h-dvh flex-col gap-0 overflow-hidden bg-card p-0 text-card-foreground",
4972
+ mobilePanel ? "inset-0 size-dvw !max-w-none border-0" : "w-[min(520px,92vw)] !max-w-none",
4973
+ panelCloseClass,
4974
+ classNames?.detailsOverlay
4975
+ ),
4976
+ children: [
4977
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: "sr-only", children: labels?.details ?? "Details" }),
4978
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: details })
4979
+ ]
4980
+ }
4981
+ )
4982
+ }
4491
4983
  ) : null
4492
4984
  ]
4493
4985
  }
@@ -5136,6 +5628,7 @@ function AgentWorkbenchArtifactWorkspace({
5136
5628
  );
5137
5629
  }
5138
5630
 
5631
+ exports.AGENT_WORKBENCH_SHELL_BREAKPOINTS = AGENT_WORKBENCH_SHELL_BREAKPOINTS;
5139
5632
  exports.AgentWorkbenchAction = AgentWorkbenchAction;
5140
5633
  exports.AgentWorkbenchActivity = AgentWorkbenchActivity;
5141
5634
  exports.AgentWorkbenchAppearanceProvider = AgentWorkbenchAppearanceProvider;
@@ -5162,5 +5655,6 @@ exports.AgentWorkbenchTool = AgentWorkbenchTool;
5162
5655
  exports.createAgentWorkbenchActivityModel = createAgentWorkbenchActivityModel;
5163
5656
  exports.createAgentWorkbenchDetailsModel = createAgentWorkbenchDetailsModel;
5164
5657
  exports.resolveAgentWorkbenchAppearance = resolveAgentWorkbenchAppearance;
5658
+ exports.resolveAgentWorkbenchShellLayout = resolveAgentWorkbenchShellLayout;
5165
5659
  //# sourceMappingURL=index.js.map
5166
5660
  //# sourceMappingURL=index.js.map