modal 0.10.2-dev.7 → 0.10.2-dev.8

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 CHANGED
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  ConflictError: () => ConflictError,
43
43
  ContainerProcess: () => ContainerProcess2,
44
44
  ExecutionError: () => ExecutionError,
45
+ ExperimentalOutboundPolicy: () => ExperimentalOutboundPolicy,
45
46
  FunctionCall: () => FunctionCall,
46
47
  FunctionCallLogsManager: () => FunctionCallLogsManager,
47
48
  FunctionCallService: () => FunctionCallService,
@@ -55,7 +56,6 @@ __export(index_exports, {
55
56
  InvalidError: () => InvalidError,
56
57
  ModalClient: () => ModalClient,
57
58
  NotFoundError: () => NotFoundError,
58
- OutboundPolicy: () => OutboundPolicy2,
59
59
  Probe: () => Probe2,
60
60
  Proxy: () => Proxy3,
61
61
  ProxyService: () => ProxyService,
@@ -5585,7 +5585,7 @@ var AppGetInfoResponse = {
5585
5585
  }
5586
5586
  };
5587
5587
  function createBaseAppGetInfoResponse_FunctionInfoSummary() {
5588
- return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0 };
5588
+ return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0, isSessioned: false };
5589
5589
  }
5590
5590
  var AppGetInfoResponse_FunctionInfoSummary = {
5591
5591
  encode(message, writer = new BinaryWriter()) {
@@ -5601,6 +5601,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5601
5601
  if (message.requiresProxyAuth !== void 0) {
5602
5602
  writer.uint32(32).bool(message.requiresProxyAuth);
5603
5603
  }
5604
+ if (message.isSessioned !== false) {
5605
+ writer.uint32(40).bool(message.isSessioned);
5606
+ }
5604
5607
  return writer;
5605
5608
  },
5606
5609
  decode(input, length) {
@@ -5638,6 +5641,13 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5638
5641
  message.requiresProxyAuth = reader.bool();
5639
5642
  continue;
5640
5643
  }
5644
+ case 5: {
5645
+ if (tag !== 40) {
5646
+ break;
5647
+ }
5648
+ message.isSessioned = reader.bool();
5649
+ continue;
5650
+ }
5641
5651
  }
5642
5652
  if ((tag & 7) === 4 || tag === 0) {
5643
5653
  break;
@@ -5651,7 +5661,8 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5651
5661
  gpuConfig: globalThis.Array.isArray(object?.gpuConfig) ? object.gpuConfig.map((e) => GPUConfig.fromJSON(e)) : [],
5652
5662
  schedule: isSet5(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0,
5653
5663
  webFunction: isSet5(object.webFunction) ? globalThis.Boolean(object.webFunction) : false,
5654
- requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0
5664
+ requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0,
5665
+ isSessioned: isSet5(object.isSessioned) ? globalThis.Boolean(object.isSessioned) : false
5655
5666
  };
5656
5667
  },
5657
5668
  toJSON(message) {
@@ -5668,6 +5679,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5668
5679
  if (message.requiresProxyAuth !== void 0) {
5669
5680
  obj.requiresProxyAuth = message.requiresProxyAuth;
5670
5681
  }
5682
+ if (message.isSessioned !== false) {
5683
+ obj.isSessioned = message.isSessioned;
5684
+ }
5671
5685
  return obj;
5672
5686
  },
5673
5687
  create(base) {
@@ -5679,6 +5693,7 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5679
5693
  message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0;
5680
5694
  message.webFunction = object.webFunction ?? false;
5681
5695
  message.requiresProxyAuth = object.requiresProxyAuth ?? void 0;
5696
+ message.isSessioned = object.isSessioned ?? false;
5682
5697
  return message;
5683
5698
  }
5684
5699
  };
@@ -58664,6 +58679,74 @@ var WebhookTokenListResponse = {
58664
58679
  return message;
58665
58680
  }
58666
58681
  };
58682
+ function createBaseWebhookTokenUpdateRequest() {
58683
+ return { tokenId: "", name: void 0 };
58684
+ }
58685
+ var WebhookTokenUpdateRequest = {
58686
+ encode(message, writer = new BinaryWriter()) {
58687
+ if (message.tokenId !== "") {
58688
+ writer.uint32(10).string(message.tokenId);
58689
+ }
58690
+ if (message.name !== void 0) {
58691
+ writer.uint32(18).string(message.name);
58692
+ }
58693
+ return writer;
58694
+ },
58695
+ decode(input, length) {
58696
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
58697
+ let end = length === void 0 ? reader.len : reader.pos + length;
58698
+ const message = createBaseWebhookTokenUpdateRequest();
58699
+ while (reader.pos < end) {
58700
+ const tag = reader.uint32();
58701
+ switch (tag >>> 3) {
58702
+ case 1: {
58703
+ if (tag !== 10) {
58704
+ break;
58705
+ }
58706
+ message.tokenId = reader.string();
58707
+ continue;
58708
+ }
58709
+ case 2: {
58710
+ if (tag !== 18) {
58711
+ break;
58712
+ }
58713
+ message.name = reader.string();
58714
+ continue;
58715
+ }
58716
+ }
58717
+ if ((tag & 7) === 4 || tag === 0) {
58718
+ break;
58719
+ }
58720
+ reader.skip(tag & 7);
58721
+ }
58722
+ return message;
58723
+ },
58724
+ fromJSON(object) {
58725
+ return {
58726
+ tokenId: isSet5(object.tokenId) ? globalThis.String(object.tokenId) : "",
58727
+ name: isSet5(object.name) ? globalThis.String(object.name) : void 0
58728
+ };
58729
+ },
58730
+ toJSON(message) {
58731
+ const obj = {};
58732
+ if (message.tokenId !== "") {
58733
+ obj.tokenId = message.tokenId;
58734
+ }
58735
+ if (message.name !== void 0) {
58736
+ obj.name = message.name;
58737
+ }
58738
+ return obj;
58739
+ },
58740
+ create(base) {
58741
+ return WebhookTokenUpdateRequest.fromPartial(base ?? {});
58742
+ },
58743
+ fromPartial(object) {
58744
+ const message = createBaseWebhookTokenUpdateRequest();
58745
+ message.tokenId = object.tokenId ?? "";
58746
+ message.name = object.name ?? void 0;
58747
+ return message;
58748
+ }
58749
+ };
58667
58750
  function createBaseWorkspaceBillingRatesRequest() {
58668
58751
  return {};
58669
58752
  }
