@datalayer/agent-runtimes 1.0.18 → 1.0.20
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 +14 -6
- package/lib/AgentNode.js +567 -67
- package/lib/App.js +2 -2
- package/lib/agent-node/AgentNodeGallery.d.ts +80 -0
- package/lib/agent-node/AgentNodeGallery.js +627 -0
- package/lib/agent-notebook-main.js +0 -1
- package/lib/api/runtimes/runtimes.d.ts +57 -0
- package/lib/api/runtimes/runtimes.js +55 -1
- package/lib/chat/Chat.d.ts +14 -1
- package/lib/chat/Chat.js +22 -7
- package/lib/chat/base/ChatBase.js +86 -23
- package/lib/chat/document/EphemeralDocument.d.ts +49 -1
- package/lib/chat/document/EphemeralDocument.js +141 -15
- 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 +40 -1
- package/lib/chat/notebook/EphemeralNotebook.js +49 -13
- 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/identity/AgentIdentity.js +1 -2
- 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/shims/primerAddonsBox.d.ts +1 -0
- package/lib/shims/primerAddonsBox.js +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 +83 -0
- package/lib/types/models.d.ts +5 -0
- package/lib/types/stream.d.ts +58 -1
- package/package.json +6 -5
- 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
- package/scripts/codegen/__pycache__/generate_sandbox_agents.cpython-313.pyc +0 -0
|
@@ -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
|
};
|
|
@@ -345,7 +345,7 @@ function ViewerContent({ onAction, }) {
|
|
|
345
345
|
borderColor: 'border.default',
|
|
346
346
|
borderRadius: 2,
|
|
347
347
|
p: 3,
|
|
348
|
-
backgroundColor: 'canvas.
|
|
348
|
+
backgroundColor: 'canvas.default',
|
|
349
349
|
display: 'flex',
|
|
350
350
|
flexDirection: 'column',
|
|
351
351
|
gap: 3,
|
|
@@ -368,14 +368,14 @@ const A2UiViewerExample = () => {
|
|
|
368
368
|
py: 3,
|
|
369
369
|
borderBottom: '1px solid',
|
|
370
370
|
borderColor: 'border.default',
|
|
371
|
-
backgroundColor: 'canvas.
|
|
371
|
+
backgroundColor: 'canvas.default',
|
|
372
372
|
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83D\uDD0D A2UI Viewer" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Standalone viewer scenes powered by MessageProcessor and A2uiSurface." })] }), _jsx(ViewerContent, { onAction: handleAction }), _jsx(Box, { sx: {
|
|
373
373
|
borderTop: '1px solid',
|
|
374
374
|
borderColor: 'border.default',
|
|
375
375
|
p: 3,
|
|
376
376
|
fontFamily: 'mono',
|
|
377
377
|
fontSize: 0,
|
|
378
|
-
backgroundColor: 'canvas.
|
|
378
|
+
backgroundColor: 'canvas.default',
|
|
379
379
|
whiteSpace: 'pre-wrap',
|
|
380
380
|
maxHeight: 180,
|
|
381
381
|
overflow: 'auto',
|
|
@@ -78,7 +78,7 @@ const AgUiAgenticExample = () => {
|
|
|
78
78
|
borderColor: 'danger.muted',
|
|
79
79
|
}, children: _jsxs(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: ["Failed to initialize managed agent runtime: ", error] }) })), _jsxs(Box, { sx: {
|
|
80
80
|
padding: 4,
|
|
81
|
-
backgroundColor: 'canvas.
|
|
81
|
+
backgroundColor: 'canvas.default',
|
|
82
82
|
borderRadius: 2,
|
|
83
83
|
border: '1px solid',
|
|
84
84
|
borderColor: 'border.default',
|
|
@@ -89,11 +89,11 @@ const AgUiAgenticExample = () => {
|
|
|
89
89
|
}, children: "Try asking: \"hi\" or \"what can you help with?\"" })] }), _jsxs(Box, { sx: {
|
|
90
90
|
marginTop: 4,
|
|
91
91
|
padding: 4,
|
|
92
|
-
backgroundColor: 'canvas.
|
|
92
|
+
backgroundColor: 'canvas.default',
|
|
93
93
|
borderRadius: 2,
|
|
94
94
|
border: '1px solid',
|
|
95
95
|
borderColor: 'border.default',
|
|
96
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), agenticChatEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: agenticChatEndpoint, title: "Agentic Chat", description: "Chat with a managed AG-UI agent runtime.", position: "bottom-right", defaultOpen: true, suggestions: [
|
|
96
|
+
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), agenticChatEndpoint && (_jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: agenticChatEndpoint, title: "Agentic Chat", description: "Chat with a managed AG-UI agent runtime.", position: "bottom-right", defaultOpen: true, suggestions: [
|
|
97
97
|
{
|
|
98
98
|
title: 'What time is it?',
|
|
99
99
|
message: 'What is the current time?',
|
|
@@ -91,7 +91,7 @@ const AgUiBackendToolRenderingExample = () => {
|
|
|
91
91
|
marginBottom: 4,
|
|
92
92
|
}, children: ["Ask about the weather anywhere in the world. Weather cards are rendered ", _jsx("strong", { children: "inline in the chat" }), " with dynamic theming!"] }), _jsxs(Box, { sx: {
|
|
93
93
|
padding: 4,
|
|
94
|
-
backgroundColor: 'canvas.
|
|
94
|
+
backgroundColor: 'canvas.default',
|
|
95
95
|
borderRadius: 2,
|
|
96
96
|
border: '1px solid',
|
|
97
97
|
borderColor: 'border.default',
|
|
@@ -105,7 +105,7 @@ const AgUiBackendToolRenderingExample = () => {
|
|
|
105
105
|
marginTop: 1,
|
|
106
106
|
fontSize: 1,
|
|
107
107
|
color: 'fg.muted',
|
|
108
|
-
}, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), backendToolRenderingEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: backendToolRenderingEndpoint, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, renderToolResult: renderToolResult, suggestions: [
|
|
108
|
+
}, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), backendToolRenderingEndpoint && (_jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: backendToolRenderingEndpoint, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, renderToolResult: renderToolResult, suggestions: [
|
|
109
109
|
{
|
|
110
110
|
title: 'Paris weather',
|
|
111
111
|
message: "What's the weather like in Paris?",
|
|
@@ -129,14 +129,14 @@ const AgUiHaikuGenUiExample = () => {
|
|
|
129
129
|
marginBottom: 4,
|
|
130
130
|
}, children: "Ask the assistant to generate haiku poetry. Haikus appear both in the chat and in the display area below!" }), _jsx(Box, { sx: {
|
|
131
131
|
padding: 5,
|
|
132
|
-
backgroundColor: 'canvas.
|
|
132
|
+
backgroundColor: 'canvas.default',
|
|
133
133
|
borderRadius: 2,
|
|
134
134
|
border: '1px solid',
|
|
135
135
|
borderColor: 'border.default',
|
|
136
136
|
marginBottom: 4,
|
|
137
137
|
}, children: _jsx(HaikuDisplayWithRef, { ref: displayRef, title: "Your Haiku Collection" }) }), _jsxs(Box, { sx: {
|
|
138
138
|
padding: 4,
|
|
139
|
-
backgroundColor: 'canvas.
|
|
139
|
+
backgroundColor: 'canvas.default',
|
|
140
140
|
borderRadius: 2,
|
|
141
141
|
border: '1px solid',
|
|
142
142
|
borderColor: 'border.default',
|
|
@@ -150,7 +150,7 @@ const AgUiHaikuGenUiExample = () => {
|
|
|
150
150
|
marginTop: 1,
|
|
151
151
|
fontSize: 1,
|
|
152
152
|
color: 'fg.muted',
|
|
153
|
-
}, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: haikuGenUiEndpoint, launching: !haikuGenUiEndpoint, launchingMessage: "Starting the haiku agent runtime\u2026", title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor: brandColor, defaultOpen: true, renderToolResult: renderToolResult, hideMessagesAfterToolUI: true, suggestions: [
|
|
153
|
+
}, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: haikuGenUiEndpoint, launching: !haikuGenUiEndpoint, launchingMessage: "Starting the haiku agent runtime\u2026", title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor: brandColor, defaultOpen: true, renderToolResult: renderToolResult, hideMessagesAfterToolUI: true, suggestions: [
|
|
154
154
|
{
|
|
155
155
|
title: 'Cherry blossoms',
|
|
156
156
|
message: 'Write me a haiku about cherry blossoms in spring.',
|
|
@@ -100,7 +100,7 @@ const StepsFeedback = ({ args, status, respond, result }) => {
|
|
|
100
100
|
return (_jsxs(Box, { "data-testid": "select-steps", sx: {
|
|
101
101
|
width: '100%',
|
|
102
102
|
padding: 3,
|
|
103
|
-
backgroundColor: 'canvas.
|
|
103
|
+
backgroundColor: 'canvas.default',
|
|
104
104
|
borderRadius: 2,
|
|
105
105
|
border: '1px solid',
|
|
106
106
|
borderColor: 'border.default',
|
|
@@ -211,18 +211,18 @@ const AgUiHumanInTheLoopExample = () => {
|
|
|
211
211
|
marginBottom: 4,
|
|
212
212
|
}, children: "This example demonstrates human review workflows. Ask the AI to create a plan, then use the Reject/Confirm buttons to respond." }), _jsxs(Box, { sx: {
|
|
213
213
|
padding: 4,
|
|
214
|
-
backgroundColor: 'canvas.
|
|
214
|
+
backgroundColor: 'canvas.default',
|
|
215
215
|
borderRadius: 2,
|
|
216
216
|
border: '1px solid',
|
|
217
217
|
borderColor: 'border.default',
|
|
218
218
|
marginBottom: 4,
|
|
219
219
|
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This demonstrates the \"Human in the Loop\" pattern where AI-generated task plans require human approval before proceeding. The pattern follows CopilotKit's useHumanInTheLoop hook." }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: _jsx("strong", { children: "How it works:" }) }), _jsxs(Box, { as: "ul", sx: { fontSize: 1, color: 'fg.muted', mt: 1, pl: 3 }, children: [_jsx("li", { children: "The agent calls the generate_task_steps tool" }), _jsx("li", { children: "A custom UI renders with toggleable steps" }), _jsx("li", { children: "User clicks Reject or Confirm to send response back" }), _jsx("li", { children: "The UI updates to show Rejected or Accepted state" })] }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Try:" }), " \"Create a plan to learn machine learning\" or \"Plan a trip to Paris in 5 steps\""] })] }), _jsxs(Box, { sx: {
|
|
220
220
|
padding: 4,
|
|
221
|
-
backgroundColor: '
|
|
221
|
+
backgroundColor: 'neutral.muted',
|
|
222
222
|
borderRadius: 2,
|
|
223
223
|
border: '1px solid',
|
|
224
|
-
borderColor: '
|
|
225
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), humanInTheLoopEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: humanInTheLoopEndpoint, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor: brandColor, renderToolResult: renderTaskStepsTool, hideMessagesAfterToolUI: true, suggestions: [
|
|
224
|
+
borderColor: 'border.default',
|
|
225
|
+
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), humanInTheLoopEndpoint && (_jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: humanInTheLoopEndpoint, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor: brandColor, renderToolResult: renderTaskStepsTool, hideMessagesAfterToolUI: true, suggestions: [
|
|
226
226
|
{
|
|
227
227
|
title: 'Plan a trip',
|
|
228
228
|
message: 'Plan a weekend trip to Paris.',
|
|
@@ -163,7 +163,7 @@ const AgUiSharedStateExample = () => {
|
|
|
163
163
|
color: 'fg.muted',
|
|
164
164
|
}, children: "Build a recipe together with AI. Both you and the agent can edit the recipe." })] }), _jsx(Button, { variant: "danger", onClick: handleClear, children: "Clear Recipe" })] }), _jsxs(Box, { sx: {
|
|
165
165
|
padding: 4,
|
|
166
|
-
backgroundColor: 'canvas.
|
|
166
|
+
backgroundColor: 'canvas.default',
|
|
167
167
|
borderRadius: 2,
|
|
168
168
|
border: '1px solid',
|
|
169
169
|
borderColor: 'border.default',
|
|
@@ -175,7 +175,7 @@ const AgUiSharedStateExample = () => {
|
|
|
175
175
|
marginBottom: 3,
|
|
176
176
|
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold' }, children: "Recipe Builder" }), _jsx(Label, { variant: "accent", children: "Shared State" })] }), _jsx(RecipeDisplay, { recipe: recipe, onUpdate: handleLocalUpdate })] }), _jsxs(Box, { sx: {
|
|
177
177
|
padding: 4,
|
|
178
|
-
backgroundColor: 'canvas.
|
|
178
|
+
backgroundColor: 'canvas.default',
|
|
179
179
|
borderRadius: 2,
|
|
180
180
|
border: '1px solid',
|
|
181
181
|
borderColor: 'border.default',
|
|
@@ -184,7 +184,7 @@ const AgUiSharedStateExample = () => {
|
|
|
184
184
|
marginTop: 1,
|
|
185
185
|
fontSize: 1,
|
|
186
186
|
color: 'fg.muted',
|
|
187
|
-
}, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), sharedStateEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: sharedStateEndpoint, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
187
|
+
}, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), sharedStateEndpoint && (_jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: sharedStateEndpoint, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
188
188
|
{
|
|
189
189
|
title: 'Pasta recipe',
|
|
190
190
|
message: 'Help me create a simple pasta recipe.',
|
|
@@ -47,7 +47,7 @@ const PlanStepItem = ({ step, index, onClick, isInteractive = false }) => {
|
|
|
47
47
|
: step.status === 'completed'
|
|
48
48
|
? 'success.subtle'
|
|
49
49
|
: isEnabled
|
|
50
|
-
? 'canvas.
|
|
50
|
+
? 'canvas.default'
|
|
51
51
|
: 'canvas.default',
|
|
52
52
|
border: '1px solid',
|
|
53
53
|
borderColor: step.status === 'in_progress'
|
|
@@ -64,7 +64,9 @@ const PlanStepItem = ({ step, index, onClick, isInteractive = false }) => {
|
|
|
64
64
|
width: '100%',
|
|
65
65
|
'&:hover': isInteractive
|
|
66
66
|
? {
|
|
67
|
-
backgroundColor: step.status === 'completed'
|
|
67
|
+
backgroundColor: step.status === 'completed'
|
|
68
|
+
? 'success.subtle'
|
|
69
|
+
: 'canvas.default',
|
|
68
70
|
borderColor: 'accent.muted',
|
|
69
71
|
}
|
|
70
72
|
: {},
|
|
@@ -242,7 +244,7 @@ const AgUiToolsBasedGenUiExample = () => {
|
|
|
242
244
|
marginBottom: 4,
|
|
243
245
|
}, children: "Watch the AI create and update a plan in real-time using STATE_SNAPSHOT and STATE_DELTA events." }), _jsxs(Box, { sx: {
|
|
244
246
|
padding: 4,
|
|
245
|
-
backgroundColor: 'canvas.
|
|
247
|
+
backgroundColor: 'canvas.default',
|
|
246
248
|
borderRadius: 2,
|
|
247
249
|
border: '1px solid',
|
|
248
250
|
borderColor: 'border.default',
|
|
@@ -250,7 +252,7 @@ const AgUiToolsBasedGenUiExample = () => {
|
|
|
250
252
|
minHeight: '300px',
|
|
251
253
|
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 3 }, children: "Generated Plan" }), _jsx(PlanDisplay, { plan: plan, isInteractive: true, onStepToggle: handleStepToggle, onConfirm: handleConfirm, onReject: handleReject, decision: decision })] }), _jsxs(Box, { sx: {
|
|
252
254
|
padding: 4,
|
|
253
|
-
backgroundColor: 'canvas.
|
|
255
|
+
backgroundColor: 'canvas.default',
|
|
254
256
|
borderRadius: 2,
|
|
255
257
|
border: '1px solid',
|
|
256
258
|
borderColor: 'border.default',
|
|
@@ -259,7 +261,7 @@ const AgUiToolsBasedGenUiExample = () => {
|
|
|
259
261
|
marginTop: 1,
|
|
260
262
|
fontSize: 1,
|
|
261
263
|
color: 'fg.muted',
|
|
262
|
-
}, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), agenticGenerativeUiEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: agenticGenerativeUiEndpoint, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
264
|
+
}, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), agenticGenerativeUiEndpoint && (_jsx(ChatFloating, { kernelIndicatorPlacement: "right", protocol: "ag-ui", endpoint: agenticGenerativeUiEndpoint, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
|
|
263
265
|
{
|
|
264
266
|
title: 'Project plan',
|
|
265
267
|
message: 'Create a project plan for building a mobile app.',
|
|
@@ -29,7 +29,8 @@ import { AuthRequiredView, ErrorView } from './components';
|
|
|
29
29
|
import { ThemedProvider } from './utils/themedProvider';
|
|
30
30
|
import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
31
31
|
import { Chat } from '../chat';
|
|
32
|
-
import { useAgentsRuntimes,
|
|
32
|
+
import { useAgentsRuntimes, useAgentRuntimesQuery, useRefreshAgentRuntimes, } from '../hooks/useAgentRuntimes';
|
|
33
|
+
import { useExampleAgentRuntimes as useAgentRuntimes } from './hooks/useExampleAgentRuntimes';
|
|
33
34
|
import { useAgentLifecycle } from '../hooks/useCheckpoints';
|
|
34
35
|
import { useDeletePausedAgentRuntime } from '../hooks/useCheckpoints';
|
|
35
36
|
import { AGENT_STATUS_COLORS } from '../types/agents';
|
|
@@ -189,10 +190,10 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
189
190
|
id: rt.id,
|
|
190
191
|
podName: rt.pod_name,
|
|
191
192
|
name: rt.name,
|
|
192
|
-
description: rt.
|
|
193
|
+
description: rt.environment.title || rt.environment.name,
|
|
193
194
|
status: rt.status,
|
|
194
195
|
protocol: 'vercel-ai',
|
|
195
|
-
environmentName: rt.
|
|
196
|
+
environmentName: rt.environment.name,
|
|
196
197
|
jupyterBaseUrl: rt.url,
|
|
197
198
|
}));
|
|
198
199
|
}, [agentRuntimes, runningAgentsOverride]);
|
|
@@ -312,7 +313,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
312
313
|
borderRight: '1px solid',
|
|
313
314
|
borderColor: 'border.default',
|
|
314
315
|
overflowY: 'auto',
|
|
315
|
-
bg: 'canvas.
|
|
316
|
+
bg: 'canvas.default',
|
|
316
317
|
}, children: [_jsxs(Box, { sx: {
|
|
317
318
|
order: 3,
|
|
318
319
|
p: 3,
|
|
@@ -435,7 +436,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
435
436
|
gap: 3,
|
|
436
437
|
px: 3,
|
|
437
438
|
}, children: [_jsx(AgentIcon, { size: 48 }), _jsx(Heading, { as: "h2", sx: { fontSize: 3 }, children: "Checkpoint Agent" }), _jsxs(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: 560 }, children: ["Launch a cloud agent runtime with pause/resume checkpointing. The agent will be deployed from the", ' ', _jsx("strong", { children: AGENTSPEC_ID }), " spec."] }), displayError && (_jsx(Flash, { variant: "danger", sx: { maxWidth: 560, width: '100%' }, children: displayError })), _jsx(Button, { variant: "primary", size: "large", leadingVisual: PlayIcon, onClick: handleLaunch, children: "Launch Agent" })] })) : (isReady || runtimeStatus === 'resumed') &&
|
|
438
|
-
runtimeStatus !== 'paused' ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, title: "Monitor Sales KPI Agent", brandIcon: _jsx(AgentIcon, { size: 16 }), placeholder: "Ask about sales KPIs\u2026", description: "Monitor Sales KPI agent with pause/resume checkpointing", showHeader: true, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: podName, historyEndpoint: `${agentBaseUrl}/api/v1/history`, suggestions: [
|
|
439
|
+
runtimeStatus !== 'paused' ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, title: "Monitor Sales KPI Agent", brandIcon: _jsx(AgentIcon, { size: 16 }), placeholder: "Ask about sales KPIs\u2026", description: "Monitor Sales KPI agent with pause/resume checkpointing", showHeader: true, kernelIndicatorPlacement: "right", showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: podName, historyEndpoint: `${agentBaseUrl}/api/v1/history`, suggestions: [
|
|
439
440
|
{
|
|
440
441
|
title: 'KPIs',
|
|
441
442
|
message: "Show me today's sales KPI dashboard",
|