@datalayer/agent-runtimes 1.3.89 → 1.3.91

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.
Files changed (265) hide show
  1. package/lib/Agent.js +2 -18
  2. package/lib/AgentDocument.js +5 -55
  3. package/lib/AgentNode.js +31 -208
  4. package/lib/AgentNotebook.js +5 -59
  5. package/lib/agent-node/AgentNodeGallery.js +23 -111
  6. package/lib/agents/AgentDetails.js +36 -274
  7. package/lib/agents/AgentRuntimeChat.js +1 -8
  8. package/lib/chat/Chat.js +7 -46
  9. package/lib/chat/ChatFloating.js +15 -100
  10. package/lib/chat/ChatInline.js +5 -47
  11. package/lib/chat/ChatPopupStandalone.js +5 -53
  12. package/lib/chat/ChatSidebar.js +4 -51
  13. package/lib/chat/ChatStandalone.js +4 -45
  14. package/lib/chat/EphemeralSurfaceControl.js +5 -25
  15. package/lib/chat/assistant/AssistantContextMenu.d.ts +8 -0
  16. package/lib/chat/assistant/AssistantContextMenu.js +17 -1
  17. package/lib/chat/assistant/AssistantStage.js +6 -25
  18. package/lib/chat/assistant/BalloonParts.js +8 -40
  19. package/lib/chat/assistant/BalloonVisual.js +2 -2
  20. package/lib/chat/assistant/ConversationBalloon.js +2 -11
  21. package/lib/chat/assistant/DecisionAsk.js +3 -3
  22. package/lib/chat/assistant/SandboxDetailsDialog.js +3 -17
  23. package/lib/chat/assistant/SpeechBalloon.js +14 -78
  24. package/lib/chat/base/ChatBase.js +37 -172
  25. package/lib/chat/display/EmptyState.js +7 -35
  26. package/lib/chat/display/FloatingBrandButton.js +4 -34
  27. package/lib/chat/display/PoweredByTag.js +3 -14
  28. package/lib/chat/document/EphemeralDocument.js +3 -18
  29. package/lib/chat/header/ChatHeader.js +1 -17
  30. package/lib/chat/header/ChatHeaderBase.js +2 -24
  31. package/lib/chat/header/ChatViewModeToggle.js +7 -29
  32. package/lib/chat/indicators/McpStatusIndicator.js +3 -12
  33. package/lib/chat/indicators/SandboxStatusIndicator.js +6 -34
  34. package/lib/chat/indicators/SkillsStatusIndicator.js +3 -12
  35. package/lib/chat/indicators/TypingDots.js +1 -11
  36. package/lib/chat/messages/ChatMessageList.js +58 -185
  37. package/lib/chat/messages/ChatMessages.js +15 -79
  38. package/lib/chat/messages/FormSubmissionMessage.js +2 -33
  39. package/lib/chat/messages/NotebookToolSurfaces.js +12 -41
  40. package/lib/chat/messages/TurnFooter.js +4 -10
  41. package/lib/chat/notebook/EphemeralNotebook.js +2 -10
  42. package/lib/chat/parts/ReasoningPart.js +2 -16
  43. package/lib/chat/parts/TextPart.js +2 -12
  44. package/lib/chat/parts/ToolPart.js +16 -90
  45. package/lib/chat/presence/Presence.js +5 -33
  46. package/lib/chat/prompt/FloatingCard.js +1 -13
  47. package/lib/chat/prompt/InputPrompt.js +1 -6
  48. package/lib/chat/prompt/InputPromptBase.js +4 -17
  49. package/lib/chat/prompt/InputPromptLexical.js +44 -45
  50. package/lib/chat/prompt/InputPromptText.js +1 -1
  51. package/lib/chat/prompt/footer/InPromptFooter.js +1 -8
  52. package/lib/chat/prompt/menus/AgentsMenu.js +1 -1
  53. package/lib/chat/prompt/menus/InlineAgentsMenu.js +1 -1
  54. package/lib/chat/prompt/menus/ModelSelector.js +1 -5
  55. package/lib/chat/prompt/menus/SkillsMenu.js +3 -30
  56. package/lib/chat/prompt/menus/SuggestionsMenu.js +1 -1
  57. package/lib/chat/prompt/menus/ToolsMenu.js +4 -48
  58. package/lib/chat/prompt/plugins/AgentMentionPlugin.js +2 -9
  59. package/lib/chat/prompt/plugins/CommandPlugin.js +2 -9
  60. package/lib/chat/prompt/plugins/MentionChip.js +1 -15
  61. package/lib/chat/prompt/stack.js +1 -19
  62. package/lib/chat/tools/A2AAgentDialog.js +9 -42
  63. package/lib/chat/tools/SubagentActivity.js +5 -22
  64. package/lib/chat/tools/ToolApprovalBanner.js +4 -34
  65. package/lib/chat/tools/ToolApprovalDialog.js +4 -19
  66. package/lib/chat/tools/ToolCallDisplay.js +12 -97
  67. package/lib/chat/usage/ContextPie.js +4 -45
  68. package/lib/chat/words.d.ts +7 -0
  69. package/lib/chat/words.js +12 -0
  70. package/lib/components/a2ui/datalayer/Chart.js +4 -10
  71. package/lib/components/a2ui/datalayer/Chat.js +2 -10
  72. package/lib/components/a2ui/datalayer/Download.js +1 -1
  73. package/lib/components/a2ui/datalayer/Evidence.js +1 -15
  74. package/lib/components/a2ui/datalayer/FileUpload.js +1 -12
  75. package/lib/components/a2ui/datalayer/Table.js +9 -17
  76. package/lib/components/a2ui/datalayer/formWidgets.js +3 -2
  77. package/lib/components/a2ui/datalayer/parts.js +1 -16
  78. package/lib/components/a2ui/styles.js +16 -5
  79. package/lib/components/agents/AgentSummary.js +1 -51
  80. package/lib/components/cards/NotificationEventCard.js +6 -72
  81. package/lib/components/cards/OutputCard.js +4 -48
  82. package/lib/components/cards/ToolApprovalCard.js +2 -35
  83. package/lib/components/code-sandboxes/CodeSandboxCellVariables.js +1 -1
  84. package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +4 -14
  85. package/lib/components/code-sandboxes/CodeSandboxPicker.js +16 -21
  86. package/lib/components/code-sandboxes/CodeSandboxVariables.js +2 -2
  87. package/lib/components/scheduler/ScheduleMenu.js +5 -10
  88. package/lib/components/specs/SpecPayloadPreview.js +1 -26
  89. package/lib/components/teams/A2ATeamGraph.d.ts +4 -3
  90. package/lib/components/teams/A2ATeamGraph.js +25 -71
  91. package/lib/components/teams/AnswerSurfacesView.js +2 -2
  92. package/lib/components/teams/NotebookPreview.js +1 -10
  93. package/lib/components/teams/NotebookPreviewView.js +2 -3
  94. package/lib/components/teams/SceneTranscript.js +3 -17
  95. package/lib/components/teams/SceneView.js +1 -8
  96. package/lib/components/teams/TeamNotebook.js +5 -13
  97. package/lib/components/teams/TeamNotebookView.js +2 -12
  98. package/lib/components/teams/index.d.ts +1 -0
  99. package/lib/components/teams/index.js +1 -0
  100. package/lib/components/teams/useBalloonRoom.d.ts +39 -0
  101. package/lib/components/teams/useBalloonRoom.js +89 -0
  102. package/lib/config/AgentConfiguration.js +22 -225
  103. package/lib/context/ContextDistribution.js +7 -41
  104. package/lib/context/ContextInspector.js +9 -107
  105. package/lib/context/ContextPanel.js +11 -86
  106. package/lib/context/ContextUsage.js +6 -34
  107. package/lib/context/CostTracker.js +7 -42
  108. package/lib/context/MessageHistory.js +3 -37
  109. package/lib/context/TurnGraphChart.js +9 -41
  110. package/lib/examples/A2UiAgentExample.js +6 -108
  111. package/lib/examples/A2UiComponentsGalleryExample.js +1 -1
  112. package/lib/examples/A2UiContactCardExample.js +1 -1
  113. package/lib/examples/A2UiJupyterOutputExample.js +25 -125
  114. package/lib/examples/A2UiRestaurantExample.js +1 -1
  115. package/lib/examples/A2UiViewerExample.js +1 -1
  116. package/lib/examples/AgUiAgenticExample.js +3 -35
  117. package/lib/examples/AgUiBackendToolRenderingExample.js +2 -25
  118. package/lib/examples/AgUiHaikuGenUiExample.js +2 -32
  119. package/lib/examples/AgUiHumanInTheLoopExample.js +5 -59
  120. package/lib/examples/AgUiSharedStateExample.js +6 -56
  121. package/lib/examples/AgUiToolsBasedGenUiExample.js +25 -120
  122. package/lib/examples/AgentA2AExample.js +1 -15
  123. package/lib/examples/AgentA2ATeamExample.js +6 -30
  124. package/lib/examples/AgentCheckpointsExample.js +11 -145
  125. package/lib/examples/AgentCodeSandboxExample.js +5 -108
  126. package/lib/examples/AgentCodeSandboxesExample.js +3 -30
  127. package/lib/examples/AgentCodemodeExample.js +9 -85
  128. package/lib/examples/AgentCompactionExample.js +3 -64
  129. package/lib/examples/AgentDecideExample.js +1 -13
  130. package/lib/examples/AgentEvalsExample.js +5 -60
  131. package/lib/examples/AgentGuardrailsExample.js +4 -28
  132. package/lib/examples/AgentHooksExample.js +1 -1
  133. package/lib/examples/AgentInferenceProviderExample.js +5 -96
  134. package/lib/examples/AgentMCPExample.js +7 -105
  135. package/lib/examples/AgentMemoryExample.js +5 -74
  136. package/lib/examples/AgentMonitoringExample.js +7 -53
  137. package/lib/examples/AgentNotificationsExample.js +3 -61
  138. package/lib/examples/AgentOtelExample.js +3 -72
  139. package/lib/examples/AgentOutputsExample.js +6 -81
  140. package/lib/examples/AgentParametersExample.js +2 -37
  141. package/lib/examples/AgentSkillsExample.js +3 -45
  142. package/lib/examples/AgentSubagentsExample.js +6 -56
  143. package/lib/examples/AgentToolApprovalsExample.js +1 -11
  144. package/lib/examples/AgentTriggersExample.js +29 -239
  145. package/lib/examples/AgentspecsExample.js +6 -60
  146. package/lib/examples/AssistantExample.js +5 -5
  147. package/lib/examples/AssistantGalleryExample.js +8 -65
  148. package/lib/examples/CellExample.js +1 -6
  149. package/lib/examples/ChatCustomExample.js +2 -31
  150. package/lib/examples/ChatExample.js +1 -9
  151. package/lib/examples/ChatStandaloneExample.js +3 -37
  152. package/lib/examples/CopilotKitLexicalExample.js +1 -24
  153. package/lib/examples/DecksAgent.js +1 -1
  154. package/lib/examples/DocumentPageAgent.js +1 -1
  155. package/lib/examples/HomeExample.js +14 -62
  156. package/lib/examples/Lexical2Example.js +3 -32
  157. package/lib/examples/LexicalAgentExample.js +2 -34
  158. package/lib/examples/LexicalAgentSidebarExample.js +3 -34
  159. package/lib/examples/LoopAppComputerExample.js +1 -1
  160. package/lib/examples/LoopShellExample.js +2 -2
  161. package/lib/examples/LoopStrategyExample.js +15 -87
  162. package/lib/examples/LoopWorkspaceEmbed.js +2 -18
  163. package/lib/examples/LoopWorkspaceExample.js +2 -2
  164. package/lib/examples/NotebookAgentExample.js +2 -33
  165. package/lib/examples/NotebookAgentSidebarExample.js +3 -46
  166. package/lib/examples/NotebookCollaborationExample.js +1 -31
  167. package/lib/examples/NotebookExample.js +1 -18
  168. package/lib/examples/NotebookPageAgent.js +1 -1
  169. package/lib/examples/ScenesExample.js +5 -24
  170. package/lib/examples/VoiceChatExample.js +1 -1
  171. package/lib/examples/components/AuthRequiredView.js +1 -7
  172. package/lib/examples/components/ErrorView.js +1 -8
  173. package/lib/examples/components/ExampleErrorBoundary.js +1 -14
  174. package/lib/examples/components/FooterMetrics.js +1 -7
  175. package/lib/examples/components/Header.js +12 -51
  176. package/lib/examples/components/HeaderControls.js +1 -9
  177. package/lib/examples/components/LexicalEditor.js +1 -8
  178. package/lib/examples/components/MainContent.js +1 -13
  179. package/lib/examples/components/MockFileBrowser.js +4 -40
  180. package/lib/examples/components/SessionTabs.js +1 -1
  181. package/lib/examples/components/TimeTravel.js +1 -13
  182. package/lib/examples/main.js +13 -81
  183. package/lib/examples/scenes/A2UiComponentsGalleryScene.js +3 -34
  184. package/lib/examples/scenes/A2UiContactCardScene.js +3 -35
  185. package/lib/examples/scenes/A2UiRestaurantScene.js +3 -53
  186. package/lib/examples/scenes/A2UiViewerScene.js +3 -34
  187. package/lib/examples/utils/AssistantGalleryGrid.js +6 -35
  188. package/lib/examples2/DatalayerNotebookExample.js +3 -33
  189. package/lib/examples2/NativeNavigationExample.js +4 -10
  190. package/lib/examples2/NotebookMutationsKernel.js +2 -1
  191. package/lib/examples2/NotebookMutationsServiceManager.js +2 -1
  192. package/lib/examples2/ReactRouterExample.js +14 -42
  193. package/lib/hooks/useToolApprovals.d.ts +2 -34
  194. package/lib/hooks/useToolApprovals.js +1 -64
  195. package/lib/identity/AgentIdentity.js +17 -62
  196. package/lib/identity/IdentityConnect.js +13 -59
  197. package/lib/identity/OAuthCallback.js +6 -44
  198. package/lib/lexical/ChatInlinePlugin.js +6 -14
  199. package/lib/loop/apps/AppFeedback.js +12 -3
  200. package/lib/loop/apps/AppRenderer.d.ts +4 -3
  201. package/lib/loop/apps/AppRenderer.js +11 -12
  202. package/lib/loop/apps/appspec.js +6 -3
  203. package/lib/loop/apps/feedback.d.ts +3 -2
  204. package/lib/loop/apps/feedback.js +4 -2
  205. package/lib/loop/core/index.d.ts +19 -0
  206. package/lib/loop/core/index.js +27 -0
  207. package/lib/loop/embed/AppEmbed.d.ts +1 -1
  208. package/lib/loop/embed/AppEmbed.js +2 -1
  209. package/lib/loop/embed/LoopEmbed.js +1 -7
  210. package/lib/loop/embed/embedConfig.d.ts +3 -3
  211. package/lib/loop/embed/embedConfig.js +2 -3
  212. package/lib/loop/embed/embedTheme.d.ts +4 -4
  213. package/lib/loop/embed/embedTheme.js +11 -7
  214. package/lib/loop/plugins/a2a-sidebar/A2ASidebar.js +7 -34
  215. package/lib/loop/plugins/a2ui/A2uiView.js +4 -12
  216. package/lib/loop/plugins/a2ui-surface/InlineSurface.js +1 -16
  217. package/lib/loop/plugins/a2ui-surface/SurfaceToolResult.js +2 -12
  218. package/lib/loop/plugins/agents/AnonymousKeyBadge.js +3 -2
  219. package/lib/loop/plugins/agents/SandboxSelector.js +3 -7
  220. package/lib/loop/plugins/agents/SandboxView.js +4 -27
  221. package/lib/loop/plugins/agents/TeamMemberPicker.js +2 -2
  222. package/lib/loop/plugins/agentspecs/AgentspecPicker.js +3 -2
  223. package/lib/loop/plugins/app-activity/AppActivity.js +1 -1
  224. package/lib/loop/plugins/app-computer/AppComputer.js +32 -27
  225. package/lib/loop/plugins/app-elements/AppElements.js +2 -31
  226. package/lib/loop/plugins/app-page/AppPage.js +26 -8
  227. package/lib/loop/plugins/app-rules/AppRulesCard.js +4 -20
  228. package/lib/loop/plugins/assistant/index.js +1 -13
  229. package/lib/loop/plugins/chat/ChatView.js +89 -130
  230. package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.js +2 -13
  231. package/lib/loop/plugins/decks/DeckSurface.js +2 -2
  232. package/lib/loop/plugins/document/DocumentView.js +4 -12
  233. package/lib/loop/plugins/document-toolbar/SandboxStatusItem.js +3 -8
  234. package/lib/loop/plugins/graph/GraphView.js +2 -2
  235. package/lib/loop/plugins/input-prompt/ComposerView.js +1 -1
  236. package/lib/loop/plugins/notebook/NotebookView.js +3 -11
  237. package/lib/loop/plugins/page-layout/SplitLayout.js +11 -34
  238. package/lib/loop/plugins/page-layout/TurnPanel.js +9 -35
  239. package/lib/loop/plugins/shell/useEditorPreviews.js +3 -2
  240. package/lib/loop/plugins/subagent-activity/SubagentPulse.js +1 -13
  241. package/lib/loop/plugins/window-frame/WindowFrame.js +10 -44
  242. package/lib/loop/plugins/window-frame/index.js +1 -1
  243. package/lib/loop/shell/LoopWorkspace.js +34 -77
  244. package/lib/loop/shell/PluginToggles.js +4 -15
  245. package/lib/loop/shell/SidebarRail.js +8 -40
  246. package/lib/loop/shell/ViewSwitcher.js +4 -24
  247. package/lib/loop-main.js +2 -3
  248. package/lib/mcp/McpServerManager.js +6 -37
  249. package/lib/portable/index.d.ts +11 -0
  250. package/lib/portable/index.js +20 -0
  251. package/lib/protocols/AGUIAdapter.js +2 -2
  252. package/lib/protocols/BaseProtocolAdapter.d.ts +2 -0
  253. package/lib/protocols/BaseProtocolAdapter.js +4 -0
  254. package/lib/specs/apps.js +6 -0
  255. package/lib/specs/appspecSchema.js +11 -4
  256. package/lib/stories/loop/ReferenceScreens.js +17 -91
  257. package/lib/stories/loop/pictures-main.js +1 -1
  258. package/lib/types/agentspecs.d.ts +5 -2
  259. package/lib/types/protocol.d.ts +2 -0
  260. package/lib/utils/approvals.d.ts +59 -0
  261. package/lib/utils/approvals.js +101 -0
  262. package/lib/voice/VoiceInput.js +3 -39
  263. package/package.json +2 -2
  264. package/lib/shims/primerAddonsBox.d.ts +0 -1
  265. package/lib/shims/primerAddonsBox.js +0 -7
