tensorlake 0.4.46 → 0.4.48
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 +36 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +40 -24
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-B5Fa0xqb.d.cts → sandbox-image-BQ6fJT92.d.cts} +3 -0
- package/dist/{sandbox-image-B5Fa0xqb.d.ts → sandbox-image-BQ6fJT92.d.ts} +3 -0
- package/dist/sandbox-image.cjs +36 -24
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.d.cts +1 -1
- package/dist/sandbox-image.d.ts +1 -1
- package/dist/sandbox-image.js +40 -24
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-
|
|
2
|
-
export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-BQ6fJT92.cjs';
|
|
2
|
+
export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-BQ6fJT92.cjs';
|
|
3
3
|
|
|
4
4
|
type MouseButton = "left" | "middle" | "right";
|
|
5
5
|
interface ConnectDesktopOptions {
|
|
@@ -249,7 +249,7 @@ declare class SandboxClient {
|
|
|
249
249
|
listPools(): Promise<SandboxPoolInfo[]>;
|
|
250
250
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
251
251
|
deletePool(poolId: string): Promise<void>;
|
|
252
|
-
connect(identifier: string, proxyUrl?: string): Sandbox;
|
|
252
|
+
connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
|
|
253
253
|
createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
|
|
254
254
|
}
|
|
255
255
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-
|
|
2
|
-
export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, R as RunOptions, a as CommandResult, b as StartProcessOptions, P as ProcessInfo, c as SendSignalResponse, O as OutputResponse, d as OutputEvent, L as ListDirectoryResponse, e as PtySessionInfo, H as HealthResponse, D as DaemonInfo, f as SandboxClientOptions, g as CreateSandboxOptions, h as CreateSandboxResponse, i as SandboxInfo, U as UpdateSandboxOptions, j as SandboxPortAccess, k as SnapshotOptions, l as CreateSnapshotResponse, m as SnapshotInfo, n as SnapshotAndWaitOptions, o as CreatePoolOptions, p as CreateSandboxPoolResponse, q as SandboxPoolInfo, r as UpdatePoolOptions, s as CreateAndConnectOptions } from './sandbox-image-BQ6fJT92.js';
|
|
2
|
+
export { t as ContainerResourcesInfo, u as ContainerState, v as CreateSandboxImageOptions, w as DirectoryEntry, x as DockerfileBuildPlan, y as DockerfileInstruction, I as Image, z as ImageBuildOperation, A as ImageBuildOperationType, A as ImageBuildOperationTypeValue, B as ImageOptions, N as NetworkConfig, E as OutputMode, F as PoolContainerInfo, G as ProcessStatus, J as SandboxImageSource, K as SandboxStatus, M as SnapshotContentMode, Q as SnapshotStatus, T as StdinMode, V as createSandboxImage, W as dockerfileContent } from './sandbox-image-BQ6fJT92.js';
|
|
3
3
|
|
|
4
4
|
type MouseButton = "left" | "middle" | "right";
|
|
5
5
|
interface ConnectDesktopOptions {
|
|
@@ -249,7 +249,7 @@ declare class SandboxClient {
|
|
|
249
249
|
listPools(): Promise<SandboxPoolInfo[]>;
|
|
250
250
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
251
251
|
deletePool(poolId: string): Promise<void>;
|
|
252
|
-
connect(identifier: string, proxyUrl?: string): Sandbox;
|
|
252
|
+
connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
|
|
253
253
|
createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
|
|
254
254
|
}
|
|
255
255
|
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,17 @@ var RequestExecutionError = class extends Error {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// src/http.ts
|
|
91
|
+
import {
|
|
92
|
+
Agent,
|
|
93
|
+
fetch as undiciFetch,
|
|
94
|
+
setGlobalDispatcher
|
|
95
|
+
} from "undici";
|
|
96
|
+
setGlobalDispatcher(
|
|
97
|
+
new Agent({
|
|
98
|
+
keepAliveTimeout: 6e4,
|
|
99
|
+
allowH2: true
|
|
100
|
+
})
|
|
101
|
+
);
|
|
91
102
|
var HttpClient = class {
|
|
92
103
|
baseUrl;
|
|
93
104
|
headers;
|
|
@@ -114,6 +125,9 @@ var HttpClient = class {
|
|
|
114
125
|
if (options.hostHeader) {
|
|
115
126
|
this.headers["Host"] = options.hostHeader;
|
|
116
127
|
}
|
|
128
|
+
if (options.routingHint) {
|
|
129
|
+
this.headers["X-Tensorlake-Route-Hint"] = options.routingHint;
|
|
130
|
+
}
|
|
117
131
|
}
|
|
118
132
|
close() {
|
|
119
133
|
this.abortController?.abort();
|
|
@@ -136,31 +150,26 @@ var HttpClient = class {
|
|
|
136
150
|
if (options?.contentType) {
|
|
137
151
|
headers["Content-Type"] = options.contentType;
|
|
138
152
|
}
|
|
139
|
-
const response = await this.requestResponse(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
headers,
|
|
145
|
-
signal: options?.signal
|
|
146
|
-
}
|
|
147
|
-
);
|
|
153
|
+
const response = await this.requestResponse(method, path2, {
|
|
154
|
+
body: options?.body,
|
|
155
|
+
headers,
|
|
156
|
+
signal: options?.signal
|
|
157
|
+
});
|
|
148
158
|
const buffer = await response.arrayBuffer();
|
|
149
159
|
return new Uint8Array(buffer);
|
|
150
160
|
}
|
|
151
161
|
/** Make a request and return the response body as an SSE stream. */
|
|
152
162
|
async requestStream(method, path2, options) {
|
|
153
|
-
const response = await this.requestResponse(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
headers: { Accept: "text/event-stream" },
|
|
159
|
-
signal: options?.signal
|
|
160
|
-
}
|
|
161
|
-
);
|
|
163
|
+
const response = await this.requestResponse(method, path2, {
|
|
164
|
+
json: options?.json,
|
|
165
|
+
headers: { Accept: "text/event-stream" },
|
|
166
|
+
signal: options?.signal
|
|
167
|
+
});
|
|
162
168
|
if (!response.body) {
|
|
163
|
-
throw new RemoteAPIError(
|
|
169
|
+
throw new RemoteAPIError(
|
|
170
|
+
response.status,
|
|
171
|
+
"No response body for SSE stream"
|
|
172
|
+
);
|
|
164
173
|
}
|
|
165
174
|
return response.body;
|
|
166
175
|
}
|
|
@@ -199,7 +208,7 @@ var HttpClient = class {
|
|
|
199
208
|
);
|
|
200
209
|
const combinedSignal = signal ? anySignal([signal, this.abortController.signal]) : this.abortController.signal;
|
|
201
210
|
try {
|
|
202
|
-
const response = await
|
|
211
|
+
const response = await undiciFetch(url, {
|
|
203
212
|
method,
|
|
204
213
|
headers,
|
|
205
214
|
body,
|
|
@@ -3087,7 +3096,8 @@ var Sandbox = class {
|
|
|
3087
3096
|
apiKey: options.apiKey,
|
|
3088
3097
|
organizationId: options.organizationId,
|
|
3089
3098
|
projectId: options.projectId,
|
|
3090
|
-
hostHeader
|
|
3099
|
+
hostHeader,
|
|
3100
|
+
routingHint: options.routingHint
|
|
3091
3101
|
});
|
|
3092
3102
|
}
|
|
3093
3103
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
@@ -3682,14 +3692,15 @@ var SandboxClient = class _SandboxClient {
|
|
|
3682
3692
|
);
|
|
3683
3693
|
}
|
|
3684
3694
|
// --- Connect ---
|
|
3685
|
-
connect(identifier, proxyUrl) {
|
|
3695
|
+
connect(identifier, proxyUrl, routingHint) {
|
|
3686
3696
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
3687
3697
|
return new Sandbox({
|
|
3688
3698
|
sandboxId: identifier,
|
|
3689
3699
|
proxyUrl: resolvedProxy,
|
|
3690
3700
|
apiKey: this.apiKey,
|
|
3691
3701
|
organizationId: this.organizationId,
|
|
3692
|
-
projectId: this.projectId
|
|
3702
|
+
projectId: this.projectId,
|
|
3703
|
+
routingHint
|
|
3693
3704
|
});
|
|
3694
3705
|
}
|
|
3695
3706
|
async createAndConnect(options) {
|
|
@@ -3700,11 +3711,16 @@ var SandboxClient = class _SandboxClient {
|
|
|
3700
3711
|
} else {
|
|
3701
3712
|
result = await this.create(options);
|
|
3702
3713
|
}
|
|
3714
|
+
if (result.status === "running" /* RUNNING */) {
|
|
3715
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
|
|
3716
|
+
sandbox._setOwner(this);
|
|
3717
|
+
return sandbox;
|
|
3718
|
+
}
|
|
3703
3719
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
3704
3720
|
while (Date.now() < deadline) {
|
|
3705
3721
|
const info = await this.get(result.sandboxId);
|
|
3706
3722
|
if (info.status === "running" /* RUNNING */) {
|
|
3707
|
-
const sandbox = this.connect(result.sandboxId, options?.proxyUrl);
|
|
3723
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, info.routingHint);
|
|
3708
3724
|
sandbox._setOwner(this);
|
|
3709
3725
|
return sandbox;
|
|
3710
3726
|
}
|