@datalayer/agent-runtimes 1.0.0 → 1.0.2
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/lib/Agent.js +1 -2
- package/lib/AgentLexical.js +1 -2
- package/lib/AgentNotebook.js +1 -2
- package/lib/components/McpServerManager.d.ts +1 -1
- package/lib/components/McpServerManager.js +1 -1
- package/lib/components/chat/components/Chat.d.ts +1 -1
- package/lib/components/chat/components/ChatFloating.d.ts +4 -2
- package/lib/components/chat/components/ChatFloating.js +1 -1
- package/lib/components/chat/components/base/ChatBase.d.ts +1 -1
- package/lib/components/chat/components/base/ChatBase.js +4 -2
- package/lib/components/chat/store/conversationStore.d.ts +1 -1
- package/lib/components/chat/store/conversationStore.js +2 -2
- package/lib/examples/A2UiRestaurantExample.js +2 -2
- package/lib/examples/AgUiAgenticExample.js +3 -3
- package/lib/examples/AgUiBackendToolRenderingExample.js +4 -3
- package/lib/examples/AgUiHaikuGenUIExample.js +4 -3
- package/lib/examples/AgUiHumanInTheLoopExample.js +4 -3
- package/lib/examples/AgUiSharedStateExample.js +4 -3
- package/lib/examples/AgUiToolsBasedGenUIExample.js +4 -3
- package/lib/examples/AgentRuntimeChatExample.js +3 -3
- package/lib/examples/AgentRuntimeCustomExample.js +2 -2
- package/lib/examples/AgentRuntimeFormExample.js +2 -2
- package/lib/examples/AgentRuntimeLexical2Example.js +3 -2
- package/lib/examples/AgentRuntimeLexicalExample.js +4 -3
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +3 -2
- package/lib/examples/AgentRuntimeNotebookExample.js +4 -3
- package/lib/examples/AgentRuntimeNotebookSidebarExample.js +3 -2
- package/lib/examples/AgentRuntimeStandaloneExample.js +3 -3
- package/lib/examples/CopilotKitLexicalExample.js +3 -2
- package/lib/examples/CopilotKitNotebookExample.js +3 -2
- package/lib/examples/DatalayerNotebookExample.js +3 -2
- package/lib/examples/JupyterCellExample.js +3 -2
- package/lib/examples/JupyterNotebookExample.js +3 -2
- package/lib/examples/main.js +68 -18
- package/lib/examples/stores/themeStore.d.ts +33 -0
- package/lib/examples/stores/themeStore.js +38 -0
- package/lib/examples/stores/themedProvider.d.ts +45 -0
- package/lib/examples/stores/themedProvider.js +54 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/index.js +8 -0
- package/lib/hooks/useAgentRuntimes.d.ts +350 -0
- package/lib/hooks/useAgentRuntimes.js +78 -0
- package/lib/hooks/useAgentStore.d.ts +30 -0
- package/lib/hooks/useAgentStore.js +22 -0
- package/lib/specs/agents/codeai/agents.d.ts +1 -1
- package/lib/specs/agents/codeai/agents.js +28 -0
- package/lib/specs/agents/codemode-paper/agents.d.ts +1 -1
- package/lib/specs/agents/codemode-paper/agents.js +71 -1
- package/lib/specs/agents/datalayer-ai/agents.d.ts +1 -1
- package/lib/specs/agents/datalayer-ai/agents.js +70 -0
- package/lib/specs/agents/index.js +2 -0
- package/lib/specs/agents/mocks/agents.d.ts +43 -0
- package/lib/specs/agents/mocks/agents.js +2293 -0
- package/lib/specs/agents/mocks/index.d.ts +1 -0
- package/lib/specs/agents/mocks/index.js +5 -0
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +16 -0
- package/lib/specs/models.d.ts +2 -2
- package/lib/specs/models.js +5 -5
- package/lib/types/Types.d.ts +29 -1
- package/package.json +4 -3
- package/scripts/codegen/generate_agents.py +95 -2
package/lib/Agent.js
CHANGED
|
@@ -25,8 +25,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
25
25
|
import { useEffect, useState } from 'react';
|
|
26
26
|
import { Text, Spinner } from '@primer/react';
|
|
27
27
|
import { AlertIcon } from '@primer/octicons-react';
|
|
28
|
-
import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
|
|
29
|
-
import { DatalayerThemeProvider } from '@datalayer/core';
|
|
28
|
+
import { Box, DatalayerThemeProvider, setupPrimerPortals, } from '@datalayer/primer-addons';
|
|
30
29
|
import { Chat } from './components/chat';
|
|
31
30
|
import { DEFAULT_MODEL } from './specs';
|
|
32
31
|
import '../style/primer-primitives.css';
|
package/lib/AgentLexical.js
CHANGED
|
@@ -48,8 +48,7 @@ import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
|
48
48
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
49
49
|
import { Text, Spinner } from '@primer/react';
|
|
50
50
|
import { AlertIcon } from '@primer/octicons-react';
|
|
51
|
-
import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
|
|
52
|
-
import { DatalayerThemeProvider } from '@datalayer/core';
|
|
51
|
+
import { Box, DatalayerThemeProvider, setupPrimerPortals, } from '@datalayer/primer-addons';
|
|
53
52
|
import { JupyterReactTheme, loadJupyterConfig, createServerSettings, getJupyterServerUrl, getJupyterServerToken, setJupyterServerUrl, setJupyterServerToken, useJupyter, } from '@datalayer/jupyter-react';
|
|
54
53
|
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, ExcalidrawPlugin, CollapsiblePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, TableCellResizerPlugin, TablePlugin, } from '@datalayer/jupyter-lexical';
|
|
55
54
|
import { ServiceManager } from '@jupyterlab/services';
|
package/lib/AgentNotebook.js
CHANGED
|
@@ -21,8 +21,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
21
21
|
import { useEffect, useState } from 'react';
|
|
22
22
|
import { Text, Spinner } from '@primer/react';
|
|
23
23
|
import { AlertIcon } from '@primer/octicons-react';
|
|
24
|
-
import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
|
|
25
|
-
import { DatalayerThemeProvider } from '@datalayer/core';
|
|
24
|
+
import { Box, DatalayerThemeProvider, setupPrimerPortals, } from '@datalayer/primer-addons';
|
|
26
25
|
import { Notebook, JupyterReactTheme, loadJupyterConfig, createServerSettings, getJupyterServerUrl, getJupyterServerToken, setJupyterServerUrl, setJupyterServerToken, } from '@datalayer/jupyter-react';
|
|
27
26
|
import { ServiceManager } from '@jupyterlab/services';
|
|
28
27
|
import { Chat } from './components/chat';
|
|
@@ -17,7 +17,7 @@ export interface McpServerManagerProps {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* McpServerManager - Manage MCP servers for agent
|
|
20
|
+
* McpServerManager - Manage MCP servers for agent runtimes
|
|
21
21
|
*
|
|
22
22
|
* Features:
|
|
23
23
|
* - View MCP Catalog servers (predefined, can be enabled on-demand)
|
|
@@ -9,7 +9,7 @@ import { ToolsIcon, PlusIcon, TrashIcon, SyncIcon, ServerIcon, CheckIcon, Search
|
|
|
9
9
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
10
10
|
import { Box } from '@datalayer/primer-addons';
|
|
11
11
|
/**
|
|
12
|
-
* McpServerManager - Manage MCP servers for agent
|
|
12
|
+
* McpServerManager - Manage MCP servers for agent runtimes
|
|
13
13
|
*
|
|
14
14
|
* Features:
|
|
15
15
|
* - View MCP Catalog servers (predefined, can be enabled on-demand)
|
|
@@ -99,7 +99,7 @@ export interface ChatProps {
|
|
|
99
99
|
/**
|
|
100
100
|
* Runtime ID for conversation persistence.
|
|
101
101
|
* When provided, messages are fetched from the server API on page reload
|
|
102
|
-
* and prevents message mixing between different agent
|
|
102
|
+
* and prevents message mixing between different agent runtimes.
|
|
103
103
|
*/
|
|
104
104
|
runtimeId?: string;
|
|
105
105
|
/**
|
|
@@ -65,7 +65,9 @@ export interface ChatFloatingProps {
|
|
|
65
65
|
showPoweredBy?: boolean;
|
|
66
66
|
/** Powered by tag props */
|
|
67
67
|
poweredByProps?: Partial<PoweredByTagProps>;
|
|
68
|
-
/** Enable click outside to close
|
|
68
|
+
/** Enable click outside to close
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
69
71
|
clickOutsideToClose?: boolean;
|
|
70
72
|
/** Enable escape key to close */
|
|
71
73
|
escapeToClose?: boolean;
|
|
@@ -89,7 +91,7 @@ export interface ChatFloatingProps {
|
|
|
89
91
|
buttonIcon?: React.ReactNode;
|
|
90
92
|
/** Button tooltip text */
|
|
91
93
|
buttonTooltip?: string;
|
|
92
|
-
/** Brand color */
|
|
94
|
+
/** Brand color override. Defaults to the theme's `accent.emphasis` token. */
|
|
93
95
|
brandColor?: string;
|
|
94
96
|
/** Offset from edge (in pixels) */
|
|
95
97
|
offset?: number;
|
|
@@ -43,7 +43,7 @@ function useIsMobile(breakpoint = 640) {
|
|
|
43
43
|
* ChatFloating component
|
|
44
44
|
* A floating chat window built on ChatBase
|
|
45
45
|
*/
|
|
46
|
-
export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useStoreMode = true, title = 'Chat', description = 'Start a conversation with the AI agent.', position = 'bottom-right', defaultOpen = false, width = 400, height = 550, showHeader = true, showButton = true, showNewChatButton = true, showClearButton = true, showSettingsButton = false, enableKeyboardShortcuts = true, toggleShortcut = '/', showPoweredBy = true, poweredByProps, clickOutsideToClose =
|
|
46
|
+
export function ChatFloating({ endpoint, protocol: protocolProp, useStore: useStoreMode = true, title = 'Chat', description = 'Start a conversation with the AI agent.', position = 'bottom-right', defaultOpen = false, width = 400, height = 550, showHeader = true, showButton = true, showNewChatButton = true, showClearButton = true, showSettingsButton = false, enableKeyboardShortcuts = true, toggleShortcut = '/', showPoweredBy = true, poweredByProps, clickOutsideToClose = false, escapeToClose = true, className, onSettingsClick, onNewChat, onOpen, onClose, onStateUpdate, children, brandIcon, buttonIcon, buttonTooltip = 'Chat with AI', brandColor, offset = 20, animationDuration = 200, renderToolResult, frontendTools, initialState: _initialState, suggestions, submitOnSuggestionClick = true, hideMessagesAfterToolUI = false, defaultViewMode = 'floating', onViewModeChange, showPanelBackdrop = false, availableModels, showModelSelector = false, showToolsMenu = false, showSkillsMenu = false, showTokenUsage = true, runtimeId, historyEndpoint, historyAuthToken, pendingPrompt, showInformation = false, onInformationClick, panelProps, }) {
|
|
47
47
|
// Store-based state
|
|
48
48
|
const storeIsOpen = useChatOpen();
|
|
49
49
|
const storeMessages = useChatMessages();
|
|
@@ -427,7 +427,7 @@ export interface ChatBaseProps {
|
|
|
427
427
|
/**
|
|
428
428
|
* Runtime ID for conversation persistence.
|
|
429
429
|
* When provided, messages are fetched from the server API on page reload
|
|
430
|
-
* and prevents message mixing between different agent
|
|
430
|
+
* and prevents message mixing between different agent runtimes.
|
|
431
431
|
*/
|
|
432
432
|
runtimeId?: string;
|
|
433
433
|
/**
|
|
@@ -714,7 +714,7 @@ pendingPrompt, }) {
|
|
|
714
714
|
// Track previous runtimeId to detect changes
|
|
715
715
|
const prevRuntimeIdRef = useRef(undefined);
|
|
716
716
|
// Clear displayItems and load messages when runtimeId changes
|
|
717
|
-
// This ensures each agent
|
|
717
|
+
// This ensures each agent runtime has isolated conversation history
|
|
718
718
|
useEffect(() => {
|
|
719
719
|
// If runtimeId changed, clear displayItems first
|
|
720
720
|
if (runtimeId !== prevRuntimeIdRef.current) {
|
|
@@ -1795,7 +1795,9 @@ pendingPrompt, }) {
|
|
|
1795
1795
|
}, children: [emptyState?.icon || brandIcon || _jsx(AiAgentIcon, { colored: true, size: 48 }), _jsx(Text, { sx: { fontSize: 2 }, children: emptyState?.title || 'Start a conversation' }), (emptyState?.subtitle || description) && (_jsx(Text, { sx: { fontSize: 1 }, children: emptyState?.subtitle || description })), suggestions && suggestions.length > 0 && (_jsx(LabelGroup, { sx: { mt: 2, justifyContent: 'center' }, children: suggestions.map((suggestion, index) => (_jsx(Label, { variant: "accent", sx: {
|
|
1796
1796
|
cursor: 'pointer',
|
|
1797
1797
|
'&:hover': {
|
|
1798
|
-
bg: 'accent.
|
|
1798
|
+
bg: 'accent.emphasis',
|
|
1799
|
+
color: 'var(--button-primary-fgColor-rest)',
|
|
1800
|
+
borderColor: 'accent.emphasis',
|
|
1799
1801
|
},
|
|
1800
1802
|
}, onClick: () => handleSuggestionClick(suggestion), children: suggestion.title }, index))) }))] }));
|
|
1801
1803
|
};
|
|
@@ -3,7 +3,7 @@ import type { ChatMessage } from '../types/message';
|
|
|
3
3
|
* Conversation data for a single runtime
|
|
4
4
|
*/
|
|
5
5
|
export interface ConversationData {
|
|
6
|
-
/**
|
|
6
|
+
/** Agent runtime ID */
|
|
7
7
|
runtimeId: string;
|
|
8
8
|
/** Messages in this conversation */
|
|
9
9
|
messages: ChatMessage[];
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Zustand store for conversation history per
|
|
6
|
+
* Zustand store for conversation history per agent runtime.
|
|
7
7
|
* Stores messages per runtime ID in memory during the session.
|
|
8
8
|
*
|
|
9
9
|
* Key features:
|
|
10
|
-
* - Messages are stored per runtime ID
|
|
10
|
+
* - Messages are stored per runtime ID in memory
|
|
11
11
|
* - On page reload, messages are fetched from the server API
|
|
12
12
|
* - No browser storage persistence - server is the source of truth
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
*/
|
|
21
21
|
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
22
22
|
import { Box } from '@datalayer/primer-addons';
|
|
23
|
-
import {
|
|
23
|
+
import { ThemedProvider } from './stores/themedProvider';
|
|
24
24
|
import { Text, Spinner, TextInput, Button } from '@primer/react';
|
|
25
25
|
import { A2UIProvider, A2UIRenderer, useA2UI } from '../renderers/a2ui';
|
|
26
26
|
// A2UI endpoint for pydantic-ai restaurant agent
|
|
@@ -278,7 +278,7 @@ const A2UiRestaurantExample = () => {
|
|
|
278
278
|
console.log('A2UI Action:', action);
|
|
279
279
|
// Actions are handled in the content component
|
|
280
280
|
}, []);
|
|
281
|
-
return (_jsx(
|
|
281
|
+
return (_jsx(ThemedProvider, { children: _jsx(A2UIProvider, { onAction: handleAction, children: _jsxs(Box, { sx: {
|
|
282
282
|
display: 'flex',
|
|
283
283
|
flexDirection: 'column',
|
|
284
284
|
minHeight: '100vh',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from '@primer/react';
|
|
3
3
|
import { Box } from '@datalayer/primer-addons';
|
|
4
|
-
import {
|
|
4
|
+
import { ThemedProvider } from './stores/themedProvider';
|
|
5
5
|
import { ChatFloating } from '../components/chat';
|
|
6
6
|
// AG-UI endpoint for agentic chat example
|
|
7
7
|
const AGENTIC_CHAT_ENDPOINT = 'http://localhost:8765/api/v1/examples/agentic_chat/';
|
|
@@ -17,7 +17,7 @@ const AGENTIC_CHAT_ENDPOINT = 'http://localhost:8765/api/v1/examples/agentic_cha
|
|
|
17
17
|
* - Floating popup interface
|
|
18
18
|
*/
|
|
19
19
|
const AgUiAgenticExample = () => {
|
|
20
|
-
return (_jsx(
|
|
20
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
21
21
|
minHeight: '100vh',
|
|
22
22
|
backgroundColor: 'canvas.default',
|
|
23
23
|
padding: 4,
|
|
@@ -49,7 +49,7 @@ const AgUiAgenticExample = () => {
|
|
|
49
49
|
borderRadius: 2,
|
|
50
50
|
border: '1px solid',
|
|
51
51
|
borderColor: 'border.default',
|
|
52
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), _jsx(ChatFloating, { endpoint: AGENTIC_CHAT_ENDPOINT, title: "Agentic Chat", description: "Chat with an AI agent that can use tools like getting the current time.", position: "bottom-right",
|
|
52
|
+
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), _jsx(ChatFloating, { endpoint: AGENTIC_CHAT_ENDPOINT, title: "Agentic Chat", description: "Chat with an AI agent that can use tools like getting the current time.", position: "bottom-right", defaultOpen: true, suggestions: [
|
|
53
53
|
{
|
|
54
54
|
title: 'What time is it?',
|
|
55
55
|
message: 'What is the current time?',
|
|
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
import { useCallback } from 'react';
|
|
19
19
|
import { Text } from '@primer/react';
|
|
20
20
|
import { Box } from '@datalayer/primer-addons';
|
|
21
|
-
import {
|
|
21
|
+
import { ThemedProvider, useThemeBrandColor } from './stores/themedProvider';
|
|
22
22
|
import { ChatFloating } from '../components/chat';
|
|
23
23
|
import { InlineWeatherCard } from './ag-ui/weather';
|
|
24
24
|
// AG-UI endpoint for backend tool rendering example
|
|
@@ -53,12 +53,13 @@ const renderWeatherToolResult = (context) => {
|
|
|
53
53
|
* - Loading states while fetching data
|
|
54
54
|
*/
|
|
55
55
|
const AgUiBackendToolRenderingExample = () => {
|
|
56
|
+
const brandColor = useThemeBrandColor();
|
|
56
57
|
// Optional: still track weather for sidebar display if needed
|
|
57
58
|
const handleStateUpdate = useCallback((_state) => {
|
|
58
59
|
// State updates are still available if needed for other purposes
|
|
59
60
|
// Uncomment to debug: console.log('[WeatherExample] State update:', _state);
|
|
60
61
|
}, []);
|
|
61
|
-
return (_jsx(
|
|
62
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
62
63
|
minHeight: '100vh',
|
|
63
64
|
backgroundColor: 'canvas.default',
|
|
64
65
|
padding: 4,
|
|
@@ -89,7 +90,7 @@ const AgUiBackendToolRenderingExample = () => {
|
|
|
89
90
|
marginTop: 1,
|
|
90
91
|
fontSize: 1,
|
|
91
92
|
color: 'fg.muted',
|
|
92
|
-
}, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: BACKEND_TOOL_RENDERING_ENDPOINT, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor:
|
|
93
|
+
}, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: BACKEND_TOOL_RENDERING_ENDPOINT, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, renderToolResult: renderWeatherToolResult, suggestions: [
|
|
93
94
|
{
|
|
94
95
|
title: 'Paris weather',
|
|
95
96
|
message: "What's the weather like in Paris?",
|
|
@@ -19,7 +19,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
import { useState, useCallback, useRef, useImperativeHandle, forwardRef, } from 'react';
|
|
20
20
|
import { Text } from '@primer/react';
|
|
21
21
|
import { Box } from '@datalayer/primer-addons';
|
|
22
|
-
import {
|
|
22
|
+
import { ThemedProvider, useThemeBrandColor } from './stores/themedProvider';
|
|
23
23
|
import { ChatFloating } from '../components/chat';
|
|
24
24
|
import { InlineHaikuCard, HaikuDisplay } from './ag-ui/haiku';
|
|
25
25
|
// AG-UI endpoint for haiku generative UI example
|
|
@@ -60,6 +60,7 @@ HaikuDisplayWithRef.displayName = 'HaikuDisplayWithRef';
|
|
|
60
60
|
* - Japanese/English text rendering
|
|
61
61
|
*/
|
|
62
62
|
const AgUiHaikuGenUIExample = () => {
|
|
63
|
+
const brandColor = useThemeBrandColor();
|
|
63
64
|
// Ref to the main display for adding haikus
|
|
64
65
|
const displayRef = useRef(null);
|
|
65
66
|
// Track processed tool call IDs to avoid duplicates
|
|
@@ -95,7 +96,7 @@ const AgUiHaikuGenUIExample = () => {
|
|
|
95
96
|
}
|
|
96
97
|
return (_jsx(InlineHaikuCard, { haiku: haiku, status: context.status, error: context.error }));
|
|
97
98
|
}, []);
|
|
98
|
-
return (_jsx(
|
|
99
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
99
100
|
minHeight: '100vh',
|
|
100
101
|
backgroundColor: 'canvas.default',
|
|
101
102
|
padding: 4,
|
|
@@ -133,7 +134,7 @@ const AgUiHaikuGenUIExample = () => {
|
|
|
133
134
|
marginTop: 1,
|
|
134
135
|
fontSize: 1,
|
|
135
136
|
color: 'fg.muted',
|
|
136
|
-
}, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: HAIKU_ENDPOINT, title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor:
|
|
137
|
+
}, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: HAIKU_ENDPOINT, title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor: brandColor, defaultOpen: true, renderToolResult: renderHaikuToolResult, hideMessagesAfterToolUI: true, suggestions: [
|
|
137
138
|
{
|
|
138
139
|
title: 'Cherry blossoms',
|
|
139
140
|
message: 'Write me a haiku about cherry blossoms in spring.',
|
|
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
18
18
|
import { useState, useEffect } from 'react';
|
|
19
19
|
import { Text, Checkbox, FormControl, Label, ProgressBar, Button, } from '@primer/react';
|
|
20
20
|
import { Box } from '@datalayer/primer-addons';
|
|
21
|
-
import {
|
|
21
|
+
import { ThemedProvider, useThemeBrandColor } from './stores/themedProvider';
|
|
22
22
|
import { ChatFloating } from '../components/chat';
|
|
23
23
|
import { TasklistIcon, CheckCircleFillIcon, XCircleFillIcon, } from '@primer/octicons-react';
|
|
24
24
|
// AG-UI endpoint for human in the loop example
|
|
@@ -178,7 +178,8 @@ const renderTaskStepsTool = (context) => {
|
|
|
178
178
|
* - UI state changes based on user actions
|
|
179
179
|
*/
|
|
180
180
|
const AgUiHumanInTheLoopExample = () => {
|
|
181
|
-
|
|
181
|
+
const brandColor = useThemeBrandColor();
|
|
182
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
182
183
|
minHeight: '100vh',
|
|
183
184
|
backgroundColor: 'canvas.default',
|
|
184
185
|
padding: 4,
|
|
@@ -206,7 +207,7 @@ const AgUiHumanInTheLoopExample = () => {
|
|
|
206
207
|
borderRadius: 2,
|
|
207
208
|
border: '1px solid',
|
|
208
209
|
borderColor: 'accent.muted',
|
|
209
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), _jsx(ChatFloating, { endpoint: HUMAN_IN_THE_LOOP_ENDPOINT, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor:
|
|
210
|
+
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), _jsx(ChatFloating, { endpoint: HUMAN_IN_THE_LOOP_ENDPOINT, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor: brandColor, renderToolResult: renderTaskStepsTool, hideMessagesAfterToolUI: true, suggestions: [
|
|
210
211
|
{
|
|
211
212
|
title: 'Plan a trip',
|
|
212
213
|
message: 'Plan a weekend trip to Paris.',
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
import { useState, useCallback } from 'react';
|
|
16
16
|
import { Text, Button, TextInput, Label } from '@primer/react';
|
|
17
17
|
import { Box } from '@datalayer/primer-addons';
|
|
18
|
-
import {
|
|
18
|
+
import { ThemedProvider, useThemeBrandColor } from './stores/themedProvider';
|
|
19
19
|
import { ChatFloating } from '../components/chat';
|
|
20
20
|
import { PlusIcon, XIcon, BeakerIcon, ClockIcon, PersonIcon, } from '@primer/octicons-react';
|
|
21
21
|
// AG-UI endpoint for shared state example
|
|
@@ -104,6 +104,7 @@ const RecipeDisplay = ({ recipe, onUpdate }) => {
|
|
|
104
104
|
* - Editable UI that updates shared state
|
|
105
105
|
*/
|
|
106
106
|
const AgUiSharedStateExample = () => {
|
|
107
|
+
const brandColor = useThemeBrandColor();
|
|
107
108
|
const [recipe, setRecipe] = useState(DEFAULT_RECIPE);
|
|
108
109
|
// Handle state updates from AG-UI
|
|
109
110
|
const handleStateUpdate = useCallback((state) => {
|
|
@@ -125,7 +126,7 @@ const AgUiSharedStateExample = () => {
|
|
|
125
126
|
const handleClear = useCallback(() => {
|
|
126
127
|
setRecipe(DEFAULT_RECIPE);
|
|
127
128
|
}, []);
|
|
128
|
-
return (_jsx(
|
|
129
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
129
130
|
minHeight: '100vh',
|
|
130
131
|
backgroundColor: 'canvas.default',
|
|
131
132
|
padding: 4,
|
|
@@ -167,7 +168,7 @@ const AgUiSharedStateExample = () => {
|
|
|
167
168
|
marginTop: 1,
|
|
168
169
|
fontSize: 1,
|
|
169
170
|
color: 'fg.muted',
|
|
170
|
-
}, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: SHARED_STATE_ENDPOINT, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor:
|
|
171
|
+
}, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), _jsx(ChatFloating, { endpoint: SHARED_STATE_ENDPOINT, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
171
172
|
{
|
|
172
173
|
title: 'Pasta recipe',
|
|
173
174
|
message: 'Help me create a simple pasta recipe.',
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
import { useState, useCallback } from 'react';
|
|
16
16
|
import { Text, ProgressBar, Button } from '@primer/react';
|
|
17
17
|
import { Box } from '@datalayer/primer-addons';
|
|
18
|
-
import {
|
|
18
|
+
import { ThemedProvider, useThemeBrandColor } from './stores/themedProvider';
|
|
19
19
|
import { ChatFloating } from '../components/chat';
|
|
20
20
|
import { CheckCircleIcon, CircleIcon, DotFillIcon, CheckIcon, XIcon, } from '@primer/octicons-react';
|
|
21
21
|
// AG-UI endpoint for agentic generative UI example
|
|
@@ -169,6 +169,7 @@ const PlanDisplay = ({ plan, isInteractive = true, onStepToggle, onConfirm, onRe
|
|
|
169
169
|
* - Interactive step selection with Confirm/Reject buttons
|
|
170
170
|
*/
|
|
171
171
|
const AgUiToolsBasedGenUIExample = () => {
|
|
172
|
+
const brandColor = useThemeBrandColor();
|
|
172
173
|
const [plan, setPlan] = useState(null);
|
|
173
174
|
const [decision, setDecision] = useState(null);
|
|
174
175
|
// Handle state updates from AG-UI events
|
|
@@ -209,7 +210,7 @@ const AgUiToolsBasedGenUIExample = () => {
|
|
|
209
210
|
setDecision('rejected');
|
|
210
211
|
console.log('Plan rejected');
|
|
211
212
|
}, []);
|
|
212
|
-
return (_jsx(
|
|
213
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
213
214
|
minHeight: '100vh',
|
|
214
215
|
backgroundColor: 'canvas.default',
|
|
215
216
|
padding: 4,
|
|
@@ -243,7 +244,7 @@ const AgUiToolsBasedGenUIExample = () => {
|
|
|
243
244
|
marginTop: 1,
|
|
244
245
|
fontSize: 1,
|
|
245
246
|
color: 'fg.muted',
|
|
246
|
-
}, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), _jsx(ChatFloating, { endpoint: AGENTIC_GENERATIVE_UI_ENDPOINT, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor:
|
|
247
|
+
}, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), _jsx(ChatFloating, { endpoint: AGENTIC_GENERATIVE_UI_ENDPOINT, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
247
248
|
{
|
|
248
249
|
title: 'Project plan',
|
|
249
250
|
message: 'Create a project plan for building a mobile app.',
|
|
@@ -19,7 +19,7 @@ import { useEffect, useState } from 'react';
|
|
|
19
19
|
import { Text, Spinner } from '@primer/react';
|
|
20
20
|
import { AlertIcon } from '@primer/octicons-react';
|
|
21
21
|
import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
|
|
22
|
-
import {
|
|
22
|
+
import { ThemedProvider } from './stores/themedProvider';
|
|
23
23
|
import { Chat } from '../components/chat';
|
|
24
24
|
setupPrimerPortals();
|
|
25
25
|
const BASE_URL = 'http://localhost:8765';
|
|
@@ -89,7 +89,7 @@ const AgentRuntimeChatExample = () => {
|
|
|
89
89
|
}, []);
|
|
90
90
|
// Loading state while agent is being created
|
|
91
91
|
if (isCreating) {
|
|
92
|
-
return (_jsx(
|
|
92
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
93
93
|
display: 'flex',
|
|
94
94
|
flexDirection: 'column',
|
|
95
95
|
alignItems: 'center',
|
|
@@ -101,7 +101,7 @@ const AgentRuntimeChatExample = () => {
|
|
|
101
101
|
}
|
|
102
102
|
// Error state
|
|
103
103
|
if (error || !agentId) {
|
|
104
|
-
return (_jsx(
|
|
104
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
105
105
|
display: 'flex',
|
|
106
106
|
flexDirection: 'column',
|
|
107
107
|
alignItems: 'center',
|
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
7
7
|
import { Spinner, Text } from '@primer/react';
|
|
8
8
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
9
9
|
import { Box } from '@datalayer/primer-addons';
|
|
10
|
-
import {
|
|
10
|
+
import { ThemedProvider } from './stores/themedProvider';
|
|
11
11
|
import { Chat } from '../components/chat';
|
|
12
12
|
// Create a query client for React Query
|
|
13
13
|
const queryClient = new QueryClient({
|
|
@@ -121,7 +121,7 @@ Be concise, helpful, and provide working code examples when appropriate.`,
|
|
|
121
121
|
*/
|
|
122
122
|
const AgentRuntimeCustomExample = () => {
|
|
123
123
|
const { agentId, isLoading, error, retry } = useEnsureAgent();
|
|
124
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(
|
|
124
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
125
125
|
display: 'flex',
|
|
126
126
|
flexDirection: 'column',
|
|
127
127
|
height: '100vh',
|
|
@@ -11,7 +11,7 @@ import { AiAgentIcon } from '@datalayer/icons-react';
|
|
|
11
11
|
import { Blankslate } from '@primer/react/experimental';
|
|
12
12
|
import { QueryClient, QueryClientProvider, useQuery, } from '@tanstack/react-query';
|
|
13
13
|
import { Box } from '@datalayer/primer-addons';
|
|
14
|
-
import {
|
|
14
|
+
import { ThemedProvider } from './stores/themedProvider';
|
|
15
15
|
import { Chat, useChatStore } from '../components/chat';
|
|
16
16
|
import { DEFAULT_MODEL } from '../specs';
|
|
17
17
|
import { useAgentsStore } from './stores/examplesStore';
|
|
@@ -528,7 +528,7 @@ githubClientId, kaggleToken, }) => {
|
|
|
528
528
|
}
|
|
529
529
|
setIsConfigured(false);
|
|
530
530
|
};
|
|
531
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(
|
|
531
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThemedProvider, { children: _jsxs(PageLayout, { containerWidth: "full", children: [_jsx(Header, { activeSession: activeSession, agentName: isNewMode ? undefined : currentAgent?.name, agentDescription: isNewMode ? undefined : currentAgent?.description, agentStatus: currentAgent?.status, showContextTree: showContextTree, isNewAgent: isNewMode, isConfigured: isConfigured, onSessionChange: setActiveSession, onToggleContextTree: () => setShowContextTree(!showContextTree), onToggleStatus: currentAgent
|
|
532
532
|
? () => toggleAgentStatus(currentAgent.id)
|
|
533
533
|
: undefined }), leftPaneVisible ? (_jsxs(_Fragment, { children: [_jsx(Box, { sx: {
|
|
534
534
|
position: 'fixed',
|
|
@@ -47,7 +47,8 @@ import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
|
47
47
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
48
48
|
import { Box } from '@datalayer/primer-addons';
|
|
49
49
|
import { Text } from '@primer/react';
|
|
50
|
-
import {
|
|
50
|
+
import { useJupyter } from '@datalayer/jupyter-react';
|
|
51
|
+
import { ThemedJupyterProvider } from './stores/themedProvider';
|
|
51
52
|
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, ExcalidrawPlugin, CollapsiblePlugin, AutoLinkPlugin, AutoEmbedPlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, TableCellResizerPlugin, TablePlugin, } from '@datalayer/jupyter-lexical';
|
|
52
53
|
// Import Chat components
|
|
53
54
|
import { ChatFloating, useChatStore, useFrontendTool, DatalayerInferenceProvider, } from '../components/chat';
|
|
@@ -228,7 +229,7 @@ export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
|
228
229
|
* Main example component with Simple wrapper
|
|
229
230
|
*/
|
|
230
231
|
export function AgentRuntimePopupLexicalExample() {
|
|
231
|
-
return (_jsx(
|
|
232
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsx(JupyterWrapper, {}) }));
|
|
232
233
|
}
|
|
233
234
|
function JupyterWrapper() {
|
|
234
235
|
const { serviceManager } = useJupyter();
|
|
@@ -44,7 +44,8 @@ import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
|
44
44
|
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
45
45
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
46
46
|
import { Box } from '@datalayer/primer-addons';
|
|
47
|
-
import {
|
|
47
|
+
import { useJupyter } from '@datalayer/jupyter-react';
|
|
48
|
+
import { ThemedJupyterProvider } from './stores/themedProvider';
|
|
48
49
|
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, ExcalidrawPlugin, CollapsiblePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, TableCellResizerPlugin, TablePlugin, } from '@datalayer/jupyter-lexical';
|
|
49
50
|
// Agent-runtimes imports
|
|
50
51
|
import { ChatFloating } from '../components/chat';
|
|
@@ -215,7 +216,7 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
|
|
|
215
216
|
padding: 3,
|
|
216
217
|
backgroundColor: 'canvas.default',
|
|
217
218
|
minHeight: '600px',
|
|
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(
|
|
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(ThemedJupyterProvider, { 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: {
|
|
219
220
|
type: 'ag-ui',
|
|
220
221
|
endpoint: AG_UI_ENDPOINT,
|
|
221
222
|
}, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] }) })] }) })] }));
|
|
@@ -246,7 +247,7 @@ function LexicalWithChat({ content, serviceManager, }) {
|
|
|
246
247
|
color: 'danger.fg',
|
|
247
248
|
borderRadius: 2,
|
|
248
249
|
maxWidth: 300,
|
|
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",
|
|
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", frontendTools: tools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
|
|
250
251
|
{
|
|
251
252
|
title: 'Insert heading',
|
|
252
253
|
message: 'Insert a heading that says "Welcome"',
|
|
@@ -45,7 +45,8 @@ import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
|
45
45
|
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
46
46
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
47
47
|
import { Box } from '@datalayer/primer-addons';
|
|
48
|
-
import {
|
|
48
|
+
import { useJupyter } from '@datalayer/jupyter-react';
|
|
49
|
+
import { ThemedJupyterProvider } from './stores/themedProvider';
|
|
49
50
|
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
51
|
// Import Chat components
|
|
51
52
|
import { ChatSidebar, } from '../components/chat';
|
|
@@ -165,7 +166,7 @@ export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
|
165
166
|
* Main example component with Simple wrapper
|
|
166
167
|
*/
|
|
167
168
|
export function AgentRuntimeLexicalSidebarExample() {
|
|
168
|
-
return (_jsx(
|
|
169
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsx(SimpleWrapper, {}) }));
|
|
169
170
|
}
|
|
170
171
|
function SimpleWrapper() {
|
|
171
172
|
const { serviceManager } = useJupyter();
|
|
@@ -17,7 +17,8 @@ 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 {
|
|
20
|
+
import { Notebook } from '@datalayer/jupyter-react';
|
|
21
|
+
import { ThemedJupyterProvider } from './stores/themedProvider';
|
|
21
22
|
// Agent-runtimes imports
|
|
22
23
|
import { ChatFloating } from '../components/chat';
|
|
23
24
|
import { useNotebookTools } from '../tools/adapters/agent-runtimes/notebookHooks';
|
|
@@ -107,7 +108,7 @@ const NotebookUI = React.memo(function NotebookUI({ serviceManager, }) {
|
|
|
107
108
|
borderRadius: 2,
|
|
108
109
|
padding: 3,
|
|
109
110
|
backgroundColor: 'canvas.default',
|
|
110
|
-
}, children: serviceManager ? (_jsx(
|
|
111
|
+
}, children: serviceManager ? (_jsx(ThemedJupyterProvider, { 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..." }) })) })] }));
|
|
111
112
|
});
|
|
112
113
|
function NotebookWithChat({ serviceManager, }) {
|
|
113
114
|
// Ensure the agent exists before rendering chat
|
|
@@ -128,7 +129,7 @@ function NotebookWithChat({ serviceManager, }) {
|
|
|
128
129
|
color: 'danger.fg',
|
|
129
130
|
borderRadius: 2,
|
|
130
131
|
maxWidth: 300,
|
|
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",
|
|
132
|
+
}, 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", frontendTools: frontendTools, useStore: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, suggestions: [
|
|
132
133
|
{
|
|
133
134
|
title: 'Add a cell',
|
|
134
135
|
message: 'Insert a random cell to the notebook',
|
|
@@ -20,7 +20,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
20
20
|
*/
|
|
21
21
|
import { useMemo } from 'react';
|
|
22
22
|
import { Box } from '@datalayer/primer-addons';
|
|
23
|
-
import { Notebook,
|
|
23
|
+
import { Notebook, useJupyter } from '@datalayer/jupyter-react';
|
|
24
|
+
import { ThemedJupyterProvider } from './stores/themedProvider';
|
|
24
25
|
// Import Chat components
|
|
25
26
|
import { ChatSidebar, } from '../components/chat';
|
|
26
27
|
// Import agent-runtimes notebook tools
|
|
@@ -112,7 +113,7 @@ export function AgentRuntimeNotebookExampleInner({ serviceManager, }) {
|
|
|
112
113
|
* Main example component with Simple wrapper
|
|
113
114
|
*/
|
|
114
115
|
export function AgentRuntimeNotebookSidebarExample() {
|
|
115
|
-
return (_jsx(
|
|
116
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsx(SimpleWrapper, {}) }));
|
|
116
117
|
}
|
|
117
118
|
function SimpleWrapper() {
|
|
118
119
|
const { serviceManager } = useJupyter();
|