modal 0.8.1 → 0.8.2

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 CHANGED
@@ -61,6 +61,7 @@ We also provide a number of examples:
61
61
  and same but
62
62
  [with an ephemeral Volume](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-volume-ephemeral.ts)
63
63
  - [Mount a cloud bucket to a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-cloud-bucket.ts)
64
+ - [Update the outbound network policy of a running Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-network-policy.ts)
64
65
  - [Eagerly build an Image for a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-prewarm.ts)
65
66
  - [Building custom Images](https://github.com/modal-labs/modal-client/blob/main/js/examples/image-building.ts)
66
67
  - [Add telemetry and tracing with custom middleware](https://github.com/modal-labs/modal-client/blob/main/js/examples/telemetry.ts)
package/dist/index.cjs CHANGED
@@ -13486,13 +13486,16 @@ var ContainerReloadVolumesResponse = {
13486
13486
  }
13487
13487
  };
13488
13488
  function createBaseContainerStopRequest() {
13489
- return { taskId: "" };
13489
+ return { taskId: "", graceful: false };
13490
13490
  }
13491
13491
  var ContainerStopRequest = {
13492
13492
  encode(message, writer = new BinaryWriter()) {
13493
13493
  if (message.taskId !== "") {
13494
13494
  writer.uint32(10).string(message.taskId);
13495
13495
  }
13496
+ if (message.graceful !== false) {
13497
+ writer.uint32(16).bool(message.graceful);
13498
+ }
13496
13499
  return writer;
13497
13500
  },
13498
13501
  decode(input, length) {
@@ -13509,6 +13512,13 @@ var ContainerStopRequest = {
13509
13512
  message.taskId = reader.string();
13510
13513
  continue;
13511
13514
  }
13515
+ case 2: {
13516
+ if (tag !== 16) {
13517
+ break;
13518
+ }
13519
+ message.graceful = reader.bool();
13520
+ continue;
13521
+ }
13512
13522
  }
13513
13523
  if ((tag & 7) === 4 || tag === 0) {
13514
13524
  break;
@@ -13518,13 +13528,19 @@ var ContainerStopRequest = {
13518
13528
  return message;
13519
13529
  },
13520
13530
  fromJSON(object) {
13521
- return { taskId: isSet5(object.taskId) ? globalThis.String(object.taskId) : "" };
13531
+ return {
13532
+ taskId: isSet5(object.taskId) ? globalThis.String(object.taskId) : "",
13533
+ graceful: isSet5(object.graceful) ? globalThis.Boolean(object.graceful) : false
13534
+ };
13522
13535
  },
13523
13536
  toJSON(message) {
13524
13537
  const obj = {};
13525
13538
  if (message.taskId !== "") {
13526
13539
  obj.taskId = message.taskId;
13527
13540
  }
13541
+ if (message.graceful !== false) {
13542
+ obj.graceful = message.graceful;
13543
+ }
13528
13544
  return obj;
13529
13545
  },
13530
13546
  create(base) {
@@ -13533,6 +13549,7 @@ var ContainerStopRequest = {
13533
13549
  fromPartial(object) {
13534
13550
  const message = createBaseContainerStopRequest();
13535
13551
  message.taskId = object.taskId ?? "";
13552
+ message.graceful = object.graceful ?? false;
13536
13553
  return message;
13537
13554
  }
13538
13555
  };
@@ -26043,7 +26060,8 @@ function createBaseFunctionOptions() {
26043
26060
  cloudProviderStr: void 0,
26044
26061
  replaceCloudBucketMounts: false,
26045
26062
  cloudBucketMounts: [],
26046
- pinnedAppVersion: void 0
26063
+ pinnedAppVersion: void 0,
26064
+ routingRegion: void 0
26047
26065
  };
26048
26066
  }
26049
26067
  var FunctionOptions = {
@@ -26111,6 +26129,9 @@ var FunctionOptions = {
26111
26129
  if (message.pinnedAppVersion !== void 0) {
26112
26130
  writer.uint32(168).int32(message.pinnedAppVersion);
26113
26131
  }
26132
+ if (message.routingRegion !== void 0) {
26133
+ writer.uint32(178).string(message.routingRegion);
26134
+ }
26114
26135
  return writer;
26115
26136
  },
26116
26137
  decode(input, length) {
@@ -26267,6 +26288,13 @@ var FunctionOptions = {
26267
26288
  message.pinnedAppVersion = reader.int32();
26268
26289
  continue;
26269
26290
  }
26291
+ case 22: {
26292
+ if (tag !== 178) {
26293
+ break;
26294
+ }
26295
+ message.routingRegion = reader.string();
26296
+ continue;
26297
+ }
26270
26298
  }
26271
26299
  if ((tag & 7) === 4 || tag === 0) {
26272
26300
  break;
@@ -26297,7 +26325,8 @@ var FunctionOptions = {
26297
26325
  cloudProviderStr: isSet5(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : void 0,
26298
26326
  replaceCloudBucketMounts: isSet5(object.replaceCloudBucketMounts) ? globalThis.Boolean(object.replaceCloudBucketMounts) : false,
26299
26327
  cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [],
26300
- pinnedAppVersion: isSet5(object.pinnedAppVersion) ? globalThis.Number(object.pinnedAppVersion) : void 0
26328
+ pinnedAppVersion: isSet5(object.pinnedAppVersion) ? globalThis.Number(object.pinnedAppVersion) : void 0,
26329
+ routingRegion: isSet5(object.routingRegion) ? globalThis.String(object.routingRegion) : void 0
26301
26330
  };
26302
26331
  },
26303
26332
  toJSON(message) {
@@ -26365,6 +26394,9 @@ var FunctionOptions = {
26365
26394
  if (message.pinnedAppVersion !== void 0) {
26366
26395
  obj.pinnedAppVersion = Math.round(message.pinnedAppVersion);
26367
26396
  }
26397
+ if (message.routingRegion !== void 0) {
26398
+ obj.routingRegion = message.routingRegion;
26399
+ }
26368
26400
  return obj;
26369
26401
  },
26370
26402
  create(base) {
@@ -26393,6 +26425,7 @@ var FunctionOptions = {
26393
26425
  message.replaceCloudBucketMounts = object.replaceCloudBucketMounts ?? false;
26394
26426
  message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || [];
26395
26427
  message.pinnedAppVersion = object.pinnedAppVersion ?? void 0;
26428
+ message.routingRegion = object.routingRegion ?? void 0;
26396
26429
  return message;
26397
26430
  }
26398
26431
  };
@@ -30426,7 +30459,7 @@ var ImageRegistryConfig = {
30426
30459
  }
30427
30460
  };
30428
30461
  function createBaseImageTagRevisionsItem() {
30429
- return { imageId: "", revisionId: "", createdAt: 0 };
30462
+ return { imageId: "", revisionId: "", createdAt: 0, publishedBy: "" };
30430
30463
  }
30431
30464
  var ImageTagRevisionsItem = {
30432
30465
  encode(message, writer = new BinaryWriter()) {
@@ -30439,6 +30472,9 @@ var ImageTagRevisionsItem = {
30439
30472
  if (message.createdAt !== 0) {
30440
30473
  writer.uint32(25).double(message.createdAt);
30441
30474
  }
30475
+ if (message.publishedBy !== "") {
30476
+ writer.uint32(34).string(message.publishedBy);
30477
+ }
30442
30478
  return writer;
30443
30479
  },
30444
30480
  decode(input, length) {
@@ -30469,6 +30505,13 @@ var ImageTagRevisionsItem = {
30469
30505
  message.createdAt = reader.double();
30470
30506
  continue;
30471
30507
  }
30508
+ case 4: {
30509
+ if (tag !== 34) {
30510
+ break;
30511
+ }
30512
+ message.publishedBy = reader.string();
30513
+ continue;
30514
+ }
30472
30515
  }
30473
30516
  if ((tag & 7) === 4 || tag === 0) {
30474
30517
  break;
@@ -30481,7 +30524,8 @@ var ImageTagRevisionsItem = {
30481
30524
  return {
30482
30525
  imageId: isSet5(object.imageId) ? globalThis.String(object.imageId) : "",
30483
30526
  revisionId: isSet5(object.revisionId) ? globalThis.String(object.revisionId) : "",
30484
- createdAt: isSet5(object.createdAt) ? globalThis.Number(object.createdAt) : 0
30527
+ createdAt: isSet5(object.createdAt) ? globalThis.Number(object.createdAt) : 0,
30528
+ publishedBy: isSet5(object.publishedBy) ? globalThis.String(object.publishedBy) : ""
30485
30529
  };
30486
30530
  },
30487
30531
  toJSON(message) {
@@ -30495,6 +30539,9 @@ var ImageTagRevisionsItem = {
30495
30539
  if (message.createdAt !== 0) {
30496
30540
  obj.createdAt = message.createdAt;
30497
30541
  }
30542
+ if (message.publishedBy !== "") {
30543
+ obj.publishedBy = message.publishedBy;
30544
+ }
30498
30545
  return obj;
30499
30546
  },
30500
30547
  create(base) {
@@ -30505,6 +30552,7 @@ var ImageTagRevisionsItem = {
30505
30552
  message.imageId = object.imageId ?? "";
30506
30553
  message.revisionId = object.revisionId ?? "";
30507
30554
  message.createdAt = object.createdAt ?? 0;
30555
+ message.publishedBy = object.publishedBy ?? "";
30508
30556
  return message;
30509
30557
  }
30510
30558
  };
@@ -51444,6 +51492,231 @@ var WorkspaceNameLookupResponse = {
51444
51492
  return message;
51445
51493
  }
51446
51494
  };
51495
+ function createBaseWorkspaceSetDefaultEnvironmentRequest() {
51496
+ return { environmentName: "" };
51497
+ }
51498
+ var WorkspaceSetDefaultEnvironmentRequest = {
51499
+ encode(message, writer = new BinaryWriter()) {
51500
+ if (message.environmentName !== "") {
51501
+ writer.uint32(10).string(message.environmentName);
51502
+ }
51503
+ return writer;
51504
+ },
51505
+ decode(input, length) {
51506
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
51507
+ let end = length === void 0 ? reader.len : reader.pos + length;
51508
+ const message = createBaseWorkspaceSetDefaultEnvironmentRequest();
51509
+ while (reader.pos < end) {
51510
+ const tag = reader.uint32();
51511
+ switch (tag >>> 3) {
51512
+ case 1: {
51513
+ if (tag !== 10) {
51514
+ break;
51515
+ }
51516
+ message.environmentName = reader.string();
51517
+ continue;
51518
+ }
51519
+ }
51520
+ if ((tag & 7) === 4 || tag === 0) {
51521
+ break;
51522
+ }
51523
+ reader.skip(tag & 7);
51524
+ }
51525
+ return message;
51526
+ },
51527
+ fromJSON(object) {
51528
+ return { environmentName: isSet5(object.environmentName) ? globalThis.String(object.environmentName) : "" };
51529
+ },
51530
+ toJSON(message) {
51531
+ const obj = {};
51532
+ if (message.environmentName !== "") {
51533
+ obj.environmentName = message.environmentName;
51534
+ }
51535
+ return obj;
51536
+ },
51537
+ create(base) {
51538
+ return WorkspaceSetDefaultEnvironmentRequest.fromPartial(base ?? {});
51539
+ },
51540
+ fromPartial(object) {
51541
+ const message = createBaseWorkspaceSetDefaultEnvironmentRequest();
51542
+ message.environmentName = object.environmentName ?? "";
51543
+ return message;
51544
+ }
51545
+ };
51546
+ function createBaseWorkspaceSetImageBuilderVersionRequest() {
51547
+ return { newImageBuilderVersion: "" };
51548
+ }
51549
+ var WorkspaceSetImageBuilderVersionRequest = {
51550
+ encode(message, writer = new BinaryWriter()) {
51551
+ if (message.newImageBuilderVersion !== "") {
51552
+ writer.uint32(10).string(message.newImageBuilderVersion);
51553
+ }
51554
+ return writer;
51555
+ },
51556
+ decode(input, length) {
51557
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
51558
+ let end = length === void 0 ? reader.len : reader.pos + length;
51559
+ const message = createBaseWorkspaceSetImageBuilderVersionRequest();
51560
+ while (reader.pos < end) {
51561
+ const tag = reader.uint32();
51562
+ switch (tag >>> 3) {
51563
+ case 1: {
51564
+ if (tag !== 10) {
51565
+ break;
51566
+ }
51567
+ message.newImageBuilderVersion = reader.string();
51568
+ continue;
51569
+ }
51570
+ }
51571
+ if ((tag & 7) === 4 || tag === 0) {
51572
+ break;
51573
+ }
51574
+ reader.skip(tag & 7);
51575
+ }
51576
+ return message;
51577
+ },
51578
+ fromJSON(object) {
51579
+ return {
51580
+ newImageBuilderVersion: isSet5(object.newImageBuilderVersion) ? globalThis.String(object.newImageBuilderVersion) : ""
51581
+ };
51582
+ },
51583
+ toJSON(message) {
51584
+ const obj = {};
51585
+ if (message.newImageBuilderVersion !== "") {
51586
+ obj.newImageBuilderVersion = message.newImageBuilderVersion;
51587
+ }
51588
+ return obj;
51589
+ },
51590
+ create(base) {
51591
+ return WorkspaceSetImageBuilderVersionRequest.fromPartial(base ?? {});
51592
+ },
51593
+ fromPartial(object) {
51594
+ const message = createBaseWorkspaceSetImageBuilderVersionRequest();
51595
+ message.newImageBuilderVersion = object.newImageBuilderVersion ?? "";
51596
+ return message;
51597
+ }
51598
+ };
51599
+ function createBaseWorkspaceSetImageBuilderVersionResponse() {
51600
+ return { imageBuilderVersion: "" };
51601
+ }
51602
+ var WorkspaceSetImageBuilderVersionResponse = {
51603
+ encode(message, writer = new BinaryWriter()) {
51604
+ if (message.imageBuilderVersion !== "") {
51605
+ writer.uint32(10).string(message.imageBuilderVersion);
51606
+ }
51607
+ return writer;
51608
+ },
51609
+ decode(input, length) {
51610
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
51611
+ let end = length === void 0 ? reader.len : reader.pos + length;
51612
+ const message = createBaseWorkspaceSetImageBuilderVersionResponse();
51613
+ while (reader.pos < end) {
51614
+ const tag = reader.uint32();
51615
+ switch (tag >>> 3) {
51616
+ case 1: {
51617
+ if (tag !== 10) {
51618
+ break;
51619
+ }
51620
+ message.imageBuilderVersion = reader.string();
51621
+ continue;
51622
+ }
51623
+ }
51624
+ if ((tag & 7) === 4 || tag === 0) {
51625
+ break;
51626
+ }
51627
+ reader.skip(tag & 7);
51628
+ }
51629
+ return message;
51630
+ },
51631
+ fromJSON(object) {
51632
+ return {
51633
+ imageBuilderVersion: isSet5(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : ""
51634
+ };
51635
+ },
51636
+ toJSON(message) {
51637
+ const obj = {};
51638
+ if (message.imageBuilderVersion !== "") {
51639
+ obj.imageBuilderVersion = message.imageBuilderVersion;
51640
+ }
51641
+ return obj;
51642
+ },
51643
+ create(base) {
51644
+ return WorkspaceSetImageBuilderVersionResponse.fromPartial(base ?? {});
51645
+ },
51646
+ fromPartial(object) {
51647
+ const message = createBaseWorkspaceSetImageBuilderVersionResponse();
51648
+ message.imageBuilderVersion = object.imageBuilderVersion ?? "";
51649
+ return message;
51650
+ }
51651
+ };
51652
+ function createBaseWorkspaceSettingsResponse() {
51653
+ return { defaultEnvironmentName: "", imageBuilderVersion: "" };
51654
+ }
51655
+ var WorkspaceSettingsResponse = {
51656
+ encode(message, writer = new BinaryWriter()) {
51657
+ if (message.defaultEnvironmentName !== "") {
51658
+ writer.uint32(10).string(message.defaultEnvironmentName);
51659
+ }
51660
+ if (message.imageBuilderVersion !== "") {
51661
+ writer.uint32(18).string(message.imageBuilderVersion);
51662
+ }
51663
+ return writer;
51664
+ },
51665
+ decode(input, length) {
51666
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
51667
+ let end = length === void 0 ? reader.len : reader.pos + length;
51668
+ const message = createBaseWorkspaceSettingsResponse();
51669
+ while (reader.pos < end) {
51670
+ const tag = reader.uint32();
51671
+ switch (tag >>> 3) {
51672
+ case 1: {
51673
+ if (tag !== 10) {
51674
+ break;
51675
+ }
51676
+ message.defaultEnvironmentName = reader.string();
51677
+ continue;
51678
+ }
51679
+ case 2: {
51680
+ if (tag !== 18) {
51681
+ break;
51682
+ }
51683
+ message.imageBuilderVersion = reader.string();
51684
+ continue;
51685
+ }
51686
+ }
51687
+ if ((tag & 7) === 4 || tag === 0) {
51688
+ break;
51689
+ }
51690
+ reader.skip(tag & 7);
51691
+ }
51692
+ return message;
51693
+ },
51694
+ fromJSON(object) {
51695
+ return {
51696
+ defaultEnvironmentName: isSet5(object.defaultEnvironmentName) ? globalThis.String(object.defaultEnvironmentName) : "",
51697
+ imageBuilderVersion: isSet5(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : ""
51698
+ };
51699
+ },
51700
+ toJSON(message) {
51701
+ const obj = {};
51702
+ if (message.defaultEnvironmentName !== "") {
51703
+ obj.defaultEnvironmentName = message.defaultEnvironmentName;
51704
+ }
51705
+ if (message.imageBuilderVersion !== "") {
51706
+ obj.imageBuilderVersion = message.imageBuilderVersion;
51707
+ }
51708
+ return obj;
51709
+ },
51710
+ create(base) {
51711
+ return WorkspaceSettingsResponse.fromPartial(base ?? {});
51712
+ },
51713
+ fromPartial(object) {
51714
+ const message = createBaseWorkspaceSettingsResponse();
51715
+ message.defaultEnvironmentName = object.defaultEnvironmentName ?? "";
51716
+ message.imageBuilderVersion = object.imageBuilderVersion ?? "";
51717
+ return message;
51718
+ }
51719
+ };
51447
51720
  var ModalClientDefinition = {
51448
51721
  name: "ModalClient",
51449
51722
  fullName: "modal.client.ModalClient",
@@ -53228,6 +53501,30 @@ var ModalClientDefinition = {
53228
53501
  responseType: WorkspaceNameLookupResponse,
53229
53502
  responseStream: false,
53230
53503
  options: {}
53504
+ },
53505
+ workspaceSetDefaultEnvironment: {
53506
+ name: "WorkspaceSetDefaultEnvironment",
53507
+ requestType: WorkspaceSetDefaultEnvironmentRequest,
53508
+ requestStream: false,
53509
+ responseType: Empty,
53510
+ responseStream: false,
53511
+ options: {}
53512
+ },
53513
+ workspaceSetImageBuilderVersion: {
53514
+ name: "WorkspaceSetImageBuilderVersion",
53515
+ requestType: WorkspaceSetImageBuilderVersionRequest,
53516
+ requestStream: false,
53517
+ responseType: WorkspaceSetImageBuilderVersionResponse,
53518
+ responseStream: false,
53519
+ options: {}
53520
+ },
53521
+ workspaceSettings: {
53522
+ name: "WorkspaceSettings",
53523
+ requestType: Empty,
53524
+ requestStream: false,
53525
+ responseType: WorkspaceSettingsResponse,
53526
+ responseStream: false,
53527
+ options: {}
53231
53528
  }
53232
53529
  }
53233
53530
  };
@@ -58501,6 +58798,94 @@ var TaskMountDirectoryRequest = {
58501
58798
  return message;
58502
58799
  }
58503
58800
  };
58801
+ function createBaseTaskReloadVolumesRequest() {
58802
+ return { taskId: "" };
58803
+ }
58804
+ var TaskReloadVolumesRequest = {
58805
+ encode(message, writer = new BinaryWriter()) {
58806
+ if (message.taskId !== "") {
58807
+ writer.uint32(10).string(message.taskId);
58808
+ }
58809
+ return writer;
58810
+ },
58811
+ decode(input, length) {
58812
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
58813
+ let end = length === void 0 ? reader.len : reader.pos + length;
58814
+ const message = createBaseTaskReloadVolumesRequest();
58815
+ while (reader.pos < end) {
58816
+ const tag = reader.uint32();
58817
+ switch (tag >>> 3) {
58818
+ case 1: {
58819
+ if (tag !== 10) {
58820
+ break;
58821
+ }
58822
+ message.taskId = reader.string();
58823
+ continue;
58824
+ }
58825
+ }
58826
+ if ((tag & 7) === 4 || tag === 0) {
58827
+ break;
58828
+ }
58829
+ reader.skip(tag & 7);
58830
+ }
58831
+ return message;
58832
+ },
58833
+ fromJSON(object) {
58834
+ return { taskId: isSet6(object.taskId) ? globalThis.String(object.taskId) : "" };
58835
+ },
58836
+ toJSON(message) {
58837
+ const obj = {};
58838
+ if (message.taskId !== "") {
58839
+ obj.taskId = message.taskId;
58840
+ }
58841
+ return obj;
58842
+ },
58843
+ create(base) {
58844
+ return TaskReloadVolumesRequest.fromPartial(base ?? {});
58845
+ },
58846
+ fromPartial(object) {
58847
+ const message = createBaseTaskReloadVolumesRequest();
58848
+ message.taskId = object.taskId ?? "";
58849
+ return message;
58850
+ }
58851
+ };
58852
+ function createBaseTaskReloadVolumesResponse() {
58853
+ return {};
58854
+ }
58855
+ var TaskReloadVolumesResponse = {
58856
+ encode(_, writer = new BinaryWriter()) {
58857
+ return writer;
58858
+ },
58859
+ decode(input, length) {
58860
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
58861
+ let end = length === void 0 ? reader.len : reader.pos + length;
58862
+ const message = createBaseTaskReloadVolumesResponse();
58863
+ while (reader.pos < end) {
58864
+ const tag = reader.uint32();
58865
+ switch (tag >>> 3) {
58866
+ }
58867
+ if ((tag & 7) === 4 || tag === 0) {
58868
+ break;
58869
+ }
58870
+ reader.skip(tag & 7);
58871
+ }
58872
+ return message;
58873
+ },
58874
+ fromJSON(_) {
58875
+ return {};
58876
+ },
58877
+ toJSON(_) {
58878
+ const obj = {};
58879
+ return obj;
58880
+ },
58881
+ create(base) {
58882
+ return TaskReloadVolumesResponse.fromPartial(base ?? {});
58883
+ },
58884
+ fromPartial(_) {
58885
+ const message = createBaseTaskReloadVolumesResponse();
58886
+ return message;
58887
+ }
58888
+ };
58504
58889
  function createBaseTaskSetNetworkAccessRequest() {
58505
58890
  return { taskId: "", networkAccess: void 0 };
58506
58891
  }
@@ -59146,6 +59531,15 @@ var TaskCommandRouterDefinition = {
59146
59531
  responseStream: false,
59147
59532
  options: {}
59148
59533
  },
59534
+ /** Reload all Volumes mounted in the task to reflect their latest committed state. */
59535
+ taskReloadVolumes: {
59536
+ name: "TaskReloadVolumes",
59537
+ requestType: TaskReloadVolumesRequest,
59538
+ requestStream: false,
59539
+ responseType: TaskReloadVolumesResponse,
59540
+ responseStream: false,
59541
+ options: {}
59542
+ },
59149
59543
  /** Replace the task's outbound network allowlist (domains + CIDRs). */
59150
59544
  taskSetNetworkAccess: {
59151
59545
  name: "TaskSetNetworkAccess",
@@ -59536,8 +59930,9 @@ var AuthTokenManager = class {
59536
59930
  };
59537
59931
 
59538
59932
  // src/version.ts
59933
+ var SDK_VERSION = "0.8.2";
59539
59934
  function getSDKVersion() {
59540
- return true ? "0.8.1" : "0.0.0";
59935
+ return SDK_VERSION;
59541
59936
  }
59542
59937
 
59543
59938
  // src/logger.ts
@@ -60433,6 +60828,13 @@ var TaskCommandRouterClientImpl = class _TaskCommandRouterClientImpl {
60433
60828
  async unmountDirectory(request) {
60434
60829
  await this.callUnary(() => this.stub.taskUnmountDirectory(request));
60435
60830
  }
60831
+ async setNetworkAccess(request) {
60832
+ await this.callUnary(() => this.stub.taskSetNetworkAccess(request));
60833
+ }
60834
+ /** Reload all Volumes mounted in the task to reflect their latest committed state. */
60835
+ async reloadVolumes(request) {
60836
+ await this.callUnary(() => this.stub.taskReloadVolumes(request));
60837
+ }
60436
60838
  async sandboxWaitUntilReady(taskId, timeoutMs) {
60437
60839
  const deadlineMs = Date.now() + timeoutMs;
60438
60840
  try {
@@ -62079,6 +62481,41 @@ var SandboxService = class {
62079
62481
  }
62080
62482
  }
62081
62483
  }
62484
+ /**
62485
+ * List the V2 {@link Sandbox}es in an {@link App}.
62486
+ *
62487
+ * This lists V2 Sandboxes, i.e. Sandboxes created via
62488
+ * {@link SandboxService#experimentalCreate client.sandboxes.experimentalCreate()}.
62489
+ * Such Sandboxes are not returned by
62490
+ * {@link SandboxService#list client.sandboxes.list()}. Filtering based on tags
62491
+ * is not yet supported.
62492
+ *
62493
+ * Yields {@link Sandbox} objects that are currently running in the App.
62494
+ *
62495
+ * EXPERIMENTAL: the API is subject to change.
62496
+ */
62497
+ async *experimentalList(params) {
62498
+ if (!params?.appId) {
62499
+ throw new InvalidError(
62500
+ 'experimentalList requires an `appId`:\n\nconst app = await modal.apps.fromName("my-app");\nmodal.sandboxes.experimentalList({ appId: app.appId });'
62501
+ );
62502
+ }
62503
+ let beforeTimestamp = void 0;
62504
+ while (true) {
62505
+ const resp = await this.#client.cpClient.sandboxListV2({
62506
+ appId: params.appId,
62507
+ beforeTimestamp,
62508
+ includeFinished: false
62509
+ });
62510
+ if (!resp.sandboxes || resp.sandboxes.length === 0) {
62511
+ return;
62512
+ }
62513
+ for (const info of resp.sandboxes) {
62514
+ yield new Sandbox2(this.#client, info.id, { isV2: true });
62515
+ }
62516
+ beforeTimestamp = resp.sandboxes[resp.sandboxes.length - 1].createdAt;
62517
+ }
62518
+ }
62082
62519
  };
62083
62520
  var Tunnel = class {
62084
62521
  /** @ignore */
@@ -62674,6 +63111,48 @@ var Sandbox2 = class _Sandbox {
62674
63111
  });
62675
63112
  await commandRouterClient.unmountDirectory(request);
62676
63113
  }
63114
+ /**
63115
+ * Updates the outbound network policy of a running Sandbox.
63116
+ *
63117
+ * Established connections that the new policy no longer permits are terminated.
63118
+ *
63119
+ * @param params - Both `outboundCidrAllowlist` and `outboundDomainAllowlist` must be provided.
63120
+ */
63121
+ async updateNetworkPolicy(params) {
63122
+ this.#ensureAttached();
63123
+ if (params.outboundCidrAllowlist === void 0 || params.outboundDomainAllowlist === void 0) {
63124
+ throw new InvalidError(
63125
+ "updateNetworkPolicy currently requires both outboundCidrAllowlist and outboundDomainAllowlist to be set"
63126
+ );
63127
+ }
63128
+ const [taskId, commandRouterClient] = await this.#getCommandRouter();
63129
+ const request = TaskSetNetworkAccessRequest.create({
63130
+ taskId,
63131
+ networkAccess: NetworkAccess.create({
63132
+ networkAccessType: 3 /* ALLOWLIST */,
63133
+ allowedCidrs: params.outboundCidrAllowlist,
63134
+ allowedDomains: params.outboundDomainAllowlist
63135
+ })
63136
+ });
63137
+ await commandRouterClient.setNetworkAccess(request);
63138
+ }
63139
+ /**
63140
+ * Reload all Volumes mounted in the Sandbox.
63141
+ */
63142
+ async reloadVolumes() {
63143
+ this.#ensureAttached();
63144
+ const taskId = await this.#getTaskId();
63145
+ if (this.#isV2) {
63146
+ const commandRouterClient = await this.#getOrCreateCommandRouterClient(taskId);
63147
+ await commandRouterClient.reloadVolumes(
63148
+ TaskReloadVolumesRequest.create({ taskId })
63149
+ );
63150
+ } else {
63151
+ await this.#client.cpClient.containerReloadVolumes(
63152
+ ContainerReloadVolumesRequest.create({ taskId })
63153
+ );
63154
+ }
63155
+ }
62677
63156
  /**
62678
63157
  * Snapshots and creates a new {@link Image} from a directory in the running sandbox.
62679
63158
  *