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
|
Binary file
|
package/dist/bin/darwin-arm64/tl
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/bin/linux-x64/tl
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var SDK_VERSION, API_URL, API_KEY, NAMESPACE, SANDBOX_PROXY_URL, DEFAULT_HTTP_TI
|
|
|
35
35
|
var init_defaults = __esm({
|
|
36
36
|
"src/defaults.ts"() {
|
|
37
37
|
"use strict";
|
|
38
|
-
SDK_VERSION = "0.5.
|
|
38
|
+
SDK_VERSION = "0.5.17";
|
|
39
39
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
40
40
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
41
41
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -5091,13 +5091,16 @@ function optionalNumber(object, key) {
|
|
|
5091
5091
|
}
|
|
5092
5092
|
return value;
|
|
5093
5093
|
}
|
|
5094
|
-
async function runChecked(sandbox, command, args, env, workingDir) {
|
|
5095
|
-
const
|
|
5094
|
+
async function runChecked(sandbox, command, args, env, workingDir, user) {
|
|
5095
|
+
const options = {
|
|
5096
5096
|
args,
|
|
5097
5097
|
env,
|
|
5098
|
-
workingDir
|
|
5099
|
-
|
|
5100
|
-
|
|
5098
|
+
workingDir
|
|
5099
|
+
};
|
|
5100
|
+
if (user != null) {
|
|
5101
|
+
options.user = user;
|
|
5102
|
+
}
|
|
5103
|
+
const result = await sandbox.run(command, options);
|
|
5101
5104
|
if (result.exitCode !== 0) {
|
|
5102
5105
|
throw new Error(
|
|
5103
5106
|
`Command '${command} ${args.join(" ")}' failed with exit code ${result.exitCode}`
|
|
@@ -5152,13 +5155,37 @@ function emitOutputLines(emit, stream, response, seen) {
|
|
|
5152
5155
|
emit({ type: "build_log", stream, message: line });
|
|
5153
5156
|
}
|
|
5154
5157
|
}
|
|
5158
|
+
async function ensureRemoteBuildRoot(sandbox) {
|
|
5159
|
+
await runChecked(
|
|
5160
|
+
sandbox,
|
|
5161
|
+
"mkdir",
|
|
5162
|
+
["-p", REMOTE_BUILD_DIR],
|
|
5163
|
+
void 0,
|
|
5164
|
+
void 0,
|
|
5165
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
5166
|
+
);
|
|
5167
|
+
await runChecked(
|
|
5168
|
+
sandbox,
|
|
5169
|
+
"chmod",
|
|
5170
|
+
["0777", REMOTE_BUILD_DIR],
|
|
5171
|
+
void 0,
|
|
5172
|
+
void 0,
|
|
5173
|
+
ROOTFS_BUILDER_PROCESS_USER
|
|
5174
|
+
);
|
|
5175
|
+
}
|
|
5176
|
+
async function ensureRemoteDirectory(sandbox, remotePath) {
|
|
5177
|
+
await runChecked(sandbox, "mkdir", ["-p", remotePath]);
|
|
5178
|
+
}
|
|
5179
|
+
async function ensureRemoteParentDir(sandbox, remotePath) {
|
|
5180
|
+
await ensureRemoteDirectory(sandbox, import_node_path.default.posix.dirname(remotePath));
|
|
5181
|
+
}
|
|
5155
5182
|
async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
5156
5183
|
const fileStats = await (0, import_promises.stat)(localPath).catch(() => null);
|
|
5157
5184
|
if (!fileStats) {
|
|
5158
5185
|
throw new Error(`Local path not found: ${localPath}`);
|
|
5159
5186
|
}
|
|
5160
5187
|
if (fileStats.isFile()) {
|
|
5161
|
-
await
|
|
5188
|
+
await ensureRemoteParentDir(sandbox, remotePath);
|
|
5162
5189
|
await sandbox.writeFile(remotePath, await (0, import_promises.readFile)(localPath));
|
|
5163
5190
|
return;
|
|
5164
5191
|
}
|
|
@@ -5170,14 +5197,10 @@ async function copyLocalPathToSandbox(sandbox, localPath, remotePath) {
|
|
|
5170
5197
|
const sourcePath = import_node_path.default.join(localPath, entry.name);
|
|
5171
5198
|
const destinationPath = import_node_path.default.posix.join(remotePath, entry.name);
|
|
5172
5199
|
if (entry.isDirectory()) {
|
|
5173
|
-
await
|
|
5200
|
+
await ensureRemoteDirectory(sandbox, destinationPath);
|
|
5174
5201
|
await copyLocalPathToSandbox(sandbox, sourcePath, destinationPath);
|
|
5175
5202
|
} else if (entry.isFile()) {
|
|
5176
|
-
await
|
|
5177
|
-
sandbox,
|
|
5178
|
-
"mkdir",
|
|
5179
|
-
["-p", import_node_path.default.posix.dirname(destinationPath)]
|
|
5180
|
-
);
|
|
5203
|
+
await ensureRemoteParentDir(sandbox, destinationPath);
|
|
5181
5204
|
await sandbox.writeFile(destinationPath, await (0, import_promises.readFile)(sourcePath));
|
|
5182
5205
|
}
|
|
5183
5206
|
}
|
|
@@ -5274,6 +5297,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5274
5297
|
message: `Rootfs builder sandbox ${sandbox.sandboxId} is running`
|
|
5275
5298
|
});
|
|
5276
5299
|
emit({ type: "status", message: "Uploading build context..." });
|
|
5300
|
+
await ensureRemoteBuildRoot(sandbox);
|
|
5277
5301
|
await copyLocalPathToSandbox(sandbox, plan.contextDir, REMOTE_CONTEXT_DIR);
|
|
5278
5302
|
const spec = await buildRootfsSpec(
|
|
5279
5303
|
preparedSpec,
|
|
@@ -5281,7 +5305,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5281
5305
|
plan,
|
|
5282
5306
|
options.diskMb
|
|
5283
5307
|
);
|
|
5284
|
-
await
|
|
5308
|
+
await ensureRemoteParentDir(sandbox, REMOTE_SPEC_PATH);
|
|
5285
5309
|
await sandbox.writeFile(
|
|
5286
5310
|
REMOTE_SPEC_PATH,
|
|
5287
5311
|
new TextEncoder().encode(JSON.stringify(spec, null, 2))
|