@datalayer/agent-runtimes 0.0.11 → 1.0.0
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.
- package/README.md +2 -2
- package/lib/Agent.d.ts +29 -0
- package/lib/Agent.js +131 -0
- package/lib/AgentLexical.d.ts +33 -0
- package/lib/AgentLexical.js +295 -0
- package/lib/AgentNotebook.d.ts +19 -0
- package/lib/AgentNotebook.js +192 -0
- package/lib/agent-lexical-main.d.ts +1 -0
- package/lib/agent-lexical-main.js +11 -0
- package/lib/agent-main.d.ts +1 -0
- package/lib/agent-main.js +11 -0
- package/lib/agent-notebook-main.d.ts +1 -0
- package/lib/agent-notebook-main.js +12 -0
- package/lib/components/AgentConfiguration.d.ts +4 -22
- package/lib/components/AgentConfiguration.js +8 -8
- package/lib/components/chat/components/AgentDetails.d.ts +3 -1
- package/lib/components/chat/components/AgentDetails.js +6 -6
- package/lib/components/chat/components/Chat.d.ts +29 -3
- package/lib/components/chat/components/Chat.js +64 -59
- package/lib/components/chat/components/ChatFloating.d.ts +34 -12
- package/lib/components/chat/components/ChatFloating.js +54 -21
- package/lib/components/chat/components/ChatInline.d.ts +5 -1
- package/lib/components/chat/components/ChatInline.js +8 -1
- package/lib/components/chat/components/ChatSidebar.d.ts +6 -1
- package/lib/components/chat/components/ChatSidebar.js +2 -2
- package/lib/components/chat/components/ChatStandalone.d.ts +6 -1
- package/lib/components/chat/components/ChatStandalone.js +2 -2
- package/lib/components/chat/components/base/ChatBase.d.ts +49 -8
- package/lib/components/chat/components/base/ChatBase.js +544 -149
- package/lib/components/chat/components/base/InputPrompt.d.ts +42 -0
- package/lib/components/chat/components/base/InputPrompt.js +131 -0
- package/lib/components/chat/components/index.d.ts +3 -3
- package/lib/components/chat/components/index.js +1 -1
- package/lib/components/chat/components/parts/ReasoningPart.js +2 -4
- package/lib/components/chat/components/parts/TextPart.js +2 -70
- package/lib/components/chat/components/styles/streamdownStyles.d.ts +23 -0
- package/lib/components/chat/components/styles/streamdownStyles.js +319 -0
- package/lib/components/chat/index.d.ts +1 -1
- package/lib/components/chat/index.js +1 -1
- package/lib/components/chat/inference/DatalayerInferenceProvider.js +16 -12
- package/lib/components/chat/inference/SelfHostedInferenceProvider.js +16 -12
- package/lib/components/chat/protocols/AGUIAdapter.d.ts +10 -3
- package/lib/components/chat/protocols/AGUIAdapter.js +123 -44
- package/lib/components/chat/types/tool.d.ts +5 -2
- package/lib/components/index.d.ts +1 -18
- package/lib/components/index.js +0 -9
- package/lib/config/index.d.ts +0 -4
- package/lib/config/index.js +0 -4
- package/lib/examples/A2UiRestaurantExample.js +1 -1
- package/lib/examples/AgentRuntimeChatExample.d.ts +15 -0
- package/lib/examples/AgentRuntimeChatExample.js +126 -0
- package/lib/examples/{AgentSpaceFormExample.d.ts → AgentRuntimeFormExample.d.ts} +3 -3
- package/lib/examples/{AgentSpaceFormExample.js → AgentRuntimeFormExample.js} +10 -8
- package/lib/examples/AgentRuntimeLexical2Example.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexical2Example.js +0 -1
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexicalExample.js +6 -4
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +8 -2
- package/lib/examples/AgentRuntimeNotebookExample.js +6 -5
- package/lib/examples/CopilotKitLexicalExample.d.ts +0 -1
- package/lib/examples/CopilotKitLexicalExample.js +0 -1
- package/lib/examples/CopilotKitNotebookExample.js +2 -2
- package/lib/examples/JupyterNotebookExample.js +2 -2
- package/lib/{components → examples/components}/Header.d.ts +2 -1
- package/lib/{components → examples/components}/HeaderControls.js +1 -1
- package/lib/{components → examples/components}/LexicalEditor.d.ts +6 -1
- package/lib/{components → examples/components}/LexicalEditor.js +4 -4
- package/lib/{components → examples/components}/MainContent.d.ts +1 -1
- package/lib/{components → examples/components}/MainContent.js +7 -5
- package/lib/examples/components/index.d.ts +16 -0
- package/lib/examples/components/index.js +13 -0
- package/lib/examples/example-selector.js +2 -1
- package/lib/examples/index.d.ts +1 -1
- package/lib/examples/index.js +1 -1
- package/lib/examples/main.js +2 -2
- package/lib/examples/stores/examplesStore.d.ts +2 -23
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/lexical/ChatInlinePlugin.d.ts +13 -2
- package/lib/lexical/ChatInlinePlugin.js +66 -183
- package/lib/lexical/index.d.ts +1 -0
- package/lib/lexical/index.js +1 -0
- package/lib/lexical/useChatInlineToolbarItems.d.ts +35 -0
- package/lib/lexical/useChatInlineToolbarItems.js +91 -0
- package/lib/runtime/useAgentRuntime.d.ts +1 -1
- package/lib/runtime/useAgentRuntime.js +1 -1
- package/lib/{config/agents/code-ai → specs/agents/codeai}/agents.d.ts +5 -2
- package/lib/specs/agents/codeai/agents.js +151 -0
- package/lib/{config → specs}/agents/codemode-paper/agents.d.ts +4 -2
- package/lib/{config → specs}/agents/codemode-paper/agents.js +39 -19
- package/lib/{config → specs}/agents/datalayer-ai/agents.d.ts +4 -2
- package/lib/{config → specs}/agents/datalayer-ai/agents.js +17 -2
- package/lib/{config → specs}/agents/index.d.ts +3 -1
- package/lib/{config → specs}/agents/index.js +12 -3
- package/lib/{config → specs}/envvars.d.ts +1 -0
- package/lib/{config → specs}/envvars.js +10 -0
- package/lib/specs/index.d.ts +5 -0
- package/lib/specs/index.js +9 -0
- package/lib/{config → specs}/mcpServers.d.ts +2 -1
- package/lib/{config → specs}/mcpServers.js +23 -1
- package/lib/specs/models.d.ts +68 -0
- package/lib/specs/models.js +239 -0
- package/lib/state/substates/AIAgentState.d.ts +0 -1
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +11 -22
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +5 -5
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -6
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +4 -4
- package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +6 -6
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +4 -4
- package/lib/{types.d.ts → types/Types.d.ts} +32 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +11 -5
- package/scripts/codegen/generate_agents.py +53 -13
- package/scripts/codegen/generate_envvars.py +1 -1
- package/scripts/codegen/generate_mcp_servers.py +5 -5
- package/scripts/codegen/generate_models.py +486 -0
- package/scripts/codegen/generate_skills.py +2 -2
- package/style/primer-primitives.css +22 -0
- package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +0 -37
- package/lib/components/chat/components/elements/ChatInputPrompt.js +0 -150
- package/lib/config/agents/code-ai/agents.js +0 -70
- /package/lib/{components → examples/components}/FooterMetrics.d.ts +0 -0
- /package/lib/{components → examples/components}/FooterMetrics.js +0 -0
- /package/lib/{components → examples/components}/Header.js +0 -0
- /package/lib/{components → examples/components}/HeaderControls.d.ts +0 -0
- /package/lib/{components → examples/components}/MockFileBrowser.d.ts +0 -0
- /package/lib/{components → examples/components}/MockFileBrowser.js +0 -0
- /package/lib/{components → examples/components}/SessionTabs.d.ts +0 -0
- /package/lib/{components → examples/components}/SessionTabs.js +0 -0
- /package/lib/{components → examples/components}/TimeTravel.d.ts +0 -0
- /package/lib/{components → examples/components}/TimeTravel.js +0 -0
- /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.d.ts +0 -0
- /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.js +0 -0
- /package/lib/{config → specs}/agents/codemode-paper/index.d.ts +0 -0
- /package/lib/{config → specs}/agents/codemode-paper/index.js +0 -0
- /package/lib/{config → specs}/agents/datalayer-ai/index.d.ts +0 -0
- /package/lib/{config → specs}/agents/datalayer-ai/index.js +0 -0
- /package/lib/{config → specs}/skills.d.ts +0 -0
- /package/lib/{config → specs}/skills.js +0 -0
- /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,
|
|
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
|
|
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(`[
|
|
264
|
+
console.log(`[AgentRuntimeFormExample] ${provider} connected with token`);
|
|
263
265
|
})
|
|
264
266
|
.catch(err => {
|
|
265
|
-
console.error(`[
|
|
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('[
|
|
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('[
|
|
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('[
|
|
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
|
|
647
|
+
export default AgentRuntimeFormExample;
|
|
@@ -27,7 +27,6 @@ import 'prismjs/components/prism-rust';
|
|
|
27
27
|
import 'prismjs/components/prism-swift';
|
|
28
28
|
import type { ServiceManager } from '@jupyterlab/services';
|
|
29
29
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
30
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
31
30
|
import './lexical/lexical-theme.css';
|
|
32
31
|
/**
|
|
33
32
|
* Chat Lexical Example with Simple integration
|
|
@@ -54,7 +54,6 @@ import { ChatFloating, useChatStore, useFrontendTool, DatalayerInferenceProvider
|
|
|
54
54
|
import { useLexicalToolActions, ActionRegistrar, } from '../tools/adapters/copilotkit/lexicalHooks';
|
|
55
55
|
import { editorConfig } from './lexical/editorConfig';
|
|
56
56
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
57
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
58
57
|
import './lexical/lexical-theme.css';
|
|
59
58
|
// Fixed lexical document ID
|
|
60
59
|
const LEXICAL_ID = 'chat-popup-lexical-example';
|
|
@@ -25,7 +25,6 @@ import 'prismjs/components/prism-swift';
|
|
|
25
25
|
import type { ServiceManager } from '@jupyterlab/services';
|
|
26
26
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
27
27
|
import './lexical/lexical-theme.css';
|
|
28
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
29
28
|
/**
|
|
30
29
|
* Main Agent Runtime lexical example component
|
|
31
30
|
*/
|
|
@@ -49,11 +49,11 @@ 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';
|
|
55
56
|
import './lexical/lexical-theme.css';
|
|
56
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
57
57
|
// Fixed lexical document ID
|
|
58
58
|
const LEXICAL_ID = 'agui-lexical-example';
|
|
59
59
|
// Base URL for agent-runtimes server
|
|
@@ -187,6 +187,8 @@ function LexicalToolsPlugin({ onToolsReady, }) {
|
|
|
187
187
|
const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, serviceManager, onToolsReady, }) {
|
|
188
188
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
189
189
|
const [_isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
190
|
+
// AI actions registered as toolbar items via the primer-addons toolbar extensibility
|
|
191
|
+
const { toolbarItems, isAiOpen, pendingPrompt, clearPendingPrompt, closeAi } = useChatInlineToolbarItems();
|
|
190
192
|
const onRef = (_floatingAnchorElem) => {
|
|
191
193
|
if (_floatingAnchorElem !== null) {
|
|
192
194
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
@@ -213,10 +215,10 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
|
|
|
213
215
|
padding: 3,
|
|
214
216
|
backgroundColor: 'canvas.default',
|
|
215
217
|
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: {
|
|
218
|
+
}, 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
219
|
type: 'ag-ui',
|
|
218
220
|
endpoint: AG_UI_ENDPOINT,
|
|
219
|
-
} })] }) })] }) })] }));
|
|
221
|
+
}, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] }) })] }) })] }));
|
|
220
222
|
});
|
|
221
223
|
function LexicalWithChat({ content, serviceManager, }) {
|
|
222
224
|
// Ensure the agent exists before rendering chat
|
|
@@ -244,7 +246,7 @@ function LexicalWithChat({ content, serviceManager, }) {
|
|
|
244
246
|
color: 'danger.fg',
|
|
245
247
|
borderRadius: 2,
|
|
246
248
|
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",
|
|
249
|
+
}, 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
250
|
{
|
|
249
251
|
title: 'Insert heading',
|
|
250
252
|
message: 'Insert a heading that says "Welcome"',
|
|
@@ -26,7 +26,6 @@ import 'prismjs/components/prism-rust';
|
|
|
26
26
|
import 'prismjs/components/prism-swift';
|
|
27
27
|
import type { ServiceManager } from '@jupyterlab/services';
|
|
28
28
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
29
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
30
29
|
import './lexical/lexical-theme.css';
|
|
31
30
|
/**
|
|
32
31
|
* Agent Runtime Lexical Sidebar Example with Simple integration
|
|
@@ -49,10 +49,11 @@ 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';
|
|
55
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
56
57
|
import './lexical/lexical-theme.css';
|
|
57
58
|
// Fixed lexical document ID
|
|
58
59
|
const LEXICAL_ID = 'chat-lexical-example';
|
|
@@ -72,6 +73,8 @@ function CodeHighlightingPlugin() {
|
|
|
72
73
|
function LexicalEditor({ serviceManager }) {
|
|
73
74
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
74
75
|
const [_isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
76
|
+
// AI actions registered as toolbar items
|
|
77
|
+
const { toolbarItems, isAiOpen, pendingPrompt, clearPendingPrompt, closeAi } = useChatInlineToolbarItems();
|
|
75
78
|
const onRef = (_floatingAnchorElem) => {
|
|
76
79
|
if (_floatingAnchorElem !== null) {
|
|
77
80
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
@@ -98,7 +101,10 @@ function LexicalEditor({ serviceManager }) {
|
|
|
98
101
|
left: '24px',
|
|
99
102
|
color: 'var(--fgColor-muted)',
|
|
100
103
|
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 })] }))
|
|
104
|
+
}, 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: {
|
|
105
|
+
type: 'ag-ui',
|
|
106
|
+
endpoint: `${DEFAULT_BASE_URL}/api/v1/examples/${DEFAULT_AGENT_ID}/`,
|
|
107
|
+
}, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] })] }) }));
|
|
102
108
|
}
|
|
103
109
|
export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
104
110
|
// 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:
|
|
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
|
|
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",
|
|
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',
|
|
@@ -26,7 +26,6 @@ import 'prismjs/components/prism-swift';
|
|
|
26
26
|
import type { ServiceManager } from '@jupyterlab/services';
|
|
27
27
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
28
28
|
import '@copilotkit/react-ui/styles.css';
|
|
29
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
30
29
|
import './lexical/lexical-theme.css';
|
|
31
30
|
/**
|
|
32
31
|
* Main CopilotKit lexical example component
|
|
@@ -53,7 +53,6 @@ import { ActionRegistrar, useLexicalToolActions, } from '../tools/adapters/copil
|
|
|
53
53
|
import { editorConfig } from './lexical/editorConfig';
|
|
54
54
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
55
55
|
import '@copilotkit/react-ui/styles.css';
|
|
56
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
57
56
|
import './lexical/lexical-theme.css';
|
|
58
57
|
// Fixed lexical document ID
|
|
59
58
|
const LEXICAL_ID = 'agui-lexical-example';
|
|
@@ -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?:
|
|
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 '
|
|
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 '../
|
|
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 '../
|
|
37
|
+
import { editorConfig } from '../lexical/editorConfig';
|
|
38
38
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
39
|
-
import '../
|
|
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 '
|
|
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 '
|
|
13
|
-
import matplotlib from '../
|
|
14
|
-
import emptyNotebook from '../
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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'),
|
package/lib/examples/index.d.ts
CHANGED
|
@@ -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
|
|
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';
|
package/lib/examples/index.js
CHANGED
|
@@ -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
|
|
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';
|
package/lib/examples/main.js
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
2
|
-
export type
|
|
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
|
|
6
|
+
export * from './specs';
|
|
7
|
+
export type { ConversationEntry, MCPServer, AgentSkillSpec, AgentSpec, AIModelRuntime, FrontendConfig, BuiltinTool, MCPServerTool, } from './types/Types';
|
package/lib/index.js
CHANGED
|
@@ -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
|
|
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;
|