@datalayer/agent-runtimes 0.0.12 → 1.0.1
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.d.ts +0 -1
- package/lib/AgentLexical.js +1 -3
- package/lib/AgentNotebook.js +1 -2
- package/lib/components/chat/components/ChatFloating.d.ts +4 -2
- package/lib/components/chat/components/ChatFloating.js +1 -1
- 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.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexical2Example.js +3 -3
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexicalExample.js +4 -4
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +0 -1
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +3 -3
- 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.d.ts +0 -1
- package/lib/examples/CopilotKitLexicalExample.js +3 -3
- 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/lexical/ChatInlinePlugin.js +28 -7
- package/lib/lexical/index.d.ts +1 -1
- package/lib/lexical/useChatInlineToolbarItems.d.ts +9 -2
- package/lib/lexical/useChatInlineToolbarItems.js +22 -94
- package/package.json +4 -3
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.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ import 'prismjs/components/prism-swift';
|
|
|
28
28
|
import React from 'react';
|
|
29
29
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
30
30
|
import './examples/lexical/lexical-theme.css';
|
|
31
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
32
31
|
import '../style/primer-primitives.css';
|
|
33
32
|
export declare const AgentLexical: React.FC;
|
|
34
33
|
export default AgentLexical;
|
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';
|
|
@@ -61,7 +60,6 @@ import { editorConfig } from './examples/lexical/editorConfig';
|
|
|
61
60
|
import { DEFAULT_MODEL } from './specs';
|
|
62
61
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
63
62
|
import './examples/lexical/lexical-theme.css';
|
|
64
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
65
63
|
import '../style/primer-primitives.css';
|
|
66
64
|
setupPrimerPortals();
|
|
67
65
|
const BASE_URL = window.location.origin;
|
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';
|
|
@@ -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();
|
|
@@ -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',
|
|
@@ -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
|
|
@@ -47,14 +47,14 @@ 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';
|
|
54
55
|
import { useLexicalToolActions, ActionRegistrar, } from '../tools/adapters/copilotkit/lexicalHooks';
|
|
55
56
|
import { editorConfig } from './lexical/editorConfig';
|
|
56
57
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
57
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
58
58
|
import './lexical/lexical-theme.css';
|
|
59
59
|
// Fixed lexical document ID
|
|
60
60
|
const LEXICAL_ID = 'chat-popup-lexical-example';
|
|
@@ -229,7 +229,7 @@ export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
|
229
229
|
* Main example component with Simple wrapper
|
|
230
230
|
*/
|
|
231
231
|
export function AgentRuntimePopupLexicalExample() {
|
|
232
|
-
return (_jsx(
|
|
232
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsx(JupyterWrapper, {}) }));
|
|
233
233
|
}
|
|
234
234
|
function JupyterWrapper() {
|
|
235
235
|
const { serviceManager } = useJupyter();
|
|
@@ -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
|
*/
|
|
@@ -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';
|
|
@@ -54,7 +55,6 @@ import { useLexicalTools } from '../tools/adapters/agent-runtimes/lexicalHooks';
|
|
|
54
55
|
import { editorConfig } from './lexical/editorConfig';
|
|
55
56
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
56
57
|
import './lexical/lexical-theme.css';
|
|
57
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
58
58
|
// Fixed lexical document ID
|
|
59
59
|
const LEXICAL_ID = 'agui-lexical-example';
|
|
60
60
|
// Base URL for agent-runtimes server
|
|
@@ -216,7 +216,7 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
|
|
|
216
216
|
padding: 3,
|
|
217
217
|
backgroundColor: 'canvas.default',
|
|
218
218
|
minHeight: '600px',
|
|
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(
|
|
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: {
|
|
220
220
|
type: 'ag-ui',
|
|
221
221
|
endpoint: AG_UI_ENDPOINT,
|
|
222
222
|
}, isOpen: isAiOpen, onClose: closeAi, pendingPrompt: pendingPrompt, onPendingPromptConsumed: clearPendingPrompt })] }) })] }) })] }));
|
|
@@ -247,7 +247,7 @@ function LexicalWithChat({ content, serviceManager, }) {
|
|
|
247
247
|
color: 'danger.fg',
|
|
248
248
|
borderRadius: 2,
|
|
249
249
|
maxWidth: 300,
|
|
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",
|
|
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: [
|
|
251
251
|
{
|
|
252
252
|
title: 'Insert heading',
|
|
253
253
|
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
|
|
@@ -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';
|
|
@@ -54,7 +55,6 @@ import { useChatInlineToolbarItems } from '../lexical/useChatInlineToolbarItems'
|
|
|
54
55
|
import { useLexicalTools } from '../tools/adapters/agent-runtimes/lexicalHooks';
|
|
55
56
|
import { editorConfig } from './lexical/editorConfig';
|
|
56
57
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
57
|
-
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
58
58
|
import './lexical/lexical-theme.css';
|
|
59
59
|
// Fixed lexical document ID
|
|
60
60
|
const LEXICAL_ID = 'chat-lexical-example';
|
|
@@ -166,7 +166,7 @@ export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
|
166
166
|
* Main example component with Simple wrapper
|
|
167
167
|
*/
|
|
168
168
|
export function AgentRuntimeLexicalSidebarExample() {
|
|
169
|
-
return (_jsx(
|
|
169
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsx(SimpleWrapper, {}) }));
|
|
170
170
|
}
|
|
171
171
|
function SimpleWrapper() {
|
|
172
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();
|
|
@@ -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 } from './stores/themedProvider';
|
|
22
22
|
import { ChatStandalone } from '../components/chat';
|
|
23
23
|
/**
|
|
24
24
|
* Simulated AI responses for demo purposes.
|
|
@@ -97,7 +97,7 @@ const AgentRuntimePopupStandaloneExample = () => {
|
|
|
97
97
|
throw err;
|
|
98
98
|
}
|
|
99
99
|
}, []);
|
|
100
|
-
return (_jsx(
|
|
100
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
101
101
|
minHeight: '100vh',
|
|
102
102
|
backgroundColor: 'canvas.default',
|
|
103
103
|
padding: 4,
|
|
@@ -153,6 +153,6 @@ const AgentRuntimePopupStandaloneExample = () => {
|
|
|
153
153
|
borderRadius: 2,
|
|
154
154
|
border: '1px solid',
|
|
155
155
|
borderColor: 'attention.muted',
|
|
156
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "When to Use" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginBottom: 2 }, children: ["Use ", _jsx("strong", { children: "ChatStandalone" }), " when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have a custom AI backend that does not use AG-UI/ACP" }), _jsx("li", { children: "You want full control over the message handling logic" }), _jsx("li", { children: "You need to integrate with a specific API (OpenAI, etc.)" }), _jsx("li", { children: "You want a quick demo without setting up a backend server" })] }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginTop: 2 }, children: ["Use ", _jsx("strong", { children: "ChatFloating" }), " instead when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have an AG-UI compatible backend" }), _jsx("li", { children: "You need built-in tool rendering support" }), _jsx("li", { children: "You want automatic protocol handling" })] })] })] }), _jsx(ChatStandalone, { title: "Demo Assistant", onSendMessage: handleSendMessage, position: "bottom-right",
|
|
156
|
+
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "When to Use" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginBottom: 2 }, children: ["Use ", _jsx("strong", { children: "ChatStandalone" }), " when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have a custom AI backend that does not use AG-UI/ACP" }), _jsx("li", { children: "You want full control over the message handling logic" }), _jsx("li", { children: "You need to integrate with a specific API (OpenAI, etc.)" }), _jsx("li", { children: "You want a quick demo without setting up a backend server" })] }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginTop: 2 }, children: ["Use ", _jsx("strong", { children: "ChatFloating" }), " instead when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have an AG-UI compatible backend" }), _jsx("li", { children: "You need built-in tool rendering support" }), _jsx("li", { children: "You want automatic protocol handling" })] })] })] }), _jsx(ChatStandalone, { title: "Demo Assistant", onSendMessage: handleSendMessage, position: "bottom-right", enableStreaming: true, emptyStateMessage: "Hi! I'm a demo assistant. Try asking me for the time, a joke, or what I can do!", buttonTooltip: "Chat with Demo Assistant", showPoweredBy: true })] }) }));
|
|
157
157
|
};
|
|
158
158
|
export default AgentRuntimePopupStandaloneExample;
|
|
@@ -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
|