@wavexzore/sandbox 0.1.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 (149) hide show
  1. package/Dockerfile +14 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +3 -0
  4. package/README.md +153 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.js +9 -0
  7. package/dist/sandbox/cli/install.d.ts +5 -0
  8. package/dist/sandbox/cli/install.js +335 -0
  9. package/dist/sandbox/cli/local-store.d.ts +87 -0
  10. package/dist/sandbox/cli/local-store.js +604 -0
  11. package/dist/sandbox/cli/opencode-config.d.ts +25 -0
  12. package/dist/sandbox/cli/opencode-config.js +240 -0
  13. package/dist/sandbox/cli/path.d.ts +64 -0
  14. package/dist/sandbox/cli/path.js +127 -0
  15. package/dist/sandbox/cli/types.d.ts +145 -0
  16. package/dist/sandbox/cli/types.js +6 -0
  17. package/dist/sandbox/cli/wavexzore-sandbox.d.ts +65 -0
  18. package/dist/sandbox/cli/wavexzore-sandbox.js +577 -0
  19. package/dist/sandbox/core/cli-helper.d.ts +19 -0
  20. package/dist/sandbox/core/cli-helper.js +64 -0
  21. package/dist/sandbox/core/docker-archive-utils.d.ts +3 -0
  22. package/dist/sandbox/core/docker-archive-utils.js +50 -0
  23. package/dist/sandbox/core/docker-sandbox.d.ts +51 -0
  24. package/dist/sandbox/core/docker-sandbox.js +675 -0
  25. package/dist/sandbox/core/edit/filediff.d.ts +16 -0
  26. package/dist/sandbox/core/edit/filediff.js +21 -0
  27. package/dist/sandbox/core/edit/index.d.ts +5 -0
  28. package/dist/sandbox/core/edit/index.js +5 -0
  29. package/dist/sandbox/core/edit/line-endings.d.ts +4 -0
  30. package/dist/sandbox/core/edit/line-endings.js +10 -0
  31. package/dist/sandbox/core/edit/lock.d.ts +1 -0
  32. package/dist/sandbox/core/edit/lock.js +18 -0
  33. package/dist/sandbox/core/edit/replace.d.ts +10 -0
  34. package/dist/sandbox/core/edit/replace.js +14 -0
  35. package/dist/sandbox/core/edit/replacers.d.ts +15 -0
  36. package/dist/sandbox/core/edit/replacers.js +241 -0
  37. package/dist/sandbox/core/logger.d.ts +15 -0
  38. package/dist/sandbox/core/logger.js +59 -0
  39. package/dist/sandbox/core/lsp/client.d.ts +63 -0
  40. package/dist/sandbox/core/lsp/client.js +533 -0
  41. package/dist/sandbox/core/lsp/config.d.ts +13 -0
  42. package/dist/sandbox/core/lsp/config.js +36 -0
  43. package/dist/sandbox/core/lsp/diagnostics.d.ts +12 -0
  44. package/dist/sandbox/core/lsp/diagnostics.js +65 -0
  45. package/dist/sandbox/core/lsp/index.d.ts +4 -0
  46. package/dist/sandbox/core/lsp/index.js +4 -0
  47. package/dist/sandbox/core/lsp/language.d.ts +24 -0
  48. package/dist/sandbox/core/lsp/language.js +249 -0
  49. package/dist/sandbox/core/lsp/manager.d.ts +77 -0
  50. package/dist/sandbox/core/lsp/manager.js +237 -0
  51. package/dist/sandbox/core/lsp/tooling.d.ts +14 -0
  52. package/dist/sandbox/core/lsp/tooling.js +78 -0
  53. package/dist/sandbox/core/patch-parser.d.ts +23 -0
  54. package/dist/sandbox/core/patch-parser.js +248 -0
  55. package/dist/sandbox/core/path-map.d.ts +9 -0
  56. package/dist/sandbox/core/path-map.js +73 -0
  57. package/dist/sandbox/core/project-data-storage.d.ts +42 -0
  58. package/dist/sandbox/core/project-data-storage.js +167 -0
  59. package/dist/sandbox/core/read/binary.d.ts +4 -0
  60. package/dist/sandbox/core/read/binary.js +80 -0
  61. package/dist/sandbox/core/read/format.d.ts +38 -0
  62. package/dist/sandbox/core/read/format.js +85 -0
  63. package/dist/sandbox/core/read/index.d.ts +3 -0
  64. package/dist/sandbox/core/read/index.js +3 -0
  65. package/dist/sandbox/core/read/permissions.d.ts +7 -0
  66. package/dist/sandbox/core/read/permissions.js +13 -0
  67. package/dist/sandbox/core/session-manager.d.ts +29 -0
  68. package/dist/sandbox/core/session-manager.js +338 -0
  69. package/dist/sandbox/core/shell/config.d.ts +7 -0
  70. package/dist/sandbox/core/shell/config.js +82 -0
  71. package/dist/sandbox/core/shell/output.d.ts +35 -0
  72. package/dist/sandbox/core/shell/output.js +80 -0
  73. package/dist/sandbox/core/shell/parser.d.ts +7 -0
  74. package/dist/sandbox/core/shell/parser.js +122 -0
  75. package/dist/sandbox/core/shell/permissions.d.ts +13 -0
  76. package/dist/sandbox/core/shell/permissions.js +33 -0
  77. package/dist/sandbox/core/shell/workdir.d.ts +4 -0
  78. package/dist/sandbox/core/shell/workdir.js +19 -0
  79. package/dist/sandbox/core/stream-utils.d.ts +23 -0
  80. package/dist/sandbox/core/stream-utils.js +97 -0
  81. package/dist/sandbox/core/toast.d.ts +47 -0
  82. package/dist/sandbox/core/toast.js +73 -0
  83. package/dist/sandbox/core/types.d.ts +159 -0
  84. package/dist/sandbox/core/types.js +11 -0
  85. package/dist/sandbox/core/write/bom.d.ts +8 -0
  86. package/dist/sandbox/core/write/bom.js +15 -0
  87. package/dist/sandbox/core/write/config.d.ts +14 -0
  88. package/dist/sandbox/core/write/config.js +188 -0
  89. package/dist/sandbox/core/write/diagnostics.d.ts +19 -0
  90. package/dist/sandbox/core/write/diagnostics.js +120 -0
  91. package/dist/sandbox/core/write/diff.d.ts +7 -0
  92. package/dist/sandbox/core/write/diff.js +21 -0
  93. package/dist/sandbox/core/write/formatter.d.ts +16 -0
  94. package/dist/sandbox/core/write/formatter.js +51 -0
  95. package/dist/sandbox/core/write/index.d.ts +6 -0
  96. package/dist/sandbox/core/write/index.js +5 -0
  97. package/dist/sandbox/core/write/permissions.d.ts +13 -0
  98. package/dist/sandbox/core/write/permissions.js +19 -0
  99. package/dist/sandbox/core/write/pipeline.d.ts +48 -0
  100. package/dist/sandbox/core/write/pipeline.js +229 -0
  101. package/dist/sandbox/core/write/read-tracker.d.ts +13 -0
  102. package/dist/sandbox/core/write/read-tracker.js +30 -0
  103. package/dist/sandbox/git/host-git-manager.d.ts +40 -0
  104. package/dist/sandbox/git/host-git-manager.js +278 -0
  105. package/dist/sandbox/git/index.d.ts +5 -0
  106. package/dist/sandbox/git/index.js +5 -0
  107. package/dist/sandbox/git/sandbox-git-manager.d.ts +14 -0
  108. package/dist/sandbox/git/sandbox-git-manager.js +54 -0
  109. package/dist/sandbox/git/session-git-manager.d.ts +18 -0
  110. package/dist/sandbox/git/session-git-manager.js +85 -0
  111. package/dist/sandbox/index.d.ts +205 -0
  112. package/dist/sandbox/index.js +70 -0
  113. package/dist/sandbox/plugins/custom-tools.d.ts +203 -0
  114. package/dist/sandbox/plugins/custom-tools.js +15 -0
  115. package/dist/sandbox/plugins/session-events.d.ts +10 -0
  116. package/dist/sandbox/plugins/session-events.js +56 -0
  117. package/dist/sandbox/plugins/system-transform.d.ts +10 -0
  118. package/dist/sandbox/plugins/system-transform.js +23 -0
  119. package/dist/sandbox/tools/bash-output.d.ts +17 -0
  120. package/dist/sandbox/tools/bash-output.js +35 -0
  121. package/dist/sandbox/tools/bash-status.d.ts +13 -0
  122. package/dist/sandbox/tools/bash-status.js +29 -0
  123. package/dist/sandbox/tools/bash-stop.d.ts +13 -0
  124. package/dist/sandbox/tools/bash-stop.js +28 -0
  125. package/dist/sandbox/tools/bash.d.ts +26 -0
  126. package/dist/sandbox/tools/bash.js +120 -0
  127. package/dist/sandbox/tools/edit.d.ts +20 -0
  128. package/dist/sandbox/tools/edit.js +87 -0
  129. package/dist/sandbox/tools/get-preview-url.d.ts +17 -0
  130. package/dist/sandbox/tools/get-preview-url.js +16 -0
  131. package/dist/sandbox/tools/glob.d.ts +17 -0
  132. package/dist/sandbox/tools/glob.js +23 -0
  133. package/dist/sandbox/tools/grep.d.ts +17 -0
  134. package/dist/sandbox/tools/grep.js +23 -0
  135. package/dist/sandbox/tools/ls.d.ts +17 -0
  136. package/dist/sandbox/tools/ls.js +21 -0
  137. package/dist/sandbox/tools/lsp.d.ts +41 -0
  138. package/dist/sandbox/tools/lsp.js +198 -0
  139. package/dist/sandbox/tools/multiedit.d.ts +24 -0
  140. package/dist/sandbox/tools/multiedit.js +83 -0
  141. package/dist/sandbox/tools/patch.d.ts +14 -0
  142. package/dist/sandbox/tools/patch.js +260 -0
  143. package/dist/sandbox/tools/read.d.ts +22 -0
  144. package/dist/sandbox/tools/read.js +105 -0
  145. package/dist/sandbox/tools/write.d.ts +16 -0
  146. package/dist/sandbox/tools/write.js +27 -0
  147. package/dist/sandbox/tools.d.ts +200 -0
  148. package/dist/sandbox/tools.js +43 -0
  149. package/package.json +55 -0
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Copyright Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import path from 'path';
6
+ import { z } from 'zod';
7
+ import { warmHostLspFile } from '../core/lsp/index.js';
8
+ import { decodeUtf8, readRegistry, splitBom } from '../core/write/index.js';
9
+ import { detectAttachmentKind, formatBytes, formatDirectoryRead, formatTextRead, isBinaryBuffer, requestReadPermission } from '../core/read/index.js';
10
+ function shellQuote(value) {
11
+ return `'${value.replace(/'/g, `'\\''`)}'`;
12
+ }
13
+ async function statPath(sandbox, containerPath, cwd) {
14
+ const quoted = shellQuote(containerPath);
15
+ const result = await sandbox.process.executeCommand(`if [ -d ${quoted} ]; then echo directory; elif [ -f ${quoted} ]; then echo file; elif [ -e ${quoted} ]; then echo other; else echo missing; fi`, cwd);
16
+ return result.result.trim().split(/\s+/)[0];
17
+ }
18
+ async function findSuggestions(sandbox, containerPath) {
19
+ const parent = path.posix.dirname(containerPath);
20
+ const base = path.posix.basename(containerPath).toLowerCase();
21
+ const entries = await sandbox.fs.listFiles(parent).catch(() => []);
22
+ return entries
23
+ .map((entry) => entry.name)
24
+ .filter((name) => name !== '.' && name !== '..')
25
+ .filter((name) => name.toLowerCase().includes(base) || base.includes(name.toLowerCase()))
26
+ .slice(0, 8);
27
+ }
28
+ function setMetadata(ctx, title, metadata) {
29
+ if (typeof ctx.metadata !== 'function')
30
+ return;
31
+ ctx.metadata({ title, metadata });
32
+ }
33
+ export const readTool = (sessionManager, projectId, worktree, pluginCtx, mapPath) => ({
34
+ description: 'Reads files or directories from the Docker sandbox with OpenCode-style permissions, truncation, binary detection, and host LSP warming for mapped project files',
35
+ args: {
36
+ filePath: z.string(),
37
+ offset: z.number().int().positive().optional().describe('1-based line or directory-entry offset'),
38
+ limit: z.number().int().positive().optional().describe('Maximum lines or directory entries to return'),
39
+ },
40
+ async execute(args, ctx) {
41
+ const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree, pluginCtx);
42
+ const containerPath = mapPath.toContainer(args.filePath);
43
+ const hostPath = mapPath.toHost(containerPath);
44
+ const relativePath = mapPath.toRelative(hostPath);
45
+ await requestReadPermission({ ctx, relativePath, hostPath, containerPath });
46
+ const kind = await statPath(sandbox, containerPath, mapPath.repoPath);
47
+ if (kind === 'missing') {
48
+ const suggestions = await findSuggestions(sandbox, containerPath);
49
+ const suffix = suggestions.length ? `\n\nDid you mean one of these?\n${suggestions.map((item) => `- ${item}`).join('\n')}` : '';
50
+ return `File not found: ${args.filePath}${suffix}`;
51
+ }
52
+ if (kind === 'other')
53
+ return `Cannot read ${args.filePath}: path is not a regular file or directory`;
54
+ if (kind === 'directory') {
55
+ const formatted = formatDirectoryRead({
56
+ displayPath: containerPath,
57
+ entries: await sandbox.fs.listFiles(containerPath),
58
+ offset: args.offset,
59
+ limit: args.limit,
60
+ });
61
+ setMetadata(ctx, relativePath, { filepath: hostPath, containerPath, ...formatted.metadata });
62
+ return formatted.output;
63
+ }
64
+ const buffer = await sandbox.fs.downloadFile(containerPath);
65
+ const attachment = detectAttachmentKind(containerPath, buffer);
66
+ const binary = isBinaryBuffer(buffer, containerPath);
67
+ if (attachment) {
68
+ setMetadata(ctx, relativePath, {
69
+ filepath: hostPath,
70
+ containerPath,
71
+ type: attachment,
72
+ binary: true,
73
+ size: buffer.length,
74
+ });
75
+ return `<path>${containerPath}</path>\n<type>${attachment}</type>\n<content>Binary ${attachment.toUpperCase()} attachment (${formatBytes(buffer.length)}). This plugin API cannot embed attachments directly; use shell/copy tooling for raw bytes.</content>`;
76
+ }
77
+ if (binary) {
78
+ setMetadata(ctx, relativePath, {
79
+ filepath: hostPath,
80
+ containerPath,
81
+ type: 'binary',
82
+ binary: true,
83
+ size: buffer.length,
84
+ });
85
+ return `<path>${containerPath}</path>\n<type>binary</type>\n<content>Binary file (${formatBytes(buffer.length)}) cannot be displayed as text.</content>`;
86
+ }
87
+ warmHostLspFile({
88
+ sessionID: ctx.sessionID,
89
+ worktree,
90
+ paths: mapPath,
91
+ inputPath: args.filePath,
92
+ containerPath,
93
+ });
94
+ if (mapPath.isMapped(hostPath))
95
+ readRegistry.mark(ctx.sessionID, hostPath, buffer);
96
+ const formatted = formatTextRead({
97
+ displayPath: containerPath,
98
+ content: splitBom(decodeUtf8(buffer)).text,
99
+ offset: args.offset,
100
+ limit: args.limit,
101
+ });
102
+ setMetadata(ctx, relativePath, { filepath: hostPath, containerPath, size: buffer.length, ...formatted.metadata });
103
+ return formatted.output;
104
+ },
105
+ });
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import type { PluginInput } from '@opencode-ai/plugin';
3
+ import type { ToolContext } from '@opencode-ai/plugin/tool';
4
+ import type { SandboxSessionManager } from '../core/session-manager.js';
5
+ import type { PathMapper } from '../core/path-map.js';
6
+ export declare const writeTool: (sessionManager: SandboxSessionManager, projectId: string, worktree: string, pluginCtx: PluginInput, mapPath: PathMapper) => {
7
+ description: string;
8
+ args: {
9
+ filePath: z.ZodString;
10
+ content: z.ZodString;
11
+ };
12
+ execute(args: {
13
+ filePath: string;
14
+ content: string;
15
+ }, ctx: ToolContext): Promise<string>;
16
+ };
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { sandboxWriteFile } from '../core/write/index.js';
3
+ export const writeTool = (sessionManager, projectId, worktree, pluginCtx, mapPath) => ({
4
+ description: 'Writes content to a file in the Docker sandbox using OpenCode-like edit permission, diff metadata, formatter, and host LSP diagnostics',
5
+ args: {
6
+ filePath: z.string().describe('Absolute, relative, or mapped container path to create or overwrite'),
7
+ content: z.string().describe('Complete file content to write'),
8
+ },
9
+ async execute(args, ctx) {
10
+ const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree, pluginCtx);
11
+ const result = await sandboxWriteFile({
12
+ ctx,
13
+ sandbox,
14
+ sessionID: ctx.sessionID,
15
+ worktree,
16
+ paths: mapPath,
17
+ filePath: args.filePath,
18
+ content: args.content,
19
+ operation: 'write',
20
+ requireFreshRead: true,
21
+ });
22
+ let output = 'Wrote file successfully.';
23
+ if (result.diagnostics.output)
24
+ output += '\n\n' + result.diagnostics.output;
25
+ return output;
26
+ },
27
+ });
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Copyright Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import type { SandboxSessionManager } from './core/session-manager.js';
6
+ import type { PluginInput } from '@opencode-ai/plugin';
7
+ export declare function createSandboxTools(sessionManager: SandboxSessionManager, projectId: string, worktree: string, pluginCtx: PluginInput): {
8
+ bash: {
9
+ description: string;
10
+ args: {
11
+ command: import("zod").ZodString;
12
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
13
+ workdir: import("zod").ZodOptional<import("zod").ZodString>;
14
+ description: import("zod").ZodOptional<import("zod").ZodString>;
15
+ background: import("zod").ZodOptional<import("zod").ZodBoolean>;
16
+ };
17
+ execute(args: {
18
+ command: string;
19
+ timeout?: number;
20
+ workdir?: string;
21
+ description?: string;
22
+ background?: boolean;
23
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
24
+ };
25
+ bash_status: {
26
+ description: string;
27
+ args: {
28
+ cmdId: import("zod").ZodString;
29
+ };
30
+ execute(args: {
31
+ cmdId: string;
32
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
33
+ };
34
+ bash_output: {
35
+ description: string;
36
+ args: {
37
+ cmdId: import("zod").ZodString;
38
+ maxBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
39
+ maxLines: import("zod").ZodOptional<import("zod").ZodNumber>;
40
+ };
41
+ execute(args: {
42
+ cmdId: string;
43
+ maxBytes?: number;
44
+ maxLines?: number;
45
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
46
+ };
47
+ bash_stop: {
48
+ description: string;
49
+ args: {
50
+ cmdId: import("zod").ZodString;
51
+ };
52
+ execute(args: {
53
+ cmdId: string;
54
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
55
+ };
56
+ read: {
57
+ description: string;
58
+ args: {
59
+ filePath: import("zod").ZodString;
60
+ offset: import("zod").ZodOptional<import("zod").ZodNumber>;
61
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
62
+ };
63
+ execute(args: {
64
+ filePath: string;
65
+ offset?: number;
66
+ limit?: number;
67
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
68
+ };
69
+ write: {
70
+ description: string;
71
+ args: {
72
+ filePath: import("zod").ZodString;
73
+ content: import("zod").ZodString;
74
+ };
75
+ execute(args: {
76
+ filePath: string;
77
+ content: string;
78
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
79
+ };
80
+ edit: {
81
+ description: string;
82
+ args: {
83
+ filePath: import("zod").ZodString;
84
+ oldString: import("zod").ZodString;
85
+ newString: import("zod").ZodString;
86
+ replaceAll: import("zod").ZodOptional<import("zod").ZodBoolean>;
87
+ };
88
+ execute(args: {
89
+ filePath: string;
90
+ oldString: string;
91
+ newString: string;
92
+ replaceAll?: boolean;
93
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
94
+ };
95
+ multiedit: {
96
+ description: string;
97
+ args: {
98
+ filePath: import("zod").ZodString;
99
+ edits: import("zod").ZodArray<import("zod").ZodObject<{
100
+ oldString: import("zod").ZodString;
101
+ newString: import("zod").ZodString;
102
+ replaceAll: import("zod").ZodOptional<import("zod").ZodBoolean>;
103
+ }, import("zod/v4/core").$strip>>;
104
+ };
105
+ execute(args: {
106
+ filePath: string;
107
+ edits: Array<{
108
+ oldString: string;
109
+ newString: string;
110
+ replaceAll?: boolean;
111
+ }>;
112
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
113
+ };
114
+ apply_patch: {
115
+ description: string;
116
+ args: {
117
+ patchText: import("zod").ZodString;
118
+ };
119
+ execute(args: {
120
+ patchText: string;
121
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
122
+ };
123
+ patch: {
124
+ description: string;
125
+ args: {
126
+ patchText: import("zod").ZodString;
127
+ };
128
+ execute(args: {
129
+ patchText: string;
130
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
131
+ };
132
+ ls: {
133
+ description: string;
134
+ args: {
135
+ dirPath: import("zod").ZodOptional<import("zod").ZodString>;
136
+ };
137
+ execute(args: {
138
+ dirPath?: string;
139
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
140
+ };
141
+ glob: {
142
+ description: string;
143
+ args: {
144
+ pattern: import("zod").ZodString;
145
+ };
146
+ execute(args: {
147
+ pattern: string;
148
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
149
+ };
150
+ grep: {
151
+ description: string;
152
+ args: {
153
+ pattern: import("zod").ZodString;
154
+ };
155
+ execute(args: {
156
+ pattern: string;
157
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
158
+ };
159
+ lsp: {
160
+ description: string;
161
+ args: {
162
+ operation: import("zod").ZodEnum<{
163
+ status: "status";
164
+ diagnostics: "diagnostics";
165
+ hover: "hover";
166
+ documentSymbol: "documentSymbol";
167
+ workspaceSymbol: "workspaceSymbol";
168
+ references: "references";
169
+ findReferences: "findReferences";
170
+ definition: "definition";
171
+ goToDefinition: "goToDefinition";
172
+ implementation: "implementation";
173
+ goToImplementation: "goToImplementation";
174
+ prepareCallHierarchy: "prepareCallHierarchy";
175
+ incomingCalls: "incomingCalls";
176
+ outgoingCalls: "outgoingCalls";
177
+ }>;
178
+ filePath: import("zod").ZodOptional<import("zod").ZodString>;
179
+ line: import("zod").ZodOptional<import("zod").ZodNumber>;
180
+ character: import("zod").ZodOptional<import("zod").ZodNumber>;
181
+ query: import("zod").ZodOptional<import("zod").ZodString>;
182
+ };
183
+ execute(args: {
184
+ operation: "status" | "diagnostics" | "hover" | "documentSymbol" | "workspaceSymbol" | "references" | "findReferences" | "definition" | "goToDefinition" | "implementation" | "goToImplementation" | "prepareCallHierarchy" | "incomingCalls" | "outgoingCalls";
185
+ filePath?: string;
186
+ line?: number;
187
+ character?: number;
188
+ query?: string;
189
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
190
+ };
191
+ getPreviewURL: {
192
+ description: string;
193
+ args: {
194
+ port: import("zod").ZodNumber;
195
+ };
196
+ execute(args: {
197
+ port: number;
198
+ }, ctx: import("@opencode-ai/plugin").ToolContext): Promise<string>;
199
+ };
200
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Tool implementations for Docker sandbox integration
7
+ */
8
+ import { bashTool } from './tools/bash.js';
9
+ import { bashOutputTool } from './tools/bash-output.js';
10
+ import { bashStatusTool } from './tools/bash-status.js';
11
+ import { bashStopTool } from './tools/bash-stop.js';
12
+ import { readTool } from './tools/read.js';
13
+ import { writeTool } from './tools/write.js';
14
+ import { editTool } from './tools/edit.js';
15
+ import { multieditTool } from './tools/multiedit.js';
16
+ import { patchTool } from './tools/patch.js';
17
+ import { lsTool } from './tools/ls.js';
18
+ import { globTool } from './tools/glob.js';
19
+ import { grepTool } from './tools/grep.js';
20
+ import { lspTool } from './tools/lsp.js';
21
+ import { getPreviewURLTool } from './tools/get-preview-url.js';
22
+ import { createPathMapper } from './core/path-map.js';
23
+ export function createSandboxTools(sessionManager, projectId, worktree, pluginCtx) {
24
+ const repoPath = sessionManager.repoPath;
25
+ const mapPath = createPathMapper(worktree, repoPath);
26
+ return {
27
+ bash: bashTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
28
+ bash_status: bashStatusTool(sessionManager, projectId, worktree, pluginCtx),
29
+ bash_output: bashOutputTool(sessionManager, projectId, worktree, pluginCtx),
30
+ bash_stop: bashStopTool(sessionManager, projectId, worktree, pluginCtx),
31
+ read: readTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
32
+ write: writeTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
33
+ edit: editTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
34
+ multiedit: multieditTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
35
+ apply_patch: patchTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
36
+ patch: patchTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
37
+ ls: lsTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
38
+ glob: globTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
39
+ grep: grepTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
40
+ lsp: lspTool(sessionManager, projectId, worktree, pluginCtx, mapPath),
41
+ getPreviewURL: getPreviewURLTool(sessionManager, projectId, worktree, pluginCtx),
42
+ };
43
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@wavexzore/sandbox",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode plugin that runs every session in a local Docker sandbox",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist/**/*.js",
9
+ "dist/**/*.d.ts",
10
+ "README.md",
11
+ "Dockerfile",
12
+ "LICENSE",
13
+ "NOTICE"
14
+ ],
15
+ "bin": {
16
+ "wavexzore-sandbox": "dist/sandbox/cli/wavexzore-sandbox.js"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run clean && tsc -p tsconfig.lib.json",
20
+ "clean": "rm -rf dist *.tsbuildinfo",
21
+ "lint": "eslint \"src/**/*.ts\"",
22
+ "prepack": "npm run build",
23
+ "prepublishOnly": "npm run build",
24
+ "test": "node --import tsx --test \"src/**/*.test.ts\"",
25
+ "typecheck": "tsc --noEmit --project tsconfig.json"
26
+ },
27
+ "dependencies": {
28
+ "@opencode-ai/plugin": "1.14.41",
29
+ "diff": "^8.0.3",
30
+ "dockerode": "^4.0.6",
31
+ "tar-stream": "^3.1.7",
32
+ "tslib": "^2.8.1",
33
+ "vscode-jsonrpc": "^8.2.1",
34
+ "vscode-languageserver-types": "^3.17.5",
35
+ "zod": "^4.2.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/dockerode": "^3.3.42",
39
+ "@types/tar-stream": "^3.1.4"
40
+ },
41
+ "keywords": [
42
+ "opencode",
43
+ "sandbox",
44
+ "docker",
45
+ "plugin"
46
+ ],
47
+ "license": "Apache-2.0",
48
+ "type": "module",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./dist/index.d.ts",
52
+ "import": "./dist/index.js"
53
+ }
54
+ }
55
+ }