opencode-ipynb 0.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +191 -41
- package/dist/domain/cell.d.ts +2 -1
- package/dist/domain/errors.d.ts +3 -31
- package/dist/domain/execution.d.ts +4 -1
- package/dist/domain/notebook.d.ts +1 -1
- package/dist/domain/output.d.ts +0 -1
- package/dist/format/diagnostics.d.ts +0 -1
- package/dist/format/markdown.d.ts +1 -2
- package/dist/format/{diff.d.ts → notebook.d.ts} +2 -1
- package/dist/format/outputs.d.ts +3 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7303 -26413
- package/dist/load-document.d.ts +16 -0
- package/dist/lsp.d.ts +97 -0
- package/dist/lsp.js +129 -0
- package/dist/notebook-diagnostics.d.ts +55 -0
- package/dist/notebook-hooks.d.ts +23 -0
- package/dist/plugin-options.d.ts +4 -1
- package/dist/plugin-v2.d.ts +35 -0
- package/dist/plugin.d.ts +2 -3
- package/dist/registrations.d.ts +5 -0
- package/dist/rpc.d.ts +141 -0
- package/dist/rpc.js +84 -0
- package/dist/services/KernelManager.d.ts +36 -0
- package/dist/services/NotebookCleanService.d.ts +3 -7
- package/dist/services/NotebookEditService.d.ts +6 -12
- package/dist/services/NotebookExecutionService.d.ts +15 -11
- package/dist/services/NotebookExportService.d.ts +3 -7
- package/dist/services/NotebookFileService.d.ts +19 -13
- package/dist/services/NotebookInspectService.d.ts +15 -14
- package/dist/services/NotebookOutputService.d.ts +4 -10
- package/dist/services/NotebookReadService.d.ts +4 -10
- package/dist/services/PathService.d.ts +5 -7
- package/dist/services/PermissionService.d.ts +6 -8
- package/dist/services/PythonService.d.ts +23 -42
- package/dist/services/index.d.ts +22 -29
- package/dist/services/revision.d.ts +15 -0
- package/dist/tool.d.ts +66 -0
- package/dist/tools/_readPermission.d.ts +8 -0
- package/dist/tools/_resolveOptions.d.ts +13 -2
- package/dist/tools/cell_delete.d.ts +4 -13
- package/dist/tools/cell_insert.d.ts +10 -21
- package/dist/tools/cell_move.d.ts +5 -15
- package/dist/tools/clean.d.ts +8 -21
- package/dist/tools/doctor.d.ts +3 -11
- package/dist/tools/edit.d.ts +10 -21
- package/dist/tools/export.d.ts +12 -23
- package/dist/tools/inspect.d.ts +7 -19
- package/dist/tools/kernel.d.ts +13 -21
- package/dist/tools/lsp.d.ts +9 -0
- package/dist/tools/outputs.d.ts +15 -29
- package/dist/tools/read.d.ts +12 -29
- package/dist/tools/repro.d.ts +6 -14
- package/dist/tools/run.d.ts +17 -34
- package/dist/utils/ansi.d.ts +2 -1
- package/dist/utils/atomic-replace.d.ts +6 -0
- package/dist/utils/attachments.d.ts +2 -3
- package/dist/utils/execution-order.d.ts +8 -0
- package/dist/utils/fence.d.ts +2 -0
- package/dist/utils/i18n.d.ts +1 -2
- package/dist/utils/imports.d.ts +6 -1
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/limits.d.ts +12 -2
- package/dist/utils/markdown-safe.d.ts +7 -0
- package/dist/utils/metadata.d.ts +3 -0
- package/dist/utils/mime.d.ts +1 -1
- package/dist/utils/paths.d.ts +0 -2
- package/dist/utils/truncate.d.ts +0 -1
- package/dist/utils/windows.d.ts +4 -0
- package/dist/virtual-materialize.d.ts +36 -0
- package/package.json +30 -18
- package/python/ipynb_runner.py +247 -17
- package/python/requirements.txt +5 -4
- package/server.js +3 -0
- package/dist/domain/cell.d.ts.map +0 -1
- package/dist/domain/errors.d.ts.map +0 -1
- package/dist/domain/execution.d.ts.map +0 -1
- package/dist/domain/notebook.d.ts.map +0 -1
- package/dist/domain/output.d.ts.map +0 -1
- package/dist/format/diagnostics.d.ts.map +0 -1
- package/dist/format/diff.d.ts.map +0 -1
- package/dist/format/markdown.d.ts.map +0 -1
- package/dist/format/outputs.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugin-options.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/services/DiffService.d.ts +0 -17
- package/dist/services/DiffService.d.ts.map +0 -1
- package/dist/services/NotebookCleanService.d.ts.map +0 -1
- package/dist/services/NotebookEditService.d.ts.map +0 -1
- package/dist/services/NotebookExecutionService.d.ts.map +0 -1
- package/dist/services/NotebookExportService.d.ts.map +0 -1
- package/dist/services/NotebookFileService.d.ts.map +0 -1
- package/dist/services/NotebookInspectService.d.ts.map +0 -1
- package/dist/services/NotebookOutputService.d.ts.map +0 -1
- package/dist/services/NotebookReadService.d.ts.map +0 -1
- package/dist/services/PathService.d.ts.map +0 -1
- package/dist/services/PermissionService.d.ts.map +0 -1
- package/dist/services/PythonService.d.ts.map +0 -1
- package/dist/services/index.d.ts.map +0 -1
- package/dist/tools/_resolveOptions.d.ts.map +0 -1
- package/dist/tools/cell_delete.d.ts.map +0 -1
- package/dist/tools/cell_insert.d.ts.map +0 -1
- package/dist/tools/cell_move.d.ts.map +0 -1
- package/dist/tools/clean.d.ts.map +0 -1
- package/dist/tools/doctor.d.ts.map +0 -1
- package/dist/tools/edit.d.ts.map +0 -1
- package/dist/tools/export.d.ts.map +0 -1
- package/dist/tools/inspect.d.ts.map +0 -1
- package/dist/tools/kernel.d.ts.map +0 -1
- package/dist/tools/outputs.d.ts.map +0 -1
- package/dist/tools/read.d.ts.map +0 -1
- package/dist/tools/repro.d.ts.map +0 -1
- package/dist/tools/run.d.ts.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/attachments.d.ts.map +0 -1
- package/dist/utils/fiber.d.ts +0 -2
- package/dist/utils/fiber.d.ts.map +0 -1
- package/dist/utils/i18n.d.ts.map +0 -1
- package/dist/utils/imports.d.ts.map +0 -1
- package/dist/utils/json.d.ts.map +0 -1
- package/dist/utils/limits.d.ts.map +0 -1
- package/dist/utils/mime.d.ts.map +0 -1
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/truncate.d.ts.map +0 -1
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
source: z.ZodString;
|
|
13
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
};
|
|
15
|
-
execute(args: {
|
|
16
|
-
filePath: string;
|
|
17
|
-
cellType: "code" | "markdown" | "raw";
|
|
18
|
-
source: string;
|
|
19
|
-
index?: number | undefined;
|
|
20
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=cell_insert.d.ts.map
|
|
2
|
+
export declare const ipynbCellInsertTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
cellType: z.ZodEnum<{
|
|
5
|
+
code: "code";
|
|
6
|
+
markdown: "markdown";
|
|
7
|
+
raw: "raw";
|
|
8
|
+
}>;
|
|
9
|
+
source: z.ZodString;
|
|
10
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}>;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fromIndex: z.ZodNumber;
|
|
8
|
-
toIndex: z.ZodNumber;
|
|
9
|
-
};
|
|
10
|
-
execute(args: {
|
|
11
|
-
filePath: string;
|
|
12
|
-
fromIndex: number;
|
|
13
|
-
toIndex: number;
|
|
14
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=cell_move.d.ts.map
|
|
2
|
+
export declare const ipynbCellMoveTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
fromIndex: z.ZodNumber;
|
|
5
|
+
toIndex: z.ZodNumber;
|
|
6
|
+
}>;
|
package/dist/tools/clean.d.ts
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
stripLargeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
-
normalizeSource: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
-
};
|
|
13
|
-
execute(args: {
|
|
14
|
-
filePath: string;
|
|
15
|
-
clearOutputs: boolean;
|
|
16
|
-
clearExecutionCount: boolean;
|
|
17
|
-
stripWidgetState: boolean;
|
|
18
|
-
stripLargeImages: boolean;
|
|
19
|
-
normalizeSource: boolean;
|
|
20
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=clean.d.ts.map
|
|
2
|
+
export declare const ipynbCleanTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
clearOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
5
|
+
clearExecutionCount: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
stripWidgetState: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
+
stripLargeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
normalizeSource: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
|
+
}>;
|
package/dist/tools/doctor.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
args: {
|
|
6
|
-
includeSuggestions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
-
};
|
|
8
|
-
execute(args: {
|
|
9
|
-
includeSuggestions: boolean;
|
|
10
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=doctor.d.ts.map
|
|
2
|
+
export declare const ipynbDoctorTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
includeSuggestions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
4
|
+
}>;
|
package/dist/tools/edit.d.ts
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
always: "always";
|
|
13
|
-
}>>>;
|
|
14
|
-
};
|
|
15
|
-
execute(args: {
|
|
16
|
-
filePath: string;
|
|
17
|
-
cellIndex: number;
|
|
18
|
-
source: string;
|
|
19
|
-
clearOutputs: "never" | "auto" | "always";
|
|
20
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=edit.d.ts.map
|
|
2
|
+
export declare const ipynbEditTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
cellIndex: z.ZodNumber;
|
|
5
|
+
source: z.ZodString;
|
|
6
|
+
clearOutputs: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
never: "never";
|
|
8
|
+
auto: "auto";
|
|
9
|
+
always: "always";
|
|
10
|
+
}>>>;
|
|
11
|
+
}>;
|
package/dist/tools/export.d.ts
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
outputPath: z.ZodOptional<z.ZodString>;
|
|
15
|
-
};
|
|
16
|
-
execute(args: {
|
|
17
|
-
filePath: string;
|
|
18
|
-
format: "markdown" | "python" | "summary";
|
|
19
|
-
includeOutputs: boolean;
|
|
20
|
-
includeErrors: boolean;
|
|
21
|
-
outputPath?: string | undefined;
|
|
22
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=export.d.ts.map
|
|
2
|
+
export declare const ipynbExportTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
format: z.ZodEnum<{
|
|
5
|
+
markdown: "markdown";
|
|
6
|
+
python: "python";
|
|
7
|
+
summary: "summary";
|
|
8
|
+
}>;
|
|
9
|
+
includeOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
includeErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
12
|
+
maxExportChars: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
13
|
+
}>;
|
package/dist/tools/inspect.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
maxCells: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
checkMissingPackages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
-
};
|
|
12
|
-
execute(args: {
|
|
13
|
-
filePath: string;
|
|
14
|
-
includeOutputsSummary: boolean;
|
|
15
|
-
checkMissingPackages: boolean;
|
|
16
|
-
includeMetadata?: boolean | undefined;
|
|
17
|
-
maxCells?: number | undefined;
|
|
18
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=inspect.d.ts.map
|
|
2
|
+
export declare const ipynbInspectTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
includeMetadata: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
includeOutputsSummary: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
maxCells: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
checkMissingPackages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
}>;
|
package/dist/tools/kernel.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import type { ToolContext } from "
|
|
3
|
+
import type { ToolContext } from "../tool.js";
|
|
4
4
|
import { buildServices } from "../services/index.js";
|
|
5
|
-
import { type PathOutsideWorktreeError } from "../domain/errors.js";
|
|
5
|
+
import { type PathOutsideWorktreeError, type PermissionDeniedError } from "../domain/errors.js";
|
|
6
6
|
declare const args: {
|
|
7
7
|
action: z.ZodEnum<{
|
|
8
8
|
list: "list";
|
|
@@ -12,25 +12,17 @@ declare const args: {
|
|
|
12
12
|
}>;
|
|
13
13
|
filePath: z.ZodOptional<z.ZodString>;
|
|
14
14
|
};
|
|
15
|
-
declare const run: (services: ReturnType<typeof buildServices>, input: z.infer<z.ZodObject<typeof args
|
|
15
|
+
declare const run: (services: ReturnType<typeof buildServices>, input: z.infer<z.ZodObject<typeof args>>, context?: ToolContext) => Effect.Effect<{
|
|
16
16
|
readonly output: string;
|
|
17
17
|
readonly metadata: Record<string, unknown>;
|
|
18
|
-
}, PathOutsideWorktreeError>;
|
|
18
|
+
}, PathOutsideWorktreeError | PermissionDeniedError>;
|
|
19
19
|
export { run };
|
|
20
|
-
export declare const ipynbKernelTool: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
filePath: z.ZodOptional<z.ZodString>;
|
|
30
|
-
};
|
|
31
|
-
execute(args: {
|
|
32
|
-
action: "list" | "status" | "shutdown" | "restart";
|
|
33
|
-
filePath?: string | undefined;
|
|
34
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=kernel.d.ts.map
|
|
20
|
+
export declare const ipynbKernelTool: import("../tool.js").ToolDefinition<{
|
|
21
|
+
action: z.ZodEnum<{
|
|
22
|
+
list: "list";
|
|
23
|
+
status: "status";
|
|
24
|
+
shutdown: "shutdown";
|
|
25
|
+
restart: "restart";
|
|
26
|
+
}>;
|
|
27
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ipynbLspTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
operation: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
diagnostics: "diagnostics";
|
|
6
|
+
materialize: "materialize";
|
|
7
|
+
}>>>;
|
|
8
|
+
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}>;
|
package/dist/tools/outputs.d.ts
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
includeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
|
-
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
19
|
-
};
|
|
20
|
-
execute(args: {
|
|
21
|
-
filePath: string;
|
|
22
|
-
operation: "read" | "list" | "read_error" | "clear_cell" | "clear_all";
|
|
23
|
-
includeImages: boolean;
|
|
24
|
-
cellIndex?: number | undefined;
|
|
25
|
-
offset?: number | undefined;
|
|
26
|
-
limit?: number | undefined;
|
|
27
|
-
maxOutputChars?: number | undefined;
|
|
28
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=outputs.d.ts.map
|
|
2
|
+
export declare const ipynbOutputsTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
operation: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
read: "read";
|
|
6
|
+
list: "list";
|
|
7
|
+
read_error: "read_error";
|
|
8
|
+
clear_cell: "clear_cell";
|
|
9
|
+
clear_all: "clear_all";
|
|
10
|
+
}>>>;
|
|
11
|
+
cellIndex: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
includeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
15
|
+
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}>;
|
package/dist/tools/read.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
maxSourceChars: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
-
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
};
|
|
17
|
-
execute(args: {
|
|
18
|
-
filePath: string;
|
|
19
|
-
includeOutputs: boolean;
|
|
20
|
-
includeErrors: boolean;
|
|
21
|
-
includeMetadata: boolean;
|
|
22
|
-
includeImages: boolean;
|
|
23
|
-
maxSourceChars: number;
|
|
24
|
-
cellIndex?: number | undefined;
|
|
25
|
-
start?: number | undefined;
|
|
26
|
-
end?: number | undefined;
|
|
27
|
-
maxOutputChars?: number | undefined;
|
|
28
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=read.d.ts.map
|
|
2
|
+
export declare const ipynbReadTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
cellIndex: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
includeOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
includeErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
|
+
includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
includeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
maxSourceChars: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
12
|
+
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}>;
|
package/dist/tools/repro.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import type { ToolContext } from "@opencode-ai/plugin";
|
|
4
3
|
import { buildServices } from "../services/index.js";
|
|
5
|
-
import { type NotebookNotFoundError, type NotebookNotImplementedError, type NotebookParseError, type NotebookValidationError, type PathOutsideWorktreeError, type PythonRunnerError } from "../domain/errors.js";
|
|
4
|
+
import { PermissionDeniedError, type NotebookNotFoundError, type NotebookNotImplementedError, type NotebookParseError, type NotebookValidationError, type PathOutsideWorktreeError, type PythonRunnerError } from "../domain/errors.js";
|
|
6
5
|
import type { NotebookRaw } from "../domain/notebook.js";
|
|
7
6
|
declare const args: {
|
|
8
7
|
filePath: z.ZodString;
|
|
@@ -15,7 +14,7 @@ export declare const detectRandomSeeds: (notebook: NotebookRaw) => ReadonlyArray
|
|
|
15
14
|
readonly cellIndex: number;
|
|
16
15
|
readonly name: string;
|
|
17
16
|
}>;
|
|
18
|
-
declare const run: (services: ReturnType<typeof buildServices>, input: z.infer<z.ZodObject<typeof args
|
|
17
|
+
declare const run: (services: ReturnType<typeof buildServices>, input: z.infer<z.ZodObject<typeof args>>, signal?: AbortSignal) => Effect.Effect<{
|
|
19
18
|
readonly output: string;
|
|
20
19
|
readonly metadata: {
|
|
21
20
|
readonly filePath: string;
|
|
@@ -28,15 +27,8 @@ declare const run: (services: ReturnType<typeof buildServices>, input: z.infer<z
|
|
|
28
27
|
readonly filesystemReadCount: number;
|
|
29
28
|
readonly seedCount: number;
|
|
30
29
|
};
|
|
31
|
-
}, NotebookNotFoundError | NotebookParseError | NotebookValidationError | PathOutsideWorktreeError | NotebookNotImplementedError | PythonRunnerError>;
|
|
30
|
+
}, NotebookNotFoundError | NotebookParseError | NotebookValidationError | PathOutsideWorktreeError | NotebookNotImplementedError | PythonRunnerError | PermissionDeniedError>;
|
|
32
31
|
export { run as runRepro };
|
|
33
|
-
export declare const ipynbReproTool: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
filePath: z.ZodString;
|
|
37
|
-
};
|
|
38
|
-
execute(args: {
|
|
39
|
-
filePath: string;
|
|
40
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=repro.d.ts.map
|
|
32
|
+
export declare const ipynbReproTool: import("../tool.js").ToolDefinition<{
|
|
33
|
+
filePath: z.ZodString;
|
|
34
|
+
}>;
|
package/dist/tools/run.d.ts
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
workingDirectory: z.ZodOptional<z.ZodString>;
|
|
20
|
-
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
21
|
-
};
|
|
22
|
-
execute(args: {
|
|
23
|
-
filePath: string;
|
|
24
|
-
mode: "cell" | "range" | "all" | "from";
|
|
25
|
-
save: boolean;
|
|
26
|
-
cellIndex?: number | undefined;
|
|
27
|
-
start?: number | undefined;
|
|
28
|
-
end?: number | undefined;
|
|
29
|
-
kernel?: string | undefined;
|
|
30
|
-
timeoutMs?: number | undefined;
|
|
31
|
-
workingDirectory?: string | undefined;
|
|
32
|
-
maxOutputChars?: number | undefined;
|
|
33
|
-
}, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=run.d.ts.map
|
|
2
|
+
export declare const ipynbRunTool: import("../tool.js").ToolDefinition<{
|
|
3
|
+
filePath: z.ZodString;
|
|
4
|
+
mode: z.ZodEnum<{
|
|
5
|
+
cell: "cell";
|
|
6
|
+
from: "from";
|
|
7
|
+
range: "range";
|
|
8
|
+
all: "all";
|
|
9
|
+
}>;
|
|
10
|
+
cellIndex: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
kernel: z.ZodOptional<z.ZodString>;
|
|
14
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
save: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
|
+
workingDirectory: z.ZodOptional<z.ZodString>;
|
|
17
|
+
maxOutputChars: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}>;
|
package/dist/utils/ansi.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const stripAnsi: (text: string) => string;
|
|
2
|
+
/** Remove terminal control sequences/bytes while keeping newlines and tabs. */
|
|
3
|
+
export declare const sanitizeTerminal: (text: string) => string;
|
|
2
4
|
export declare const hasAnsi: (text: string) => boolean;
|
|
3
|
-
//# sourceMappingURL=ansi.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rename `temp` over `target`. On Windows rename fails when the target
|
|
3
|
+
* exists; move the original to a backup first and restore it if the second
|
|
4
|
+
* rename fails, so a failed replace never deletes the only copy.
|
|
5
|
+
*/
|
|
6
|
+
export declare const replaceFile: (temp: string, target: string) => Promise<void>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ToolAttachment } from "
|
|
1
|
+
import type { ToolAttachment } from "../tool.js";
|
|
2
2
|
export declare const pickExtensionForMime: (mime: string) => string | undefined;
|
|
3
|
-
export declare const formatAttachment: (mime: string,
|
|
4
|
-
//# sourceMappingURL=attachments.d.ts.map
|
|
3
|
+
export declare const formatAttachment: (mime: string, payload: string, filename?: string) => ToolAttachment;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NotebookRaw } from "../domain/notebook.js";
|
|
2
|
+
export interface ExecutionOrderEntry {
|
|
3
|
+
readonly cellIndex: number;
|
|
4
|
+
readonly executionCount: number;
|
|
5
|
+
readonly previousCount: number;
|
|
6
|
+
}
|
|
7
|
+
/** Cells whose execution_count is lower than a previous non-null count. */
|
|
8
|
+
export declare const analyzeExecutionOrder: (notebook: NotebookRaw) => ReadonlyArray<ExecutionOrderEntry>;
|
package/dist/utils/i18n.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export type TruncationHintKey = "output" | "source" | "traceback" | "export" | "json" | "stream";
|
|
1
|
+
export type TruncationHintKey = "output" | "source" | "traceback" | "export" | "json" | "stream" | "hard";
|
|
2
2
|
export interface TruncationHintContext {
|
|
3
3
|
readonly paramName: string;
|
|
4
4
|
readonly maxChars: number;
|
|
5
5
|
readonly locale?: string | undefined;
|
|
6
6
|
}
|
|
7
7
|
export declare const formatHint: (key: TruncationHintKey, ctx: TruncationHintContext, locale?: string) => string;
|
|
8
|
-
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/utils/imports.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare const isStdlibModule: (name: string) => boolean;
|
|
2
2
|
export declare const isRelativeImport: (name: string) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Extract the top-level modules imported by Python source. For
|
|
5
|
+
* `from pandas import DataFrame` the module is `pandas`, not `DataFrame`.
|
|
6
|
+
* This is intentionally a lightweight parser (not a Python AST); it handles
|
|
7
|
+
* aliases, comments, dotted modules, and parenthesized from-imports.
|
|
8
|
+
*/
|
|
3
9
|
export declare const extractImportNames: (source: string) => string[];
|
|
4
|
-
//# sourceMappingURL=imports.d.ts.map
|
package/dist/utils/json.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import { Effect } from "effect";
|
|
|
2
2
|
import { NotebookParseError } from "../domain/errors.js";
|
|
3
3
|
export declare const safeParseJson: (text: string, filePath: string) => Effect.Effect<unknown, NotebookParseError>;
|
|
4
4
|
export declare const stringifyNotebook: (notebook: unknown) => string;
|
|
5
|
-
//# sourceMappingURL=json.d.ts.map
|
package/dist/utils/limits.d.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
export declare const DEFAULT_MAX_SOURCE_CHARS = 12000;
|
|
2
2
|
export declare const DEFAULT_MAX_OUTPUT_CHARS = 6000;
|
|
3
3
|
export declare const DEFAULT_MAX_INSPECT_CELLS = 200;
|
|
4
|
-
export declare const DEFAULT_MAX_TRACEBACK_CHARS = 8000;
|
|
5
4
|
export declare const DEFAULT_MAX_IMAGE_NOTICE_COUNT = 20;
|
|
6
5
|
export declare const DEFAULT_MAX_EXPORT_CHARS = 60000;
|
|
7
6
|
export declare const DEFAULT_RUN_TIMEOUT_MS = 120000;
|
|
8
7
|
export declare const DEFAULT_INSPECT_PREVIEW_CHARS = 240;
|
|
9
|
-
|
|
8
|
+
export declare const MAX_NOTEBOOK_BYTES: number;
|
|
9
|
+
export declare const MAX_READ_CELLS = 500;
|
|
10
|
+
/** Hard caps that protect the host context from pathological notebooks. */
|
|
11
|
+
export declare const MAX_INSPECT_CELLS = 1000;
|
|
12
|
+
export declare const MAX_METADATA_CHARS = 20000;
|
|
13
|
+
export declare const MAX_RUN_RESPONSE_CHARS = 120000;
|
|
14
|
+
export declare const MAX_READ_RESPONSE_CHARS = 120000;
|
|
15
|
+
export declare const MAX_HELPER_STDOUT_BYTES: number;
|
|
16
|
+
export declare const MAX_ATTACHMENT_BYTES: number;
|
|
17
|
+
export declare const MAX_DIAGNOSTICS_METADATA = 500;
|
|
18
|
+
export declare const MAX_ANALYSIS_WARNINGS = 500;
|
|
19
|
+
export declare const MAX_DIAGNOSTICS_METADATA_BYTES = 200000;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Single-line label safe inside markdown table/labels. */
|
|
2
|
+
export declare const sanitizeInline: (text: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Truncate rendered markdown without leaving a code fence open. Any fence
|
|
5
|
+
* opened before the cut is closed before the truncation hint is appended.
|
|
6
|
+
*/
|
|
7
|
+
export declare const truncateMarkdown: (text: string, maxChars: number, hint: string) => string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NotebookDiagnostic } from "../notebook-diagnostics.js";
|
|
2
|
+
/** Cap diagnostics metadata by both entry count and serialized bytes. */
|
|
3
|
+
export declare const capDiagnosticMetadata: (diagnostics: ReadonlyArray<NotebookDiagnostic>) => ReadonlyArray<NotebookDiagnostic>;
|
package/dist/utils/mime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const isImageMime: (mime: string) => boolean;
|
|
2
2
|
export declare const estimateBase64Bytes: (data: string) => number;
|
|
3
3
|
export declare const humanBytes: (n: number) => string;
|
|
4
|
-
|
|
4
|
+
export declare const isAttachableImageMime: (mime: string) => boolean;
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export interface NormalizeOptions {
|
|
|
5
5
|
export declare const normalizeSlashes: (p: string, platform?: NodeJS.Platform) => string;
|
|
6
6
|
export declare const isAbsolutePath: (p: string) => boolean;
|
|
7
7
|
export declare const hasIpynbExtension: (p: string) => boolean;
|
|
8
|
-
export declare const ensureIpynbExtension: (p: string) => string;
|
|
9
8
|
export interface ResolveInput {
|
|
10
9
|
readonly inputPath: string;
|
|
11
10
|
readonly base: string;
|
|
@@ -19,4 +18,3 @@ export interface RelativeOptions {
|
|
|
19
18
|
}
|
|
20
19
|
export declare const makeRelative: (from: string, to: string, opts?: RelativeOptions) => string;
|
|
21
20
|
export declare const toForwardSlashes: (p: string) => string;
|
|
22
|
-
//# sourceMappingURL=paths.d.ts.map
|
package/dist/utils/truncate.d.ts
CHANGED
|
@@ -14,4 +14,3 @@ export type TruncateHint = string | TruncateHintSpec;
|
|
|
14
14
|
export declare const truncate: (text: string, maxChars: number, hint?: TruncateHint) => TruncateResult;
|
|
15
15
|
export declare const truncatePreview: (text: string, maxChars: number) => string;
|
|
16
16
|
export declare const firstLine: (text: string) => string;
|
|
17
|
-
//# sourceMappingURL=truncate.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NotebookVirtualDocument } from "./lsp.js";
|
|
2
|
+
export interface MaterializedCell {
|
|
3
|
+
readonly cellIndex: number;
|
|
4
|
+
readonly cellType: string;
|
|
5
|
+
/** First line in the materialized file, 1-based and inclusive. */
|
|
6
|
+
readonly startLine: number;
|
|
7
|
+
/** Last line in the materialized file, 1-based and inclusive. */
|
|
8
|
+
readonly endLine: number;
|
|
9
|
+
}
|
|
10
|
+
export interface MaterializedDocument {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
readonly cells: ReadonlyArray<MaterializedCell>;
|
|
14
|
+
}
|
|
15
|
+
/** Path of the materialized sidecar for a notebook. */
|
|
16
|
+
export declare const materializedPath: (filePath: string, root?: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Write the notebook's virtual Python document beside the notebook so an
|
|
19
|
+
* external LSP plugin can open it with its own `lsp` tool. The path must stay
|
|
20
|
+
* inside the session/worktree (opencode-v2-lsp-support rejects paths outside
|
|
21
|
+
* its root), and living next to the notebook lets pyright resolve sibling
|
|
22
|
+
* imports exactly like the notebook itself.
|
|
23
|
+
*
|
|
24
|
+
* IPython magics are blanked exactly like the diagnostics path, preserving
|
|
25
|
+
* line/column positions so hover and definitions still map to cells.
|
|
26
|
+
*/
|
|
27
|
+
export declare const materializeVirtualDocument: (document: NotebookVirtualDocument, worktree: string) => Promise<MaterializedDocument>;
|
|
28
|
+
/**
|
|
29
|
+
* Refresh an already materialized document after an edit. Does nothing until
|
|
30
|
+
* the notebook has been materialized at least once.
|
|
31
|
+
*/
|
|
32
|
+
export declare const refreshMaterializedDocument: (document: NotebookVirtualDocument, worktree: string) => Promise<boolean>;
|
|
33
|
+
/** True when this notebook already has a materialized sidecar. */
|
|
34
|
+
export declare const hasMaterializedDocument: (worktree: string, filePath: string) => Promise<boolean>;
|
|
35
|
+
/** Remove only this plugin's materialized documents. */
|
|
36
|
+
export declare const cleanupVirtualDocuments: (worktree: string) => Promise<void>;
|