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/sandbox-image.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-
|
|
1
|
+
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-BQ6fJT92.cjs';
|
package/dist/sandbox-image.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-
|
|
1
|
+
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-BQ6fJT92.js';
|
package/dist/sandbox-image.js
CHANGED
|
@@ -112,6 +112,17 @@ var RemoteAPIError = class extends SandboxError {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
// src/http.ts
|
|
115
|
+
import {
|
|
116
|
+
Agent,
|
|
117
|
+
fetch as undiciFetch,
|
|
118
|
+
setGlobalDispatcher
|
|
119
|
+
} from "undici";
|
|
120
|
+
setGlobalDispatcher(
|
|
121
|
+
new Agent({
|
|
122
|
+
keepAliveTimeout: 6e4,
|
|
123
|
+
allowH2: true
|
|
124
|
+
})
|
|
125
|
+
);
|
|
115
126
|
var HttpClient = class {
|
|
116
127
|
baseUrl;
|
|
117
128
|
headers;
|
|
@@ -138,6 +149,9 @@ var HttpClient = class {
|
|
|
138
149
|
if (options.hostHeader) {
|
|
139
150
|
this.headers["Host"] = options.hostHeader;
|
|
140
151
|
}
|
|
152
|
+
if (options.routingHint) {
|
|
153
|
+
this.headers["X-Tensorlake-Route-Hint"] = options.routingHint;
|
|
154
|
+
}
|
|
141
155
|
}
|
|
142
156
|
close() {
|
|
143
157
|
this.abortController?.abort();
|
|
@@ -160,31 +174,26 @@ var HttpClient = class {
|
|
|
160
174
|
if (options?.contentType) {
|
|
161
175
|
headers["Content-Type"] = options.contentType;
|
|
162
176
|
}
|
|
163
|
-
const response = await this.requestResponse(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
headers,
|
|
169
|
-
signal: options?.signal
|
|
170
|
-
}
|
|
171
|
-
);
|
|
177
|
+
const response = await this.requestResponse(method, path2, {
|
|
178
|
+
body: options?.body,
|
|
179
|
+
headers,
|
|
180
|
+
signal: options?.signal
|
|
181
|
+
});
|
|
172
182
|
const buffer = await response.arrayBuffer();
|
|
173
183
|
return new Uint8Array(buffer);
|
|
174
184
|
}
|
|
175
185
|
/** Make a request and return the response body as an SSE stream. */
|
|
176
186
|
async requestStream(method, path2, options) {
|
|
177
|
-
const response = await this.requestResponse(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
headers: { Accept: "text/event-stream" },
|
|
183
|
-
signal: options?.signal
|
|
184
|
-
}
|
|
185
|
-
);
|
|
187
|
+
const response = await this.requestResponse(method, path2, {
|
|
188
|
+
json: options?.json,
|
|
189
|
+
headers: { Accept: "text/event-stream" },
|
|
190
|
+
signal: options?.signal
|
|
191
|
+
});
|
|
186
192
|
if (!response.body) {
|
|
187
|
-
throw new RemoteAPIError(
|
|
193
|
+
throw new RemoteAPIError(
|
|
194
|
+
response.status,
|
|
195
|
+
"No response body for SSE stream"
|
|
196
|
+
);
|
|
188
197
|
}
|
|
189
198
|
return response.body;
|
|
190
199
|
}
|
|
@@ -223,7 +232,7 @@ var HttpClient = class {
|
|
|
223
232
|
);
|
|
224
233
|
const combinedSignal = signal ? anySignal([signal, this.abortController.signal]) : this.abortController.signal;
|
|
225
234
|
try {
|
|
226
|
-
const response = await
|
|
235
|
+
const response = await undiciFetch(url, {
|
|
227
236
|
method,
|
|
228
237
|
headers,
|
|
229
238
|
body,
|
|
@@ -3032,7 +3041,8 @@ var Sandbox = class {
|
|
|
3032
3041
|
apiKey: options.apiKey,
|
|
3033
3042
|
organizationId: options.organizationId,
|
|
3034
3043
|
projectId: options.projectId,
|
|
3035
|
-
hostHeader
|
|
3044
|
+
hostHeader,
|
|
3045
|
+
routingHint: options.routingHint
|
|
3036
3046
|
});
|
|
3037
3047
|
}
|
|
3038
3048
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
@@ -3627,14 +3637,15 @@ var SandboxClient = class _SandboxClient {
|
|
|
3627
3637
|
);
|
|
3628
3638
|
}
|
|
3629
3639
|
// --- Connect ---
|
|
3630
|
-
connect(identifier, proxyUrl) {
|
|
3640
|
+
connect(identifier, proxyUrl, routingHint) {
|
|
3631
3641
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
3632
3642
|
return new Sandbox({
|
|
3633
3643
|
sandboxId: identifier,
|
|
3634
3644
|
proxyUrl: resolvedProxy,
|
|
3635
3645
|
apiKey: this.apiKey,
|
|
3636
3646
|
organizationId: this.organizationId,
|
|
3637
|
-
projectId: this.projectId
|
|
3647
|
+
projectId: this.projectId,
|
|
3648
|
+
routingHint
|
|
3638
3649
|
});
|
|
3639
3650
|
}
|
|
3640
3651
|
async createAndConnect(options) {
|
|
@@ -3645,11 +3656,16 @@ var SandboxClient = class _SandboxClient {
|
|
|
3645
3656
|
} else {
|
|
3646
3657
|
result = await this.create(options);
|
|
3647
3658
|
}
|
|
3659
|
+
if (result.status === "running" /* RUNNING */) {
|
|
3660
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
|
|
3661
|
+
sandbox._setOwner(this);
|
|
3662
|
+
return sandbox;
|
|
3663
|
+
}
|
|
3648
3664
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
3649
3665
|
while (Date.now() < deadline) {
|
|
3650
3666
|
const info = await this.get(result.sandboxId);
|
|
3651
3667
|
if (info.status === "running" /* RUNNING */) {
|
|
3652
|
-
const sandbox = this.connect(result.sandboxId, options?.proxyUrl);
|
|
3668
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, info.routingHint);
|
|
3653
3669
|
sandbox._setOwner(this);
|
|
3654
3670
|
return sandbox;
|
|
3655
3671
|
}
|