tensorlake 0.5.14 → 0.5.17
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/bin/darwin-arm64/tensorlake +0 -0
- package/dist/bin/darwin-arm64/tl +0 -0
- package/dist/bin/linux-x64/tensorlake +0 -0
- package/dist/bin/linux-x64/tl +0 -0
- package/dist/bin/win32-x64/tensorlake.exe +0 -0
- package/dist/bin/win32-x64/tl.exe +0 -0
- package/dist/index.cjs +38 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -14
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +38 -14
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +38 -14
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
package/dist/sandbox-image.js
CHANGED
|
@@ -61,7 +61,7 @@ var SDK_VERSION, API_URL, API_KEY, NAMESPACE, SANDBOX_PROXY_URL, DEFAULT_HTTP_TI
|
|
|
61
61
|
var init_defaults = __esm({
|
|
62
62
|
"src/defaults.ts"() {
|
|
63
63
|
"use strict";
|
|
64
|
-
SDK_VERSION = "0.5.
|
|
64
|
+
SDK_VERSION = "0.5.17";
|
|
65
65
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
66
66
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
67
67
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -4911,13 +4911,16 @@ function optionalNumber(object, key) {
|
|
|
4911
4911
|
}
|
|
4912
4912
|
return value;
|
|
4913
4913
|
}
|
|
4914
|
-
async function runChecked(sandbox, command, args, env, workingDir) {
|
|
4915
|
-
const
|
|
4914
|
+
async function runChecked(sandbox, command, args, env, workingDir, user) {
|
|
4915
|
+
const options = {
|
|
4916
4916
|
args,
|
|
4917
4917
|
env,
|
|
4918
|
-
workingDir
|
|
4919
|
-
|
|
4920
|
-
|
|
4918
|
+
workingDir
|
|
4919
|
+
};
|
|
4920
|
+
if (user != null) {
|
|
4921
|
+
options.user = user;
|
|
4922
|
+
}
|
|
4923
|
+
const result = await sandbox.run(command, options);
|
|
4921
4924
|
if (result.exitCode !== 0) {
|
|
4922
4925
|
throw new Error(
|
|
4923
4926
|
`Command '${command} ${args.join(" ")}' failed with exit code ${result.exitCode}`
|
|
@@ -4972,13 +4975,37 @@ function emitOutputLines(emit, stream, response, seen) {
|
|
|
4972
4975
|
emit({ type: "build_log", stream, message: line });
|
|
4973
4976
|
}
|
|
4974
4977
|
}
|
|
4978
|
+
async function ensureRemoteBuildRoot(sandbox) {
|
|
4979
|
+
await runChecked(
|
|
4980
|
+
sandbox,
|
|
4981
|
+
"mkdir",
|
|
4982
|
+
["-p", REMOTE_BUILD_DIR],
|
|
4983
|
+
void 0,
|
|
4984
|
+
void 0,
|
|
4985
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
4986
|
+
);
|
|
4987
|
+
await runChecked(
|
|
4988
|
+
sandbox,
|
|
4989
|
+
"chmod",
|
|
4990
|
+
["0777", REMOTE_BUILD_DIR],
|
|
4991
|
+
void 0,
|
|
4992
|
+
void 0,
|
|
4993
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
4994
|
+
);
|
|
4995
|
+
}
|
|
4996
|
+
async function ensureRemoteDirectory(sandbox, remotePath) {
|
|
4997
|
+
await runChecked(sandbox, "mkdir", ["-p", remotePath]);
|
|
4998
|
+
}
|
|
4999
|
+
async function ensureRemoteParentDir(sandbox, remotePath) {
|
|
5000
|
+
await ensureRemoteDirectory(sandbox, path.posix.dirname(remotePath));
|
|
5001
|
+
}
|
|
4975
5002
|
async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
4976
5003
|
const fileStats = await stat(localPath).catch(() => null);
|
|
4977
5004
|
if (!fileStats) {
|
|
4978
5005
|
throw new Error(`Local path not found: ${localPath}`);
|
|
4979
5006
|
}
|
|
4980
5007
|
if (fileStats.isFile()) {
|
|
4981
|
-
await
|
|
5008
|
+
await ensureRemoteParentDir(sandbox, remotePath);
|
|
4982
5009
|
await sandbox.writeFile(remotePath, await readFile(localPath));
|
|
4983
5010
|
return;
|
|
4984
5011
|
}
|
|
@@ -4990,14 +5017,10 @@ async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
|
4990
5017
|
const sourcePath = path.join(localPath, entry.name);
|
|
4991
5018
|
const destinationPath = path.posix.join(remotePath, entry.name);
|
|
4992
5019
|
if (entry.isDirectory()) {
|
|
4993
|
-
await
|
|
5020
|
+
await ensureRemoteDirectory(sandbox, destinationPath);
|
|
4994
5021
|
await copyLocalPathToSandbox(sandbox, sourcePath, destinationPath);
|
|
4995
5022
|
} else if (entry.isFile()) {
|
|
4996
|
-
await
|
|
4997
|
-
sandbox,
|
|
4998
|
-
"mkdir",
|
|
4999
|
-
["-p", path.posix.dirname(destinationPath)]
|
|
5000
|
-
);
|
|
5023
|
+
await ensureRemoteParentDir(sandbox, destinationPath);
|
|
5001
5024
|
await sandbox.writeFile(destinationPath, await readFile(sourcePath));
|
|
5002
5025
|
}
|
|
5003
5026
|
}
|
|
@@ -5094,6 +5117,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5094
5117
|
message: `Rootfs builder sandbox ${sandbox.sandboxId} is running`
|
|
5095
5118
|
});
|
|
5096
5119
|
emit({ type: "status", message: "Uploading build context..." });
|
|
5120
|
+
await ensureRemoteBuildRoot(sandbox);
|
|
5097
5121
|
await copyLocalPathToSandbox(sandbox, plan.contextDir, REMOTE_CONTEXT_DIR);
|
|
5098
5122
|
const spec = await buildRootfsSpec(
|
|
5099
5123
|
preparedSpec,
|
|
@@ -5101,7 +5125,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5101
5125
|
plan,
|
|
5102
5126
|
options.diskMb
|
|
5103
5127
|
);
|
|
5104
|
-
await
|
|
5128
|
+
await ensureRemoteParentDir(sandbox, REMOTE_SPEC_PATH);
|
|
5105
5129
|
await sandbox.writeFile(
|
|
5106
5130
|
REMOTE_SPEC_PATH,
|
|
5107
5131
|
new TextEncoder().encode(JSON.stringify(spec, null, 2))
|