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/dist/index.js CHANGED
@@ -3322,6 +3322,56 @@ function cloudBucketMount_MetadataTTLTypeToJSON(object) {
3322
3322
  return "UNRECOGNIZED";
3323
3323
  }
3324
3324
  }
3325
+ function endpointGetInfoResponse_EndpointStatusFromJSON(object) {
3326
+ switch (object) {
3327
+ case 0:
3328
+ case "ENDPOINT_STATUS_UNSPECIFIED":
3329
+ return 0 /* ENDPOINT_STATUS_UNSPECIFIED */;
3330
+ case 1:
3331
+ case "ENDPOINT_STATUS_PROVISIONING":
3332
+ return 1 /* ENDPOINT_STATUS_PROVISIONING */;
3333
+ case 2:
3334
+ case "ENDPOINT_STATUS_LIVE":
3335
+ return 2 /* ENDPOINT_STATUS_LIVE */;
3336
+ case 3:
3337
+ case "ENDPOINT_STATUS_FAILED":
3338
+ return 3 /* ENDPOINT_STATUS_FAILED */;
3339
+ case 4:
3340
+ case "ENDPOINT_STATUS_CANCELLING":
3341
+ return 4 /* ENDPOINT_STATUS_CANCELLING */;
3342
+ case 5:
3343
+ case "ENDPOINT_STATUS_CANCELLED":
3344
+ return 5 /* ENDPOINT_STATUS_CANCELLED */;
3345
+ case 6:
3346
+ case "ENDPOINT_STATUS_STOPPED":
3347
+ return 6 /* ENDPOINT_STATUS_STOPPED */;
3348
+ case -1:
3349
+ case "UNRECOGNIZED":
3350
+ default:
3351
+ return -1 /* UNRECOGNIZED */;
3352
+ }
3353
+ }
3354
+ function endpointGetInfoResponse_EndpointStatusToJSON(object) {
3355
+ switch (object) {
3356
+ case 0 /* ENDPOINT_STATUS_UNSPECIFIED */:
3357
+ return "ENDPOINT_STATUS_UNSPECIFIED";
3358
+ case 1 /* ENDPOINT_STATUS_PROVISIONING */:
3359
+ return "ENDPOINT_STATUS_PROVISIONING";
3360
+ case 2 /* ENDPOINT_STATUS_LIVE */:
3361
+ return "ENDPOINT_STATUS_LIVE";
3362
+ case 3 /* ENDPOINT_STATUS_FAILED */:
3363
+ return "ENDPOINT_STATUS_FAILED";
3364
+ case 4 /* ENDPOINT_STATUS_CANCELLING */:
3365
+ return "ENDPOINT_STATUS_CANCELLING";
3366
+ case 5 /* ENDPOINT_STATUS_CANCELLED */:
3367
+ return "ENDPOINT_STATUS_CANCELLED";
3368
+ case 6 /* ENDPOINT_STATUS_STOPPED */:
3369
+ return "ENDPOINT_STATUS_STOPPED";
3370
+ case -1 /* UNRECOGNIZED */:
3371
+ default:
3372
+ return "UNRECOGNIZED";
3373
+ }
3374
+ }
3325
3375
  function fileEntry_FileTypeFromJSON(object) {
3326
3376
  switch (object) {
3327
3377
  case 0:
@@ -18253,6 +18303,407 @@ var EndpointGetByNameResponse = {
18253
18303
  return message;
18254
18304
  }
18255
18305
  };
18306
+ function createBaseEndpointGetInfoRequest() {
18307
+ return { endpointId: "" };
18308
+ }
18309
+ var EndpointGetInfoRequest = {
18310
+ encode(message, writer = new BinaryWriter()) {
18311
+ if (message.endpointId !== "") {
18312
+ writer.uint32(10).string(message.endpointId);
18313
+ }
18314
+ return writer;
18315
+ },
18316
+ decode(input, length) {
18317
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18318
+ let end = length === void 0 ? reader.len : reader.pos + length;
18319
+ const message = createBaseEndpointGetInfoRequest();
18320
+ while (reader.pos < end) {
18321
+ const tag = reader.uint32();
18322
+ switch (tag >>> 3) {
18323
+ case 1: {
18324
+ if (tag !== 10) {
18325
+ break;
18326
+ }
18327
+ message.endpointId = reader.string();
18328
+ continue;
18329
+ }
18330
+ }
18331
+ if ((tag & 7) === 4 || tag === 0) {
18332
+ break;
18333
+ }
18334
+ reader.skip(tag & 7);
18335
+ }
18336
+ return message;
18337
+ },
18338
+ fromJSON(object) {
18339
+ return { endpointId: isSet5(object.endpointId) ? globalThis.String(object.endpointId) : "" };
18340
+ },
18341
+ toJSON(message) {
18342
+ const obj = {};
18343
+ if (message.endpointId !== "") {
18344
+ obj.endpointId = message.endpointId;
18345
+ }
18346
+ return obj;
18347
+ },
18348
+ create(base) {
18349
+ return EndpointGetInfoRequest.fromPartial(base ?? {});
18350
+ },
18351
+ fromPartial(object) {
18352
+ const message = createBaseEndpointGetInfoRequest();
18353
+ message.endpointId = object.endpointId ?? "";
18354
+ return message;
18355
+ }
18356
+ };
18357
+ function createBaseEndpointGetInfoResponse() {
18358
+ return { info: void 0, metadata: void 0 };
18359
+ }
18360
+ var EndpointGetInfoResponse = {
18361
+ encode(message, writer = new BinaryWriter()) {
18362
+ if (message.info !== void 0) {
18363
+ EndpointGetInfoResponse_EndpointInfoSummary.encode(message.info, writer.uint32(10).fork()).join();
18364
+ }
18365
+ if (message.metadata !== void 0) {
18366
+ EndpointGetInfoResponse_EndpointHandleMetadata.encode(message.metadata, writer.uint32(18).fork()).join();
18367
+ }
18368
+ return writer;
18369
+ },
18370
+ decode(input, length) {
18371
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18372
+ let end = length === void 0 ? reader.len : reader.pos + length;
18373
+ const message = createBaseEndpointGetInfoResponse();
18374
+ while (reader.pos < end) {
18375
+ const tag = reader.uint32();
18376
+ switch (tag >>> 3) {
18377
+ case 1: {
18378
+ if (tag !== 10) {
18379
+ break;
18380
+ }
18381
+ message.info = EndpointGetInfoResponse_EndpointInfoSummary.decode(reader, reader.uint32());
18382
+ continue;
18383
+ }
18384
+ case 2: {
18385
+ if (tag !== 18) {
18386
+ break;
18387
+ }
18388
+ message.metadata = EndpointGetInfoResponse_EndpointHandleMetadata.decode(reader, reader.uint32());
18389
+ continue;
18390
+ }
18391
+ }
18392
+ if ((tag & 7) === 4 || tag === 0) {
18393
+ break;
18394
+ }
18395
+ reader.skip(tag & 7);
18396
+ }
18397
+ return message;
18398
+ },
18399
+ fromJSON(object) {
18400
+ return {
18401
+ info: isSet5(object.info) ? EndpointGetInfoResponse_EndpointInfoSummary.fromJSON(object.info) : void 0,
18402
+ metadata: isSet5(object.metadata) ? EndpointGetInfoResponse_EndpointHandleMetadata.fromJSON(object.metadata) : void 0
18403
+ };
18404
+ },
18405
+ toJSON(message) {
18406
+ const obj = {};
18407
+ if (message.info !== void 0) {
18408
+ obj.info = EndpointGetInfoResponse_EndpointInfoSummary.toJSON(message.info);
18409
+ }
18410
+ if (message.metadata !== void 0) {
18411
+ obj.metadata = EndpointGetInfoResponse_EndpointHandleMetadata.toJSON(message.metadata);
18412
+ }
18413
+ return obj;
18414
+ },
18415
+ create(base) {
18416
+ return EndpointGetInfoResponse.fromPartial(base ?? {});
18417
+ },
18418
+ fromPartial(object) {
18419
+ const message = createBaseEndpointGetInfoResponse();
18420
+ message.info = object.info !== void 0 && object.info !== null ? EndpointGetInfoResponse_EndpointInfoSummary.fromPartial(object.info) : void 0;
18421
+ message.metadata = object.metadata !== void 0 && object.metadata !== null ? EndpointGetInfoResponse_EndpointHandleMetadata.fromPartial(object.metadata) : void 0;
18422
+ return message;
18423
+ }
18424
+ };
18425
+ function createBaseEndpointGetInfoResponse_EndpointInfoSummary() {
18426
+ return {
18427
+ name: "",
18428
+ repoId: "",
18429
+ revision: "",
18430
+ serviceUrl: "",
18431
+ requiresProxyAuth: false,
18432
+ servingMode: 0,
18433
+ status: 0,
18434
+ lifecycle: void 0,
18435
+ volumeId: "",
18436
+ modelPath: ""
18437
+ };
18438
+ }
18439
+ var EndpointGetInfoResponse_EndpointInfoSummary = {
18440
+ encode(message, writer = new BinaryWriter()) {
18441
+ if (message.name !== "") {
18442
+ writer.uint32(10).string(message.name);
18443
+ }
18444
+ if (message.repoId !== "") {
18445
+ writer.uint32(18).string(message.repoId);
18446
+ }
18447
+ if (message.revision !== "") {
18448
+ writer.uint32(26).string(message.revision);
18449
+ }
18450
+ if (message.serviceUrl !== "") {
18451
+ writer.uint32(34).string(message.serviceUrl);
18452
+ }
18453
+ if (message.requiresProxyAuth !== false) {
18454
+ writer.uint32(40).bool(message.requiresProxyAuth);
18455
+ }
18456
+ if (message.servingMode !== 0) {
18457
+ writer.uint32(48).int32(message.servingMode);
18458
+ }
18459
+ if (message.status !== 0) {
18460
+ writer.uint32(56).int32(message.status);
18461
+ }
18462
+ if (message.lifecycle !== void 0) {
18463
+ EndpointLifecycle.encode(message.lifecycle, writer.uint32(66).fork()).join();
18464
+ }
18465
+ if (message.volumeId !== "") {
18466
+ writer.uint32(90).string(message.volumeId);
18467
+ }
18468
+ if (message.modelPath !== "") {
18469
+ writer.uint32(98).string(message.modelPath);
18470
+ }
18471
+ return writer;
18472
+ },
18473
+ decode(input, length) {
18474
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18475
+ let end = length === void 0 ? reader.len : reader.pos + length;
18476
+ const message = createBaseEndpointGetInfoResponse_EndpointInfoSummary();
18477
+ while (reader.pos < end) {
18478
+ const tag = reader.uint32();
18479
+ switch (tag >>> 3) {
18480
+ case 1: {
18481
+ if (tag !== 10) {
18482
+ break;
18483
+ }
18484
+ message.name = reader.string();
18485
+ continue;
18486
+ }
18487
+ case 2: {
18488
+ if (tag !== 18) {
18489
+ break;
18490
+ }
18491
+ message.repoId = reader.string();
18492
+ continue;
18493
+ }
18494
+ case 3: {
18495
+ if (tag !== 26) {
18496
+ break;
18497
+ }
18498
+ message.revision = reader.string();
18499
+ continue;
18500
+ }
18501
+ case 4: {
18502
+ if (tag !== 34) {
18503
+ break;
18504
+ }
18505
+ message.serviceUrl = reader.string();
18506
+ continue;
18507
+ }
18508
+ case 5: {
18509
+ if (tag !== 40) {
18510
+ break;
18511
+ }
18512
+ message.requiresProxyAuth = reader.bool();
18513
+ continue;
18514
+ }
18515
+ case 6: {
18516
+ if (tag !== 48) {
18517
+ break;
18518
+ }
18519
+ message.servingMode = reader.int32();
18520
+ continue;
18521
+ }
18522
+ case 7: {
18523
+ if (tag !== 56) {
18524
+ break;
18525
+ }
18526
+ message.status = reader.int32();
18527
+ continue;
18528
+ }
18529
+ case 8: {
18530
+ if (tag !== 66) {
18531
+ break;
18532
+ }
18533
+ message.lifecycle = EndpointLifecycle.decode(reader, reader.uint32());
18534
+ continue;
18535
+ }
18536
+ case 11: {
18537
+ if (tag !== 90) {
18538
+ break;
18539
+ }
18540
+ message.volumeId = reader.string();
18541
+ continue;
18542
+ }
18543
+ case 12: {
18544
+ if (tag !== 98) {
18545
+ break;
18546
+ }
18547
+ message.modelPath = reader.string();
18548
+ continue;
18549
+ }
18550
+ }
18551
+ if ((tag & 7) === 4 || tag === 0) {
18552
+ break;
18553
+ }
18554
+ reader.skip(tag & 7);
18555
+ }
18556
+ return message;
18557
+ },
18558
+ fromJSON(object) {
18559
+ return {
18560
+ name: isSet5(object.name) ? globalThis.String(object.name) : "",
18561
+ repoId: isSet5(object.repoId) ? globalThis.String(object.repoId) : "",
18562
+ revision: isSet5(object.revision) ? globalThis.String(object.revision) : "",
18563
+ serviceUrl: isSet5(object.serviceUrl) ? globalThis.String(object.serviceUrl) : "",
18564
+ requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : false,
18565
+ servingMode: isSet5(object.servingMode) ? endpointServingModeFromJSON(object.servingMode) : 0,
18566
+ status: isSet5(object.status) ? endpointGetInfoResponse_EndpointStatusFromJSON(object.status) : 0,
18567
+ lifecycle: isSet5(object.lifecycle) ? EndpointLifecycle.fromJSON(object.lifecycle) : void 0,
18568
+ volumeId: isSet5(object.volumeId) ? globalThis.String(object.volumeId) : "",
18569
+ modelPath: isSet5(object.modelPath) ? globalThis.String(object.modelPath) : ""
18570
+ };
18571
+ },
18572
+ toJSON(message) {
18573
+ const obj = {};
18574
+ if (message.name !== "") {
18575
+ obj.name = message.name;
18576
+ }
18577
+ if (message.repoId !== "") {
18578
+ obj.repoId = message.repoId;
18579
+ }
18580
+ if (message.revision !== "") {
18581
+ obj.revision = message.revision;
18582
+ }
18583
+ if (message.serviceUrl !== "") {
18584
+ obj.serviceUrl = message.serviceUrl;
18585
+ }
18586
+ if (message.requiresProxyAuth !== false) {
18587
+ obj.requiresProxyAuth = message.requiresProxyAuth;
18588
+ }
18589
+ if (message.servingMode !== 0) {
18590
+ obj.servingMode = endpointServingModeToJSON(message.servingMode);
18591
+ }
18592
+ if (message.status !== 0) {
18593
+ obj.status = endpointGetInfoResponse_EndpointStatusToJSON(message.status);
18594
+ }
18595
+ if (message.lifecycle !== void 0) {
18596
+ obj.lifecycle = EndpointLifecycle.toJSON(message.lifecycle);
18597
+ }
18598
+ if (message.volumeId !== "") {
18599
+ obj.volumeId = message.volumeId;
18600
+ }
18601
+ if (message.modelPath !== "") {
18602
+ obj.modelPath = message.modelPath;
18603
+ }
18604
+ return obj;
18605
+ },
18606
+ create(base) {
18607
+ return EndpointGetInfoResponse_EndpointInfoSummary.fromPartial(base ?? {});
18608
+ },
18609
+ fromPartial(object) {
18610
+ const message = createBaseEndpointGetInfoResponse_EndpointInfoSummary();
18611
+ message.name = object.name ?? "";
18612
+ message.repoId = object.repoId ?? "";
18613
+ message.revision = object.revision ?? "";
18614
+ message.serviceUrl = object.serviceUrl ?? "";
18615
+ message.requiresProxyAuth = object.requiresProxyAuth ?? false;
18616
+ message.servingMode = object.servingMode ?? 0;
18617
+ message.status = object.status ?? 0;
18618
+ message.lifecycle = object.lifecycle !== void 0 && object.lifecycle !== null ? EndpointLifecycle.fromPartial(object.lifecycle) : void 0;
18619
+ message.volumeId = object.volumeId ?? "";
18620
+ message.modelPath = object.modelPath ?? "";
18621
+ return message;
18622
+ }
18623
+ };
18624
+ function createBaseEndpointGetInfoResponse_EndpointHandleMetadata() {
18625
+ return { appId: "", serverId: "", environmentName: "" };
18626
+ }
18627
+ var EndpointGetInfoResponse_EndpointHandleMetadata = {
18628
+ encode(message, writer = new BinaryWriter()) {
18629
+ if (message.appId !== "") {
18630
+ writer.uint32(10).string(message.appId);
18631
+ }
18632
+ if (message.serverId !== "") {
18633
+ writer.uint32(18).string(message.serverId);
18634
+ }
18635
+ if (message.environmentName !== "") {
18636
+ writer.uint32(26).string(message.environmentName);
18637
+ }
18638
+ return writer;
18639
+ },
18640
+ decode(input, length) {
18641
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18642
+ let end = length === void 0 ? reader.len : reader.pos + length;
18643
+ const message = createBaseEndpointGetInfoResponse_EndpointHandleMetadata();
18644
+ while (reader.pos < end) {
18645
+ const tag = reader.uint32();
18646
+ switch (tag >>> 3) {
18647
+ case 1: {
18648
+ if (tag !== 10) {
18649
+ break;
18650
+ }
18651
+ message.appId = reader.string();
18652
+ continue;
18653
+ }
18654
+ case 2: {
18655
+ if (tag !== 18) {
18656
+ break;
18657
+ }
18658
+ message.serverId = reader.string();
18659
+ continue;
18660
+ }
18661
+ case 3: {
18662
+ if (tag !== 26) {
18663
+ break;
18664
+ }
18665
+ message.environmentName = reader.string();
18666
+ continue;
18667
+ }
18668
+ }
18669
+ if ((tag & 7) === 4 || tag === 0) {
18670
+ break;
18671
+ }
18672
+ reader.skip(tag & 7);
18673
+ }
18674
+ return message;
18675
+ },
18676
+ fromJSON(object) {
18677
+ return {
18678
+ appId: isSet5(object.appId) ? globalThis.String(object.appId) : "",
18679
+ serverId: isSet5(object.serverId) ? globalThis.String(object.serverId) : "",
18680
+ environmentName: isSet5(object.environmentName) ? globalThis.String(object.environmentName) : ""
18681
+ };
18682
+ },
18683
+ toJSON(message) {
18684
+ const obj = {};
18685
+ if (message.appId !== "") {
18686
+ obj.appId = message.appId;
18687
+ }
18688
+ if (message.serverId !== "") {
18689
+ obj.serverId = message.serverId;
18690
+ }
18691
+ if (message.environmentName !== "") {
18692
+ obj.environmentName = message.environmentName;
18693
+ }
18694
+ return obj;
18695
+ },
18696
+ create(base) {
18697
+ return EndpointGetInfoResponse_EndpointHandleMetadata.fromPartial(base ?? {});
18698
+ },
18699
+ fromPartial(object) {
18700
+ const message = createBaseEndpointGetInfoResponse_EndpointHandleMetadata();
18701
+ message.appId = object.appId ?? "";
18702
+ message.serverId = object.serverId ?? "";
18703
+ message.environmentName = object.environmentName ?? "";
18704
+ return message;
18705
+ }
18706
+ };
18256
18707
  function createBaseEndpointGetLifecycleRequest() {
18257
18708
  return { endpointId: "" };
18258
18709
  }
@@ -61159,6 +61610,14 @@ var ModalClientDefinition = {
61159
61610
  responseStream: false,
61160
61611
  options: {}
61161
61612
  },
61613
+ endpointGetInfo: {
61614
+ name: "EndpointGetInfo",
61615
+ requestType: EndpointGetInfoRequest,
61616
+ requestStream: false,
61617
+ responseType: EndpointGetInfoResponse,
61618
+ responseStream: false,
61619
+ options: {}
61620
+ },
61162
61621
  endpointGetLifecycle: {
61163
61622
  name: "EndpointGetLifecycle",
61164
61623
  requestType: EndpointGetLifecycleRequest,
@@ -63344,6 +63803,16 @@ var CloudBucketMount2 = class {
63344
63803
  });
63345
63804
  }
