modal 0.11.1-dev.6 → 0.11.1-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -211,12 +211,17 @@ declare enum EnvironmentRole {
211
211
  }
212
212
  /**
213
213
  * Creation-time environment classification. Captures whether an environment
214
- * is public. is_managed and machine_generated may be folded in as future
215
- * values.
214
+ * is public or administered by Modal. is_managed and machine_generated may be
215
+ * folded in as future values.
216
216
  */
217
217
  declare enum EnvironmentType {
218
218
  ENVIRONMENT_TYPE_UNSPECIFIED = 0,
219
219
  ENVIRONMENT_TYPE_PUBLIC = 1,
220
+ /**
221
+ * ENVIRONMENT_TYPE_MODAL_ADMINISTERED - Restricted environment whose roles are administered by Modal admins rather
222
+ * than the workspace's own managers.
223
+ */
224
+ ENVIRONMENT_TYPE_MODAL_ADMINISTERED = 2,
220
225
  UNRECOGNIZED = -1
221
226
  }
222
227
  declare enum ExecOutputOption {
@@ -1207,6 +1212,41 @@ interface ClusterListResponse {
1207
1212
  clusters: ClusterStats[];
1208
1213
  }
1209
1214
  declare const ClusterListResponse: MessageFns$1<ClusterListResponse>;
1215
+ interface ClusterReservation {
1216
+ /** reservation name, as configured by Modal */
1217
+ name: string;
1218
+ /** e.g. "B300" */
1219
+ gpuType: string;
1220
+ region: string;
1221
+ /** workers Modal has committed to keep reserved */
1222
+ minReservedWorkers: number;
1223
+ /** healthy reserved workers currently present (active + idle) */
1224
+ reservedWorkers: number;
1225
+ /** reserved workers running this workspace's containers */
1226
+ activeWorkers: number;
1227
+ /** reserved workers available for new clusters */
1228
+ idleWorkers: number;
1229
+ /** max(0, min_reserved_workers - reserved_workers) */
1230
+ unfulfilledWorkers: number;
1231
+ /** containers on reserved workers, ordered by cluster then rank */
1232
+ tasks: ClusterReservation_Task[];
1233
+ }
1234
+ declare const ClusterReservation: MessageFns$1<ClusterReservation>;
1235
+ /** A container running on a worker reserved for this reservation. */
1236
+ interface ClusterReservation_Task {
1237
+ taskId: string;
1238
+ clusterRank: number;
1239
+ appId: string;
1240
+ functionId: string;
1241
+ }
1242
+ declare const ClusterReservation_Task: MessageFns$1<ClusterReservation_Task>;
1243
+ interface ClusterReservationListRequest {
1244
+ }
1245
+ declare const ClusterReservationListRequest: MessageFns$1<ClusterReservationListRequest>;
1246
+ interface ClusterReservationListResponse {
1247
+ reservations: ClusterReservation[];
1248
+ }
1249
+ declare const ClusterReservationListResponse: MessageFns$1<ClusterReservationListResponse>;
1210
1250
  interface ClusterStats {
1211
1251
  appId: string;
1212
1252
  taskIds: string[];
@@ -1632,12 +1672,16 @@ interface EndpointCreateRequest {
1632
1672
  unauthenticated: boolean;
1633
1673
  servingMode: EndpointServingMode;
1634
1674
  sharedEndpointNoticeAcknowledged: boolean;
1675
+ /** Requires Modal admin access. Dedicated endpoints only; must match model. */
1676
+ recipeId?: string | undefined;
1635
1677
  }
1636
1678
  declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
1637
1679
  interface EndpointCreateResponse {
1638
1680
  endpointId: string;
1639
1681
  endpointPageUrl: string;
1640
1682
  name: string;
1683
+ /** Model name to send in requests to the endpoint. */
1684
+ modelName: string;
1641
1685
  }
1642
1686
  declare const EndpointCreateResponse: MessageFns$1<EndpointCreateResponse>;
1643
1687
  interface EndpointCustomModelSource {
@@ -1677,6 +1721,8 @@ interface EndpointGetInfoResponse_EndpointInfoSummary {
1677
1721
  /** set only when the model is served from a modal volume */
1678
1722
  volumeId: string;
1679
1723
  modelPath: string;
1724
+ /** Model name to send in requests to the endpoint. */
1725
+ modelName: string;
1680
1726
  }
1681
1727
  declare const EndpointGetInfoResponse_EndpointInfoSummary: MessageFns$1<EndpointGetInfoResponse_EndpointInfoSummary>;
1682
1728
  interface EndpointGetInfoResponse_EndpointHandleMetadata {
@@ -2556,7 +2602,7 @@ interface FunctionGetTimeRangeStatsResponse {
2556
2602
  * as requirements evolve
2557
2603
  */
2558
2604
  inputPercentileStats: {
2559
- [key: string]: StatsPercentileDistribution;
2605
+ [key: string]: StatsPercentileDistribution$1;
2560
2606
  };
2561
2607
  /**
2562
2608
  * Container lifecycle counts. Started and errored containers are counted when
@@ -2571,7 +2617,7 @@ interface FunctionGetTimeRangeStatsResponse {
2571
2617
  * as requirements evolve
2572
2618
  */
2573
2619
  containerPercentileStats: {
2574
- [key: string]: StatsPercentileDistribution;
2620
+ [key: string]: StatsPercentileDistribution$1;
2575
2621
  };
2576
2622
  /**
2577
2623
  * Number of direct non-version-pinned variants included in the roll-up.
@@ -2782,13 +2828,13 @@ interface FunctionSchema {
2782
2828
  returnType: GenericPayloadType | undefined;
2783
2829
  }
2784
2830
  declare const FunctionSchema: MessageFns$1<FunctionSchema>;
2785
- interface FunctionStats {
2831
+ interface FunctionStats$1 {
2786
2832
  backlog: number;
2787
2833
  numTotalTasks: number;
2788
2834
  numRunningInputs: number;
2789
2835
  inputHeadroom: number;
2790
2836
  }
2791
- declare const FunctionStats: MessageFns$1<FunctionStats>;
2837
+ declare const FunctionStats$1: MessageFns$1<FunctionStats$1>;
2792
2838
  interface FunctionUpdateSchedulingParamsRequest {
2793
2839
  functionId: string;
2794
2840
  warmPoolSizeOverride: number;
@@ -3865,6 +3911,11 @@ interface SandboxGetFromNameRequest {
3865
3911
  sandboxName: string;
3866
3912
  environmentName: string;
3867
3913
  appName: string;
3914
+ /**
3915
+ * When set, the lookup also considers sandboxes that have already stopped and
3916
+ * returns the most recently created sandbox with the given name.
3917
+ */
3918
+ includeTerminated: boolean;
3868
3919
  }
3869
3920
  declare const SandboxGetFromNameRequest: MessageFns$1<SandboxGetFromNameRequest>;
3870
3921
  interface SandboxGetFromNameResponse {
@@ -4230,14 +4281,14 @@ interface ServerGetTimeRangeStatsResponse {
4230
4281
  requestRatePerSecond: number;
4231
4282
  /** Metrics include request_latency, subject to change as requirements evolve. */
4232
4283
  requestPercentileStats: {
4233
- [key: string]: StatsPercentileDistribution;
4284
+ [key: string]: StatsPercentileDistribution$1;
4234
4285
  };
4235
4286
  /**
4236
4287
  * Metrics include startup_time, cpu_usage, memory_usage, and
4237
4288
  * gpu_utilization, subject to change as requirements evolve.
4238
4289
  */
4239
4290
  containerPercentileStats: {
4240
- [key: string]: StatsPercentileDistribution;
4291
+ [key: string]: StatsPercentileDistribution$1;
4241
4292
  };
4242
4293
  /** Absent when the image does not contain a supported inference engine. */
4243
4294
  inference: ServerGetTimeRangeStatsResponse_ServerInferenceStats | undefined;
@@ -4261,7 +4312,7 @@ interface ServerGetTimeRangeStatsResponse_ServerInferenceStats {
4261
4312
  * end_to_end_latency, subject to change as requirements evolve.
4262
4313
  */
4263
4314
  percentileStats: {
4264
- [key: string]: StatsPercentileDistribution;
4315
+ [key: string]: StatsPercentileDistribution$1;
4265
4316
  };
4266
4317
  /**
4267
4318
  * Metrics include input_tokens_per_second, cached_input_tokens_per_second,
@@ -4402,18 +4453,18 @@ interface SharedVolumeRemoveFileRequest {
4402
4453
  recursive: boolean;
4403
4454
  }
4404
4455
  declare const SharedVolumeRemoveFileRequest: MessageFns$1<SharedVolumeRemoveFileRequest>;
4405
- interface StatsPercentile {
4456
+ interface StatsPercentile$1 {
4406
4457
  /** The percentile expressed in basis points: 5000 is p50 and 9990 is p99.9. */
4407
4458
  percentileBasisPoints: number;
4408
4459
  value: number;
4409
4460
  }
4410
- declare const StatsPercentile: MessageFns$1<StatsPercentile>;
4411
- interface StatsPercentileDistribution {
4461
+ declare const StatsPercentile$1: MessageFns$1<StatsPercentile$1>;
4462
+ interface StatsPercentileDistribution$1 {
4412
4463
  /** Unit identifier such as "seconds", "cores", "gibibytes", or "fraction". */
4413
4464
  unit: string;
4414
- percentiles: StatsPercentile[];
4465
+ percentiles: StatsPercentile$1[];
4415
4466
  }
4416
- declare const StatsPercentileDistribution: MessageFns$1<StatsPercentileDistribution>;
4467
+ declare const StatsPercentileDistribution$1: MessageFns$1<StatsPercentileDistribution$1>;
4417
4468
  interface StringMap {
4418
4469
  contents: {
4419
4470
  [key: string]: string;
@@ -5438,6 +5489,14 @@ declare const ModalClientDefinition: {
5438
5489
  readonly responseStream: false;
5439
5490
  readonly options: {};
5440
5491
  };
5492
+ readonly clusterReservationList: {
5493
+ readonly name: "ClusterReservationList";
5494
+ readonly requestType: MessageFns$1<ClusterReservationListRequest>;
5495
+ readonly requestStream: false;
5496
+ readonly responseType: MessageFns$1<ClusterReservationListResponse>;
5497
+ readonly responseStream: false;
5498
+ readonly options: {};
5499
+ };
5441
5500
  /** Container */
5442
5501
  readonly containerCheckpoint: {
5443
5502
  readonly name: "ContainerCheckpoint";
@@ -5987,7 +6046,7 @@ declare const ModalClientDefinition: {
5987
6046
  readonly name: "FunctionGetCurrentStats";
5988
6047
  readonly requestType: MessageFns$1<FunctionGetCurrentStatsRequest>;
5989
6048
  readonly requestStream: false;
5990
- readonly responseType: MessageFns$1<FunctionStats>;
6049
+ readonly responseType: MessageFns$1<FunctionStats$1>;
5991
6050
  readonly responseStream: false;
5992
6051
  readonly options: {};
5993
6052
  };
@@ -7828,6 +7887,39 @@ interface FunctionCurrentStats {
7828
7887
  backlog: number;
7829
7888
  numTotalRunners: number;
7830
7889
  }
7890
+ interface StatsPercentile {
7891
+ percentile: number;
7892
+ value: number;
7893
+ }
7894
+ interface StatsPercentileDistribution {
7895
+ unit: string;
7896
+ percentiles: StatsPercentile[];
7897
+ }
7898
+ interface FunctionStats {
7899
+ since: Date;
7900
+ until: Date;
7901
+ inputSuccessCount: number;
7902
+ inputFailureCount: number;
7903
+ inputTimeoutCount: number;
7904
+ inputRunningAtEndCount: number;
7905
+ containerStartedCount: number;
7906
+ containerErrorCount: number;
7907
+ containerCreatingAtEndCount: number;
7908
+ variantCount: number;
7909
+ inputPercentileStats: Record<string, StatsPercentileDistribution>;
7910
+ containerPercentileStats: Record<string, StatsPercentileDistribution>;
7911
+ allVariants: boolean;
7912
+ }
7913
+ interface FunctionStatsParams {
7914
+ /** Inclusive start; defaults to one hour before until. */
7915
+ since?: Date;
7916
+ /** Exclusive end; defaults to the current time. */
7917
+ until?: Date;
7918
+ /** Restrict statistics to this container ID. */
7919
+ container?: string;
7920
+ /** Aggregate the base Function and its variants. Defaults to false. */
7921
+ allVariants?: boolean;
7922
+ }
7831
7923
  /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
7832
7924
  interface FunctionUpdateAutoscalerParams {
7833
7925
  minContainers?: number;
@@ -7906,6 +7998,29 @@ declare class Function_ {
7906
7998
  instance(): Promise<Function_>;
7907
7999
  remote(args?: any[], kwargs?: Record<string, any>): Promise<any>;
7908
8000
  spawn(args?: any[], kwargs?: Record<string, any>): Promise<FunctionCall>;
8001
+ /**
8002
+ * Return historical statistics. Defaults to the last hour; the maximum range is 7 days.
8003
+ *
8004
+ * @example Read statistics for the last hour.
8005
+ * ```ts
8006
+ * const fn = await modal.functions.fromName("libmodal-test-support", "echo_string");
8007
+ * const stats = await fn.stats();
8008
+ * console.log(stats.inputSuccessCount, stats.inputFailureCount);
8009
+ * ```
8010
+ *
8011
+ * @example Include all variants over the last 24 hours.
8012
+ * ```ts
8013
+ * const until = new Date();
8014
+ * const since = new Date(until.getTime() - 24 * 60 * 60 * 1000);
8015
+ * const variantStats = await fn.stats({ since, until, allVariants: true });
8016
+ * for (const [metric, distribution] of Object.entries(variantStats.inputPercentileStats)) {
8017
+ * console.log(metric, distribution.unit, distribution.percentiles);
8018
+ * }
8019
+ * ```
8020
+ *
8021
+ * Set `container` to a container ID to restrict statistics to that container.
8022
+ */
8023
+ stats(params?: FunctionStatsParams): Promise<FunctionStats>;
7909
8024
  getCurrentStats(): Promise<FunctionCurrentStats>;
7910
8025
  updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<FunctionAutoscalerSettings>;
7911
8026
  /**
@@ -10208,4 +10323,4 @@ declare class ClientClosedError extends Error {
10208
10323
 
10209
10324
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10210
10325
 
10211
- export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
10326
+ export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
package/dist/index.d.ts CHANGED
@@ -211,12 +211,17 @@ declare enum EnvironmentRole {
211
211
  }
212
212
  /**
213
213
  * Creation-time environment classification. Captures whether an environment
214
- * is public. is_managed and machine_generated may be folded in as future
215
- * values.
214
+ * is public or administered by Modal. is_managed and machine_generated may be
215
+ * folded in as future values.
216
216
  */
217
217
  declare enum EnvironmentType {
218
218
  ENVIRONMENT_TYPE_UNSPECIFIED = 0,
219
219
  ENVIRONMENT_TYPE_PUBLIC = 1,
220
+ /**
221
+ * ENVIRONMENT_TYPE_MODAL_ADMINISTERED - Restricted environment whose roles are administered by Modal admins rather
222
+ * than the workspace's own managers.
223
+ */
224
+ ENVIRONMENT_TYPE_MODAL_ADMINISTERED = 2,
220
225
  UNRECOGNIZED = -1
221
226
  }
222
227
  declare enum ExecOutputOption {
@@ -1207,6 +1212,41 @@ interface ClusterListResponse {
1207
1212
  clusters: ClusterStats[];
1208
1213
  }
1209
1214
  declare const ClusterListResponse: MessageFns$1<ClusterListResponse>;
1215
+ interface ClusterReservation {
1216
+ /** reservation name, as configured by Modal */
1217
+ name: string;
1218
+ /** e.g. "B300" */
1219
+ gpuType: string;
1220
+ region: string;
1221
+ /** workers Modal has committed to keep reserved */
1222
+ minReservedWorkers: number;
1223
+ /** healthy reserved workers currently present (active + idle) */
1224
+ reservedWorkers: number;
1225
+ /** reserved workers running this workspace's containers */
1226
+ activeWorkers: number;
1227
+ /** reserved workers available for new clusters */
1228
+ idleWorkers: number;
1229
+ /** max(0, min_reserved_workers - reserved_workers) */
1230
+ unfulfilledWorkers: number;
1231
+ /** containers on reserved workers, ordered by cluster then rank */
1232
+ tasks: ClusterReservation_Task[];
1233
+ }
1234
+ declare const ClusterReservation: MessageFns$1<ClusterReservation>;
1235
+ /** A container running on a worker reserved for this reservation. */
1236
+ interface ClusterReservation_Task {
1237
+ taskId: string;
1238
+ clusterRank: number;
1239
+ appId: string;
1240
+ functionId: string;
1241
+ }
1242
+ declare const ClusterReservation_Task: MessageFns$1<ClusterReservation_Task>;
1243
+ interface ClusterReservationListRequest {
1244
+ }
1245
+ declare const ClusterReservationListRequest: MessageFns$1<ClusterReservationListRequest>;
1246
+ interface ClusterReservationListResponse {
1247
+ reservations: ClusterReservation[];
1248
+ }
1249
+ declare const ClusterReservationListResponse: MessageFns$1<ClusterReservationListResponse>;
1210
1250
  interface ClusterStats {
1211
1251
  appId: string;
1212
1252
  taskIds: string[];
@@ -1632,12 +1672,16 @@ interface EndpointCreateRequest {
1632
1672
  unauthenticated: boolean;
1633
1673
  servingMode: EndpointServingMode;
1634
1674
  sharedEndpointNoticeAcknowledged: boolean;
1675
+ /** Requires Modal admin access. Dedicated endpoints only; must match model. */
1676
+ recipeId?: string | undefined;
1635
1677
  }
1636
1678
  declare const EndpointCreateRequest: MessageFns$1<EndpointCreateRequest>;
1637
1679
  interface EndpointCreateResponse {
1638
1680
  endpointId: string;
1639
1681
  endpointPageUrl: string;
1640
1682
  name: string;
1683
+ /** Model name to send in requests to the endpoint. */
1684
+ modelName: string;
1641
1685
  }
1642
1686
  declare const EndpointCreateResponse: MessageFns$1<EndpointCreateResponse>;
1643
1687
  interface EndpointCustomModelSource {
@@ -1677,6 +1721,8 @@ interface EndpointGetInfoResponse_EndpointInfoSummary {
1677
1721
  /** set only when the model is served from a modal volume */
1678
1722
  volumeId: string;
1679
1723
  modelPath: string;
1724
+ /** Model name to send in requests to the endpoint. */
1725
+ modelName: string;
1680
1726
  }
1681
1727
  declare const EndpointGetInfoResponse_EndpointInfoSummary: MessageFns$1<EndpointGetInfoResponse_EndpointInfoSummary>;
1682
1728
  interface EndpointGetInfoResponse_EndpointHandleMetadata {
@@ -2556,7 +2602,7 @@ interface FunctionGetTimeRangeStatsResponse {
2556
2602
  * as requirements evolve
2557
2603
  */
2558
2604
  inputPercentileStats: {
2559
- [key: string]: StatsPercentileDistribution;
2605
+ [key: string]: StatsPercentileDistribution$1;
2560
2606
  };
2561
2607
  /**
2562
2608
  * Container lifecycle counts. Started and errored containers are counted when
@@ -2571,7 +2617,7 @@ interface FunctionGetTimeRangeStatsResponse {
2571
2617
  * as requirements evolve
2572
2618
  */
2573
2619
  containerPercentileStats: {
2574
- [key: string]: StatsPercentileDistribution;
2620
+ [key: string]: StatsPercentileDistribution$1;
2575
2621
  };
2576
2622
  /**
2577
2623
  * Number of direct non-version-pinned variants included in the roll-up.
@@ -2782,13 +2828,13 @@ interface FunctionSchema {
2782
2828
  returnType: GenericPayloadType | undefined;
2783
2829
  }
2784
2830
  declare const FunctionSchema: MessageFns$1<FunctionSchema>;
2785
- interface FunctionStats {
2831
+ interface FunctionStats$1 {
2786
2832
  backlog: number;
2787
2833
  numTotalTasks: number;
2788
2834
  numRunningInputs: number;
2789
2835
  inputHeadroom: number;
2790
2836
  }
2791
- declare const FunctionStats: MessageFns$1<FunctionStats>;
2837
+ declare const FunctionStats$1: MessageFns$1<FunctionStats$1>;
2792
2838
  interface FunctionUpdateSchedulingParamsRequest {
2793
2839
  functionId: string;
2794
2840
  warmPoolSizeOverride: number;
@@ -3865,6 +3911,11 @@ interface SandboxGetFromNameRequest {
3865
3911
  sandboxName: string;
3866
3912
  environmentName: string;
3867
3913
  appName: string;
3914
+ /**
3915
+ * When set, the lookup also considers sandboxes that have already stopped and
3916
+ * returns the most recently created sandbox with the given name.
3917
+ */
3918
+ includeTerminated: boolean;
3868
3919
  }
3869
3920
  declare const SandboxGetFromNameRequest: MessageFns$1<SandboxGetFromNameRequest>;
3870
3921
  interface SandboxGetFromNameResponse {
@@ -4230,14 +4281,14 @@ interface ServerGetTimeRangeStatsResponse {
4230
4281
  requestRatePerSecond: number;
4231
4282
  /** Metrics include request_latency, subject to change as requirements evolve. */
4232
4283
  requestPercentileStats: {
4233
- [key: string]: StatsPercentileDistribution;
4284
+ [key: string]: StatsPercentileDistribution$1;
4234
4285
  };
4235
4286
  /**
4236
4287
  * Metrics include startup_time, cpu_usage, memory_usage, and
4237
4288
  * gpu_utilization, subject to change as requirements evolve.
4238
4289
  */
4239
4290
  containerPercentileStats: {
4240
- [key: string]: StatsPercentileDistribution;
4291
+ [key: string]: StatsPercentileDistribution$1;
4241
4292
  };
4242
4293
  /** Absent when the image does not contain a supported inference engine. */
4243
4294
  inference: ServerGetTimeRangeStatsResponse_ServerInferenceStats | undefined;
@@ -4261,7 +4312,7 @@ interface ServerGetTimeRangeStatsResponse_ServerInferenceStats {
4261
4312
  * end_to_end_latency, subject to change as requirements evolve.
4262
4313
  */
4263
4314
  percentileStats: {
4264
- [key: string]: StatsPercentileDistribution;
4315
+ [key: string]: StatsPercentileDistribution$1;
4265
4316
  };
4266
4317
  /**
4267
4318
  * Metrics include input_tokens_per_second, cached_input_tokens_per_second,
@@ -4402,18 +4453,18 @@ interface SharedVolumeRemoveFileRequest {
4402
4453
  recursive: boolean;
4403
4454
  }
4404
4455
  declare const SharedVolumeRemoveFileRequest: MessageFns$1<SharedVolumeRemoveFileRequest>;
4405
- interface StatsPercentile {
4456
+ interface StatsPercentile$1 {
4406
4457
  /** The percentile expressed in basis points: 5000 is p50 and 9990 is p99.9. */
4407
4458
  percentileBasisPoints: number;
4408
4459
  value: number;
4409
4460
  }
4410
- declare const StatsPercentile: MessageFns$1<StatsPercentile>;
4411
- interface StatsPercentileDistribution {
4461
+ declare const StatsPercentile$1: MessageFns$1<StatsPercentile$1>;
4462
+ interface StatsPercentileDistribution$1 {
4412
4463
  /** Unit identifier such as "seconds", "cores", "gibibytes", or "fraction". */
4413
4464
  unit: string;
4414
- percentiles: StatsPercentile[];
4465
+ percentiles: StatsPercentile$1[];
4415
4466
  }
4416
- declare const StatsPercentileDistribution: MessageFns$1<StatsPercentileDistribution>;
4467
+ declare const StatsPercentileDistribution$1: MessageFns$1<StatsPercentileDistribution$1>;
4417
4468
  interface StringMap {
4418
4469
  contents: {
4419
4470
  [key: string]: string;
@@ -5438,6 +5489,14 @@ declare const ModalClientDefinition: {
5438
5489
  readonly responseStream: false;
5439
5490
  readonly options: {};
5440
5491
  };
5492
+ readonly clusterReservationList: {
5493
+ readonly name: "ClusterReservationList";
5494
+ readonly requestType: MessageFns$1<ClusterReservationListRequest>;
5495
+ readonly requestStream: false;
5496
+ readonly responseType: MessageFns$1<ClusterReservationListResponse>;
5497
+ readonly responseStream: false;
5498
+ readonly options: {};
5499
+ };
5441
5500
  /** Container */
5442
5501
  readonly containerCheckpoint: {
5443
5502
  readonly name: "ContainerCheckpoint";
@@ -5987,7 +6046,7 @@ declare const ModalClientDefinition: {
5987
6046
  readonly name: "FunctionGetCurrentStats";
5988
6047
  readonly requestType: MessageFns$1<FunctionGetCurrentStatsRequest>;
5989
6048
  readonly requestStream: false;
5990
- readonly responseType: MessageFns$1<FunctionStats>;
6049
+ readonly responseType: MessageFns$1<FunctionStats$1>;
5991
6050
  readonly responseStream: false;
5992
6051
  readonly options: {};
5993
6052
  };
@@ -7828,6 +7887,39 @@ interface FunctionCurrentStats {
7828
7887
  backlog: number;
7829
7888
  numTotalRunners: number;
7830
7889
  }
7890
+ interface StatsPercentile {
7891
+ percentile: number;
7892
+ value: number;
7893
+ }
7894
+ interface StatsPercentileDistribution {
7895
+ unit: string;
7896
+ percentiles: StatsPercentile[];
7897
+ }
7898
+ interface FunctionStats {
7899
+ since: Date;
7900
+ until: Date;
7901
+ inputSuccessCount: number;
7902
+ inputFailureCount: number;
7903
+ inputTimeoutCount: number;
7904
+ inputRunningAtEndCount: number;
7905
+ containerStartedCount: number;
7906
+ containerErrorCount: number;
7907
+ containerCreatingAtEndCount: number;
7908
+ variantCount: number;
7909
+ inputPercentileStats: Record<string, StatsPercentileDistribution>;
7910
+ containerPercentileStats: Record<string, StatsPercentileDistribution>;
7911
+ allVariants: boolean;
7912
+ }
7913
+ interface FunctionStatsParams {
7914
+ /** Inclusive start; defaults to one hour before until. */
7915
+ since?: Date;
7916
+ /** Exclusive end; defaults to the current time. */
7917
+ until?: Date;
7918
+ /** Restrict statistics to this container ID. */
7919
+ container?: string;
7920
+ /** Aggregate the base Function and its variants. Defaults to false. */
7921
+ allVariants?: boolean;
7922
+ }
7831
7923
  /** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */
7832
7924
  interface FunctionUpdateAutoscalerParams {
7833
7925
  minContainers?: number;
@@ -7906,6 +7998,29 @@ declare class Function_ {
7906
7998
  instance(): Promise<Function_>;
7907
7999
  remote(args?: any[], kwargs?: Record<string, any>): Promise<any>;
7908
8000
  spawn(args?: any[], kwargs?: Record<string, any>): Promise<FunctionCall>;
8001
+ /**
8002
+ * Return historical statistics. Defaults to the last hour; the maximum range is 7 days.
8003
+ *
8004
+ * @example Read statistics for the last hour.
8005
+ * ```ts
8006
+ * const fn = await modal.functions.fromName("libmodal-test-support", "echo_string");
8007
+ * const stats = await fn.stats();
8008
+ * console.log(stats.inputSuccessCount, stats.inputFailureCount);
8009
+ * ```
8010
+ *
8011
+ * @example Include all variants over the last 24 hours.
8012
+ * ```ts
8013
+ * const until = new Date();
8014
+ * const since = new Date(until.getTime() - 24 * 60 * 60 * 1000);
8015
+ * const variantStats = await fn.stats({ since, until, allVariants: true });
8016
+ * for (const [metric, distribution] of Object.entries(variantStats.inputPercentileStats)) {
8017
+ * console.log(metric, distribution.unit, distribution.percentiles);
8018
+ * }
8019
+ * ```
8020
+ *
8021
+ * Set `container` to a container ID to restrict statistics to that container.
8022
+ */
8023
+ stats(params?: FunctionStatsParams): Promise<FunctionStats>;
7909
8024
  getCurrentStats(): Promise<FunctionCurrentStats>;
7910
8025
  updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise<FunctionAutoscalerSettings>;
7911
8026
  /**
@@ -10208,4 +10323,4 @@ declare class ClientClosedError extends Error {
10208
10323
 
10209
10324
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10210
10325
 
10211
- export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
10326
+ export { AlreadyExistsError, App, type AppFromNameParams, AppService, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };