@tensorlakeai/tensorlake 0.5.150 → 0.5.152
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/README.md +8 -0
- package/dist/applications/index.cjs +14 -3
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.d.cts +3 -3
- package/dist/applications/index.d.ts +3 -3
- package/dist/applications/index.js +14 -3
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.cjs.map +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-agent/main.js.map +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.cjs.map +1 -1
- package/dist/function-executor/main.js +2 -2
- package/dist/function-executor/main.js.map +1 -1
- package/dist/index.cjs +53 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +52 -189
- package/dist/index.js.map +1 -1
- package/dist/{remote-dblFxKug.d.ts → remote-BbSrvgUn.d.ts} +1 -1
- package/dist/{remote-CNJ9TmcQ.d.cts → remote-CC48cvYP.d.cts} +1 -1
- package/dist/{sandbox-image-ChzWDeZy.d.cts → sandbox-image-CAK_K7ND.d.cts} +14 -0
- package/dist/{sandbox-image-ChzWDeZy.d.ts → sandbox-image-CAK_K7ND.d.ts} +14 -0
- package/dist/sandbox-image.cjs +14 -3
- 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 +14 -3
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +8 -7
- package/runtime/function-executor/manifest.json +7 -7
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- package/runtime/function-executor/package/dist/function-executor/main.js.map +1 -1
- package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
- package/runtime/function-executor/package/package.json +1 -1
- package/runtime/typescript-function-runner/manifest.json +7 -7
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js.map +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
- package/runtime/typescript-function-runner/package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, F as FileSystem } from './sandbox-image-
|
|
2
|
-
export { l as ApplicationBuildImageResult, m as CreateApplicationBuildImageRequest, n as CreateSandboxImageOptions, I as Image, o as ImageBuildOperation, p as ImageBuildOperationType, p as ImageBuildOperationTypeValue, q as ImageOptions, r as ImportSandboxImageOptions, s as RequestErrorInfo, t as SandboxImageSource, u as SecretsPagination, v as createSandboxImage, w as deleteSandboxImage, x as dockerfileContent, y as findSandboxImageByName, z as importSandboxImage, D as listSandboxImages } from './sandbox-image-
|
|
3
|
-
export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-
|
|
1
|
+
import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, F as FileSystem } from './sandbox-image-CAK_K7ND.cjs';
|
|
2
|
+
export { l as ApplicationBuildImageResult, m as CreateApplicationBuildImageRequest, n as CreateSandboxImageOptions, I as Image, o as ImageBuildOperation, p as ImageBuildOperationType, p as ImageBuildOperationTypeValue, q as ImageOptions, r as ImportSandboxImageOptions, s as RequestErrorInfo, t as SandboxImageSource, u as SecretsPagination, v as createSandboxImage, w as deleteSandboxImage, x as dockerfileContent, y as findSandboxImageByName, z as importSandboxImage, D as listSandboxImages } from './sandbox-image-CAK_K7ND.cjs';
|
|
3
|
+
export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-CC48cvYP.cjs';
|
|
4
4
|
|
|
5
5
|
/** An SDK result paired with its server-side W3C trace ID. */
|
|
6
6
|
type Traced<T> = T & {
|
|
@@ -1000,15 +1000,12 @@ interface TunnelAddress {
|
|
|
1000
1000
|
port: number;
|
|
1001
1001
|
}
|
|
1002
1002
|
declare class TcpTunnel {
|
|
1003
|
+
private readonly native;
|
|
1003
1004
|
readonly remotePort: number;
|
|
1004
1005
|
readonly localHost: string;
|
|
1005
1006
|
readonly localPort: number;
|
|
1006
|
-
private readonly baseUrl;
|
|
1007
|
-
private readonly wsHeaders;
|
|
1008
|
-
private readonly server;
|
|
1009
|
-
private readonly connectTimeoutMs;
|
|
1010
|
-
private readonly activeRelays;
|
|
1011
1007
|
private closePromise;
|
|
1008
|
+
private readonly lifetime;
|
|
1012
1009
|
private constructor();
|
|
1013
1010
|
static listen(options: {
|
|
1014
1011
|
baseUrl: string;
|
|
@@ -1020,7 +1017,6 @@ declare class TcpTunnel {
|
|
|
1020
1017
|
}): Promise<TcpTunnel>;
|
|
1021
1018
|
address(): TunnelAddress;
|
|
1022
1019
|
close(): Promise<void>;
|
|
1023
|
-
private handleConnection;
|
|
1024
1020
|
}
|
|
1025
1021
|
|
|
1026
1022
|
type PtyDataHandler = (data: Uint8Array) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, F as FileSystem } from './sandbox-image-
|
|
2
|
-
export { l as ApplicationBuildImageResult, m as CreateApplicationBuildImageRequest, n as CreateSandboxImageOptions, I as Image, o as ImageBuildOperation, p as ImageBuildOperationType, p as ImageBuildOperationTypeValue, q as ImageOptions, r as ImportSandboxImageOptions, s as RequestErrorInfo, t as SandboxImageSource, u as SecretsPagination, v as createSandboxImage, w as deleteSandboxImage, x as dockerfileContent, y as findSandboxImageByName, z as importSandboxImage, D as listSandboxImages } from './sandbox-image-
|
|
3
|
-
export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-
|
|
1
|
+
import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, F as FileSystem } from './sandbox-image-CAK_K7ND.js';
|
|
2
|
+
export { l as ApplicationBuildImageResult, m as CreateApplicationBuildImageRequest, n as CreateSandboxImageOptions, I as Image, o as ImageBuildOperation, p as ImageBuildOperationType, p as ImageBuildOperationTypeValue, q as ImageOptions, r as ImportSandboxImageOptions, s as RequestErrorInfo, t as SandboxImageSource, u as SecretsPagination, v as createSandboxImage, w as deleteSandboxImage, x as dockerfileContent, y as findSandboxImageByName, z as importSandboxImage, D as listSandboxImages } from './sandbox-image-CAK_K7ND.js';
|
|
3
|
+
export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-BbSrvgUn.js';
|
|
4
4
|
|
|
5
5
|
/** An SDK result paired with its server-side W3C trace ID. */
|
|
6
6
|
type Traced<T> = T & {
|
|
@@ -1000,15 +1000,12 @@ interface TunnelAddress {
|
|
|
1000
1000
|
port: number;
|
|
1001
1001
|
}
|
|
1002
1002
|
declare class TcpTunnel {
|
|
1003
|
+
private readonly native;
|
|
1003
1004
|
readonly remotePort: number;
|
|
1004
1005
|
readonly localHost: string;
|
|
1005
1006
|
readonly localPort: number;
|
|
1006
|
-
private readonly baseUrl;
|
|
1007
|
-
private readonly wsHeaders;
|
|
1008
|
-
private readonly server;
|
|
1009
|
-
private readonly connectTimeoutMs;
|
|
1010
|
-
private readonly activeRelays;
|
|
1011
1007
|
private closePromise;
|
|
1008
|
+
private readonly lifetime;
|
|
1012
1009
|
private constructor();
|
|
1013
1010
|
static listen(options: {
|
|
1014
1011
|
baseUrl: string;
|
|
@@ -1020,7 +1017,6 @@ declare class TcpTunnel {
|
|
|
1020
1017
|
}): Promise<TcpTunnel>;
|
|
1021
1018
|
address(): TunnelAddress;
|
|
1022
1019
|
close(): Promise<void>;
|
|
1023
|
-
private handleConnection;
|
|
1024
1020
|
}
|
|
1025
1021
|
|
|
1026
1022
|
type PtyDataHandler = (data: Uint8Array) => void;
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_defaults = __esm({
|
|
|
46
46
|
"src/defaults.ts"() {
|
|
47
47
|
"use strict";
|
|
48
48
|
init_esm_shims();
|
|
49
|
-
SDK_VERSION = "0.5.
|
|
49
|
+
SDK_VERSION = "0.5.152";
|
|
50
50
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
51
51
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
52
52
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -313,6 +313,11 @@ function createWorkerBinding(runtime) {
|
|
|
313
313
|
return runtime.handle("NativeRepositoryClient", args);
|
|
314
314
|
}
|
|
315
315
|
},
|
|
316
|
+
NativeTcpTunnel: class {
|
|
317
|
+
constructor() {
|
|
318
|
+
return runtime.handle("NativeTcpTunnel", []);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
316
321
|
validateManagedName: (name) => runtime.call(void 0, "validateManagedName", [name])
|
|
317
322
|
};
|
|
318
323
|
}
|
|
@@ -490,7 +495,7 @@ var init_native_worker_client = __esm({
|
|
|
490
495
|
}
|
|
491
496
|
};
|
|
492
497
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
493
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
498
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.152"}.v1`
|
|
494
499
|
);
|
|
495
500
|
runtimes = globalThis;
|
|
496
501
|
}
|
|
@@ -862,7 +867,6 @@ var init_pending_sandbox = __esm({
|
|
|
862
867
|
});
|
|
863
868
|
|
|
864
869
|
// src/tunnel.ts
|
|
865
|
-
import * as net from "net";
|
|
866
870
|
import WebSocket from "ws";
|
|
867
871
|
async function openTunnelWebSocket(options) {
|
|
868
872
|
const wsUrl = buildTunnelWsUrl(options.baseUrl, options.remotePort);
|
|
@@ -940,116 +944,6 @@ function normalizeWebSocketData(message) {
|
|
|
940
944
|
}
|
|
941
945
|
return Buffer.from(message);
|
|
942
946
|
}
|
|
943
|
-
async function relaySocket(localSocket, websocket) {
|
|
944
|
-
return new Promise((resolve2) => {
|
|
945
|
-
let settled = false;
|
|
946
|
-
const keepAliveInterval = setInterval(() => {
|
|
947
|
-
if (websocket.readyState === WebSocket.OPEN) {
|
|
948
|
-
websocket.ping();
|
|
949
|
-
}
|
|
950
|
-
}, WEBSOCKET_KEEPALIVE_INTERVAL_MS);
|
|
951
|
-
keepAliveInterval.unref?.();
|
|
952
|
-
const finish = () => {
|
|
953
|
-
if (settled) return;
|
|
954
|
-
settled = true;
|
|
955
|
-
clearInterval(keepAliveInterval);
|
|
956
|
-
cleanup();
|
|
957
|
-
resolve2();
|
|
958
|
-
};
|
|
959
|
-
const cleanup = () => {
|
|
960
|
-
localSocket.removeListener("data", onLocalData);
|
|
961
|
-
localSocket.removeListener("end", onLocalEnd);
|
|
962
|
-
localSocket.removeListener("close", onLocalClose);
|
|
963
|
-
localSocket.removeListener("error", onLocalError);
|
|
964
|
-
websocket.removeListener("message", onWsMessage);
|
|
965
|
-
websocket.removeListener("close", onWsClose);
|
|
966
|
-
websocket.removeListener("error", onWsError);
|
|
967
|
-
websocket.removeListener("ping", onWsPing);
|
|
968
|
-
};
|
|
969
|
-
const onLocalData = (chunk) => {
|
|
970
|
-
if (websocket.readyState !== WebSocket.OPEN) {
|
|
971
|
-
localSocket.destroy();
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
websocket.send(chunk, { binary: true }, (error) => {
|
|
975
|
-
if (error) {
|
|
976
|
-
localSocket.destroy(error);
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
};
|
|
980
|
-
const onLocalEnd = () => {
|
|
981
|
-
if (websocket.readyState === WebSocket.OPEN) {
|
|
982
|
-
websocket.close();
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
const onLocalClose = () => {
|
|
986
|
-
if (websocket.readyState === WebSocket.OPEN || websocket.readyState === WebSocket.CONNECTING) {
|
|
987
|
-
websocket.close();
|
|
988
|
-
}
|
|
989
|
-
finish();
|
|
990
|
-
};
|
|
991
|
-
const onLocalError = () => {
|
|
992
|
-
websocket.close();
|
|
993
|
-
finish();
|
|
994
|
-
};
|
|
995
|
-
const onWsMessage = (message, isBinary) => {
|
|
996
|
-
if (!isBinary) {
|
|
997
|
-
localSocket.destroy(
|
|
998
|
-
new SandboxError("received unexpected text frame from tunnel")
|
|
999
|
-
);
|
|
1000
|
-
websocket.close();
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
const payload = normalizeWebSocketData(message);
|
|
1004
|
-
if (!localSocket.destroyed) {
|
|
1005
|
-
localSocket.write(payload);
|
|
1006
|
-
}
|
|
1007
|
-
};
|
|
1008
|
-
const onWsClose = () => {
|
|
1009
|
-
if (!localSocket.destroyed) {
|
|
1010
|
-
localSocket.end();
|
|
1011
|
-
}
|
|
1012
|
-
finish();
|
|
1013
|
-
};
|
|
1014
|
-
const onWsError = (error) => {
|
|
1015
|
-
localSocket.destroy(error);
|
|
1016
|
-
finish();
|
|
1017
|
-
};
|
|
1018
|
-
const onWsPing = (data) => {
|
|
1019
|
-
if (websocket.readyState === WebSocket.OPEN) {
|
|
1020
|
-
websocket.pong(data, false, () => {
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
};
|
|
1024
|
-
localSocket.on("data", onLocalData);
|
|
1025
|
-
localSocket.on("end", onLocalEnd);
|
|
1026
|
-
localSocket.on("close", onLocalClose);
|
|
1027
|
-
localSocket.on("error", onLocalError);
|
|
1028
|
-
websocket.on("message", onWsMessage);
|
|
1029
|
-
websocket.on("close", onWsClose);
|
|
1030
|
-
websocket.on("error", onWsError);
|
|
1031
|
-
websocket.on("ping", onWsPing);
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
async function listenServer(server, localPort, localHost) {
|
|
1035
|
-
await new Promise((resolve2, reject) => {
|
|
1036
|
-
const onError = (error) => {
|
|
1037
|
-
server.removeListener("listening", onListening);
|
|
1038
|
-
reject(
|
|
1039
|
-
new SandboxError(
|
|
1040
|
-
`failed to bind local tunnel listener on ${localHost}:${localPort}: ${error.message}`
|
|
1041
|
-
)
|
|
1042
|
-
);
|
|
1043
|
-
};
|
|
1044
|
-
const onListening = () => {
|
|
1045
|
-
server.removeListener("error", onError);
|
|
1046
|
-
resolve2();
|
|
1047
|
-
};
|
|
1048
|
-
server.once("error", onError);
|
|
1049
|
-
server.once("listening", onListening);
|
|
1050
|
-
server.listen(localPort, localHost);
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1053
947
|
function validatePort(port, label, allowZero = false) {
|
|
1054
948
|
if (!Number.isInteger(port)) {
|
|
1055
949
|
throw new SandboxError(`${label} must be an integer, got ${port}`);
|
|
@@ -1088,6 +982,8 @@ var init_tunnel = __esm({
|
|
|
1088
982
|
"use strict";
|
|
1089
983
|
init_esm_shims();
|
|
1090
984
|
init_errors();
|
|
985
|
+
init_native_sandbox();
|
|
986
|
+
init_native_worker_client();
|
|
1091
987
|
DEFAULT_TUNNEL_CONNECT_TIMEOUT_MS = 1e4;
|
|
1092
988
|
WEBSOCKET_KEEPALIVE_INTERVAL_MS = 15e3;
|
|
1093
989
|
TunnelByteStream = class _TunnelByteStream {
|
|
@@ -1217,24 +1113,17 @@ var init_tunnel = __esm({
|
|
|
1217
1113
|
}
|
|
1218
1114
|
};
|
|
1219
1115
|
TcpTunnel = class _TcpTunnel {
|
|
1220
|
-
remotePort
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
closePromise = null;
|
|
1229
|
-
constructor(options) {
|
|
1230
|
-
this.baseUrl = options.baseUrl;
|
|
1231
|
-
this.wsHeaders = options.wsHeaders;
|
|
1232
|
-
this.remotePort = options.remotePort;
|
|
1233
|
-
this.localHost = options.localHost;
|
|
1234
|
-
this.localPort = options.localPort;
|
|
1235
|
-
this.server = options.server;
|
|
1236
|
-
this.connectTimeoutMs = options.connectTimeoutMs;
|
|
1116
|
+
constructor(native, remotePort, localHost, localPort) {
|
|
1117
|
+
this.native = native;
|
|
1118
|
+
this.remotePort = remotePort;
|
|
1119
|
+
this.localHost = localHost;
|
|
1120
|
+
this.localPort = localPort;
|
|
1121
|
+
this.lifetime = native.waitClosed();
|
|
1122
|
+
void this.lifetime.catch(() => {
|
|
1123
|
+
});
|
|
1237
1124
|
}
|
|
1125
|
+
closePromise = null;
|
|
1126
|
+
lifetime;
|
|
1238
1127
|
static async listen(options) {
|
|
1239
1128
|
const remotePort = validatePort(options.remotePort, "remote port");
|
|
1240
1129
|
const localHost = options.localHost ?? "127.0.0.1";
|
|
@@ -1243,69 +1132,37 @@ var init_tunnel = __esm({
|
|
|
1243
1132
|
"local port",
|
|
1244
1133
|
true
|
|
1245
1134
|
);
|
|
1246
|
-
const
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
void tunnel.handleConnection(localSocket);
|
|
1265
|
-
});
|
|
1266
|
-
return tunnel;
|
|
1135
|
+
const timeout = secondsToMillis(options.connectTimeout ?? 10) / 1e3;
|
|
1136
|
+
const native = new (loadNativeSandboxBinding()).NativeTcpTunnel();
|
|
1137
|
+
try {
|
|
1138
|
+
const port = await callNative(
|
|
1139
|
+
() => native.listen(
|
|
1140
|
+
options.baseUrl,
|
|
1141
|
+
options.wsHeaders,
|
|
1142
|
+
remotePort,
|
|
1143
|
+
localHost,
|
|
1144
|
+
localPort,
|
|
1145
|
+
timeout
|
|
1146
|
+
)
|
|
1147
|
+
);
|
|
1148
|
+
return new _TcpTunnel(native, remotePort, localHost, port);
|
|
1149
|
+
} catch (error) {
|
|
1150
|
+
releaseNativeHandle(native);
|
|
1151
|
+
throw error;
|
|
1152
|
+
}
|
|
1267
1153
|
}
|
|
1268
1154
|
address() {
|
|
1269
1155
|
return { host: this.localHost, port: this.localPort };
|
|
1270
1156
|
}
|
|
1271
1157
|
async close() {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
this.server.close((error) => {
|
|
1281
|
-
if (error) {
|
|
1282
|
-
reject(new SandboxError(`failed to close tunnel listener: ${error.message}`));
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
resolve2();
|
|
1286
|
-
});
|
|
1287
|
-
});
|
|
1288
|
-
return this.closePromise;
|
|
1289
|
-
}
|
|
1290
|
-
async handleConnection(localSocket) {
|
|
1291
|
-
localSocket.setNoDelay(true);
|
|
1292
|
-
const relay = { localSocket, websocket: null };
|
|
1293
|
-
this.activeRelays.add(relay);
|
|
1294
|
-
try {
|
|
1295
|
-
relay.websocket = await openTunnelWebSocket({
|
|
1296
|
-
baseUrl: this.baseUrl,
|
|
1297
|
-
wsHeaders: this.wsHeaders,
|
|
1298
|
-
remotePort: this.remotePort,
|
|
1299
|
-
connectTimeoutMs: this.connectTimeoutMs
|
|
1300
|
-
});
|
|
1301
|
-
await relaySocket(localSocket, relay.websocket);
|
|
1302
|
-
} catch (error) {
|
|
1303
|
-
localSocket.destroy(
|
|
1304
|
-
error instanceof Error ? error : new Error(String(error))
|
|
1305
|
-
);
|
|
1306
|
-
} finally {
|
|
1307
|
-
this.activeRelays.delete(relay);
|
|
1308
|
-
}
|
|
1158
|
+
return this.closePromise ??= (async () => {
|
|
1159
|
+
try {
|
|
1160
|
+
await callNative(() => this.native.close());
|
|
1161
|
+
await this.lifetime;
|
|
1162
|
+
} finally {
|
|
1163
|
+
releaseNativeHandle(this.native);
|
|
1164
|
+
}
|
|
1165
|
+
})();
|
|
1309
1166
|
}
|
|
1310
1167
|
};
|
|
1311
1168
|
}
|
|
@@ -6770,6 +6627,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6770
6627
|
useScopeHeaders: usePat,
|
|
6771
6628
|
userAgent: void 0,
|
|
6772
6629
|
dockerCompat: options.dockerCompat ?? false,
|
|
6630
|
+
dockerConfigJson: options.dockerConfigJson,
|
|
6773
6631
|
dockerfileText,
|
|
6774
6632
|
contextDir: nativeContextDir
|
|
6775
6633
|
},
|
|
@@ -6848,7 +6706,8 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6848
6706
|
namespace: context.namespace,
|
|
6849
6707
|
useScopeHeaders: usePat,
|
|
6850
6708
|
userAgent: void 0,
|
|
6851
|
-
dockerCompat: options.dockerCompat ?? false
|
|
6709
|
+
dockerCompat: options.dockerCompat ?? false,
|
|
6710
|
+
dockerConfigJson: options.dockerConfigJson
|
|
6852
6711
|
},
|
|
6853
6712
|
(event) => {
|
|
6854
6713
|
try {
|
|
@@ -6983,10 +6842,12 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6983
6842
|
`Invalid --builder_disk_mb value: ${parsed.values.builder_disk_mb}`
|
|
6984
6843
|
);
|
|
6985
6844
|
}
|
|
6845
|
+
const dockerConfigJson = loadNativeBinding().loadDockerConfigJson();
|
|
6986
6846
|
await createSandboxImage(
|
|
6987
6847
|
dockerfilePath,
|
|
6988
6848
|
{
|
|
6989
6849
|
registeredName: parsed.values.name,
|
|
6850
|
+
dockerConfigJson,
|
|
6990
6851
|
cpus,
|
|
6991
6852
|
memoryMb,
|
|
6992
6853
|
diskMb,
|
|
@@ -7035,10 +6896,12 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
7035
6896
|
`Invalid --builder_disk_mb value: ${parsed.values.builder_disk_mb}`
|
|
7036
6897
|
);
|
|
7037
6898
|
}
|
|
6899
|
+
const dockerConfigJson = loadNativeBinding().loadDockerConfigJson();
|
|
7038
6900
|
await importSandboxImage(
|
|
7039
6901
|
imageReference,
|
|
7040
6902
|
{
|
|
7041
6903
|
registeredName: parsed.values.name,
|
|
6904
|
+
dockerConfigJson,
|
|
7042
6905
|
cpus,
|
|
7043
6906
|
memoryMb,
|
|
7044
6907
|
diskMb,
|