@cuylabs/agent-sandbox-docker 0.10.0 → 0.12.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/dist/index.js +9 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -168,7 +168,9 @@ function createDockerToolHost(options) {
|
|
|
168
168
|
const absPath = resolveDockerPath(filePath, defaultWorkdir);
|
|
169
169
|
const result = await run(`cat ${sq(absPath)}`);
|
|
170
170
|
if (result.exitCode !== 0) {
|
|
171
|
-
throw new Error(
|
|
171
|
+
throw new Error(
|
|
172
|
+
`readFile failed (${absPath}): ${result.stderr.trim()}`
|
|
173
|
+
);
|
|
172
174
|
}
|
|
173
175
|
return result.stdout;
|
|
174
176
|
},
|
|
@@ -190,11 +192,11 @@ function createDockerToolHost(options) {
|
|
|
190
192
|
await run(`mkdir -p ${sq(dir)}`);
|
|
191
193
|
const contentBytes = Buffer.from(content, "utf-8");
|
|
192
194
|
if (contentBytes.length > STDIN_WRITE_THRESHOLD) {
|
|
193
|
-
const result = await containerExec(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
);
|
|
195
|
+
const result = await containerExec(runtime, `cat > ${sq(absPath)}`, {
|
|
196
|
+
user: defaultUser,
|
|
197
|
+
workdir: defaultWorkdir,
|
|
198
|
+
stdin: contentBytes
|
|
199
|
+
});
|
|
198
200
|
if (result.exitCode !== 0) {
|
|
199
201
|
throw new Error(
|
|
200
202
|
`writeFile failed (${absPath}): ${result.stderr.trim()}`
|
|
@@ -247,9 +249,7 @@ function createDockerToolHost(options) {
|
|
|
247
249
|
`find ${sq(absPath)} -maxdepth 1 -mindepth 1 -printf '%f\\t%y\\n' 2>/dev/null || for f in ${sq(absPath)}/*; do [ -e "$f" ] || continue; n=$(basename "$f"); if [ -d "$f" ]; then printf '%s\\td\\n' "$n"; else printf '%s\\tf\\n' "$n"; fi; done`
|
|
248
250
|
);
|
|
249
251
|
if (result.exitCode !== 0) {
|
|
250
|
-
throw new Error(
|
|
251
|
-
`readdir failed (${absPath}): ${result.stderr.trim()}`
|
|
252
|
-
);
|
|
252
|
+
throw new Error(`readdir failed (${absPath}): ${result.stderr.trim()}`);
|
|
253
253
|
}
|
|
254
254
|
return result.stdout.trim().split("\n").filter(Boolean).map((line) => {
|
|
255
255
|
const [name, type] = line.split(" ");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/agent-sandbox-docker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Docker-backed sandbox sessions and execution hosts for @cuylabs/agent-core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cuylabs/agent-core": "^0.
|
|
20
|
+
"@cuylabs/agent-core": "^0.12.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"dockerode": "^4.0.9"
|