opencode-ipynb 0.1.2 → 3.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/README.md +197 -41
  3. package/dist/domain/cell.d.ts +4 -3
  4. package/dist/domain/errors.d.ts +3 -31
  5. package/dist/domain/execution.d.ts +4 -1
  6. package/dist/domain/notebook.d.ts +6 -3
  7. package/dist/domain/output.d.ts +0 -1
  8. package/dist/format/diagnostics.d.ts +0 -1
  9. package/dist/format/markdown.d.ts +1 -2
  10. package/dist/format/{diff.d.ts → notebook.d.ts} +1 -1
  11. package/dist/format/outputs.d.ts +2 -2
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +11294 -28152
  14. package/dist/load-document.d.ts +10 -0
  15. package/dist/lsp.d.ts +58 -0
  16. package/dist/lsp.js +172 -0
  17. package/dist/notebook-diagnostics.d.ts +52 -0
  18. package/dist/notebook-hooks.d.ts +18 -0
  19. package/dist/plugin-options.d.ts +4 -1
  20. package/dist/plugin-v2.d.ts +31 -0
  21. package/dist/plugin.d.ts +2 -3
  22. package/dist/registrations.d.ts +5 -0
  23. package/dist/rpc.d.ts +134 -0
  24. package/dist/rpc.js +84 -0
  25. package/dist/services/KernelManager.d.ts +45 -0
  26. package/dist/services/NotebookCleanService.d.ts +7 -7
  27. package/dist/services/NotebookEditService.d.ts +15 -12
  28. package/dist/services/NotebookExecutionService.d.ts +41 -12
  29. package/dist/services/NotebookExportService.d.ts +3 -7
  30. package/dist/services/NotebookFileService.d.ts +31 -16
  31. package/dist/services/NotebookInspectService.d.ts +15 -19
  32. package/dist/services/NotebookOutputService.d.ts +7 -10
  33. package/dist/services/NotebookReadService.d.ts +4 -10
  34. package/dist/services/PathService.d.ts +10 -8
  35. package/dist/services/PermissionService.d.ts +13 -8
  36. package/dist/services/PythonService.d.ts +14 -43
  37. package/dist/services/index.d.ts +23 -28
  38. package/dist/services/revision.d.ts +9 -0
  39. package/dist/tool.d.ts +45 -0
  40. package/dist/tools/_readPermission.d.ts +2 -0
  41. package/dist/tools/_resolveOptions.d.ts +13 -2
  42. package/dist/tools/cell_delete.d.ts +4 -13
  43. package/dist/tools/cell_insert.d.ts +10 -21
  44. package/dist/tools/cell_move.d.ts +5 -15
  45. package/dist/tools/clean.d.ts +8 -21
  46. package/dist/tools/doctor.d.ts +3 -11
  47. package/dist/tools/edit.d.ts +10 -21
  48. package/dist/tools/export.d.ts +12 -23
  49. package/dist/tools/inspect.d.ts +7 -19
  50. package/dist/tools/kernel.d.ts +13 -21
  51. package/dist/tools/lsp.d.ts +9 -0
  52. package/dist/tools/outputs.d.ts +15 -29
  53. package/dist/tools/read.d.ts +12 -29
  54. package/dist/tools/repro.d.ts +6 -14
  55. package/dist/tools/run.d.ts +17 -34
  56. package/dist/utils/ansi.d.ts +1 -1
  57. package/dist/utils/atomic-replace.d.ts +2 -0
  58. package/dist/utils/attachments.d.ts +2 -3
  59. package/dist/utils/execution-order.d.ts +7 -0
  60. package/dist/utils/fence.d.ts +1 -0
  61. package/dist/utils/i18n.d.ts +1 -2
  62. package/dist/utils/imports.d.ts +0 -1
  63. package/dist/utils/json-patch.d.ts +58 -0
  64. package/dist/utils/json.d.ts +16 -2
  65. package/dist/utils/limits.d.ts +11 -2
  66. package/dist/utils/markdown-safe.d.ts +2 -0
  67. package/dist/utils/metadata.d.ts +2 -0
  68. package/dist/utils/mime.d.ts +1 -1
  69. package/dist/utils/paths.d.ts +2 -2
  70. package/dist/utils/realpath.d.ts +1 -0
  71. package/dist/utils/rename-hook.d.ts +6 -0
  72. package/dist/utils/truncate.d.ts +0 -1
  73. package/dist/utils/warnings.d.ts +15 -0
  74. package/dist/utils/windows.d.ts +3 -0
  75. package/dist/virtual-materialize.d.ts +25 -0
  76. package/package.json +30 -18
  77. package/python/ipynb_runner.py +418 -31
  78. package/python/requirements.txt +5 -4
  79. package/server.js +3 -0
  80. package/dist/domain/cell.d.ts.map +0 -1
  81. package/dist/domain/errors.d.ts.map +0 -1
  82. package/dist/domain/execution.d.ts.map +0 -1
  83. package/dist/domain/notebook.d.ts.map +0 -1
  84. package/dist/domain/output.d.ts.map +0 -1
  85. package/dist/format/diagnostics.d.ts.map +0 -1
  86. package/dist/format/diff.d.ts.map +0 -1
  87. package/dist/format/markdown.d.ts.map +0 -1
  88. package/dist/format/outputs.d.ts.map +0 -1
  89. package/dist/index.d.ts.map +0 -1
  90. package/dist/plugin-options.d.ts.map +0 -1
  91. package/dist/plugin.d.ts.map +0 -1
  92. package/dist/services/DiffService.d.ts +0 -17
  93. package/dist/services/DiffService.d.ts.map +0 -1
  94. package/dist/services/NotebookCleanService.d.ts.map +0 -1
  95. package/dist/services/NotebookEditService.d.ts.map +0 -1
  96. package/dist/services/NotebookExecutionService.d.ts.map +0 -1
  97. package/dist/services/NotebookExportService.d.ts.map +0 -1
  98. package/dist/services/NotebookFileService.d.ts.map +0 -1
  99. package/dist/services/NotebookInspectService.d.ts.map +0 -1
  100. package/dist/services/NotebookOutputService.d.ts.map +0 -1
  101. package/dist/services/NotebookReadService.d.ts.map +0 -1
  102. package/dist/services/PathService.d.ts.map +0 -1
  103. package/dist/services/PermissionService.d.ts.map +0 -1
  104. package/dist/services/PythonService.d.ts.map +0 -1
  105. package/dist/services/index.d.ts.map +0 -1
  106. package/dist/tools/_resolveOptions.d.ts.map +0 -1
  107. package/dist/tools/cell_delete.d.ts.map +0 -1
  108. package/dist/tools/cell_insert.d.ts.map +0 -1
  109. package/dist/tools/cell_move.d.ts.map +0 -1
  110. package/dist/tools/clean.d.ts.map +0 -1
  111. package/dist/tools/doctor.d.ts.map +0 -1
  112. package/dist/tools/edit.d.ts.map +0 -1
  113. package/dist/tools/export.d.ts.map +0 -1
  114. package/dist/tools/inspect.d.ts.map +0 -1
  115. package/dist/tools/kernel.d.ts.map +0 -1
  116. package/dist/tools/outputs.d.ts.map +0 -1
  117. package/dist/tools/read.d.ts.map +0 -1
  118. package/dist/tools/repro.d.ts.map +0 -1
  119. package/dist/tools/run.d.ts.map +0 -1
  120. package/dist/utils/ansi.d.ts.map +0 -1
  121. package/dist/utils/attachments.d.ts.map +0 -1
  122. package/dist/utils/fiber.d.ts +0 -2
  123. package/dist/utils/fiber.d.ts.map +0 -1
  124. package/dist/utils/i18n.d.ts.map +0 -1
  125. package/dist/utils/imports.d.ts.map +0 -1
  126. package/dist/utils/json.d.ts.map +0 -1
  127. package/dist/utils/limits.d.ts.map +0 -1
  128. package/dist/utils/mime.d.ts.map +0 -1
  129. package/dist/utils/paths.d.ts.map +0 -1
  130. package/dist/utils/truncate.d.ts.map +0 -1
