@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
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
import { useMemo, useState, useCallback } from 'react';
|
|
7
|
+
import { Text, TextInput, Button, FormControl, Select, Checkbox, Spinner, Flash, Label, IconButton, } from '@primer/react';
|
|
8
|
+
import { ToolsIcon, KeyIcon, SyncIcon, PlusIcon, XIcon, LinkExternalIcon, } from '@primer/octicons-react';
|
|
9
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
10
|
+
import { Box } from '@datalayer/primer-addons';
|
|
11
|
+
import { IdentityConnect, useIdentity } from '../identity';
|
|
12
|
+
import { IdentityCard } from './chat';
|
|
13
|
+
/**
|
|
14
|
+
* Helper: is the selected agent id a library spec?
|
|
15
|
+
*/
|
|
16
|
+
export const isSpecSelection = (id) => id.startsWith('spec:');
|
|
17
|
+
/**
|
|
18
|
+
* Helper: extract the spec id from a spec selection value.
|
|
19
|
+
*/
|
|
20
|
+
export const getSpecId = (id) => id.replace(/^spec:/, '');
|
|
21
|
+
/**
|
|
22
|
+
* Token-based identity providers that can be connected via API key
|
|
23
|
+
*/
|
|
24
|
+
const TOKEN_PROVIDERS = [
|
|
25
|
+
{
|
|
26
|
+
provider: 'kaggle',
|
|
27
|
+
name: 'Kaggle',
|
|
28
|
+
description: 'Access Kaggle datasets and notebooks',
|
|
29
|
+
iconUrl: 'https://www.kaggle.com/static/images/favicon.ico',
|
|
30
|
+
color: '#20beff',
|
|
31
|
+
helpUrl: 'https://www.kaggle.com/settings/account',
|
|
32
|
+
helpText: 'Get your API key from the Account page',
|
|
33
|
+
placeholder: 'Enter your Kaggle API key',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Combined component that shows:
|
|
38
|
+
* - Connected identities with token status (from AgentIdentity)
|
|
39
|
+
* - Connect buttons only for providers NOT yet connected (from IdentityConnect)
|
|
40
|
+
* - Token input for token-based providers (Kaggle, etc.)
|
|
41
|
+
*/
|
|
42
|
+
function IdentityConnectWithStatus({ identityProviders = {}, disabled = false, onConnect, onDisconnect, }) {
|
|
43
|
+
const { identities, connectWithToken, disconnect } = useIdentity();
|
|
44
|
+
const [expandedTokenProvider, setExpandedTokenProvider] = useState(null);
|
|
45
|
+
const [tokenInput, setTokenInput] = useState('');
|
|
46
|
+
const [isConnecting, setIsConnecting] = useState(false);
|
|
47
|
+
// Get list of connected provider names
|
|
48
|
+
const connectedProviders = useMemo(() => new Set(identities.map(id => id.provider)), [identities]);
|
|
49
|
+
// Get providers that have config and are already connected (OAuth providers)
|
|
50
|
+
// Plus any token-based providers that are connected (no config needed)
|
|
51
|
+
const connectedIdentities = useMemo(() => {
|
|
52
|
+
const providerKeys = Object.keys(identityProviders);
|
|
53
|
+
return identities.filter(id => providerKeys.includes(id.provider) ||
|
|
54
|
+
(id.authType === 'token' && id.isConnected));
|
|
55
|
+
}, [identities, identityProviders]);
|
|
56
|
+
// Get OAuth providers that are NOT yet connected
|
|
57
|
+
const unconnectedProviders = useMemo(() => {
|
|
58
|
+
const providerKeys = Object.keys(identityProviders);
|
|
59
|
+
const unconnected = {};
|
|
60
|
+
for (const provider of providerKeys) {
|
|
61
|
+
if (!connectedProviders.has(provider)) {
|
|
62
|
+
unconnected[provider] = identityProviders[provider];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return unconnected;
|
|
66
|
+
}, [identityProviders, connectedProviders]);
|
|
67
|
+
// Get token providers that are NOT yet connected
|
|
68
|
+
const unconnectedTokenProviders = useMemo(() => {
|
|
69
|
+
return TOKEN_PROVIDERS.filter(tp => !connectedProviders.has(tp.provider));
|
|
70
|
+
}, [connectedProviders]);
|
|
71
|
+
const hasUnconnected = Object.keys(unconnectedProviders).length > 0;
|
|
72
|
+
const hasUnconnectedToken = unconnectedTokenProviders.length > 0;
|
|
73
|
+
// Check if there's anything to show
|
|
74
|
+
const hasContent = connectedIdentities.length > 0 || hasUnconnected || hasUnconnectedToken;
|
|
75
|
+
// Handle token connection
|
|
76
|
+
const handleTokenConnect = useCallback(async (provider, displayName, iconUrl) => {
|
|
77
|
+
if (!tokenInput.trim())
|
|
78
|
+
return;
|
|
79
|
+
setIsConnecting(true);
|
|
80
|
+
try {
|
|
81
|
+
const identity = await connectWithToken(provider, tokenInput.trim(), {
|
|
82
|
+
displayName,
|
|
83
|
+
iconUrl,
|
|
84
|
+
});
|
|
85
|
+
onConnect?.(identity);
|
|
86
|
+
setTokenInput('');
|
|
87
|
+
setExpandedTokenProvider(null);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
console.error(`Failed to connect ${provider}:`, err);
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
setIsConnecting(false);
|
|
94
|
+
}
|
|
95
|
+
}, [tokenInput, connectWithToken, onConnect]);
|
|
96
|
+
// Handle token disconnect
|
|
97
|
+
const handleTokenDisconnect = useCallback(async (provider) => {
|
|
98
|
+
try {
|
|
99
|
+
await disconnect(provider);
|
|
100
|
+
onDisconnect?.(provider);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error(`Failed to disconnect ${provider}:`, err);
|
|
104
|
+
}
|
|
105
|
+
}, [disconnect, onDisconnect]);
|
|
106
|
+
if (!hasContent) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [connectedIdentities.length > 0 && (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: connectedIdentities.map(identity => (_jsx(IdentityCard, { identity: identity, providerConfig: identityProviders?.[identity.provider], showExpirationDetails: true, allowReconnect: !disabled && identity.authType !== 'token', onConnect: onConnect, onDisconnect: identity.authType === 'token'
|
|
110
|
+
? () => handleTokenDisconnect(identity.provider)
|
|
111
|
+
: onDisconnect }, identity.provider))) })), hasUnconnected && (_jsx(IdentityConnect, { providers: unconnectedProviders, layout: "list", showHeader: false, size: "medium", showDescriptions: true, disabled: disabled, onConnect: onConnect, onDisconnect: onDisconnect })), hasUnconnectedToken && !disabled && (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: unconnectedTokenProviders.map(tp => (_jsxs(Box, { sx: {
|
|
112
|
+
border: '1px solid',
|
|
113
|
+
borderColor: expandedTokenProvider === tp.provider
|
|
114
|
+
? tp.color
|
|
115
|
+
: 'border.default',
|
|
116
|
+
borderRadius: 2,
|
|
117
|
+
overflow: 'hidden',
|
|
118
|
+
}, children: [_jsxs(Box, { as: "button", onClick: () => {
|
|
119
|
+
setExpandedTokenProvider(expandedTokenProvider === tp.provider ? null : tp.provider);
|
|
120
|
+
setTokenInput('');
|
|
121
|
+
}, sx: {
|
|
122
|
+
width: '100%',
|
|
123
|
+
display: 'flex',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
gap: 2,
|
|
126
|
+
padding: 2,
|
|
127
|
+
backgroundColor: 'canvas.subtle',
|
|
128
|
+
border: 'none',
|
|
129
|
+
cursor: 'pointer',
|
|
130
|
+
'&:hover': {
|
|
131
|
+
backgroundColor: 'canvas.inset',
|
|
132
|
+
},
|
|
133
|
+
}, children: [tp.iconUrl ? (_jsx("img", { src: tp.iconUrl, alt: tp.name, style: { width: 20, height: 20 } })) : (_jsx(KeyIcon, { size: 20 })), _jsxs(Box, { sx: { flex: 1, textAlign: 'left' }, children: [_jsxs(Text, { sx: { fontWeight: 'semibold', display: 'block' }, children: ["Connect ", tp.name] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: tp.description })] }), _jsx(PlusIcon, { size: 16 })] }), expandedTokenProvider === tp.provider && (_jsxs(Box, { sx: { padding: 3, backgroundColor: 'canvas.default' }, children: [_jsxs(Box, { sx: {
|
|
134
|
+
mb: 2,
|
|
135
|
+
display: 'flex',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: 1,
|
|
138
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: tp.helpText }), _jsx(Button, { as: "a", href: tp.helpUrl, target: "_blank", rel: "noopener noreferrer", variant: "invisible", size: "small", leadingVisual: LinkExternalIcon, sx: { fontSize: 0 }, children: "Get API Key" })] }), _jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(TextInput, { type: "password", placeholder: tp.placeholder, value: tokenInput, onChange: e => setTokenInput(e.target.value), onKeyDown: e => {
|
|
139
|
+
if (e.key === 'Enter' && tokenInput.trim()) {
|
|
140
|
+
handleTokenConnect(tp.provider, tp.name, tp.iconUrl);
|
|
141
|
+
}
|
|
142
|
+
}, sx: { flex: 1 }, disabled: isConnecting, autoFocus: true }), _jsx(Button, { onClick: () => handleTokenConnect(tp.provider, tp.name, tp.iconUrl), disabled: !tokenInput.trim() || isConnecting, variant: "primary", children: isConnecting ? _jsx(Spinner, { size: "small" }) : 'Connect' }), _jsx(IconButton, { icon: XIcon, "aria-label": "Cancel", onClick: () => {
|
|
143
|
+
setExpandedTokenProvider(null);
|
|
144
|
+
setTokenInput('');
|
|
145
|
+
}, variant: "invisible" })] })] }))] }, tp.provider))) }))] }));
|
|
146
|
+
}
|
|
147
|
+
const AGENT_LIBRARIES = [
|
|
148
|
+
{
|
|
149
|
+
value: 'pydantic-ai',
|
|
150
|
+
label: 'Pydantic AI',
|
|
151
|
+
description: 'Type-safe agents with Pydantic models',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
value: 'langchain',
|
|
155
|
+
label: 'LangChain',
|
|
156
|
+
description: 'Complex chains and agent workflows',
|
|
157
|
+
disabled: true,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
value: 'jupyter-ai',
|
|
161
|
+
label: 'Simple AI',
|
|
162
|
+
description: 'Simple notebook integration',
|
|
163
|
+
disabled: true,
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
const TRANSPORTS = [
|
|
167
|
+
{
|
|
168
|
+
value: 'ag-ui',
|
|
169
|
+
label: 'AG-UI',
|
|
170
|
+
description: 'Pydantic AI native UI transport',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
value: 'acp',
|
|
174
|
+
label: 'ACP (Agent Client Protocol)',
|
|
175
|
+
description: 'Standard WebSocket-based transport',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
value: 'vercel-ai',
|
|
179
|
+
label: 'Vercel AI',
|
|
180
|
+
description: 'HTTP streaming with Vercel AI',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: 'vercel-ai-jupyter',
|
|
184
|
+
label: 'Vercel AI (Jupyter)',
|
|
185
|
+
description: 'Vercel AI via Jupyter server endpoint',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
value: 'a2a',
|
|
189
|
+
label: 'A2A (Agent-to-Agent)',
|
|
190
|
+
description: 'Inter-agent communication',
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
const EXTENSIONS = [
|
|
194
|
+
{
|
|
195
|
+
value: 'mcp-ui',
|
|
196
|
+
label: 'MCP-UI',
|
|
197
|
+
description: 'MCP UI resources extension',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
value: 'a2ui',
|
|
201
|
+
label: 'A2UI',
|
|
202
|
+
description: 'Agent-to-UI extension',
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
/**
|
|
206
|
+
* Agent Configuration Component
|
|
207
|
+
*
|
|
208
|
+
* Form for configuring agent connection settings.
|
|
209
|
+
*/
|
|
210
|
+
export const AgentConfiguration = ({ agentLibrary, transport, extensions, wsUrl, baseUrl, agentName, model, agents, selectedAgentId, isCreatingAgent = false, createError = null, enableCodemode = false, allowDirectToolCalls = false, enableToolReranker = false, useJupyterSandbox = false, availableSkills = [], selectedSkills = [], selectedMcpServers = [], identityProviders, onIdentityConnect, onIdentityDisconnect, onAgentLibraryChange, onTransportChange, onExtensionsChange, onWsUrlChange, onBaseUrlChange, onAgentNameChange, onModelChange, onAgentSelect, onConnect, onEnableCodemodeChange, onAllowDirectToolCallsChange, onEnableToolRerankerChange, onUseJupyterSandboxChange, onSelectedSkillsChange, onSelectedMcpServersChange, }) => {
|
|
211
|
+
// Fetch general configuration from the backend (models, etc.)
|
|
212
|
+
const configQuery = useQuery({
|
|
213
|
+
queryKey: ['agent-config', baseUrl],
|
|
214
|
+
queryFn: async () => {
|
|
215
|
+
const response = await fetch(`${baseUrl}/api/v1/configure`);
|
|
216
|
+
if (!response.ok) {
|
|
217
|
+
throw new Error('Failed to fetch configuration');
|
|
218
|
+
}
|
|
219
|
+
return response.json();
|
|
220
|
+
},
|
|
221
|
+
enabled: !!baseUrl,
|
|
222
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
223
|
+
retry: 1,
|
|
224
|
+
});
|
|
225
|
+
// Fetch MCP Config servers from mcp.json (user-defined servers)
|
|
226
|
+
const mcpServersQuery = useQuery({
|
|
227
|
+
queryKey: ['mcp-config', baseUrl],
|
|
228
|
+
queryFn: async () => {
|
|
229
|
+
const response = await fetch(`${baseUrl}/api/v1/mcp/servers/config`);
|
|
230
|
+
if (!response.ok) {
|
|
231
|
+
throw new Error('Failed to fetch MCP config servers');
|
|
232
|
+
}
|
|
233
|
+
return response.json();
|
|
234
|
+
},
|
|
235
|
+
enabled: !!baseUrl,
|
|
236
|
+
staleTime: 1000 * 60 * 1, // 1 minute (refresh more often for running status)
|
|
237
|
+
retry: 1,
|
|
238
|
+
});
|
|
239
|
+
// Fetch agent specs from library
|
|
240
|
+
const libraryQuery = useQuery({
|
|
241
|
+
queryKey: ['agent-library', baseUrl],
|
|
242
|
+
queryFn: async () => {
|
|
243
|
+
const response = await fetch(`${baseUrl}/api/v1/agents/library`);
|
|
244
|
+
if (!response.ok) {
|
|
245
|
+
throw new Error('Failed to fetch agent library');
|
|
246
|
+
}
|
|
247
|
+
return response.json();
|
|
248
|
+
},
|
|
249
|
+
enabled: !!baseUrl,
|
|
250
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
251
|
+
retry: 1,
|
|
252
|
+
});
|
|
253
|
+
const librarySpecs = libraryQuery.data || [];
|
|
254
|
+
// The currently selected library spec (if any)
|
|
255
|
+
const selectedSpec = useMemo(() => {
|
|
256
|
+
if (!isSpecSelection(selectedAgentId))
|
|
257
|
+
return null;
|
|
258
|
+
const specId = getSpecId(selectedAgentId);
|
|
259
|
+
return librarySpecs.find(s => s.id === specId) || null;
|
|
260
|
+
}, [selectedAgentId, librarySpecs]);
|
|
261
|
+
// When a spec is selected, form behaves like new-agent but with pre-filled values
|
|
262
|
+
const isNewAgentMode = selectedAgentId === 'new-agent' || isSpecSelection(selectedAgentId);
|
|
263
|
+
// True when a library spec is selected (fields locked down except Name, URL, Library, Model, Transport, Extensions)
|
|
264
|
+
const isSpecMode = isSpecSelection(selectedAgentId);
|
|
265
|
+
// Fetch skills from the backend (only when codemode is enabled)
|
|
266
|
+
const skillsQuery = useQuery({
|
|
267
|
+
queryKey: ['agent-skills', baseUrl],
|
|
268
|
+
queryFn: async () => {
|
|
269
|
+
const response = await fetch(`${baseUrl}/api/v1/skills`);
|
|
270
|
+
if (!response.ok) {
|
|
271
|
+
throw new Error('Failed to fetch skills');
|
|
272
|
+
}
|
|
273
|
+
return response.json();
|
|
274
|
+
},
|
|
275
|
+
enabled: !!baseUrl && enableCodemode,
|
|
276
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
277
|
+
retry: 1,
|
|
278
|
+
});
|
|
279
|
+
// Fetch MCP Catalog servers (predefined servers that can be enabled on-demand)
|
|
280
|
+
const catalogServersQuery = useQuery({
|
|
281
|
+
queryKey: ['mcp-catalog', baseUrl],
|
|
282
|
+
queryFn: async () => {
|
|
283
|
+
const response = await fetch(`${baseUrl}/api/v1/mcp/servers/catalog`);
|
|
284
|
+
if (!response.ok) {
|
|
285
|
+
throw new Error('Failed to fetch MCP catalog servers');
|
|
286
|
+
}
|
|
287
|
+
return response.json();
|
|
288
|
+
},
|
|
289
|
+
enabled: !!baseUrl,
|
|
290
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
291
|
+
retry: 1,
|
|
292
|
+
});
|
|
293
|
+
// Query client for invalidating queries
|
|
294
|
+
const queryClient = useQueryClient();
|
|
295
|
+
// Mutation to enable a catalog server
|
|
296
|
+
const enableCatalogServerMutation = useMutation({
|
|
297
|
+
mutationFn: async (serverName) => {
|
|
298
|
+
const response = await fetch(`${baseUrl}/api/v1/mcp/servers/catalog/${serverName}/enable`, { method: 'POST' });
|
|
299
|
+
if (!response.ok) {
|
|
300
|
+
const error = await response
|
|
301
|
+
.json()
|
|
302
|
+
.catch(() => ({ detail: 'Unknown error' }));
|
|
303
|
+
throw new Error(error.detail || 'Failed to enable server');
|
|
304
|
+
}
|
|
305
|
+
return response.json();
|
|
306
|
+
},
|
|
307
|
+
onSuccess: () => {
|
|
308
|
+
// Refresh both config and catalog queries to get updated running status
|
|
309
|
+
queryClient.invalidateQueries({ queryKey: ['mcp-config', baseUrl] });
|
|
310
|
+
queryClient.invalidateQueries({ queryKey: ['mcp-catalog', baseUrl] });
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
// Use MCP servers from dedicated query, fallback to configQuery for backwards compatibility
|
|
314
|
+
const configServers = mcpServersQuery.data || configQuery.data?.mcpServers || [];
|
|
315
|
+
const catalogServers = catalogServersQuery.data || [];
|
|
316
|
+
const models = configQuery.data?.models || [];
|
|
317
|
+
// Use fetched skills when codemode is enabled, otherwise use passed availableSkills (which may be empty)
|
|
318
|
+
const fetchedSkills = skillsQuery.data?.skills || [];
|
|
319
|
+
const displaySkills = enableCodemode ? fetchedSkills : availableSkills;
|
|
320
|
+
const skillsEnabled = selectedSkills.length > 0;
|
|
321
|
+
const selectedConfigServers = selectedMcpServers
|
|
322
|
+
.filter(s => s.origin === 'config')
|
|
323
|
+
.map(s => s.id);
|
|
324
|
+
const selectedCatalogServers = selectedMcpServers
|
|
325
|
+
.filter(s => s.origin === 'catalog')
|
|
326
|
+
.map(s => s.id);
|
|
327
|
+
// Preview servers combines both config and catalog selections
|
|
328
|
+
const previewConfigServers = selectedConfigServers.length
|
|
329
|
+
? configServers.filter(server => selectedConfigServers.includes(server.id))
|
|
330
|
+
: [];
|
|
331
|
+
const previewCatalogServers = selectedCatalogServers.length
|
|
332
|
+
? catalogServers.filter(server => selectedCatalogServers.includes(server.id))
|
|
333
|
+
: [];
|
|
334
|
+
// Handle MCP Config server checkbox change
|
|
335
|
+
const handleConfigServerChange = (serverId, checked) => {
|
|
336
|
+
if (!onSelectedMcpServersChange)
|
|
337
|
+
return;
|
|
338
|
+
if (checked) {
|
|
339
|
+
if (!selectedMcpServers.some(s => s.id === serverId && s.origin === 'config')) {
|
|
340
|
+
onSelectedMcpServersChange([
|
|
341
|
+
...selectedMcpServers,
|
|
342
|
+
{ id: serverId, origin: 'config' },
|
|
343
|
+
]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
onSelectedMcpServersChange(selectedMcpServers.filter(s => !(s.id === serverId && s.origin === 'config')));
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
// Handle MCP Catalog server checkbox change
|
|
351
|
+
// If selected and not running, enable (start) the server first
|
|
352
|
+
const handleCatalogServerChange = async (serverId, checked, isRunning) => {
|
|
353
|
+
if (!onSelectedMcpServersChange)
|
|
354
|
+
return;
|
|
355
|
+
if (checked) {
|
|
356
|
+
// If not running, start the server first
|
|
357
|
+
if (!isRunning) {
|
|
358
|
+
try {
|
|
359
|
+
await enableCatalogServerMutation.mutateAsync(serverId);
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
console.error('Failed to enable catalog server:', error);
|
|
363
|
+
return; // Don't add to selection if enable failed
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (!selectedMcpServers.some(s => s.id === serverId && s.origin === 'catalog')) {
|
|
367
|
+
onSelectedMcpServersChange([
|
|
368
|
+
...selectedMcpServers,
|
|
369
|
+
{ id: serverId, origin: 'catalog' },
|
|
370
|
+
]);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
onSelectedMcpServersChange(selectedMcpServers.filter(s => !(s.id === serverId && s.origin === 'catalog')));
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
const handleSkillChange = (skillId, checked) => {
|
|
378
|
+
if (checked) {
|
|
379
|
+
onSelectedSkillsChange?.([...selectedSkills, skillId]);
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
onSelectedSkillsChange?.(selectedSkills.filter(id => id !== skillId));
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
// MCP servers are disabled for existing agents and when a spec is selected
|
|
386
|
+
const mcpServersDisabled = !isNewAgentMode || isSpecMode;
|
|
387
|
+
// Determine which extensions are enabled based on transport
|
|
388
|
+
const isExtensionEnabled = (ext) => {
|
|
389
|
+
if (!isNewAgentMode)
|
|
390
|
+
return false;
|
|
391
|
+
if (transport === 'ag-ui')
|
|
392
|
+
return true; // Both mcp-ui and a2ui enabled
|
|
393
|
+
if (transport === 'a2a')
|
|
394
|
+
return ext === 'a2ui'; // Only a2ui enabled
|
|
395
|
+
return false; // All others disabled
|
|
396
|
+
};
|
|
397
|
+
// Handle extension checkbox change
|
|
398
|
+
const handleExtensionChange = (ext, checked) => {
|
|
399
|
+
if (checked) {
|
|
400
|
+
onExtensionsChange([...extensions, ext]);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
onExtensionsChange(extensions.filter(e => e !== ext));
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
return (_jsxs(Box, { sx: {
|
|
407
|
+
padding: 3,
|
|
408
|
+
border: '1px solid',
|
|
409
|
+
borderColor: 'border.default',
|
|
410
|
+
borderRadius: 2,
|
|
411
|
+
backgroundColor: 'canvas.subtle',
|
|
412
|
+
}, children: [_jsx(Text, { sx: {
|
|
413
|
+
fontSize: 2,
|
|
414
|
+
fontWeight: 'bold',
|
|
415
|
+
display: 'block',
|
|
416
|
+
marginBottom: 3,
|
|
417
|
+
}, children: "Create a new Agent" }), _jsxs(FormControl, { sx: { marginBottom: 3 }, children: [_jsx(FormControl.Label, { children: "Available Agents" }), _jsxs(Select, { value: selectedAgentId, onChange: e => onAgentSelect(e.target.value), sx: { width: '100%' }, children: [_jsx(Select.Option, { value: "new-agent", children: "+ New Agent..." }), librarySpecs
|
|
418
|
+
.filter(s => s.enabled)
|
|
419
|
+
.map(spec => (_jsxs(Select.Option, { value: `spec:${spec.id}`, children: [spec.emoji ? `${spec.emoji} ` : '', spec.name] }, `spec:${spec.id}`))), agents.map(agent => (_jsxs(Select.Option, { value: agent.id, children: [agent.status === 'running' && '● ', agent.name] }, agent.id)))] }), _jsx(FormControl.Caption, { children: isNewAgentMode
|
|
420
|
+
? selectedSpec
|
|
421
|
+
? `Creating from spec: ${selectedSpec.name} — capabilities are locked`
|
|
422
|
+
: 'Configure a new custom agent'
|
|
423
|
+
: 'Selected agent - form fields below are disabled' })] }), _jsxs(FormControl, { sx: { marginBottom: 3 }, children: [_jsx(FormControl.Label, { children: "Agent Name" }), _jsx(TextInput, { value: agentName, onChange: e => onAgentNameChange(e.target.value), disabled: !isNewAgentMode, placeholder: "demo-agent", sx: { width: '100%' } }), _jsx(FormControl.Caption, { children: "The name of the agent to connect to" })] }), _jsxs(FormControl, { sx: { marginBottom: 3 }, children: [_jsx(FormControl.Label, { children: transport === 'acp' ? 'WebSocket URL' : 'Base URL' }), _jsx(TextInput, { value: transport === 'acp' ? wsUrl : baseUrl, onChange: e => transport === 'acp'
|
|
424
|
+
? onWsUrlChange(e.target.value)
|
|
425
|
+
: onBaseUrlChange(e.target.value), disabled: !isNewAgentMode, placeholder: transport === 'acp'
|
|
426
|
+
? 'ws://localhost:8000/api/v1/acp/ws'
|
|
427
|
+
: 'http://localhost:8000', sx: { width: '100%' } }), _jsx(FormControl.Caption, { children: transport === 'acp'
|
|
428
|
+
? 'The WebSocket endpoint of your agent-runtimes server'
|
|
429
|
+
: 'The base URL of your agent-runtimes server' })] }), _jsxs(Box, { sx: { display: 'flex', gap: 3, marginBottom: 3 }, children: [_jsxs(FormControl, { sx: { flex: 1 }, children: [_jsx(FormControl.Label, { children: "Agent Library" }), _jsx(Select, { value: agentLibrary, onChange: e => onAgentLibraryChange(e.target.value), disabled: !isNewAgentMode, sx: { width: '100%' }, children: AGENT_LIBRARIES.map(lib => (_jsxs(Select.Option, { value: lib.value, disabled: lib.disabled, children: [lib.label, lib.disabled && ' (Coming Soon)'] }, lib.value))) })] }), _jsxs(FormControl, { sx: { flex: 1 }, children: [_jsx(FormControl.Label, { children: "Model" }), _jsx(Select, { value: model, onChange: e => onModelChange(e.target.value), disabled: !isNewAgentMode || models.length === 0, sx: { width: '100%' }, children: models.length === 0 ? (_jsx(Select.Option, { value: "", children: "Loading models..." })) : (models.map(m => (_jsxs(Select.Option, { value: m.id, disabled: !m.isAvailable, children: [m.name, !m.isAvailable && ' (API key required)'] }, m.id)))) })] }), _jsxs(FormControl, { sx: { flex: 1 }, children: [_jsx(FormControl.Label, { children: "Transport" }), _jsx(Select, { value: transport, onChange: e => onTransportChange(e.target.value), disabled: !isNewAgentMode, sx: { width: '100%' }, children: TRANSPORTS.map(t => (_jsx(Select.Option, { value: t.value, children: t.label }, t.value))) })] }), _jsxs(FormControl, { sx: { flex: 1 }, children: [_jsx(FormControl.Label, { children: "Extensions" }), _jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: EXTENSIONS.map(ext => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { value: ext.value, checked: extensions.includes(ext.value), disabled: !isExtensionEnabled(ext.value), onChange: e => handleExtensionChange(ext.value, e.target.checked) }), _jsx(Text, { children: ext.label })] }, ext.value))) })] })] }), _jsxs(Box, { sx: {
|
|
430
|
+
marginBottom: 3,
|
|
431
|
+
padding: 3,
|
|
432
|
+
border: '1px solid',
|
|
433
|
+
borderColor: 'border.default',
|
|
434
|
+
borderRadius: 2,
|
|
435
|
+
backgroundColor: 'canvas.default',
|
|
436
|
+
opacity: isSpecMode ? 0.6 : 1,
|
|
437
|
+
}, children: [_jsxs(Box, { sx: {
|
|
438
|
+
display: 'flex',
|
|
439
|
+
alignItems: 'center',
|
|
440
|
+
gap: 2,
|
|
441
|
+
marginBottom: 2,
|
|
442
|
+
}, children: [_jsx(KeyIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'bold' }, children: "Connected Accounts" })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block', mb: 3 }, children: "Connect your accounts to give the agent access to external services like GitHub repositories, Google services, or Kaggle datasets." }), _jsx(IdentityConnectWithStatus, { identityProviders: identityProviders, disabled: !isNewAgentMode || isSpecMode, onConnect: onIdentityConnect, onDisconnect: onIdentityDisconnect })] }), _jsxs(Box, { sx: {
|
|
443
|
+
marginBottom: 3,
|
|
444
|
+
padding: 3,
|
|
445
|
+
border: '1px solid',
|
|
446
|
+
borderColor: 'border.default',
|
|
447
|
+
borderRadius: 2,
|
|
448
|
+
backgroundColor: 'canvas.default',
|
|
449
|
+
opacity: isSpecMode ? 0.6 : 1,
|
|
450
|
+
}, children: [_jsxs(Text, { sx: { fontSize: 1, fontWeight: 'bold', display: 'block', mb: 2 }, children: ["Agent Capabilities", isSpecMode && (_jsx(Text, { as: "span", sx: {
|
|
451
|
+
fontSize: 0,
|
|
452
|
+
color: 'fg.muted',
|
|
453
|
+
fontWeight: 'normal',
|
|
454
|
+
ml: 2,
|
|
455
|
+
}, children: "\u2014 defined by spec" }))] }), _jsx(Box, { sx: { display: 'flex', gap: 4, opacity: isSpecMode ? 0.6 : 1 }, children: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: enableCodemode, disabled: !isNewAgentMode || isSpecMode, onChange: e => onEnableCodemodeChange?.(e.target.checked) }), _jsxs(Box, { children: [_jsx(Text, { sx: { fontSize: 1 }, children: "Codemode" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block' }, children: "Execute code to compose tools" })] })] }) }), skillsEnabled && enableCodemode && (_jsx(Flash, { variant: "default", sx: { mt: 3 }, children: _jsx(Text, { sx: { fontSize: 0 }, children: "Skills provide curated capabilities; Codemode composes tools with Python for multi-step execution." }) })), enableCodemode && (_jsxs(Box, { sx: { mt: 3, display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: allowDirectToolCalls, disabled: !isNewAgentMode || isSpecMode, onChange: e => onAllowDirectToolCallsChange?.(e.target.checked) }), _jsxs(Box, { children: [_jsx(Text, { sx: { fontSize: 1 }, children: "Allow direct tool calls" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block' }, children: "Expose call_tool for simple, single-tool operations" })] })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: enableToolReranker, disabled: !isNewAgentMode || isSpecMode, onChange: e => onEnableToolRerankerChange?.(e.target.checked) }), _jsxs(Box, { children: [_jsx(Text, { sx: { fontSize: 1 }, children: "Enable tool reranker" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block' }, children: "Reorder search results using the configured reranker" })] })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: useJupyterSandbox, disabled: !isNewAgentMode || isSpecMode, onChange: e => onUseJupyterSandboxChange?.(e.target.checked) }), _jsxs(Box, { children: [_jsx(Text, { sx: { fontSize: 1 }, children: "Use Jupyter Sandbox" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block' }, children: "Execute code in a Jupyter kernel instead of local-eval" })] })] })] }))] }), _jsxs(Box, { sx: {
|
|
456
|
+
marginBottom: 3,
|
|
457
|
+
padding: 3,
|
|
458
|
+
border: '1px solid',
|
|
459
|
+
borderColor: 'border.default',
|
|
460
|
+
borderRadius: 2,
|
|
461
|
+
backgroundColor: 'canvas.default',
|
|
462
|
+
opacity: isSpecMode ? 0.6 : enableCodemode ? 1 : 0.5,
|
|
463
|
+
}, children: [_jsxs(Box, { sx: {
|
|
464
|
+
display: 'flex',
|
|
465
|
+
alignItems: 'center',
|
|
466
|
+
gap: 2,
|
|
467
|
+
marginBottom: 2,
|
|
468
|
+
}, children: [_jsxs(Text, { sx: { fontSize: 1, fontWeight: 'bold' }, children: ["Skills", isSpecMode && (_jsx(Text, { as: "span", sx: {
|
|
469
|
+
fontSize: 0,
|
|
470
|
+
color: 'fg.muted',
|
|
471
|
+
fontWeight: 'normal',
|
|
472
|
+
ml: 2,
|
|
473
|
+
}, children: "\u2014 defined by spec" }))] }), skillsQuery.isLoading && _jsx(Spinner, { size: "small" }), enableCodemode && !skillsQuery.isLoading && (_jsx(Button, { variant: "invisible", size: "small", onClick: () => skillsQuery.refetch(), sx: { padding: 1 }, "aria-label": "Refresh skills", children: _jsx(SyncIcon, { size: 14 }) }))] }), !enableCodemode ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Enable Codemode to use skills." })) : skillsQuery.isError ? (_jsx(Flash, { variant: "warning", sx: { marginBottom: 2 }, children: _jsx(Text, { sx: { fontSize: 0 }, children: "Unable to fetch skills. Check that the server is running." }) })) : displaySkills.length === 0 && !skillsQuery.isLoading ? (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No skills available." })) : (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: displaySkills.map(skill => (_jsxs(Box, { sx: {
|
|
474
|
+
display: 'flex',
|
|
475
|
+
alignItems: 'center',
|
|
476
|
+
gap: 2,
|
|
477
|
+
padding: 2,
|
|
478
|
+
borderRadius: 1,
|
|
479
|
+
backgroundColor: 'canvas.subtle',
|
|
480
|
+
opacity: !isNewAgentMode || isSpecMode ? 0.6 : 1,
|
|
481
|
+
}, children: [_jsx(Checkbox, { checked: selectedSkills.includes(skill.id), disabled: !isNewAgentMode || isSpecMode, onChange: e => handleSkillChange(skill.id, e.target.checked) }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: skill.name }), skill.description && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: skill.description }))] })] }, skill.id))) }))] }), _jsxs(Box, { sx: {
|
|
482
|
+
marginBottom: 3,
|
|
483
|
+
padding: 3,
|
|
484
|
+
border: '1px solid',
|
|
485
|
+
borderColor: 'border.default',
|
|
486
|
+
borderRadius: 2,
|
|
487
|
+
backgroundColor: 'canvas.default',
|
|
488
|
+
}, children: [_jsxs(Box, { sx: {
|
|
489
|
+
display: 'flex',
|
|
490
|
+
alignItems: 'center',
|
|
491
|
+
gap: 2,
|
|
492
|
+
marginBottom: 2,
|
|
493
|
+
}, children: [_jsx(ToolsIcon, { size: 16 }), _jsxs(Text, { sx: { fontSize: 1, fontWeight: 'bold' }, children: ["MCP Config Servers", isSpecMode && (_jsx(Text, { as: "span", sx: {
|
|
494
|
+
fontSize: 0,
|
|
495
|
+
color: 'fg.muted',
|
|
496
|
+
fontWeight: 'normal',
|
|
497
|
+
ml: 2,
|
|
498
|
+
}, children: "\u2014 defined by spec" }))] }), mcpServersQuery.isLoading && _jsx(Spinner, { size: "small" }), !mcpServersQuery.isLoading && (_jsx(Button, { variant: "invisible", size: "small", onClick: () => mcpServersQuery.refetch(), sx: { padding: 1 }, "aria-label": "Refresh MCP config servers", children: _jsx(SyncIcon, { size: 14 }) }))] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', marginBottom: 2 }, children: "Servers from your mcp.json configuration file. Started automatically." }), mcpServersQuery.isError && (_jsx(Flash, { variant: "warning", sx: { marginBottom: 2 }, children: _jsx(Text, { sx: { fontSize: 0 }, children: "Unable to fetch MCP config servers. Check that the server is running." }) })), configServers.length === 0 &&
|
|
499
|
+
!mcpServersQuery.isLoading &&
|
|
500
|
+
!mcpServersQuery.isError && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No MCP config servers found. Add servers to ~/.datalayer/mcp.json" })), enableCodemode && (_jsx(Flash, { variant: "default", sx: { marginBottom: 2 }, children: _jsx(Text, { sx: { fontSize: 0 }, children: "When Codemode is enabled, selected MCP servers are used to build the Codemode tool registry (tools are exposed via Codemode meta tools like search and execute_code)." }) })), enableCodemode && (_jsxs(Box, { sx: {
|
|
501
|
+
marginBottom: 2,
|
|
502
|
+
padding: 2,
|
|
503
|
+
borderRadius: 1,
|
|
504
|
+
border: '1px solid',
|
|
505
|
+
borderColor: 'border.default',
|
|
506
|
+
backgroundColor: 'canvas.subtle',
|
|
507
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'semibold', display: 'block' }, children: "Codemode registry preview" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', mb: 1 }, children: selectedConfigServers.length > 0 ||
|
|
508
|
+
selectedCatalogServers.length > 0
|
|
509
|
+
? 'Using selected MCP servers'
|
|
510
|
+
: 'No servers selected — select servers to scope Codemode tools.' }), previewConfigServers.length > 0 ||
|
|
511
|
+
previewCatalogServers.length > 0 ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [previewConfigServers.map(server => (_jsxs(Text, { sx: { fontSize: 0 }, children: [server.name, " \u2014 ", server.tools.length, " tools (config)"] }, server.id))), previewCatalogServers.map(server => (_jsxs(Text, { sx: { fontSize: 0 }, children: [server.name, " \u2014 ", server.tools?.length || 0, " tools (catalog)"] }, server.id)))] })) : (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No servers selected." })), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', mt: 2 }, children: "Exposed meta-tools: list_tool_names, search_tools, get_tool_details, list_servers, execute_code, call_tool (optional)" })] })), configServers.length > 0 && (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: configServers.map(server => (_jsxs(Box, { sx: {
|
|
512
|
+
display: 'flex',
|
|
513
|
+
alignItems: 'flex-start',
|
|
514
|
+
gap: 2,
|
|
515
|
+
padding: 2,
|
|
516
|
+
borderRadius: 1,
|
|
517
|
+
backgroundColor: 'canvas.subtle',
|
|
518
|
+
opacity: mcpServersDisabled ? 0.6 : 1,
|
|
519
|
+
}, children: [_jsx(Checkbox, { checked: selectedConfigServers.includes(server.id), disabled: mcpServersDisabled, onChange: e => handleConfigServerChange(server.id, e.target.checked) }), _jsxs(Box, { sx: {
|
|
520
|
+
display: 'flex',
|
|
521
|
+
flexDirection: 'column',
|
|
522
|
+
gap: 1,
|
|
523
|
+
flex: 1,
|
|
524
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: server.name }), _jsx(Label, { variant: "success", size: "small", children: "Running" })] }), server.tools.length > 0 && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Tools: ", server.tools.map(t => t.name).join(', ')] }))] })] }, server.id))) }))] }), catalogServers.length > 0 && (_jsxs(Box, { sx: {
|
|
525
|
+
marginBottom: 3,
|
|
526
|
+
padding: 3,
|
|
527
|
+
border: '1px solid',
|
|
528
|
+
borderColor: 'border.default',
|
|
529
|
+
borderRadius: 2,
|
|
530
|
+
backgroundColor: 'canvas.default',
|
|
531
|
+
}, children: [_jsxs(Box, { sx: {
|
|
532
|
+
display: 'flex',
|
|
533
|
+
alignItems: 'center',
|
|
534
|
+
gap: 2,
|
|
535
|
+
marginBottom: 2,
|
|
536
|
+
}, children: [_jsx(ToolsIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'bold' }, children: "MCP Catalog Servers" })] }), _jsx(Text, { sx: {
|
|
537
|
+
fontSize: 0,
|
|
538
|
+
color: 'fg.muted',
|
|
539
|
+
marginBottom: 2,
|
|
540
|
+
}, children: "Predefined servers that can be enabled on-demand. Select to start and add to your agent." }), _jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: catalogServers.map(server => {
|
|
541
|
+
// If required env vars are not provided, treat as available
|
|
542
|
+
const hasRequiredEnvVars = (server.requiredEnvVars?.length || 0) > 0;
|
|
543
|
+
const envVarsAvailable = hasRequiredEnvVars
|
|
544
|
+
? server.isAvailable === true
|
|
545
|
+
: true;
|
|
546
|
+
const isRunning = server.isRunning === true;
|
|
547
|
+
const canSelect = envVarsAvailable || isRunning;
|
|
548
|
+
return (_jsxs(Box, { sx: {
|
|
549
|
+
display: 'flex',
|
|
550
|
+
alignItems: 'flex-start',
|
|
551
|
+
gap: 2,
|
|
552
|
+
padding: 2,
|
|
553
|
+
borderRadius: 1,
|
|
554
|
+
backgroundColor: 'canvas.subtle',
|
|
555
|
+
opacity: mcpServersDisabled || !canSelect ? 0.6 : 1,
|
|
556
|
+
}, children: [_jsx(Checkbox, { checked: selectedCatalogServers.includes(server.id), disabled: mcpServersDisabled ||
|
|
557
|
+
enableCatalogServerMutation.isPending ||
|
|
558
|
+
!canSelect, onChange: e => handleCatalogServerChange(server.id, e.target.checked, isRunning) }), _jsxs(Box, { sx: {
|
|
559
|
+
display: 'flex',
|
|
560
|
+
flexDirection: 'column',
|
|
561
|
+
gap: 1,
|
|
562
|
+
flex: 1,
|
|
563
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: server.name }), enableCatalogServerMutation.isPending &&
|
|
564
|
+
enableCatalogServerMutation.variables === server.id ? (_jsx(Label, { variant: "accent", size: "small", children: "Starting..." })) : server.isRunning ? (_jsx(Label, { variant: "success", size: "small", children: "Running" })) : (_jsx(Label, { variant: "secondary", size: "small", children: "Not Started" })), server.isConfig && (_jsx(Label, { variant: "secondary", size: "small", children: "From Config" }))] }), hasRequiredEnvVars ? (_jsx(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 1 }, children: server.requiredEnvVars?.map(envVar => (_jsx(Label, { variant: envVarsAvailable ? 'success' : 'danger', size: "small", children: envVar }, envVar))) })) : (_jsx(Box, { sx: { display: 'flex' }, children: _jsx(Label, { variant: "success", size: "small", children: "No env vars required" }) })), server.tools && server.tools.length > 0 && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Tools: ", server.tools.map(t => t.name).join(', ')] }))] })] }, server.id));
|
|
565
|
+
}) })] })), createError && (_jsx(Flash, { variant: "danger", sx: { marginBottom: 3 }, children: createError })), _jsxs(Box, { sx: {
|
|
566
|
+
display: 'flex',
|
|
567
|
+
flexDirection: 'column',
|
|
568
|
+
gap: 2,
|
|
569
|
+
marginBottom: 3,
|
|
570
|
+
padding: 3,
|
|
571
|
+
bg: 'canvas.subtle',
|
|
572
|
+
borderRadius: 2,
|
|
573
|
+
border: '1px solid',
|
|
574
|
+
borderColor: 'border.default',
|
|
575
|
+
opacity: 0.6,
|
|
576
|
+
}, children: [_jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold', color: 'fg.muted' }, children: "Coming Soon" }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: false, disabled: true, onChange: () => { } }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Rich Editor" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "\u2014 Enable rich text editing with formatting options" })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Checkbox, { checked: false, disabled: true, onChange: () => { } }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Durable" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "\u2014 Persist agent state across sessions" })] })] }), _jsx(Button, { variant: "primary", onClick: onConnect, disabled: isCreatingAgent ||
|
|
577
|
+
!agentName ||
|
|
578
|
+
(transport === 'acp' ? !wsUrl : !baseUrl), sx: { width: '100%' }, children: isCreatingAgent ? (_jsxs(Box, { sx: {
|
|
579
|
+
display: 'flex',
|
|
580
|
+
alignItems: 'center',
|
|
581
|
+
justifyContent: 'center',
|
|
582
|
+
gap: 2,
|
|
583
|
+
}, children: [_jsx(Spinner, { size: "small" }), _jsx("span", { children: "Creating Agent..." })] })) : isNewAgentMode ? (selectedSpec ? (`Create from "${selectedSpec.name}"`) : ('Create the Agent')) : agents.find(a => a.id === selectedAgentId)?.status === 'running' ? ('Connect to the Agent') : ('Start and Connect to the Agent') })] }));
|
|
584
|
+
};
|
|
585
|
+
export { AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface FooterMetricsProps {
|
|
2
|
+
export interface FooterMetricsProps {
|
|
3
3
|
tokens: number;
|
|
4
4
|
cost: number;
|
|
5
5
|
}
|
|
@@ -9,4 +9,3 @@ interface FooterMetricsProps {
|
|
|
9
9
|
* Displays token usage and cost.
|
|
10
10
|
*/
|
|
11
11
|
export declare const FooterMetrics: React.FC<FooterMetricsProps>;
|
|
12
|
-
export {};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface HeaderProps {
|
|
2
|
+
export interface HeaderProps {
|
|
3
3
|
activeSession: string;
|
|
4
4
|
agentName?: string;
|
|
5
5
|
agentDescription?: string;
|
|
6
6
|
agentStatus?: 'running' | 'paused';
|
|
7
|
-
richEditor: boolean;
|
|
8
|
-
durable: boolean;
|
|
9
7
|
showContextTree: boolean;
|
|
10
8
|
isNewAgent?: boolean;
|
|
11
9
|
isConfigured?: boolean;
|
|
12
10
|
onSessionChange: (sessionId: string) => void;
|
|
13
|
-
onRichEditorChange: (value: boolean) => void;
|
|
14
|
-
onDurableChange: (value: boolean) => void;
|
|
15
11
|
onToggleContextTree: () => void;
|
|
16
12
|
onToggleStatus?: () => void;
|
|
17
13
|
}
|
|
@@ -22,4 +18,3 @@ interface HeaderProps {
|
|
|
22
18
|
* toggle switches, controls, and optional context treemap.
|
|
23
19
|
*/
|
|
24
20
|
export declare const Header: React.FC<HeaderProps>;
|
|
25
|
-
export {};
|