@datalayer/jupyter-react 1.1.8 → 1.2.0
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 +74 -1
- package/lib/app/tabs/components/CellComponent.js +4 -2
- package/lib/app/tabs/components/CellComponent.js.map +1 -1
- package/lib/app/tabs/components/NotebookComponent.js +2 -2
- package/lib/app/tabs/components/NotebookComponent.js.map +1 -1
- package/lib/app/tabs/components/ViewerComponent.js +1 -1
- package/lib/app/tabs/components/ViewerComponent.js.map +1 -1
- package/lib/components/cell/Cell.d.ts +5 -8
- package/lib/components/cell/Cell.js +6 -22
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/cell/CellAdapter.d.ts +1 -3
- package/lib/components/cell/CellAdapter.js +5 -17
- package/lib/components/cell/CellAdapter.js.map +1 -1
- package/lib/components/codemirror/CodeMirrorOutputToolbar.d.ts +2 -2
- package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
- package/lib/components/console/ConsoleAdapter.d.ts +1 -1
- package/lib/components/console/ConsoleAdapter.js +1 -1
- package/lib/components/console/ConsoleAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabApp.d.ts +16 -19
- package/lib/components/jupyterlab/JupyterLabApp.js +27 -21
- package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.d.ts +4 -4
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js +1 -1
- package/lib/components/jupyterlab/JupyterLabAppAdapter.js.map +1 -1
- package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +1 -4
- package/lib/components/jupyterlab/JupyterLabAppCss.js +1 -5
- package/lib/components/jupyterlab/JupyterLabAppCss.js.map +1 -1
- package/lib/components/kernel/KernelActionMenu.d.ts +2 -2
- package/lib/components/kernel/KernelActionMenu.js.map +1 -1
- package/lib/components/kernel/KernelDetective.d.ts +1 -1
- package/lib/components/kernel/{Kernelndicator.d.ts → KernelIndicator.d.ts} +2 -1
- package/lib/components/kernel/{Kernelndicator.js → KernelIndicator.js} +13 -5
- package/lib/components/kernel/KernelIndicator.js.map +1 -0
- package/lib/components/kernel/KernelInspector.d.ts +2 -2
- package/lib/components/kernel/KernelInspector.js.map +1 -1
- package/lib/components/kernel/KernelSelector.d.ts +2 -2
- package/lib/components/kernel/KernelSelector.js.map +1 -1
- package/lib/components/kernel/KernelUsage.d.ts +2 -2
- package/lib/components/kernel/KernelUsage.js.map +1 -1
- package/lib/components/kernel/KernelVariables.d.ts +2 -2
- package/lib/components/kernel/KernelVariables.js.map +1 -1
- package/lib/components/kernel/index.d.ts +1 -1
- package/lib/components/kernel/index.js +1 -1
- package/lib/components/kernel/index.js.map +1 -1
- package/lib/components/kernel/variables/kernelconnector.d.ts +2 -2
- package/lib/components/kernel/variables/kernelconnector.js +2 -2
- package/lib/components/kernel/variables/widget.d.ts +4 -2
- package/lib/components/kernel/variables/widget.js.map +1 -1
- package/lib/components/lumino/Lumino.d.ts +1 -1
- package/lib/components/lumino/LuminoBox.d.ts +3 -9
- package/lib/components/lumino/LuminoBox.js +1 -6
- package/lib/components/lumino/LuminoBox.js.map +1 -1
- package/lib/components/lumino/ReactPortalWidget.d.ts +1 -2
- package/lib/components/notebook/Notebook.d.ts +4 -6
- package/lib/components/notebook/Notebook.js +11 -26
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/Notebook2.d.ts +6 -2
- package/lib/components/notebook/Notebook2.js +3 -2
- package/lib/components/notebook/Notebook2.js.map +1 -1
- package/lib/components/notebook/Notebook2Adapter.d.ts +189 -0
- package/lib/components/notebook/Notebook2Adapter.js +554 -10
- package/lib/components/notebook/Notebook2Adapter.js.map +1 -1
- package/lib/components/notebook/Notebook2Base.d.ts +15 -9
- package/lib/components/notebook/Notebook2Base.js +89 -50
- package/lib/components/notebook/Notebook2Base.js.map +1 -1
- package/lib/components/notebook/Notebook2State.d.ts +35 -8
- package/lib/components/notebook/Notebook2State.js +74 -45
- package/lib/components/notebook/Notebook2State.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +1 -0
- package/lib/components/notebook/NotebookAdapter.js +13 -8
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookCommands.d.ts +25 -2
- package/lib/components/notebook/NotebookCommands.js +89 -10
- package/lib/components/notebook/NotebookCommands.js.map +1 -1
- package/lib/components/notebook/NotebookState.d.ts +11 -11
- package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +1 -1
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.d.ts +2 -4
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js +1 -3
- package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js.map +1 -1
- package/lib/components/notebook/index.d.ts +1 -0
- package/lib/components/notebook/index.js +1 -0
- package/lib/components/notebook/index.js.map +1 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.d.ts +28 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +15 -1
- package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js.map +1 -1
- package/lib/components/output/Output.d.ts +11 -13
- package/lib/components/output/Output.js +19 -30
- package/lib/components/output/Output.js.map +1 -1
- package/lib/components/output/OutputIPyWidgets.d.ts +2 -2
- package/lib/components/output/OutputIPyWidgets.js.map +1 -1
- package/lib/components/output/OutputRenderer.d.ts +2 -2
- package/lib/components/output/OutputRenderer.js.map +1 -1
- package/lib/components/terminal/Terminal.d.ts +1 -4
- package/lib/components/terminal/Terminal.js +5 -8
- package/lib/components/terminal/Terminal.js.map +1 -1
- package/lib/components/viewer/Viewer.d.ts +1 -1
- package/lib/components/viewer/output/OutputViewer.d.ts +3 -6
- package/lib/components/viewer/output/OutputViewer.js +1 -5
- package/lib/components/viewer/output/OutputViewer.js.map +1 -1
- package/lib/examples/Bokeh.js +2 -2
- package/lib/examples/Bokeh.js.map +1 -1
- package/lib/examples/Bqplot.js +2 -2
- package/lib/examples/Bqplot.js.map +1 -1
- package/lib/examples/Cell.js +4 -4
- package/lib/examples/Cell.js.map +1 -1
- package/lib/examples/CellLite.js +16 -4
- package/lib/examples/CellLite.js.map +1 -1
- package/lib/examples/Cells.js +9 -6
- package/lib/examples/Cells.js.map +1 -1
- package/lib/examples/CellsExecute.js +13 -9
- package/lib/examples/CellsExecute.js.map +1 -1
- package/lib/examples/Console.js +2 -2
- package/lib/examples/Console.js.map +1 -1
- package/lib/examples/ConsoleLite.js +3 -3
- package/lib/examples/ConsoleLite.js.map +1 -1
- package/lib/examples/Dashboard.js +2 -2
- package/lib/examples/Dashboard.js.map +1 -1
- package/lib/examples/Deno.js +2 -2
- package/lib/examples/Deno.js.map +1 -1
- package/lib/examples/Examples.d.ts +23 -0
- package/lib/examples/Examples.js +342 -0
- package/lib/examples/Examples.js.map +1 -0
- package/lib/examples/FileBrowser.js +2 -2
- package/lib/examples/FileBrowser.js.map +1 -1
- package/lib/examples/GeoJson.js +2 -2
- package/lib/examples/GeoJson.js.map +1 -1
- package/lib/examples/IPyLeaflet.js +3 -3
- package/lib/examples/IPyLeaflet.js.map +1 -1
- package/lib/examples/IPyReact.js +3 -3
- package/lib/examples/IPyReact.js.map +1 -1
- package/lib/examples/IPyWidgets.js +3 -3
- package/lib/examples/IPyWidgets.js.map +1 -1
- package/lib/examples/IPyWidgetsState.js +3 -3
- package/lib/examples/IPyWidgetsState.js.map +1 -1
- package/lib/examples/JupyterContext.js +2 -2
- package/lib/examples/JupyterContext.js.map +1 -1
- package/lib/examples/JupyterLabAppHeadless.js +2 -2
- package/lib/examples/JupyterLabAppHeadless.js.map +1 -1
- package/lib/examples/JupyterLabAppHeadlessServerless.js +2 -2
- package/lib/examples/JupyterLabAppHeadlessServerless.js.map +1 -1
- package/lib/examples/JupyterLabAppServerless.js +2 -2
- package/lib/examples/JupyterLabAppServerless.js.map +1 -1
- package/lib/examples/JupyterLabAppServiceManager.js +2 -2
- package/lib/examples/JupyterLabAppServiceManager.js.map +1 -1
- package/lib/examples/JupyterLabTheme.js +2 -2
- package/lib/examples/JupyterLabTheme.js.map +1 -1
- package/lib/examples/KernelExecute.d.ts +1 -1
- package/lib/examples/KernelExecute.js +9 -11
- package/lib/examples/KernelExecute.js.map +1 -1
- package/lib/examples/KernelExecuteLite.d.ts +1 -0
- package/lib/examples/KernelExecuteLite.js +51 -0
- package/lib/examples/KernelExecuteLite.js.map +1 -0
- package/lib/examples/KernelExecutor.js +10 -9
- package/lib/examples/KernelExecutor.js.map +1 -1
- package/lib/examples/KernelExecutorLite.js +63 -0
- package/lib/examples/KernelExecutorLite.js.map +1 -0
- package/lib/examples/Kernels.js +6 -5
- package/lib/examples/Kernels.js.map +1 -1
- package/lib/examples/Lumino.js +2 -2
- package/lib/examples/Lumino.js.map +1 -1
- package/lib/examples/Matplotlib.js +10 -6
- package/lib/examples/Matplotlib.js.map +1 -1
- package/lib/examples/Notebook.js +3 -2
- package/lib/examples/Notebook.js.map +1 -1
- package/lib/examples/Notebook2.js +9 -6
- package/lib/examples/Notebook2.js.map +1 -1
- package/lib/examples/Notebook2Actions.js +8 -6
- package/lib/examples/Notebook2Actions.js.map +1 -1
- package/lib/examples/Notebook2Collaborative.js +2 -2
- package/lib/examples/Notebook2Collaborative.js.map +1 -1
- package/lib/examples/Notebook2Lite.js +19 -14
- package/lib/examples/Notebook2Lite.js.map +1 -1
- package/lib/examples/NotebookCellSidebar.js +3 -3
- package/lib/examples/NotebookCellSidebar.js.map +1 -1
- package/lib/examples/NotebookCellToolbar.js +4 -4
- package/lib/examples/NotebookCellToolbar.js.map +1 -1
- package/lib/examples/NotebookCollaborative.js +2 -2
- package/lib/examples/NotebookCollaborative.js.map +1 -1
- package/lib/examples/NotebookColormode.js +15 -10
- package/lib/examples/NotebookColormode.js.map +1 -1
- package/lib/examples/NotebookExtension.js +4 -4
- package/lib/examples/NotebookExtension.js.map +1 -1
- package/lib/examples/NotebookExternalContent.js +18 -13
- package/lib/examples/NotebookExternalContent.js.map +1 -1
- package/lib/examples/NotebookInit.js +10 -9
- package/lib/examples/NotebookInit.js.map +1 -1
- package/lib/examples/NotebookKernel.js +4 -4
- package/lib/examples/NotebookKernel.js.map +1 -1
- package/lib/examples/NotebookKernelChange.js +2 -2
- package/lib/examples/NotebookKernelChange.js.map +1 -1
- package/lib/examples/NotebookLess.js +4 -4
- package/lib/examples/NotebookLess.js.map +1 -1
- package/lib/examples/NotebookLite.js +10 -6
- package/lib/examples/NotebookLite.js.map +1 -1
- package/lib/examples/NotebookLiteContext.js +10 -5
- package/lib/examples/NotebookLiteContext.js.map +1 -1
- package/lib/examples/NotebookLocalServer.js +3 -3
- package/lib/examples/NotebookLocalServer.js.map +1 -1
- package/lib/examples/NotebookNbformat.js +7 -5
- package/lib/examples/NotebookNbformat.js.map +1 -1
- package/lib/examples/NotebookNbformatChange.js +12 -6
- package/lib/examples/NotebookNbformatChange.js.map +1 -1
- package/lib/examples/NotebookNoContext.js +4 -3
- package/lib/examples/NotebookNoContext.js.map +1 -1
- package/lib/examples/NotebookNoPrimer.js +3 -2
- package/lib/examples/NotebookNoPrimer.js.map +1 -1
- package/lib/examples/NotebookOnSessionConnection.js +5 -5
- package/lib/examples/NotebookOnSessionConnection.js.map +1 -1
- package/lib/examples/NotebookPath.js +2 -2
- package/lib/examples/NotebookPath.js.map +1 -1
- package/lib/examples/NotebookPathChange.js +5 -4
- package/lib/examples/NotebookPathChange.js.map +1 -1
- package/lib/examples/NotebookReadonly.js +4 -4
- package/lib/examples/NotebookReadonly.js.map +1 -1
- package/lib/examples/NotebookServiceManager.js +4 -4
- package/lib/examples/NotebookServiceManager.js.map +1 -1
- package/lib/examples/NotebookSkeleton.js +3 -2
- package/lib/examples/NotebookSkeleton.js.map +1 -1
- package/lib/examples/NotebookTOC.d.ts +1 -0
- package/lib/examples/{NotebookToc.js → NotebookTOC.js} +12 -6
- package/lib/examples/NotebookTOC.js.map +1 -0
- package/lib/examples/NotebookTheme.js +10 -5
- package/lib/examples/NotebookTheme.js.map +1 -1
- package/lib/examples/NotebookThemeColormode.js +4 -4
- package/lib/examples/NotebookThemeColormode.js.map +1 -1
- package/lib/examples/NotebookURL.js +3 -2
- package/lib/examples/NotebookURL.js.map +1 -1
- package/lib/examples/NotebookUnmount.js +13 -7
- package/lib/examples/NotebookUnmount.js.map +1 -1
- package/lib/examples/ObservableHQ.js +2 -2
- package/lib/examples/ObservableHQ.js.map +1 -1
- package/lib/examples/OutputIPyWidgets.js +3 -3
- package/lib/examples/OutputIPyWidgets.js.map +1 -1
- package/lib/examples/OutputWithMonitoring.js +3 -2
- package/lib/examples/OutputWithMonitoring.js.map +1 -1
- package/lib/examples/Outputs.js +8 -8
- package/lib/examples/Outputs.js.map +1 -1
- package/lib/examples/OutputsIpynb.js +4 -4
- package/lib/examples/OutputsIpynb.js.map +1 -1
- package/lib/examples/Panel.js +2 -2
- package/lib/examples/Panel.js.map +1 -1
- package/lib/examples/Plotly.js +2 -2
- package/lib/examples/Plotly.js.map +1 -1
- package/lib/examples/PyGWalker.js +4 -4
- package/lib/examples/PyGWalker.js.map +1 -1
- package/lib/examples/Terminal.js +4 -3
- package/lib/examples/Terminal.js.map +1 -1
- package/lib/examples/Vega.js +2 -2
- package/lib/examples/Vega.js.map +1 -1
- package/lib/examples/Viewer.js +5 -4
- package/lib/examples/Viewer.js.map +1 -1
- package/lib/examples/extensions/celltoolbar/CellToolbarComponent.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/jupyter/Jupyter.d.ts +1 -74
- package/lib/jupyter/Jupyter.js +2 -9
- package/lib/jupyter/Jupyter.js.map +1 -1
- package/lib/jupyter/JupyterConfig.js +7 -5
- package/lib/jupyter/JupyterConfig.js.map +1 -1
- package/lib/jupyter/JupyterContext.d.ts +2 -2
- package/lib/jupyter/collaboration/ICollaborationProvider.js.map +1 -1
- package/lib/jupyter/ipywidgets/classic/htmlmanager.d.ts +6 -0
- package/lib/jupyter/ipywidgets/classic/htmlmanager.js +8 -0
- package/lib/jupyter/ipywidgets/classic/htmlmanager.js.map +1 -1
- package/lib/jupyter/ipywidgets/lab/manager.d.ts +6 -0
- package/lib/jupyter/ipywidgets/lab/manager.js +8 -0
- package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
- package/lib/jupyter/ipywidgets/libembed-amd.d.ts +1 -1
- package/lib/jupyter/ipywidgets/libembed-amd.js +1 -1
- package/lib/jupyter/kernel/Kernel.js +21 -15
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/jupyter/kernel/KernelState.d.ts +1 -1
- package/lib/jupyter/lite/Lite.d.ts +1 -1
- package/lib/jupyter/lite/LiteServer.d.ts +2 -2
- package/lib/jupyter/lite/LiteServer.js +21 -6
- package/lib/jupyter/lite/LiteServer.js.map +1 -1
- package/lib/jupyter/lite/contents/broadcast.d.ts +27 -0
- package/lib/jupyter/lite/contents/broadcast.js +60 -0
- package/lib/jupyter/lite/contents/broadcast.js.map +1 -0
- package/lib/jupyter/lite/contents/contents.d.ts +228 -0
- package/lib/jupyter/lite/contents/contents.js +774 -0
- package/lib/jupyter/lite/contents/contents.js.map +1 -0
- package/lib/jupyter/lite/contents/drivecontents.d.ts +92 -0
- package/lib/jupyter/lite/contents/drivecontents.js +133 -0
- package/lib/jupyter/lite/contents/drivecontents.js.map +1 -0
- package/lib/jupyter/lite/contents/drivefs.d.ts +193 -0
- package/lib/jupyter/lite/contents/drivefs.js +432 -0
- package/lib/jupyter/lite/contents/drivefs.js.map +1 -0
- package/lib/jupyter/lite/contents/emscripten.d.ts +89 -0
- package/lib/jupyter/lite/contents/emscripten.js +11 -0
- package/lib/jupyter/lite/contents/emscripten.js.map +1 -0
- package/lib/jupyter/lite/contents/index.d.ts +6 -0
- package/lib/jupyter/lite/contents/index.js +9 -0
- package/lib/jupyter/lite/contents/index.js.map +1 -0
- package/lib/jupyter/lite/contents/tokens.d.ts +136 -0
- package/lib/jupyter/lite/contents/tokens.js +66 -0
- package/lib/jupyter/lite/contents/tokens.js.map +1 -0
- package/lib/jupyter/lite/kernel/index.d.ts +4 -0
- package/lib/jupyter/lite/kernel/index.js +7 -0
- package/lib/jupyter/lite/kernel/index.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernel.d.ts +245 -0
- package/lib/jupyter/lite/kernel/kernel.js +453 -0
- package/lib/jupyter/lite/kernel/kernel.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernels.d.ts +85 -0
- package/lib/jupyter/lite/kernel/kernels.js +218 -0
- package/lib/jupyter/lite/kernel/kernels.js.map +1 -0
- package/lib/jupyter/lite/kernel/kernelspecs.d.ts +53 -0
- package/lib/jupyter/lite/kernel/kernelspecs.js +50 -0
- package/lib/jupyter/lite/kernel/kernelspecs.js.map +1 -0
- package/lib/jupyter/lite/kernel/tokens.d.ts +171 -0
- package/lib/jupyter/lite/kernel/tokens.js +16 -0
- package/lib/jupyter/lite/kernel/tokens.js.map +1 -0
- package/lib/jupyter/lite/licenses/index.d.ts +2 -0
- package/lib/jupyter/lite/licenses/index.js +5 -0
- package/lib/jupyter/lite/licenses/index.js.map +1 -0
- package/lib/jupyter/lite/licenses/licenses.d.ts +35 -0
- package/lib/jupyter/lite/licenses/licenses.js +95 -0
- package/lib/jupyter/lite/licenses/licenses.js.map +1 -0
- package/lib/jupyter/lite/licenses/tokens.d.ts +74 -0
- package/lib/jupyter/lite/licenses/tokens.js +13 -0
- package/lib/jupyter/lite/licenses/tokens.js.map +1 -0
- package/lib/jupyter/lite/localforage/index.d.ts +2 -0
- package/lib/jupyter/lite/localforage/index.js +5 -0
- package/lib/jupyter/lite/localforage/index.js.map +1 -0
- package/lib/jupyter/lite/localforage/memory.d.ts +5 -0
- package/lib/jupyter/lite/localforage/memory.js +10 -0
- package/lib/jupyter/lite/localforage/memory.js.map +1 -0
- package/lib/jupyter/lite/localforage/tokens.d.ts +12 -0
- package/lib/jupyter/lite/localforage/tokens.js +8 -0
- package/lib/jupyter/lite/localforage/tokens.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.d.ts +18 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.js +45 -0
- package/lib/jupyter/lite/pyodide-kernel/_pypi.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.d.ts +15 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js +63 -0
- package/lib/jupyter/lite/pyodide-kernel/coincident.worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.d.ts +9 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js +50 -0
- package/lib/jupyter/lite/pyodide-kernel/comlink.worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/index.d.ts +6 -0
- package/lib/jupyter/lite/pyodide-kernel/index.js +9 -0
- package/lib/jupyter/lite/pyodide-kernel/index.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.d.ts +157 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.js +294 -0
- package/lib/jupyter/lite/pyodide-kernel/kernel.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/pypi/all-local.json +128 -0
- package/lib/jupyter/lite/pyodide-kernel/pypi/all.json +128 -0
- package/lib/jupyter/lite/pyodide-kernel/schema/piplite.v0.schema.json +113 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.d.ts +82 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.js +8 -0
- package/lib/jupyter/lite/pyodide-kernel/tokens.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.d.ts +138 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.js +426 -0
- package/lib/jupyter/lite/pyodide-kernel/worker.js.map +1 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.d.ts +4 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.js +88 -0
- package/lib/jupyter/lite/pyodide-kernel-extension/index.js.map +1 -0
- package/lib/jupyter/lite/server/app.d.ts +87 -0
- package/lib/jupyter/lite/server/app.js +157 -0
- package/lib/jupyter/lite/server/app.js.map +1 -0
- package/lib/jupyter/lite/server/index.d.ts +4 -0
- package/lib/jupyter/lite/server/index.js +7 -0
- package/lib/jupyter/lite/server/index.js.map +1 -0
- package/lib/jupyter/lite/server/router.d.ts +99 -0
- package/lib/jupyter/lite/server/router.js +109 -0
- package/lib/jupyter/lite/server/router.js.map +1 -0
- package/lib/jupyter/lite/server/service-manager.d.ts +21 -0
- package/lib/jupyter/lite/server/service-manager.js +102 -0
- package/lib/jupyter/lite/server/service-manager.js.map +1 -0
- package/lib/jupyter/lite/server/service-worker.d.ts +58 -0
- package/lib/jupyter/lite/server/service-worker.js +145 -0
- package/lib/jupyter/lite/server/service-worker.js.map +1 -0
- package/lib/jupyter/lite/server/status.d.ts +18 -0
- package/lib/jupyter/lite/server/status.js +21 -0
- package/lib/jupyter/lite/server/status.js.map +1 -0
- package/lib/jupyter/lite/server/tokens.d.ts +38 -0
- package/lib/jupyter/lite/server/tokens.js +8 -0
- package/lib/jupyter/lite/server/tokens.js.map +1 -0
- package/lib/jupyter/lite/server-extension/index.d.ts +3 -0
- package/lib/jupyter/lite/server-extension/index.js +500 -0
- package/lib/jupyter/lite/server-extension/index.js.map +1 -0
- package/lib/jupyter/lite/session/index.d.ts +2 -0
- package/lib/jupyter/lite/session/index.js +5 -0
- package/lib/jupyter/lite/session/index.js.map +1 -0
- package/lib/jupyter/lite/session/sessions.d.ts +68 -0
- package/lib/jupyter/lite/session/sessions.js +185 -0
- package/lib/jupyter/lite/session/sessions.js.map +1 -0
- package/lib/jupyter/lite/session/tokens.d.ts +40 -0
- package/lib/jupyter/lite/session/tokens.js +6 -0
- package/lib/jupyter/lite/session/tokens.js.map +1 -0
- package/lib/jupyter/lite/settings/index.d.ts +2 -0
- package/lib/jupyter/lite/settings/index.js +5 -0
- package/lib/jupyter/lite/settings/index.js.map +1 -0
- package/lib/jupyter/lite/settings/settings.d.ts +75 -0
- package/lib/jupyter/lite/settings/settings.js +155 -0
- package/lib/jupyter/lite/settings/settings.js.map +1 -0
- package/lib/jupyter/lite/settings/tokens.d.ts +65 -0
- package/lib/jupyter/lite/settings/tokens.js +6 -0
- package/lib/jupyter/lite/settings/tokens.js.map +1 -0
- package/lib/jupyter/lite/translation/index.d.ts +2 -0
- package/lib/jupyter/lite/translation/index.js +5 -0
- package/lib/jupyter/lite/translation/index.js.map +1 -0
- package/lib/jupyter/lite/translation/tokens.d.ts +17 -0
- package/lib/jupyter/lite/translation/tokens.js +6 -0
- package/lib/jupyter/lite/translation/tokens.js.map +1 -0
- package/lib/jupyter/lite/translation/translation.d.ts +13 -0
- package/lib/jupyter/lite/translation/translation.js +52 -0
- package/lib/jupyter/lite/translation/translation.js.map +1 -0
- package/lib/jupyter/lite/types/index.d.ts +1 -0
- package/lib/jupyter/lite/types/index.js +4 -0
- package/lib/jupyter/lite/types/index.js.map +1 -0
- package/lib/jupyter/lite/types/tokens.d.ts +27 -0
- package/lib/jupyter/lite/types/tokens.js +4 -0
- package/lib/jupyter/lite/types/tokens.js.map +1 -0
- package/lib/jupyter/services/ServiceManagerLite.js +15 -6
- package/lib/jupyter/services/ServiceManagerLite.js.map +1 -1
- package/lib/state/JupyterReactState.js +7 -8
- package/lib/state/JupyterReactState.js.map +1 -1
- package/lib/theme/JupyterLabCss.d.ts +1 -1
- package/lib/theme/JupyterLabCss.js +4 -2
- package/lib/theme/JupyterLabCss.js.map +1 -1
- package/lib/theme/JupyterReactTheme.d.ts +1 -1
- package/lib/tools/__tests__/operationRunner.test.d.ts +1 -0
- package/lib/tools/__tests__/operationRunner.test.js +193 -0
- package/lib/tools/__tests__/operationRunner.test.js.map +1 -0
- package/lib/tools/core/executor.d.ts +46 -0
- package/lib/tools/core/executor.js +55 -0
- package/lib/tools/core/executor.js.map +1 -0
- package/lib/tools/core/formatter.d.ts +20 -0
- package/lib/tools/core/formatter.js +41 -0
- package/lib/tools/core/formatter.js.map +1 -0
- package/lib/tools/core/index.d.ts +18 -0
- package/lib/tools/core/index.js +24 -0
- package/lib/tools/core/index.js.map +1 -0
- package/lib/tools/core/interfaces.d.ts +38 -0
- package/lib/tools/core/interfaces.js +7 -0
- package/lib/tools/core/interfaces.js.map +1 -0
- package/lib/tools/core/operationRunner.d.ts +27 -0
- package/lib/tools/core/operationRunner.js +33 -0
- package/lib/tools/core/operationRunner.js.map +1 -0
- package/lib/tools/core/schema.d.ts +47 -0
- package/lib/tools/core/schema.js +7 -0
- package/lib/tools/core/schema.js.map +1 -0
- package/lib/tools/core/types.d.ts +36 -0
- package/lib/tools/core/types.js +7 -0
- package/lib/tools/core/types.js.map +1 -0
- package/lib/tools/core/zodUtils.d.ts +56 -0
- package/lib/tools/core/zodUtils.js +179 -0
- package/lib/tools/core/zodUtils.js.map +1 -0
- package/lib/tools/definitions/deleteCell.d.ts +7 -0
- package/lib/tools/definitions/deleteCell.js +25 -0
- package/lib/tools/definitions/deleteCell.js.map +1 -0
- package/lib/tools/definitions/executeCode.d.ts +7 -0
- package/lib/tools/definitions/executeCode.js +33 -0
- package/lib/tools/definitions/executeCode.js.map +1 -0
- package/lib/tools/definitions/index.d.ts +12 -0
- package/lib/tools/definitions/index.js +18 -0
- package/lib/tools/definitions/index.js.map +1 -0
- package/lib/tools/definitions/insertCell.d.ts +7 -0
- package/lib/tools/definitions/insertCell.js +24 -0
- package/lib/tools/definitions/insertCell.js.map +1 -0
- package/lib/tools/definitions/readAllCells.d.ts +7 -0
- package/lib/tools/definitions/readAllCells.js +24 -0
- package/lib/tools/definitions/readAllCells.js.map +1 -0
- package/lib/tools/definitions/readCell.d.ts +7 -0
- package/lib/tools/definitions/readCell.js +24 -0
- package/lib/tools/definitions/readCell.js.map +1 -0
- package/lib/tools/definitions/runCell.d.ts +7 -0
- package/lib/tools/definitions/runCell.js +31 -0
- package/lib/tools/definitions/runCell.js.map +1 -0
- package/lib/tools/definitions/updateCell.d.ts +7 -0
- package/lib/tools/definitions/updateCell.js +24 -0
- package/lib/tools/definitions/updateCell.js.map +1 -0
- package/lib/tools/index.d.ts +20 -0
- package/lib/tools/index.js +62 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/tools/operations/deleteCell.d.ts +49 -0
- package/lib/tools/operations/deleteCell.js +103 -0
- package/lib/tools/operations/deleteCell.js.map +1 -0
- package/lib/tools/operations/executeCode.d.ts +33 -0
- package/lib/tools/operations/executeCode.js +45 -0
- package/lib/tools/operations/executeCode.js.map +1 -0
- package/lib/tools/operations/insertCell.d.ts +27 -0
- package/lib/tools/operations/insertCell.js +56 -0
- package/lib/tools/operations/insertCell.js.map +1 -0
- package/lib/tools/operations/readAllCells.d.ts +21 -0
- package/lib/tools/operations/readAllCells.js +45 -0
- package/lib/tools/operations/readAllCells.js.map +1 -0
- package/lib/tools/operations/readCell.d.ts +39 -0
- package/lib/tools/operations/readCell.js +90 -0
- package/lib/tools/operations/readCell.js.map +1 -0
- package/lib/tools/operations/runCell.d.ts +24 -0
- package/lib/tools/operations/runCell.js +124 -0
- package/lib/tools/operations/runCell.js.map +1 -0
- package/lib/tools/operations/updateCell.d.ts +27 -0
- package/lib/tools/operations/updateCell.js +53 -0
- package/lib/tools/operations/updateCell.js.map +1 -0
- package/lib/tools/schemas/deleteCell.d.ts +20 -0
- package/lib/tools/schemas/deleteCell.js +24 -0
- package/lib/tools/schemas/deleteCell.js.map +1 -0
- package/lib/tools/schemas/executeCode.d.ts +19 -0
- package/lib/tools/schemas/executeCode.js +28 -0
- package/lib/tools/schemas/executeCode.js.map +1 -0
- package/lib/tools/schemas/index.d.ts +12 -0
- package/lib/tools/schemas/index.js +18 -0
- package/lib/tools/schemas/index.js.map +1 -0
- package/lib/tools/schemas/insertCell.d.ts +24 -0
- package/lib/tools/schemas/insertCell.js +29 -0
- package/lib/tools/schemas/insertCell.js.map +1 -0
- package/lib/tools/schemas/readAllCells.d.ts +19 -0
- package/lib/tools/schemas/readAllCells.js +18 -0
- package/lib/tools/schemas/readAllCells.js.map +1 -0
- package/lib/tools/schemas/readCell.d.ts +19 -0
- package/lib/tools/schemas/readCell.js +24 -0
- package/lib/tools/schemas/readCell.js.map +1 -0
- package/lib/tools/schemas/runCell.d.ts +21 -0
- package/lib/tools/schemas/runCell.js +39 -0
- package/lib/tools/schemas/runCell.js.map +1 -0
- package/lib/tools/schemas/updateCell.d.ts +19 -0
- package/lib/tools/schemas/updateCell.js +21 -0
- package/lib/tools/schemas/updateCell.js.map +1 -0
- package/package.json +40 -28
- package/schema/kernel.v0.schema.json +42 -0
- package/style/icons/pyodide.svg +17 -0
- package/lib/components/kernel/Kernelndicator.js.map +0 -1
- package/lib/examples/NotebookToc.js.map +0 -1
- /package/lib/examples/{NotebookToc.d.ts → KernelExecutorLite.d.ts} +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
|
|
2
|
+
import { ObservableMap } from '@jupyterlab/observables';
|
|
3
|
+
import { KernelAPI } from '@jupyterlab/services';
|
|
4
|
+
import { deserialize, serialize, } from '@jupyterlab/services/lib/kernel/serialize';
|
|
5
|
+
import { supportedKernelWebSocketProtocols } from '@jupyterlab/services/lib/kernel/messages';
|
|
6
|
+
import { UUID } from '@lumino/coreutils';
|
|
7
|
+
import { Signal } from '@lumino/signaling';
|
|
8
|
+
import { Mutex } from 'async-mutex';
|
|
9
|
+
import { Server as WebSocketServer, } from 'mock-socket';
|
|
10
|
+
/**
|
|
11
|
+
* Use the default kernel wire protocol.
|
|
12
|
+
*/
|
|
13
|
+
const KERNEL_WEBSOCKET_PROTOCOL = supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg;
|
|
14
|
+
/**
|
|
15
|
+
* A class to handle requests to /api/kernels
|
|
16
|
+
*/
|
|
17
|
+
export class Kernels {
|
|
18
|
+
/**
|
|
19
|
+
* Construct a new Kernels
|
|
20
|
+
*
|
|
21
|
+
* @param options The instantiation options
|
|
22
|
+
*/
|
|
23
|
+
constructor(options) {
|
|
24
|
+
const { kernelspecs } = options;
|
|
25
|
+
this._kernelspecs = kernelspecs;
|
|
26
|
+
// Forward the changed signal from _kernels
|
|
27
|
+
this._kernels.changed.connect((_, args) => {
|
|
28
|
+
this._changed.emit(args);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Signal emitted when the kernels map changes
|
|
33
|
+
*/
|
|
34
|
+
get changed() {
|
|
35
|
+
return this._changed;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Start a new kernel.
|
|
39
|
+
*
|
|
40
|
+
* @param options The kernel start options.
|
|
41
|
+
*/
|
|
42
|
+
async startNew(options) {
|
|
43
|
+
const { id, name, location } = options;
|
|
44
|
+
const factory = this._kernelspecs.factories.get(name);
|
|
45
|
+
// bail if there is no factory associated with the requested kernel
|
|
46
|
+
if (!factory) {
|
|
47
|
+
console.error('No factory associated with', name, this._kernelspecs.factories);
|
|
48
|
+
return { id, name };
|
|
49
|
+
}
|
|
50
|
+
// create a synchronization mechanism to allow only one message
|
|
51
|
+
// to be processed at a time
|
|
52
|
+
const mutex = new Mutex();
|
|
53
|
+
// hook a new client to a kernel
|
|
54
|
+
const hook = (kernelId, clientId, socket) => {
|
|
55
|
+
const kernel = this._kernels.get(kernelId);
|
|
56
|
+
if (!kernel) {
|
|
57
|
+
throw Error(`No kernel ${kernelId}`);
|
|
58
|
+
}
|
|
59
|
+
this._clients.set(clientId, socket);
|
|
60
|
+
this._kernelClients.get(kernelId)?.add(clientId);
|
|
61
|
+
const processMsg = async (msg) => {
|
|
62
|
+
await mutex.runExclusive(async () => {
|
|
63
|
+
await kernel.ready;
|
|
64
|
+
await kernel.handleMessage(msg);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
socket.on('message', async (message) => {
|
|
68
|
+
let msg;
|
|
69
|
+
if (message instanceof ArrayBuffer) {
|
|
70
|
+
message = new Uint8Array(message).buffer;
|
|
71
|
+
msg = deserialize(message, KERNEL_WEBSOCKET_PROTOCOL);
|
|
72
|
+
}
|
|
73
|
+
else if (typeof message === 'string') {
|
|
74
|
+
const encoder = new TextEncoder();
|
|
75
|
+
const encodedData = encoder.encode(message);
|
|
76
|
+
msg = deserialize(encodedData.buffer, KERNEL_WEBSOCKET_PROTOCOL);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// TODO Find a better solution for this?
|
|
82
|
+
// input-reply is asynchronous, must not be processed like other messages
|
|
83
|
+
if (msg.header.msg_type === 'input_reply') {
|
|
84
|
+
kernel.handleMessage(msg);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
void processMsg(msg);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const removeClient = () => {
|
|
91
|
+
this._clients.delete(clientId);
|
|
92
|
+
this._kernelClients.get(kernelId)?.delete(clientId);
|
|
93
|
+
};
|
|
94
|
+
kernel.disposed.connect(removeClient);
|
|
95
|
+
socket.onclose = removeClient;
|
|
96
|
+
};
|
|
97
|
+
// ensure kernel id
|
|
98
|
+
const kernelId = id ?? UUID.uuid4();
|
|
99
|
+
// There is one server per kernel which handles multiple clients
|
|
100
|
+
const kernelUrl = URLExt.join(Kernels.WS_BASE_URL, KernelAPI.KERNEL_SERVICE_URL, encodeURIComponent(kernelId), 'channels');
|
|
101
|
+
const runningKernel = this._kernels.get(kernelId);
|
|
102
|
+
if (runningKernel) {
|
|
103
|
+
return {
|
|
104
|
+
id: runningKernel.id,
|
|
105
|
+
name: runningKernel.name,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// start the kernel
|
|
109
|
+
const sendMessage = (msg) => {
|
|
110
|
+
const clientId = msg.header.session;
|
|
111
|
+
const socket = this._clients.get(clientId);
|
|
112
|
+
if (!socket) {
|
|
113
|
+
console.warn(`Trying to send message on removed socket for kernel ${kernelId}`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const message = serialize(msg, KERNEL_WEBSOCKET_PROTOCOL);
|
|
117
|
+
// process iopub messages
|
|
118
|
+
if (msg.channel === 'iopub') {
|
|
119
|
+
const clients = this._kernelClients.get(kernelId);
|
|
120
|
+
clients?.forEach(id => {
|
|
121
|
+
this._clients.get(id)?.send(message);
|
|
122
|
+
});
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
socket.send(message);
|
|
126
|
+
};
|
|
127
|
+
const kernel = await factory({
|
|
128
|
+
id: kernelId,
|
|
129
|
+
sendMessage,
|
|
130
|
+
name,
|
|
131
|
+
location,
|
|
132
|
+
});
|
|
133
|
+
this._kernels.set(kernelId, kernel);
|
|
134
|
+
this._kernelClients.set(kernelId, new Set());
|
|
135
|
+
// create the websocket server for the kernel
|
|
136
|
+
const wsServer = new WebSocketServer(kernelUrl, {
|
|
137
|
+
mock: false,
|
|
138
|
+
selectProtocol: () => KERNEL_WEBSOCKET_PROTOCOL,
|
|
139
|
+
});
|
|
140
|
+
wsServer.on('connection', (socket) => {
|
|
141
|
+
const url = new URL(socket.url);
|
|
142
|
+
const clientId = url.searchParams.get('session_id') ?? '';
|
|
143
|
+
hook(kernelId, clientId, socket);
|
|
144
|
+
});
|
|
145
|
+
// clean up closed connection
|
|
146
|
+
wsServer.on('close', () => {
|
|
147
|
+
this._clients.keys().forEach(clientId => {
|
|
148
|
+
const socket = this._clients.get(clientId);
|
|
149
|
+
if (socket?.readyState === WebSocket.CLOSED) {
|
|
150
|
+
this._clients.delete(clientId);
|
|
151
|
+
this._kernelClients.get(kernelId)?.delete(clientId);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
// cleanup on kernel shutdown
|
|
156
|
+
kernel.disposed.connect(() => {
|
|
157
|
+
wsServer.close();
|
|
158
|
+
this._kernels.delete(kernelId);
|
|
159
|
+
this._kernelClients.delete(kernelId);
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
id: kernel.id,
|
|
163
|
+
name: kernel.name,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Restart a kernel.
|
|
168
|
+
*
|
|
169
|
+
* @param kernelId The kernel id.
|
|
170
|
+
*/
|
|
171
|
+
async restart(kernelId) {
|
|
172
|
+
const kernel = this._kernels.get(kernelId);
|
|
173
|
+
if (!kernel) {
|
|
174
|
+
throw Error(`Kernel ${kernelId} does not exist`);
|
|
175
|
+
}
|
|
176
|
+
const { id, name, location } = kernel;
|
|
177
|
+
kernel.dispose();
|
|
178
|
+
return this.startNew({ id, name, location });
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* List the running kernels.
|
|
182
|
+
*/
|
|
183
|
+
async list() {
|
|
184
|
+
return [...this._kernels.values()].map(kernel => ({
|
|
185
|
+
id: kernel.id,
|
|
186
|
+
name: kernel.name,
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Shut down a kernel.
|
|
191
|
+
*
|
|
192
|
+
* @param id The kernel id.
|
|
193
|
+
*/
|
|
194
|
+
async shutdown(id) {
|
|
195
|
+
this._kernels.delete(id)?.dispose();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get a kernel by id
|
|
199
|
+
*/
|
|
200
|
+
async get(id) {
|
|
201
|
+
return this._kernels.get(id);
|
|
202
|
+
}
|
|
203
|
+
_kernels = new ObservableMap();
|
|
204
|
+
_clients = new ObservableMap();
|
|
205
|
+
_kernelClients = new ObservableMap();
|
|
206
|
+
_kernelspecs;
|
|
207
|
+
_changed = new Signal(this);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* A namespace for Kernels statics.
|
|
211
|
+
*/
|
|
212
|
+
(function (Kernels) {
|
|
213
|
+
/**
|
|
214
|
+
* The base url for the Kernels manager
|
|
215
|
+
*/
|
|
216
|
+
Kernels.WS_BASE_URL = PageConfig.getBaseUrl().replace(/^http/, 'ws');
|
|
217
|
+
})(Kernels || (Kernels = {}));
|
|
218
|
+
//# sourceMappingURL=kernels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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,QAAQ,GAAG,IAAI,aAAa,EAAmB,CAAC;IAChD,cAAc,GAAG,IAAI,aAAa,EAAe,CAAC;IAClD,YAAY,CAAe;IAC3B,QAAQ,GAAG,IAAI,MAAM,CAC3B,IAAI,CACL,CAAC;CACH;AAED;;GAEG;AACH,WAAiB,OAAO;IA+BtB;;OAEG;IACU,mBAAW,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC5E,CAAC,EAnCgB,OAAO,KAAP,OAAO,QAmCvB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { KernelSpec } from '@jupyterlab/services';
|
|
2
|
+
import { IKernel, IKernelSpecs } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* A class to handle requests to /api/kernelspecs
|
|
5
|
+
*/
|
|
6
|
+
export declare class KernelSpecs implements IKernelSpecs {
|
|
7
|
+
/**
|
|
8
|
+
* Get the kernel specs.
|
|
9
|
+
*/
|
|
10
|
+
get specs(): KernelSpec.ISpecModels | null;
|
|
11
|
+
/**
|
|
12
|
+
* Get the default kernel name.
|
|
13
|
+
*/
|
|
14
|
+
get defaultKernelName(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the kernel factories for the current kernels.
|
|
17
|
+
*/
|
|
18
|
+
get factories(): KernelSpecs.KernelFactories;
|
|
19
|
+
/**
|
|
20
|
+
* Register a new kernel.
|
|
21
|
+
*
|
|
22
|
+
* @param options The options to register a new kernel.
|
|
23
|
+
*/
|
|
24
|
+
register(options: KernelSpecs.IKernelOptions): void;
|
|
25
|
+
private _specs;
|
|
26
|
+
private _factories;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A namespace for KernelSpecs statics.
|
|
30
|
+
*/
|
|
31
|
+
export declare namespace KernelSpecs {
|
|
32
|
+
/**
|
|
33
|
+
* Registration options for a new kernel.
|
|
34
|
+
*/
|
|
35
|
+
interface IKernelOptions {
|
|
36
|
+
/**
|
|
37
|
+
* The kernel spec.
|
|
38
|
+
*/
|
|
39
|
+
spec: KernelSpec.ISpecModel;
|
|
40
|
+
/**
|
|
41
|
+
* The factory function to instantiate a new kernel.
|
|
42
|
+
*/
|
|
43
|
+
create: KernelFactory;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The type for a kernel factory function used to instantiate new kernels.
|
|
47
|
+
*/
|
|
48
|
+
type KernelFactory = (options: IKernel.IOptions) => Promise<IKernel>;
|
|
49
|
+
/**
|
|
50
|
+
* The type for the record of kernel factory functions.
|
|
51
|
+
*/
|
|
52
|
+
type KernelFactories = Map<string, KernelFactory>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PageConfig } from '@jupyterlab/coreutils';
|
|
2
|
+
import { FALLBACK_KERNEL } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* A class to handle requests to /api/kernelspecs
|
|
5
|
+
*/
|
|
6
|
+
export class KernelSpecs {
|
|
7
|
+
/**
|
|
8
|
+
* Get the kernel specs.
|
|
9
|
+
*/
|
|
10
|
+
get specs() {
|
|
11
|
+
if (this._specs.size === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
default: this.defaultKernelName,
|
|
16
|
+
kernelspecs: Object.fromEntries(this._specs),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the default kernel name.
|
|
21
|
+
*/
|
|
22
|
+
get defaultKernelName() {
|
|
23
|
+
let defaultKernelName = PageConfig.getOption('defaultKernelName');
|
|
24
|
+
if (!defaultKernelName && this._specs.size) {
|
|
25
|
+
const keys = Array.from(this._specs.keys());
|
|
26
|
+
keys.sort();
|
|
27
|
+
defaultKernelName = keys[0];
|
|
28
|
+
}
|
|
29
|
+
return defaultKernelName || FALLBACK_KERNEL;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the kernel factories for the current kernels.
|
|
33
|
+
*/
|
|
34
|
+
get factories() {
|
|
35
|
+
return this._factories;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Register a new kernel.
|
|
39
|
+
*
|
|
40
|
+
* @param options The options to register a new kernel.
|
|
41
|
+
*/
|
|
42
|
+
register(options) {
|
|
43
|
+
const { spec, create } = options;
|
|
44
|
+
this._specs.set(spec.name, spec);
|
|
45
|
+
this._factories.set(spec.name, create);
|
|
46
|
+
}
|
|
47
|
+
_specs = new Map();
|
|
48
|
+
_factories = new Map();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=kernelspecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernelspecs.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/kernel/kernelspecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAyB,eAAe,EAAE,MAAM,UAAU,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;OAEG;IACH,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,iBAAiB;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;SAC7C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,iBAAiB;QACnB,IAAI,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAElE,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,iBAAiB,IAAI,eAAe,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAmC;QAC1C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAEO,MAAM,GAAG,IAAI,GAAG,EAAiC,CAAC;IAClD,UAAU,GAAG,IAAI,GAAG,EAAqC,CAAC;CACnE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { Remote } from 'comlink';
|
|
2
|
+
import { IObservableMap } from '@jupyterlab/observables';
|
|
3
|
+
import { Kernel, KernelMessage, KernelSpec } from '@jupyterlab/services';
|
|
4
|
+
import { Token } from '@lumino/coreutils';
|
|
5
|
+
import { IObservableDisposable } from '@lumino/disposable';
|
|
6
|
+
import { ISignal } from '@lumino/signaling';
|
|
7
|
+
import { Kernels } from './kernels';
|
|
8
|
+
import { KernelSpecs } from './kernelspecs';
|
|
9
|
+
/**
|
|
10
|
+
* The token for the kernels service.
|
|
11
|
+
*/
|
|
12
|
+
export declare const IKernels: Token<IKernels>;
|
|
13
|
+
/**
|
|
14
|
+
* The kernel name of last resort.
|
|
15
|
+
*/
|
|
16
|
+
export declare const FALLBACK_KERNEL = "javascript";
|
|
17
|
+
/**
|
|
18
|
+
* An interface for the Kernels service.
|
|
19
|
+
*/
|
|
20
|
+
export interface IKernels {
|
|
21
|
+
/**
|
|
22
|
+
* Signal emitted when the kernels map changes
|
|
23
|
+
*/
|
|
24
|
+
readonly changed: ISignal<IKernels, IObservableMap.IChangedArgs<IKernel>>;
|
|
25
|
+
/**
|
|
26
|
+
* Start a new kernel.
|
|
27
|
+
*
|
|
28
|
+
* @param options The kernel startup options.
|
|
29
|
+
*/
|
|
30
|
+
startNew: (options: Kernels.IKernelOptions) => Promise<Kernel.IModel>;
|
|
31
|
+
/**
|
|
32
|
+
* Restart a kernel.
|
|
33
|
+
*
|
|
34
|
+
* @param id The kernel id.
|
|
35
|
+
*/
|
|
36
|
+
restart: (id: string) => Promise<Kernel.IModel>;
|
|
37
|
+
/**
|
|
38
|
+
* List the running kernels.
|
|
39
|
+
*/
|
|
40
|
+
list: () => Promise<Kernel.IModel[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Shut down a kernel.
|
|
43
|
+
*
|
|
44
|
+
* @param id The kernel id.
|
|
45
|
+
*/
|
|
46
|
+
shutdown: (id: string) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Get a kernel by id
|
|
49
|
+
*
|
|
50
|
+
* @param id The kernel id.
|
|
51
|
+
* @returns the kernel if it exists, undefined otherwise.
|
|
52
|
+
*/
|
|
53
|
+
get(id: string): Promise<IKernel | undefined>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* An interface for a kernel running in the browser.
|
|
57
|
+
*/
|
|
58
|
+
export interface IKernel extends IObservableDisposable {
|
|
59
|
+
/**
|
|
60
|
+
* The id of the server-side kernel.
|
|
61
|
+
*/
|
|
62
|
+
readonly id: string;
|
|
63
|
+
/**
|
|
64
|
+
* The name of the server-side kernel.
|
|
65
|
+
*/
|
|
66
|
+
readonly name: string;
|
|
67
|
+
/**
|
|
68
|
+
* The location in the virtual filesystem from which the kernel was started.
|
|
69
|
+
*/
|
|
70
|
+
readonly location: string;
|
|
71
|
+
/**
|
|
72
|
+
* A promise that is fulfilled when the kernel is ready.
|
|
73
|
+
*/
|
|
74
|
+
readonly ready: Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Handle an incoming message from the client.
|
|
77
|
+
*
|
|
78
|
+
* @param msg The message to handle
|
|
79
|
+
*/
|
|
80
|
+
handleMessage(msg: KernelMessage.IMessage): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A namespace for IKernel statics.
|
|
84
|
+
*/
|
|
85
|
+
export declare namespace IKernel {
|
|
86
|
+
/**
|
|
87
|
+
* The type for the send message function.
|
|
88
|
+
*/
|
|
89
|
+
type SendMessage = (msg: KernelMessage.IMessage) => void;
|
|
90
|
+
/**
|
|
91
|
+
* The instantiation options for an IKernel.
|
|
92
|
+
*/
|
|
93
|
+
interface IOptions {
|
|
94
|
+
/**
|
|
95
|
+
* The kernel id.
|
|
96
|
+
*/
|
|
97
|
+
id: string;
|
|
98
|
+
/**
|
|
99
|
+
* The name of the kernel.
|
|
100
|
+
*/
|
|
101
|
+
name: string;
|
|
102
|
+
/**
|
|
103
|
+
* The location in the virtual filesystem from which the kernel was started.
|
|
104
|
+
*/
|
|
105
|
+
location: string;
|
|
106
|
+
/**
|
|
107
|
+
* The method to send messages back to the server.
|
|
108
|
+
*/
|
|
109
|
+
sendMessage: SendMessage;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The token for the kernel spec service.
|
|
114
|
+
*/
|
|
115
|
+
export declare const IKernelSpecs: Token<IKernelSpecs>;
|
|
116
|
+
/**
|
|
117
|
+
* The interface for the kernel specs service.
|
|
118
|
+
*/
|
|
119
|
+
export interface IKernelSpecs {
|
|
120
|
+
/**
|
|
121
|
+
* Get the kernel specs.
|
|
122
|
+
*/
|
|
123
|
+
readonly specs: KernelSpec.ISpecModels | null;
|
|
124
|
+
/**
|
|
125
|
+
* Get the default kernel name.
|
|
126
|
+
*/
|
|
127
|
+
readonly defaultKernelName: string;
|
|
128
|
+
/**
|
|
129
|
+
* Get the kernel factories for the current kernels.
|
|
130
|
+
*/
|
|
131
|
+
readonly factories: KernelSpecs.KernelFactories;
|
|
132
|
+
/**
|
|
133
|
+
* Register a new kernel spec
|
|
134
|
+
*
|
|
135
|
+
* @param options The kernel spec options.
|
|
136
|
+
*/
|
|
137
|
+
register: (options: KernelSpecs.IKernelOptions) => void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* An interface for a comlink-based worker kernel
|
|
141
|
+
*/
|
|
142
|
+
export interface IWorkerKernel {
|
|
143
|
+
/**
|
|
144
|
+
* Handle any lazy setup activities.
|
|
145
|
+
*/
|
|
146
|
+
initialize(options: IWorkerKernel.IOptions): Promise<void>;
|
|
147
|
+
execute(content: KernelMessage.IExecuteRequestMsg['content'], parent: any): Promise<KernelMessage.IExecuteReplyMsg['content']>;
|
|
148
|
+
complete(content: KernelMessage.ICompleteRequestMsg['content'], parent: any): Promise<KernelMessage.ICompleteReplyMsg['content']>;
|
|
149
|
+
inspect(content: KernelMessage.IInspectRequestMsg['content'], parent: any): Promise<KernelMessage.IInspectReplyMsg['content']>;
|
|
150
|
+
isComplete(content: KernelMessage.IIsCompleteRequestMsg['content'], parent: any): Promise<KernelMessage.IIsCompleteReplyMsg['content']>;
|
|
151
|
+
commInfo(content: KernelMessage.ICommInfoRequestMsg['content'], parent: any): Promise<KernelMessage.ICommInfoReplyMsg['content']>;
|
|
152
|
+
commOpen(content: KernelMessage.ICommOpenMsg, parent: any): Promise<void>;
|
|
153
|
+
commMsg(content: KernelMessage.ICommMsgMsg, parent: any): Promise<void>;
|
|
154
|
+
commClose(content: KernelMessage.ICommCloseMsg, parent: any): Promise<void>;
|
|
155
|
+
inputReply(content: KernelMessage.IInputReplyMsg['content'], parent: any): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A namespace for worker kernels.
|
|
159
|
+
**/
|
|
160
|
+
export declare namespace IWorkerKernel {
|
|
161
|
+
/**
|
|
162
|
+
* Common values likely to be required by all kernels.
|
|
163
|
+
*/
|
|
164
|
+
interface IOptions {
|
|
165
|
+
/**
|
|
166
|
+
* The base URL of the kernel server.
|
|
167
|
+
*/
|
|
168
|
+
baseUrl: string;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export type IRemoteKernel = Remote<IWorkerKernel>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { Token } from '@lumino/coreutils';
|
|
4
|
+
/**
|
|
5
|
+
* The token for the kernels service.
|
|
6
|
+
*/
|
|
7
|
+
export const IKernels = new Token('@jupyterlite/kernel:IKernels');
|
|
8
|
+
/**
|
|
9
|
+
* The kernel name of last resort.
|
|
10
|
+
*/
|
|
11
|
+
export const FALLBACK_KERNEL = 'javascript';
|
|
12
|
+
/**
|
|
13
|
+
* The token for the kernel spec service.
|
|
14
|
+
*/
|
|
15
|
+
export const IKernelSpecs = new Token('@jupyterlite/kernel:IKernelSpecs');
|
|
16
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/kernel/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAQ3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAU1C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAW,8BAA8B,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAiH5C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,KAAK,CACnC,kCAAkC,CACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/licenses/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IFederatedExtension } from '../types';
|
|
2
|
+
import { ILicenseBundle, ILicenseBundles, ILicenseResponse, ILicenses } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* A JupyterLite implementation of the jupyterlab_server licenses route
|
|
5
|
+
*/
|
|
6
|
+
export declare class Licenses implements ILicenses {
|
|
7
|
+
/**
|
|
8
|
+
* A GET handler for the licenses
|
|
9
|
+
*/
|
|
10
|
+
get(): Promise<ILicenseResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the app name (or default).
|
|
13
|
+
*/
|
|
14
|
+
protected get appName(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the well-known URL of the app licenses.
|
|
17
|
+
*/
|
|
18
|
+
protected get appLicensesUrl(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the lab extension base url.
|
|
21
|
+
*/
|
|
22
|
+
protected get labExtensionsUrl(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the licenses for the app distribution itself, or the empty bundle.
|
|
25
|
+
*/
|
|
26
|
+
_getAppLicenses(): Promise<ILicenseBundle>;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the licenses for all federated extensions.
|
|
29
|
+
*/
|
|
30
|
+
_getFederated(): Promise<ILicenseBundles>;
|
|
31
|
+
/**
|
|
32
|
+
* Update the bundles with the extension's licenses, or the empty bundle.
|
|
33
|
+
*/
|
|
34
|
+
_getOneFederated(ext: IFederatedExtension, bundles: ILicenseBundles): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { URLExt, PageConfig } from '@jupyterlab/coreutils';
|
|
4
|
+
import { THIRD_PARTY_LICENSES, } from './tokens';
|
|
5
|
+
/**
|
|
6
|
+
* An empty bundle.
|
|
7
|
+
*/
|
|
8
|
+
const EMPTY_BUNDLE = Object.freeze({ packages: [] });
|
|
9
|
+
/**
|
|
10
|
+
* A JupyterLite implementation of the jupyterlab_server licenses route
|
|
11
|
+
*/
|
|
12
|
+
export class Licenses {
|
|
13
|
+
/**
|
|
14
|
+
* A GET handler for the licenses
|
|
15
|
+
*/
|
|
16
|
+
async get() {
|
|
17
|
+
return {
|
|
18
|
+
bundles: {
|
|
19
|
+
...(await this._getFederated()),
|
|
20
|
+
[this.appName]: await this._getAppLicenses(),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the app name (or default).
|
|
26
|
+
*/
|
|
27
|
+
get appName() {
|
|
28
|
+
return PageConfig.getOption('appName') || 'JupyterLite';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the well-known URL of the app licenses.
|
|
32
|
+
*/
|
|
33
|
+
get appLicensesUrl() {
|
|
34
|
+
return URLExt.join(PageConfig.getBaseUrl(), 'build', THIRD_PARTY_LICENSES);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the lab extension base url.
|
|
38
|
+
*/
|
|
39
|
+
get labExtensionsUrl() {
|
|
40
|
+
return PageConfig.getOption('fullLabextensionsUrl');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolve the licenses for the app distribution itself, or the empty bundle.
|
|
44
|
+
*/
|
|
45
|
+
async _getAppLicenses() {
|
|
46
|
+
let bundle = EMPTY_BUNDLE;
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetch(this.appLicensesUrl);
|
|
49
|
+
bundle = response.json();
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
console.warn('Could not resolve licenses for', this.appName);
|
|
53
|
+
}
|
|
54
|
+
return bundle;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve the licenses for all federated extensions.
|
|
58
|
+
*/
|
|
59
|
+
async _getFederated() {
|
|
60
|
+
const bundles = {};
|
|
61
|
+
let federated;
|
|
62
|
+
try {
|
|
63
|
+
federated = JSON.parse(PageConfig.getOption('federated_extensions'));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return bundles;
|
|
67
|
+
}
|
|
68
|
+
const promises = [];
|
|
69
|
+
for (const ext of federated) {
|
|
70
|
+
promises.push(this._getOneFederated(ext, bundles));
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
await Promise.all(promises);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
console.warn('Error resolving licenses', err);
|
|
77
|
+
}
|
|
78
|
+
return bundles;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Update the bundles with the extension's licenses, or the empty bundle.
|
|
82
|
+
*/
|
|
83
|
+
async _getOneFederated(ext, bundles) {
|
|
84
|
+
try {
|
|
85
|
+
const url = URLExt.join(this.labExtensionsUrl, ext.name, 'static', THIRD_PARTY_LICENSES);
|
|
86
|
+
const response = await fetch(url);
|
|
87
|
+
bundles[ext.name] = await response.json();
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
console.warn('Could not resolve licenses for', ext);
|
|
91
|
+
bundles[ext.name] = EMPTY_BUNDLE;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=licenses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"licenses.js","sourceRoot":"","sources":["../../../../src/jupyter/lite/licenses/licenses.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAKL,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,YAAY,GAAmB,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,QAAQ;IACnB;;OAEG;IACH,KAAK,CAAC,GAAG;QACP,O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