modal 0.7.4 → 0.7.5

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
@@ -126,6 +126,26 @@ declare enum DeploymentNamespace {
126
126
  DEPLOYMENT_NAMESPACE_GLOBAL = 3,
127
127
  UNRECOGNIZED = -1
128
128
  }
129
+ declare enum EndpointApiSurface {
130
+ ENDPOINT_API_SURFACE_UNSPECIFIED = 0,
131
+ ENDPOINT_API_SURFACE_OPENAI_CHAT_COMPLETIONS = 1,
132
+ ENDPOINT_API_SURFACE_OPENAI_RESPONSES = 2,
133
+ ENDPOINT_API_SURFACE_ANTHROPIC_MESSAGES = 3,
134
+ UNRECOGNIZED = -1
135
+ }
136
+ declare enum EndpointInputModality {
137
+ ENDPOINT_INPUT_MODALITY_UNSPECIFIED = 0,
138
+ ENDPOINT_INPUT_MODALITY_TEXT = 1,
139
+ ENDPOINT_INPUT_MODALITY_IMAGE = 2,
140
+ ENDPOINT_INPUT_MODALITY_AUDIO = 3,
141
+ UNRECOGNIZED = -1
142
+ }
143
+ declare enum EnvironmentRole {
144
+ ENVIRONMENT_ROLE_UNSPECIFIED = 0,
145
+ ENVIRONMENT_ROLE_VIEWER = 1,
146
+ ENVIRONMENT_ROLE_CONTRIBUTOR = 2,
147
+ UNRECOGNIZED = -1
148
+ }
129
149
  declare enum ExecOutputOption {
130
150
  EXEC_OUTPUT_OPTION_UNSPECIFIED = 0,
131
151
  EXEC_OUTPUT_OPTION_DEVNULL = 1,
@@ -171,6 +191,20 @@ declare enum GPUType {
171
191
  GPU_TYPE_H200 = 12,
172
192
  UNRECOGNIZED = -1
173
193
  }
194
+ declare enum IdentityProviderType {
195
+ IDENTITY_PROVIDER_TYPE_UNSPECIFIED = 0,
196
+ IDENTITY_PROVIDER_TYPE_GITHUB = 1,
197
+ IDENTITY_PROVIDER_TYPE_OKTA = 2,
198
+ IDENTITY_PROVIDER_TYPE_GOOGLE_OAUTH = 3,
199
+ UNRECOGNIZED = -1
200
+ }
201
+ declare enum MemberRole {
202
+ MEMBER_ROLE_UNSPECIFIED = 0,
203
+ MEMBER_ROLE_USER = 1,
204
+ MEMBER_ROLE_MANAGER = 2,
205
+ MEMBER_ROLE_OWNER = 3,
206
+ UNRECOGNIZED = -1
207
+ }
174
208
  declare enum ObjectCreationType {
175
209
  /** OBJECT_CREATION_TYPE_UNSPECIFIED - just lookup */
176
210
  OBJECT_CREATION_TYPE_UNSPECIFIED = 0,
@@ -513,7 +547,14 @@ interface AppGetByDeploymentNameRequest {
513
547
  }
514
548
  declare const AppGetByDeploymentNameRequest: MessageFns$1<AppGetByDeploymentNameRequest>;
515
549
  interface AppGetByDeploymentNameResponse {
550
+ /** Null when App with requested name is not deployed */
516
551
  appId: string;
552
+ /** Populated if App with requested name was recently stopped */
553
+ previousAppId: string;
554
+ /** Populated because server may resolve default environment */
555
+ environmentName: string;
556
+ /** Lifecycle of current App or recently stopped App */
557
+ lifecycle: AppLifecycle | undefined;
517
558
  }
518
559
  declare const AppGetByDeploymentNameResponse: MessageFns$1<AppGetByDeploymentNameResponse>;
519
560
  interface AppGetLayoutRequest {
@@ -769,7 +810,7 @@ interface AutoscalerSettings {
769
810
  maxContainers?: number | undefined;
770
811
  /** Additional container to spin up when Function is active */
771
812
  bufferContainers?: number | undefined;
772
- /** Currently unused; a placeholder in case we decide to expose scaleup control to users */
813
+ /** Stabilization window (in seconds) before scaling up; requires sustained demand over this period */
773
814
  scaleupWindow?: number | undefined;
774
815
  /** Maximum amount of time a container can be idle before being scaled down, in seconds; pka "container_idle_timeout" */
775
816
  scaledownWindow?: number | undefined;
@@ -1311,14 +1352,85 @@ interface DomainListResponse {
1311
1352
  domains: Domain[];
1312
1353
  }
1313
1354
  declare const DomainListResponse: MessageFns$1<DomainListResponse>;
1355
+ interface EndpointComputeRegionSpec {
1356
+ auto?: Empty | undefined;
1357
+ colocated?: Empty | undefined;
1358
+ explicit?: EndpointComputeRegionSpec_ExplicitRegions | undefined;
1359
+ }
1360
+ declare const EndpointComputeRegionSpec: MessageFns$1<EndpointComputeRegionSpec>;
1361
+ interface EndpointComputeRegionSpec_ExplicitRegions {
1362
+ regions: string[];
1363
+ }
1364
+ declare const EndpointComputeRegionSpec_ExplicitRegions: MessageFns$1<EndpointComputeRegionSpec_ExplicitRegions>;
1365
+ interface EndpointCreateRequest {
1366
+ name: string;
1367
+ description: string;
1368
+ proxyRegions: string[];
1369
+ computeRegion: EndpointComputeRegionSpec | undefined;
1370
+ model: EndpointModelSource | undefined;
1371
+ apiSurfaces: EndpointApiSurface[];
1372
+ inputModalities: EndpointInputModality[];
1373
+ environmentName: string;
1374
+ }
1375
+ declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
1376
+ interface EndpointCreateResponse {
1377
+ endpointId: string;
1378
+ }
1379
+ declare const EndpointCreateResponse: MessageFns$1<EndpointCreateResponse>;
1380
+ interface EndpointCustomModelSource {
1381
+ baseModelRepoId: string;
1382
+ huggingface?: EndpointHuggingFaceModelSource | undefined;
1383
+ modalVolume?: EndpointModalVolumeModelSource | undefined;
1384
+ }
1385
+ declare const EndpointCustomModelSource: MessageFns$1<EndpointCustomModelSource>;
1386
+ interface EndpointHuggingFaceModelSource {
1387
+ repoId: string;
1388
+ revision: string;
1389
+ huggingfaceToken: string;
1390
+ }
1391
+ declare const EndpointHuggingFaceModelSource: MessageFns$1<EndpointHuggingFaceModelSource>;
1392
+ interface EndpointModalVolumeModelSource {
1393
+ volumeId: string;
1394
+ modelPath: string;
1395
+ }
1396
+ declare const EndpointModalVolumeModelSource: MessageFns$1<EndpointModalVolumeModelSource>;
1397
+ interface EndpointModelSource {
1398
+ baseModelRepoId?: string | undefined;
1399
+ custom?: EndpointCustomModelSource | undefined;
1400
+ }
1401
+ declare const EndpointModelSource: MessageFns$1<EndpointModelSource>;
1314
1402
  interface EnvironmentCreateRequest {
1315
1403
  name: string;
1404
+ isManaged: boolean;
1316
1405
  }
1317
1406
  declare const EnvironmentCreateRequest: MessageFns$1<EnvironmentCreateRequest>;
1318
1407
  interface EnvironmentDeleteRequest {
1319
1408
  name: string;
1320
1409
  }
1321
1410
  declare const EnvironmentDeleteRequest: MessageFns$1<EnvironmentDeleteRequest>;
1411
+ interface EnvironmentGetManagedRequest {
1412
+ environmentId: string;
1413
+ }
1414
+ declare const EnvironmentGetManagedRequest: MessageFns$1<EnvironmentGetManagedRequest>;
1415
+ interface EnvironmentGetManagedResponse {
1416
+ environmentId: string;
1417
+ name: string;
1418
+ createdAt: number;
1419
+ principalRoles: EnvironmentGetManagedResponse_PrincipalEnvRole[];
1420
+ additionalRoles: EnvironmentGetManagedResponse_PrincipalEnvRole[];
1421
+ }
1422
+ declare const EnvironmentGetManagedResponse: MessageFns$1<EnvironmentGetManagedResponse>;
1423
+ interface EnvironmentGetManagedResponse_PrincipalEnvRole {
1424
+ userId: string;
1425
+ serviceUserId: string;
1426
+ email: string;
1427
+ avatarUrl: string;
1428
+ serviceUserName: string;
1429
+ role: EnvironmentRole;
1430
+ memberRole: MemberRole;
1431
+ userName: string;
1432
+ }
1433
+ declare const EnvironmentGetManagedResponse_PrincipalEnvRole: MessageFns$1<EnvironmentGetManagedResponse_PrincipalEnvRole>;
1322
1434
  interface EnvironmentGetOrCreateRequest {
1323
1435
  deploymentName: string;
1324
1436
  objectCreationType: ObjectCreationType;
@@ -1351,6 +1463,18 @@ interface EnvironmentMetadata {
1351
1463
  settings: EnvironmentSettings | undefined;
1352
1464
  }
1353
1465
  declare const EnvironmentMetadata: MessageFns$1<EnvironmentMetadata>;
1466
+ interface EnvironmentRoleSetRequest {
1467
+ environmentId: string;
1468
+ userId: string;
1469
+ serviceUserId: string;
1470
+ role: EnvironmentRole;
1471
+ }
1472
+ declare const EnvironmentRoleSetRequest: MessageFns$1<EnvironmentRoleSetRequest>;
1473
+ interface EnvironmentSetManagedRequest {
1474
+ environmentId: string;
1475
+ managed: boolean;
1476
+ }
1477
+ declare const EnvironmentSetManagedRequest: MessageFns$1<EnvironmentSetManagedRequest>;
1354
1478
  /**
1355
1479
  * Environment-scoped settings, with workspace-level defaults.
1356
1480
  * Note that we use MergeFrom to combine workspace / environment settings,
@@ -1473,7 +1597,7 @@ interface FunctionMessage {
1473
1597
  objectDependencies: ObjectDependency[];
1474
1598
  blockNetwork: boolean;
1475
1599
  /**
1476
- * In the SDK, we've deprecated `max_inputs` (which only every implemented `max_inputs=1`)
1600
+ * In the SDK, we've deprecated `max_inputs` (which only ever implemented `max_inputs=1`)
1477
1601
  * in favor of a boolean `single_use_containers` parameter.
1478
1602
  */
1479
1603
  maxInputs: number;
@@ -1510,6 +1634,8 @@ interface FunctionMessage {
1510
1634
  /**
1511
1635
  * _experimental_proxy_ip -> ProxyInfo
1512
1636
  * TODO: deprecate.
1637
+ *
1638
+ * @deprecated
1513
1639
  */
1514
1640
  ExperimentalProxyIp?: string | undefined;
1515
1641
  /** For internal debugging use only. */
@@ -1562,6 +1688,8 @@ interface FunctionMessage {
1562
1688
  singleUseContainers: boolean;
1563
1689
  /** When True, the function is a server function */
1564
1690
  isServer: boolean;
1691
+ /** Where inputs to a function should be routed through. */
1692
+ routingRegion: string;
1565
1693
  }
1566
1694
  declare const FunctionMessage: MessageFns$1<FunctionMessage>;
1567
1695
  interface FunctionAsyncInvokeRequest {
@@ -1712,6 +1840,8 @@ interface FunctionData {
1712
1840
  /**
1713
1841
  * _experimental_proxy_ip -> ProxyInfo
1714
1842
  * TODO: deprecate.
1843
+ *
1844
+ * @deprecated
1715
1845
  */
1716
1846
  ExperimentalProxyIp?: string | undefined;
1717
1847
  /** Mapping of method names to method definitions, only non-empty for class service functions */
@@ -1754,6 +1884,8 @@ interface FunctionData {
1754
1884
  implementationName: string;
1755
1885
  /** When True, the function is a server function */
1756
1886
  isServer: boolean;
1887
+ /** Where inputs to a function should be routed through. */
1888
+ routingRegion: string;
1757
1889
  }
1758
1890
  declare const FunctionData: MessageFns$1<FunctionData>;
1759
1891
  interface FunctionData_RankedFunction {
@@ -1768,7 +1900,6 @@ interface FunctionFinishInputsRequest {
1768
1900
  }
1769
1901
  declare const FunctionFinishInputsRequest: MessageFns$1<FunctionFinishInputsRequest>;
1770
1902
  interface FunctionGetCallGraphRequest {
1771
- /** TODO: use input_id once we switch client submit API to return those. */
1772
1903
  functionCallId: string;
1773
1904
  }
1774
1905
  declare const FunctionGetCallGraphRequest: MessageFns$1<FunctionGetCallGraphRequest>;
@@ -1801,6 +1932,7 @@ interface FunctionGetInputsItem {
1801
1932
  /** intercepted and only used by the worker. */
1802
1933
  functionMapIdx?: number | undefined;
1803
1934
  attemptToken: string;
1935
+ fromInputPlane: boolean;
1804
1936
  }
1805
1937
  declare const FunctionGetInputsItem: MessageFns$1<FunctionGetInputsItem>;
1806
1938
  interface FunctionGetInputsRequest {
@@ -2024,6 +2156,8 @@ interface FunctionPutOutputsItem {
2024
2156
  functionCallId: string;
2025
2157
  /** injected by the worker */
2026
2158
  functionMapIdx?: number | undefined;
2159
+ /** injected by the worker */
2160
+ fromInputPlane: boolean;
2027
2161
  }
2028
2162
  declare const FunctionPutOutputsItem: MessageFns$1<FunctionPutOutputsItem>;
2029
2163
  interface FunctionPutOutputsRequest {
@@ -2066,6 +2200,7 @@ interface FunctionStats$1 {
2066
2200
  backlog: number;
2067
2201
  numTotalTasks: number;
2068
2202
  numRunningInputs: number;
2203
+ inputHeadroom: number;
2069
2204
  }
2070
2205
  declare const FunctionStats$1: MessageFns$1<FunctionStats$1>;
2071
2206
  interface FunctionUpdateSchedulingParamsRequest {
@@ -2811,9 +2946,9 @@ interface Sandbox$1 {
2811
2946
  /** Optional idle timeout in seconds. If set, the sandbox will be terminated after being idle for this duration. */
2812
2947
  idleTimeoutSecs?: number | undefined;
2813
2948
  /**
2814
- * If set, the sandbox will be created with direct sandbox commands enabled.
2815
- * Exec commands for the sandbox will be issued directly to the sandbox
2816
- * command router running on the Modal worker.
2949
+ * Deprecated: direct sandbox commands are always enabled.
2950
+ *
2951
+ * @deprecated
2817
2952
  */
2818
2953
  directSandboxCommandsEnabled: boolean;
2819
2954
  /**
@@ -2832,6 +2967,11 @@ interface Sandbox$1 {
2832
2967
  includeOidcIdentityToken: boolean;
2833
2968
  /** Probe used to determine when the sandbox has become ready. */
2834
2969
  readinessProbe?: Probe$1 | undefined;
2970
+ /**
2971
+ * If set, only connections from these CIDRs will be allowed to connect to the sandbox
2972
+ * (tunnels and auth proxy).
2973
+ */
2974
+ inboundCidrAllowlist: string[];
2835
2975
  }
2836
2976
  declare const Sandbox$1: MessageFns$1<Sandbox$1>;
2837
2977
  interface SandboxCreateConnectTokenRequest {
@@ -2849,6 +2989,7 @@ interface SandboxCreateRequest {
2849
2989
  definition: Sandbox$1 | undefined;
2850
2990
  /** DEPRECATED* 7/16/2025 */
2851
2991
  environmentName: string;
2992
+ tags: SandboxTag[];
2852
2993
  }
2853
2994
  declare const SandboxCreateRequest: MessageFns$1<SandboxCreateRequest>;
2854
2995
  interface SandboxCreateResponse {
@@ -2877,6 +3018,12 @@ declare const SandboxGetCommandRouterAccessRequest: MessageFns$1<SandboxGetComma
2877
3018
  interface SandboxGetCommandRouterAccessResponse {
2878
3019
  jwt: string;
2879
3020
  url: string;
3021
+ /**
3022
+ * Worker's public IPv4 address. When set, clients should connect directly
3023
+ * to this IP while still using the URL's hostname for TLS SNI and the
3024
+ * HTTP/2 :authority header.
3025
+ */
3026
+ workerIpv4Address: string;
2880
3027
  }
2881
3028
  declare const SandboxGetCommandRouterAccessResponse: MessageFns$1<SandboxGetCommandRouterAccessResponse>;
2882
3029
  interface SandboxGetFromNameRequest {
@@ -2950,6 +3097,8 @@ interface SandboxInfo {
2950
3097
  timeoutSecs: number;
2951
3098
  idleTimeoutSecs?: number | undefined;
2952
3099
  readyAt?: number | undefined;
3100
+ readinessProbe?: Probe$1 | undefined;
3101
+ tunnels: TunnelData[];
2953
3102
  }
2954
3103
  declare const SandboxInfo: MessageFns$1<SandboxInfo>;
2955
3104
  interface SandboxListRequest {
@@ -3171,12 +3320,26 @@ interface SecretUpdateRequest_Update {
3171
3320
  value?: string | undefined;
3172
3321
  }
3173
3322
  declare const SecretUpdateRequest_Update: MessageFns$1<SecretUpdateRequest_Update>;
3323
+ interface ServiceUser {
3324
+ name: string;
3325
+ tokenId: string;
3326
+ createdBy: string;
3327
+ createdAt: number;
3328
+ lastUsedAt: number;
3329
+ createdByAvatarUrl: string;
3330
+ serviceUserId: string;
3331
+ }
3332
+ declare const ServiceUser: MessageFns$1<ServiceUser>;
3174
3333
  interface ServiceUserIdentity {
3175
3334
  serviceUserId: string;
3176
3335
  serviceUserName: string;
3177
3336
  createdBy: UserIdentity | undefined;
3178
3337
  }
3179
3338
  declare const ServiceUserIdentity: MessageFns$1<ServiceUserIdentity>;
3339
+ interface ServiceUserListResponse {
3340
+ serviceUsers: ServiceUser[];
3341
+ }
3342
+ declare const ServiceUserListResponse: MessageFns$1<ServiceUserListResponse>;
3180
3343
  interface SharedVolumeDeleteRequest {
3181
3344
  sharedVolumeId: string;
3182
3345
  }
@@ -3627,6 +3790,7 @@ interface VolumeMount {
3627
3790
  mountPath: string;
3628
3791
  allowBackgroundCommits: boolean;
3629
3792
  readOnly: boolean;
3793
+ subPath?: string | undefined;
3630
3794
  }
3631
3795
  declare const VolumeMount: MessageFns$1<VolumeMount>;
3632
3796
  interface VolumePutFiles2Request {
@@ -3792,6 +3956,23 @@ interface WorkspaceDashboardUrlResponse {
3792
3956
  url: string;
3793
3957
  }
3794
3958
  declare const WorkspaceDashboardUrlResponse: MessageFns$1<WorkspaceDashboardUrlResponse>;
3959
+ interface WorkspaceMembersListItem {
3960
+ memberId: string;
3961
+ memberDisplayname: string;
3962
+ memberRole: MemberRole;
3963
+ joinedAt: number;
3964
+ lastActiveAt: number;
3965
+ deletedAt: number;
3966
+ userId: string;
3967
+ identityProviderType: IdentityProviderType;
3968
+ email: string;
3969
+ avatarUrl: string;
3970
+ }
3971
+ declare const WorkspaceMembersListItem: MessageFns$1<WorkspaceMembersListItem>;
3972
+ interface WorkspaceMembersListResponse {
3973
+ members: WorkspaceMembersListItem[];
3974
+ }
3975
+ declare const WorkspaceMembersListResponse: MessageFns$1<WorkspaceMembersListResponse>;
3795
3976
  interface WorkspaceNameLookupResponse {
3796
3977
  /** @deprecated */
3797
3978
  workspaceName: string;
@@ -4293,6 +4474,15 @@ declare const ModalClientDefinition: {
4293
4474
  readonly responseStream: false;
4294
4475
  readonly options: {};
4295
4476
  };
4477
+ /** Endpoints */
4478
+ readonly endpointCreate: {
4479
+ readonly name: "EndpointCreate";
4480
+ readonly requestType: MessageFns$1<EndpointCreateRequest>;
4481
+ readonly requestStream: false;
4482
+ readonly responseType: MessageFns$1<EndpointCreateResponse>;
4483
+ readonly responseStream: false;
4484
+ readonly options: {};
4485
+ };
4296
4486
  /** Environments */
4297
4487
  readonly environmentCreate: {
4298
4488
  readonly name: "EnvironmentCreate";
@@ -4310,6 +4500,14 @@ declare const ModalClientDefinition: {
4310
4500
  readonly responseStream: false;
4311
4501
  readonly options: {};
4312
4502
  };
4503
+ readonly environmentGetManaged: {
4504
+ readonly name: "EnvironmentGetManaged";
4505
+ readonly requestType: MessageFns$1<EnvironmentGetManagedRequest>;
4506
+ readonly requestStream: false;
4507
+ readonly responseType: MessageFns$1<EnvironmentGetManagedResponse>;
4508
+ readonly responseStream: false;
4509
+ readonly options: {};
4510
+ };
4313
4511
  readonly environmentGetOrCreate: {
4314
4512
  readonly name: "EnvironmentGetOrCreate";
4315
4513
  readonly requestType: MessageFns$1<EnvironmentGetOrCreateRequest>;
@@ -4326,6 +4524,22 @@ declare const ModalClientDefinition: {
4326
4524
  readonly responseStream: false;
4327
4525
  readonly options: {};
4328
4526
  };
4527
+ readonly environmentRoleSet: {
4528
+ readonly name: "EnvironmentRoleSet";
4529
+ readonly requestType: MessageFns$1<EnvironmentRoleSetRequest>;
4530
+ readonly requestStream: false;
4531
+ readonly responseType: MessageFns$2<Empty>;
4532
+ readonly responseStream: false;
4533
+ readonly options: {};
4534
+ };
4535
+ readonly environmentSetManaged: {
4536
+ readonly name: "EnvironmentSetManaged";
4537
+ readonly requestType: MessageFns$1<EnvironmentSetManagedRequest>;
4538
+ readonly requestStream: false;
4539
+ readonly responseType: MessageFns$2<Empty>;
4540
+ readonly responseStream: false;
4541
+ readonly options: {};
4542
+ };
4329
4543
  readonly environmentUpdate: {
4330
4544
  readonly name: "EnvironmentUpdate";
4331
4545
  readonly requestType: MessageFns$1<EnvironmentUpdateRequest>;
@@ -5037,6 +5251,15 @@ declare const ModalClientDefinition: {
5037
5251
  readonly responseStream: false;
5038
5252
  readonly options: {};
5039
5253
  };
5254
+ /** Service users */
5255
+ readonly serviceUserList: {
5256
+ readonly name: "ServiceUserList";
5257
+ readonly requestType: MessageFns$2<Empty>;
5258
+ readonly requestStream: false;
5259
+ readonly responseType: MessageFns$1<ServiceUserListResponse>;
5260
+ readonly responseStream: false;
5261
+ readonly options: {};
5262
+ };
5040
5263
  /** SharedVolumes */
5041
5264
  readonly sharedVolumeDelete: {
5042
5265
  readonly name: "SharedVolumeDelete";
@@ -5372,6 +5595,14 @@ declare const ModalClientDefinition: {
5372
5595
  readonly responseStream: false;
5373
5596
  readonly options: {};
5374
5597
  };
5598
+ readonly workspaceMembersList: {
5599
+ readonly name: "WorkspaceMembersList";
5600
+ readonly requestType: MessageFns$2<Empty>;
5601
+ readonly requestStream: false;
5602
+ readonly responseType: MessageFns$1<WorkspaceMembersListResponse>;
5603
+ readonly responseStream: false;
5604
+ readonly options: {};
5605
+ };
5375
5606
  readonly workspaceNameLookup: {
5376
5607
  readonly name: "WorkspaceNameLookup";
5377
5608
  readonly requestType: MessageFns$2<Empty>;
@@ -5583,8 +5814,8 @@ declare class Function_ {
5583
5814
  getCurrentStats(): Promise<FunctionStats>;
5584
5815
  updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<void>;
5585
5816
  /**
5586
- * URL of a Function running as a web endpoint.
5587
- * @returns The web URL if this Function is a web endpoint, otherwise undefined
5817
+ * URL for addressing the Web Function via HTTP.
5818
+ * @returns The web URL, or undefined if this is not a Web Function
5588
5819
  */
5589
5820
  getWebUrl(): Promise<string | undefined>;
5590
5821
  }
@@ -6147,12 +6378,53 @@ declare const TaskMountDirectoryRequest: MessageFns<TaskMountDirectoryRequest>;
6147
6378
  interface TaskSnapshotDirectoryRequest {
6148
6379
  taskId: string;
6149
6380
  path: Uint8Array;
6381
+ /** A unique ID to ensure idempotency of directory snapshot requests. */
6382
+ snapshotId: string;
6383
+ /**
6384
+ * Lifetime for the resulting image, in seconds. When set, the
6385
+ * image's expires_at is a hard cutoff: it is fixed at creation time
6386
+ * and is not extended on use.
6387
+ *
6388
+ * When unset, the resulting image gets the legacy retention policy:
6389
+ * a 30-day TTL that is bumped forward by 30 days on every use, so
6390
+ * active images effectively never expire.
6391
+ *
6392
+ * Sentinel: -1 means "no expiry" (the image never expires).
6393
+ * 0 and other negative values are invalid and rejected by the
6394
+ * server.
6395
+ */
6396
+ ttlSeconds?: number | undefined;
6150
6397
  }
6151
6398
  declare const TaskSnapshotDirectoryRequest: MessageFns<TaskSnapshotDirectoryRequest>;
6152
6399
  interface TaskSnapshotDirectoryResponse {
6153
6400
  imageId: string;
6154
6401
  }
6155
6402
  declare const TaskSnapshotDirectoryResponse: MessageFns<TaskSnapshotDirectoryResponse>;
6403
+ interface TaskSnapshotFilesystemRequest {
6404
+ taskId: string;
6405
+ /** A unique ID to ensure idempotency of filesystem snapshot requests. */
6406
+ snapshotId: string;
6407
+ /**
6408
+ * Lifetime for the resulting image, in seconds. Must be set. When positive,
6409
+ * the image expiry is a hard cutoff: it is fixed at creation time and is
6410
+ * not extended on use.
6411
+ *
6412
+ * Sentinel: -1 means "no expiry" (the image never expires).
6413
+ * 0 and other negative values are invalid and rejected by the
6414
+ * server.
6415
+ */
6416
+ ttlSeconds?: number | undefined;
6417
+ }
6418
+ declare const TaskSnapshotFilesystemRequest: MessageFns<TaskSnapshotFilesystemRequest>;
6419
+ interface TaskSnapshotFilesystemResponse {
6420
+ imageId: string;
6421
+ }
6422
+ declare const TaskSnapshotFilesystemResponse: MessageFns<TaskSnapshotFilesystemResponse>;
6423
+ interface TaskUnmountDirectoryRequest {
6424
+ taskId: string;
6425
+ path: Uint8Array;
6426
+ }
6427
+ declare const TaskUnmountDirectoryRequest: MessageFns<TaskUnmountDirectoryRequest>;
6156
6428
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
6157
6429
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
6158
6430
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -6182,6 +6454,8 @@ interface Profile {
6182
6454
  environment?: string;
6183
6455
  imageBuilderVersion?: string;
6184
6456
  logLevel?: string;
6457
+ /** Parsed from MODAL_MAX_THROTTLE_WAIT. null means unlimited. */
6458
+ maxThrottleWaitSecs?: number;
6185
6459
  }
6186
6460
 
6187
6461
  /** @ignore */
@@ -6190,13 +6464,15 @@ declare class TaskCommandRouterClientImpl {
6190
6464
  private channel;
6191
6465
  private serverClient;
6192
6466
  private taskId;
6467
+ private sandboxId;
6468
+ private isV2;
6193
6469
  private serverUrl;
6194
6470
  private jwt;
6195
6471
  private jwtExp;
6196
6472
  private jwtRefreshLock;
6197
6473
  private logger;
6198
6474
  private closed;
6199
- static tryInit(serverClient: ModalGrpcClient, taskId: string, logger: Logger, profile: Profile): Promise<TaskCommandRouterClientImpl | null>;
6475
+ static tryInit(serverClient: ModalGrpcClient, taskId: string, sandboxId: string, isV2: boolean, logger: Logger, profile: Profile): Promise<TaskCommandRouterClientImpl | null>;
6200
6476
  private constructor();
6201
6477
  close(): void;
6202
6478
  execStart(request: TaskExecStartRequest): Promise<TaskExecStartResponse>;
@@ -6206,6 +6482,8 @@ declare class TaskCommandRouterClientImpl {
6206
6482
  execWait(taskId: string, execId: string, deadline?: number | null): Promise<TaskExecWaitResponse>;
6207
6483
  mountDirectory(request: TaskMountDirectoryRequest): Promise<void>;
6208
6484
  snapshotDirectory(request: TaskSnapshotDirectoryRequest): Promise<TaskSnapshotDirectoryResponse>;
6485
+ snapshotFilesystem(request: TaskSnapshotFilesystemRequest, options?: TimeoutOptions): Promise<TaskSnapshotFilesystemResponse>;
6486
+ unmountDirectory(request: TaskUnmountDirectoryRequest): Promise<void>;
6209
6487
  private refreshJwt;
6210
6488
  private callWithAuthRetry;
6211
6489
  private streamStdio;
@@ -6228,7 +6506,7 @@ declare class SandboxFile {
6228
6506
  read(): Promise<Uint8Array>;
6229
6507
  /**
6230
6508
  * Write data to the file.
6231
- * @param data - Data to write (string or Uint8Array)
6509
+ * @param data - Data to write
6232
6510
  */
6233
6511
  write(data: Uint8Array): Promise<void>;
6234
6512
  /**
@@ -6346,8 +6624,14 @@ type SandboxCreateParams = {
6346
6624
  unencryptedPorts?: number[];
6347
6625
  /** Whether to block all network access from the Sandbox. */
6348
6626
  blockNetwork?: boolean;
6349
- /** List of CIDRs the Sandbox is allowed to access. If None, all CIDRs are allowed. Cannot be used with blockNetwork. */
6627
+ /** List of CIDRs the Sandbox is allowed to access. If not set, all CIDRs are allowed. Cannot be used with blockNetwork. */
6628
+ outboundCidrAllowlist?: string[];
6629
+ /**
6630
+ * @deprecated Use {@link outboundCidrAllowlist} instead.
6631
+ */
6350
6632
  cidrAllowlist?: string[];
6633
+ /** 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
+ inboundCidrAllowlist?: string[];
6351
6635
  /** Cloud provider to run the Sandbox on. */
6352
6636
  cloud?: string;
6353
6637
  /** Region(s) to run the Sandbox on. */
@@ -6360,6 +6644,8 @@ type SandboxCreateParams = {
6360
6644
  readinessProbe?: Probe;
6361
6645
  /** Optional name for the Sandbox. Unique within an App. */
6362
6646
  name?: string;
6647
+ /** Tags to attach to the Sandbox. Filterable via {@link SandboxService#list Sandbox.list}. */
6648
+ tags?: Record<string, string>;
6363
6649
  /** Optional experimental options. */
6364
6650
  experimentalOptions?: Record<string, any>;
6365
6651
  /** If set, connections to this Sandbox will be subdomains of this domain rather than the default.
@@ -6385,6 +6671,10 @@ declare class SandboxService {
6385
6671
  * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options.
6386
6672
  */
6387
6673
  create(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
6674
+ /**
6675
+ * Create a new {@link Sandbox} using the experimental V2 backend.
6676
+ */
6677
+ experimentalCreate(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
6388
6678
  /** Returns a running {@link Sandbox} object from an ID.
6389
6679
  *
6390
6680
  * @returns Sandbox with ID
@@ -6474,7 +6764,11 @@ declare class Sandbox {
6474
6764
  #private;
6475
6765
  readonly sandboxId: string;
6476
6766
  /** @ignore */
6477
- constructor(client: ModalClient, sandboxId: string);
6767
+ constructor(client: ModalClient, sandboxId: string, params?: {
6768
+ isV2?: boolean;
6769
+ taskId?: string;
6770
+ tunnels?: Record<number, Tunnel>;
6771
+ });
6478
6772
  get stdin(): ModalWriteStream<string>;
6479
6773
  get stdout(): ModalReadStream<string>;
6480
6774
  get stderr(): ModalReadStream<string>;
@@ -6540,7 +6834,11 @@ declare class Sandbox {
6540
6834
  *
6541
6835
  * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem.
6542
6836
  *
6543
- * @param timeoutMs - Timeout for the snapshot operation in milliseconds
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.
6840
+ *
6841
+ * @param timeoutMs - Timeout for the snapshot operation in milliseconds.
6544
6842
  * @returns Promise that resolves to an {@link Image}
6545
6843
  */
6546
6844
  snapshotFilesystem(timeoutMs?: number): Promise<Image>;
@@ -6551,9 +6849,18 @@ declare class Sandbox {
6551
6849
  * @param image - Optional {@link Image} to mount. If undefined, mounts an empty directory.
6552
6850
  */
6553
6851
  mountImage(path: string, image?: Image): Promise<void>;
6852
+ /**
6853
+ * Unmounts an {@link Image} previously mounted at a path in the Sandbox filesystem.
6854
+ *
6855
+ * @param path - The mount path to unmount
6856
+ */
6857
+ unmountImage(path: string): Promise<void>;
6554
6858
  /**
6555
6859
  * Snapshots and creates a new {@link Image} from a directory in the running sandbox.
6556
6860
  *
6861
+ * Directory snapshots are currently persisted for 30 days after they
6862
+ * were created.
6863
+ *
6557
6864
  * @param path - The path of the directory to snapshot
6558
6865
  * @returns Promise that resolves to an {@link Image}
6559
6866
  */
@@ -6587,6 +6894,7 @@ interface ModalClientParams {
6587
6894
  endpoint?: string;
6588
6895
  timeoutMs?: number;
6589
6896
  maxRetries?: number;
6897
+ maxThrottleWaitSecs?: number;
6590
6898
  logger?: Logger;
6591
6899
  logLevel?: LogLevel;
6592
6900
  /**