@datalayer/agent-runtimes 0.0.11 → 0.0.12

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 (136) hide show
  1. package/README.md +2 -2
  2. package/lib/Agent.d.ts +29 -0
  3. package/lib/Agent.js +131 -0
  4. package/lib/AgentLexical.d.ts +34 -0
  5. package/lib/AgentLexical.js +296 -0
  6. package/lib/AgentNotebook.d.ts +19 -0
  7. package/lib/AgentNotebook.js +192 -0
  8. package/lib/agent-lexical-main.d.ts +1 -0
  9. package/lib/agent-lexical-main.js +11 -0
  10. package/lib/agent-main.d.ts +1 -0
  11. package/lib/agent-main.js +11 -0
  12. package/lib/agent-notebook-main.d.ts +1 -0
  13. package/lib/agent-notebook-main.js +12 -0
  14. package/lib/components/AgentConfiguration.d.ts +4 -22
  15. package/lib/components/AgentConfiguration.js +8 -8
  16. package/lib/components/chat/components/AgentDetails.d.ts +3 -1
  17. package/lib/components/chat/components/AgentDetails.js +6 -6
  18. package/lib/components/chat/components/Chat.d.ts +29 -3
  19. package/lib/components/chat/components/Chat.js +64 -59
  20. package/lib/components/chat/components/ChatFloating.d.ts +34 -12
  21. package/lib/components/chat/components/ChatFloating.js +54 -21
  22. package/lib/components/chat/components/ChatInline.d.ts +5 -1
  23. package/lib/components/chat/components/ChatInline.js +8 -1
  24. package/lib/components/chat/components/ChatSidebar.d.ts +6 -1
  25. package/lib/components/chat/components/ChatSidebar.js +2 -2
  26. package/lib/components/chat/components/ChatStandalone.d.ts +6 -1
  27. package/lib/components/chat/components/ChatStandalone.js +2 -2
  28. package/lib/components/chat/components/base/ChatBase.d.ts +49 -8
  29. package/lib/components/chat/components/base/ChatBase.js +544 -149
  30. package/lib/components/chat/components/base/InputPrompt.d.ts +42 -0
  31. package/lib/components/chat/components/base/InputPrompt.js +131 -0
  32. package/lib/components/chat/components/index.d.ts +3 -3
  33. package/lib/components/chat/components/index.js +1 -1
  34. package/lib/components/chat/components/parts/ReasoningPart.js +2 -4
  35. package/lib/components/chat/components/parts/TextPart.js +2 -70
  36. package/lib/components/chat/components/styles/streamdownStyles.d.ts +23 -0
  37. package/lib/components/chat/components/styles/streamdownStyles.js +319 -0
  38. package/lib/components/chat/index.d.ts +1 -1
  39. package/lib/components/chat/index.js +1 -1
  40. package/lib/components/chat/inference/DatalayerInferenceProvider.js +16 -12
  41. package/lib/components/chat/inference/SelfHostedInferenceProvider.js +16 -12
  42. package/lib/components/chat/protocols/AGUIAdapter.d.ts +10 -3
  43. package/lib/components/chat/protocols/AGUIAdapter.js +123 -44
  44. package/lib/components/chat/types/tool.d.ts +5 -2
  45. package/lib/components/index.d.ts +1 -18
  46. package/lib/components/index.js +0 -9
  47. package/lib/config/index.d.ts +0 -4
  48. package/lib/config/index.js +0 -4
  49. package/lib/examples/A2UiRestaurantExample.js +1 -1
  50. package/lib/examples/AgentRuntimeChatExample.d.ts +15 -0
  51. package/lib/examples/AgentRuntimeChatExample.js +126 -0
  52. package/lib/examples/{AgentSpaceFormExample.d.ts → AgentRuntimeFormExample.d.ts} +3 -3
  53. package/lib/examples/{AgentSpaceFormExample.js → AgentRuntimeFormExample.js} +10 -8
  54. package/lib/examples/AgentRuntimeLexicalExample.js +6 -3
  55. package/lib/examples/AgentRuntimeLexicalSidebarExample.js +8 -1
  56. package/lib/examples/AgentRuntimeNotebookExample.js +6 -5
  57. package/lib/examples/CopilotKitNotebookExample.js +2 -2
  58. package/lib/examples/JupyterNotebookExample.js +2 -2
  59. package/lib/{components → examples/components}/Header.d.ts +2 -1
  60. package/lib/{components → examples/components}/HeaderControls.js +1 -1
  61. package/lib/{components → examples/components}/LexicalEditor.d.ts +6 -1
  62. package/lib/{components → examples/components}/LexicalEditor.js +4 -4
  63. package/lib/{components → examples/components}/MainContent.d.ts +1 -1
  64. package/lib/{components → examples/components}/MainContent.js +7 -5
  65. package/lib/examples/components/index.d.ts +16 -0
  66. package/lib/examples/components/index.js +13 -0
  67. package/lib/examples/example-selector.js +2 -1
  68. package/lib/examples/index.d.ts +1 -1
  69. package/lib/examples/index.js +1 -1
  70. package/lib/examples/main.js +2 -2
  71. package/lib/examples/stores/examplesStore.d.ts +2 -23
  72. package/lib/index.d.ts +2 -1
  73. package/lib/index.js +1 -0
  74. package/lib/lexical/ChatInlinePlugin.d.ts +13 -2
  75. package/lib/lexical/ChatInlinePlugin.js +41 -179
  76. package/lib/lexical/index.d.ts +1 -0
  77. package/lib/lexical/index.js +1 -0
  78. package/lib/lexical/useChatInlineToolbarItems.d.ts +28 -0
  79. package/lib/lexical/useChatInlineToolbarItems.js +163 -0
  80. package/lib/runtime/useAgentRuntime.d.ts +1 -1
  81. package/lib/runtime/useAgentRuntime.js +1 -1
  82. package/lib/{config/agents/code-ai → specs/agents/codeai}/agents.d.ts +5 -2
  83. package/lib/specs/agents/codeai/agents.js +151 -0
  84. package/lib/{config → specs}/agents/codemode-paper/agents.d.ts +4 -2
  85. package/lib/{config → specs}/agents/codemode-paper/agents.js +39 -19
  86. package/lib/{config → specs}/agents/datalayer-ai/agents.d.ts +4 -2
  87. package/lib/{config → specs}/agents/datalayer-ai/agents.js +17 -2
  88. package/lib/{config → specs}/agents/index.d.ts +3 -1
  89. package/lib/{config → specs}/agents/index.js +12 -3
  90. package/lib/{config → specs}/envvars.d.ts +1 -0
  91. package/lib/{config → specs}/envvars.js +10 -0
  92. package/lib/specs/index.d.ts +5 -0
  93. package/lib/specs/index.js +9 -0
  94. package/lib/{config → specs}/mcpServers.d.ts +2 -1
  95. package/lib/{config → specs}/mcpServers.js +23 -1
  96. package/lib/specs/models.d.ts +68 -0
  97. package/lib/specs/models.js +239 -0
  98. package/lib/state/substates/AIAgentState.d.ts +0 -1
  99. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +11 -22
  100. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +5 -5
  101. package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -6
  102. package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +4 -4
  103. package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +6 -6
  104. package/lib/tools/adapters/agent-runtimes/notebookHooks.js +4 -4
  105. package/lib/{types.d.ts → types/Types.d.ts} +32 -6
  106. package/lib/types/index.d.ts +1 -0
  107. package/lib/types/index.js +1 -0
  108. package/package.json +11 -5
  109. package/scripts/codegen/generate_agents.py +53 -13
  110. package/scripts/codegen/generate_envvars.py +1 -1
  111. package/scripts/codegen/generate_mcp_servers.py +5 -5
  112. package/scripts/codegen/generate_models.py +486 -0
  113. package/scripts/codegen/generate_skills.py +2 -2
  114. package/style/primer-primitives.css +22 -0
  115. package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +0 -37
  116. package/lib/components/chat/components/elements/ChatInputPrompt.js +0 -150
  117. package/lib/config/agents/code-ai/agents.js +0 -70
  118. /package/lib/{components → examples/components}/FooterMetrics.d.ts +0 -0
  119. /package/lib/{components → examples/components}/FooterMetrics.js +0 -0
  120. /package/lib/{components → examples/components}/Header.js +0 -0
  121. /package/lib/{components → examples/components}/HeaderControls.d.ts +0 -0
  122. /package/lib/{components → examples/components}/MockFileBrowser.d.ts +0 -0
  123. /package/lib/{components → examples/components}/MockFileBrowser.js +0 -0
  124. /package/lib/{components → examples/components}/SessionTabs.d.ts +0 -0
  125. /package/lib/{components → examples/components}/SessionTabs.js +0 -0
  126. /package/lib/{components → examples/components}/TimeTravel.d.ts +0 -0
  127. /package/lib/{components → examples/components}/TimeTravel.js +0 -0
  128. /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.d.ts +0 -0
  129. /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.js +0 -0
  130. /package/lib/{config → specs}/agents/codemode-paper/index.d.ts +0 -0
  131. /package/lib/{config → specs}/agents/codemode-paper/index.js +0 -0
  132. /package/lib/{config → specs}/agents/datalayer-ai/index.d.ts +0 -0
  133. /package/lib/{config → specs}/agents/datalayer-ai/index.js +0 -0
  134. /package/lib/{config → specs}/skills.d.ts +0 -0
  135. /package/lib/{config → specs}/skills.js +0 -0
  136. /package/lib/{types.js → types/Types.js} +0 -0
