@datalayer/agent-runtimes 1.0.20 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/AgentNode.js +26 -26
- package/lib/chat/Chat.d.ts +1 -1
- package/lib/chat/Chat.js +2 -2
- package/lib/chat/base/ChatBase.js +44 -9
- package/lib/chat/document/EphemeralDocument.d.ts +12 -1
- package/lib/chat/document/EphemeralDocument.js +4 -4
- package/lib/chat/notebook/EphemeralNotebook.d.ts +11 -1
- package/lib/chat/notebook/EphemeralNotebook.js +13 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +1 -1
- package/lib/collaboration/DatalayerCollaborationProvider.js +5 -5
- package/lib/components/code-sandboxes/CodeSandboxLauncher.d.ts +59 -0
- package/lib/components/code-sandboxes/CodeSandboxLauncher.js +272 -0
- package/lib/components/code-sandboxes/CodeSandboxPicker.d.ts +71 -0
- package/lib/components/code-sandboxes/CodeSandboxPicker.js +163 -0
- package/lib/components/code-sandboxes/NewCodeSandboxControls.d.ts +42 -0
- package/lib/components/code-sandboxes/NewCodeSandboxControls.js +76 -0
- package/lib/components/code-sandboxes/index.d.ts +3 -0
- package/lib/components/code-sandboxes/index.js +7 -0
- package/lib/components/progress/CreditsIndicator.d.ts +7 -0
- package/lib/components/progress/CreditsIndicator.js +2 -2
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +5 -55
- package/lib/components/runtimes/RuntimeLauncherDialog.js +5 -269
- package/lib/components/runtimes/RuntimePickerBase.d.ts +6 -67
- package/lib/components/runtimes/RuntimePickerBase.js +6 -151
- package/lib/components/runtimes/RuntimePickerCell.d.ts +2 -2
- package/lib/components/runtimes/RuntimePickerCell.js +4 -4
- package/lib/components/runtimes/RuntimePickerNotebook.js +35 -70
- package/lib/components/runtimes/RuntimeReservationControl.js +8 -1
- package/lib/components/runtimes/RuntimeSimplePicker.js +1 -1
- package/lib/components/runtimes/RuntimeUtils.js +34 -18
- package/lib/components/runtimes/index.d.ts +1 -0
- package/lib/components/runtimes/index.js +2 -0
- package/lib/context/CostUsageChart.d.ts +2 -2
- package/lib/context/CostUsageChart.js +7 -7
- package/lib/context/TokenUsageChart.d.ts +2 -2
- package/lib/context/TokenUsageChart.js +6 -6
- package/lib/context/TurnGraphChart.d.ts +1 -1
- package/lib/context/TurnGraphChart.js +6 -6
- package/lib/examples/AgentEvalsExample.js +1 -1
- package/lib/examples/AgentGuardrailsExample.js +3 -3
- package/lib/examples/AgentInferenceProviderExample.js +1 -1
- package/lib/examples/AgentMonitoringExample.js +6 -6
- package/lib/examples/AgentOtelExample.d.ts +2 -2
- package/lib/examples/AgentOtelExample.js +5 -5
- package/lib/examples/AgentspecsExample.js +1 -1
- package/lib/examples/NotebookCollaborationExample.js +8 -8
- package/lib/examples/main.js +5 -5
- package/lib/examples2/DatalayerNotebookExample.js +8 -8
- package/lib/examples2/main.js +5 -5
- package/lib/hooks/useAgentRuntimes.js +3 -3
- package/lib/hooks/useMonitoring.d.ts +5 -5
- package/lib/hooks/useMonitoring.js +10 -10
- package/lib/protocols/AGUIAdapter.js +4 -0
- package/lib/protocols/VercelAIAdapter.js +3 -0
- package/lib/types/chat.d.ts +23 -0
- package/lib/types/tools.d.ts +11 -0
- package/package.json +3 -3
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/lib/components/toolbars/AssignmentEditorToolbar.d.ts +0 -4
- package/lib/components/toolbars/AssignmentEditorToolbar.js +0 -18
- package/lib/components/toolbars/DocumentEditorToolbar.d.ts +0 -2
- package/lib/components/toolbars/DocumentEditorToolbar.js +0 -12
- package/lib/components/toolbars/NotebookEditorToolbar.d.ts +0 -29
- package/lib/components/toolbars/NotebookEditorToolbar.js +0 -30
|
@@ -13,8 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
* list and launched on demand.
|
|
14
14
|
*
|
|
15
15
|
* The OTEL backend is configured via `configuration.otelUrl` when available
|
|
16
|
-
* (falling back to `configuration.
|
|
17
|
-
* `
|
|
16
|
+
* (falling back to `configuration.otelUrl`, then `VITE_OTEL_BASE_URL`, then
|
|
17
|
+
* `VITE_DATALAYER_OTEL_URL`, then the resolved runtime base URL).
|
|
18
18
|
* Agent routes resolve from the shared local/cloud runtime target hook.
|
|
19
19
|
*
|
|
20
20
|
* For Python-side observability, wire in `agent_runtimes/otel.py`:
|
|
@@ -37,7 +37,7 @@ const OTEL_BASE_URL_ENV = import.meta.env.VITE_OTEL_BASE_URL ?? '';
|
|
|
37
37
|
// Consume-side OTEL override (DATALAYER_OTEL_IN_URL). When set, telemetry is
|
|
38
38
|
// read from here instead of VITE_OTEL_BASE_URL (e.g. prod during local dev).
|
|
39
39
|
const OTEL_IN_BASE_URL_ENV = import.meta.env.VITE_OTEL_IN_BASE_URL ?? '';
|
|
40
|
-
const
|
|
40
|
+
const OTEL_URL_ENV = import.meta.env.VITE_DATALAYER_OTEL_URL ?? '';
|
|
41
41
|
const DEFAULT_AGENT_PROTOCOL = 'vercel-ai';
|
|
42
42
|
const DEFAULT_AGENT_LIBRARY = 'pydantic-ai';
|
|
43
43
|
/** Spec id this example always launches. */
|
|
@@ -138,9 +138,9 @@ const AgentOtelExampleInner = ({ token }) => {
|
|
|
138
138
|
const resolvedUrl = configuration?.otelInUrl ||
|
|
139
139
|
OTEL_IN_BASE_URL_ENV ||
|
|
140
140
|
configuration?.otelUrl ||
|
|
141
|
-
configuration?.
|
|
141
|
+
configuration?.otelUrl ||
|
|
142
142
|
OTEL_BASE_URL_ENV ||
|
|
143
|
-
|
|
143
|
+
OTEL_URL_ENV ||
|
|
144
144
|
agentBaseUrl;
|
|
145
145
|
const otelBaseUrl = resolvedUrl;
|
|
146
146
|
// ── OTEL view state ─────────────────────────────────────────────
|
|
@@ -32,7 +32,7 @@ const NotebookCollaborationExample = (props) => {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
// Create DatalayerServiceManager if we have credentials
|
|
35
|
-
if (configuration?.token && configuration?.
|
|
35
|
+
if (configuration?.token && configuration?.spacerUrl) {
|
|
36
36
|
try {
|
|
37
37
|
// Now we can pass undefined to use config/defaults
|
|
38
38
|
const manager = await createDatalayerServiceManager(configuration?.cpuEnvironment, configuration?.credits);
|
|
@@ -44,7 +44,7 @@ const NotebookCollaborationExample = (props) => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
console.warn('Datalayer credentials not configured. Please set
|
|
47
|
+
console.warn('Datalayer credentials not configured. Please set spacerUrl and token.');
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
createManager();
|
|
@@ -54,20 +54,20 @@ const NotebookCollaborationExample = (props) => {
|
|
|
54
54
|
if (!enableCollaboration) {
|
|
55
55
|
return undefined;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const spacerUrl = configuration?.spacerUrl;
|
|
58
58
|
const token = configuration?.token;
|
|
59
|
-
if (!
|
|
60
|
-
console.warn('Datalayer collaboration enabled but
|
|
59
|
+
if (!spacerUrl || !token) {
|
|
60
|
+
console.warn('Datalayer collaboration enabled but spacerUrl or token not configured. ' +
|
|
61
61
|
'Please configure them in the Datalayer store or environment.');
|
|
62
62
|
return undefined;
|
|
63
63
|
}
|
|
64
64
|
// Create and return the Datalayer collaboration provider
|
|
65
65
|
return new DatalayerCollaborationProvider({
|
|
66
|
-
|
|
66
|
+
spacerUrl,
|
|
67
67
|
token,
|
|
68
68
|
});
|
|
69
69
|
}, [enableCollaboration, configuration]);
|
|
70
|
-
return (_jsx(ThemedJupyterProvider, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "Notebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.
|
|
70
|
+
return (_jsx(ThemedJupyterProvider, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "Notebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.spacerUrl || !configuration?.token) && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'danger.subtle' }, children: "Warning: Datalayer configuration is missing. Please configure spacerUrl and token to use DatalayerServiceManager and collaboration features." })), !serviceManager && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'attention.subtle' }, children: "Note: DatalayerServiceManager is not available. Notebook functionality will be limited." })), enableCollaboration ? (_jsxs(Box, { sx: {
|
|
71
71
|
display: 'flex',
|
|
72
72
|
gap: 2,
|
|
73
73
|
flexDirection: 'row',
|
|
@@ -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(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 (
|
|
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 (spacerUrl 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;
|
package/lib/examples/main.js
CHANGED
|
@@ -114,7 +114,7 @@ const withTokenQueryParam = (rawUrl, token) => {
|
|
|
114
114
|
};
|
|
115
115
|
const resolveRuntimesUrl = (configured) => {
|
|
116
116
|
const envRuntimeUrl = import.meta.env.VITE_DATALAYER_RUNTIMES_URL;
|
|
117
|
-
const envBaseUrl = import.meta.env.
|
|
117
|
+
const envBaseUrl = import.meta.env.VITE_DATALAYER_IAM_URL;
|
|
118
118
|
const candidate = configured || envRuntimeUrl || envBaseUrl;
|
|
119
119
|
if (!candidate) {
|
|
120
120
|
return DEFAULT_RUNTIMES_URL;
|
|
@@ -193,7 +193,7 @@ const loadConfigurations = () => {
|
|
|
193
193
|
datalayerConfig.token = envToken;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
if (datalayerConfig.
|
|
196
|
+
if (datalayerConfig.iamUrl) {
|
|
197
197
|
datalayerConfig.runtimesUrl = resolveRuntimesUrl(datalayerConfig.runtimesUrl);
|
|
198
198
|
coreStore.getState().setConfiguration(datalayerConfig);
|
|
199
199
|
// Also set the token in the IAM store for API authentication
|
|
@@ -466,12 +466,12 @@ const NotebookOnlyApp = () => {
|
|
|
466
466
|
const initializeApp = async () => {
|
|
467
467
|
try {
|
|
468
468
|
const { configuration } = coreStore.getState();
|
|
469
|
-
// Always try to create collaboration provider if we have token and
|
|
470
|
-
if (configuration?.token && configuration?.
|
|
469
|
+
// Always try to create collaboration provider if we have token and spacerUrl
|
|
470
|
+
if (configuration?.token && configuration?.spacerUrl) {
|
|
471
471
|
try {
|
|
472
472
|
const { DatalayerCollaborationProvider } = await import('../collaboration/DatalayerCollaborationProvider');
|
|
473
473
|
const provider = new DatalayerCollaborationProvider({
|
|
474
|
-
|
|
474
|
+
spacerUrl: configuration.spacerUrl,
|
|
475
475
|
token: configuration.token,
|
|
476
476
|
});
|
|
477
477
|
setCollaborationProvider(provider);
|
|
@@ -31,7 +31,7 @@ const DatalayerNotebookExample = (props) => {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
// Create DatalayerServiceManager if we have credentials
|
|
34
|
-
if (configuration?.token && configuration?.
|
|
34
|
+
if (configuration?.token && configuration?.spacerUrl) {
|
|
35
35
|
try {
|
|
36
36
|
// Now we can pass undefined to use config/defaults
|
|
37
37
|
const manager = await createDatalayerServiceManager(configuration?.cpuEnvironment, configuration?.credits);
|
|
@@ -43,7 +43,7 @@ const DatalayerNotebookExample = (props) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
console.warn('Datalayer credentials not configured. Please set
|
|
46
|
+
console.warn('Datalayer credentials not configured. Please set spacerUrl and token.');
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
createManager();
|
|
@@ -53,20 +53,20 @@ const DatalayerNotebookExample = (props) => {
|
|
|
53
53
|
if (!enableCollaboration) {
|
|
54
54
|
return undefined;
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const spacerUrl = configuration?.spacerUrl;
|
|
57
57
|
const token = configuration?.token;
|
|
58
|
-
if (!
|
|
59
|
-
console.warn('Datalayer collaboration enabled but
|
|
58
|
+
if (!spacerUrl || !token) {
|
|
59
|
+
console.warn('Datalayer collaboration enabled but spacerUrl or token not configured. ' +
|
|
60
60
|
'Please configure them in the Datalayer store or environment.');
|
|
61
61
|
return undefined;
|
|
62
62
|
}
|
|
63
63
|
// Create and return the Datalayer collaboration provider
|
|
64
64
|
return new DatalayerCollaborationProvider({
|
|
65
|
-
|
|
65
|
+
spacerUrl,
|
|
66
66
|
token,
|
|
67
67
|
});
|
|
68
68
|
}, [enableCollaboration, configuration]);
|
|
69
|
-
return (_jsx(JupyterReactTheme, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "Datalayer Notebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.
|
|
69
|
+
return (_jsx(JupyterReactTheme, { children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h2", sx: { mb: 3 }, children: "Datalayer Notebook Collaboration Example" }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: enableCollaboration, onChange: e => setEnableCollaboration(e.target.checked) }), _jsx(FormControl.Label, { children: "Enable Datalayer Collaboration" })] }) }), (!configuration?.spacerUrl || !configuration?.token) && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'danger.subtle' }, children: "Warning: Datalayer configuration is missing. Please configure spacerUrl and token to use DatalayerServiceManager and collaboration features." })), !serviceManager && (_jsx(Box, { sx: { mb: 2, p: 2, bg: 'attention.subtle' }, children: "Note: DatalayerServiceManager is not available. Notebook functionality will be limited." })), enableCollaboration ? (_jsxs(Box, { sx: {
|
|
70
70
|
display: 'flex',
|
|
71
71
|
gap: 2,
|
|
72
72
|
flexDirection: 'row',
|
|
@@ -104,6 +104,6 @@ const DatalayerNotebookExample = (props) => {
|
|
|
104
104
|
border: '1px solid',
|
|
105
105
|
borderColor: 'border.default',
|
|
106
106
|
borderRadius: 2,
|
|
107
|
-
}, 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 (
|
|
107
|
+
}, 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 (spacerUrl 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" })] })] })] }) }));
|
|
108
108
|
};
|
|
109
109
|
export default DatalayerNotebookExample;
|
package/lib/examples2/main.js
CHANGED
|
@@ -19,7 +19,7 @@ const DEFAULT_LOCAL_JUPYTER_SERVER_URL = 'http://0.0.0.0:8888/api/jupyter-server
|
|
|
19
19
|
const DEFAULT_LOCAL_JUPYTER_SERVER_TOKEN = '60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6';
|
|
20
20
|
const resolveRuntimesUrl = (configured) => {
|
|
21
21
|
const envRuntimeUrl = import.meta.env.VITE_DATALAYER_RUNTIMES_URL;
|
|
22
|
-
const envBaseUrl = import.meta.env.
|
|
22
|
+
const envBaseUrl = import.meta.env.VITE_DATALAYER_IAM_URL;
|
|
23
23
|
const candidate = configured || envRuntimeUrl || envBaseUrl;
|
|
24
24
|
if (!candidate) {
|
|
25
25
|
return DEFAULT_RUNTIMES_URL;
|
|
@@ -72,7 +72,7 @@ const loadConfigurations = () => {
|
|
|
72
72
|
datalayerConfig.token = envToken;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
if (datalayerConfig.
|
|
75
|
+
if (datalayerConfig.iamUrl) {
|
|
76
76
|
datalayerConfig.runtimesUrl = resolveRuntimesUrl(datalayerConfig.runtimesUrl);
|
|
77
77
|
coreStore.getState().setConfiguration(datalayerConfig);
|
|
78
78
|
// Also set the token in the IAM store for API authentication
|
|
@@ -154,12 +154,12 @@ const NotebookOnlyApp = () => {
|
|
|
154
154
|
const initializeApp = async () => {
|
|
155
155
|
try {
|
|
156
156
|
const { configuration } = coreStore.getState();
|
|
157
|
-
// Always try to create collaboration provider if we have token and
|
|
158
|
-
if (configuration?.token && configuration?.
|
|
157
|
+
// Always try to create collaboration provider if we have token and spacerUrl
|
|
158
|
+
if (configuration?.token && configuration?.spacerUrl) {
|
|
159
159
|
try {
|
|
160
160
|
const { DatalayerCollaborationProvider } = await import('../collaboration/DatalayerCollaborationProvider');
|
|
161
161
|
const provider = new DatalayerCollaborationProvider({
|
|
162
|
-
|
|
162
|
+
spacerUrl: configuration.spacerUrl,
|
|
163
163
|
token: configuration.token,
|
|
164
164
|
});
|
|
165
165
|
console.warn('[NotebookOnlyApp] Created collaboration provider:', provider);
|
|
@@ -395,12 +395,12 @@ export function useAgentRuntimes(options = {}) {
|
|
|
395
395
|
const { iamStore, coreStore } = await import('@datalayer/core/lib/state');
|
|
396
396
|
const token = iamStore.getState().token || '';
|
|
397
397
|
const config = coreStore.getState().configuration;
|
|
398
|
-
const
|
|
398
|
+
const aiAgentsUrl = config?.aiAgentsUrl || '';
|
|
399
399
|
const runtimesUrl = resolvedRuntimeCreationBaseUrl;
|
|
400
|
-
return { token,
|
|
400
|
+
return { token, aiAgentsUrl, runtimesUrl };
|
|
401
401
|
}
|
|
402
402
|
catch {
|
|
403
|
-
return { token: '',
|
|
403
|
+
return { token: '', aiAgentsUrl: '', runtimesUrl: '' };
|
|
404
404
|
}
|
|
405
405
|
}, [resolvedRuntimeCreationBaseUrl]);
|
|
406
406
|
// ─── Launch Runtime ─────────────────────────────────────────────────
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface OtelQueryOptions {
|
|
2
2
|
metric: string;
|
|
3
3
|
serviceName?: string;
|
|
4
|
-
|
|
4
|
+
otelUrl?: string;
|
|
5
5
|
apiKey?: string;
|
|
6
6
|
limit?: number;
|
|
7
7
|
accountUid?: string;
|
|
@@ -12,15 +12,15 @@ interface MetricValueRow {
|
|
|
12
12
|
value_int?: unknown;
|
|
13
13
|
}
|
|
14
14
|
export declare function toMetricValue(row: MetricValueRow): number;
|
|
15
|
-
export declare function fetchOtelMetricRows({ metric, serviceName,
|
|
15
|
+
export declare function fetchOtelMetricRows({ metric, serviceName, otelUrl, apiKey, limit, accountUid, }: OtelQueryOptions): Promise<MetricValueRow[]>;
|
|
16
16
|
export declare function fetchOtelMetricTotal(options: OtelQueryOptions): Promise<number>;
|
|
17
17
|
export interface OtelTotalTokensOptions {
|
|
18
18
|
serviceName?: string;
|
|
19
|
-
|
|
19
|
+
otelUrl?: string;
|
|
20
20
|
apiKey?: string;
|
|
21
21
|
limit?: number;
|
|
22
22
|
accountUid?: string;
|
|
23
23
|
}
|
|
24
|
-
export declare function fetchOtelTotalTokens({ serviceName,
|
|
25
|
-
export declare function useOtelTotalTokens({ serviceName,
|
|
24
|
+
export declare function fetchOtelTotalTokens({ serviceName, otelUrl, apiKey, limit, accountUid, }: OtelTotalTokensOptions): Promise<number>;
|
|
25
|
+
export declare function useOtelTotalTokens({ serviceName, otelUrl, apiKey, limit, accountUid, }: OtelTotalTokensOptions): string;
|
|
26
26
|
export {};
|
|
@@ -24,12 +24,12 @@ export function toMetricValue(row) {
|
|
|
24
24
|
}
|
|
25
25
|
return 0;
|
|
26
26
|
}
|
|
27
|
-
export async function fetchOtelMetricRows({ metric, serviceName,
|
|
28
|
-
if (!
|
|
27
|
+
export async function fetchOtelMetricRows({ metric, serviceName, otelUrl, apiKey, limit = 500, accountUid, }) {
|
|
28
|
+
if (!otelUrl || !apiKey) {
|
|
29
29
|
return [];
|
|
30
30
|
}
|
|
31
31
|
const client = createOtelClient({
|
|
32
|
-
baseUrl:
|
|
32
|
+
baseUrl: otelUrl,
|
|
33
33
|
token: apiKey,
|
|
34
34
|
});
|
|
35
35
|
const filtered = await client.fetchMetrics({
|
|
@@ -52,11 +52,11 @@ export async function fetchOtelMetricTotal(options) {
|
|
|
52
52
|
const rows = await fetchOtelMetricRows(options);
|
|
53
53
|
return rows.reduce((sum, row) => sum + toMetricValue(row), 0);
|
|
54
54
|
}
|
|
55
|
-
export async function fetchOtelTotalTokens({ serviceName,
|
|
55
|
+
export async function fetchOtelTotalTokens({ serviceName, otelUrl, apiKey, limit = 500, accountUid, }) {
|
|
56
56
|
const total = await fetchOtelMetricTotal({
|
|
57
57
|
metric: 'agent_runtimes.prompt.turn.total_tokens',
|
|
58
58
|
serviceName,
|
|
59
|
-
|
|
59
|
+
otelUrl,
|
|
60
60
|
apiKey,
|
|
61
61
|
limit,
|
|
62
62
|
accountUid,
|
|
@@ -67,7 +67,7 @@ export async function fetchOtelTotalTokens({ serviceName, datalayerUrl, apiKey,
|
|
|
67
67
|
const prompt = await fetchOtelMetricTotal({
|
|
68
68
|
metric: 'agent_runtimes.prompt.turn.prompt_tokens',
|
|
69
69
|
serviceName,
|
|
70
|
-
|
|
70
|
+
otelUrl,
|
|
71
71
|
apiKey,
|
|
72
72
|
limit,
|
|
73
73
|
accountUid,
|
|
@@ -75,14 +75,14 @@ export async function fetchOtelTotalTokens({ serviceName, datalayerUrl, apiKey,
|
|
|
75
75
|
const completion = await fetchOtelMetricTotal({
|
|
76
76
|
metric: 'agent_runtimes.prompt.turn.completion_tokens',
|
|
77
77
|
serviceName,
|
|
78
|
-
|
|
78
|
+
otelUrl,
|
|
79
79
|
apiKey,
|
|
80
80
|
limit,
|
|
81
81
|
accountUid,
|
|
82
82
|
});
|
|
83
83
|
return prompt + completion;
|
|
84
84
|
}
|
|
85
|
-
export function useOtelTotalTokens({ serviceName,
|
|
85
|
+
export function useOtelTotalTokens({ serviceName, otelUrl, apiKey, limit = 500, accountUid, }) {
|
|
86
86
|
const [tokensLabel, setTokensLabel] = useState('-');
|
|
87
87
|
useEffect(() => {
|
|
88
88
|
let cancelled = false;
|
|
@@ -90,7 +90,7 @@ export function useOtelTotalTokens({ serviceName, datalayerUrl, apiKey, limit =
|
|
|
90
90
|
try {
|
|
91
91
|
const total = await fetchOtelTotalTokens({
|
|
92
92
|
serviceName,
|
|
93
|
-
|
|
93
|
+
otelUrl,
|
|
94
94
|
apiKey,
|
|
95
95
|
limit,
|
|
96
96
|
accountUid,
|
|
@@ -115,6 +115,6 @@ export function useOtelTotalTokens({ serviceName, datalayerUrl, apiKey, limit =
|
|
|
115
115
|
return () => {
|
|
116
116
|
cancelled = true;
|
|
117
117
|
};
|
|
118
|
-
}, [apiKey, limit,
|
|
118
|
+
}, [apiKey, limit, otelUrl, serviceName, accountUid]);
|
|
119
119
|
return tokensLabel;
|
|
120
120
|
}
|
|
@@ -539,6 +539,8 @@ export class AGUIAdapter extends BaseProtocolAdapter {
|
|
|
539
539
|
toolCallId,
|
|
540
540
|
toolName,
|
|
541
541
|
args: {},
|
|
542
|
+
// TOOL_CALL_START: the args stream in afterwards.
|
|
543
|
+
argsComplete: false,
|
|
542
544
|
},
|
|
543
545
|
timestamp: new Date(),
|
|
544
546
|
});
|
|
@@ -582,6 +584,8 @@ export class AGUIAdapter extends BaseProtocolAdapter {
|
|
|
582
584
|
toolCallId: pending.toolCallId,
|
|
583
585
|
toolName: pending.toolName,
|
|
584
586
|
args: parsedArgs,
|
|
587
|
+
// TOOL_CALL_END: this is the full argument set.
|
|
588
|
+
argsComplete: true,
|
|
585
589
|
},
|
|
586
590
|
timestamp: new Date(),
|
|
587
591
|
});
|
|
@@ -485,6 +485,9 @@ export class VercelAIAdapter extends BaseProtocolAdapter {
|
|
|
485
485
|
toolCallId,
|
|
486
486
|
toolName,
|
|
487
487
|
args,
|
|
488
|
+
// `tool-input-available` carries the final input:
|
|
489
|
+
// empty args are an answer, not a promise of more.
|
|
490
|
+
argsComplete: true,
|
|
488
491
|
},
|
|
489
492
|
timestamp: new Date(),
|
|
490
493
|
});
|
package/lib/types/chat.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module types/chat
|
|
5
5
|
*/
|
|
6
|
+
import type { ToolbarItem } from '@datalayer/primer-addons';
|
|
6
7
|
import type { ComponentType, ReactNode } from 'react';
|
|
7
8
|
import type { ICollaborationProvider } from '@datalayer/jupyter-react';
|
|
8
9
|
import type { ChatMessage, MessageHandler } from './messages';
|
|
@@ -369,6 +370,17 @@ export interface ChatCommonProps {
|
|
|
369
370
|
* Defaults to the toolbar from `@datalayer/jupyter-react` when omitted.
|
|
370
371
|
*/
|
|
371
372
|
ephemeralNotebookToolbar?: EphemeralNotebookToolbarComponent;
|
|
373
|
+
/**
|
|
374
|
+
* Items added to the toolbar of the ephemeral notebook, e.g. the status of
|
|
375
|
+
* the sandbox it runs on. Merged with the items of the toolbar and ordered
|
|
376
|
+
* by the `order` of each item.
|
|
377
|
+
*/
|
|
378
|
+
ephemeralNotebookToolbarExtraItems?: ToolbarItem[];
|
|
379
|
+
/**
|
|
380
|
+
* Items added to the toolbar of the ephemeral document, the same way as
|
|
381
|
+
* {@link ChatProps.ephemeralNotebookToolbarExtraItems} for the notebook.
|
|
382
|
+
*/
|
|
383
|
+
ephemeralDocumentToolbarExtraItems?: ToolbarItem[];
|
|
372
384
|
/**
|
|
373
385
|
* Optional real-time collaboration provider for the ephemeral notebook.
|
|
374
386
|
* When supplied, the notebook joins a shared collaborative room so its state
|
|
@@ -801,6 +813,17 @@ export interface ChatBaseProps {
|
|
|
801
813
|
* Defaults to the toolbar from `@datalayer/jupyter-react` when omitted.
|
|
802
814
|
*/
|
|
803
815
|
ephemeralNotebookToolbar?: EphemeralNotebookToolbarComponent;
|
|
816
|
+
/**
|
|
817
|
+
* Items added to the toolbar of the ephemeral notebook, e.g. the status of
|
|
818
|
+
* the sandbox it runs on. Merged with the items of the toolbar and ordered
|
|
819
|
+
* by the `order` of each item.
|
|
820
|
+
*/
|
|
821
|
+
ephemeralNotebookToolbarExtraItems?: ToolbarItem[];
|
|
822
|
+
/**
|
|
823
|
+
* Items added to the toolbar of the ephemeral document, the same way as
|
|
824
|
+
* {@link ChatProps.ephemeralNotebookToolbarExtraItems} for the notebook.
|
|
825
|
+
*/
|
|
826
|
+
ephemeralDocumentToolbarExtraItems?: ToolbarItem[];
|
|
804
827
|
/**
|
|
805
828
|
* Optional real-time collaboration provider for the ephemeral notebook.
|
|
806
829
|
* When supplied, the notebook joins a shared collaborative room so its state
|
package/lib/types/tools.d.ts
CHANGED
|
@@ -192,6 +192,17 @@ export interface ToolCallRequest {
|
|
|
192
192
|
toolCallId: string;
|
|
193
193
|
toolName: string;
|
|
194
194
|
args: Record<string, unknown>;
|
|
195
|
+
/**
|
|
196
|
+
* Whether `args` is the complete argument set.
|
|
197
|
+
*
|
|
198
|
+
* Protocols that stream arguments (AG-UI) emit a first tool-call with
|
|
199
|
+
* `{}` and the real args later — those mark `false`, and execution waits.
|
|
200
|
+
* Protocols whose tool-call event is terminal (Vercel) mark `true`: an
|
|
201
|
+
* empty `args` there means the model chose to pass nothing, which is
|
|
202
|
+
* legal for a tool whose parameters are all optional — waiting on more
|
|
203
|
+
* would wait forever. Absent, the executor falls back to heuristics.
|
|
204
|
+
*/
|
|
205
|
+
argsComplete?: boolean;
|
|
195
206
|
}
|
|
196
207
|
/**
|
|
197
208
|
* Tool registry entry (internal)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"examples:fresh": "npm run clean:cache && npm run examples",
|
|
74
74
|
"examples:jupyter": "run-p jupyter:start server:start server:start:codemode examples:vite",
|
|
75
75
|
"examples:nextjs": "npm run dev --workspace=nextjs-notebook-example",
|
|
76
|
-
"examples:vite": "
|
|
77
|
-
"examples2:vite": "
|
|
76
|
+
"examples:vite": "VITE_DATALAYER_RUNTIMES_URL=${VITE_DATALAYER_RUNTIMES_URL:-https://r1.datalayer.run} VITE_DATALAYER_AGENT_RUNTIMES_URL=${VITE_DATALAYER_AGENT_RUNTIMES_URL:-https://r1.datalayer.run} VITE_APP_TARGET=examples vite",
|
|
77
|
+
"examples2:vite": "VITE_DATALAYER_RUNTIMES_URL=${VITE_DATALAYER_RUNTIMES_URL:-https://r1.datalayer.run} VITE_DATALAYER_AGENT_RUNTIMES_URL=${VITE_DATALAYER_AGENT_RUNTIMES_URL:-https://r1.datalayer.run} VITE_APP_TARGET=examples2 vite",
|
|
78
78
|
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,json,md}\" \"examples/**/*.{js,jsx,ts,tsx,css,json,md,mjs}\"",
|
|
79
79
|
"format:all": "npm run format && npm run format --workspaces --if-present",
|
|
80
80
|
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,json,md}\" \"examples/**/*.{js,jsx,ts,tsx,css,json,md,mjs}\"",
|
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { Button } from '@primer/react';
|
|
7
|
-
import { Box } from '@datalayer/primer-addons';
|
|
8
|
-
import { RepoPushIcon } from '@primer/octicons-react';
|
|
9
|
-
// import { PlayIcon, StopIcon } from '@primer/octicons-react';
|
|
10
|
-
// import { notebookStore } from '@datalayer/jupyter-react';
|
|
11
|
-
import { useGradeStore } from '../../state/substates';
|
|
12
|
-
export const AssignmentEditorToolbar = (props) => {
|
|
13
|
-
// const { notebookId } = props;
|
|
14
|
-
// const notebook = notebookStore.getState().selectNotebook(notebookId);
|
|
15
|
-
const { grade } = useGradeStore();
|
|
16
|
-
return (_jsx(Box, { display: "flex", children: _jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }) }));
|
|
17
|
-
};
|
|
18
|
-
export default AssignmentEditorToolbar;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { Button, Box } from '@primer/react';
|
|
7
|
-
import { RepoPushIcon } from '@primer/octicons-react';
|
|
8
|
-
import { documentStore } from '../../state/substates';
|
|
9
|
-
export const DocumentEditorToolbar = () => {
|
|
10
|
-
return (_jsx(Box, { display: "flex", children: _jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => documentStore.getState().save(new Date()), children: "Save" }) }) }));
|
|
11
|
-
};
|
|
12
|
-
export default DocumentEditorToolbar;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Session } from '@jupyterlab/services';
|
|
2
|
-
import { CommandRegistry } from '@lumino/commands';
|
|
3
|
-
import type { IRuntimeDesc } from '../../models';
|
|
4
|
-
/**
|
|
5
|
-
* NotebookEditorToolbar component properties
|
|
6
|
-
*/
|
|
7
|
-
export type INotebookEditorToolbar = {
|
|
8
|
-
/**
|
|
9
|
-
* Jupyter commands registry
|
|
10
|
-
*/
|
|
11
|
-
commandRegistry?: CommandRegistry;
|
|
12
|
-
/**
|
|
13
|
-
* Kernel description
|
|
14
|
-
*/
|
|
15
|
-
runtimeDesc?: IRuntimeDesc;
|
|
16
|
-
/**
|
|
17
|
-
* Callback to save the notebook model
|
|
18
|
-
*/
|
|
19
|
-
save: () => void;
|
|
20
|
-
/**
|
|
21
|
-
* Session connection
|
|
22
|
-
*/
|
|
23
|
-
sessionConnection?: Session.ISessionConnection;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Notebook editor toolbar
|
|
27
|
-
*/
|
|
28
|
-
export declare function NotebookEditorToolbar(props: INotebookEditorToolbar): JSX.Element;
|
|
29
|
-
export default NotebookEditorToolbar;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { NotebookCommandIds } from '@datalayer/jupyter-react';
|
|
7
|
-
import { Button } from '@primer/react';
|
|
8
|
-
import { PlayIcon, StopIcon } from '@primer/octicons-react';
|
|
9
|
-
import { useEffect, useState } from 'react';
|
|
10
|
-
/**
|
|
11
|
-
* Notebook editor toolbar
|
|
12
|
-
*/
|
|
13
|
-
export function NotebookEditorToolbar(props) {
|
|
14
|
-
const { commandRegistry, runtimeDesc, sessionConnection } = props;
|
|
15
|
-
const [kernelStatus, setKernelStatus] = useState();
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const onStatusChanged = () => {
|
|
18
|
-
setKernelStatus(sessionConnection?.kernel?.status);
|
|
19
|
-
};
|
|
20
|
-
onStatusChanged();
|
|
21
|
-
sessionConnection?.statusChanged.connect(onStatusChanged);
|
|
22
|
-
sessionConnection?.connectionStatusChanged.connect(onStatusChanged);
|
|
23
|
-
return () => {
|
|
24
|
-
sessionConnection?.statusChanged.disconnect(onStatusChanged);
|
|
25
|
-
sessionConnection?.connectionStatusChanged.disconnect(onStatusChanged);
|
|
26
|
-
};
|
|
27
|
-
}, [sessionConnection]);
|
|
28
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, disabled: !runtimeDesc?.location || kernelStatus === 'busy', onClick: (e) => commandRegistry?.execute(NotebookCommandIds.runAll), children: "Run all" }), _jsx(Button, { variant: "invisible", size: "small", leadingVisual: StopIcon, disabled: !runtimeDesc?.location || kernelStatus !== 'busy', onClick: (e) => commandRegistry?.execute(NotebookCommandIds.interrupt), children: "Interrupt" })] }));
|
|
29
|
-
}
|
|
30
|
-
export default NotebookEditorToolbar;
|