@datalayer/agent-runtimes 1.3.89 → 1.3.90

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 (257) 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/components/a2ui/datalayer/Chart.js +4 -10
  69. package/lib/components/a2ui/datalayer/Chat.js +2 -10
  70. package/lib/components/a2ui/datalayer/Download.js +1 -1
  71. package/lib/components/a2ui/datalayer/Evidence.js +1 -15
  72. package/lib/components/a2ui/datalayer/FileUpload.js +1 -12
  73. package/lib/components/a2ui/datalayer/Table.js +9 -17
  74. package/lib/components/a2ui/datalayer/formWidgets.js +3 -2
  75. package/lib/components/a2ui/datalayer/parts.js +1 -16
  76. package/lib/components/agents/AgentSummary.js +1 -51
  77. package/lib/components/cards/NotificationEventCard.js +6 -72
  78. package/lib/components/cards/OutputCard.js +4 -48
  79. package/lib/components/cards/ToolApprovalCard.js +2 -35
  80. package/lib/components/code-sandboxes/CodeSandboxCellVariables.js +1 -1
  81. package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +4 -14
  82. package/lib/components/code-sandboxes/CodeSandboxPicker.js +16 -21
  83. package/lib/components/code-sandboxes/CodeSandboxVariables.js +2 -2
  84. package/lib/components/scheduler/ScheduleMenu.js +5 -10
  85. package/lib/components/specs/SpecPayloadPreview.js +1 -26
  86. package/lib/components/teams/A2ATeamGraph.d.ts +4 -3
  87. package/lib/components/teams/A2ATeamGraph.js +25 -71
  88. package/lib/components/teams/AnswerSurfacesView.js +2 -2
  89. package/lib/components/teams/NotebookPreview.js +1 -10
  90. package/lib/components/teams/NotebookPreviewView.js +2 -3
  91. package/lib/components/teams/SceneTranscript.js +3 -17
  92. package/lib/components/teams/SceneView.js +1 -8
  93. package/lib/components/teams/TeamNotebook.js +5 -13
  94. package/lib/components/teams/TeamNotebookView.js +2 -12
  95. package/lib/components/teams/index.d.ts +1 -0
  96. package/lib/components/teams/index.js +1 -0
  97. package/lib/components/teams/useBalloonRoom.d.ts +39 -0
  98. package/lib/components/teams/useBalloonRoom.js +89 -0
  99. package/lib/config/AgentConfiguration.js +22 -225
  100. package/lib/context/ContextDistribution.js +7 -41
  101. package/lib/context/ContextInspector.js +9 -107
  102. package/lib/context/ContextPanel.js +11 -86
  103. package/lib/context/ContextUsage.js +6 -34
  104. package/lib/context/CostTracker.js +7 -42
  105. package/lib/context/MessageHistory.js +3 -37
  106. package/lib/context/TurnGraphChart.js +9 -41
  107. package/lib/examples/A2UiAgentExample.js +6 -108
  108. package/lib/examples/A2UiComponentsGalleryExample.js +1 -1
  109. package/lib/examples/A2UiContactCardExample.js +1 -1
  110. package/lib/examples/A2UiJupyterOutputExample.js +25 -125
  111. package/lib/examples/A2UiRestaurantExample.js +1 -1
  112. package/lib/examples/A2UiViewerExample.js +1 -1
  113. package/lib/examples/AgUiAgenticExample.js +3 -35
  114. package/lib/examples/AgUiBackendToolRenderingExample.js +2 -25
  115. package/lib/examples/AgUiHaikuGenUiExample.js +2 -32
  116. package/lib/examples/AgUiHumanInTheLoopExample.js +5 -59
  117. package/lib/examples/AgUiSharedStateExample.js +6 -56
  118. package/lib/examples/AgUiToolsBasedGenUiExample.js +25 -120
  119. package/lib/examples/AgentA2AExample.js +1 -15
  120. package/lib/examples/AgentA2ATeamExample.js +6 -30
  121. package/lib/examples/AgentCheckpointsExample.js +11 -145
  122. package/lib/examples/AgentCodeSandboxExample.js +5 -108
  123. package/lib/examples/AgentCodeSandboxesExample.js +3 -30
  124. package/lib/examples/AgentCodemodeExample.js +9 -85
  125. package/lib/examples/AgentCompactionExample.js +3 -64
  126. package/lib/examples/AgentDecideExample.js +1 -13
  127. package/lib/examples/AgentEvalsExample.js +5 -60
  128. package/lib/examples/AgentGuardrailsExample.js +4 -28
  129. package/lib/examples/AgentHooksExample.js +1 -1
  130. package/lib/examples/AgentInferenceProviderExample.js +5 -96
  131. package/lib/examples/AgentMCPExample.js +7 -105
  132. package/lib/examples/AgentMemoryExample.js +5 -74
  133. package/lib/examples/AgentMonitoringExample.js +7 -53
  134. package/lib/examples/AgentNotificationsExample.js +3 -61
  135. package/lib/examples/AgentOtelExample.js +3 -72
  136. package/lib/examples/AgentOutputsExample.js +6 -81
  137. package/lib/examples/AgentParametersExample.js +2 -37
  138. package/lib/examples/AgentSkillsExample.js +3 -45
  139. package/lib/examples/AgentSubagentsExample.js +6 -56
  140. package/lib/examples/AgentToolApprovalsExample.js +1 -11
  141. package/lib/examples/AgentTriggersExample.js +29 -239
  142. package/lib/examples/AgentspecsExample.js +6 -60
  143. package/lib/examples/AssistantExample.js +5 -5
  144. package/lib/examples/AssistantGalleryExample.js +8 -65
  145. package/lib/examples/CellExample.js +1 -6
  146. package/lib/examples/ChatCustomExample.js +2 -31
  147. package/lib/examples/ChatExample.js +1 -9
  148. package/lib/examples/ChatStandaloneExample.js +3 -37
  149. package/lib/examples/CopilotKitLexicalExample.js +1 -24
  150. package/lib/examples/DecksAgent.js +1 -1
  151. package/lib/examples/DocumentPageAgent.js +1 -1
  152. package/lib/examples/HomeExample.js +14 -62
  153. package/lib/examples/Lexical2Example.js +3 -32
  154. package/lib/examples/LexicalAgentExample.js +2 -34
  155. package/lib/examples/LexicalAgentSidebarExample.js +3 -34
  156. package/lib/examples/LoopAppComputerExample.js +1 -1
  157. package/lib/examples/LoopShellExample.js +2 -2
  158. package/lib/examples/LoopStrategyExample.js +15 -87
  159. package/lib/examples/LoopWorkspaceEmbed.js +2 -18
  160. package/lib/examples/LoopWorkspaceExample.js +2 -2
  161. package/lib/examples/NotebookAgentExample.js +2 -33
  162. package/lib/examples/NotebookAgentSidebarExample.js +3 -46
  163. package/lib/examples/NotebookCollaborationExample.js +1 -31
  164. package/lib/examples/NotebookExample.js +1 -18
  165. package/lib/examples/NotebookPageAgent.js +1 -1
  166. package/lib/examples/ScenesExample.js +5 -24
  167. package/lib/examples/VoiceChatExample.js +1 -1
  168. package/lib/examples/components/AuthRequiredView.js +1 -7
  169. package/lib/examples/components/ErrorView.js +1 -8
  170. package/lib/examples/components/ExampleErrorBoundary.js +1 -14
  171. package/lib/examples/components/FooterMetrics.js +1 -7
  172. package/lib/examples/components/Header.js +12 -51
  173. package/lib/examples/components/HeaderControls.js +1 -9
  174. package/lib/examples/components/LexicalEditor.js +1 -8
  175. package/lib/examples/components/MainContent.js +1 -13
  176. package/lib/examples/components/MockFileBrowser.js +4 -40
  177. package/lib/examples/components/SessionTabs.js +1 -1
  178. package/lib/examples/components/TimeTravel.js +1 -13
  179. package/lib/examples/main.js +13 -81
  180. package/lib/examples/scenes/A2UiComponentsGalleryScene.js +3 -34
  181. package/lib/examples/scenes/A2UiContactCardScene.js +3 -35
  182. package/lib/examples/scenes/A2UiRestaurantScene.js +3 -53
  183. package/lib/examples/scenes/A2UiViewerScene.js +3 -34
  184. package/lib/examples/utils/AssistantGalleryGrid.js +6 -35
  185. package/lib/examples2/DatalayerNotebookExample.js +3 -33
  186. package/lib/examples2/NativeNavigationExample.js +4 -10
  187. package/lib/examples2/NotebookMutationsKernel.js +2 -1
  188. package/lib/examples2/NotebookMutationsServiceManager.js +2 -1
  189. package/lib/examples2/ReactRouterExample.js +14 -42
  190. package/lib/hooks/useToolApprovals.d.ts +2 -34
  191. package/lib/hooks/useToolApprovals.js +1 -64
  192. package/lib/identity/AgentIdentity.js +17 -62
  193. package/lib/identity/IdentityConnect.js +13 -59
  194. package/lib/identity/OAuthCallback.js +6 -44
  195. package/lib/lexical/ChatInlinePlugin.js +6 -14
  196. package/lib/loop/apps/AppRenderer.d.ts +4 -3
  197. package/lib/loop/apps/AppRenderer.js +11 -12
  198. package/lib/loop/apps/appspec.js +6 -3
  199. package/lib/loop/embed/AppEmbed.d.ts +1 -1
  200. package/lib/loop/embed/AppEmbed.js +2 -1
  201. package/lib/loop/embed/LoopEmbed.js +1 -7
  202. package/lib/loop/embed/embedConfig.d.ts +3 -3
  203. package/lib/loop/embed/embedConfig.js +2 -3
  204. package/lib/loop/embed/embedTheme.d.ts +4 -4
  205. package/lib/loop/embed/embedTheme.js +11 -7
  206. package/lib/loop/plugins/a2a-sidebar/A2ASidebar.js +7 -34
  207. package/lib/loop/plugins/a2ui/A2uiView.js +4 -12
  208. package/lib/loop/plugins/a2ui-surface/InlineSurface.js +1 -16
  209. package/lib/loop/plugins/a2ui-surface/SurfaceToolResult.js +2 -12
  210. package/lib/loop/plugins/agents/AnonymousKeyBadge.js +3 -2
  211. package/lib/loop/plugins/agents/SandboxSelector.js +3 -7
  212. package/lib/loop/plugins/agents/SandboxView.js +4 -27
  213. package/lib/loop/plugins/agents/TeamMemberPicker.js +2 -2
  214. package/lib/loop/plugins/agentspecs/AgentspecPicker.js +3 -2
  215. package/lib/loop/plugins/app-activity/AppActivity.js +1 -1
  216. package/lib/loop/plugins/app-computer/AppComputer.js +5 -21
  217. package/lib/loop/plugins/app-elements/AppElements.js +2 -31
  218. package/lib/loop/plugins/app-page/AppPage.js +1 -1
  219. package/lib/loop/plugins/app-rules/AppRulesCard.js +4 -20
  220. package/lib/loop/plugins/assistant/index.js +1 -13
  221. package/lib/loop/plugins/chat/ChatView.js +40 -106
  222. package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.js +2 -13
  223. package/lib/loop/plugins/decks/DeckSurface.js +2 -2
  224. package/lib/loop/plugins/document/DocumentView.js +4 -12
  225. package/lib/loop/plugins/document-toolbar/SandboxStatusItem.js +3 -8
  226. package/lib/loop/plugins/graph/GraphView.js +2 -2
  227. package/lib/loop/plugins/input-prompt/ComposerView.js +1 -1
  228. package/lib/loop/plugins/notebook/NotebookView.js +3 -11
  229. package/lib/loop/plugins/page-layout/SplitLayout.js +11 -34
  230. package/lib/loop/plugins/page-layout/TurnPanel.js +9 -35
  231. package/lib/loop/plugins/shell/useEditorPreviews.js +3 -2
  232. package/lib/loop/plugins/subagent-activity/SubagentPulse.js +1 -13
  233. package/lib/loop/plugins/window-frame/WindowFrame.js +10 -44
  234. package/lib/loop/plugins/window-frame/index.js +1 -1
  235. package/lib/loop/shell/LoopWorkspace.js +34 -77
  236. package/lib/loop/shell/PluginToggles.js +4 -15
  237. package/lib/loop/shell/SidebarRail.js +8 -40
  238. package/lib/loop/shell/ViewSwitcher.js +4 -24
  239. package/lib/loop-main.js +2 -3
  240. package/lib/mcp/McpServerManager.js +6 -37
  241. package/lib/portable/index.d.ts +11 -0
  242. package/lib/portable/index.js +20 -0
  243. package/lib/protocols/AGUIAdapter.js +2 -2
  244. package/lib/protocols/BaseProtocolAdapter.d.ts +2 -0
  245. package/lib/protocols/BaseProtocolAdapter.js +4 -0
  246. package/lib/specs/apps.js +6 -0
  247. package/lib/specs/appspecSchema.js +11 -4
  248. package/lib/stories/loop/ReferenceScreens.js +17 -91
  249. package/lib/stories/loop/pictures-main.js +1 -1
  250. package/lib/types/agentspecs.d.ts +5 -2
  251. package/lib/types/protocol.d.ts +2 -0
  252. package/lib/utils/approvals.d.ts +59 -0
  253. package/lib/utils/approvals.js +101 -0
  254. package/lib/voice/VoiceInput.js +3 -39
  255. package/package.json +2 -2
  256. package/lib/shims/primerAddonsBox.d.ts +0 -1
  257. package/lib/shims/primerAddonsBox.js +0 -7