@@ -13,9 +13,11 @@ import { QueryClient, QueryClientProvider, useQuery, } from '@tanstack/react-que
13
13
  import { Box } from '@datalayer/primer-addons';
14
14
  import { DatalayerThemeProvider } from '@datalayer/core';
15
15
  import { Chat, useChatStore } from '../components/chat';
16
+ import { DEFAULT_MODEL } from '../specs';
16
17
  import { useAgentsStore } from './stores/examplesStore';
17
18
  import { useIdentity } from '../identity';
18
- import { MockFileBrowser, MainContent, Header, FooterMetrics, AgentConfiguration, } from '../components';
19
+ import { MockFileBrowser, MainContent, Header, FooterMetrics, } from './components';
20
+ import { AgentConfiguration, } from '../components';
19
21
  import { isSpecSelection, getSpecId } from '../components/AgentConfiguration';
20
22
  // Create a query client for React Query
21
23
  const queryClient = new QueryClient({
@@ -107,7 +109,7 @@ const DEFAULT_IDENTITY_PROVIDERS = {
107
109
  }
108
110
  : {}),
109
111
  };
110
- const AgentSpaceFormExample = ({ initialWsUrl = DEFAULT_WS_URL, initialBaseUrl = DEFAULT_BASE_URL, initialAgentName = DEFAULT_AGENT_ID, initialAgentLibrary = 'pydantic-ai', initialTransport = 'ag-ui', initialModel = 'bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0', initialEnableCodemode = false, initialAllowDirectToolCalls = false, initialEnableToolReranker = false, initialSelectedMcpServers = [], autoSelectMcpServers = false, identityProviders = DEFAULT_IDENTITY_PROVIDERS,
112
+ const AgentRuntimeFormExample = ({ initialWsUrl = DEFAULT_WS_URL, initialBaseUrl = DEFAULT_BASE_URL, initialAgentName = DEFAULT_AGENT_ID, initialAgentLibrary = 'pydantic-ai', initialTransport = 'ag-ui', initialModel = DEFAULT_MODEL, initialEnableCodemode = false, initialAllowDirectToolCalls = false, initialEnableToolReranker = false, initialSelectedMcpServers = [], autoSelectMcpServers = false, identityProviders = DEFAULT_IDENTITY_PROVIDERS,
111
113
  // Deprecated props - merged into identityProviders for backward compat
112
114
  githubClientId, kaggleToken, }) => {
113
115
  const [wsUrl, setWsUrl] = useState(initialWsUrl);
@@ -259,10 +261,10 @@ githubClientId, kaggleToken, }) => {
259
261
  connectedTokenProvidersRef.current.add(provider);
260
262
  connectWithToken(provider, token, { displayName, iconUrl })
261
263
  .then(() => {
262
- console.log(`[AgentSpaceFormExample] ${provider} connected with token`);
264
+ console.log(`[AgentRuntimeFormExample] ${provider} connected with token`);
263
265
  })
264
266
  .catch(err => {
265
- console.error(`[AgentSpaceFormExample] Failed to connect ${provider}:`, err);
267
+ console.error(`[AgentRuntimeFormExample] Failed to connect ${provider}:`, err);
266
268
  // Remove from attempted set so we can retry
267
269
  connectedTokenProvidersRef.current.delete(provider);
268
270
  });
@@ -270,10 +272,10 @@ githubClientId, kaggleToken, }) => {
270
272
  }, [tokenProviders, connectWithToken, isIdentityConnected]);
