modal 0.10.2-dev.8 → 0.11.0
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 +1 -0
- package/dist/index.cjs +692 -71
- package/dist/index.d.cts +96 -24
- package/dist/index.d.ts +96 -24
- package/dist/index.js +691 -71
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
QueueFullError: () => QueueFullError,
|
|
65
65
|
QueueService: () => QueueService,
|
|
66
66
|
RemoteError: () => RemoteError,
|
|
67
|
+
ResourceExhaustedError: () => ResourceExhaustedError,
|
|
67
68
|
Retries: () => Retries,
|
|
68
69
|
Sandbox: () => Sandbox2,
|
|
69
70
|
SandboxFilesystem: () => SandboxFilesystem,
|
|
@@ -3416,6 +3417,56 @@ function cloudBucketMount_MetadataTTLTypeToJSON(object) {
|
|
|
3416
3417
|
return "UNRECOGNIZED";
|
|
3417
3418
|
}
|
|
3418
3419
|
}
|
|
3420
|
+
function endpointGetInfoResponse_EndpointStatusFromJSON(object) {
|
|
3421
|
+
switch (object) {
|
|
3422
|
+
case 0:
|
|
3423
|
+
case "ENDPOINT_STATUS_UNSPECIFIED":
|
|
3424
|
+
return 0 /* ENDPOINT_STATUS_UNSPECIFIED */;
|
|
3425
|
+
case 1:
|
|
3426
|
+
case "ENDPOINT_STATUS_PROVISIONING":
|
|
3427
|
+
return 1 /* ENDPOINT_STATUS_PROVISIONING */;
|
|
3428
|
+
case 2:
|
|
3429
|
+
case "ENDPOINT_STATUS_LIVE":
|
|
3430
|
+
return 2 /* ENDPOINT_STATUS_LIVE */;
|
|
3431
|
+
case 3:
|
|
3432
|
+
case "ENDPOINT_STATUS_FAILED":
|
|
3433
|
+
return 3 /* ENDPOINT_STATUS_FAILED */;
|
|
3434
|
+
case 4:
|
|
3435
|
+
case "ENDPOINT_STATUS_CANCELLING":
|
|
3436
|
+
return 4 /* ENDPOINT_STATUS_CANCELLING */;
|
|
3437
|
+
case 5:
|
|
3438
|
+
case "ENDPOINT_STATUS_CANCELLED":
|
|
3439
|
+
return 5 /* ENDPOINT_STATUS_CANCELLED */;
|
|
3440
|
+
case 6:
|
|
3441
|
+
case "ENDPOINT_STATUS_STOPPED":
|
|
3442
|
+
return 6 /* ENDPOINT_STATUS_STOPPED */;
|
|
3443
|
+
case -1:
|
|
3444
|
+
case "UNRECOGNIZED":
|
|
3445
|
+
default:
|
|
3446
|
+
return -1 /* UNRECOGNIZED */;
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
function endpointGetInfoResponse_EndpointStatusToJSON(object) {
|
|
3450
|
+
switch (object) {
|
|
3451
|
+
case 0 /* ENDPOINT_STATUS_UNSPECIFIED */:
|
|
3452
|
+
return "ENDPOINT_STATUS_UNSPECIFIED";
|
|
3453
|
+
case 1 /* ENDPOINT_STATUS_PROVISIONING */:
|
|
3454
|
+
return "ENDPOINT_STATUS_PROVISIONING";
|
|
3455
|
+
case 2 /* ENDPOINT_STATUS_LIVE */:
|
|
3456
|
+
return "ENDPOINT_STATUS_LIVE";
|
|
3457
|
+
case 3 /* ENDPOINT_STATUS_FAILED */:
|
|
3458
|
+
return "ENDPOINT_STATUS_FAILED";
|
|
3459
|
+
case 4 /* ENDPOINT_STATUS_CANCELLING */:
|
|
3460
|
+
return "ENDPOINT_STATUS_CANCELLING";
|
|
3461
|
+
case 5 /* ENDPOINT_STATUS_CANCELLED */:
|
|
3462
|
+
return "ENDPOINT_STATUS_CANCELLED";
|
|
3463
|
+
case 6 /* ENDPOINT_STATUS_STOPPED */:
|
|
3464
|
+
return "ENDPOINT_STATUS_STOPPED";
|
|
3465
|
+
case -1 /* UNRECOGNIZED */:
|
|
3466
|
+
default:
|
|
3467
|
+
return "UNRECOGNIZED";
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3419
3470
|
function fileEntry_FileTypeFromJSON(object) {
|
|
3420
3471
|
switch (object) {
|
|
3421
3472
|
case 0:
|
|
@@ -18347,6 +18398,407 @@ var EndpointGetByNameResponse = {
|
|
|
18347
18398
|
return message;
|
|
18348
18399
|
}
|
|
18349
18400
|
};
|
|
18401
|
+
function createBaseEndpointGetInfoRequest() {
|
|
18402
|
+
return { endpointId: "" };
|
|
18403
|
+
}
|
|
18404
|
+
var EndpointGetInfoRequest = {
|
|
18405
|
+
encode(message, writer = new BinaryWriter()) {
|
|
18406
|
+
if (message.endpointId !== "") {
|
|
18407
|
+
writer.uint32(10).string(message.endpointId);
|
|
18408
|
+
}
|
|
18409
|
+
return writer;
|
|
18410
|
+
},
|
|
18411
|
+
decode(input, length) {
|
|
18412
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
18413
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
18414
|
+
const message = createBaseEndpointGetInfoRequest();
|
|
18415
|
+
while (reader.pos < end) {
|
|
18416
|
+
const tag = reader.uint32();
|
|
18417
|
+
switch (tag >>> 3) {
|
|
18418
|
+
case 1: {
|
|
18419
|
+
if (tag !== 10) {
|
|
18420
|
+
break;
|
|
18421
|
+
}
|
|
18422
|
+
message.endpointId = reader.string();
|
|
18423
|
+
continue;
|
|
18424
|
+
}
|
|
18425
|
+
}
|
|
18426
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
18427
|
+
break;
|
|
18428
|
+
}
|
|
18429
|
+
reader.skip(tag & 7);
|
|
18430
|
+
}
|
|
18431
|
+
return message;
|
|
18432
|
+
},
|
|
18433
|
+
fromJSON(object) {
|
|
18434
|
+
return { endpointId: isSet5(object.endpointId) ? globalThis.String(object.endpointId) : "" };
|
|
18435
|
+
},
|
|
18436
|
+
toJSON(message) {
|
|
18437
|
+
const obj = {};
|
|
18438
|
+
if (message.endpointId !== "") {
|
|
18439
|
+
obj.endpointId = message.endpointId;
|
|
18440
|
+
}
|
|
18441
|
+
return obj;
|
|
18442
|
+
},
|
|
18443
|
+
create(base) {
|
|
18444
|
+
return EndpointGetInfoRequest.fromPartial(base ?? {});
|
|
18445
|
+
},
|
|
18446
|
+
fromPartial(object) {
|
|
18447
|
+
const message = createBaseEndpointGetInfoRequest();
|
|
18448
|
+
message.endpointId = object.endpointId ?? "";
|
|
18449
|
+
return message;
|
|
18450
|
+
}
|
|
18451
|
+
};
|
|
18452
|
+
function createBaseEndpointGetInfoResponse() {
|
|
18453
|
+
return { info: void 0, metadata: void 0 };
|
|
18454
|
+
}
|
|
18455
|
+
var EndpointGetInfoResponse = {
|
|
18456
|
+
encode(message, writer = new BinaryWriter()) {
|
|
18457
|
+
if (message.info !== void 0) {
|
|
18458
|
+
EndpointGetInfoResponse_EndpointInfoSummary.encode(message.info, writer.uint32(10).fork()).join();
|
|
18459
|
+
}
|
|
18460
|
+
if (message.metadata !== void 0) {
|
|
18461
|
+
EndpointGetInfoResponse_EndpointHandleMetadata.encode(message.metadata, writer.uint32(18).fork()).join();
|
|
18462
|
+
}
|
|
18463
|
+
return writer;
|
|
18464
|
+
},
|
|
18465
|
+
decode(input, length) {
|
|
18466
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
18467
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
18468
|
+
const message = createBaseEndpointGetInfoResponse();
|
|
18469
|
+
while (reader.pos < end) {
|
|
18470
|
+
const tag = reader.uint32();
|
|
18471
|
+
switch (tag >>> 3) {
|
|
18472
|
+
case 1: {
|
|
18473
|
+
if (tag !== 10) {
|
|
18474
|
+
break;
|
|
18475
|
+
}
|
|
18476
|
+
message.info = EndpointGetInfoResponse_EndpointInfoSummary.decode(reader, reader.uint32());
|
|
18477
|
+
continue;
|
|
18478
|
+
}
|
|
18479
|
+
case 2: {
|
|
18480
|
+
if (tag !== 18) {
|
|
18481
|
+
break;
|
|
18482
|
+
}
|
|
18483
|
+
message.metadata = EndpointGetInfoResponse_EndpointHandleMetadata.decode(reader, reader.uint32());
|
|
18484
|
+
continue;
|
|
18485
|
+
}
|
|
18486
|
+
}
|
|
18487
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
18488
|
+
break;
|
|
18489
|
+
}
|
|
18490
|
+
reader.skip(tag & 7);
|
|
18491
|
+
}
|
|
18492
|
+
return message;
|
|
18493
|
+
},
|
|
18494
|
+
fromJSON(object) {
|
|
18495
|
+
return {
|
|
18496
|
+
info: isSet5(object.info) ? EndpointGetInfoResponse_EndpointInfoSummary.fromJSON(object.info) : void 0,
|
|
18497
|
+
metadata: isSet5(object.metadata) ? EndpointGetInfoResponse_EndpointHandleMetadata.fromJSON(object.metadata) : void 0
|
|
18498
|
+
};
|
|
18499
|
+
},
|
|
18500
|
+
toJSON(message) {
|
|
18501
|
+
const obj = {};
|
|
18502
|
+
if (message.info !== void 0) {
|
|
18503
|
+
obj.info = EndpointGetInfoResponse_EndpointInfoSummary.toJSON(message.info);
|
|
18504
|
+
}
|
|
18505
|
+
if (message.metadata !== void 0) {
|
|
18506
|
+
obj.metadata = EndpointGetInfoResponse_EndpointHandleMetadata.toJSON(message.metadata);
|
|
18507
|
+
}
|
|
18508
|
+
return obj;
|
|
18509
|
+
},
|
|
18510
|
+
create(base) {
|
|
18511
|
+
return EndpointGetInfoResponse.fromPartial(base ?? {});
|
|
18512
|
+
},
|
|
18513
|
+
fromPartial(object) {
|
|
18514
|
+
const message = createBaseEndpointGetInfoResponse();
|
|
18515
|
+
message.info = object.info !== void 0 && object.info !== null ? EndpointGetInfoResponse_EndpointInfoSummary.fromPartial(object.info) : void 0;
|
|
18516
|
+
message.metadata = object.metadata !== void 0 && object.metadata !== null ? EndpointGetInfoResponse_EndpointHandleMetadata.fromPartial(object.metadata) : void 0;
|
|
18517
|
+
return message;
|
|
18518
|
+
}
|
|
18519
|
+
};
|
|
18520
|
+
function createBaseEndpointGetInfoResponse_EndpointInfoSummary() {
|
|
18521
|
+
return {
|
|
18522
|
+
name: "",
|
|
18523
|
+
repoId: "",
|
|
18524
|
+
revision: "",
|
|
18525
|
+
serviceUrl: "",
|
|
18526
|
+
requiresProxyAuth: false,
|
|
18527
|
+
servingMode: 0,
|
|
18528
|
+
status: 0,
|
|
18529
|
+
lifecycle: void 0,
|
|
18530
|
+
volumeId: "",
|
|
18531
|
+
modelPath: ""
|
|
18532
|
+
};
|
|
18533
|
+
}
|
|
18534
|
+
var EndpointGetInfoResponse_EndpointInfoSummary = {
|
|
18535
|
+
encode(message, writer = new BinaryWriter()) {
|
|
18536
|
+
if (message.name !== "") {
|
|
18537
|
+
writer.uint32(10).string(message.name);
|
|
18538
|
+
}
|
|
18539
|
+
if (message.repoId !== "") {
|
|
18540
|
+
writer.uint32(18).string(message.repoId);
|
|
18541
|
+
}
|
|
18542
|
+
if (message.revision !== "") {
|
|
18543
|
+
writer.uint32(26).string(message.revision);
|
|
18544
|
+
}
|
|
18545
|
+
if (message.serviceUrl !== "") {
|
|
18546
|
+
writer.uint32(34).string(message.serviceUrl);
|
|
18547
|
+
}
|
|
18548
|
+
if (message.requiresProxyAuth !== false) {
|
|
18549
|
+
writer.uint32(40).bool(message.requiresProxyAuth);
|
|
18550
|
+
}
|
|
18551
|
+
if (message.servingMode !== 0) {
|
|
18552
|
+
writer.uint32(48).int32(message.servingMode);
|
|
18553
|
+
}
|
|
18554
|
+
if (message.status !== 0) {
|
|
18555
|
+
writer.uint32(56).int32(message.status);
|
|
18556
|
+
}
|
|
18557
|
+
if (message.lifecycle !== void 0) {
|
|
18558
|
+
EndpointLifecycle.encode(message.lifecycle, writer.uint32(66).fork()).join();
|
|
18559
|
+
}
|
|
18560
|
+
if (message.volumeId !== "") {
|
|
18561
|
+
writer.uint32(90).string(message.volumeId);
|
|
18562
|
+
}
|
|
18563
|
+
if (message.modelPath !== "") {
|
|
18564
|
+
writer.uint32(98).string(message.modelPath);
|
|
18565
|
+
}
|
|
18566
|
+
return writer;
|
|
18567
|
+
},
|
|
18568
|
+
decode(input, length) {
|
|
18569
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
18570
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
18571
|
+
const message = createBaseEndpointGetInfoResponse_EndpointInfoSummary();
|
|
18572
|
+
while (reader.pos < end) {
|
|
18573
|
+
const tag = reader.uint32();
|
|
18574
|
+
switch (tag >>> 3) {
|
|
18575
|
+
case 1: {
|
|
18576
|
+
if (tag !== 10) {
|
|
18577
|
+
break;
|
|
18578
|
+
}
|
|
18579
|
+
message.name = reader.string();
|
|
18580
|
+
continue;
|
|
18581
|
+
}
|
|
18582
|
+
case 2: {
|
|
18583
|
+
if (tag !== 18) {
|
|
18584
|
+
break;
|
|
18585
|
+
}
|
|
18586
|
+
message.repoId = reader.string();
|
|
18587
|
+
continue;
|
|
18588
|
+
}
|
|
18589
|
+
case 3: {
|
|
18590
|
+
if (tag !== 26) {
|
|
18591
|
+
break;
|
|
18592
|
+
}
|
|
18593
|
+
message.revision = reader.string();
|
|
18594
|
+
continue;
|
|
18595
|
+
}
|
|
18596
|
+
case 4: {
|
|
18597
|
+
if (tag !== 34) {
|
|
18598
|
+
break;
|
|
18599
|
+
}
|
|
18600
|
+
message.serviceUrl = reader.string();
|
|
18601
|
+
continue;
|
|
18602
|
+
}
|
|
18603
|
+
case 5: {
|
|
18604
|
+
if (tag !== 40) {
|
|
18605
|
+
break;
|
|
18606
|
+
}
|
|
18607
|
+
message.requiresProxyAuth = reader.bool();
|
|
18608
|
+
continue;
|
|
18609
|
+
}
|
|
18610
|
+
case 6: {
|
|
18611
|
+
if (tag !== 48) {
|
|
18612
|
+
break;
|
|
18613
|
+
}
|
|
18614
|
+
message.servingMode = reader.int32();
|
|
18615
|
+
continue;
|
|
18616
|
+
}
|
|
18617
|
+
case 7: {
|
|
18618
|
+
if (tag !== 56) {
|
|
18619
|
+
break;
|
|
18620
|
+
}
|
|
18621
|
+
message.status = reader.int32();
|
|
18622
|
+
continue;
|
|
18623
|
+
}
|
|
18624
|
+
case 8: {
|
|
18625
|
+
if (tag !== 66) {
|
|
18626
|
+
break;
|
|
18627
|
+
}
|
|
18628
|
+
message.lifecycle = EndpointLifecycle.decode(reader, reader.uint32());
|
|
18629
|
+
continue;
|
|
18630
|
+
}
|
|
18631
|
+
case 11: {
|
|
18632
|
+
if (tag !== 90) {
|
|
18633
|
+
break;
|
|
18634
|
+
}
|
|
18635
|
+
message.volumeId = reader.string();
|
|
18636
|
+
continue;
|
|
18637
|
+
}
|
|
18638
|
+
case 12: {
|
|
18639
|
+
if (tag !== 98) {
|
|
18640
|
+
break;
|
|
18641
|
+
}
|
|
18642
|
+
message.modelPath = reader.string();
|
|
18643
|
+
continue;
|
|
18644
|
+
}
|
|
18645
|
+
}
|
|
18646
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
18647
|
+
break;
|
|
18648
|
+
}
|
|
18649
|
+
reader.skip(tag & 7);
|
|
18650
|
+
}
|
|
18651
|
+
return message;
|
|
18652
|
+
},
|
|
18653
|
+
fromJSON(object) {
|
|
18654
|
+
return {
|
|
18655
|
+
name: isSet5(object.name) ? globalThis.String(object.name) : "",
|
|
18656
|
+
repoId: isSet5(object.repoId) ? globalThis.String(object.repoId) : "",
|
|
18657
|
+
revision: isSet5(object.revision) ? globalThis.String(object.revision) : "",
|
|
18658
|
+
serviceUrl: isSet5(object.serviceUrl) ? globalThis.String(object.serviceUrl) : "",
|
|
18659
|
+
requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : false,
|
|
18660
|
+
servingMode: isSet5(object.servingMode) ? endpointServingModeFromJSON(object.servingMode) : 0,
|
|
18661
|
+
status: isSet5(object.status) ? endpointGetInfoResponse_EndpointStatusFromJSON(object.status) : 0,
|
|
18662
|
+
lifecycle: isSet5(object.lifecycle) ? EndpointLifecycle.fromJSON(object.lifecycle) : void 0,
|
|
18663
|
+
volumeId: isSet5(object.volumeId) ? globalThis.String(object.volumeId) : "",
|
|
18664
|
+
modelPath: isSet5(object.modelPath) ? globalThis.String(object.modelPath) : ""
|
|
18665
|
+
};
|
|
18666
|
+
},
|
|
18667
|
+
toJSON(message) {
|
|
18668
|
+
const obj = {};
|
|
18669
|
+
if (message.name !== "") {
|
|
18670
|
+
obj.name = message.name;
|
|
18671
|
+
}
|
|
18672
|
+
if (message.repoId !== "") {
|
|
18673
|
+
obj.repoId = message.repoId;
|
|
18674
|
+
}
|
|
18675
|
+
if (message.revision !== "") {
|
|
18676
|
+
obj.revision = message.revision;
|
|
18677
|
+
}
|
|
18678
|
+
if (message.serviceUrl !== "") {
|
|
18679
|
+
obj.serviceUrl = message.serviceUrl;
|
|
18680
|
+
}
|
|
18681
|
+
if (message.requiresProxyAuth !== false) {
|
|
18682
|
+
obj.requiresProxyAuth = message.requiresProxyAuth;
|
|
18683
|
+
}
|
|
18684
|
+
if (message.servingMode !== 0) {
|
|
18685
|
+
obj.servingMode = endpointServingModeToJSON(message.servingMode);
|
|
18686
|
+
}
|
|
18687
|
+
if (message.status !== 0) {
|
|
18688
|
+
obj.status = endpointGetInfoResponse_EndpointStatusToJSON(message.status);
|
|
18689
|
+
}
|
|
18690
|
+
if (message.lifecycle !== void 0) {
|
|
18691
|
+
obj.lifecycle = EndpointLifecycle.toJSON(message.lifecycle);
|
|
18692
|
+
}
|
|
18693
|
+
if (message.volumeId !== "") {
|
|
18694
|
+
obj.volumeId = message.volumeId;
|
|
18695
|
+
}
|
|
18696
|
+
if (message.modelPath !== "") {
|
|
18697
|
+
obj.modelPath = message.modelPath;
|
|
18698
|
+
}
|
|
18699
|
+
return obj;
|
|
18700
|
+
},
|
|
18701
|
+
create(base) {
|
|
18702
|
+
return EndpointGetInfoResponse_EndpointInfoSummary.fromPartial(base ?? {});
|
|
18703
|
+
},
|
|
18704
|
+
fromPartial(object) {
|
|
18705
|
+
const message = createBaseEndpointGetInfoResponse_EndpointInfoSummary();
|
|
18706
|
+
message.name = object.name ?? "";
|
|
18707
|
+
message.repoId = object.repoId ?? "";
|
|
18708
|
+
message.revision = object.revision ?? "";
|
|
18709
|
+
message.serviceUrl = object.serviceUrl ?? "";
|
|
18710
|
+
message.requiresProxyAuth = object.requiresProxyAuth ?? false;
|
|
18711
|
+
message.servingMode = object.servingMode ?? 0;
|
|
18712
|
+
message.status = object.status ?? 0;
|
|
18713
|
+
message.lifecycle = object.lifecycle !== void 0 && object.lifecycle !== null ? EndpointLifecycle.fromPartial(object.lifecycle) : void 0;
|
|
18714
|
+
message.volumeId = object.volumeId ?? "";
|
|
18715
|
+
message.modelPath = object.modelPath ?? "";
|
|
18716
|
+
return message;
|
|
18717
|
+
}
|
|
18718
|
+
};
|
|
18719
|
+
function createBaseEndpointGetInfoResponse_EndpointHandleMetadata() {
|
|
18720
|
+
return { appId: "", serverId: "", environmentName: "" };
|
|
18721
|
+
}
|
|
18722
|
+
var EndpointGetInfoResponse_EndpointHandleMetadata = {
|
|
18723
|
+
encode(message, writer = new BinaryWriter()) {
|
|
18724
|
+
if (message.appId !== "") {
|
|
18725
|
+
writer.uint32(10).string(message.appId);
|
|
18726
|
+
}
|
|
18727
|
+
if (message.serverId !== "") {
|
|
18728
|
+
writer.uint32(18).string(message.serverId);
|
|
18729
|
+
}
|
|
18730
|
+
if (message.environmentName !== "") {
|
|
18731
|
+
writer.uint32(26).string(message.environmentName);
|
|
18732
|
+
}
|
|
18733
|
+
return writer;
|
|
18734
|
+
},
|
|
18735
|
+
decode(input, length) {
|
|
18736
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
18737
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
18738
|
+
const message = createBaseEndpointGetInfoResponse_EndpointHandleMetadata();
|
|
18739
|
+
while (reader.pos < end) {
|
|
18740
|
+
const tag = reader.uint32();
|
|
18741
|
+
switch (tag >>> 3) {
|
|
18742
|
+
case 1: {
|
|
18743
|
+
if (tag !== 10) {
|
|
18744
|
+
break;
|
|
18745
|
+
}
|
|
18746
|
+
message.appId = reader.string();
|
|
18747
|
+
continue;
|
|
18748
|
+
}
|
|
18749
|
+
case 2: {
|
|
18750
|
+
if (tag !== 18) {
|
|
18751
|
+
break;
|
|
18752
|
+
}
|
|
18753
|
+
message.serverId = reader.string();
|
|
18754
|
+
continue;
|
|
18755
|
+
}
|
|
18756
|
+
case 3: {
|
|
18757
|
+
if (tag !== 26) {
|
|
18758
|
+
break;
|
|
18759
|
+
}
|
|
18760
|
+
message.environmentName = reader.string();
|
|
18761
|
+
continue;
|
|
18762
|
+
}
|
|
18763
|
+
}
|
|
18764
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
18765
|
+
break;
|
|
18766
|
+
}
|
|
18767
|
+
reader.skip(tag & 7);
|
|
18768
|
+
}
|
|
18769
|
+
return message;
|
|
18770
|
+
},
|
|
18771
|
+
fromJSON(object) {
|
|
18772
|
+
return {
|
|
18773
|
+
appId: isSet5(object.appId) ? globalThis.String(object.appId) : "",
|
|
18774
|
+
serverId: isSet5(object.serverId) ? globalThis.String(object.serverId) : "",
|
|
18775
|
+
environmentName: isSet5(object.environmentName) ? globalThis.String(object.environmentName) : ""
|
|
18776
|
+
};
|
|
18777
|
+
},
|
|
18778
|
+
toJSON(message) {
|
|
18779
|
+
const obj = {};
|
|
18780
|
+
if (message.appId !== "") {
|
|
18781
|
+
obj.appId = message.appId;
|
|
18782
|
+
}
|
|
18783
|
+
if (message.serverId !== "") {
|
|
18784
|
+
obj.serverId = message.serverId;
|
|
18785
|
+
}
|
|
18786
|
+
if (message.environmentName !== "") {
|
|
18787
|
+
obj.environmentName = message.environmentName;
|
|
18788
|
+
}
|
|
18789
|
+
return obj;
|
|
18790
|
+
},
|
|
18791
|
+
create(base) {
|
|
18792
|
+
return EndpointGetInfoResponse_EndpointHandleMetadata.fromPartial(base ?? {});
|
|
18793
|
+
},
|
|
18794
|
+
fromPartial(object) {
|
|
18795
|
+
const message = createBaseEndpointGetInfoResponse_EndpointHandleMetadata();
|
|
18796
|
+
message.appId = object.appId ?? "";
|
|
18797
|
+
message.serverId = object.serverId ?? "";
|
|
18798
|
+
message.environmentName = object.environmentName ?? "";
|
|
18799
|
+
return message;
|
|
18800
|
+
}
|
|
18801
|
+
};
|
|
18350
18802
|
function createBaseEndpointGetLifecycleRequest() {
|
|
18351
18803
|
return { endpointId: "" };
|
|
18352
18804
|
}
|
|
@@ -22612,7 +23064,6 @@ function createBaseFunctionMessage() {
|
|
|
22612
23064
|
ExperimentalFabricSize: 0,
|
|
22613
23065
|
untrusted: false,
|
|
22614
23066
|
ExperimentalBufferContainers: 0,
|
|
22615
|
-
ExperimentalProxyIp: void 0,
|
|
22616
23067
|
runtimePerfRecord: false,
|
|
22617
23068
|
schedule: void 0,
|
|
22618
23069
|
snapshotDebug: false,
|
|
@@ -22806,9 +23257,6 @@ var FunctionMessage = {
|
|
|
22806
23257
|
if (message.ExperimentalBufferContainers !== 0) {
|
|
22807
23258
|
writer.uint32(552).uint32(message.ExperimentalBufferContainers);
|
|
22808
23259
|
}
|
|
22809
|
-
if (message.ExperimentalProxyIp !== void 0) {
|
|
22810
|
-
writer.uint32(562).string(message.ExperimentalProxyIp);
|
|
22811
|
-
}
|
|
22812
23260
|
if (message.runtimePerfRecord !== false) {
|
|
22813
23261
|
writer.uint32(568).bool(message.runtimePerfRecord);
|
|
22814
23262
|
}
|
|
@@ -23279,13 +23727,6 @@ var FunctionMessage = {
|
|
|
23279
23727
|
message.ExperimentalBufferContainers = reader.uint32();
|
|
23280
23728
|
continue;
|
|
23281
23729
|
}
|
|
23282
|
-
case 70: {
|
|
23283
|
-
if (tag !== 562) {
|
|
23284
|
-
break;
|
|
23285
|
-
}
|
|
23286
|
-
message.ExperimentalProxyIp = reader.string();
|
|
23287
|
-
continue;
|
|
23288
|
-
}
|
|
23289
23730
|
case 71: {
|
|
23290
23731
|
if (tag !== 568) {
|
|
23291
23732
|
break;
|
|
@@ -23539,7 +23980,6 @@ var FunctionMessage = {
|
|
|
23539
23980
|
ExperimentalFabricSize: isSet5(object.ExperimentalFabricSize) ? globalThis.Number(object.ExperimentalFabricSize) : 0,
|
|
23540
23981
|
untrusted: isSet5(object.untrusted) ? globalThis.Boolean(object.untrusted) : false,
|
|
23541
23982
|
ExperimentalBufferContainers: isSet5(object.ExperimentalBufferContainers) ? globalThis.Number(object.ExperimentalBufferContainers) : 0,
|
|
23542
|
-
ExperimentalProxyIp: isSet5(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0,
|
|
23543
23983
|
runtimePerfRecord: isSet5(object.runtimePerfRecord) ? globalThis.Boolean(object.runtimePerfRecord) : false,
|
|
23544
23984
|
schedule: isSet5(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0,
|
|
23545
23985
|
snapshotDebug: isSet5(object.snapshotDebug) ? globalThis.Boolean(object.snapshotDebug) : false,
|
|
@@ -23739,9 +24179,6 @@ var FunctionMessage = {
|
|
|
23739
24179
|
if (message.ExperimentalBufferContainers !== 0) {
|
|
23740
24180
|
obj.ExperimentalBufferContainers = Math.round(message.ExperimentalBufferContainers);
|
|
23741
24181
|
}
|
|
23742
|
-
if (message.ExperimentalProxyIp !== void 0) {
|
|
23743
|
-
obj.ExperimentalProxyIp = message.ExperimentalProxyIp;
|
|
23744
|
-
}
|
|
23745
24182
|
if (message.runtimePerfRecord !== false) {
|
|
23746
24183
|
obj.runtimePerfRecord = message.runtimePerfRecord;
|
|
23747
24184
|
}
|
|
@@ -23888,7 +24325,6 @@ var FunctionMessage = {
|
|
|
23888
24325
|
message.ExperimentalFabricSize = object.ExperimentalFabricSize ?? 0;
|
|
23889
24326
|
message.untrusted = object.untrusted ?? false;
|
|
23890
24327
|
message.ExperimentalBufferContainers = object.ExperimentalBufferContainers ?? 0;
|
|
23891
|
-
message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0;
|
|
23892
24328
|
message.runtimePerfRecord = object.runtimePerfRecord ?? false;
|
|
23893
24329
|
message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0;
|
|
23894
24330
|
message.snapshotDebug = object.snapshotDebug ?? false;
|
|
@@ -25995,7 +26431,6 @@ function createBaseFunctionData() {
|
|
|
25995
26431
|
webUrlInfo: void 0,
|
|
25996
26432
|
webhookConfig: void 0,
|
|
25997
26433
|
customDomainInfo: [],
|
|
25998
|
-
ExperimentalProxyIp: void 0,
|
|
25999
26434
|
methodDefinitions: {},
|
|
26000
26435
|
methodDefinitionsSet: false,
|
|
26001
26436
|
isClass: false,
|
|
@@ -26074,9 +26509,6 @@ var FunctionData = {
|
|
|
26074
26509
|
for (const v of message.customDomainInfo) {
|
|
26075
26510
|
CustomDomainInfo.encode(v, writer.uint32(98).fork()).join();
|
|
26076
26511
|
}
|
|
26077
|
-
if (message.ExperimentalProxyIp !== void 0) {
|
|
26078
|
-
writer.uint32(194).string(message.ExperimentalProxyIp);
|
|
26079
|
-
}
|
|
26080
26512
|
Object.entries(message.methodDefinitions).forEach(([key, value]) => {
|
|
26081
26513
|
FunctionData_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(202).fork()).join();
|
|
26082
26514
|
});
|
|
@@ -26278,13 +26710,6 @@ var FunctionData = {
|
|
|
26278
26710
|
message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32()));
|
|
26279
26711
|
continue;
|
|
26280
26712
|
}
|
|
26281
|
-
case 24: {
|
|
26282
|
-
if (tag !== 194) {
|
|
26283
|
-
break;
|
|
26284
|
-
}
|
|
26285
|
-
message.ExperimentalProxyIp = reader.string();
|
|
26286
|
-
continue;
|
|
26287
|
-
}
|
|
26288
26713
|
case 25: {
|
|
26289
26714
|
if (tag !== 202) {
|
|
26290
26715
|
break;
|
|
@@ -26493,7 +26918,6 @@ var FunctionData = {
|
|
|
26493
26918
|
webUrlInfo: isSet5(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0,
|
|
26494
26919
|
webhookConfig: isSet5(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0,
|
|
26495
26920
|
customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [],
|
|
26496
|
-
ExperimentalProxyIp: isSet5(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0,
|
|
26497
26921
|
methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => {
|
|
26498
26922
|
acc[key] = MethodDefinition.fromJSON(value);
|
|
26499
26923
|
return acc;
|
|
@@ -26578,9 +27002,6 @@ var FunctionData = {
|
|
|
26578
27002
|
if (message.customDomainInfo?.length) {
|
|
26579
27003
|
obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e));
|
|
26580
27004
|
}
|
|
26581
|
-
if (message.ExperimentalProxyIp !== void 0) {
|
|
26582
|
-
obj.ExperimentalProxyIp = message.ExperimentalProxyIp;
|
|
26583
|
-
}
|
|
26584
27005
|
if (message.methodDefinitions) {
|
|
26585
27006
|
const entries = Object.entries(message.methodDefinitions);
|
|
26586
27007
|
if (entries.length > 0) {
|
|
@@ -26686,7 +27107,6 @@ var FunctionData = {
|
|
|
26686
27107
|
message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0;
|
|
26687
27108
|
message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0;
|
|
26688
27109
|
message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || [];
|
|
26689
|
-
message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0;
|
|
26690
27110
|
message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => {
|
|
26691
27111
|
if (value !== void 0) {
|
|
26692
27112
|
acc[key] = MethodDefinition.fromPartial(value);
|
|
@@ -61285,6 +61705,14 @@ var ModalClientDefinition = {
|
|
|
61285
61705
|
responseStream: false,
|
|
61286
61706
|
options: {}
|
|
61287
61707
|
},
|
|
61708
|
+
endpointGetInfo: {
|
|
61709
|
+
name: "EndpointGetInfo",
|
|
61710
|
+
requestType: EndpointGetInfoRequest,
|
|
61711
|
+
requestStream: false,
|
|
61712
|
+
responseType: EndpointGetInfoResponse,
|
|
61713
|
+
responseStream: false,
|
|
61714
|
+
options: {}
|
|
61715
|
+
},
|
|
61288
61716
|
endpointGetLifecycle: {
|
|
61289
61717
|
name: "EndpointGetLifecycle",
|
|
61290
61718
|
requestType: EndpointGetLifecycleRequest,
|
|
@@ -62936,6 +63364,12 @@ var QueueFullError = class extends Error {
|
|
|
62936
63364
|
this.name = "QueueFullError";
|
|
62937
63365
|
}
|
|
62938
63366
|
};
|
|
63367
|
+
var ResourceExhaustedError = class extends Error {
|
|
63368
|
+
constructor(message) {
|
|
63369
|
+
super(message);
|
|
63370
|
+
this.name = "ResourceExhaustedError";
|
|
63371
|
+
}
|
|
63372
|
+
};
|
|
62939
63373
|
var SandboxFilesystemError = class extends Error {
|
|
62940
63374
|
constructor(message) {
|
|
62941
63375
|
super(message);
|
|
@@ -63458,6 +63892,16 @@ var CloudBucketMount2 = class {
|
|
|
63458
63892
|
});
|
|
63459
63893
|
}
|
|
63460
63894
|
};
|
|
63895
|
+
function buildCloudBucketMountProtos(mounts) {
|
|
63896
|
+
return Object.entries(mounts ?? {}).map(([mountPath, mount]) => {
|
|
63897
|
+
if (!mount) {
|
|
63898
|
+
throw new InvalidError(
|
|
63899
|
+
`CloudBucketMount mounted at "${mountPath}" must not be null or undefined`
|
|
63900
|
+
);
|
|
63901
|
+
}
|
|
63902
|
+
return mount.toProto(mountPath);
|
|
63903
|
+
});
|
|
63904
|
+
}
|
|
63461
63905
|
|
|
63462
63906
|
// src/secret.ts
|
|
63463
63907
|
var import_nice_grpc2 = require("nice-grpc");
|
|
@@ -63491,7 +63935,7 @@ var SecretService = class {
|
|
|
63491
63935
|
"secret_name",
|
|
63492
63936
|
name
|
|
63493
63937
|
);
|
|
63494
|
-
return new Secret(resp.secretId, name);
|
|
63938
|
+
return new Secret(resp.secretId, name, void 0, resp.metadata?.keys);
|
|
63495
63939
|
} catch (err) {
|
|
63496
63940
|
if (err instanceof import_nice_grpc2.ClientError && err.code === import_nice_grpc2.Status.NOT_FOUND)
|
|
63497
63941
|
throw new NotFoundError(err.details);
|
|
@@ -63590,16 +64034,20 @@ var Secret = class {
|
|
|
63590
64034
|
// constructed already-hydrated (e.g. from fromName), and not consulted again
|
|
63591
64035
|
// once secretId is set.
|
|
63592
64036
|
#hydrator;
|
|
64037
|
+
// Names of the env vars a server-side Secret defines, as reported by the
|
|
64038
|
+
// control plane on fromName. Undefined when unknown.
|
|
64039
|
+
#keys;
|
|
63593
64040
|
// Caches the single in-flight (or successfully completed) hydration so the
|
|
63594
64041
|
// ephemeral Secret is created at most once, even if multiple callers hydrate
|
|
63595
64042
|
// the same Secret concurrently. Cleared on failure so a transient error
|
|
63596
64043
|
// doesn't permanently break the Secret; subsequent calls can retry.
|
|
63597
64044
|
#hydratePromise;
|
|
63598
64045
|
/** @ignore */
|
|
63599
|
-
constructor(secretId, name, hydrator) {
|
|
64046
|
+
constructor(secretId, name, hydrator, keys) {
|
|
63600
64047
|
this.#secretId = secretId;
|
|
63601
64048
|
this.name = name;
|
|
63602
64049
|
this.#hydrator = hydrator;
|
|
64050
|
+
this.#keys = keys !== void 0 ? new Set(keys) : void 0;
|
|
63603
64051
|
}
|
|
63604
64052
|
/** The ID of the server-side Secret, or an empty string if not yet hydrated. */
|
|
63605
64053
|
get secretId() {
|
|
@@ -63615,6 +64063,16 @@ var Secret = class {
|
|
|
63615
64063
|
get _hydrator() {
|
|
63616
64064
|
return this.#hydrator;
|
|
63617
64065
|
}
|
|
64066
|
+
/**
|
|
64067
|
+
* Names of the env vars this server-side Secret defines, or `undefined` if
|
|
64068
|
+
* unknown (e.g. for lazy fromObject Secrets or Secrets constructed by id).
|
|
64069
|
+
*
|
|
64070
|
+
* @internal
|
|
64071
|
+
* @hidden
|
|
64072
|
+
*/
|
|
64073
|
+
get _keys() {
|
|
64074
|
+
return this.#keys;
|
|
64075
|
+
}
|
|
63618
64076
|
/**
|
|
63619
64077
|
* Lazily create the ephemeral server-side Secret backing a fromObject Secret
|
|
63620
64078
|
* and populate {@link Secret#secretId secretId}. A no-op once secretId is set
|
|
@@ -63682,6 +64140,9 @@ function splitEnvDictAndResolvableSecrets(secrets) {
|
|
|
63682
64140
|
if (hydrator !== void 0) {
|
|
63683
64141
|
Object.assign(envDict, hydrator.envDict);
|
|
63684
64142
|
} else {
|
|
64143
|
+
for (const key of secret?._keys ?? []) {
|
|
64144
|
+
delete envDict[key];
|
|
64145
|
+
}
|
|
63685
64146
|
resolvable.push(secret);
|
|
63686
64147
|
}
|
|
63687
64148
|
}
|
|
@@ -65377,7 +65838,8 @@ function createBaseTaskContainerCreateRequest() {
|
|
|
65377
65838
|
secretIds: [],
|
|
65378
65839
|
volumeMounts: [],
|
|
65379
65840
|
networkAccess: void 0,
|
|
65380
|
-
ptyInfo: void 0
|
|
65841
|
+
ptyInfo: void 0,
|
|
65842
|
+
memoryReserveConsumeMib: void 0
|
|
65381
65843
|
};
|
|
65382
65844
|
}
|
|
65383
65845
|
var TaskContainerCreateRequest = {
|
|
@@ -65412,6 +65874,9 @@ var TaskContainerCreateRequest = {
|
|
|
65412
65874
|
if (message.ptyInfo !== void 0) {
|
|
65413
65875
|
PTYInfo.encode(message.ptyInfo, writer.uint32(90).fork()).join();
|
|
65414
65876
|
}
|
|
65877
|
+
if (message.memoryReserveConsumeMib !== void 0) {
|
|
65878
|
+
writer.uint32(96).uint32(message.memoryReserveConsumeMib);
|
|
65879
|
+
}
|
|
65415
65880
|
return writer;
|
|
65416
65881
|
},
|
|
65417
65882
|
decode(input, length) {
|
|
@@ -65494,6 +65959,13 @@ var TaskContainerCreateRequest = {
|
|
|
65494
65959
|
message.ptyInfo = PTYInfo.decode(reader, reader.uint32());
|
|
65495
65960
|
continue;
|
|
65496
65961
|
}
|
|
65962
|
+
case 12: {
|
|
65963
|
+
if (tag !== 96) {
|
|
65964
|
+
break;
|
|
65965
|
+
}
|
|
65966
|
+
message.memoryReserveConsumeMib = reader.uint32();
|
|
65967
|
+
continue;
|
|
65968
|
+
}
|
|
65497
65969
|
}
|
|
65498
65970
|
if ((tag & 7) === 4 || tag === 0) {
|
|
65499
65971
|
break;
|
|
@@ -65516,7 +65988,8 @@ var TaskContainerCreateRequest = {
|
|
|
65516
65988
|
secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [],
|
|
65517
65989
|
volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [],
|
|
65518
65990
|
networkAccess: isSet6(object.networkAccess) ? NetworkAccess.fromJSON(object.networkAccess) : void 0,
|
|
65519
|
-
ptyInfo: isSet6(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0
|
|
65991
|
+
ptyInfo: isSet6(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0,
|
|
65992
|
+
memoryReserveConsumeMib: isSet6(object.memoryReserveConsumeMib) ? globalThis.Number(object.memoryReserveConsumeMib) : void 0
|
|
65520
65993
|
};
|
|
65521
65994
|
},
|
|
65522
65995
|
toJSON(message) {
|
|
@@ -65557,6 +66030,9 @@ var TaskContainerCreateRequest = {
|
|
|
65557
66030
|
if (message.ptyInfo !== void 0) {
|
|
65558
66031
|
obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo);
|
|
65559
66032
|
}
|
|
66033
|
+
if (message.memoryReserveConsumeMib !== void 0) {
|
|
66034
|
+
obj.memoryReserveConsumeMib = Math.round(message.memoryReserveConsumeMib);
|
|
66035
|
+
}
|
|
65560
66036
|
return obj;
|
|
65561
66037
|
},
|
|
65562
66038
|
create(base) {
|
|
@@ -65579,6 +66055,7 @@ var TaskContainerCreateRequest = {
|
|
|
65579
66055
|
message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || [];
|
|
65580
66056
|
message.networkAccess = object.networkAccess !== void 0 && object.networkAccess !== null ? NetworkAccess.fromPartial(object.networkAccess) : void 0;
|
|
65581
66057
|
message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0;
|
|
66058
|
+
message.memoryReserveConsumeMib = object.memoryReserveConsumeMib ?? void 0;
|
|
65582
66059
|
return message;
|
|
65583
66060
|
}
|
|
65584
66061
|
};
|
|
@@ -68869,6 +69346,41 @@ function isSet6(value) {
|
|
|
68869
69346
|
var import_promises = require("timers/promises");
|
|
68870
69347
|
var import_nice_grpc7 = require("nice-grpc");
|
|
68871
69348
|
|
|
69349
|
+
// src/server_warnings.ts
|
|
69350
|
+
var SERVER_WARNING_HEADER = "x-modal-warning";
|
|
69351
|
+
var SERVER_WARNING_REGISTRY_LIMIT = 2048;
|
|
69352
|
+
function logServerWarnings(logger2, trailer, seen) {
|
|
69353
|
+
const joined = trailer.get(SERVER_WARNING_HEADER);
|
|
69354
|
+
if (typeof joined !== "string") return;
|
|
69355
|
+
for (const encoded of joined.split(",")) {
|
|
69356
|
+
let message;
|
|
69357
|
+
try {
|
|
69358
|
+
message = decodeURIComponent(encoded.trim());
|
|
69359
|
+
} catch {
|
|
69360
|
+
message = encoded.trim();
|
|
69361
|
+
}
|
|
69362
|
+
if (seen.size > SERVER_WARNING_REGISTRY_LIMIT) {
|
|
69363
|
+
seen.clear();
|
|
69364
|
+
}
|
|
69365
|
+
if (seen.has(message)) continue;
|
|
69366
|
+
seen.add(message);
|
|
69367
|
+
logger2.warn(message);
|
|
69368
|
+
}
|
|
69369
|
+
}
|
|
69370
|
+
function serverWarningMiddleware(logger2) {
|
|
69371
|
+
const seen = /* @__PURE__ */ new Set();
|
|
69372
|
+
return async function* serverWarningMiddleware2(call, options) {
|
|
69373
|
+
const { onTrailer, ...restOptions } = options;
|
|
69374
|
+
return yield* call.next(call.request, {
|
|
69375
|
+
...restOptions,
|
|
69376
|
+
onTrailer: (trailer) => {
|
|
69377
|
+
logServerWarnings(logger2, trailer, seen);
|
|
69378
|
+
onTrailer?.(trailer);
|
|
69379
|
+
}
|
|
69380
|
+
});
|
|
69381
|
+
};
|
|
69382
|
+
}
|
|
69383
|
+
|
|
68872
69384
|
// src/config.ts
|
|
68873
69385
|
var import_node_console = require("console");
|
|
68874
69386
|
var import_node_fs = require("fs");
|
|
@@ -68960,7 +69472,7 @@ function getProfile(profileName) {
|
|
|
68960
69472
|
const ms = Math.round(parsed * 1e3);
|
|
68961
69473
|
return parsed > 0 && ms === 0 ? 1 : ms;
|
|
68962
69474
|
})(),
|
|
68963
|
-
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : parseBooleanFlag(profileData.sandbox_v2)
|
|
69475
|
+
sandboxV2: process.env["MODAL_SANDBOX_V2"] ? parseBooleanFlag(process.env["MODAL_SANDBOX_V2"]) : profileData.sandbox_v2 !== void 0 ? parseBooleanFlag(profileData.sandbox_v2) : true
|
|
68964
69476
|
};
|
|
68965
69477
|
return profile;
|
|
68966
69478
|
}
|
|
@@ -69182,7 +69694,7 @@ var TaskCommandRouterClientImpl = class _TaskCommandRouterClientImpl {
|
|
|
69182
69694
|
options.metadata ??= new import_nice_grpc7.Metadata();
|
|
69183
69695
|
options.metadata.set("authorization", `Bearer ${self.jwt}`);
|
|
69184
69696
|
return yield* call.next(call.request, options);
|
|
69185
|
-
});
|
|
69697
|
+
}).use(serverWarningMiddleware(logger2));
|
|
69186
69698
|
this.factory = factory;
|
|
69187
69699
|
this.stub = factory.create(TaskCommandRouterDefinition, this.channel);
|
|
69188
69700
|
this.armIdleTimer();
|
|
@@ -70921,7 +71433,11 @@ var MAIN_CONTAINER_NAME = "main";
|
|
|
70921
71433
|
var CONTAINER_WAIT_POLL_TIMEOUT_SECONDS = 10;
|
|
70922
71434
|
var CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR = "MODAL_USE_CONTROL_PLANE_SIDECAR_CREATE";
|
|
70923
71435
|
function useControlPlaneSidecarCreate(sandboxId) {
|
|
70924
|
-
|
|
71436
|
+
if (getSandboxVersion(sandboxId) !== "V2" /* V2 */) {
|
|
71437
|
+
return false;
|
|
71438
|
+
}
|
|
71439
|
+
const value = process.env[CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR];
|
|
71440
|
+
return value === void 0 || parseBooleanFlag(value);
|
|
70925
71441
|
}
|
|
70926
71442
|
function validateSidecarName(name) {
|
|
70927
71443
|
if (name === "") {
|
|
@@ -70986,14 +71502,44 @@ var SidecarService = class {
|
|
|
70986
71502
|
const command = params?.command ?? [];
|
|
70987
71503
|
validateExecArgs(command);
|
|
70988
71504
|
validateWorkdir(params?.workdir);
|
|
71505
|
+
if (params?.experimentalMemoryReserveConsumeMiB !== void 0 && (!Number.isInteger(params.experimentalMemoryReserveConsumeMiB) || params.experimentalMemoryReserveConsumeMiB <= 0)) {
|
|
71506
|
+
throw new InvalidError(
|
|
71507
|
+
`experimentalMemoryReserveConsumeMiB must be a positive integer number of MiB, got: ${params.experimentalMemoryReserveConsumeMiB}`
|
|
71508
|
+
);
|
|
71509
|
+
}
|
|
71510
|
+
const viaControlPlane = useControlPlaneSidecarCreate(
|
|
71511
|
+
this.#access.sandboxId
|
|
71512
|
+
);
|
|
71513
|
+
const cloudBucketMountEntries = Object.entries(
|
|
71514
|
+
params?.cloudBucketMounts ?? {}
|
|
71515
|
+
);
|
|
71516
|
+
if (cloudBucketMountEntries.length > 0) {
|
|
71517
|
+
if (getSandboxVersion(this.#access.sandboxId) !== "V2" /* V2 */) {
|
|
71518
|
+
throw new InvalidError(
|
|
71519
|
+
"cloudBucketMounts are not supported in sidecars of V1 Sandboxes. A Sandbox is V1 when it has a GPU or MODAL_SANDBOX_V2=0 is set; contact Modal support for more information"
|
|
71520
|
+
);
|
|
71521
|
+
}
|
|
71522
|
+
if (!viaControlPlane) {
|
|
71523
|
+
throw new InvalidError(
|
|
71524
|
+
`cloudBucketMounts are not supported in sidecars when ${CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR}=0 is set; unset it to use them`
|
|
71525
|
+
);
|
|
71526
|
+
}
|
|
71527
|
+
}
|
|
70989
71528
|
validateEnvVarKeys(params?.env ?? {});
|
|
70990
71529
|
const [envDict, resolvableSecrets] = splitEnvDictAndResolvableSecrets(
|
|
70991
71530
|
params?.secrets ?? []
|
|
70992
71531
|
);
|
|
70993
71532
|
Object.assign(envDict, params?.env ?? {});
|
|
70994
|
-
await
|
|
71533
|
+
await hydrateSandboxSecrets(
|
|
71534
|
+
this.#access.client,
|
|
71535
|
+
resolvableSecrets,
|
|
71536
|
+
params?.cloudBucketMounts
|
|
71537
|
+
);
|
|
70995
71538
|
const secretIds = collectSecretIds(resolvableSecrets);
|
|
70996
71539
|
const volumeMounts = buildSidecarVolumeMounts(params?.volumes);
|
|
71540
|
+
const cloudBucketMounts = buildCloudBucketMountProtos(
|
|
71541
|
+
params?.cloudBucketMounts
|
|
71542
|
+
);
|
|
70997
71543
|
const ptyInfo = params?.pty ? defaultSandboxPTYInfo() : void 0;
|
|
70998
71544
|
const networkAccess = buildOutboundNetworkAccess(
|
|
70999
71545
|
false,
|
|
@@ -71002,7 +71548,7 @@ var SidecarService = class {
|
|
|
71002
71548
|
);
|
|
71003
71549
|
let resp;
|
|
71004
71550
|
try {
|
|
71005
|
-
if (
|
|
71551
|
+
if (viaControlPlane) {
|
|
71006
71552
|
const ephemeralSecrets = Object.keys(envDict).length > 0 ? StringMap.create({ contents: envDict }) : void 0;
|
|
71007
71553
|
resp = await this.#access.client.cpClient.sandboxContainerCreateV2(
|
|
71008
71554
|
SandboxContainerCreateV2Request.create({
|
|
@@ -71014,8 +71560,12 @@ var SidecarService = class {
|
|
|
71014
71560
|
workdir: params?.workdir ?? void 0,
|
|
71015
71561
|
secretIds,
|
|
71016
71562
|
volumeMounts,
|
|
71563
|
+
cloudBucketMounts,
|
|
71017
71564
|
networkAccess,
|
|
71018
|
-
ptyInfo
|
|
71565
|
+
ptyInfo,
|
|
71566
|
+
resources: params?.experimentalMemoryReserveConsumeMiB !== void 0 ? Resources.create({
|
|
71567
|
+
memoryMb: params.experimentalMemoryReserveConsumeMiB
|
|
71568
|
+
}) : void 0
|
|
71019
71569
|
}),
|
|
71020
71570
|
ephemeralSecrets
|
|
71021
71571
|
})
|
|
@@ -71033,7 +71583,8 @@ var SidecarService = class {
|
|
|
71033
71583
|
secretIds,
|
|
71034
71584
|
volumeMounts,
|
|
71035
71585
|
networkAccess,
|
|
71036
|
-
ptyInfo
|
|
71586
|
+
ptyInfo,
|
|
71587
|
+
memoryReserveConsumeMib: params?.experimentalMemoryReserveConsumeMiB
|
|
71037
71588
|
})
|
|
71038
71589
|
);
|
|
71039
71590
|
}
|
|
@@ -71444,6 +71995,14 @@ var SB_LOGS_INITIAL_DELAY_MS = 10;
|
|
|
71444
71995
|
var SB_LOGS_DELAY_FACTOR = 2;
|
|
71445
71996
|
var SB_LOGS_MAX_RETRIES = 10;
|
|
71446
71997
|
var SB_LOGS_TASK_ID_TIMEOUT_SECONDS = 0.5;
|
|
71998
|
+
var SANDBOX_SCHEDULING_TIMEOUT_MS = 21 * 60 * 1e3;
|
|
71999
|
+
var GET_TASK_ID_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
72000
|
+
function isTransientTaskIDLookupError(err) {
|
|
72001
|
+
if (!(err instanceof import_nice_grpc12.ClientError)) {
|
|
72002
|
+
return false;
|
|
72003
|
+
}
|
|
72004
|
+
return err.code === import_nice_grpc12.Status.UNAVAILABLE || err.code === import_nice_grpc12.Status.DEADLINE_EXCEEDED || err.code === import_nice_grpc12.Status.INTERNAL;
|
|
72005
|
+
}
|
|
71447
72006
|
var TTL_NO_EXPIRY_SENTINEL = -1;
|
|
71448
72007
|
var CUSTOMER_SUPPLIED_ENCRYPTION_KEY_MIN_LENGTH = 16;
|
|
71449
72008
|
var CUSTOMER_SUPPLIED_ENCRYPTION_KEY_MAX_LENGTH = 512;
|
|
@@ -71643,9 +72202,9 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
71643
72202
|
const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
|
|
71644
72203
|
([mountPath, volume]) => volumeToMountProto(mountPath, volume)
|
|
71645
72204
|
) : [];
|
|
71646
|
-
const cloudBucketMounts =
|
|
71647
|
-
|
|
71648
|
-
)
|
|
72205
|
+
const cloudBucketMounts = buildCloudBucketMountProtos(
|
|
72206
|
+
params.cloudBucketMounts
|
|
72207
|
+
);
|
|
71649
72208
|
const openPorts = [];
|
|
71650
72209
|
if (params.encryptedPorts) {
|
|
71651
72210
|
openPorts.push(
|
|
@@ -71877,7 +72436,9 @@ var SandboxService = class {
|
|
|
71877
72436
|
"sandbox_id",
|
|
71878
72437
|
createResp.sandboxId
|
|
71879
72438
|
);
|
|
71880
|
-
|
|
72439
|
+
const sb = new Sandbox2(this.#client, createResp.sandboxId);
|
|
72440
|
+
await sb._waitForScheduling(SANDBOX_SCHEDULING_TIMEOUT_MS);
|
|
72441
|
+
return sb;
|
|
71881
72442
|
}
|
|
71882
72443
|
/**
|
|
71883
72444
|
* Create a new {@link Sandbox} using the experimental V2 backend.
|
|
@@ -72319,7 +72880,7 @@ function buildTaskSnapshotDirectoryRequestProto(taskId, path2, snapshotId, ttlSe
|
|
|
72319
72880
|
containerId
|
|
72320
72881
|
});
|
|
72321
72882
|
}
|
|
72322
|
-
var Sandbox2 = class
|
|
72883
|
+
var Sandbox2 = class {
|
|
72323
72884
|
#client;
|
|
72324
72885
|
sandboxId;
|
|
72325
72886
|
#appId;
|
|
@@ -72620,15 +73181,15 @@ var Sandbox2 = class _Sandbox {
|
|
|
72620
73181
|
}
|
|
72621
73182
|
return this.#client.cpClient.sandboxWait(req);
|
|
72622
73183
|
}
|
|
72623
|
-
#sandboxGetTaskId(
|
|
73184
|
+
#sandboxGetTaskId(timeoutSecs, options) {
|
|
72624
73185
|
const req = SandboxGetTaskIdRequest.create({
|
|
72625
73186
|
sandboxId: this.sandboxId,
|
|
72626
|
-
timeout
|
|
73187
|
+
timeout: timeoutSecs
|
|
72627
73188
|
});
|
|
72628
73189
|
if (this.#isV2) {
|
|
72629
|
-
return this.#client.cpClient.sandboxGetTaskIdV2(req,
|
|
73190
|
+
return this.#client.cpClient.sandboxGetTaskIdV2(req, options);
|
|
72630
73191
|
}
|
|
72631
|
-
return this.#client.cpClient.sandboxGetTaskId(req,
|
|
73192
|
+
return this.#client.cpClient.sandboxGetTaskId(req, options);
|
|
72632
73193
|
}
|
|
72633
73194
|
#sandboxGetTunnels(timeoutMs) {
|
|
72634
73195
|
const req = { sandboxId: this.sandboxId, timeout: timeoutMs / 1e3 };
|
|
@@ -72652,8 +73213,6 @@ var Sandbox2 = class _Sandbox {
|
|
|
72652
73213
|
}
|
|
72653
73214
|
await this.#client.cpClient.sandboxTerminate(req);
|
|
72654
73215
|
}
|
|
72655
|
-
static #maxGetTaskIdAttempts = 600;
|
|
72656
|
-
// 5 minutes at 500ms intervals
|
|
72657
73216
|
async #getAppId() {
|
|
72658
73217
|
if (this.#appId !== void 0) {
|
|
72659
73218
|
return this.#appId;
|
|
@@ -72674,10 +73233,7 @@ var Sandbox2 = class _Sandbox {
|
|
|
72674
73233
|
}
|
|
72675
73234
|
let resp;
|
|
72676
73235
|
try {
|
|
72677
|
-
resp = await this.#sandboxGetTaskId(
|
|
72678
|
-
void 0,
|
|
72679
|
-
SB_LOGS_TASK_ID_TIMEOUT_SECONDS
|
|
72680
|
-
);
|
|
73236
|
+
resp = await this.#sandboxGetTaskId(SB_LOGS_TASK_ID_TIMEOUT_SECONDS);
|
|
72681
73237
|
} catch (error) {
|
|
72682
73238
|
if (error instanceof import_nice_grpc12.ClientError && error.code === import_nice_grpc12.Status.DEADLINE_EXCEEDED) {
|
|
72683
73239
|
throw new ExecutionError("Sandbox task ID is not available yet.");
|
|
@@ -72691,28 +73247,92 @@ var Sandbox2 = class _Sandbox {
|
|
|
72691
73247
|
return this.#taskId;
|
|
72692
73248
|
}
|
|
72693
73249
|
async #getTaskId(signal) {
|
|
73250
|
+
return await this.#waitForTaskId(GET_TASK_ID_TIMEOUT_MS, false, signal);
|
|
73251
|
+
}
|
|
73252
|
+
/**
|
|
73253
|
+
* Blocks until the Sandbox has a task. If the wait fails, the Sandbox is
|
|
73254
|
+
* terminated so a queued one cannot start later with no caller. A timeout
|
|
73255
|
+
* surfaces as a ResourceExhaustedError.
|
|
73256
|
+
*
|
|
73257
|
+
* @internal
|
|
73258
|
+
* @hidden
|
|
73259
|
+
*/
|
|
73260
|
+
async _waitForScheduling(timeoutMs) {
|
|
73261
|
+
try {
|
|
73262
|
+
await this.#waitForTaskId(timeoutMs, true);
|
|
73263
|
+
} catch (err) {
|
|
73264
|
+
if (err instanceof ConflictError) {
|
|
73265
|
+
throw err;
|
|
73266
|
+
}
|
|
73267
|
+
try {
|
|
73268
|
+
await this.#sandboxTerminate();
|
|
73269
|
+
} catch (terminateErr) {
|
|
73270
|
+
this.#client.logger.debug(
|
|
73271
|
+
"Failed to terminate unscheduled Sandbox",
|
|
73272
|
+
"sandbox_id",
|
|
73273
|
+
this.sandboxId,
|
|
73274
|
+
"error",
|
|
73275
|
+
terminateErr
|
|
73276
|
+
);
|
|
73277
|
+
}
|
|
73278
|
+
if (err instanceof TimeoutError) {
|
|
73279
|
+
throw new ResourceExhaustedError(
|
|
73280
|
+
"Insufficient capacity to create sandbox."
|
|
73281
|
+
);
|
|
73282
|
+
}
|
|
73283
|
+
throw err;
|
|
73284
|
+
}
|
|
73285
|
+
}
|
|
73286
|
+
/**
|
|
73287
|
+
* Polls until the Sandbox has been assigned a task. Throws a ConflictError
|
|
73288
|
+
* if the Sandbox finished before that happened and a TimeoutError once
|
|
73289
|
+
* timeoutMs elapses. With retryTransient, lookups that fail with a
|
|
73290
|
+
* transient error keep polling until the deadline instead of failing.
|
|
73291
|
+
*/
|
|
73292
|
+
async #waitForTaskId(timeoutMs, retryTransient, signal) {
|
|
72694
73293
|
if (this.#taskId !== void 0) {
|
|
72695
73294
|
return this.#taskId;
|
|
72696
73295
|
}
|
|
72697
|
-
|
|
72698
|
-
|
|
73296
|
+
const deadline = Date.now() + timeoutMs;
|
|
73297
|
+
const timedOut = () => new TimeoutError(
|
|
73298
|
+
`Timed out waiting for task ID for Sandbox ${this.sandboxId}`
|
|
73299
|
+
);
|
|
73300
|
+
const pollIntervalMs = 500;
|
|
73301
|
+
const noTimeLeft = () => deadline - Date.now() <= pollIntervalMs;
|
|
73302
|
+
while (true) {
|
|
73303
|
+
let resp;
|
|
73304
|
+
try {
|
|
73305
|
+
resp = await this.#sandboxGetTaskId(void 0, { signal });
|
|
73306
|
+
} catch (err) {
|
|
73307
|
+
if (signal?.aborted || !isTransientTaskIDLookupError(err)) {
|
|
73308
|
+
throw err;
|
|
73309
|
+
}
|
|
73310
|
+
if (!retryTransient && Date.now() < deadline) {
|
|
73311
|
+
throw err;
|
|
73312
|
+
}
|
|
73313
|
+
if (noTimeLeft()) {
|
|
73314
|
+
if (err instanceof import_nice_grpc12.ClientError && err.code === import_nice_grpc12.Status.INTERNAL) {
|
|
73315
|
+
throw err;
|
|
73316
|
+
}
|
|
73317
|
+
throw timedOut();
|
|
73318
|
+
}
|
|
73319
|
+
await (0, import_promises3.setTimeout)(pollIntervalMs, void 0, { signal });
|
|
73320
|
+
continue;
|
|
73321
|
+
}
|
|
72699
73322
|
if (resp.taskId) {
|
|
72700
73323
|
this.#taskId = resp.taskId;
|
|
72701
73324
|
return this.#taskId;
|
|
72702
73325
|
}
|
|
72703
73326
|
if (resp.taskResult) {
|
|
72704
|
-
|
|
72705
|
-
|
|
72706
|
-
}
|
|
72707
|
-
throw new Error(
|
|
72708
|
-
`Sandbox ${this.sandboxId} has already completed with result: exception:"${resp.taskResult.exception}"`
|
|
73327
|
+
throw new ConflictError(
|
|
73328
|
+
resp.taskResult.exception || `Sandbox ${this.sandboxId} has already finished`
|
|
72709
73329
|
);
|
|
72710
73330
|
}
|
|
72711
|
-
|
|
73331
|
+
if (noTimeLeft()) {
|
|
73332
|
+
throw timedOut();
|
|
73333
|
+
}
|
|
73334
|
+
await (0, import_promises3.setTimeout)(pollIntervalMs, void 0, { signal });
|
|
72712
73335
|
}
|
|
72713
|
-
throw new Error(
|
|
72714
|
-
`Timed out waiting for task ID for Sandbox ${this.sandboxId}`
|
|
72715
|
-
);
|
|
72716
73336
|
}
|
|
72717
73337
|
async #getOrCreateCommandRouterClient(taskId) {
|
|
72718
73338
|
if (this.#commandRouterClient !== void 0) {
|
|
@@ -73700,7 +74320,7 @@ var AuthTokenManager = class {
|
|
|
73700
74320
|
};
|
|
73701
74321
|
|
|
73702
74322
|
// src/version.ts
|
|
73703
|
-
var SDK_VERSION = "0.
|
|
74323
|
+
var SDK_VERSION = "0.11.0";
|
|
73704
74324
|
function getSDKVersion() {
|
|
73705
74325
|
return SDK_VERSION;
|
|
73706
74326
|
}
|
|
@@ -73967,7 +74587,7 @@ var ModalClient = class {
|
|
|
73967
74587
|
"grpc.keepalive_timeout_ms": 1e4,
|
|
73968
74588
|
"grpc.keepalive_permit_without_calls": 1
|
|
73969
74589
|
});
|
|
73970
|
-
let factory = (0, import_nice_grpc14.createClientFactory)().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(timeoutMiddleware);
|
|
74590
|
+
let factory = (0, import_nice_grpc14.createClientFactory)().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(serverWarningMiddleware(this.logger)).use(timeoutMiddleware);
|
|
73971
74591
|
for (const middleware of this.customMiddleware) {
|
|
73972
74592
|
factory = factory.use(middleware);
|
|
73973
74593
|
}
|
|
@@ -76280,6 +76900,7 @@ var ExperimentalOutboundPolicy = class _ExperimentalOutboundPolicy {
|
|
|
76280
76900
|
QueueFullError,
|
|
76281
76901
|
QueueService,
|
|
76282
76902
|
RemoteError,
|
|
76903
|
+
ResourceExhaustedError,
|
|
76283
76904
|
Retries,
|
|
76284
76905
|
Sandbox,
|
|
76285
76906
|
SandboxFilesystem,
|