@datalayer/jupyter-react 1.1.7 → 1.1.9

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.
Files changed (222) hide show
  1. package/lib/components/cell/Cell.d.ts +3 -6
  2. package/lib/components/cell/Cell.js +2 -11
  3. package/lib/components/cell/Cell.js.map +1 -1
  4. package/lib/components/cell/CellAdapter.d.ts +1 -1
  5. package/lib/components/codemirror/CodeMirrorOutputToolbar.d.ts +2 -2
  6. package/lib/components/codemirror/CodeMirrorOutputToolbar.js.map +1 -1
  7. package/lib/components/console/ConsoleAdapter.d.ts +1 -1
  8. package/lib/components/console/ConsoleAdapter.js +1 -1
  9. package/lib/components/console/ConsoleAdapter.js.map +1 -1
  10. package/lib/components/jupyterlab/JupyterLabApp.d.ts +16 -19
  11. package/lib/components/jupyterlab/JupyterLabApp.js +21 -21
  12. package/lib/components/jupyterlab/JupyterLabApp.js.map +1 -1
  13. package/lib/components/jupyterlab/JupyterLabAppAdapter.d.ts +4 -4
  14. package/lib/components/jupyterlab/JupyterLabAppAdapter.js +1 -1
  15. package/lib/components/jupyterlab/JupyterLabAppAdapter.js.map +1 -1
  16. package/lib/components/jupyterlab/JupyterLabAppCss.d.ts +1 -4
  17. package/lib/components/jupyterlab/JupyterLabAppCss.js +1 -5
  18. package/lib/components/jupyterlab/JupyterLabAppCss.js.map +1 -1
  19. package/lib/components/kernel/KernelActionMenu.d.ts +2 -2
  20. package/lib/components/kernel/KernelActionMenu.js.map +1 -1
  21. package/lib/components/kernel/KernelDetective.d.ts +1 -1
  22. package/lib/components/kernel/KernelInspector.d.ts +2 -2
  23. package/lib/components/kernel/KernelInspector.js.map +1 -1
  24. package/lib/components/kernel/KernelSelector.d.ts +2 -2
  25. package/lib/components/kernel/KernelSelector.js.map +1 -1
  26. package/lib/components/kernel/KernelUsage.d.ts +2 -2
  27. package/lib/components/kernel/KernelUsage.js.map +1 -1
  28. package/lib/components/kernel/KernelVariables.d.ts +2 -2
  29. package/lib/components/kernel/KernelVariables.js.map +1 -1
  30. package/lib/components/kernel/Kernelndicator.d.ts +1 -1
  31. package/lib/components/kernel/Kernelndicator.js +17 -13
  32. package/lib/components/kernel/Kernelndicator.js.map +1 -1
  33. package/lib/components/kernel/variables/kernelconnector.d.ts +2 -2
  34. package/lib/components/kernel/variables/kernelconnector.js +2 -2
  35. package/lib/components/kernel/variables/widget.d.ts +4 -2
  36. package/lib/components/kernel/variables/widget.js.map +1 -1
  37. package/lib/components/lumino/Lumino.d.ts +2 -8
  38. package/lib/components/lumino/Lumino.js +1 -6
  39. package/lib/components/lumino/Lumino.js.map +1 -1
  40. package/lib/components/lumino/LuminoBox.d.ts +3 -9
  41. package/lib/components/lumino/LuminoBox.js +1 -6
  42. package/lib/components/lumino/LuminoBox.js.map +1 -1
  43. package/lib/components/lumino/ReactPortalWidget.d.ts +1 -2
  44. package/lib/components/notebook/Notebook.d.ts +4 -6
  45. package/lib/components/notebook/Notebook.js +11 -27
  46. package/lib/components/notebook/Notebook.js.map +1 -1
  47. package/lib/components/notebook/Notebook2.d.ts +7 -0
  48. package/lib/components/notebook/Notebook2.js +13 -2
  49. package/lib/components/notebook/Notebook2.js.map +1 -1
  50. package/lib/components/notebook/Notebook2Adapter.d.ts +197 -0
  51. package/lib/components/notebook/Notebook2Adapter.js +563 -9
  52. package/lib/components/notebook/Notebook2Adapter.js.map +1 -1
  53. package/lib/components/notebook/Notebook2Base.d.ts +15 -6
  54. package/lib/components/notebook/Notebook2Base.js +183 -15
  55. package/lib/components/notebook/Notebook2Base.js.map +1 -1
  56. package/lib/components/notebook/Notebook2State.d.ts +36 -8
  57. package/lib/components/notebook/Notebook2State.js +75 -21
  58. package/lib/components/notebook/Notebook2State.js.map +1 -1
  59. package/lib/components/notebook/NotebookAdapter.js +6 -87
  60. package/lib/components/notebook/NotebookAdapter.js.map +1 -1
  61. package/lib/components/notebook/NotebookState.d.ts +11 -11
  62. package/lib/components/notebook/cell/sidebar/CellSidebarButton.js +1 -1
  63. package/lib/components/notebook/cell/sidebar/CellSidebarExtension.d.ts +2 -4
  64. package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js +1 -3
  65. package/lib/components/notebook/cell/sidebar/CellSidebarExtension.js.map +1 -1
  66. package/lib/components/notebook/index.d.ts +1 -0
  67. package/lib/components/notebook/index.js +1 -0
  68. package/lib/components/notebook/index.js.map +1 -1
  69. package/lib/components/notebook/model/JupyterReactNotebookModelFactory.d.ts +28 -1
  70. package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js +15 -1
  71. package/lib/components/notebook/model/JupyterReactNotebookModelFactory.js.map +1 -1
  72. package/lib/components/output/Output.d.ts +11 -13
  73. package/lib/components/output/Output.js +43 -35
  74. package/lib/components/output/Output.js.map +1 -1
  75. package/lib/components/output/OutputAdapter.d.ts +1 -0
  76. package/lib/components/output/OutputAdapter.js +6 -0
  77. package/lib/components/output/OutputAdapter.js.map +1 -1
  78. package/lib/components/output/OutputIPyWidgets.d.ts +2 -2
  79. package/lib/components/output/OutputIPyWidgets.js.map +1 -1
  80. package/lib/components/output/OutputRenderer.d.ts +2 -2
  81. package/lib/components/output/OutputRenderer.js +11 -1
  82. package/lib/components/output/OutputRenderer.js.map +1 -1
  83. package/lib/components/output/ipywidgets/IPyWidgetsViewManager.js +1 -3
  84. package/lib/components/output/ipywidgets/IPyWidgetsViewManager.js.map +1 -1
  85. package/lib/components/terminal/Terminal.d.ts +1 -4
  86. package/lib/components/terminal/Terminal.js +4 -7
  87. package/lib/components/terminal/Terminal.js.map +1 -1
  88. package/lib/components/viewer/Viewer.d.ts +1 -1
  89. package/lib/components/viewer/output/OutputViewer.d.ts +3 -6
  90. package/lib/components/viewer/output/OutputViewer.js +1 -5
  91. package/lib/components/viewer/output/OutputViewer.js.map +1 -1
  92. package/lib/examples/JupyterLabAppHeadless.js +1 -1
  93. package/lib/examples/JupyterLabAppHeadless.js.map +1 -1
  94. package/lib/examples/JupyterLabAppHeadlessServerless.js +1 -1
  95. package/lib/examples/JupyterLabAppHeadlessServerless.js.map +1 -1
  96. package/lib/examples/Notebook2Actions.js +2 -2
  97. package/lib/examples/Notebook2Actions.js.map +1 -1
  98. package/lib/examples/RunningSessions.js +1 -1
  99. package/lib/examples/RunningSessions.js.map +1 -1
  100. package/lib/examples/extensions/celltoolbar/CellToolbarComponent.js +1 -1
  101. package/lib/index.d.ts +4 -0
  102. package/lib/index.js +1 -0
  103. package/lib/index.js.map +1 -1
  104. package/lib/jupyter/Jupyter.d.ts +1 -74
  105. package/lib/jupyter/Jupyter.js +2 -9
  106. package/lib/jupyter/Jupyter.js.map +1 -1
  107. package/lib/jupyter/JupyterConfig.d.ts +6 -0
  108. package/lib/jupyter/JupyterConfig.js +10 -2
  109. package/lib/jupyter/JupyterConfig.js.map +1 -1
  110. package/lib/jupyter/JupyterContext.d.ts +2 -2
  111. package/lib/jupyter/ipywidgets/classic/htmlmanager.d.ts +6 -0
  112. package/lib/jupyter/ipywidgets/classic/htmlmanager.js +8 -0
  113. package/lib/jupyter/ipywidgets/classic/htmlmanager.js.map +1 -1
  114. package/lib/jupyter/ipywidgets/lab/manager.d.ts +6 -0
  115. package/lib/jupyter/ipywidgets/lab/manager.js +8 -0
  116. package/lib/jupyter/ipywidgets/lab/manager.js.map +1 -1
  117. package/lib/jupyter/ipywidgets/libembed-amd.d.ts +1 -1
  118. package/lib/jupyter/ipywidgets/libembed-amd.js +1 -1
  119. package/lib/jupyter/lite/LiteServer.d.ts +1 -1
  120. package/lib/jupyter/lite/LiteServer.js +1 -1
  121. package/lib/theme/JupyterLabCss.d.ts +1 -1
  122. package/lib/theme/JupyterReactTheme.d.ts +1 -1
  123. package/lib/tools/__tests__/operationRunner.test.d.ts +1 -0
  124. package/lib/tools/__tests__/operationRunner.test.js +193 -0
  125. package/lib/tools/__tests__/operationRunner.test.js.map +1 -0
  126. package/lib/tools/core/executor.d.ts +46 -0
  127. package/lib/tools/core/executor.js +55 -0
  128. package/lib/tools/core/executor.js.map +1 -0
  129. package/lib/tools/core/formatter.d.ts +20 -0
  130. package/lib/tools/core/formatter.js +41 -0
  131. package/lib/tools/core/formatter.js.map +1 -0
  132. package/lib/tools/core/index.d.ts +18 -0
  133. package/lib/tools/core/index.js +24 -0
  134. package/lib/tools/core/index.js.map +1 -0
  135. package/lib/tools/core/interfaces.d.ts +38 -0
  136. package/lib/tools/core/interfaces.js +7 -0
  137. package/lib/tools/core/interfaces.js.map +1 -0
  138. package/lib/tools/core/operationRunner.d.ts +27 -0
  139. package/lib/tools/core/operationRunner.js +33 -0
  140. package/lib/tools/core/operationRunner.js.map +1 -0
  141. package/lib/tools/core/schema.d.ts +47 -0
  142. package/lib/tools/core/schema.js +7 -0
  143. package/lib/tools/core/schema.js.map +1 -0
  144. package/lib/tools/core/types.d.ts +36 -0
  145. package/lib/tools/core/types.js +7 -0
  146. package/lib/tools/core/types.js.map +1 -0
  147. package/lib/tools/core/zodUtils.d.ts +56 -0
  148. package/lib/tools/core/zodUtils.js +179 -0
  149. package/lib/tools/core/zodUtils.js.map +1 -0
  150. package/lib/tools/definitions/deleteCell.d.ts +7 -0
  151. package/lib/tools/definitions/deleteCell.js +25 -0
  152. package/lib/tools/definitions/deleteCell.js.map +1 -0
  153. package/lib/tools/definitions/executeCode.d.ts +7 -0
  154. package/lib/tools/definitions/executeCode.js +33 -0
  155. package/lib/tools/definitions/executeCode.js.map +1 -0
  156. package/lib/tools/definitions/index.d.ts +12 -0
  157. package/lib/tools/definitions/index.js +18 -0
  158. package/lib/tools/definitions/index.js.map +1 -0
  159. package/lib/tools/definitions/insertCell.d.ts +7 -0
  160. package/lib/tools/definitions/insertCell.js +24 -0
  161. package/lib/tools/definitions/insertCell.js.map +1 -0
  162. package/lib/tools/definitions/readAllCells.d.ts +7 -0
  163. package/lib/tools/definitions/readAllCells.js +24 -0
  164. package/lib/tools/definitions/readAllCells.js.map +1 -0
  165. package/lib/tools/definitions/readCell.d.ts +7 -0
  166. package/lib/tools/definitions/readCell.js +24 -0
  167. package/lib/tools/definitions/readCell.js.map +1 -0
  168. package/lib/tools/definitions/runCell.d.ts +7 -0
  169. package/lib/tools/definitions/runCell.js +31 -0
  170. package/lib/tools/definitions/runCell.js.map +1 -0
  171. package/lib/tools/definitions/updateCell.d.ts +7 -0
  172. package/lib/tools/definitions/updateCell.js +24 -0
  173. package/lib/tools/definitions/updateCell.js.map +1 -0
  174. package/lib/tools/index.d.ts +20 -0
  175. package/lib/tools/index.js +62 -0
  176. package/lib/tools/index.js.map +1 -0
  177. package/lib/tools/operations/deleteCell.d.ts +49 -0
  178. package/lib/tools/operations/deleteCell.js +103 -0
  179. package/lib/tools/operations/deleteCell.js.map +1 -0
  180. package/lib/tools/operations/executeCode.d.ts +33 -0
  181. package/lib/tools/operations/executeCode.js +45 -0
  182. package/lib/tools/operations/executeCode.js.map +1 -0
  183. package/lib/tools/operations/insertCell.d.ts +27 -0
  184. package/lib/tools/operations/insertCell.js +56 -0
  185. package/lib/tools/operations/insertCell.js.map +1 -0
  186. package/lib/tools/operations/readAllCells.d.ts +21 -0
  187. package/lib/tools/operations/readAllCells.js +45 -0
  188. package/lib/tools/operations/readAllCells.js.map +1 -0
  189. package/lib/tools/operations/readCell.d.ts +39 -0
  190. package/lib/tools/operations/readCell.js +90 -0
  191. package/lib/tools/operations/readCell.js.map +1 -0
  192. package/lib/tools/operations/runCell.d.ts +24 -0
  193. package/lib/tools/operations/runCell.js +124 -0
  194. package/lib/tools/operations/runCell.js.map +1 -0
  195. package/lib/tools/operations/updateCell.d.ts +27 -0
  196. package/lib/tools/operations/updateCell.js +53 -0
  197. package/lib/tools/operations/updateCell.js.map +1 -0
  198. package/lib/tools/schemas/deleteCell.d.ts +20 -0
  199. package/lib/tools/schemas/deleteCell.js +24 -0
  200. package/lib/tools/schemas/deleteCell.js.map +1 -0
  201. package/lib/tools/schemas/executeCode.d.ts +19 -0
  202. package/lib/tools/schemas/executeCode.js +28 -0
  203. package/lib/tools/schemas/executeCode.js.map +1 -0
  204. package/lib/tools/schemas/index.d.ts +12 -0
  205. package/lib/tools/schemas/index.js +18 -0
  206. package/lib/tools/schemas/index.js.map +1 -0
  207. package/lib/tools/schemas/insertCell.d.ts +24 -0
  208. package/lib/tools/schemas/insertCell.js +29 -0
  209. package/lib/tools/schemas/insertCell.js.map +1 -0
  210. package/lib/tools/schemas/readAllCells.d.ts +19 -0
  211. package/lib/tools/schemas/readAllCells.js +18 -0
  212. package/lib/tools/schemas/readAllCells.js.map +1 -0
  213. package/lib/tools/schemas/readCell.d.ts +19 -0
  214. package/lib/tools/schemas/readCell.js +24 -0
  215. package/lib/tools/schemas/readCell.js.map +1 -0
  216. package/lib/tools/schemas/runCell.d.ts +21 -0
  217. package/lib/tools/schemas/runCell.js +39 -0
  218. package/lib/tools/schemas/runCell.js.map +1 -0
  219. package/lib/tools/schemas/updateCell.d.ts +19 -0
  220. package/lib/tools/schemas/updateCell.js +21 -0
  221. package/lib/tools/schemas/updateCell.js.map +1 -0
  222. package/package.json +25 -16
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Platform-agnostic cell deletion operation.
3
+ *
4
+ * @module tools/operations/deleteCell
5
+ */
6
+ import type { ToolOperation } from '../core/interfaces';
7
+ import { type DeleteCellParams } from '../schemas/deleteCell';
8
+ /**
9
+ * Information about a deleted cell.
10
+ */
11
+ export interface DeletedCellInfo {
12
+ /** Original index of the deleted cell */
13
+ index: number;
14
+ /** Cell type (code, markdown, raw) */
15
+ type: string;
16
+ /** Cell source content */
17
+ source: string;
18
+ }
19
+ /**
20
+ * Result from deleteCell operation.
21
+ */
22
+ export interface DeleteCellResult {
23
+ success: boolean;
24
+ deletedCells: DeletedCellInfo[];
25
+ message: string;
26
+ }
27
+ /**
28
+ * Deletes one or more cells from a notebook at the specified indices.
29
+ *
30
+ * Cells are deleted in reverse order (highest index first) to prevent
31
+ * index shifting issues during multi-cell deletion. This matches the
32
+ * behavior of the Jupyter MCP Server.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Delete single cell
37
+ * await deleteCellOperation.execute(
38
+ * { indices: [2] },
39
+ * { documentId: "file:///path/to/notebook.ipynb", executor }
40
+ * );
41
+ *
42
+ * // Delete multiple cells
43
+ * await deleteCellOperation.execute(
44
+ * { indices: [1, 3, 5] },
45
+ * { documentId: "file:///path/to/notebook.ipynb", executor }
46
+ * );
47
+ * ```
48
+ */
49
+ export declare const deleteCellOperation: ToolOperation<DeleteCellParams, DeleteCellResult>;
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { readAllCellsOperation } from './readAllCells';
7
+ import { validateWithZod } from '../core/zodUtils';
8
+ import { deleteCellParamsSchema, } from '../schemas/deleteCell';
9
+ /**
10
+ * Deletes one or more cells from a notebook at the specified indices.
11
+ *
12
+ * Cells are deleted in reverse order (highest index first) to prevent
13
+ * index shifting issues during multi-cell deletion. This matches the
14
+ * behavior of the Jupyter MCP Server.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Delete single cell
19
+ * await deleteCellOperation.execute(
20
+ * { indices: [2] },
21
+ * { documentId: "file:///path/to/notebook.ipynb", executor }
22
+ * );
23
+ *
24
+ * // Delete multiple cells
25
+ * await deleteCellOperation.execute(
26
+ * { indices: [1, 3, 5] },
27
+ * { documentId: "file:///path/to/notebook.ipynb", executor }
28
+ * );
29
+ * ```
30
+ */
31
+ export const deleteCellOperation = {
32
+ name: 'deleteCell',
33
+ async execute(params, context) {
34
+ // Validate params using Zod schema
35
+ const { indices } = validateWithZod(deleteCellParamsSchema, params, this.name);
36
+ const { documentId } = context;
37
+ if (!documentId) {
38
+ throw new Error('Document ID is required for deleteCell operation. ' +
39
+ 'Ensure the tool execution context includes a valid documentId.');
40
+ }
41
+ // Ensure executor is available
42
+ if (!context.executor) {
43
+ throw new Error('Executor is required for deleteCell operation. ' +
44
+ 'This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)');
45
+ }
46
+ try {
47
+ // First, read all cells to get current state and validate indices
48
+ // Request detailed format to get full source for deletion confirmation
49
+ const cellsResult = await readAllCellsOperation.execute({ format: 'detailed' }, context);
50
+ if (!cellsResult.success || !cellsResult.cells) {
51
+ throw new Error('Failed to read cells for bounds validation');
52
+ }
53
+ const cellCount = cellsResult.cellCount || cellsResult.cells.length;
54
+ const cells = cellsResult.cells;
55
+ // Validate ALL indices are in range (match Jupyter MCP Server error format)
56
+ for (const index of indices) {
57
+ if (index < 0 || index >= cellCount) {
58
+ throw new Error(`Cell index ${index} is out of range. Notebook has ${cellCount} cells.`);
59
+ }
60
+ }
61
+ // Sort indices in REVERSE order (highest to lowest) to prevent index shifting
62
+ // This matches the Jupyter MCP Server behavior
63
+ const sortedIndices = [...indices].sort((a, b) => b - a);
64
+ // Store information about cells before deletion
65
+ const deletedCells = [];
66
+ // Delete each cell in reverse order
67
+ for (const index of sortedIndices) {
68
+ // Store cell info before deletion (from original read)
69
+ const cell = cells[index];
70
+ // Execute deletion via executor
71
+ await context.executor.execute(this.name, {
72
+ index,
73
+ });
74
+ // Track deletion with original index
75
+ deletedCells.push({
76
+ index,
77
+ type: cell.type,
78
+ source: cell.source,
79
+ });
80
+ }
81
+ // Format message similar to Jupyter MCP Server
82
+ const message = deletedCells
83
+ .map(cell => {
84
+ return (`Deleted cell at index ${cell.index}:\n` +
85
+ `Type: ${cell.type}\n` +
86
+ `----------------------------------------`);
87
+ })
88
+ .join('\n\n');
89
+ // Return success result
90
+ return {
91
+ success: true,
92
+ deletedCells: deletedCells.reverse(), // Reverse to show in original order
93
+ message,
94
+ };
95
+ }
96
+ catch (error) {
97
+ // Convert error to descriptive error
98
+ const errorMessage = error instanceof Error ? error.message : String(error);
99
+ throw new Error(`Failed to delete cell(s): ${errorMessage}`);
100
+ }
101
+ },
102
+ };
103
+ //# sourceMappingURL=deleteCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteCell.js","sourceRoot":"","sources":["../../../src/tools/operations/deleteCell.ts"],"names":[],"mapp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AE,CAAC;YACf,qCAAqC;YACrC,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Platform-agnostic code execution operation.
3
+ * Executes code directly in the kernel without creating or modifying cells.
4
+ *
5
+ * @module tools/operations/executeCode
6
+ */
7
+ import type { ToolOperation } from '../core/interfaces';
8
+ import { type ExecuteCodeParams } from '../schemas/executeCode';
9
+ /**
10
+ * Result from executeCode operation.
11
+ */
12
+ export interface ExecuteCodeResult {
13
+ success: boolean;
14
+ /** Execution outputs (streams, results, errors) */
15
+ outputs?: Array<{
16
+ type: 'stream' | 'execute_result' | 'display_data' | 'error';
17
+ content: unknown;
18
+ }>;
19
+ /** Error message if execution failed */
20
+ error?: string;
21
+ /** Execution count (if stored in history) */
22
+ executionCount?: number;
23
+ }
24
+ /**
25
+ * Executes code directly in the kernel without creating a cell.
26
+ *
27
+ * This is useful for:
28
+ * - Variable inspection
29
+ * - Environment setup
30
+ * - Background tasks
31
+ * - Tool introspection
32
+ */
33
+ export declare const executeCodeOperation: ToolOperation<ExecuteCodeParams, ExecuteCodeResult>;
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { validateWithZod } from '../core/zodUtils';
7
+ import { executeCodeParamsSchema, } from '../schemas/executeCode';
8
+ /**
9
+ * Executes code directly in the kernel without creating a cell.
10
+ *
11
+ * This is useful for:
12
+ * - Variable inspection
13
+ * - Environment setup
14
+ * - Background tasks
15
+ * - Tool introspection
16
+ */
17
+ export const executeCodeOperation = {
18
+ name: 'executeCode',
19
+ async execute(params, context) {
20
+ // Validate params using Zod schema
21
+ validateWithZod(executeCodeParamsSchema, params, this.name);
22
+ const { documentId } = context;
23
+ if (!documentId) {
24
+ return {
25
+ success: false,
26
+ error: 'Document ID is required for this operation.',
27
+ };
28
+ }
29
+ // Ensure executor is available
30
+ if (!context.executor) {
31
+ throw new Error('Executor is required for executeCode operation. ' +
32
+ 'This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)');
33
+ }
34
+ try {
35
+ // Call executor (uses this.name for DRY principle)
36
+ const result = await context.executor.execute(this.name, params);
37
+ return result;
38
+ }
39
+ catch (error) {
40
+ const errorMessage = error instanceof Error ? error.message : String(error);
41
+ throw new Error(`Failed to execute code: ${errorMessage}`);
42
+ }
43
+ },
44
+ };
45
+ //# sourceMappingURL=executeCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeCode.js","sourceRoot":"","sources":["../../../src/tools/operations/executeCode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,uBAAuB,GAExB,MAAM,wBAAwB,CAAC;AAkBhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAG7B;IACF,IAAI,EAAE,aAAa;IAEnB,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAA6B;QAE7B,mCAAmC;QACnC,eAAe,CAAC,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5D,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/B,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,6CAA6C;aACrD,CAAC;QACJ,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,kDAAkD;gBAChD,iFAAiF,CACpF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,mDAAmD;YACnD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEjE,OAAO,MAA2B,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,2BAA2B,YAAY,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Platform-agnostic cell insertion operation.
3
+ *
4
+ * @module tools/operations/insertCell
5
+ */
6
+ import type { ToolOperation } from '../core/interfaces';
7
+ import { type InsertCellParams } from '../schemas/insertCell';
8
+ /**
9
+ * Result from insertCell operation.
10
+ */
11
+ export interface InsertCellResult {
12
+ success: boolean;
13
+ index: number;
14
+ message: string;
15
+ }
16
+ /**
17
+ * Inserts a cell into a notebook at the specified position.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * await insertCellOperation.execute(
22
+ * { type: 'code', source: 'print("Hello")' },
23
+ * { documentId: 'file:///path/to/notebook.ipynb', executor }
24
+ * );
25
+ * ```
26
+ */
27
+ export declare const insertCellOperation: ToolOperation<InsertCellParams, InsertCellResult>;
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { validateWithZod } from '../core/zodUtils';
7
+ import { insertCellParamsSchema, } from '../schemas/insertCell';
8
+ /**
9
+ * Inserts a cell into a notebook at the specified position.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * await insertCellOperation.execute(
14
+ * { type: 'code', source: 'print("Hello")' },
15
+ * { documentId: 'file:///path/to/notebook.ipynb', executor }
16
+ * );
17
+ * ```
18
+ */
19
+ export const insertCellOperation = {
20
+ name: 'insertCell',
21
+ async execute(params, context) {
22
+ // Validate params using Zod schema
23
+ const { type, source, index } = validateWithZod(insertCellParamsSchema, params, this.name);
24
+ const { documentId } = context;
25
+ // Validate context
26
+ if (!documentId) {
27
+ throw new Error('Document ID is required for insertCell operation. ' +
28
+ 'Ensure the tool execution context includes a valid documentId.');
29
+ }
30
+ // Ensure executor is available
31
+ if (!context.executor) {
32
+ throw new Error('Executor is required for insertCell operation. ' +
33
+ 'This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)');
34
+ }
35
+ try {
36
+ // Call executor (uses this.name for DRY principle)
37
+ await context.executor.execute(this.name, {
38
+ type,
39
+ source,
40
+ index, // undefined means insert at end
41
+ });
42
+ // Return success result
43
+ return {
44
+ success: true,
45
+ index: index ?? -1,
46
+ message: `Cell inserted at index ${index ?? -1}`,
47
+ };
48
+ }
49
+ catch (error) {
50
+ // Convert error to result with failure status
51
+ const errorMessage = error instanceof Error ? error.message : String(error);
52
+ throw new Error(`Failed to insert cell: ${errorMessage}`);
53
+ }
54
+ },
55
+ };
56
+ //# sourceMappingURL=insertCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insertCell.js","sourceRoot":"","sources":["../../../src/tools/operations/insertCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAW/B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,IAAI,EAAE,YAAY;IAElB,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAA6B;QAE7B,mCAAmC;QACnC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAC7C,sBAAsB,EACtB,MAAM,EACN,IAAI,CAAC,IAAI,CACV,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/B,mBAAmB;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,oDAAoD;gBAClD,gEAAgE,CACnE,CAAC;QACJ,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,iDAAiD;gBAC/C,iFAAiF,CACpF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,mDAAmD;YACnD,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBACxC,IAAI;gBACJ,MAAM;gBACN,KAAK,EAAE,gCAAgC;aACxC,CAAC,CAAC;YAEH,wBAAwB;YACxB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC;gBAClB,OAAO,EAAE,0BAA0B,KAAK,IAAI,CAAC,CAAC,EAAE;aACjD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,8CAA8C;YAC9C,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Platform-agnostic operation to read all cells.
3
+ *
4
+ * @module tools/operations/readAllCells
5
+ */
6
+ import type { ToolOperation } from '../core/interfaces';
7
+ import type { BriefCell, DetailedCell } from '../core/types';
8
+ import { type ReadAllCellsParams } from '../schemas/readAllCells';
9
+ /**
10
+ * Result from readAllCells operation.
11
+ */
12
+ export interface ReadAllCellsResult {
13
+ success: boolean;
14
+ cells?: BriefCell[] | DetailedCell[];
15
+ cellCount?: number;
16
+ error?: string;
17
+ }
18
+ /**
19
+ * Reads all cells from a notebook with source and outputs.
20
+ */
21
+ export declare const readAllCellsOperation: ToolOperation<ReadAllCellsParams, ReadAllCellsResult>;
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { validateWithZod } from '../core/zodUtils';
7
+ import { readAllCellsParamsSchema, } from '../schemas/readAllCells';
8
+ /**
9
+ * Reads all cells from a notebook with source and outputs.
10
+ */
11
+ export const readAllCellsOperation = {
12
+ name: 'readAllCells',
13
+ async execute(params, context) {
14
+ // Validate params using Zod
15
+ const validatedParams = validateWithZod(readAllCellsParamsSchema, params || {}, 'readAllCells');
16
+ const { format = 'brief' } = validatedParams;
17
+ const { documentId } = context;
18
+ if (!documentId) {
19
+ return {
20
+ success: false,
21
+ error: 'Document ID is required for this operation.',
22
+ };
23
+ }
24
+ if (!context.executor) {
25
+ throw new Error('Executor is required for readAllCells operation. ' +
26
+ 'This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)');
27
+ }
28
+ try {
29
+ // Call executor with format parameter
30
+ const cells = (await context.executor.execute(this.name, {
31
+ format,
32
+ }));
33
+ return {
34
+ success: true,
35
+ cells,
36
+ cellCount: cells.length,
37
+ };
38
+ }
39
+ catch (error) {
40
+ const errorMessage = error instanceof Error ? error.message : String(error);
41
+ throw new Error(`Failed to read all cells: ${errorMessage}`);
42
+ }
43
+ },
44
+ };
45
+ //# sourceMappingURL=readAllCells.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readAllCells.js","sourceRoot":"","sources":["../../../src/tools/operations/readAllCells.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC;AAYjC;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,IAAI,EAAE,cAAc;IAEpB,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAA6B;QAE7B,4BAA4B;QAC5B,MAAM,eAAe,GAAG,eAAe,CACrC,wBAAwB,EACxB,MAAM,IAAI,EAAE,EACZ,cAAc,CACf,CAAC;QAEF,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,eAAe,CAAC;QAC7C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/B,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,6CAA6C;aACrD,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,mDAAmD;gBACjD,iFAAiF,CACpF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,sCAAsC;YACtC,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBACvD,MAAM;aACP,CAAC,CAAiC,CAAC;YAEpC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK;gBACL,SAAS,EAAE,KAAK,CAAC,MAAM;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Platform-agnostic cell read operation.
3
+ *
4
+ * @module tools/operations/readCell
5
+ */
6
+ import type { ToolOperation } from '../core/interfaces';
7
+ /**
8
+ * Parameters for readCell operation.
9
+ */
10
+ export interface ReadCellParams {
11
+ /** Cell index (0-based) */
12
+ index: number;
13
+ /** Whether to include cell outputs in the response (default: true) */
14
+ includeOutputs?: boolean;
15
+ }
16
+ /**
17
+ * Result from readCell operation.
18
+ */
19
+ export interface ReadCellResult {
20
+ success: boolean;
21
+ index?: number;
22
+ type?: string;
23
+ source?: string;
24
+ execution_count?: number | null;
25
+ outputs?: string[];
26
+ error?: string;
27
+ }
28
+ /**
29
+ * Reads cell content and metadata at the specified index.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const result = await readCellOperation.execute(
34
+ * { index: 0 },
35
+ * { documentId: 'file:///notebook.ipynb', executor }
36
+ * );
37
+ * ```
38
+ */
39
+ export declare const readCellOperation: ToolOperation<ReadCellParams, ReadCellResult>;
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Copyright (c) 2021-2023 Datalayer, Inc.
3
+ *
4
+ * MIT License
5
+ */
6
+ import { readAllCellsOperation } from './readAllCells';
7
+ /**
8
+ * Validates ReadCellParams at runtime.
9
+ */
10
+ function isReadCellParams(params) {
11
+ if (typeof params !== 'object' || params === null) {
12
+ return false;
13
+ }
14
+ const p = params;
15
+ // Validate required field
16
+ if (typeof p.index !== 'number') {
17
+ return false;
18
+ }
19
+ // Validate optional field
20
+ if (p.includeOutputs !== undefined && typeof p.includeOutputs !== 'boolean') {
21
+ return false;
22
+ }
23
+ return true;
24
+ }
25
+ /**
26
+ * Reads cell content and metadata at the specified index.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const result = await readCellOperation.execute(
31
+ * { index: 0 },
32
+ * { documentId: 'file:///notebook.ipynb', executor }
33
+ * );
34
+ * ```
35
+ */
36
+ export const readCellOperation = {
37
+ name: 'readCell',
38
+ async execute(params, context) {
39
+ // Validate params using type guard
40
+ if (!isReadCellParams(params)) {
41
+ throw new Error(`Invalid parameters for readCell. Expected { index: number }. ` +
42
+ `Received: ${JSON.stringify(params)}`);
43
+ }
44
+ // Now TypeScript knows params is ReadCellParams!
45
+ const { index } = params;
46
+ const { documentId } = context;
47
+ if (!documentId) {
48
+ return {
49
+ success: false,
50
+ error: 'Document ID is required for this operation.',
51
+ };
52
+ }
53
+ if (!context.executor) {
54
+ throw new Error('Executor is required for readCell operation.');
55
+ }
56
+ try {
57
+ // First, validate that the index is within bounds
58
+ const cellsResult = await readAllCellsOperation.execute({}, context);
59
+ if (!cellsResult.success || !cellsResult.cells) {
60
+ throw new Error('Failed to read cells for bounds validation');
61
+ }
62
+ const cellCount = cellsResult.cellCount || cellsResult.cells.length;
63
+ // Validate index bounds (match Jupyter MCP Server error format)
64
+ if (index < 0 || index >= cellCount) {
65
+ return {
66
+ success: false,
67
+ error: `Cell index ${index} is out of range. Notebook has ${cellCount} cells.`,
68
+ };
69
+ }
70
+ // Call executor (uses this.name for DRY principle)
71
+ const includeOutputs = params.includeOutputs ?? true;
72
+ const cellData = await context.executor.execute(this.name, {
73
+ index,
74
+ includeOutputs,
75
+ });
76
+ const result = {
77
+ success: true,
78
+ ...(typeof cellData === 'object' && cellData !== null
79
+ ? cellData
80
+ : {}),
81
+ };
82
+ return result;
83
+ }
84
+ catch (error) {
85
+ const errorMessage = error instanceof Error ? error.message : String(error);
86
+ throw new Error(`Failed to read cell: ${errorMessage}`);
87
+ }
88
+ },
89
+ };
90
+ //# sourceMappingURL=readCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readCell.js","sourceRoot":"","sources":["../../../src/tools/operations/readCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAYvD;;GAEG;AACH,SAAS,gBAAgB,CAAC,MAAe;IACvC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,GAAG,MAAiC,CAAC;IAE5C,0BAA0B;IAC1B,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,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AChE,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;gBACpC,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,cAAc,KAAK,kCAAkC,SAAS,SAAS;iBAC/E,CAAC;YACJ,CAAC;YAED,mDAAmD;YACnD,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBACzD,KAAK;gBACL,cAAc;aACf,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,IAAI;gBACb,GAAG,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;oBACnD,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,EAAE,CAAC;aACR,CAAC;YAEF,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,wBAAwB,YAAY,EAAE,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Platform-agnostic cell execution operation.
3
+ *
4
+ * @module tools/operations/runCell
5
+ */
6
+ import type { ToolOperation } from '../core/interfaces';
7
+ import { type RunCellParams } from '../schemas/runCell';
8
+ /**
9
+ * Result from runCell operation (snake_case for outputs, matching MCP and existing tools).
10
+ */
11
+ export interface RunCellResult {
12
+ success: boolean;
13
+ index?: number;
14
+ execution_count?: number | null;
15
+ outputs?: Array<string>;
16
+ elapsed_time?: number;
17
+ message?: string;
18
+ error?: string;
19
+ timeout?: boolean;
20
+ }
21
+ /**
22
+ * Executes a cell and displays its output.
23
+ */
24
+ export declare const runCellOperation: ToolOperation<RunCellParams, RunCellResult>;