modal 0.7.6 → 0.8.0

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.d.cts CHANGED
@@ -140,6 +140,14 @@ declare enum EndpointInputModality {
140
140
  ENDPOINT_INPUT_MODALITY_AUDIO = 3,
141
141
  UNRECOGNIZED = -1
142
142
  }
143
+ declare enum EndpointProvisioningStatus {
144
+ ENDPOINT_PROVISIONING_STATUS_UNSPECIFIED = 0,
145
+ ENDPOINT_PROVISIONING_STATUS_PENDING = 1,
146
+ ENDPOINT_PROVISIONING_STATUS_RUNNING = 2,
147
+ ENDPOINT_PROVISIONING_STATUS_SUCCEEDED = 3,
148
+ ENDPOINT_PROVISIONING_STATUS_FAILED = 4,
149
+ UNRECOGNIZED = -1
150
+ }
143
151
  declare enum EndpointStopSource {
144
152
  ENDPOINT_STOP_SOURCE_UNSPECIFIED = 0,
145
153
  ENDPOINT_STOP_SOURCE_CLI = 1,
@@ -820,6 +828,10 @@ interface AutoscalerSettings {
820
828
  scaleupWindow?: number | undefined;
821
829
  /** Maximum amount of time a container can be idle before being scaled down, in seconds; pka "container_idle_timeout" */
822
830
  scaledownWindow?: number | undefined;
831
+ /** Target concurrent inputs per replica for Flash autoscaling. */
832
+ targetConcurrency?: number | undefined;
833
+ /** Maximum number of containers that can be scaled down per minute for Flash autoscaling. */
834
+ scaledownRateLimit?: number | undefined;
823
835
  }
824
836
  declare const AutoscalerSettings: MessageFns$1<AutoscalerSettings>;
825
837
  interface BaseImage {
@@ -896,6 +908,7 @@ interface ClassGetRequest {
896
908
  environmentName: string;
897
909
  /** True starting with 0.67.x clients, which don't create method placeholder functions */
898
910
  onlyClassFunction: boolean;
911
+ appVersion: number;
899
912
  }
900
913
  declare const ClassGetRequest: MessageFns$1<ClassGetRequest>;
901
914
  interface ClassGetResponse {
@@ -1381,6 +1394,7 @@ interface EndpointCreateRequest {
1381
1394
  declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
1382
1395
  interface EndpointCreateResponse {
1383
1396
  endpointId: string;
1397
+ endpointPageUrl: string;
1384
1398
  }
1385
1399
  declare const EndpointCreateResponse: MessageFns$1<EndpointCreateResponse>;
1386
1400
  interface EndpointCustomModelSource {
@@ -1402,6 +1416,10 @@ interface EndpointListItem {
1402
1416
  activeDeploymentId: string;
1403
1417
  updatedAt: number;
1404
1418
  metadata: EndpointMetadata | undefined;
1419
+ appState: AppState;
1420
+ functionId: string;
1421
+ createdByAvatarUrl: string;
1422
+ provisioningStatus: EndpointProvisioningStatus;
1405
1423
  }
1406
1424
  declare const EndpointListItem: MessageFns$1<EndpointListItem>;
1407
1425
  interface EndpointListRequest {
@@ -1440,6 +1458,7 @@ declare const EndpointStopResponse: MessageFns$1<EndpointStopResponse>;
1440
1458
  interface EnvironmentCreateRequest {
1441
1459
  name: string;
1442
1460
  isManaged: boolean;
1461
+ settings: EnvironmentSettings | undefined;
1443
1462
  }
1444
1463
  declare const EnvironmentCreateRequest: MessageFns$1<EnvironmentCreateRequest>;
1445
1464
  interface EnvironmentDeleteRequest {
@@ -1521,6 +1540,8 @@ declare const EnvironmentSetManagedRequest: MessageFns$1<EnvironmentSetManagedRe
1521
1540
  interface EnvironmentSettings {
1522
1541
  imageBuilderVersion: string;
1523
1542
  webhookSuffix: string;
1543
+ maxConcurrentGpus?: number | undefined;
1544
+ maxConcurrentTasks?: number | undefined;
1524
1545
  }
1525
1546
  declare const EnvironmentSettings: MessageFns$1<EnvironmentSettings>;
1526
1547
  interface EnvironmentUpdateRequest {
@@ -1704,8 +1725,8 @@ interface FunctionMessage {
1704
1725
  [key: string]: string;
1705
1726
  };
1706
1727
  /**
1707
- * If set, client deps will be mounted into the container, and are
1708
- * no longer expected to exist in the image itself.
1728
+ * Deprecated: still set by client but ignored by server. The scheduler
1729
+ * derives this from the image's builder_version directly.
1709
1730
  */
1710
1731
  mountClientDependencies: boolean;
1711
1732
  flashServiceUrls: string[];
@@ -1744,7 +1765,7 @@ declare const FunctionAsyncInvokeResponse: MessageFns$1<FunctionAsyncInvokeRespo
1744
1765
  interface FunctionBindParamsRequest {
1745
1766
  functionId: string;
1746
1767
  serializedParams: Uint8Array;
1747
- functionOptions: FunctionOptions | undefined;
1768
+ functionOptions: FunctionOptions$1 | undefined;
1748
1769
  environmentName: string;
1749
1770
  /** Only used for the input plane. */
1750
1771
  authSecret: string;
@@ -1783,7 +1804,6 @@ interface FunctionCallGetDataRequest {
1783
1804
  functionCallId?: string | undefined;
1784
1805
  attemptToken?: string | undefined;
1785
1806
  lastIndex: number;
1786
- useGaplessRead: boolean;
1787
1807
  }
1788
1808
  declare const FunctionCallGetDataRequest: MessageFns$1<FunctionCallGetDataRequest>;
1789
1809
  interface FunctionCallInfo {
@@ -2033,6 +2053,7 @@ interface FunctionGetRequest {
2033
2053
  appName: string;
2034
2054
  objectTag: string;
2035
2055
  environmentName: string;
2056
+ appVersion: number;
2036
2057
  }
2037
2058
  declare const FunctionGetRequest: MessageFns$1<FunctionGetRequest>;
2038
2059
  interface FunctionGetResponse {
@@ -2111,7 +2132,8 @@ interface FunctionMapResponse {
2111
2132
  maxInputsOutstanding: number;
2112
2133
  }
2113
2134
  declare const FunctionMapResponse: MessageFns$1<FunctionMapResponse>;
2114
- interface FunctionOptions {
2135
+ /** todo(ayush): update this to also use `autoscaler_settings` */
2136
+ interface FunctionOptions$1 {
2115
2137
  secretIds: string[];
2116
2138
  /** Currently not supported */
2117
2139
  mountIds: string[];
@@ -2133,8 +2155,9 @@ interface FunctionOptions {
2133
2155
  cloudProviderStr?: string | undefined;
2134
2156
  replaceCloudBucketMounts: boolean;
2135
2157
  cloudBucketMounts: CloudBucketMount$1[];
2158
+ pinnedAppVersion?: number | undefined;
2136
2159
  }
2137
- declare const FunctionOptions: MessageFns$1<FunctionOptions>;
2160
+ declare const FunctionOptions$1: MessageFns$1<FunctionOptions$1>;
2138
2161
  interface FunctionPrecreateRequest {
2139
2162
  appId: string;
2140
2163
  functionName: string;
@@ -2342,6 +2365,16 @@ interface ImageFromIdResponse {
2342
2365
  metadata: ImageMetadata | undefined;
2343
2366
  }
2344
2367
  declare const ImageFromIdResponse: MessageFns$1<ImageFromIdResponse>;
2368
+ interface ImageGetByTagRequest {
2369
+ /** Full "name:tag" string. Must be non-empty. */
2370
+ tag: string;
2371
+ environmentName: string;
2372
+ }
2373
+ declare const ImageGetByTagRequest: MessageFns$1<ImageGetByTagRequest>;
2374
+ interface ImageGetByTagResponse {
2375
+ imageId: string;
2376
+ }
2377
+ declare const ImageGetByTagResponse: MessageFns$1<ImageGetByTagResponse>;
2345
2378
  interface ImageGetOrCreateRequest {
2346
2379
  image: Image$1 | undefined;
2347
2380
  appId: string;
@@ -2382,6 +2415,29 @@ interface ImageJoinStreamingResponse {
2382
2415
  metadata: ImageMetadata | undefined;
2383
2416
  }
2384
2417
  declare const ImageJoinStreamingResponse: MessageFns$1<ImageJoinStreamingResponse>;
2418
+ interface ImageListTagsItem {
2419
+ tag: string;
2420
+ imageId: string;
2421
+ revisionId: string;
2422
+ createdAt: number;
2423
+ updatedAt: number;
2424
+ }
2425
+ declare const ImageListTagsItem: MessageFns$1<ImageListTagsItem>;
2426
+ interface ImageListTagsRequest {
2427
+ environmentName: string;
2428
+ /** Prefix search over full "name:tag" strings. */
2429
+ tagPrefix: string;
2430
+ /** Defaults to 100. Values above 100 are rejected by the server. */
2431
+ maxObjects: number;
2432
+ pageToken: string;
2433
+ }
2434
+ declare const ImageListTagsRequest: MessageFns$1<ImageListTagsRequest>;
2435
+ interface ImageListTagsResponse {
2436
+ items: ImageListTagsItem[];
2437
+ nextPageToken: string;
2438
+ environmentName: string;
2439
+ }
2440
+ declare const ImageListTagsResponse: MessageFns$1<ImageListTagsResponse>;
2385
2441
  interface ImageMetadata {
2386
2442
  /** The output of `python -VV. Not set if missing */
2387
2443
  pythonVersionInfo?: string | undefined;
@@ -2406,11 +2462,47 @@ interface ImageMetadata {
2406
2462
  imageBuilderVersion?: string | undefined;
2407
2463
  }
2408
2464
  declare const ImageMetadata: MessageFns$1<ImageMetadata>;
2465
+ interface ImagePublishRequest {
2466
+ imageId: string;
2467
+ /** Full "name:tag" string. Must be non-empty. Each ImagePublish RPC writes exactly one tag. */
2468
+ tag: string;
2469
+ environmentName: string;
2470
+ /** Marks the published tag as public. Public read protocol is defined separately. */
2471
+ isPublic: boolean;
2472
+ }
2473
+ declare const ImagePublishRequest: MessageFns$1<ImagePublishRequest>;
2474
+ interface ImagePublishResponse {
2475
+ imageId: string;
2476
+ revisionId: string;
2477
+ }
2478
+ declare const ImagePublishResponse: MessageFns$1<ImagePublishResponse>;
2409
2479
  interface ImageRegistryConfig {
2410
2480
  registryAuthType: RegistryAuthType;
2411
2481
  secretId: string;
2412
2482
  }
2413
2483
  declare const ImageRegistryConfig: MessageFns$1<ImageRegistryConfig>;
2484
+ interface ImageTagRevisionsItem {
2485
+ imageId: string;
2486
+ revisionId: string;
2487
+ createdAt: number;
2488
+ }
2489
+ declare const ImageTagRevisionsItem: MessageFns$1<ImageTagRevisionsItem>;
2490
+ interface ImageTagRevisionsRequest {
2491
+ /** Full "name:tag" string. Must be non-empty. */
2492
+ tag: string;
2493
+ environmentName: string;
2494
+ /** Defaults to 100. Values above 100 are rejected by the server. */
2495
+ maxObjects: number;
2496
+ pageToken: string;
2497
+ }
2498
+ declare const ImageTagRevisionsRequest: MessageFns$1<ImageTagRevisionsRequest>;
2499
+ interface ImageTagRevisionsResponse {
2500
+ items: ImageTagRevisionsItem[];
2501
+ nextPageToken: string;
2502
+ tag: string;
2503
+ environmentName: string;
2504
+ }
2505
+ declare const ImageTagRevisionsResponse: MessageFns$1<ImageTagRevisionsResponse>;
2414
2506
  interface InputCallGraphInfo {
2415
2507
  inputId: string;
2416
2508
  status: GenericResult_GenericStatus;
@@ -2554,6 +2646,7 @@ declare const MultiPartUploadList: MessageFns$1<MultiPartUploadList>;
2554
2646
  interface NetworkAccess {
2555
2647
  networkAccessType: NetworkAccess_NetworkAccessType;
2556
2648
  allowedCidrs: string[];
2649
+ allowedDomains: string[];
2557
2650
  }
2558
2651
  declare const NetworkAccess: MessageFns$1<NetworkAccess>;
2559
2652
  interface NotebookKernelPublishResultsRequest {
@@ -2975,10 +3068,18 @@ interface Sandbox$1 {
2975
3068
  verbose: boolean;
2976
3069
  /** If set, the sandbox will be created with a name. */
2977
3070
  name?: string | undefined;
2978
- /** Experimental options */
3071
+ /**
3072
+ * Deprecated: use experimental_options_v2 instead.
3073
+ *
3074
+ * @deprecated
3075
+ */
2979
3076
  experimentalOptions: {
2980
3077
  [key: string]: boolean;
2981
3078
  };
3079
+ /** Experimental options */
3080
+ experimentalOptionsV2: {
3081
+ [key: string]: string;
3082
+ };
2982
3083
  /** Internal use only. */
2983
3084
  preloadPathPrefixes: string[];
2984
3085
  /** Optional idle timeout in seconds. If set, the sandbox will be terminated after being idle for this duration. */
@@ -3016,6 +3117,8 @@ declare const Sandbox$1: MessageFns$1<Sandbox$1>;
3016
3117
  interface SandboxCreateConnectTokenRequest {
3017
3118
  sandboxId: string;
3018
3119
  userMetadata: string;
3120
+ /** Uses port 8080 if unspecified. */
3121
+ port?: number | undefined;
3019
3122
  }
3020
3123
  declare const SandboxCreateConnectTokenRequest: MessageFns$1<SandboxCreateConnectTokenRequest>;
3021
3124
  interface SandboxCreateConnectTokenResponse {
@@ -3156,6 +3259,8 @@ interface SandboxRestoreRequest {
3156
3259
  snapshotId: string;
3157
3260
  sandboxNameOverride: string;
3158
3261
  sandboxNameOverrideType: SandboxRestoreRequest_SandboxNameOverrideType;
3262
+ /** For internal debugging use only. */
3263
+ workerId: string;
3159
3264
  }
3160
3265
  declare const SandboxRestoreRequest: MessageFns$1<SandboxRestoreRequest>;
3161
3266
  interface SandboxRestoreResponse {
@@ -4012,6 +4117,7 @@ interface WorkspaceMembersListItem {
4012
4117
  identityProviderType: IdentityProviderType;
4013
4118
  email: string;
4014
4119
  avatarUrl: string;
4120
+ idpExternalId: string;
4015
4121
  }
4016
4122
  declare const WorkspaceMembersListItem: MessageFns$1<WorkspaceMembersListItem>;
4017
4123
  interface WorkspaceMembersListResponse {
@@ -4856,6 +4962,14 @@ declare const ModalClientDefinition: {
4856
4962
  readonly responseStream: false;
4857
4963
  readonly options: {};
4858
4964
  };
4965
+ readonly imageGetByTag: {
4966
+ readonly name: "ImageGetByTag";
4967
+ readonly requestType: MessageFns$1<ImageGetByTagRequest>;
4968
+ readonly requestStream: false;
4969
+ readonly responseType: MessageFns$1<ImageGetByTagResponse>;
4970
+ readonly responseStream: false;
4971
+ readonly options: {};
4972
+ };
4859
4973
  readonly imageGetOrCreate: {
4860
4974
  readonly name: "ImageGetOrCreate";
4861
4975
  readonly requestType: MessageFns$1<ImageGetOrCreateRequest>;
@@ -4872,6 +4986,30 @@ declare const ModalClientDefinition: {
4872
4986
  readonly responseStream: true;
4873
4987
  readonly options: {};
4874
4988
  };
4989
+ readonly imageListTags: {
4990
+ readonly name: "ImageListTags";
4991
+ readonly requestType: MessageFns$1<ImageListTagsRequest>;
4992
+ readonly requestStream: false;
4993
+ readonly responseType: MessageFns$1<ImageListTagsResponse>;
4994
+ readonly responseStream: false;
4995
+ readonly options: {};
4996
+ };
4997
+ readonly imagePublish: {
4998
+ readonly name: "ImagePublish";
4999
+ readonly requestType: MessageFns$1<ImagePublishRequest>;
5000
+ readonly requestStream: false;
5001
+ readonly responseType: MessageFns$1<ImagePublishResponse>;
5002
+ readonly responseStream: false;
5003
+ readonly options: {};
5004
+ };
5005
+ readonly imageTagRevisions: {
5006
+ readonly name: "ImageTagRevisions";
5007
+ readonly requestType: MessageFns$1<ImageTagRevisionsRequest>;
5008
+ readonly requestStream: false;
5009
+ readonly responseType: MessageFns$1<ImageTagRevisionsResponse>;
5010
+ readonly responseStream: false;
5011
+ readonly options: {};
5012
+ };
4875
5013
  /** Input Plane Map */
4876
5014
  readonly mapAwait: {
4877
5015
  readonly name: "MapAwait";
@@ -5159,6 +5297,14 @@ declare const ModalClientDefinition: {
5159
5297
  readonly responseStream: false;
5160
5298
  readonly options: {};
5161
5299
  };
5300
+ readonly sandboxListV2: {
5301
+ readonly name: "SandboxListV2";
5302
+ readonly requestType: MessageFns$1<SandboxListRequest>;
5303
+ readonly requestStream: false;
5304
+ readonly responseType: MessageFns$1<SandboxListResponse>;
5305
+ readonly responseStream: false;
5306
+ readonly options: {};
5307
+ };
5162
5308
  readonly sandboxRestore: {
5163
5309
  readonly name: "SandboxRestore";
5164
5310
  readonly requestType: MessageFns$1<SandboxRestoreRequest>;
@@ -5730,14 +5876,6 @@ declare class Secret {
5730
5876
  readonly name?: string;
5731
5877
  /** @ignore */
5732
5878
  constructor(secretId: string, name?: string);
5733
- /**
5734
- * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead.
5735
- */
5736
- static fromName(name: string, params?: SecretFromNameParams): Promise<Secret>;
5737
- /**
5738
- * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead.
5739
- */
5740
- static fromObject(entries: Record<string, string>, params?: SecretFromObjectParams): Promise<Secret>;
5741
5879
  }
5742
5880
 
5743
5881
  declare class CloudBucketMountService {
@@ -5762,17 +5900,6 @@ declare class CloudBucketMount {
5762
5900
  readonly bucketEndpointUrl?: string;
5763
5901
  readonly keyPrefix?: string;
5764
5902
  readonly oidcAuthRoleArn?: string;
5765
- /**
5766
- * @deprecated Use {@link CloudBucketMountService#create client.cloudBucketMounts.create()} instead.
5767
- */
5768
- constructor(bucketName: string, params?: {
5769
- secret?: Secret;
5770
- readOnly?: boolean;
5771
- requesterPays?: boolean;
5772
- bucketEndpointUrl?: string;
5773
- keyPrefix?: string;
5774
- oidcAuthRoleArn?: string;
5775
- });
5776
5903
  /** @ignore */
5777
5904
  constructor(bucketName: string, secret: Secret | undefined, readOnly: boolean, requesterPays: boolean, bucketEndpointUrl: string | undefined, keyPrefix: string | undefined, oidcAuthRoleArn: string | undefined, bucketType: CloudBucketMount_BucketType);
5778
5905
  /** @ignore */
@@ -5814,87 +5941,13 @@ declare class FunctionCall {
5814
5941
  #private;
5815
5942
  readonly functionCallId: string;
5816
5943
  /** @ignore */
5817
- constructor(client: ModalClient | undefined, functionCallId: string);
5818
- /**
5819
- * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead.
5820
- */
5821
- static fromId(functionCallId: string): FunctionCall;
5944
+ constructor(client: ModalClient, functionCallId: string);
5822
5945
  /** Get the result of a FunctionCall, optionally waiting with a timeout. */
5823
5946
  get(params?: FunctionCallGetParams): Promise<any>;
5824
5947
  /** Cancel a running FunctionCall. */
5825
5948
  cancel(params?: FunctionCallCancelParams): Promise<void>;
5826
5949
  }
5827
5950
 
5828
- /** Optional parameters for `client.functions.fromName()`. */
5829
- type FunctionFromNameParams = {
5830
- environment?: string;
5831
- createIfMissing?: boolean;
5832
- };
5833
- /**
5834
- * Service for managing {@link Function_ Function}s.
5835
- *
5836
- * Normally only ever accessed via the client as:
5837
- * ```typescript
5838
- * const modal = new ModalClient();
5839
- * const function = await modal.functions.fromName("my-app", "my-function");
5840
- * ```
5841
- */
5842
- declare class FunctionService {
5843
- #private;
5844
- constructor(client: ModalClient);
5845
- /**
5846
- * Reference a {@link Function_ Function} by its name in an App.
5847
- */
5848
- fromName(appName: string, name: string, params?: FunctionFromNameParams): Promise<Function_>;
5849
- }
5850
- /** Simple data structure storing stats for a running {@link Function_ Function}. */
5851
- interface FunctionStats {
5852
- backlog: number;
5853
- numTotalRunners: number;
5854
- }
5855
- /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
5856
- interface FunctionUpdateAutoscalerParams {
5857
- minContainers?: number;
5858
- maxContainers?: number;
5859
- bufferContainers?: number;
5860
- scaledownWindowMs?: number;
5861
- }
5862
- /** Represents a deployed Modal Function, which can be invoked remotely. */
5863
- declare class Function_ {
5864
- #private;
5865
- readonly functionId: string;
5866
- readonly methodName?: string;
5867
- /** @ignore */
5868
- constructor(client: ModalClient, functionId: string, methodName?: string, functionHandleMetadata?: FunctionHandleMetadata);
5869
- /**
5870
- * @deprecated Use `client.functions.fromName()` instead.
5871
- */
5872
- static lookup(appName: string, name: string, params?: FunctionFromNameParams): Promise<Function_>;
5873
- remote(args?: any[], kwargs?: Record<string, any>): Promise<any>;
5874
- spawn(args?: any[], kwargs?: Record<string, any>): Promise<FunctionCall>;
5875
- getCurrentStats(): Promise<FunctionStats>;
5876
- updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<void>;
5877
- /**
5878
- * URL for addressing the Web Function via HTTP.
5879
- * @returns The web URL, or undefined if this is not a Web Function
5880
- */
5881
- getWebUrl(): Promise<string | undefined>;
5882
- }
5883
-
5884
- /** Retry policy configuration for a Modal Function/Cls. */
5885
- declare class Retries {
5886
- readonly maxRetries: number;
5887
- readonly backoffCoefficient: number;
5888
- readonly initialDelayMs: number;
5889
- readonly maxDelayMs: number;
5890
- constructor(params: {
5891
- maxRetries: number;
5892
- backoffCoefficient?: number;
5893
- initialDelayMs?: number;
5894
- maxDelayMs?: number;
5895
- });
5896
- }
5897
-
5898
5951
  type HeartbeatFunction = () => Promise<any>;
5899
5952
  declare class EphemeralHeartbeatManager {
5900
5953
  private readonly heartbeatFn;
@@ -5966,30 +6019,11 @@ declare class Volume {
5966
6019
  readonly _mountOptions: ResolvedMountOptions;
5967
6020
  /** @ignore */
5968
6021
  constructor(volumeId: string, name?: string, mountOptions?: ResolvedMountOptions, ephemeralHbManager?: EphemeralHeartbeatManager);
5969
- /**
5970
- * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead.
5971
- */
5972
- static fromName(name: string, options?: VolumeFromNameParams): Promise<Volume>;
5973
- /**
5974
- * Configure Volume to mount as read-only.
5975
- *
5976
- * @deprecated Use {@link withMountOptions} with `{ readOnly: true }` instead.
5977
- */
5978
- readOnly(): Volume;
5979
6022
  /**
5980
6023
  * Configure options used when mounting this Volume. Fields left undefined preserve their value
5981
6024
  * from any previous withMountOptions call on the same Volume (stacking).
5982
6025
  */
5983
6026
  withMountOptions(params?: VolumeMountOptions): Volume;
5984
- /**
5985
- * @deprecated Inspect mount configuration at the call site that configured it instead.
5986
- * Future versions of this SDK may remove direct mount-option accessors on Volume.
5987
- */
5988
- get isReadOnly(): boolean;
5989
- /**
5990
- * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead.
5991
- */
5992
- static ephemeral(options?: VolumeEphemeralParams): Promise<Volume>;
5993
6027
  /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */
5994
6028
  closeEphemeral(): void;
5995
6029
  }
@@ -5999,29 +6033,56 @@ type VolumeMountOptions = {
5999
6033
  subPath?: string;
6000
6034
  };
6001
6035
 
6002
- /** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */
6003
- type ClsFromNameParams = {
6036
+ /** Retry policy configuration for a Modal Function/Cls. */
6037
+ declare class Retries {
6038
+ readonly maxRetries: number;
6039
+ readonly backoffCoefficient: number;
6040
+ readonly initialDelayMs: number;
6041
+ readonly maxDelayMs: number;
6042
+ constructor(params: {
6043
+ maxRetries: number;
6044
+ backoffCoefficient?: number;
6045
+ initialDelayMs?: number;
6046
+ maxDelayMs?: number;
6047
+ });
6048
+ }
6049
+
6050
+ /** Optional parameters for `client.functions.fromName()`. */
6051
+ type FunctionFromNameParams = {
6004
6052
  environment?: string;
6005
6053
  createIfMissing?: boolean;
6006
6054
  };
6007
6055
  /**
6008
- * Service for managing {@link Cls}.
6056
+ * Service for managing {@link Function_ Function}s.
6009
6057
  *
6010
6058
  * Normally only ever accessed via the client as:
6011
6059
  * ```typescript
6012
6060
  * const modal = new ModalClient();
6013
- * const cls = await modal.cls.fromName("my-app", "MyCls");
6061
+ * const function = await modal.functions.fromName("my-app", "my-function");
6014
6062
  * ```
6015
6063
  */
6016
- declare class ClsService {
6064
+ declare class FunctionService {
6017
6065
  #private;
6018
6066
  constructor(client: ModalClient);
6019
6067
  /**
6020
- * Reference a {@link Cls} from a deployed {@link App} by its name.
6068
+ * Reference a {@link Function_ Function} by its name in an App.
6021
6069
  */
6022
- fromName(appName: string, name: string, params?: ClsFromNameParams): Promise<Cls>;
6070
+ fromName(appName: string, name: string, params?: FunctionFromNameParams): Promise<Function_>;
6071
+ }
6072
+ /** Simple data structure storing stats for a running {@link Function_ Function}. */
6073
+ interface FunctionStats {
6074
+ backlog: number;
6075
+ numTotalRunners: number;
6023
6076
  }
6024
- type ClsWithOptionsParams = {
6077
+ /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
6078
+ interface FunctionUpdateAutoscalerParams {
6079
+ minContainers?: number;
6080
+ maxContainers?: number;
6081
+ bufferContainers?: number;
6082
+ scaledownWindowMs?: number;
6083
+ }
6084
+ /** Configuration options for {@link Function_#withOptions Function_.withOptions()}. */
6085
+ type FunctionWithOptionsParams = {
6025
6086
  cpu?: number;
6026
6087
  cpuLimit?: number;
6027
6088
  memoryMiB?: number;
@@ -6036,29 +6097,81 @@ type ClsWithOptionsParams = {
6036
6097
  scaledownWindowMs?: number;
6037
6098
  timeoutMs?: number;
6038
6099
  };
6039
- type ClsWithConcurrencyParams = {
6100
+ /** Configuration options for {@link Function_#withConcurrency Function_.withConcurrency()}. */
6101
+ type FunctionWithConcurrencyParams = {
6040
6102
  maxInputs: number;
6041
6103
  targetInputs?: number;
6042
6104
  };
6043
- type ClsWithBatchingParams = {
6105
+ /** Configuration options for {@link Function_#withBatching Function_.withBatching()}. */
6106
+ type FunctionWithBatchingParams = {
6044
6107
  maxBatchSize: number;
6045
6108
  waitMs: number;
6046
6109
  };
6047
- type ServiceOptions = ClsWithOptionsParams & {
6110
+ /** Internal data structure holding configuration options for {@link Function_ Function}. */
6111
+ type FunctionOptions = FunctionWithOptionsParams & {
6048
6112
  maxConcurrentInputs?: number;
6049
6113
  targetConcurrentInputs?: number;
6050
6114
  batchMaxSize?: number;
6051
6115
  batchWaitMs?: number;
6052
6116
  };
6053
- /** Represents a deployed Modal Cls. */
6054
- declare class Cls {
6117
+ /** Represents a deployed Modal Function, which can be invoked remotely. */
6118
+ declare class Function_ {
6055
6119
  #private;
6120
+ readonly functionId: string;
6121
+ readonly methodName?: string;
6056
6122
  /** @ignore */
6057
- constructor(client: ModalClient, serviceFunctionId: string, serviceFunctionMetadata: FunctionHandleMetadata, options?: ServiceOptions);
6123
+ constructor(client: ModalClient, functionId: string, methodName?: string, functionHandleMetadata?: FunctionHandleMetadata, options?: FunctionOptions);
6124
+ /** Override the static Function configuration at runtime. */
6125
+ withOptions(options: FunctionWithOptionsParams): Function_;
6126
+ /** Override the static Function concurrency configuration at runtime. */
6127
+ withConcurrency(params: FunctionWithConcurrencyParams): Function_;
6128
+ /** Override the static Function batching configuration at runtime. */
6129
+ withBatching(params: FunctionWithBatchingParams): Function_;
6130
+ /** Create an instance of the Function with configuration specified by
6131
+ * {@link Function_#withOptions withOptions}, {@link Function_#withConcurrency withConcurrency},
6132
+ * and/or {@link Function_#withBatching withBatching}. */
6133
+ instance(): Promise<Function_>;
6134
+ remote(args?: any[], kwargs?: Record<string, any>): Promise<any>;
6135
+ spawn(args?: any[], kwargs?: Record<string, any>): Promise<FunctionCall>;
6136
+ getCurrentStats(): Promise<FunctionStats>;
6137
+ updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<void>;
6138
+ /**
6139
+ * URL for addressing the Web Function via HTTP.
6140
+ * @returns The web URL, or undefined if this is not a Web Function
6141
+ */
6142
+ getWebUrl(): Promise<string | undefined>;
6143
+ }
6144
+
6145
+ /** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */
6146
+ type ClsFromNameParams = {
6147
+ environment?: string;
6148
+ createIfMissing?: boolean;
6149
+ };
6150
+ /**
6151
+ * Service for managing {@link Cls}.
6152
+ *
6153
+ * Normally only ever accessed via the client as:
6154
+ * ```typescript
6155
+ * const modal = new ModalClient();
6156
+ * const cls = await modal.cls.fromName("my-app", "MyCls");
6157
+ * ```
6158
+ */
6159
+ declare class ClsService {
6160
+ #private;
6161
+ constructor(client: ModalClient);
6058
6162
  /**
6059
- * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead.
6163
+ * Reference a {@link Cls} from a deployed {@link App} by its name.
6060
6164
  */
6061
- static lookup(appName: string, name: string, params?: ClsFromNameParams): Promise<Cls>;
6165
+ fromName(appName: string, name: string, params?: ClsFromNameParams): Promise<Cls>;
6166
+ }
6167
+ type ClsWithOptionsParams = FunctionWithOptionsParams;
6168
+ type ClsWithConcurrencyParams = FunctionWithConcurrencyParams;
6169
+ type ClsWithBatchingParams = FunctionWithBatchingParams;
6170
+ /** Represents a deployed Modal Cls. */
6171
+ declare class Cls {
6172
+ #private;
6173
+ /** @ignore */
6174
+ constructor(client: ModalClient, serviceFunctionId: string, serviceFunctionMetadata: FunctionHandleMetadata, options?: FunctionOptions);
6062
6175
  /** Create a new instance of the Cls with parameters and/or runtime options. */
6063
6176
  instance(parameters?: Record<string, any>): Promise<ClsInstance>;
6064
6177
  /** Override the static Function configuration at runtime. */
@@ -6075,6 +6188,11 @@ declare class ClsInstance {
6075
6188
  method(name: string): Function_;
6076
6189
  }
6077
6190
 
6191
+ /** Optional parameters for {@link ImageService#fromName client.images.fromName()}. */
6192
+ type ImageFromNameParams = {
6193
+ /** Modal Environment to resolve the named Image in. */
6194
+ environment?: string;
6195
+ };
6078
6196
  /**
6079
6197
  * Service for managing {@link Image}s.
6080
6198
  *
@@ -6093,6 +6211,14 @@ declare class ImageService {
6093
6211
  * @param imageId - Image ID.
6094
6212
  */
6095
6213
  fromId(imageId: string): Promise<Image>;
6214
+ /**
6215
+ * Reference a named {@link Image} that was previously published.
6216
+ *
6217
+ * @param name - Name of the published Image, optionally including a tag as `name:tag`.
6218
+ * If no tag is included, `:latest` is used.
6219
+ * @param params - Optional environment.
6220
+ */
6221
+ fromName(name: string, params?: ImageFromNameParams): Promise<Image>;
6096
6222
  /**
6097
6223
  * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication.
6098
6224
  *
@@ -6128,6 +6254,11 @@ declare class ImageService {
6128
6254
  }
6129
6255
  /** Optional parameters for {@link ImageService#delete client.images.delete()}. */
6130
6256
  type ImageDeleteParams = Record<never, never>;
6257
+ /** Optional parameters for {@link Image#publish Image.publish()}. */
6258
+ type ImagePublishParams = {
6259
+ /** Modal Environment to publish the named Image in. */
6260
+ environment?: string;
6261
+ };
6131
6262
  /** Optional parameters for {@link Image#dockerfileCommands Image.dockerfileCommands()}. */
6132
6263
  type ImageDockerfileCommandsParams = {
6133
6264
  /** Environment variables to set in the build environment. */
@@ -6151,24 +6282,8 @@ type Layer = {
6151
6282
  declare class Image {
6152
6283
  #private;
6153
6284
  /** @ignore */
6154
- constructor(client: ModalClient, imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[]);
6285
+ constructor(client: ModalClient, imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[], baseImageId?: string);
6155
6286
  get imageId(): string;
6156
- /**
6157
- * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead.
6158
- */
6159
- static fromId(imageId: string): Promise<Image>;
6160
- /**
6161
- * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead.
6162
- */
6163
- static fromRegistry(tag: string, secret?: Secret): Image;
6164
- /**
6165
- * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead.
6166
- */
6167
- static fromAwsEcr(tag: string, secret: Secret): Image;
6168
- /**
6169
- * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead.
6170
- */
6171
- static fromGcpArtifactRegistry(tag: string, secret: Secret): Image;
6172
6287
  private static validateDockerfileCommands;
6173
6288
  /**
6174
6289
  * Extend an image with arbitrary Dockerfile-like commands.
@@ -6188,9 +6303,13 @@ declare class Image {
6188
6303
  */
6189
6304
  build(app: App): Promise<Image>;
6190
6305
  /**
6191
- * @deprecated Use {@link ImageService#delete client.images.delete()} instead.
6306
+ * Publish this built Image under a stable name and tag.
6307
+ *
6308
+ * @param name - Name to publish the Image under, optionally including a tag as `name:tag`.
6309
+ * If no tag is included, `:latest` is used.
6310
+ * @param params - Optional environment.
6192
6311
  */
6193
- static delete(imageId: string, _?: ImageDeleteParams): Promise<void>;
6312
+ publish(name: string, params?: ImagePublishParams): Promise<void>;
6194
6313
  }
6195
6314
 
6196
6315
  /**
@@ -6219,10 +6338,6 @@ declare class Proxy {
6219
6338
  readonly proxyId: string;
6220
6339
  /** @ignore */
6221
6340
  constructor(proxyId: string);
6222
- /**
6223
- * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead.
6224
- */
6225
- static fromName(name: string, params?: ProxyFromNameParams): Promise<Proxy>;
6226
6341
  }
6227
6342
 
6228
6343
  /** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */
@@ -6317,20 +6432,8 @@ declare class Queue {
6317
6432
  readonly name?: string;
6318
6433
  /** @ignore */
6319
6434
  constructor(client: ModalClient, queueId: string, name?: string, ephemeralHbManager?: EphemeralHeartbeatManager);
6320
- /**
6321
- * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead.
6322
- */
6323
- static ephemeral(params?: QueueEphemeralParams): Promise<Queue>;
6324
6435
  /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */
6325
6436
  closeEphemeral(): void;
6326
- /**
6327
- * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead.
6328
- */
6329
- static lookup(name: string, options?: QueueFromNameParams): Promise<Queue>;
6330
- /**
6331
- * @deprecated Use {@link QueueService#delete client.queues.delete()} instead.
6332
- */
6333
- static delete(name: string, options?: QueueDeleteParams): Promise<void>;
6334
6437
  /**
6335
6438
  * Remove all objects from a Queue partition.
6336
6439
  */
@@ -6392,6 +6495,70 @@ declare enum TaskExecStdoutConfig {
6392
6495
  TASK_EXEC_STDOUT_CONFIG_PIPE = 1,
6393
6496
  UNRECOGNIZED = -1
6394
6497
  }
6498
+ interface TaskContainerCreateRequest {
6499
+ taskId: string;
6500
+ /** Logical container name. */
6501
+ containerName: string;
6502
+ imageId: string;
6503
+ args: string[];
6504
+ env: {
6505
+ [key: string]: string;
6506
+ };
6507
+ workdir: string;
6508
+ /** Secret IDs to inject into the container as environment variables. */
6509
+ secretIds: string[];
6510
+ }
6511
+ declare const TaskContainerCreateRequest: MessageFns<TaskContainerCreateRequest>;
6512
+ interface TaskContainerCreateResponse {
6513
+ /** Fully qualified container ID (for example, ctr-<ulid>). */
6514
+ containerId: string;
6515
+ /** Logical container name associated with this container. */
6516
+ containerName: string;
6517
+ }
6518
+ declare const TaskContainerCreateResponse: MessageFns<TaskContainerCreateResponse>;
6519
+ interface TaskContainerGetRequest {
6520
+ taskId: string;
6521
+ containerName: string;
6522
+ /** Include the latest terminated container if the name is no longer active. */
6523
+ includeTerminated: boolean;
6524
+ }
6525
+ declare const TaskContainerGetRequest: MessageFns<TaskContainerGetRequest>;
6526
+ interface TaskContainerGetResponse {
6527
+ container: TaskContainerInfo | undefined;
6528
+ }
6529
+ declare const TaskContainerGetResponse: MessageFns<TaskContainerGetResponse>;
6530
+ interface TaskContainerInfo {
6531
+ containerId: string;
6532
+ containerName: string;
6533
+ status: string;
6534
+ result: GenericResult | undefined;
6535
+ }
6536
+ declare const TaskContainerInfo: MessageFns<TaskContainerInfo>;
6537
+ interface TaskContainerListRequest {
6538
+ taskId: string;
6539
+ /** Include all tracked terminated containers in addition to active ones. */
6540
+ includeTerminated: boolean;
6541
+ }
6542
+ declare const TaskContainerListRequest: MessageFns<TaskContainerListRequest>;
6543
+ interface TaskContainerListResponse {
6544
+ containers: TaskContainerInfo[];
6545
+ }
6546
+ declare const TaskContainerListResponse: MessageFns<TaskContainerListResponse>;
6547
+ interface TaskContainerTerminateRequest {
6548
+ taskId: string;
6549
+ containerId: string;
6550
+ }
6551
+ declare const TaskContainerTerminateRequest: MessageFns<TaskContainerTerminateRequest>;
6552
+ interface TaskContainerWaitRequest {
6553
+ taskId: string;
6554
+ containerId: string;
6555
+ timeout: number;
6556
+ }
6557
+ declare const TaskContainerWaitRequest: MessageFns<TaskContainerWaitRequest>;
6558
+ interface TaskContainerWaitResponse {
6559
+ result: GenericResult | undefined;
6560
+ }
6561
+ declare const TaskContainerWaitResponse: MessageFns<TaskContainerWaitResponse>;
6395
6562
  /**
6396
6563
  * The response to a TaskExecPollRequest. If the exec'd command has not
6397
6564
  * completed, exit_status will be unset.
@@ -6464,6 +6631,11 @@ interface TaskMountDirectoryRequest {
6464
6631
  taskId: string;
6465
6632
  path: Uint8Array;
6466
6633
  imageId: string;
6634
+ /**
6635
+ * Customer-supplied encryption key used to decrypt CSEK-encrypted image metadata keys.
6636
+ * This key is not persisted by Modal.
6637
+ */
6638
+ customerSuppliedEncryptionKey?: Uint8Array | undefined;
6467
6639
  }
6468
6640
  declare const TaskMountDirectoryRequest: MessageFns<TaskMountDirectoryRequest>;
6469
6641
  interface TaskSnapshotDirectoryRequest {
@@ -6485,6 +6657,11 @@ interface TaskSnapshotDirectoryRequest {
6485
6657
  * server.
6486
6658
  */
6487
6659
  ttlSeconds?: number | undefined;
6660
+ /**
6661
+ * Customer-supplied encryption key used to encrypt the resulting image's data and tree
6662
+ * metadata keys. This key is not persisted by Modal.
6663
+ */
6664
+ customerSuppliedEncryptionKey?: Uint8Array | undefined;
6488
6665
  }
6489
6666
  declare const TaskSnapshotDirectoryRequest: MessageFns<TaskSnapshotDirectoryRequest>;
6490
6667
  interface TaskSnapshotDirectoryResponse {
@@ -6505,6 +6682,11 @@ interface TaskSnapshotFilesystemRequest {
6505
6682
  * server.
6506
6683
  */
6507
6684
  ttlSeconds?: number | undefined;
6685
+ /**
6686
+ * Customer-supplied encryption key used to encrypt the resulting image's data and tree
6687
+ * metadata keys. This key is not persisted by Modal.
6688
+ */
6689
+ customerSuppliedEncryptionKey?: Uint8Array | undefined;
6508
6690
  }
6509
6691
  declare const TaskSnapshotFilesystemRequest: MessageFns<TaskSnapshotFilesystemRequest>;
6510
6692
  interface TaskSnapshotFilesystemResponse {
@@ -6566,13 +6748,20 @@ declare class TaskCommandRouterClientImpl {
6566
6748
  static tryInit(serverClient: ModalGrpcClient, taskId: string, sandboxId: string, isV2: boolean, logger: Logger, profile: Profile): Promise<TaskCommandRouterClientImpl | null>;
6567
6749
  private constructor();
6568
6750
  close(): void;
6751
+ /** Run a unary RPC against the command router with the default retry policy. */
6752
+ private callUnary;
6569
6753
  execStart(request: TaskExecStartRequest): Promise<TaskExecStartResponse>;
6754
+ containerCreate(request: TaskContainerCreateRequest): Promise<TaskContainerCreateResponse>;
6755
+ containerGet(request: TaskContainerGetRequest): Promise<TaskContainerGetResponse>;
6756
+ containerList(request: TaskContainerListRequest): Promise<TaskContainerListResponse>;
6757
+ containerTerminate(request: TaskContainerTerminateRequest): Promise<void>;
6758
+ containerWait(request: TaskContainerWaitRequest): Promise<TaskContainerWaitResponse>;
6570
6759
  execStdioRead(taskId: string, execId: string, fileDescriptor: FileDescriptor, deadline?: number | null): AsyncGenerator<TaskExecStdioReadResponse>;
6571
6760
  execStdinWrite(taskId: string, execId: string, offset: number, data: Uint8Array, eof: boolean): Promise<TaskExecStdinWriteResponse>;
6572
6761
  execPoll(taskId: string, execId: string, deadline?: number | null): Promise<TaskExecPollResponse>;
6573
6762
  execWait(taskId: string, execId: string, deadline?: number | null): Promise<TaskExecWaitResponse>;
6574
6763
  mountDirectory(request: TaskMountDirectoryRequest): Promise<void>;
6575
- snapshotDirectory(request: TaskSnapshotDirectoryRequest): Promise<TaskSnapshotDirectoryResponse>;
6764
+ snapshotDirectory(request: TaskSnapshotDirectoryRequest, options?: TimeoutOptions): Promise<TaskSnapshotDirectoryResponse>;
6576
6765
  snapshotFilesystem(request: TaskSnapshotFilesystemRequest, options?: TimeoutOptions): Promise<TaskSnapshotFilesystemResponse>;
6577
6766
  unmountDirectory(request: TaskUnmountDirectoryRequest): Promise<void>;
6578
6767
  private refreshJwt;
@@ -6580,36 +6769,6 @@ declare class TaskCommandRouterClientImpl {
6580
6769
  private streamStdio;
6581
6770
  }
6582
6771
 
6583
- /** File open modes supported by the filesystem API. */
6584
- type SandboxFileMode = "r" | "w" | "a" | "r+" | "w+" | "a+";
6585
- /**
6586
- * SandboxFile represents an open file in the {@link Sandbox} filesystem.
6587
- * Provides read/write operations similar to Node.js `fsPromises.FileHandle`.
6588
- */
6589
- declare class SandboxFile {
6590
- #private;
6591
- /** @ignore */
6592
- constructor(client: ModalClient, fileDescriptor: string, taskId: string);
6593
- /**
6594
- * Read data from the file.
6595
- * @returns Promise that resolves to the read data as Uint8Array
6596
- */
6597
- read(): Promise<Uint8Array>;
6598
- /**
6599
- * Write data to the file.
6600
- * @param data - Data to write
6601
- */
6602
- write(data: Uint8Array): Promise<void>;
6603
- /**
6604
- * Flush any buffered data to the file.
6605
- */
6606
- flush(): Promise<void>;
6607
- /**
6608
- * Close the file handle.
6609
- */
6610
- close(): Promise<void>;
6611
- }
6612
-
6613
6772
  /** Type of a filesystem entry. */
6614
6773
  type FileType = "file" | "directory" | "symlink";
6615
6774
  /** Metadata for a file or directory entry in a Sandbox. */
@@ -6628,9 +6787,9 @@ interface FileInfo {
6628
6787
  }
6629
6788
  /** Namespace for Sandbox filesystem APIs. */
6630
6789
  declare class SandboxFilesystem {
6631
- private readonly sandbox;
6790
+ private readonly exec;
6632
6791
  /** @ignore */
6633
- constructor(sandbox: Sandbox);
6792
+ constructor(exec: (command: string[], params?: SandboxExecParams) => Promise<ContainerProcess>);
6634
6793
  /**
6635
6794
  * Copy a local file into the Sandbox.
6636
6795
  *
@@ -6777,6 +6936,94 @@ declare class SandboxFilesystem {
6777
6936
  writeText(data: string, remotePath: string): Promise<void>;
6778
6937
  }
6779
6938
 
6939
+ type SandboxSidecarCommandRouter = Pick<TaskCommandRouterClientImpl, "containerCreate" | "containerGet" | "containerList" | "containerTerminate" | "containerWait">;
6940
+ type SandboxSidecarAccess = {
6941
+ exec(command: string[], params: SandboxExecParams | undefined, containerId: string): Promise<ContainerProcess>;
6942
+ commandRouter(): Promise<[string, SandboxSidecarCommandRouter]>;
6943
+ };
6944
+ /** Options for {@link SidecarService#create SidecarService.create()}. */
6945
+ type SidecarCreateParams = {
6946
+ /** Command to run in the sidecar container on startup. */
6947
+ command?: string[];
6948
+ /** Environment variables to set in the sidecar container. */
6949
+ env?: Record<string, string>;
6950
+ /** {@link Secret}s to inject into the sidecar container as environment variables. */
6951
+ secrets?: Secret[];
6952
+ /** Working directory of the sidecar container. */
6953
+ workdir?: string;
6954
+ };
6955
+ /** Options for {@link SidecarService#get SidecarService.get()}. */
6956
+ type SidecarGetParams = {
6957
+ /** If true, return the latest container with the name even if it has terminated. */
6958
+ includeTerminated?: boolean;
6959
+ };
6960
+ /** Options for {@link SidecarService#list SidecarService.list()}. */
6961
+ type SidecarListParams = {
6962
+ /** If true, include terminated containers. */
6963
+ includeTerminated?: boolean;
6964
+ };
6965
+ /** Options for {@link SidecarContainer#exec SidecarContainer.exec()}. */
6966
+ type SidecarExecParams = SandboxExecParams;
6967
+ /** Options for {@link SidecarContainer#terminate SidecarContainer.terminate()}. */
6968
+ type SidecarTerminateParams = {
6969
+ /** If true, wait for the sidecar container to terminate. */
6970
+ wait?: boolean;
6971
+ };
6972
+ /**
6973
+ * Creates and manages sidecar containers inside a Sandbox.
6974
+ *
6975
+ * EXPERIMENTAL: the API is subject to change.
6976
+ */
6977
+ declare class SidecarService {
6978
+ #private;
6979
+ /** @internal @hidden */
6980
+ constructor(access: SandboxSidecarAccess);
6981
+ /**
6982
+ * Start a new sidecar container in the Sandbox. The {@link Image} must
6983
+ * already be built by calling {@link Image#build Image.build()} before it is
6984
+ * passed to `create`.
6985
+ */
6986
+ create(name: string, image: Image, params?: SidecarCreateParams): Promise<SidecarContainer>;
6987
+ /** Return a sidecar container by name. */
6988
+ get(name: string, params?: SidecarGetParams): Promise<SidecarContainer>;
6989
+ /** Return all sidecar containers (not including the main container). */
6990
+ list(params?: SidecarListParams): Promise<SidecarContainer[]>;
6991
+ }
6992
+ /**
6993
+ * A handle to a sidecar container running in a Sandbox.
6994
+ *
6995
+ * EXPERIMENTAL: the API is subject to change.
6996
+ */
6997
+ declare class SidecarContainer {
6998
+ #private;
6999
+ /** The fully qualified container ID. */
7000
+ readonly containerId: string;
7001
+ /** The logical name of the container within the Sandbox. */
7002
+ readonly containerName: string;
7003
+ /** @internal @hidden */
7004
+ constructor(access: SandboxSidecarAccess, containerId: string, containerName: string, result?: GenericResult);
7005
+ exec(command: string[], params?: SidecarExecParams & {
7006
+ mode?: "text";
7007
+ }): Promise<ContainerProcess<string>>;
7008
+ exec(command: string[], params: SidecarExecParams & {
7009
+ mode: "binary";
7010
+ }): Promise<ContainerProcess<Uint8Array>>;
7011
+ /** Namespace for filesystem APIs scoped to this sidecar container. */
7012
+ get filesystem(): SandboxFilesystem;
7013
+ /** Block until the sidecar container exits, and return its exit code. */
7014
+ wait(): Promise<number>;
7015
+ /**
7016
+ * Check if the sidecar container has finished running.
7017
+ *
7018
+ * Returns `null` if the container is still running, else the exit code.
7019
+ */
7020
+ poll(): Promise<number | null>;
7021
+ terminate(): Promise<void>;
7022
+ terminate(params: {
7023
+ wait: true;
7024
+ }): Promise<number>;
7025
+ }
7026
+
6780
7027
  /**
6781
7028
  * Wrapper around `ReadableStream` with convenience functions.
6782
7029
  *
@@ -6884,10 +7131,8 @@ type SandboxCreateParams = {
6884
7131
  blockNetwork?: boolean;
6885
7132
  /** List of CIDRs the Sandbox is allowed to access. If not set, all CIDRs are allowed. Cannot be used with blockNetwork. */
6886
7133
  outboundCidrAllowlist?: string[];
6887
- /**
6888
- * @deprecated Use {@link outboundCidrAllowlist} instead.
6889
- */
6890
- cidrAllowlist?: string[];
7134
+ /** List of domain names the Sandbox is allowed to access. Supports wildcard prefixes (`*.example.com`). Cannot be used with blockNetwork. */
7135
+ outboundDomainAllowlist?: string[];
6891
7136
  /** 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. */
6892
7137
  inboundCidrAllowlist?: string[];
6893
7138
  /** Cloud provider to run the Sandbox on. */
@@ -6902,7 +7147,7 @@ type SandboxCreateParams = {
6902
7147
  readinessProbe?: Probe;
6903
7148
  /** Optional name for the Sandbox. Unique within an App. */
6904
7149
  name?: string;
6905
- /** Tags to attach to the Sandbox. Filterable via {@link SandboxService#list Sandbox.list}. */
7150
+ /** Tags to attach to the Sandbox. Filterable via {@link SandboxService#list client.sandboxes.list}. */
6906
7151
  tags?: Record<string, string>;
6907
7152
  /** Optional experimental options. */
6908
7153
  experimentalOptions?: Record<string, any>;
@@ -6933,11 +7178,13 @@ declare class SandboxService {
6933
7178
  * Create a new {@link Sandbox} using the experimental V2 backend.
6934
7179
  *
6935
7180
  * Supported features include exec, encrypted tunnels, wait/poll/terminate,
6936
- * CPU and memory configuration, and region placement.
7181
+ * CPU and memory configuration, region placement, volumes, cloud bucket
7182
+ * mounts (with static credentials via {@link Secret}), and filesystem
7183
+ * snapshots.
6937
7184
  *
6938
- * Features like tags, filesystem snapshots, memory snapshots, volumes, cloud
6939
- * bucket mounts, GPUs, custom domains, OIDC identity tokens, proxies, and
6940
- * readiness probes are not supported.
7185
+ * Features like tags, memory snapshots, GPUs, custom domains, OIDC identity
7186
+ * tokens (including `oidcAuthRoleArn` on a {@link CloudBucketMount}),
7187
+ * proxies, and readiness probes are not supported.
6941
7188
  *
6942
7189
  * V2 sandboxes created with this method are not currently returned by
6943
7190
  * {@link SandboxService#list client.sandboxes.list()} and cannot be looked up
@@ -7007,6 +7254,36 @@ type SandboxTerminateParams = {
7007
7254
  /** If true, wait for the Sandbox to finish and return the exit code. */
7008
7255
  wait?: boolean;
7009
7256
  };
7257
+ /** Optional parameters for {@link Sandbox#snapshotFilesystem Sandbox.snapshotFilesystem()}. */
7258
+ type SandboxSnapshotFilesystemParams = {
7259
+ /**
7260
+ * Overall budget for the snapshot call, in milliseconds. Defaults to
7261
+ * 55000. If it elapses before a snapshot completes, the call is cancelled
7262
+ * and an error is thrown.
7263
+ */
7264
+ timeoutMs?: number;
7265
+ /**
7266
+ * Lifetime of the resulting image in milliseconds, as a hard cutoff
7267
+ * measured from creation. Defaults to 30 days. Pass `null` to retain
7268
+ * the image indefinitely.
7269
+ */
7270
+ ttlMs?: number | null;
7271
+ };
7272
+ /** Optional parameters for {@link Sandbox#snapshotDirectory Sandbox.snapshotDirectory()}. */
7273
+ type SandboxSnapshotDirectoryParams = {
7274
+ /**
7275
+ * Overall budget for the snapshot call, in milliseconds. Defaults to
7276
+ * 55000. If it elapses before a snapshot completes, the call is cancelled
7277
+ * and an error is thrown.
7278
+ */
7279
+ timeoutMs?: number;
7280
+ /**
7281
+ * Lifetime of the resulting image in milliseconds, as a hard cutoff
7282
+ * measured from creation. Defaults to 30 days. Pass `null` to retain
7283
+ * the image indefinitely.
7284
+ */
7285
+ ttlMs?: number | null;
7286
+ };
7010
7287
  type SandboxCreateConnectTokenParams = {
7011
7288
  /** Optional user-provided metadata string that will be added to the headers by the proxy when forwarding requests to the Sandbox. */
7012
7289
  userMetadata?: string;
@@ -7045,29 +7322,17 @@ declare class Sandbox {
7045
7322
  get stdout(): ModalReadStream<string>;
7046
7323
  get stderr(): ModalReadStream<string>;
7047
7324
  get filesystem(): SandboxFilesystem;
7048
- /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */
7049
- setTags(tags: Record<string, string>): Promise<void>;
7050
- /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */
7051
- getTags(): Promise<Record<string, string>>;
7052
- /**
7053
- * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead.
7054
- */
7055
- static fromId(sandboxId: string): Promise<Sandbox>;
7056
- /**
7057
- * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead.
7058
- */
7059
- static fromName(appName: string, name: string, environment?: string): Promise<Sandbox>;
7060
7325
  /**
7061
- * Open a file in the Sandbox filesystem.
7062
- *
7063
- * @deprecated Use {@link SandboxFilesystem} methods: `sandbox.filesystem.readBytes()`,
7064
- * `writeBytes()`, or `copyToLocal()` instead for improved reliability.
7326
+ * Operations for managing sidecar containers that run alongside the
7327
+ * Sandbox's main container.
7065
7328
  *
7066
- * @param path - Path to the file to open
7067
- * @param mode - File open mode (r, w, a, r+, w+, a+)
7068
- * @returns Promise that resolves to a {@link SandboxFile}
7329
+ * EXPERIMENTAL: the API is subject to change.
7069
7330
  */
7070
- open(path: string, mode?: SandboxFileMode): Promise<SandboxFile>;
7331
+ get experimentalSidecars(): SidecarService;
7332
+ /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list client.sandboxes.list}. */
7333
+ setTags(tags: Record<string, string>): Promise<void>;
7334
+ /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */
7335
+ getTags(): Promise<Record<string, string>>;
7071
7336
  exec(command: string[], params?: SandboxExecParams & {
7072
7337
  mode?: "text";
7073
7338
  }): Promise<ContainerProcess<string>>;
@@ -7111,14 +7376,14 @@ declare class Sandbox {
7111
7376
  *
7112
7377
  * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem.
7113
7378
  *
7114
- * `timeoutMs` is propagated as the gRPC deadline. If the snapshot does
7115
- * not return within that window, the call is cancelled and an error is
7116
- * thrown.
7379
+ * The call has an overall `timeoutMs` budget (default: 55000). If it
7380
+ * elapses before a snapshot completes, the call is cancelled and an
7381
+ * error is thrown.
7117
7382
  *
7118
- * @param timeoutMs - Timeout for the snapshot operation in milliseconds.
7383
+ * @param params - Optional parameters; see {@link SandboxSnapshotFilesystemParams}.
7119
7384
  * @returns Promise that resolves to an {@link Image}
7120
7385
  */
7121
- snapshotFilesystem(timeoutMs?: number): Promise<Image>;
7386
+ snapshotFilesystem(params?: SandboxSnapshotFilesystemParams): Promise<Image>;
7122
7387
  /**
7123
7388
  * Mount an {@link Image} at a path in the Sandbox filesystem.
7124
7389
  *
@@ -7135,23 +7400,25 @@ declare class Sandbox {
7135
7400
  /**
7136
7401
  * Snapshots and creates a new {@link Image} from a directory in the running sandbox.
7137
7402
  *
7138
- * Directory snapshots are currently persisted for 30 days after they
7139
- * were created.
7403
+ * The resulting Image is retained for `ttlMs` (default: 30 days),
7404
+ * as a hard cutoff measured from creation — usage does not extend
7405
+ * the lifetime. Pass `ttlMs: null` to retain indefinitely.
7406
+ *
7407
+ * The call has an overall `timeoutMs` budget (default: 55000). If it
7408
+ * elapses before a snapshot completes, the call is cancelled and an
7409
+ * error is thrown.
7140
7410
  *
7141
7411
  * @param path - The path of the directory to snapshot
7412
+ * @param params - Optional parameters; see {@link SandboxSnapshotDirectoryParams}.
7142
7413
  * @returns Promise that resolves to an {@link Image}
7143
7414
  */
7144
- snapshotDirectory(path: string): Promise<Image>;
7415
+ snapshotDirectory(path: string, params?: SandboxSnapshotDirectoryParams): Promise<Image>;
7145
7416
  /**
7146
7417
  * Check if the Sandbox has finished running.
7147
7418
  *
7148
7419
  * Returns `null` if the Sandbox is still running, else returns the exit code.
7149
7420
  */
7150
7421
  poll(): Promise<number | null>;
7151
- /**
7152
- * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead.
7153
- */
7154
- static list(params?: SandboxListParams): AsyncGenerator<Sandbox, void, unknown>;
7155
7422
  }
7156
7423
  declare class ContainerProcess<R extends string | Uint8Array = any> {
7157
7424
  #private;
@@ -7232,9 +7499,18 @@ declare class ModalClient {
7232
7499
  private ipClients;
7233
7500
  private authTokenManager;
7234
7501
  private customMiddleware;
7502
+ private environmentManager;
7235
7503
  constructor(params?: ModalClientParams);
7236
7504
  environmentName(environment?: string): string;
7237
- imageBuilderVersion(version?: string): string;
7505
+ /**
7506
+ * Returns the image builder version by querying the server where the local profile takes
7507
+ * precedence.
7508
+ *
7509
+ * The image builder version is an environment-scoped server setting, so pass the environment
7510
+ * the image will be built in (e.g. an App's environment) to fetch the correct version. When
7511
+ * omitted, the profile's default environment is used.
7512
+ */
7513
+ getImageBuilderVersion(environmentName?: string): Promise<string>;
7238
7514
  /** @ignore */
7239
7515
  ipClient(serverUrl: string): ModalGrpcClient;
7240
7516
  close(): void;
@@ -7260,23 +7536,6 @@ type RetryOptions = {
7260
7536
  /** Additional status codes to retry. */
7261
7537
  additionalStatusCodes?: Status[];
7262
7538
  };
7263
- /**
7264
- * @deprecated Use {@link ModalClient `new ModalClient()`} instead.
7265
- */
7266
- type ClientOptions = {
7267
- tokenId: string;
7268
- tokenSecret: string;
7269
- environment?: string;
7270
- };
7271
- /**
7272
- * @deprecated Use {@link ModalClient `new ModalClient()`} instead.
7273
- */
7274
- declare function initializeClient(options: ClientOptions): void;
7275
- /**
7276
- * Stops the auth token refresh.
7277
- * @deprecated Use {@link ModalClient#close modalClient.close()} instead.
7278
- */
7279
- declare function close(): void;
7280
7539
 
7281
7540
  /**
7282
7541
  * Service for managing {@link App}s.
@@ -7300,45 +7559,13 @@ type AppFromNameParams = {
7300
7559
  environment?: string;
7301
7560
  createIfMissing?: boolean;
7302
7561
  };
7303
- /** @deprecated Use specific Params types instead. */
7304
- type LookupOptions = {
7305
- environment?: string;
7306
- createIfMissing?: boolean;
7307
- };
7308
- /** @deprecated Use specific Params types instead. */
7309
- type DeleteOptions = {
7310
- environment?: string;
7311
- };
7312
- /** @deprecated Use specific Params types instead. */
7313
- type EphemeralOptions = {
7314
- environment?: string;
7315
- };
7316
7562
  /** Represents a deployed Modal App. */
7317
7563
  declare class App {
7318
7564
  readonly appId: string;
7319
7565
  readonly name?: string;
7566
+ readonly environmentName?: string;
7320
7567
  /** @ignore */
7321
- constructor(appId: string, name?: string);
7322
- /**
7323
- * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead.
7324
- */
7325
- static lookup(name: string, options?: LookupOptions): Promise<App>;
7326
- /**
7327
- * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead.
7328
- */
7329
- createSandbox(image: Image, options?: SandboxCreateParams): Promise<Sandbox>;
7330
- /**
7331
- * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead.
7332
- */
7333
- imageFromRegistry(tag: string, secret?: Secret): Promise<Image>;
7334
- /**
7335
- * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead.
7336
- */
7337
- imageFromAwsEcr(tag: string, secret: Secret): Promise<Image>;
7338
- /**
7339
- * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead.
7340
- */
7341
- imageFromGcpArtifactRegistry(tag: string, secret: Secret): Promise<Image>;
7568
+ constructor(appId: string, name?: string, environmentName?: string);
7342
7569
  }
7343
7570
 
7344
7571
  /** An operation exceeds the allowed time limit. */
@@ -7420,4 +7647,4 @@ declare class ClientClosedError extends Error {
7420
7647
 
7421
7648
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
7422
7649
 
7423
- export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, type ClientOptions, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ContainerProcess, type DeleteOptions, type EphemeralOptions, type FileInfo, type FileType, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, FunctionCallService, type FunctionFromNameParams, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, ImageService, InternalFailure, InvalidError, type LogLevel, type Logger, type LookupOptions, 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, SandboxFile, type SandboxFileMode, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, SandboxService, type SandboxTerminateParams, SandboxTimeoutError, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptions, VolumeService, checkForRenamedParams, close, initializeClient };
7650
+ export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ContainerProcess, type FileInfo, type FileType, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, FunctionCallService, type FunctionFromNameParams, 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 LogLevel, 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, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, SandboxService, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, type SandboxTerminateParams, SandboxTimeoutError, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, SidecarService, type SidecarTerminateParams, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptions, VolumeService, checkForRenamedParams };