@datalayer/agent-runtimes 1.0.21 → 1.0.26
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/agents/index.d.ts +6 -0
- package/lib/components/{students → agents}/index.js +6 -1
- package/lib/components/{NotificationEventCard.js → cards/NotificationEventCard.js} +1 -1
- package/lib/components/{OutputCard.js → cards/OutputCard.js} +1 -1
- package/lib/components/cards/index.d.ts +9 -0
- package/lib/components/cards/index.js +13 -0
- package/lib/components/{runtimes/RuntimeCellVariables.d.ts → code-sandboxes/CodeSandboxCellVariables.d.ts} +3 -3
- package/lib/components/{runtimes/RuntimeCellVariables.js → code-sandboxes/CodeSandboxCellVariables.js} +2 -2
- package/lib/components/{runtimes/RuntimeCellVariablesDialog.d.ts → code-sandboxes/CodeSandboxCellVariablesDialog.d.ts} +4 -4
- package/lib/components/{runtimes/RuntimeCellVariablesDialog.js → code-sandboxes/CodeSandboxCellVariablesDialog.js} +4 -4
- package/lib/components/{runtimes/RuntimeLauncherDialog.d.ts → code-sandboxes/CodeSandboxLauncher.d.ts} +4 -4
- package/lib/components/{runtimes/RuntimeLauncherDialog.js → code-sandboxes/CodeSandboxLauncher.js} +33 -38
- package/lib/components/code-sandboxes/CodeSandboxPicker.d.ts +96 -0
- package/lib/components/code-sandboxes/CodeSandboxPicker.js +296 -0
- package/lib/components/{runtimes/RuntimePickerCell.d.ts → code-sandboxes/CodeSandboxPickerCell.d.ts} +5 -5
- package/lib/components/{runtimes/RuntimePickerCell.js → code-sandboxes/CodeSandboxPickerCell.js} +7 -7
- package/lib/components/{runtimes/RuntimeReservationControl.d.ts → code-sandboxes/CodeSandboxReservationControl.d.ts} +3 -3
- package/lib/components/{runtimes/RuntimeReservationControl.js → code-sandboxes/CodeSandboxReservationControl.js} +11 -4
- package/lib/components/{runtimes/RuntimeTransfer.d.ts → code-sandboxes/CodeSandboxTransfer.d.ts} +1 -1
- package/lib/components/{runtimes/RuntimeUtils.d.ts → code-sandboxes/CodeSandboxUtils.d.ts} +3 -3
- package/lib/components/{runtimes/RuntimeUtils.js → code-sandboxes/CodeSandboxUtils.js} +35 -19
- package/lib/components/code-sandboxes/CodeSandboxVariables.d.ts +71 -0
- package/lib/components/{runtimes/RuntimeVariables.js → code-sandboxes/CodeSandboxVariables.js} +77 -2
- 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 +21 -0
- package/lib/components/code-sandboxes/index.js +25 -0
- package/lib/components/index.d.ts +4 -6
- package/lib/components/index.js +4 -6
- package/lib/components/progress/CreditsIndicator.d.ts +7 -0
- package/lib/components/progress/CreditsIndicator.js +3 -3
- 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 +4 -4
- package/lib/components/runtimes/RuntimePickerBase.d.ts +0 -69
- package/lib/components/runtimes/RuntimePickerBase.js +0 -157
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +0 -42
- package/lib/components/runtimes/RuntimePickerNotebook.js +0 -232
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +0 -38
- package/lib/components/runtimes/RuntimeSimplePicker.js +0 -156
- package/lib/components/runtimes/RuntimeVariables.d.ts +0 -38
- package/lib/components/runtimes/index.d.ts +0 -11
- package/lib/components/runtimes/index.js +0 -15
- package/lib/components/students/StudentItemStatus.d.ts +0 -7
- package/lib/components/students/StudentItemStatus.js +0 -68
- package/lib/components/students/index.d.ts +0 -1
- 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
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- /package/lib/components/{AgentSummary.d.ts → agents/AgentSummary.d.ts} +0 -0
- /package/lib/components/{AgentSummary.js → agents/AgentSummary.js} +0 -0
- /package/lib/components/{NotificationEventCard.d.ts → cards/NotificationEventCard.d.ts} +0 -0
- /package/lib/components/{OutputCard.d.ts → cards/OutputCard.d.ts} +0 -0
- /package/lib/components/{ToolApprovalCard.d.ts → cards/ToolApprovalCard.d.ts} +0 -0
- /package/lib/components/{ToolApprovalCard.js → cards/ToolApprovalCard.js} +0 -0
- /package/lib/components/{runtimes/RuntimeTransfer.js → code-sandboxes/CodeSandboxTransfer.js} +0 -0
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.26",
|
|
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}\"",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"@agentclientprotocol/sdk": "^0.8.0",
|
|
139
139
|
"@ai-sdk/react": "4.0.23",
|
|
140
140
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
141
|
-
"@datalayer/core": "^1.1.
|
|
141
|
+
"@datalayer/core": "^1.1.57",
|
|
142
142
|
"@datalayer/icons-react": "^1.0.7",
|
|
143
143
|
"@datalayer/jupyter-lexical": "^1.0.16",
|
|
144
144
|
"@datalayer/lexical-loro": "^1.0.0",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ISessionContext } from '@jupyterlab/apputils';
|
|
3
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
4
|
-
import { IRuntimeDesc } from '../../models';
|
|
5
|
-
import { IMultiServiceManager } from '../../runtimes';
|
|
6
|
-
type IDisplayMode = 'menu' | 'radio';
|
|
7
|
-
/**
|
|
8
|
-
* {@link RuntimePickerBase} properties
|
|
9
|
-
*/
|
|
10
|
-
export interface IRuntimePickerBaseProps {
|
|
11
|
-
/**
|
|
12
|
-
* The display mode.
|
|
13
|
-
*/
|
|
14
|
-
display: IDisplayMode;
|
|
15
|
-
/**
|
|
16
|
-
* Additional actions items to be placed at the top of the picker
|
|
17
|
-
*/
|
|
18
|
-
preActions?: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Additional actions items to be placed at the bottom of the picker
|
|
21
|
-
*/
|
|
22
|
-
postActions?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the picker is disabled or not.
|
|
25
|
-
*/
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Runtime description passing this filter function will be displayed.
|
|
29
|
-
*/
|
|
30
|
-
filterRuntime?: (desc: IRuntimeDesc) => boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Session preference.
|
|
33
|
-
*/
|
|
34
|
-
preference?: {
|
|
35
|
-
id?: string;
|
|
36
|
-
kernelDisplayName?: string;
|
|
37
|
-
language?: string;
|
|
38
|
-
location?: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Runtime description.
|
|
42
|
-
*/
|
|
43
|
-
runtimeDesc?: IRuntimeDesc;
|
|
44
|
-
/**
|
|
45
|
-
* Set runtime description.
|
|
46
|
-
*/
|
|
47
|
-
setRuntimeDesc: (desc?: IRuntimeDesc) => void;
|
|
48
|
-
/**
|
|
49
|
-
* Document session context.
|
|
50
|
-
*/
|
|
51
|
-
sessionContext?: ISessionContext;
|
|
52
|
-
/**
|
|
53
|
-
* Application service manager
|
|
54
|
-
*/
|
|
55
|
-
multiServiceManager: IMultiServiceManager;
|
|
56
|
-
/**
|
|
57
|
-
* Application translator.
|
|
58
|
-
*/
|
|
59
|
-
translator?: ITranslator;
|
|
60
|
-
/**
|
|
61
|
-
* Change the look depending on the menu integration.
|
|
62
|
-
*/
|
|
63
|
-
variant?: 'document' | 'cell';
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Base Kernel Picker component.
|
|
67
|
-
*/
|
|
68
|
-
export declare function RuntimePickerBase(props: IRuntimePickerBaseProps): ReactElement;
|
|
69
|
-
export default RuntimePickerBase;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { useEffect, useMemo, useState } from 'react';
|
|
7
|
-
import { nullTranslator } from '@jupyterlab/translation';
|
|
8
|
-
//import { kernelIcon } from '@jupyterlab/ui-components';
|
|
9
|
-
import { ActionList, ActionMenu, IconButton, Text, RadioGroup, Radio, FormControl, LabelGroup, Label, } from '@primer/react';
|
|
10
|
-
import CloudUploadIcon from '@datalayer/icons-react/data1/CloudUploadIcon';
|
|
11
|
-
import { Box } from '@datalayer/primer-addons';
|
|
12
|
-
import { CpuIcon } from '@primer/octicons-react';
|
|
13
|
-
import { BrowserIcon, LaptopSimpleIcon } from '@datalayer/icons-react';
|
|
14
|
-
import { CreditsIndicator } from '../../components/progress';
|
|
15
|
-
import { isRuntimeRemote } from '../../runtimes';
|
|
16
|
-
import { getGroupedRuntimeDescs } from './RuntimeUtils';
|
|
17
|
-
/**
|
|
18
|
-
* Maximal runtime display name length after which it is trimmed.
|
|
19
|
-
*/
|
|
20
|
-
const RUNTIME_DISPLAY_NAME_MAX_LENGTH = 25;
|
|
21
|
-
/**
|
|
22
|
-
* Base Kernel Picker component.
|
|
23
|
-
*/
|
|
24
|
-
export function RuntimePickerBase(props) {
|
|
25
|
-
const { disabled, display, filterRuntime, multiServiceManager, postActions, preActions, preference, runtimeDesc, sessionContext, setRuntimeDesc, translator, variant, } = props;
|
|
26
|
-
const [groupedRuntimeDescs, setGroupedRuntimeDescs] = useState(getGroupedRuntimeDescs(multiServiceManager, preference?.id, translator, filterRuntime, variant));
|
|
27
|
-
const trans = useMemo(() => (translator ?? nullTranslator).load('jupyterlab'), [translator]);
|
|
28
|
-
const [defaultSet, setDefaultSet] = useState(false);
|
|
29
|
-
const [remoteModelsReady, setRemoteModelsReady] = useState(!multiServiceManager.remote);
|
|
30
|
-
// Trick because overflow is an unknown prop of ActionMenu.Overlay.
|
|
31
|
-
const overlayProps = {
|
|
32
|
-
maxHeight: 'large',
|
|
33
|
-
width: (variant === 'cell' ? 'small' : 'auto'),
|
|
34
|
-
};
|
|
35
|
-
useEffect(() => {
|
|
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]);
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (defaultSet) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (sessionContext && groupedRuntimeDescs) {
|
|
88
|
-
const kernelId = sessionContext.session?.kernel?.id;
|
|
89
|
-
if (kernelId) {
|
|
90
|
-
let matched = false;
|
|
91
|
-
Object.entries(groupedRuntimeDescs).forEach(([group, runtimeDescs]) => {
|
|
92
|
-
runtimeDescs.forEach(runtimeDesc => {
|
|
93
|
-
if (runtimeDesc.kernelId === kernelId) {
|
|
94
|
-
matched = true;
|
|
95
|
-
setRuntimeDesc(runtimeDesc);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
if (!matched && !remoteModelsReady) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
setDefaultSet(true);
|
|
105
|
-
}, [
|
|
106
|
-
defaultSet,
|
|
107
|
-
groupedRuntimeDescs,
|
|
108
|
-
remoteModelsReady,
|
|
109
|
-
sessionContext,
|
|
110
|
-
setRuntimeDesc,
|
|
111
|
-
]);
|
|
112
|
-
// For cell using submenu instead of group would be nice unfortunately the feature
|
|
113
|
-
// is not yet implemented in the component there has been a not-great demo story.
|
|
114
|
-
// https://github.com/primer/react/pull/3585
|
|
115
|
-
return (_jsx(_Fragment, { children: display === 'menu' ? (
|
|
116
|
-
/*
|
|
117
|
-
* Section for Menu display.
|
|
118
|
-
*/
|
|
119
|
-
_jsxs(ActionMenu, { children: [variant === 'cell' ? (_jsx(ActionMenu.Anchor, { children: _jsx(IconButton, { disabled: disabled || groupedRuntimeDescs === null,
|
|
120
|
-
// icon={() => <kernelIcon.react className="dla-Cell-runtime-icon" tag={'span'} />}
|
|
121
|
-
icon: () => (_jsx("span", { className: "dla-Cell-runtime-icon", children: _jsx(CpuIcon, {}) })), "aria-label": trans.__('Assign a Runtime to the Cell.'), title: trans.__('Assign a Runtime to the Cell.'), size: "small", variant: "invisible" }) })) : (_jsxs(ActionMenu.Button, { variant: "default", disabled: disabled || groupedRuntimeDescs === null, children: [_jsx(Text, { fontWeight: 'bold', children: trans.__('Runtime:') }), ' ' + (runtimeDesc?.displayName ?? trans.__('No Runtime'))] })), _jsx(ActionMenu.Overlay, { ...overlayProps, width: "medium", sx: { overflowY: 'auto' }, side: variant === 'cell' ? 'outside-left' : 'outside-right', children: _jsxs(ActionList, { selectionVariant: "single", children: [variant === 'cell' && (_jsxs(ActionList.Item, { selected: runtimeDesc === undefined, onSelect: () => {
|
|
122
|
-
setRuntimeDesc(undefined);
|
|
123
|
-
}, children: [preference?.location && (_jsx(ActionList.LeadingVisual, { children: preference.location === 'local' ? (_jsx(LaptopSimpleIcon, {})) : preference.location === 'browser' ? (_jsx(BrowserIcon, {})) : (_jsx(CloudUploadIcon, {})) })), trans.__('Assign the Notebook Runtime')] }, 'null')), !!preActions && preActions, Object.entries(groupedRuntimeDescs ?? {}).map(([group, runtimeDescs]) => (_jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: group }), runtimeDescs.map(candidateRuntimeDesc => {
|
|
124
|
-
const annotation = candidateRuntimeDesc.podName
|
|
125
|
-
? ` - ${candidateRuntimeDesc.podName.split('-', 2).reverse()[0]}`
|
|
126
|
-
: candidateRuntimeDesc.kernelId
|
|
127
|
-
? ` - ${candidateRuntimeDesc.kernelId}`
|
|
128
|
-
: '';
|
|
129
|
-
const fullDisplayName = (candidateRuntimeDesc.displayName ?? '') + annotation;
|
|
130
|
-
const displayName = (candidateRuntimeDesc.displayName?.length ?? 0) >
|
|
131
|
-
RUNTIME_DISPLAY_NAME_MAX_LENGTH
|
|
132
|
-
? candidateRuntimeDesc.displayName.slice(0, RUNTIME_DISPLAY_NAME_MAX_LENGTH) + '…'
|
|
133
|
-
: (candidateRuntimeDesc.displayName ?? '');
|
|
134
|
-
return (_jsxs(ActionList.Item, { title: fullDisplayName, selected: (candidateRuntimeDesc.location ===
|
|
135
|
-
runtimeDesc?.location ||
|
|
136
|
-
(isRuntimeRemote(candidateRuntimeDesc.location) &&
|
|
137
|
-
isRuntimeRemote(runtimeDesc?.location ?? 'local'))) &&
|
|
138
|
-
(candidateRuntimeDesc.kernelId ??
|
|
139
|
-
candidateRuntimeDesc.name) ===
|
|
140
|
-
(runtimeDesc?.kernelId ?? runtimeDesc?.name), onSelect: () => {
|
|
141
|
-
setRuntimeDesc(candidateRuntimeDesc);
|
|
142
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: candidateRuntimeDesc.location === 'local' ? (_jsx(LaptopSimpleIcon, {})) : candidateRuntimeDesc.location === 'browser' ? (_jsx(BrowserIcon, {})) : (_jsx(CloudUploadIcon, {})) }), displayName + annotation.slice(0, 10)] }, candidateRuntimeDesc.name));
|
|
143
|
-
})] }, group))), !!postActions && (_jsxs(_Fragment, { children: [_jsx(ActionList.Divider, {}), postActions] }))] }) })] })) : (
|
|
144
|
-
/*
|
|
145
|
-
* Section for Radio display.
|
|
146
|
-
*/
|
|
147
|
-
_jsxs(_Fragment, { children: [defaultSet && (_jsx(RadioGroup, { name: "kernel-options", "aria-labelledby": "kernel-options", children: Object.entries(groupedRuntimeDescs ?? {}).map(([group, runtimeDescs]) => (_jsxs(Box, { children: [_jsx(Box, { as: "h4", style: { marginTop: 0 }, children: group }), runtimeDescs.map(k => {
|
|
148
|
-
return (_jsxs(Box, { title: k.name, children: [_jsxs(FormControl, { children: [_jsx(Radio, { value: k.kernelId, onChange: () => {
|
|
149
|
-
setRuntimeDesc(k);
|
|
150
|
-
}, checked: (k.location === runtimeDesc?.location ||
|
|
151
|
-
(isRuntimeRemote(k.location) &&
|
|
152
|
-
isRuntimeRemote(runtimeDesc?.location ?? 'local'))) &&
|
|
153
|
-
(k.kernelId ?? k.name) ===
|
|
154
|
-
(runtimeDesc?.kernelId ?? runtimeDesc?.name) }), _jsx(FormControl.Label, { children: _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: k.displayName }), k.kernelId && k.location === 'remote' && (_jsx(Box, { ml: 3, mt: 1, children: _jsx(CreditsIndicator, { kernelId: k.kernelId, serviceManager: multiServiceManager.remote }, "credits-indicator") }))] }) }), _jsx(FormControl.Caption, { children: _jsxs(LabelGroup, { sx: { marginTop: 1 }, children: [_jsx(Label, { variant: "secondary", children: k.name }), _jsx(Label, { variant: "secondary", sx: { marginLeft: 1 }, children: k.location }), k.burningRate && (_jsxs(Label, { variant: "sponsors", sx: { marginLeft: 1 }, children: [k.burningRate, " credits/second"] })), k.gpu && (_jsx(Label, { variant: "success", sx: { marginLeft: 1 }, children: "GPU" }))] }) })] }), _jsx(ActionList.Divider, {})] }, k.kernelId));
|
|
155
|
-
})] }, group))) })), !!postActions && _jsx(_Fragment, { children: postActions })] })) }));
|
|
156
|
-
}
|
|
157
|
-
export default RuntimePickerBase;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
2
|
-
import { CommandRegistry } from '@lumino/commands';
|
|
3
|
-
import type { IMultiServiceManager, IDatalayerSessionContext } from '../../runtimes';
|
|
4
|
-
import { RuntimeTransfer } from './RuntimeTransfer';
|
|
5
|
-
/**
|
|
6
|
-
* {@link RuntimePickerNotebook} properties
|
|
7
|
-
*/
|
|
8
|
-
export interface IRuntimePickerNotebookProps {
|
|
9
|
-
/**
|
|
10
|
-
* Callback to allow the user to login
|
|
11
|
-
*/
|
|
12
|
-
logIn?: () => void;
|
|
13
|
-
/**
|
|
14
|
-
* Document session context
|
|
15
|
-
*/
|
|
16
|
-
sessionContext: IDatalayerSessionContext;
|
|
17
|
-
/**
|
|
18
|
-
* Multi service manager
|
|
19
|
-
*/
|
|
20
|
-
multiServiceManager: IMultiServiceManager;
|
|
21
|
-
/**
|
|
22
|
-
* Set the selected kernel
|
|
23
|
-
*/
|
|
24
|
-
setValue: (v: RuntimeTransfer | Error) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Close the dialog
|
|
27
|
-
*/
|
|
28
|
-
close: () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Command registry
|
|
31
|
-
*/
|
|
32
|
-
commands: CommandRegistry;
|
|
33
|
-
/**
|
|
34
|
-
* Application translator
|
|
35
|
-
*/
|
|
36
|
-
translator?: ITranslator;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Runtime Picker components for a Notebook.
|
|
40
|
-
*/
|
|
41
|
-
export declare function RuntimePickerNotebook(props: IRuntimePickerNotebookProps): JSX.Element;
|
|
42
|
-
export default RuntimePickerNotebook;
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, 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 { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import { ActionList, FormControl, ToggleSwitch, Tooltip, IconButton, } from '@primer/react';
|
|
8
|
-
import { Box } from '@datalayer/primer-addons';
|
|
9
|
-
import { AlertIcon } from '@primer/octicons-react';
|
|
10
|
-
import { JSONExt } from '@lumino/coreutils';
|
|
11
|
-
import { KernelExecutor } from '@datalayer/jupyter-react';
|
|
12
|
-
import { RuntimeSnippetsFacade } from '../../jupyter';
|
|
13
|
-
import { ExternalTokenSilentLogin } from '@datalayer/core/lib/components/iam';
|
|
14
|
-
import { useCoreStore, useIAMStore } from '../../state/substates';
|
|
15
|
-
import { RuntimeReservationControl, MAXIMAL_RUNTIME_TIME_RESERVATION_MINUTES, } from './RuntimeReservationControl';
|
|
16
|
-
import { RuntimeVariables } from './RuntimeVariables';
|
|
17
|
-
import { RuntimePickerBase } from './RuntimePickerBase';
|
|
18
|
-
/**
|
|
19
|
-
* Runtime Picker components for a Notebook.
|
|
20
|
-
*/
|
|
21
|
-
export function RuntimePickerNotebook(props) {
|
|
22
|
-
const { multiServiceManager, sessionContext, setValue, translator } = props;
|
|
23
|
-
const { configuration } = useCoreStore();
|
|
24
|
-
const { credits, refreshCredits, token, user } = useIAMStore();
|
|
25
|
-
const [selectedRuntimeDesc, setSelectedRuntimeDesc] = useState();
|
|
26
|
-
const [timeLimit, setTimeLimit] = useState(10);
|
|
27
|
-
const [userStorage, setUserStorage] = useState(false);
|
|
28
|
-
const [canTransferFrom, setTransferFrom] = useState(false);
|
|
29
|
-
const [canTransferTo, setTransferTo] = useState(false);
|
|
30
|
-
const [transferVariables, setTransferVariables] = useState(false);
|
|
31
|
-
const [hasLoadedVariables, setHasLoadedVariables] = useState(false);
|
|
32
|
-
const [kernelVariables, setRuntimeVariables] = useState();
|
|
33
|
-
const [toTransfer, setToTransfer] = useState([]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
refreshCredits();
|
|
36
|
-
}, []);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const specs = sessionContext.specsManager.specs?.kernelspecs;
|
|
39
|
-
if (sessionContext.session?.kernel?.name && specs) {
|
|
40
|
-
const spec = Object.values(specs).find(spec => spec?.name === sessionContext.session.kernel.name);
|
|
41
|
-
if (spec) {
|
|
42
|
-
setSelectedRuntimeDesc({
|
|
43
|
-
name: spec.name,
|
|
44
|
-
kernelId: sessionContext.session.kernel.id,
|
|
45
|
-
location: sessionContext.location,
|
|
46
|
-
language: spec.language,
|
|
47
|
-
displayName: sessionContext.kernelDisplayName,
|
|
48
|
-
});
|
|
49
|
-
setTransferFrom(RuntimeSnippetsFacade.supports(spec.language));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, [sessionContext]);
|
|
53
|
-
const listRuntimeVariables = useCallback(async () => {
|
|
54
|
-
if (hasLoadedVariables) {
|
|
55
|
-
return Promise.resolve();
|
|
56
|
-
}
|
|
57
|
-
setHasLoadedVariables(true);
|
|
58
|
-
const connection = sessionContext.session.kernel;
|
|
59
|
-
const spec = sessionContext.specsManager.specs.kernelspecs[connection.model.name];
|
|
60
|
-
const snippets = new RuntimeSnippetsFacade(spec.language);
|
|
61
|
-
const outputs = await new KernelExecutor({ connection }).execute(snippets.listVariables());
|
|
62
|
-
const content = outputs.get(0).data['text/plain'];
|
|
63
|
-
if (content) {
|
|
64
|
-
setRuntimeVariables(JSON.parse(
|
|
65
|
-
// We need to remove the quotes prior to parsing.
|
|
66
|
-
content.slice(1, content.length - 1)));
|
|
67
|
-
if (toTransfer.length) {
|
|
68
|
-
const candidates = Object.keys(kernelVariables ?? {});
|
|
69
|
-
setToTransfer(toTransfer.filter(n => candidates.includes(n)));
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
// By default select all variables.
|
|
73
|
-
setToTransfer(Object.keys(kernelVariables ?? {}));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
setRuntimeVariables({});
|
|
78
|
-
}
|
|
79
|
-
}, [hasLoadedVariables, kernelVariables, toTransfer]);
|
|
80
|
-
const setSelectedVariables = useCallback((l) => {
|
|
81
|
-
if (!JSONExt.deepEqual(toTransfer, l)) {
|
|
82
|
-
setToTransfer(l);
|
|
83
|
-
}
|
|
84
|
-
}, [toTransfer]);
|
|
85
|
-
const setTransferVariable = useCallback((value) => {
|
|
86
|
-
if (transferVariables !== value) {
|
|
87
|
-
if (value) {
|
|
88
|
-
listRuntimeVariables().catch(error => {
|
|
89
|
-
console.error('Failed to list the runtime variable', error);
|
|
90
|
-
setHasLoadedVariables(false);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
setTransferVariables(value);
|
|
94
|
-
}
|
|
95
|
-
}, [transferVariables]);
|
|
96
|
-
const setRuntimeDesc = useCallback((runtimeDesc) => {
|
|
97
|
-
if (!runtimeDesc) {
|
|
98
|
-
if (selectedRuntimeDesc) {
|
|
99
|
-
setSelectedRuntimeDesc(undefined);
|
|
100
|
-
setTransferTo(false);
|
|
101
|
-
}
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (selectedRuntimeDesc?.displayName !== runtimeDesc.displayName ||
|
|
105
|
-
selectedRuntimeDesc?.kernelId !== runtimeDesc.kernelId) {
|
|
106
|
-
setSelectedRuntimeDesc({ ...runtimeDesc });
|
|
107
|
-
setTransferTo(RuntimeSnippetsFacade.supports(runtimeDesc.language));
|
|
108
|
-
}
|
|
109
|
-
}, [selectedRuntimeDesc]);
|
|
110
|
-
const handleUserStorageChange = useCallback((e) => {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
setUserStorage(!userStorage);
|
|
113
|
-
}, [userStorage]);
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
const resolvedBurningRate = selectedRuntimeDesc?.burningRate ??
|
|
116
|
-
multiServiceManager.remote?.environments
|
|
117
|
-
.get()
|
|
118
|
-
.find(env => env.name === selectedRuntimeDesc?.name)?.burning_rate;
|
|
119
|
-
const includedRuns = user?.subscription?.usage?.included_runs ??
|
|
120
|
-
user?.subscription?.included_runs;
|
|
121
|
-
const currentRuns = user?.subscription?.usage?.current_runs ??
|
|
122
|
-
user?.subscription?.current_runs ??
|
|
123
|
-
user?.subscription?.used_runs;
|
|
124
|
-
const hasKnownRunAllowance = typeof includedRuns === 'number';
|
|
125
|
-
const hasRemainingRuns = hasKnownRunAllowance &&
|
|
126
|
-
typeof currentRuns === 'number' &&
|
|
127
|
-
includedRuns > 0 &&
|
|
128
|
-
currentRuns < includedRuns;
|
|
129
|
-
const hasKnownCredits = typeof credits?.available === 'number';
|
|
130
|
-
const maxMinutes = selectedRuntimeDesc?.location === 'remote' && resolvedBurningRate
|
|
131
|
-
? Math.floor((credits?.available ?? 0) / resolvedBurningRate / 60.0)
|
|
132
|
-
: undefined;
|
|
133
|
-
const effectiveTimeLimit = selectedRuntimeDesc?.location === 'remote'
|
|
134
|
-
? Math.max(1, Math.min(timeLimit, maxMinutes && maxMinutes > 0 ? maxMinutes : 10))
|
|
135
|
-
: timeLimit;
|
|
136
|
-
const creditsLimit = selectedRuntimeDesc?.location === 'remote' && resolvedBurningRate
|
|
137
|
-
? Math.min(effectiveTimeLimit, MAXIMAL_RUNTIME_TIME_RESERVATION_MINUTES) *
|
|
138
|
-
resolvedBurningRate *
|
|
139
|
-
60
|
|
140
|
-
: undefined;
|
|
141
|
-
const requiresRuntimeStart = !!selectedRuntimeDesc && !selectedRuntimeDesc.kernelId;
|
|
142
|
-
if (requiresRuntimeStart && selectedRuntimeDesc.location === 'remote') {
|
|
143
|
-
if (!resolvedBurningRate || !Number.isFinite(resolvedBurningRate)) {
|
|
144
|
-
setValue({ runtime: null, selectedVariables: toTransfer });
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (hasKnownCredits &&
|
|
148
|
-
hasKnownRunAllowance &&
|
|
149
|
-
!hasRemainingRuns &&
|
|
150
|
-
(!creditsLimit || creditsLimit <= 0)) {
|
|
151
|
-
setValue({ runtime: null, selectedVariables: toTransfer });
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
setValue({
|
|
156
|
-
runtime: selectedRuntimeDesc
|
|
157
|
-
? {
|
|
158
|
-
environmentName: ['browser', 'remote'].includes(selectedRuntimeDesc.location)
|
|
159
|
-
? `${selectedRuntimeDesc.location}-${selectedRuntimeDesc.name}`
|
|
160
|
-
: selectedRuntimeDesc.name,
|
|
161
|
-
id: selectedRuntimeDesc.kernelId,
|
|
162
|
-
creditsLimit,
|
|
163
|
-
capabilities: userStorage ? ['user_storage'] : undefined,
|
|
164
|
-
}
|
|
165
|
-
: null,
|
|
166
|
-
selectedVariables: toTransfer,
|
|
167
|
-
});
|
|
168
|
-
}, [
|
|
169
|
-
selectedRuntimeDesc,
|
|
170
|
-
userStorage,
|
|
171
|
-
toTransfer,
|
|
172
|
-
timeLimit,
|
|
173
|
-
multiServiceManager.remote,
|
|
174
|
-
credits?.available,
|
|
175
|
-
user,
|
|
176
|
-
]);
|
|
177
|
-
const { kernelPreference: { canStart }, } = sessionContext;
|
|
178
|
-
const resolvedBurningRate = selectedRuntimeDesc?.burningRate ??
|
|
179
|
-
multiServiceManager.remote?.environments
|
|
180
|
-
.get()
|
|
181
|
-
.find(env => env.name === selectedRuntimeDesc?.name)?.burning_rate;
|
|
182
|
-
const maxFromCredits = resolvedBurningRate
|
|
183
|
-
? Math.floor((credits?.available ?? 0) / resolvedBurningRate / 60.0)
|
|
184
|
-
: -1;
|
|
185
|
-
const includedRuns = user?.subscription?.usage?.included_runs ??
|
|
186
|
-
user?.subscription?.included_runs;
|
|
187
|
-
const currentRuns = user?.subscription?.usage?.current_runs ??
|
|
188
|
-
user?.subscription?.current_runs ??
|
|
189
|
-
user?.subscription?.used_runs;
|
|
190
|
-
const hasKnownRunAllowance = typeof includedRuns === 'number';
|
|
191
|
-
const hasRemainingRuns = hasKnownRunAllowance &&
|
|
192
|
-
typeof currentRuns === 'number' &&
|
|
193
|
-
includedRuns > 0 &&
|
|
194
|
-
currentRuns < includedRuns;
|
|
195
|
-
const hasKnownCredits = typeof credits?.available === 'number';
|
|
196
|
-
const effectiveMaxMinutes = selectedRuntimeDesc?.location === 'remote'
|
|
197
|
-
? hasKnownCredits && hasKnownRunAllowance && !hasRemainingRuns
|
|
198
|
-
? Math.max(1, maxFromCredits)
|
|
199
|
-
: Math.max(10, maxFromCredits > 0 ? maxFromCredits : 0)
|
|
200
|
-
: Math.max(1, maxFromCredits);
|
|
201
|
-
const outOfCredits = hasKnownCredits &&
|
|
202
|
-
hasKnownRunAllowance &&
|
|
203
|
-
!hasRemainingRuns &&
|
|
204
|
-
maxFromCredits < Number.EPSILON;
|
|
205
|
-
return (_jsxs(Box, { as: "form", className: "dla-Runtimes-picker", children: [_jsx(Box, { sx: { padding: 'var(--stack-padding-condensed) 0' }, children: _jsx(RuntimePickerBase, { display: "radio", disabled: canStart === false, preference: {
|
|
206
|
-
id: sessionContext.session?.id,
|
|
207
|
-
kernelDisplayName: sessionContext.kernelPreference.shouldStart
|
|
208
|
-
? sessionContext.kernelDisplayName
|
|
209
|
-
: undefined,
|
|
210
|
-
}, sessionContext: sessionContext, multiServiceManager: multiServiceManager, translator: translator, runtimeDesc: selectedRuntimeDesc, setRuntimeDesc: setRuntimeDesc, postActions: token || !props.logIn ? (
|
|
211
|
-
/*
|
|
212
|
-
<Button
|
|
213
|
-
variant="default"
|
|
214
|
-
onClick={e => {
|
|
215
|
-
e.preventDefault();
|
|
216
|
-
commands.execute(CommandIDs.launchRemoteRuntime);
|
|
217
|
-
close();
|
|
218
|
-
}}
|
|
219
|
-
>
|
|
220
|
-
Launch a New Runtime
|
|
221
|
-
</Button>
|
|
222
|
-
*/
|
|
223
|
-
_jsx(_Fragment, {})) : (_jsx(ActionList.Item, { onSelect: props.logIn, title: 'Runtime Provider.', children: _jsx(ExternalTokenSilentLogin, { message: "Click to sign in." }) })) }) }), !selectedRuntimeDesc?.kernelId &&
|
|
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
|
-
? 'You must add credits to your account.'
|
|
226
|
-
: timeLimit === 0
|
|
227
|
-
? 'You must set a time limit.'
|
|
228
|
-
: undefined, burningRate: selectedRuntimeDesc.burningRate }), !configuration.whiteLabel && (_jsxs(FormControl, { disabled: !!selectedRuntimeDesc?.kernelId ||
|
|
229
|
-
selectedRuntimeDesc?.location !== 'remote', layout: "horizontal", children: [_jsxs(FormControl.Label, { id: "user-storage-picker-label", children: ["User storage", _jsx(Tooltip, { text: "The runtime will be slower to start.", direction: "e", style: { marginLeft: 3 }, children: _jsx(IconButton, { icon: AlertIcon, "aria-label": "", variant: "invisible" }) })] }), _jsx(ToggleSwitch, { disabled: !!selectedRuntimeDesc?.kernelId ||
|
|
230
|
-
selectedRuntimeDesc?.location !== 'remote', checked: userStorage, size: "small", onClick: handleUserStorageChange, "aria-labelledby": "user-storage-picker-label" })] }))] })), canTransferFrom && canTransferTo && (_jsx(RuntimeVariables, { selectedVariables: toTransfer, setSelectVariable: setSelectedVariables, transferVariables: transferVariables, setTransferVariable: setTransferVariable, kernelVariables: kernelVariables, translator: translator }))] }));
|
|
231
|
-
}
|
|
232
|
-
export default RuntimePickerNotebook;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Session } from '@jupyterlab/services';
|
|
2
|
-
import { IRuntimeModel, type IRuntimeDesc } from '../../models';
|
|
3
|
-
export interface IRuntimeAssignOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Runtime description.
|
|
6
|
-
*/
|
|
7
|
-
runtimeDesc?: IRuntimeDesc;
|
|
8
|
-
/**
|
|
9
|
-
* Runtime model to connect to.
|
|
10
|
-
*/
|
|
11
|
-
runtimeModel?: IRuntimeModel;
|
|
12
|
-
/**
|
|
13
|
-
* Whether to transfer the state to the runtime model.
|
|
14
|
-
*/
|
|
15
|
-
transferState?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Runtime picker component properties.
|
|
19
|
-
*/
|
|
20
|
-
interface IRuntimeSimplePickerProps {
|
|
21
|
-
/**
|
|
22
|
-
* Runtime assignment callback.
|
|
23
|
-
*/
|
|
24
|
-
assignRuntime: (options: IRuntimeAssignOptions) => Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Connection to the active runtime.
|
|
27
|
-
*/
|
|
28
|
-
sessionConnection?: Session.ISessionConnection;
|
|
29
|
-
/**
|
|
30
|
-
* Whether browser runtime is available.
|
|
31
|
-
*/
|
|
32
|
-
browserRuntimeAvailable?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Runtime simple picker component.
|
|
36
|
-
*/
|
|
37
|
-
export declare function RuntimeSimplePicker(props: IRuntimeSimplePickerProps): JSX.Element;
|
|
38
|
-
export {};
|