@@ -17,11 +17,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
17
17
  */
18
18
  import { useContext } from 'react';
19
19
  import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
20
- import { Box, Text, Spinner, IconButton } from '@primer/react';
20
+ import { Text, Spinner, IconButton } from '@primer/react';
21
21
  import { SkeletonText } from '@primer/react/experimental';
22
22
  import { SidebarExpandIcon } from '@primer/octicons-react';
23
23
  import { notebookStore, JupyterReactTheme } from '@datalayer/jupyter-react';
24
- import { setupPrimerPortals, useThemeStore, getColorPalette, getThemeConfig, useSystemColorMode, } from '@datalayer/primer-addons';
24
+ import { Box, setupPrimerPortals, useThemeStore, getColorPalette, getThemeConfig, useSystemColorMode, } from '@datalayer/primer-addons';
25
25
  import { AlertIcon, PersonIcon } from '@primer/octicons-react';
26
26
  import { AiAgentIcon } from '@datalayer/icons-react';
27
27
  import { QueryClientProvider, QueryClientContext } from '@tanstack/react-query';
@@ -97,31 +97,7 @@ function frontendToolExpectsArgs(tool) {
97
97
  return Object.keys(parameters).length > 0;
98
98
  }
99
99
  function CompanionSurfaceSkeleton({ mode }) {
100
- return (_jsx(Box, { "aria-label": mode === 'notebook' ? 'Preparing notebook…' : 'Preparing document…', sx: {
101
- flex: 1,
102
- minHeight: 0,
103
- overflow: 'hidden',
104
- display: 'flex',
105
- flexDirection: 'column',
106
- gap: 3,
107
- p: 4,
108
- }, children: mode === 'notebook' ? (_jsx(_Fragment, { children: [0, 1, 2].map(i => (_jsxs(Box, { sx: {
109
- p: 3,
110
- border: '1px solid',
111
- borderColor: 'border.muted',
112
- borderRadius: 2,
113
- bg: 'canvas.subtle',
114
- display: 'flex',
115
- flexDirection: 'column',
116
- gap: 2,
117
- }, children: [_jsx(SkeletonText, { lines: 1 }), _jsx(SkeletonText, { lines: i === 0 ? 2 : 3 })] }, i))) })) : (_jsxs(Box, { sx: {
118
- maxWidth: 860,
119
- width: '100%',
120
- mx: 'auto',
121
- display: 'flex',
122
- flexDirection: 'column',
123
- gap: 3,
124
- }, children: [_jsx(SkeletonText, { lines: 1 }), _jsx(SkeletonText, { lines: 4 }), _jsx(SkeletonText, { lines: 3 }), _jsx(SkeletonText, { lines: 5 })] })) }));
100
+ return (_jsx(Box, { "aria-label": mode === 'notebook' ? 'Preparing notebook…' : 'Preparing document…', flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column", gap: 3, p: 4, children: mode === 'notebook' ? (_jsx(_Fragment, { children: [0, 1, 2].map(i => (_jsxs(Box, { p: 3, border: "1px solid", borderColor: "border.muted", borderRadius: 2, bg: "canvas.subtle", display: "flex", flexDirection: "column", gap: 2, children: [_jsx(SkeletonText, { lines: 1 }), _jsx(SkeletonText, { lines: i === 0 ? 2 : 3 })] }, i))) })) : (_jsxs(Box, { maxWidth: 860, width: "100%", mx: "auto", display: "flex", flexDirection: "column", gap: 3, children: [_jsx(SkeletonText, { lines: 1 }), _jsx(SkeletonText, { lines: 4 }), _jsx(SkeletonText, { lines: 3 }), _jsx(SkeletonText, { lines: 5 })] })) }));
125
101
  }
126
102
  // JupyterReactTheme forwards unknown props (e.g. `style`) to its inner Primer
127
103
  // `BaseStyles`. `style` is not part of its typings, so we widen the type here.
@@ -3567,18 +3543,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
3567
3543
  ? notebookToolSurfacesRenderer(notebookToolSurfacesId)
3568
3544
  : undefined), [renderToolResult, notebookToolSurfacesId]);
3569
3545
  if (!ready) {
3570
- return (_jsx(Box, { className: className, sx: {
3571
- display: 'flex',
3572
- flexDirection: 'column',
3573
- alignItems: 'center',
3574
- justifyContent: 'center',
3575
- height: '100%',
3576
- p: 4,
3577
- borderRadius,
3578
- bg: backgroundColor || 'canvas.default',
3579
- border,
3580
- boxShadow,
3581
- }, children: loadingState || (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { mt: 3, color: 'fg.muted' }, children: "Initializing chat..." })] })) }));
3546
+ return (_jsx(Box, { className: className, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%", p: 4, borderRadius: borderRadius, bg: backgroundColor || 'canvas.default', border: border, boxShadow: boxShadow, children: loadingState || (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { mt: 3, color: 'fg.muted' }, children: "Initializing chat..." })] })) }));
3582
3547
  }
3583
3548
  // ---- apiBase for indicators (derived from configEndpoint) ----
3584
3549
  // Indicators (McpStatusIndicator, SandboxStatusIndicator) prepend
@@ -3645,23 +3610,16 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
3645
3610
  ...displayItems,
3646
3611
  ]
3647
3612
  : displayItems;
3648
- const messagesContent = children ? (children) : (_jsxs(Box, { sx: {
3649
- display: 'flex',
3650
- flexDirection: 'column',
3651
- minHeight: 0,
3652
- /*
3653
- A reading column, not a full-bleed sheet.
3654
-
3655
- The transcript keeps a book-page width and centres itself; on a
3656
- narrow chat column the cap never binds and nothing changes. The
3657
- rows inside carry their own horizontal padding, which becomes the
3658
- margin once the cap does bind.
3659
- */
3660
- width: '100%',
3661
- maxWidth: 920,
3662
- mx: 'auto',
3663
- bg: 'canvas.default',
3664
- }, children: [_jsx(ChatMessageList, { displayItems: welcomedItems, isLoading: isLoading, isStreaming: isStreaming, showLoadingIndicator: showLoadingIndicator, hideMessagesAfterToolUI: hideMessagesAfterToolUI, avatarConfig: defaultAvatarConfig, padding: padding, renderToolResult: effectiveRenderToolResult, approvalConfig: approvalConfig, messagesEndRef: messagesEndRef, onRespond: handleRespond, showTurnFooters: showTurnFooter, agentUsage: agentUsage, onRemoveItems: handleRemoveItems, mcpServers: filteredMcpServers, emptyContent: launching ? null : (_jsx(ChatEmptyState, { emptyState: emptyState, brandIcon: brandIcon, description: resolvedDescription, suggestions: resolvedSuggestions, submitOnSuggestionClick: submitOnSuggestionClick, onSuggestionSubmit: handleSuggestionSubmit, onSuggestionFill: handleSuggestionFill })) }), trailingContent] }));
3613
+ const messagesContent = children ? (children) : (_jsxs(Box, { display: "flex", flexDirection: "column", minHeight: 0,
3614
+ /*
3615
+ A reading column, not a full-bleed sheet.
3616
+
3617
+ The transcript keeps a book-page width and centres itself; on a
3618
+ narrow chat column the cap never binds and nothing changes. The
3619
+ rows inside carry their own horizontal padding, which becomes the
3620
+ margin once the cap does bind.
3621
+ */
3622
+ width: "100%", maxWidth: 920, mx: "auto", bg: "canvas.default", children: [_jsx(ChatMessageList, { displayItems: welcomedItems, isLoading: isLoading, isStreaming: isStreaming, showLoadingIndicator: showLoadingIndicator, hideMessagesAfterToolUI: hideMessagesAfterToolUI, avatarConfig: defaultAvatarConfig, padding: padding, renderToolResult: effectiveRenderToolResult, approvalConfig: approvalConfig, messagesEndRef: messagesEndRef, onRespond: handleRespond, showTurnFooters: showTurnFooter, agentUsage: agentUsage, onRemoveItems: handleRemoveItems, mcpServers: filteredMcpServers, emptyContent: launching ? null : (_jsx(ChatEmptyState, { emptyState: emptyState, brandIcon: brandIcon, description: resolvedDescription, suggestions: resolvedSuggestions, submitOnSuggestionClick: submitOnSuggestionClick, onSuggestionSubmit: handleSuggestionSubmit, onSuggestionFill: handleSuggestionFill })) }), trailingContent] }));
3665
3623
  // The microphone, in the composer's footer (VO-10).
3666
3624
  const voiceControl = hearing && voice ? (_jsx(VoiceInput, { hearing: hearing, language: voice.language, consentKey: voice.consentKey ?? 'chat', disabled: disabled || launching, speaking: voiceSpeaking, onStopSpeaking: onStopSpeaking, onListen: onStopSpeaking, onTranscript: (transcript) => {
3667
3625
  if (voice.sendWhatISay) {
@@ -3754,33 +3712,19 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
3754
3712
  // ========================================================================
3755
3713
  // Render
3756
3714
  // ========================================================================
3757
- return (_jsxs(Box, { className: className, sx: {
3758
- position: 'relative',
3759
- display: 'flex',
3760
- flexDirection: 'column',
3761
- height: '100%',
3762
- maxHeight: '100%',
3763
- minHeight: 0,
3764
- /*
3765
- As wide as the host, always.
3766
-
3767
- The root set its height and said nothing about width, so mounted in
3768
- a flex row — which is how the LOOP chat mounts it — it was a
3769
- shrink-to-fit item: as wide as its widest line and no wider,
3770
- anchored to the left of a row it should have filled, and re-sizing
3771
- with every streamed chunk. That is what made the person's own
3772
- bubble drift while the agent answered. A chat fills the column it
3773
- is given; the column decides the width, not the transcript.
3774
- */
3775
- flex: '1 1 auto',
3776
- width: '100%',
3777
- minWidth: 0,
3778
- bg: backgroundColor || 'canvas.default',
3779
- borderRadius,
3780
- border,
3781
- boxShadow,
3782
- overflow: 'hidden',
3783
- }, children: [!surfaceVisible && chatHeaderElement, showDetails && (
3715
+ return (_jsxs(Box, { className: className, position: "relative", display: "flex", flexDirection: "column", height: "100%", maxHeight: "100%", minHeight: 0,
3716
+ /*
3717
+ As wide as the host, always.
3718
+
3719
+ The root set its height and said nothing about width, so mounted in
3720
+ a flex row — which is how the LOOP chat mounts it — it was a
3721
+ shrink-to-fit item: as wide as its widest line and no wider,
3722
+ anchored to the left of a row it should have filled, and re-sizing
3723
+ with every streamed chunk. That is what made the person's own
3724
+ bubble drift while the agent answered. A chat fills the column it
3725
+ is given; the column decides the width, not the transcript.
3726
+ */
3727
+ flex: "1 1 auto", width: "100%", minWidth: 0, bg: backgroundColor || 'canvas.default', borderRadius: borderRadius, border: border, boxShadow: boxShadow, overflow: "hidden", children: [!surfaceVisible && chatHeaderElement, showDetails && (
3784
3728
  /*
3785
3729
  A column, not a row.
3786
3730
 
@@ -3795,43 +3739,16 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
3795
3739
  stretches across that by default. `Chat.tsx` mounts the same component
3796
3740
  the same way and has always looked right for exactly this reason.
3797
3741
  */
3798
- _jsx(Box, { sx: {
3799
- flex: '1 1 auto',
3800
- minHeight: 0,
3801
- display: 'flex',
3802
- flexDirection: 'column',
3803
- }, children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: protocol?.type ?? 'unknown', url: protocol?.endpoint || '', messageCount: displayItems.length, agentId: activeAgentId, apiBase: protocol?.configEndpoint, onBack: () => setShowDetails(false) }) })), showToolApprovalBanner &&
3742
+ _jsx(Box, { flex: "1 1 auto", minHeight: 0, display: "flex", flexDirection: "column", children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: protocol?.type ?? 'unknown', url: protocol?.endpoint || '', messageCount: displayItems.length, agentId: activeAgentId, apiBase: protocol?.configEndpoint, onBack: () => setShowDetails(false) }) })), showToolApprovalBanner &&
3804
3743
  pendingApprovals &&
3805
- pendingApprovals.length > 0 && (_jsx(ToolApprovalBannerSection, { pendingApprovals: pendingApprovals, onApprove: handleBannerApprove, onReject: handleBannerReject })), showErrors && error && (_jsxs(Box, { sx: {
3806
- display: 'flex',
3807
- alignItems: 'center',
3808
- gap: 2,
3809
- p: padding,
3810
- bg: 'danger.subtle',
3811
- borderBottom: '1px solid',
3812
- borderColor: 'danger.muted',
3813
- }, children: [_jsx(AlertIcon, { size: 16 }), _jsx(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: error.message })] })), surfaceVisible ? (_jsxs(Box, { sx: {
3814
- flex: 1,
3815
- minHeight: 0,
3816
- display: 'flex',
3817
- overflow: 'hidden',
3818
- position: 'relative',
3819
- }, children: [_jsx(Box, { sx: {
3820
- flex: 1,
3821
- minWidth: 0,
3822
- minHeight: 0,
3823
- display: 'flex',
3824
- flexDirection: 'column',
3825
- overflow: 'hidden',
3826
- ...(surfaceChatFloating
3744
+ pendingApprovals.length > 0 && (_jsx(ToolApprovalBannerSection, { pendingApprovals: pendingApprovals, onApprove: handleBannerApprove, onReject: handleBannerReject })), showErrors && error && (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, p: padding, bg: "danger.subtle", borderBottom: "1px solid", borderColor: "danger.muted", children: [_jsx(AlertIcon, { size: 16 }), _jsx(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: error.message })] })), surfaceVisible ? (_jsxs(Box, { flex: 1, minHeight: 0, display: "flex", overflow: "hidden", position: "relative", children: [_jsx(Box, { flex: 1, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column", overflow: "hidden", sx: surfaceChatFloating
3745
+ ? null
3746
+ : surfaceCollapsed
3827
3747
  ? null
3828
- : surfaceCollapsed
3829
- ? null
3830
- : {
3831
- borderRight: '1px solid',
3832
- borderColor: 'border.default',
3833
- }),
3834
- }, children: launching || overlay ? (_jsx(CompanionSurfaceSkeleton, { mode: notebookVisible ? 'notebook' : 'document' })) : notebookVisible ? (_jsx(EphemeralNotebook, { notebookId: ephemeralNotebookId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, nbformat: persistedEphemeralNbformat ?? undefined, onNbformatChange: handleEphemeralNotebookChange, toolbarComponent: ephemeralNotebookToolbar, toolbarExtraItems: notebookToolbarItems, collaborationProvider: ephemeralNotebookCollaborationProvider })) : (_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
3748
+ : {
3749
+ borderRight: '1px solid',
3750
+ borderColor: 'border.default',
3751
+ }, children: launching || overlay ? (_jsx(CompanionSurfaceSkeleton, { mode: notebookVisible ? 'notebook' : 'document' })) : notebookVisible ? (_jsx(EphemeralNotebook, { notebookId: ephemeralNotebookId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, nbformat: persistedEphemeralNbformat ?? undefined, onNbformatChange: handleEphemeralNotebookChange, toolbarComponent: ephemeralNotebookToolbar, toolbarExtraItems: notebookToolbarItems, collaborationProvider: ephemeralNotebookCollaborationProvider })) : (_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
3835
3752
  ? {
3836
3753
  position: 'absolute',
3837
3754
  right: 16,
@@ -3861,61 +3778,9 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
3861
3778
  flexDirection: 'column',
3862
3779
  overflow: 'hidden',
3863
3780
  bg: 'canvas.default',
3864
- }, children: [chatHeaderElement, _jsx(Box, { ref: messagesContainerRef, sx: {
3865
- flex: 1,
3866
- minHeight: 0,
3867
- overflow: 'auto',
3868
- bg: 'canvas.default',
3869
- }, children: messagesContent }), footerContent, inputToolbar] })), surfaceCollapsed &&
3781
+ }, children: [chatHeaderElement, _jsx(Box, { ref: messagesContainerRef, flex: 1, minHeight: 0, overflow: "auto", bg: "canvas.default", children: messagesContent }), footerContent, inputToolbar] })), surfaceCollapsed &&
3870
3782
  onExpandFromCollapsed &&
3871
- (chatViewMode === 'sidebar' ? (_jsx(Box, { sx: {
3872
- position: 'absolute',
3873
- top: 8,
3874
- right: 8,
3875
- zIndex: 6,
3876
- }, 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": "", sx: {
3877
- flex: 1,
3878
- flexGrow: 1,
3879
- minHeight: 0,
3880
- overflow: 'auto',
3881
- bg: 'canvas.default',
3882
- }, children: messagesContent }), footerContent, inputToolbar] })), showPoweredBy && _jsx(PoweredByTag, { ...poweredByProps }), overlay && (_jsxs(Box, { sx: {
3883
- position: 'absolute',
3884
- inset: 0,
3885
- zIndex: 20,
3886
- display: 'flex',
3887
- alignItems: 'center',
3888
- justifyContent: 'center',
3889
- p: 3,
3890
- overflow: 'auto',
3891
- }, children: [_jsx(Box, { "aria-hidden": true, sx: {
3892
- position: 'absolute',
3893
- inset: 0,
3894
- bg: 'canvas.default',
3895
- opacity: 0.4,
3896
- backdropFilter: 'blur(1px)',
3897
- } }), _jsx(Box, { sx: { position: 'relative', zIndex: 1, maxWidth: '100%' }, children: overlay })] })), launching && !overlay && (_jsxs(Box, { sx: {
3898
- position: 'absolute',
3899
- inset: 0,
3900
- zIndex: 15,
3901
- display: 'flex',
3902
- alignItems: 'center',
3903
- justifyContent: 'center',
3904
- p: 3,
3905
- }, children: [_jsx(Box, { "aria-hidden": true, sx: {
3906
- position: 'absolute',
3907
- inset: 0,
3908
- bg: 'canvas.default',
3909
- opacity: 0.35,
3910
- backdropFilter: 'blur(1px)',
3911
- } }), _jsxs(Box, { sx: {
3912
- position: 'relative',
3913
- zIndex: 1,
3914
- display: 'flex',
3915
- flexDirection: 'column',
3916
- alignItems: 'center',
3917
- gap: 3,
3918
- }, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: launchingMessage || 'Launching your agent…' })] })] }))] }));
3783
+ (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…' })] })] }))] }));
3919
3784
  }
3920
3785
  /**
3921
3786
  * Internal component rendering the top-of-chat approval banner + review dialog.
@@ -70,50 +70,22 @@ export function ChatEmptyState({ emptyState, brandIcon, description, suggestions
70
70
  handleSuggestionClick(suggestion);
71
71
  }
72
72
  }, children: _jsx(Truncate, { inline: true, title: suggestion.message, maxWidth: "100%", sx: { minWidth: 0 }, children: suggestion.title }) }, index))) }));
73
- return (_jsx(ThemeProvider, { children: _jsxs(Box, { sx: {
74
- display: 'flex',
75
- flexDirection: 'column',
76
- // Centred across the column, anchored to its top: the introduction
77
- // is where a conversation starts, and the first message should
78
- // appear under it rather than push it around the canvas.
79
- alignItems: 'center',
80
- justifyContent: 'flex-start',
81
- p: 4,
82
- color: 'fg.muted',
83
- textAlign: 'center',
84
- gap: 2,
85
- }, children: [sections.length > 0 ? (
73
+ return (_jsx(ThemeProvider, { children: _jsxs(Box, { display: "flex", flexDirection: "column",
74
+ // Centred across the column, anchored to its top: the introduction
75
+ // is where a conversation starts, and the first message should
76
+ // appear under it rather than push it around the canvas.
77
+ alignItems: "center", justifyContent: "flex-start", p: 4, color: "fg.muted", textAlign: "center", gap: 2, children: [sections.length > 0 ? (
86
78
  /*
87
79
  * Levels: the first at full size, the ones under it a step
88
80
  * smaller and set off by a rule — a team, then the member of it
89
81
  * being addressed, each introducing itself and offering its own
90
82
  * openers.
91
83
  */
92
- sections.map((section, level) => (_jsxs(Box, { sx: {
93
- display: 'flex',
94
- flexDirection: 'column',
95
- alignItems: 'center',
96
- gap: 2,
97
- width: '100%',
98
- ...(level > 0
99
- ? {
100
- mt: 3,
101
- pt: 3,
102
- borderTop: '1px solid',
103
- borderColor: 'border.muted',
104
- }
105
- : null),
106
- }, children: [section.icon, _jsx(Text, { sx: {
84
+ sections.map((section, level) => (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 2, width: "100%", mt: level > 0 ? 3 : undefined, pt: level > 0 ? 3 : undefined, borderTop: level > 0 ? '1px solid' : undefined, borderColor: level > 0 ? 'border.muted' : undefined, children: [section.icon, _jsx(Text, { sx: {
107
85
  fontSize: level === 0 ? 2 : 1,
108
86
  fontWeight: level === 0 ? 'normal' : 'semibold',
109
87
  }, children: section.title }), section.subtitle ? (_jsx(Text, { sx: { fontSize: level === 0 ? 1 : 0 }, children: section.subtitle })) : null, (() => {
110
88
  const own = (suggestions ?? []).filter(suggestion => suggestion.group === section.group);
111
89
  return own.length > 0 ? chips(own) : null;
112
- })()] }, section.group)))) : (_jsxs(_Fragment, { children: [emptyState?.icon || brandIcon || _jsx(AiAgentIcon, { colored: true, size: 48 }), _jsx(Text, { sx: { fontSize: 2 }, children: emptyState?.title || chatText.startConversation }), (emptyState?.subtitle || description) && (_jsx(Text, { sx: { fontSize: 1 }, children: emptyState?.subtitle || description }))] })), blocks.map(block => (_jsxs(Box, { sx: {
113
- display: 'flex',
114
- flexDirection: 'column',
115
- alignItems: 'center',
116
- gap: 1,
117
- mt: 2,
118
- }, children: [block.group ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: block.group })) : null, chips(block.items)] }, block.group ?? '')))] }) }));
90
+ })()] }, section.group)))) : (_jsxs(_Fragment, { children: [emptyState?.icon || brandIcon || _jsx(AiAgentIcon, { colored: true, size: 48 }), _jsx(Text, { sx: { fontSize: 2 }, children: emptyState?.title || chatText.startConversation }), (emptyState?.subtitle || description) && (_jsx(Text, { sx: { fontSize: 1 }, children: emptyState?.subtitle || description }))] })), blocks.map(block => (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 1, mt: 2, children: [block.group ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: block.group })) : null, chips(block.items)] }, block.group ?? '')))] }) }));
119
91
  }
