opencode-sandbox 0.1.20 → 0.1.22
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/dist/index.js +6 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
110
110
|
}
|
|
111
111
|
if (!sandboxReady)
|
|
112
112
|
return {};
|
|
113
|
-
|
|
113
|
+
const originalCommands = new Map;
|
|
114
114
|
return {
|
|
115
115
|
"tool.execute.before": async (input, output) => {
|
|
116
116
|
if (input.tool !== "bash")
|
|
@@ -118,7 +118,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
118
118
|
const command = output.args?.command;
|
|
119
119
|
if (typeof command !== "string" || !command)
|
|
120
120
|
return;
|
|
121
|
-
|
|
121
|
+
originalCommands.set(input.callID, command);
|
|
122
122
|
try {
|
|
123
123
|
output.args.command = await SandboxManager.wrapWithSandbox(command);
|
|
124
124
|
} catch (err) {
|
|
@@ -128,9 +128,10 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
128
128
|
"tool.execute.after": async (input, _output) => {
|
|
129
129
|
if (input.tool !== "bash")
|
|
130
130
|
return;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const originalCommand = originalCommands.get(input.callID);
|
|
132
|
+
if (originalCommand && input.args && typeof input.args.command === "string") {
|
|
133
|
+
input.args.command = originalCommand;
|
|
134
|
+
originalCommands.delete(input.callID);
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-sandbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "OpenCode plugin that sandboxes agent commands using @anthropic-ai/sandbox-runtime (seatbelt on macOS, bubblewrap on Linux)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"registry": "https://registry.npmjs.org/"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@anthropic-ai/sandbox-runtime": "^0.0.
|
|
58
|
+
"@anthropic-ai/sandbox-runtime": "^0.0.38"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@opencode-ai/plugin": ">=1.0.0"
|