modal 0.7.5 → 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,20 @@ 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
+ }
151
+ declare enum EndpointStopSource {
152
+ ENDPOINT_STOP_SOURCE_UNSPECIFIED = 0,
153
+ ENDPOINT_STOP_SOURCE_CLI = 1,
154
+ ENDPOINT_STOP_SOURCE_WEB = 2,
155
+ UNRECOGNIZED = -1
156
+ }
143
157
  declare enum EnvironmentRole {
144
158
  ENVIRONMENT_ROLE_UNSPECIFIED = 0,
145
159
  ENVIRONMENT_ROLE_VIEWER = 1,
@@ -814,6 +828,10 @@ interface AutoscalerSettings {
814
828
  scaleupWindow?: number | undefined;
815
829
  /** Maximum amount of time a container can be idle before being scaled down, in seconds; pka "container_idle_timeout" */
816
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;
817
835
  }
818
836
  declare const AutoscalerSettings: MessageFns$1<AutoscalerSettings>;
819
837
  interface BaseImage {
@@ -890,6 +908,7 @@ interface ClassGetRequest {
890
908
  environmentName: string;
891
909
  /** True starting with 0.67.x clients, which don't create method placeholder functions */
892
910
  onlyClassFunction: boolean;
911
+ appVersion: number;
893
912
  }
894
913
  declare const ClassGetRequest: MessageFns$1<ClassGetRequest>;
895
914
  interface ClassGetResponse {
@@ -1375,6 +1394,7 @@ interface EndpointCreateRequest {
1375
1394
  declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
1376
1395
  interface EndpointCreateResponse {
1377
1396
  endpointId: string;
1397
+ endpointPageUrl: string;
1378
1398
  }
1379
1399
  declare const EndpointCreateResponse: MessageFns$1<EndpointCreateResponse>;
1380
1400
  interface EndpointCustomModelSource {
@@ -1389,6 +1409,34 @@ interface EndpointHuggingFaceModelSource {
1389
1409
  huggingfaceToken: string;
1390
1410
  }
1391
1411
  declare const EndpointHuggingFaceModelSource: MessageFns$1<EndpointHuggingFaceModelSource>;
1412
+ interface EndpointListItem {
1413
+ endpointId: string;
1414
+ name: string;
1415
+ description: string;
1416
+ activeDeploymentId: string;
1417
+ updatedAt: number;
1418
+ metadata: EndpointMetadata | undefined;
1419
+ appState: AppState;
1420
+ functionId: string;
1421
+ createdByAvatarUrl: string;
1422
+ provisioningStatus: EndpointProvisioningStatus;
1423
+ }
1424
+ declare const EndpointListItem: MessageFns$1<EndpointListItem>;
1425
+ interface EndpointListRequest {
1426
+ environmentName: string;
1427
+ pagination: ListPagination | undefined;
1428
+ }
1429
+ declare const EndpointListRequest: MessageFns$1<EndpointListRequest>;
1430
+ interface EndpointListResponse {
1431
+ items: EndpointListItem[];
1432
+ environmentName: string;
1433
+ }
1434
+ declare const EndpointListResponse: MessageFns$1<EndpointListResponse>;
1435
+ interface EndpointMetadata {
1436
+ name: string;
1437
+ creationInfo: CreationInfo | undefined;
1438
+ }
1439
+ declare const EndpointMetadata: MessageFns$1<EndpointMetadata>;
1392
1440
  interface EndpointModalVolumeModelSource {
1393
1441
  volumeId: string;
1394
1442
  modelPath: string;
@@ -1399,9 +1447,18 @@ interface EndpointModelSource {
1399
1447
  custom?: EndpointCustomModelSource | undefined;
1400
1448
  }
1401
1449
  declare const EndpointModelSource: MessageFns$1<EndpointModelSource>;
1450
+ interface EndpointStopRequest {
1451
+ endpointId: string;
1452
+ source: EndpointStopSource;
1453
+ }
1454
+ declare const EndpointStopRequest: MessageFns$1<EndpointStopRequest>;
1455
+ interface EndpointStopResponse {
1456
+ }
1457
+ declare const EndpointStopResponse: MessageFns$1<EndpointStopResponse>;
1402
1458
  interface EnvironmentCreateRequest {
1403
1459
  name: string;
1404
1460
  isManaged: boolean;
1461
+ settings: EnvironmentSettings | undefined;
1405
1462
  }
1406
1463
  declare const EnvironmentCreateRequest: MessageFns$1<EnvironmentCreateRequest>;
1407
1464
  interface EnvironmentDeleteRequest {
@@ -1483,6 +1540,8 @@ declare const EnvironmentSetManagedRequest: MessageFns$1<EnvironmentSetManagedRe
1483
1540
  interface EnvironmentSettings {
1484
1541
  imageBuilderVersion: string;
1485
1542
  webhookSuffix: string;
1543
+ maxConcurrentGpus?: number | undefined;
1544
+ maxConcurrentTasks?: number | undefined;
1486
1545
  }
1487
1546
  declare const EnvironmentSettings: MessageFns$1<EnvironmentSettings>;
1488
1547
  interface EnvironmentUpdateRequest {
@@ -1666,8 +1725,8 @@ interface FunctionMessage {
1666
1725
  [key: string]: string;
1667
1726
  };
1668
1727
  /**
1669
- * If set, client deps will be mounted into the container, and are
1670
- * 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.
1671
1730
  */
1672
1731
  mountClientDependencies: boolean;
1673
1732
  flashServiceUrls: string[];
@@ -1706,7 +1765,7 @@ declare const FunctionAsyncInvokeResponse: MessageFns$1<FunctionAsyncInvokeRespo
1706
1765
  interface FunctionBindParamsRequest {
1707
1766
  functionId: string;
1708
1767
  serializedParams: Uint8Array;
1709
- functionOptions: FunctionOptions | undefined;
1768
+ functionOptions: FunctionOptions$1 | undefined;
1710
1769
  environmentName: string;
1711
1770
  /** Only used for the input plane. */
1712
1771
  authSecret: string;
@@ -1745,7 +1804,6 @@ interface FunctionCallGetDataRequest {
1745
1804
  functionCallId?: string | undefined;
1746
1805
  attemptToken?: string | undefined;
1747
1806
  lastIndex: number;
1748
- useGaplessRead: boolean;
1749
1807
  }
1750
1808
  declare const FunctionCallGetDataRequest: MessageFns$1<FunctionCallGetDataRequest>;
1751
1809
  interface FunctionCallInfo {
@@ -1995,6 +2053,7 @@ interface FunctionGetRequest {
1995
2053
  appName: string;
1996
2054
  objectTag: string;
1997
2055
  environmentName: string;
2056
+ appVersion: number;
1998
2057
  }
1999
2058
  declare const FunctionGetRequest: MessageFns$1<FunctionGetRequest>;
2000
2059
  interface FunctionGetResponse {
@@ -2073,7 +2132,8 @@ interface FunctionMapResponse {
2073
2132
  maxInputsOutstanding: number;
2074
2133
  }
2075
2134
  declare const FunctionMapResponse: MessageFns$1<FunctionMapResponse>;
2076
- interface FunctionOptions {
2135
+ /** todo(ayush): update this to also use `autoscaler_settings` */
2136
+ interface FunctionOptions$1 {
2077
2137
  secretIds: string[];
2078
2138
  /** Currently not supported */
2079
2139
  mountIds: string[];
@@ -2095,8 +2155,9 @@ interface FunctionOptions {
2095
2155
  cloudProviderStr?: string | undefined;
2096
2156
  replaceCloudBucketMounts: boolean;
2097
2157
  cloudBucketMounts: CloudBucketMount$1[];
2158
+ pinnedAppVersion?: number | undefined;
2098
2159
  }
2099
- declare const FunctionOptions: MessageFns$1<FunctionOptions>;
2160
+ declare const FunctionOptions$1: MessageFns$1<FunctionOptions$1>;
2100
2161
  interface FunctionPrecreateRequest {
2101
2162
  appId: string;
2102
2163
  functionName: string;
@@ -2304,6 +2365,16 @@ interface ImageFromIdResponse {
2304
2365
  metadata: ImageMetadata | undefined;
2305
2366
  }
2306
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>;
2307
2378
  interface ImageGetOrCreateRequest {
2308
2379
  image: Image$1 | undefined;
2309
2380
  appId: string;
@@ -2344,6 +2415,29 @@ interface ImageJoinStreamingResponse {
2344
2415
  metadata: ImageMetadata | undefined;
2345
2416
  }
2346
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>;
2347
2441
  interface ImageMetadata {
2348
2442
  /** The output of `python -VV. Not set if missing */
2349
2443
  pythonVersionInfo?: string | undefined;
@@ -2368,11 +2462,47 @@ interface ImageMetadata {
2368
2462
  imageBuilderVersion?: string | undefined;
2369
2463
  }
2370
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>;
2371
2479
  interface ImageRegistryConfig {
2372
2480
  registryAuthType: RegistryAuthType;
2373
2481
  secretId: string;
2374
2482
  }
2375
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>;
2376
2506
  interface InputCallGraphInfo {
2377
2507
  inputId: string;
2378
2508
  status: GenericResult_GenericStatus;
@@ -2516,6 +2646,7 @@ declare const MultiPartUploadList: MessageFns$1<MultiPartUploadList>;
2516
2646
  interface NetworkAccess {
2517
2647
  networkAccessType: NetworkAccess_NetworkAccessType;
2518
2648
  allowedCidrs: string[];
2649
+ allowedDomains: string[];
2519
2650
  }
2520
2651
  declare const NetworkAccess: MessageFns$1<NetworkAccess>;
2521
2652
  interface NotebookKernelPublishResultsRequest {
@@ -2937,10 +3068,18 @@ interface Sandbox$1 {
2937
3068
  verbose: boolean;
2938
3069
  /** If set, the sandbox will be created with a name. */
2939
3070
  name?: string | undefined;
2940
- /** Experimental options */
3071
+ /**
3072
+ * Deprecated: use experimental_options_v2 instead.
3073
+ *
3074
+ * @deprecated
3075
+ */
2941
3076
  experimentalOptions: {
2942
3077
  [key: string]: boolean;
2943
3078
  };
3079
+ /** Experimental options */
3080
+ experimentalOptionsV2: {
3081
+ [key: string]: string;
3082
+ };
2944
3083
  /** Internal use only. */
2945
3084
  preloadPathPrefixes: string[];
2946
3085
  /** Optional idle timeout in seconds. If set, the sandbox will be terminated after being idle for this duration. */
@@ -2972,11 +3111,14 @@ interface Sandbox$1 {
2972
3111
  * (tunnels and auth proxy).
2973
3112
  */
2974
3113
  inboundCidrAllowlist: string[];
3114
+ environmentVariables: StringMap | undefined;
2975
3115
  }
2976
3116
  declare const Sandbox$1: MessageFns$1<Sandbox$1>;
2977
3117
  interface SandboxCreateConnectTokenRequest {
2978
3118
  sandboxId: string;
2979
3119
  userMetadata: string;
3120
+ /** Uses port 8080 if unspecified. */
3121
+ port?: number | undefined;
2980
3122
  }
2981
3123
  declare const SandboxCreateConnectTokenRequest: MessageFns$1<SandboxCreateConnectTokenRequest>;
2982
3124
  interface SandboxCreateConnectTokenResponse {
@@ -3117,6 +3259,8 @@ interface SandboxRestoreRequest {
3117
3259
  snapshotId: string;
3118
3260
  sandboxNameOverride: string;
3119
3261
  sandboxNameOverrideType: SandboxRestoreRequest_SandboxNameOverrideType;
3262
+ /** For internal debugging use only. */
3263
+ workerId: string;
3120
3264
  }
3121
3265
  declare const SandboxRestoreRequest: MessageFns$1<SandboxRestoreRequest>;
3122
3266
  interface SandboxRestoreResponse {
@@ -3422,6 +3566,12 @@ interface SharedVolumeRemoveFileRequest {
3422
3566
  recursive: boolean;
3423
3567
  }
3424
3568
  declare const SharedVolumeRemoveFileRequest: MessageFns$1<SharedVolumeRemoveFileRequest>;
3569
+ interface StringMap {
3570
+ contents: {
3571
+ [key: string]: string;
3572
+ };
3573
+ }
3574
+ declare const StringMap: MessageFns$1<StringMap>;
3425
3575
  interface SystemErrorMessage {
3426
3576
  errorCode: SystemErrorCode;
3427
3577
  errorMessage: string;
@@ -3967,6 +4117,7 @@ interface WorkspaceMembersListItem {
3967
4117
  identityProviderType: IdentityProviderType;
3968
4118
  email: string;
3969
4119
  avatarUrl: string;
4120
+ idpExternalId: string;
3970
4121
  }
3971
4122
  declare const WorkspaceMembersListItem: MessageFns$1<WorkspaceMembersListItem>;
3972
4123
  interface WorkspaceMembersListResponse {
@@ -4483,6 +4634,22 @@ declare const ModalClientDefinition: {
4483
4634
  readonly responseStream: false;
4484
4635
  readonly options: {};
4485
4636
  };
4637
+ readonly endpointList: {
4638
+ readonly name: "EndpointList";
4639
+ readonly requestType: MessageFns$1<EndpointListRequest>;
4640
+ readonly requestStream: false;
4641
+ readonly responseType: MessageFns$1<EndpointListResponse>;
4642
+ readonly responseStream: false;
4643
+ readonly options: {};
4644
+ };
4645
+ readonly endpointStop: {
4646
+ readonly name: "EndpointStop";
4647
+ readonly requestType: MessageFns$1<EndpointStopRequest>;
4648
+ readonly requestStream: false;
4649
+ readonly responseType: MessageFns$1<EndpointStopResponse>;
4650
+ readonly responseStream: false;
4651
+ readonly options: {};
4652
+ };
4486
4653
  /** Environments */
4487
4654
  readonly environmentCreate: {
4488
4655
  readonly name: "EnvironmentCreate";
@@ -4795,6 +4962,14 @@ declare const ModalClientDefinition: {
4795
4962
  readonly responseStream: false;
4796
4963
  readonly options: {};
4797
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
+ };
4798
4973
  readonly imageGetOrCreate: {
4799
4974
  readonly name: "ImageGetOrCreate";
4800
4975
  readonly requestType: MessageFns$1<ImageGetOrCreateRequest>;
@@ -4811,6 +4986,30 @@ declare const ModalClientDefinition: {
4811
4986
  readonly responseStream: true;
4812
4987
  readonly options: {};
4813
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
+ };
4814
5013
  /** Input Plane Map */
4815
5014
  readonly mapAwait: {
4816
5015
  readonly name: "MapAwait";
@@ -5098,6 +5297,14 @@ declare const ModalClientDefinition: {
5098
5297
  readonly responseStream: false;
5099
5298
  readonly options: {};
5100
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
+ };
5101
5308
  readonly sandboxRestore: {
5102
5309
  readonly name: "SandboxRestore";
5103
5310
  readonly requestType: MessageFns$1<SandboxRestoreRequest>;
@@ -5669,14 +5876,6 @@ declare class Secret {
5669
5876
  readonly name?: string;
5670
5877
  /** @ignore */
5671
5878
  constructor(secretId: string, name?: string);
5672
- /**
5673
- * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead.
5674
- */
5675
- static fromName(name: string, params?: SecretFromNameParams): Promise<Secret>;
5676
- /**
5677
- * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead.
5678
- */
5679
- static fromObject(entries: Record<string, string>, params?: SecretFromObjectParams): Promise<Secret>;
5680
5879
  }
5681
5880
 
5682
5881
  declare class CloudBucketMountService {
@@ -5701,17 +5900,6 @@ declare class CloudBucketMount {
5701
5900
  readonly bucketEndpointUrl?: string;
5702
5901
  readonly keyPrefix?: string;
5703
5902
  readonly oidcAuthRoleArn?: string;
5704
- /**
5705
- * @deprecated Use {@link CloudBucketMountService#create client.cloudBucketMounts.create()} instead.
5706
- */
5707
- constructor(bucketName: string, params?: {
5708
- secret?: Secret;
5709
- readOnly?: boolean;
5710
- requesterPays?: boolean;
5711
- bucketEndpointUrl?: string;
5712
- keyPrefix?: string;
5713
- oidcAuthRoleArn?: string;
5714
- });
5715
5903
  /** @ignore */
5716
5904
  constructor(bucketName: string, secret: Secret | undefined, readOnly: boolean, requesterPays: boolean, bucketEndpointUrl: string | undefined, keyPrefix: string | undefined, oidcAuthRoleArn: string | undefined, bucketType: CloudBucketMount_BucketType);
5717
5905
  /** @ignore */
@@ -5753,87 +5941,13 @@ declare class FunctionCall {
5753
5941
  #private;
5754
5942
  readonly functionCallId: string;
5755
5943
  /** @ignore */
5756
- constructor(client: ModalClient | undefined, functionCallId: string);
5757
- /**
5758
- * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead.
5759
- */
5760
- static fromId(functionCallId: string): FunctionCall;
5944
+ constructor(client: ModalClient, functionCallId: string);
5761
5945
  /** Get the result of a FunctionCall, optionally waiting with a timeout. */
5762
5946
  get(params?: FunctionCallGetParams): Promise<any>;
5763
5947
  /** Cancel a running FunctionCall. */
5764
5948
  cancel(params?: FunctionCallCancelParams): Promise<void>;
5765
5949
  }
5766
5950
 
5767
- /** Optional parameters for `client.functions.fromName()`. */
5768
- type FunctionFromNameParams = {
5769
- environment?: string;
5770
- createIfMissing?: boolean;
5771
- };
5772
- /**
5773
- * Service for managing {@link Function_ Function}s.
5774
- *
5775
- * Normally only ever accessed via the client as:
5776
- * ```typescript
5777
- * const modal = new ModalClient();
5778
- * const function = await modal.functions.fromName("my-app", "my-function");
5779
- * ```
5780
- */
5781
- declare class FunctionService {
5782
- #private;
5783
- constructor(client: ModalClient);
5784
- /**
5785
- * Reference a {@link Function_ Function} by its name in an App.
5786
- */
5787
- fromName(appName: string, name: string, params?: FunctionFromNameParams): Promise<Function_>;
5788
- }
5789
- /** Simple data structure storing stats for a running {@link Function_ Function}. */
5790
- interface FunctionStats {
5791
- backlog: number;
5792
- numTotalRunners: number;
5793
- }
5794
- /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
5795
- interface FunctionUpdateAutoscalerParams {
5796
- minContainers?: number;
5797
- maxContainers?: number;
5798
- bufferContainers?: number;
5799
- scaledownWindowMs?: number;
5800
- }
5801
- /** Represents a deployed Modal Function, which can be invoked remotely. */
5802
- declare class Function_ {
5803
- #private;
5804
- readonly functionId: string;
5805
- readonly methodName?: string;
5806
- /** @ignore */
5807
- constructor(client: ModalClient, functionId: string, methodName?: string, functionHandleMetadata?: FunctionHandleMetadata);
5808
- /**
5809
- * @deprecated Use `client.functions.fromName()` instead.
5810
- */
5811
- static lookup(appName: string, name: string, params?: FunctionFromNameParams): Promise<Function_>;
5812
- remote(args?: any[], kwargs?: Record<string, any>): Promise<any>;
5813
- spawn(args?: any[], kwargs?: Record<string, any>): Promise<FunctionCall>;
5814
- getCurrentStats(): Promise<FunctionStats>;
5815
- updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<void>;
5816
- /**
5817
- * URL for addressing the Web Function via HTTP.
5818
- * @returns The web URL, or undefined if this is not a Web Function
5819
- */
5820
- getWebUrl(): Promise<string | undefined>;
5821
- }
5822
-
5823
- /** Retry policy configuration for a Modal Function/Cls. */
5824
- declare class Retries {
5825
- readonly maxRetries: number;
5826
- readonly backoffCoefficient: number;
5827
- readonly initialDelayMs: number;
5828
- readonly maxDelayMs: number;
5829
- constructor(params: {
5830
- maxRetries: number;
5831
- backoffCoefficient?: number;
5832
- initialDelayMs?: number;
5833
- maxDelayMs?: number;
5834
- });
5835
- }
5836
-
5837
5951
  type HeartbeatFunction = () => Promise<any>;
5838
5952
  declare class EphemeralHeartbeatManager {
5839
5953
  private readonly heartbeatFn;
@@ -5885,52 +5999,90 @@ declare class VolumeService {
5885
5999
  */
5886
6000
  delete(name: string, params?: VolumeDeleteParams): Promise<void>;
5887
6001
  }
6002
+ /**
6003
+ * Resolved mount configuration stored on a Volume. `subPath: undefined` means "mount the
6004
+ * whole volume" (no sub-path set on the resulting VolumeMount proto).
6005
+ */
6006
+ type ResolvedMountOptions = {
6007
+ readOnly: boolean;
6008
+ subPath: string | undefined;
6009
+ };
5888
6010
  /** Volumes provide persistent storage that can be mounted in Modal {@link Function_ Function}s. */
5889
6011
  declare class Volume {
5890
6012
  #private;
5891
6013
  readonly volumeId: string;
5892
6014
  readonly name?: string;
5893
- private _readOnly;
5894
- /** @ignore */
5895
- constructor(volumeId: string, name?: string, readOnly?: boolean, ephemeralHbManager?: EphemeralHeartbeatManager);
5896
6015
  /**
5897
- * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead.
6016
+ * @hidden
6017
+ * @internal
5898
6018
  */
5899
- static fromName(name: string, options?: VolumeFromNameParams): Promise<Volume>;
5900
- /** Configure Volume to mount as read-only. */
5901
- readOnly(): Volume;
5902
- get isReadOnly(): boolean;
6019
+ readonly _mountOptions: ResolvedMountOptions;
6020
+ /** @ignore */
6021
+ constructor(volumeId: string, name?: string, mountOptions?: ResolvedMountOptions, ephemeralHbManager?: EphemeralHeartbeatManager);
5903
6022
  /**
5904
- * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead.
6023
+ * Configure options used when mounting this Volume. Fields left undefined preserve their value
6024
+ * from any previous withMountOptions call on the same Volume (stacking).
5905
6025
  */
5906
- static ephemeral(options?: VolumeEphemeralParams): Promise<Volume>;
6026
+ withMountOptions(params?: VolumeMountOptions): Volume;
5907
6027
  /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */
5908
6028
  closeEphemeral(): void;
5909
6029
  }
6030
+ /** Options for mounting a {@link Volume}. */
6031
+ type VolumeMountOptions = {
6032
+ readOnly?: boolean;
6033
+ subPath?: string;
6034
+ };
5910
6035
 
5911
- /** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */
5912
- 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 = {
5913
6052
  environment?: string;
5914
6053
  createIfMissing?: boolean;
5915
6054
  };
5916
6055
  /**
5917
- * Service for managing {@link Cls}.
6056
+ * Service for managing {@link Function_ Function}s.
5918
6057
  *
5919
6058
  * Normally only ever accessed via the client as:
5920
6059
  * ```typescript
5921
6060
  * const modal = new ModalClient();
5922
- * const cls = await modal.cls.fromName("my-app", "MyCls");
6061
+ * const function = await modal.functions.fromName("my-app", "my-function");
5923
6062
  * ```
5924
6063
  */
5925
- declare class ClsService {
6064
+ declare class FunctionService {
5926
6065
  #private;
5927
6066
  constructor(client: ModalClient);
5928
6067
  /**
5929
- * Reference a {@link Cls} from a deployed {@link App} by its name.
6068
+ * Reference a {@link Function_ Function} by its name in an App.
5930
6069
  */
5931
- 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;
6076
+ }
6077
+ /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
6078
+ interface FunctionUpdateAutoscalerParams {
6079
+ minContainers?: number;
6080
+ maxContainers?: number;
6081
+ bufferContainers?: number;
6082
+ scaledownWindowMs?: number;
5932
6083
  }
5933
- type ClsWithOptionsParams = {
6084
+ /** Configuration options for {@link Function_#withOptions Function_.withOptions()}. */
6085
+ type FunctionWithOptionsParams = {
5934
6086
  cpu?: number;
5935
6087
  cpuLimit?: number;
5936
6088
  memoryMiB?: number;
@@ -5945,29 +6097,81 @@ type ClsWithOptionsParams = {
5945
6097
  scaledownWindowMs?: number;
5946
6098
  timeoutMs?: number;
5947
6099
  };
5948
- type ClsWithConcurrencyParams = {
6100
+ /** Configuration options for {@link Function_#withConcurrency Function_.withConcurrency()}. */
6101
+ type FunctionWithConcurrencyParams = {
5949
6102
  maxInputs: number;
5950
6103
  targetInputs?: number;
5951
6104
  };
5952
- type ClsWithBatchingParams = {
6105
+ /** Configuration options for {@link Function_#withBatching Function_.withBatching()}. */
6106
+ type FunctionWithBatchingParams = {
5953
6107
  maxBatchSize: number;
5954
6108
  waitMs: number;
5955
6109
  };
5956
- type ServiceOptions = ClsWithOptionsParams & {
6110
+ /** Internal data structure holding configuration options for {@link Function_ Function}. */
6111
+ type FunctionOptions = FunctionWithOptionsParams & {
5957
6112
  maxConcurrentInputs?: number;
5958
6113
  targetConcurrentInputs?: number;
5959
6114
  batchMaxSize?: number;
5960
6115
  batchWaitMs?: number;
5961
6116
  };
5962
- /** Represents a deployed Modal Cls. */
5963
- declare class Cls {
6117
+ /** Represents a deployed Modal Function, which can be invoked remotely. */
6118
+ declare class Function_ {
5964
6119
  #private;
6120
+ readonly functionId: string;
6121
+ readonly methodName?: string;
5965
6122
  /** @ignore */
5966
- 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>;
5967
6138
  /**
5968
- * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead.
6139
+ * URL for addressing the Web Function via HTTP.
6140
+ * @returns The web URL, or undefined if this is not a Web Function
5969
6141
  */
5970
- static lookup(appName: string, name: string, params?: ClsFromNameParams): Promise<Cls>;
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);
6162
+ /**
6163
+ * Reference a {@link Cls} from a deployed {@link App} by its name.
6164
+ */
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);
5971
6175
  /** Create a new instance of the Cls with parameters and/or runtime options. */
5972
6176
  instance(parameters?: Record<string, any>): Promise<ClsInstance>;
5973
6177
  /** Override the static Function configuration at runtime. */
@@ -5984,6 +6188,11 @@ declare class ClsInstance {
5984
6188
  method(name: string): Function_;
5985
6189
  }
5986
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
+ };
5987
6196
  /**
5988
6197
  * Service for managing {@link Image}s.
5989
6198
  *
@@ -6002,6 +6211,14 @@ declare class ImageService {
6002
6211
  * @param imageId - Image ID.
6003
6212
  */
6004
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>;
6005
6222
  /**
6006
6223
  * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication.
6007
6224
  *
@@ -6037,6 +6254,11 @@ declare class ImageService {
6037
6254
  }
6038
6255
  /** Optional parameters for {@link ImageService#delete client.images.delete()}. */
6039
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
+ };
6040
6262
  /** Optional parameters for {@link Image#dockerfileCommands Image.dockerfileCommands()}. */
6041
6263
  type ImageDockerfileCommandsParams = {
6042
6264
  /** Environment variables to set in the build environment. */
@@ -6060,24 +6282,8 @@ type Layer = {
6060
6282
  declare class Image {
6061
6283
  #private;
6062
6284
  /** @ignore */
6063
- 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);
6064
6286
  get imageId(): string;
6065
- /**
6066
- * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead.
6067
- */
6068
- static fromId(imageId: string): Promise<Image>;
6069
- /**
6070
- * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead.
6071
- */
6072
- static fromRegistry(tag: string, secret?: Secret): Image;
6073
- /**
6074
- * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead.
6075
- */
6076
- static fromAwsEcr(tag: string, secret: Secret): Image;
6077
- /**
6078
- * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead.
6079
- */
6080
- static fromGcpArtifactRegistry(tag: string, secret: Secret): Image;
6081
6287
  private static validateDockerfileCommands;
6082
6288
  /**
6083
6289
  * Extend an image with arbitrary Dockerfile-like commands.
@@ -6097,9 +6303,13 @@ declare class Image {
6097
6303
  */
6098
6304
  build(app: App): Promise<Image>;
6099
6305
  /**
6100
- * @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.
6101
6311
  */
6102
- static delete(imageId: string, _?: ImageDeleteParams): Promise<void>;
6312
+ publish(name: string, params?: ImagePublishParams): Promise<void>;
6103
6313
  }
6104
6314
 
6105
6315
  /**
@@ -6128,10 +6338,6 @@ declare class Proxy {
6128
6338
  readonly proxyId: string;
6129
6339
  /** @ignore */
6130
6340
  constructor(proxyId: string);
6131
- /**
6132
- * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead.
6133
- */
6134
- static fromName(name: string, params?: ProxyFromNameParams): Promise<Proxy>;
6135
6341
  }
6136
6342
 
6137
6343
  /** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */
@@ -6226,20 +6432,8 @@ declare class Queue {
6226
6432
  readonly name?: string;
6227
6433
  /** @ignore */
6228
6434
  constructor(client: ModalClient, queueId: string, name?: string, ephemeralHbManager?: EphemeralHeartbeatManager);
6229
- /**
6230
- * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead.
6231
- */
6232
- static ephemeral(params?: QueueEphemeralParams): Promise<Queue>;
6233
6435
  /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */
6234
6436
  closeEphemeral(): void;
6235
- /**
6236
- * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead.
6237
- */
6238
- static lookup(name: string, options?: QueueFromNameParams): Promise<Queue>;
6239
- /**
6240
- * @deprecated Use {@link QueueService#delete client.queues.delete()} instead.
6241
- */
6242
- static delete(name: string, options?: QueueDeleteParams): Promise<void>;
6243
6437
  /**
6244
6438
  * Remove all objects from a Queue partition.
6245
6439
  */
@@ -6301,6 +6495,70 @@ declare enum TaskExecStdoutConfig {
6301
6495
  TASK_EXEC_STDOUT_CONFIG_PIPE = 1,
6302
6496
  UNRECOGNIZED = -1
6303
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>;
6304
6562
  /**
6305
6563
  * The response to a TaskExecPollRequest. If the exec'd command has not
6306
6564
  * completed, exit_status will be unset.
@@ -6373,6 +6631,11 @@ interface TaskMountDirectoryRequest {
6373
6631
  taskId: string;
6374
6632
  path: Uint8Array;
6375
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;
6376
6639
  }
6377
6640
  declare const TaskMountDirectoryRequest: MessageFns<TaskMountDirectoryRequest>;
6378
6641
  interface TaskSnapshotDirectoryRequest {
@@ -6394,6 +6657,11 @@ interface TaskSnapshotDirectoryRequest {
6394
6657
  * server.
6395
6658
  */
6396
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;
6397
6665
  }
6398
6666
  declare const TaskSnapshotDirectoryRequest: MessageFns<TaskSnapshotDirectoryRequest>;
6399
6667
  interface TaskSnapshotDirectoryResponse {
@@ -6414,6 +6682,11 @@ interface TaskSnapshotFilesystemRequest {
6414
6682
  * server.
6415
6683
  */
6416
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;
6417
6690
  }
6418
6691
  declare const TaskSnapshotFilesystemRequest: MessageFns<TaskSnapshotFilesystemRequest>;
6419
6692
  interface TaskSnapshotFilesystemResponse {
@@ -6475,13 +6748,20 @@ declare class TaskCommandRouterClientImpl {
6475
6748
  static tryInit(serverClient: ModalGrpcClient, taskId: string, sandboxId: string, isV2: boolean, logger: Logger, profile: Profile): Promise<TaskCommandRouterClientImpl | null>;
6476
6749
  private constructor();
6477
6750
  close(): void;
6751
+ /** Run a unary RPC against the command router with the default retry policy. */
6752
+ private callUnary;
6478
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>;
6479
6759
  execStdioRead(taskId: string, execId: string, fileDescriptor: FileDescriptor, deadline?: number | null): AsyncGenerator<TaskExecStdioReadResponse>;
6480
6760
  execStdinWrite(taskId: string, execId: string, offset: number, data: Uint8Array, eof: boolean): Promise<TaskExecStdinWriteResponse>;
6481
6761
  execPoll(taskId: string, execId: string, deadline?: number | null): Promise<TaskExecPollResponse>;
6482
6762
  execWait(taskId: string, execId: string, deadline?: number | null): Promise<TaskExecWaitResponse>;
6483
6763
  mountDirectory(request: TaskMountDirectoryRequest): Promise<void>;
6484
- snapshotDirectory(request: TaskSnapshotDirectoryRequest): Promise<TaskSnapshotDirectoryResponse>;
6764
+ snapshotDirectory(request: TaskSnapshotDirectoryRequest, options?: TimeoutOptions): Promise<TaskSnapshotDirectoryResponse>;
6485
6765
  snapshotFilesystem(request: TaskSnapshotFilesystemRequest, options?: TimeoutOptions): Promise<TaskSnapshotFilesystemResponse>;
6486
6766
  unmountDirectory(request: TaskUnmountDirectoryRequest): Promise<void>;
6487
6767
  private refreshJwt;
@@ -6489,34 +6769,259 @@ declare class TaskCommandRouterClientImpl {
6489
6769
  private streamStdio;
6490
6770
  }
6491
6771
 
6492
- /** File open modes supported by the filesystem API. */
6493
- type SandboxFileMode = "r" | "w" | "a" | "r+" | "w+" | "a+";
6494
- /**
6495
- * SandboxFile represents an open file in the {@link Sandbox} filesystem.
6496
- * Provides read/write operations similar to Node.js `fsPromises.FileHandle`.
6497
- */
6498
- declare class SandboxFile {
6499
- #private;
6772
+ /** Type of a filesystem entry. */
6773
+ type FileType = "file" | "directory" | "symlink";
6774
+ /** Metadata for a file or directory entry in a Sandbox. */
6775
+ interface FileInfo {
6776
+ readonly name: string;
6777
+ readonly path: string;
6778
+ readonly type: FileType;
6779
+ readonly size: number;
6780
+ readonly mode: number;
6781
+ readonly permissions: string;
6782
+ readonly owner: string;
6783
+ readonly group: string;
6784
+ /** Unix epoch seconds. */
6785
+ readonly modifiedTime: number;
6786
+ readonly symlinkTarget: string | null;
6787
+ }
6788
+ /** Namespace for Sandbox filesystem APIs. */
6789
+ declare class SandboxFilesystem {
6790
+ private readonly exec;
6500
6791
  /** @ignore */
6501
- constructor(client: ModalClient, fileDescriptor: string, taskId: string);
6792
+ constructor(exec: (command: string[], params?: SandboxExecParams) => Promise<ContainerProcess>);
6793
+ /**
6794
+ * Copy a local file into the Sandbox.
6795
+ *
6796
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6797
+ * Parent directories are created if needed. The remote file is overwritten
6798
+ * if it already exists.
6799
+ *
6800
+ * @throws {SandboxFilesystemNotADirectoryError} a parent component of `remotePath` is not a directory.
6801
+ * @throws {SandboxFilesystemIsADirectoryError} `remotePath` points to a directory.
6802
+ * @throws {SandboxFilesystemPermissionError} write permission is denied in the Sandbox.
6803
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6804
+ * @throws {Error} `localPath` does not exist, is a directory, or cannot be read (`ENOENT`, `EISDIR`, `EACCES`).
6805
+ */
6806
+ copyFromLocal(localPath: string, remotePath: string): Promise<void>;
6807
+ /**
6808
+ * Copy a file from the Sandbox to a local path.
6809
+ *
6810
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6811
+ * Parent directories for `localPath` are created if needed. The local file
6812
+ * is overwritten if it already exists.
6813
+ *
6814
+ * @throws {SandboxFilesystemNotFoundError} the remote path does not exist.
6815
+ * @throws {SandboxFilesystemIsADirectoryError} the remote path points to a directory.
6816
+ * @throws {SandboxFilesystemFileTooLargeError} the file exceeds the read size limit.
6817
+ * @throws {SandboxFilesystemPermissionError} read permission is denied in the Sandbox.
6818
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6819
+ * @throws {Error} `localPath` points to a directory, or writing it is not permitted.
6820
+ */
6821
+ copyToLocal(remotePath: string, localPath: string): Promise<void>;
6822
+ /**
6823
+ * List files and directories in a Sandbox directory.
6824
+ *
6825
+ * `remotePath` must be an absolute path to a directory in the Sandbox.
6826
+ * Returns an array of {@link FileInfo} objects sorted by name.
6827
+ *
6828
+ * @throws {SandboxFilesystemNotFoundError} the path does not exist.
6829
+ * @throws {SandboxFilesystemNotADirectoryError} the path is not a directory.
6830
+ * @throws {SandboxFilesystemPermissionError} read permission is denied.
6831
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6832
+ */
6833
+ listFiles(remotePath: string): Promise<FileInfo[]>;
6834
+ /**
6835
+ * Create a new directory in the Sandbox.
6836
+ *
6837
+ * `remotePath` must be an absolute path in the Sandbox.
6838
+ *
6839
+ * When `createParents` is `true` (the default), any missing parent
6840
+ * directories are created and the call is idempotent (succeeds if the
6841
+ * directory already exists). When `createParents` is `false`, the immediate
6842
+ * parent must already exist and the path must not already exist.
6843
+ *
6844
+ * @throws {SandboxFilesystemNotFoundError} the parent does not exist and `createParents` is `false`.
6845
+ * @throws {SandboxFilesystemPathAlreadyExistsError} the path already exists and `createParents` is `false`.
6846
+ * @throws {SandboxFilesystemNotADirectoryError} a path component is not a directory.
6847
+ * @throws {SandboxFilesystemPermissionError} creation is not permitted.
6848
+ * @throws {InvalidError} the operation is not supported by the mount.
6849
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6850
+ */
6851
+ makeDirectory(remotePath: string, options?: {
6852
+ createParents?: boolean;
6853
+ }): Promise<void>;
6854
+ /**
6855
+ * Read a file from the Sandbox and return its contents as bytes.
6856
+ *
6857
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6858
+ *
6859
+ * @throws {SandboxFilesystemNotFoundError} the path does not exist.
6860
+ * @throws {SandboxFilesystemIsADirectoryError} the path points to a directory.
6861
+ * @throws {SandboxFilesystemFileTooLargeError} the file exceeds the read size limit.
6862
+ * @throws {SandboxFilesystemPermissionError} read permission is denied.
6863
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6864
+ */
6865
+ readBytes(remotePath: string): Promise<Uint8Array>;
6866
+ /**
6867
+ * Read a file from the Sandbox and return its contents as a UTF-8 string.
6868
+ *
6869
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6870
+ *
6871
+ * @throws {SandboxFilesystemNotFoundError} the path does not exist.
6872
+ * @throws {SandboxFilesystemIsADirectoryError} the path points to a directory.
6873
+ * @throws {SandboxFilesystemFileTooLargeError} the file exceeds the read size limit.
6874
+ * @throws {SandboxFilesystemPermissionError} read permission is denied.
6875
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6876
+ */
6877
+ readText(remotePath: string): Promise<string>;
6878
+ /**
6879
+ * Remove a file or directory in the Sandbox.
6880
+ *
6881
+ * `remotePath` must be an absolute path in the Sandbox. When `remotePath`
6882
+ * is a directory and `recursive` is `false` (the default), it is removed
6883
+ * only if empty. When `recursive` is `true`, the directory and all its
6884
+ * contents are removed. Recursive removal is not supported on all mounts —
6885
+ * `CloudBucketMount` does not support it.
6886
+ *
6887
+ * @throws {SandboxFilesystemNotFoundError} the path does not exist.
6888
+ * @throws {SandboxFilesystemDirectoryNotEmptyError} `recursive` is `false` and the directory is not empty.
6889
+ * @throws {SandboxFilesystemPermissionError} removal is not permitted.
6890
+ * @throws {InvalidError} the operation is not supported by the mount.
6891
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6892
+ */
6893
+ remove(remotePath: string, options?: {
6894
+ recursive?: boolean;
6895
+ }): Promise<void>;
6502
6896
  /**
6503
- * Read data from the file.
6504
- * @returns Promise that resolves to the read data as Uint8Array
6897
+ * Return metadata for a single file, directory, or symlink in the Sandbox.
6898
+ *
6899
+ * `remotePath` must be an absolute path in the Sandbox. If `remotePath` is
6900
+ * a symlink, the returned {@link FileInfo} describes the symlink itself, not
6901
+ * the target it points to.
6902
+ *
6903
+ * @throws {SandboxFilesystemNotFoundError} the path does not exist.
6904
+ * @throws {SandboxFilesystemNotADirectoryError} a non-leaf component of the path is not a directory.
6905
+ * @throws {SandboxFilesystemPermissionError} a path component is not searchable.
6906
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6505
6907
  */
6506
- read(): Promise<Uint8Array>;
6908
+ stat(remotePath: string): Promise<FileInfo>;
6507
6909
  /**
6508
- * Write data to the file.
6509
- * @param data - Data to write
6910
+ * Write binary content to a file in the Sandbox.
6911
+ *
6912
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6913
+ * Parent directories are created if needed. The remote file is overwritten
6914
+ * if it already exists.
6915
+ *
6916
+ * @throws {TypeError} `data` is not a `Uint8Array`, `ArrayBuffer`, or `Buffer`.
6917
+ * @throws {SandboxFilesystemNotADirectoryError} a parent component of `remotePath` is not a directory.
6918
+ * @throws {SandboxFilesystemIsADirectoryError} `remotePath` points to a directory.
6919
+ * @throws {SandboxFilesystemPermissionError} write permission is denied.
6920
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6510
6921
  */
6511
- write(data: Uint8Array): Promise<void>;
6922
+ writeBytes(data: Uint8Array | ArrayBuffer | Buffer, remotePath: string): Promise<void>;
6923
+ /**
6924
+ * Write UTF-8 text to a file in the Sandbox.
6925
+ *
6926
+ * `remotePath` must be an absolute path to a file in the Sandbox.
6927
+ * Parent directories are created if needed. The remote file is overwritten
6928
+ * if it already exists.
6929
+ *
6930
+ * @throws {TypeError} `data` is not a string.
6931
+ * @throws {SandboxFilesystemNotADirectoryError} a parent component of `remotePath` is not a directory.
6932
+ * @throws {SandboxFilesystemIsADirectoryError} `remotePath` points to a directory.
6933
+ * @throws {SandboxFilesystemPermissionError} write permission is denied.
6934
+ * @throws {SandboxFilesystemError} the command fails for any other reason.
6935
+ */
6936
+ writeText(data: string, remotePath: string): Promise<void>;
6937
+ }
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);
6512
6981
  /**
6513
- * Flush any buffered data to the file.
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`.
6514
6985
  */
6515
- flush(): Promise<void>;
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>;
6516
7015
  /**
6517
- * Close the file handle.
7016
+ * Check if the sidecar container has finished running.
7017
+ *
7018
+ * Returns `null` if the container is still running, else the exit code.
6518
7019
  */
6519
- close(): Promise<void>;
7020
+ poll(): Promise<number | null>;
7021
+ terminate(): Promise<void>;
7022
+ terminate(params: {
7023
+ wait: true;
7024
+ }): Promise<number>;
6520
7025
  }
6521
7026
 
6522
7027
  /**
@@ -6626,10 +7131,8 @@ type SandboxCreateParams = {
6626
7131
  blockNetwork?: boolean;
6627
7132
  /** List of CIDRs the Sandbox is allowed to access. If not set, all CIDRs are allowed. Cannot be used with blockNetwork. */
6628
7133
  outboundCidrAllowlist?: string[];
6629
- /**
6630
- * @deprecated Use {@link outboundCidrAllowlist} instead.
6631
- */
6632
- 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[];
6633
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. */
6634
7137
  inboundCidrAllowlist?: string[];
6635
7138
  /** Cloud provider to run the Sandbox on. */
@@ -6644,7 +7147,7 @@ type SandboxCreateParams = {
6644
7147
  readinessProbe?: Probe;
6645
7148
  /** Optional name for the Sandbox. Unique within an App. */
6646
7149
  name?: string;
6647
- /** 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}. */
6648
7151
  tags?: Record<string, string>;
6649
7152
  /** Optional experimental options. */
6650
7153
  experimentalOptions?: Record<string, any>;
@@ -6673,6 +7176,22 @@ declare class SandboxService {
6673
7176
  create(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
6674
7177
  /**
6675
7178
  * Create a new {@link Sandbox} using the experimental V2 backend.
7179
+ *
7180
+ * Supported features include exec, encrypted tunnels, wait/poll/terminate,
7181
+ * CPU and memory configuration, region placement, volumes, cloud bucket
7182
+ * mounts (with static credentials via {@link Secret}), and filesystem
7183
+ * snapshots.
7184
+ *
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.
7188
+ *
7189
+ * V2 sandboxes created with this method are not currently returned by
7190
+ * {@link SandboxService#list client.sandboxes.list()} and cannot be looked up
7191
+ * with {@link SandboxService#fromName client.sandboxes.fromName()}. Store
7192
+ * {@link Sandbox#sandboxId sandbox.sandboxId} if you need to retrieve the
7193
+ * sandbox later, and use {@link SandboxService#fromId client.sandboxes.fromId()}
7194
+ * to reattach.
6676
7195
  */
6677
7196
  experimentalCreate(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
6678
7197
  /** Returns a running {@link Sandbox} object from an ID.
@@ -6735,6 +7254,36 @@ type SandboxTerminateParams = {
6735
7254
  /** If true, wait for the Sandbox to finish and return the exit code. */
6736
7255
  wait?: boolean;
6737
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
+ };
6738
7287
  type SandboxCreateConnectTokenParams = {
6739
7288
  /** Optional user-provided metadata string that will be added to the headers by the proxy when forwarding requests to the Sandbox. */
6740
7289
  userMetadata?: string;
@@ -6772,25 +7321,18 @@ declare class Sandbox {
6772
7321
  get stdin(): ModalWriteStream<string>;
6773
7322
  get stdout(): ModalReadStream<string>;
6774
7323
  get stderr(): ModalReadStream<string>;
6775
- /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */
7324
+ get filesystem(): SandboxFilesystem;
7325
+ /**
7326
+ * Operations for managing sidecar containers that run alongside the
7327
+ * Sandbox's main container.
7328
+ *
7329
+ * EXPERIMENTAL: the API is subject to change.
7330
+ */
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}. */
6776
7333
  setTags(tags: Record<string, string>): Promise<void>;
6777
7334
  /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */
6778
7335
  getTags(): Promise<Record<string, string>>;
6779
- /**
6780
- * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead.
6781
- */
6782
- static fromId(sandboxId: string): Promise<Sandbox>;
6783
- /**
6784
- * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead.
6785
- */
6786
- static fromName(appName: string, name: string, environment?: string): Promise<Sandbox>;
6787
- /**
6788
- * Open a file in the Sandbox filesystem.
6789
- * @param path - Path to the file to open
6790
- * @param mode - File open mode (r, w, a, r+, w+, a+)
6791
- * @returns Promise that resolves to a {@link SandboxFile}
6792
- */
6793
- open(path: string, mode?: SandboxFileMode): Promise<SandboxFile>;
6794
7336
  exec(command: string[], params?: SandboxExecParams & {
6795
7337
  mode?: "text";
6796
7338
  }): Promise<ContainerProcess<string>>;
@@ -6834,14 +7376,14 @@ declare class Sandbox {
6834
7376
  *
6835
7377
  * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem.
6836
7378
  *
6837
- * `timeoutMs` is propagated as the gRPC deadline. If the snapshot does
6838
- * not return within that window, the call is cancelled and an error is
6839
- * 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.
6840
7382
  *
6841
- * @param timeoutMs - Timeout for the snapshot operation in milliseconds.
7383
+ * @param params - Optional parameters; see {@link SandboxSnapshotFilesystemParams}.
6842
7384
  * @returns Promise that resolves to an {@link Image}
6843
7385
  */
6844
- snapshotFilesystem(timeoutMs?: number): Promise<Image>;
7386
+ snapshotFilesystem(params?: SandboxSnapshotFilesystemParams): Promise<Image>;
6845
7387
  /**
6846
7388
  * Mount an {@link Image} at a path in the Sandbox filesystem.
6847
7389
  *
@@ -6858,23 +7400,25 @@ declare class Sandbox {
6858
7400
  /**
6859
7401
  * Snapshots and creates a new {@link Image} from a directory in the running sandbox.
6860
7402
  *
6861
- * Directory snapshots are currently persisted for 30 days after they
6862
- * 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.
6863
7410
  *
6864
7411
  * @param path - The path of the directory to snapshot
7412
+ * @param params - Optional parameters; see {@link SandboxSnapshotDirectoryParams}.
6865
7413
  * @returns Promise that resolves to an {@link Image}
6866
7414
  */
6867
- snapshotDirectory(path: string): Promise<Image>;
7415
+ snapshotDirectory(path: string, params?: SandboxSnapshotDirectoryParams): Promise<Image>;
6868
7416
  /**
6869
7417
  * Check if the Sandbox has finished running.
6870
7418
  *
6871
7419
  * Returns `null` if the Sandbox is still running, else returns the exit code.
6872
7420
  */
6873
7421
  poll(): Promise<number | null>;
6874
- /**
6875
- * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead.
6876
- */
6877
- static list(params?: SandboxListParams): AsyncGenerator<Sandbox, void, unknown>;
6878
7422
  }
6879
7423
  declare class ContainerProcess<R extends string | Uint8Array = any> {
6880
7424
  #private;
@@ -6883,6 +7427,13 @@ declare class ContainerProcess<R extends string | Uint8Array = any> {
6883
7427
  stderr: ModalReadStream<R>;
6884
7428
  /** @ignore */
6885
7429
  constructor(taskId: string, execId: string, commandRouterClient: TaskCommandRouterClientImpl, params?: SandboxExecParams, deadline?: number | null);
7430
+ /**
7431
+ * @ignore
7432
+ * Send stdin EOF directly, bypassing the WritableStream state machine.
7433
+ *
7434
+ * Useful for when an stdin write has failed.
7435
+ */
7436
+ closeStdin(): Promise<void>;
6886
7437
  /** Wait for process completion and return the exit code. */
6887
7438
  wait(): Promise<number>;
6888
7439
  }
@@ -6948,9 +7499,18 @@ declare class ModalClient {
6948
7499
  private ipClients;
6949
7500
  private authTokenManager;
6950
7501
  private customMiddleware;
7502
+ private environmentManager;
6951
7503
  constructor(params?: ModalClientParams);
6952
7504
  environmentName(environment?: string): string;
6953
- 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>;
6954
7514
  /** @ignore */
6955
7515
  ipClient(serverUrl: string): ModalGrpcClient;
6956
7516
  close(): void;
@@ -6976,23 +7536,6 @@ type RetryOptions = {
6976
7536
  /** Additional status codes to retry. */
6977
7537
  additionalStatusCodes?: Status[];
6978
7538
  };
6979
- /**
6980
- * @deprecated Use {@link ModalClient `new ModalClient()`} instead.
6981
- */
6982
- type ClientOptions = {
6983
- tokenId: string;
6984
- tokenSecret: string;
6985
- environment?: string;
6986
- };
6987
- /**
6988
- * @deprecated Use {@link ModalClient `new ModalClient()`} instead.
6989
- */
6990
- declare function initializeClient(options: ClientOptions): void;
6991
- /**
6992
- * Stops the auth token refresh.
6993
- * @deprecated Use {@link ModalClient#close modalClient.close()} instead.
6994
- */
6995
- declare function close(): void;
6996
7539
 
6997
7540
  /**
6998
7541
  * Service for managing {@link App}s.
@@ -7016,45 +7559,13 @@ type AppFromNameParams = {
7016
7559
  environment?: string;
7017
7560
  createIfMissing?: boolean;
7018
7561
  };
7019
- /** @deprecated Use specific Params types instead. */
7020
- type LookupOptions = {
7021
- environment?: string;
7022
- createIfMissing?: boolean;
7023
- };
7024
- /** @deprecated Use specific Params types instead. */
7025
- type DeleteOptions = {
7026
- environment?: string;
7027
- };
7028
- /** @deprecated Use specific Params types instead. */
7029
- type EphemeralOptions = {
7030
- environment?: string;
7031
- };
7032
7562
  /** Represents a deployed Modal App. */
7033
7563
  declare class App {
7034
7564
  readonly appId: string;
7035
7565
  readonly name?: string;
7566
+ readonly environmentName?: string;
7036
7567
  /** @ignore */
7037
- constructor(appId: string, name?: string);
7038
- /**
7039
- * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead.
7040
- */
7041
- static lookup(name: string, options?: LookupOptions): Promise<App>;
7042
- /**
7043
- * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead.
7044
- */
7045
- createSandbox(image: Image, options?: SandboxCreateParams): Promise<Sandbox>;
7046
- /**
7047
- * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead.
7048
- */
7049
- imageFromRegistry(tag: string, secret?: Secret): Promise<Image>;
7050
- /**
7051
- * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead.
7052
- */
7053
- imageFromAwsEcr(tag: string, secret: Secret): Promise<Image>;
7054
- /**
7055
- * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead.
7056
- */
7057
- imageFromGcpArtifactRegistry(tag: string, secret: Secret): Promise<Image>;
7568
+ constructor(appId: string, name?: string, environmentName?: string);
7058
7569
  }
7059
7570
 
7060
7571
  /** An operation exceeds the allowed time limit. */
@@ -7093,6 +7604,38 @@ declare class QueueEmptyError extends Error {
7093
7604
  declare class QueueFullError extends Error {
7094
7605
  constructor(message: string);
7095
7606
  }
7607
+ /** Errors from invalid Sandbox FileSystem operations. */
7608
+ declare class SandboxFilesystemError extends Error {
7609
+ constructor(message: string);
7610
+ }
7611
+ /** A directory was expected to be empty but is not. */
7612
+ declare class SandboxFilesystemDirectoryNotEmptyError extends SandboxFilesystemError {
7613
+ constructor(message: string);
7614
+ }
7615
+ /** A file exceeds the maximum allowed size for a read operation. */
7616
+ declare class SandboxFilesystemFileTooLargeError extends SandboxFilesystemError {
7617
+ constructor(message: string);
7618
+ }
7619
+ /** A file operation was attempted on a path that resolves to a directory. */
7620
+ declare class SandboxFilesystemIsADirectoryError extends SandboxFilesystemError {
7621
+ constructor(message: string);
7622
+ }
7623
+ /** A directory operation encountered a path component that is not a directory. */
7624
+ declare class SandboxFilesystemNotADirectoryError extends SandboxFilesystemError {
7625
+ constructor(message: string);
7626
+ }
7627
+ /** A file or directory is not found. */
7628
+ declare class SandboxFilesystemNotFoundError extends SandboxFilesystemError {
7629
+ constructor(message: string);
7630
+ }
7631
+ /** A path already exists and the operation requires it to be absent. */
7632
+ declare class SandboxFilesystemPathAlreadyExistsError extends SandboxFilesystemError {
7633
+ constructor(message: string);
7634
+ }
7635
+ /** Permission is denied for a file operation. */
7636
+ declare class SandboxFilesystemPermissionError extends SandboxFilesystemError {
7637
+ constructor(message: string);
7638
+ }
7096
7639
  /** Sandbox operations that exceed the allowed time limit. */
7097
7640
  declare class SandboxTimeoutError extends Error {
7098
7641
  constructor(message?: string);
@@ -7104,4 +7647,4 @@ declare class ClientClosedError extends Error {
7104
7647
 
7105
7648
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
7106
7649
 
7107
- 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, 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, 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, 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 };