271
273
  // Handle identity connect/disconnect
272
274
  const handleIdentityConnect = useCallback((identity) => {
273
- console.log('[AgentSpaceFormExample] Identity connected:', identity.provider, identity.userInfo?.name || identity.userInfo?.email);
275
+ console.log('[AgentRuntimeFormExample] Identity connected:', identity.provider, identity.userInfo?.name || identity.userInfo?.email);
274
276
  }, []);
275
277
  const handleIdentityDisconnect = useCallback((provider) => {
276
- console.log('[AgentSpaceFormExample] Identity disconnected:', provider);
278
+ console.log('[AgentRuntimeFormExample] Identity disconnected:', provider);
277
279
  }, []);
278
280
  // Handle codemode change - keep MCP server selections to scope codemode tools
279
281
  const handleEnableCodemodeChange = (enabled) => {
@@ -554,7 +556,7 @@ githubClientId, kaggleToken, }) => {
554
556
  borderColor: 'border.default',
555
557
  } }) })), _jsx(PageLayout.Content, { children: _jsx(MainContent, { showNotebook: showNotebook, timeTravel: timeTravel, onTimeTravelChange: setTimeTravel, richEditor: false, notebookFile: currentAgent?.notebookFile, lexicalFile: currentAgent?.lexicalFile, isNewAgent: isNewMode, isConfigured: isConfigured, baseUrl: baseUrl, agentId: currentAgent?.id || agentName, enableCodemode: enableCodemode, selectedMcpServers: selectedMcpServers, onSelectedMcpServersChange: handleSelectedServersChange, onMcpServersChange: () => {
556
558
  // Trigger codemode tool regeneration when MCP servers change at runtime
557
- console.log('[AgentSpaceFormExample] MCP servers changed, regenerating codemode tools...');
559
+ console.log('[AgentRuntimeFormExample] MCP servers changed, regenerating codemode tools...');
558
560
  // The Chat component will pick up the new selectedMcpServers via props
559
561
  } }) }), rightPaneVisible ? (_jsxs(_Fragment, { children: [_jsx(Box, { sx: {
560
562
  position: 'fixed',
@@ -642,4 +644,4 @@ githubClientId, kaggleToken, }) => {
642
644
  zIndex: 10,
643
645
  }, children: selectedAgentId !== 'new-agent' && (_jsx(FooterMetrics, { tokens: 1523552, cost: 2.01 })) })] }) }) }));
644
646
  };
645
- export default AgentSpaceFormExample;
647
+ export default AgentRuntimeFormExample;
@@ -49,6 +49,7 @@ import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin,
49
49
  // Agent-runtimes imports
50
50
  import { ChatFloating } from '../components/chat';
51
51
  import { ChatInlinePlugin } from '../lexical/ChatInlinePlugin';
52
+ import { useChatInlineToolbarItems } from '../lexical/useChatInlineToolbarItems';
52
53
  import { useLexicalTools } from '../tools/adapters/agent-runtimes/lexicalHooks';
53
54
  import { editorConfig } from './lexical/editorConfig';
54
55
  import '@datalayer/jupyter-lexical/style/index.css';
