@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
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * MIT License
5
5
  */
6
- import { NotebookActions } from '@jupyterlab/notebook';
6
+ import { NotebookActions, } from '@jupyterlab/notebook';
7
+ import { NotebookCommandIds } from './NotebookCommands';
8
+ import * as Diff from 'diff';
7
9
  export class Notebook2Adapter {
8
10
  _commands;
9
11
  _panel;
@@ -59,10 +61,9 @@ export class Notebook2Adapter {
59
61
  const notebook = this._notebook;
60
62
  // Insert above using NotebookActions
61
63
  NotebookActions.insertAbove(notebook);
62
- // Set the cell type if different from default
63
- if (this._defaultCellType !== 'code') {
64
- NotebookActions.changeCellType(notebook, this._defaultCellType);
65
- }
64
+ // Always set the cell type to match _defaultCellType
65
+ // (NotebookActions may create cells with a different default type)
66
+ NotebookActions.changeCellType(notebook, this._defaultCellType);
66
67
  // Set the source if provided
67
68
  if (source && notebook.activeCell) {
68
69
  notebook.activeCell.model.sharedModel.setSource(source);
@@ -77,10 +78,9 @@ export class Notebook2Adapter {
77
78
  const notebook = this._notebook;
78
79
  // Insert below using NotebookActions
79
80
  NotebookActions.insertBelow(notebook);
80
- // Set the cell type if different from default
81
- if (this._defaultCellType !== 'code') {
82
- NotebookActions.changeCellType(notebook, this._defaultCellType);
83
- }
81
+ // Always set the cell type to match _defaultCellType
82
+ // (NotebookActions may create cells with a different default type)
83
+ NotebookActions.changeCellType(notebook, this._defaultCellType);
84
84
  // Set the source if provided
85
85
  if (source && notebook.activeCell) {
86
86
  notebook.activeCell.model.sharedModel.setSource(source);
@@ -110,6 +110,560 @@ export class Notebook2Adapter {
110
110
  get model() {
111
111
  return this._context.model;
112
112
  }
113
+ /**
114
+ * Undo the last change in the notebook.
115
+ *
116
+ * @remarks
117
+ * If there is no history to undo (e.g., at the beginning of the undo stack),
118
+ * this operation will have no effect. The notebook must be available and
119
+ * properly initialized for this operation to succeed.
120
+ */
121
+ undo() {
122
+ const notebook = this._notebook;
123
+ // If we're in edit mode and have an active cell with an editor,
124
+ // try to undo in the cell editor first
125
+ if (notebook.mode === 'edit' && notebook.activeCell?.editor) {
126
+ const editor = notebook.activeCell.editor;
127
+ // CodeMirror editor has an undo method
128
+ if (editor && typeof editor.undo === 'function') {
129
+ editor.undo();
130
+ return;
131
+ }
132
+ }
133
+ // Otherwise, undo at the notebook level (add/remove cells, etc.)
134
+ NotebookActions.undo(notebook);
135
+ }
136
+ /**
137
+ * Redo the last undone change in the notebook.
138
+ *
139
+ * @remarks
140
+ * If there is no history to redo (e.g., no prior undo operations or at the
141
+ * end of the redo stack), this operation will have no effect. The notebook
142
+ * must be available and properly initialized for this operation to succeed.
143
+ */
144
+ redo() {
145
+ const notebook = this._notebook;
146
+ // If we're in edit mode and have an active cell with an editor,
147
+ // try to redo in the cell editor first
148
+ if (notebook.mode === 'edit' && notebook.activeCell?.editor) {
149
+ const editor = notebook.activeCell.editor;
150
+ // CodeMirror editor has a redo method
151
+ if (editor && typeof editor.redo === 'function') {
152
+ editor.redo();
153
+ return;
154
+ }
155
+ }
156
+ // Otherwise, redo at the notebook level (add/remove cells, etc.)
157
+ NotebookActions.redo(notebook);
158
+ }
159
+ /**
160
+ * Set the active cell by index.
161
+ *
162
+ * @param index - The index of the cell to activate (0-based)
163
+ *
164
+ * @remarks
165
+ * This method programmatically selects a cell at the specified index.
166
+ * If the index is out of bounds, the operation has no effect.
167
+ */
168
+ setActiveCell(index) {
169
+ const notebook = this._notebook;
170
+ const cellCount = notebook.model?.cells.length ?? 0;
171
+ if (index >= 0 && index < cellCount) {
172
+ notebook.activeCellIndex = index;
173
+ }
174
+ }
175
+ /**
176
+ * Get all cells from the notebook.
177
+ *
178
+ * @returns Array of cell data including type, source, and outputs
179
+ *
180
+ * @remarks
181
+ * This method extracts cell information from the notebook model.
182
+ * For code cells, outputs are included. Returns an empty array if
183
+ * the notebook model is not available.
184
+ */
185
+ getCells() {
186
+ console.log('[Notebook2Adapter.getCells] Called');
187
+ const cells = this._notebook.model?.cells;
188
+ if (!cells) {
189
+ console.log('[Notebook2Adapter.getCells] No cells model, returning empty array');
190
+ return [];
191
+ }
192
+ console.log(`[Notebook2Adapter.getCells] Found ${cells.length} cells`);
193
+ const result = [];
194
+ for (let i = 0; i < cells.length; i++) {
195
+ const cell = cells.get(i);
196
+ if (cell) {
197
+ const cellData = {
198
+ index: i,
199
+ type: cell.type,
200
+ source: cell.sharedModel.getSource(),
201
+ outputs: cell.type === 'code' ? cell.outputs?.toJSON() : undefined,
202
+ };
203
+ console.log(`[Notebook2Adapter.getCells] Cell ${i}:`, {
204
+ type: cellData.type,
205
+ sourceLength: cellData.source.length,
206
+ });
207
+ result.push(cellData);
208
+ }
209
+ }
210
+ console.log(`[Notebook2Adapter.getCells] Returning ${result.length} cells`);
211
+ return result;
212
+ }
213
+ /**
214
+ * Read all cells from the notebook (alias for getCells).
215
+ *
216
+ * @param format - Response format: 'brief' returns preview only, 'detailed' returns full content
217
+ * @returns Array of cell data - brief or detailed based on format
218
+ *
219
+ * @remarks
220
+ * This method is an alias for getCells() to match the readAllCells tool operation.
221
+ * Provides a consistent naming convention for read operations.
222
+ * Supports brief format (index, type, 40-char preview) and detailed format (full content).
223
+ */
224
+ readAllCells(format = 'brief') {
225
+ const cells = this.getCells();
226
+ return cells.map((cell, index) => {
227
+ // Get execution count for code cells
228
+ const cellModel = this._notebook.model?.cells.get(index);
229
+ const execution_count = cellModel?.type === 'code'
230
+ ? (cellModel.executionCount ?? null)
231
+ : null;
232
+ if (format === 'brief') {
233
+ // Brief format: index, type, 40-char preview
234
+ return {
235
+ index,
236
+ type: cell.type,
237
+ preview: cell.source.substring(0, 40),
238
+ };
239
+ }
240
+ else {
241
+ // Detailed format: full content with source, execution_count, outputs
242
+ return {
243
+ index,
244
+ type: cell.type,
245
+ source: cell.source,
246
+ execution_count,
247
+ outputs: cell.outputs,
248
+ };
249
+ }
250
+ });
251
+ }
252
+ /**
253
+ * Get the total number of cells in the notebook.
254
+ *
255
+ * @returns The number of cells, or 0 if the notebook model is not available
256
+ */
257
+ getCellCount() {
258
+ return this._notebook.model?.cells.length ?? 0;
259
+ }
260
+ /**
261
+ * Insert a new cell at a specific index.
262
+ *
263
+ * @param cellIndex - The index where the cell should be inserted (0-based)
264
+ * @param source - Optional source code/text for the new cell
265
+ *
266
+ * @remarks
267
+ * This method inserts a cell at the specified position by:
268
+ * 1. Setting the active cell to cellIndex
269
+ * 2. Calling insertAbove to insert before that cell
270
+ *
271
+ * Note: The cell type is determined by _defaultCellType, which should be set
272
+ * before calling this method (typically done by the store layer).
273
+ */
274
+ insertAt(cellIndex, source) {
275
+ const cellCount = this.getCellCount();
276
+ console.log('[Notebook2Adapter.insertAt] Called with:', {
277
+ cellIndex,
278
+ sourceLength: source?.length || 0,
279
+ sourcePreview: source?.substring(0, 50),
280
+ currentActiveCell: this._notebook.activeCellIndex,
281
+ cellCount,
282
+ defaultCellType: this._defaultCellType,
283
+ });
284
+ // Validate cell index is within bounds (matches Jupyter MCP Server)
285
+ if (cellIndex < -1 || cellIndex > cellCount) {
286
+ throw new Error(`Index ${cellIndex} is outside valid range [-1, ${cellCount}]. ` +
287
+ `Use -1 to append at end.`);
288
+ }
289
+ // Normalize -1 to append position (matches Jupyter MCP Server)
290
+ const actualIndex = cellIndex === -1 ? cellCount : cellIndex;
291
+ console.log('[Notebook2Adapter.insertAt] Normalized index:', {
292
+ originalIndex: cellIndex,
293
+ actualIndex,
294
+ cellCount,
295
+ });
296
+ // Insert at the actual index
297
+ if (actualIndex >= cellCount) {
298
+ // Append at end
299
+ console.log('[Notebook2Adapter.insertAt] Appending at end');
300
+ if (cellCount > 0) {
301
+ this.setActiveCell(cellCount - 1);
302
+ }
303
+ this.insertBelow(source);
304
+ }
305
+ else {
306
+ // Insert at specific position
307
+ console.log(`[Notebook2Adapter.insertAt] Inserting at index ${actualIndex}`);
308
+ this.setActiveCell(actualIndex);
309
+ this.insertAbove(source);
310
+ }
311
+ console.log('[Notebook2Adapter.insertAt] After insertion:', {
312
+ cellCount: this.getCellCount(),
313
+ activeCell: this._notebook.activeCellIndex,
314
+ });
315
+ }
316
+ /**
317
+ * NEW ALIGNED TOOL METHODS
318
+ * These methods align 1:1 with tool operation names for seamless integration
319
+ */
320
+ /**
321
+ * Insert a cell at a specific index (aligned with insertCell tool).
322
+ *
323
+ * @param cellType - Type of cell to insert (code, markdown, or raw)
324
+ * @param cellIndex - Index where to insert (0-based). If undefined, inserts at end.
325
+ * @param source - Optional source code/text for the cell
326
+ */
327
+ insertCell(cellType, cellIndex, source) {
328
+ this.setDefaultCellType(cellType);
329
+ // Default to cell count (end of notebook) if index not provided
330
+ const targetIndex = cellIndex ?? this.getCellCount();
331
+ this.insertAt(targetIndex, source);
332
+ }
333
+ /**
334
+ * Insert multiple cells at a specific index (aligned with insertCells tool).
335
+ *
336
+ * More efficient than calling insertCell multiple times.
337
+ * Cells are inserted sequentially starting at the given index.
338
+ *
339
+ * @param cells - Array of cells to insert (each with type and source)
340
+ * @param cellIndex - Index where to insert first cell (0-based). Use large number for end.
341
+ */
342
+ insertCells(cells, cellIndex) {
343
+ let currentIndex = cellIndex;
344
+ for (const cell of cells) {
345
+ this.setDefaultCellType(cell.type);
346
+ this.insertAt(currentIndex, cell.source);
347
+ currentIndex++;
348
+ }
349
+ }
350
+ /**
351
+ * Delete cell(s) at the specified index/indices (aligned with deleteCell tool and Jupyter MCP Server).
352
+ *
353
+ * @param index - Single cell index, array of indices, or undefined.
354
+ * - Single number: Deletes that cell
355
+ * - Array: Deletes all cells at those indices (in reverse order to prevent shifting)
356
+ * - Undefined: Deletes the active cell if one exists
357
+ *
358
+ * @remarks
359
+ * This method matches the Jupyter MCP Server behavior:
360
+ * - Validates ALL indices are in range before deleting any
361
+ * - Deletes in reverse order (highest to lowest) to prevent index shifting
362
+ * - Throws error with MCP-compatible message format if any index is out of range
363
+ *
364
+ * @throws {Error} If any index is out of range
365
+ */
366
+ deleteCell(index) {
367
+ const cells = this._notebook.model?.cells;
368
+ const cellCount = cells?.length ?? 0;
369
+ if (index !== undefined) {
370
+ // Convert single index to array for unified handling
371
+ const indices = Array.isArray(index) ? index : [index];
372
+ // Validate ALL indices first (match Jupyter MCP Server error format)
373
+ for (const idx of indices) {
374
+ if (idx < 0 || idx >= cellCount) {
375
+ console.error(`[Notebook2Adapter.deleteCell] Index ${idx} is out of range (cell count: ${cellCount})`);
376
+ throw new Error(`Cell index ${idx} is out of range. Notebook has ${cellCount} cells.`);
377
+ }
378
+ }
379
+ // Sort indices in REVERSE order (highest to lowest) to prevent index shifting
380
+ // This matches the Jupyter MCP Server behavior
381
+ const sortedIndices = [...indices].sort((a, b) => b - a);
382
+ console.log(`[Notebook2Adapter.deleteCell] Deleting ${sortedIndices.length} cell(s) in reverse order:`, sortedIndices);
383
+ // Delete each cell in reverse order
384
+ for (const idx of sortedIndices) {
385
+ this.setActiveCell(idx);
386
+ this.deleteCells();
387
+ }
388
+ }
389
+ else {
390
+ // No index provided: check if there's an active cell to delete
391
+ const activeCell = this._notebook.activeCell;
392
+ if (!activeCell) {
393
+ console.warn('[Notebook2Adapter.deleteCell] No active cell to delete');
394
+ return; // Safely return without deleting
395
+ }
396
+ // Active cell exists, safe to delete
397
+ this.deleteCells();
398
+ }
399
+ }
400
+ /**
401
+ * Updates cell source at the specified index and returns a diff.
402
+ * Matches MCP server's overwrite_cell_source behavior.
403
+ *
404
+ * @param index - Cell index (0-based)
405
+ * @param source - New cell source content
406
+ * @returns Diff string showing changes made
407
+ * @throws Error if cell index is out of range or cell not found
408
+ */
409
+ updateCell(index, source) {
410
+ // Validate cell index
411
+ const cellCount = this._notebook.model?.sharedModel.cells.length ?? 0;
412
+ if (index < 0 || index >= cellCount) {
413
+ throw new Error(`Cell index ${index} is out of range. Notebook has ${cellCount} cells.`);
414
+ }
415
+ // Get the cell at the specified index
416
+ const cellModel = this._notebook.model?.cells.get(index);
417
+ if (!cellModel) {
418
+ throw new Error(`Cell at index ${index} not found.`);
419
+ }
420
+ // Store old source before updating
421
+ const oldSource = cellModel.sharedModel.getSource();
422
+ // Update the cell source
423
+ cellModel.sharedModel.setSource(source);
424
+ // Generate diff (matches MCP server behavior)
425
+ const patch = Diff.createPatch(`cell_${index}`, oldSource, source, 'before', 'after', { context: 3 });
426
+ return patch;
427
+ }
428
+ /**
429
+ * Get a cell's content by index or active cell (aligned with getCell tool and MCP Server).
430
+ *
431
+ * @param index - Optional cell index (0-based). If not provided, returns active cell.
432
+ * @param includeOutputs - Whether to include cell outputs (default: true)
433
+ * @returns Cell data or undefined if not found
434
+ */
435
+ getCell(index, includeOutputs = true) {
436
+ if (index !== undefined) {
437
+ // Get cell at specific index
438
+ const cells = this.getCells();
439
+ const cell = cells[index];
440
+ if (!cell)
441
+ return undefined;
442
+ // Get execution count for code cells
443
+ const cellModel = this._notebook.model?.cells.get(index);
444
+ const execution_count = cellModel?.type === 'code'
445
+ ? (cellModel.executionCount ?? null)
446
+ : null;
447
+ return {
448
+ type: cell.type,
449
+ source: cell.source,
450
+ execution_count,
451
+ outputs: includeOutputs ? cell.outputs : undefined,
452
+ };
453
+ }
454
+ else {
455
+ // Get active cell
456
+ const activeCell = this._notebook.activeCell;
457
+ if (!activeCell)
458
+ return undefined;
459
+ const execution_count = activeCell.model.type === 'code'
460
+ ? (activeCell.model.executionCount ?? null)
461
+ : null;
462
+ return {
463
+ type: activeCell.model.type,
464
+ source: activeCell.model.sharedModel.getSource(),
465
+ execution_count,
466
+ outputs: includeOutputs && activeCell.model.type === 'code'
467
+ ? activeCell.model.outputs?.toJSON()
468
+ : undefined,
469
+ };
470
+ }
471
+ }
472
+ /**
473
+ * Run a cell and optionally capture outputs (aligned with runCell tool).
474
+ *
475
+ * @param params - Parameters for cell execution
476
+ * @param params.index - Cell index to run (optional, defaults to active cell)
477
+ * @param params.timeoutSeconds - Timeout in seconds (optional, for future use)
478
+ * @param params.stream - Enable streaming progress (optional, for future use)
479
+ * @param params.progressInterval - Progress update interval (optional, for future use)
480
+ * @returns Promise resolving to execution result with outputs
481
+ */
482
+ async runCell(params) {
483
+ const { index } = params || {};
484
+ // Note: timeoutSeconds, stream, progressInterval are accepted for future use
485
+ // but timeout/streaming logic is handled at the operation layer
486
+ // Set active cell if index provided
487
+ if (index !== undefined) {
488
+ this.setActiveCell(index);
489
+ }
490
+ const targetIndex = index ?? this._notebook.activeCellIndex;
491
+ if (targetIndex === -1) {
492
+ throw new Error('No active cell to execute');
493
+ }
494
+ // Execute the cell using JupyterLab's NotebookActions
495
+ await NotebookActions.run(this._notebook, this._context.sessionContext);
496
+ // Wait a brief moment for outputs to be available
497
+ await new Promise(resolve => setTimeout(resolve, 100));
498
+ // Capture outputs after execution
499
+ const cellData = this.getCell(targetIndex, true);
500
+ if (!cellData) {
501
+ return {
502
+ execution_count: null,
503
+ outputs: [],
504
+ };
505
+ }
506
+ // Convert outputs to string array (matching MCP format)
507
+ const outputs = [];
508
+ if (cellData.outputs && Array.isArray(cellData.outputs)) {
509
+ for (const output of cellData.outputs) {
510
+ if (typeof output === 'string') {
511
+ outputs.push(output);
512
+ }
513
+ else if (output && typeof output === 'object') {
514
+ // Handle different output types
515
+ const outputObj = output;
516
+ if (outputObj.output_type === 'stream') {
517
+ const text = outputObj.text;
518
+ if (typeof text === 'string') {
519
+ outputs.push(text);
520
+ }
521
+ else if (Array.isArray(text)) {
522
+ outputs.push(text.join(''));
523
+ }
524
+ }
525
+ else if (outputObj.output_type === 'execute_result' ||
526
+ outputObj.output_type === 'display_data') {
527
+ const data = outputObj.data;
528
+ if (data) {
529
+ // Prefer text/plain output
530
+ if (data['text/plain']) {
531
+ const text = data['text/plain'];
532
+ if (typeof text === 'string') {
533
+ outputs.push(text);
534
+ }
535
+ else if (Array.isArray(text)) {
536
+ outputs.push(text.join(''));
537
+ }
538
+ }
539
+ }
540
+ }
541
+ else if (outputObj.output_type === 'error') {
542
+ // Format error output
543
+ const ename = outputObj.ename ?? 'Error';
544
+ const evalue = outputObj.evalue ?? '';
545
+ const traceback = outputObj.traceback;
546
+ if (Array.isArray(traceback) && traceback.length > 0) {
547
+ outputs.push(`[ERROR: ${ename}: ${evalue}]\n${traceback.join('\n')}`);
548
+ }
549
+ else {
550
+ outputs.push(`[ERROR: ${ename}: ${evalue}]`);
551
+ }
552
+ }
553
+ }
554
+ }
555
+ }
556
+ return {
557
+ execution_count: cellData.execution_count,
558
+ outputs,
559
+ };
560
+ }
561
+ /**
562
+ * Run all cells in the notebook (aligned with runAllCells tool).
563
+ */
564
+ runAllCells() {
565
+ this._commands.execute(NotebookCommandIds.runAll);
566
+ }
567
+ /**
568
+ * Execute code directly in the kernel without creating a cell.
569
+ *
570
+ * This method sends code execution requests directly to the kernel,
571
+ * bypassing the notebook cell model. Useful for:
572
+ * - Variable inspection
573
+ * - Environment setup
574
+ * - Background tasks
575
+ * - Tool introspection
576
+ *
577
+ * @param code - Code to execute
578
+ * @param options - Execution options
579
+ * @returns Promise with execution result including outputs
580
+ */
581
+ async executeCode(code, options = {}) {
582
+ const sessionContext = this._panel.sessionContext;
583
+ if (!sessionContext || !sessionContext.session?.kernel) {
584
+ return {
585
+ success: false,
586
+ error: 'No active kernel session',
587
+ };
588
+ }
589
+ const kernel = sessionContext.session.kernel;
590
+ try {
591
+ const future = kernel.requestExecute({
592
+ code,
593
+ stop_on_error: true, // Internal default: stop on error
594
+ store_history: false, // Internal default: don't store in history
595
+ silent: false, // Internal default: not silent (show outputs)
596
+ allow_stdin: false,
597
+ });
598
+ const outputs = [];
599
+ let executionCount;
600
+ // Collect outputs
601
+ future.onIOPub = msg => {
602
+ const msgType = msg.header.msg_type;
603
+ if (msgType === 'stream') {
604
+ outputs.push({
605
+ type: 'stream',
606
+ content: msg.content,
607
+ });
608
+ }
609
+ else if (msgType === 'execute_result') {
610
+ outputs.push({
611
+ type: 'execute_result',
612
+ content: msg.content,
613
+ });
614
+ executionCount = msg.content.execution_count;
615
+ }
616
+ else if (msgType === 'display_data') {
617
+ outputs.push({
618
+ type: 'display_data',
619
+ content: msg.content,
620
+ });
621
+ }
622
+ else if (msgType === 'error') {
623
+ outputs.push({
624
+ type: 'error',
625
+ content: msg.content,
626
+ });
627
+ }
628
+ };
629
+ // Handle timeout if specified (default: 30 seconds, max: 60)
630
+ const timeoutMs = (options.timeout ?? 30) * 1000;
631
+ const executionPromise = future.done;
632
+ const timeoutPromise = new Promise((_, reject) => {
633
+ setTimeout(() => {
634
+ reject(new Error(`Execution timeout after ${options.timeout ?? 30} seconds`));
635
+ }, timeoutMs);
636
+ });
637
+ try {
638
+ await Promise.race([executionPromise, timeoutPromise]);
639
+ }
640
+ catch (timeoutError) {
641
+ // Interrupt kernel on timeout
642
+ try {
643
+ await kernel.interrupt();
644
+ }
645
+ catch (interruptError) {
646
+ console.error('Failed to interrupt kernel:', interruptError);
647
+ }
648
+ return {
649
+ success: false,
650
+ error: `Execution exceeded ${options.timeout ?? 30} seconds and was interrupted`,
651
+ outputs,
652
+ };
653
+ }
654
+ return {
655
+ success: true,
656
+ outputs,
657
+ executionCount,
658
+ };
659
+ }
660
+ catch (error) {
661
+ return {
662
+ success: false,
663
+ error: error instanceof Error ? error.message : String(error),
664
+ };
665
+ }
666
+ }
113
667
  /**
114
668
  * Dispose of the adapter.
115
669
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Notebook2Adapter.js","sourceRoot":"","sources":["../../../src/components/notebook/Notebook2Adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAiB,eAAe,EAAiB,MAAM,sBAAsB,CAAC;AAKrF,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAkB;IAC3B,MAAM,CAAgB;IACtB,SAAS,CAAW;IACpB,QAAQ,CAAyB;IACjC,gBAAgB,GAAsB,MAAM,CAAC;IAErD,YACE,QAAyB,EACzB,KAAoB,EACpB,OAA+B;QAE/B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,QAA2B;QAC5C,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,MAAe;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAEhC,qCAAqC;QACrC,eAAe,CAAC,WAAW,CA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AC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,mCAAmC;QACnC,gEAAgE;IAClE,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"Notebook2Adapter.js","sourceRoot":"","sources":["../../../src/components/notebook/Notebook2Adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAEL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAkB;IAC3B,MAAM,CAAgB;IACtB,SAAS,CAAW;IACpB,QAAQ,CAAyB;IACjC,gBAAgB,GAAsB,MAAM,CAAC;IAErD,YACE,QAAyB,EACzB,KAAoB,EACpB,OAA+B;QAE/B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT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