@datalayer/agent-runtimes 1.0.19 → 1.0.21
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 +11 -3
- package/lib/AgentNode.js +141 -40
- package/lib/App.js +2 -2
- package/lib/agent-node/AgentNodeGallery.js +188 -25
- package/lib/api/runtimes/runtimes.d.ts +57 -0
- package/lib/api/runtimes/runtimes.js +55 -1
- package/lib/chat/Chat.d.ts +1 -1
- package/lib/chat/Chat.js +2 -2
- package/lib/chat/base/ChatBase.js +50 -13
- package/lib/chat/document/EphemeralDocument.d.ts +5 -1
- package/lib/chat/document/EphemeralDocument.js +7 -5
- package/lib/chat/header/ChatHeaderBase.d.ts +3 -1
- package/lib/chat/header/ChatHeaderBase.js +5 -3
- package/lib/chat/messages/ChatMessageList.d.ts +19 -0
- package/lib/chat/messages/ChatMessageList.js +180 -9
- package/lib/chat/notebook/EphemeralNotebook.d.ts +5 -1
- package/lib/chat/notebook/EphemeralNotebook.js +9 -6
- package/lib/chat/prompt/InputPrompt.js +1 -1
- package/lib/chat/tools/SubagentActivity.d.ts +20 -0
- package/lib/chat/tools/SubagentActivity.js +154 -0
- package/lib/chat/tools/index.d.ts +1 -0
- package/lib/chat/tools/index.js +1 -0
- package/lib/chat/usage/TokenUsageBar.js +3 -3
- package/lib/client/AgentRuntimesClient.d.ts +5 -0
- package/lib/client/AgentsMixin.js +3 -1
- package/lib/client/mixins/RuntimesMixin.d.ts +12 -0
- package/lib/client/mixins/RuntimesMixin.js +24 -1
- package/lib/components/AgentSummary.d.ts +1 -0
- package/lib/components/AgentSummary.js +66 -10
- package/lib/components/runtimes/RuntimePickerBase.js +64 -29
- package/lib/components/runtimes/RuntimePickerCell.js +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
- package/lib/components/runtimes/RuntimeSimplePicker.js +3 -2
- package/lib/components/runtimes/RuntimeUtils.js +2 -2
- package/lib/context/GraphFlowChart.js +1 -1
- package/lib/context/TokenUsageChart.js +1 -1
- package/lib/context/TurnGraphChart.js +2 -2
- package/lib/examples/A2UiAgentExample.js +4 -4
- package/lib/examples/A2UiComponentsGalleryExample.js +3 -3
- package/lib/examples/A2UiContactCardExample.js +3 -3
- package/lib/examples/A2UiRestaurantExample.js +2 -2
- package/lib/examples/A2UiViewerExample.js +3 -3
- package/lib/examples/AgUiAgenticExample.js +3 -3
- package/lib/examples/AgUiBackendToolRenderingExample.js +2 -2
- package/lib/examples/AgUiHaikuGenUiExample.js +3 -3
- package/lib/examples/AgUiHumanInTheLoopExample.js +5 -5
- package/lib/examples/AgUiSharedStateExample.js +3 -3
- package/lib/examples/AgUiToolsBasedGenUiExample.js +7 -5
- package/lib/examples/AgentCheckpointsExample.js +6 -5
- package/lib/examples/{AgentSandboxExample.d.ts → AgentCodeSandboxExample.d.ts} +4 -4
- package/lib/examples/{AgentSandboxExample.js → AgentCodeSandboxExample.js} +10 -9
- package/lib/examples/AgentCodeSandboxesExample.js +2 -2
- package/lib/examples/AgentCodemodeExample.js +3 -3
- package/lib/examples/AgentCompactionExample.d.ts +12 -0
- package/lib/examples/AgentCompactionExample.js +244 -0
- package/lib/examples/AgentEvalsExample.js +10 -20
- package/lib/examples/AgentGuardrailsExample.js +2 -2
- package/lib/examples/AgentHooksExample.js +1 -1
- package/lib/examples/AgentInferenceProviderExample.js +6 -8
- package/lib/examples/AgentLoopExample.js +3 -3
- package/lib/examples/AgentMCPExample.js +3 -3
- package/lib/examples/AgentMemoryExample.d.ts +4 -2
- package/lib/examples/AgentMemoryExample.js +93 -10
- package/lib/examples/AgentMonitoringExample.js +2 -2
- package/lib/examples/AgentNotificationsExample.js +1 -1
- package/lib/examples/AgentOtelExample.d.ts +2 -3
- package/lib/examples/AgentOtelExample.js +7 -12
- package/lib/examples/AgentOutputsExample.js +5 -5
- package/lib/examples/AgentParametersExample.js +3 -3
- package/lib/examples/AgentSkillsExample.js +4 -4
- package/lib/examples/AgentSubagentsExample.d.ts +2 -2
- package/lib/examples/AgentSubagentsExample.js +43 -34
- package/lib/examples/AgentToolApprovalsExample.js +1 -1
- package/lib/examples/AgentTriggersExample.js +9 -11
- package/lib/examples/AgentspecsExample.js +13 -5
- package/lib/examples/CellExample.d.ts +6 -0
- package/lib/examples/CellExample.js +84 -0
- package/lib/examples/ChatCustomExample.js +1 -1
- package/lib/examples/ChatExample.js +1 -1
- package/lib/examples/ChatStandaloneExample.js +2 -2
- package/lib/examples/HomeExample.js +29 -28
- package/lib/examples/Lexical2Example.js +2 -2
- package/lib/examples/LexicalAgentExample.js +1 -1
- package/lib/examples/LexicalAgentSidebarExample.js +2 -2
- package/lib/examples/NotebookAgentSidebarExample.d.ts +1 -1
- package/lib/examples/NotebookAgentSidebarExample.js +5 -4
- package/lib/examples/NotebookCollaborationExample.js +3 -3
- package/lib/examples/NotebookExample.js +2 -2
- package/lib/examples/components/ExampleWrapper.js +5 -0
- package/lib/examples/components/Header.js +2 -2
- package/lib/examples/components/HeaderControls.js +1 -1
- package/lib/examples/components/LexicalEditor.js +1 -1
- package/lib/examples/components/MainContent.js +1 -1
- package/lib/examples/components/MockFileBrowser.js +8 -8
- package/lib/examples/components/TimeTravel.js +1 -1
- package/lib/examples/components/haiku/HaikuDisplay.js +2 -2
- package/lib/examples/example-selector.js +4 -3
- package/lib/examples/hooks/useExampleAgentRuntime.js +11 -1
- package/lib/examples/hooks/useExampleAgentRuntimes.d.ts +7 -0
- package/lib/examples/hooks/useExampleAgentRuntimes.js +82 -0
- package/lib/examples/index.d.ts +2 -1
- package/lib/examples/index.js +2 -1
- package/lib/examples/main.js +359 -46
- package/lib/examples/utils/agentSummaryStore.d.ts +17 -0
- package/lib/examples/utils/themedProvider.js +32 -2
- package/lib/examples/utils/useExampleAgentRuntimesUrl.js +2 -1
- package/lib/examples2/NotebookMutationsKernel.js +6 -3
- package/lib/examples2/NotebookMutationsServiceManager.js +6 -3
- package/lib/examples2/ReactRouterExample.js +5 -5
- package/lib/examples2/main.js +38 -0
- package/lib/hooks/useAIAgentsWebSocket.js +35 -0
- package/lib/hooks/useAgentRuntimes.d.ts +22 -0
- package/lib/hooks/useAgentRuntimes.js +192 -5
- package/lib/hooks/useCheckpoints.js +2 -2
- package/lib/hooks/useToolApprovals.d.ts +10 -4
- package/lib/hooks/useToolApprovals.js +11 -5
- package/lib/models/Runtime.d.ts +10 -8
- package/lib/models/RuntimeDTO.d.ts +5 -3
- package/lib/models/RuntimeDTO.js +3 -3
- package/lib/runtimes/actions.js +3 -1
- package/lib/runtimes/apis.d.ts +7 -0
- package/lib/specs/agents/agents.d.ts +51 -0
- package/lib/specs/agents/agents.js +3389 -94
- package/lib/specs/models.d.ts +2 -0
- package/lib/specs/models.js +37 -0
- package/lib/stores/agentRuntimeStore.d.ts +32 -1
- package/lib/stores/agentRuntimeStore.js +65 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -1
- package/lib/types/agents.d.ts +9 -3
- package/lib/types/agentspecs.d.ts +2 -0
- package/lib/types/chat.d.ts +12 -0
- package/lib/types/models.d.ts +5 -0
- package/lib/types/stream.d.ts +58 -1
- package/package.json +4 -4
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +7 -0
- package/scripts/codegen/generate_models.py +22 -9
- package/scripts/gen_workers.py +340 -0
- package/lib/examples/CellSimpleExample.d.ts +0 -6
- package/lib/examples/CellSimpleExample.js +0 -20
|
@@ -53,7 +53,7 @@ export function TokenUsageBar({ agentUsage, padding }) {
|
|
|
53
53
|
const colorMap = {
|
|
54
54
|
'System Prompts': '#8250df',
|
|
55
55
|
'Tool Definitions': '#bf8700',
|
|
56
|
-
'User Messages': '#
|
|
56
|
+
'User Messages': '#16A085',
|
|
57
57
|
'Assistant Messages': '#1a7f37',
|
|
58
58
|
'Tool Usage': '#cf222e',
|
|
59
59
|
};
|
|
@@ -86,7 +86,7 @@ export function TokenUsageBar({ agentUsage, padding }) {
|
|
|
86
86
|
categories.push({
|
|
87
87
|
name: 'Messages',
|
|
88
88
|
value: messageTokens,
|
|
89
|
-
color: '#
|
|
89
|
+
color: '#16A085',
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
const toolResultTokens = (agentUsage.toolCallTokens || 0) + (agentUsage.toolReturnTokens || 0);
|
|
@@ -99,7 +99,7 @@ export function TokenUsageBar({ agentUsage, padding }) {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
// Tiny filled pie chart options
|
|
102
|
-
const pieColor = pct > 90 ? '#cf222e' : pct > 70 ? '#bf8700' : '#
|
|
102
|
+
const pieColor = pct > 90 ? '#cf222e' : pct > 70 ? '#bf8700' : '#16A085';
|
|
103
103
|
const freeSliceColor = 'var(--bgColor-muted, #f6f8fa)';
|
|
104
104
|
const freeSliceOverlayColor = 'var(--borderColor-default, #d1d9e0)';
|
|
105
105
|
const miniPieOption = {
|
|
@@ -13,6 +13,7 @@ import type { SpaceDTO, UpdateSpaceRequest } from '../models/SpaceDTO';
|
|
|
13
13
|
import type { NotebookDTO } from '../models/NotebookDTO';
|
|
14
14
|
import type { LexicalDTO } from '../models/LexicalDTO';
|
|
15
15
|
import type { ProjectDTO, ProjectDefaultItems } from '../models/ProjectDTO';
|
|
16
|
+
import type { RuntimeMemory, ListRuntimeMemoriesOptions } from '../api/runtimes/runtimes';
|
|
16
17
|
declare const AgentRuntimesClientWithMixins: {
|
|
17
18
|
new (...args: any[]): {
|
|
18
19
|
getMySpaces(): Promise<SpaceDTO[]>;
|
|
@@ -54,6 +55,8 @@ declare const AgentRuntimesClientWithMixins: {
|
|
|
54
55
|
listRuntimes(): Promise<RuntimeDTO[]>;
|
|
55
56
|
getRuntime(podName: string): Promise<RuntimeDTO>;
|
|
56
57
|
deleteRuntime(podName: string): Promise<void>;
|
|
58
|
+
listRuntimeMemories(options?: ListRuntimeMemoriesOptions): Promise<RuntimeMemory[]>;
|
|
59
|
+
getRuntimeMemory(memoryId: string): Promise<RuntimeMemory>;
|
|
57
60
|
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
|
|
58
61
|
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<CodeSandboxSnapshotDTO>;
|
|
59
62
|
listSnapshots(): Promise<CodeSandboxSnapshotDTO[]>;
|
|
@@ -86,6 +89,8 @@ export interface AgentRuntimesClient extends DatalayerCoreClient {
|
|
|
86
89
|
ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<RuntimeDTO>;
|
|
87
90
|
createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
|
|
88
91
|
listRuntimes(): Promise<RuntimeDTO[]>;
|
|
92
|
+
listRuntimeMemories(options?: ListRuntimeMemoriesOptions): Promise<RuntimeMemory[]>;
|
|
93
|
+
getRuntimeMemory(memoryId: string): Promise<RuntimeMemory>;
|
|
89
94
|
getRuntime(podName: string): Promise<RuntimeDTO>;
|
|
90
95
|
deleteRuntime(podName: string): Promise<void>;
|
|
91
96
|
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
|
|
@@ -339,7 +339,9 @@ export function AgentsMixin(Base) {
|
|
|
339
339
|
method: 'POST',
|
|
340
340
|
token,
|
|
341
341
|
body: {
|
|
342
|
-
|
|
342
|
+
environment: {
|
|
343
|
+
name: data.environmentName || 'ai-agents-env',
|
|
344
|
+
},
|
|
343
345
|
given_name: data.givenName || 'Agent',
|
|
344
346
|
credits_limit: data.creditsLimit || 10,
|
|
345
347
|
type: data.type || 'notebook',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RuntimeMemory, ListRuntimeMemoriesOptions } from '../../api/runtimes/runtimes';
|
|
1
2
|
import type { Constructor } from '@datalayer/core/lib/client/utils/mixins';
|
|
2
3
|
import { EnvironmentDTO } from '../../models/EnvironmentDTO';
|
|
3
4
|
import { RuntimeDTO } from '../../models/RuntimeDTO';
|
|
@@ -53,6 +54,17 @@ export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
53
54
|
* @param podName - Runtime pod name
|
|
54
55
|
*/
|
|
55
56
|
deleteRuntime(podName: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* List persisted memories for the authenticated caller.
|
|
59
|
+
*
|
|
60
|
+
* Backend scoping rules apply: non-admin callers are limited to their own
|
|
61
|
+
* personal account.
|
|
62
|
+
*/
|
|
63
|
+
listRuntimeMemories(options?: ListRuntimeMemoriesOptions): Promise<RuntimeMemory[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Fetch one persisted memory by id.
|
|
66
|
+
*/
|
|
67
|
+
getRuntimeMemory(memoryId: string): Promise<RuntimeMemory>;
|
|
56
68
|
/**
|
|
57
69
|
* Terminate all runtimes.
|
|
58
70
|
* Lists all runtimes and deletes them in parallel.
|
|
@@ -69,7 +69,9 @@ export function RuntimesMixin(Base) {
|
|
|
69
69
|
const runtimesUrl = this.getRuntimesUrl();
|
|
70
70
|
const creditsLimit = this.calculateCreditsFromMinutes(minutesLimit, env.burningRate);
|
|
71
71
|
const data = {
|
|
72
|
-
|
|
72
|
+
environment: {
|
|
73
|
+
name: environmentName,
|
|
74
|
+
},
|
|
73
75
|
type,
|
|
74
76
|
given_name: givenName,
|
|
75
77
|
credits_limit: creditsLimit,
|
|
@@ -113,6 +115,27 @@ export function RuntimesMixin(Base) {
|
|
|
113
115
|
const runtimesUrl = this.getRuntimesUrl();
|
|
114
116
|
await runtimes.deleteRuntime(token, podName, runtimesUrl);
|
|
115
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* List persisted memories for the authenticated caller.
|
|
120
|
+
*
|
|
121
|
+
* Backend scoping rules apply: non-admin callers are limited to their own
|
|
122
|
+
* personal account.
|
|
123
|
+
*/
|
|
124
|
+
async listRuntimeMemories(options = {}) {
|
|
125
|
+
const token = this.getToken();
|
|
126
|
+
const runtimesUrl = this.getRuntimesUrl();
|
|
127
|
+
const response = await runtimes.listRuntimeMemories(token, options, runtimesUrl);
|
|
128
|
+
return response.memories;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Fetch one persisted memory by id.
|
|
132
|
+
*/
|
|
133
|
+
async getRuntimeMemory(memoryId) {
|
|
134
|
+
const token = this.getToken();
|
|
135
|
+
const runtimesUrl = this.getRuntimesUrl();
|
|
136
|
+
const response = await runtimes.getRuntimeMemory(token, memoryId, runtimesUrl);
|
|
137
|
+
return response.memory;
|
|
138
|
+
}
|
|
116
139
|
/**
|
|
117
140
|
* Terminate all runtimes.
|
|
118
141
|
* Lists all runtimes and deletes them in parallel.
|
|
@@ -3,9 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { useState } from 'react';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { Spinner } from '@primer/react';
|
|
8
8
|
import { Box } from '@datalayer/primer-addons';
|
|
9
|
+
import { strip } from '@datalayer/core/lib/utils';
|
|
9
10
|
/**
|
|
10
11
|
* Statuses that represent an agent actively being created/started. The spinner
|
|
11
12
|
* only shows for these; app-navigation states ("selected", "switching") and
|
|
@@ -19,20 +20,61 @@ const CREATING_STATUSES = new Set([
|
|
|
19
20
|
'pending',
|
|
20
21
|
'resuming',
|
|
21
22
|
]);
|
|
23
|
+
const MAX_AGENT_NAME_LENGTH = 32;
|
|
24
|
+
const toSandboxStatusUrl = (value) => {
|
|
25
|
+
const raw = String(value || '').trim();
|
|
26
|
+
if (!raw) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const parsed = new URL(raw);
|
|
31
|
+
parsed.pathname = `${parsed.pathname.replace(/\/$/, '')}/api`;
|
|
32
|
+
return parsed.toString();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
const normalized = raw.replace(/\/$/, '');
|
|
36
|
+
return normalized.endsWith('/api') ? normalized : `${normalized}/api`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
22
39
|
/**
|
|
23
40
|
* Compact agent summary badge with a hover overlay for details.
|
|
24
41
|
*/
|
|
25
42
|
export const AgentSummary = ({ summary, title = 'Active Agent', }) => {
|
|
26
43
|
const [isHovering, setIsHovering] = useState(false);
|
|
27
|
-
const
|
|
44
|
+
const closeTimerRef = useRef(null);
|
|
45
|
+
const clearCloseTimer = () => {
|
|
46
|
+
if (closeTimerRef.current !== null) {
|
|
47
|
+
window.clearTimeout(closeTimerRef.current);
|
|
48
|
+
closeTimerRef.current = null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const handleMouseEnter = () => {
|
|
52
|
+
clearCloseTimer();
|
|
53
|
+
setIsHovering(true);
|
|
54
|
+
};
|
|
55
|
+
const handleMouseLeave = () => {
|
|
56
|
+
clearCloseTimer();
|
|
57
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
58
|
+
setIsHovering(false);
|
|
59
|
+
closeTimerRef.current = null;
|
|
60
|
+
}, 300);
|
|
61
|
+
};
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
return () => {
|
|
64
|
+
clearCloseTimer();
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
// Agent status is served by the agent-runtimes API server.
|
|
68
|
+
const apiBase = summary?.baseUrl
|
|
28
69
|
? (() => {
|
|
29
70
|
const normalized = summary.baseUrl.replace(/\/$/, '');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return `${normalized}/api/v1/runtime/status`;
|
|
71
|
+
return normalized.endsWith('/api/v1')
|
|
72
|
+
? normalized
|
|
73
|
+
: `${normalized}/api/v1`;
|
|
34
74
|
})()
|
|
35
75
|
: undefined;
|
|
76
|
+
const agentStatusUrl = apiBase ? `${apiBase}/runtime/status` : undefined;
|
|
77
|
+
const sandboxStatusUrl = toSandboxStatusUrl(summary?.sandboxBaseUrl);
|
|
36
78
|
if (!summary) {
|
|
37
79
|
return null;
|
|
38
80
|
}
|
|
@@ -43,9 +85,17 @@ export const AgentSummary = ({ summary, title = 'Active Agent', }) => {
|
|
|
43
85
|
!summary.agentId &&
|
|
44
86
|
CREATING_STATUSES.has(normalizedStatus);
|
|
45
87
|
const hasError = Boolean(summary.error);
|
|
46
|
-
|
|
88
|
+
// The agent is optional: some examples run only a code sandbox. Show the
|
|
89
|
+
// agent status when there is an agent (or one is being created).
|
|
90
|
+
const hasAgent = Boolean(summary.agentId) || isCreating;
|
|
91
|
+
const shortAgentName = strip(summary.agentName, MAX_AGENT_NAME_LENGTH);
|
|
92
|
+
const badgeLabel = `${summary.agentName} · ${summary.location}`;
|
|
93
|
+
const badgeLabelShort = `${shortAgentName} · ${summary.location}`;
|
|
94
|
+
return (_jsxs(Box, { sx: { position: 'relative' }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsxs(Box, { as: "button", type: "button", title: badgeLabel, sx: {
|
|
47
95
|
px: 2,
|
|
48
96
|
py: '6px',
|
|
97
|
+
maxWidth: 280,
|
|
98
|
+
minWidth: 0,
|
|
49
99
|
border: '1px solid',
|
|
50
100
|
borderColor: hasError ? 'danger.emphasis' : 'border.default',
|
|
51
101
|
borderRadius: 2,
|
|
@@ -56,7 +106,13 @@ export const AgentSummary = ({ summary, title = 'Active Agent', }) => {
|
|
|
56
106
|
display: 'flex',
|
|
57
107
|
alignItems: 'center',
|
|
58
108
|
gap: 1,
|
|
59
|
-
}, children: [isCreating && _jsx(Spinner, { size: "small", sx: { width: 12, height: 12 } }), hasError && _jsx("span", { "aria-hidden": true, children: "\u26A0" }),
|
|
109
|
+
}, children: [isCreating && _jsx(Spinner, { size: "small", sx: { width: 12, height: 12 } }), hasError && _jsx("span", { "aria-hidden": true, children: "\u26A0" }), _jsx(Box, { as: "span", sx: {
|
|
110
|
+
display: 'block',
|
|
111
|
+
minWidth: 0,
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
textOverflow: 'ellipsis',
|
|
114
|
+
whiteSpace: 'nowrap',
|
|
115
|
+
}, children: badgeLabelShort })] }), isHovering && (_jsxs(Box, { sx: {
|
|
60
116
|
position: 'absolute',
|
|
61
117
|
top: 'calc(100% + 8px)',
|
|
62
118
|
right: 0,
|
|
@@ -70,13 +126,13 @@ export const AgentSummary = ({ summary, title = 'Active Agent', }) => {
|
|
|
70
126
|
zIndex: 120,
|
|
71
127
|
fontSize: 0,
|
|
72
128
|
color: 'fg.default',
|
|
73
|
-
}, children: [_jsx(Box, { sx: { mb: 1, fontWeight: 600 }, children: title }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Name: ", summary.agentName] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Location: ", summary.location] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Spec: ", summary.specId || '—'] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Status: ", isCreating ? 'creating' : summary.status || '—'] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["
|
|
129
|
+
}, children: [_jsx(Box, { sx: { mb: 1, fontWeight: 600 }, children: title }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Name: ", summary.agentName] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Location: ", summary.location] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Spec: ", summary.specId || '—'] }), _jsxs(Box, { sx: { color: 'fg.muted' }, children: ["Status: ", isCreating ? 'creating' : summary.status || '—'] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["Agent base URL: ", summary.baseUrl || '—'] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["Code sandbox base URL:", ' ', summary.sandboxBaseUrl ? (_jsx(Box, { as: "a", href: summary.sandboxBaseUrl, target: "_blank", rel: "noopener noreferrer", sx: { color: 'accent.fg', textDecoration: 'underline' }, children: summary.sandboxBaseUrl })) : ('—')] }), _jsxs(Box, { sx: {
|
|
74
130
|
color: 'fg.muted',
|
|
75
131
|
wordBreak: 'break-all',
|
|
76
132
|
display: 'flex',
|
|
77
133
|
alignItems: 'center',
|
|
78
134
|
gap: 1,
|
|
79
|
-
}, children: ["Agent ID:", ' ', summary.agentId ? (summary.agentId) : isCreating ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small", sx: { width: 12, height: 12 } }), "Creating\u2026"] })) : ('—')] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["
|
|
135
|
+
}, children: ["Agent ID:", ' ', summary.agentId ? (summary.agentId) : isCreating ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small", sx: { width: 12, height: 12 } }), "Creating\u2026"] })) : ('—')] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["Agent status:", ' ', hasAgent && agentStatusUrl ? (_jsx(Box, { as: "a", href: agentStatusUrl, target: "_blank", rel: "noopener noreferrer", sx: { color: 'accent.fg', textDecoration: 'underline' }, children: agentStatusUrl })) : ('n/a')] }), _jsxs(Box, { sx: { color: 'fg.muted', wordBreak: 'break-all' }, children: ["Code sandbox status:", ' ', sandboxStatusUrl ? (_jsx(Box, { as: "a", href: sandboxStatusUrl, target: "_blank", rel: "noopener noreferrer", sx: { color: 'accent.fg', textDecoration: 'underline' }, children: sandboxStatusUrl })) : ('n/a')] }), hasError && (_jsxs(Box, { sx: {
|
|
80
136
|
mt: 1,
|
|
81
137
|
p: 1,
|
|
82
138
|
border: '1px solid',
|
|
@@ -23,57 +23,92 @@ const RUNTIME_DISPLAY_NAME_MAX_LENGTH = 25;
|
|
|
23
23
|
*/
|
|
24
24
|
export function RuntimePickerBase(props) {
|
|
25
25
|
const { disabled, display, filterRuntime, multiServiceManager, postActions, preActions, preference, runtimeDesc, sessionContext, setRuntimeDesc, translator, variant, } = props;
|
|
26
|
-
const [groupedRuntimeDescs,
|
|
26
|
+
const [groupedRuntimeDescs, setGroupedRuntimeDescs] = useState(getGroupedRuntimeDescs(multiServiceManager, preference?.id, translator, filterRuntime, variant));
|
|
27
27
|
const trans = useMemo(() => (translator ?? nullTranslator).load('jupyterlab'), [translator]);
|
|
28
28
|
const [defaultSet, setDefaultSet] = useState(false);
|
|
29
|
+
const [remoteModelsReady, setRemoteModelsReady] = useState(!multiServiceManager.remote);
|
|
29
30
|
// Trick because overflow is an unknown prop of ActionMenu.Overlay.
|
|
30
31
|
const overlayProps = {
|
|
31
32
|
maxHeight: 'large',
|
|
32
33
|
width: (variant === 'cell' ? 'small' : 'auto'),
|
|
33
34
|
};
|
|
34
|
-
/*
|
|
35
|
-
// TODO this effect generates refresh of the react components which discards any change in the selection.
|
|
36
35
|
useEffect(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
let disposed = false;
|
|
37
|
+
const updateGroupedRuntimeDescs = () => {
|
|
38
|
+
if (disposed) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setGroupedRuntimeDescs(getGroupedRuntimeDescs(multiServiceManager, preference?.id, translator, filterRuntime, variant));
|
|
42
|
+
};
|
|
43
|
+
const refreshRuntimeModels = multiServiceManager.remote?.runtimesManager.refreshRuntimeModels?.();
|
|
44
|
+
if (refreshRuntimeModels) {
|
|
45
|
+
refreshRuntimeModels
|
|
46
|
+
.catch(reason => {
|
|
47
|
+
console.error('Failed to resolve remote runtimes for the runtime picker.', reason);
|
|
48
|
+
})
|
|
49
|
+
.finally(() => {
|
|
50
|
+
if (disposed) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
updateGroupedRuntimeDescs();
|
|
54
|
+
setRemoteModelsReady(true);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
setRemoteModelsReady(true);
|
|
59
|
+
}
|
|
60
|
+
// Recompute immediately in case a runtime changed between the initial
|
|
61
|
+
// render and connecting the manager signals.
|
|
62
|
+
updateGroupedRuntimeDescs();
|
|
63
|
+
multiServiceManager.browser?.kernels.runningChanged.connect(updateGroupedRuntimeDescs);
|
|
64
|
+
multiServiceManager.browser?.kernelspecs.specsChanged.connect(updateGroupedRuntimeDescs);
|
|
65
|
+
multiServiceManager.browser?.sessions.runningChanged.connect(updateGroupedRuntimeDescs);
|
|
66
|
+
multiServiceManager.local.kernels.runningChanged.connect(updateGroupedRuntimeDescs);
|
|
67
|
+
multiServiceManager.local.kernelspecs.specsChanged.connect(updateGroupedRuntimeDescs);
|
|
68
|
+
multiServiceManager.local.sessions.runningChanged.connect(updateGroupedRuntimeDescs);
|
|
69
|
+
multiServiceManager.remote?.runtimesManager.changed.connect(updateGroupedRuntimeDescs);
|
|
70
|
+
multiServiceManager.remote?.environments.changed.connect(updateGroupedRuntimeDescs);
|
|
71
|
+
return () => {
|
|
72
|
+
disposed = true;
|
|
73
|
+
multiServiceManager.browser?.kernels.runningChanged.disconnect(updateGroupedRuntimeDescs);
|
|
74
|
+
multiServiceManager.browser?.kernelspecs.specsChanged.disconnect(updateGroupedRuntimeDescs);
|
|
75
|
+
multiServiceManager.browser?.sessions.runningChanged.disconnect(updateGroupedRuntimeDescs);
|
|
76
|
+
multiServiceManager.local.kernels.runningChanged.disconnect(updateGroupedRuntimeDescs);
|
|
77
|
+
multiServiceManager.local.kernelspecs.specsChanged.disconnect(updateGroupedRuntimeDescs);
|
|
78
|
+
multiServiceManager.local.sessions.runningChanged.disconnect(updateGroupedRuntimeDescs);
|
|
79
|
+
multiServiceManager.remote?.runtimesManager.changed.disconnect(updateGroupedRuntimeDescs);
|
|
80
|
+
multiServiceManager.remote?.environments.changed.disconnect(updateGroupedRuntimeDescs);
|
|
81
|
+
};
|
|
82
|
+
}, [multiServiceManager, preference?.id, translator, filterRuntime, variant]);
|
|
62
83
|
useEffect(() => {
|
|
84
|
+
if (defaultSet) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
63
87
|
if (sessionContext && groupedRuntimeDescs) {
|
|
64
88
|
const kernelId = sessionContext.session?.kernel?.id;
|
|
65
89
|
if (kernelId) {
|
|
90
|
+
let matched = false;
|
|
66
91
|
Object.entries(groupedRuntimeDescs).forEach(([group, runtimeDescs]) => {
|
|
67
92
|
runtimeDescs.forEach(runtimeDesc => {
|
|
68
93
|
if (runtimeDesc.kernelId === kernelId) {
|
|
94
|
+
matched = true;
|
|
69
95
|
setRuntimeDesc(runtimeDesc);
|
|
70
96
|
}
|
|
71
97
|
});
|
|
72
98
|
});
|
|
99
|
+
if (!matched && !remoteModelsReady) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
73
102
|
}
|
|
74
103
|
}
|
|
75
104
|
setDefaultSet(true);
|
|
76
|
-
}, [
|
|
105
|
+
}, [
|
|
106
|
+
defaultSet,
|
|
107
|
+
groupedRuntimeDescs,
|
|
108
|
+
remoteModelsReady,
|
|
109
|
+
sessionContext,
|
|
110
|
+
setRuntimeDesc,
|
|
111
|
+
]);
|
|
77
112
|
// For cell using submenu instead of group would be nice unfortunately the feature
|
|
78
113
|
// is not yet implemented in the component there has been a not-great demo story.
|
|
79
114
|
// https://github.com/primer/react/pull/3585
|
|
@@ -99,6 +99,6 @@ export function RuntimePickerCell(props) {
|
|
|
99
99
|
const datalayerMeta = model.getMetadata('datalayer') ?? {};
|
|
100
100
|
return (_jsxs(_Fragment, { children: [_jsx(RuntimePickerBase, { display: "menu", filterRuntime: filterKernel, preference: preference, multiServiceManager: multiServiceManager, runtimeDesc: datalayerMeta.kernel ? datalayerMeta.kernel : undefined, setRuntimeDesc: setSelectedRuntimeDesc, variant: 'cell', preActions: _jsxs(ActionList.Item, { disabled: !multiServiceManager.remote, onSelect: setCell, selected: hasCellRuntime, title: !multiServiceManager.remote
|
|
101
101
|
? 'You are not connected with Datalayer.'
|
|
102
|
-
: 'Assign a new temporary Runtime on each Cell execution.', children: [_jsx(ActionList.LeadingVisual, { children: _jsx(CloudUploadIcon, {}) }), trans.__('Assign a Cell Runtime')] }), postActions: token || !logIn ? (_jsxs(_Fragment, { children: [RuntimeSnippetsFacade.supports(preference?.language ?? '') && (_jsx(ActionList.Item, { onSelect: openVariableDialog, disabled: !isForeign, title: trans.__('Define variables to transfer between the document kernel and the cell kernel.'), children: trans.__('Define Cell Variables Transfer') })), !configuration.whiteLabel && (_jsx(ActionList.Item, { onSelect: openSnippetDialog, disabled: snippets.length === 0, title: trans.__('Inject a code snippet at the end of the cell.'), children: trans.__('Inject Code Snippet') }))] })) : (_jsx(ActionList.Item, { onSelect: props.logIn, title: '
|
|
102
|
+
: 'Assign a new temporary Runtime on each Cell execution.', children: [_jsx(ActionList.LeadingVisual, { children: _jsx(CloudUploadIcon, {}) }), trans.__('Assign a Cell Runtime')] }), postActions: token || !logIn ? (_jsxs(_Fragment, { children: [RuntimeSnippetsFacade.supports(preference?.language ?? '') && (_jsx(ActionList.Item, { onSelect: openVariableDialog, disabled: !isForeign, title: trans.__('Define variables to transfer between the document kernel and the cell kernel.'), children: trans.__('Define Cell Variables Transfer') })), !configuration.whiteLabel && (_jsx(ActionList.Item, { onSelect: openSnippetDialog, disabled: snippets.length === 0, title: trans.__('Inject a code snippet at the end of the cell.'), children: trans.__('Inject Code Snippet') }))] })) : (_jsx(ActionList.Item, { onSelect: props.logIn, title: 'Runtime Provider.', children: _jsx(ExternalTokenSilentLogin, { message: "Click to sign in" }) })), translator: translator }), isVariableDialogOpen && (_jsx(RuntimeCellVariablesDialog, { model: model, onClose: closeVariableDialog, preference: preference, sessionContext: sessionContext, translator: translator })), isSnippetDialogOpen && (_jsx(SnippetDialog, { language: language, model: model, snippets: snippets, onClose: closeSnippetDialog, markdownParser: markdownParser, sanitizer: sanitizer })), isKernelDialogOpen && (_jsx(RuntimeLauncherDialog, { manager: multiServiceManager.remote, onSubmit: onStartRemote, startRuntime: 'defer', submitLabel: "Assign", markdownParser: markdownParser, sanitizer: sanitizer }))] }));
|
|
103
103
|
}
|
|
104
104
|
export default RuntimePickerCell;
|
|
@@ -220,7 +220,7 @@ export function RuntimePickerNotebook(props) {
|
|
|
220
220
|
Launch a New Runtime
|
|
221
221
|
</Button>
|
|
222
222
|
*/
|
|
223
|
-
_jsx(_Fragment, {})) : (_jsx(ActionList.Item, { onSelect: props.logIn, title: '
|
|
223
|
+
_jsx(_Fragment, {})) : (_jsx(ActionList.Item, { onSelect: props.logIn, title: 'Runtime Provider.', children: _jsx(ExternalTokenSilentLogin, { message: "Click to sign in." }) })) }) }), !selectedRuntimeDesc?.kernelId &&
|
|
224
224
|
selectedRuntimeDesc?.location === 'remote' && (_jsxs(_Fragment, { children: [_jsx(RuntimeReservationControl, { disabled: outOfCredits || selectedRuntimeDesc?.location !== 'remote', label: 'Time reservation', max: effectiveMaxMinutes, time: timeLimit, onTimeChange: setTimeLimit, error: outOfCredits && maxFromCredits >= 0
|
|
225
225
|
? 'You must add credits to your account.'
|
|
226
226
|
: timeLimit === 0
|
|
@@ -134,7 +134,7 @@ export function RuntimeSimplePicker(props) {
|
|
|
134
134
|
setRuntimeLocation('remote');
|
|
135
135
|
assignRuntime({
|
|
136
136
|
runtimeDesc: {
|
|
137
|
-
name: kernelModel.
|
|
137
|
+
name: kernelModel.environment.name,
|
|
138
138
|
language: '',
|
|
139
139
|
location: 'remote',
|
|
140
140
|
displayName: kernelModel.given_name,
|
|
@@ -144,7 +144,8 @@ export function RuntimeSimplePicker(props) {
|
|
|
144
144
|
},
|
|
145
145
|
runtimeModel: kernelModel,
|
|
146
146
|
});
|
|
147
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArtifactIcon, { type: "runtime" }) }), kernelModel.given_name, _jsx(ActionList.Description, { variant: "block", children: kernelModel.
|
|
147
|
+
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArtifactIcon, { type: "runtime" }) }), kernelModel.given_name, _jsx(ActionList.Description, { variant: "block", children: kernelModel.environment.title ||
|
|
148
|
+
kernelModel.environment.name })] }, kernelModel.id));
|
|
148
149
|
})] })), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: false, onSelect: handleLaunchRemoteKernel, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, {}) }), "Launch a new Runtime\u2026"] }), _jsxs(ActionList.Item, { disabled: runtimeLocation !== 'browser', selected: false, onSelect: () => {
|
|
149
150
|
setDialogCause(RuntimeDialogCause.Transfer);
|
|
150
151
|
}, title: "Transfer the state of the current Runtime to a new Remote Runtime.", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(UnfoldIcon, {}) }), "Transfer state to a new Runtime\u2026"] })] })] }) })] }), multiServiceManager?.remote && dialogCause > 0 && (_jsx(RuntimeLauncherDialog, { dialogTitle: dialogCause === RuntimeDialogCause.Transfer
|
|
@@ -64,12 +64,12 @@ export function getGroupedRuntimeDescs(multiServiceManager, kernelId, translator
|
|
|
64
64
|
.map(runtime => {
|
|
65
65
|
const environment = multiServiceManager
|
|
66
66
|
.remote.environments.get()
|
|
67
|
-
.find(env => env.name === runtime.
|
|
67
|
+
.find(env => env.name === runtime.environment.name);
|
|
68
68
|
return {
|
|
69
69
|
kernelId: runtime.id,
|
|
70
70
|
name: environment.name,
|
|
71
71
|
language: environment.language,
|
|
72
|
-
displayName: runtime.given_name
|
|
72
|
+
displayName: environment.title || runtime.given_name || environment.name,
|
|
73
73
|
location: 'remote',
|
|
74
74
|
podName: runtime.pod_name,
|
|
75
75
|
gpu: environment.resources?.['nvidia.com/gpu'],
|
|
@@ -14,7 +14,7 @@ import { useMemo } from 'react';
|
|
|
14
14
|
import ReactECharts from 'echarts-for-react';
|
|
15
15
|
/** Category definitions for ECharts graph. */
|
|
16
16
|
const CATEGORIES = [
|
|
17
|
-
{ name: 'start', itemStyle: { color: '#
|
|
17
|
+
{ name: 'start', itemStyle: { color: '#16A085' } },
|
|
18
18
|
{ name: 'step', itemStyle: { color: '#3fb950' } },
|
|
19
19
|
{ name: 'end', itemStyle: { color: '#f85149' } },
|
|
20
20
|
{ name: 'end_or_continue', itemStyle: { color: '#d29922' } },
|
|
@@ -568,7 +568,7 @@ export function TokenUsageChart({ serviceName, agentId, runtimeId, apiKey, datal
|
|
|
568
568
|
]
|
|
569
569
|
: [[initialTimestampMsRef.current, 0]],
|
|
570
570
|
})),
|
|
571
|
-
color: ['#2da44e', '#
|
|
571
|
+
color: ['#2da44e', '#16A085', '#0ea5a5', '#bf8700', '#cf222e'],
|
|
572
572
|
};
|
|
573
573
|
}, [turns]);
|
|
574
574
|
return (_jsx(ReactECharts, { option: option, style: { height, width: '100%' }, opts: { renderer: 'canvas' }, notMerge: true, lazyUpdate: true }));
|
|
@@ -40,8 +40,8 @@ import { Text } from '@primer/react';
|
|
|
40
40
|
// - reducer → alias for the reducer half of a join
|
|
41
41
|
// - start/end → graph entry / exit markers
|
|
42
42
|
const NODE_COLORS = {
|
|
43
|
-
root: '#
|
|
44
|
-
start: '#
|
|
43
|
+
root: '#16A085',
|
|
44
|
+
start: '#16A085',
|
|
45
45
|
step: '#3fb950',
|
|
46
46
|
end: '#f85149',
|
|
47
47
|
end_or_continue: '#d29922',
|
|
@@ -312,7 +312,7 @@ const A2UiAgentExample = () => {
|
|
|
312
312
|
borderRadius: 2,
|
|
313
313
|
px: 3,
|
|
314
314
|
py: 2,
|
|
315
|
-
bg: 'canvas.
|
|
315
|
+
bg: 'canvas.default',
|
|
316
316
|
display: 'flex',
|
|
317
317
|
alignItems: 'center',
|
|
318
318
|
gap: 2,
|
|
@@ -355,7 +355,7 @@ const A2UiAgentExample = () => {
|
|
|
355
355
|
py: 2,
|
|
356
356
|
borderBottom: '1px solid',
|
|
357
357
|
borderColor: 'border.default',
|
|
358
|
-
bg: 'canvas.
|
|
358
|
+
bg: 'canvas.default',
|
|
359
359
|
display: 'flex',
|
|
360
360
|
justifyContent: 'space-between',
|
|
361
361
|
alignItems: 'center',
|
|
@@ -411,7 +411,7 @@ const A2UiAgentExample = () => {
|
|
|
411
411
|
m: 0,
|
|
412
412
|
p: 2,
|
|
413
413
|
borderRadius: 2,
|
|
414
|
-
bg: 'canvas.
|
|
414
|
+
bg: 'canvas.default',
|
|
415
415
|
border: '1px solid',
|
|
416
416
|
borderColor: 'border.default',
|
|
417
417
|
fontSize: 0,
|
|
@@ -437,6 +437,6 @@ const A2UiAgentExample = () => {
|
|
|
437
437
|
justifyContent: 'center',
|
|
438
438
|
height: '100%',
|
|
439
439
|
gap: 3,
|
|
440
|
-
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Creating A2UI agent..." })] })) : chatError || !agentId ? (_jsx(Box, { sx: { p: 3 }, children: _jsxs(Text, { sx: { color: 'danger.fg' }, children: ["Failed to initialize chat:", ' ', chatError || 'No agent id returned'] }) })) : (_jsx(Chat, { protocol: "ag-ui", baseUrl: baseUrl, agentId: agentId, title: "A2UI Agent", description: "Generate interactive A2UI surfaces", placeholder: "Describe the UI you want...", showHeader: true, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, showInformation: true, autoFocus: true, height: "100%", runtimeId: agentId, historyEndpoint: `${baseUrl}/api/v1/history`, suggestions: SUGGESTIONS, submitOnSuggestionClick: true, pendingPrompt: pendingPrompt, renderToolResult: renderToolResult })) })] }) }) }));
|
|
440
|
+
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Creating A2UI agent..." })] })) : chatError || !agentId ? (_jsx(Box, { sx: { p: 3 }, children: _jsxs(Text, { sx: { color: 'danger.fg' }, children: ["Failed to initialize chat:", ' ', chatError || 'No agent id returned'] }) })) : (_jsx(Chat, { protocol: "ag-ui", baseUrl: baseUrl, agentId: agentId, title: "A2UI Agent", description: "Generate interactive A2UI surfaces", placeholder: "Describe the UI you want...", showHeader: true, kernelIndicatorPlacement: "right", showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, showInformation: true, autoFocus: true, height: "100%", runtimeId: agentId, historyEndpoint: `${baseUrl}/api/v1/history`, suggestions: SUGGESTIONS, submitOnSuggestionClick: true, pendingPrompt: pendingPrompt, renderToolResult: renderToolResult })) })] }) }) }));
|
|
441
441
|
};
|
|
442
442
|
export default A2UiAgentExample;
|
|
@@ -817,7 +817,7 @@ function GalleryContent({ onAction, }) {
|
|
|
817
817
|
borderColor: 'border.default',
|
|
818
818
|
borderRadius: 2,
|
|
819
819
|
p: 3,
|
|
820
|
-
backgroundColor: 'canvas.
|
|
820
|
+
backgroundColor: 'canvas.default',
|
|
821
821
|
display: 'flex',
|
|
822
822
|
flexDirection: 'column',
|
|
823
823
|
gap: 3,
|
|
@@ -845,14 +845,14 @@ const A2UiComponentsGalleryExample = () => {
|
|
|
845
845
|
py: 3,
|
|
846
846
|
borderBottom: '1px solid',
|
|
847
847
|
borderColor: 'border.default',
|
|
848
|
-
backgroundColor: 'canvas.
|
|
848
|
+
backgroundColor: 'canvas.default',
|
|
849
849
|
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83C\uDFA8 A2UI Components Gallery" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Showcases the A2UI basic catalog rendered live via MessageProcessor and A2uiSurface." })] }), _jsx(GalleryContent, { onAction: handleAction }), _jsx(Box, { sx: {
|
|
850
850
|
borderTop: '1px solid',
|
|
851
851
|
borderColor: 'border.default',
|
|
852
852
|
p: 3,
|
|
853
853
|
fontFamily: 'mono',
|
|
854
854
|
fontSize: 0,
|
|
855
|
-
backgroundColor: 'canvas.
|
|
855
|
+
backgroundColor: 'canvas.default',
|
|
856
856
|
whiteSpace: 'pre-wrap',
|
|
857
857
|
maxHeight: 220,
|
|
858
858
|
overflow: 'auto',
|
|
@@ -138,7 +138,7 @@ function ContactCardContent({ onAction, }) {
|
|
|
138
138
|
borderColor: 'border.default',
|
|
139
139
|
borderRadius: 2,
|
|
140
140
|
p: 3,
|
|
141
|
-
backgroundColor: 'canvas.
|
|
141
|
+
backgroundColor: 'canvas.default',
|
|
142
142
|
}, children: _jsx(A2uiSurfaceComposed, { surface: surface }) }, surface.id))) })] }));
|
|
143
143
|
}
|
|
144
144
|
const A2UiContactCardExample = () => {
|
|
@@ -158,7 +158,7 @@ const A2UiContactCardExample = () => {
|
|
|
158
158
|
py: 3,
|
|
159
159
|
borderBottom: '1px solid',
|
|
160
160
|
borderColor: 'border.default',
|
|
161
|
-
backgroundColor: 'canvas.
|
|
161
|
+
backgroundColor: 'canvas.default',
|
|
162
162
|
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83D\uDC64 A2UI Contact Card" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Uses MessageProcessor + A2uiSurface with native A2UI protocol messages." })] }), _jsxs(Box, { sx: {
|
|
163
163
|
display: 'grid',
|
|
164
164
|
gridTemplateColumns: ['1fr', '2fr 1fr'],
|
|
@@ -169,7 +169,7 @@ const A2UiContactCardExample = () => {
|
|
|
169
169
|
borderColor: 'border.default',
|
|
170
170
|
borderRadius: 2,
|
|
171
171
|
p: 3,
|
|
172
|
-
backgroundColor: 'canvas.
|
|
172
|
+
backgroundColor: 'canvas.default',
|
|
173
173
|
fontFamily: 'mono',
|
|
174
174
|
fontSize: 0,
|
|
175
175
|
whiteSpace: 'pre-wrap',
|
|
@@ -152,7 +152,7 @@ const A2UiRestaurantExample = () => {
|
|
|
152
152
|
p: 3,
|
|
153
153
|
borderBottom: '1px solid',
|
|
154
154
|
borderColor: 'border.default',
|
|
155
|
-
backgroundColor: 'canvas.
|
|
155
|
+
backgroundColor: 'canvas.default',
|
|
156
156
|
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: '1.25rem', fontWeight: 'bold' }, children: "\uD83E\uDD16 A2UI Restaurant Example" }), _jsx(Text, { sx: { fontSize: '0.875rem', color: 'fg.muted' }, children: "Uses MessageProcessor and A2uiSurface with native A2UI backend messages." })] }), _jsxs(Box, { sx: { flex: 1, p: 3 }, children: [!hasData && !isLoading && !error && (_jsx(RestaurantSearch, { onSearch: handleSearch, isLoading: isLoading })), isLoading && (_jsxs(Box, { sx: {
|
|
157
157
|
display: 'flex',
|
|
158
158
|
flexDirection: 'column',
|
|
@@ -180,7 +180,7 @@ const A2UiRestaurantExample = () => {
|
|
|
180
180
|
p: 2,
|
|
181
181
|
borderTop: '1px solid',
|
|
182
182
|
borderColor: 'border.default',
|
|
183
|
-
backgroundColor: 'canvas.
|
|
183
|
+
backgroundColor: 'canvas.default',
|
|
184
184
|
textAlign: 'center',
|
|
185
185
|
}, children: _jsxs(Text, { sx: { fontSize: '0.75rem', color: 'fg.muted' }, children: ["Backend: ", a2uiRestaurantEndpoint] }) })] }) }) }));
|
|
186
186
|
};
|