@@ -187,6 +188,8 @@ function LexicalToolsPlugin({ onToolsReady, }) {
187
188
  const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, serviceManager, onToolsReady, }) {
188
189
  const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
189
190
  const [_isLinkEditMode, setIsLinkEditMode] = useState(false);
191
+ // AI actions registered as toolbar items via the primer-addons toolbar extensibility
192
+ const { toolbarItems, isAiOpen, pendingPrompt, clearPendingPrompt, closeAi } = useChatInlineToolbarItems();
190
193
  const onRef = (_floatingAnchorElem) => {
191
194
  if (_floatingAnchorElem !== null) {
192
195
  setFloatingAnchorElem(_floatingAnchorElem);
@@ -213,10 +216,10 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
213
216
  padding: 3,
214
217
  backgroundColor: 'canvas.default',
215
218
  minHeight: '600px',
216
- }, children: _jsxs(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: [_jsx(LexicalToolsPlugin, { onToolsReady: onToolsReady }), _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(ExcalidrawPlugin, {}), _jsx(CollapsiblePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizerPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), _jsx(ChatInlinePlugin, { protocol: {
219
+ }, children: _jsxs(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: [_jsx(LexicalToolsPlugin, { onToolsReady: onToolsReady }), _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(ExcalidrawPlugin, {}), _jsx(CollapsiblePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizerPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode, extraItems: toolbarItems }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), _jsx(ChatInlinePlugin, { protocol: {
217
220
  type: 'ag-ui',
218
221
  endpoint: AG_UI_ENDPOINT,
219
- } })] }) })] }) })] }));
222
+ }, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] }) })] }) })] }));
220
223
  });
221
224
  function LexicalWithChat({ content, serviceManager, }) {
222
225
  // Ensure the agent exists before rendering chat
@@ -244,7 +247,7 @@ function LexicalWithChat({ content, serviceManager, }) {
244
247
  color: 'danger.fg',
245
248
  borderRadius: 2,
246
249
  maxWidth: 300,
247
- }, children: [_jsx("strong", { children: "Error:" }), " ", error] })), isReady && (_jsx(ChatFloating, { endpoint: AG_UI_ENDPOINT, title: "Lexical AI Agent Runtime", description: "Hi! I can help you edit documents. Try: 'Insert a heading', 'Add a code block', or 'Create a list'", defaultOpen: true, defaultViewMode: "panel", position: "bottom-right", brandColor: "#7c3aed", tools: tools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
250
+ }, children: [_jsx("strong", { children: "Error:" }), " ", error] })), isReady && (_jsx(ChatFloating, { endpoint: AG_UI_ENDPOINT, title: "Lexical AI Agent Runtime", description: "Hi! I can help you edit documents. Try: 'Insert a heading', 'Add a code block', or 'Create a list'", defaultOpen: true, defaultViewMode: "panel", position: "bottom-right", brandColor: "#7c3aed", frontendTools: tools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
248
251
  {
249
252
  title: 'Insert heading',
250
253
  message: 'Insert a heading that says "Welcome"',
@@ -49,6 +49,8 @@ import { JupyterReactTheme, useJupyter } from '@datalayer/jupyter-react';
49
49
  import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, ExcalidrawPlugin, CollapsiblePlugin, AutoLinkPlugin, AutoEmbedPlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, LexicalConfigProvider, LexicalStatePlugin, TableCellResizerPlugin, TablePlugin, } from '@datalayer/jupyter-lexical';
50
50
  // Import Chat components
51
51
  import { ChatSidebar, } from '../components/chat';
52
+ import { ChatInlinePlugin } from '../lexical/ChatInlinePlugin';
53
+ import { useChatInlineToolbarItems } from '../lexical/useChatInlineToolbarItems';
52
54
  import { useLexicalTools } from '../tools/adapters/agent-runtimes/lexicalHooks';
53
55
  import { editorConfig } from './lexical/editorConfig';
54
56
  import '@datalayer/jupyter-lexical/style/index.css';
@@ -72,6 +74,8 @@ function CodeHighlightingPlugin() {
72
74
  function LexicalEditor({ serviceManager }) {
73
75
  const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
74
76
  const [_isLinkEditMode, setIsLinkEditMode] = useState(false);
77
+ // AI actions registered as toolbar items
78
+ const { toolbarItems, isAiOpen, pendingPrompt, clearPendingPrompt, closeAi } = useChatInlineToolbarItems();
75
79
  const onRef = (_floatingAnchorElem) => {
76
80
  if (_floatingAnchorElem !== null) {
77
81
  setFloatingAnchorElem(_floatingAnchorElem);
@@ -98,7 +102,10 @@ function LexicalEditor({ serviceManager }) {
98
102
  left: '24px',
99
103
  color: 'var(--fgColor-muted)',
100
104
  pointerEvents: 'none',
101
- }, children: "Start typing or use the chat to create content..." }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(OnChangePlugin, { onChange: onChange }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(CodeHighlightingPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizerPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterInputOutputPlugin, {}), _jsx(ImagesPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(ExcalidrawPlugin, {}), _jsx(CollapsiblePlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(ComponentPickerMenuPlugin, {}), _jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] })] }) }));
105
+ }, children: "Start typing or use the chat to create content..." }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(OnChangePlugin, { onChange: onChange }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(CodeHighlightingPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizerPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterInputOutputPlugin, {}), _jsx(ImagesPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(ExcalidrawPlugin, {}), _jsx(CollapsiblePlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(ComponentPickerMenuPlugin, {}), _jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode, extraItems: toolbarItems }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), _jsx(ChatInlinePlugin, { protocol: {
106
+ type: 'ag-ui',
107
+ endpoint: `${DEFAULT_BASE_URL}/api/v1/examples/${DEFAULT_AGENT_ID}/`,
108
+ }, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] })] }) }));
102
109
  }
