@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
|
@@ -1,156 +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 { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import { KernelIndicator, useJupyterReactStore, } from '@datalayer/jupyter-react';
|
|
8
|
-
import { ISanitizer } from '@jupyterlab/apputils';
|
|
9
|
-
import { IMarkdownParser } from '@jupyterlab/rendermime';
|
|
10
|
-
import { ActionList, ActionMenu, Box, Button, Tooltip } from '@primer/react';
|
|
11
|
-
import { CloudIcon, EyeIcon, UnfoldIcon } from '@primer/octicons-react';
|
|
12
|
-
import { BrowserIcon, PlusIcon } from '@datalayer/icons-react';
|
|
13
|
-
import { ArtifactIcon } from '../../components/icons';
|
|
14
|
-
import { RuntimeLauncherDialog } from '.';
|
|
15
|
-
import { useRuntimesStore } from '../../state/substates';
|
|
16
|
-
/**
|
|
17
|
-
* Cause to open the new runtime dialog.
|
|
18
|
-
*/
|
|
19
|
-
var RuntimeDialogCause;
|
|
20
|
-
(function (RuntimeDialogCause) {
|
|
21
|
-
/**
|
|
22
|
-
* Don't open.
|
|
23
|
-
*/
|
|
24
|
-
RuntimeDialogCause[RuntimeDialogCause["None"] = 0] = "None";
|
|
25
|
-
/**
|
|
26
|
-
* Launch a new runtime.
|
|
27
|
-
*/
|
|
28
|
-
RuntimeDialogCause[RuntimeDialogCause["New"] = 1] = "New";
|
|
29
|
-
/**
|
|
30
|
-
* Transfer the state from the current runtime to a new runtime.
|
|
31
|
-
*/
|
|
32
|
-
RuntimeDialogCause[RuntimeDialogCause["Transfer"] = 2] = "Transfer";
|
|
33
|
-
})(RuntimeDialogCause || (RuntimeDialogCause = {}));
|
|
34
|
-
/**
|
|
35
|
-
* Runtime simple picker component.
|
|
36
|
-
*/
|
|
37
|
-
export function RuntimeSimplePicker(props) {
|
|
38
|
-
const { assignRuntime, sessionConnection, browserRuntimeAvailable = true, } = props;
|
|
39
|
-
const { runtimeModels, multiServiceManager } = useRuntimesStore();
|
|
40
|
-
const jupyterReactStore = useJupyterReactStore();
|
|
41
|
-
const jupyterLabAdapter = jupyterReactStore.jupyterLabAdapter;
|
|
42
|
-
const [runtimeLocation, setRuntimeLocation] = useState();
|
|
43
|
-
const [luminoServices, setLuminoServices] = useState({});
|
|
44
|
-
const [dialogCause, setDialogCause] = useState(RuntimeDialogCause.None);
|
|
45
|
-
const [status, setStatus] = useState('');
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (sessionConnection) {
|
|
48
|
-
function onStatusChanged(connection) {
|
|
49
|
-
setStatus(`Runtime ${connection.kernel?.connectionStatus} - Status: ${connection.kernel?.status}`);
|
|
50
|
-
}
|
|
51
|
-
onStatusChanged(sessionConnection);
|
|
52
|
-
sessionConnection?.statusChanged.connect(onStatusChanged);
|
|
53
|
-
sessionConnection?.connectionStatusChanged.connect(onStatusChanged);
|
|
54
|
-
return () => {
|
|
55
|
-
sessionConnection?.statusChanged.disconnect(onStatusChanged);
|
|
56
|
-
sessionConnection?.connectionStatusChanged.disconnect(onStatusChanged);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
setStatus('No kernel');
|
|
61
|
-
}
|
|
62
|
-
}, [sessionConnection]);
|
|
63
|
-
const refreshRemoteKernels = useCallback(async () => {
|
|
64
|
-
if (multiServiceManager?.remote?.runtimesManager) {
|
|
65
|
-
await multiServiceManager.remote.runtimesManager.refresh();
|
|
66
|
-
}
|
|
67
|
-
}, [multiServiceManager?.remote?.runtimesManager]);
|
|
68
|
-
const handleLaunchRemoteKernel = useCallback(() => {
|
|
69
|
-
setDialogCause(RuntimeDialogCause.New);
|
|
70
|
-
}, []);
|
|
71
|
-
const handleCloseDialog = useCallback((runtimeDesc) => {
|
|
72
|
-
if (runtimeDesc) {
|
|
73
|
-
switch (dialogCause) {
|
|
74
|
-
case RuntimeDialogCause.New:
|
|
75
|
-
refreshRemoteKernels().then(() => {
|
|
76
|
-
setRuntimeLocation('remote');
|
|
77
|
-
assignRuntime({
|
|
78
|
-
runtimeDesc,
|
|
79
|
-
runtimeModel: multiServiceManager?.remote?.runtimesManager
|
|
80
|
-
.get()
|
|
81
|
-
.find(model => model.id === runtimeDesc.kernelId),
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
85
|
-
case RuntimeDialogCause.Transfer:
|
|
86
|
-
setRuntimeLocation('remote');
|
|
87
|
-
assignRuntime({ runtimeDesc, transferState: true });
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
setDialogCause(RuntimeDialogCause.None);
|
|
92
|
-
}, [refreshRemoteKernels, multiServiceManager?.remote, dialogCause]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (jupyterLabAdapter) {
|
|
95
|
-
Promise.all([
|
|
96
|
-
jupyterLabAdapter.jupyterLab.resolveOptionalService(IMarkdownParser),
|
|
97
|
-
jupyterLabAdapter.jupyterLab.resolveOptionalService(ISanitizer),
|
|
98
|
-
]).then(services => {
|
|
99
|
-
setLuminoServices({
|
|
100
|
-
[IMarkdownParser.name]: services[0],
|
|
101
|
-
[ISanitizer.name]: services[1],
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
setLuminoServices({});
|
|
107
|
-
}
|
|
108
|
-
}, [jupyterLabAdapter]);
|
|
109
|
-
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: () => {
|
|
110
|
-
switch (runtimeLocation) {
|
|
111
|
-
case 'browser':
|
|
112
|
-
return _jsx(BrowserIcon, {});
|
|
113
|
-
case 'remote':
|
|
114
|
-
return _jsx(CloudIcon, {});
|
|
115
|
-
case undefined:
|
|
116
|
-
return _jsx(EyeIcon, {});
|
|
117
|
-
}
|
|
118
|
-
return _jsx(ArtifactIcon, { type: "runtime" });
|
|
119
|
-
}, trailingVisual: () => sessionConnection ? (_jsx(Box, { sx: { paddingTop: '5px' }, children: _jsx(KernelIndicator, { kernel: sessionConnection.kernel }) })) : (_jsx(_Fragment, {})), size: "small", variant: "invisible", children: _jsx(Tooltip, { text: status, direction: "s", children: _jsx(Button, { variant: "invisible", size: "small", children: sessionConnection?.kernel?.name ?? 'Runtimes' }) }) }), _jsx(ActionMenu.Overlay, { width: "medium", children: _jsxs(ActionList, { selectionVariant: "single", showDividers: true, children: [_jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: runtimeLocation === undefined &&
|
|
120
|
-
sessionConnection === undefined, onSelect: () => {
|
|
121
|
-
setRuntimeLocation(undefined);
|
|
122
|
-
assignRuntime({ runtimeDesc: undefined });
|
|
123
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(EyeIcon, {}) }), "Viewer", _jsx(ActionList.Description, { variant: "block", children: "A simple Notebook Viewer without Runtime." })] }), browserRuntimeAvailable && (_jsxs(ActionList.Item, { selected: runtimeLocation === 'browser', onSelect: () => {
|
|
124
|
-
setRuntimeLocation('browser');
|
|
125
|
-
assignRuntime({
|
|
126
|
-
runtimeDesc: {
|
|
127
|
-
name: 'pyodide',
|
|
128
|
-
location: 'browser',
|
|
129
|
-
language: 'python',
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(BrowserIcon, {}) }), "Browser Runtime", _jsx(ActionList.Description, { variant: "block", children: "A Browser Runtime based on Pyodide." })] }))] }), runtimeModels.length > 0 && (_jsxs(ActionList.Group, { children: [_jsx(ActionList.GroupHeading, { children: "Cloud Runtimes" }), runtimeModels.map(kernelModel => {
|
|
133
|
-
return (_jsxs(ActionList.Item, { selected: sessionConnection?.kernel?.id === kernelModel.id, onSelect: () => {
|
|
134
|
-
setRuntimeLocation('remote');
|
|
135
|
-
assignRuntime({
|
|
136
|
-
runtimeDesc: {
|
|
137
|
-
name: kernelModel.environment.name,
|
|
138
|
-
language: '',
|
|
139
|
-
location: 'remote',
|
|
140
|
-
displayName: kernelModel.given_name,
|
|
141
|
-
kernelId: kernelModel.id,
|
|
142
|
-
burningRate: kernelModel.burning_rate,
|
|
143
|
-
podName: kernelModel.pod_name,
|
|
144
|
-
},
|
|
145
|
-
runtimeModel: kernelModel,
|
|
146
|
-
});
|
|
147
|
-
}, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(ArtifactIcon, { type: "runtime" }) }), kernelModel.given_name, _jsx(ActionList.Description, { variant: "block", children: kernelModel.environment.title ||
|
|
148
|
-
kernelModel.environment.name })] }, kernelModel.id));
|
|
149
|
-
})] })), _jsx(ActionList.Divider, {}), _jsxs(ActionList.Group, { children: [_jsxs(ActionList.Item, { selected: false, onSelect: handleLaunchRemoteKernel, children: [_jsx(ActionList.LeadingVisual, { children: _jsx(PlusIcon, {}) }), "Launch a new Runtime\u2026"] }), _jsxs(ActionList.Item, { disabled: runtimeLocation !== 'browser', selected: false, onSelect: () => {
|
|
150
|
-
setDialogCause(RuntimeDialogCause.Transfer);
|
|
151
|
-
}, title: "Transfer the state of the current Runtime to a new Remote Runtime.", children: [_jsx(ActionList.LeadingVisual, { children: _jsx(UnfoldIcon, {}) }), "Transfer state to a new Runtime\u2026"] })] })] }) })] }), multiServiceManager?.remote && dialogCause > 0 && (_jsx(RuntimeLauncherDialog, { dialogTitle: dialogCause === RuntimeDialogCause.Transfer
|
|
152
|
-
? 'Switch to a new Cloud Runtime'
|
|
153
|
-
: undefined, manager: multiServiceManager.remote, onSubmit: handleCloseDialog, markdownParser: luminoServices[IMarkdownParser.name], sanitizer: luminoServices[ISanitizer.name], startRuntime: dialogCause === RuntimeDialogCause.Transfer
|
|
154
|
-
? 'defer'
|
|
155
|
-
: dialogCause === RuntimeDialogCause.New }))] }));
|
|
156
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
3
|
-
/**
|
|
4
|
-
* {@link RuntimeVariables} properties
|
|
5
|
-
*/
|
|
6
|
-
export interface IRuntimeVariablesProps {
|
|
7
|
-
/**
|
|
8
|
-
* Component class name
|
|
9
|
-
*/
|
|
10
|
-
className?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Available kernel variables
|
|
13
|
-
*
|
|
14
|
-
* Mapping (variable name, variable type)
|
|
15
|
-
*/
|
|
16
|
-
kernelVariables?: {
|
|
17
|
-
[name: string]: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Kernel variables to be transferred.
|
|
21
|
-
*/
|
|
22
|
-
selectedVariables: string[];
|
|
23
|
-
setSelectVariable: (l: string[]) => void;
|
|
24
|
-
/**
|
|
25
|
-
* Whether to transfer the variable from the current
|
|
26
|
-
* to the selected kernel or not.
|
|
27
|
-
*/
|
|
28
|
-
transferVariables: boolean;
|
|
29
|
-
setTransferVariable: (v: boolean) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Application translator
|
|
32
|
-
*/
|
|
33
|
-
translator?: ITranslator;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Runtime variables selector component.
|
|
37
|
-
*/
|
|
38
|
-
export declare function RuntimeVariables(props: IRuntimeVariablesProps): ReactElement;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './RuntimeCellVariables';
|
|
2
|
-
export * from './RuntimeCellVariablesDialog';
|
|
3
|
-
export * from './RuntimeLauncherDialog';
|
|
4
|
-
export * from './RuntimePickerBase';
|
|
5
|
-
export * from './RuntimePickerCell';
|
|
6
|
-
export * from './RuntimePickerNotebook';
|
|
7
|
-
export * from './RuntimeReservationControl';
|
|
8
|
-
export * from './RuntimeSimplePicker';
|
|
9
|
-
export * from './RuntimeTransfer';
|
|
10
|
-
export * from './RuntimeUtils';
|
|
11
|
-
export * from './RuntimeVariables';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
export * from './RuntimeCellVariables';
|
|
6
|
-
export * from './RuntimeCellVariablesDialog';
|
|
7
|
-
export * from './RuntimeLauncherDialog';
|
|
8
|
-
export * from './RuntimePickerBase';
|
|
9
|
-
export * from './RuntimePickerCell';
|
|
10
|
-
export * from './RuntimePickerNotebook';
|
|
11
|
-
export * from './RuntimeReservationControl';
|
|
12
|
-
export * from './RuntimeSimplePicker';
|
|
13
|
-
export * from './RuntimeTransfer';
|
|
14
|
-
export * from './RuntimeUtils';
|
|
15
|
-
export * from './RuntimeVariables';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { StudentResultCircle } from '@datalayer/core/lib/components/students/StudentResultCircle';
|
|
3
|
-
const getExerciseScore = (studentItem) => {
|
|
4
|
-
if (studentItem && studentItem.score) {
|
|
5
|
-
return studentItem.score;
|
|
6
|
-
}
|
|
7
|
-
return 0;
|
|
8
|
-
};
|
|
9
|
-
export const StudentItemStatus = (props) => {
|
|
10
|
-
const { studentItem } = props;
|
|
11
|
-
if (!studentItem) {
|
|
12
|
-
return _jsx(StudentResultCircle, { status: "none", label: "No result yet" });
|
|
13
|
-
}
|
|
14
|
-
switch (studentItem.itemType) {
|
|
15
|
-
case 'dataset': {
|
|
16
|
-
if (studentItem.completed === undefined) {
|
|
17
|
-
return (_jsx(StudentResultCircle, { status: "none", label: "Dataset not started" }));
|
|
18
|
-
}
|
|
19
|
-
const completed = Boolean(studentItem.completed);
|
|
20
|
-
return (_jsx(StudentResultCircle, { status: completed ? 'pass' : 'fail', label: completed ? 'Dataset completed' : 'Dataset not completed' }));
|
|
21
|
-
}
|
|
22
|
-
case 'lesson': {
|
|
23
|
-
if (studentItem.completed === undefined) {
|
|
24
|
-
return _jsx(StudentResultCircle, { status: "none", label: "Lesson not started" });
|
|
25
|
-
}
|
|
26
|
-
const completed = Boolean(studentItem.completed);
|
|
27
|
-
return (_jsx(StudentResultCircle, { status: completed ? 'pass' : 'fail', label: completed ? 'Lesson completed' : 'Lesson not completed' }));
|
|
28
|
-
}
|
|
29
|
-
case 'exercise': {
|
|
30
|
-
const hasResult = Boolean(studentItem.id) ||
|
|
31
|
-
Boolean(studentItem.codeStudent) ||
|
|
32
|
-
studentItem.score !== undefined;
|
|
33
|
-
if (!hasResult) {
|
|
34
|
-
return (_jsx(StudentResultCircle, { status: "none", label: "Exercise not started" }));
|
|
35
|
-
}
|
|
36
|
-
const passed = getExerciseScore(studentItem) > 0;
|
|
37
|
-
return (_jsx(StudentResultCircle, { status: passed ? 'pass' : 'fail', label: passed ? 'Exercise passed' : 'Exercise failed' }));
|
|
38
|
-
}
|
|
39
|
-
case 'assignment': {
|
|
40
|
-
const hasRecordedAttempt = Boolean(studentItem.id) ||
|
|
41
|
-
studentItem.nbgradesTotalScore !== undefined ||
|
|
42
|
-
studentItem.nbgradesTotalPoints !== undefined ||
|
|
43
|
-
Boolean(studentItem.nbgrades);
|
|
44
|
-
if (!hasRecordedAttempt) {
|
|
45
|
-
return (_jsx(StudentResultCircle, { status: "none", label: "Assignment not graded" }));
|
|
46
|
-
}
|
|
47
|
-
const totalScore = studentItem.nbgradesTotalScore ?? 0;
|
|
48
|
-
const totalPoints = studentItem.nbgradesTotalPoints ?? 0;
|
|
49
|
-
const nbgrades = Array.isArray(studentItem.nbgrades)
|
|
50
|
-
? studentItem.nbgrades
|
|
51
|
-
: [];
|
|
52
|
-
const status = totalPoints === 0
|
|
53
|
-
? 'pass'
|
|
54
|
-
: totalScore <= 0
|
|
55
|
-
? 'fail'
|
|
56
|
-
: totalScore >= totalPoints
|
|
57
|
-
? 'pass'
|
|
58
|
-
: 'partial';
|
|
59
|
-
const tooltip = nbgrades.length > 0
|
|
60
|
-
? `Assignment graded: ${totalScore} / ${totalPoints} (${nbgrades.length} checks)`
|
|
61
|
-
: `Assignment graded: ${totalScore} / ${totalPoints}`;
|
|
62
|
-
return _jsx(StudentResultCircle, { status: status, label: tooltip });
|
|
63
|
-
}
|
|
64
|
-
default:
|
|
65
|
-
return _jsx(StudentResultCircle, { status: "none", label: "No result yet" });
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
export default StudentItemStatus;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './StudentItemStatus';
|
|
@@ -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;
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/components/{runtimes/RuntimeTransfer.js → code-sandboxes/CodeSandboxTransfer.js}
RENAMED
|
File without changes
|