package/lib/chat/Chat.js CHANGED
@@ -320,56 +320,17 @@ export function Chat({ protocol: transport, extensions: _extensions, baseUrl = '
320
320
  const avatarConfig = useMemo(() => ({ showAvatars: true }), []);
321
321
  // Render error state
322
322
  if (error) {
323
- return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
324
- display: 'flex',
325
- flexDirection: 'column',
326
- alignItems: 'center',
327
- justifyContent: 'center',
328
- height,
329
- p: 4,
330
- bg: 'canvas.default',
331
- }, children: [_jsx(AlertIcon, { size: 48 }), _jsx(Text, { sx: { mt: 3, color: 'danger.fg', fontSize: 2 }, children: "Connection Error" }), _jsx(Text, { sx: { mt: 1, color: 'fg.muted', fontSize: 1 }, children: error }), _jsx(Button, { variant: "primary", sx: { mt: 3 }, leadingVisual: SyncIcon, onClick: handleReconnect, children: "Retry" })] }) }) }));
323
+ return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: height, p: 4, bg: "canvas.default", children: [_jsx(AlertIcon, { size: 48 }), _jsx(Text, { sx: { mt: 3, color: 'danger.fg', fontSize: 2 }, children: "Connection Error" }), _jsx(Text, { sx: { mt: 1, color: 'fg.muted', fontSize: 1 }, children: error }), _jsx(Button, { variant: "primary", sx: { mt: 3 }, leadingVisual: SyncIcon, onClick: handleReconnect, children: "Retry" })] }) }) }));
332
324
  }
333
325
  // Render loading state