103
110
  export function ChatLexicalExampleInner({ serviceManager, }) {
104
111
  // Get lexical tools for ChatSidebar
@@ -17,12 +17,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  */
18
18
  import React, { useEffect, useState } from 'react';
19
19
  import { Box } from '@datalayer/primer-addons';
20
- import { Notebook } from '@datalayer/jupyter-react';
20
+ import { JupyterReactTheme, Notebook } from '@datalayer/jupyter-react';
21
21
  // Agent-runtimes imports
22
22
  import { ChatFloating } from '../components/chat';
23
23
  import { useNotebookTools } from '../tools/adapters/agent-runtimes/notebookHooks';
24
24
  // Import Matplotlib notebook
25
25
  import MatplotlibNotebook from './stores/notebooks/Matplotlib.ipynb.json';
26
+ import { DEFAULT_MODEL } from '../specs';
26
27
  // Fixed notebook ID
27
28
  const NOTEBOOK_ID = 'agui-notebook-example';
28
29
  // Use the imported Matplotlib notebook
@@ -54,7 +55,7 @@ function useEnsureAgent(agentId, baseUrl) {
54
55
  description: 'Demo agent for notebook example',
55
56
  agent_library: 'pydantic-ai',
56
57
  transport: 'ag-ui',
57
- model: 'openai:gpt-4o-mini',
58
+ model: DEFAULT_MODEL,
58
59
  system_prompt: 'You are a helpful AI assistant that helps users work with Jupyter notebooks. You can help with code, explanations, and data analysis.',
59
60
  }),
60
61
  });
@@ -106,13 +107,13 @@ const NotebookUI = React.memo(function NotebookUI({ serviceManager, }) {
106
107
  borderRadius: 2,
107
108
  padding: 3,
108
109
  backgroundColor: 'canvas.default',
109
- }, children: serviceManager ? (_jsx(Notebook, { nbformat: NOTEBOOK_CONTENT, id: NOTEBOOK_ID, serviceManager: serviceManager, height: "600px", cellSidebarMargin: 120, startDefaultKernel: true })) : (_jsx(Box, { sx: { padding: 3 }, children: _jsx("p", { children: "Loading service manager..." }) })) })] }));
110
+ }, children: serviceManager ? (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { nbformat: NOTEBOOK_CONTENT, id: NOTEBOOK_ID, serviceManager: serviceManager, height: "600px", cellSidebarMargin: 120, startDefaultKernel: true }) })) : (_jsx(Box, { sx: { padding: 3 }, children: _jsx("p", { children: "Loading service manager..." }) })) })] }));
110
111
  });
111
112
  function NotebookWithChat({ serviceManager, }) {
112
113
  // Ensure the agent exists before rendering chat
113
114
  const { isReady, error } = useEnsureAgent(AGENT_ID, BASE_URL);
114
115
  // Get notebook tools for ChatFloating
115
- const tools = useNotebookTools(NOTEBOOK_ID);
116
+ const frontendTools = useNotebookTools(NOTEBOOK_ID);
116
117
  return (_jsxs(Box, { sx: {
117
118
  height: '100vh',
118
119
  width: '100vw',
@@ -127,7 +128,7 @@ function NotebookWithChat({ serviceManager, }) {
127
128
  color: 'danger.fg',
128
129
  borderRadius: 2,
129
130
  maxWidth: 300,
130
- }, children: [_jsx("strong", { children: "Error:" }), " ", error] })), isReady && (_jsx(ChatFloating, { endpoint: AG_UI_ENDPOINT, title: "Notebook AI Agent Runtime", description: "Hi! I can help you edit notebook cells. Try: 'Add a new code cell', 'Run cell 1', or 'Delete the last cell'", defaultOpen: true, defaultViewMode: "panel", position: "bottom-right", brandColor: "#7c3aed", tools: tools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
131
+ }, children: [_jsx("strong", { children: "Error:" }), " ", error] })), isReady && (_jsx(ChatFloating, { endpoint: AG_UI_ENDPOINT, title: "Notebook AI Agent Runtime", description: "Hi! I can help you edit notebook cells. Try: 'Add a new code cell', 'Run cell 1', or 'Delete the last cell'", defaultOpen: true, defaultViewMode: "panel", position: "bottom-right", brandColor: "#7c3aed", frontendTools: frontendTools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
131
132
  {
132
133
  title: 'Add a cell',
133
134
  message: 'Insert a random cell to the notebook',
@@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
16
16
  */
17
17
  import React from 'react';
18
18
  import { Box } from '@datalayer/primer-addons';
19
- import { Notebook } from '@datalayer/jupyter-react';
19
+ import { JupyterReactTheme, Notebook } from '@datalayer/jupyter-react';
20
20
  // CopilotKit imports
21
21
  import { CopilotKit, useFrontendTool } from '@copilotkit/react-core';
22
22
  import { CopilotSidebar } from '@copilotkit/react-ui';
@@ -50,7 +50,7 @@ const NotebookUI = React.memo(function NotebookUI({ serviceManager, }) {
50
50
  borderRadius: 8,
51
51
  padding: 24,
52
52
  backgroundColor: 'var(--bgColor-default)',
53
- }, children: serviceManager ? (_jsx(Notebook, { nbformat: NOTEBOOK_CONTENT, id: NOTEBOOK_ID, serviceManager: serviceManager, height: "600px", cellSidebarMargin: 120, startDefaultKernel: true })) : (_jsx(Box, { style: { padding: 24 }, children: _jsx("p", { children: "Loading service manager..." }) })) })] }) }));
53
+ }, children: serviceManager ? (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { nbformat: NOTEBOOK_CONTENT, id: NOTEBOOK_ID, serviceManager: serviceManager, height: "600px", cellSidebarMargin: 120, startDefaultKernel: true }) })) : (_jsx(Box, { style: { padding: 24 }, children: _jsx("p", { children: "Loading service manager..." }) })) })] }) }));
54
54
  });
55
55
  /**
56
56
  * Component to register actions with CopilotKit.
@@ -10,12 +10,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
10
10
  */
11
11
  import { useMemo } from 'react';
12
12
  import { Box } from '@datalayer/primer-addons';
