tensorlake 0.5.4 → 0.5.6
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 +40 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +40 -2
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +40 -2
- 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
|
@@ -3672,15 +3672,53 @@ var init_sandbox = __esm({
|
|
|
3672
3672
|
}
|
|
3673
3673
|
/** Connect to a sandbox VNC session for programmatic desktop control. */
|
|
3674
3674
|
async connectDesktop(options) {
|
|
3675
|
+
const port = options?.port ?? 5901;
|
|
3676
|
+
const connectTimeout = options?.connectTimeout ?? 10;
|
|
3677
|
+
const startMs = Date.now();
|
|
3678
|
+
const deadlineMs = startMs + connectTimeout * 1e3;
|
|
3679
|
+
await this.waitForPortReady(port, deadlineMs);
|
|
3680
|
+
const remainingSecs = Math.max(0.1, (deadlineMs - Date.now()) / 1e3);
|
|
3675
3681
|
return Desktop.connect({
|
|
3676
3682
|
baseUrl: this.baseUrl,
|
|
3677
3683
|
wsHeaders: this.wsHeaders,
|
|
3678
|
-
port
|
|
3684
|
+
port,
|
|
3679
3685
|
password: options?.password,
|
|
3680
3686
|
shared: options?.shared,
|
|
3681
|
-
connectTimeout:
|
|
3687
|
+
connectTimeout: remainingSecs
|
|
3682
3688
|
});
|
|
3683
3689
|
}
|
|
3690
|
+
/**
|
|
3691
|
+
* Poll the in-sandbox daemon until `127.0.0.1:port` accepts a TCP connection.
|
|
3692
|
+
* Uses `bash`'s `/dev/tcp` builtin via `processes/run` — no extra deps in
|
|
3693
|
+
* the sandbox image. `bash` is present on every image we ship.
|
|
3694
|
+
*/
|
|
3695
|
+
async waitForPortReady(port, deadlineMs) {
|
|
3696
|
+
const probeIntervalMs = 250;
|
|
3697
|
+
const probeProcessTimeoutSecs = 2;
|
|
3698
|
+
let lastError;
|
|
3699
|
+
while (Date.now() < deadlineMs) {
|
|
3700
|
+
try {
|
|
3701
|
+
const result = await this.run("/bin/bash", {
|
|
3702
|
+
args: ["-c", `exec 3<>/dev/tcp/127.0.0.1/${port}`],
|
|
3703
|
+
timeout: probeProcessTimeoutSecs
|
|
3704
|
+
});
|
|
3705
|
+
if (result.exitCode === 0) {
|
|
3706
|
+
return;
|
|
3707
|
+
}
|
|
3708
|
+
} catch (error) {
|
|
3709
|
+
lastError = error;
|
|
3710
|
+
}
|
|
3711
|
+
const remainingMs = deadlineMs - Date.now();
|
|
3712
|
+
if (remainingMs <= 0) break;
|
|
3713
|
+
await new Promise(
|
|
3714
|
+
(resolve) => setTimeout(resolve, Math.min(probeIntervalMs, remainingMs))
|
|
3715
|
+
);
|
|
3716
|
+
}
|
|
3717
|
+
const detail = lastError instanceof Error ? `: ${lastError.message}` : "";
|
|
3718
|
+
throw new SandboxError(
|
|
3719
|
+
`port ${port} did not become reachable inside sandbox within the connect timeout${detail}`
|
|
3720
|
+
);
|
|
3721
|
+
}
|
|
3684
3722
|
ptyWsUrl(sessionId, token) {
|
|
3685
3723
|
let wsBase;
|
|
3686
3724
|
if (this.baseUrl.startsWith("https://")) {
|