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.cjs
CHANGED
|
@@ -83,7 +83,7 @@ var SDK_VERSION, API_URL, API_KEY, NAMESPACE, SANDBOX_PROXY_URL, DEFAULT_HTTP_TI
|
|
|
83
83
|
var init_defaults = __esm({
|
|
84
84
|
"src/defaults.ts"() {
|
|
85
85
|
"use strict";
|
|
86
|
-
SDK_VERSION = "0.5.
|
|
86
|
+
SDK_VERSION = "0.5.17";
|
|
87
87
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
88
88
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
89
89
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -4936,13 +4936,16 @@ function optionalNumber(object, key) {
|
|
|
4936
4936
|
}
|
|
4937
4937
|
return value;
|
|
4938
4938
|
}
|
|
4939
|
-
async function runChecked(sandbox, command, args, env, workingDir) {
|
|
4940
|
-
const
|
|
4939
|
+
async function runChecked(sandbox, command, args, env, workingDir, user) {
|
|
4940
|
+
const options = {
|
|
4941
4941
|
args,
|
|
4942
4942
|
env,
|
|
4943
|
-
workingDir
|
|
4944
|
-
|
|
4945
|
-
|
|
4943
|
+
workingDir
|
|
4944
|
+
};
|
|
4945
|
+
if (user != null) {
|
|
4946
|
+
options.user = user;
|
|
4947
|
+
}
|
|
4948
|
+
const result = await sandbox.run(command, options);
|
|
4946
4949
|
if (result.exitCode !== 0) {
|
|
4947
4950
|
throw new Error(
|
|
4948
4951
|
`Command '${command} ${args.join(" ")}' failed with exit code ${result.exitCode}`
|
|
@@ -4997,13 +5000,37 @@ function emitOutputLines(emit, stream, response, seen) {
|
|
|
4997
5000
|
emit({ type: "build_log", stream, message: line });
|
|
4998
5001
|
}
|
|
4999
5002
|
}
|
|
5003
|
+
async function ensureRemoteBuildRoot(sandbox) {
|
|
5004
|
+
await runChecked(
|
|
5005
|
+
sandbox,
|
|
5006
|
+
"mkdir",
|
|
5007
|
+
["-p", REMOTE_BUILD_DIR],
|
|
5008
|
+
void 0,
|
|
5009
|
+
void 0,
|
|
5010
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
5011
|
+
);
|
|
5012
|
+
await runChecked(
|
|
5013
|
+
sandbox,
|
|
5014
|
+
"chmod",
|
|
5015
|
+
["0777", REMOTE_BUILD_DIR],
|
|
5016
|
+
void 0,
|
|
5017
|
+
void 0,
|
|
5018
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
5019
|
+
);
|
|
5020
|
+
}
|
|
5021
|
+
async function ensureRemoteDirectory(sandbox, remotePath) {
|
|
5022
|
+
await runChecked(sandbox, "mkdir", ["-p", remotePath]);
|
|
5023
|
+
}
|
|
5024
|
+
async function ensureRemoteParentDir(sandbox, remotePath) {
|
|
5025
|
+
await ensureRemoteDirectory(sandbox, import_node_path.default.posix.dirname(remotePath));
|
|
5026
|
+
}
|
|
5000
5027
|
async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
5001
5028
|
const fileStats = await (0, import_promises.stat)(localPath).catch(() => null);
|
|
5002
5029
|
if (!fileStats) {
|
|
5003
5030
|
throw new Error(`Local path not found: ${localPath}`);
|
|
5004
5031
|
}
|
|
5005
5032
|
if (fileStats.isFile()) {
|
|
5006
|
-
await
|
|
5033
|
+
await ensureRemoteParentDir(sandbox, remotePath);
|
|
5007
5034
|
await sandbox.writeFile(remotePath, await (0, import_promises.readFile)(localPath));
|
|
5008
5035
|
return;
|
|
5009
5036
|
}
|
|
@@ -5015,14 +5042,10 @@ async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
|
5015
5042
|
const sourcePath = import_node_path.default.join(localPath, entry.name);
|
|
5016
5043
|
const destinationPath = import_node_path.default.posix.join(remotePath, entry.name);
|
|
5017
5044
|
if (entry.isDirectory()) {
|
|
5018
|
-
await
|
|
5045
|
+
await ensureRemoteDirectory(sandbox, destinationPath);
|
|
5019
5046
|
await copyLocalPathToSandbox(sandbox, sourcePath, destinationPath);
|
|
5020
5047
|
} else if (entry.isFile()) {
|
|
5021
|
-
await
|
|
5022
|
-
sandbox,
|
|
5023
|
-
"mkdir",
|
|
5024
|
-
["-p", import_node_path.default.posix.dirname(destinationPath)]
|
|
5025
|
-
);
|
|
5048
|
+
await ensureRemoteParentDir(sandbox, destinationPath);
|
|
5026
5049
|
await sandbox.writeFile(destinationPath, await (0, import_promises.readFile)(sourcePath));
|
|
5027
5050
|
}
|
|
5028
5051
|
}
|
|
@@ -5119,6 +5142,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5119
5142
|
message: `Rootfs builder sandbox ${sandbox.sandboxId} is running`
|
|
5120
5143
|
});
|
|
5121
5144
|
emit({ type: "status", message: "Uploading build context..." });
|
|
5145
|
+
await ensureRemoteBuildRoot(sandbox);
|
|
5122
5146
|
await copyLocalPathToSandbox(sandbox, plan.contextDir, REMOTE_CONTEXT_DIR);
|
|
5123
5147
|
const spec = await buildRootfsSpec(
|
|
5124
5148
|
preparedSpec,
|
|
@@ -5126,7 +5150,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5126
5150
|
plan,
|
|
5127
5151
|
options.diskMb
|
|
5128
5152
|
);
|
|
5129
|
-
await
|
|
5153
|
+
await ensureRemoteParentDir(sandbox, REMOTE_SPEC_PATH);
|
|
5130
5154
|
await sandbox.writeFile(
|
|
5131
5155
|
REMOTE_SPEC_PATH,
|
|
5132
5156
|
new TextEncoder().encode(JSON.stringify(spec, null, 2))
|