modal 0.10.2-dev.12 → 0.10.2-dev.13

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
@@ -51,6 +51,7 @@ We also provide a number of examples:
51
51
  - [Run a Sidecar and snapshot its filesystem](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-sidecar.ts)
52
52
  - [Persist a workspace across Sidecars](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-sidecar-directory-snapshot.ts)
53
53
  - [Mount a Volume in a Sidecar](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-sidecar-volume.ts)
54
+ - [Mount a cloud bucket in a Sidecar](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-sidecar-cloud-bucket.ts)
54
55
  - [Take a snapshot of the filesystem of a Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-filesystem-snapshot.ts)
55
56
  - [Snapshot the filesystem of a Sandbox when it exits](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-exit-snapshot.ts)
56
57
  - [Snapshot a directory, and mount it in a running Sandbox](https://github.com/modal-labs/modal-client/blob/main/js/examples/sandbox-directory-snapshot.ts)
package/dist/index.cjs CHANGED
@@ -3417,6 +3417,56 @@ function cloudBucketMount_MetadataTTLTypeToJSON(object) {
3417
3417
  return "UNRECOGNIZED";
3418
3418
  }
3419
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
+ }
3420
3470
  function fileEntry_FileTypeFromJSON(object) {
3421
3471
  switch (object) {
3422
3472
  case 0:
@@ -18348,6 +18398,407 @@ var EndpointGetByNameResponse = {
18348
18398
  return message;
18349
18399
  }
18350
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
+ };
18351
18802
  function createBaseEndpointGetLifecycleRequest() {
18352
18803
  return { endpointId: "" };
18353
18804
  }
@@ -61254,6 +61705,14 @@ var ModalClientDefinition = {
61254
61705
  responseStream: false,
61255
61706
  options: {}
61256
61707
  },
61708
+ endpointGetInfo: {
61709
+ name: "EndpointGetInfo",
61710
+ requestType: EndpointGetInfoRequest,
61711
+ requestStream: false,
61712
+ responseType: EndpointGetInfoResponse,
61713
+ responseStream: false,
61714
+ options: {}
61715
+ },
61257
61716
  endpointGetLifecycle: {
61258
61717
  name: "EndpointGetLifecycle",
61259
61718
  requestType: EndpointGetLifecycleRequest,
@@ -63433,6 +63892,16 @@ var CloudBucketMount2 = class {
63433
63892
  });
63434
63893
  }
63435
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
+ }
63436
63905
 
63437
63906
  // src/secret.ts
63438
63907
  var import_nice_grpc2 = require("nice-grpc");
@@ -63466,7 +63935,7 @@ var SecretService = class {
63466
63935
  "secret_name",
63467
63936
  name
63468
63937
  );
