modal 0.6.0 → 0.6.1

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
@@ -330,6 +330,12 @@ declare enum CloudBucketMount_BucketType {
330
330
  GCP = 3,
331
331
  UNRECOGNIZED = -1
332
332
  }
333
+ declare enum CloudBucketMount_MetadataTTLType {
334
+ METADATA_TTL_TYPE_UNSPECIFIED = 0,
335
+ METADATA_TTL_TYPE_MINIMAL = 1,
336
+ METADATA_TTL_TYPE_INDEFINITE = 2,
337
+ UNRECOGNIZED = -1
338
+ }
333
339
  declare enum FileEntry_FileType {
334
340
  UNSPECIFIED = 0,
335
341
  FILE = 1,
@@ -414,6 +420,10 @@ interface AppCreateRequest {
414
420
  description: string;
415
421
  environmentName: string;
416
422
  appState: AppState;
423
+ /** Additional metadata to attach to the App */
424
+ tags: {
425
+ [key: string]: string;
426
+ };
417
427
  }
418
428
  declare const AppCreateRequest: MessageFns<AppCreateRequest>;
419
429
  interface AppCreateResponse {
@@ -477,6 +487,7 @@ interface AppGetLogsRequest {
477
487
  timeout: number;
478
488
  lastEntryId: string;
479
489
  functionId: string;
490
+ parametrizedFunctionId: string;
480
491
  inputId: string;
481
492
  taskId: string;
482
493
  functionCallId: string;
@@ -685,14 +696,6 @@ interface AutoscalerSettings {
685
696
  scaledownWindow?: number | undefined;
686
697
  }
687
698
  declare const AutoscalerSettings: MessageFns<AutoscalerSettings>;
688
- /** Used for flash autoscaling */
689
- interface AutoscalingMetrics {
690
- cpuUsagePercent: number;
691
- memoryUsagePercent: number;
692
- concurrentRequests: number;
693
- timestamp: number;
694
- }
695
- declare const AutoscalingMetrics: MessageFns<AutoscalingMetrics>;
696
699
  interface BaseImage {
697
700
  imageId: string;
698
701
  dockerTag: string;
@@ -734,6 +737,7 @@ declare const BuildFunction: MessageFns<BuildFunction>;
734
737
  interface CancelInputEvent {
735
738
  inputIds: string[];
736
739
  terminateContainers: boolean;
740
+ cancellationReason: string;
737
741
  }
738
742
  declare const CancelInputEvent: MessageFns<CancelInputEvent>;
739
743
  interface CheckpointInfo {
@@ -826,6 +830,9 @@ interface CloudBucketMount$1 {
826
830
  bucketEndpointUrl?: string | undefined;
827
831
  keyPrefix?: string | undefined;
828
832
  oidcAuthRoleArn?: string | undefined;
833
+ forcePathStyle: boolean;
834
+ metadataTtlType?: CloudBucketMount_MetadataTTLType | undefined;
835
+ metadataTtlSeconds?: number | undefined;
829
836
  }
830
837
  declare const CloudBucketMount$1: MessageFns<CloudBucketMount$1>;
831
838
  interface ClusterGetRequest {
@@ -1240,6 +1247,10 @@ interface EnvironmentListItem {
1240
1247
  default: boolean;
1241
1248
  isManaged: boolean;
1242
1249
  environmentId: string;
1250
+ maxConcurrentTasks?: number | undefined;
1251
+ maxConcurrentGpus?: number | undefined;
1252
+ currentConcurrentTasks: number;
1253
+ currentConcurrentGpus: number;
1243
1254
  }
1244
1255
  declare const EnvironmentListItem: MessageFns<EnvironmentListItem>;
1245
1256
  interface EnvironmentListResponse {
@@ -1265,6 +1276,8 @@ interface EnvironmentUpdateRequest {
1265
1276
  currentName: string;
1266
1277
  name: string | undefined;
1267
1278
  webSuffix: string | undefined;
1279
+ maxConcurrentTasks?: number | undefined;
1280
+ maxConcurrentGpus?: number | undefined;
1268
1281
  }
1269
1282
  declare const EnvironmentUpdateRequest: MessageFns<EnvironmentUpdateRequest>;
1270
1283
  /** A file entry when listing files in a volume or network file system. */
@@ -1370,6 +1383,10 @@ interface FunctionMessage {
1370
1383
  checkpoint: CheckpointInfo | undefined;
1371
1384
  objectDependencies: ObjectDependency[];
1372
1385
  blockNetwork: boolean;
1386
+ /**
1387
+ * In the SDK, we've deprecated `max_inputs` (which only every implemented `max_inputs=1`)
1388
+ * in favor of a boolean `single_use_containers` parameter.
1389
+ */
1373
1390
  maxInputs: number;
1374
1391
  s3Mounts: S3Mount[];
1375
1392
  cloudBucketMounts: CloudBucketMount$1[];
@@ -1446,6 +1463,16 @@ interface FunctionMessage {
1446
1463
  /** can be used as inputs */
1447
1464
  supportedInputFormats: DataFormat[];
1448
1465
  supportedOutputFormats: DataFormat[];
1466
+ httpConfig?: HTTPConfig | undefined;
1467
+ /**
1468
+ * Attribute on the module with the implementation, which may differ from function_name
1469
+ * when the user provided a custom name= for the Function inside the Application namespace
1470
+ */
1471
+ implementationName: string;
1472
+ /** When True, containers will shut down after handling a single input */
1473
+ singleUseContainers: boolean;
1474
+ /** When True, the function is a server function */
1475
+ isServer: boolean;
1449
1476
  }
1450
1477
  declare const FunctionMessage: MessageFns<FunctionMessage>;
1451
1478
  interface FunctionAsyncInvokeRequest {
@@ -1501,6 +1528,7 @@ interface FunctionCallGetDataRequest {
1501
1528
  functionCallId?: string | undefined;
1502
1529
  attemptToken?: string | undefined;
1503
1530
  lastIndex: number;
1531
+ useGaplessRead: boolean;
1504
1532
  }
1505
1533
  declare const FunctionCallGetDataRequest: MessageFns<FunctionCallGetDataRequest>;
1506
1534
  interface FunctionCallInfo {
@@ -1629,6 +1657,14 @@ interface FunctionData {
1629
1657
  startupTimeoutSecs: number;
1630
1658
  supportedInputFormats: DataFormat[];
1631
1659
  supportedOutputFormats: DataFormat[];
1660
+ httpConfig?: HTTPConfig | undefined;
1661
+ /**
1662
+ * Attribute on the module with the implementation, which may differ from function_name
1663
+ * when the user provided a custom name= for the Function inside the Application namespace
1664
+ */
1665
+ implementationName: string;
1666
+ /** When True, the function is a server function */
1667
+ isServer: boolean;
1632
1668
  }
1633
1669
  declare const FunctionData: MessageFns<FunctionData>;
1634
1670
  interface FunctionData_RankedFunction {
@@ -1986,6 +2022,15 @@ interface GenericResult {
1986
2022
  propagationReason: string;
1987
2023
  }
1988
2024
  declare const GenericResult: MessageFns<GenericResult>;
2025
+ interface HTTPConfig {
2026
+ port: number;
2027
+ proxyRegions: string[];
2028
+ startupTimeout: number;
2029
+ exitGracePeriod: number;
2030
+ h2Enabled: boolean;
2031
+ targetConcurrency: number;
2032
+ }
2033
+ declare const HTTPConfig: MessageFns<HTTPConfig>;
1989
2034
  interface Image$1 {
1990
2035
  baseImages: BaseImage[];
1991
2036
  dockerfileCommands: string[];
@@ -2366,8 +2411,9 @@ interface Proxy$1 {
2366
2411
  name: string;
2367
2412
  createdAt: number;
2368
2413
  environmentName: string;
2369
- proxyId: string;
2370
2414
  proxyIps: ProxyIp[];
2415
+ proxyId: string;
2416
+ region: string;
2371
2417
  }
2372
2418
  declare const Proxy$1: MessageFns<Proxy$1>;
2373
2419
  interface ProxyAddIpRequest {
@@ -2381,6 +2427,7 @@ declare const ProxyAddIpResponse: MessageFns<ProxyAddIpResponse>;
2381
2427
  interface ProxyCreateRequest {
2382
2428
  name: string;
2383
2429
  environmentName: string;
2430
+ region: string;
2384
2431
  }
2385
2432
  declare const ProxyCreateRequest: MessageFns<ProxyCreateRequest>;
2386
2433
  interface ProxyCreateResponse {
@@ -2528,6 +2575,25 @@ interface RateLimit {
2528
2575
  interval: RateLimitInterval;
2529
2576
  }
2530
2577
  declare const RateLimit: MessageFns<RateLimit>;
2578
+ interface ResourceInfo {
2579
+ /** MiB */
2580
+ memoryMb: ResourceInfo_ResourceValue | undefined;
2581
+ /** milli CPU cores */
2582
+ milliCpu: ResourceInfo_ResourceValue | undefined;
2583
+ gpuType: string;
2584
+ /** MiB */
2585
+ memoryMbMax: number;
2586
+ /** MiB */
2587
+ ephemeralDiskMb: number;
2588
+ /** milli CPU cores */
2589
+ milliCpuMax: number;
2590
+ }
2591
+ declare const ResourceInfo: MessageFns<ResourceInfo>;
2592
+ interface ResourceInfo_ResourceValue {
2593
+ value: number;
2594
+ isDefault: boolean;
2595
+ }
2596
+ declare const ResourceInfo_ResourceValue: MessageFns<ResourceInfo_ResourceValue>;
2531
2597
  interface Resources {
2532
2598
  /** MiB */
2533
2599
  memoryMb: number;
@@ -2639,6 +2705,14 @@ interface Sandbox$1 {
2639
2705
  * command router running on the Modal worker.
2640
2706
  */
2641
2707
  directSandboxCommandsEnabled: boolean;
2708
+ /**
2709
+ * Internal: restricts sandbox to run on this specific instance type.
2710
+ * Set by server during SandboxRestore to ensure the restored sandbox runs
2711
+ * on the same instance type as the original snapshot.
2712
+ */
2713
+ RestoreInstanceType: string;
2714
+ /** If set, connections to this sandbox will be subdomains of this domain rather than the default. */
2715
+ customDomain: string;
2642
2716
  }
2643
2717
  declare const Sandbox$1: MessageFns<Sandbox$1>;
2644
2718
  interface SandboxCreateConnectTokenRequest {
@@ -2662,22 +2736,6 @@ interface SandboxCreateResponse {
2662
2736
  sandboxId: string;
2663
2737
  }
2664
2738
  declare const SandboxCreateResponse: MessageFns<SandboxCreateResponse>;
2665
- /**
2666
- * Used to get a JWT and URL for direct access to a sandbox router server
2667
- * running on the modal-worker, so the client can issue exec commands (and other
2668
- * operations as they become available) directly to the worker.
2669
- * DEPRECATED: Use TaskGetCommandRouterAccessRequest instead.
2670
- * TODO(saltzm): Remove this.
2671
- */
2672
- interface SandboxGetCommandRouterAccessRequest {
2673
- sandboxId: string;
2674
- }
2675
- declare const SandboxGetCommandRouterAccessRequest: MessageFns<SandboxGetCommandRouterAccessRequest>;
2676
- interface SandboxGetCommandRouterAccessResponse {
2677
- jwt: string;
2678
- url: string;
2679
- }
2680
- declare const SandboxGetCommandRouterAccessResponse: MessageFns<SandboxGetCommandRouterAccessResponse>;
2681
2739
  interface SandboxGetFromNameRequest {
2682
2740
  sandboxName: string;
2683
2741
  environmentName: string;
@@ -2743,6 +2801,11 @@ interface SandboxInfo {
2743
2801
  /** TODO: Not yet exposed in client library. */
2744
2802
  tags: SandboxTag[];
2745
2803
  name: string;
2804
+ imageId: string;
2805
+ resourceInfo: ResourceInfo | undefined;
2806
+ regions: string[];
2807
+ timeoutSecs: number;
2808
+ idleTimeoutSecs?: number | undefined;
2746
2809
  }
2747
2810
  declare const SandboxInfo: MessageFns<SandboxInfo>;
2748
2811
  interface SandboxListRequest {
@@ -2883,20 +2946,17 @@ interface Schedule_Period {
2883
2946
  seconds: number;
2884
2947
  }
2885
2948
  declare const Schedule_Period: MessageFns<Schedule_Period>;
2886
- /**
2887
- * TODO(irfansharif):
2888
- * - Fold in cloud, resource needs here too.
2889
- * - Allow specifying list of zones, cloud, fallback and alternative
2890
- * GPU types.
2891
- */
2949
+ /** Scheduling constraints for Functions and Sandboxes. */
2892
2950
  interface SchedulerPlacement {
2893
2951
  regions: string[];
2894
- /** TODO(irfansharif): Make these two repeated. */
2952
+ /** @deprecated */
2895
2953
  Zone?: string | undefined;
2896
- /** admin-only, "on-demand" or "spot", else ignored */
2954
+ /** @deprecated */
2897
2955
  Lifecycle?: string | undefined;
2898
- /** admin-only */
2956
+ /** @deprecated */
2899
2957
  InstanceTypes: string[];
2958
+ /** Functions only */
2959
+ nonpreemptible: boolean;
2900
2960
  }
2901
2961
  declare const SchedulerPlacement: MessageFns<SchedulerPlacement>;
2902
2962
  interface SecretDeleteRequest {
@@ -2947,6 +3007,12 @@ interface SecretMetadata {
2947
3007
  creationInfo: CreationInfo | undefined;
2948
3008
  }
2949
3009
  declare const SecretMetadata: MessageFns<SecretMetadata>;
3010
+ interface ServiceUserIdentity {
3011
+ serviceUserId: string;
3012
+ serviceUserName: string;
3013
+ createdBy: UserIdentity | undefined;
3014
+ }
3015
+ declare const ServiceUserIdentity: MessageFns<ServiceUserIdentity>;
2950
3016
  interface SharedVolumeDeleteRequest {
2951
3017
  sharedVolumeId: string;
2952
3018
  }
@@ -3051,14 +3117,6 @@ interface TaskCurrentInputsResponse {
3051
3117
  inputIds: string[];
3052
3118
  }
3053
3119
  declare const TaskCurrentInputsResponse: MessageFns<TaskCurrentInputsResponse>;
3054
- interface TaskGetAutoscalingMetricsRequest {
3055
- taskId: string;
3056
- }
3057
- declare const TaskGetAutoscalingMetricsRequest: MessageFns<TaskGetAutoscalingMetricsRequest>;
3058
- interface TaskGetAutoscalingMetricsResponse {
3059
- metrics: AutoscalingMetrics | undefined;
3060
- }
3061
- declare const TaskGetAutoscalingMetricsResponse: MessageFns<TaskGetAutoscalingMetricsResponse>;
3062
3120
  /**
3063
3121
  * Used to get a JWT and URL for direct access to a task command router
3064
3122
  * running on the modal-worker, so the client can issue exec commands (and other
@@ -3176,6 +3234,20 @@ interface TokenFlowWaitResponse {
3176
3234
  workspaceUsername: string;
3177
3235
  }
3178
3236
  declare const TokenFlowWaitResponse: MessageFns<TokenFlowWaitResponse>;
3237
+ interface TokenInfoGetRequest {
3238
+ }
3239
+ declare const TokenInfoGetRequest: MessageFns<TokenInfoGetRequest>;
3240
+ interface TokenInfoGetResponse {
3241
+ tokenId: string;
3242
+ workspaceId: string;
3243
+ workspaceName: string;
3244
+ userIdentity?: UserIdentity | undefined;
3245
+ serviceUserIdentity?: ServiceUserIdentity | undefined;
3246
+ /** Token metadata */
3247
+ createdAt: Date | undefined;
3248
+ expiresAt: Date | undefined;
3249
+ }
3250
+ declare const TokenInfoGetResponse: MessageFns<TokenInfoGetResponse>;
3179
3251
  interface TunnelData {
3180
3252
  host: string;
3181
3253
  port: number;
@@ -3209,6 +3281,11 @@ interface UploadUrlList {
3209
3281
  items: string[];
3210
3282
  }
3211
3283
  declare const UploadUrlList: MessageFns<UploadUrlList>;
3284
+ interface UserIdentity {
3285
+ userId: string;
3286
+ username: string;
3287
+ }
3288
+ declare const UserIdentity: MessageFns<UserIdentity>;
3212
3289
  interface VolumeCommitRequest {
3213
3290
  /**
3214
3291
  * NOTE(staffan): Mounting a volume in multiple locations is not supported, so volume_id alone uniquely identifies
@@ -3475,6 +3552,7 @@ declare const WebUrlInfo: MessageFns<WebUrlInfo>;
3475
3552
  interface WebhookConfig {
3476
3553
  type: WebhookType;
3477
3554
  method: string;
3555
+ /** User-supplied "label" component of URL */
3478
3556
  requestedSuffix: string;
3479
3557
  asyncMode: WebhookAsyncMode;
3480
3558
  customDomains: CustomDomainConfig[];
@@ -3482,6 +3560,8 @@ interface WebhookConfig {
3482
3560
  webServerStartupTimeout: number;
3483
3561
  webEndpointDocs: boolean;
3484
3562
  requiresProxyAuth: boolean;
3563
+ /** Additional URL suffix added for ephemeral Apps */
3564
+ ephemeralSuffix: string;
3485
3565
  }
3486
3566
  declare const WebhookConfig: MessageFns<WebhookConfig>;
3487
3567
  interface WorkspaceBillingReportItem {
@@ -4467,14 +4547,6 @@ declare const ModalClientDefinition: {
4467
4547
  readonly responseStream: false;
4468
4548
  readonly options: {};
4469
4549
  };
4470
- readonly sandboxGetCommandRouterAccess: {
4471
- readonly name: "SandboxGetCommandRouterAccess";
4472
- readonly requestType: MessageFns<SandboxGetCommandRouterAccessRequest>;
4473
- readonly requestStream: false;
4474
- readonly responseType: MessageFns<SandboxGetCommandRouterAccessResponse>;
4475
- readonly responseStream: false;
4476
- readonly options: {};
4477
- };
4478
4550
  readonly sandboxGetFromName: {
4479
4551
  readonly name: "SandboxGetFromName";
4480
4552
  readonly requestType: MessageFns<SandboxGetFromNameRequest>;
@@ -4735,15 +4807,6 @@ declare const ModalClientDefinition: {
4735
4807
  readonly responseStream: false;
4736
4808
  readonly options: {};
4737
4809
  };
4738
- /** Used for flash autoscaling */
4739
- readonly taskGetAutoscalingMetrics: {
4740
- readonly name: "TaskGetAutoscalingMetrics";
4741
- readonly requestType: MessageFns<TaskGetAutoscalingMetricsRequest>;
4742
- readonly requestStream: false;
4743
- readonly responseType: MessageFns<TaskGetAutoscalingMetricsResponse>;
4744
- readonly responseStream: false;
4745
- readonly options: {};
4746
- };
4747
4810
  readonly taskGetCommandRouterAccess: {
4748
4811
  readonly name: "TaskGetCommandRouterAccess";
4749
4812
  readonly requestType: MessageFns<TaskGetCommandRouterAccessRequest>;
@@ -4785,6 +4848,14 @@ declare const ModalClientDefinition: {
4785
4848
  readonly responseStream: false;
4786
4849
  readonly options: {};
4787
4850
  };
4851
+ readonly tokenInfoGet: {
4852
+ readonly name: "TokenInfoGet";
4853
+ readonly requestType: MessageFns<TokenInfoGetRequest>;
4854
+ readonly requestStream: false;
4855
+ readonly responseType: MessageFns<TokenInfoGetResponse>;
4856
+ readonly responseStream: false;
4857
+ readonly options: {};
4858
+ };
4788
4859
  /** Tunnels */
4789
4860
  readonly tunnelStart: {
4790
4861
  readonly name: "TunnelStart";
@@ -5369,7 +5440,14 @@ declare class ImageService {
5369
5440
  */
5370
5441
  fromGcpArtifactRegistry(tag: string, secret: Secret): Image;
5371
5442
  /**
5372
- * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone.
5443
+ * Delete an {@link Image} by ID.
5444
+ *
5445
+ * Deletion is irreversible and will prevent Functions/Sandboxes from using the Image.
5446
+ *
5447
+ * Note: When building an Image, each chained method call will create an
5448
+ * intermediate Image layer, each with its own ID. Deleting an Image will not
5449
+ * delete any of its intermediate layers, only the image identified by the
5450
+ * provided ID.
5373
5451
  */
5374
5452
  delete(imageId: string, _?: ImageDeleteParams): Promise<void>;
5375
5453
  }
@@ -5755,6 +5833,10 @@ type SandboxCreateParams = {
5755
5833
  name?: string;
5756
5834
  /** Optional experimental options. */
5757
5835
  experimentalOptions?: Record<string, any>;
5836
+ /** If set, connections to this Sandbox will be subdomains of this domain rather than the default.
5837
+ * This requires prior manual setup by Modal and is only available for Enterprise customers.
5838
+ */
5839
+ customDomain?: string;
5758
5840
  };
5759
5841
  /**
5760
5842
  * Service for managing {@link Sandbox}es.