@datalayer/agent-runtimes 1.6.45 → 1.6.46

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.
@@ -22,7 +22,8 @@ import { ReactorLazy } from '@datalayer/reactor/react';
22
22
  import { ANSWER_ACTION, emptyUiModel, isFileRef, uploadFile, } from '@datalayer/reactor/ui';
23
23
  import { UiSocket } from '@datalayer/reactor/ui/ws';
24
24
  import { SkeletonText } from '@primer/react/experimental';
25
- import { SidebarExpandIcon } from '@primer/octicons-react';
25
+ import { GrabberIcon, SidebarExpandIcon } from '@primer/octicons-react';
26
+ import { useViewportDrag } from '../useViewportDrag.js';
26
27
  import { notebookStore, JupyterReactTheme } from '@datalayer/jupyter-react';
27
28
  import { Box, setupPrimerPortals, useThemeStore, getColorPalette, getThemeConfig, useSystemColorMode, } from '@datalayer/primer-addons';
28
29
  import { AlertIcon, PersonIcon, UnmuteIcon } from '@primer/octicons-react';
@@ -601,6 +602,29 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
601
602
  const surfaceChatFloating = surfaceVisible && isFloatingChatViewMode(chatViewMode);
602
603
  // The two smaller floating modes share the compact card over a surface.
603
604
  const compactFloating = chatViewMode === 'floating-small' || chatViewMode === 'floating-draggable';
605
+ // "Floating draggable" over a surface: the card moves about the viewport by
606
+ // its handle, at the size it had when taken (the user, 14 November 2026: the
607
+ // handle had gone from the agent page's floating chat).
608
+ const draggableFloating = surfaceChatFloating && chatViewMode === 'floating-draggable';
609
+ const floatingChatRef = useRef(null);
610
+ const floatingDrag = useViewportDrag(floatingChatRef);
611
+ const resetFloatingDrag = floatingDrag.reset;
612
+ const floatingSize = useRef(null);
613
+ const onFloatingHandlePointerDown = useCallback((event) => {
614
+ const box = floatingChatRef.current;
615
+ if (box) {
616
+ floatingSize.current = {
617
+ width: box.offsetWidth,
618
+ height: box.offsetHeight,
619
+ };
620
+ }
621
+ floatingDrag.onHandlePointerDown(event);
622
+ }, [floatingDrag]);
623
+ useEffect(() => {
624
+ if (!draggableFloating) {
625
+ resetFloatingDrag();
626
+ }
627
+ }, [draggableFloating, resetFloatingDrag]);
604
628
  // Notebook frontend tools are always created (hooks must be unconditional)
605
629
  // but only merged into the tools sent to the agent while the notebook is
606
630
  // visible, so the agent can manipulate the live notebook cells. Document
@@ -4079,7 +4103,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
4079
4103
  toolbarComponent: ephemeralNotebookToolbar,
4080
4104
  toolbarExtraItems: notebookToolbarItems,
4081
4105
  collaborationProvider: ephemeralNotebookCollaborationProvider,
