@datalayer/agent-runtimes 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/lib/{examples/components → components}/AgentConfiguration.d.ts +54 -9
- package/lib/components/AgentConfiguration.js +585 -0
- package/lib/{examples/components → components}/FooterMetrics.d.ts +1 -2
- package/lib/{examples/components → components}/Header.d.ts +1 -6
- package/lib/{examples/components → components}/Header.js +5 -39
- package/lib/{examples/components → components}/HeaderControls.d.ts +1 -2
- package/lib/{examples/components → components}/HeaderControls.js +1 -1
- package/lib/{examples/components → components}/LexicalEditor.d.ts +2 -3
- package/lib/{examples/components → components}/LexicalEditor.js +2 -2
- package/lib/components/MainContent.d.ts +34 -0
- package/lib/{examples/components → components}/MainContent.js +18 -9
- package/lib/components/McpServerManager.d.ts +30 -0
- package/lib/components/McpServerManager.js +331 -0
- package/lib/{examples/components → components}/MockFileBrowser.d.ts +1 -2
- package/lib/{examples/components → components}/SessionTabs.d.ts +2 -3
- package/lib/{examples/components → components}/TimeTravel.d.ts +1 -2
- package/lib/components/chat/components/AgentDetails.d.ts +3 -1
- package/lib/components/chat/components/AgentDetails.js +472 -22
- package/lib/components/chat/components/Chat.d.ts +37 -3
- package/lib/components/chat/components/Chat.js +29 -10
- package/lib/components/chat/components/ChatFloating.d.ts +27 -2
- package/lib/components/chat/components/ChatFloating.js +17 -10
- package/lib/components/chat/components/ChatPopupStandalone.js +1 -1
- package/lib/components/chat/components/ChatSidebar.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.js +1 -1
- package/lib/components/chat/components/ContextDistribution.d.ts +70 -6
- package/lib/components/chat/components/ContextDistribution.js +13 -6
- package/lib/components/chat/components/ContextInspector.d.ts +81 -0
- package/lib/components/chat/components/ContextInspector.js +263 -0
- package/lib/components/chat/components/ContextPanel.d.ts +112 -0
- package/lib/components/chat/components/ContextPanel.js +368 -0
- package/lib/components/chat/components/base/ChatBase.d.ts +74 -19
- package/lib/components/chat/components/base/ChatBase.js +296 -37
- package/lib/components/chat/components/index.d.ts +3 -1
- package/lib/components/chat/components/index.js +2 -0
- package/lib/components/chat/extensions/ExtensionRegistry.d.ts +1 -1
- package/lib/components/chat/extensions/index.d.ts +1 -0
- package/lib/components/chat/index.d.ts +3 -3
- package/lib/components/chat/protocols/AGUIAdapter.js +24 -4
- package/lib/components/chat/protocols/VercelAIAdapter.js +35 -1
- package/lib/components/chat/store/chatStore.d.ts +2 -3
- package/lib/components/chat/store/conversationStore.d.ts +83 -0
- package/lib/components/chat/store/conversationStore.js +174 -0
- package/lib/components/chat/store/index.d.ts +2 -1
- package/lib/components/chat/store/index.js +1 -0
- package/lib/components/chat/types/inference.d.ts +17 -0
- package/lib/components/chat/types/protocol.d.ts +10 -0
- package/lib/components/index.d.ts +23 -0
- package/lib/components/index.js +11 -0
- package/lib/config/agents/code-ai/agents.d.ts +25 -0
- package/lib/config/agents/code-ai/agents.js +70 -0
- package/lib/config/agents/code-ai/index.d.ts +1 -0
- package/lib/config/agents/code-ai/index.js +5 -0
- package/lib/config/agents/codemode-paper/agents.d.ts +29 -0
- package/lib/config/agents/codemode-paper/agents.js +288 -0
- package/lib/config/agents/codemode-paper/index.d.ts +1 -0
- package/lib/config/agents/codemode-paper/index.js +5 -0
- package/lib/config/agents/datalayer-ai/agents.d.ts +29 -0
- package/lib/config/agents/datalayer-ai/agents.js +267 -0
- package/lib/config/agents/datalayer-ai/index.d.ts +1 -0
- package/lib/config/agents/datalayer-ai/index.js +5 -0
- package/lib/config/agents/index.d.ts +19 -0
- package/lib/config/agents/index.js +38 -0
- package/lib/config/envvars.d.ts +28 -0
- package/lib/config/envvars.js +115 -0
- package/lib/config/index.d.ts +5 -0
- package/lib/config/index.js +9 -0
- package/lib/config/mcpServers.d.ts +18 -0
- package/lib/config/mcpServers.js +153 -0
- package/lib/config/skills.d.ts +27 -0
- package/lib/config/skills.js +60 -0
- package/lib/{lib → config}/utils.d.ts +1 -1
- package/lib/{lib → config}/utils.js +2 -2
- package/lib/examples/AgentRuntimeLexical2Example.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexical2Example.js +3 -2
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalExample.js +5 -3
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +3 -3
- package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
- package/lib/examples/AgentSpaceFormExample.d.ts +2 -2
- package/lib/examples/AgentSpaceFormExample.js +215 -35
- package/lib/examples/CopilotKitLexicalExample.d.ts +1 -0
- package/lib/examples/CopilotKitLexicalExample.js +3 -2
- package/lib/examples/index.d.ts +1 -0
- package/lib/examples/stores/notebooks/NotebookExample2.ipynb.json +43 -43
- package/lib/hooks/useAGUI.d.ts +1 -1
- package/lib/hooks/useAGUI.js +1 -1
- package/lib/identity/types.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/runtime/index.d.ts +3 -0
- package/lib/runtime/runtimeStore.d.ts +3 -4
- package/lib/runtime/useAgentConnection.d.ts +2 -3
- package/lib/runtime/useAgentRuntime.d.ts +2 -3
- package/lib/stories/Cell.stories.js +1 -1
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +1 -0
- package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -0
- package/lib/types.d.ts +158 -0
- package/package.json +5 -6
- package/scripts/apply-patches.sh +1 -1
- package/scripts/codegen/generate_agents.py +863 -0
- package/scripts/codegen/generate_envvars.py +302 -0
- package/scripts/codegen/generate_mcp_servers.py +436 -0
- package/scripts/codegen/generate_skills.py +334 -0
- package/scripts/download-ai-elements.py +35 -20
- package/scripts/sync-jupyter.sh +6 -0
- package/lib/components/ui/accordion.d.ts +0 -7
- package/lib/components/ui/accordion.js +0 -22
- package/lib/components/ui/alert-dialog.d.ts +0 -14
- package/lib/components/ui/alert-dialog.js +0 -43
- package/lib/components/ui/alert.d.ts +0 -9
- package/lib/components/ui/alert.js +0 -24
- package/lib/components/ui/aspect-ratio.d.ts +0 -3
- package/lib/components/ui/aspect-ratio.js +0 -11
- package/lib/components/ui/avatar.d.ts +0 -6
- package/lib/components/ui/avatar.js +0 -18
- package/lib/components/ui/badge.d.ts +0 -9
- package/lib/components/ui/badge.js +0 -22
- package/lib/components/ui/breadcrumb.d.ts +0 -11
- package/lib/components/ui/breadcrumb.js +0 -27
- package/lib/components/ui/button-group.d.ts +0 -11
- package/lib/components/ui/button-group.js +0 -31
- package/lib/components/ui/button.d.ts +0 -13
- package/lib/components/ui/button.js +0 -39
- package/lib/components/ui/calendar.d.ts +0 -8
- package/lib/components/ui/calendar.js +0 -80
- package/lib/components/ui/card.d.ts +0 -9
- package/lib/components/ui/card.js +0 -24
- package/lib/components/ui/carousel.d.ts +0 -19
- package/lib/components/ui/carousel.js +0 -95
- package/lib/components/ui/chart.d.ts +0 -53
- package/lib/components/ui/chart.js +0 -136
- package/lib/components/ui/checkbox.d.ts +0 -4
- package/lib/components/ui/checkbox.js +0 -13
- package/lib/components/ui/collapsible.d.ts +0 -5
- package/lib/components/ui/collapsible.js +0 -17
- package/lib/components/ui/command.d.ts +0 -18
- package/lib/components/ui/command.js +0 -38
- package/lib/components/ui/context-menu.d.ts +0 -25
- package/lib/components/ui/context-menu.js +0 -55
- package/lib/components/ui/dialog.d.ts +0 -15
- package/lib/components/ui/dialog.js +0 -40
- package/lib/components/ui/drawer.d.ts +0 -13
- package/lib/components/ui/drawer.js +0 -39
- package/lib/components/ui/dropdown-menu.d.ts +0 -25
- package/lib/components/ui/dropdown-menu.js +0 -55
- package/lib/components/ui/empty.d.ts +0 -11
- package/lib/components/ui/empty.js +0 -37
- package/lib/components/ui/field.d.ts +0 -24
- package/lib/components/ui/field.js +0 -80
- package/lib/components/ui/form.d.ts +0 -24
- package/lib/components/ui/form.js +0 -63
- package/lib/components/ui/hover-card.d.ts +0 -6
- package/lib/components/ui/hover-card.js +0 -18
- package/lib/components/ui/input-group.d.ts +0 -19
- package/lib/components/ui/input-group.js +0 -69
- package/lib/components/ui/input-otp.d.ts +0 -11
- package/lib/components/ui/input-otp.js +0 -25
- package/lib/components/ui/input.d.ts +0 -3
- package/lib/components/ui/input.js +0 -6
- package/lib/components/ui/item.d.ts +0 -23
- package/lib/components/ui/item.js +0 -66
- package/lib/components/ui/kbd.d.ts +0 -3
- package/lib/components/ui/kbd.js +0 -13
- package/lib/components/ui/label.d.ts +0 -4
- package/lib/components/ui/label.js +0 -12
- package/lib/components/ui/menubar.d.ts +0 -26
- package/lib/components/ui/menubar.js +0 -58
- package/lib/components/ui/navigation-menu.d.ts +0 -14
- package/lib/components/ui/navigation-menu.js +0 -31
- package/lib/components/ui/pagination.d.ts +0 -13
- package/lib/components/ui/pagination.js +0 -29
- package/lib/components/ui/popover.d.ts +0 -7
- package/lib/components/ui/popover.js +0 -21
- package/lib/components/ui/progress.d.ts +0 -4
- package/lib/components/ui/progress.js +0 -12
- package/lib/components/ui/radio-group.d.ts +0 -5
- package/lib/components/ui/radio-group.js +0 -16
- package/lib/components/ui/resizable.d.ts +0 -8
- package/lib/components/ui/resizable.js +0 -19
- package/lib/components/ui/scroll-area.d.ts +0 -5
- package/lib/components/ui/scroll-area.js +0 -17
- package/lib/components/ui/select.d.ts +0 -15
- package/lib/components/ui/select.js +0 -42
- package/lib/components/ui/separator.d.ts +0 -4
- package/lib/components/ui/separator.js +0 -12
- package/lib/components/ui/sheet.d.ts +0 -13
- package/lib/components/ui/sheet.js +0 -44
- package/lib/components/ui/sidebar.d.ts +0 -69
- package/lib/components/ui/sidebar.js +0 -216
- package/lib/components/ui/skeleton.d.ts +0 -2
- package/lib/components/ui/skeleton.js +0 -10
- package/lib/components/ui/slider.d.ts +0 -4
- package/lib/components/ui/slider.js +0 -18
- package/lib/components/ui/sonner.d.ts +0 -3
- package/lib/components/ui/sonner.js +0 -25
- package/lib/components/ui/spinner.d.ts +0 -2
- package/lib/components/ui/spinner.js +0 -11
- package/lib/components/ui/switch.d.ts +0 -4
- package/lib/components/ui/switch.js +0 -12
- package/lib/components/ui/table.d.ts +0 -10
- package/lib/components/ui/table.js +0 -32
- package/lib/components/ui/tabs.d.ts +0 -7
- package/lib/components/ui/tabs.js +0 -21
- package/lib/components/ui/textarea.d.ts +0 -3
- package/lib/components/ui/textarea.js +0 -6
- package/lib/components/ui/toast.d.ts +0 -15
- package/lib/components/ui/toast.js +0 -38
- package/lib/components/ui/toaster.d.ts +0 -1
- package/lib/components/ui/toaster.js +0 -14
- package/lib/components/ui/toggle-group.d.ts +0 -9
- package/lib/components/ui/toggle-group.js +0 -26
- package/lib/components/ui/toggle.d.ts +0 -9
- package/lib/components/ui/toggle.js +0 -30
- package/lib/components/ui/tooltip.d.ts +0 -7
- package/lib/components/ui/tooltip.js +0 -21
- package/lib/components/vercel-ai-elements/artifact.d.ts +0 -23
- package/lib/components/vercel-ai-elements/artifact.js +0 -24
- package/lib/components/vercel-ai-elements/code-block.d.ts +0 -17
- package/lib/components/vercel-ai-elements/code-block.js +0 -94
- package/lib/components/vercel-ai-elements/conversation.d.ts +0 -15
- package/lib/components/vercel-ai-elements/conversation.js +0 -21
- package/lib/components/vercel-ai-elements/loader.d.ts +0 -5
- package/lib/components/vercel-ai-elements/loader.js +0 -8
- package/lib/components/vercel-ai-elements/message.d.ts +0 -46
- package/lib/components/vercel-ai-elements/message.js +0 -109
- package/lib/components/vercel-ai-elements/model-selector.d.ts +0 -35
- package/lib/components/vercel-ai-elements/model-selector.js +0 -22
- package/lib/components/vercel-ai-elements/prompt-input.d.ts +0 -195
- package/lib/components/vercel-ai-elements/prompt-input.js +0 -589
- package/lib/components/vercel-ai-elements/reasoning.d.ts +0 -26
- package/lib/components/vercel-ai-elements/reasoning.js +0 -80
- package/lib/components/vercel-ai-elements/shimmer.d.ts +0 -9
- package/lib/components/vercel-ai-elements/shimmer.js +0 -22
- package/lib/components/vercel-ai-elements/sources.d.ts +0 -12
- package/lib/components/vercel-ai-elements/sources.js +0 -13
- package/lib/components/vercel-ai-elements/suggestion.d.ts +0 -10
- package/lib/components/vercel-ai-elements/suggestion.js +0 -16
- package/lib/components/vercel-ai-elements/tool.d.ts +0 -23
- package/lib/components/vercel-ai-elements/tool.js +0 -52
- package/lib/examples/components/AgentConfiguration.js +0 -382
- package/lib/examples/components/MainContent.d.ts +0 -19
- package/lib/examples/components/index.d.ts +0 -10
- package/lib/examples/components/index.js +0 -13
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.d.ts +0 -12
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.js +0 -69
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.js +0 -85
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.js +0 -62
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.js +0 -51
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.js +0 -56
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.js +0 -50
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.js +0 -16
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.js +0 -72
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.js +0 -43
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.js +0 -31
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.js +0 -54
- package/lib/examples/vercel-ai-elements/index.d.ts +0 -13
- package/lib/examples/vercel-ai-elements/index.js +0 -17
- package/lib/examples/vercel-ai-elements/main.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/main.js +0 -9
- package/lib/examples/vercel-ai-elements/showcase.css +0 -128
- package/lib/hooks/useToast.d.ts +0 -44
- package/lib/hooks/useToast.js +0 -128
- package/patches/@datalayer+jupyter-lexical+1.0.8.patch +0 -11628
- package/patches/@datalayer+jupyter-react+2.0.2.patch +0 -5338
- package/style/showcase-vercel-ai.css +0 -137
- /package/lib/{examples/components → components}/FooterMetrics.js +0 -0
- /package/lib/{examples/components → components}/MockFileBrowser.js +0 -0
- /package/lib/{examples/components → components}/SessionTabs.js +0 -0
- /package/lib/{examples/components → components}/TimeTravel.js +0 -0
- /package/lib/{models → types}/AIAgent.d.ts +0 -0
- /package/lib/{models → types}/AIAgent.js +0 -0
- /package/lib/{models → types}/index.d.ts +0 -0
- /package/lib/{models → types}/index.js +0 -0
|
@@ -9,13 +9,14 @@ import { PageLayout, IconButton } from '@primer/react';
|
|
|
9
9
|
import { SidebarCollapseIcon, SidebarExpandIcon } from '@primer/octicons-react';
|
|
10
10
|
import { AiAgentIcon } from '@datalayer/icons-react';
|
|
11
11
|
import { Blankslate } from '@primer/react/experimental';
|
|
12
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
12
|
+
import { QueryClient, QueryClientProvider, useQuery, } from '@tanstack/react-query';
|
|
13
13
|
import { Box } from '@datalayer/primer-addons';
|
|
14
14
|
import { DatalayerThemeProvider } from '@datalayer/core';
|
|
15
|
-
import { Chat } from '../components/chat';
|
|
15
|
+
import { Chat, useChatStore } from '../components/chat';
|
|
16
16
|
import { useAgentsStore } from './stores/examplesStore';
|
|
17
17
|
import { useIdentity } from '../identity';
|
|
18
|
-
import { MockFileBrowser, MainContent, Header, FooterMetrics, AgentConfiguration, } from '
|
|
18
|
+
import { MockFileBrowser, MainContent, Header, FooterMetrics, AgentConfiguration, } from '../components';
|
|
19
|
+
import { isSpecSelection, getSpecId } from '../components/AgentConfiguration';
|
|
19
20
|
// Create a query client for React Query
|
|
20
21
|
const queryClient = new QueryClient({
|
|
21
22
|
defaultOptions: {
|
|
@@ -27,6 +28,47 @@ const queryClient = new QueryClient({
|
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
});
|
|
31
|
+
/**
|
|
32
|
+
* Hook to fetch codemode status and compute Jupyter error banner.
|
|
33
|
+
* Must be used inside QueryClientProvider.
|
|
34
|
+
*/
|
|
35
|
+
function useJupyterSandboxStatus(baseUrl, isConfigured, enableCodemode, useJupyterSandbox) {
|
|
36
|
+
const { data: codemodeStatus } = useQuery({
|
|
37
|
+
queryKey: ['codemode-status', baseUrl],
|
|
38
|
+
queryFn: async () => {
|
|
39
|
+
const response = await fetch(`${baseUrl}/api/v1/configure/codemode-status`);
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
throw new Error('Failed to fetch codemode status');
|
|
42
|
+
}
|
|
43
|
+
return response.json();
|
|
44
|
+
},
|
|
45
|
+
enabled: isConfigured && enableCodemode && useJupyterSandbox,
|
|
46
|
+
refetchInterval: 10000, // Refresh every 10 seconds
|
|
47
|
+
});
|
|
48
|
+
return React.useMemo(() => {
|
|
49
|
+
if (!isConfigured || !enableCodemode || !useJupyterSandbox) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const sandbox = codemodeStatus?.sandbox;
|
|
53
|
+
if (!sandbox) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
// Check if Jupyter variant is selected but not connected
|
|
57
|
+
if (sandbox.variant === 'local-jupyter' && !sandbox.jupyter_connected) {
|
|
58
|
+
return {
|
|
59
|
+
message: sandbox.jupyter_error
|
|
60
|
+
? `Jupyter Sandbox Error: ${sandbox.jupyter_error}`
|
|
61
|
+
: 'Jupyter Sandbox not connected. Code execution may fail.',
|
|
62
|
+
variant: 'danger',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}, [isConfigured, enableCodemode, useJupyterSandbox, codemodeStatus]);
|
|
67
|
+
}
|
|
68
|
+
function ChatWithJupyterStatus({ baseUrl, isConfigured, enableCodemode, useJupyterSandbox, chatProps, }) {
|
|
69
|
+
const jupyterErrorBanner = useJupyterSandboxStatus(baseUrl, isConfigured, enableCodemode, useJupyterSandbox);
|
|
70
|
+
return _jsx(Chat, { ...chatProps, errorBanner: jupyterErrorBanner });
|
|
71
|
+
}
|
|
30
72
|
// Default configuration - use environment variable if available
|
|
31
73
|
// Note: Vercel AI connects to Jupyter server (8888), other protocols connect to agent-runtimes server (8765)
|
|
32
74
|
const DEFAULT_WS_URL = import.meta.env.VITE_ACP_WS_URL || 'ws://localhost:8765/api/v1/acp/ws';
|
|
@@ -80,11 +122,70 @@ githubClientId, kaggleToken, }) => {
|
|
|
80
122
|
// Agent capabilities state (moved from Header toggles)
|
|
81
123
|
const [selectedSkills, setSelectedSkills] = useState([]);
|
|
82
124
|
const [enableCodemode, setEnableCodemode] = useState(initialEnableCodemode);
|
|
125
|
+
const [useJupyterSandbox, setUseJupyterSandbox] = useState(false);
|
|
83
126
|
const [allowDirectToolCalls, setAllowDirectToolCalls] = useState(initialAllowDirectToolCalls);
|
|
84
127
|
const [enableToolReranker, setEnableToolReranker] = useState(initialEnableToolReranker);
|
|
85
128
|
const [selectedMcpServers, setSelectedMcpServers] = useState(initialSelectedMcpServers);
|
|
86
129
|
const autoSelectRef = useRef(false);
|
|
87
130
|
const enableSkills = selectedSkills.length > 0;
|
|
131
|
+
// =====================================================================
|
|
132
|
+
// Two-Container Codemode Architecture
|
|
133
|
+
// =====================================================================
|
|
134
|
+
//
|
|
135
|
+
// When Jupyter sandbox is enabled, the architecture uses two containers:
|
|
136
|
+
//
|
|
137
|
+
// ┌─────────────────────────────────────┐ ┌─────────────────────────────────┐
|
|
138
|
+
// │ agent-runtimes (port 8765) │ │ jupyter server (port 8888) │
|
|
139
|
+
// │ ┌─────────────────────────────┐ │ │ ┌─────────────────────────┐ │
|
|
140
|
+
// │ │ MCP Servers (stdio) │ │ │ │ Jupyter Kernel │ │
|
|
141
|
+
// │ │ - github, filesystem, etc │◀───┼──┼──│ executes generated │ │
|
|
142
|
+
// │ └─────────────────────────────┘ │ │ │ Python code │ │
|
|
143
|
+
// │ ┌─────────────────────────────┐ │ │ └─────────────────────────┘ │
|
|
144
|
+
// │ │ /api/v1/mcp/proxy/* │ │ │ │
|
|
145
|
+
// │ │ HTTP proxy for tool calls │ │ │ Tool calls go via HTTP to │
|
|
146
|
+
// │ └─────────────────────────────┘ │ │ agent-runtimes MCP proxy │
|
|
147
|
+
// └─────────────────────────────────────┘ └─────────────────────────────────┘
|
|
148
|
+
//
|
|
149
|
+
// The backend automatically configures mcp_proxy_url when jupyter_sandbox
|
|
150
|
+
// is provided, defaulting to http://0.0.0.0:8765/api/v1/mcp/proxy
|
|
151
|
+
//
|
|
152
|
+
// =====================================================================
|
|
153
|
+
// Jupyter sandbox URL (used when useJupyterSandbox is true)
|
|
154
|
+
// Can be configured via VITE_JUPYTER_SANDBOX_URL environment variable
|
|
155
|
+
const jupyterSandboxUrl = import.meta.env.VITE_JUPYTER_SANDBOX_URL ||
|
|
156
|
+
'http://localhost:8888/api/jupyter-server?token=60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6';
|
|
157
|
+
const handleSelectedServersChange = React.useCallback((newServers) => {
|
|
158
|
+
const oldServers = selectedMcpServers;
|
|
159
|
+
// Find added and removed servers
|
|
160
|
+
const oldIds = new Set(oldServers.map(s => `${s.id}:${s.origin}`));
|
|
161
|
+
const newIds = new Set(newServers.map(s => `${s.id}:${s.origin}`));
|
|
162
|
+
const added = newServers.filter(s => !oldIds.has(`${s.id}:${s.origin}`));
|
|
163
|
+
const removed = oldServers.filter(s => !newIds.has(`${s.id}:${s.origin}`));
|
|
164
|
+
// Add system message about tool changes if there are any
|
|
165
|
+
if ((added.length > 0 || removed.length > 0) && isConfigured) {
|
|
166
|
+
let messageContent = '';
|
|
167
|
+
if (added.length > 0) {
|
|
168
|
+
const addedNames = added.map(s => `${s.id} (${s.origin})`).join(', ');
|
|
169
|
+
messageContent += `🔧 Tools added: ${addedNames}. `;
|
|
170
|
+
}
|
|
171
|
+
if (removed.length > 0) {
|
|
172
|
+
const removedNames = removed
|
|
173
|
+
.map(s => `${s.id} (${s.origin})`)
|
|
174
|
+
.join(', ');
|
|
175
|
+
messageContent += `🔧 Tools removed: ${removedNames}. You no longer have access to these tools.`;
|
|
176
|
+
}
|
|
177
|
+
if (messageContent) {
|
|
178
|
+
const systemMessage = {
|
|
179
|
+
id: `system-mcp-${Date.now()}`,
|
|
180
|
+
role: 'system',
|
|
181
|
+
content: messageContent.trim(),
|
|
182
|
+
createdAt: new Date(),
|
|
183
|
+
};
|
|
184
|
+
useChatStore.getState().addMessage(systemMessage);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
setSelectedMcpServers(newServers);
|
|
188
|
+
}, [selectedMcpServers, isConfigured]);
|
|
88
189
|
// Merge deprecated props into identityProviders for backward compatibility
|
|
89
190
|
const mergedIdentityProviders = React.useMemo(() => {
|
|
90
191
|
const merged = { ...identityProviders };
|
|
@@ -180,12 +281,11 @@ githubClientId, kaggleToken, }) => {
|
|
|
180
281
|
if (!enabled) {
|
|
181
282
|
setAllowDirectToolCalls(false);
|
|
182
283
|
setEnableToolReranker(false);
|
|
284
|
+
setUseJupyterSandbox(false);
|
|
183
285
|
}
|
|
184
286
|
};
|
|
185
287
|
// UI state
|
|
186
288
|
const [activeSession, setActiveSession] = useState('session-1');
|
|
187
|
-
const [richEditor, setRichEditor] = useState(false);
|
|
188
|
-
const [durable, setDurable] = useState(true);
|
|
189
289
|
const [codemode, _] = useState(false);
|
|
190
290
|
const [showContextTree, setShowContextTree] = useState(false);
|
|
191
291
|
const [showNotebook] = useState(true);
|
|
@@ -224,7 +324,7 @@ githubClientId, kaggleToken, }) => {
|
|
|
224
324
|
const servers = data?.mcpServers || [];
|
|
225
325
|
const available = servers.filter((s) => s.isAvailable);
|
|
226
326
|
if (available.length > 0) {
|
|
227
|
-
setSelectedMcpServers([available[0].id]);
|
|
327
|
+
setSelectedMcpServers([{ id: available[0].id, origin: 'config' }]);
|
|
228
328
|
autoSelectRef.current = true;
|
|
229
329
|
}
|
|
230
330
|
}
|
|
@@ -234,7 +334,26 @@ githubClientId, kaggleToken, }) => {
|
|
|
234
334
|
};
|
|
235
335
|
void loadServers();
|
|
236
336
|
}, [autoSelectMcpServers, enableCodemode, selectedMcpServers, baseUrl]);
|
|
237
|
-
|
|
337
|
+
// Track previous MCP servers to detect changes
|
|
338
|
+
const prevMcpServersRef = useRef(selectedMcpServers);
|
|
339
|
+
// Cache for library specs (fetched on-demand, outside QueryClientProvider)
|
|
340
|
+
const librarySpecsRef = useRef(null);
|
|
341
|
+
const fetchLibrarySpecs = useCallback(async () => {
|
|
342
|
+
if (librarySpecsRef.current)
|
|
343
|
+
return librarySpecsRef.current;
|
|
344
|
+
try {
|
|
345
|
+
const response = await fetch(`${baseUrl}/api/v1/agents/library`);
|
|
346
|
+
if (!response.ok)
|
|
347
|
+
return [];
|
|
348
|
+
const data = await response.json();
|
|
349
|
+
librarySpecsRef.current = data;
|
|
350
|
+
return data;
|
|
351
|
+
}
|
|
352
|
+
catch {
|
|
353
|
+
return [];
|
|
354
|
+
}
|
|
355
|
+
}, [baseUrl]);
|
|
356
|
+
const handleAgentSelect = async (agentId) => {
|
|
238
357
|
setSelectedAgentId(agentId);
|
|
239
358
|
setCreateError(null);
|
|
240
359
|
if (agentId === 'new-agent') {
|
|
@@ -242,6 +361,23 @@ githubClientId, kaggleToken, }) => {
|
|
|
242
361
|
setAgentName(DEFAULT_AGENT_ID);
|
|
243
362
|
setTransport('ag-ui');
|
|
244
363
|
}
|
|
364
|
+
else if (isSpecSelection(agentId)) {
|
|
365
|
+
// Populate form fields from the selected library spec
|
|
366
|
+
const specId = getSpecId(agentId);
|
|
367
|
+
const specs = await fetchLibrarySpecs();
|
|
368
|
+
const spec = specs.find(s => s.id === specId);
|
|
369
|
+
if (spec) {
|
|
370
|
+
setAgentName(spec.id);
|
|
371
|
+
// Keep current transport, model, agentLibrary - user can override
|
|
372
|
+
if (spec.skills.length > 0) {
|
|
373
|
+
setSelectedSkills(spec.skills);
|
|
374
|
+
setEnableCodemode(true);
|
|
375
|
+
}
|
|
376
|
+
if (spec.systemPromptCodemodeAddons) {
|
|
377
|
+
setEnableCodemode(true);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
245
381
|
else {
|
|
246
382
|
const agent = agents.find(a => a.id === agentId);
|
|
247
383
|
if (agent) {
|
|
@@ -257,6 +393,10 @@ githubClientId, kaggleToken, }) => {
|
|
|
257
393
|
setIsCreatingAgent(true);
|
|
258
394
|
setCreateError(null);
|
|
259
395
|
try {
|
|
396
|
+
// Resolve spec ID if creating from a library spec
|
|
397
|
+
const specId = isSpecSelection(selectedAgentId)
|
|
398
|
+
? getSpecId(selectedAgentId)
|
|
399
|
+
: undefined;
|
|
260
400
|
const response = await fetch(`${baseUrl}/api/v1/agents`, {
|
|
261
401
|
method: 'POST',
|
|
262
402
|
headers: {
|
|
@@ -275,6 +415,8 @@ githubClientId, kaggleToken, }) => {
|
|
|
275
415
|
enable_tool_reranker: enableToolReranker,
|
|
276
416
|
selected_mcp_servers: selectedMcpServers,
|
|
277
417
|
skills: selectedSkills,
|
|
418
|
+
jupyter_sandbox: useJupyterSandbox ? jupyterSandboxUrl : undefined,
|
|
419
|
+
...(specId ? { agent_spec_id: specId } : {}),
|
|
278
420
|
}),
|
|
279
421
|
});
|
|
280
422
|
if (!response.ok) {
|
|
@@ -308,6 +450,9 @@ githubClientId, kaggleToken, }) => {
|
|
|
308
450
|
enableToolReranker,
|
|
309
451
|
selectedMcpServers,
|
|
310
452
|
selectedSkills,
|
|
453
|
+
useJupyterSandbox,
|
|
454
|
+
jupyterSandboxUrl,
|
|
455
|
+
selectedAgentId,
|
|
311
456
|
]);
|
|
312
457
|
/**
|
|
313
458
|
* Delete an agent via the API
|
|
@@ -329,9 +474,16 @@ githubClientId, kaggleToken, }) => {
|
|
|
329
474
|
return false;
|
|
330
475
|
}
|
|
331
476
|
}, [baseUrl]);
|
|
477
|
+
// Track MCP servers for reference (no longer triggers recreation)
|
|
478
|
+
// MCP server updates are now handled via PATCH endpoint by McpServerManager
|
|
479
|
+
useEffect(() => {
|
|
480
|
+
prevMcpServersRef.current = selectedMcpServers;
|
|
481
|
+
}, [selectedMcpServers]);
|
|
482
|
+
// True when creating a new agent (blank or from a library spec)
|
|
483
|
+
const isNewMode = selectedAgentId === 'new-agent' || isSpecSelection(selectedAgentId);
|
|
332
484
|
const handleConnect = async () => {
|
|
333
|
-
// For existing agents (not new-agent), ensure transport and agentName are set
|
|
334
|
-
if (
|
|
485
|
+
// For existing agents (not new-agent or spec), ensure transport and agentName are set
|
|
486
|
+
if (!isNewMode) {
|
|
335
487
|
const agent = agents.find(a => a.id === selectedAgentId);
|
|
336
488
|
if (agent) {
|
|
337
489
|
setTransport(agent.transport);
|
|
@@ -368,14 +520,13 @@ githubClientId, kaggleToken, }) => {
|
|
|
368
520
|
};
|
|
369
521
|
const handleReset = async () => {
|
|
370
522
|
// Delete the agent from the server if we created it
|
|
371
|
-
if (selectedAgentId === 'new-agent'
|
|
523
|
+
if ((selectedAgentId === 'new-agent' || isSpecSelection(selectedAgentId)) &&
|
|
524
|
+
agentName) {
|
|
372
525
|
await deleteAgentOnServer(agentName);
|
|
373
526
|
}
|
|
374
527
|
setIsConfigured(false);
|
|
375
528
|
};
|
|
376
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(DatalayerThemeProvider, { children: _jsxs(PageLayout, { containerWidth: "full", children: [_jsx(Header, { activeSession: activeSession, agentName:
|
|
377
|
-
? undefined
|
|
378
|
-
: currentAgent?.description, agentStatus: currentAgent?.status, richEditor: richEditor, durable: durable, showContextTree: showContextTree, isNewAgent: selectedAgentId === 'new-agent', isConfigured: isConfigured, onSessionChange: setActiveSession, onRichEditorChange: setRichEditor, onDurableChange: setDurable, onToggleContextTree: () => setShowContextTree(!showContextTree), onToggleStatus: currentAgent
|
|
529
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(DatalayerThemeProvider, { 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
|
|
379
530
|
? () => toggleAgentStatus(currentAgent.id)
|
|
380
531
|
: undefined }), leftPaneVisible ? (_jsxs(_Fragment, { children: [_jsx(Box, { sx: {
|
|
381
532
|
position: 'fixed',
|
|
@@ -389,7 +540,7 @@ githubClientId, kaggleToken, }) => {
|
|
|
389
540
|
border: '1px solid',
|
|
390
541
|
borderLeft: 'none',
|
|
391
542
|
borderColor: 'border.default',
|
|
392
|
-
} }) }), _jsx(PageLayout.Pane, { position: "start", resizable: true, sticky: true, width: { min: '250px', default: '300px', max: '90px' }, children:
|
|
543
|
+
} }) }), _jsx(PageLayout.Pane, { position: "start", resizable: true, sticky: true, width: { min: '250px', default: '300px', max: '90px' }, children: isNewMode ? (_jsxs(Blankslate, { border: true, spacious: true, narrow: true, children: [_jsx(Blankslate.Visual, { children: _jsx(AiAgentIcon, { colored: true, size: 48 }) }), _jsx(Blankslate.Heading, { children: "Agent Runtimes" }), _jsx(Box, { sx: { textAlign: 'center' }, children: _jsx(Blankslate.Description, { children: "Expose AI Agents through multiple protocols." }) })] })) : (_jsx(MockFileBrowser, { codemode: codemode })) })] })) : (_jsx(Box, { sx: {
|
|
393
544
|
position: 'fixed',
|
|
394
545
|
left: 0,
|
|
395
546
|
top: '50%',
|
|
@@ -401,7 +552,11 @@ githubClientId, kaggleToken, }) => {
|
|
|
401
552
|
border: '1px solid',
|
|
402
553
|
borderLeft: 'none',
|
|
403
554
|
borderColor: 'border.default',
|
|
404
|
-
} }) })), _jsx(PageLayout.Content, { children: _jsx(MainContent, { showNotebook: showNotebook, timeTravel: timeTravel, onTimeTravelChange: setTimeTravel, richEditor:
|
|
555
|
+
} }) })), _jsx(PageLayout.Content, { children: _jsx(MainContent, { showNotebook: showNotebook, timeTravel: timeTravel, onTimeTravelChange: setTimeTravel, richEditor: false, notebookFile: currentAgent?.notebookFile, lexicalFile: currentAgent?.lexicalFile, isNewAgent: isNewMode, isConfigured: isConfigured, baseUrl: baseUrl, agentId: currentAgent?.id || agentName, enableCodemode: enableCodemode, selectedMcpServers: selectedMcpServers, onSelectedMcpServersChange: handleSelectedServersChange, onMcpServersChange: () => {
|
|
556
|
+
// Trigger codemode tool regeneration when MCP servers change at runtime
|
|
557
|
+
console.log('[AgentSpaceFormExample] MCP servers changed, regenerating codemode tools...');
|
|
558
|
+
// The Chat component will pick up the new selectedMcpServers via props
|
|
559
|
+
} }) }), rightPaneVisible ? (_jsxs(_Fragment, { children: [_jsx(Box, { sx: {
|
|
405
560
|
position: 'fixed',
|
|
406
561
|
right: 0,
|
|
407
562
|
top: '50%',
|
|
@@ -418,29 +573,54 @@ githubClientId, kaggleToken, }) => {
|
|
|
418
573
|
display: 'flex',
|
|
419
574
|
flexDirection: 'column',
|
|
420
575
|
p: 2,
|
|
421
|
-
}, children: !isConfigured ? (_jsx(AgentConfiguration, { agentLibrary: agentLibrary, transport: currentAgent?.transport || transport, extensions: extensions, wsUrl: wsUrl, baseUrl: baseUrl, agentName: agentName, model: model, agents: agents, selectedAgentId: selectedAgentId, isCreatingAgent: isCreatingAgent, createError: createError, enableCodemode: enableCodemode, allowDirectToolCalls: allowDirectToolCalls, enableToolReranker: enableToolReranker, availableSkills: MOCK_SKILLS, selectedSkills: selectedSkills, selectedMcpServers: selectedMcpServers, identityProviders: oauthProvidersConfig, onIdentityConnect: handleIdentityConnect, onIdentityDisconnect: handleIdentityDisconnect, onAgentLibraryChange: setAgentLibrary, onTransportChange: setTransport, onExtensionsChange: setExtensions, onWsUrlChange: setWsUrl, onBaseUrlChange: setBaseUrl, onAgentNameChange: setAgentName, onModelChange: setModel, onAgentSelect: handleAgentSelect, onConnect: handleConnect, onEnableCodemodeChange: handleEnableCodemodeChange, onAllowDirectToolCallsChange: setAllowDirectToolCalls, onEnableToolRerankerChange: setEnableToolReranker, onSelectedSkillsChange: setSelectedSkills, onSelectedMcpServersChange: setSelectedMcpServers })) : (
|
|
576
|
+
}, children: !isConfigured ? (_jsx(AgentConfiguration, { agentLibrary: agentLibrary, transport: currentAgent?.transport || transport, extensions: extensions, wsUrl: wsUrl, baseUrl: baseUrl, agentName: agentName, model: model, agents: agents, selectedAgentId: selectedAgentId, isCreatingAgent: isCreatingAgent, createError: createError, enableCodemode: enableCodemode, useJupyterSandbox: useJupyterSandbox, allowDirectToolCalls: allowDirectToolCalls, enableToolReranker: enableToolReranker, availableSkills: MOCK_SKILLS, selectedSkills: selectedSkills, selectedMcpServers: selectedMcpServers, identityProviders: oauthProvidersConfig, onIdentityConnect: handleIdentityConnect, onIdentityDisconnect: handleIdentityDisconnect, onAgentLibraryChange: setAgentLibrary, onTransportChange: setTransport, onExtensionsChange: setExtensions, onWsUrlChange: setWsUrl, onBaseUrlChange: setBaseUrl, onAgentNameChange: setAgentName, onModelChange: setModel, onAgentSelect: handleAgentSelect, onConnect: handleConnect, onEnableCodemodeChange: handleEnableCodemodeChange, onUseJupyterSandboxChange: setUseJupyterSandbox, onAllowDirectToolCallsChange: setAllowDirectToolCalls, onEnableToolRerankerChange: setEnableToolReranker, onSelectedSkillsChange: setSelectedSkills, onSelectedMcpServersChange: setSelectedMcpServers })) : (
|
|
422
577
|
/* Chat Interface */
|
|
423
|
-
_jsx(Box, { sx: { flex: 1 }, children: _jsx(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
578
|
+
_jsx(Box, { sx: { flex: 1, minHeight: 0 }, children: _jsx(ChatWithJupyterStatus, { baseUrl: baseUrl, isConfigured: isConfigured, enableCodemode: enableCodemode, useJupyterSandbox: useJupyterSandbox, chatProps: {
|
|
579
|
+
transport: currentAgent?.transport || transport,
|
|
580
|
+
extensions: extensions,
|
|
581
|
+
wsUrl: wsUrl,
|
|
582
|
+
baseUrl: baseUrl,
|
|
583
|
+
agentId: currentAgent?.id || agentName,
|
|
584
|
+
title: currentAgent?.name || agentName || 'AI Assistant',
|
|
585
|
+
autoConnect: true,
|
|
586
|
+
autoFocus: true,
|
|
587
|
+
placeholder: 'Type your message to the agent...',
|
|
588
|
+
height: 'calc(100vh - 150px)',
|
|
589
|
+
showModelSelector: true,
|
|
590
|
+
showToolsMenu: true,
|
|
591
|
+
showSkillsMenu: true,
|
|
592
|
+
codemodeEnabled: enableCodemode,
|
|
593
|
+
initialModel: model,
|
|
594
|
+
mcpServers: selectedMcpServers,
|
|
595
|
+
initialSkills: selectedSkills,
|
|
596
|
+
identityProviders: oauthProvidersConfig,
|
|
597
|
+
onIdentityConnect: handleIdentityConnect,
|
|
598
|
+
onIdentityDisconnect: handleIdentityDisconnect,
|
|
599
|
+
suggestions: [
|
|
600
|
+
{
|
|
601
|
+
title: '👋 Say hello',
|
|
602
|
+
message: 'Hello! What can you help me with today?',
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
title: '💡 Get ideas',
|
|
606
|
+
message: 'Can you suggest some creative project ideas?',
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
title: '📝 Explain concepts',
|
|
610
|
+
message: 'Can you explain how AI agents work?',
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
title: '🔧 Help with code',
|
|
614
|
+
message: 'Can you help me write some Python code?',
|
|
615
|
+
},
|
|
616
|
+
],
|
|
617
|
+
onDisconnect: handleReset,
|
|
618
|
+
onMessageSent: (_content) => {
|
|
619
|
+
// Message sent
|
|
435
620
|
},
|
|
436
|
-
{
|
|
437
|
-
|
|
438
|
-
message: 'Can you help me write some Python code?',
|
|
621
|
+
onMessageReceived: (_message) => {
|
|
622
|
+
// Message received
|
|
439
623
|
},
|
|
440
|
-
], onDisconnect: handleReset, onMessageSent: (_content) => {
|
|
441
|
-
// Message sent
|
|
442
|
-
}, onMessageReceived: (_message) => {
|
|
443
|
-
// Message received
|
|
444
624
|
} }) })) }) })] })) : (_jsx(Box, { sx: {
|
|
445
625
|
position: 'fixed',
|
|
446
626
|
right: 0,
|
|
@@ -26,6 +26,7 @@ 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';
|
|
29
30
|
import './lexical/lexical-theme.css';
|
|
30
31
|
/**
|
|
31
32
|
* Main CopilotKit lexical example component
|
|
@@ -48,11 +48,12 @@ import { CopilotKit, useFrontendTool } from '@copilotkit/react-core';
|
|
|
48
48
|
import { CopilotSidebar } from '@copilotkit/react-ui';
|
|
49
49
|
import { Box } from '@datalayer/primer-addons';
|
|
50
50
|
import { JupyterReactTheme, useJupyter } from '@datalayer/jupyter-react';
|
|
51
|
-
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, } from '@datalayer/jupyter-lexical';
|
|
51
|
+
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, ExcalidrawPlugin, CollapsiblePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, TableCellResizerPlugin, TablePlugin, } from '@datalayer/jupyter-lexical';
|
|
52
52
|
import { ActionRegistrar, useLexicalToolActions, } from '../tools/adapters/copilotkit/lexicalHooks';
|
|
53
53
|
import { editorConfig } from './lexical/editorConfig';
|
|
54
54
|
import '@datalayer/jupyter-lexical/style/index.css';
|
|
55
55
|
import '@copilotkit/react-ui/styles.css';
|
|
56
|
+
import '@datalayer/jupyter-lexical/style/modal-overrides.css';
|
|
56
57
|
import './lexical/lexical-theme.css';
|
|
57
58
|
// Fixed lexical document ID
|
|
58
59
|
const LEXICAL_ID = 'agui-lexical-example';
|
|
@@ -146,7 +147,7 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
|
|
|
146
147
|
padding: 3,
|
|
147
148
|
backgroundColor: 'canvas.default',
|
|
148
149
|
minHeight: '600px',
|
|
149
|
-
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) })] }) }));
|
|
150
|
+
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizerPlugin, {}), _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(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) })] }) }));
|
|
150
151
|
});
|
|
151
152
|
function LexicalWithTools({ content, serviceManager, }) {
|
|
152
153
|
// Get all actions for this lexical document
|
package/lib/examples/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { default as CopilotKitNotebookExample } from './CopilotKitNotebookExampl
|
|
|
18
18
|
export { default as DatalayerNotebookExample } from './DatalayerNotebookExample';
|
|
19
19
|
export { default as JupyterCellExample } from './JupyterCellExample';
|
|
20
20
|
export { default as JupyterNotebookExample } from './JupyterNotebookExample';
|
|
21
|
+
export type { Agent, AgentStatus, AgentsState, Transport, } from './stores/examplesStore';
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
{
|
|
4
|
-
"cell_type": "code",
|
|
5
|
-
"execution_count": 1,
|
|
6
|
-
"metadata": {},
|
|
7
|
-
"outputs": [
|
|
2
|
+
"cells": [
|
|
8
3
|
{
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
"cell_type": "code",
|
|
5
|
+
"execution_count": 1,
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"outputs": [
|
|
8
|
+
{
|
|
9
|
+
"data": {
|
|
10
|
+
"text/plain": ["4"]
|
|
11
|
+
},
|
|
12
|
+
"execution_count": 1,
|
|
13
|
+
"metadata": {},
|
|
14
|
+
"output_type": "execute_result"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"source": ["2+2"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"cell_type": "code",
|
|
21
|
+
"execution_count": null,
|
|
22
|
+
"metadata": {},
|
|
23
|
+
"outputs": [],
|
|
24
|
+
"source": []
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"metadata": {
|
|
28
|
+
"kernelspec": {
|
|
29
|
+
"display_name": "Python (ipykernel)",
|
|
30
|
+
"language": "python",
|
|
31
|
+
"name": "python"
|
|
32
|
+
},
|
|
33
|
+
"language_info": {
|
|
34
|
+
"codemirror_mode": {
|
|
35
|
+
"name": "ipython",
|
|
36
|
+
"version": 3
|
|
37
|
+
},
|
|
38
|
+
"file_extension": ".py",
|
|
39
|
+
"mimetype": "text/x-python",
|
|
40
|
+
"name": "python",
|
|
41
|
+
"nbconvert_exporter": "python",
|
|
42
|
+
"pygments_lexer": "ipython3",
|
|
43
|
+
"version": "3.10.4"
|
|
15
44
|
}
|
|
16
|
-
],
|
|
17
|
-
"source": ["2+2"]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"cell_type": "code",
|
|
21
|
-
"execution_count": null,
|
|
22
|
-
"metadata": {},
|
|
23
|
-
"outputs": [],
|
|
24
|
-
"source": []
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"metadata": {
|
|
28
|
-
"kernelspec": {
|
|
29
|
-
"display_name": "Python (ipykernel)",
|
|
30
|
-
"language": "python",
|
|
31
|
-
"name": "python"
|
|
32
45
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"name": "ipython",
|
|
36
|
-
"version": 3
|
|
37
|
-
},
|
|
38
|
-
"file_extension": ".py",
|
|
39
|
-
"mimetype": "text/x-python",
|
|
40
|
-
"name": "python",
|
|
41
|
-
"nbconvert_exporter": "python",
|
|
42
|
-
"pygments_lexer": "ipython3",
|
|
43
|
-
"version": "3.10.4"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"nbformat": 4,
|
|
47
|
-
"nbformat_minor": 4
|
|
46
|
+
"nbformat": 4,
|
|
47
|
+
"nbformat_minor": 4
|
|
48
48
|
}
|
package/lib/hooks/useAGUI.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface UseAGUIOptions {
|
|
|
33
33
|
* Hook to manage chat state with AG-UI protocol.
|
|
34
34
|
*
|
|
35
35
|
* This hook provides an interface to the AG-UI protocol endpoint
|
|
36
|
-
* at /api/v1/ag-ui/{agent_id}/ which is powered by Pydantic AI's
|
|
36
|
+
* at /api/v1/ag-ui/{agent_id}/ (trailing slash required) which is powered by Pydantic AI's
|
|
37
37
|
* native AGUIApp. The AG-UI protocol accepts POST requests with
|
|
38
38
|
* prompts and streams back agent responses.
|
|
39
39
|
*
|
package/lib/hooks/useAGUI.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
7
7
|
* Hook to manage chat state with AG-UI protocol.
|
|
8
8
|
*
|
|
9
9
|
* This hook provides an interface to the AG-UI protocol endpoint
|
|
10
|
-
* at /api/v1/ag-ui/{agent_id}/ which is powered by Pydantic AI's
|
|
10
|
+
* at /api/v1/ag-ui/{agent_id}/ (trailing slash required) which is powered by Pydantic AI's
|
|
11
11
|
* native AGUIApp. The AG-UI protocol accepts POST requests with
|
|
12
12
|
* prompts and streams back agent responses.
|
|
13
13
|
*
|
package/lib/identity/types.d.ts
CHANGED
|
@@ -226,7 +226,7 @@ export interface TokenProviderConfig {
|
|
|
226
226
|
displayName: string;
|
|
227
227
|
/** Icon URL */
|
|
228
228
|
iconUrl?: string;
|
|
229
|
-
/** Profile URL template (use {username} placeholder) */
|
|
229
|
+
/** Profile URL template (use `{username}` placeholder) */
|
|
230
230
|
profileUrlTemplate?: string;
|
|
231
231
|
/** User info endpoint (called with Bearer token) */
|
|
232
232
|
userInfoUrl?: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export * from './components';
|
|
|
2
2
|
export * from './state';
|
|
3
3
|
export * from './runtime';
|
|
4
4
|
export * from './identity';
|
|
5
|
+
export * from './config';
|
|
6
|
+
export type { ConversationEntry, MCPServer, AgentSkillSpec, AgentSpec, AIModel, FrontendConfig, BuiltinTool, MCPServerTool, } from './types';
|
package/lib/index.js
CHANGED
package/lib/runtime/index.d.ts
CHANGED
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export { useRuntimeStore, useRuntime, useAgent, useRuntimeStatus, useRuntimeError, useIsLaunching, getRuntimeState, subscribeToRuntime, } from './runtimeStore';
|
|
31
|
+
export type { RuntimeStore, RuntimeStoreState, RuntimeStoreActions, } from './runtimeStore';
|
|
31
32
|
export { useAgentConnection } from './useAgentConnection';
|
|
33
|
+
export type { UseAgentConnectionReturn, UseAgentConnectionOptions, } from './useAgentConnection';
|
|
32
34
|
export { useAgentRuntime } from './useAgentRuntime';
|
|
35
|
+
export type { UseAgentRuntimeReturn, UseAgentRuntimeOptions, } from './useAgentRuntime';
|
|
33
36
|
export type { IRuntimeLocation, IRuntimeType, IRuntimeCapabilities, IRuntimePod, IRuntimeOptions, IRuntimeDesc, } from './types';
|
|
34
37
|
export type { RuntimeConnection, AgentRuntimeStatus as RuntimeStatus, AgentConfig, AgentConnection, AgentRuntimeState, } from './types';
|
|
35
38
|
export { DEFAULT_AGENT_CONFIG } from './types';
|
|
@@ -3,7 +3,7 @@ import type { IRuntimeOptions, RuntimeConnection, AgentRuntimeStatus, AgentConfi
|
|
|
3
3
|
/**
|
|
4
4
|
* Runtime store state interface.
|
|
5
5
|
*/
|
|
6
|
-
interface RuntimeStoreState {
|
|
6
|
+
export interface RuntimeStoreState {
|
|
7
7
|
/** Current runtime connection */
|
|
8
8
|
runtime: RuntimeConnection | null;
|
|
9
9
|
/** Current agent connection */
|
|
@@ -18,7 +18,7 @@ interface RuntimeStoreState {
|
|
|
18
18
|
/**
|
|
19
19
|
* Runtime store actions interface.
|
|
20
20
|
*/
|
|
21
|
-
interface RuntimeStoreActions {
|
|
21
|
+
export interface RuntimeStoreActions {
|
|
22
22
|
/** Launch a new runtime */
|
|
23
23
|
launchRuntime: (options: IRuntimeOptions) => Promise<RuntimeConnection>;
|
|
24
24
|
/** Connect to an existing runtime */
|
|
@@ -39,7 +39,7 @@ interface RuntimeStoreActions {
|
|
|
39
39
|
/** Reset store to initial state */
|
|
40
40
|
reset: () => void;
|
|
41
41
|
}
|
|
42
|
-
type RuntimeStore = RuntimeStoreState & RuntimeStoreActions;
|
|
42
|
+
export type RuntimeStore = RuntimeStoreState & RuntimeStoreActions;
|
|
43
43
|
/**
|
|
44
44
|
* Zustand store for runtime management.
|
|
45
45
|
*
|
|
@@ -74,4 +74,3 @@ export declare const getRuntimeState: () => RuntimeStore;
|
|
|
74
74
|
* Subscribe to runtime store changes (for use outside React).
|
|
75
75
|
*/
|
|
76
76
|
export declare const subscribeToRuntime: (listener: (state: RuntimeStore, prevState: RuntimeStore) => void) => () => void;
|
|
77
|
-
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AgentConfig, AgentConnection } from './types';
|
|
2
|
-
interface UseAgentConnectionOptions {
|
|
2
|
+
export interface UseAgentConnectionOptions {
|
|
3
3
|
/** Agent configuration */
|
|
4
4
|
config?: AgentConfig;
|
|
5
5
|
/** Auto-create agent when runtime is ready */
|
|
6
6
|
autoCreate?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface UseAgentConnectionReturn {
|
|
8
|
+
export interface UseAgentConnectionReturn {
|
|
9
9
|
/** Current agent connection */
|
|
10
10
|
agent: AgentConnection | null;
|
|
11
11
|
/** Whether the agent is ready */
|
|
@@ -43,4 +43,3 @@ interface UseAgentConnectionReturn {
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export declare function useAgentConnection(options?: UseAgentConnectionOptions): UseAgentConnectionReturn;
|
|
46
|
-
export {};
|