@@ -62636,6 +62719,14 @@ var ModalClientDefinition = {
62636
62719
  responseStream: false,
62637
62720
  options: {}
62638
62721
  },
62722
+ webhookTokenUpdate: {
62723
+ name: "WebhookTokenUpdate",
62724
+ requestType: WebhookTokenUpdateRequest,
62725
+ requestStream: false,
62726
+ responseType: WebhookToken,
62727
+ responseStream: false,
62728
+ options: {}
62729
+ },
62639
62730
  /** Workspaces */
62640
62731
  workspaceBillingRates: {
62641
62732
  name: "WorkspaceBillingRates",
@@ -71402,6 +71493,19 @@ function getSandboxVersion(sandboxId) {
71402
71493
  }
71403
71494
  return "V2" /* V2 */;
71404
71495
  }
71496
+ function sandboxRuntimeToProto(runtime) {
71497
+ switch (runtime) {
71498
+ case void 0:
71499
+ return void 0;
71500
+ case "gvisor":
71501
+ case "vm":
71502
+ return runtime;
71503
+ default:
71504
+ throw new Error(
71505
+ `runtime must be "gvisor" or "vm", got ${JSON.stringify(runtime)}`
71506
+ );
71507
+ }
71508
+ }
71405
71509
  var Probe2 = class _Probe {
71406
71510
  #tcpPort;
71407
71511
  #execArgv;
@@ -71535,6 +71639,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71535
71639
  if (params.workdir && !params.workdir.startsWith("/")) {
71536
71640
  throw new Error(`workdir must be an absolute path, got: ${params.workdir}`);
71537
71641
  }
71642
+ const runtime = sandboxRuntimeToProto(params.runtime);
71538
71643
  const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
71539
71644
  ([mountPath, volume]) => volumeToMountProto(mountPath, volume)
71540
71645
  ) : [];
@@ -71586,16 +71691,16 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71586
71691
  );
71587
71692
  }
71588
71693
  }
71589
- if (params.outboundPolicy !== void 0) {
71590
- params.outboundPolicy._validate();
71694
+ if (params.experimentalOutboundPolicy !== void 0) {
71695
+ params.experimentalOutboundPolicy._validate();
71591
71696
  if (params.blockNetwork) {
71592
71697
  throw new InvalidError(
71593
- "outboundPolicy cannot be used when blockNetwork is enabled"
71698
+ "experimentalOutboundPolicy cannot be used when blockNetwork is enabled"
71594
71699
  );
71595
71700
  }
71596
71701
  if (params.outboundDomainAllowlist && params.outboundDomainAllowlist.length > 0) {
71597
71702
  throw new InvalidError(
71598
- "outboundPolicy cannot be used with outboundDomainAllowlist"
71703
+ "experimentalOutboundPolicy cannot be used with outboundDomainAllowlist"
71599
71704
  );
71600
71705
  }
71601
71706
  }
@@ -71679,7 +71784,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71679
71784
  idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
71680
71785
  workdir: params.workdir ?? void 0,
71681
71786
  networkAccess,
71682
- outboundPolicy: params.outboundPolicy?._toProto(),
71787
+ outboundPolicy: params.experimentalOutboundPolicy?._toProto(),
71683
71788
  resources: Resources.create({
71684
71789
  milliCpu,
71685
71790
  milliCpuMax,
@@ -71703,7 +71808,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71703
71808
  includeOidcIdentityToken: params.includeOidcIdentityToken ?? false,
71704
71809
  inboundCidrAllowlist: params.inboundCidrAllowlist ?? [],
71705
71810
  i6pnEnabled: params.i6pn ?? false,
71706
- enableSnapshot: params.experimentalEnableSnapshot ?? false
71811
+ enableSnapshot: params.experimentalEnableSnapshot ?? false,
71812
+ runtime
71707
71813
  }
71708
71814
  });
71709
71815
  }
@@ -71740,7 +71846,10 @@ var SandboxService = class {
71740
71846
  );
71741
71847
  await hydrateSandboxSecrets(
71742
71848
  this.#client,
71743
- [...mergedSecrets, ...params.outboundPolicy?._secrets() ?? []],
71849
+ [
71850
+ ...mergedSecrets,
71851
+ ...params.experimentalOutboundPolicy?._secrets() ?? []
71852
+ ],
71744
71853
  params.cloudBucketMounts
71745
71854
  );