@@ -11,7 +11,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  */
12
12
  import { useState } from 'react';
13
13
  import { createPortal } from 'react-dom';
14
- import { Box, IconButton, Tooltip, Text } from '@primer/react';
14
+ import { Box } from '@datalayer/primer-addons';
15
+ import { IconButton, Tooltip, Text } from '@primer/react';
15
16
  import { CommentDiscussionIcon, XIcon } from '@primer/octicons-react';
16
17
  /**
17
18
  * Floating brand button component
@@ -27,14 +28,7 @@ export function FloatingBrandButton({ isOpen, onToggle, position = 'bottom-right
27
28
  'top-left': { top: 20, left: 20 },
28
29
  };
29
30
  const posStyle = positionStyles[position];
30
- const floatingButton = (_jsx(Box, { className: className, sx: {
31
- position: 'fixed',
32
- zIndex: 1000,
33
- ...posStyle,
34
- }, children: _jsxs(Box, { sx: {
35
- position: 'relative',
36
- display: 'inline-flex',
37
- }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: tooltip, direction: "w", children: _jsx(IconButton, { icon: isOpen
31
+ const floatingButton = (_jsx(Box, { className: className, position: "fixed", zIndex: 1000, sx: posStyle, children: _jsxs(Box, { position: "relative", display: "inline-flex", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: tooltip, direction: "w", children: _jsx(IconButton, { icon: isOpen
38
32
  ? XIcon
39
33
  : icon || CommentDiscussionIcon, "aria-label": isOpen ? 'Close chat' : 'Open chat', onClick: onToggle, size: "large", sx: {
40
34
  width: 56,
@@ -49,31 +43,7 @@ export function FloatingBrandButton({ isOpen, onToggle, position = 'bottom-right
49
43
  bg: brandColor || 'accent.emphasis',
50
44
  boxShadow: 'shadow.extra-large',
51
45
  },
52
- } }) }), unreadCount > 0 && !isOpen && (_jsx(Box, { sx: {
53
- position: 'absolute',
54
- top: -4,
55
- right: -4,
56
- minWidth: 20,
57
- height: 20,
58
- px: 1,
59
- display: 'flex',
60
- alignItems: 'center',
61
- justifyContent: 'center',
62
- bg: 'danger.emphasis',
63
- color: 'fg.onEmphasis',
64
- borderRadius: '50%',
65
- fontSize: 0,
66
- fontWeight: 'bold',
67
- }, children: _jsx(Text, { sx: { fontSize: 0 }, children: unreadCount > 99 ? '99+' : unreadCount }) })), unreadCount > 0 && !isOpen && (_jsx(Box, { sx: {
68
- position: 'absolute',
69
- top: 0,
70
- left: 0,
71
- right: 0,
72
- bottom: 0,
73
- borderRadius: '50%',
74
- border: '2px solid',
75
- borderColor: 'accent.emphasis',
76
- animation: 'pulse 2s infinite',
46
+ } }) }), unreadCount > 0 && !isOpen && (_jsx(Box, { position: "absolute", top: -4, right: -4, minWidth: 20, height: 20, px: 1, display: "flex", alignItems: "center", justifyContent: "center", bg: "danger.emphasis", color: "fg.onEmphasis", borderRadius: "50%", fontSize: 0, fontWeight: "bold", children: _jsx(Text, { sx: { fontSize: 0 }, children: unreadCount > 99 ? '99+' : unreadCount }) })), unreadCount > 0 && !isOpen && (_jsx(Box, { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, borderRadius: "50%", border: "2px solid", borderColor: "accent.emphasis", animation: "pulse 2s infinite", sx: {
77
47
  '@keyframes pulse': {
78
48
  '0%': {
79
49
  transform: 'scale(1)',
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Link } from '@primer/react';
2
+ import { Box } from '@datalayer/primer-addons';
3
+ import { Link } from '@primer/react';
3
4
  /**
4
5
  * PoweredBy tag component
5
6
  * Displays a "Powered by X" branding tag
@@ -8,19 +9,7 @@ export function PoweredByTag({ show = true, brandName = 'Datalayer', brandUrl =
8
9
  if (!show) {
9
10
  return null;
10
11
  }
11
- return (_jsxs(Box, { sx: {
12
- display: 'flex',
13
- alignItems: 'center',
14
- justifyContent: 'center',
15
- gap: 1,
16
- py: 2,
17
- px: 3,
18
- fontSize: 0,
19
- color: 'fg.muted',
20
- borderTop: '1px solid',
21
- borderColor: 'border.default',
22
- bg: 'canvas.subtle',
23
- }, children: [brandIcon && (_jsx(Box, { sx: { display: 'flex', alignItems: 'center' }, children: brandIcon })), _jsx("span", { children: "Powered by" }), _jsx(Link, { href: brandUrl, target: "_blank", rel: "noopener noreferrer", sx: {
12
+ return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", gap: 1, py: 2, px: 3, fontSize: 0, color: "fg.muted", borderTop: "1px solid", borderColor: "border.default", bg: "canvas.subtle", children: [brandIcon && (_jsx(Box, { display: "flex", alignItems: "center", children: brandIcon })), _jsx("span", { children: "Powered by" }), _jsx(Link, { href: brandUrl, target: "_blank", rel: "noopener noreferrer", sx: {
24
13
  color: 'fg.muted',
25
14
  fontWeight: 'semibold',
26
15
  textDecoration: 'none',
@@ -37,8 +37,7 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
37
37
  import { AutoFocusExtension, getExtensionDependencyFromEditor, } from '@lexical/extension';
38
38
  import { HistoryExtension } from '@lexical/history';
39
39
  import { ServerConnection, ServiceManager } from '@jupyterlab/services';
40
- import { DatalayerThemeProvider, getThemeConfig, useSystemColorMode, useThemeStore, } from '@datalayer/primer-addons';
41
- import { Box } from '@primer/react';
40
+ import { Box, DatalayerThemeProvider, getThemeConfig, useSystemColorMode, useThemeStore, } from '@datalayer/primer-addons';
42
41
  import { JupyterReactTheme, Kernel, disposeServiceManager, } from '@datalayer/jupyter-react';
43
42
  import { ComponentPickerMenuPlugin, JupyterLexicalExtension, JupyterInputOutputPlugin, DraggableBlockPlugin, TableCellResizerPlugin, TableActionMenuPlugin, TableHoverActionsV2Plugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ToolbarPlugin, ToolbarContext, CommentsProvider, DocumentSkeleton, commentTheme, } from '@datalayer/jupyter-lexical';
44
43
  import { createWebsocketProvider, LoroCollaborationPlugin, } from '@datalayer/lexical-loro';
@@ -385,14 +384,7 @@ export function EphemeralDocument({ documentId, runtimeName, runtimeOverride, se
385
384
  ? themeConfig.themeStyles.dark
386
385
  : themeConfig.themeStyles.light;
387
386
  const themeBackground = modeStyles.backgroundColor ?? '';
388
- return (_jsx(Box, { sx: {
389
- flex: 1,
390
- minHeight: 0,
391
- height: '100%',
392
- position: 'relative',
393
- overflow: 'hidden',
394
- bg: 'canvas.default',
395
- }, children: activeServiceManager ? (_jsx(ThemeRoot, { inherit: inheritTheme, colorMode: effectiveColorMode, themeConfig: themeConfig, children: _jsx(JupyterReactTheme, { colormode: resolvedMode, backgroundColor: themeBackground, children: _jsx(Box, { sx: {
387
+ return (_jsx(Box, { flex: 1, minHeight: 0, height: "100%", position: "relative", overflow: "hidden", bg: "canvas.default", children: activeServiceManager ? (_jsx(ThemeRoot, { inherit: inheritTheme, colorMode: effectiveColorMode, themeConfig: themeConfig, children: _jsx(JupyterReactTheme, { colormode: resolvedMode, backgroundColor: themeBackground, children: _jsx(Box, { sx: {
396
388
  position: 'absolute',
397
389
  inset: 0,
398
390
  display: 'flex',
@@ -486,13 +478,6 @@ export function EphemeralDocument({ documentId, runtimeName, runtimeOverride, se
486
478
  }, children: _jsx(LexicalConfigProvider, { lexicalId: documentId, serviceManager: activeServiceManager, children: _jsx(LexicalExtensionComposer, { extension: extension, contentEditable: null, children: _jsx(CommentsProvider, { children: _jsx(ToolbarContext, { children: _jsxs("div", { className: "editor-shell", children: [showToolbar ? (_jsx(DocumentToolbar, { setIsLinkEditMode: setIsLinkEditMode, extraItems: toolbarExtraItems })) : null, _jsx("div", { className: "editor-container", children: _jsxs("div", { className: "editor-inner", children: [isCollaborative && collaboration ? (_jsx(LoroCollaborationPlugin, { id: collaboration.roomId, providerFactory: createWebsocketProvider, websocketUrl: collaboration.websocketUrl, shouldBootstrap: true, showCollaborators: true, username: collaborationName, cursorColor: collaborationColor, awarenessData: collaborationAwarenessData, onInitialization: onRoomInitialization })) : null, _jsx(LexicalStatePlugin, {}), documentReady ? (_jsx("div", { className: "editor-scroller", children: _jsx("div", { className: "editor", ref: onAnchorRef, children: _jsx(ContentEditable, { className: "editor-input", "aria-label": "Ephemeral document editor" }) }) })) : (_jsx(DocumentSkeleton, { maxWidth: "100%" })), !isCollaborative && (_jsx(OnChangePlugin, { onChange: handleChange })), _jsx(HistoryTogglePlugin, { disabled: isCollaborative }), !isCollaborative && (_jsx(LoadContentPlugin, { content: initialContent })), _jsx(TableCellResizerPlugin, {}), _jsx(TableActionMenuPlugin, {}), _jsx(TableHoverActionsV2Plugin, {}), _jsx(ComponentPickerMenuPlugin, { kernel: documentKernel }), _jsx(JupyterInputOutputPlugin, { kernel: documentKernel }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) })] }) }) }) }) }) }) }) })) : isRuntimeStarting ? (
487
479
  // The document's shape while its runtime starts, where the document
488
480
  // will be — not a wheel, which says nothing about what is coming.
489
- _jsx(ThemeRoot, { inherit: inheritTheme, colorMode: effectiveColorMode, themeConfig: themeConfig, children: _jsx(Box, { sx: {
490
- position: 'absolute',
491
- inset: 0,
492
- display: 'flex',
493
- flexDirection: 'column',
494
- padding: 2,
495
- backgroundColor: themeBackground,
496
- }, children: _jsx(DocumentSkeleton, { label: "Starting the document", maxWidth: "100%" }) }) })) : null }));
481
+ _jsx(ThemeRoot, { inherit: inheritTheme, colorMode: effectiveColorMode, themeConfig: themeConfig, children: _jsx(Box, { position: "absolute", inset: 0, display: "flex", flexDirection: "column", padding: 2, backgroundColor: themeBackground, children: _jsx(DocumentSkeleton, { label: "Starting the document", maxWidth: "100%" }) }) })) : null }));
497
482
  }
498
483
  export default EphemeralDocument;
@@ -47,23 +47,7 @@ export function ChatHeader({ title, description, connectionState, runtimeBusy =
47
47
  disconnected: 'Disconnected',
48
48
  error: 'Connection Error',
49
49
  };
50
- return (_jsx(Box, { sx: {
51
- display: 'flex',
52
- alignItems: 'center',
53
- justifyContent: 'flex-end',
54
- p: 3,
55
- borderBottom: '1px solid',
56
- borderColor: 'border.default',
57
- backgroundColor: 'canvas.subtle',
58
- }, children: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsxs(Box, { sx: {
59
- display: 'flex',
60
- alignItems: 'center',
61
- gap: 2,
62
- fontSize: 0,
63
- }, children: [_jsx(Box, { sx: {
64
- display: 'inline-flex',
65
- alignItems: 'center',
66
- }, children: _jsx(KernelIndicator, { state: indicatorState }) }), _jsx(Text, { sx: { color: statusColor }, children: labels[connectionState] }), (connectionState === 'disconnected' ||
50
+ return (_jsx(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end", p: 3, borderBottom: "1px solid", borderColor: "border.default", backgroundColor: "canvas.subtle", children: _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, fontSize: 0, children: [_jsx(Box, { display: "inline-flex", alignItems: "center", children: _jsx(KernelIndicator, { state: indicatorState }) }), _jsx(Text, { sx: { color: statusColor }, children: labels[connectionState] }), (connectionState === 'disconnected' ||
67
51
  connectionState === 'error') &&
68
52
  onReconnect && (_jsx(IconButton, { icon: SyncIcon, "aria-label": "Reconnect", size: "small", variant: "invisible", onClick: onReconnect }))] }), onDisconnect && connectionState === 'connected' && (_jsx(Button, { variant: "invisible", size: "small", onClick: onDisconnect, children: "Disconnect" })), onLogout && (_jsx(IconButton, { icon: SignOutIcon, "aria-label": "Logout", size: "small", variant: "invisible", onClick: onLogout })), onCollapsePanel && (_jsx(IconButton, { icon: SidebarCollapseIcon, "aria-label": "Collapse panel", size: "small", variant: "invisible", onClick: onCollapsePanel }))] }) }));
69
53
  }
@@ -48,29 +48,7 @@ export function ChatBaseHeader({ title, subtitle, disableReason, brandIcon, head
48
48
  * honest rendering of silence is nothing at all.
49
49
  */