4082
- } })) : (_jsx(React.Suspense, { fallback: null, children: _jsx(EphemeralDocument, { documentId: ephemeralDocumentId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, content: persistedEphemeralDocument ?? undefined, onContentChange: handleEphemeralDocumentChange, onToolsReady: handleDocumentToolsReady, onKernelChange: handleDocumentKernelChange, collaboration: ephemeralDocumentCollaboration, toolbarExtraItems: documentToolbarItems }) })) }), !surfaceCollapsed && (_jsxs(Box, { sx: surfaceChatFloating
4106
+ } })) : (_jsx(React.Suspense, { fallback: null, children: _jsx(EphemeralDocument, { documentId: ephemeralDocumentId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, content: persistedEphemeralDocument ?? undefined, onContentChange: handleEphemeralDocumentChange, onToolsReady: handleDocumentToolsReady, onKernelChange: handleDocumentKernelChange, collaboration: ephemeralDocumentCollaboration, toolbarExtraItems: documentToolbarItems }) })) }), !surfaceCollapsed && (_jsxs(Box, { ref: floatingChatRef, sx: surfaceChatFloating
4083
4107
  ? {
4084
4108
  position: 'absolute',
4085
4109
  right: 16,
@@ -4088,6 +4112,20 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
4088
4112
  ...(compactFloating
4089
4113
  ? { bottom: 16, height: '62%' }
4090
4114
  : { top: 16, bottom: 16 }),
4115
+ // Where it was put down, in the viewport.
4116
+ ...(draggableFloating && floatingDrag.position
4117
+ ? {
4118
+ position: 'fixed',
4119
+ left: floatingDrag.position.left,
4120
+ top: floatingDrag.position.top,
4121
+ right: 'auto',
4122
+ bottom: 'auto',
4123
+ maxWidth: 'none',
4124
+ width: floatingSize.current?.width ?? 360,
4125
+ height: floatingSize.current?.height ?? '62vh',
4126
+ zIndex: 1000,
4127
+ }
4128
+ : {}),
4091
4129
  display: 'flex',
4092
4130
  flexDirection: 'column',
4093
4131
  minHeight: 0,
@@ -4109,7 +4147,15 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
4109
4147
  flexDirection: 'column',
4110
4148
  overflow: 'hidden',
4111
4149
  bg: 'canvas.default',
4112
- }, children: [chatHeaderElement, _jsx(Box, { ref: messagesContainerRef, flex: 1, minHeight: 0, overflow: "auto", bg: "canvas.default", children: messagesContent }), footerContent, inputToolbar] })), surfaceCollapsed &&
4150
+ }, children: [draggableFloating && (_jsx(Box, { onPointerDown: onFloatingHandlePointerDown, "aria-label": "Move the chat", "data-chat-drag-handle": "", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, height: 18, sx: {
4151
+ cursor: 'grab',
4152
+ color: 'fg.subtle',
4153
+ bg: 'canvas.subtle',
4154
+ borderBottom: '1px solid',
4155
+ borderColor: 'border.muted',
4156
+ touchAction: 'none',
4157
+ '&:active': { cursor: 'grabbing' },
4158
+ }, children: _jsx(GrabberIcon, { size: 16 }) })), chatHeaderElement, _jsx(Box, { ref: messagesContainerRef, flex: 1, minHeight: 0, overflow: "auto", bg: "canvas.default", children: messagesContent }), footerContent, inputToolbar] })), surfaceCollapsed &&
4113
4159
  onExpandFromCollapsed &&
4114
4160
  (chatViewMode === 'sidebar' ? (_jsx(Box, { position: "absolute", top: 8, right: 8, zIndex: 6, children: _jsx(IconButton, { icon: SidebarExpandIcon, "aria-label": "Open chat", onClick: onExpandFromCollapsed, variant: "default", size: "small" }) })) : (_jsx(FloatingBrandButton, { isOpen: false, onToggle: onExpandFromCollapsed, position: "bottom-right", tooltip: "Open chat" })))] })) : (_jsxs(_Fragment, { children: [_jsx(Box, { ref: messagesContainerRef, "data-chat-history": "", flex: 1, flexGrow: 1, minHeight: 0, overflow: "auto", bg: "canvas.default", children: messagesContent }), footerContent, inputToolbar] })), showPoweredBy && _jsx(PoweredByTag, { ...poweredByProps }), overlay && (_jsxs(Box, { position: "absolute", inset: 0, zIndex: 20, display: "flex", alignItems: "center", justifyContent: "center", p: 3, overflow: "auto", children: [_jsx(Box, { "aria-hidden": true, position: "absolute", inset: 0, bg: "canvas.default", opacity: 0.4, backdropFilter: "blur(1px)" }), _jsx(Box, { position: "relative", zIndex: 1, maxWidth: "100%", children: overlay })] })), launching && !overlay && (_jsxs(Box, { position: "absolute", inset: 0, zIndex: 15, display: "flex", alignItems: "center", justifyContent: "center", p: 3, children: [_jsx(Box, { "aria-hidden": true, position: "absolute", inset: 0, bg: "canvas.default", opacity: 0.35, backdropFilter: "blur(1px)" }), _jsxs(Box, { position: "relative", zIndex: 1, display: "flex", flexDirection: "column", alignItems: "center", gap: 3, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: launchingMessage || 'Launching your agent…' })] })] }))] }));
4115
4161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.6.45",
3
+ "version": "1.6.46",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",