mercury-agent 0.4.18 → 0.4.20
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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execFileSync, execSync, spawn } from "node:child_process";
|
|
1
|
+
import { execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path, { dirname } from "node:path";
|
|
@@ -389,12 +389,39 @@ let _isDockerDesktop: boolean | undefined;
|
|
|
389
389
|
function isDockerDesktop(): boolean {
|
|
390
390
|
if (_isDockerDesktop !== undefined) return _isDockerDesktop;
|
|
391
391
|
try {
|
|
392
|
-
const
|
|
392
|
+
const result = spawnSync("docker", ["info", "--format", "{{.Name}}"], {
|
|
393
393
|
encoding: "utf8",
|
|
394
394
|
timeout: 10_000,
|
|
395
395
|
stdio: ["pipe", "pipe", "pipe"],
|
|
396
|
-
})
|
|
397
|
-
|
|
396
|
+
});
|
|
397
|
+
const name = (result.stdout ?? "").trim();
|
|
398
|
+
const stderr = (result.stderr ?? "").trim();
|
|
399
|
+
if (name === "docker-desktop") {
|
|
400
|
+
_isDockerDesktop = true;
|
|
401
|
+
} else {
|
|
402
|
+
// Fallback: check Docker context or server OS for Docker Desktop indicators
|
|
403
|
+
const ctxResult = spawnSync(
|
|
404
|
+
"docker",
|
|
405
|
+
["info", "--format", "{{.OperatingSystem}}"],
|
|
406
|
+
{ encoding: "utf8", timeout: 10_000, stdio: ["pipe", "pipe", "pipe"] },
|
|
407
|
+
);
|
|
408
|
+
const os = (ctxResult.stdout ?? "").trim();
|
|
409
|
+
_isDockerDesktop =
|
|
410
|
+
os.includes("Docker Desktop") || os.includes("Docker for Windows");
|
|
411
|
+
if (_isDockerDesktop) {
|
|
412
|
+
logger.info("Docker Desktop detected via OperatingSystem field", {
|
|
413
|
+
name,
|
|
414
|
+
os,
|
|
415
|
+
});
|
|
416
|
+
} else {
|
|
417
|
+
logger.debug("Docker Desktop not detected", {
|
|
418
|
+
name,
|
|
419
|
+
os,
|
|
420
|
+
exitCode: result.status,
|
|
421
|
+
stderr: stderr.slice(0, 200),
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
398
425
|
} catch {
|
|
399
426
|
_isDockerDesktop = false;
|
|
400
427
|
}
|
|
@@ -951,10 +978,10 @@ export class AgentContainerRunner {
|
|
|
951
978
|
"CONTAINER_RUNTIME=runsc",
|
|
952
979
|
);
|
|
953
980
|
} else if (this.config.containerBwrapDockerCompat || isDockerDesktop()) {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
981
|
+
logger.info("Enabling bwrap Docker compat (seccomp/apparmor/SYS_ADMIN)", {
|
|
982
|
+
configFlag: this.config.containerBwrapDockerCompat,
|
|
983
|
+
dockerDesktop: isDockerDesktop(),
|
|
984
|
+
});
|
|
958
985
|
args.push(
|
|
959
986
|
"--security-opt",
|
|
960
987
|
"seccomp=unconfined",
|