50
50
  const kernelIndicatorElement = kernel ? (_jsx(KernelIndicator, { kernel: kernel, environmentName: kernelEnvironmentName, cpu: kernelCpu, memory: kernelMemory, gpu: kernelGpu, position: "s", bordered: false })) : effectiveIndicatorState ? (_jsx(KernelIndicator, { state: effectiveIndicatorState, environmentName: kernelEnvironmentName, cpu: kernelCpu, memory: kernelMemory, gpu: kernelGpu, position: "s", bordered: false })) : null;
51
- return (_jsx(Box, { sx: {
52
- display: 'flex',
53
- flexDirection: 'column',
54
- bg: 'canvas.default',
55
- borderBottom: '1px solid',
56
- borderColor: 'border.default',
57
- }, children: _jsxs(Box, { sx: {
58
- display: 'flex',
59
- alignItems: 'center',
60
- justifyContent: 'space-between',
61
- p: padding,
62
- }, children: [_jsxs(Box, { sx: {
63
- display: 'flex',
64
- alignItems: 'center',
65
- gap: 2,
66
- minWidth: 0,
67
- flex: '1 1 auto',
68
- }, children: [kernelIndicatorPlacement === 'left' && kernelIndicatorElement, brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), (title || subtitle) && (_jsxs(Box, { sx: {
69
- display: 'flex',
70
- flexDirection: 'column',
71
- minWidth: 0,
72
- maxWidth: '100%',
73
- }, children: [title && (_jsx(Heading, { as: "h3", sx: {
51
+ return (_jsx(Box, { display: "flex", flexDirection: "column", bg: "canvas.default", borderBottom: "1px solid", borderColor: "border.default", children: _jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", p: padding, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, minWidth: 0, flex: "1 1 auto", children: [kernelIndicatorPlacement === 'left' && kernelIndicatorElement, brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), (title || subtitle) && (_jsxs(Box, { display: "flex", flexDirection: "column", minWidth: 0, maxWidth: "100%", children: [title && (_jsx(Heading, { as: "h3", sx: {
74
52
  fontSize: 2,
75
53
  fontWeight: 'semibold',
76
54
  minWidth: 0,
@@ -80,5 +58,5 @@ export function ChatBaseHeader({ title, subtitle, disableReason, brandIcon, head
80
58
  color: 'fg.muted',
81
59
  minWidth: 0,
82
60
  maxWidth: '100%',
83
- }, children: _jsx(Truncate, { title: subtitle, maxWidth: "40ch", children: subtitle }) }))] })), disableReason && (_jsx(Label, { variant: "attention", sx: { flexShrink: 0 }, children: disableReason })), headerContent, showInformation && (_jsx(IconButton, { icon: InfoIcon, "aria-label": "Information", variant: "invisible", size: "small", onClick: onInformationClick })), kernelIndicatorPlacement === 'center' && kernelIndicatorElement] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, flexShrink: 0 }, children: [kernelIndicatorPlacement === 'right' && kernelIndicatorElement, headerButtons?.showNewChat && (_jsx(IconButton, { icon: PlusIcon, "aria-label": "New chat", variant: "invisible", size: "small", onClick: onNewChat })), headerButtons?.showClear && messageCount > 0 && (_jsx(IconButton, { icon: TrashIcon, "aria-label": "Clear messages", variant: "invisible", size: "small", onClick: onClear })), headerButtons?.showSettings && (_jsx(IconButton, { icon: GearIcon, "aria-label": "Settings", variant: "invisible", size: "small", onClick: headerButtons.onSettings })), showEphemeralSurfaceControl && (_jsx(EphemeralSurfaceControl, { mode: ephemeralSurfaceMode, onChange: onEphemeralSurfaceModeChange, enableNotebook: enableEphemeralNotebookOption, enableDocument: enableEphemeralDocumentOption })), chatViewMode && onChatViewModeChange && (_jsx(ChatViewModeToggle, { value: chatViewMode, onChange: onChatViewModeChange, disabledModes: disabledViewModes })), headerActions] })] }) }));
61
+ }, children: _jsx(Truncate, { title: subtitle, maxWidth: "40ch", children: subtitle }) }))] })), disableReason && (_jsx(Label, { variant: "attention", sx: { flexShrink: 0 }, children: disableReason })), headerContent, showInformation && (_jsx(IconButton, { icon: InfoIcon, "aria-label": "Information", variant: "invisible", size: "small", onClick: onInformationClick })), kernelIndicatorPlacement === 'center' && kernelIndicatorElement] }), _jsxs(Box, { display: "flex", alignItems: "center", gap: 1, flexShrink: 0, children: [kernelIndicatorPlacement === 'right' && kernelIndicatorElement, headerButtons?.showNewChat && (_jsx(IconButton, { icon: PlusIcon, "aria-label": "New chat", variant: "invisible", size: "small", onClick: onNewChat })), headerButtons?.showClear && messageCount > 0 && (_jsx(IconButton, { icon: TrashIcon, "aria-label": "Clear messages", variant: "invisible", size: "small", onClick: onClear })), headerButtons?.showSettings && (_jsx(IconButton, { icon: GearIcon, "aria-label": "Settings", variant: "invisible", size: "small", onClick: headerButtons.onSettings })), showEphemeralSurfaceControl && (_jsx(EphemeralSurfaceControl, { mode: ephemeralSurfaceMode, onChange: onEphemeralSurfaceModeChange, enableNotebook: enableEphemeralNotebookOption, enableDocument: enableEphemeralDocumentOption })), chatViewMode && onChatViewModeChange && (_jsx(ChatViewModeToggle, { value: chatViewMode, onChange: onChatViewModeChange, disabledModes: disabledViewModes })), headerActions] })] }) }));
84
62
  }
