@datalayer/agent-runtimes 1.0.19 → 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 +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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServiceManager } from '@jupyterlab/services';
|
|
2
2
|
/**
|
|
3
|
-
* Agent Runtime Notebook Sidebar Example with Simple integration
|
|
3
|
+
* Agent Runtime Notebook Chat Sidebar Example with Simple integration
|
|
4
4
|
*/
|
|
5
5
|
interface ChatJupyterNotebookExampleProps {
|
|
6
6
|
serviceManager?: ServiceManager.IManager;
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Agent Runtime Notebook Example -
|
|
7
|
+
* Agent Runtime Notebook Example - Chat with Jupyter Notebook.
|
|
8
8
|
*
|
|
9
9
|
* This example demonstrates using the chat component with:
|
|
10
10
|
* - Jupyter Notebook integration
|
|
@@ -14,7 +14,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
*
|
|
15
15
|
* To run this example:
|
|
16
16
|
* 1. Start the agent-runtimes server: `npm run start:ag-ui`
|
|
17
|
-
* 2.
|
|
17
|
+
* 2. Optionally set `VITE_DATALAYER_AGENT_RUNTIMES_URL` (and
|
|
18
|
+
* `VITE_DATALAYER_RUNTIMES_URL` for cloud target) when overriding defaults.
|
|
18
19
|
*
|
|
19
20
|
* @module examples/NotebookAgentSidebarExample
|
|
20
21
|
*/
|
|
@@ -130,8 +131,8 @@ export function AgentRuntimeNotebookExampleInner({ serviceManager, }) {
|
|
|
130
131
|
p: 3,
|
|
131
132
|
borderBottom: '1px solid',
|
|
132
133
|
borderColor: 'border.default',
|
|
133
|
-
bg: 'canvas.
|
|
134
|
-
}, children: [_jsx("h1", { style: { margin: 0, fontSize: '1.5rem' }, children: "Agent Runtime Notebook Sidebar Example" }), _jsx("p", { style: { margin: '8px 0 0', color: 'var(--fgColor-muted)' }, children: "
|
|
134
|
+
bg: 'canvas.default',
|
|
135
|
+
}, children: [_jsx("h1", { style: { margin: 0, fontSize: '1.5rem' }, children: "Agent Runtime Notebook Chat Sidebar Example" }), _jsx("p", { style: { margin: '8px 0 0', color: 'var(--fgColor-muted)' }, children: "Chat with Jupyter Notebook integration" })] }), _jsx(Box, { sx: {
|
|
135
136
|
flex: 1,
|
|
136
137
|
display: 'flex',
|
|
137
138
|
overflow: 'hidden',
|
|
@@ -78,7 +78,7 @@ const NotebookCollaborationExample = (props) => {
|
|
|
78
78
|
borderRadius: 2,
|
|
79
79
|
}, children: [_jsx(Box, { sx: {
|
|
80
80
|
p: 2,
|
|
81
|
-
bg: 'canvas.
|
|
81
|
+
bg: 'canvas.default',
|
|
82
82
|
borderBottom: '1px solid',
|
|
83
83
|
borderColor: 'border.default',
|
|
84
84
|
fontWeight: 'bold',
|
|
@@ -89,7 +89,7 @@ const NotebookCollaborationExample = (props) => {
|
|
|
89
89
|
borderRadius: 2,
|
|
90
90
|
}, children: [_jsx(Box, { sx: {
|
|
91
91
|
p: 2,
|
|
92
|
-
bg: 'canvas.
|
|
92
|
+
bg: 'canvas.default',
|
|
93
93
|
borderBottom: '1px solid',
|
|
94
94
|
borderColor: 'border.default',
|
|
95
95
|
fontWeight: 'bold',
|
|
@@ -97,6 +97,6 @@ const NotebookCollaborationExample = (props) => {
|
|
|
97
97
|
border: '1px solid',
|
|
98
98
|
borderColor: 'border.default',
|
|
99
99
|
borderRadius: 2,
|
|
100
|
-
}, children: serviceManager ? (_jsx(Notebook, { id: NOTEBOOK_ID, height: "calc(100vh - 200px)", nbformat: nbformat, readonly: readonly, serviceManager: serviceManager, startDefaultKernel: true, collaborationProvider: collaborationProvider })) : (_jsx(Box, { sx: { p: 4, textAlign: 'center' }, children: "Loading ServiceManager..." })) })), _jsxs(Box, { sx: { mt: 2, fontSize: 1, color: 'fg.subtle' }, children: [_jsx("p", { children: "This example demonstrates how to use Datalayer services with Notebook:" }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "DatalayerServiceManager:" }), " Connects to Datalayer infrastructure for kernel management"] }), _jsxs("li", { children: [_jsx("strong", { children: "DatalayerCollaborationProvider:" }), " Enables real-time collaboration"] }), _jsx("li", { children: "Both require Datalayer credentials (datalayerUrl and token)" }), _jsx("li", { children: "Pass them directly to the base Notebook component" }), _jsx("li", { children: "No wrapper components needed - just create the services and pass them as props" }), _jsx("li", { children: "This shows the explicit, composable pattern for Datalayer integration" })] })] })] }) }));
|
|
100
|
+
}, children: serviceManager ? (_jsx(Notebook, { id: NOTEBOOK_ID, height: "calc(100vh - 200px)", nbformat: nbformat, readonly: readonly, serviceManager: serviceManager, startDefaultKernel: true, collaborationProvider: collaborationProvider })) : (_jsx(Box, { sx: { p: 4, textAlign: 'center' }, children: "Loading ServiceManager..." })) })), _jsxs(Box, { sx: { mt: 2, fontSize: 1, color: 'fg.subtle' }, children: [_jsx(Box, { as: "p", sx: { m: 0, mb: 2 }, children: "This example demonstrates how to use Datalayer services with Notebook:" }), _jsxs(Box, { as: "ul", sx: { m: 0, pl: 3, '& li': { mb: 1 } }, children: [_jsxs("li", { children: [_jsx("strong", { children: "DatalayerServiceManager:" }), " Connects to Datalayer infrastructure for kernel management"] }), _jsxs("li", { children: [_jsx("strong", { children: "DatalayerCollaborationProvider:" }), " Enables real-time collaboration"] }), _jsx("li", { children: "Both require Datalayer credentials (datalayerUrl and token)" }), _jsx("li", { children: "Pass them directly to the base Notebook component" }), _jsx("li", { children: "No wrapper components needed - just create the services and pass them as props" }), _jsx("li", { children: "This shows the explicit, composable pattern for Datalayer integration" })] })] })] }) }));
|
|
101
101
|
};
|
|
102
102
|
export default NotebookCollaborationExample;
|
|
@@ -18,8 +18,8 @@ export const JupyterNotebookExample = (props) => {
|
|
|
18
18
|
const { serviceManager } = props;
|
|
19
19
|
const extensions = useMemo(() => [new CellSidebarExtension({ factory: CellSidebarButton })], []);
|
|
20
20
|
if (!serviceManager) {
|
|
21
|
-
return (_jsxs(Box, { as: "h1", children: ["
|
|
21
|
+
return (_jsxs(Box, { as: "h1", children: ["Notebook Example", _jsx("div", { children: "Loading..." })] }));
|
|
22
22
|
}
|
|
23
|
-
return (_jsxs(ThemedJupyterProvider, { children: [_jsx(Box, { as: "h1", children: "
|
|
23
|
+
return (_jsxs(ThemedJupyterProvider, { children: [_jsx(Box, { as: "h1", children: "Notebook Example" }), _jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformatExample, serviceManager: serviceManager, startDefaultKernel: true, extensions: extensions, Toolbar: NotebookToolbar })] }));
|
|
24
24
|
};
|
|
25
25
|
export default JupyterNotebookExample;
|
|
@@ -32,6 +32,11 @@ export const ExampleWrapper = ({ children, }) => {
|
|
|
32
32
|
overflow: 'hidden',
|
|
33
33
|
display: 'flex',
|
|
34
34
|
flexDirection: 'column',
|
|
35
|
+
fontFamily: 'var(--fontStack-sansSerif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif)',
|
|
36
|
+
lineHeight: 1.5,
|
|
37
|
+
'& h1, & h2, & h3, & h4, & h5, & h6, & p, & li, & span, & label, & button, & input, & textarea, & select': {
|
|
38
|
+
fontFamily: 'inherit',
|
|
39
|
+
},
|
|
35
40
|
// Generic constraint: every example's root child fills the wrapper
|
|
36
41
|
// exactly and cannot exceed it. This neutralises stray `100vh`/
|
|
37
42
|
// `calc(100vh - Npx)` heights inside individual examples so the
|
|
@@ -141,7 +141,7 @@ export const Header = ({ activeSession, agentName, agentDescription, agentStatus
|
|
|
141
141
|
border: '1px solid',
|
|
142
142
|
borderColor: 'border.default',
|
|
143
143
|
borderRadius: 2,
|
|
144
|
-
bg: 'canvas.
|
|
144
|
+
bg: 'canvas.default',
|
|
145
145
|
}, children: [_jsxs(Box, { sx: {
|
|
146
146
|
display: 'flex',
|
|
147
147
|
justifyContent: 'space-between',
|
|
@@ -204,7 +204,7 @@ export const Header = ({ activeSession, agentName, agentDescription, agentStatus
|
|
|
204
204
|
border: '1px solid',
|
|
205
205
|
borderColor: 'border.default',
|
|
206
206
|
borderRadius: 2,
|
|
207
|
-
bg: 'canvas.
|
|
207
|
+
bg: 'canvas.default',
|
|
208
208
|
}, children: [_jsx(Text, { sx: {
|
|
209
209
|
fontSize: 1,
|
|
210
210
|
fontWeight: 'bold',
|
|
@@ -20,5 +20,5 @@ export const HeaderControls = ({ onToggleContextTree, }) => {
|
|
|
20
20
|
'&:hover': {
|
|
21
21
|
opacity: 0.8,
|
|
22
22
|
},
|
|
23
|
-
}, onClick: onToggleContextTree, children: _jsx(Box, { sx: { width: '120px', height: '30px' }, children: _jsx(Sparklines, { data: sparklineData, width: 120, height: 30, children: _jsx(SparklinesLine, { color: "#
|
|
23
|
+
}, onClick: onToggleContextTree, children: _jsx(Box, { sx: { width: '120px', height: '30px' }, children: _jsx(Sparklines, { data: sparklineData, width: 120, height: 30, children: _jsx(SparklinesLine, { color: "var(--fgColor-accent, #16A085)", style: { strokeWidth: '2' } }) }) }) }));
|
|
24
24
|
};
|
|
@@ -104,5 +104,5 @@ export const LexicalEditor = ({ content = INITIAL_CONTENT, serviceManager, extra
|
|
|
104
104
|
padding: 3,
|
|
105
105
|
backgroundColor: 'canvas.default',
|
|
106
106
|
minHeight: '600px',
|
|
107
|
-
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode, extraItems: extraItems }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), children] }) }) }) }));
|
|
107
|
+
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { useBaseStyles: false, children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode, extraItems: extraItems }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] })), children] }) }) }) }));
|
|
108
108
|
};
|
|
@@ -12,7 +12,7 @@ export const MainContent = ({ showWelcomeMessage = true, baseUrl, agentId, enabl
|
|
|
12
12
|
return (_jsxs(Box, { sx: { height: '100%', overflow: 'auto', padding: 3 }, children: [isConfigured && baseUrl && (_jsx(Box, { sx: {
|
|
13
13
|
mb: 4,
|
|
14
14
|
p: 3,
|
|
15
|
-
bg: 'canvas.
|
|
15
|
+
bg: 'canvas.default',
|
|
16
16
|
borderRadius: 2,
|
|
17
17
|
border: '1px solid',
|
|
18
18
|
borderColor: 'border.default',
|
|
@@ -29,35 +29,35 @@ export const MockFileBrowser = ({ codemode = false, }) => {
|
|
|
29
29
|
}, children: "Documents" }), _jsxs(Box, { sx: { fontSize: 0, mb: 2 }, children: [_jsx(Box, { sx: {
|
|
30
30
|
py: 1,
|
|
31
31
|
cursor: 'pointer',
|
|
32
|
-
'&:hover': { bg: 'canvas.
|
|
32
|
+
'&:hover': { bg: 'canvas.default' },
|
|
33
33
|
}, children: "\uD83D\uDCC1 notebooks/" }), _jsx(Box, { sx: {
|
|
34
34
|
py: 1,
|
|
35
35
|
pl: 3,
|
|
36
36
|
cursor: 'pointer',
|
|
37
|
-
'&:hover': { bg: 'canvas.
|
|
37
|
+
'&:hover': { bg: 'canvas.default' },
|
|
38
38
|
}, children: "\uD83D\uDCD3 analysis.ipynb" }), _jsx(Box, { sx: {
|
|
39
39
|
py: 1,
|
|
40
40
|
pl: 3,
|
|
41
41
|
cursor: 'pointer',
|
|
42
|
-
'&:hover': { bg: 'canvas.
|
|
42
|
+
'&:hover': { bg: 'canvas.default' },
|
|
43
43
|
}, children: "\uD83D\uDCD3 demo.ipynb" }), _jsx(Box, { sx: {
|
|
44
44
|
py: 1,
|
|
45
45
|
cursor: 'pointer',
|
|
46
|
-
'&:hover': { bg: 'canvas.
|
|
46
|
+
'&:hover': { bg: 'canvas.default' },
|
|
47
47
|
}, children: "\uD83D\uDCC1 data/" }), _jsx(Box, { sx: {
|
|
48
48
|
py: 1,
|
|
49
49
|
pl: 3,
|
|
50
50
|
cursor: 'pointer',
|
|
51
|
-
'&:hover': { bg: 'canvas.
|
|
51
|
+
'&:hover': { bg: 'canvas.default' },
|
|
52
52
|
}, children: "\uD83D\uDCC4 dataset.csv" }), _jsx(Box, { sx: {
|
|
53
53
|
py: 1,
|
|
54
54
|
cursor: 'pointer',
|
|
55
|
-
'&:hover': { bg: 'canvas.
|
|
55
|
+
'&:hover': { bg: 'canvas.default' },
|
|
56
56
|
}, children: "\uD83D\uDCC1 models/" }), _jsx(Box, { sx: {
|
|
57
57
|
py: 1,
|
|
58
58
|
pl: 3,
|
|
59
59
|
cursor: 'pointer',
|
|
60
|
-
'&:hover': { bg: 'canvas.
|
|
60
|
+
'&:hover': { bg: 'canvas.default' },
|
|
61
61
|
}, children: "\uD83D\uDCC4 agent.py" })] }), _jsx(Text, { sx: {
|
|
62
62
|
fontSize: 0,
|
|
63
63
|
fontWeight: 'semibold',
|
|
@@ -67,7 +67,7 @@ export const MockFileBrowser = ({ codemode = false, }) => {
|
|
|
67
67
|
}, children: "Buckets" }), _jsx(Box, { sx: { fontSize: 0 }, children: _jsx(Box, { sx: {
|
|
68
68
|
py: 1,
|
|
69
69
|
cursor: 'pointer',
|
|
70
|
-
'&:hover': { bg: 'canvas.
|
|
70
|
+
'&:hover': { bg: 'canvas.default' },
|
|
71
71
|
}, children: "\uD83E\uDEA3 s3://nasa-1" }) })] }), _jsxs(Box, { children: [_jsx(Text, { sx: {
|
|
72
72
|
fontSize: 1,
|
|
73
73
|
fontWeight: 'semibold',
|
|
@@ -13,7 +13,7 @@ export const TimeTravel = ({ value, onChange, min = 0, max = 100, step = 1, }) =
|
|
|
13
13
|
border: '1px solid',
|
|
14
14
|
borderColor: 'border.default',
|
|
15
15
|
borderRadius: 2,
|
|
16
|
-
backgroundColor: 'canvas.
|
|
16
|
+
backgroundColor: 'canvas.default',
|
|
17
17
|
}, children: [_jsxs(Box, { sx: {
|
|
18
18
|
display: 'flex',
|
|
19
19
|
alignItems: 'center',
|
|
@@ -34,7 +34,7 @@ export function HaikuDisplay({ haikus, title = 'Generated Haikus', }) {
|
|
|
34
34
|
border: '2px dashed',
|
|
35
35
|
borderColor: 'var(--borderColor-muted, #d0d7de)',
|
|
36
36
|
borderRadius: 12,
|
|
37
|
-
backgroundColor: 'var(--bgColor-
|
|
37
|
+
backgroundColor: 'var(--bgColor-default, #ffffff)',
|
|
38
38
|
minHeight: 200,
|
|
39
39
|
}, children: [_jsx(Text, { sx: {
|
|
40
40
|
fontSize: 1,
|
|
@@ -96,7 +96,7 @@ export function HaikuDisplay({ haikus, title = 'Generated Haikus', }) {
|
|
|
96
96
|
borderRadius: 4,
|
|
97
97
|
border: 'none',
|
|
98
98
|
backgroundColor: index === currentIndex
|
|
99
|
-
? 'var(--fgColor-accent, #
|
|
99
|
+
? 'var(--fgColor-accent, #16A085)'
|
|
100
100
|
: 'var(--borderColor-muted, #d0d7de)',
|
|
101
101
|
cursor: 'pointer',
|
|
102
102
|
transition: 'all 0.2s ease',
|
|
@@ -76,13 +76,14 @@ export const EXAMPLE_ENTRIES = [
|
|
|
76
76
|
makeEntry('AgUiSharedStateExample', () => import('./AgUiSharedStateExample'), 'AG-UI shared state synchronization example.'),
|
|
77
77
|
makeEntry('AgUiToolsBasedGenUiExample', () => import('./AgUiToolsBasedGenUiExample'), 'AG-UI tool-based generative UI example.'),
|
|
78
78
|
makeEntry('AgentspecsExample', () => import('./AgentspecsExample'), 'Configure and run agents from specs and transports.'),
|
|
79
|
-
makeEntry('
|
|
79
|
+
makeEntry('CellExample', () => import('./CellExample'), 'Simple cell example.'),
|
|
80
80
|
makeEntry('ChatCustomExample', () => import('./ChatCustomExample'), 'Custom chat experience composition example.'),
|
|
81
81
|
makeEntry('ChatExample', () => import('./ChatExample'), 'Baseline chat integration example.'),
|
|
82
82
|
makeEntry('ChatStandaloneExample', () => import('./ChatStandaloneExample'), 'Standalone chat component usage example.'),
|
|
83
83
|
makeEntry('CopilotKitLexicalExample', () => import('./CopilotKitLexicalExample'), 'CopilotKit integration with Lexical editor.'),
|
|
84
84
|
makeEntry('CopilotKitNotebookExample', () => import('./CopilotKitNotebookExample'), 'CopilotKit integration with notebook workflows.'),
|
|
85
85
|
makeEntry('AgentCheckpointsExample', () => import('./AgentCheckpointsExample'), 'Checkpoint and resume lifecycle for agents.'),
|
|
86
|
+
makeEntry('AgentCompactionExample', () => import('./AgentCompactionExample'), 'Set a context token budget and watch history compaction summarize older messages, with live from/to token and timing details.', ['example', 'agent', 'compaction', 'context', 'tokens']),
|
|
86
87
|
makeEntry('AgentCodemodeExample', () => import('./AgentCodemodeExample'), 'Code mode execution and tool orchestration example.'),
|
|
87
88
|
makeEntry('AgentCodeSandboxesExample', () => import('./AgentCodeSandboxesExample'), 'Launch sandbox-variant agent specs and compare code execution across backends.', ['example', 'agent', 'sandbox', 'codemode']),
|
|
88
89
|
makeEntry('AgentEvalsExample', () => import('./AgentEvalsExample'), 'Evaluation workflows for agent outputs.'),
|
|
@@ -95,9 +96,9 @@ export const EXAMPLE_ENTRIES = [
|
|
|
95
96
|
makeEntry('AgentSkillsExample', () => import('./AgentSkillsExample'), 'Skills discovery, execution, and monitoring example.'),
|
|
96
97
|
makeEntry('AgentMCPExample', () => import('./AgentMCPExample'), 'MCP servers and toolset integration example.'),
|
|
97
98
|
makeEntry('AgentOtelExample', () => import('./AgentOtelExample'), 'OpenTelemetry instrumentation and traces example.'),
|
|
98
|
-
makeEntry('
|
|
99
|
+
makeEntry('AgentCodeSandboxExample', () => import('./AgentCodeSandboxExample'), 'Sandbox execution variants and context controls.'),
|
|
99
100
|
makeEntry('AgentMonitoringExample', () => import('./AgentMonitoringExample'), 'Runtime monitoring and live metrics example.'),
|
|
100
|
-
makeEntry('AgentSubagentsExample', () => import('./AgentSubagentsExample'), 'Multi-agent delegation with subagents
|
|
101
|
+
makeEntry('AgentSubagentsExample', () => import('./AgentSubagentsExample'), 'Multi-agent delegation with the in-repo subagents capability.'),
|
|
101
102
|
makeEntry('AgentNotificationsExample', () => import('./AgentNotificationsExample'), 'Notifications and event routing example.'),
|
|
102
103
|
makeEntry('AgentOutputsExample', () => import('./AgentOutputsExample'), 'Structured outputs and rendering patterns.'),
|
|
103
104
|
makeEntry('AgentParametersExample', () => import('./AgentParametersExample'), 'Launch-time parameterized agent creation with JSON schema.'),
|
|
@@ -42,13 +42,22 @@ export function useExampleAgentRuntime(options) {
|
|
|
42
42
|
});
|
|
43
43
|
}, [isCloud, connectToRuntime, agentName, environmentName, baseUrl]);
|
|
44
44
|
useEffect(() => {
|
|
45
|
+
// Agent status and code sandbox status are both reported by the
|
|
46
|
+
// agent-runtimes API server. For local runs that server is `baseUrl`
|
|
47
|
+
// (e.g. http://localhost:8765); the Jupyter sandbox lives elsewhere
|
|
48
|
+
// (`runtime.agentBaseUrl`). For cloud runs the per-agent runtime URL
|
|
49
|
+
// (`runtime.agentBaseUrl`) hosts the API, so prefer it when present.
|
|
50
|
+
const agentApiBaseUrl = isCloud
|
|
51
|
+
? runtime?.agentBaseUrl || baseUrl
|
|
52
|
+
: baseUrl;
|
|
45
53
|
agentSummaryStore.getState().setActive({
|
|
46
54
|
exampleId,
|
|
47
55
|
agentName,
|
|
48
56
|
agentId: runtime?.agentId,
|
|
49
57
|
specId,
|
|
50
58
|
location,
|
|
51
|
-
baseUrl:
|
|
59
|
+
baseUrl: agentApiBaseUrl,
|
|
60
|
+
sandboxBaseUrl: runtime?.agentBaseUrl,
|
|
52
61
|
status,
|
|
53
62
|
isReady,
|
|
54
63
|
error: error || undefined,
|
|
@@ -64,6 +73,7 @@ export function useExampleAgentRuntime(options) {
|
|
|
64
73
|
specId,
|
|
65
74
|
location,
|
|
66
75
|
baseUrl,
|
|
76
|
+
isCloud,
|
|
67
77
|
status,
|
|
68
78
|
isReady,
|
|
69
79
|
error,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type UseAgentOptions, type UseAgentReturn } from '../../hooks/useAgentRuntimes';
|
|
2
|
+
/**
|
|
3
|
+
* High-level examples hook that applies the shared Local/Cloud runtime target
|
|
4
|
+
* defaults while preserving explicit overrides from individual examples.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useExampleAgentRuntimes(options: UseAgentOptions): UseAgentReturn;
|
|
7
|
+
export default useExampleAgentRuntimes;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { useAgentRuntimes, } from '../../hooks/useAgentRuntimes';
|
|
6
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
7
|
+
import { useRuntimeTargetStore } from '../utils/runtimeTargetStore';
|
|
8
|
+
import { useExampleAgentRuntimesUrl } from '../utils/useExampleAgentRuntimesUrl';
|
|
9
|
+
/**
|
|
10
|
+
* High-level examples hook that applies the shared Local/Cloud runtime target
|
|
11
|
+
* defaults while preserving explicit overrides from individual examples.
|
|
12
|
+
*/
|
|
13
|
+
export function useExampleAgentRuntimes(options) {
|
|
14
|
+
const runtimeTarget = useRuntimeTargetStore(state => state.target);
|
|
15
|
+
const localRuntimeBaseUrl = useExampleAgentRuntimesUrl();
|
|
16
|
+
const runtimeCreationTarget = options.runtimeCreationTarget ??
|
|
17
|
+
(runtimeTarget === 'cloud' ? 'backend-services' : 'local-agent-runtimes');
|
|
18
|
+
const runtimeCreationBaseUrl = options.runtimeCreationBaseUrl ??
|
|
19
|
+
(runtimeCreationTarget === 'local-agent-runtimes'
|
|
20
|
+
? localRuntimeBaseUrl
|
|
21
|
+
: undefined);
|
|
22
|
+
const autoStart = options.autoStart ?? runtimeCreationTarget === 'backend-services';
|
|
23
|
+
const result = useAgentRuntimes({
|
|
24
|
+
...options,
|
|
25
|
+
runtimeCreationTarget,
|
|
26
|
+
runtimeCreationBaseUrl,
|
|
27
|
+
autoStart,
|
|
28
|
+
});
|
|
29
|
+
const bootstrapAttemptKeyRef = useRef(null);
|
|
30
|
+
const fallbackPodName = useMemo(() => {
|
|
31
|
+
const configuredName = typeof options.agentConfig?.name === 'string'
|
|
32
|
+
? options.agentConfig.name.trim()
|
|
33
|
+
: '';
|
|
34
|
+
if (configuredName) {
|
|
35
|
+
return configuredName;
|
|
36
|
+
}
|
|
37
|
+
const configuredSpecId = typeof options.agentSpecId === 'string' ? options.agentSpecId.trim() : '';
|
|
38
|
+
if (configuredSpecId) {
|
|
39
|
+
return configuredSpecId;
|
|
40
|
+
}
|
|
41
|
+
return 'example-agent-runtime';
|
|
42
|
+
}, [options.agentConfig?.name, options.agentSpecId]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (result.runtime || result.isLaunching) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const bootstrapKey = `${runtimeTarget}:${runtimeCreationTarget}:${fallbackPodName}`;
|
|
48
|
+
if (bootstrapAttemptKeyRef.current === bootstrapKey) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (runtimeCreationTarget === 'local-agent-runtimes') {
|
|
52
|
+
bootstrapAttemptKeyRef.current = bootstrapKey;
|
|
53
|
+
result.connectToRuntime({
|
|
54
|
+
podName: fallbackPodName,
|
|
55
|
+
environmentName: 'local-agent-runtimes',
|
|
56
|
+
jupyterBaseUrl: runtimeCreationBaseUrl,
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (runtimeCreationTarget === 'backend-services' &&
|
|
61
|
+
!autoStart &&
|
|
62
|
+
options.agentSpecId) {
|
|
63
|
+
bootstrapAttemptKeyRef.current = bootstrapKey;
|
|
64
|
+
void result.launchRuntime().catch(() => {
|
|
65
|
+
bootstrapAttemptKeyRef.current = null;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
runtimeTarget,
|
|
70
|
+
runtimeCreationTarget,
|
|
71
|
+
runtimeCreationBaseUrl,
|
|
72
|
+
fallbackPodName,
|
|
73
|
+
autoStart,
|
|
74
|
+
options.agentSpecId,
|
|
75
|
+
result.runtime,
|
|
76
|
+
result.isLaunching,
|
|
77
|
+
result.connectToRuntime,
|
|
78
|
+
result.launchRuntime,
|
|
79
|
+
]);
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
export default useExampleAgentRuntimes;
|
package/lib/examples/index.d.ts
CHANGED
|
@@ -10,13 +10,14 @@ export { default as AgUiHaikuGenUiExample } from './AgUiHaikuGenUiExample';
|
|
|
10
10
|
export { default as AgUiHumanInTheLoopExample } from './AgUiHumanInTheLoopExample';
|
|
11
11
|
export { default as AgUiSharedStateExample } from './AgUiSharedStateExample';
|
|
12
12
|
export { default as AgUiToolsBasedGenUiExample } from './AgUiToolsBasedGenUiExample';
|
|
13
|
-
export { default as CellExample } from './
|
|
13
|
+
export { default as CellExample } from './CellExample';
|
|
14
14
|
export { default as ChatStandaloneExample } from './ChatStandaloneExample';
|
|
15
15
|
export { default as CopilotKitLexicalExample } from './CopilotKitLexicalExample';
|
|
16
16
|
export { default as CopilotKitNotebookExample } from './CopilotKitNotebookExample';
|
|
17
17
|
export { default as CustomExample } from './ChatCustomExample';
|
|
18
18
|
export { default as NotebookCollaborationExample } from './NotebookCollaborationExample';
|
|
19
19
|
export { default as AgentCheckpointsExample } from './AgentCheckpointsExample';
|
|
20
|
+
export { default as AgentCompactionExample } from './AgentCompactionExample';
|
|
20
21
|
export { default as AgentCodemodeExample } from './AgentCodemodeExample';
|
|
21
22
|
export { default as AgentCodeSandboxesExample } from './AgentCodeSandboxesExample';
|
|
22
23
|
export { default as AgentEvalsExample } from './AgentEvalsExample';
|
package/lib/examples/index.js
CHANGED
|
@@ -14,13 +14,14 @@ export { default as AgUiHaikuGenUiExample } from './AgUiHaikuGenUiExample';
|
|
|
14
14
|
export { default as AgUiHumanInTheLoopExample } from './AgUiHumanInTheLoopExample';
|
|
15
15
|
export { default as AgUiSharedStateExample } from './AgUiSharedStateExample';
|
|
16
16
|
export { default as AgUiToolsBasedGenUiExample } from './AgUiToolsBasedGenUiExample';
|
|
17
|
-
export { default as CellExample } from './
|
|
17
|
+
export { default as CellExample } from './CellExample';
|
|
18
18
|
export { default as ChatStandaloneExample } from './ChatStandaloneExample';
|
|
19
19
|
export { default as CopilotKitLexicalExample } from './CopilotKitLexicalExample';
|
|
20
20
|
export { default as CopilotKitNotebookExample } from './CopilotKitNotebookExample';
|
|
21
21
|
export { default as CustomExample } from './ChatCustomExample';
|
|
22
22
|
export { default as NotebookCollaborationExample } from './NotebookCollaborationExample';
|
|
23
23
|
export { default as AgentCheckpointsExample } from './AgentCheckpointsExample';
|
|
24
|
+
export { default as AgentCompactionExample } from './AgentCompactionExample';
|
|
24
25
|
export { default as AgentCodemodeExample } from './AgentCodemodeExample';
|
|
25
26
|
export { default as AgentCodeSandboxesExample } from './AgentCodeSandboxesExample';
|
|
26
27
|
export { default as AgentEvalsExample } from './AgentEvalsExample';
|