13
- import { Notebook, NotebookToolbar, CellSidebarExtension, CellSidebarButton, } from '@datalayer/jupyter-react';
13
+ import { JupyterReactTheme, Notebook, NotebookToolbar, CellSidebarExtension, CellSidebarButton, } from '@datalayer/jupyter-react';
14
14
  import nbformatExample from './stores/notebooks/NotebookExample1.ipynb.json';
15
15
  const NOTEBOOK_ID = 'notebook-example-1';
16
16
  export const JupyterNotebookExample = (props) => {
17
17
  const { serviceManager } = props;
18
18
  const extensions = useMemo(() => [new CellSidebarExtension({ factory: CellSidebarButton })], []);
19
- return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "Jupyter Notebook Example" }), serviceManager && (_jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformatExample, serviceManager: serviceManager, startDefaultKernel: true, extensions: extensions, Toolbar: NotebookToolbar }))] }));
19
+ return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "Jupyter Notebook Example" }), serviceManager && (_jsx(JupyterReactTheme, { children: _jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformatExample, serviceManager: serviceManager, startDefaultKernel: true, extensions: extensions, Toolbar: NotebookToolbar }) }))] }));
20
20
  };
21
21
  export default JupyterNotebookExample;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import type { AgentStatus } from '../../types/Types';
2
3
  export interface HeaderProps {
3
4
  activeSession: string;
4
5
  agentName?: string;
5
6
  agentDescription?: string;
6
- agentStatus?: 'running' | 'paused';
7
+ agentStatus?: AgentStatus;
7
8
  showContextTree: boolean;
8
9
  isNewAgent?: boolean;
9
10
  isConfigured?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@datalayer/primer-addons';
3
- import { Sparklines, SparklinesLine } from './sparklines';
3
+ import { Sparklines, SparklinesLine } from '../../components/sparklines';
4
4
  /**
5
5
  * Header Controls Component
6
6
  *
@@ -12,11 +12,16 @@ import 'prismjs/components/prism-rust';
12
12
  import 'prismjs/components/prism-swift';
13
13
  import React from 'react';
14
14
  import type { ServiceManager } from '@jupyterlab/services';
15
+ import type { ToolbarItem } from '@datalayer/primer-addons';
15
16
  import '@datalayer/jupyter-lexical/style/index.css';
16
- import '../examples/lexical/lexical-theme.css';
17
+ import '../lexical/lexical-theme.css';
17
18
  export interface LexicalEditorProps {
18
19
  content?: string;
19
20
  serviceManager?: ServiceManager.IManager;
21
+ /** Optional extra toolbar items (e.g. AI actions from useChatInlineToolbarItems) */
22
+ extraItems?: ToolbarItem[];
23
+ /** Optional additional children to render inside the LexicalComposer */
24
+ children?: React.ReactNode;
20
25
  }
21
26
  /**
22
27
  * Lexical Editor Component
@@ -34,9 +34,9 @@ import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
34
34
  import { Box } from '@datalayer/primer-addons';
35
35
  import { JupyterReactTheme, useJupyter } from '@datalayer/jupyter-react';
36
36
  import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, } from '@datalayer/jupyter-lexical';
37
- import { editorConfig } from '../examples/lexical/editorConfig';
37
+ import { editorConfig } from '../lexical/editorConfig';
38
38
  import '@datalayer/jupyter-lexical/style/index.css';
39
- import '../examples/lexical/lexical-theme.css';
39
+ import '../lexical/lexical-theme.css';
40
40
  const LEXICAL_ID = 'agent-runtime-lexical-editor';
41
41
  const INITIAL_CONTENT = undefined;
42
42
  /**
@@ -97,7 +97,7 @@ function SimpleKernelPluginsInner() {
97
97
  *
98
98
  * Rich text editor with Simple integration.
99
99
  */
100
- export const LexicalEditor = ({ content = INITIAL_CONTENT, serviceManager, }) => {
100
+ export const LexicalEditor = ({ content = INITIAL_CONTENT, serviceManager, extraItems, children, }) => {
101
101
  const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
102
102
  const [_isLinkEditMode, setIsLinkEditMode] = useState(false);
103
103
  const onRef = (_floatingAnchorElem) => {
@@ -115,5 +115,5 @@ export const LexicalEditor = ({ content = INITIAL_CONTENT, serviceManager, }) =>
115
115
  padding: 3,
116
116
  backgroundColor: 'canvas.default',
117
117
  minHeight: '600px',
118
- }, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) }));
118
+ }, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode, extraItems: extraItems }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), children] }) }) }) }));
119
119
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ServiceManager } from '@jupyterlab/services';
3
- import { type McpServerSelection } from './McpServerManager';
3
+ import { type McpServerSelection } from '../../components/McpServerManager';
4
4
  export interface MainContentProps {
5
5
  showNotebook: boolean;
6
6
  timeTravel: number;
@@ -9,9 +9,9 @@ import { Box } from '@datalayer/primer-addons';
9
9
  import { JupyterReactTheme, Viewer } from '@datalayer/jupyter-react';
10
10
  import { TimeTravel } from './TimeTravel';
11
11
  import { LexicalEditor } from './LexicalEditor';
12
- import { McpServerManager } from './McpServerManager';
13
- import matplotlib from '../examples/stores/notebooks/NotebookExample2.ipynb.json';
14
- import emptyNotebook from '../examples/stores/notebooks/Empty.ipynb.json';
12
+ import { McpServerManager, } from '../../components/McpServerManager';
13
+ import matplotlib from '../stores/notebooks/NotebookExample2.ipynb.json';
14
+ import emptyNotebook from '../stores/notebooks/Empty.ipynb.json';
15
15
  /**
16
16
  * Main Content Component
17
17
  *
@@ -30,7 +30,8 @@ export const MainContent = ({ showNotebook, timeTravel, onTimeTravelChange, rich
30
30
  }
31
31
  else if (notebookFile) {
32
32
  // Dynamically import the notebook based on the file name
33
- import(/* @vite-ignore */ `../stores/agents/${notebookFile}`)
33
+ import(
34
+ /* webpackIgnore: true */ /* @vite-ignore */ `../stores/agents/${notebookFile}`)
34
35
  .then(module => {
35
36
  setNotebookData(module.default);
36
37
  })