@@ -12,14 +12,7 @@ export const VIEW_MODE_ICONS = {
12
12
  sidebar: SidebarExpandIcon,
13
13
  };
14
14
  export function ChatViewModeToggle({ value, onChange, disabledModes = [], tooltipDirection = 'n', }) {
15
- return (_jsx(Box, { role: "group", "aria-label": "Display mode", "data-chat-view-mode-toggle": "", sx: {
16
- display: 'inline-flex',
17
- alignItems: 'center',
18
- bg: 'neutral.muted',
19
- borderRadius: '6px',
20
- p: '2px',
21
- gap: '1px',
22
- }, children: CHAT_VIEW_MODES.map(({ mode, label }) => {
15
+ return (_jsx(Box, { role: "group", "aria-label": "Display mode", "data-chat-view-mode-toggle": "", display: "inline-flex", alignItems: "center", bg: "neutral.muted", borderRadius: "6px", p: "2px", gap: "1px", children: CHAT_VIEW_MODES.map(({ mode, label }) => {
23
16
  const ModeIcon = VIEW_MODE_ICONS[mode];
24
17
  const selected = value === mode;
25
18
  /* Greyed rather than left out: the person sees the mode exists, and
@@ -33,26 +26,11 @@ export function ChatViewModeToggle({ value, onChange, disabledModes = [], toolti
33
26
  if (!disabled) {
34
27
  onChange(mode);
35
28
  }
36
- }, sx: {
37
- display: 'inline-flex',
38
- alignItems: 'center',
39
- justifyContent: 'center',
40
- width: 26,
41
- height: 24,
42
- borderRadius: '4px',
43
- border: 'none',
44
- cursor: disabled ? 'not-allowed' : 'pointer',
45
- opacity: disabled ? 0.45 : 1,
46
- bg: selected ? 'canvas.default' : 'transparent',
47
- boxShadow: selected ? 'shadow.small' : 'none',
48
- color: selected ? 'fg.default' : 'fg.muted',
49
- transition: 'all 0.15s ease',
50
- '&:hover': disabled
51
- ? {}
52
- : {
53
- color: 'fg.default',
54
- bg: selected ? 'canvas.default' : 'neutral.subtle',
55
- },
56
- }, children: _jsx(ModeIcon, { size: 14 }) }) }, mode));
29
+ }, display: "inline-flex", alignItems: "center", justifyContent: "center", width: 26, height: 24, borderRadius: "4px", border: "none", cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.45 : 1, bg: selected ? 'canvas.default' : 'transparent', boxShadow: selected ? 'shadow.small' : 'none', color: selected ? 'fg.default' : 'fg.muted', transition: "all 0.15s ease", hover: disabled
30
+ ? {}
31
+ : {
32
+ color: 'fg.default',
33
+ bg: selected ? 'canvas.default' : 'neutral.subtle',
34
+ }, children: _jsx(ModeIcon, { size: 14 }) }) }, mode));
57
35
  }) }));
58
36
  }
@@ -94,17 +94,8 @@ export function McpStatusIndicator({ data: wsData, apiBase, authToken, }) {
94
94
  background: 'none',
95
95
  cursor: 'default',
96
96
  lineHeight: 0,
97
- }, children: _jsx(Box, { as: "span", sx: {
98
- display: 'inline-block',
99
- width: 12,
100
- height: 12,
101
- borderRadius: '50%',
102
- bg: MCP_STATUS_COLORS[aggregate],
103
- flexShrink: 0,
104
- ...(aggregate === 'starting' && {
105
- animation: 'mcp-pulse 1.5s ease-in-out infinite',
106
- }),
107
- '@media (prefers-reduced-motion: reduce)': { animation: 'none' },
108
- } }) }) }));
97
+ }, children: _jsx(Box, { as: "span", display: "inline-block", width: 12, height: 12, borderRadius: "50%", bg: MCP_STATUS_COLORS[aggregate], flexShrink: 0, animation: aggregate === 'starting'
98
+ ? 'mcp-pulse 1.5s ease-in-out infinite'
99
+ : undefined, reducedMotion: { animation: 'none' } }) }) }));
109
100
  }
110
101
  export default McpStatusIndicator;