71746
71855
  const mergedParams = {
@@ -71801,7 +71910,10 @@ var SandboxService = class {
71801
71910
  Object.assign(envDict, params.env ?? {});
71802
71911
  await hydrateSandboxSecrets(
71803
71912
  this.#client,
71804
- [...resolvableSecrets, ...params.outboundPolicy?._secrets() ?? []],
71913
+ [
71914
+ ...resolvableSecrets,
71915
+ ...params.experimentalOutboundPolicy?._secrets() ?? []
71916
+ ],
71805
71917
  params.cloudBucketMounts
71806
71918
  );
71807
71919
  const mergedParams = {
@@ -73009,14 +73121,16 @@ var Sandbox2 = class _Sandbox {
73009
73121
  /**
73010
73122
  * Replace the outbound policy of a running Sandbox.
73011
73123
  *
73124
+ * EXPERIMENTAL: the API is subject to change.
73125
+ *
73012
73126
  * The new policy replaces all existing policy configuration on the
73013
73127
  * Sandbox; build a policy including any existing rules you want to keep.
73014
73128
  *
73015
- * Only Sandboxes created with an `outboundPolicy` can be updated this
73129
+ * Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
73016
73130
  * way; for Sandboxes created without one this fails, since header
73017
73131
  * replacement is only set up at creation time.
73018
73132
  */
73019
- async updateOutboundPolicy(outboundPolicy) {
73133
+ async experimentalUpdateOutboundPolicy(outboundPolicy) {
73020
73134
  this.#ensureAttached();
73021
73135
  outboundPolicy._validate();
73022
73136
  const [, [taskId, commandRouterClient]] = await Promise.all([
@@ -73586,7 +73700,7 @@ var AuthTokenManager = class {
73586
73700
  };
73587
73701
 
73588
73702
  // src/version.ts
73589
- var SDK_VERSION = "0.10.2-dev.7";
73703
+ var SDK_VERSION = "0.10.2-dev.8";
73590
73704
  function getSDKVersion() {
73591
73705
  return SDK_VERSION;
73592
73706
  }
@@ -76037,7 +76151,7 @@ function templateReferencesKey(template) {
76037
76151
  }
76038
76152
  return false;
76039
76153
  }
76040
- var OutboundPolicy2 = class _OutboundPolicy {
76154
+ var ExperimentalOutboundPolicy = class _ExperimentalOutboundPolicy {
76041
76155
  /** @internal */
76042
76156
  _replacements;
76043
76157
  /** @internal */
@@ -76045,7 +76159,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
76045
76159
  this._replacements = _replacements;
76046
76160
  }
76047
76161
  /**
76048
- * Return a new {@link OutboundPolicy} with an added header replacement.
76162
+ * Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
76049
76163
  *
76050
76164
  * @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
76051
76165
  * prefixes (matching the apex domain and subdomains) and a bare `"*"`.
@@ -76056,7 +76170,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
76056
76170
  */
76057
76171
  withHeaderReplacement(params) {
76058
76172
  const { domain, headers, secret } = params;
76059
- return new _OutboundPolicy([
76173
+ return new _ExperimentalOutboundPolicy([
76060
76174
  ...this._replacements,
76061
76175
  { domain, headers: { ...headers }, secret }
76062
76176
  ]);
@@ -76144,6 +76258,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
76144
76258
  ConflictError,
76145
76259
  ContainerProcess,
76146
76260
  ExecutionError,
76261
+ ExperimentalOutboundPolicy,
76147
76262
  FunctionCall,
76148
76263
  FunctionCallLogsManager,
76149
76264
  FunctionCallService,
@@ -76157,7 +76272,6 @@ var OutboundPolicy2 = class _OutboundPolicy {
76157
76272
  InvalidError,
76158
76273
  ModalClient,
76159
76274
  NotFoundError,
76160
- OutboundPolicy,
76161
76275
  Probe,
76162
76276
  Proxy,
76163
76277
  ProxyService,
package/dist/index.d.cts CHANGED
@@ -702,6 +702,8 @@ interface AppGetInfoResponse_FunctionInfoSummary {
702
702
  /** True for Web Functions and classes with web methods; false for Servers. */
703
703
  webFunction: boolean;
704
704
  requiresProxyAuth?: boolean | undefined;
705
+ /** True for Sessioned Servers. */
706
+ isSessioned: boolean;
705
707
  }
706
708
  declare const AppGetInfoResponse_FunctionInfoSummary: MessageFns$1<AppGetInfoResponse_FunctionInfoSummary>;
707
709
  interface AppGetLayoutRequest {
@@ -3305,11 +3307,11 @@ interface ObjectDependency {
3305
3307
  }
3306
3308
  declare const ObjectDependency: MessageFns$1<ObjectDependency>;
3307
3309
  /** Policy for outbound traffic from a sandbox. */
3308
- interface OutboundPolicy$1 {
3310
+ interface OutboundPolicy {
3309
3311
  /** Replace headers in outbound HTTPS requests, potentially with secret values. */
3310
3312
  headerReplacements: OutboundPolicy_HeaderReplacement[];
3311
3313
  }
3312
- declare const OutboundPolicy$1: MessageFns$1<OutboundPolicy$1>;
3314
+ declare const OutboundPolicy: MessageFns$1<OutboundPolicy>;
3313
3315
  interface OutboundPolicy_HeaderReplacement {
3314
3316
  /**
3315
3317
  * Domain that the header replacements are scoped to. Supports wildcards in
@@ -3654,7 +3656,10 @@ interface Sandbox$1 {
3654
3656
  * Set by the backend at snapshot creation time.
3655
3657
  */
3656
3658
  runscRuntimeVersion?: string | undefined;
3657
- /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */
3659
+ /**
3660
+ * Runtime the sandbox runs in: "vm" for a virtual machine, or a container
3661
+ * runtime such as "gvisor". Leave it unset to let Modal pick.
3662
+ */
3658
3663
  runtime?: string | undefined;
3659
3664
  /** If set, the sandbox will be created with verbose logging enabled. */
3660
3665
  verbose: boolean;
@@ -3704,7 +3709,7 @@ interface Sandbox$1 {
3704
3709
  */
3705
3710
  inboundCidrAllowlist: string[];
3706
3711
  environmentVariables: StringMap | undefined;
3707
- outboundPolicy?: OutboundPolicy$1 | undefined;
3712
+ outboundPolicy?: OutboundPolicy | undefined;
3708
3713
  /**
3709
3714
  * If set, the sandbox's main container is served an X.509-SVID over a
3710
3715
  * SPIFFE Workload API socket, addressed by SPIFFE_ENDPOINT_SOCKET. The
@@ -4968,6 +4973,11 @@ interface WebhookTokenListResponse {
4968
4973
  tokens: WebhookToken[];
4969
4974
  }
4970
4975
  declare const WebhookTokenListResponse: MessageFns$1<WebhookTokenListResponse>;
4976
+ interface WebhookTokenUpdateRequest {
4977
+ tokenId: string;
4978
+ name?: string | undefined;
4979
+ }
4980
+ declare const WebhookTokenUpdateRequest: MessageFns$1<WebhookTokenUpdateRequest>;
4971
4981
  interface WorkspaceBillingRatesRequest {
4972
4982
  }
4973
4983
  declare const WorkspaceBillingRatesRequest: MessageFns$1<WorkspaceBillingRatesRequest>;
@@ -7070,6 +7080,14 @@ declare const ModalClientDefinition: {
7070
7080
  readonly responseStream: false;
7071
7081
  readonly options: {};
7072
7082
  };
7083
+ readonly webhookTokenUpdate: {
7084
+ readonly name: "WebhookTokenUpdate";
7085
+ readonly requestType: MessageFns$1<WebhookTokenUpdateRequest>;
7086
+ readonly requestStream: false;
7087
+ readonly responseType: MessageFns$1<WebhookToken>;
7088
+ readonly responseStream: false;
7089
+ readonly options: {};
7090
+ };
7073
7091
  /** Workspaces */
7074
7092
  readonly workspaceBillingRates: {
7075
7093
  readonly name: "WorkspaceBillingRates";
@@ -8383,7 +8401,7 @@ declare const TaskSetNetworkAccessRequest: MessageFns<TaskSetNetworkAccessReques
8383
8401
  interface TaskSetOutboundPolicyRequest {
8384
8402
  taskId: string;
8385
8403
  /** Replaces the task's outbound policy. */
8386
- outboundPolicy: OutboundPolicy$1 | undefined;
8404
+ outboundPolicy: OutboundPolicy | undefined;
8387
8405
  }
8388
8406
  declare const TaskSetOutboundPolicyRequest: MessageFns<TaskSetOutboundPolicyRequest>;
8389
8407
  interface TaskSnapshotDirectoryRequest {
@@ -8677,6 +8695,8 @@ type HeaderReplacement = {
8677
8695
  * Immutable configuration for replacing headers in outbound HTTPS requests
8678
8696
  * from a Sandbox.
8679
8697
  *
8698
+ * EXPERIMENTAL: the API is subject to change.
8699
+ *
8680
8700
  * Header values support templating with keys in a replacement's secret: a
8681
8701
  * `$`-prefixed key name in the secret is replaced with the secret value.
8682
8702
  * Literal `$` characters are written `$$`.
@@ -8687,7 +8707,7 @@ type HeaderReplacement = {
8687
8707
  * ```ts
8688
8708
  * const secret = await modal.secrets.fromName("api-token");
8689
8709
  *
8690
- * const outboundPolicy = new modal.OutboundPolicy()
8710
+ * const outboundPolicy = new modal.ExperimentalOutboundPolicy()
8691
8711
  * // Inject a secret-backed Authorization header.
8692
8712
  * .withHeaderReplacement({
8693
8713
  * domain: "example.com",
@@ -8700,16 +8720,18 @@ type HeaderReplacement = {
8700
8720
  * headers: { "X-Trace-Token": "trace_abcd" },
8701
8721
  * });
8702
8722
  *
8703
- * const sb = await modal.sandboxes.create(app, image, { outboundPolicy });
8723
+ * const sb = await modal.sandboxes.create(app, image, {
8724
+ * experimentalOutboundPolicy: outboundPolicy,
8725
+ * });
8704
8726
  * ```
8705
8727
  */
8706
- declare class OutboundPolicy {
8728
+ declare class ExperimentalOutboundPolicy {
8707
8729
  /** @internal */
8708
8730
  readonly _replacements: readonly HeaderReplacement[];
8709
8731
  /** @internal */
8710
8732
  constructor(_replacements?: readonly HeaderReplacement[]);
8711
8733
  /**
8712
- * Return a new {@link OutboundPolicy} with an added header replacement.
8734
+ * Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
8713
8735
  *
8714
8736
  * @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
8715
8737
  * prefixes (matching the apex domain and subdomains) and a bare `"*"`.
@@ -8722,7 +8744,7 @@ declare class OutboundPolicy {
8722
8744
  domain: string;
8723
8745
  headers: Record<string, string>;
8724
8746
  secret?: Secret;
8725
- }): OutboundPolicy;
8747
+ }): ExperimentalOutboundPolicy;
8726
8748
  /** Check all replacements, throwing `InvalidError` on the first violation found.
8727
8749
  * @internal
8728
8750
  */
@@ -8734,7 +8756,7 @@ declare class OutboundPolicy {
8734
8756
  /** Convert to the wire format. Referenced secrets must be hydrated first.
8735
8757
  * @internal
8736
8758
  */
8737
- _toProto(): OutboundPolicy$1;
8759
+ _toProto(): OutboundPolicy;
8738
8760
  }
8739
8761
 
8740
8762
  /** Type of a filesystem entry. */
@@ -9209,6 +9231,8 @@ type StdioBehavior = "pipe" | "ignore";
9209
9231
  * means the data will be read as raw bytes (Uint8Array).
9210
9232
  */
9211
9233
  type StreamMode = "text" | "binary";
9234
+ /** Runtime a Sandbox runs in: a virtual machine, or gVisor. */
9235
+ type SandboxRuntime = "gvisor" | "vm";
9212
9236
  /** Optional parameters for {@link Probe.withTcp} and {@link Probe.withExec}. */
9213
9237
  type ProbeParams = {
9214
9238
  intervalMs: number;
@@ -9232,6 +9256,8 @@ type SandboxCreateParams = {
9232
9256
  memoryMiB?: number;
9233
9257
  /** Hard limit of memory in MiB. */
9234
9258
  memoryLimitMiB?: number;
9259
+ /** Runtime under which the Sandbox executes, or undefined to let Modal pick. */
9260
+ runtime?: SandboxRuntime;
9235
9261
  /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
9236
9262
  gpu?: string;
9237
9263
  /** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
@@ -9270,8 +9296,9 @@ type SandboxCreateParams = {
9270
9296
  outboundDomainAllowlist?: string[];
9271
9297
  /** Configuration for replacing headers in outbound HTTPS requests from the Sandbox.
9272
9298
  * Secrets referenced by the policy are resolved outside the Sandbox and are never
9273
- * visible to the workload. See {@link OutboundPolicy}. */
9274
- outboundPolicy?: OutboundPolicy;
9299
+ * visible to the workload. See {@link ExperimentalOutboundPolicy}.
9300
+ * EXPERIMENTAL: the API is subject to change. */
9301
+ experimentalOutboundPolicy?: ExperimentalOutboundPolicy;
9275
9302
  /** List of CIDRs allowed to connect inbound to the Sandbox (tunnels and connection tokens). If not set, all IPs are allowed. Cannot be used with blockNetwork. */
9276
9303
  inboundCidrAllowlist?: string[];
9277
9304
  /** Enable private IPv6 networking (i6pn) so Sandboxes in the same workspace can address each
@@ -9753,14 +9780,16 @@ declare class Sandbox {
9753
9780
  /**
9754
9781
  * Replace the outbound policy of a running Sandbox.
9755
9782
  *
9783
+ * EXPERIMENTAL: the API is subject to change.
9784
+ *
9756
9785
  * The new policy replaces all existing policy configuration on the
9757
9786
  * Sandbox; build a policy including any existing rules you want to keep.
9758
9787
  *
9759
- * Only Sandboxes created with an `outboundPolicy` can be updated this
9788
+ * Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
9760
9789
  * way; for Sandboxes created without one this fails, since header
9761
9790
  * replacement is only set up at creation time.
9762
9791
  */
9763
- updateOutboundPolicy(outboundPolicy: OutboundPolicy): Promise<void>;
9792
+ experimentalUpdateOutboundPolicy(outboundPolicy: ExperimentalOutboundPolicy): Promise<void>;
9764
9793
  /**
9765
9794
  * Reload all Volumes mounted in the Sandbox.
9766
9795
  *
@@ -10060,4 +10089,4 @@ declare class ClientClosedError extends Error {
10060
10089
 
10061
10090
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10062
10091
 
10063
- export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, OutboundPolicy, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
10092
+ export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
package/dist/index.d.ts CHANGED
@@ -702,6 +702,8 @@ interface AppGetInfoResponse_FunctionInfoSummary {
702
702
  /** True for Web Functions and classes with web methods; false for Servers. */
703
703
  webFunction: boolean;
704
704
  requiresProxyAuth?: boolean | undefined;
705
+ /** True for Sessioned Servers. */
706
+ isSessioned: boolean;
705
707
  }
706
708
  declare const AppGetInfoResponse_FunctionInfoSummary: MessageFns$1<AppGetInfoResponse_FunctionInfoSummary>;
707
709
  interface AppGetLayoutRequest {
@@ -3305,11 +3307,11 @@ interface ObjectDependency {
3305
3307
  }
3306
3308
  declare const ObjectDependency: MessageFns$1<ObjectDependency>;
3307
3309
  /** Policy for outbound traffic from a sandbox. */
3308
- interface OutboundPolicy$1 {
3310
+ interface OutboundPolicy {
3309
3311
  /** Replace headers in outbound HTTPS requests, potentially with secret values. */
3310
3312
  headerReplacements: OutboundPolicy_HeaderReplacement[];
3311
3313
  }
3312
- declare const OutboundPolicy$1: MessageFns$1<OutboundPolicy$1>;
3314
+ declare const OutboundPolicy: MessageFns$1<OutboundPolicy>;
3313
3315
  interface OutboundPolicy_HeaderReplacement {
3314
3316
  /**
3315
3317
  * Domain that the header replacements are scoped to. Supports wildcards in
@@ -3654,7 +3656,10 @@ interface Sandbox$1 {
3654
3656
  * Set by the backend at snapshot creation time.
3655
3657
  */
3656
3658
  runscRuntimeVersion?: string | undefined;
3657
- /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */
3659
+ /**
3660
+ * Runtime the sandbox runs in: "vm" for a virtual machine, or a container
3661
+ * runtime such as "gvisor". Leave it unset to let Modal pick.
3662
+ */
3658
3663
  runtime?: string | undefined;
3659
3664
  /** If set, the sandbox will be created with verbose logging enabled. */
3660
3665
  verbose: boolean;
@@ -3704,7 +3709,7 @@ interface Sandbox$1 {
3704
3709
  */
3705
3710
  inboundCidrAllowlist: string[];
3706
3711
  environmentVariables: StringMap | undefined;
3707
- outboundPolicy?: OutboundPolicy$1 | undefined;
3712
+ outboundPolicy?: OutboundPolicy | undefined;
3708
3713
  /**
3709
3714
  * If set, the sandbox's main container is served an X.509-SVID over a
3710
3715
  * SPIFFE Workload API socket, addressed by SPIFFE_ENDPOINT_SOCKET. The
@@ -4968,6 +4973,11 @@ interface WebhookTokenListResponse {
4968
4973
  tokens: WebhookToken[];
4969
4974
  }
4970
4975
  declare const WebhookTokenListResponse: MessageFns$1<WebhookTokenListResponse>;
4976
+ interface WebhookTokenUpdateRequest {
4977
+ tokenId: string;
4978
+ name?: string | undefined;
4979
+ }
4980
+ declare const WebhookTokenUpdateRequest: MessageFns$1<WebhookTokenUpdateRequest>;
4971
4981
  interface WorkspaceBillingRatesRequest {
4972
4982
  }
4973
4983
  declare const WorkspaceBillingRatesRequest: MessageFns$1<WorkspaceBillingRatesRequest>;
@@ -7070,6 +7080,14 @@ declare const ModalClientDefinition: {
7070
7080
  readonly responseStream: false;
7071
7081
  readonly options: {};
7072
7082
  };
7083
+ readonly webhookTokenUpdate: {
7084
+ readonly name: "WebhookTokenUpdate";
7085
+ readonly requestType: MessageFns$1<WebhookTokenUpdateRequest>;
7086
+ readonly requestStream: false;
7087
+ readonly responseType: MessageFns$1<WebhookToken>;
7088
+ readonly responseStream: false;
7089
+ readonly options: {};
7090
+ };
7073
7091
  /** Workspaces */
7074
7092
  readonly workspaceBillingRates: {
7075
7093
  readonly name: "WorkspaceBillingRates";
@@ -8383,7 +8401,7 @@ declare const TaskSetNetworkAccessRequest: MessageFns<TaskSetNetworkAccessReques
8383
8401
  interface TaskSetOutboundPolicyRequest {
8384
8402
  taskId: string;
8385
8403
  /** Replaces the task's outbound policy. */
8386
- outboundPolicy: OutboundPolicy$1 | undefined;
8404
+ outboundPolicy: OutboundPolicy | undefined;
8387
8405
  }
8388
8406
  declare const TaskSetOutboundPolicyRequest: MessageFns<TaskSetOutboundPolicyRequest>;
8389
8407
  interface TaskSnapshotDirectoryRequest {
@@ -8677,6 +8695,8 @@ type HeaderReplacement = {
8677
8695
  * Immutable configuration for replacing headers in outbound HTTPS requests
8678
8696
  * from a Sandbox.
8679
8697
  *
8698
+ * EXPERIMENTAL: the API is subject to change.
8699
+ *
8680
8700
  * Header values support templating with keys in a replacement's secret: a
8681
8701
  * `$`-prefixed key name in the secret is replaced with the secret value.
8682
8702
  * Literal `$` characters are written `$$`.
@@ -8687,7 +8707,7 @@ type HeaderReplacement = {
8687
8707
  * ```ts
8688
8708
  * const secret = await modal.secrets.fromName("api-token");
8689
8709
  *
8690
- * const outboundPolicy = new modal.OutboundPolicy()
8710
+ * const outboundPolicy = new modal.ExperimentalOutboundPolicy()
8691
8711
  * // Inject a secret-backed Authorization header.
8692
8712
  * .withHeaderReplacement({
8693
8713
  * domain: "example.com",
@@ -8700,16 +8720,18 @@ type HeaderReplacement = {
8700
8720
  * headers: { "X-Trace-Token": "trace_abcd" },
8701
8721
  * });
8702
8722
  *
8703
- * const sb = await modal.sandboxes.create(app, image, { outboundPolicy });
8723
+ * const sb = await modal.sandboxes.create(app, image, {
8724
+ * experimentalOutboundPolicy: outboundPolicy,
8725
+ * });
8704
8726
  * ```
8705
8727
  */
8706
- declare class OutboundPolicy {
8728
+ declare class ExperimentalOutboundPolicy {
8707
8729
  /** @internal */
8708
8730
  readonly _replacements: readonly HeaderReplacement[];
8709
8731
  /** @internal */
8710
8732
  constructor(_replacements?: readonly HeaderReplacement[]);
8711
8733
  /**
8712
- * Return a new {@link OutboundPolicy} with an added header replacement.
8734
+ * Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
8713
8735
  *
8714
8736
  * @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
8715
8737
  * prefixes (matching the apex domain and subdomains) and a bare `"*"`.
@@ -8722,7 +8744,7 @@ declare class OutboundPolicy {
8722
8744
  domain: string;
8723
8745
  headers: Record<string, string>;
8724
8746
  secret?: Secret;
8725
- }): OutboundPolicy;
8747
+ }): ExperimentalOutboundPolicy;
8726
8748
  /** Check all replacements, throwing `InvalidError` on the first violation found.
8727
8749
  * @internal
8728
8750
  */
@@ -8734,7 +8756,7 @@ declare class OutboundPolicy {
8734
8756
  /** Convert to the wire format. Referenced secrets must be hydrated first.
8735
8757
  * @internal
8736
8758
  */
8737
- _toProto(): OutboundPolicy$1;
8759
+ _toProto(): OutboundPolicy;
8738
8760
  }
8739
8761
 
8740
8762
  /** Type of a filesystem entry. */
@@ -9209,6 +9231,8 @@ type StdioBehavior = "pipe" | "ignore";
9209
9231
  * means the data will be read as raw bytes (Uint8Array).
9210
9232
  */
9211
9233
  type StreamMode = "text" | "binary";
9234
+ /** Runtime a Sandbox runs in: a virtual machine, or gVisor. */
9235
+ type SandboxRuntime = "gvisor" | "vm";
9212
9236
  /** Optional parameters for {@link Probe.withTcp} and {@link Probe.withExec}. */
9213
9237
  type ProbeParams = {
9214
9238
  intervalMs: number;
@@ -9232,6 +9256,8 @@ type SandboxCreateParams = {
9232
9256
  memoryMiB?: number;
9233
9257
  /** Hard limit of memory in MiB. */
9234
9258
  memoryLimitMiB?: number;
9259
+ /** Runtime under which the Sandbox executes, or undefined to let Modal pick. */
9260
+ runtime?: SandboxRuntime;
9235
9261
  /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
9236
9262
  gpu?: string;
9237
9263
  /** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
@@ -9270,8 +9296,9 @@ type SandboxCreateParams = {
9270
9296
  outboundDomainAllowlist?: string[];
9271
9297
  /** Configuration for replacing headers in outbound HTTPS requests from the Sandbox.
9272
9298
  * Secrets referenced by the policy are resolved outside the Sandbox and are never
9273
- * visible to the workload. See {@link OutboundPolicy}. */
9274
- outboundPolicy?: OutboundPolicy;
9299
+ * visible to the workload. See {@link ExperimentalOutboundPolicy}.
9300
+ * EXPERIMENTAL: the API is subject to change. */
9301
+ experimentalOutboundPolicy?: ExperimentalOutboundPolicy;
9275
9302
  /** List of CIDRs allowed to connect inbound to the Sandbox (tunnels and connection tokens). If not set, all IPs are allowed. Cannot be used with blockNetwork. */
9276
9303
  inboundCidrAllowlist?: string[];
9277
9304
  /** Enable private IPv6 networking (i6pn) so Sandboxes in the same workspace can address each
@@ -9753,14 +9780,16 @@ declare class Sandbox {
9753
9780
  /**
9754
9781
  * Replace the outbound policy of a running Sandbox.
9755
9782
  *
9783
+ * EXPERIMENTAL: the API is subject to change.
9784
+ *
9756
9785
  * The new policy replaces all existing policy configuration on the
9757
9786
  * Sandbox; build a policy including any existing rules you want to keep.
9758
9787
  *
9759
- * Only Sandboxes created with an `outboundPolicy` can be updated this
9788
+ * Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
9760
9789
  * way; for Sandboxes created without one this fails, since header
9761
9790
  * replacement is only set up at creation time.
9762
9791
  */
9763
- updateOutboundPolicy(outboundPolicy: OutboundPolicy): Promise<void>;
9792
+ experimentalUpdateOutboundPolicy(outboundPolicy: ExperimentalOutboundPolicy): Promise<void>;
9764
9793
  /**
9765
9794
  * Reload all Volumes mounted in the Sandbox.
9766
9795
  *
@@ -10060,4 +10089,4 @@ declare class ClientClosedError extends Error {
10060
10089
 
10061
10090
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10062
10091
 
10063
- export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, OutboundPolicy, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
10092
+ export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
package/dist/index.js CHANGED
@@ -5491,7 +5491,7 @@ var AppGetInfoResponse = {
5491
5491
  }
5492
5492
  };
5493
5493
  function createBaseAppGetInfoResponse_FunctionInfoSummary() {
5494
- return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0 };
5494
+ return { gpuConfig: [], schedule: void 0, webFunction: false, requiresProxyAuth: void 0, isSessioned: false };
5495
5495
  }
5496
5496
  var AppGetInfoResponse_FunctionInfoSummary = {
5497
5497
  encode(message, writer = new BinaryWriter()) {
@@ -5507,6 +5507,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5507
5507
  if (message.requiresProxyAuth !== void 0) {
5508
5508
  writer.uint32(32).bool(message.requiresProxyAuth);
5509
5509
  }
5510
+ if (message.isSessioned !== false) {
5511
+ writer.uint32(40).bool(message.isSessioned);
5512
+ }
5510
5513
  return writer;
5511
5514
  },
5512
5515
  decode(input, length) {
@@ -5544,6 +5547,13 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5544
5547
  message.requiresProxyAuth = reader.bool();
5545
5548
  continue;
5546
5549
  }
5550
+ case 5: {
5551
+ if (tag !== 40) {
5552
+ break;
5553
+ }
5554
+ message.isSessioned = reader.bool();
5555
+ continue;
5556
+ }
5547
5557
  }
5548
5558
  if ((tag & 7) === 4 || tag === 0) {
5549
5559
  break;
@@ -5557,7 +5567,8 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5557
5567
  gpuConfig: globalThis.Array.isArray(object?.gpuConfig) ? object.gpuConfig.map((e) => GPUConfig.fromJSON(e)) : [],
5558
5568
  schedule: isSet5(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0,
5559
5569
  webFunction: isSet5(object.webFunction) ? globalThis.Boolean(object.webFunction) : false,
5560
- requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0
5570
+ requiresProxyAuth: isSet5(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : void 0,
5571
+ isSessioned: isSet5(object.isSessioned) ? globalThis.Boolean(object.isSessioned) : false
5561
5572
  };
5562
5573
  },
5563
5574
  toJSON(message) {
@@ -5574,6 +5585,9 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5574
5585
  if (message.requiresProxyAuth !== void 0) {
5575
5586
  obj.requiresProxyAuth = message.requiresProxyAuth;
5576
5587
  }
5588
+ if (message.isSessioned !== false) {
5589
+ obj.isSessioned = message.isSessioned;
5590
+ }
5577
5591
  return obj;
5578
5592
  },
5579
5593
  create(base) {
@@ -5585,6 +5599,7 @@ var AppGetInfoResponse_FunctionInfoSummary = {
5585
5599
  message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0;
5586
5600
  message.webFunction = object.webFunction ?? false;
5587
5601
  message.requiresProxyAuth = object.requiresProxyAuth ?? void 0;
5602
+ message.isSessioned = object.isSessioned ?? false;
5588
5603
  return message;
5589
5604
  }
5590
5605
  };
@@ -58570,6 +58585,74 @@ var WebhookTokenListResponse = {
58570
58585
  return message;
58571
58586
  }
58572
58587
  };
58588
+ function createBaseWebhookTokenUpdateRequest() {
58589
+ return { tokenId: "", name: void 0 };
58590
+ }
58591
+ var WebhookTokenUpdateRequest = {
58592
+ encode(message, writer = new BinaryWriter()) {
58593
+ if (message.tokenId !== "") {
58594
+ writer.uint32(10).string(message.tokenId);
58595
+ }
58596
+ if (message.name !== void 0) {
58597
+ writer.uint32(18).string(message.name);
58598
+ }
58599
+ return writer;
58600
+ },
58601
+ decode(input, length) {
58602
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
58603
+ let end = length === void 0 ? reader.len : reader.pos + length;
58604
+ const message = createBaseWebhookTokenUpdateRequest();
58605
+ while (reader.pos < end) {
58606
+ const tag = reader.uint32();
58607
+ switch (tag >>> 3) {
58608
+ case 1: {
58609
+ if (tag !== 10) {
58610
+ break;
58611
+ }
58612
+ message.tokenId = reader.string();
58613
+ continue;
58614
+ }
58615
+ case 2: {
58616
+ if (tag !== 18) {
58617
+ break;
58618
+ }
58619
+ message.name = reader.string();
58620
+ continue;
58621
+ }
58622
+ }
58623
+ if ((tag & 7) === 4 || tag === 0) {
58624
+ break;
58625
+ }
58626
+ reader.skip(tag & 7);
58627
+ }
58628
+ return message;
58629
+ },
58630
+ fromJSON(object) {
58631
+ return {
58632
+ tokenId: isSet5(object.tokenId) ? globalThis.String(object.tokenId) : "",
58633
+ name: isSet5(object.name) ? globalThis.String(object.name) : void 0
58634
+ };
58635
+ },
58636
+ toJSON(message) {
58637
+ const obj = {};
58638
+ if (message.tokenId !== "") {
58639
+ obj.tokenId = message.tokenId;
58640
+ }
58641
+ if (message.name !== void 0) {
58642
+ obj.name = message.name;
58643
+ }
58644
+ return obj;
58645
+ },
58646
+ create(base) {
58647
+ return WebhookTokenUpdateRequest.fromPartial(base ?? {});
58648
+ },
58649
+ fromPartial(object) {
58650
+ const message = createBaseWebhookTokenUpdateRequest();
58651
+ message.tokenId = object.tokenId ?? "";
58652
+ message.name = object.name ?? void 0;
58653
+ return message;
58654
+ }
58655
+ };
58573
58656
  function createBaseWorkspaceBillingRatesRequest() {
58574
58657
  return {};
58575
58658
  }
@@ -62542,6 +62625,14 @@ var ModalClientDefinition = {
62542
62625
  responseStream: false,
62543
62626
  options: {}
62544
62627
  },
62628
+ webhookTokenUpdate: {
62629
+ name: "WebhookTokenUpdate",
62630
+ requestType: WebhookTokenUpdateRequest,
62631
+ requestStream: false,
62632
+ responseType: WebhookToken,
62633
+ responseStream: false,
62634
+ options: {}
62635
+ },
62545
62636
  /** Workspaces */
62546
62637
  workspaceBillingRates: {
62547
62638
  name: "WorkspaceBillingRates",
@@ -71321,6 +71412,19 @@ function getSandboxVersion(sandboxId) {
71321
71412
  }
71322
71413
  return "V2" /* V2 */;
71323
71414
  }
71415
+ function sandboxRuntimeToProto(runtime) {
71416
+ switch (runtime) {
71417
+ case void 0:
71418
+ return void 0;
71419
+ case "gvisor":
71420
+ case "vm":
71421
+ return runtime;
71422
+ default:
71423
+ throw new Error(
71424
+ `runtime must be "gvisor" or "vm", got ${JSON.stringify(runtime)}`
71425
+ );
71426
+ }
71427
+ }
71324
71428
  var Probe2 = class _Probe {
71325
71429
  #tcpPort;
71326
71430
  #execArgv;
@@ -71454,6 +71558,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71454
71558
  if (params.workdir && !params.workdir.startsWith("/")) {
71455
71559
  throw new Error(`workdir must be an absolute path, got: ${params.workdir}`);
71456
71560
  }
71561
+ const runtime = sandboxRuntimeToProto(params.runtime);
71457
71562
  const volumeMounts = params.volumes ? Object.entries(params.volumes).map(
71458
71563
  ([mountPath, volume]) => volumeToMountProto(mountPath, volume)
71459
71564
  ) : [];
@@ -71505,16 +71610,16 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71505
71610
  );
71506
71611
  }
71507
71612
  }
71508
- if (params.outboundPolicy !== void 0) {
71509
- params.outboundPolicy._validate();
71613
+ if (params.experimentalOutboundPolicy !== void 0) {
71614
+ params.experimentalOutboundPolicy._validate();
71510
71615
  if (params.blockNetwork) {
71511
71616
  throw new InvalidError(
71512
- "outboundPolicy cannot be used when blockNetwork is enabled"
71617
+ "experimentalOutboundPolicy cannot be used when blockNetwork is enabled"
71513
71618
  );
71514
71619
  }
71515
71620
  if (params.outboundDomainAllowlist && params.outboundDomainAllowlist.length > 0) {
71516
71621
  throw new InvalidError(
71517
- "outboundPolicy cannot be used with outboundDomainAllowlist"
71622
+ "experimentalOutboundPolicy cannot be used with outboundDomainAllowlist"
71518
71623
  );
71519
71624
  }
71520
71625
  }
@@ -71598,7 +71703,7 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71598
71703
  idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
71599
71704
  workdir: params.workdir ?? void 0,
71600
71705
  networkAccess,
71601
- outboundPolicy: params.outboundPolicy?._toProto(),
71706
+ outboundPolicy: params.experimentalOutboundPolicy?._toProto(),
71602
71707
  resources: Resources.create({
71603
71708
  milliCpu,
71604
71709
  milliCpuMax,
@@ -71622,7 +71727,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
71622
71727
  includeOidcIdentityToken: params.includeOidcIdentityToken ?? false,
71623
71728
  inboundCidrAllowlist: params.inboundCidrAllowlist ?? [],
71624
71729
  i6pnEnabled: params.i6pn ?? false,
71625
- enableSnapshot: params.experimentalEnableSnapshot ?? false
71730
+ enableSnapshot: params.experimentalEnableSnapshot ?? false,
71731
+ runtime
71626
71732
  }
71627
71733
  });
71628
71734
  }
@@ -71659,7 +71765,10 @@ var SandboxService = class {
71659
71765
  );
71660
71766
  await hydrateSandboxSecrets(
71661
71767
  this.#client,
71662
- [...mergedSecrets, ...params.outboundPolicy?._secrets() ?? []],
71768
+ [
71769
+ ...mergedSecrets,
71770
+ ...params.experimentalOutboundPolicy?._secrets() ?? []
71771
+ ],
71663
71772
  params.cloudBucketMounts
71664
71773
  );
71665
71774
  const mergedParams = {
@@ -71720,7 +71829,10 @@ var SandboxService = class {
71720
71829
  Object.assign(envDict, params.env ?? {});
71721
71830
  await hydrateSandboxSecrets(
71722
71831
  this.#client,
71723
- [...resolvableSecrets, ...params.outboundPolicy?._secrets() ?? []],
71832
+ [
71833
+ ...resolvableSecrets,
71834
+ ...params.experimentalOutboundPolicy?._secrets() ?? []
71835
+ ],
71724
71836
  params.cloudBucketMounts
71725
71837
  );
71726
71838
  const mergedParams = {
@@ -72928,14 +73040,16 @@ var Sandbox2 = class _Sandbox {
72928
73040
  /**
72929
73041
  * Replace the outbound policy of a running Sandbox.
72930
73042
  *
73043
+ * EXPERIMENTAL: the API is subject to change.
73044
+ *
72931
73045
  * The new policy replaces all existing policy configuration on the
72932
73046
  * Sandbox; build a policy including any existing rules you want to keep.
72933
73047
  *
72934
- * Only Sandboxes created with an `outboundPolicy` can be updated this
73048
+ * Only Sandboxes created with an `experimentalOutboundPolicy` can be updated this
72935
73049
  * way; for Sandboxes created without one this fails, since header
72936
73050
  * replacement is only set up at creation time.
72937
73051
  */
72938
- async updateOutboundPolicy(outboundPolicy) {
73052
+ async experimentalUpdateOutboundPolicy(outboundPolicy) {
72939
73053
  this.#ensureAttached();
72940
73054
  outboundPolicy._validate();
72941
73055
  const [, [taskId, commandRouterClient]] = await Promise.all([
@@ -73505,7 +73619,7 @@ var AuthTokenManager = class {
73505
73619
  };
73506
73620
 
73507
73621
  // src/version.ts
73508
- var SDK_VERSION = "0.10.2-dev.7";
73622
+ var SDK_VERSION = "0.10.2-dev.8";
73509
73623
  function getSDKVersion() {
73510
73624
  return SDK_VERSION;
73511
73625
  }
@@ -75961,7 +76075,7 @@ function templateReferencesKey(template) {
75961
76075
  }
75962
76076
  return false;
75963
76077
  }
75964
- var OutboundPolicy2 = class _OutboundPolicy {
76078
+ var ExperimentalOutboundPolicy = class _ExperimentalOutboundPolicy {
75965
76079
  /** @internal */
75966
76080
  _replacements;
75967
76081
  /** @internal */
@@ -75969,7 +76083,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
75969
76083
  this._replacements = _replacements;
75970
76084
  }
75971
76085
  /**
75972
- * Return a new {@link OutboundPolicy} with an added header replacement.
76086
+ * Return a new {@link ExperimentalOutboundPolicy} with an added header replacement.
75973
76087
  *
75974
76088
  * @param params.domain Domain the replacements are scoped to. Supports `*.` wildcard
75975
76089
  * prefixes (matching the apex domain and subdomains) and a bare `"*"`.
@@ -75980,7 +76094,7 @@ var OutboundPolicy2 = class _OutboundPolicy {
75980
76094
  */
75981
76095
  withHeaderReplacement(params) {
75982
76096
  const { domain, headers, secret } = params;
75983
- return new _OutboundPolicy([
76097
+ return new _ExperimentalOutboundPolicy([
75984
76098
  ...this._replacements,
75985
76099
  { domain, headers: { ...headers }, secret }
75986
76100
  ]);
@@ -76067,6 +76181,7 @@ export {
76067
76181
  ConflictError,
76068
76182
  ContainerProcess2 as ContainerProcess,
76069
76183
  ExecutionError,
76184
+ ExperimentalOutboundPolicy,
76070
76185
  FunctionCall,
76071
76186
  FunctionCallLogsManager,
76072
76187
  FunctionCallService,
@@ -76080,7 +76195,6 @@ export {
76080
76195
  InvalidError,
76081
76196
  ModalClient,
76082
76197
  NotFoundError,
76083
- OutboundPolicy2 as OutboundPolicy,
76084
76198
  Probe2 as Probe,
76085
76199
  Proxy2 as Proxy,
76086
76200
  ProxyService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modal",
3
- "version": "0.10.2-dev.7",
3
+ "version": "0.10.2-dev.8",
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",