334
326
  if (isInitializing || !protocolConfig) {
335
- return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
336
- display: 'flex',
337
- flexDirection: 'column',
338
- alignItems: 'center',
339
- justifyContent: 'center',
340
- height,
341
- p: 4,
342
- bg: 'canvas.default',
343
- }, children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { mt: 3, color: 'fg.muted' }, children: ["Connecting to ", transportName.toUpperCase().replace('-', ' '), ' ', "agent..."] })] }) }) }));
327
+ return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: height, p: 4, bg: "canvas.default", children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { mt: 3, color: 'fg.muted' }, children: ["Connecting to ", transportName.toUpperCase().replace('-', ' '), ' ', "agent..."] })] }) }) }));
344
328
  }
345
- return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
346
- position: 'relative',
347
- height,
348
- bg: 'canvas.default',
349
- display: 'flex',
350
- flexDirection: 'column',
351
- }, children: [_jsx(Box, { sx: {
352
- display: showDetails ? 'flex' : 'none',
353
- flexDirection: 'column',
354
- height: '100%',
355
- }, children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: transportName, url: protocolConfig?.endpoint || baseUrl, messageCount: messageCount, agentId: agentId, apiBase: baseUrl, identityProviders: identityProviders, onIdentityConnect: onIdentityConnect, onIdentityDisconnect: onIdentityDisconnect, onBack: handleBackFromDetails, mcpStatusData: mcpStatusData, codemodeStatusData: codemodeStatusData }) }), _jsxs(Box, { sx: {
356
- display: showDetails ? 'none' : 'flex',
357
- flexDirection: 'column',
358
- height: '100%',
359
- }, children: [errorBanner && (_jsxs(Box, { sx: {
360
- display: 'flex',
361
- alignItems: 'center',
362
- gap: 2,
363
- px: 3,
364
- py: 2,
365
- bg: errorBanner.variant === 'warning'
366
- ? 'attention.subtle'
367
- : 'danger.subtle',
368
- borderBottom: '1px solid',
369
- borderColor: errorBanner.variant === 'warning'
370
- ? 'attention.muted'
371
- : 'danger.muted',
372
- }, children: [_jsx(AlertIcon, { size: 16, fill: errorBanner.variant === 'warning'
329
+ return (_jsx(ThemeProvider, { children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, position: "relative", height: height, bg: "canvas.default", display: "flex", flexDirection: "column", children: [_jsx(Box, { display: showDetails ? 'flex' : 'none', flexDirection: "column", height: "100%", children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: transportName, url: protocolConfig?.endpoint || baseUrl, messageCount: messageCount, agentId: agentId, apiBase: baseUrl, identityProviders: identityProviders, onIdentityConnect: onIdentityConnect, onIdentityDisconnect: onIdentityDisconnect, onBack: handleBackFromDetails, mcpStatusData: mcpStatusData, codemodeStatusData: codemodeStatusData }) }), _jsxs(Box, { display: showDetails ? 'none' : 'flex', flexDirection: "column", height: "100%", children: [errorBanner && (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, px: 3, py: 2, bg: errorBanner.variant === 'warning'
330
+ ? 'attention.subtle'
331
+ : 'danger.subtle', borderBottom: "1px solid", borderColor: errorBanner.variant === 'warning'
332
+ ? 'attention.muted'
333
+ : 'danger.muted', children: [_jsx(AlertIcon, { size: 16, fill: errorBanner.variant === 'warning'
373
334
  ? 'attention.fg'
374
335
  : 'danger.fg' }), _jsx(Text, { sx: {
375
336
  fontSize: 1,
@@ -894,13 +894,7 @@ export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useSt
894
894
  backgroundColor: 'canvas.default',
895
895
  borderRadius: 'var(--theme-radius-bubble, 16px)',
896
896
  trailingContent: balloonApproval ? (_jsx(BalloonApprovalMessage, { approval: balloonApproval })) : undefined,
897
- footerContent: assistantDecide ? (_jsx(Box, { "data-balloon-decisions": "", sx: {
898
- px: 3,
899
- pb: 1,
900
- display: 'flex',
901
- flexDirection: 'column',
902
- alignItems: 'flex-end',
903
- fontSize: 0,
897
+ footerContent: assistantDecide ? (_jsx(Box, { "data-balloon-decisions": "", px: 3, pb: 1, display: "flex", flexDirection: "column", alignItems: "flex-end", fontSize: 0, sx: {
904
898
  '& form': { alignSelf: 'stretch' },
905
899
  '& [data-balloon-decision="answered"]': { alignSelf: 'stretch' },
906
900
  }, children: _jsx(DecisionAsk, { ask: assistantDecide }) })) : undefined,
@@ -1040,46 +1034,14 @@ export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useSt
1040
1034
  ? 'canvas.subtle'
1041
1035
  : 'canvas.default')
1042
1036
  : {}),
1043
- }, "data-conversation-balloon": conversationBalloon ? '' : undefined, "data-balloon-display": conversationBalloon ? balloonDisplay : undefined, children: [conversationBalloon ? (_jsx(ConversationBalloonClose, { onClose: handleToggle })) : null, conversationBalloon && !currentOpen ? (_jsx(ConversationBalloonHeader, { count: messageCount })) : null, viewMode === 'floating-draggable' && !isMobile && (_jsx(Box, { onPointerDown: drag.onHandlePointerDown, "aria-label": "Move the chat", sx: {
1044
- display: 'flex',
1045
- alignItems: 'center',
1046
- justifyContent: 'center',
1047
- flexShrink: 0,
1048
- height: 18,
1049
- cursor: 'grab',
1050
- color: 'fg.subtle',
1051
- bg: 'canvas.subtle',
1052
- borderBottom: '1px solid',
1053
- borderColor: 'border.muted',
1054
- touchAction: 'none',
1055
- '&:active': { cursor: 'grabbing' },
1056
- }, children: _jsx(GrabberIcon, { size: 16 }) })), conversation ? (_jsxs(_Fragment, { children: [showHeader && !conversationBalloon ? (_jsxs(Box, { sx: {
1057
- display: 'flex',
1058
- alignItems: 'center',
1059
- gap: 2,
1060
- flexShrink: 0,
1061
- px: 3,
1062
- py: 2,
1063
- borderBottom: '1px solid',
1064
- borderColor: 'border.default',
1065
- }, children: [brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), _jsx(Text, { sx: {
1037
+ }, "data-conversation-balloon": conversationBalloon ? '' : undefined, "data-balloon-display": conversationBalloon ? balloonDisplay : undefined, children: [conversationBalloon ? (_jsx(ConversationBalloonClose, { onClose: handleToggle })) : null, conversationBalloon && !currentOpen ? (_jsx(ConversationBalloonHeader, { count: messageCount })) : null, viewMode === 'floating-draggable' && !isMobile && (_jsx(Box, { onPointerDown: drag.onHandlePointerDown, "aria-label": "Move the chat", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, height: 18, cursor: "grab", color: "fg.subtle", bg: "canvas.subtle", borderBottom: "1px solid", borderColor: "border.muted", active: { cursor: 'grabbing' }, touchAction: "none", children: _jsx(GrabberIcon, { size: 16 }) })), conversation ? (_jsxs(_Fragment, { children: [showHeader && !conversationBalloon ? (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, flexShrink: 0, px: 3, py: 2, borderBottom: "1px solid", borderColor: "border.default", children: [brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), _jsx(Text, { sx: {
1066
1038
  flex: 1,
1067
1039
  minWidth: 0,
1068
1040
  fontWeight: 'semibold',
1069
1041
  overflow: 'hidden',
1070
1042
  textOverflow: 'ellipsis',
1071
1043
  whiteSpace: 'nowrap',
1072
- }, children: title }), closeButton] })) : null, _jsx(Box, { "data-floating-conversation": true, sx: {
1073
- flex: '1 1 auto',
1074
- minHeight: 0,
1075
- display: 'flex',
1076
- ...(conversationBalloon
1077
- ? {
1078
- borderRadius: 'var(--theme-radius-bubble, 16px)',
1079
- overflow: 'hidden',
1080
- }
1081
- : {}),
1082
- }, children: conversation.body })] })) : (_jsx(ChatBase, { title: title, showHeader: showHeader, useStore: useStoreMode, protocol: protocol, themeVariant: themeVariant, themeOverrides: themeOverrides, colorMode: colorMode, autoFocus: isOpen, focusTrigger: focusTrigger, launching: launching, launchingMessage: launchingMessage, brandIcon: brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), headerButtons: {
1044
+ }, children: title }), closeButton] })) : null, _jsx(Box, { "data-floating-conversation": true, flex: "1 1 auto", minHeight: 0, display: "flex", borderRadius: conversationBalloon ? 'bubble' : undefined, overflow: conversationBalloon ? 'hidden' : undefined, children: conversation.body })] })) : (_jsx(ChatBase, { title: title, showHeader: showHeader, useStore: useStoreMode, protocol: protocol, themeVariant: themeVariant, themeOverrides: themeOverrides, colorMode: colorMode, autoFocus: isOpen, focusTrigger: focusTrigger, launching: launching, launchingMessage: launchingMessage, brandIcon: brandIcon || _jsx(AiAgentIcon, { colored: true, size: 20 }), headerButtons: {
1083
1045
  showNewChat: showNewChatButton,
1084
1046
  showClear: showClearButton && messages.length > 0,
1085
1047
  showSettings: showSettingsButton && !!onSettingsClick,
@@ -1097,7 +1059,7 @@ export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useSt
1097
1059
  showAvatars: true,
1098
1060
  }, placeholder: "Type a message...", backgroundColor: "canvas.subtle", frontendTools: frontendTools, showModelSelector: showModelSelector, availableModels: availableModels, showToolsMenu: showToolsMenu, showSkillsMenu: showSkillsMenu, showTokenUsage: showTokenUsage, showContextRing: showContextRing, runtimeId: runtimeId, historyEndpoint: historyEndpoint, historyAuthToken: historyAuthToken, pendingPrompt: pendingPrompt ?? suggestionPrompt, inspector: inspector, showInformation: showInformation, onInformationClick: onInformationClick, onToolCallStart: onToolCallStart, onToolCallComplete: onToolCallComplete, showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval, voice: voice, voiceSpeaking: speakerState.speaking, onStopSpeaking: speaker ? stopSpeaking : undefined, ...panelProps, ...assistantChat, onLoadingChange: handleLoadingChange, onDisplayItemsChange: handleDisplayItemsChange, onSendReady: handleSendReady, children: conversationBalloon && currentOpen ? (
1099
1061
  // Current: the one thing said or done now, over the composer.
1100
- _jsx(Box, { sx: { px: 3, pt: 3, pb: 2, overflow: 'hidden' }, children: _jsx(CurrentBalloonBody, { text: toolSaid ? undefined : (currentWords ?? description), fullText: toolSaid ? undefined : currentWhole, tool: toolSaid, busy: atWork, speaking: answering && atWork, waiting: atWork && !answering }) })) : (children) }))] }));
1062
+ _jsx(Box, { px: 3, pt: 3, pb: 2, overflow: "hidden", children: _jsx(CurrentBalloonBody, { text: toolSaid ? undefined : (currentWords ?? description), fullText: toolSaid ? undefined : currentWhole, tool: toolSaid, busy: atWork, speaking: answering && atWork, waiting: atWork && !answering }) })) : (children) }))] }));
1101
1063
  /*
1102
1064
  * The floating popup's button. Words not yet heard make it blink for the
1103
1065
  * person's attention, until the chat is opened; hovered, they show in a
@@ -1159,38 +1121,16 @@ export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useSt
1159
1121
  }
1160
1122
  : undefined, onResetPosition: stageDrag.position ? stageDrag.reset : undefined, about: agentAbout, sandbox: agentSandbox, contextMenu: contextMenu })), showButton && !isOpen && !assistantShown && (_jsx(Box, { sx: {
1161
1123
  ...getPositionStyles(),
1162
- }, children: _jsxs(Box, { sx: {
1163
- position: 'relative',
1164
- display: 'inline-flex',
1165
- // The glow's halos go behind the button, not behind the page.
1166
- isolation: 'isolate',
1167
- }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [buttonGlow && _jsx(ButtonGlow, { color: brandColor }), isHovered && saying ? (_jsx(SpeechBalloon, { text: saying.text, more: saying.more, onOpen: handleToggle, above: 64, side: position.startsWith('bottom') ? 'above' : 'below', align: position.includes('right') ? 'right' : 'left', tailAt: 28 })) : null, saying ? (chatButton) : (_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: chatButton })), messages.length > 0 && (_jsx(Box, { sx: {
1168
- position: 'absolute',
1169
- top: 0,
1170
- right: 0,
1171
- minWidth: 18,
1172
- height: 18,
1173
- px: 1,
1174
- display: 'flex',
1175
- alignItems: 'center',
1176
- justifyContent: 'center',
1177
- bg: 'danger.emphasis',
1178
- color: 'fg.onEmphasis',
1179
- borderRadius: '50%',
1180
- fontSize: 0,
1181
- fontWeight: 'bold',
1182
- pointerEvents: 'none',
1183
- }, children: _jsx(Text, { sx: { fontSize: 0 }, children: messages.length > 99 ? '99+' : messages.length }) })), unheard && (_jsx(Box, { sx: {
1184
- position: 'absolute',
1185
- top: 0,
1186
- left: 0,
1187
- right: 0,
1188
- bottom: 0,
1189
- borderRadius: '50%',
1190
- border: '2px solid',
1191
- borderColor: brandColor || 'accent.emphasis',
1192
- animation: 'pulse 2s infinite',
1193
- pointerEvents: 'none',
1124
+ }, children: _jsxs(Box, { position: "relative", display: "inline-flex",
1125
+ // The glow's halos go behind the button, not behind the page.
1126
+ isolation: "isolate", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [buttonGlow && _jsx(ButtonGlow, { color: brandColor }), isHovered && saying ? (_jsx(SpeechBalloon, { text: saying.text, more: saying.more, onOpen: handleToggle, above: 64, side: position.startsWith('bottom') ? 'above' : 'below', align: position.includes('right') ? 'right' : 'left', tailAt: 28 })) : null, saying ? (chatButton) : (_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: chatButton })), messages.length > 0 && (_jsx(Box, { position: "absolute", top: 0, right: 0, minWidth: 18, height: 18, px: 1, display: "flex", alignItems: "center", justifyContent: "center", bg: "danger.emphasis", color: "fg.onEmphasis", borderRadius: "50%", fontSize: 0, fontWeight: "bold", pointerEvents: "none", children: _jsx(Text, { sx: { fontSize: 0 }, children: messages.length > 99 ? '99+' : messages.length }) })), unheard && (_jsx(Box, { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, borderRadius: "50%", border: "2px solid", borderColor: brandColor || 'accent.emphasis', animation: "pulse 2s infinite", pointerEvents: "none",
1127
+ // Still, as a ring held around the button, for a reader
1128
+ // who asks the system for reduced motion (T-28).
1129
+ reducedMotion: {
1130
+ animation: 'none',
1131
+ transform: 'scale(1.15)',
1132
+ opacity: 0.6,
1133
+ }, sx: {
1194
1134
  '@keyframes pulse': {
1195
1135
  '0%': {
1196
1136
  transform: 'scale(1)',
@@ -1201,32 +1141,7 @@ export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useSt
1201
1141
  opacity: 0,
1202
1142
  },
1203
1143
  },
1204
- // Still, as a ring held around the button, for a reader
1205
- // who asks the system for reduced motion (T-28).
1206
- '@media (prefers-reduced-motion: reduce)': {
1207
- animation: 'none',
1208
- transform: 'scale(1.15)',
1209
- opacity: 0.6,
1210
- },
1211
- } }))] }) })), isMobile && isOpen && (_jsx(Box, { sx: {
1212
- position: 'fixed',
1213
- top: 0,
1214
- left: 0,
1215
- right: 0,
1216
- bottom: 0,
1217
- bg: 'neutral.muted',
1218
- opacity: 0.5,
1219
- zIndex: 999,
1220
- }, onClick: handleToggle })), showPanelBackdrop && viewMode === 'panel' && isOpen && !isMobile && (_jsx(Box, { sx: {
1221
- position: 'fixed',
1222
- top: 0,
1223
- left: 0,
1224
- right: 0,
1225
- bottom: 0,
1226
- bg: 'neutral.muted',
1227
- opacity: 0.3,
1228
- zIndex: 1000,
1229
- }, onClick: handleToggle })), dockedInMount && sidebarMount
1144
+ } }))] }) })), isMobile && isOpen && (_jsx(Box, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "neutral.muted", opacity: 0.5, zIndex: 999, onClick: handleToggle })), showPanelBackdrop && viewMode === 'panel' && isOpen && !isMobile && (_jsx(Box, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "neutral.muted", opacity: 0.3, zIndex: 1000, onClick: handleToggle })), dockedInMount && sidebarMount
1230
1145
  ? createPortal(chatWindow, sidebarMount)
1231
1146
  : chatWindow] }));
1232
1147
  }
@@ -241,56 +241,19 @@ ${selectedText || ''}
241
241
  const handleDiscard = useCallback(() => {
242
242
  onClose?.();
243
243
  }, [onClose]);
244
- return (_jsxs(Box, { sx: {
245
- display: 'flex',
246
- flexDirection: 'column',
247
- gap: 1,
248
- width: '100%',
249
- }, children: [_jsxs(Box, { sx: {
250
- borderRadius: '12px',
251
- border: '1px solid',
252
- borderColor: 'border.default',
253
- boxShadow: 'shadow.large',
254
- bg: 'canvas.default',
255
- overflow: 'hidden',
256
- }, onMouseDown: e => {
244
+ return (_jsxs(Box, { display: "flex", flexDirection: "column", gap: 1, width: "100%", children: [_jsxs(Box, { borderRadius: "12px", border: "1px solid", borderColor: "border.default", boxShadow: "shadow.large", bg: "canvas.default", overflow: "hidden", onMouseDown: e => {
257
245
  e.preventDefault();
258
246
  onSaveSelection?.();
259
247
  }, onMouseUp: () => {
260
248
  onRestoreSelection?.();
261
- }, children: [aiResponse && (_jsxs(Box, { sx: {
262
- p: 2,
263
- borderBottom: '1px solid',
264
- borderColor: 'border.default',
265
- maxHeight: '130px',
266
- overflow: 'auto',
267
- position: 'relative',
268
- }, children: [_jsx(Box, { sx: {
269
- position: 'absolute',
270
- top: 1,
271
- right: 1,
272
- }, children: _jsx(IconButton, { icon: CopyIcon, "aria-label": "Copy", variant: "invisible", size: "small", onClick: handleCopy, sx: { opacity: 0.5, '&:hover': { opacity: 1 } } }) }), _jsx(Text, { sx: {
249
+ }, children: [aiResponse && (_jsxs(Box, { p: 2, borderBottom: "1px solid", borderColor: "border.default", maxHeight: "130px", overflow: "auto", position: "relative", children: [_jsx(Box, { position: "absolute", top: 1, right: 1, children: _jsx(IconButton, { icon: CopyIcon, "aria-label": "Copy", variant: "invisible", size: "small", onClick: handleCopy, sx: { opacity: 0.5, '&:hover': { opacity: 1 } } }) }), _jsx(Text, { sx: {
273
250
  whiteSpace: 'pre-wrap',
274
251
  fontSize: 1,
275
252
  pr: 4,
276
- }, children: aiResponse })] })), _jsxs(Box, { as: "form", onSubmit: handleSubmit, sx: {
277
- display: 'flex',
278
- alignItems: 'center',
279
- gap: 1,
280
- p: 1,
281
- }, children: [_jsx(TextInput, { value: input, onChange: e => setInput(e.target.value), placeholder: aiState === 'loading' ? 'Writing…' : 'Custom prompt…', disabled: aiState === 'loading', sx: { flex: 1 }, onMouseDown: e => {
253
+ }, children: aiResponse })] })), _jsxs(Box, { as: "form", onSubmit: handleSubmit, display: "flex", alignItems: "center", gap: 1, p: 1, children: [_jsx(TextInput, { value: input, onChange: e => setInput(e.target.value), placeholder: aiState === 'loading' ? 'Writing…' : 'Custom prompt…', disabled: aiState === 'loading', sx: { flex: 1 }, onMouseDown: e => {
282
254
  e.stopPropagation();
283
255
  onSaveSelection?.();
284
- }, onMouseUp: e => e.stopPropagation() }), _jsx(IconButton, { type: "submit", icon: () => (_jsx(SparklesIcon, { style: aiState === 'loading' ? { opacity: 0.6 } : {} })), "aria-label": "Send", disabled: aiState === 'loading' || !input.trim(), variant: "invisible" })] }), error && (_jsx(Box, { sx: { px: 2, pb: 2 }, children: _jsx(Text, { sx: { color: 'danger.fg', fontSize: 0 }, children: error }) }))] }), aiState !== 'loading' && (_jsx(Box, { sx: {
285
- borderRadius: '12px',
286
- border: '1px solid',
287
- borderColor: 'border.default',
288
- boxShadow: 'shadow.large',
289
- bg: 'canvas.default',
290
- maxWidth: '220px',
291
- maxHeight: '360px',
292
- overflow: 'auto',
293
- }, onMouseDown: e => e.preventDefault(), children: _jsxs(ActionList, { children: [aiResponse && !page && aiState === 'complete' && (_jsxs(_Fragment, { children: [_jsxs(ActionList.Item, { onSelect: handleReplace, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(SyncIcon, { size: 14 }) }), "Replace selection"] }), _jsxs(ActionList.Item, { onSelect: handleInsertInline, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, { size: 14 }) }), "Add text inline"] }), _jsxs(ActionList.Item, { onSelect: handleInsertBelow, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, { size: 14 }) }), "Add below paragraph"] }), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { title: "Modify further", children: [_jsxs(ActionList.Item, { onSelect: handleRegenerate, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(SyncIcon, { size: 14 }) }), "Regenerate"] }), _jsxs(ActionList.Item, { onSelect: handleBackToOptions, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArrowLeftIcon, { size: 14 }) }), "Other options"] })] }), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Item, { onSelect: handleDiscard, variant: "danger", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(TrashIcon, { size: 14 }) }), "Discard"] })] })), aiState === 'initial' && (_jsxs(_Fragment, { children: [page ? (
256
+ }, onMouseUp: e => e.stopPropagation() }), _jsx(IconButton, { type: "submit", icon: () => (_jsx(SparklesIcon, { style: aiState === 'loading' ? { opacity: 0.6 } : {} })), "aria-label": "Send", disabled: aiState === 'loading' || !input.trim(), variant: "invisible" })] }), error && (_jsx(Box, { px: 2, pb: 2, children: _jsx(Text, { sx: { color: 'danger.fg', fontSize: 0 }, children: error }) }))] }), aiState !== 'loading' && (_jsx(Box, { borderRadius: "12px", border: "1px solid", borderColor: "border.default", boxShadow: "shadow.large", bg: "canvas.default", maxWidth: "220px", maxHeight: "360px", overflow: "auto", onMouseDown: e => e.preventDefault(), children: _jsxs(ActionList, { children: [aiResponse && !page && aiState === 'complete' && (_jsxs(_Fragment, { children: [_jsxs(ActionList.Item, { onSelect: handleReplace, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(SyncIcon, { size: 14 }) }), "Replace selection"] }), _jsxs(ActionList.Item, { onSelect: handleInsertInline, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, { size: 14 }) }), "Add text inline"] }), _jsxs(ActionList.Item, { onSelect: handleInsertBelow, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, { size: 14 }) }), "Add below paragraph"] }), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { title: "Modify further", children: [_jsxs(ActionList.Item, { onSelect: handleRegenerate, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(SyncIcon, { size: 14 }) }), "Regenerate"] }), _jsxs(ActionList.Item, { onSelect: handleBackToOptions, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArrowLeftIcon, { size: 14 }) }), "Other options"] })] }), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Item, { onSelect: handleDiscard, variant: "danger", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(TrashIcon, { size: 14 }) }), "Discard"] })] })), aiState === 'initial' && (_jsxs(_Fragment, { children: [page ? (
294
257
  // Back button when on sub-page
295
258
  _jsxs(ActionList.Item, { onSelect: () => setPages([]), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArrowLeftIcon, { size: 14 }) }), "Back"] })) : (
296
259
  // Main options
@@ -308,11 +271,6 @@ ${selectedText || ''}
308
271
  submitPrompt(option.prompt);
309
272
  }
310
273
  setPages([]);
311
- }, children: [option.icon && (_jsx(ActionList.LeadingVisual, { children: option.icon })), option.text] }, option.text)))] }))] }) })), aiState === 'loading' && (_jsxs(Box, { sx: {
312
- display: 'flex',
313
- alignItems: 'center',
314
- justifyContent: 'center',
315
- py: 2,
316
- }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { ml: 2, color: 'fg.muted', fontSize: 1 }, children: "Generating..." })] }))] }));
274
+ }, children: [option.icon && (_jsx(ActionList.LeadingVisual, { children: option.icon })), option.text] }, option.text)))] }))] }) })), aiState === 'loading' && (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", py: 2, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { ml: 2, color: 'fg.muted', fontSize: 1 }, children: "Generating..." })] }))] }));
317
275
  }
318
276
  export default ChatInline;
@@ -302,10 +302,7 @@ export function ChatPopupStandalone({ onSendMessage, title = 'Chat', description
302
302
  const closeButton = (_jsx(Tooltip, { text: `Close${escapeToClose ? ' (Esc)' : ''}`, direction: "s", children: _jsx(IconButton, { icon: XIcon, "aria-label": "Close", onClick: handleToggle, variant: "invisible", size: "small" }) }));
303
303
  return (_jsxs(_Fragment, { children: [showButton && !isOpen && (_jsx(Box, { sx: {
304
304
  ...getPositionStyles(),
305
- }, children: _jsxs(Box, { sx: {
306
- position: 'relative',
307
- display: 'inline-flex',
308
- }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: _jsx(IconButton, { icon: buttonIcon
305
+ }, children: _jsxs(Box, { position: "relative", display: "inline-flex", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: _jsx(IconButton, { icon: buttonIcon
309
306
  ? buttonIcon
310
307
  : CommentDiscussionIcon, "aria-label": buttonTooltip, onClick: handleToggle, size: "large", sx: {
311
308
  width: 56,
@@ -320,31 +317,7 @@ export function ChatPopupStandalone({ onSendMessage, title = 'Chat', description
320
317
  bg: brandColor || 'accent.emphasis',
321
318
  boxShadow: 'shadow.extra-large',
322
319
  },
323
- } }) }), messages.length > 0 && (_jsx(Box, { sx: {
324
- position: 'absolute',
325
- top: -4,
326
- right: -4,
327
- minWidth: 20,
328
- height: 20,
329
- px: 1,
330
- display: 'flex',
331
- alignItems: 'center',
332
- justifyContent: 'center',
333
- bg: 'danger.emphasis',
334
- color: 'fg.onEmphasis',
335
- borderRadius: '50%',
336
- fontSize: 0,
337
- fontWeight: 'bold',
338
- }, children: _jsx(Text, { sx: { fontSize: 0 }, children: messages.length > 99 ? '99+' : messages.length }) })), messages.length > 0 && (_jsx(Box, { sx: {
339
- position: 'absolute',
340
- top: 0,
341
- left: 0,
342
- right: 0,
343
- bottom: 0,
344
- borderRadius: '50%',
345
- border: '2px solid',
346
- borderColor: brandColor || 'accent.emphasis',
347
- animation: 'pulse 2s infinite',
320
+ } }) }), messages.length > 0 && (_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: messages.length > 99 ? '99+' : messages.length }) })), messages.length > 0 && (_jsx(Box, { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, borderRadius: "50%", border: "2px solid", borderColor: brandColor || 'accent.emphasis', animation: "pulse 2s infinite", sx: {
348
321
  '@keyframes pulse': {
349
322
  '0%': {
350
323
  transform: 'scale(1)',
@@ -355,16 +328,7 @@ export function ChatPopupStandalone({ onSendMessage, title = 'Chat', description
355
328
  opacity: 0,
356
329
  },
357
330
  },
358
- } }))] }) })), isMobile && isOpen && (_jsx(Box, { sx: {
359
- position: 'fixed',
360
- top: 0,
361
- left: 0,
362
- right: 0,
363
- bottom: 0,
364
- bg: 'neutral.muted',
365
- opacity: 0.5,
366
- zIndex: 999,
367
- }, onClick: handleToggle })), (isOpen || isAnimating) && (_jsxs(Box, { ref: popupRef, className: className, sx: {
331
+ } }))] }) })), isMobile && isOpen && (_jsx(Box, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "neutral.muted", opacity: 0.5, zIndex: 999, onClick: handleToggle })), (isOpen || isAnimating) && (_jsxs(Box, { ref: popupRef, className: className, sx: {
368
332
  ...getPositionStyles(),
369
333
  width: isMobile
370
334
  ? '100%'
@@ -400,23 +364,11 @@ export function ChatPopupStandalone({ onSendMessage, title = 'Chat', description
400
364
  title: emptyStateMessage,
401
365
  }, avatarConfig: {
402
366
  showAvatars: true,
403
- }, backgroundColor: "canvas.subtle", showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval, ...panelProps, children: children }), _jsxs(Box, { sx: {
404
- display: 'flex',
405
- gap: 2,
406
- p: 3,
407
- borderTop: '1px solid',
408
- borderColor: 'border.default',
409
- bg: 'canvas.default',
410
- }, children: [_jsx(Textarea, { ref: textareaRef, value: inputValue, onChange: e => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isLoading, sx: {
367
+ }, backgroundColor: "canvas.subtle", showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval, ...panelProps, children: children }), _jsxs(Box, { display: "flex", gap: 2, p: 3, borderTop: "1px solid", borderColor: "border.default", bg: "canvas.default", children: [_jsx(Textarea, { ref: textareaRef, value: inputValue, onChange: e => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isLoading, sx: {
411
368
  flex: 1,
412
369
  resize: 'none',
413
370
  minHeight: '40px',
414
371
  maxHeight: '120px',
415
- }, rows: 1 }), isLoading || isStreaming ? (_jsx(Button, { onClick: handleStop, variant: "danger", children: _jsx(SquareCircleIcon, {}) })) : (_jsx(Button, { onClick: handleSend, variant: "primary", disabled: !inputValue.trim(), children: _jsx(PaperAirplaneIcon, {}) }))] }), showPoweredBy && (_jsx(Box, { sx: {
416
- p: 2,
417
- borderTop: '1px solid',
418
- borderColor: 'border.default',
419
- bg: 'canvas.subtle',
420
- }, children: _jsx(PoweredByTag, { show: true, brandName: "Datalayer", brandUrl: "https://datalayer.ai", ...poweredByProps }) }))] }))] }));
372
+ }, rows: 1 }), isLoading || isStreaming ? (_jsx(Button, { onClick: handleStop, variant: "danger", children: _jsx(SquareCircleIcon, {}) })) : (_jsx(Button, { onClick: handleSend, variant: "primary", disabled: !inputValue.trim(), children: _jsx(PaperAirplaneIcon, {}) }))] }), showPoweredBy && (_jsx(Box, { p: 2, borderTop: "1px solid", borderColor: "border.default", bg: "canvas.subtle", children: _jsx(PoweredByTag, { show: true, brandName: "Datalayer", brandUrl: "https://datalayer.ai", ...poweredByProps }) }))] }))] }));
421
373
  }
422
374
  export default ChatPopupStandalone;
@@ -164,39 +164,12 @@ export function ChatSidebar({ title = 'Chat', protocol: protocolProp, defaultOpe
164
164
  const collapseButton = (_jsx(IconButton, { icon: XIcon, "aria-label": `Close sidebar${shortcutHint ? ` (${shortcutHint})` : ''}`, onClick: handleToggle, variant: "invisible", size: "small" }));
165
165
  // Collapsed state
166
166
  if (!isOpen) {
167
- const collapsedLauncher = (_jsx(Box, { ref: sidebarRef, className: className, sx: {
168
- position: 'fixed',
169
- top: 12,
170
- ...(position === 'right'
171
- ? { right: 'env(safe-area-inset-right)' }
172
- : { left: 'env(safe-area-inset-left)' }),
173
- zIndex: 1001,
174
- display: 'flex',
175
- flexDirection: 'column',
176
- alignItems: 'center',
177
- gap: 2,
178
- }, children: _jsxs(Box, { sx: { position: 'relative' }, children: [_jsx(IconButton, { icon: position === 'right' ? SidebarExpandIcon : SidebarCollapseIcon, "aria-label": "Open chat", description: shortcutHint ? `Open chat (${shortcutHint})` : 'Open chat', onClick: handleToggle, variant: "default", size: "small", sx: {
167
+ const collapsedLauncher = (_jsx(Box, { ref: sidebarRef, className: className, position: "fixed", top: 12, zIndex: 1001, display: "flex", flexDirection: "column", alignItems: "center", gap: 2, right: position === 'right' ? 'env(safe-area-inset-right)' : undefined, left: position === 'right' ? undefined : 'env(safe-area-inset-left)', children: _jsxs(Box, { position: "relative", children: [_jsx(IconButton, { icon: position === 'right' ? SidebarExpandIcon : SidebarCollapseIcon, "aria-label": "Open chat", description: shortcutHint ? `Open chat (${shortcutHint})` : 'Open chat', onClick: handleToggle, variant: "default", size: "small", sx: {
179
168
  bg: 'canvas.default',
180
169
  border: '1px solid',
181
170
  borderColor: 'border.default',
182
171
  boxShadow: 'shadow.small',
183
- } }), messages.length > 0 && (_jsx(Box, { sx: {
184
- position: 'absolute',
185
- top: -6,
186
- right: -6,
187
- minWidth: 16,
188
- height: 16,
189
- px: 1,
190
- display: 'flex',
191
- alignItems: 'center',
192
- justifyContent: 'center',
193
- bg: 'accent.emphasis',
194
- color: 'fg.onEmphasis',
195
- borderRadius: '50%',
196
- fontSize: '10px',
197
- fontWeight: 'bold',
198
- boxShadow: 'shadow.small',
199
- }, children: messages.length > 99 ? '99+' : messages.length }))] }) }));
172
+ } }), messages.length > 0 && (_jsx(Box, { position: "absolute", top: -6, right: -6, minWidth: 16, height: 16, px: 1, display: "flex", alignItems: "center", justifyContent: "center", bg: "accent.emphasis", color: "fg.onEmphasis", borderRadius: "50%", fontSize: "10px", fontWeight: "bold", boxShadow: "shadow.small", children: messages.length > 99 ? '99+' : messages.length }))] }) }));
200
173
  // Render the collapsed launcher in a body portal so it stays pinned to the
201
174
  // viewport edge even when ancestors use transforms/positioning contexts.
202
175
  if (typeof document !== 'undefined' && document.body) {
@@ -218,16 +191,7 @@ export function ChatSidebar({ title = 'Chat', protocol: protocolProp, defaultOpe
218
191
  }
219
192
  : {};
220
193
  // Expanded state using ChatBase
221
- return (_jsxs(_Fragment, { children: [isMobile && isOpen && (_jsx(Box, { sx: {
222
- position: 'fixed',
223
- top: 0,
224
- left: 0,
225
- right: 0,
226
- bottom: 0,
227
- bg: 'neutral.muted',
228
- opacity: 0.5,
229
- zIndex: 999,
230
- }, onClick: handleToggle })), _jsx(Box, { ref: sidebarRef, className: className,
194
+ return (_jsxs(_Fragment, { children: [isMobile && isOpen && (_jsx(Box, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "neutral.muted", opacity: 0.5, zIndex: 999, onClick: handleToggle })), _jsx(Box, { ref: sidebarRef, className: className,
231
195
  // Frequently-changing pixel dimensions (resizable width and the
232
196
  // viewport-derived height that updates on scroll/resize) are applied
233
197
  // via the inline `style` prop instead of `sx`. Passing them through
@@ -244,19 +208,8 @@ export function ChatSidebar({ title = 'Chat', protocol: protocolProp, defaultOpe
244
208
  maxHeight: desktopViewportHeight
245
209
  ? `${desktopViewportHeight}px`
246
210
  : 'calc(100dvh - 8px)',
247
- }, sx: {
248
- position: 'relative',
249
- display: 'flex',
250
- flexDirection: 'column',
251
- alignSelf: 'stretch',
252
- minHeight: 0,
211
+ }, position: "relative", display: "flex", flexDirection: "column", alignSelf: "stretch", minHeight: 0, flex: isMobile ? '1 1 auto' : '0 0 auto', bg: "canvas.default", borderLeft: !isMobile && position === 'right' ? '1px solid' : 'none', borderRight: !isMobile && position === 'left' ? '1px solid' : 'none', borderColor: "border.default", overflow: "hidden", sx: {
253
212
  marginBlock: isMobile ? 0 : '4px',
254
- flex: isMobile ? '1 1 auto' : '0 0 auto',
255
- bg: 'canvas.default',
256
- borderLeft: !isMobile && position === 'right' ? '1px solid' : 'none',
257
- borderRight: !isMobile && position === 'left' ? '1px solid' : 'none',
258
- borderColor: 'border.default',
259
- overflow: 'hidden',
260
213
  ...mobileStyles,
261
214
  }, children: _jsx(ChatBase, { title: title, showHeader: showHeader, brandIcon: brandIcon, protocol: protocolProp, headerButtons: {
262
215
  showNewChat: showNewChatButton,
@@ -212,10 +212,7 @@ export function ChatStandalone({ onSendMessage, title = 'Chat', description = 'S
212
212
  const closeButton = (_jsx(Tooltip, { text: `Close${escapeToClose ? ' (Esc)' : ''}`, direction: "s", children: _jsx(IconButton, { icon: XIcon, "aria-label": "Close", onClick: handleToggle, variant: "invisible", size: "small" }) }));
213
213
  return (_jsxs(_Fragment, { children: [showButton && !isOpen && (_jsx(Box, { sx: {
214
214
  ...getPositionStyles(),
215
- }, children: _jsxs(Box, { sx: {
216
- position: 'relative',
217
- display: 'inline-flex',
218
- }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: _jsx(IconButton, { icon: buttonIcon
215
+ }, children: _jsxs(Box, { position: "relative", display: "inline-flex", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx(Tooltip, { text: `${buttonTooltip}${shortcutHint ? ` (${shortcutHint})` : ''}`, direction: position.includes('right') ? 'w' : 'e', children: _jsx(IconButton, { icon: buttonIcon
219
216
  ? buttonIcon
220
217
  : CommentDiscussionIcon, "aria-label": buttonTooltip, onClick: handleToggle, size: "large", sx: {
221
218
  width: 56,
@@ -230,31 +227,7 @@ export function ChatStandalone({ onSendMessage, title = 'Chat', description = 'S
230
227
  bg: brandColor || 'accent.emphasis',
231
228
  boxShadow: 'shadow.extra-large',
232
229
  },
233
- } }) }), messages.length > 0 && (_jsx(Box, { sx: {
234
- position: 'absolute',
235
- top: -4,
236
- right: -4,
237
- minWidth: 20,
238
- height: 20,
239
- px: 1,
240
- display: 'flex',
241
- alignItems: 'center',
242
- justifyContent: 'center',
243
- bg: 'danger.emphasis',
244
- color: 'fg.onEmphasis',
245
- borderRadius: '50%',
246
- fontSize: 0,
247
- fontWeight: 'bold',
248
- }, children: _jsx(Text, { sx: { fontSize: 0 }, children: messages.length > 99 ? '99+' : messages.length }) })), messages.length > 0 && (_jsx(Box, { sx: {
249
- position: 'absolute',
250
- top: 0,
251
- left: 0,
252
- right: 0,
253
- bottom: 0,
254
- borderRadius: '50%',
255
- border: '2px solid',
256
- borderColor: brandColor || 'accent.emphasis',
257
- animation: 'pulse 2s infinite',
230
+ } }) }), messages.length > 0 && (_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: messages.length > 99 ? '99+' : messages.length }) })), messages.length > 0 && (_jsx(Box, { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, borderRadius: "50%", border: "2px solid", borderColor: brandColor || 'accent.emphasis', animation: "pulse 2s infinite", sx: {
258
231
  '@keyframes pulse': {
259
232
  '0%': {
260
233
  transform: 'scale(1)',
@@ -265,16 +238,7 @@ export function ChatStandalone({ onSendMessage, title = 'Chat', description = 'S
265
238
  opacity: 0,
266
239
  },
267
240
  },
268
- } }))] }) })), isMobile && isOpen && (_jsx(Box, { sx: {
269
- position: 'fixed',
270
- top: 0,
271
- left: 0,
272
- right: 0,
273
- bottom: 0,
274
- bg: 'neutral.muted',
275
- opacity: 0.5,
276
- zIndex: 999,
277
- }, onClick: handleToggle })), (isOpen || isAnimating) && (_jsxs(Box, { ref: popupRef, className: className, sx: {
241
+ } }))] }) })), isMobile && isOpen && (_jsx(Box, { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "neutral.muted", opacity: 0.5, zIndex: 999, onClick: handleToggle })), (isOpen || isAnimating) && (_jsxs(Box, { ref: popupRef, className: className, sx: {
278
242
  ...getPositionStyles(),
279
243
  width: isMobile
280
244
  ? '100%'
@@ -310,11 +274,6 @@ export function ChatStandalone({ onSendMessage, title = 'Chat', description = 'S
310
274
  title: emptyStateMessage,
311
275
  }, avatarConfig: {
312
276
  showAvatars: true,
313
- }, backgroundColor: "canvas.subtle", focusTrigger: focusTrigger, pendingPrompt: pendingPrompt, showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval, ...panelProps, children: children }), showPoweredBy && (_jsx(Box, { sx: {
314
- p: 2,
315
- borderTop: '1px solid',
316
- borderColor: 'border.default',
317
- bg: 'canvas.subtle',
318
- }, children: _jsx(PoweredByTag, { show: true, brandName: "Datalayer", brandUrl: "https://datalayer.ai", ...poweredByProps }) }))] }))] }));
277
+ }, backgroundColor: "canvas.subtle", focusTrigger: focusTrigger, pendingPrompt: pendingPrompt, showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval, ...panelProps, children: children }), showPoweredBy && (_jsx(Box, { p: 2, borderTop: "1px solid", borderColor: "border.default", bg: "canvas.subtle", children: _jsx(PoweredByTag, { show: true, brandName: "Datalayer", brandUrl: "https://datalayer.ai", ...poweredByProps }) }))] }))] }));
319
278
  }
320
279
  export default ChatStandalone;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Tooltip } from '@primer/react';
2
+ import { Box } from '@datalayer/primer-addons';
3
+ import { Tooltip } from '@primer/react';
3
4
  import { CircleSlashIcon, FileIcon, RowsIcon } from '@primer/octicons-react';
4
5
  export function EphemeralSurfaceControl({ mode, onChange, enableNotebook = false, enableDocument = false, enableChatOnly = true, }) {
5
6
  const choices = [
@@ -26,30 +27,9 @@ export function EphemeralSurfaceControl({ mode, onChange, enableNotebook = false
26
27
  if (choices.length < 2) {
27
28
  return null;
28
29
  }
29
- return (_jsx(Box, { sx: {
30
- display: 'inline-flex',
31
- alignItems: 'center',
32
- bg: 'neutral.muted',
33
- borderRadius: '6px',
34
- p: '2px',
35
- gap: '1px',
36
- }, children: choices.map(({ mode: choice, icon: ModeIcon, label }) => (_jsx(Tooltip, { text: label, direction: "n", children: _jsx(Box, { as: "button", "aria-label": label, onClick: () => onChange?.(choice), 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: 'pointer',
45
- bg: mode === choice ? 'canvas.default' : 'transparent',
46
- boxShadow: mode === choice ? 'shadow.small' : 'none',
47
- color: mode === choice ? 'fg.default' : 'fg.muted',
48
- transition: 'all 0.15s ease',
49
- '&:hover': {
50
- color: 'fg.default',
51
- bg: mode === choice ? 'canvas.default' : 'neutral.subtle',
52
- },
30
+ return (_jsx(Box, { display: "inline-flex", alignItems: "center", bg: "neutral.muted", borderRadius: "6px", p: "2px", gap: "1px", children: choices.map(({ mode: choice, icon: ModeIcon, label }) => (_jsx(Tooltip, { text: label, direction: "n", children: _jsx(Box, { as: "button", "aria-label": label, onClick: () => onChange?.(choice), display: "inline-flex", alignItems: "center", justifyContent: "center", width: 26, height: 24, borderRadius: "4px", border: "none", cursor: "pointer", bg: mode === choice ? 'canvas.default' : 'transparent', boxShadow: mode === choice ? 'shadow.small' : 'none', color: mode === choice ? 'fg.default' : 'fg.muted', transition: "all 0.15s ease", hover: {
31
+ color: 'fg.default',
32
+ bg: mode === choice ? 'canvas.default' : 'neutral.subtle',
53
33
  }, children: _jsx(ModeIcon, { size: 14 }) }) }, choice))) }));
54
34
  }
55
35
  export default EphemeralSurfaceControl;