@datalayer/jupyter-react 2.0.2 → 2.0.4
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/lib/components/cell/Cell.js +1 -1
- package/lib/components/cell/Cell.js.map +1 -1
- package/lib/components/kernel/KernelActionMenu.d.ts +1 -0
- package/lib/components/kernel/KernelActionMenu.js +21 -8
- package/lib/components/kernel/KernelActionMenu.js.map +1 -1
- package/lib/components/notebook/Notebook.d.ts +8 -1
- package/lib/components/notebook/Notebook.js +2 -2
- package/lib/components/notebook/Notebook.js.map +1 -1
- package/lib/components/notebook/NotebookAdapter.d.ts +5 -8
- package/lib/components/notebook/NotebookAdapter.js +15 -32
- package/lib/components/notebook/NotebookAdapter.js.map +1 -1
- package/lib/components/notebook/NotebookBase.d.ts +8 -1
- package/lib/components/notebook/NotebookBase.js +25 -5
- package/lib/components/notebook/NotebookBase.js.map +1 -1
- package/lib/components/notebook/NotebookState.d.ts +1 -0
- package/lib/components/notebook/NotebookState.js +15 -2
- package/lib/components/notebook/NotebookState.js.map +1 -1
- package/lib/components/output/Output.js +103 -30
- package/lib/components/output/Output.js.map +1 -1
- package/lib/jupyter/ipywidgets/classic/manager.js +1 -11
- package/lib/jupyter/ipywidgets/classic/manager.js.map +1 -1
- package/lib/jupyter/ipywidgets/libembed.js +1 -0
- package/lib/jupyter/ipywidgets/libembed.js.map +1 -1
- package/lib/jupyter/kernel/Kernel.js +14 -2
- package/lib/jupyter/kernel/Kernel.js.map +1 -1
- package/lib/state/JupyterReactState.js +39 -9
- package/lib/state/JupyterReactState.js.map +1 -1
- package/lib/theme/JupyterLabColormode.d.ts +1 -1
- package/lib/theme/JupyterLabCss.js +52 -6
- package/lib/theme/JupyterLabCss.js.map +1 -1
- package/lib/theme/JupyterReactTheme.d.ts +5 -0
- package/lib/theme/JupyterReactTheme.js +89 -50
- package/lib/theme/JupyterReactTheme.js.map +1 -1
- package/lib/tools/__tests__/operationRunner.test.js +3 -3
- package/lib/tools/__tests__/operationRunner.test.js.map +1 -1
- package/lib/tools/core/executor.d.ts +9 -1
- package/lib/tools/core/executor.js.map +1 -1
- package/lib/tools/core/index.d.ts +1 -1
- package/lib/tools/core/index.js +1 -1
- package/lib/tools/core/index.js.map +1 -1
- package/lib/tools/core/operationRunner.js +10 -1
- package/lib/tools/core/operationRunner.js.map +1 -1
- package/lib/tools/core/zodUtils.js +49 -5
- package/lib/tools/core/zodUtils.js.map +1 -1
- package/lib/tools/definitions/deleteCells.d.ts +7 -0
- package/lib/tools/definitions/{deleteCell.js → deleteCells.js} +7 -7
- package/lib/tools/definitions/deleteCells.js.map +1 -0
- package/lib/tools/definitions/index.d.ts +1 -1
- package/lib/tools/definitions/index.js +1 -1
- package/lib/tools/definitions/index.js.map +1 -1
- package/lib/tools/definitions/insertCell.js +2 -2
- package/lib/tools/definitions/insertCell.js.map +1 -1
- package/lib/tools/index.js +4 -4
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/operations/deleteCells.d.ts +38 -0
- package/lib/tools/operations/deleteCells.js +65 -0
- package/lib/tools/operations/deleteCells.js.map +1 -0
- package/lib/tools/schemas/deleteCells.d.ts +21 -0
- package/lib/tools/schemas/deleteCells.js +25 -0
- package/lib/tools/schemas/deleteCells.js.map +1 -0
- package/lib/tools/schemas/index.d.ts +1 -1
- package/lib/tools/schemas/index.js +1 -1
- package/lib/tools/schemas/index.js.map +1 -1
- package/lib/tools/schemas/readCell.d.ts +2 -1
- package/lib/tools/schemas/readCell.js +2 -1
- package/lib/tools/schemas/readCell.js.map +1 -1
- package/lib/tools/schemas/updateCell.d.ts +2 -1
- package/lib/tools/schemas/updateCell.js +2 -1
- package/lib/tools/schemas/updateCell.js.map +1 -1
- package/package.json +2 -1
- package/lib/tools/definitions/deleteCell.d.ts +0 -7
- package/lib/tools/definitions/deleteCell.js.map +0 -1
- package/lib/tools/operations/deleteCell.d.ts +0 -49
- package/lib/tools/operations/deleteCell.js +0 -103
- package/lib/tools/operations/deleteCell.js.map +0 -1
- package/lib/tools/schemas/deleteCell.d.ts +0 -20
- package/lib/tools/schemas/deleteCell.js +0 -24
- package/lib/tools/schemas/deleteCell.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
@@ -9,7 +9,7 @@ export const insertCellTool = {
|
|
|
9
9
|
name: 'datalayer_insertCell',
|
|
10
10
|
displayName: 'Insert Notebook Cell',
|
|
11
11
|
toolReferenceName: 'insertCell',
|
|
12
|
-
description: 'IMPORTANT: Call readAllCells first to see the current notebook structure and determine the correct insertion point. Then, insert a code or markdown cell into a Jupyter notebook at a specified position or at the end',
|
|
12
|
+
description: 'Insert cells into Jupyter notebooks (.ipynb files ONLY). For Lexical documents (.dlex), use insertBlock with type="jupyter-cell" instead. IMPORTANT: Call readAllCells first to see the current notebook structure and determine the correct insertion point. Then, insert a code or markdown cell into a Jupyter notebook at a specified position or at the end',
|
|
13
13
|
parameters: zodToToolParameters(insertCellParamsSchema),
|
|
14
14
|
operation: 'insertCell',
|
|
15
15
|
config: {
|
|
@@ -19,6 +19,6 @@ export const insertCellTool = {
|
|
|
19
19
|
canBeReferencedInPrompt: true,
|
|
20
20
|
priority: 'high',
|
|
21
21
|
},
|
|
22
|
-
tags: ['cell', 'notebook', 'manipulation', '
|
|
22
|
+
tags: ['cell', 'notebook', 'manipulation', 'insert'],
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=insertCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertCell.js","sourceRoot":"","sources":["../../../src/tools/definitions/insertCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,iBAAiB,EAAE,YAAY;IAC/B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"insertCell.js","sourceRoot":"","sources":["../../../src/tools/definitions/insertCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,iBAAiB,EAAE,YAAY;IAC/B,WAAW,EACT,kWAAkW;IAEpW,UAAU,EAAE,mBAAmB,CAAC,sBAAsB,CAAC;IAEvD,SAAS,EAAE,YAAY;IAEvB,MAAM,EAAE;QACN,mBAAmB,EAAE,CAAC,MAAwC,EAAE,EAAE,CAChE,UAAU,MAAM,CAAC,IAAI,2BAA2B,MAAM,CAAC,MAAM,EAAE;QACjE,iBAAiB,EAAE,CAAC,MAAwB,EAAE,EAAE,CAC9C,aAAa,MAAM,CAAC,IAAI,qBAAqB;QAC/C,oBAAoB,EAAE,IAAI;QAC1B,uBAAuB,EAAE,IAAI;QAC7B,QAAQ,EAAE,MAAM;KACjB;IAED,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,CAAC;CACrD,CAAC"}
|
package/lib/tools/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
// Import all tool definitions
|
|
12
12
|
import { insertCellTool } from './definitions/insertCell.js';
|
|
13
|
-
import {
|
|
13
|
+
import { deleteCellsTool } from './definitions/deleteCells.js';
|
|
14
14
|
import { updateCellTool } from './definitions/updateCell.js';
|
|
15
15
|
import { readCellTool } from './definitions/readCell.js';
|
|
16
16
|
import { readAllCellsTool } from './definitions/readAllCells.js';
|
|
@@ -18,7 +18,7 @@ import { runCellTool } from './definitions/runCell.js';
|
|
|
18
18
|
import { executeCodeTool } from './definitions/executeCode.js';
|
|
19
19
|
// Import all operations
|
|
20
20
|
import { insertCellOperation } from './operations/insertCell.js';
|
|
21
|
-
import {
|
|
21
|
+
import { deleteCellsOperation } from './operations/deleteCells.js';
|
|
22
22
|
import { updateCellOperation } from './operations/updateCell.js';
|
|
23
23
|
import { readCellOperation } from './operations/readCell.js';
|
|
24
24
|
import { readAllCellsOperation } from './operations/readAllCells.js';
|
|
@@ -29,7 +29,7 @@ import { executeCodeOperation } from './operations/executeCode.js';
|
|
|
29
29
|
*/
|
|
30
30
|
export const notebookToolDefinitions = [
|
|
31
31
|
insertCellTool,
|
|
32
|
-
|
|
32
|
+
deleteCellsTool,
|
|
33
33
|
updateCellTool,
|
|
34
34
|
readCellTool,
|
|
35
35
|
readAllCellsTool,
|
|
@@ -42,7 +42,7 @@ export const notebookToolDefinitions = [
|
|
|
42
42
|
*/
|
|
43
43
|
export const notebookToolOperations = {
|
|
44
44
|
insertCell: insertCellOperation,
|
|
45
|
-
|
|
45
|
+
deleteCells: deleteCellsOperation,
|
|
46
46
|
updateCell: updateCellOperation,
|
|
47
47
|
readCell: readCellOperation,
|
|
48
48
|
readAllCells: readAllCellsOperation,
|
package/lib/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../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,mBAAmB;IAC/B,WAAW,EAAE,oBAAoB;IACjC,UAAU,EAAE,mBAAmB;IAC/B,QAAQ,EAAE,iBAAiB;IAC3B,YAAY,EAAE,qBAAqB;IACnC,OAAO,EAAE,gBAAgB;IACzB,WAAW,EAAE,oBAAoB;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,uBAAuB;IACpC,UAAU,EAAE,sBAAsB;CACnC,CAAC;AAEF,uCAAuC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete cells operation for notebooks
|
|
3
|
+
*
|
|
4
|
+
* @module tools/operations/deleteCells
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolOperation } from '../core/interfaces';
|
|
7
|
+
import { type DeleteCellsParams } from '../schemas/deleteCells';
|
|
8
|
+
/**
|
|
9
|
+
* Information about a deleted cell.
|
|
10
|
+
*/
|
|
11
|
+
export interface DeletedCellInfo {
|
|
12
|
+
/** Original index of the deleted cell */
|
|
13
|
+
index: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Result from deleteCells operation.
|
|
17
|
+
*/
|
|
18
|
+
export interface DeleteCellsResult {
|
|
19
|
+
success: boolean;
|
|
20
|
+
deletedCells: DeletedCellInfo[];
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Delete cells operation - removes one or more cells from a notebook
|
|
25
|
+
*
|
|
26
|
+
* Complex logic (validation, sorting, reverse-order deletion) is handled in the adapter.
|
|
27
|
+
* This operation validates parameters and delegates to the adapter.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Delete cells
|
|
32
|
+
* await deleteCellsOperation.execute(
|
|
33
|
+
* { indices: [1, 3, 5] },
|
|
34
|
+
* { documentId: "file:///path/to/notebook.ipynb", executor }
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const deleteCellsOperation: ToolOperation<DeleteCellsParams, DeleteCellsResult>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { validateWithZod } from '../core/zodUtils.js';
|
|
7
|
+
import { deleteCellsParamsSchema, } from '../schemas/deleteCells.js';
|
|
8
|
+
/**
|
|
9
|
+
* Delete cells operation - removes one or more cells from a notebook
|
|
10
|
+
*
|
|
11
|
+
* Complex logic (validation, sorting, reverse-order deletion) is handled in the adapter.
|
|
12
|
+
* This operation validates parameters and delegates to the adapter.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Delete cells
|
|
17
|
+
* await deleteCellsOperation.execute(
|
|
18
|
+
* { indices: [1, 3, 5] },
|
|
19
|
+
* { documentId: "file:///path/to/notebook.ipynb", executor }
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const deleteCellsOperation = {
|
|
24
|
+
name: 'deleteCells',
|
|
25
|
+
async execute(params, context) {
|
|
26
|
+
// Validate params using Zod schema
|
|
27
|
+
const { indices } = validateWithZod(deleteCellsParamsSchema, params, this.name);
|
|
28
|
+
const { documentId } = context;
|
|
29
|
+
if (!documentId) {
|
|
30
|
+
throw new Error('Document ID is required for deleteCells operation. ' +
|
|
31
|
+
'Ensure the tool execution context includes a valid documentId.');
|
|
32
|
+
}
|
|
33
|
+
// Ensure executor is available
|
|
34
|
+
if (!context.executor) {
|
|
35
|
+
throw new Error('Executor is required for deleteCells operation. ' +
|
|
36
|
+
'This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)');
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
// Call deleteCells store method with all indices
|
|
40
|
+
// The adapter handles validation, sorting, and deletion
|
|
41
|
+
// NOTE: Don't pass 'id' - DefaultExecutor injects it automatically
|
|
42
|
+
await context.executor.execute('deleteCells', {
|
|
43
|
+
indices: indices,
|
|
44
|
+
});
|
|
45
|
+
// Format message
|
|
46
|
+
const deletedCells = indices.map(index => ({
|
|
47
|
+
index,
|
|
48
|
+
}));
|
|
49
|
+
const message = deletedCells
|
|
50
|
+
.map(cell => `Deleted cell at index ${cell.index}`)
|
|
51
|
+
.join('\n');
|
|
52
|
+
// Return success result
|
|
53
|
+
return {
|
|
54
|
+
success: true,
|
|
55
|
+
deletedCells,
|
|
56
|
+
message: message || `Deleted ${deletedCells.length} cell(s)`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
61
|
+
throw new Error(`Failed to delete cell(s): ${errorMessage}`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=deleteCells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteCells.js","sourceRoot":"","sources":["../../../src/tools/operations/deleteCells.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,uBAAuB,GAExB,MAAM,wBAAwB,CAAC;AAmBhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAG7B;IACF,IAAI,EAAE,aAAa;IAEnB,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAA6B;QAE7B,mCAAmC;QACnC,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CACjC,uBAAuB,EACvB,MAAM,EACN,IAAI,CAAC,IAAI,CACV,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/B,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MA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+
/**
|
|
8
|
+
* Schema for deleteCells parameters
|
|
9
|
+
*
|
|
10
|
+
* Validates that indices is a non-empty array of non-negative integers.
|
|
11
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
12
|
+
*/
|
|
13
|
+
export declare const deleteCellsParamsSchema: z.ZodObject<{
|
|
14
|
+
indices: z.ZodArray<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/**
|
|
17
|
+
* TypeScript type inferred from Zod schema.
|
|
18
|
+
*
|
|
19
|
+
* This replaces the manual interface definition and is guaranteed to stay in sync with the schema.
|
|
20
|
+
*/
|
|
21
|
+
export type DeleteCellsParams = z.infer<typeof deleteCellsParamsSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for deleteCells operation parameters
|
|
8
|
+
*
|
|
9
|
+
* @module tools/schemas/deleteCells
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
/**
|
|
13
|
+
* Schema for deleteCells parameters
|
|
14
|
+
*
|
|
15
|
+
* Validates that indices is a non-empty array of non-negative integers.
|
|
16
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
17
|
+
*/
|
|
18
|
+
export const deleteCellsParamsSchema = z.object({
|
|
19
|
+
indices: z
|
|
20
|
+
.array(z.preprocess(val => (typeof val === 'string' ? parseInt(val, 10) : val), z.number().int().nonnegative()))
|
|
21
|
+
.min(1)
|
|
22
|
+
.describe('Array of cell indices (0-based) to delete. ' +
|
|
23
|
+
'Cells will be deleted in reverse order (highest index first) to prevent index shifting.'),
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=deleteCells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteCells.js","sourceRoot":"","sources":["../../../src/tools/schemas/deleteCells.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC;SACP,KAAK,CACJ,CAAC,CAAC,UAAU,CACV,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAC1D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAC/B,CACF;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,6CAA6C;QAC3C,yFAAyF,CAC5F;CACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
@@ -8,9 +8,10 @@ import { z } from 'zod';
|
|
|
8
8
|
* Schema for readCell parameters
|
|
9
9
|
*
|
|
10
10
|
* Validates cell index and optional output inclusion flag.
|
|
11
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
11
12
|
*/
|
|
12
13
|
export declare const readCellParamsSchema: z.ZodObject<{
|
|
13
|
-
index: z.ZodNumber
|
|
14
|
+
index: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>;
|
|
14
15
|
includeOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
/**
|
|
@@ -13,9 +13,10 @@ import { z } from 'zod';
|
|
|
13
13
|
* Schema for readCell parameters
|
|
14
14
|
*
|
|
15
15
|
* Validates cell index and optional output inclusion flag.
|
|
16
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
16
17
|
*/
|
|
17
18
|
export const readCellParamsSchema = z.object({
|
|
18
|
-
index: z.number().int().nonnegative().describe('Cell index (0-based)'),
|
|
19
|
+
index: z.preprocess(val => (typeof val === 'string' ? parseInt(val, 10) : val), z.number().int().nonnegative().describe('Cell index (0-based)')),
|
|
19
20
|
includeOutputs: z
|
|
20
21
|
.boolean()
|
|
21
22
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readCell.js","sourceRoot":"","sources":["../../../src/tools/schemas/readCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"readCell.js","sourceRoot":"","sources":["../../../src/tools/schemas/readCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,UAAU,CACjB,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAC1D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAChE;IACD,cAAc,EAAE,CAAC;SACd,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,iEAAiE,CAClE;CACJ,CAAC,CAAC"}
|
|
@@ -8,9 +8,10 @@ import { z } from 'zod';
|
|
|
8
8
|
* Schema for updateCell parameters
|
|
9
9
|
*
|
|
10
10
|
* Validates cell index and new source content.
|
|
11
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
11
12
|
*/
|
|
12
13
|
export declare const updateCellParamsSchema: z.ZodObject<{
|
|
13
|
-
index: z.ZodNumber
|
|
14
|
+
index: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>;
|
|
14
15
|
source: z.ZodString;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
/**
|
|
@@ -13,9 +13,10 @@ import { z } from 'zod';
|
|
|
13
13
|
* Schema for updateCell parameters
|
|
14
14
|
*
|
|
15
15
|
* Validates cell index and new source content.
|
|
16
|
+
* Coerces string numbers to actual numbers (LLMs often pass "0" instead of 0).
|
|
16
17
|
*/
|
|
17
18
|
export const updateCellParamsSchema = z.object({
|
|
18
|
-
index: z.number().int().nonnegative().describe('Cell index (0-based)'),
|
|
19
|
+
index: z.preprocess(val => (typeof val === 'string' ? parseInt(val, 10) : val), z.number().int().nonnegative().describe('Cell index (0-based)')),
|
|
19
20
|
source: z.string().describe('New cell source content'),
|
|
20
21
|
});
|
|
21
22
|
//# sourceMappingURL=updateCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCell.js","sourceRoot":"","sources":["../../../src/tools/schemas/updateCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"updateCell.js","sourceRoot":"","sources":["../../../src/tools/schemas/updateCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,UAAU,CACjB,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAC1D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAChE;IACD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CACvD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/jupyter-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Jupyter React - React.js components 100% compatible with Jupyter.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"@jupyterlab/translation-extension": "^4.0.0",
|
|
221
221
|
"@jupyterlab/ui-components-extension": "^4.0.0",
|
|
222
222
|
"@lumino/default-theme": "^2.0.0",
|
|
223
|
+
"@lumino/widgets": "^2.7.3",
|
|
223
224
|
"@primer/react": "^37.19.0",
|
|
224
225
|
"@primer/react-brand": "^0.58.2",
|
|
225
226
|
"@toon-format/toon": "^1.3.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCell.js","sourceRoot":"","sources":["../../../src/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.
|
|
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>;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { readAllCellsOperation } from './readAllCells.js';
|
|
7
|
-
import { validateWithZod } from '../core/zodUtils.js';
|
|
8
|
-
import { deleteCellParamsSchema, } from '../schemas/deleteCell.js';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCell.js","sourceRoot":"","sources":["../../../src/tools/operations/deleteCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAuB/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,IAAI,EAAE,YAAY;IAElB,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAA6B;QAE7B,mCAAmC;QACnC,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CACjC,sBAAsB,EACtB,MAAM,EACN,IAAI,CAAC,IAAI,CACV,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAE/B,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,kEAAkE;YACl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,MAAM;iBACpB,CAAC,CAAC;YACL,CAAC;YAED,+CAA+C;YAC/C,MAAM,OAAO,GAAG,YAAY;iBACzB,GAAG,CAAC,IAAI,CAAC,EAAE;gBACV,OAAO,CACL,yBAAyB,IAAI,CAAC,KAAK,KAAK;oBACxC,SAAS,IAAI,CAAC,IAAI,IAAI;oBACtB,0CAA0C,CAC3C,CAAC;YACJ,CAAC,CAAC;iBACD,IAAI,CAAC,MAAM,CAAC,CAAC;YAEhB,wBAAwB;YACxB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,EAAE,oCAAoC;gBAC1E,OAAO;aACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for deleteCell operation parameters
|
|
3
|
-
*
|
|
4
|
-
* @module tools/schemas/deleteCell
|
|
5
|
-
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* Schema for deleteCell parameters
|
|
9
|
-
*
|
|
10
|
-
* Validates that indices is a non-empty array of non-negative integers.
|
|
11
|
-
*/
|
|
12
|
-
export declare const deleteCellParamsSchema: z.ZodObject<{
|
|
13
|
-
indices: z.ZodArray<z.ZodNumber>;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
/**
|
|
16
|
-
* TypeScript type inferred from Zod schema.
|
|
17
|
-
*
|
|
18
|
-
* This replaces the manual interface definition and is guaranteed to stay in sync with the schema.
|
|
19
|
-
*/
|
|
20
|
-
export type DeleteCellParams = z.infer<typeof deleteCellParamsSchema>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Zod schema for deleteCell operation parameters
|
|
8
|
-
*
|
|
9
|
-
* @module tools/schemas/deleteCell
|
|
10
|
-
*/
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
/**
|
|
13
|
-
* Schema for deleteCell parameters
|
|
14
|
-
*
|
|
15
|
-
* Validates that indices is a non-empty array of non-negative integers.
|
|
16
|
-
*/
|
|
17
|
-
export const deleteCellParamsSchema = z.object({
|
|
18
|
-
indices: z
|
|
19
|
-
.array(z.number().int().nonnegative())
|
|
20
|
-
.min(1)
|
|
21
|
-
.describe('Array of cell indices (0-based) to delete. ' +
|
|
22
|
-
'Cells will be deleted in reverse order (highest index first) to prevent index shifting.'),
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=deleteCell.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteCell.js","sourceRoot":"","sources":["../../../src/tools/schemas/deleteCell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;SACrC,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,6CAA6C;QAC3C,yFAAyF,CAC5F;CACJ,CAAC,CAAC"}
|