@eyepop.ai/eyepop 3.26.0-rc.2 → 3.26.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.
@@ -64,6 +64,13 @@ interface Prediction extends StreamTime {
64
64
  source_url?: string;
65
65
  source_type?: string;
66
66
  system_timestamp?: number;
67
+ /**
68
+ * Compute units the frame's remote calls (a VLM ability's calls to vlm-server) used, in whole units. Absent
69
+ * when they used none, as for a local model.
70
+ */
71
+ compute_units?: number;
72
+ /** The same in milli compute units; from prediction version 4. */
73
+ milli_compute_units?: number;
67
74
  objects?: Array<PredictedObject>;
68
75
  classes?: Array<PredictedClass>;
69
76
  texts?: Array<PredictedText>;
@@ -665,6 +672,16 @@ interface InferRequest {
665
672
  refresh?: boolean;
666
673
  transform_into?: TransformInto;
667
674
  response_schema?: ResponseSchema;
675
+ /**
676
+ * Auto-label task. The worker derives the prompt and output schema from the task and
677
+ * `prompts`, so `text_prompt`, `transform_into` and `response_schema` must be unset.
678
+ * Object detection returns `objects`, image classification `classes`, each labeled with a
679
+ * prompt's label. A task takes one image. Leave `config.max_new_tokens` unset to use the
680
+ * worker's default, which leaves room for a detection answer.
681
+ */
682
+ task?: AutoAnnotateTask;
683
+ /** Labels and what each one means, for `task`; required with a task. */
684
+ prompts?: AutoAnnotatePrompt[];
668
685
  }
669
686
  interface EvaluateFilter {
670
687
  partitions?: string[];
@@ -746,13 +763,27 @@ interface AbilityAliasEntry {
746
763
  alias: string;
747
764
  tag: string;
748
765
  }
766
+ /**
767
+ * A VLM ability runs in one of two modes:
768
+ * - free-form: `text_prompt`, optionally with `transform_into` and `response_schema`;
769
+ * - task: `task` with a non-empty `prompts`. The worker derives the prompt and output schema
770
+ * from them, as for {@link InferRequest.task}, so `text_prompt`, `transform_into` and
771
+ * `response_schema` must be unset.
772
+ *
773
+ * `DataEndpoint.createVlmAbility` refuses a create that mixes the two or has neither.
774
+ */
749
775
  interface VlmAbilityCreate {
750
776
  name: string;
751
777
  description: string;
752
778
  worker_release: string;
753
- text_prompt: string;
754
- transform_into: TransformInto;
779
+ /** The prompt of a free-form ability; required unless `task` is set. */
780
+ text_prompt?: string;
781
+ transform_into?: TransformInto;
755
782
  response_schema?: ResponseSchema;
783
+ /** Auto-label task; see {@link InferRequest.task}. Excludes `text_prompt`, `transform_into` and `response_schema`. */
784
+ task?: AutoAnnotateTask;
785
+ /** Labels and what each one means, for `task`; required and non-empty with a task. */
786
+ prompts?: AutoAnnotatePrompt[];
756
787
  config: InferRuntimeConfig;
757
788
  is_public: boolean;
758
789
  video_chunk_length_ns?: number;
@@ -765,6 +796,8 @@ interface VlmAbilityUpdate {
765
796
  text_prompt?: string;
766
797
  transform_into?: TransformInto;
767
798
  response_schema?: ResponseSchema;
799
+ task?: AutoAnnotateTask;
800
+ prompts?: AutoAnnotatePrompt[];
768
801
  config?: InferRuntimeConfig;
769
802
  is_public?: boolean;
770
803
  video_chunk_length_ns?: number;
@@ -784,6 +817,8 @@ interface VlmAbility {
784
817
  text_prompt?: string;
785
818
  transform_into?: TransformInto;
786
819
  response_schema?: ResponseSchema;
820
+ task?: AutoAnnotateTask;
821
+ prompts?: AutoAnnotatePrompt[];
787
822
  config?: InferRuntimeConfig;
788
823
  video_chunk_length_ns?: number;
789
824
  video_chunk_overlap?: number;
@@ -990,6 +1025,12 @@ interface AssetUuidSource {
990
1025
  type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
991
1026
  interface ResultStream extends AsyncIterable<Prediction> {
992
1027
  cancel(): void;
1028
+ /**
1029
+ * What the stream's remote calls (a VLM ability's calls to vlm-server) used so far, in milli compute units:
1030
+ * a running total while it runs, its total once it ended. Undefined until reported, and where a backend does
1031
+ * not report it; a local model reports none. Informational: the called API bills its calls itself.
1032
+ */
1033
+ readonly milliComputeUnits?: number | undefined;
993
1034
  }
994
1035
  declare enum PopComponentType {
995
1036
  FORWARD = "forward",
@@ -1315,9 +1356,15 @@ interface Options {
1315
1356
  */
1316
1357
  apiKey?: string | undefined;
1317
1358
  /**
1318
- * Bearer token accepted by the compute API.
1359
+ * Bearer token accepted by the compute API: a login token, which the SDK exchanges at the
1360
+ * compute API, or an already exchanged token, which it uses as is.
1319
1361
  */
1320
1362
  accessToken?: string | undefined;
1363
+ /**
1364
+ * The account a login token (`accessToken` or `oAuth2`) is exchanged for, sent to the compute API
1365
+ * as `account_uuid`. Needed when the user has no single account to pick.
1366
+ */
1367
+ accountId?: string | undefined;
1321
1368
  /**
1322
1369
  * Temporary authentication token for client side execution.
1323
1370
  */
@@ -1415,6 +1462,7 @@ declare class Endpoint<T extends Endpoint<T>> {
1415
1462
  protected _options: Options;
1416
1463
  private _token;
1417
1464
  private _expire_token_time;
1465
+ private _exchanging;
1418
1466
  protected _client: HttpClient | null;
1419
1467
  private _statusRetryHandlers;
1420
1468
  protected _limit: Semaphore;
@@ -1435,11 +1483,19 @@ declare class Endpoint<T extends Endpoint<T>> {
1435
1483
  connect(): Promise<T>;
1436
1484
  disconnect(wait?: boolean): Promise<void>;
1437
1485
  session(): Promise<Session>;
1438
- protected statusHandler401(_statusCode: number): void;
1486
+ protected statusHandler401(_statusCode: number, failedToken?: string | null): void;
1439
1487
  protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
1440
1488
  protected reconnect(): Promise<T>;
1441
1489
  protected authorizationHeader(): Promise<string>;
1490
+ private exchange;
1491
+ private storeExchangedToken;
1492
+ /**
1493
+ * A token that already carries an account, or that the compute API refuses to exchange
1494
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
1495
+ */
1496
+ private exchangeLoginToken;
1442
1497
  private currentAccessToken;
1498
+ private authenticate;
1443
1499
  }
1444
1500
 
1445
1501
  /**
@@ -1625,9 +1681,15 @@ declare class InferAssetJob implements ResultStream {
1625
1681
  protected _inferRequest: InferRequest;
1626
1682
  protected _response: Promise<Prediction[]> | null;
1627
1683
  protected _runInfo: InferRunInfo | null;
1684
+ protected _milliComputeUnits: number | undefined;
1628
1685
  protected _controller: AbortController;
1629
1686
  protected _requestLogger: Logger;
1630
1687
  [Symbol.asyncIterator](): AsyncIterator<Prediction>;
1688
+ /**
1689
+ * The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
1690
+ * or when it reported none.
1691
+ */
1692
+ get milliComputeUnits(): number | undefined;
1631
1693
  constructor(assetUrl: string, inferRequest: InferRequest, vlmFetch: VlmFetch, requestLogger: Logger);
1632
1694
  start(done: () => void): InferAssetJob;
1633
1695
  cancel(): void;
@@ -1651,6 +1713,30 @@ declare class EyePopDataWebSocketError extends Error {
1651
1713
  readonly sourceError: unknown;
1652
1714
  constructor(url: string, event: unknown);
1653
1715
  }
1716
+ /** Why `createVlmAbility` or `updateVlmAbility` refused an ability's mode fields. */
1717
+ declare enum VlmAbilityModeErrorReason {
1718
+ /** Neither a non-empty `text_prompt` nor `task` is set (create only). */
1719
+ missing_mode = "missing_mode",
1720
+ /** `task` is not an `AutoAnnotateTask`. */
1721
+ unknown_task = "unknown_task",
1722
+ /** `task` or `prompts` is set together with `text_prompt`, `transform_into` or `response_schema`. */
1723
+ task_excludes_free_form = "task_excludes_free_form",
1724
+ /** `task` is set without `prompts` (create only). */
1725
+ task_without_prompts = "task_without_prompts",
1726
+ /** `prompts` is set without `task` (create only). */
1727
+ prompts_without_task = "prompts_without_task",
1728
+ /** `prompts` is empty or not a list. */
1729
+ empty_prompts = "empty_prompts",
1730
+ /** An entry of `prompts` lacks a non-empty `label` or `prompt`. */
1731
+ invalid_prompt = "invalid_prompt"
1732
+ }
1733
+ /** Thrown, before any request, for a VLM ability that is neither free-form nor a task, or mixes them. */
1734
+ declare class VlmAbilityModeError extends Error {
1735
+ readonly reason: VlmAbilityModeErrorReason;
1736
+ /** The fields at fault, for example the free-form fields set next to a task, or `prompts[0]`. */
1737
+ readonly fields: string[];
1738
+ constructor(reason: VlmAbilityModeErrorReason, message: string, fields?: string[]);
1739
+ }
1654
1740
  declare class DataEndpoint extends Endpoint<DataEndpoint> {
1655
1741
  private datasetApiUrl;
1656
1742
  private vlmApiUrl;
@@ -2101,8 +2187,13 @@ declare class PipelineJob implements ResultStream {
2101
2187
  readonly whenCancelled: Promise<void>;
2102
2188
  openSource: OpenSource | null;
2103
2189
  stopOnPipeline: (() => void) | null;
2190
+ private _milliComputeUnits;
2104
2191
  constructor(source: Message, media: Media[], live: boolean, params: ProcessParams, mediaStream?: MediaStream | undefined);
2105
2192
  get cancelled(): boolean;
2193
+ /** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
2194
+ get milliComputeUnits(): number | undefined;
2195
+ /** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
2196
+ noteMilliComputeUnits(message: Message): void;
2106
2197
  command(id: string): Message;
2107
2198
  predicted(prediction: Prediction): void;
2108
2199
  finish(error?: Error | null): void;
@@ -2315,4 +2406,4 @@ declare namespace EyePop {
2315
2406
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
2316
2407
  }
2317
2408
 
2318
- export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, COMBINED_UPLOAD_MAX_BYTES, type Camera, type CameraDistortion, type CameraExtrinsics, type CameraIntrinsics, type ChangeEvent, ChangeType, type ClassificationTask, type CloudBounds, type CloudBox, type ComponentFinderComponent, type ComponentParams, ComputeAccountMismatchError, ComputeApiError, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type Depth, DepthMap, type DepthSemantic, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyePopDataWebSocketError, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, MAX_OPEN_SOURCES, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, PIPELINE_PATH, PIPELINE_SOCKETS, type PathSource, PipelineBackend, PipelineCommandError, PipelineConfigurationError, type PipelineConfigurationProblem, PipelineJob, PipelineSocketClosedError, PipelineSourceError, type PlatformSupport, type Point2d, type Point3d, PointCloud, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopDepthMap, type PopForward, type PopForwardOperator, type PopSelect, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, QUATERNION_TOLERANCE, type QcAiHubExportParams, type Quaternion, type RectangleArea, type ResponseSchema, type ResultStream, type Roi, SUBPROTOCOL, SelectMode, Semaphore, type Session, type SessionAuth, SessionBackend, type Source, type SourceDefaults, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, type Vector3, type Vector3d, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, type WorkerBackend, type WorkerContext, WorkerEndpoint, type WorkerOptions, type WorkerSession, type WorkerWork, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, cloudOfDepth, cloudOfObject, cloudsOfPrediction, decodeDepthMap, decodePointCloud, EyePop as default, encodeMultipartFormData, getBaseUrl, isSelectOperator, popSelects, randomMultipartBoundary, readableStreamFromString, resolveAuth, validateCamera, validatePop };
2409
+ export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, COMBINED_UPLOAD_MAX_BYTES, type Camera, type CameraDistortion, type CameraExtrinsics, type CameraIntrinsics, type ChangeEvent, ChangeType, type ClassificationTask, type CloudBounds, type CloudBox, type ComponentFinderComponent, type ComponentParams, ComputeAccountMismatchError, ComputeApiError, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type Depth, DepthMap, type DepthSemantic, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyePopDataWebSocketError, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, MAX_OPEN_SOURCES, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, PIPELINE_PATH, PIPELINE_SOCKETS, type PathSource, PipelineBackend, PipelineCommandError, PipelineConfigurationError, type PipelineConfigurationProblem, PipelineJob, PipelineSocketClosedError, PipelineSourceError, type PlatformSupport, type Point2d, type Point3d, PointCloud, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopDepthMap, type PopForward, type PopForwardOperator, type PopSelect, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, QUATERNION_TOLERANCE, type QcAiHubExportParams, type Quaternion, type RectangleArea, type ResponseSchema, type ResultStream, type Roi, SUBPROTOCOL, SelectMode, Semaphore, type Session, type SessionAuth, SessionBackend, type Source, type SourceDefaults, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, type Vector3, type Vector3d, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityModeError, VlmAbilityModeErrorReason, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, type WorkerBackend, type WorkerContext, WorkerEndpoint, type WorkerOptions, type WorkerSession, type WorkerWork, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, cloudOfDepth, cloudOfObject, cloudsOfPrediction, decodeDepthMap, decodePointCloud, EyePop as default, encodeMultipartFormData, getBaseUrl, isSelectOperator, popSelects, randomMultipartBoundary, readableStreamFromString, resolveAuth, validateCamera, validatePop };
@@ -64,6 +64,13 @@ interface Prediction extends StreamTime {
64
64
  source_url?: string;
65
65
  source_type?: string;
66
66
  system_timestamp?: number;
67
+ /**
68
+ * Compute units the frame's remote calls (a VLM ability's calls to vlm-server) used, in whole units. Absent
69
+ * when they used none, as for a local model.
70
+ */
71
+ compute_units?: number;
72
+ /** The same in milli compute units; from prediction version 4. */
73
+ milli_compute_units?: number;
67
74
  objects?: Array<PredictedObject>;
68
75
  classes?: Array<PredictedClass>;
69
76
  texts?: Array<PredictedText>;
@@ -665,6 +672,16 @@ interface InferRequest {
665
672
  refresh?: boolean;
666
673
  transform_into?: TransformInto;
667
674
  response_schema?: ResponseSchema;
675
+ /**
676
+ * Auto-label task. The worker derives the prompt and output schema from the task and
677
+ * `prompts`, so `text_prompt`, `transform_into` and `response_schema` must be unset.
678
+ * Object detection returns `objects`, image classification `classes`, each labeled with a
679
+ * prompt's label. A task takes one image. Leave `config.max_new_tokens` unset to use the
680
+ * worker's default, which leaves room for a detection answer.
681
+ */
682
+ task?: AutoAnnotateTask;
683
+ /** Labels and what each one means, for `task`; required with a task. */
684
+ prompts?: AutoAnnotatePrompt[];
668
685
  }
669
686
  interface EvaluateFilter {
670
687
  partitions?: string[];
@@ -746,13 +763,27 @@ interface AbilityAliasEntry {
746
763
  alias: string;
747
764
  tag: string;
748
765
  }
766
+ /**
767
+ * A VLM ability runs in one of two modes:
768
+ * - free-form: `text_prompt`, optionally with `transform_into` and `response_schema`;
769
+ * - task: `task` with a non-empty `prompts`. The worker derives the prompt and output schema
770
+ * from them, as for {@link InferRequest.task}, so `text_prompt`, `transform_into` and
771
+ * `response_schema` must be unset.
772
+ *
773
+ * `DataEndpoint.createVlmAbility` refuses a create that mixes the two or has neither.
774
+ */
749
775
  interface VlmAbilityCreate {
750
776
  name: string;
751
777
  description: string;
752
778
  worker_release: string;
753
- text_prompt: string;
754
- transform_into: TransformInto;
779
+ /** The prompt of a free-form ability; required unless `task` is set. */
780
+ text_prompt?: string;
781
+ transform_into?: TransformInto;
755
782
  response_schema?: ResponseSchema;
783
+ /** Auto-label task; see {@link InferRequest.task}. Excludes `text_prompt`, `transform_into` and `response_schema`. */
784
+ task?: AutoAnnotateTask;
785
+ /** Labels and what each one means, for `task`; required and non-empty with a task. */
786
+ prompts?: AutoAnnotatePrompt[];
756
787
  config: InferRuntimeConfig;
757
788
  is_public: boolean;
758
789
  video_chunk_length_ns?: number;
@@ -765,6 +796,8 @@ interface VlmAbilityUpdate {
765
796
  text_prompt?: string;
766
797
  transform_into?: TransformInto;
767
798
  response_schema?: ResponseSchema;
799
+ task?: AutoAnnotateTask;
800
+ prompts?: AutoAnnotatePrompt[];
768
801
  config?: InferRuntimeConfig;
769
802
  is_public?: boolean;
770
803
  video_chunk_length_ns?: number;
@@ -784,6 +817,8 @@ interface VlmAbility {
784
817
  text_prompt?: string;
785
818
  transform_into?: TransformInto;
786
819
  response_schema?: ResponseSchema;
820
+ task?: AutoAnnotateTask;
821
+ prompts?: AutoAnnotatePrompt[];
787
822
  config?: InferRuntimeConfig;
788
823
  video_chunk_length_ns?: number;
789
824
  video_chunk_overlap?: number;
@@ -990,6 +1025,12 @@ interface AssetUuidSource {
990
1025
  type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
991
1026
  interface ResultStream extends AsyncIterable<Prediction> {
992
1027
  cancel(): void;
1028
+ /**
1029
+ * What the stream's remote calls (a VLM ability's calls to vlm-server) used so far, in milli compute units:
1030
+ * a running total while it runs, its total once it ended. Undefined until reported, and where a backend does
1031
+ * not report it; a local model reports none. Informational: the called API bills its calls itself.
1032
+ */
1033
+ readonly milliComputeUnits?: number | undefined;
993
1034
  }
994
1035
  declare enum PopComponentType {
995
1036
  FORWARD = "forward",
@@ -1315,9 +1356,15 @@ interface Options {
1315
1356
  */
1316
1357
  apiKey?: string | undefined;
1317
1358
  /**
1318
- * Bearer token accepted by the compute API.
1359
+ * Bearer token accepted by the compute API: a login token, which the SDK exchanges at the
1360
+ * compute API, or an already exchanged token, which it uses as is.
1319
1361
  */
1320
1362
  accessToken?: string | undefined;
1363
+ /**
1364
+ * The account a login token (`accessToken` or `oAuth2`) is exchanged for, sent to the compute API
1365
+ * as `account_uuid`. Needed when the user has no single account to pick.
1366
+ */
1367
+ accountId?: string | undefined;
1321
1368
  /**
1322
1369
  * Temporary authentication token for client side execution.
1323
1370
  */
@@ -1415,6 +1462,7 @@ declare class Endpoint<T extends Endpoint<T>> {
1415
1462
  protected _options: Options;
1416
1463
  private _token;
1417
1464
  private _expire_token_time;
1465
+ private _exchanging;
1418
1466
  protected _client: HttpClient | null;
1419
1467
  private _statusRetryHandlers;
1420
1468
  protected _limit: Semaphore;
@@ -1435,11 +1483,19 @@ declare class Endpoint<T extends Endpoint<T>> {
1435
1483
  connect(): Promise<T>;
1436
1484
  disconnect(wait?: boolean): Promise<void>;
1437
1485
  session(): Promise<Session>;
1438
- protected statusHandler401(_statusCode: number): void;
1486
+ protected statusHandler401(_statusCode: number, failedToken?: string | null): void;
1439
1487
  protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
1440
1488
  protected reconnect(): Promise<T>;
1441
1489
  protected authorizationHeader(): Promise<string>;
1490
+ private exchange;
1491
+ private storeExchangedToken;
1492
+ /**
1493
+ * A token that already carries an account, or that the compute API refuses to exchange
1494
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
1495
+ */
1496
+ private exchangeLoginToken;
1442
1497
  private currentAccessToken;
1498
+ private authenticate;
1443
1499
  }
1444
1500
 
1445
1501
  /**
@@ -1625,9 +1681,15 @@ declare class InferAssetJob implements ResultStream {
1625
1681
  protected _inferRequest: InferRequest;
1626
1682
  protected _response: Promise<Prediction[]> | null;
1627
1683
  protected _runInfo: InferRunInfo | null;
1684
+ protected _milliComputeUnits: number | undefined;
1628
1685
  protected _controller: AbortController;
1629
1686
  protected _requestLogger: Logger;
1630
1687
  [Symbol.asyncIterator](): AsyncIterator<Prediction>;
1688
+ /**
1689
+ * The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
1690
+ * or when it reported none.
1691
+ */
1692
+ get milliComputeUnits(): number | undefined;
1631
1693
  constructor(assetUrl: string, inferRequest: InferRequest, vlmFetch: VlmFetch, requestLogger: Logger);
1632
1694
  start(done: () => void): InferAssetJob;
1633
1695
  cancel(): void;
@@ -1651,6 +1713,30 @@ declare class EyePopDataWebSocketError extends Error {
1651
1713
  readonly sourceError: unknown;
1652
1714
  constructor(url: string, event: unknown);
1653
1715
  }
1716
+ /** Why `createVlmAbility` or `updateVlmAbility` refused an ability's mode fields. */
1717
+ declare enum VlmAbilityModeErrorReason {
1718
+ /** Neither a non-empty `text_prompt` nor `task` is set (create only). */
1719
+ missing_mode = "missing_mode",
1720
+ /** `task` is not an `AutoAnnotateTask`. */
1721
+ unknown_task = "unknown_task",
1722
+ /** `task` or `prompts` is set together with `text_prompt`, `transform_into` or `response_schema`. */
1723
+ task_excludes_free_form = "task_excludes_free_form",
1724
+ /** `task` is set without `prompts` (create only). */
1725
+ task_without_prompts = "task_without_prompts",
1726
+ /** `prompts` is set without `task` (create only). */
1727
+ prompts_without_task = "prompts_without_task",
1728
+ /** `prompts` is empty or not a list. */
1729
+ empty_prompts = "empty_prompts",
1730
+ /** An entry of `prompts` lacks a non-empty `label` or `prompt`. */
1731
+ invalid_prompt = "invalid_prompt"
1732
+ }
1733
+ /** Thrown, before any request, for a VLM ability that is neither free-form nor a task, or mixes them. */
1734
+ declare class VlmAbilityModeError extends Error {
1735
+ readonly reason: VlmAbilityModeErrorReason;
1736
+ /** The fields at fault, for example the free-form fields set next to a task, or `prompts[0]`. */
1737
+ readonly fields: string[];
1738
+ constructor(reason: VlmAbilityModeErrorReason, message: string, fields?: string[]);
1739
+ }
1654
1740
  declare class DataEndpoint extends Endpoint<DataEndpoint> {
1655
1741
  private datasetApiUrl;
1656
1742
  private vlmApiUrl;
@@ -2101,8 +2187,13 @@ declare class PipelineJob implements ResultStream {
2101
2187
  readonly whenCancelled: Promise<void>;
2102
2188
  openSource: OpenSource | null;
2103
2189
  stopOnPipeline: (() => void) | null;
2190
+ private _milliComputeUnits;
2104
2191
  constructor(source: Message, media: Media[], live: boolean, params: ProcessParams, mediaStream?: MediaStream | undefined);
2105
2192
  get cancelled(): boolean;
2193
+ /** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
2194
+ get milliComputeUnits(): number | undefined;
2195
+ /** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
2196
+ noteMilliComputeUnits(message: Message): void;
2106
2197
  command(id: string): Message;
2107
2198
  predicted(prediction: Prediction): void;
2108
2199
  finish(error?: Error | null): void;
@@ -2315,4 +2406,4 @@ declare namespace EyePop {
2315
2406
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
2316
2407
  }
2317
2408
 
2318
- export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, COMBINED_UPLOAD_MAX_BYTES, type Camera, type CameraDistortion, type CameraExtrinsics, type CameraIntrinsics, type ChangeEvent, ChangeType, type ClassificationTask, type CloudBounds, type CloudBox, type ComponentFinderComponent, type ComponentParams, ComputeAccountMismatchError, ComputeApiError, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type Depth, DepthMap, type DepthSemantic, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyePopDataWebSocketError, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, MAX_OPEN_SOURCES, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, PIPELINE_PATH, PIPELINE_SOCKETS, type PathSource, PipelineBackend, PipelineCommandError, PipelineConfigurationError, type PipelineConfigurationProblem, PipelineJob, PipelineSocketClosedError, PipelineSourceError, type PlatformSupport, type Point2d, type Point3d, PointCloud, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopDepthMap, type PopForward, type PopForwardOperator, type PopSelect, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, QUATERNION_TOLERANCE, type QcAiHubExportParams, type Quaternion, type RectangleArea, type ResponseSchema, type ResultStream, type Roi, SUBPROTOCOL, SelectMode, Semaphore, type Session, type SessionAuth, SessionBackend, type Source, type SourceDefaults, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, type Vector3, type Vector3d, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, type WorkerBackend, type WorkerContext, WorkerEndpoint, type WorkerOptions, type WorkerSession, type WorkerWork, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, cloudOfDepth, cloudOfObject, cloudsOfPrediction, decodeDepthMap, decodePointCloud, EyePop as default, encodeMultipartFormData, getBaseUrl, isSelectOperator, popSelects, randomMultipartBoundary, readableStreamFromString, resolveAuth, validateCamera, validatePop };
2409
+ export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, COMBINED_UPLOAD_MAX_BYTES, type Camera, type CameraDistortion, type CameraExtrinsics, type CameraIntrinsics, type ChangeEvent, ChangeType, type ClassificationTask, type CloudBounds, type CloudBox, type ComponentFinderComponent, type ComponentParams, ComputeAccountMismatchError, ComputeApiError, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type Depth, DepthMap, type DepthSemantic, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyePopDataWebSocketError, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, MAX_OPEN_SOURCES, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, PIPELINE_PATH, PIPELINE_SOCKETS, type PathSource, PipelineBackend, PipelineCommandError, PipelineConfigurationError, type PipelineConfigurationProblem, PipelineJob, PipelineSocketClosedError, PipelineSourceError, type PlatformSupport, type Point2d, type Point3d, PointCloud, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopDepthMap, type PopForward, type PopForwardOperator, type PopSelect, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, QUATERNION_TOLERANCE, type QcAiHubExportParams, type Quaternion, type RectangleArea, type ResponseSchema, type ResultStream, type Roi, SUBPROTOCOL, SelectMode, Semaphore, type Session, type SessionAuth, SessionBackend, type Source, type SourceDefaults, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, type Vector3, type Vector3d, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityModeError, VlmAbilityModeErrorReason, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, type WorkerBackend, type WorkerContext, WorkerEndpoint, type WorkerOptions, type WorkerSession, type WorkerWork, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, cloudOfDepth, cloudOfObject, cloudsOfPrediction, decodeDepthMap, decodePointCloud, EyePop as default, encodeMultipartFormData, getBaseUrl, isSelectOperator, popSelects, randomMultipartBoundary, readableStreamFromString, resolveAuth, validateCamera, validatePop };