63346
63805
  };
63806
+ function buildCloudBucketMountProtos(mounts) {
63807
+ return Object.entries(mounts ?? {}).map(([mountPath, mount]) => {
63808
+ if (!mount) {
63809
+ throw new InvalidError(
63810
+ `CloudBucketMount mounted at "${mountPath}" must not be null or undefined`
63811
+ );
63812
+ }
63813
+ return mount.toProto(mountPath);
63814
+ });
63815
+ }
63347
63816
 
63348
63817
  // src/secret.ts
63349
63818
  import { ClientError as ClientError2, Status as Status2 } from "nice-grpc";
@@ -63377,7 +63846,7 @@ var SecretService = class {
63377
63846
  "secret_name",
63378
63847
  name
63379
63848
  );
63380
- return new Secret(resp.secretId, name);
63849
+ return new Secret(resp.secretId, name, void 0, resp.metadata?.keys);
63381
63850
  } catch (err) {
63382
63851
  if (err instanceof ClientError2 && err.code === Status2.NOT_FOUND)
63383
63852
  throw new NotFoundError(err.details);
@@ -63476,16 +63945,20 @@ var Secret = class {
63476
63945
  // constructed already-hydrated (e.g. from fromName), and not consulted again
63477
63946
  // once secretId is set.
63478
63947
  #hydrator;
63948
+ // Names of the env vars a server-side Secret defines, as reported by the
63949
+ // control plane on fromName. Undefined when unknown.
63950
+ #keys;
63479
63951
  // Caches the single in-flight (or successfully completed) hydration so the
63480
63952
  // ephemeral Secret is created at most once, even if multiple callers hydrate
63481
63953
  // the same Secret concurrently. Cleared on failure so a transient error
63482
63954
  // doesn't permanently break the Secret; subsequent calls can retry.
63483
63955
  #hydratePromise;
63484
63956
  /** @ignore */
63485
- constructor(secretId, name, hydrator) {
63957
+ constructor(secretId, name, hydrator, keys) {
63486
63958
  this.#secretId = secretId;
63487
63959
  this.name = name;
63488
63960
  this.#hydrator = hydrator;
63961
+ this.#keys = keys !== void 0 ? new Set(keys) : void 0;
63489
63962
  }
63490
63963
  /** The ID of the server-side Secret, or an empty string if not yet hydrated. */
63491
63964
  get secretId() {
@@ -63501,6 +63974,16 @@ var Secret = class {
63501
63974
  get _hydrator() {
63502
63975
  return this.#hydrator;
63503
63976
  }
63977
+ /**
63978
+ * Names of the env vars this server-side Secret defines, or `undefined` if
63979
+ * unknown (e.g. for lazy fromObject Secrets or Secrets constructed by id).
63980
+ *
63981
+ * @internal
63982
+ * @hidden
63983
+ */
63984
+ get _keys() {
63985
+ return this.#keys;
63986
+ }
63504
63987
  /**
63505
63988
  * Lazily create the ephemeral server-side Secret backing a fromObject Secret
63506
63989
  * and populate {@link Secret#secretId secretId}. A no-op once secretId is set
@@ -63568,6 +64051,9 @@ function splitEnvDictAndResolvableSecrets(secrets) {
63568
64051
  if (hydrator !== void 0) {
63569
64052
  Object.assign(envDict, hydrator.envDict);
63570
64053
  } else {
64054
+ for (const key of secret?._keys ?? []) {
64055
+ delete envDict[key];
64056
+ }
63571
64057
  resolvable.push(secret);
63572
64058
  }
63573
64059
  }
@@ -70865,7 +71351,11 @@ var MAIN_CONTAINER_NAME = "main";
70865
71351
  var CONTAINER_WAIT_POLL_TIMEOUT_SECONDS = 10;
70866
71352
  var CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR = "MODAL_USE_CONTROL_PLANE_SIDECAR_CREATE";
70867
71353
  function useControlPlaneSidecarCreate(sandboxId) {
70868
- return getSandboxVersion(sandboxId) === "V2" /* V2 */ && process.env[CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR] === "1";
71354
+ if (getSandboxVersion(sandboxId) !== "V2" /* V2 */) {
71355
+ return false;
71356
+ }
71357
+ const value = process.env[CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR];
71358
+ return value === void 0 || parseBooleanFlag(value);
70869
71359
  }
70870
71360
  function validateSidecarName(name) {
70871
71361
  if (name === "") {
@@ -70935,14 +71425,39 @@ var SidecarService = class {
70935
71425
  `experimentalMemoryReserveConsumeMiB must be a positive integer number of MiB, got: ${params.experimentalMemoryReserveConsumeMiB}`
70936
71426
  );
70937
71427
  }
71428
+ const viaControlPlane = useControlPlaneSidecarCreate(
71429
+ this.#access.sandboxId
71430
+ );
71431
+ const cloudBucketMountEntries = Object.entries(
71432
+ params?.cloudBucketMounts ?? {}
71433
+ );
71434
+ if (cloudBucketMountEntries.length > 0) {
71435
+ if (getSandboxVersion(this.#access.sandboxId) !== "V2" /* V2 */) {
71436
+ throw new InvalidError(
71437
+ "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"
71438
+ );
71439
+ }
71440
+ if (!viaControlPlane) {
71441
+ throw new InvalidError(
71442
+ `cloudBucketMounts are not supported in sidecars when ${CONTROL_PLANE_SIDECAR_CREATE_ENV_VAR}=0 is set; unset it to use them`
71443
+ );
71444
+ }
71445
+ }
70938
71446
  validateEnvVarKeys(params?.env ?? {});
70939
71447
  const [envDict, resolvableSecrets] = splitEnvDictAndResolvableSecrets(
70940
71448
  params?.secrets ?? []
70941
71449
  );
70942
71450
  Object.assign(envDict, params?.env ?? {});
70943
- await hydrateSecrets(this.#access.client, resolvableSecrets);
71451
+ await hydrateSandboxSecrets(
71452
+ this.#access.client,
71453
+ resolvableSecrets,
71454
+ params?.cloudBucketMounts
71455
+ );
70944
71456
  const secretIds = collectSecretIds(resolvableSecrets);
70945
71457
  const volumeMounts = buildSidecarVolumeMounts(params?.volumes);
71458
+ const cloudBucketMounts = buildCloudBucketMountProtos(
71459
+ params?.cloudBucketMounts
71460
+ );
70946
71461
  const ptyInfo = params?.pty ? defaultSandboxPTYInfo() : void 0;
70947
71462
  const networkAccess = buildOutboundNetworkAccess(
70948
71463
  false,
@@ -70951,7 +71466,7 @@ var SidecarService = class {
70951
71466
  );
70952
71467
  let resp;
70953
71468
  try {
70954
- if (useControlPlaneSidecarCreate(this.#access.sandboxId)) {
71469
+ if (viaControlPlane) {
70955
71470
  const ephemeralSecrets = Object.keys(envDict).length > 0 ? StringMap.create({ contents: envDict }) : void 0;
70956
71471
  resp = await this.#access.client.cpClient.sandboxContainerCreateV2(
70957
71472
  SandboxContainerCreateV2Request.create({
@@ -70963,6 +71478,7 @@ var SidecarService = class {
70963
71478
  workdir: params?.workdir ?? void 0,
70964
71479
  secretIds,
70965
71480
  volumeMounts,
71481
+ cloudBucketMounts,
70966
71482
  networkAccess,
70967
71483
  ptyInfo,
70968
71484
  resources: params?.experimentalMemoryReserveConsumeMiB !== void 0 ? Resources.create({
@@ -71604,9 +72120,9 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71604
72120
  const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
71605
72121
  ([mountPath, volume]) => volumeToMountProto(mountPath, volume)
71606
72122
  ) : [];
71607
- const cloudBucketMounts = params.cloudBucketMounts ? Object.entries(params.cloudBucketMounts).map(
71608
- ([mountPath, mount]) => mount.toProto(mountPath)
71609
- ) : [];
72123
+ const cloudBucketMounts = buildCloudBucketMountProtos(
72124
+ params.cloudBucketMounts
72125
+ );
71610
72126
  const openPorts = [];
71611
72127
  if (params.encryptedPorts) {
71612
72128
  openPorts.push(
@@ -72699,13 +73215,9 @@ var Sandbox2 = class {
72699
73215
  const timedOut = () => new TimeoutError(
72700
73216
  `Timed out waiting for task ID for Sandbox ${this.sandboxId}`
72701
73217
  );
72702
- const backoff = () => setTimeout3(Math.max(0, Math.min(500, deadline - Date.now())), void 0, {
72703
- signal
72704
- });
73218
+ const pollIntervalMs = 500;
73219
+ const noTimeLeft = () => deadline - Date.now() <= pollIntervalMs;
72705
73220
  while (true) {
72706
- if (Date.now() >= deadline) {
72707
- throw timedOut();
72708
- }
72709
73221
  let resp;
72710
73222
  try {
72711
73223
  resp = await this.#sandboxGetTaskId(void 0, { signal });
@@ -72713,16 +73225,16 @@ var Sandbox2 = class {
72713
73225
  if (signal?.aborted || !isTransientTaskIDLookupError(err)) {
72714
73226
  throw err;
72715
73227
  }
72716
- if (Date.now() >= deadline) {
73228
+ if (!retryTransient && Date.now() < deadline) {
73229
+ throw err;
73230
+ }
73231
+ if (noTimeLeft()) {
72717
73232
  if (err instanceof ClientError11 && err.code === Status11.INTERNAL) {
72718
73233
  throw err;
72719
73234
  }
72720
73235
  throw timedOut();
72721
73236
  }
72722
- if (!retryTransient) {
72723
- throw err;
72724
- }
72725
- await backoff();
73237
+ await setTimeout3(pollIntervalMs, void 0, { signal });
72726
73238
  continue;
72727
73239
  }
72728
73240
  if (resp.taskId) {
@@ -72734,7 +73246,10 @@ var Sandbox2 = class {
72734
73246
  resp.taskResult.exception || `Sandbox ${this.sandboxId} has already finished`
72735
73247
  );
72736
73248
  }
72737
- await backoff();
73249
+ if (noTimeLeft()) {
73250
+ throw timedOut();
73251
+ }
73252
+ await setTimeout3(pollIntervalMs, void 0, { signal });
72738
73253
  }
72739
73254
  }
72740
73255
  async #getOrCreateCommandRouterClient(taskId) {
@@ -73723,7 +74238,7 @@ var AuthTokenManager = class {
73723
74238
  };
73724
74239
 
73725
74240
  // src/version.ts
73726
- var SDK_VERSION = "0.10.2-dev.12";
74241
+ var SDK_VERSION = "0.10.2-dev.13";
73727
74242
  function getSDKVersion() {
73728
74243
  return SDK_VERSION;
73729
74244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modal",
3
- "version": "0.10.2-dev.12",
3
+ "version": "0.10.2-dev.13",
4
4
  "description": "Modal SDK for JavaScript/TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://modal.com/docs/guide/sdk-javascript-go",