opencode-sandbox 0.1.3 → 0.1.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/dist/index.js +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,6 +91,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
91
91
|
}
|
|
92
92
|
if (!sandboxReady)
|
|
93
93
|
return {};
|
|
94
|
+
let lastOriginalCommand;
|
|
94
95
|
return {
|
|
95
96
|
"tool.execute.before": async (input, output) => {
|
|
96
97
|
if (input.tool !== "bash")
|
|
@@ -98,6 +99,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
98
99
|
const command = output.args?.command;
|
|
99
100
|
if (typeof command !== "string" || !command)
|
|
100
101
|
return;
|
|
102
|
+
lastOriginalCommand = command;
|
|
101
103
|
try {
|
|
102
104
|
output.args.command = await SandboxManager.wrapWithSandbox(command);
|
|
103
105
|
} catch (err) {
|
|
@@ -117,6 +119,10 @@ var SandboxPlugin = async ({ directory, worktree }) => {
|
|
|
117
119
|
output.metadata.output = message;
|
|
118
120
|
}
|
|
119
121
|
}
|
|
122
|
+
if (lastOriginalCommand && input.args && typeof input.args.command === "string") {
|
|
123
|
+
input.args.command = lastOriginalCommand;
|
|
124
|
+
lastOriginalCommand = undefined;
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
128
|
};
|
package/package.json
CHANGED