63469
- return new Secret(resp.secretId, name);
63938
+ return new Secret(resp.secretId, name, void 0, resp.metadata?.keys);
63470
63939
  } catch (err) {
63471
63940
  if (err instanceof import_nice_grpc2.ClientError && err.code === import_nice_grpc2.Status.NOT_FOUND)
63472
63941
  throw new NotFoundError(err.details);
@@ -63565,16 +64034,20 @@ var Secret = class {
63565
64034
  // constructed already-hydrated (e.g. from fromName), and not consulted again
63566
64035
  // once secretId is set.
63567
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;
63568
64040
  // Caches the single in-flight (or successfully completed) hydration so the
63569
64041
  // ephemeral Secret is created at most once, even if multiple callers hydrate
63570
64042
  // the same Secret concurrently. Cleared on failure so a transient error
63571
64043
  // doesn't permanently break the Secret; subsequent calls can retry.
63572
64044
  #hydratePromise;
63573
64045
  /** @ignore */
63574
- constructor(secretId, name, hydrator) {
64046
+ constructor(secretId, name, hydrator, keys) {
63575
64047
  this.#secretId = secretId;
63576
64048
  this.name = name;
63577
64049
  this.#hydrator = hydrator;
64050
+ this.#keys = keys !== void 0 ? new Set(keys) : void 0;
63578
64051
  }
63579
64052
  /** The ID of the server-side Secret, or an empty string if not yet hydrated. */
63580
64053
  get secretId() {
@@ -63590,6 +64063,16 @@ var Secret = class {
63590
64063
  get _hydrator() {
63591
64064
  return this.#hydrator;
63592
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
+ }
63593
64076
  /**
63594
64077
  * Lazily create the ephemeral server-side Secret backing a fromObject Secret
63595
64078
  * and populate {@link Secret#secretId secretId}. A no-op once secretId is set
@@ -63657,6 +64140,9 @@ function splitEnvDictAndResolvableSecrets(secrets) {
63657
64140
  if (hydrator !== void 0) {
63658
64141
  Object.assign(envDict, hydrator.envDict);
63659
64142
  } else {
64143
+ for (const key of secret?._keys ?? []) {
64144
+ delete envDict[key];
64145
+ }
63660
64146
  resolvable.push(secret);
63661
64147
  }
63662
64148
  }
@@ -70947,7 +71433,11 @@ var MAIN_CONTAINER_NAME = "main";
70947
71433
  var CONTAINER_WAIT_POLL_TIMEOUT_SECONDS = 10;
70948
71434
  var CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR = "MODAL_USE_CONTROL_PLANE_SIDECAR_CREATE";
70949
71435
  function useControlPlaneSidecarCreate(sandboxId) {
70950
- return getSandboxVersion(sandboxId) === "V2" /* V2 */ && process.env[CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR] === "1";
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);
70951
71441
  }
70952
71442
  function validateSidecarName(name) {
70953
71443
  if (name === "") {
@@ -71017,14 +71507,39 @@ var SidecarService = class {
71017
71507
  `experimentalMemoryReserveConsumeMiB must be a positive integer number of MiB, got: ${params.experimentalMemoryReserveConsumeMiB}`
71018
71508
  );
71019
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
+ }
71020
71528
  validateEnvVarKeys(params?.env ?? {});
71021
71529
  const [envDict, resolvableSecrets] = splitEnvDictAndResolvableSecrets(
71022
71530
  params?.secrets ?? []
71023
71531
  );
71024
71532
  Object.assign(envDict, params?.env ?? {});
71025
- await hydrateSecrets(this.#access.client, resolvableSecrets);
71533
+ await hydrateSandboxSecrets(
71534
+ this.#access.client,
71535
+ resolvableSecrets,
71536
+ params?.cloudBucketMounts
71537
+ );
71026
71538
  const secretIds = collectSecretIds(resolvableSecrets);
71027
71539
  const volumeMounts = buildSidecarVolumeMounts(params?.volumes);
71540
+ const cloudBucketMounts = buildCloudBucketMountProtos(
71541
+ params?.cloudBucketMounts
71542
+ );
71028
71543
  const ptyInfo = params?.pty ? defaultSandboxPTYInfo() : void 0;
71029
71544
  const networkAccess = buildOutboundNetworkAccess(
71030
71545
  false,
@@ -71033,7 +71548,7 @@ var SidecarService = class {
71033
71548
  );
71034
71549
  let resp;
71035
71550
  try {
71036
- if (useControlPlaneSidecarCreate(this.#access.sandboxId)) {
71551
+ if (viaControlPlane) {
71037
71552
  const ephemeralSecrets = Object.keys(envDict).length > 0 ? StringMap.create({ contents: envDict }) : void 0;
71038
71553
  resp = await this.#access.client.cpClient.sandboxContainerCreateV2(
71039
71554
  SandboxContainerCreateV2Request.create({
@@ -71045,6 +71560,7 @@ var SidecarService = class {
71045
71560
  workdir: params?.workdir ?? void 0,
71046
71561
  secretIds,
71047
71562
  volumeMounts,
71563
+ cloudBucketMounts,
71048
71564
  networkAccess,
71049
71565
  ptyInfo,
71050
71566
  resources: params?.experimentalMemoryReserveConsumeMiB !== void 0 ? Resources.create({
@@ -71686,9 +72202,9 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71686
72202
  const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
71687
72203
  ([mountPath, volume]) => volumeToMountProto(mountPath, volume)
71688
72204
  ) : [];
71689
- const cloudBucketMounts = params.cloudBucketMounts ? Object.entries(params.cloudBucketMounts).map(
71690
- ([mountPath, mount]) => mount.toProto(mountPath)
71691
- ) : [];
72205
+ const cloudBucketMounts = buildCloudBucketMountProtos(
72206
+ params.cloudBucketMounts
72207
+ );
71692
72208
  const openPorts = [];
71693
72209
  if (params.encryptedPorts) {
71694
72210
  openPorts.push(
@@ -72781,13 +73297,9 @@ var Sandbox2 = class {
72781
73297
  const timedOut = () => new TimeoutError(
72782
73298
  `Timed out waiting for task ID for Sandbox ${this.sandboxId}`
72783
73299
  );
72784
- const backoff = () => (0, import_promises3.setTimeout)(Math.max(0, Math.min(500, deadline - Date.now())), void 0, {
72785
- signal
72786
- });
73300
+ const pollIntervalMs = 500;
73301
+ const noTimeLeft = () => deadline - Date.now() <= pollIntervalMs;
72787
73302
  while (true) {
72788
- if (Date.now() >= deadline) {
72789
- throw timedOut();
72790
- }
72791
73303
  let resp;
72792
73304
  try {
72793
73305
  resp = await this.#sandboxGetTaskId(void 0, { signal });
@@ -72795,16 +73307,16 @@ var Sandbox2 = class {
72795
73307
  if (signal?.aborted || !isTransientTaskIDLookupError(err)) {
72796
73308
  throw err;
72797
73309
  }
72798
- if (Date.now() >= deadline) {
73310
+ if (!retryTransient && Date.now() < deadline) {
73311
+ throw err;
73312
+ }
73313
+ if (noTimeLeft()) {
72799
73314
  if (err instanceof import_nice_grpc12.ClientError && err.code === import_nice_grpc12.Status.INTERNAL) {
72800
73315
  throw err;
72801
73316
  }
72802
73317
  throw timedOut();
72803
73318
  }
72804
- if (!retryTransient) {
72805
- throw err;
72806
- }
72807
- await backoff();
73319
+ await (0, import_promises3.setTimeout)(pollIntervalMs, void 0, { signal });
72808
73320
  continue;
72809
73321
  }
72810
73322
  if (resp.taskId) {
@@ -72816,7 +73328,10 @@ var Sandbox2 = class {
72816
73328
  resp.taskResult.exception || `Sandbox ${this.sandboxId} has already finished`
72817
73329
  );
72818
73330
  }
72819
- await backoff();
73331
+ if (noTimeLeft()) {
73332
+ throw timedOut();
73333
+ }
73334
+ await (0, import_promises3.setTimeout)(pollIntervalMs, void 0, { signal });
72820
73335
  }
72821
73336
  }
72822
73337
  async #getOrCreateCommandRouterClient(taskId) {
@@ -73805,7 +74320,7 @@ var AuthTokenManager = class {
73805
74320
  };
73806
74321
 
73807
74322
  // src/version.ts
73808
- var SDK_VERSION = "0.10.2-dev.12";
74323
+ var SDK_VERSION = "0.10.2-dev.13";
73809
74324
  function getSDKVersion() {
73810
74325
  return SDK_VERSION;
73811
74326
  }