package/dist/tool.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { Effect } from "effect";
2
+ import type { z } from "zod";
3
+ export interface ToolContext {
4
+ readonly sessionID: string;
5
+ readonly messageID: string;
6
+ readonly agent: string;
7
+ readonly directory: string;
8
+ readonly worktree: string;
9
+ readonly abort: AbortSignal;
10
+ readonly pluginOptions?: unknown;
11
+ readonly pluginScope?: object;
12
+ readonly warningSink?: import("./utils/warnings.js").WarningSink | undefined;
13
+ metadata(input: {
14
+ title?: string;
15
+ metadata?: Record<string, any>;
16
+ }): void;
17
+ ask(input: ToolAskInput): Promise<void>;
18
+ }
19
+ export interface ToolAskInput {
20
+ readonly permission: string;
21
+ readonly patterns: string[];
22
+ readonly always: string[];
23
+ readonly metadata: Record<string, any>;
24
+ }
25
+ export interface ToolAttachment {
26
+ readonly type: "file";
27
+ readonly mime: string;
28
+ readonly url: string;
29
+ readonly filename?: string;
30
+ }
31
+ export type ToolResult = string | {
32
+ readonly title?: string;
33
+ readonly output: string;
34
+ readonly metadata?: Record<string, any>;
35
+ readonly attachments?: ToolAttachment[];
36
+ };
37
+ export interface ToolDefinition<Args extends z.ZodRawShape = z.ZodRawShape> {
38
+ readonly description: string;
39
+ readonly args: Args;
40
+ execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
41
+ }
42
+ export type AnyToolDefinition = ToolDefinition<z.ZodRawShape>;
43
+ export declare const tool: <Args extends z.ZodRawShape>(definition: ToolDefinition<Args>) => ToolDefinition<Args>;
44
+ export declare const runToolEffect: <A, E>(effect: Effect.Effect<A, E>) => Promise<A>;
45
+ export declare const rethrowPermissionDenied: (error: unknown) => void;
@@ -0,0 +1,2 @@
1
+ import type { ToolContext } from "../tool.js";
2
+ export declare const assertReadPermission: (context: ToolContext, filePath: string) => Promise<void>;
@@ -1,2 +1,13 @@
1
- export { resolveOptionsFromEnv as resolveToolOptions } from "../services/index.js";
2
- //# sourceMappingURL=_resolveOptions.d.ts.map
1
+ import type { ToolContext } from "../tool.js";
2
+ export declare const resolveToolOptions: (context?: ToolContext) => {
3
+ preferUv: boolean;
4
+ helperRelativePath: string;
5
+ defaultTimeoutMs: number;
6
+ defaultMaxOutputChars: number;
7
+ warmKernel: boolean;
8
+ lspDiagnostics: boolean;
9
+ pyrightPath: string;
10
+ diagnosticsTimeoutMs: number;
11
+ pythonPath?: string | undefined;
12
+ allowOutsideWorktree?: boolean | undefined;
13
+ };
@@ -1,14 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbCellDeleteTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- cellIndex: z.ZodNumber;
8
- };
9
- execute(args: {
10
- filePath: string;
11
- cellIndex: number;
12
- }, context: ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
13
- };
14
- //# sourceMappingURL=cell_delete.d.ts.map
2
+ export declare const ipynbCellDeleteTool: import("../tool.js").ToolDefinition<{
3
+ filePath: z.ZodString;
4
+ cellIndex: z.ZodNumber;
5
+ }>;
@@ -1,22 +1,11 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbCellInsertTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- cellType: z.ZodEnum<{
8
- code: "code";
9
- markdown: "markdown";
10
- raw: "raw";
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
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbCellMoveTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
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
+ }>;
@@ -1,22 +1,9 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbCleanTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- clearOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
- clearExecutionCount: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
- stripWidgetState: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
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
+ }>;
@@ -1,12 +1,4 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbDoctorTool: {
4
- description: string;
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
+ }>;
@@ -1,22 +1,11 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbEditTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- cellIndex: z.ZodNumber;
8
- source: z.ZodString;
9
- clearOutputs: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
10
- never: "never";
11
- auto: "auto";
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
+ }>;
@@ -1,24 +1,13 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbExportTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- format: z.ZodEnum<{
8
- markdown: "markdown";
9
- python: "python";
10
- summary: "summary";
11
- }>;
12
- includeOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
13
- includeErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
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
+ }>;
@@ -1,20 +1,8 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbInspectTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- includeMetadata: z.ZodOptional<z.ZodBoolean>;
8
- includeOutputsSummary: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
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
+ }>;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { Effect } from "effect";
3
- import type { ToolContext } from "@opencode-ai/plugin";
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>>) => Effect.Effect<{
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
- description: string;
22
- args: {
23
- action: z.ZodEnum<{
24
- list: "list";
25
- status: "status";
26
- shutdown: "shutdown";
27
- restart: "restart";
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
+ }>;
@@ -1,30 +1,16 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbOutputsTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- operation: z.ZodEnum<{
8
- read: "read";
9
- list: "list";
10
- read_error: "read_error";
11
- clear_cell: "clear_cell";
12
- clear_all: "clear_all";
13
- }>;
14
- cellIndex: z.ZodOptional<z.ZodNumber>;
15
- offset: z.ZodOptional<z.ZodNumber>;
16
- limit: z.ZodOptional<z.ZodNumber>;
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
+ }>;
@@ -1,30 +1,13 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbReadTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- cellIndex: z.ZodOptional<z.ZodNumber>;
8
- start: z.ZodOptional<z.ZodNumber>;
9
- end: z.ZodOptional<z.ZodNumber>;
10
- includeOutputs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
11
- includeErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
- includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
13
- includeImages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
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
+ }>;
@@ -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>>) => Effect.Effect<{
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
- description: string;
35
- args: {
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
+ }>;
@@ -1,35 +1,18 @@
1
1
  import { z } from "zod";
2
- import type { ToolContext } from "@opencode-ai/plugin";
3
- export declare const ipynbRunTool: {
4
- description: string;
5
- args: {
6
- filePath: z.ZodString;
7
- mode: z.ZodEnum<{
8
- cell: "cell";
9
- range: "range";
10
- all: "all";
11
- from: "from";
12
- }>;
13
- cellIndex: z.ZodOptional<z.ZodNumber>;
14
- start: z.ZodOptional<z.ZodNumber>;
15
- end: z.ZodOptional<z.ZodNumber>;
16
- kernel: z.ZodOptional<z.ZodString>;
17
- timeoutMs: z.ZodOptional<z.ZodNumber>;
18
- save: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
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
+ }>;
@@ -1,3 +1,3 @@
1
1
  export declare const stripAnsi: (text: string) => string;
2
+ export declare const sanitizeTerminal: (text: string) => string;
2
3
  export declare const hasAnsi: (text: string) => boolean;
3
- //# sourceMappingURL=ansi.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { type WarningSink } from "./warnings.js";
2
+ export declare const replaceFile: (temp: string, target: string, sink?: WarningSink) => Promise<void>;
@@ -1,4 +1,3 @@
1
- import type { ToolAttachment } from "@opencode-ai/plugin";
1
+ import type { ToolAttachment } from "../tool.js";
2
2
  export declare const pickExtensionForMime: (mime: string) => string | undefined;
3
- export declare const formatAttachment: (mime: string, base64: string, filename?: string) => ToolAttachment;
4
- //# sourceMappingURL=attachments.d.ts.map
3
+ export declare const formatAttachment: (mime: string, payload: string, filename?: string) => ToolAttachment;
@@ -0,0 +1,7 @@
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
+ export declare const analyzeExecutionOrder: (notebook: NotebookRaw) => ReadonlyArray<ExecutionOrderEntry>;
@@ -0,0 +1 @@
1
+ export declare const codeFence: (text: string) => string;
@@ -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
@@ -1,4 +1,3 @@
1
1
  export declare const isStdlibModule: (name: string) => boolean;
2
2
  export declare const isRelativeImport: (name: string) => boolean;
3
3
  export declare const extractImportNames: (source: string) => string[];
4
- //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1,58 @@
1
+ export interface JsonTextStyle {
2
+ readonly newline: "\n" | "\r\n";
3
+ readonly itemSeparator: string;
4
+ readonly keySeparator: string;
5
+ readonly ensureAscii: boolean;
6
+ readonly unit: string;
7
+ }
8
+ interface LiteralNode {
9
+ readonly kind: "literal";
10
+ readonly start: number;
11
+ readonly end: number;
12
+ readonly value: unknown;
13
+ }
14
+ interface ItemSpan {
15
+ readonly start: number;
16
+ readonly end: number;
17
+ }
18
+ interface ArrayNode {
19
+ readonly kind: "array";
20
+ readonly start: number;
21
+ readonly end: number;
22
+ readonly items: ReadonlyArray<ItemSpan>;
23
+ readonly value: ReadonlyArray<unknown>;
24
+ }
25
+ interface ObjectEntry {
26
+ readonly key: string;
27
+ readonly keyStart: number;
28
+ readonly value: JsonNode;
29
+ }
30
+ interface ObjectNode {
31
+ readonly kind: "object";
32
+ readonly start: number;
33
+ readonly end: number;
34
+ readonly entries: ReadonlyArray<ObjectEntry>;
35
+ readonly value: Record<string, unknown>;
36
+ }
37
+ export type JsonNode = LiteralNode | ArrayNode | ObjectNode;
38
+ export declare const MAX_JSON_DEPTH = 512;
39
+ export declare const jsonEqual: (left: unknown, right: unknown) => boolean;
40
+ interface Edit {
41
+ readonly start: number;
42
+ readonly end: number;
43
+ readonly text: string;
44
+ }
45
+ export declare const applyEdits: (text: string, edits: ReadonlyArray<Edit>) => string | undefined;
46
+ export interface PatchOptions {
47
+ readonly style: JsonTextStyle;
48
+ }
49
+ export type PatchFailureReason = "parse-failed" | "patch-threw" | "overlapping-edits" | "not-representable" | "verification-failed" | "too-deep";
50
+ export interface PatchResult {
51
+ readonly text?: string;
52
+ readonly reason?: PatchFailureReason;
53
+ }
54
+ export declare const patchJsonTextDetailed: (text: string, next: unknown, options: PatchOptions) => PatchResult;
55
+ export declare const patchJsonText: (text: string, next: unknown, options: PatchOptions) => string | undefined;
56
+ export declare const jsonDepth: (value: unknown, depth?: number) => number;
57
+ export declare const formatJsonValue: (value: unknown, style: JsonTextStyle, multiline?: boolean) => string;
58
+ export {};