@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
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
// Distributed under the terms of the Modified BSD License.
|
|
4
4
|
/**
|
|
5
5
|
* AgentDetails component - Shows detailed information about the agent
|
|
6
6
|
* including name, protocol, URL, message count, and context details.
|
|
7
7
|
*/
|
|
8
|
-
import { ArrowLeftIcon,
|
|
9
|
-
import {
|
|
8
|
+
import { ArrowLeftIcon, CheckCircleIcon, XCircleIcon, CodeIcon, ZapIcon, DownloadIcon, NoteIcon, ServerIcon, } from '@primer/octicons-react';
|
|
9
|
+
import { Button, Heading, IconButton, Text, Label, Spinner, ToggleSwitch, } from '@primer/react';
|
|
10
|
+
import { Box } from '@datalayer/primer-addons';
|
|
10
11
|
import { AiAgentIcon } from '@datalayer/icons-react';
|
|
11
|
-
import { useQuery } from '@tanstack/react-query';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
13
|
+
import { ContextPanel } from './ContextPanel';
|
|
14
|
+
import { ContextInspector } from './ContextInspector';
|
|
14
15
|
import { AgentIdentity } from './AgentIdentity';
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Get the API base URL for fetching data.
|
|
18
|
+
* If apiBase prop is provided, use it.
|
|
19
|
+
* Otherwise, fall back to localhost for local development.
|
|
20
|
+
*/
|
|
21
|
+
function getApiBase(apiBase) {
|
|
22
|
+
if (apiBase) {
|
|
23
|
+
return apiBase;
|
|
24
|
+
}
|
|
16
25
|
if (typeof window === 'undefined') {
|
|
17
26
|
return '';
|
|
18
27
|
}
|
|
@@ -21,16 +30,155 @@ function getLocalApiBase() {
|
|
|
21
30
|
? 'http://127.0.0.1:8765'
|
|
22
31
|
: '';
|
|
23
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert context snapshot data to CSV format and trigger download
|
|
35
|
+
*/
|
|
36
|
+
async function downloadContextSnapshotAsCSV(agentId, apiBase) {
|
|
37
|
+
const base = getApiBase(apiBase);
|
|
38
|
+
const response = await fetch(`${base}/api/v1/configure/agents/${encodeURIComponent(agentId)}/full-context`);
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error('Failed to fetch context snapshot');
|
|
41
|
+
}
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
const rows = [];
|
|
44
|
+
// Header section
|
|
45
|
+
rows.push(['Context Snapshot for Agent', data.agentId]);
|
|
46
|
+
rows.push(['Generated At', new Date().toISOString()]);
|
|
47
|
+
rows.push([]);
|
|
48
|
+
// Model Configuration
|
|
49
|
+
rows.push(['=== Model Configuration ===']);
|
|
50
|
+
rows.push([
|
|
51
|
+
'Model Name',
|
|
52
|
+
data.modelConfiguration?.modelName || 'Not specified',
|
|
53
|
+
]);
|
|
54
|
+
rows.push([
|
|
55
|
+
'Context Window',
|
|
56
|
+
String(data.modelConfiguration?.contextWindow || 0),
|
|
57
|
+
]);
|
|
58
|
+
rows.push([]);
|
|
59
|
+
// Token Summary
|
|
60
|
+
rows.push(['=== Token Summary ===']);
|
|
61
|
+
rows.push(['Category', 'Tokens']);
|
|
62
|
+
rows.push(['System Prompts', String(data.tokenSummary?.systemPrompts || 0)]);
|
|
63
|
+
rows.push(['Tools', String(data.tokenSummary?.tools || 0)]);
|
|
64
|
+
rows.push(['Memory', String(data.tokenSummary?.memory || 0)]);
|
|
65
|
+
rows.push(['History', String(data.tokenSummary?.history || 0)]);
|
|
66
|
+
rows.push(['Current', String(data.tokenSummary?.current || 0)]);
|
|
67
|
+
rows.push(['Total', String(data.tokenSummary?.total || 0)]);
|
|
68
|
+
rows.push(['Context Window', String(data.tokenSummary?.contextWindow || 0)]);
|
|
69
|
+
rows.push([
|
|
70
|
+
'Usage Percent',
|
|
71
|
+
`${(data.tokenSummary?.usagePercent || 0).toFixed(2)}%`,
|
|
72
|
+
]);
|
|
73
|
+
rows.push([]);
|
|
74
|
+
// System Prompts
|
|
75
|
+
if (data.systemPrompts?.length > 0) {
|
|
76
|
+
rows.push(['=== System Prompts ===']);
|
|
77
|
+
rows.push(['Index', 'Tokens', 'Content']);
|
|
78
|
+
data.systemPrompts.forEach((prompt, idx) => {
|
|
79
|
+
rows.push([
|
|
80
|
+
String(idx + 1),
|
|
81
|
+
String(prompt.tokens),
|
|
82
|
+
prompt.content.replace(/"/g, '""'),
|
|
83
|
+
]);
|
|
84
|
+
});
|
|
85
|
+
rows.push([]);
|
|
86
|
+
}
|
|
87
|
+
// Tools
|
|
88
|
+
if (data.tools?.length > 0) {
|
|
89
|
+
rows.push(['=== Tools ===']);
|
|
90
|
+
rows.push([
|
|
91
|
+
'Name',
|
|
92
|
+
'Description',
|
|
93
|
+
'Source Type',
|
|
94
|
+
'Is Async',
|
|
95
|
+
'Requires Approval',
|
|
96
|
+
'Total Tokens',
|
|
97
|
+
]);
|
|
98
|
+
data.tools.forEach(tool => {
|
|
99
|
+
rows.push([
|
|
100
|
+
tool.name,
|
|
101
|
+
(tool.description || '').replace(/"/g, '""'),
|
|
102
|
+
tool.sourceType,
|
|
103
|
+
String(tool.isAsync),
|
|
104
|
+
String(tool.requiresApproval),
|
|
105
|
+
String(tool.totalTokens),
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
rows.push([]);
|
|
109
|
+
}
|
|
110
|
+
// Messages
|
|
111
|
+
if (data.messages?.length > 0) {
|
|
112
|
+
rows.push(['=== Messages ===']);
|
|
113
|
+
rows.push([
|
|
114
|
+
'Role',
|
|
115
|
+
'In Context',
|
|
116
|
+
'Estimated Tokens',
|
|
117
|
+
'Tool Name',
|
|
118
|
+
'Is Tool Call',
|
|
119
|
+
'Is Tool Result',
|
|
120
|
+
'Timestamp',
|
|
121
|
+
'Content',
|
|
122
|
+
]);
|
|
123
|
+
data.messages.forEach(msg => {
|
|
124
|
+
rows.push([
|
|
125
|
+
msg.role,
|
|
126
|
+
String(msg.inContext),
|
|
127
|
+
String(msg.estimatedTokens),
|
|
128
|
+
msg.toolName || '',
|
|
129
|
+
String(msg.isToolCall),
|
|
130
|
+
String(msg.isToolResult),
|
|
131
|
+
msg.timestamp || '',
|
|
132
|
+
msg.content.replace(/"/g, '""'),
|
|
133
|
+
]);
|
|
134
|
+
});
|
|
135
|
+
rows.push([]);
|
|
136
|
+
}
|
|
137
|
+
// Memory Blocks
|
|
138
|
+
if (data.memoryBlocks?.length > 0) {
|
|
139
|
+
rows.push(['=== Memory Blocks ===']);
|
|
140
|
+
rows.push(['Index', 'Content (JSON)']);
|
|
141
|
+
data.memoryBlocks.forEach((block, idx) => {
|
|
142
|
+
rows.push([String(idx + 1), JSON.stringify(block).replace(/"/g, '""')]);
|
|
143
|
+
});
|
|
144
|
+
rows.push([]);
|
|
145
|
+
}
|
|
146
|
+
// Tool Environment
|
|
147
|
+
if (data.toolEnvironment && Object.keys(data.toolEnvironment).length > 0) {
|
|
148
|
+
rows.push(['=== Tool Environment ===']);
|
|
149
|
+
rows.push(['Key', 'Value']);
|
|
150
|
+
Object.entries(data.toolEnvironment).forEach(([key, value]) => {
|
|
151
|
+
rows.push([key, value]);
|
|
152
|
+
});
|
|
153
|
+
rows.push([]);
|
|
154
|
+
}
|
|
155
|
+
// Convert to CSV string
|
|
156
|
+
const csvContent = rows
|
|
157
|
+
.map(row => row.map(cell => `"${cell}"`).join(','))
|
|
158
|
+
.join('\n');
|
|
159
|
+
// Create and trigger download
|
|
160
|
+
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
161
|
+
const link = document.createElement('a');
|
|
162
|
+
const url = URL.createObjectURL(blob);
|
|
163
|
+
link.setAttribute('href', url);
|
|
164
|
+
link.setAttribute('download', `context-snapshot-${agentId}-${new Date().toISOString().slice(0, 10)}.csv`);
|
|
165
|
+
link.style.visibility = 'hidden';
|
|
166
|
+
document.body.appendChild(link);
|
|
167
|
+
link.click();
|
|
168
|
+
document.body.removeChild(link);
|
|
169
|
+
URL.revokeObjectURL(url);
|
|
170
|
+
}
|
|
24
171
|
/**
|
|
25
172
|
* AgentDetails component displays comprehensive information about the agent.
|
|
26
173
|
*/
|
|
27
|
-
export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, agentId, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, }) {
|
|
174
|
+
export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, }) {
|
|
175
|
+
const queryClient = useQueryClient();
|
|
28
176
|
// Fetch MCP toolsets status
|
|
29
177
|
const { data: mcpStatus, isLoading: mcpLoading } = useQuery({
|
|
30
|
-
queryKey: ['mcp-toolsets-status'],
|
|
178
|
+
queryKey: ['mcp-toolsets-status', apiBase],
|
|
31
179
|
queryFn: async () => {
|
|
32
|
-
const
|
|
33
|
-
const response = await fetch(`${
|
|
180
|
+
const base = getApiBase(apiBase);
|
|
181
|
+
const response = await fetch(`${base}/api/v1/configure/mcp-toolsets-status`);
|
|
34
182
|
if (!response.ok) {
|
|
35
183
|
throw new Error('Failed to fetch MCP status');
|
|
36
184
|
}
|
|
@@ -38,6 +186,53 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
38
186
|
},
|
|
39
187
|
refetchInterval: 5000, // Refresh every 5 seconds
|
|
40
188
|
});
|
|
189
|
+
// Fetch Codemode status
|
|
190
|
+
const { data: codemodeStatus, isLoading: codemodeLoading } = useQuery({
|
|
191
|
+
queryKey: ['codemode-status', apiBase],
|
|
192
|
+
queryFn: async () => {
|
|
193
|
+
const base = getApiBase(apiBase);
|
|
194
|
+
const response = await fetch(`${base}/api/v1/configure/codemode-status`);
|
|
195
|
+
if (!response.ok) {
|
|
196
|
+
throw new Error('Failed to fetch Codemode status');
|
|
197
|
+
}
|
|
198
|
+
return response.json();
|
|
199
|
+
},
|
|
200
|
+
refetchInterval: 5000, // Refresh every 5 seconds
|
|
201
|
+
});
|
|
202
|
+
// Mutation to toggle codemode
|
|
203
|
+
const toggleCodemodeMutation = useMutation({
|
|
204
|
+
mutationFn: async (enabled) => {
|
|
205
|
+
const base = getApiBase(apiBase);
|
|
206
|
+
const response = await fetch(`${base}/api/v1/configure/codemode/toggle`, {
|
|
207
|
+
method: 'POST',
|
|
208
|
+
headers: {
|
|
209
|
+
'Content-Type': 'application/json',
|
|
210
|
+
},
|
|
211
|
+
body: JSON.stringify({ enabled }),
|
|
212
|
+
});
|
|
213
|
+
if (!response.ok) {
|
|
214
|
+
throw new Error('Failed to toggle codemode');
|
|
215
|
+
}
|
|
216
|
+
return response.json();
|
|
217
|
+
},
|
|
218
|
+
onSuccess: () => {
|
|
219
|
+
// Invalidate the codemode status query to refetch
|
|
220
|
+
queryClient.invalidateQueries({ queryKey: ['codemode-status'] });
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
// Fetch agent spec (original creation request with separated system prompts)
|
|
224
|
+
const { data: agentSpec, isLoading: specLoading } = useQuery({
|
|
225
|
+
queryKey: ['agent-spec', agentId, apiBase],
|
|
226
|
+
queryFn: async () => {
|
|
227
|
+
const base = getApiBase(apiBase);
|
|
228
|
+
const response = await fetch(`${base}/api/v1/configure/agents/${encodeURIComponent(agentId)}/spec`);
|
|
229
|
+
if (!response.ok) {
|
|
230
|
+
throw new Error('Failed to fetch agent spec');
|
|
231
|
+
}
|
|
232
|
+
return response.json();
|
|
233
|
+
},
|
|
234
|
+
enabled: !!agentId,
|
|
235
|
+
});
|
|
41
236
|
return (_jsxs(Box, { sx: {
|
|
42
237
|
display: 'flex',
|
|
43
238
|
flexDirection: 'column',
|
|
@@ -64,7 +259,7 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
64
259
|
p: 2,
|
|
65
260
|
bg: 'accent.subtle',
|
|
66
261
|
borderRadius: 2,
|
|
67
|
-
}, children: _jsx(AiAgentIcon, { colored: true, size: 32 }) }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Heading, { as: "h3", sx: { fontSize: 2, fontWeight: 'semibold', mb: 1 }, children: name }),
|
|
262
|
+
}, children: _jsx(AiAgentIcon, { colored: true, size: 32 }) }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Heading, { as: "h3", sx: { fontSize: 2, fontWeight: 'semibold', mb: 1 }, children: name }), agentId && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["ID: ", agentId] }))] })] }), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
68
263
|
fontSize: 1,
|
|
69
264
|
fontWeight: 'semibold',
|
|
70
265
|
mb: 2,
|
|
@@ -75,7 +270,7 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
75
270
|
borderRadius: 2,
|
|
76
271
|
border: '1px solid',
|
|
77
272
|
borderColor: 'border.default',
|
|
78
|
-
}, children: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(
|
|
273
|
+
}, children: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Label, { variant: "accent", size: "small", children: protocol.toUpperCase().replace(/-/g, ' ') }), _jsx(Text, { sx: {
|
|
79
274
|
fontSize: 1,
|
|
80
275
|
fontFamily: 'mono',
|
|
81
276
|
wordBreak: 'break-all',
|
|
@@ -84,21 +279,152 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
84
279
|
fontWeight: 'semibold',
|
|
85
280
|
mb: 2,
|
|
86
281
|
color: 'fg.muted',
|
|
87
|
-
}, children: "
|
|
282
|
+
}, children: "Agent Spec" }), _jsx(Box, { sx: {
|
|
88
283
|
p: 3,
|
|
89
284
|
bg: 'canvas.subtle',
|
|
90
285
|
borderRadius: 2,
|
|
91
286
|
border: '1px solid',
|
|
92
287
|
borderColor: 'border.default',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
288
|
+
}, children: specLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading agent spec..." })] })) : agentSpec ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Model:" }), _jsx(Text, { sx: {
|
|
289
|
+
fontSize: 0,
|
|
290
|
+
fontFamily: 'mono',
|
|
291
|
+
color: 'fg.default',
|
|
292
|
+
}, children: agentSpec.model })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Library:" }), _jsx(Label, { variant: "secondary", size: "small", children: agentSpec.agent_library })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Codemode:" }), _jsx(Label, { variant: agentSpec.enable_codemode ? 'accent' : 'secondary', size: "small", children: agentSpec.enable_codemode ? 'Enabled' : 'Disabled' })] }), agentSpec.enable_skills && agentSpec.skills.length > 0 && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Skills:" }), _jsx(Box, { sx: { display: 'flex', gap: 1, flexWrap: 'wrap' }, children: agentSpec.skills.map(skill => (_jsx(Label, { variant: "secondary", size: "small", children: skill }, skill))) })] }))] }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(NoteIcon, { size: 16 }), _jsx(Text, { sx: {
|
|
293
|
+
fontSize: 0,
|
|
294
|
+
fontWeight: 'semibold',
|
|
295
|
+
color: 'fg.muted',
|
|
296
|
+
}, children: "System Prompt" })] }), _jsx(Box, { sx: {
|
|
297
|
+
p: 2,
|
|
298
|
+
bg: 'canvas.default',
|
|
299
|
+
borderRadius: 2,
|
|
300
|
+
border: '1px solid',
|
|
301
|
+
borderColor: 'border.default',
|
|
302
|
+
maxHeight: 200,
|
|
303
|
+
overflow: 'auto',
|
|
304
|
+
}, children: _jsx(Text, { sx: {
|
|
305
|
+
fontSize: 0,
|
|
306
|
+
fontFamily: 'mono',
|
|
307
|
+
whiteSpace: 'pre-wrap',
|
|
308
|
+
wordBreak: 'break-word',
|
|
309
|
+
color: 'fg.default',
|
|
310
|
+
}, children: agentSpec.system_prompt }) })] }), agentSpec.system_prompt_codemode_addons && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(CodeIcon, { size: 16 }), _jsx(Text, { sx: {
|
|
311
|
+
fontSize: 0,
|
|
312
|
+
fontWeight: 'semibold',
|
|
313
|
+
color: 'fg.muted',
|
|
314
|
+
}, children: "Codemode Addon Prompt" }), agentSpec.enable_codemode ? (_jsx(Label, { variant: "accent", size: "small", children: "Active" })) : (_jsx(Label, { variant: "secondary", size: "small", children: "Inactive" }))] }), _jsx(Box, { sx: {
|
|
315
|
+
p: 2,
|
|
316
|
+
bg: 'canvas.default',
|
|
317
|
+
borderRadius: 2,
|
|
318
|
+
border: '1px solid',
|
|
319
|
+
borderColor: 'border.default',
|
|
320
|
+
maxHeight: 200,
|
|
321
|
+
overflow: 'auto',
|
|
322
|
+
}, children: _jsx(Text, { sx: {
|
|
323
|
+
fontSize: 0,
|
|
324
|
+
fontFamily: 'mono',
|
|
325
|
+
whiteSpace: 'pre-wrap',
|
|
326
|
+
wordBreak: 'break-word',
|
|
327
|
+
color: 'fg.default',
|
|
328
|
+
}, children: agentSpec.system_prompt_codemode_addons }) })] }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "No agent spec available" })) })] }), agentSpec?.sandbox && (_jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
97
329
|
fontSize: 1,
|
|
98
330
|
fontWeight: 'semibold',
|
|
99
331
|
mb: 2,
|
|
100
332
|
color: 'fg.muted',
|
|
101
|
-
}, children: "
|
|
333
|
+
}, children: "Code Sandbox" }), _jsx(Box, { sx: {
|
|
334
|
+
p: 3,
|
|
335
|
+
bg: 'canvas.subtle',
|
|
336
|
+
borderRadius: 2,
|
|
337
|
+
border: '1px solid',
|
|
338
|
+
borderColor: 'border.default',
|
|
339
|
+
}, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ServerIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Variant:" }), _jsx(Label, { variant: agentSpec.sandbox.variant === 'local-jupyter'
|
|
340
|
+
? 'accent'
|
|
341
|
+
: 'secondary', size: "small", children: agentSpec.sandbox.variant })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100, pl: 4 }, children: "Running:" }), agentSpec.sandbox.sandbox_running ? (_jsxs(Box, { sx: {
|
|
342
|
+
display: 'flex',
|
|
343
|
+
alignItems: 'center',
|
|
344
|
+
gap: 1,
|
|
345
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Yes" })] })) : (_jsxs(Box, { sx: {
|
|
346
|
+
display: 'flex',
|
|
347
|
+
alignItems: 'center',
|
|
348
|
+
gap: 1,
|
|
349
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "fg.muted" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No" })] }))] }), agentSpec.sandbox.variant === 'local-jupyter' && (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
350
|
+
fontSize: 0,
|
|
351
|
+
color: 'fg.muted',
|
|
352
|
+
width: 100,
|
|
353
|
+
pl: 4,
|
|
354
|
+
}, children: "Jupyter URL:" }), _jsx(Text, { sx: {
|
|
355
|
+
fontSize: 0,
|
|
356
|
+
fontFamily: 'mono',
|
|
357
|
+
color: 'fg.default',
|
|
358
|
+
overflow: 'hidden',
|
|
359
|
+
textOverflow: 'ellipsis',
|
|
360
|
+
whiteSpace: 'nowrap',
|
|
361
|
+
}, children: agentSpec.jupyter_sandbox ||
|
|
362
|
+
agentSpec.sandbox.jupyter_url ||
|
|
363
|
+
'Not configured' })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
364
|
+
fontSize: 0,
|
|
365
|
+
color: 'fg.muted',
|
|
366
|
+
width: 100,
|
|
367
|
+
pl: 4,
|
|
368
|
+
}, children: "Connection:" }), agentSpec.sandbox.jupyter_connected ? (_jsxs(Box, { sx: {
|
|
369
|
+
display: 'flex',
|
|
370
|
+
alignItems: 'center',
|
|
371
|
+
gap: 1,
|
|
372
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Connected" })] })) : (_jsxs(Box, { sx: {
|
|
373
|
+
display: 'flex',
|
|
374
|
+
flexDirection: 'column',
|
|
375
|
+
gap: 1,
|
|
376
|
+
}, children: [_jsxs(Box, { sx: {
|
|
377
|
+
display: 'flex',
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
gap: 1,
|
|
380
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "danger.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'danger.fg' }, children: "Not Connected" })] }), agentSpec.sandbox.jupyter_error && (_jsx(Text, { sx: {
|
|
381
|
+
fontSize: 0,
|
|
382
|
+
color: 'danger.fg',
|
|
383
|
+
fontFamily: 'mono',
|
|
384
|
+
whiteSpace: 'pre-wrap',
|
|
385
|
+
wordBreak: 'break-word',
|
|
386
|
+
}, children: agentSpec.sandbox.jupyter_error }))] }))] })] })), agentSpec.sandbox.generated_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
387
|
+
fontSize: 0,
|
|
388
|
+
color: 'fg.muted',
|
|
389
|
+
width: 100,
|
|
390
|
+
pl: 4,
|
|
391
|
+
}, children: "Generated:" }), _jsx(Text, { sx: {
|
|
392
|
+
fontSize: 0,
|
|
393
|
+
fontFamily: 'mono',
|
|
394
|
+
color: 'fg.default',
|
|
395
|
+
overflow: 'hidden',
|
|
396
|
+
textOverflow: 'ellipsis',
|
|
397
|
+
whiteSpace: 'nowrap',
|
|
398
|
+
}, title: agentSpec.sandbox.generated_path, children: agentSpec.sandbox.generated_path })] })), agentSpec.sandbox.skills_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
399
|
+
fontSize: 0,
|
|
400
|
+
color: 'fg.muted',
|
|
401
|
+
width: 100,
|
|
402
|
+
pl: 4,
|
|
403
|
+
}, children: "Skills:" }), _jsx(Text, { sx: {
|
|
404
|
+
fontSize: 0,
|
|
405
|
+
fontFamily: 'mono',
|
|
406
|
+
color: 'fg.default',
|
|
407
|
+
overflow: 'hidden',
|
|
408
|
+
textOverflow: 'ellipsis',
|
|
409
|
+
whiteSpace: 'nowrap',
|
|
410
|
+
}, title: agentSpec.sandbox.skills_path, children: agentSpec.sandbox.skills_path })] })), agentSpec.sandbox.python_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
411
|
+
fontSize: 0,
|
|
412
|
+
color: 'fg.muted',
|
|
413
|
+
width: 100,
|
|
414
|
+
pl: 4,
|
|
415
|
+
}, children: "Python:" }), _jsx(Text, { sx: {
|
|
416
|
+
fontSize: 0,
|
|
417
|
+
fontFamily: 'mono',
|
|
418
|
+
color: 'fg.default',
|
|
419
|
+
overflow: 'hidden',
|
|
420
|
+
textOverflow: 'ellipsis',
|
|
421
|
+
whiteSpace: 'nowrap',
|
|
422
|
+
}, title: agentSpec.sandbox.python_path, children: agentSpec.sandbox.python_path })] }))] }) })] })), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
423
|
+
fontSize: 1,
|
|
424
|
+
fontWeight: 'semibold',
|
|
425
|
+
mb: 2,
|
|
426
|
+
color: 'fg.muted',
|
|
427
|
+
}, children: "Config MCP Servers" }), _jsx(Box, { sx: {
|
|
102
428
|
p: 3,
|
|
103
429
|
bg: 'canvas.subtle',
|
|
104
430
|
borderRadius: 2,
|
|
@@ -133,17 +459,141 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
133
459
|
pl: 4,
|
|
134
460
|
whiteSpace: 'pre-wrap',
|
|
135
461
|
wordBreak: 'break-word',
|
|
136
|
-
}, children: error.split('\n')[0] })] }, server)))] }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load MCP status" })) })] }),
|
|
462
|
+
}, children: error.split('\n')[0] })] }, server)))] }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load MCP status" })) })] }), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
137
463
|
fontSize: 1,
|
|
138
464
|
fontWeight: 'semibold',
|
|
139
465
|
mb: 2,
|
|
140
466
|
color: 'fg.muted',
|
|
141
|
-
}, children: "
|
|
467
|
+
}, children: "Codemode" }), _jsx(Box, { sx: {
|
|
468
|
+
p: 3,
|
|
469
|
+
bg: 'canvas.subtle',
|
|
470
|
+
borderRadius: 2,
|
|
471
|
+
border: '1px solid',
|
|
472
|
+
borderColor: 'border.default',
|
|
473
|
+
}, children: codemodeLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading Codemode status..." })] })) : codemodeStatus ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsxs(Box, { sx: {
|
|
474
|
+
display: 'flex',
|
|
475
|
+
alignItems: 'center',
|
|
476
|
+
justifyContent: 'space-between',
|
|
477
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(CodeIcon, { size: 16 }), _jsxs(Box, { children: [_jsx(Text, { id: "codemode-toggle-label", sx: { fontSize: 1, fontWeight: 'semibold' }, children: "Codemode" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', marginLeft: 1 }, children: "MCP servers become programmatic tools" })] })] }), _jsx(ToggleSwitch, { "aria-labelledby": "codemode-toggle-label", checked: codemodeStatus.enabled, onClick: () => toggleCodemodeMutation.mutate(!codemodeStatus.enabled), disabled: toggleCodemodeMutation.isPending, size: "small" })] }), codemodeStatus.sandbox && (_jsxs(Box, { sx: {
|
|
478
|
+
display: 'flex',
|
|
479
|
+
flexDirection: 'column',
|
|
480
|
+
gap: 2,
|
|
481
|
+
p: 2,
|
|
482
|
+
bg: 'canvas.default',
|
|
483
|
+
borderRadius: 2,
|
|
484
|
+
border: '1px solid',
|
|
485
|
+
borderColor: 'border.default',
|
|
486
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(CodeIcon, { size: 16 }), _jsx(Text, { sx: {
|
|
487
|
+
fontSize: 0,
|
|
488
|
+
fontWeight: 'semibold',
|
|
489
|
+
color: 'fg.muted',
|
|
490
|
+
}, children: "Code Sandbox" })] }), _jsxs(Box, { sx: {
|
|
491
|
+
display: 'flex',
|
|
492
|
+
flexDirection: 'column',
|
|
493
|
+
gap: 1,
|
|
494
|
+
pl: 4,
|
|
495
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Variant:" }), _jsx(Label, { variant: codemodeStatus.sandbox.variant === 'local-jupyter'
|
|
496
|
+
? 'accent'
|
|
497
|
+
: 'secondary', size: "small", children: codemodeStatus.sandbox.variant })] }), codemodeStatus.sandbox.variant === 'local-jupyter' && (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: {
|
|
498
|
+
display: 'flex',
|
|
499
|
+
alignItems: 'center',
|
|
500
|
+
gap: 2,
|
|
501
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "URL:" }), _jsx(Text, { sx: {
|
|
502
|
+
fontSize: 0,
|
|
503
|
+
fontFamily: 'mono',
|
|
504
|
+
color: 'fg.default',
|
|
505
|
+
overflow: 'hidden',
|
|
506
|
+
textOverflow: 'ellipsis',
|
|
507
|
+
whiteSpace: 'nowrap',
|
|
508
|
+
}, children: codemodeStatus.sandbox.jupyter_url ||
|
|
509
|
+
'Not configured' })] }), _jsxs(Box, { sx: {
|
|
510
|
+
display: 'flex',
|
|
511
|
+
alignItems: 'center',
|
|
512
|
+
gap: 2,
|
|
513
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Status:" }), codemodeStatus.sandbox.jupyter_connected ? (_jsxs(Box, { sx: {
|
|
514
|
+
display: 'flex',
|
|
515
|
+
alignItems: 'center',
|
|
516
|
+
gap: 1,
|
|
517
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Connected" })] })) : (_jsxs(Box, { sx: {
|
|
518
|
+
display: 'flex',
|
|
519
|
+
flexDirection: 'column',
|
|
520
|
+
gap: 1,
|
|
521
|
+
}, children: [_jsxs(Box, { sx: {
|
|
522
|
+
display: 'flex',
|
|
523
|
+
alignItems: 'center',
|
|
524
|
+
gap: 1,
|
|
525
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "danger.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'danger.fg' }, children: "Not Connected" })] }), codemodeStatus.sandbox.jupyter_error && (_jsx(Text, { sx: {
|
|
526
|
+
fontSize: 0,
|
|
527
|
+
color: 'danger.fg',
|
|
528
|
+
fontFamily: 'mono',
|
|
529
|
+
whiteSpace: 'pre-wrap',
|
|
530
|
+
wordBreak: 'break-word',
|
|
531
|
+
}, children: codemodeStatus.sandbox.jupyter_error }))] }))] })] })), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Running:" }), codemodeStatus.sandbox.sandbox_running ? (_jsxs(Box, { sx: {
|
|
532
|
+
display: 'flex',
|
|
533
|
+
alignItems: 'center',
|
|
534
|
+
gap: 1,
|
|
535
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Yes" })] })) : (_jsxs(Box, { sx: {
|
|
536
|
+
display: 'flex',
|
|
537
|
+
alignItems: 'center',
|
|
538
|
+
gap: 1,
|
|
539
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "fg.muted" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No" })] }))] }), codemodeStatus.sandbox.generated_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Generated:" }), _jsx(Text, { sx: {
|
|
540
|
+
fontSize: 0,
|
|
541
|
+
fontFamily: 'mono',
|
|
542
|
+
color: 'fg.default',
|
|
543
|
+
overflow: 'hidden',
|
|
544
|
+
textOverflow: 'ellipsis',
|
|
545
|
+
whiteSpace: 'nowrap',
|
|
546
|
+
}, title: codemodeStatus.sandbox.generated_path, children: codemodeStatus.sandbox.generated_path })] })), codemodeStatus.sandbox.skills_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Skills:" }), _jsx(Text, { sx: {
|
|
547
|
+
fontSize: 0,
|
|
548
|
+
fontFamily: 'mono',
|
|
549
|
+
color: 'fg.default',
|
|
550
|
+
overflow: 'hidden',
|
|
551
|
+
textOverflow: 'ellipsis',
|
|
552
|
+
whiteSpace: 'nowrap',
|
|
553
|
+
}, title: codemodeStatus.sandbox.skills_path, children: codemodeStatus.sandbox.skills_path })] })), codemodeStatus.sandbox.python_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Python Path:" }), _jsx(Text, { sx: {
|
|
554
|
+
fontSize: 0,
|
|
555
|
+
fontFamily: 'mono',
|
|
556
|
+
color: 'fg.default',
|
|
557
|
+
overflow: 'hidden',
|
|
558
|
+
textOverflow: 'ellipsis',
|
|
559
|
+
whiteSpace: 'nowrap',
|
|
560
|
+
}, title: codemodeStatus.sandbox.python_path, children: codemodeStatus.sandbox.python_path })] }))] })] })), codemodeStatus.skills.length > 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ZapIcon, { size: 16 }), _jsxs(Text, { sx: {
|
|
561
|
+
fontSize: 0,
|
|
562
|
+
fontWeight: 'semibold',
|
|
563
|
+
color: 'fg.muted',
|
|
564
|
+
}, children: ["Active Skills (", codemodeStatus.skills.length, ")"] })] }), codemodeStatus.skills.map(skill => (_jsxs(Box, { sx: {
|
|
565
|
+
display: 'flex',
|
|
566
|
+
flexDirection: 'column',
|
|
567
|
+
gap: 1,
|
|
568
|
+
pl: 4,
|
|
569
|
+
py: 1,
|
|
570
|
+
borderLeft: '2px solid',
|
|
571
|
+
borderColor: 'accent.emphasis',
|
|
572
|
+
}, children: [_jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: skill.name }), skill.description && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: skill.description })), skill.tags && skill.tags.length > 0 && (_jsx(Box, { sx: { display: 'flex', gap: 1, flexWrap: 'wrap' }, children: skill.tags.map(tag => (_jsx(Label, { variant: "secondary", size: "small", children: tag }, tag))) }))] }, skill.name)))] })), codemodeStatus.available_skills.length > 0 &&
|
|
573
|
+
codemodeStatus.skills.length === 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Text, { sx: {
|
|
574
|
+
fontSize: 0,
|
|
575
|
+
fontWeight: 'semibold',
|
|
576
|
+
color: 'fg.muted',
|
|
577
|
+
}, children: ["Available Skills (", codemodeStatus.available_skills.length, ")"] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Enable skills via CLI with --skills flag" }), _jsx(Box, { sx: {
|
|
578
|
+
display: 'flex',
|
|
579
|
+
gap: 1,
|
|
580
|
+
flexWrap: 'wrap',
|
|
581
|
+
mt: 1,
|
|
582
|
+
}, children: codemodeStatus.available_skills.map(skill => (_jsx(Label, { variant: "secondary", size: "small", children: skill.name }, skill.name))) })] })), codemodeStatus.available_skills.length === 0 && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No skills available. Add skills to the skills/ directory." }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load Codemode status" })) })] }), agentId && (_jsx(ContextPanel, { agentId: agentId, apiBase: apiBase, messageCount: messageCount, chartHeight: "200px" })), agentId && (_jsxs(Box, { sx: { mt: 3 }, children: [_jsxs(Box, { sx: {
|
|
583
|
+
display: 'flex',
|
|
584
|
+
alignItems: 'center',
|
|
585
|
+
justifyContent: 'space-between',
|
|
586
|
+
mb: 2,
|
|
587
|
+
}, children: [_jsx(Heading, { as: "h4", sx: {
|
|
588
|
+
fontSize: 1,
|
|
589
|
+
fontWeight: 'semibold',
|
|
590
|
+
color: 'fg.muted',
|
|
591
|
+
}, children: "Context Snapshot" }), _jsx(Button, { size: "small", variant: "invisible", leadingVisual: DownloadIcon, onClick: () => downloadContextSnapshotAsCSV(agentId, apiBase), children: "Download" })] }), _jsx(Box, { sx: {
|
|
142
592
|
p: 3,
|
|
143
593
|
bg: 'canvas.subtle',
|
|
144
594
|
borderRadius: 2,
|
|
145
595
|
border: '1px solid',
|
|
146
596
|
borderColor: 'border.default',
|
|
147
|
-
}, children: _jsx(
|
|
597
|
+
}, children: _jsx(ContextInspector, { agentId: agentId, apiBase: apiBase }) })] })), _jsx(AgentIdentity, { providers: identityProviders, title: "Connected Accounts", showHeader: true, showDescription: true, description: "OAuth identities connected to this agent. Agents can use these to access external services like GitHub repositories on your behalf.", showExpirationDetails: true, allowReconnect: Boolean(identityProviders), onConnect: onIdentityConnect, onDisconnect: onIdentityDisconnect }), _jsx(Box, { sx: { mt: 2 }, children: _jsx(Button, { variant: "primary", onClick: onBack, sx: { width: '100%' }, children: "Back to Chat" }) })] })] }));
|
|
148
598
|
}
|
|
149
599
|
export default AgentDetails;
|