@tangle-network/agent-app 0.46.9 → 0.46.10
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.
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
flattenHistory,
|
|
113
113
|
readSandboxBinaryBytes,
|
|
114
114
|
statSandboxFileSize
|
|
115
|
-
} from "../chunk-
|
|
115
|
+
} from "../chunk-3HBH5GFN.js";
|
|
116
116
|
import "../chunk-TH7L265V.js";
|
|
117
117
|
import "../chunk-LWSJK546.js";
|
|
118
118
|
import "../chunk-P5PIAQVS.js";
|
|
@@ -1026,36 +1026,48 @@ function buildSandboxToolFileMounts(options) {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
|
+
function buildSandboxToolBinDirsEnv(apps) {
|
|
1030
|
+
if (apps.length === 0) {
|
|
1031
|
+
throw new Error(
|
|
1032
|
+
"buildSandboxToolBinDirsEnv: name at least one app whose tool bin dir belongs on PATH."
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
const binDirs = /* @__PURE__ */ new Set();
|
|
1036
|
+
for (const app of apps) {
|
|
1037
|
+
const binDir = sandboxToolBinDir(app);
|
|
1038
|
+
if (binDir.includes(":")) {
|
|
1039
|
+
throw new Error(
|
|
1040
|
+
`sandbox tool bin dir ${binDir} contains ':', which separates entries in SANDBOX_TOOL_BIN_DIRS and in PATH. Place the tools under a colon-free directory.`
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
binDirs.add(binDir);
|
|
1044
|
+
}
|
|
1045
|
+
return { SANDBOX_TOOL_BIN_DIRS: [...binDirs].join(":") };
|
|
1046
|
+
}
|
|
1047
|
+
function buildSandboxToolBinDirScript(options) {
|
|
1048
|
+
return ["set -eu", `mkdir -p ${shellSingleQuote(sandboxToolBinDir(options))}`].join("\n");
|
|
1049
|
+
}
|
|
1029
1050
|
function buildSandboxToolPathSetupScript(options) {
|
|
1030
|
-
|
|
1031
|
-
const exportLine = `export PATH=${binDir}:$PATH`;
|
|
1032
|
-
return [
|
|
1033
|
-
"set -eu",
|
|
1034
|
-
`mkdir -p ${shellSingleQuote(binDir)}`,
|
|
1035
|
-
`PATH=${shellSingleQuote(binDir)}:$PATH`,
|
|
1036
|
-
"export PATH",
|
|
1037
|
-
'for profile in "${HOME:-/home/agent}/.profile" "${HOME:-/home/agent}/.bashrc" "${HOME:-/home/agent}/.zshrc"; do',
|
|
1038
|
-
' mkdir -p "$(dirname "$profile")"',
|
|
1039
|
-
' touch "$profile"',
|
|
1040
|
-
` grep -Fqx ${shellSingleQuote(exportLine)} "$profile" || printf '\\n%s\\n' ${shellSingleQuote(exportLine)} >> "$profile"`,
|
|
1041
|
-
"done"
|
|
1042
|
-
].join("\n");
|
|
1051
|
+
return buildSandboxToolBinDirScript(options);
|
|
1043
1052
|
}
|
|
1044
|
-
async function
|
|
1053
|
+
async function ensureSandboxToolBinDir(box, options) {
|
|
1045
1054
|
try {
|
|
1046
|
-
const res = await box.exec(
|
|
1055
|
+
const res = await box.exec(buildSandboxToolBinDirScript(options));
|
|
1047
1056
|
if (res.exitCode !== 0) {
|
|
1048
1057
|
return fail(
|
|
1049
1058
|
new Error(
|
|
1050
|
-
`
|
|
1059
|
+
`ensureSandboxToolBinDir: failed to create the tool bin dir ${sandboxToolBinDir(options)} (exit ${res.exitCode}): ${res.stderr.slice(0, 500)}`
|
|
1051
1060
|
)
|
|
1052
1061
|
);
|
|
1053
1062
|
}
|
|
1054
1063
|
return ok(void 0);
|
|
1055
1064
|
} catch (err) {
|
|
1056
|
-
return fail(new Error("
|
|
1065
|
+
return fail(new Error("ensureSandboxToolBinDir: exec failed", { cause: err }));
|
|
1057
1066
|
}
|
|
1058
1067
|
}
|
|
1068
|
+
async function runSandboxToolPathSetup(box, options) {
|
|
1069
|
+
return ensureSandboxToolBinDir(box, options);
|
|
1070
|
+
}
|
|
1059
1071
|
function shellPath(path) {
|
|
1060
1072
|
if (path === "~") return '"$HOME"';
|
|
1061
1073
|
if (path.startsWith("~/")) {
|
|
@@ -2340,7 +2352,10 @@ export {
|
|
|
2340
2352
|
sandboxToolBinDir,
|
|
2341
2353
|
sandboxToolPath,
|
|
2342
2354
|
buildSandboxToolFileMounts,
|
|
2355
|
+
buildSandboxToolBinDirsEnv,
|
|
2356
|
+
buildSandboxToolBinDirScript,
|
|
2343
2357
|
buildSandboxToolPathSetupScript,
|
|
2358
|
+
ensureSandboxToolBinDir,
|
|
2344
2359
|
runSandboxToolPathSetup,
|
|
2345
2360
|
splitDeferredProfileFiles,
|
|
2346
2361
|
SandboxEgressPolicyMismatchError,
|
|
@@ -2376,4 +2391,4 @@ export {
|
|
|
2376
2391
|
isTerminalPromptEvent,
|
|
2377
2392
|
detectInteractiveQuestion
|
|
2378
2393
|
};
|
|
2379
|
-
//# sourceMappingURL=chunk-
|
|
2394
|
+
//# sourceMappingURL=chunk-3HBH5GFN.js.map
|