@@ -46,7 +47,8 @@ export const MainContent = ({ showNotebook, timeTravel, onTimeTravelChange, rich
46
47
  React.useEffect(() => {
47
48
  if (lexicalFile && !isNewAgent) {
48
49
  // Dynamically import the lexical file based on the file name
49
- import(/* @vite-ignore */ `../stores/agents/${lexicalFile}`)
50
+ import(
51
+ /* webpackIgnore: true */ /* @vite-ignore */ `../stores/agents/${lexicalFile}`)
50
52
  .then(module => {
51
53
  // Convert the JSON to a string if needed
52
54
  setLexicalContent(typeof module.default === 'string'
@@ -0,0 +1,16 @@
1
+ export { MockFileBrowser } from './MockFileBrowser';
2
+ export type { MockFileBrowserProps } from './MockFileBrowser';
3
+ export { MainContent } from './MainContent';
4
+ export type { MainContentProps } from './MainContent';
5
+ export { SessionTabs } from './SessionTabs';
6
+ export type { SessionTabsProps, Session } from './SessionTabs';
7
+ export { Header } from './Header';
8
+ export type { HeaderProps } from './Header';
9
+ export { HeaderControls } from './HeaderControls';
10
+ export type { HeaderControlsProps } from './HeaderControls';
11
+ export { FooterMetrics } from './FooterMetrics';
12
+ export type { FooterMetricsProps } from './FooterMetrics';
13
+ export { TimeTravel } from './TimeTravel';
14
+ export type { TimeTravelProps } from './TimeTravel';
15
+ export { LexicalEditor } from './LexicalEditor';
16
+ export type { LexicalEditorProps } from './LexicalEditor';
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ // Example/layout components
6
+ export { MockFileBrowser } from './MockFileBrowser';
7
+ export { MainContent } from './MainContent';
8
+ export { SessionTabs } from './SessionTabs';
9
+ export { Header } from './Header';
10
+ export { HeaderControls } from './HeaderControls';
11
+ export { FooterMetrics } from './FooterMetrics';
12
+ export { TimeTravel } from './TimeTravel';
13
+ export { LexicalEditor } from './LexicalEditor';
@@ -16,7 +16,7 @@ export const EXAMPLES = {
16
16
  AgUiSharedStateExample: () => import('./AgUiSharedStateExample'),
17
17
  AgUiToolsBasedGenUIExample: () => import('./AgUiToolsBasedGenUIExample'),
18
18
  AgentRuntimeCustomExample: () => import('./AgentRuntimeCustomExample'),
19
- AgentSpaceFormExample: () => import('./AgentSpaceFormExample'),
19
+ AgentRuntimeFormExample: () => import('./AgentRuntimeFormExample'),
20
20
  AgentRuntimeLexicalSidebarExample: () => import('./AgentRuntimeLexicalSidebarExample'),
21
21
  AgentRuntimeNotebookExample: () => import('./AgentRuntimeNotebookExample'),
22
22
  AgentRuntimeNotebookSidebarExample: () => import('./AgentRuntimeNotebookSidebarExample'),
@@ -24,6 +24,7 @@ export const EXAMPLES = {
24
24
  // AgentRuntimeLexical2Example: () =>
25
25
  // import('./AgentRuntimeLexical2Example'),
26
26
  AgentRuntimeStandaloneExample: () => import('./AgentRuntimeStandaloneExample'),
27
+ AgentRuntimeChatExample: () => import('./AgentRuntimeChatExample'),
27
28
  CopilotKitNotebookExample: () => import('./CopilotKitNotebookExample'),
28
29
  CopilotKitLexicalExample: () => import('./CopilotKitLexicalExample'),
29
30
  DatalayerNotebookExample: () => import('./DatalayerNotebookExample'),
@@ -12,7 +12,7 @@ export { default as AgentRuntimeLexicalSidebarExample } from './AgentRuntimeLexi
12
12
  export { default as AgentRuntimeNotebookExample } from './AgentRuntimeNotebookExample';
13
13
  export { default as AgentRuntimeNotebookSidebarExample } from './AgentRuntimeNotebookSidebarExample';
14
14
  export { default as AgentRuntimeStandaloneExample } from './AgentRuntimeStandaloneExample';
15
- export { default as AgentSpaceFormExample } from './AgentSpaceFormExample';
15
+ export { default as AgentRuntimeFormExample } from './AgentRuntimeFormExample';
16
16
  export { default as CopilotKitLexicalExample } from './CopilotKitLexicalExample';
17
17
  export { default as CopilotKitNotebookExample } from './CopilotKitNotebookExample';
18
18
  export { default as DatalayerNotebookExample } from './DatalayerNotebookExample';
@@ -16,7 +16,7 @@ export { default as AgentRuntimeLexicalSidebarExample } from './AgentRuntimeLexi
16
16
  export { default as AgentRuntimeNotebookExample } from './AgentRuntimeNotebookExample';
17
17
  export { default as AgentRuntimeNotebookSidebarExample } from './AgentRuntimeNotebookSidebarExample';
18
18
  export { default as AgentRuntimeStandaloneExample } from './AgentRuntimeStandaloneExample';
19
- export { default as AgentSpaceFormExample } from './AgentSpaceFormExample';
19
+ export { default as AgentRuntimeFormExample } from './AgentRuntimeFormExample';
20
20
  export { default as CopilotKitLexicalExample } from './CopilotKitLexicalExample';
21
21
  export { default as CopilotKitNotebookExample } from './CopilotKitNotebookExample';
22
22
  export { default as DatalayerNotebookExample } from './DatalayerNotebookExample';
@@ -8,7 +8,7 @@ import { useEffect, useState } from 'react';
8
8
  import { createRoot } from 'react-dom/client';
9
9
  import { loadJupyterConfig, JupyterReactTheme, createServerSettings, setJupyterServerUrl, setJupyterServerToken, getJupyterServerUrl, getJupyterServerToken, } from '@datalayer/jupyter-react';
10
10
  import { ServiceManager } from '@jupyterlab/services';
11
- import { coreStore, iamStore, createDatalayerServiceManager, } from '@datalayer/core';
11
+ import { coreStore, iamStore, createDatalayerServiceManager, DatalayerThemeProvider, } from '@datalayer/core';
12
12
  import { useChatStore } from '../components/chat/store';
13
13
  import { OAuthCallback } from '../identity';
14
14
  import { EXAMPLES } from './example-selector';
@@ -292,7 +292,7 @@ export const ExampleApp = () => {
292
292
  if (serviceManager) {
293
293
  exampleProps.serviceManager = serviceManager;
294
294
  }
295
- return (_jsx(JupyterReactTheme, { children: _jsxs("div", { style: { width: '100vw', height: '100vh', overflow: 'hidden' }, children: [_jsxs("div", { style: {
295
+ return (_jsx(DatalayerThemeProvider, { children: _jsxs("div", { style: { width: '100vw', height: '100vh', overflow: 'hidden' }, children: [_jsxs("div", { style: {
296
296
  position: 'fixed',
297
297
  top: 0,
298
298
  left: 0,
@@ -1,26 +1,5 @@
1
- export type AgentStatus = 'running' | 'paused';
2
- export type Transport = 'acp' | 'ag-ui' | 'vercel-ai' | 'a2a';
3
- export interface Agent {
4
- id: string;
5
- name: string;
6
- description: string;
7
- author: string;
8
- lastEdited: string;
9
- screenshot: string;
10
- status?: AgentStatus;
11
- transport: Transport;
12
- avatarUrl: string;
13
- notebookFile: string;
14
- lexicalFile: string;
15
- stars: number;
16
- notifications: number;
17
- }
18
- export type AgentsState = {
19
- agents: readonly Agent[];
20
- getAgentById: (id: string) => Agent | undefined;
21
- updateAgentStatus: (id: string, status: AgentStatus) => void;
22
- toggleAgentStatus: (id: string) => void;
23
- };
1
+ import type { Agent, AgentStatus, AgentsState, Transport } from '../../types/Types';
2
+ export type { Agent, AgentStatus, AgentsState, Transport };
24
3
  export declare const agentsStore: any;
25
4
  export declare function useAgentsStore(): AgentsState;
26
5
  export declare function useAgentsStore<T>(selector: (state: AgentsState) => T): T;
package/lib/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from './state';
3
3
  export * from './runtime';
4
4
  export * from './identity';
5
5
  export * from './config';
6
- export type { ConversationEntry, MCPServer, AgentSkillSpec, AgentSpec, AIModel, FrontendConfig, BuiltinTool, MCPServerTool, } from './types';
6
+ export * from './specs';
7
+ export type { ConversationEntry, MCPServer, AgentSkillSpec, AgentSpec, AIModelRuntime, FrontendConfig, BuiltinTool, MCPServerTool, } from './types/Types';
package/lib/index.js CHANGED
@@ -7,3 +7,4 @@ export * from './state';
7
7
  export * from './runtime';
8
8
  export * from './identity';
9
9
  export * from './config';
10
+ export * from './specs';
@@ -11,11 +11,22 @@ export declare const RESTORE_SELECTION_COMMAND: LexicalCommand<null>;
11
11
  export interface ChatInlinePluginProps {
12
12
  /** Protocol configuration for the AI agent */
13
13
  protocol: ChatInlineProtocolConfig;
14
+ /** Whether the AI chat panel is open (controlled by useChatInlineToolbarItems) */
15
+ isOpen: boolean;
16
+ /** Callback to close the AI chat panel */
17
+ onClose: () => void;
18
+ /** A pending prompt to submit automatically (from toolbar dropdown action) */
19
+ pendingPrompt?: string | null;
20
+ /** Callback after the pending prompt has been consumed */
21
+ onPendingPromptConsumed?: () => void;
14
22
  /** Optional: Container element for the portal (defaults to document.body) */
15
23
  portalContainer?: HTMLElement;
16
24
  }
17
25
  /**
18
- * ChatInlinePlugin - Floating AI toolbar for Lexical text selection.
26
+ * ChatInlinePlugin - Floating AI chat panel for Lexical text selection.
27
+ *
28
+ * This plugin is controlled externally via `isOpen` prop. It positions a
29
+ * ChatInline component near the text selection when open.
19
30
  */
20
- export declare function ChatInlinePlugin({ protocol, portalContainer, }: ChatInlinePluginProps): JSX.Element | null;
31
+ export declare function ChatInlinePlugin({ protocol, isOpen, onClose, pendingPrompt, onPendingPromptConsumed, portalContainer, }: ChatInlinePluginProps): JSX.Element | null;
21
32
  export default ChatInlinePlugin;