modal 0.3.22 → 0.3.23
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/index.cjs +375 -121
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +375 -121
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24415,13 +24415,16 @@ var ListPagination = {
|
|
|
24415
24415
|
}
|
|
24416
24416
|
};
|
|
24417
24417
|
function createBaseMapAwaitRequest() {
|
|
24418
|
-
return { functionCallId:
|
|
24418
|
+
return { functionCallId: void 0, mapToken: void 0, lastEntryId: "", requestedAt: 0, timeout: 0 };
|
|
24419
24419
|
}
|
|
24420
24420
|
var MapAwaitRequest = {
|
|
24421
24421
|
encode(message, writer = new BinaryWriter()) {
|
|
24422
|
-
if (message.functionCallId !==
|
|
24422
|
+
if (message.functionCallId !== void 0) {
|
|
24423
24423
|
writer.uint32(10).string(message.functionCallId);
|
|
24424
24424
|
}
|
|
24425
|
+
if (message.mapToken !== void 0) {
|
|
24426
|
+
writer.uint32(42).string(message.mapToken);
|
|
24427
|
+
}
|
|
24425
24428
|
if (message.lastEntryId !== "") {
|
|
24426
24429
|
writer.uint32(18).string(message.lastEntryId);
|
|
24427
24430
|
}
|
|
@@ -24447,6 +24450,13 @@ var MapAwaitRequest = {
|
|
|
24447
24450
|
message.functionCallId = reader.string();
|
|
24448
24451
|
continue;
|
|
24449
24452
|
}
|
|
24453
|
+
case 5: {
|
|
24454
|
+
if (tag !== 42) {
|
|
24455
|
+
break;
|
|
24456
|
+
}
|
|
24457
|
+
message.mapToken = reader.string();
|
|
24458
|
+
continue;
|
|
24459
|
+
}
|
|
24450
24460
|
case 2: {
|
|
24451
24461
|
if (tag !== 18) {
|
|
24452
24462
|
break;
|
|
@@ -24478,7 +24488,8 @@ var MapAwaitRequest = {
|
|
|
24478
24488
|
},
|
|
24479
24489
|
fromJSON(object) {
|
|
24480
24490
|
return {
|
|
24481
|
-
functionCallId: isSet3(object.functionCallId) ? globalThis.String(object.functionCallId) :
|
|
24491
|
+
functionCallId: isSet3(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0,
|
|
24492
|
+
mapToken: isSet3(object.mapToken) ? globalThis.String(object.mapToken) : void 0,
|
|
24482
24493
|
lastEntryId: isSet3(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "",
|
|
24483
24494
|
requestedAt: isSet3(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0,
|
|
24484
24495
|
timeout: isSet3(object.timeout) ? globalThis.Number(object.timeout) : 0
|
|
@@ -24486,9 +24497,12 @@ var MapAwaitRequest = {
|
|
|
24486
24497
|
},
|
|
24487
24498
|
toJSON(message) {
|
|
24488
24499
|
const obj = {};
|
|
24489
|
-
if (message.functionCallId !==
|
|
24500
|
+
if (message.functionCallId !== void 0) {
|
|
24490
24501
|
obj.functionCallId = message.functionCallId;
|
|
24491
24502
|
}
|
|
24503
|
+
if (message.mapToken !== void 0) {
|
|
24504
|
+
obj.mapToken = message.mapToken;
|
|
24505
|
+
}
|
|
24492
24506
|
if (message.lastEntryId !== "") {
|
|
24493
24507
|
obj.lastEntryId = message.lastEntryId;
|
|
24494
24508
|
}
|
|
@@ -24505,7 +24519,8 @@ var MapAwaitRequest = {
|
|
|
24505
24519
|
},
|
|
24506
24520
|
fromPartial(object) {
|
|
24507
24521
|
const message = createBaseMapAwaitRequest();
|
|
24508
|
-
message.functionCallId = object.functionCallId ??
|
|
24522
|
+
message.functionCallId = object.functionCallId ?? void 0;
|
|
24523
|
+
message.mapToken = object.mapToken ?? void 0;
|
|
24509
24524
|
message.lastEntryId = object.lastEntryId ?? "";
|
|
24510
24525
|
message.requestedAt = object.requestedAt ?? 0;
|
|
24511
24526
|
message.timeout = object.timeout ?? 0;
|
|
@@ -24792,7 +24807,7 @@ var MapStartOrContinueItem = {
|
|
|
24792
24807
|
}
|
|
24793
24808
|
};
|
|
24794
24809
|
function createBaseMapStartOrContinueRequest() {
|
|
24795
|
-
return { functionId: "", parentInputId: "", functionCallId: void 0, items: [] };
|
|
24810
|
+
return { functionId: "", parentInputId: "", functionCallId: void 0, mapToken: void 0, items: [] };
|
|
24796
24811
|
}
|
|
24797
24812
|
var MapStartOrContinueRequest = {
|
|
24798
24813
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -24805,6 +24820,9 @@ var MapStartOrContinueRequest = {
|
|
|
24805
24820
|
if (message.functionCallId !== void 0) {
|
|
24806
24821
|
writer.uint32(26).string(message.functionCallId);
|
|
24807
24822
|
}
|
|
24823
|
+
if (message.mapToken !== void 0) {
|
|
24824
|
+
writer.uint32(42).string(message.mapToken);
|
|
24825
|
+
}
|
|
24808
24826
|
for (const v of message.items) {
|
|
24809
24827
|
MapStartOrContinueItem.encode(v, writer.uint32(34).fork()).join();
|
|
24810
24828
|
}
|
|
@@ -24838,6 +24856,13 @@ var MapStartOrContinueRequest = {
|
|
|
24838
24856
|
message.functionCallId = reader.string();
|
|
24839
24857
|
continue;
|
|
24840
24858
|
}
|
|
24859
|
+
case 5: {
|
|
24860
|
+
if (tag !== 42) {
|
|
24861
|
+
break;
|
|
24862
|
+
}
|
|
24863
|
+
message.mapToken = reader.string();
|
|
24864
|
+
continue;
|
|
24865
|
+
}
|
|
24841
24866
|
case 4: {
|
|
24842
24867
|
if (tag !== 34) {
|
|
24843
24868
|
break;
|
|
@@ -24858,6 +24883,7 @@ var MapStartOrContinueRequest = {
|
|
|
24858
24883
|
functionId: isSet3(object.functionId) ? globalThis.String(object.functionId) : "",
|
|
24859
24884
|
parentInputId: isSet3(object.parentInputId) ? globalThis.String(object.parentInputId) : "",
|
|
24860
24885
|
functionCallId: isSet3(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0,
|
|
24886
|
+
mapToken: isSet3(object.mapToken) ? globalThis.String(object.mapToken) : void 0,
|
|
24861
24887
|
items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => MapStartOrContinueItem.fromJSON(e)) : []
|
|
24862
24888
|
};
|
|
24863
24889
|
},
|
|
@@ -24872,6 +24898,9 @@ var MapStartOrContinueRequest = {
|
|
|
24872
24898
|
if (message.functionCallId !== void 0) {
|
|
24873
24899
|
obj.functionCallId = message.functionCallId;
|
|
24874
24900
|
}
|
|
24901
|
+
if (message.mapToken !== void 0) {
|
|
24902
|
+
obj.mapToken = message.mapToken;
|
|
24903
|
+
}
|
|
24875
24904
|
if (message.items?.length) {
|
|
24876
24905
|
obj.items = message.items.map((e) => MapStartOrContinueItem.toJSON(e));
|
|
24877
24906
|
}
|
|
@@ -24885,15 +24914,26 @@ var MapStartOrContinueRequest = {
|
|
|
24885
24914
|
message.functionId = object.functionId ?? "";
|
|
24886
24915
|
message.parentInputId = object.parentInputId ?? "";
|
|
24887
24916
|
message.functionCallId = object.functionCallId ?? void 0;
|
|
24917
|
+
message.mapToken = object.mapToken ?? void 0;
|
|
24888
24918
|
message.items = object.items?.map((e) => MapStartOrContinueItem.fromPartial(e)) || [];
|
|
24889
24919
|
return message;
|
|
24890
24920
|
}
|
|
24891
24921
|
};
|
|
24892
24922
|
function createBaseMapStartOrContinueResponse() {
|
|
24893
|
-
return {
|
|
24923
|
+
return {
|
|
24924
|
+
mapToken: "",
|
|
24925
|
+
functionId: "",
|
|
24926
|
+
functionCallId: "",
|
|
24927
|
+
maxInputsOutstanding: 0,
|
|
24928
|
+
attemptTokens: [],
|
|
24929
|
+
retryPolicy: void 0
|
|
24930
|
+
};
|
|
24894
24931
|
}
|
|
24895
24932
|
var MapStartOrContinueResponse = {
|
|
24896
24933
|
encode(message, writer = new BinaryWriter()) {
|
|
24934
|
+
if (message.mapToken !== "") {
|
|
24935
|
+
writer.uint32(50).string(message.mapToken);
|
|
24936
|
+
}
|
|
24897
24937
|
if (message.functionId !== "") {
|
|
24898
24938
|
writer.uint32(10).string(message.functionId);
|
|
24899
24939
|
}
|
|
@@ -24918,6 +24958,13 @@ var MapStartOrContinueResponse = {
|
|
|
24918
24958
|
while (reader.pos < end) {
|
|
24919
24959
|
const tag = reader.uint32();
|
|
24920
24960
|
switch (tag >>> 3) {
|
|
24961
|
+
case 6: {
|
|
24962
|
+
if (tag !== 50) {
|
|
24963
|
+
break;
|
|
24964
|
+
}
|
|
24965
|
+
message.mapToken = reader.string();
|
|
24966
|
+
continue;
|
|
24967
|
+
}
|
|
24921
24968
|
case 1: {
|
|
24922
24969
|
if (tag !== 10) {
|
|
24923
24970
|
break;
|
|
@@ -24963,6 +25010,7 @@ var MapStartOrContinueResponse = {
|
|
|
24963
25010
|
},
|
|
24964
25011
|
fromJSON(object) {
|
|
24965
25012
|
return {
|
|
25013
|
+
mapToken: isSet3(object.mapToken) ? globalThis.String(object.mapToken) : "",
|
|
24966
25014
|
functionId: isSet3(object.functionId) ? globalThis.String(object.functionId) : "",
|
|
24967
25015
|
functionCallId: isSet3(object.functionCallId) ? globalThis.String(object.functionCallId) : "",
|
|
24968
25016
|
maxInputsOutstanding: isSet3(object.maxInputsOutstanding) ? globalThis.Number(object.maxInputsOutstanding) : 0,
|
|
@@ -24972,6 +25020,9 @@ var MapStartOrContinueResponse = {
|
|
|
24972
25020
|
},
|
|
24973
25021
|
toJSON(message) {
|
|
24974
25022
|
const obj = {};
|
|
25023
|
+
if (message.mapToken !== "") {
|
|
25024
|
+
obj.mapToken = message.mapToken;
|
|
25025
|
+
}
|
|
24975
25026
|
if (message.functionId !== "") {
|
|
24976
25027
|
obj.functionId = message.functionId;
|
|
24977
25028
|
}
|
|
@@ -24994,6 +25045,7 @@ var MapStartOrContinueResponse = {
|
|
|
24994
25045
|
},
|
|
24995
25046
|
fromPartial(object) {
|
|
24996
25047
|
const message = createBaseMapStartOrContinueResponse();
|
|
25048
|
+
message.mapToken = object.mapToken ?? "";
|
|
24997
25049
|
message.functionId = object.functionId ?? "";
|
|
24998
25050
|
message.functionCallId = object.functionCallId ?? "";
|
|
24999
25051
|
message.maxInputsOutstanding = object.maxInputsOutstanding ?? 0;
|
|
@@ -26689,7 +26741,16 @@ var ObjectDependency = {
|
|
|
26689
26741
|
}
|
|
26690
26742
|
};
|
|
26691
26743
|
function createBasePTYInfo() {
|
|
26692
|
-
return {
|
|
26744
|
+
return {
|
|
26745
|
+
enabled: false,
|
|
26746
|
+
winszRows: 0,
|
|
26747
|
+
winszCols: 0,
|
|
26748
|
+
envTerm: "",
|
|
26749
|
+
envColorterm: "",
|
|
26750
|
+
envTermProgram: "",
|
|
26751
|
+
ptyType: 0,
|
|
26752
|
+
noTerminateOnIdleStdin: false
|
|
26753
|
+
};
|
|
26693
26754
|
}
|
|
26694
26755
|
var PTYInfo = {
|
|
26695
26756
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -26714,6 +26775,9 @@ var PTYInfo = {
|
|
|
26714
26775
|
if (message.ptyType !== 0) {
|
|
26715
26776
|
writer.uint32(56).int32(message.ptyType);
|
|
26716
26777
|
}
|
|
26778
|
+
if (message.noTerminateOnIdleStdin !== false) {
|
|
26779
|
+
writer.uint32(64).bool(message.noTerminateOnIdleStdin);
|
|
26780
|
+
}
|
|
26717
26781
|
return writer;
|
|
26718
26782
|
},
|
|
26719
26783
|
decode(input, length) {
|
|
@@ -26772,6 +26836,13 @@ var PTYInfo = {
|
|
|
26772
26836
|
message.ptyType = reader.int32();
|
|
26773
26837
|
continue;
|
|
26774
26838
|
}
|
|
26839
|
+
case 8: {
|
|
26840
|
+
if (tag !== 64) {
|
|
26841
|
+
break;
|
|
26842
|
+
}
|
|
26843
|
+
message.noTerminateOnIdleStdin = reader.bool();
|
|
26844
|
+
continue;
|
|
26845
|
+
}
|
|
26775
26846
|
}
|
|
26776
26847
|
if ((tag & 7) === 4 || tag === 0) {
|
|
26777
26848
|
break;
|
|
@@ -26788,7 +26859,8 @@ var PTYInfo = {
|
|
|
26788
26859
|
envTerm: isSet3(object.envTerm) ? globalThis.String(object.envTerm) : "",
|
|
26789
26860
|
envColorterm: isSet3(object.envColorterm) ? globalThis.String(object.envColorterm) : "",
|
|
26790
26861
|
envTermProgram: isSet3(object.envTermProgram) ? globalThis.String(object.envTermProgram) : "",
|
|
26791
|
-
ptyType: isSet3(object.ptyType) ? pTYInfo_PTYTypeFromJSON(object.ptyType) : 0
|
|
26862
|
+
ptyType: isSet3(object.ptyType) ? pTYInfo_PTYTypeFromJSON(object.ptyType) : 0,
|
|
26863
|
+
noTerminateOnIdleStdin: isSet3(object.noTerminateOnIdleStdin) ? globalThis.Boolean(object.noTerminateOnIdleStdin) : false
|
|
26792
26864
|
};
|
|
26793
26865
|
},
|
|
26794
26866
|
toJSON(message) {
|
|
@@ -26814,6 +26886,9 @@ var PTYInfo = {
|
|
|
26814
26886
|
if (message.ptyType !== 0) {
|
|
26815
26887
|
obj.ptyType = pTYInfo_PTYTypeToJSON(message.ptyType);
|
|
26816
26888
|
}
|
|
26889
|
+
if (message.noTerminateOnIdleStdin !== false) {
|
|
26890
|
+
obj.noTerminateOnIdleStdin = message.noTerminateOnIdleStdin;
|
|
26891
|
+
}
|
|
26817
26892
|
return obj;
|
|
26818
26893
|
},
|
|
26819
26894
|
create(base) {
|
|
@@ -26828,6 +26903,7 @@ var PTYInfo = {
|
|
|
26828
26903
|
message.envColorterm = object.envColorterm ?? "";
|
|
26829
26904
|
message.envTermProgram = object.envTermProgram ?? "";
|
|
26830
26905
|
message.ptyType = object.ptyType ?? 0;
|
|
26906
|
+
message.noTerminateOnIdleStdin = object.noTerminateOnIdleStdin ?? false;
|
|
26831
26907
|
return message;
|
|
26832
26908
|
}
|
|
26833
26909
|
};
|
|
@@ -30324,6 +30400,142 @@ var Sandbox_ExperimentalOptionsEntry = {
|
|
|
30324
30400
|
return message;
|
|
30325
30401
|
}
|
|
30326
30402
|
};
|
|
30403
|
+
function createBaseSandboxCreateConnectTokenRequest() {
|
|
30404
|
+
return { sandboxId: "", metadata: "" };
|
|
30405
|
+
}
|
|
30406
|
+
var SandboxCreateConnectTokenRequest = {
|
|
30407
|
+
encode(message, writer = new BinaryWriter()) {
|
|
30408
|
+
if (message.sandboxId !== "") {
|
|
30409
|
+
writer.uint32(10).string(message.sandboxId);
|
|
30410
|
+
}
|
|
30411
|
+
if (message.metadata !== "") {
|
|
30412
|
+
writer.uint32(18).string(message.metadata);
|
|
30413
|
+
}
|
|
30414
|
+
return writer;
|
|
30415
|
+
},
|
|
30416
|
+
decode(input, length) {
|
|
30417
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
30418
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
30419
|
+
const message = createBaseSandboxCreateConnectTokenRequest();
|
|
30420
|
+
while (reader.pos < end) {
|
|
30421
|
+
const tag = reader.uint32();
|
|
30422
|
+
switch (tag >>> 3) {
|
|
30423
|
+
case 1: {
|
|
30424
|
+
if (tag !== 10) {
|
|
30425
|
+
break;
|
|
30426
|
+
}
|
|
30427
|
+
message.sandboxId = reader.string();
|
|
30428
|
+
continue;
|
|
30429
|
+
}
|
|
30430
|
+
case 2: {
|
|
30431
|
+
if (tag !== 18) {
|
|
30432
|
+
break;
|
|
30433
|
+
}
|
|
30434
|
+
message.metadata = reader.string();
|
|
30435
|
+
continue;
|
|
30436
|
+
}
|
|
30437
|
+
}
|
|
30438
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
30439
|
+
break;
|
|
30440
|
+
}
|
|
30441
|
+
reader.skip(tag & 7);
|
|
30442
|
+
}
|
|
30443
|
+
return message;
|
|
30444
|
+
},
|
|
30445
|
+
fromJSON(object) {
|
|
30446
|
+
return {
|
|
30447
|
+
sandboxId: isSet3(object.sandboxId) ? globalThis.String(object.sandboxId) : "",
|
|
30448
|
+
metadata: isSet3(object.metadata) ? globalThis.String(object.metadata) : ""
|
|
30449
|
+
};
|
|
30450
|
+
},
|
|
30451
|
+
toJSON(message) {
|
|
30452
|
+
const obj = {};
|
|
30453
|
+
if (message.sandboxId !== "") {
|
|
30454
|
+
obj.sandboxId = message.sandboxId;
|
|
30455
|
+
}
|
|
30456
|
+
if (message.metadata !== "") {
|
|
30457
|
+
obj.metadata = message.metadata;
|
|
30458
|
+
}
|
|
30459
|
+
return obj;
|
|
30460
|
+
},
|
|
30461
|
+
create(base) {
|
|
30462
|
+
return SandboxCreateConnectTokenRequest.fromPartial(base ?? {});
|
|
30463
|
+
},
|
|
30464
|
+
fromPartial(object) {
|
|
30465
|
+
const message = createBaseSandboxCreateConnectTokenRequest();
|
|
30466
|
+
message.sandboxId = object.sandboxId ?? "";
|
|
30467
|
+
message.metadata = object.metadata ?? "";
|
|
30468
|
+
return message;
|
|
30469
|
+
}
|
|
30470
|
+
};
|
|
30471
|
+
function createBaseSandboxCreateConnectTokenResponse() {
|
|
30472
|
+
return { url: "", token: "" };
|
|
30473
|
+
}
|
|
30474
|
+
var SandboxCreateConnectTokenResponse = {
|
|
30475
|
+
encode(message, writer = new BinaryWriter()) {
|
|
30476
|
+
if (message.url !== "") {
|
|
30477
|
+
writer.uint32(10).string(message.url);
|
|
30478
|
+
}
|
|
30479
|
+
if (message.token !== "") {
|
|
30480
|
+
writer.uint32(18).string(message.token);
|
|
30481
|
+
}
|
|
30482
|
+
return writer;
|
|
30483
|
+
},
|
|
30484
|
+
decode(input, length) {
|
|
30485
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
30486
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
30487
|
+
const message = createBaseSandboxCreateConnectTokenResponse();
|
|
30488
|
+
while (reader.pos < end) {
|
|
30489
|
+
const tag = reader.uint32();
|
|
30490
|
+
switch (tag >>> 3) {
|
|
30491
|
+
case 1: {
|
|
30492
|
+
if (tag !== 10) {
|
|
30493
|
+
break;
|
|
30494
|
+
}
|
|
30495
|
+
message.url = reader.string();
|
|
30496
|
+
continue;
|
|
30497
|
+
}
|
|
30498
|
+
case 2: {
|
|
30499
|
+
if (tag !== 18) {
|
|
30500
|
+
break;
|
|
30501
|
+
}
|
|
30502
|
+
message.token = reader.string();
|
|
30503
|
+
continue;
|
|
30504
|
+
}
|
|
30505
|
+
}
|
|
30506
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
30507
|
+
break;
|
|
30508
|
+
}
|
|
30509
|
+
reader.skip(tag & 7);
|
|
30510
|
+
}
|
|
30511
|
+
return message;
|
|
30512
|
+
},
|
|
30513
|
+
fromJSON(object) {
|
|
30514
|
+
return {
|
|
30515
|
+
url: isSet3(object.url) ? globalThis.String(object.url) : "",
|
|
30516
|
+
token: isSet3(object.token) ? globalThis.String(object.token) : ""
|
|
30517
|
+
};
|
|
30518
|
+
},
|
|
30519
|
+
toJSON(message) {
|
|
30520
|
+
const obj = {};
|
|
30521
|
+
if (message.url !== "") {
|
|
30522
|
+
obj.url = message.url;
|
|
30523
|
+
}
|
|
30524
|
+
if (message.token !== "") {
|
|
30525
|
+
obj.token = message.token;
|
|
30526
|
+
}
|
|
30527
|
+
return obj;
|
|
30528
|
+
},
|
|
30529
|
+
create(base) {
|
|
30530
|
+
return SandboxCreateConnectTokenResponse.fromPartial(base ?? {});
|
|
30531
|
+
},
|
|
30532
|
+
fromPartial(object) {
|
|
30533
|
+
const message = createBaseSandboxCreateConnectTokenResponse();
|
|
30534
|
+
message.url = object.url ?? "";
|
|
30535
|
+
message.token = object.token ?? "";
|
|
30536
|
+
return message;
|
|
30537
|
+
}
|
|
30538
|
+
};
|
|
30327
30539
|
function createBaseSandboxCreateRequest() {
|
|
30328
30540
|
return { appId: "", definition: void 0, environmentName: "" };
|
|
30329
30541
|
}
|
|
@@ -40927,6 +41139,14 @@ var ModalClientDefinition = {
|
|
|
40927
41139
|
responseStream: false,
|
|
40928
41140
|
options: {}
|
|
40929
41141
|
},
|
|
41142
|
+
sandboxCreateConnectToken: {
|
|
41143
|
+
name: "SandboxCreateConnectToken",
|
|
41144
|
+
requestType: SandboxCreateConnectTokenRequest,
|
|
41145
|
+
requestStream: false,
|
|
41146
|
+
responseType: SandboxCreateConnectTokenResponse,
|
|
41147
|
+
responseStream: false,
|
|
41148
|
+
options: {}
|
|
41149
|
+
},
|
|
40930
41150
|
sandboxGetFromName: {
|
|
40931
41151
|
name: "SandboxGetFromName",
|
|
40932
41152
|
requestType: SandboxGetFromNameRequest,
|
|
@@ -42237,6 +42457,33 @@ var Tunnel = class {
|
|
|
42237
42457
|
return [this.unencryptedHost, this.unencryptedPort];
|
|
42238
42458
|
}
|
|
42239
42459
|
};
|
|
42460
|
+
function defaultSandboxPTYInfo() {
|
|
42461
|
+
return PTYInfo.create({
|
|
42462
|
+
enabled: true,
|
|
42463
|
+
winszRows: 24,
|
|
42464
|
+
winszCols: 80,
|
|
42465
|
+
envTerm: "xterm-256color",
|
|
42466
|
+
envColorterm: "truecolor",
|
|
42467
|
+
envTermProgram: "",
|
|
42468
|
+
ptyType: 2 /* PTY_TYPE_SHELL */,
|
|
42469
|
+
noTerminateOnIdleStdin: true
|
|
42470
|
+
});
|
|
42471
|
+
}
|
|
42472
|
+
function containerExecRequestProto(taskId, command, options) {
|
|
42473
|
+
const secretIds = options?.secrets ? options.secrets.map((secret) => secret.secretId) : [];
|
|
42474
|
+
let ptyInfo;
|
|
42475
|
+
if (options?.pty) {
|
|
42476
|
+
ptyInfo = defaultSandboxPTYInfo();
|
|
42477
|
+
}
|
|
42478
|
+
return ContainerExecRequest.create({
|
|
42479
|
+
taskId,
|
|
42480
|
+
command,
|
|
42481
|
+
workdir: options?.workdir,
|
|
42482
|
+
timeoutSecs: options?.timeout ? options.timeout / 1e3 : 0,
|
|
42483
|
+
secretIds,
|
|
42484
|
+
ptyInfo
|
|
42485
|
+
});
|
|
42486
|
+
}
|
|
42240
42487
|
var Sandbox2 = class _Sandbox {
|
|
42241
42488
|
sandboxId;
|
|
42242
42489
|
stdin;
|
|
@@ -42341,14 +42588,8 @@ var Sandbox2 = class _Sandbox {
|
|
|
42341
42588
|
}
|
|
42342
42589
|
async exec(command, options) {
|
|
42343
42590
|
const taskId = await this.#getTaskId();
|
|
42344
|
-
const
|
|
42345
|
-
const resp = await client.containerExec(
|
|
42346
|
-
taskId,
|
|
42347
|
-
command,
|
|
42348
|
-
workdir: options?.workdir,
|
|
42349
|
-
timeoutSecs: options?.timeout ? options.timeout / 1e3 : 0,
|
|
42350
|
-
secretIds
|
|
42351
|
-
});
|
|
42591
|
+
const req = containerExecRequestProto(taskId, command, options);
|
|
42592
|
+
const resp = await client.containerExec(req);
|
|
42352
42593
|
return new ContainerProcess(resp.execId, options);
|
|
42353
42594
|
}
|
|
42354
42595
|
async #getTaskId() {
|
|
@@ -42735,6 +42976,117 @@ function parseGpuConfig(gpu) {
|
|
|
42735
42976
|
gpuType: gpuType.toUpperCase()
|
|
42736
42977
|
};
|
|
42737
42978
|
}
|
|
42979
|
+
function sandboxCreateRequestProto(appId, imageId, options = {}) {
|
|
42980
|
+
const gpuConfig = parseGpuConfig(options.gpu);
|
|
42981
|
+
if (options.timeout && options.timeout % 1e3 !== 0) {
|
|
42982
|
+
throw new Error(
|
|
42983
|
+
`timeout must be a multiple of 1000ms, got ${options.timeout}`
|
|
42984
|
+
);
|
|
42985
|
+
}
|
|
42986
|
+
if (options.idleTimeout && options.idleTimeout % 1e3 !== 0) {
|
|
42987
|
+
throw new Error(
|
|
42988
|
+
`idleTimeout must be a multiple of 1000ms, got ${options.idleTimeout}`
|
|
42989
|
+
);
|
|
42990
|
+
}
|
|
42991
|
+
if (options.workdir && !options.workdir.startsWith("/")) {
|
|
42992
|
+
throw new Error(
|
|
42993
|
+
`workdir must be an absolute path, got: ${options.workdir}`
|
|
42994
|
+
);
|
|
42995
|
+
}
|
|
42996
|
+
const volumeMounts = options.volumes ? Object.entries(options.volumes).map(([mountPath, volume]) => ({
|
|
42997
|
+
volumeId: volume.volumeId,
|
|
42998
|
+
mountPath,
|
|
42999
|
+
allowBackgroundCommits: true,
|
|
43000
|
+
readOnly: volume.isReadOnly
|
|
43001
|
+
})) : [];
|
|
43002
|
+
const cloudBucketMounts = options.cloudBucketMounts ? Object.entries(options.cloudBucketMounts).map(
|
|
43003
|
+
([mountPath, mount]) => cloudBucketMountToProto(mount, mountPath)
|
|
43004
|
+
) : [];
|
|
43005
|
+
const openPorts = [];
|
|
43006
|
+
if (options.encryptedPorts) {
|
|
43007
|
+
openPorts.push(
|
|
43008
|
+
...options.encryptedPorts.map((port) => ({
|
|
43009
|
+
port,
|
|
43010
|
+
unencrypted: false
|
|
43011
|
+
}))
|
|
43012
|
+
);
|
|
43013
|
+
}
|
|
43014
|
+
if (options.h2Ports) {
|
|
43015
|
+
openPorts.push(
|
|
43016
|
+
...options.h2Ports.map((port) => ({
|
|
43017
|
+
port,
|
|
43018
|
+
unencrypted: false,
|
|
43019
|
+
tunnelType: 1 /* TUNNEL_TYPE_H2 */
|
|
43020
|
+
}))
|
|
43021
|
+
);
|
|
43022
|
+
}
|
|
43023
|
+
if (options.unencryptedPorts) {
|
|
43024
|
+
openPorts.push(
|
|
43025
|
+
...options.unencryptedPorts.map((port) => ({
|
|
43026
|
+
port,
|
|
43027
|
+
unencrypted: true
|
|
43028
|
+
}))
|
|
43029
|
+
);
|
|
43030
|
+
}
|
|
43031
|
+
const secretIds = options.secrets ? options.secrets.map((secret) => secret.secretId) : [];
|
|
43032
|
+
let networkAccess;
|
|
43033
|
+
if (options.blockNetwork) {
|
|
43034
|
+
if (options.cidrAllowlist) {
|
|
43035
|
+
throw new Error(
|
|
43036
|
+
"cidrAllowlist cannot be used when blockNetwork is enabled"
|
|
43037
|
+
);
|
|
43038
|
+
}
|
|
43039
|
+
networkAccess = {
|
|
43040
|
+
networkAccessType: 2 /* BLOCKED */,
|
|
43041
|
+
allowedCidrs: []
|
|
43042
|
+
};
|
|
43043
|
+
} else if (options.cidrAllowlist) {
|
|
43044
|
+
networkAccess = {
|
|
43045
|
+
networkAccessType: 3 /* ALLOWLIST */,
|
|
43046
|
+
allowedCidrs: options.cidrAllowlist
|
|
43047
|
+
};
|
|
43048
|
+
} else {
|
|
43049
|
+
networkAccess = {
|
|
43050
|
+
networkAccessType: 1 /* OPEN */,
|
|
43051
|
+
allowedCidrs: []
|
|
43052
|
+
};
|
|
43053
|
+
}
|
|
43054
|
+
const schedulerPlacement = SchedulerPlacement.create({
|
|
43055
|
+
regions: options.regions ?? []
|
|
43056
|
+
});
|
|
43057
|
+
let ptyInfo;
|
|
43058
|
+
if (options.pty) {
|
|
43059
|
+
ptyInfo = defaultSandboxPTYInfo();
|
|
43060
|
+
}
|
|
43061
|
+
return SandboxCreateRequest.create({
|
|
43062
|
+
appId,
|
|
43063
|
+
definition: {
|
|
43064
|
+
// Sleep default is implicit in image builder version <=2024.10
|
|
43065
|
+
entrypointArgs: options.command ?? ["sleep", "48h"],
|
|
43066
|
+
imageId,
|
|
43067
|
+
timeoutSecs: options.timeout != void 0 ? options.timeout / 1e3 : 600,
|
|
43068
|
+
idleTimeoutSecs: options.idleTimeout != void 0 ? options.idleTimeout / 1e3 : void 0,
|
|
43069
|
+
workdir: options.workdir ?? void 0,
|
|
43070
|
+
networkAccess,
|
|
43071
|
+
resources: {
|
|
43072
|
+
// https://modal.com/docs/guide/resources
|
|
43073
|
+
milliCpu: Math.round(1e3 * (options.cpu ?? 0.125)),
|
|
43074
|
+
memoryMb: options.memory ?? 128,
|
|
43075
|
+
gpuConfig
|
|
43076
|
+
},
|
|
43077
|
+
volumeMounts,
|
|
43078
|
+
cloudBucketMounts,
|
|
43079
|
+
ptyInfo,
|
|
43080
|
+
secretIds,
|
|
43081
|
+
openPorts: openPorts.length > 0 ? { ports: openPorts } : void 0,
|
|
43082
|
+
cloudProviderStr: options.cloud ?? "",
|
|
43083
|
+
schedulerPlacement,
|
|
43084
|
+
verbose: options.verbose ?? false,
|
|
43085
|
+
proxyId: options.proxy?.proxyId,
|
|
43086
|
+
name: options.name
|
|
43087
|
+
}
|
|
43088
|
+
});
|
|
43089
|
+
}
|
|
42738
43090
|
var App2 = class _App {
|
|
42739
43091
|
appId;
|
|
42740
43092
|
name;
|
|
@@ -42759,113 +43111,15 @@ var App2 = class _App {
|
|
|
42759
43111
|
}
|
|
42760
43112
|
}
|
|
42761
43113
|
async createSandbox(image, options = {}) {
|
|
42762
|
-
const gpuConfig = parseGpuConfig(options.gpu);
|
|
42763
|
-
if (options.timeout && options.timeout % 1e3 !== 0) {
|
|
42764
|
-
throw new Error(
|
|
42765
|
-
`timeout must be a multiple of 1000ms, got ${options.timeout}`
|
|
42766
|
-
);
|
|
42767
|
-
}
|
|
42768
|
-
if (options.idleTimeout && options.idleTimeout % 1e3 !== 0) {
|
|
42769
|
-
throw new Error(
|
|
42770
|
-
`idleTimeout must be a multiple of 1000ms, got ${options.idleTimeout}`
|
|
42771
|
-
);
|
|
42772
|
-
}
|
|
42773
43114
|
await image.build(this);
|
|
42774
|
-
|
|
42775
|
-
|
|
42776
|
-
|
|
42777
|
-
|
|
42778
|
-
|
|
42779
|
-
const volumeMounts = options.volumes ? Object.entries(options.volumes).map(([mountPath, volume]) => ({
|
|
42780
|
-
volumeId: volume.volumeId,
|
|
42781
|
-
mountPath,
|
|
42782
|
-
allowBackgroundCommits: true,
|
|
42783
|
-
readOnly: volume.isReadOnly
|
|
42784
|
-
})) : [];
|
|
42785
|
-
const cloudBucketMounts = options.cloudBucketMounts ? Object.entries(options.cloudBucketMounts).map(
|
|
42786
|
-
([mountPath, mount]) => cloudBucketMountToProto(mount, mountPath)
|
|
42787
|
-
) : [];
|
|
42788
|
-
const openPorts = [];
|
|
42789
|
-
if (options.encryptedPorts) {
|
|
42790
|
-
openPorts.push(
|
|
42791
|
-
...options.encryptedPorts.map((port) => ({
|
|
42792
|
-
port,
|
|
42793
|
-
unencrypted: false
|
|
42794
|
-
}))
|
|
42795
|
-
);
|
|
42796
|
-
}
|
|
42797
|
-
if (options.h2Ports) {
|
|
42798
|
-
openPorts.push(
|
|
42799
|
-
...options.h2Ports.map((port) => ({
|
|
42800
|
-
port,
|
|
42801
|
-
unencrypted: false,
|
|
42802
|
-
tunnelType: 1 /* TUNNEL_TYPE_H2 */
|
|
42803
|
-
}))
|
|
42804
|
-
);
|
|
42805
|
-
}
|
|
42806
|
-
if (options.unencryptedPorts) {
|
|
42807
|
-
openPorts.push(
|
|
42808
|
-
...options.unencryptedPorts.map((port) => ({
|
|
42809
|
-
port,
|
|
42810
|
-
unencrypted: true
|
|
42811
|
-
}))
|
|
42812
|
-
);
|
|
42813
|
-
}
|
|
42814
|
-
const secretIds = options.secrets ? options.secrets.map((secret) => secret.secretId) : [];
|
|
42815
|
-
let networkAccess;
|
|
42816
|
-
if (options.blockNetwork) {
|
|
42817
|
-
if (options.cidrAllowlist) {
|
|
42818
|
-
throw new Error(
|
|
42819
|
-
"cidrAllowlist cannot be used when blockNetwork is enabled"
|
|
42820
|
-
);
|
|
42821
|
-
}
|
|
42822
|
-
networkAccess = {
|
|
42823
|
-
networkAccessType: 2 /* BLOCKED */,
|
|
42824
|
-
allowedCidrs: []
|
|
42825
|
-
};
|
|
42826
|
-
} else if (options.cidrAllowlist) {
|
|
42827
|
-
networkAccess = {
|
|
42828
|
-
networkAccessType: 3 /* ALLOWLIST */,
|
|
42829
|
-
allowedCidrs: options.cidrAllowlist
|
|
42830
|
-
};
|
|
42831
|
-
} else {
|
|
42832
|
-
networkAccess = {
|
|
42833
|
-
networkAccessType: 1 /* OPEN */,
|
|
42834
|
-
allowedCidrs: []
|
|
42835
|
-
};
|
|
42836
|
-
}
|
|
42837
|
-
const schedulerPlacement = SchedulerPlacement.create({
|
|
42838
|
-
regions: options.regions ?? []
|
|
42839
|
-
});
|
|
43115
|
+
const createReq = sandboxCreateRequestProto(
|
|
43116
|
+
this.appId,
|
|
43117
|
+
image.imageId,
|
|
43118
|
+
options
|
|
43119
|
+
);
|
|
42840
43120
|
let createResp;
|
|
42841
43121
|
try {
|
|
42842
|
-
createResp = await client.sandboxCreate(
|
|
42843
|
-
appId: this.appId,
|
|
42844
|
-
definition: {
|
|
42845
|
-
// Sleep default is implicit in image builder version <=2024.10
|
|
42846
|
-
entrypointArgs: options.command ?? ["sleep", "48h"],
|
|
42847
|
-
imageId: image.imageId,
|
|
42848
|
-
timeoutSecs: options.timeout != void 0 ? options.timeout / 1e3 : 600,
|
|
42849
|
-
idleTimeoutSecs: options.idleTimeout != void 0 ? options.idleTimeout / 1e3 : void 0,
|
|
42850
|
-
workdir: options.workdir ?? void 0,
|
|
42851
|
-
networkAccess,
|
|
42852
|
-
resources: {
|
|
42853
|
-
// https://modal.com/docs/guide/resources
|
|
42854
|
-
milliCpu: Math.round(1e3 * (options.cpu ?? 0.125)),
|
|
42855
|
-
memoryMb: options.memory ?? 128,
|
|
42856
|
-
gpuConfig
|
|
42857
|
-
},
|
|
42858
|
-
volumeMounts,
|
|
42859
|
-
cloudBucketMounts,
|
|
42860
|
-
secretIds,
|
|
42861
|
-
openPorts: openPorts.length > 0 ? { ports: openPorts } : void 0,
|
|
42862
|
-
cloudProviderStr: options.cloud ?? "",
|
|
42863
|
-
schedulerPlacement,
|
|
42864
|
-
verbose: options.verbose ?? false,
|
|
42865
|
-
proxyId: options.proxy?.proxyId,
|
|
42866
|
-
name: options.name
|
|
42867
|
-
}
|
|
42868
|
-
});
|
|
43122
|
+
createResp = await client.sandboxCreate(createReq);
|
|
42869
43123
|
} catch (err) {
|
|
42870
43124
|
if (err instanceof import_nice_grpc6.ClientError && err.code === import_nice_grpc6.Status.ALREADY_EXISTS) {
|
|
42871
43125
|
throw new AlreadyExistsError(err.details || err.message);
|
package/dist/index.d.cts
CHANGED
|
@@ -283,6 +283,8 @@ type ExecOptions = {
|
|
|
283
283
|
timeout?: number;
|
|
284
284
|
/** Secrets with environment variables for the command. */
|
|
285
285
|
secrets?: Secret[];
|
|
286
|
+
/** Enable a PTY for the command. */
|
|
287
|
+
pty?: boolean;
|
|
286
288
|
};
|
|
287
289
|
/** A port forwarded from within a running Modal Sandbox. */
|
|
288
290
|
declare class Tunnel {
|
|
@@ -485,6 +487,8 @@ type SandboxCreateOptions = {
|
|
|
485
487
|
volumes?: Record<string, Volume>;
|
|
486
488
|
/** Mount points for cloud buckets. */
|
|
487
489
|
cloudBucketMounts?: Record<string, CloudBucketMount>;
|
|
490
|
+
/** Enable a PTY for the Sandbox. */
|
|
491
|
+
pty?: boolean;
|
|
488
492
|
/** List of ports to tunnel into the Sandbox. Encrypted ports are tunneled with TLS. */
|
|
489
493
|
encryptedPorts?: number[];
|
|
490
494
|
/** List of encrypted ports to tunnel into the Sandbox, using HTTP/2. */
|